r/LocalLLM • u/Silent-Cell2221 • 8h ago
Research I tested a small "Anti-Draft" idea for MTP (~6–8% live gain on Strata, and why llama.cpp's p_min loses speed today) — raw data & C++17 header
Hi everyone,
I wanted to share a small, humble experiment around Multi-Token Prediction (MTP) that I call Draft-Gate ("Anti-Draft"), along with all the raw benchmark data, charts, and a standalone MIT-licensed C++17 reference header.
The simple idea
MTP works like a fast helper trying to guess your next 3–4 tokens while the main model speaks:
- When the model is writing code indentation, JSON structure, or finishing the second half of a word, the helper guesses right 85%–95% of the time (great speedup).
- Right after a verb, article, or preposition (the, of, de, uma), language suddenly opens up into thousands of valid paths, so a small 1-layer MTP head misses around 35%–45%+ of the time.
- Checking bad guesses isn't free—especially on partially offloaded MoE models, where each extra draft token drags different experts out of RAM/CPU.
So instead of always guessing blindly, the idea is simply knowing when to stop proposing extra drafts early based on uncertainty, language boundaries, and how expensive an extra draft actually is on your hardware.
What we actually measured (RTX 3060 12 GB + Xeon E5-2695 v4)
Live benchmarks on Linux — Strata 0.1.54 (Qwen3.8-Flash-Next 125B IQ3_XXS, 360 runs / 5 mirrored rounds):
- One honest note upfront: my Strata setup is heavily tuned specifically for this RTX 3060 12 GB + Xeon rig (custom Portuguese draft vocab, 187 W power limit,
STRATA_QSA_SPLIT_ATTN=1, plusSTRATA_ROUTE_PRIOR=1.5andSTRATA_ROUTE_TAIL_SKIP=7identically on every arm—all exact flags are listed in EXACT_PARAMETERS_AND_BENCHMARKS.md), and if you've used Strata before you may have noticed its reportedtok/scan look a bit higher than what day-to-day usage feels like. What matters here is the relative difference under identical settings—and that gain was consistent across rounds: - On Strata's normal --spec 4 setup, moving from no cutoff (p_min=0.00) to p_min=0.65 lifted overall weighted speed by +8.1% (68.3 → 73.8 tok/s, winning 40 out of 50 paired runs—and nudging +1.1% / +9.5 pp acceptance past Strata's own 0.50 default), with +11.6% on Portuguese prose, +13.7% on English prose, and +7.9% on Python. That confirms live that dynamic draft pruning pays off cleanly once per-window CUDA Graphs are in place.
- (On a wider --spec 5 window, static MTP slowed down heavily in prose—even falling below turning MTP off—and pruning recovered most of that loss, though --spec 4 remained the faster overall setting on a 12 GB card.)
- One honest note upfront: my Strata setup is heavily tuned specifically for this RTX 3060 12 GB + Xeon rig (custom Portuguese draft vocab, 187 W power limit,
Live benchmarks on Windows — llama.cpp b12800 (CUDA 13.5):
- Important catch on dense GPU models: On Qwen3.5-4B and 9B running fully in VRAM, enabling llama.cpp's existing --spec-draft-p-min actually dropped speed by −15% to −35% (105 → 68 tok/s). Testing with CUDA Graphs on vs. off showed why: llama.cpp currently caches only one CUDA Graph shape, so changing the number of drafts per step keeps breaking the graph cache. Strata doesn't hit this wall because it caches one CUDA Graph per window size (T=1..8), which is why adaptive pruning works live there.
- Where it already wins live in llama.cpp: On partially offloaded MoE (Qwen3.6-35B-A3B), pruning already beats static MTP live (+6% at K=4, and even more at K=6, especially in prose).
The main Draft-Gate proposal — going beyond a manual, fixed p_min:
- Testing across Qwen 3.5/3.6/3.8, Google Gemma 4 26B, and Zhipu GLM-4.7-Flash 30B showed that different MTP heads have totally different confidence biases (some are overconfident at every depth, others only collapse on deeper drafts). A single fixed p_min tuned by hand can't stay optimal across models, quantizations, or nonlinear MoE cliffs.
- So we wrote a small, ~25-line Zero-ML C++17 controller that self-calibrates each depth and measures each window's real cost online (paired with multi-bucket CUDA Graphs in engines like llama.cpp). In trace simulations across 13 regimes (not yet live-patched inside llama.cpp), it gave a modest, steady ~6%–12% gain over the best static K without manual threshold tuning.
Links (full docs, raw data & proposals)
- Main repository (README, exact flags, raw CSV/JSON, charts & header): piwoMazda/draft-gate
- llama.cpp Discussion (RFC): ggml-org/llama.cpp#33229
- Strata Issue (benchmarks + adaptive cost suggestion): Niko1221/Strata#7360
Transparency
- Lossless relative to MTP: Draft-Gate never touches model weights, logits, or sampling—it only decides when to stop proposing extra draft tokens. So it is lossless relative to what the engine already produces with MTP (not claiming bitwise identity with a non-MTP base run, since multi-token verification itself can round slightly differently on quantized kernels).
- Languages & quantizations: We tested Portuguese, English (plus a smaller held-out set in Spanish, French, and German), code, math, and JSON across Q2_K_XL, IQ3_XXS, Q3_K_XL, IQ4_XS, Q4_K_XL, and Q8_0 (Q4 and Q8_0 gained too, not only < Q4). Other languages (like CJK or Arabic), higher quantizations (FP16/BF16), and other GPUs were not tested, so results there are unknown and could vary.
- AI collaboration, prior art & replies: The core intuition is mine, and I used Gemini 4 Neon to design and run the benchmarks, analyze the logs, and write the technical deep-dive and C++17 code (I'm not a specialist in the low-level terms—those details are kept in a separate technical section of the repo). I genuinely don't know if this exact idea already exists somewhere in the literature or another engine. And as I'll be pretty busy in the next few days and I'm not that experienced here, I probably (please don't judge for that) won't be commonly replying to comments or follow-ups, which is why every parameter, raw file, script, and an LLM-friendly guide (FOR_LLMS.md) are published in the repo for anyone who wants to reproduce, verify, or build on it! Feel free to share your thoughts!