Skip to content

kvbase: later requests keep their prompt's expert pick; Qwen3.8's K/V starts at a floor and grows; one common K/V owner - #1190

Merged
midagedev merged 10 commits into
mainfrom
kvbase
Nov 10, 2026
Merged

midagedev merged 10 commits into
mainfrom
kvbase

Conversation

@midagedev

Copy link
Copy Markdown
Owner

요약: 서버의 뒤쪽 요청이 새 대화를 시작할 때 프롬프트의 전문가 선택을 지키고(+10.4 % tg, +18 % pp), Qwen3.8 서버의 K/V는 8,192 위치의 바닥에서 시작해 필요한 만큼 자라며, K/V 바닥·성장·호스트 페이지가 하나의 공통 owner로 모입니다.

What and why

Three changes to how the card holds a server's K/V and experts, landed as one train because their gate sets overlap:

  • callkeep. A prompt call at position 0 begins a new sequence, so the swap rule's heat from the sequence before is
    cleared and the call keeps its own expert pick (SwapRule::call_history(start), one owner for Qwen3.8, Qwen3.5, V4.1
    and Muse). Before, every request after a server's first ran its decode on the previous conversation's pool.
  • kvflip + spillmargin. The Qwen3.8 server's unset K/V levers are a floor of 8,192 positions with spill: the plan
    gives the card bytes past the floor to experts, and the K/V grows into them. A spill room puts a page on the host when
    the card's free bytes would fall below the plan's margin. A device that cannot back a host page takes kv_host=off
    for an unset lever, named on stderr. Levers and placement stay model-free (KvFloor, KvDefault,
    PlanLevers::from_levers_with).
  • kvcommon R0. The K/V floor, growth and host pages have one common owner: runtime::stores
    (PosLayout/PosBuf/Access), KvBytes::rooms, and the room facade gpu::room::kv (kv_backing, RoomTensor,
    fit_rooms). Qwen3.8 moves onto it. A load whose family declares no rooms refuses a set BLOOMERY_KV_FLOOR count or
    BLOOMERY_KV_HOST=spill|all by name (KvUnroomed). V4.1 and K3.1 follow in their own PRs.

Two record commits ride along: the Qwen3.8 kv_room doc text, and the V4.1 prompt-call plans re-dumped. Main's planner
had moved those plans since their last dump; records-refresh at main 2f560a7 gives the same bytes, so no commit here
moves them.

Release notes: Changed — a server's later requests keep their own prompt's expert pick (faster decode and prompt on every
request after the first); Qwen3.8 serving starts its K/V at 8,192 positions and grows it, giving the rest of the card to
experts.

Code shape

  • No second copy. The keep decision was copied in four prompt drivers; it is now SwapRule::call_history. The
    K/V floor/growth/host logic lives in runtime::stores + gpu::room::kv.
  • Model code holds only architecture facts. The seat default is the seat's constant (KV_DEFAULT); levers and
    placement carry no model name.
  • Dead code is gone.
  • No silent failure. A set K/V lever on a family without rooms is KvUnroomed; a device without host pages is
    named on stderr.
  • Comments state what is true now.
  • No relaxed gate.
  • cargo fmt and cargo clippy clean; lint count 0 = the ratchet.

Duplication found or removed: body38.rs, body35.rs, prompt_walk.rs, musespark/body/prefill.rs (the keep rule,
now one owner).

What I ran

