emerging-techniques-speculative-decoding
A skill that walks your agent through speculative decoding, Medusa and lookahead decoding to speed up token generation by 1.5–3.6×.
npx claude-code-templates@latest --skill ai-research/emerging-techniques-speculative-decodingWhat emerging-techniques-speculative-decoding does
Three ways to make an LLM answer faster are covered here: a small draft model that proposes tokens for a larger one to verify, Medusa with extra prediction heads, and lookahead decoding built on Jacobi iteration. The agent gets Python snippets: loading target and draft models with transformers, calling medusa_generate with posterior_threshold and posterior_alpha, and setting up LookaheadDecoding with window_size, ngram_size and guess_size.
The algorithm is spelled out too. The draft model guesses K tokens, the target model scores all of them in a single forward pass, and matching ones are kept. Medusa builds a tree of candidates, and the skill separates Medusa-1, where only the heads are trained, from Medusa-2, where the base model is fine-tuned as well.
Examples rely on transformers and torch. Medusa and lookahead decoding each need their own repository cloned and installed with pip install -e ., so without those dependencies the snippets will not run.
What it helps with
- speed up token generation without retraining the model
- cut latency in a chatbot or code generator
- pick between a draft model, Medusa and lookahead decoding
- run inference on limited hardware
- understand how the target model verifies candidates in parallel
Example prompts for the agent
- Show me how to pass a draft model to
generateviaassistant_model - Compare Medusa-1 and Medusa-2 on speed and quality
- Set up
LookaheadDecodingwithwindow_size=15andngram_size=5
How to install emerging-techniques-speculative-decoding
1claude-code-templates
npx claude-code-templates@latest --skill ai-research/emerging-techniques-speculative-decoding2Skills CLI (Vercel)
npx skills add davila7/claude-code-templates --skill emerging-techniques-speculative-decoding -a claude-code3Manually: put the files in place
~/.claude/skills/emerging-techniques-speculative-decoding/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/emerging-techniques-speculative-decoding/
Manually: put the files in place
.agents/skills/emerging-techniques-speculative-decoding/SKILL.mdFor all projects use ~/.agents/skills/
Manually: put the files in place
.cursor/skills/emerging-techniques-speculative-decoding/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install davila7/claude-code-templates emerging-techniques-speculative-decoding2Manually: put the files in place
.github/skills/emerging-techniques-speculative-decoding/SKILL.mdPlatform CLI
gemini skills install https://github.com/davila7/claude-code-templates --path cli-tool/components/skills/ai-research/emerging-techniques-speculative-decodingManually: put the files in place
.devin/skills/emerging-techniques-speculative-decoding/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about emerging-techniques-speculative-decoding
How do I install emerging-techniques-speculative-decoding in Claude Code?
Use the marketplace: first npx claude-code-templates@latest --skill ai-research/emerging-techniques-speculative-decoding, then npx skills add davila7/claude-code-templates --skill emerging-techniques-speculative-decoding -a claude-code. The skill file lands at ~/.claude/skills/emerging-techniques-speculative-decoding/SKILL.md.
What does this skill do?
It hands the agent techniques for faster LLM inference: speculative decoding with a draft model, Medusa with multiple heads, and lookahead decoding. Code samples and algorithm notes are included.
What do the examples need to run?
The transformers and torch packages. Medusa and lookahead decoding also require cloning their repositories and installing them with pip install -e ..