Repository navigation
prefill: two-phase full cache hit emits from the snapshot's stashed hidden (latent wrong first token) - #208
Conversation
…idden prefill_twophase_dispatch takes the proc_count == 0 path when an SSM snapshot covers the whole prompt. prefill_full_cache_hit then re-embeds the last token and ran final_norm + lm_head on that embedding, which went through no layers: the first token came from embedding logits. Not gated by ATLAS_MARCONI_EXACT. Use the snapshot's stashed last-token hidden, as finalize_last's exact-hit fixup does; warn when the snapshot has none. Reachable only when max_prefill_tokens < prompt <= max_batch_tokens (two-phase runs above max_prefill_tokens, the monolithic arm needs the whole prompt in the arena); with the defaults (arena = max_prefill + 1) that is a single prompt length, so this was latent rather than observed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Riding integration train #212 ( |
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Live-repro attempt notes (sparky GB10, FP4-Local). This merged in train #212 on compile, tests and the train gate (BFCL ST-995 87.44 / 87.32 identical to main, agentic 50/50). I tried to drive
Both arms behaved identically each time. In practice the two-phase full-hit path needs a two-phase dispatch (len > the effective chunk size with nothing decoding) AND a restorable snapshot at exactly the prompt length. On the FP4-Local recipe profile that combination didn't occur in any serve log. That matches the original reachability note (only a prompt of exactly 8,193 tokens on the recipe). Unexplained: why the 5,536 |
Problem
prefill_twophase_dispatchtakes theproc_count == 0branch when an SSM snapshot covers the whole prompt.prefill_d.rs::prefill_full_cache_hitthen:final_norm_rows+lm_headon that embedding, which went through no layers.So the first token comes from embedding logits. The path is not gated by
ATLAS_MARCONI_EXACT, and it never uses the snapshot's stashed post-norm hidden, whichfinalize_last's exact-hit fixup does use.Reachability
Two-phase runs only above
max_prefill_tokens, and the monolithic arm needs the whole prompt in the arena (max_batch_tokens). With the default arena (max_prefill + 1, e.g. 8193 for the FP4-Local recipe), that is a single prompt length. So this is latent: zeroTwo-phase prefilllines in the recipe or bare-metal serve logs. It becomes reachable on any config withmax_batch_tokenswell abovemax_prefill_tokens.Change
Pass the effective snapshot into
prefill_full_cache_hit, and copy its stashed hidden intonormedbeforelm_head(restore_hidden, asfinalize_lastdoes). Warn when the snapshot has none.Verified
cargo fmt --check,cargo clippy -p spark-runtime -p spark-model -D warningsand the release build are clean on sparky (GB10), built together with the shallower-snapshot fallback branch. The path itself was not exercised live; that needs a config withmax_batch_tokens > len > max_prefill_tokens.🤖 Generated with Claude Code