Card line: RTX A6000 (timing), RTX 3090 (functional lane A).

  • Move proof for R0: just canon-check origin/main → canon-check: 4 bins, 2024 entries: 2024 identical, 0 reordered-only, 0 differs.
  • Fixture-tier landing batch of just affected origin/main (tools/gate-batch.sh --tier fixture --ledger):
    DONE total=221 red=1 tier=fixture. The red, gate-serve-draft-rules (four Qwen3.8 seat tests: a layout without
    rooms refused room_padding), is fixed in 9c3bac3: pure test a_layout_without_rooms_pads_nothing red without the
    fix (Metadata { key: "the stores' rooms" … }), green with it; just gate-serve-draft-rules → all suites ok.
  • callkeep timed A/B (docs/cards/callkeep-fold.card, A6000, one lease, 4 rounds, a server's later requests at D 4,096):
    tg main 60.19 / 60.49 / 60.05 against callkeep 64.97 / 67.04 / 67.22 / 66.83 → +10.4 % on the means; pp 2,118..2,221
    against 2,512..2,613 → +18 %. gate-gpu-qwen38-residency green; with .mutants/callkeep-history-ignores-pos.patch
    only its newseq clause red.
  • The V4.1 plan re-dump moved tools/flow/routes.py's self-test pin (2668 → 2662 card experts, 66..67 on 40 layers), moved
    with it in 454ac6c (FAIL-first: the old pin fails on the new record, the new pin passes).
  • Static tier: just remote-static origin/main → mac-remote: wall 519 s (setup 4 s, run 514 s), remote rc 0.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CjHkkjT5mN7HgMpebF3dE7

midagedev and others added 10 commits November 9, 2026 18:03
… would fall below the plan's margin (Card::margin_bytes), not only on the driver's refusal; hw_held_a_spill_room_keeps_the_cards_margin (WIP: unrun on a card)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01CjHkkoRrDMeThyrzguSMXZ
…sitions and spill (the seat owns KV_DEFAULT; levers and placement stay model-free: KvFloor with `off`, KvDefault, PlanLevers::from_levers_with); a device that cannot back a host page takes kv_host=off for an unset lever, named on stderr

Decided by docs/cards/ctxplace-q38.card (A6000, ctx 262,144, 6 rounds): decode +3.75 / +2.51 / +1.16 % at depth 6 / 512 /
4,096, prompt +2.0 / +11.1 / -0.0 %. BLOOMERY_KV_FLOOR=off and BLOOMERY_KV_HOST=off give the plan of the context alone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01X1hsQdxdmvvQpg1WFwxmEf
…rule's heat from the sequence before is cleared and the call keeps its pick (SwapRule::call_history(start), one owner for Qwen3.8, Qwen3.5, V4.1 and Muse); a call past 0 keeps today's return

A server's second request onward always held decode heat, so a new conversation's prompt pick was put back and its
decode ran on the previous conversation's pool. gate-gpu-qwen38-residency gains newseq (mutant
.mutants/callkeep-history-ignores-pos.patch); the swap rule's unit test is red on that mutant.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01X1hsQdxdmvvQpg1WFwxmEf
…er (runtime::stores PosLayout/PosBuf/Access, KvBytes::rooms, the room facade gpu::room::kv with kv_backing, RoomTensor and fit_rooms); Qwen3.8 moves onto it, and a load whose family declares no rooms refuses a set BLOOMERY_KV_FLOOR count or BLOOMERY_KV_HOST spill/all by name (KvUnroomed)

A family declares its by-position buffers once as data (row bytes, positions a row, head runs, Scan or Select); the plan's
floor and cap terms, the page rounding, the Scan -> card / Select -> host-able class and the fit -> residency free -> retry
loop are common. Qwen3.8's plan lines and kernels are meant unmoved (canon-check and the plan tests decide).
.mutants/r3b-fit-retry-removed.patch now targets fit_rooms.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01X1hsQdxdmvvQpg1WFwxmEf
…in's planner moved them since their last dump (the same bytes at main 2f560a7, so no kvbase commit moves them)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XgzWziKCXosAu2zaVTWpbG
…out the selector, plain buffers) pads nothing, so its plan does not refuse (gate-serve-draft-rules' four seat tests)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XgzWziKCXosAu2zaVTWpbG
@midagedev

Copy link
Copy Markdown
Owner Author

Superseded by #1191, which carries this branch's commits with the card-byte fixes on top. I will close this one when #1191 lands.

@midagedev
midagedev merged commit 454ac6c into main Nov 10, 2026
1 of 2 checks passed
@github-actions github-actions Bot added the tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo label Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant