Skip to content

fix(footprint): a hybrid artifact holds KV only on its attending layers — read full_attention_interval (Qwen3.8-27B: 65,536 not 262,144 bytes/token) - #4156

Merged
joelteply merged 1 commit into
canaryfrom
fix/hybrid-kv-counts-only-attending-layers
Sep 17, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fix/hybrid-kv-counts-only-attending-layers

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

The last wrong constant in tonight's chain, and it is live-harmful right now: with #4146's kept-window bound in place, the 5090's served window went to 9,430 and every citizen turn since has failed delib.payload.over_window (272 in 40 min).

kv_bytes_per_token_f16 reads the header's geometry — right instinct — but counts all block_count layers as attending. The Qwen3.8 header also declares qwen35.full_attention_interval = 4: Gated DeltaNet linear layers with a full-attention layer every fourth; linear layers keep a fixed recurrent state, no per-token KV. So 64 / 4 = 16 attending layers × 4 kv-heads × (256+256) × 2 = 65,536 — which is what the engine measured (144k in 31.9 GB, ~74 KiB/token with compute growth). On 262,144 the board saw a 67.5 GB declaration on a 33.6 GB card, the cache demand read 3.5× high, and the physical fit said 9.4k.

No family knowledge: the key is read under the artifact's own arch like every other dimension; an artifact without it attends on every layer as before. Test: the 27B header verbatim → 65,536; without the interval → 262,144. Mutation (interval ignored) fails. inference_capability 131/131, daemon 64/64, plan 37/37.

#4152 stays open for the measured rate (catches a header that lies); this closes the case where it tells the truth.

Deploying to the 5090 now (feature build, SHA in the receipt) — the citizens are mute until it lands. Review requested; merging on green after the window unless someone objects sooner.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc

…rs — read `full_attention_interval` from the header

The 5090, 2026-09-17: `kv_per_token = 262,144` for Qwen3.8-27B came from the
header's declared geometry counting all 64 blocks as attending. The header also
declares `qwen35.full_attention_interval = 4` — Gated DeltaNet linear layers with
a full-attention layer every fourth; the linear layers keep a fixed recurrent
state, no per-token KV. Attending layers = 64 / 4 = 16 → 65,536 bytes/token, which
is what the engine measured (144k window in 31.9 GB; ~74 KiB/token including the
window-scaled compute growth).

On the wrong rate: serving declared 67.5 GB to the resource board on a 33.6 GB
card (the ledger fiction #4144 capped), the prompt-cache demand read 3.5× high,
and — once #4146 bounded the kept window by the physical fit — the served window
went to 9,430 and EVERY turn failed `delib.payload.over_window` (272 in 40 min).
Honest arithmetic on a wrong constant; the constant is the header's, read fully.

No family knowledge: the key is read under the artifact's own arch, like every
other dimension; an artifact that never wrote it attends on every layer as
before. Test: the 27B header verbatim → 65,536; the same header without the
interval → 262,144. Mutation (interval ignored): fails on the 27B case.

#4152 stays open for the MEASURED rate (device-used deltas at launch), which
would also catch a header that lies; this closes the case where it tells the truth.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
@joelteply

Copy link
Copy Markdown
Contributor Author

No objection — LGTM; merge on green. The hybrid's KV lives on its attending layers only (blocks / full_attention_interval), the DeltaNet layers carry a per-slot state that is not per-token, and the header key is the artifact's own word. The test pins both the hybrid (65,536) and the dense read (262,144). Consequence to watch on the M5 rather than an objection: Ornith-1.5-35B-A3B is the same family — if its header carries full_attention_interval the M5's kv estimate drops ~4× on the next plan and the served window grows (the KV-derived window bound is what limits it today at 67k on 5 lanes). That is correct if true; read serving.plan.* on the M5's next boot for the new window and make sure the lane count does not jump with it (lanes stop at the decode knee, #4106).

@joelteply
joelteply merged commit 02fb585 into canary Sep 17, 2026
5 checks passed
@joelteply
joelteply deleted the fix/hybrid-kv-counts-only-attending-layers branch September 17, 2026 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant