Skip to main content
skill

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×.

Install into Claude Code · claude-code-templates All methods and platforms ↓
npx claude-code-templates@latest --skill ai-research/emerging-techniques-speculative-decoding
Open on GitHub

What 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 generate via assistant_model
  • Compare Medusa-1 and Medusa-2 on speed and quality
  • Set up LookaheadDecoding with window_size=15 and ngram_size=5

How to install emerging-techniques-speculative-decoding

1claude-code-templates

npx claude-code-templates@latest --skill ai-research/emerging-techniques-speculative-decoding

2Skills CLI (Vercel)

npx skills add davila7/claude-code-templates --skill emerging-techniques-speculative-decoding -a claude-code

3Manually: put the files in place

~/.claude/skills/emerging-techniques-speculative-decoding/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/emerging-techniques-speculative-decoding/

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 ..

Similar skills

All skills for AI and ML →

From the same set361

The whole set →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor