← TinyGPT · docs · devlog · roadmap · speedup
source: docs/prds/B14-speculative-decoding.md · view on GitHub ↗

PRD — Vanilla speculative decoding with a Mini-Llama draft

Goal

Wire --draft-model <path> into tinygpt serve and tinygpt sample so a small “draft” model proposes K tokens per step and the target model verifies them in one parallel forward. Expect ~1.6–2× decode tok/s on Mega (~960M target) using a Tiny-class draft (~10M params), matching the Leviathan et al. 2023 paper.

This is distinct from the Medusa / EAGLE-2 spec-dec already shipped (those train extra heads on the target itself). Vanilla spec-dec uses two independent models — the cheaper option when you already have a small model trained on the same domain.

Why now

Scope — in

Scope — out

Files to touch

FileChange
Sources/TinyGPTServe/SpecDec.swiftnew — accept/reject loop
Sources/TinyGPTServe/Serve.swift--draft-model arg; plumb optional draft into the generate path
Sources/TinyGPT/Sample.swiftmirror flag for offline use
evals/specdec-numerics.swiftnew — T=0 byte-equality + T>0 KL ε gate
evals/specdec-throughput.shnew — measure tok/s ratio (spec / plain) on Tiny-draft + Mega-target
docs/precision.mdappend a “vanilla spec-dec” gate row
docs/PLAN.mdflip B14 ⬜ → ✅ + measured tok/s lift

Don’t touch

Acceptance criteria

Reference patterns

Open questions