From d438db62f9ba62bdbd1f5ede88ef9e7310d9fcd5 Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Thu, 12 Nov 2026 03:25:15 +0100 Subject: [PATCH] ledger H4: control gate (shares 0.35/0.55 vs 0.45) - max d_top1 0.67..0.75 is the size of any placement change; control-relative rule applies; candidate passes Co-Authored-By: Claude Sonnet 5.5 --- docs/experiments/step-ledger.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/experiments/step-ledger.md b/docs/experiments/step-ledger.md index c05c9e3c..536cc34c 100644 --- a/docs/experiments/step-ledger.md +++ b/docs/experiments/step-ledger.md @@ -191,7 +191,7 @@ The tier adapts every 4 rounds and survives across requests. | H1 | VRAM hit share in the replay | 90.8 % | 92.8 % | -2.0 points; 28 % more misses | LOG | device | open (2026-11-11 `docs/experiments/vram-hit-share-gap.md`: the -2.0 does not reproduce, the two surviving VANL replays give 91.8 unweighted / 93.4 token-weighted; gap on the 30-request replay is -0.7..-1.3 points token-weighted, -1.0..-1.6 unweighted) | | H2 | VRAM hit share weighted by decode time in real sessions | nestng-crm 91.38 %, ttt 92.68 % | 92.41 %, 93.38 % | -1.03 and -0.70 points; at most 0.57 ms per round per point, so up to 0.59 and 0.40 ms per round | LOG | device | open | | H3 | short requests (< 600 tokens) hit share | 86.9 % | 89.9 % | -3.0 points (up to 7 in single requests) | LOG | device | open | -| H4 | expert slots | 12,192 | 12,575 (+3 %) | -383 slots; variant H (reserves 130 / 500 MiB, about +190 slots): VRAM share +0.44 points, ms/round -0.44 (-2.19 %, CI -3.55..-0.83), tokens per round -1.69 %, decode +0.51 % (CI -0.19..+1.20), end-to-end +1.06 % (CI -0.38..+2.50) | A/B `ab-l3v2` | device | fixing (CORRECTION 2026-11-11 `docs/experiments/vram-hit-share-gap.md`: the earlier reading that variant H 'gained nothing' was an env leak; the clean paired A/B `ab-l3v2` (10 pairs, H 12,384 slots against A 12,192) is a real gain: hit share +0.44 points token-weighted (CI +0.24..+0.64), ms/round -2.10 % (CI -3.61..-0.59), decode tok/s +0.67 % (CI +0.02..+1.31); about 0.23 points per 100 slots, 383 missing slots are worth about 0.9 of the 1.3-point gap. Not enabled: the free VRAM at decode drops to about 355 MiB (vanilla 315), and the project rule is that real work is 256k: before any profile change a run on the 245k corpus (docs/quality-gate.md q245, `leleka/decode/`, sha in the manifest) with the memory profile, the minimum free VRAM along the run, no OOM or refusal and the memory governor without incident is required, and the memory owner (hex-finish, 2026-11-11) names the threshold: no stricter rule exists, vanilla's own minimum free VRAM of 315 MiB (`vram-footprint-5090.md`: 389 at request start, 315 after the windows are captured; `decode_headroom_mib()` = 700+130-514 = 316) is the proof of safety, so 355 MiB is inside it. Pass criteria: (1) minimum free VRAM by 100 ms sampling (`mon.csv`) over the WHOLE 245k corpus session >= 315 MiB, (2) 0 request failures / CudaExecution / OOM, (3) 3 repeats (the adaptive tier is not bitwise reproducible), (4) the cost confirmed: 12,384 slots. The VRAM floor is set by decode_reserve + usable_room (`original_cache_startup.rs`), not by the memory governor (host RAM). No current 256k stub with a memory profile exists in jobs/: nearest are `987-decode-vram` (dc-g2, `run_corpus` of dec-common.sh, prints the minimum free VRAM, old binary) and `q245-*`; the plan is `run_corpus` with the current binary and the two variables. Group A/B `decode-slots-and-adapt-every-group-ab-pg-vs-ps-pw` (PS = alias + reserve 130) queued; the per-layer-quota arm (EXPERT_PER_LAYER=no) is measured by hex-finish (`host-tier-global-rank-fill-vs-uniform-layer-quota-profile`)) UPDATE 2026-11-12: 256k session check `memory-256k-codex-session-alias-reserve130-vram-floor` (release 02c784249, alias + reserve 130, 12,432 slots, Codex fixbug-ledger x3 at 178-228k input tokens, 100 ms sampler): 0 OOM/CudaExecution, 3 accepted, but the minimum free VRAM is 212 MiB (about 400 at the start, 312 -> 212 at the longest contexts; 478 of 12,792 samples below 315): NOT PASSED. Reserve 130 is too small; about +100 MiB of reserve (about -55 slots) would be needed for the 315 floor. The group A/B (PG against PS/PW) is rerun (`decode-slots-and-adapt-every-group-ab-pg-vs-ps-pw-rerun`, the first run was refused by the faulty guard). The hex-finish candidate (quota=no + PCIE_FRAC 0.65, +62 slots, reserve unchanged) is checked separately by `memory-256k-codex-session-quota-no-pcie065-vram-floor`. 2026-11-11 `host-tier-global-rank-fill-vs-uniform-layer-quota-profile` (pkg-s19, 30 requests, profiled, FP GLP GLP FP, key proven different: log `expert cache 12192 slots (per layer)` against `12254 slots (global)`): global rank fill instead of the 254-slot uniform quota (`LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER=no`, set through a profile override because the built-in profile overrides the shell env): VRAM share 89.76/90.38 -> 91.21/91.12 (+1.1 points), non-resident experts per layer-window 2.96/2.67 -> 2.40/2.47 (-13.5 %), layer 0 non-resident 7.0 -> 2.35 (layers 0-15 3.9 -> 3.1), ms/round (`round.run_window`) 16.33/15.55 -> 15.03/15.19 (mean 15.94 -> 15.11, -5.2 %), decode 186.0/182.8 -> 186.4/187.8 tok/s (+1.5 %, 2 reps, A/A floor +-1 %). Slots differ by 62 (12,254 against 12,192), about 0.1 point of the gain. Placement-class: needs the quality gate against the control placement and the VRAM/OOM floor before it may become a default. Cross-layer potential of the swap rule (`tier.cross.*`, uncapped): global minus within-layer swap gain is 0.02-0.03 % of the usage mass in both layouts (within 517 / global 524 against usage mass 27,443; miss mass 6.1 % uniform, 5.3 % global), so moving slots between layers at adaptation time adds nothing; the gain of the global fill is the initial layout, which the capped swaps (96 per 4 rounds) repair slowly (H3/H7). The layer-weight policy is therefore not needed. 2026-11-12 PLACEMENT GATE (`host-tier-quota-no-and-pcie-share-065-placement-gate`, teacher-forced night5-long-256k, 5 requests to 243k, 240 forced tokens, adaptive tier, rt-pf21 = 02c784249a7e, A/A floor 0 in all three processes): P2 = EXPERT_PER_LAYER=no + PCIE_FRAC 0.65 against the shipped placement: 1,720 common rows, argmax flips 33 (1.92 %), d_top1 p99 0.210, max 0.653; P3 = share 0.65 only: 1,741 rows, flips 39 (2.24 %), p99 0.198, max 0.763. Against the Original envelope (p99 <= 0.22, max <= 0.43, flips <= 2.8 %): p99 and flip rate inside, the single-row max outside for both (the quota change adds nothing worse than the share change alone); the draft trace differs from the first row on by construction (placement-class). Verdict: NOT a clean PASS (max); the control `host-pcie-share-control-placement-gate-035-and-055` (shares 0.35 and 0.55 against 0.45, same reference) decides whether the max is the size of any ordinary placement change. VRAM/OOM floor: the speed session's 256k Codex run of its own variant (alias + DECODE_RESERVE 130, 12,432 slots) measured a minimum free VRAM of 212 MiB (rule >= 315) with 0 OOM: FAIL for that variant; the candidate (quota=no + share, default reserve) has not been run at 256k. Default stays unchanged; the candidate is an option only. | +| H4 | expert slots | 12,192 | 12,575 (+3 %) | -383 slots; variant H (reserves 130 / 500 MiB, about +190 slots): VRAM share +0.44 points, ms/round -0.44 (-2.19 %, CI -3.55..-0.83), tokens per round -1.69 %, decode +0.51 % (CI -0.19..+1.20), end-to-end +1.06 % (CI -0.38..+2.50) | A/B `ab-l3v2` | device | fixing (CORRECTION 2026-11-11 `docs/experiments/vram-hit-share-gap.md`: the earlier reading that variant H 'gained nothing' was an env leak; the clean paired A/B `ab-l3v2` (10 pairs, H 12,384 slots against A 12,192) is a real gain: hit share +0.44 points token-weighted (CI +0.24..+0.64), ms/round -2.10 % (CI -3.61..-0.59), decode tok/s +0.67 % (CI +0.02..+1.31); about 0.23 points per 100 slots, 383 missing slots are worth about 0.9 of the 1.3-point gap. Not enabled: the free VRAM at decode drops to about 355 MiB (vanilla 315), and the project rule is that real work is 256k: before any profile change a run on the 245k corpus (docs/quality-gate.md q245, `leleka/decode/`, sha in the manifest) with the memory profile, the minimum free VRAM along the run, no OOM or refusal and the memory governor without incident is required, and the memory owner (hex-finish, 2026-11-11) names the threshold: no stricter rule exists, vanilla's own minimum free VRAM of 315 MiB (`vram-footprint-5090.md`: 389 at request start, 315 after the windows are captured; `decode_headroom_mib()` = 700+130-514 = 316) is the proof of safety, so 355 MiB is inside it. Pass criteria: (1) minimum free VRAM by 100 ms sampling (`mon.csv`) over the WHOLE 245k corpus session >= 315 MiB, (2) 0 request failures / CudaExecution / OOM, (3) 3 repeats (the adaptive tier is not bitwise reproducible), (4) the cost confirmed: 12,384 slots. The VRAM floor is set by decode_reserve + usable_room (`original_cache_startup.rs`), not by the memory governor (host RAM). No current 256k stub with a memory profile exists in jobs/: nearest are `987-decode-vram` (dc-g2, `run_corpus` of dec-common.sh, prints the minimum free VRAM, old binary) and `q245-*`; the plan is `run_corpus` with the current binary and the two variables. Group A/B `decode-slots-and-adapt-every-group-ab-pg-vs-ps-pw` (PS = alias + reserve 130) queued; the per-layer-quota arm (EXPERT_PER_LAYER=no) is measured by hex-finish (`host-tier-global-rank-fill-vs-uniform-layer-quota-profile`)) UPDATE 2026-11-12: 256k session check `memory-256k-codex-session-alias-reserve130-vram-floor` (release 02c784249, alias + reserve 130, 12,432 slots, Codex fixbug-ledger x3 at 178-228k input tokens, 100 ms sampler): 0 OOM/CudaExecution, 3 accepted, but the minimum free VRAM is 212 MiB (about 400 at the start, 312 -> 212 at the longest contexts; 478 of 12,792 samples below 315): NOT PASSED. Reserve 130 is too small; about +100 MiB of reserve (about -55 slots) would be needed for the 315 floor. The group A/B (PG against PS/PW) is rerun (`decode-slots-and-adapt-every-group-ab-pg-vs-ps-pw-rerun`, the first run was refused by the faulty guard). The hex-finish candidate (quota=no + PCIE_FRAC 0.65, +62 slots, reserve unchanged) is checked separately by `memory-256k-codex-session-quota-no-pcie065-vram-floor`. 2026-11-11 `host-tier-global-rank-fill-vs-uniform-layer-quota-profile` (pkg-s19, 30 requests, profiled, FP GLP GLP FP, key proven different: log `expert cache 12192 slots (per layer)` against `12254 slots (global)`): global rank fill instead of the 254-slot uniform quota (`LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER=no`, set through a profile override because the built-in profile overrides the shell env): VRAM share 89.76/90.38 -> 91.21/91.12 (+1.1 points), non-resident experts per layer-window 2.96/2.67 -> 2.40/2.47 (-13.5 %), layer 0 non-resident 7.0 -> 2.35 (layers 0-15 3.9 -> 3.1), ms/round (`round.run_window`) 16.33/15.55 -> 15.03/15.19 (mean 15.94 -> 15.11, -5.2 %), decode 186.0/182.8 -> 186.4/187.8 tok/s (+1.5 %, 2 reps, A/A floor +-1 %). Slots differ by 62 (12,254 against 12,192), about 0.1 point of the gain. Placement-class: needs the quality gate against the control placement and the VRAM/OOM floor before it may become a default. Cross-layer potential of the swap rule (`tier.cross.*`, uncapped): global minus within-layer swap gain is 0.02-0.03 % of the usage mass in both layouts (within 517 / global 524 against usage mass 27,443; miss mass 6.1 % uniform, 5.3 % global), so moving slots between layers at adaptation time adds nothing; the gain of the global fill is the initial layout, which the capped swaps (96 per 4 rounds) repair slowly (H3/H7). The layer-weight policy is therefore not needed. 2026-11-12 PLACEMENT GATE (`host-tier-quota-no-and-pcie-share-065-placement-gate`, teacher-forced night5-long-256k, 5 requests to 243k, 240 forced tokens, adaptive tier, rt-pf21 = 02c784249a7e, A/A floor 0 in all three processes): P2 = EXPERT_PER_LAYER=no + PCIE_FRAC 0.65 against the shipped placement: 1,720 common rows, argmax flips 33 (1.92 %), d_top1 p99 0.210, max 0.653; P3 = share 0.65 only: 1,741 rows, flips 39 (2.24 %), p99 0.198, max 0.763. Against the Original envelope (p99 <= 0.22, max <= 0.43, flips <= 2.8 %): p99 and flip rate inside, the single-row max outside for both (the quota change adds nothing worse than the share change alone); the draft trace differs from the first row on by construction (placement-class). Verdict: NOT a clean PASS (max); the control `host-pcie-share-control-placement-gate-035-and-055` (shares 0.35 and 0.55 against 0.45, same reference) decides whether the max is the size of any ordinary placement change. VRAM/OOM floor: the speed session's 256k Codex run of its own variant (alias + DECODE_RESERVE 130, 12,432 slots) measured a minimum free VRAM of 212 MiB (rule >= 315) with 0 OOM: FAIL for that variant; the candidate (quota=no + share, default reserve) has not been run at 256k. Default stays unchanged; the candidate is an option only. 2026-11-12 CONTROL (`host-pcie-share-control-placement-gate-035-and-055`, same binary, same reference idP1 = shipped 0.45, A/A floor 0 in both processes): an ordinary placement change of the same kind, the PCIe share alone: 0.35 (vanilla's share) 1,746 common rows, flips 39 (2.23 %), d_top1 p99 0.224, max 0.746; 0.55: 1,760 rows, flips 45 (2.56 %), p99 0.215, max 0.665. Candidate rows for reading side by side: quota=no + 0.65: flips 1.92 %, p99 0.210, max 0.653; share 0.65 only: flips 2.24 %, p99 0.198, max 0.763. The single-row max of 0.65..0.76 is therefore the size of ANY placement change (0.665 and 0.746 for a share step of 0.10 and 0.10), not a property of the candidate; the p99 and flip rate of the candidate are at or below the controls (p99 0.210 vs 0.215/0.224; flips 1.92 % vs 2.23/2.56 %). The Original envelope max <= 0.43 was measured on ~100-token prompts and is not applicable to the placement class at 243k context (every placement step overshoots it); the applicable rule is the control-relative one of `q_tail_gate.py --control` (p99, max and flip rate each <= 1.25 x the control's): the candidate passes it against the worst control (p99 0.210 <= 0.28, max 0.653 <= 0.93, flips 1.92 % <= 3.2 %). Quality gate of the candidate: PASS under the control-relative rule (n = 1 replay of 5 requests, 240 tokens, one workload; the second evidence is the e2e acceptance of the candidate run, not yet made). Still open for the candidate: the 256k VRAM/OOM floor (speed session's stub), then e2e (CRM x3 + ttt x3). Default unchanged. | | H5 | adaptive tie order (equal-gain swaps share the cap across layers, `LELEKA_ADAPT_TIE_SPREAD`, `9d130fd38`) | low layer first | | run `memory-tier-tie-spread-ab-first-half/xb` queued | gap doc | device | fixing | | H6 | tier knobs: adapt every 2, 192 swaps, decay 0.85, margin 1.0 (`spd-w1..w5`) | 4, 96, 0.7, 1.5 | same policy | runs queued | gap doc | device | fixing (W1 adapt every 2: earlier n=5 +0.56 points hit, +1.31 % tok/s (CI +0.77..+1.85); in the group A/B above as PW against PG, then 10 pairs if it holds) | | H7 | first rounds of a request see an unadapted tier | | | not isolated | gap doc | device | open (isolated for ours 2026-11-11 `docs/experiments/vram-hit-share-gap.md`: hit share 79 % in the first 4 windows of a request, 85 % at windows 16-31, 90 % at 32-63, 93 % from 128; the first 64 windows carry 20 % of the misses, a ceiling of 0.71 points; vanilla has no per-window log; a request-start warm-up needs code in `original_serve_residency/source_spans.rs`, hex-finish) |