speculative-decoding

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

2|Updated Apr 12, 2026
One-click install
npx skills add https://github.com/Clay-HHK/claude-config --skill speculative-decoding-clay-hhk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: speculative-decoding
Source: https://github.com/Clay-HHK/claude-config/tree/main/skills/AI-research-SKILLs/19-emerging-techniques/speculative-decoding
Command: npx skills add https://github.com/Clay-HHK/claude-config --skill speculative-decoding-clay-hhk

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Speculative decoding, Medusa, and Lookahead decoding address the latency and throughput bottlenecks of autoregressive LLM inference by enabling parallel exploration of candidate tokens and reducing sequential steps.

Core Features & Use Cases

  • Speculative Decoding: uses a small draft model to generate candidate tokens while the large target model verifies in parallel.
  • Medusa: adds multiple decoding heads and a tree-based attention scheme to evaluate multiple future tokens in a single forward pass.
  • Lookahead Decoding: generates disjoint n-grams in parallel with a verification branch to confirm high-likelihood continuations.
  • Real-time chat, code generation, and edge deployments with limited compute.

Quick Start

Configure Medusa with four heads on a Vicuna-7B model and run a prompt to observe speedups.

Frequently Asked Questions about speculative-decoding

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

FAQPage Schema
How does speculative decoding speed up LLM inference?

Speculative decoding accelerates LLM inference by using a small draft model to generate candidate tokens, which the large target model then verifies in parallel, reducing sequential autoregressive steps.

What is the difference between Medusa and Lookahead decoding for parallel token exploration?

Medusa adds multiple decoding heads and tree-based attention to evaluate future tokens in a single forward pass, while Lookahead decoding generates disjoint n-grams in parallel with a verification branch for high-likelihood continuations.

How do I configure Medusa heads for a Vicuna model to improve inference speed?

You can configure Medusa by setting up multiple decoding heads, such as four heads on a Vicuna-7B model, and running a prompt to observe the parallel token evaluation and inference speedups.

Can I use parallel decoding techniques for real-time chat and edge deployments?

Yes, parallel decoding techniques like speculative decoding, Medusa, and Lookahead decoding are suited for real-time chat, code generation, and edge deployments with limited compute resources.

What dependencies are needed to implement tree attention and parallel decoding?

Implementing these parallel decoding techniques requires standard PyTorch and transformers tooling, along with clear setup instructions and references for configuring the tree-based attention and verification branches.