speculative-decoding

Accelerate LLM inference with speculative decoding, Medusa heads, and lookahead decoding.

6|3|Updated Jan 29, 2026
One-click install
npx skills add https://github.com/jonnabio/ace-framework --skill speculative-decoding-jonnabio
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: speculative-decoding
Source: https://github.com/jonnabio/ace-framework/tree/main/.ace/packs/ai-research/speculative-decoding
Command: npx skills add https://github.com/jonnabio/ace-framework --skill speculative-decoding-jonnabio

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill addresses the challenge of slow LLM inference times, providing a solution that accelerates processing while maintaining quality.

Core Features & Use Cases

  • Speculative Decoding: Uses a smaller, faster model to generate speculative candidates, which are then verified by a larger, more accurate model.
  • Medusa Multiple Heads: Utilizes multiple decoding heads to predict future tokens in parallel, enhancing speed without sacrificing quality.
  • Lookahead Decoding: Applies Jacobi iteration to parallelize the generation of n-grams, improving throughput.
  • Use Case: Ideal for real-time applications that require fast inference, such as chatbots and code generation.

Quick Start

Generate an inference with speculative decoding for the prompt 'Tell me about AI' using the Llama-2-70b model and Llama-2-7b draft model.

Frequently Asked Questions about speculative-decoding

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

FAQPage Schema
How can I accelerate LLM inference for real-time applications like chatbots?

You can accelerate LLM inference using speculative decoding techniques like Medusa multiple heads and lookahead decoding to parallelize token generation and significantly reduce latency for real-time applications.

What is speculative decoding and how does it speed up large language models?

Speculative decoding speeds up large language models by using a smaller, faster draft model to generate speculative candidate tokens, which a larger, more accurate model then verifies in parallel.

How do I implement Medusa multiple heads for parallel token generation in PyTorch?

You can implement Medusa multiple heads using PyTorch and Transformers to predict future tokens in parallel via multiple decoding heads, enhancing inference speed without sacrificing output quality.

Does speculative decoding work with the Hugging Face Transformers library?

Yes, speculative decoding works with the Hugging Face Transformers library, requiring both Transformers and PyTorch dependencies to execute draft model verification and parallel token generation.

What is the best way to improve LLM throughput using Jacobi iteration?

The best way to improve LLM throughput using Jacobi iteration is through lookahead decoding, which parallelizes the generation of n-grams to maximize inference speed and overall processing efficiency.

When should I use lookahead decoding instead of a draft model for inference acceleration?

You should use lookahead decoding when you want to parallelize n-gram generation via Jacobi iteration without training a separate draft model, whereas speculative decoding requires a smaller model for candidate generation.