Repository navigation
fix(kv): the remaining layers — header-true KV rate, recall to the tail, the split applied for real - #2721
Merged
Conversation
…ghts guess over-charged MoE 4x The cache load/store breakdown, root layer. kv_per_token was weights/80_000: a 35B fine-grained MoE read as ~244 KB/token (q8: 122) where the header's declared geometry is ~61 KB f16 (~30 KB served q8 — confirmed against llama-server's own prompt-cache entry sizes). Expert weights add ZERO KV; any weights-scaled guess over-charges MoE ~4x. One inflated constant, both live symptoms: - peak_resident_bytes inflated ~25 GB -> afford collapsed -> --cache-ram derived at 686 MiB = ONE mind's state; llama's log shows 'removing oldest entry (593 MiB)' on every save — the restore tier held exactly one of five rotating minds, so every restore missed and hit_rate was 0.0 fleet-wide even with affinity, classes, and paging all correct. - the same inflation is why the planner granted 3-4 lanes against a resident demand of 5-6. Fix at the constraint: gguf_keys::kv_bytes_per_token_f16 reads the header's own geometry (scalar GQA, per-layer arrays with recurrent zeros, key_length-absent fallback — all three shapes tested); footprint_for overrides the heuristic with it, memoized per path (the governor tick must not re-parse headers). The heuristic stands only when the header cannot answer. Probe: serving.kv_rate.header. gguf_keys 6/6, serving_daemon 43/43. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…urn and was churning the stable KV head The last layer of the hit_rate-0.0 stack. With 5 slots granted (every resident on her own slot, rotation gone) and the server's reuse proven perfect the same hour (same prompt x2 on one slot: cache_n 397/401, 74ms), reuse was STILL 0 — because the recall block lives in the system prefix and is re-scored every turn: capture diff showed an '(you reflected, 3d ago)' line inserted mid-list and the head re-fit 12.3k -> 10.7k chars between consecutive turns. A head mutation at char ~8.5k invalidates every token behind it. stable_blocks' own doc promises 'recall … is separated out as its own .trailing() turns (#205)'; FacultyId::Recall never actually set the flag. One line makes the promise true; the mechanism (trailing contributions render nearest generation) already existed and is already tested. Regression assert added to surfaces_top_salience_memory_as_context. recall_faculty 20/20. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…the facts phase, never the system message The split composer existed, its docs called it 'the live path' — and the live view builder (prompt_view_within) still called compose_system_holding, which glues stable ++ trailing back into ONE system message. So the [now] minute clock and the presence flip (DIRECTED / WORKING / SILENCE) kept mutating the system prefix at char ~8.4k on nearly every act: wire-capture diff 2026-09-01 showed consecutive turns diverging exactly at '[now …]' / '[Conversational Presence]' -> '[Your own time]', with the server's reuse proven perfect the same hour (same prompt x2 on one slot: cache_n 397/401, 74ms). A prefix that mutates every act caches nothing. Now: compose_trailing() renders the volatile framing WITHOUT the context (none of its blocks read it), and messages_unfitted places it in the FACTS phase — flicker-class content, before the ask (parrot order preserved), after everything stable. The system message is the stable half only, so a presence flip cannot move a byte of it — pinned by the strengthened directedness_flip test (system now byte-IDENTICAL across the flip, framing asserted into the tail). Three tests that encoded the old placement updated to the new contract. llm_deliberation_faculty 38/38; cognition:: 1085/1085. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
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.
Three commits pushed to #2719's branch after its squash-merge closed it — the layers that took hit_rate from 0.0 to a measured 0.38–0.50 with warm act latency halved (58s vs 138s):
weights/80kguess over-charged a 35B MoE ~4× (experts add weights, zero KV), starving--cache-ramto one mind and under-granting lanes. Header-true rate unlocked 5 lanes = one warm slot per resident..trailing()— it re-scores every turn and was churning the stable system head.stable ++ trailinginto one system message, so the[now]clock + presence flips invalidated the prefix every act. System message is now byte-identical across presence flips (pinned by test).Receipts in-session: consecutive warm turns cached 9,661–9,669 tokens (the stable head), hit 0.38–0.50, first nonzero reuse of the night. gguf_keys 6/6, serving_daemon 43/43, recall 20/20, llm_deliberation_faculty 38/38, cognition:: 1085/1085.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo