Feature: prompt-lookup (n-gram copy) drafting alongside the MTP head for input-grounded workloads
Summary
Feature suggestion: prompt-lookup (n-gram copy) drafting as a supplementary draft source alongside the MTP head, for input-grounded workloads (code editing, multi-turn agents, summarization) where long spans of the output are verbatim copies of tokens already in context.
Evidence from a sibling runtime
I recently benchmarked prompt-lookup drafting on dense Qwen3.6-27B (Apple M5, 32 GB, 4-bit) via dflash-mlx, which ships a hybrid drafter: try an n-gram match against prompt+committed tokens first, fall back to the neural drafter on a miss (after fixing a gating bug — bstnxbt/dflash-mlx#36). On a code-edit prompt (model re-emits a ~100-line file with a small refactor, 3072 generated tokens, greedy):
| backend | tok/s | notes |
|---|---|---|
mtplx 0.3.7, --mtp (quickstart defaults, depth 3) |
16.6 | server-reported tok_s |
| draft-model spec + prompt-lookup hybrid | 32.0 | copy drafting covered 74.5% of generated tokens |
| same, fresh-code prompt (nothing to copy) | 18.6 vs 15.4 | parity-or-better on the unfavourable case |
The dense-model economics are what make this interesting for MTPLX specifically: each verified copy block replaces up to ~15 sequential decode steps with one verify pass, and on a dense 27B those steps are expensive. The drafting itself is trivial (rolling-hash window match over context tokens — no extra model, no extra memory beyond a small index).
Why I'm filing it here
MTP depth on Apple Silicon tops out around D2/D3, which caps the per-cycle speedup on copy-heavy output. A prompt-lookup pass in front of (or fused with) the MTP head would let the verify path consume much longer draft blocks exactly where they're free. The main open question is whether mtplx's verify strategies (e.g. capture_commit with the linear-GDN conv-tape rollback) can verify variable-length blocks beyond MTP depth, or whether that's a deeper change — you'd know best.
Happy to share the benchmark prompts/harness or run comparisons on M5/32GB hardware if useful.
One methodological note for fairness: the 16.6 tok/s mtplx figure above was measured with quickstart default sampling (temperature 0.6, depth 3), while the draft-model+prompt-lookup rows were greedy. Greedy decoding would likely lift the MTP number somewhat (higher acceptance), so treat the exact gap as approximate — the qualitative point (prompt-lookup drafted ~75% of tokens on the edit workload, which depth-capped MTP drafting can't reach) is unaffected.
As offered — prompts and harness behind the numbers above: https://gist.github.com/ashalliants/91819d410f6822e406a314740c8b7d0e. edit_prompt.txt/fresh_prompt.txt are the exact workloads; the README documents environment and methodology (including the sampling caveat noted earlier).
This is a great idea, Currently working on a massive release and will implement this as a follow-up update.
Awesome stuff, let me know if you need any help happy to contribute pr's as needed
Still interested in this for input grounded workloads, and the speculative path rework happening now makes it easier to slot a second draft source in cleanly. No date, but it is not dead.
Shipped, in stages, and 2.10.0 completes it. Context copy is exactly this: when the stream's tail matches an n-gram in the prompt, up to 24 tokens are proposed as one block and verified in one forward pass alongside the MTP head, with the same probability-ratio acceptance, so sampling is identical at any temperature. On a file rewrite it measures 87.6 tok/s against 73.8 for a fresh build. 2.10.0 added the batched-lane version and made short turns stop paying for misfires.