/major-ai-skills:speculative-decoding-promptingfrom major-ai-skills
Use supported predicted-output or speculative-decoding features for edits with a largely known output and measure their benefit.
Ships in major-ai-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
In modern LLM inference engines (vLLM, TensorRT-LLM, OpenAI Predicted Outputs), Speculative Decoding accelerates generation speed by pairing a large target model (e.g., 70B+ parameters) with a lightweight, ultra-fast draft model (e.g., 1B parameters) or reference text cache.
The draft model speculatively generates $K=5$ tokens per step, and the large model verifies all 5 tokens in a single parallel forward pass. If the draft tokens match the target model's probability distribution, generation velocity increases from 40 tokens/sec to 120+ tokens/sec (3x speedup).
The Speculative Decoding Alignment Protocol structures prompts and leverages reference predictions to achieve $>85%$ draft acceptance rates.
┌─────────────────────────────────────────────────────────────┐
│ Inference Generation Velocity │
│ │
│ Standard Autoregressive Generation (1 Token / Forward Pass):│
│ • Token 1 ──► GPU Pass 1 (25ms) │
│ • Token 2 ──► GPU Pass 2 (25ms) │
│ • Token 3 ──► GPU Pass 3 (25ms) │
│ ↳ Generation Speed: 40 Tokens / Second │
│ │
│ Speculative Decoding (5 Tokens Verified / 1 GPU Pass): │
│ • Draft Model generates 5 tokens in 4ms │
│ • Target Model verifies all 5 in 1 single GPU pass (25ms) │
│ ↳ Effective Speed: 135 Tokens / Second (3.3x Speedup!) │
└─────────────────────────────────────────────────────────────┘
When modifying an existing file where 80% of lines remain identical, pass the existing code in the prediction parameter. The inference engine speculatively validates existing lines in bulk:
from openai import OpenAI
client = OpenAI()
def refactor_with_predicted_outputs(original_code: str, instruction: str) -> str:
"""Uses Speculative Decoding to stream refactored code 3x faster."""
response = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": "You are a code refactoring assistant."},
{"role": "user", "content": f"{instruction}\n\nOriginal Code:\n{original_code}"}
],
# Feed original code as the speculative draft prediction
prediction={
"type": "content",
"content": original_code
},
temperature=0.0
)
return response.choices[0].message.content
Draft models predict standard boilerplate with 95% accuracy. Use standard convention structures:
import React from 'react';)throw new NotFoundError(...))Setting temperature: 0.0 aligns draft model greedy sampling with target model top-1 greedy logits, maximizing token acceptance matches.
Refactoring a 400-line backend controller file:
| Inference Mode | Generation Latency | Throughput (Tokens/Sec) | Acceptance Rate |
|---|---|---|---|
| Standard GPT-4o Autoregressive | 12.8 seconds | 42 tok/s | N/A |
| Speculative Predicted Outputs | 3.9 seconds | 138 tok/s (3.3x Faster!) | 88.4% Accepted |
MANDATORY: When performing large single-file refactorings or minor bug patches on existing files using OpenAI-compatible engines, pass the existing code into the
predictionparameter to enable 3x speculative inference acceleration.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub alivirgo/major-ai-skills --plugin major-ai-skills412 skills in this plugin
/3d-slicerAutomate 3D Slicer research workflows with MRML, VTK/ITK, DICOM data, and Segment Editor. Use for software workflows, not clinical interpretation./abbreviated-git-statusInspect Git branch, staging, and working-tree changes with short or porcelain status output when a compact repository check is needed./ableton-liveAutomate Ableton Live sessions with Python MIDI Remote Scripts, Max for Live, AbletonOSC, and Link synchronization.Other plugins' skills for the same job
/act-as-a-personal-tutorExplain a subject step by step, assess prior knowledge, and use short exercises to check understanding before advancing.