docs: FORK.md/runbook for the KV used-cells deploy (9d8a4ffc6, pointer 19) and the F16 expert lookahead lead

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PZz44SLQvTXMyWGio6t9DZ
This commit is contained in:
LumpiastyandClaude Opus 5.5 committed 2026-11-23 18:03:52 +01:00
1 parent 9d8a4ffc60
commit 3b4e9b593f
2 files changed
+48 -10

No files matched your search

+29 -6
View File
@@ -14,9 +14,15 @@ Status at the time of writing (2026-11-23, after the slimming run):
2026-11-23") and squashing the 74 earlier commits. Deployed commit,
validation and measurements: section 2, "Audit". `system_fingerprint` is `b<build number>-<short
sha>` and changes with each rebase or carry.
- Rollback: pointer `/root/DEPLOY-ROLLBACK-commit-18.txt` = `ec3bf13f6`, the previous production
commit (branch `fable5/vram-ondemand-rebase-20261122`, kept untouched; build copy
`/root/arms/build-ec3bf13f6`, config unchanged by this deploy). Next free pointer 19. Older
- Since 2026-11-23 18:01 Warsaw production runs `9d8a4ffc6` (`b12655-9d8a4ffc6`) on the same
branch: the slimmed code plus the KV used-cells shadow (F4, "KV shadow of the used cells only";
commit "llama: KV host shadow of a released cache holds only the used cells (F4)"). Validation:
`fork-validate.sh --arbiter --diskcache` 31 PASS, 0 FAIL against `92fe769a0` (handoff median
524.5 ms against 658.5 ms), deploy downtime 33 s; runbook section 6 history, "KV used cells".
- Rollback: pointer `/root/DEPLOY-ROLLBACK-commit-19.txt` = `92fe769a0` (the slimmed production
commit of 12:58 UTC; build copy `/root/arms/build-92fe769a0`, config unchanged). Next free pointer
20. The previous pointer `/root/DEPLOY-ROLLBACK-commit-18.txt` = `ec3bf13f6` (branch
`fable5/vram-ondemand-rebase-20261122`, build copy `/root/arms/build-ec3bf13f6`). Older
pointers and their config backups: runbook section 9.
- Older branches kept as safety nets: `fable5/vram-ondemand-rebase-20261122` (production
2026-11-23 01:47 to the slimming deploy), `-20261121` (upstream `e6d624b9a`), `-20261024`
@@ -113,6 +119,7 @@ three commits builds on the previous one.
| 3f9b79b45 | llama: inkling2_loop - per-pass views of host weights for the later loop passes | F13 | 5, +120 -1 |
| 25d6e1e9b | server: merge user-message batch breaks when the rest of the prompt fits in one ubatch, keep the first-user-message break | F14 | 1, +35 -1 |
| a1eb757ea | scripts: fork-validate.sh, post-rebase validation of the fork | F9 | 1, +1034 |
| 9d8a4ffc6 | llama: KV host shadow of a released cache holds only the used cells | F4 | 2, +67 -12 |
Then the documentation commits (FORK.md, the runbook, the AGENTS.md pointer). The README's fork
section was removed on 2026-11-23 (README.md changes upstream all the time, so it was a conflict at
@@ -182,6 +189,7 @@ Knobs (all read once from the environment):
| `LLAMA_LOOP_FULL_COPY=0` | set on both Inkling entries | skip upstream's #32807 guard, which F13 makes redundant | keep as an env knob, not a default: skipping the guard is only correct with the views on (`LLAMA_LOOP_HOST_VIEWS` unset), and the default keeps upstream's behaviour |
| `LLAMA_LOOP_HOST_VIEWS=0` | unset | upstream's shared tensors (A/B, LoRA on Inkling) | keep (one `getenv`, needed for the F13 A/Bs) |
| `LLAMA_USERSTART_MERGE=0` | unset | upstream's batch breaks (for a RAG client) | keep |
| `LLAMA_SLEEP_KV_USED_ONLY=0` | unset (used cells only) | the old full-allocation KV shadow (F4), for A/B | keep (one `getenv`) |
| `GGML_CUDA_REGISTER_HOST` | not in the environment any more | the pinning era | gone; section 5 no longer mentions it |
Validation and deploy (2026-11-23, details in the runbook, section 6 history, "Slimming"): the code
@@ -327,6 +335,17 @@ Measured footprints:
host (`Vulkan_Host`, i.e. pinned RAM) buffers stay as they are.
- KV and recurrent state: same pattern, but the shadow is re-captured on every release (the data is
read-write) and dropped after restore.
- KV shadow of the used cells only (since 2026-11-23, `llama_kv_cache::shadow_ranges`, knob
`LLAMA_SLEEP_KV_USED_ONLY=0` for the old full copy): of K, and of V when it is not transposed
(flash attention), only the rows below `used_max_p1()` of each stream are captured, with their
byte ranges kept in the shadow (`device_buffer_shadow::ranges`), so a later change of the cell
metadata cannot shift the layout. Restore clears the new buffer first (the uncaptured cells read
as zero, as after the first allocation) and uploads the ranges. The `to_host` restore (disk cache
at exit, F11) scatters the ranges into a full-layout buffer. Measured on the 35B at ctx 131072
with a 9771-token prompt (scratch server, production command line and environment, `-lv 4`, fake
waiter; `/root/arms/la-win/kv-*.log`): the KV step of the release 1924 ms -> 170 ms, RSS while
cold 5856 -> 3488 MiB (the KV shadow 2560 MiB -> about 190 MiB), clean exit on a warm and a cold
SIGTERM. The restore uploads the same smaller amount (not timed separately).
- Scheduler: with `evict_kv`, `sched.reset()` frees the worst-case compute buffer and
`sched_need_reserve = true`; restore calls `sched_reserve()` (which goes through `sched_new()`,
re-registering the expert-copy callback and upstream's realloc callback).
@@ -1885,9 +1904,13 @@ Machine-level:
the cache is on in production. Remaining gap: only the 35B and gemma were checked in production;
other models gain the flag only if they use those macros.
- A SIGTERM during an arbiter release with `LLAMA_SLEEP_EVICT_KV` (F4, not F11) pays that release's
host shadow of the full KV allocation (about 2.6 GB for the 35B at ctx 131072) and its D2H time
(token free in about 1.9 s) before the exit. The same is true of every cold 35B, which holds that
shadow while it is cold.
host shadow of the KV and its D2H time before the exit. Since 2026-11-23 the shadow holds only the
used cells (F4): about 2.6 GB and 1.9 s for a full 35B context at ctx 131072, about 0.2 GB and
0.17 s for a 10K-token conversation.
- Expert lookahead (F16 on branch `fable5/expert-lookahead-20261123`, not deployed): +12.6% Qwen 35B
pp2048 and +6.2% at d16384, byte-identical 35B output, but Inkling's output is garbage with it on
(cause open) and the 35B compute buffer grows by 512 MiB. The F16 section, the numbers and the next
diagnostic step are in FORK.md on that branch.
- F11 saves only the slots, not the RAM prompt cache entries, and every deploy empties it (the key
holds the build commit). Its exit write delays a llama-swap model switch by about 1 s per GB.
- From the 2026-11-23 window (`/root/arms/overnight2/STATUS.md`), measured and not adopted:
+19 -4
View File
@@ -443,6 +443,19 @@ setsid nohup sh /root/bench/moe/swapdown.sh /root/arms/fv-perf.sh > /root/arms/f
restored from the copy, `/v1/models` 200 (`deploy-try1.log`). After `git checkout --detach` in
that worktree the second try built and probed fine: downtime 129 s, `system_fingerprint`
`b12653-92fe769a0` (`deploy.log`). Section 8 checks (`post.sh`, `post.log`): 35B, 4B task and gemma answers correct with `holder` on the answering PID across 35B/4B/gemma handoffs, gemma image red, both Inkling entries correct on the 59-token first prompt, short, image, tool (`get_weather`, city Warsaw) and a 29.4K-token Pan Tadeusz prompt (94.4 / 92.1 t/s prefill), disk cache saved and restored (1157 tokens, restored in 172 ms), log scan 0 asserts or Vulkan errors, Mesa 26.3.1 variables in every llama-server environ, power cap 120 W, children on llama-swap ports, pod restarts 0; dmesg shows a memory-cgroup OOM kill of nginx-ingress processes (their own cgroup limit, no llama process) during the checks.
- KV used cells and expert lookahead, 2026-11-23 evening (scripts and logs `/root/arms/la-win/`,
windows under swapdown 16:58-18:01 Warsaw). Expert lookahead (F16, branch
`fable5/expert-lookahead-20261123`): 35B prefill +12.6% / +6.2% (d16384), but Inkling output is
garbage with it on; not deployed (FORK.md on that branch, section F16). KV used-cells shadow
(F4, branch `fable5/kv-used-shadow-20261123` = `9d8a4ffc6` on top of `6a6c6c4e4`), clean build
`/root/arms/kv1123/build`: `fork-validate.sh --arbiter --diskcache` 31 PASS, 0 FAIL, 0 SKIP
against production `92fe769a0` (`fv-kv.log`; handoff median 524.5 ms against 658.5 ms), and on
the 35B with the production command line (`kvtest.sh`, `kv-*.log`): KV release step 1924 -> 170
ms, cold RSS 5856 -> 3488 MiB, greedy output after the restore identical, warm and cold SIGTERM
exit 0. Trap: an earlier candidate tree had three builds running at once and kept objects
compiled from an older header; its arbiter shutdowns all exited 139 (`fv.log`), the clean tree
passed. Deployed `9d8a4ffc6` with `/root/arms/la-win/deploy.sh` (pointer 19 = `92fe769a0`),
downtime 33 s, `system_fingerprint` `b12655-9d8a4ffc6`; section 8 checks `post.log`.
- What the 2026-11-22 window must run, in this order (GPU to itself under swapdown; about 75-90
minutes in all):
1. Phase 2 as written above with `W=/root/arms/reb20261122` (about 32 minutes).
@@ -528,8 +541,8 @@ Run the stop, build and start (steps 4-7) as one script on the pod, started with
1. **Rollback pointer.** Record the current production commit in the next free pointer file, as the
full SHA alone on line 1 (older files mix full SHAs, short SHAs and extra text; see section 9):
```sh
ls /root/DEPLOY-ROLLBACK-commit-*.txt # last used: 18 (holds ec3bf13f6)
git -C /root/llama.cpp rev-parse HEAD > /root/DEPLOY-ROLLBACK-commit-19.txt
ls /root/DEPLOY-ROLLBACK-commit-*.txt # last used: 19 (holds 92fe769a0)
git -C /root/llama.cpp rev-parse HEAD > /root/DEPLOY-ROLLBACK-commit-20.txt
git -C /root/llama.cpp status --short # must be clean
```
2. **Check out the candidate** in the production tree (fetch first; the branch must be on gitea, or already local after a bundle fetch, section 3):
@@ -739,11 +752,13 @@ commit-10 `6c480f7e7`, commit-11 was used by the failed cb48bf224 deploy, commit
commit-16 holds `b13c41355`, commit-17 holds `f3397cded` (config backup
`/root/config.yaml.bak-20261123-predeploy`: it removes the Inkling `LLAMA_LOOP_FULL_COPY=0` env), and
commit-18 holds `ec3bf13f6`, the rollback target for the slimmed production branch
`fable5/vram-ondemand-rebase-20261123` (next free: 19; build copy `/root/arms/build-ec3bf13f6`; config
`fable5/vram-ondemand-rebase-20261123` (build copy `/root/arms/build-ec3bf13f6`; config
unchanged by that deploy, backup `/root/config.yaml.bak-20261123-run3`; branch
`fable5/vram-ondemand-rebase-20261122`). After that deploy `inkling_args` went from `-tb 12` to
`-tb 6` (config only, backup `/root/config.yaml.bak-20261123-tb`); a rollback to commit-18 can keep
it. The formats vary
it. commit-19 holds `92fe769a0`, the rollback target of the 2026-11-23 KV used-cells deploy
(`9d8a4ffc6` on the same branch name; build copy `/root/arms/build-92fe769a0`, config unchanged;
next free: 20). The formats vary
(commit-4 to 6 hold short SHAs, commit-6 has branch and date after the SHA, commit-9 a subject on
line 2), hence `head -1 | cut -d' ' -f1`. New pointers: the full SHA alone on line 1.