docs(mlx): grammar-aware speculation is correct and inert, and why - #201
docs(mlx): grammar-aware speculation is correct and inert, and why#201glennneuber wants to merge 1 commit into
Conversation
Records the on-device measurement of the feature merged in #191: constrained output is correct (bare, parseable JSON, which stage 3 broke), but there is no speedup because the depth controller cold-starts at 0 and a parked round reports observed=0, so it never gathers the acceptance data that would raise it. drafted=0 with grammar_no_legal_draft=0 -- nothing was rejected, nothing was ever proposed. Also records the two measurement traps that made this expensive to establish: the VRAM-derived default num_ctx of 262144 (25x decode swing), and /api/generate + think + format returning a markdown fence that reads exactly like the grammar being ignored. The remaining work is the depth controller. Gate stays off. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Reviewing as consolidator. Recording a negative result properly is the right call, and the diagnosis is specific enough to act on. The cold-start deadlock is well isolated:
That is a closed loop with no entry point, and the counters prove it rather than suggest it: Not picking among the three candidate depth fixes is right. Choosing one without measuring is how the 42% got attributed to The traps are the most reusable partThe VRAM-derived The One thing to add, since it is now measurableThe 42% penalty in I raised this on #187 and #191 and it is still open; this note is the natural place for it to live, since it is now the tracking artifact. Good that the stale "not attempted here" section gets a dated update rather than being left to mislead — a document that points readers at work already done is worse than one that says nothing. |
Follow-up to #191, recording the remaining work. Documentation only — no code.
#191 landed the correctness fix for grammar-aware speculation and I measured it on CUDA. The result is negative and worth writing down properly rather than leaving in a PR comment:
format:"json"), because it never proposes a draft.drafted=0withgrammar_no_legal_draft=0andgrammar_truncated=0— nothing was rejected, nothing was ever proposed.The mechanism is a cold-start deadlock: a round only proposes when
s.limit > 0,s.limitis refreshed only inendRoundfromdepth.next(), and the acceptance model only learns whenobserved > 0— which a parked round never reports. Depth starts at 0, round 1 parks, that teaches nothing, depth stays 0.The note sets out three candidate fixes for the depth controller without picking one, since that choice wants measuring. It also records two traps that cost hours: the VRAM-derived
default_num_ctx=262144on this host (25× decode swing) and the/api/generate+ think + format markdown fence that reads exactly like the grammar being ignored.Adds a dated update to
mlx-constrained-decode-disables-speculation.md, whose "What would fix it" section said the feature "is not attempted here" — it has been now, so that section pointed readers somewhere stale.Issues are disabled on this repo, so this note is the tracking artifact for the remaining work.