speculative-decoding

Implements speculative decoding to accelerate LLM inference latency and throughput using torch models.

Updated Apr 11, 2026
One-click install
npx skills add https://github.com/hhhi21g/HealthCenter --skill speculative-decoding-hhhi21g
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: speculative-decoding
Source: https://github.com/hhhi21g/HealthCenter/tree/main/.codex/skills/speculative-decoding
Command: npx skills add https://github.com/hhhi21g/HealthCenter --skill speculative-decoding-hhhi21g

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires transformers, torch, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill enhances the speed of language model inference by implementing speculative decoding techniques, reducing latency for real-time applications and optimizing throughput on limited hardware.

Core Features & Use Cases

  • Speculative Decoding: Leverages small draft models to generate candidate tokens, while a large target model verifies them in parallel.
  • Medusa: Adds multiple prediction heads to the base model for parallel token generation.
  • Lookahead Decoding: Uses Jacobi iteration to parallelize n-gram generation and verification.
  • Use Case: Ideal for chatbots, code generation, and high-volume serving scenarios where real-time response is crucial.

Quick Start

Run the 'speculative-decoding' skill to generate a summary of the latest research on speculative decoding techniques.

Frequently Asked Questions about speculative-decoding

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I accelerate language model inference for real-time applications?

Speculative decoding accelerates language model inference by using small draft models to generate candidate tokens while a large target model verifies them in parallel, reducing latency for real-time applications and optimizing throughput on limited hardware.

What is the best way to parallelize token generation in PyTorch?

Speculative decoding parallelizes token generation in PyTorch by adding multiple Medusa prediction heads to the base model or using Jacobi iteration for lookahead decoding to verify n-grams in parallel.

Does speculative decoding work with the transformers library?

Yes, speculative decoding works with the transformers library. It requires both transformers and torch dependencies for model execution to accelerate inference in high-volume serving scenarios like chatbots and code generation.

How does lookahead decoding compare to using draft models for inference acceleration?

Lookahead decoding uses Jacobi iteration to parallelize n-gram generation and verification, whereas draft model methods leverage a small model for candidate token generation that a large target model verifies in parallel.

When should I use speculative decoding for LLM inference?

You should use speculative decoding for LLM inference in real-time applications like chatbots, code generation, and high-volume serving scenarios where high throughput and low latency are crucial.