speculative-decoding

speculative-decoding is a skill for Claude Code, Codex from synthetic-sciences/openscience. It costs 77 tokens per session (3,744 once invoked), scanned A, a copy of emerging-techniques-speculative-decoding, Apache-2.0.

A collection of techniques that use a smaller draft model or extra prediction heads to help a larger language model produce tokens faster.

In plain words
What is it for?
Use it to speed up chatbots, code generation, and high-volume language-model serving, including deployments on limited hardware.
Why use it?
It can reduce response time and increase throughput without changing the larger model's intended output quality.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to speed up chatbots, code generation, and high-volume language-model serving, including deployments on limited hardware.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/synthetic-sciences/openscience/speculative-decoding
About the project

synthetic-sciences/openscience is an AI workbench that carries out scientific research by reading papers, forming hypotheses, writing and running code, conducting experiments, analyzing results, and preparing reports. Researchers use it for work in machine learning, biology, physics, and chemistry with remote or local models. Catalogue add-ons extend its scientific workflows through skills and instructions.

synthetic-sciences/openscience · 4,357 stars · on GitHub · openscience.sh

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add synthetic-sciences/openscience --skill speculative-decoding
Clone the repo
git clone --depth 1 https://github.com/synthetic-sciences/openscience

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for speculative-decoding

README.md
[![agentmods](https://agentmods.dev/badge/skills/synthetic-sciences/openscience/speculative-decoding/github.svg)](https://agentmods.dev/skills/synthetic-sciences/openscience/speculative-decoding)
Your own site
<a href="https://agentmods.dev/skills/synthetic-sciences/openscience/speculative-decoding"><img src="https://agentmods.dev/badge/skills/synthetic-sciences/openscience/speculative-decoding/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for speculative-decoding

Your own site · 80×15
<a href="https://agentmods.dev/skills/synthetic-sciences/openscience/speculative-decoding"><img src="https://agentmods.dev/badge/skills/synthetic-sciences/openscience/speculative-decoding.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 77 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,744 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 98% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00077 $0.03744
Opus 5.5 $0.00031 $0.01498
Sonnet 5.5 $0.00015 $0.00749
Haiku 4.5 $0.00008 $0.00374

Measured 2mo ago against content hash 29b197a74ef9, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

speculative-decoding scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

98% identical to emerging-techniques-speculative-decoding — 14 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

backend/cli/skills/ml-inference/speculative-decoding/SKILL.md · 467 lines

How it starts

The opening of the file, as written. The whole thing — 467 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Speculative Decoding: Accelerating LLM Inference

When to Use This Skill

Use Speculative Decoding when you need to:

  • Speed up inference by 1.5-3.6× without quality loss
  • Reduce latency for real-time applications (chatbots, code generation)
  • Optimize throughput for high-volume serving
  • Deploy efficiently on limited hardware
  • Generate faster without changing model architecture

Key Techniques: Draft model speculative decoding, Medusa (multiple heads), Lookahead Decoding (Jacobi iteration)

Papers: Medusa (arXiv 2401.10774), Lookahead Decoding (ICML 2024), Speculative Decoding Survey (ACL 2024)

Installation

# Standard speculative decoding (transformers)
pip install transformers accelerate

# Medusa (multiple decoding heads)
git clone https://github.com/FasterDecoding/Medusa
cd Medusa
pip install -e .

# Lookahead Decoding
git clone https://github.com/hao-ai-lab/LookaheadDecoding
cd LookaheadDecoding
pip install -e .

# Optional: vLLM with speculative decoding
pip install vllm

Quick Start

Basic Speculative Decoding (Draft Model)

from transformers import AutoModelForCausalLM, AutoTokenizer

# Load target model (large, slow)
target_model = AutoModelForCausalLM.from_pretrained(
    "meta-llama/Llama-2-70b-hf",
    device_map="auto",
    torch_dtype=torch.float16
)

# Load draft model (small, fast)
draft_model = AutoModelForCausalLM.from_pretrained(
    "meta-llama/Llama-2-7b-hf",
    device_map="auto",
    torch_dtype=torch.float16
)

tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-2-70b-hf")

# Generate with speculative decoding
prompt = "Explain quantum computing in simple terms:"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")

# Transformers 4.36+ supports assisted generation
outputs = target_model.generate(
    **inputs,
    assistant_model=draft_model,  # Enable speculative decoding
    max_new_tokens=256,
    do_sample=True,
    temperature=0.7,
)

response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)

Read the full file on GitHub · 467 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago Changed · -2 lines 29b197a74ef9
  2. 2mo ago First seen · 469 lines · 77 tokens per session scan A 468651740332

Subscribe to this mod's changes

speculative-decoding is a skill published in the GitHub repository synthetic-sciences/openscience (4,357 stars, last pushed today), licensed Apache-2.0. It adds 77 tokens to every session and 3,744 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 98% identical to emerging-techniques-speculative-decoding, differing in 14 lines, and is treated as a copy.

Related

speculative-decoding compared with skills from other repositories

speculative-decoding next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
speculative-decodingsynthetic-sciences/openscienceSkill4.4ktodayApache-2.0A77Claude Code, Codex
speculative-decodingOpenLAIR/dr-clawSkill1.2k2d agononeA77Claude Code, Codex
speculative-decodingOrchestra-Research/AI-Research-SKILLsSkill14k28d agoMITA77Claude Code
speculative-decodingliortesta/ClawdAgentSkill122mo agoApache-2.0A77Claude Code
speculative-decodingOpenLAIR/dr-claw-plugin-ccSkill55mo agononeA77Claude Code
speculative-decodingihatesea69/HieuNghi-AI-SkillsSkill38mo agoMITA77Claude Code, Codex
model-pruningOpenLAIR/dr-clawSkill1.2k2d agononeA70Claude Code, Codex