speculative-decoding

Accelerate LLM inference with speculative decoding, Medusa heads, and Lookahead Decoding.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Accelerate LLM inference by combining speculative decoding, Medusa decoding heads, and Lookahead Decoding to reduce latency and increase throughput.

Core Features & Use Cases

  • Speculative Decoding: use a smaller draft model to generate candidate tokens and verify with the large target model in a single forward pass.
  • Medusa Heads: add multiple decoding heads to predict several future tokens in parallel, eliminating the need for separate draft models.
  • Lookahead Decoding: apply Jacobi-iteration-style parallelization to generate n-grams and verify them efficiently.
  • Production deployment: supports transformers-based models, optional draft components, tree-based verification, and plug-and-play usage for real-time systems.

Quick Start

Install the required libraries and load a model, then run a sample prompt using Speculative, Medusa, or Lookahead to see speedups.

Frequently Asked Questions about speculative-decoding

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

FAQPage Schema
How do I reduce LLM inference latency and increase throughput?

Reduce LLM inference latency by combining speculative decoding, Medusa decoding heads, and Lookahead Decoding to verify candidate tokens in a single forward pass. Apply tree-structured verification to accelerate text generation.

How does Medusa decoding speed up transformer-based models without a draft model?

Medusa decoding heads speed up transformer-based models by adding multiple parallel heads to predict several future tokens simultaneously. This eliminates the need for a separate draft model during speculative decoding.

What is the best way to accelerate LLM inference for chatbots and code assistants?

The best way to accelerate latency-sensitive deployments like chatbots and code assistants is using speculative decoding with plug-and-play tree-based verification. This approach supports transformer-based models and optional draft components.

Can I use Lookahead Decoding with my existing transformer-based model?

Yes, Lookahead Decoding works with transformer-based models by applying Jacobi-iteration-style parallelization. It generates and verifies n-grams efficiently without requiring separate draft heads or additional model components.

Does speculative decoding require a separate draft model to generate candidate tokens?

Speculative decoding can use a smaller draft model to generate candidate tokens verified in a single forward pass, but Medusa heads provide an alternative by predicting multiple future tokens in parallel without a draft model.

When should I use speculative decoding versus Medusa heads for LLM inference?

Use speculative decoding when a smaller draft model is available, or switch to Medusa heads to predict multiple future tokens in parallel without separate draft models. Lookahead Decoding offers Jacobi-iteration-style n-gram verification as another alternative.