kadirnar/kernel-agent/speculative-decoding
Claude Code and agent skill by kadirnar/kernel-agent
- community
Checking that the SKILL.md file is still in the repository.
Exact data-dependent speedups (prompt-lookup drafts, draft models, early exit) — keeping them exact for greedy decoding, the diverse input set they are timed on, the data_dependent label, report_stats counters. Use when a transform's gain depends on the generated content.
Install
npx vskill@latest install kadirnar/kernel-agent/speculative-decodingSKILL.md
Data-dependent speedups: speculative decoding, early exit
Some exact techniques are as fast as the content lets them be: prompt-lookup (n-gram) drafts are right where the continuation copies the prompt, a draft model where its guesses match, an early exit where the input is easy. They are welcome. Keep them exact for greedy decoding (verify every draft with the model's own forward and keep the longest prefix where draft == argmax, plus the model's next token), and measure them honestly:
- Every passing
evaluate_e2ealso runs the workload's diverse input set
(metrics.diverse; LLM: news, dialogue, code, a recipe, a poem, a question, maths, a CSV table, German, French, Spanish and Chinese requests at the end of a prompt_len prompt; TTS: a few other texts), judged like the main input and timed against the baseline per input. Its median, min and max speedup are reported next to the benchmark speedup.
- A candidate whose per-input speedups spread beyond the noise (10 % at least), or whose
decode steps per token change with the input, is labelled data_dependent in the ledger (flags), status, the integration and the report. It is never rejected for it; the report shows the diverse-set median next to the benchmark number.
- Report the loop's counters so the report can explain the gain:
``python # one verification of a K-token draft that accepted n tokens and emitted m (= n + 1) workload.report_stats(steps=1, verifies=1, drafted=K, accepted=n, tokens=m) # one plain decode step workload.report_stats(steps=1, tokens=1) ``
Every timed run starts from zero; metric_detail.decode_stats holds the medians plus acceptance_rate, tokens_per_verify and tokens_per_step.
- The benchmark prompt is long non-repeating text. A prompt made of one paragraph repeated
(the LLM workload before #170) makes a greedy model repeat it, and prompt lookup then looks 40-67x faster than on real text (Qwen3-0.6B: 65x on the repeated paragraph, 11-14x on READMEs, code and a licence).
- With
--quality near-losslessorrelaxedan LLM is judged teacher forced (KL and top-1 agreement on
eager's continuations, the likelihood of its own): the gate calls model(input_ids) on a prompt plus 64 tokens, so keep plain forward calls of the model working when a transform replaces the decode loop.
Related: systems-patterns (host syncs, serving), model-transforms.md of optimisation-playbook.
Examples and sources
- Sources: the
documentation-sourcesskill'ssources.md, sections "Attention and LLM kernels (reference code)". - Code:
Workload.report_stats,kernel_agent.workloads.diverse.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingsrc/kernel_agent/agent/plugin/skills/speculative-decoding/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/kadirnar/kernel-agent/speculative-decoding)