Repository navigation
Gates for decode-graph changes; opt-in decode width tiers (#14) - #26
Merged
Merged
Conversation
bench/teacher_forced.py feeds the same token sequences through the 16-wide decode graph and a candidate (another width or tactic hint, on shared weights) and reports top-1 agreement, |delta logit| at the teacher token, KL(old||new) on the top-k, the half-probability guard, and perplexity on bench/ppl_text.txt (original prose, so not memorised). bench/token_gate.py checks free-running continuations against the reference engine's own runs. BatchDecodeEngine can share another engine's weights and lm_head (share=), take its own tactic hint (hint=), and return logits (step_logits). TieredDecode (engines/tiers.py, RNGD_DECODE_TIERS, RNGD_TIER_HINTS) steps at the narrowest width covering the live lanes; it stays off by default: width 4 passes the teacher-forced gate but not the free-running one, width 8 passes both but gains nothing. Decode graph specs no longer pass the options 2026.3+ removed, and the engine uses the SDK's device string, so the graphs can be built on newer furiosa-torch. bench/kv_append_probe.py measures the eager in-place KV writes a decode graph without the full-cache rewrite would need. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
After #23 and #24, the remaining #14 gap is TPOT. The 16-wide decode step costs 35–43 ms against furiosa-llm's 17–22 ms. Every lever on it changes bf16 rounding, so the token gate was relaxed (coordinator decision on #14). A rounding-changing change is accepted only if:
This PR adds the tools for those gates, and decode width tiers as an opt-in lever, with every measurement. It also records the KV-rewrite and tactic-hint levers that reached hard limits.
Changes
bench/teacher_forced.py: gate 2 and gate 3. Variants areWIDTH[:HINT]engines that share the reference engine's weights.bench/token_gate.py: gate 1.bench/ppl_text.txt: ~1,800 words of original prose. A first try with famous public-domain texts gave perplexity 1.06, because the model has memorised them.engines/decode_batch.py:BatchDecodeEngine(share=, hint=)reuses another engine's 16 GB of projections and the lm_head, and takes a per-engine tactic hint.step_logits()returns the logits.allow_external/unlowered_operatorson SDK ≥ 2026.3 (removed there), and the engine usesdev_str(). The default path's keys and behaviour are unchanged.engines/tiers.py,TieredDecode: one engine per width on shared weights. Each step runs at the narrowest width covering the live lanes, and live lanes are copied on the card when the width changes.serving/cluster.pybuilds it fromRNGD_DECODE_TIERS(e.g.4,8) andRNGD_TIER_HINTS(e.g.4:Default).bench/tier_numerics.py(bit-exactness across widths),bench/kv_append_probe.py(eager in-place KV writes).tests/test_decode_tiers.py: tokens are identical to one wide engine across width changes; added to CI.Verification
All runs: npu-node-1, 2026-10-22, a Job with one card, S=1024, decode group 8, furiosa-torch 2026.2.0. The reference is the 16-wide
ForLlmModelDecodegraph.Gates per candidate. Gate 2 runs on the 14 reference continuations (819 steps); perplexity runs on 1,716 tokens of
ppl_text.txt. Data:teacher_forced_tiers_S1024.json,teacher_forced_hint_default_S1024.json,greedy_rngd_pd_{tiers,t4def,t8}_S1024.jsonl.Width 4 is the only one that is fast (TPOT 25 ms vs 42 ms for ≤ 4 in flight), and it fails gate 1. Its graph is not bit-exact with the 16-wide one: hidden-state max |Δ| 0.5, argmax flipped on 1 of 24 steps (
tier_numerics.py). The flipped continuation diverges for the rest of the 64 tokens.Width 8 passes all gates, but its step costs about the same as 16. With tiers {8, 16} the sweep is flat or worse (
harness_rngd_pd_t8_S1024.jsonl):So tiers stay off by default.
On the high-entropy natural text, top-1 agreement is 98.3–98.7 % for every variant, against 99.3–99.6 % on the reference continuations. Guard violations were 0 everywhere and perplexity moved ≤ 0.13 %.
Default path unchanged: with
RNGD_DECODE_TIERSunset, greedy is 14/14 identical to Admit a burst back to back and argmax with torch (#14) #24's run on this branch's final code.Tests: CI set +
tests/test_decode_tiers.py→ 54 passed, 1 skipped locally.Compatibility and limits (the levers that did not pass)
kv_append_probe.py(B=16, S=1024, one group's K = 268 MB) measured:index_put_: 1,115 ms (it goes through the host).Defaultis 1.5× slower (group call 10.4 vs 8.3 ms).ForMiscModelandNoConstraintdid not finish tactic search in 2 h even at width 4.memory explosionat layer group 8 and 4. Group 2 compiles, but cannot be stored: 2026.3+ has no EDF container forartifact_cache. On 2026.2, group 8 also fails at S ≥ 2048.Related Issue
Part of #14 (phase 3: decode tiers, KV rewrite, hints).
🤖 Generated with Claude Code