Files
leleka/docs/experiments/baseline-pair-5090.md
T

114 lines
16 KiB
Markdown

# Ours against vanilla Strata 0.2.6 on the RTX 5090: balanced paired runs with a machine-state record (claude/baseline-pair)
Date 2026-10-31. RTX 5090 server `rnr5090`, Ryzen 9 9950X3D, uptime 29.8-34.7 h during the runs, frozen corpus, ~245k context, 5 turns, `--max-output 300`, final-turn input 246,862-246,961 tokens.
Labels: M measured in the run named. All 33 runs of parts a and b are VALID (validity rules of `speedtrain3-ab.sh`; vanilla arms also checked against their engine log for the tail-skip / CPU-share lines).
Part c (new main binary, two PCIe shares) is **queued, not measured** at the time of writing; section 7.
## 1. Result
* **Ours is level with vanilla in the interleaved design, and it is the only arm that repeats.** Ours 143.4 tok/s (sd 2.0, n=11). Vanilla v2 142.1 (sd 14.7, n=16), v1 145.4 (sd 11.6, n=6), vanilla pooled 143.0 (sd 13.8, n=22). Block-paired (part a, 6 blocks): ours - v1 -2.0 tok/s (-0.9 %), ours - v2 -0.3 tok/s (+0.8 %), both 95 % intervals about +-13..16 tok/s (+-10 %). No sign of a difference either way.
* **Against vanilla in its good state, ours is behind.** Vanilla runs that got the whole expert arena as transparent huge pages (n=12) average 147.8 tok/s (sd 13.3; best runs 160-174); ours is 3 % behind that mean (143.4), 10-18 % behind the best runs. Vanilla runs that started right after an ours run (partial huge pages, n=10) average 137.2; ours is 4.5 % ahead of those. Which of the two numbers is "the" comparison is a matter of what vanilla's real operating state is; the first is vanilla in isolation, the second is what an interleaved design inflicts on it.
* **Why the earlier 161.3 vs 138.9 looked like a 14 % gap:** the vanilla runs of that series were in the good class (the 160-174 runs here have the same signature), ours is 139-146 in every series (the 2026-10-30 n-series, older binary, 138.8-143.7; here 143.4).
* **Round view (M):** ours 14.14 ms/round at 2.03 tokens/round; vanilla 13.14 ms/round at 1.86 tokens/round. Ours has longer rounds and accepts more drafts per round; the two nearly cancel.
* **Vanilla drift:** partly explained (section 5): a vanilla launch that follows an ours run gets 44.0-45.1 GiB of its 46.8 GiB arena as huge pages instead of 46.4-46.7 GiB, because free memory in 2 MiB or larger blocks is 40-46 GiB instead of 49 GiB; those runs are 10-12 tok/s (7-8 %) slower on average (Welch t -2.2 on 9 against 12 runs, one of about 20 variables looked at: suggestive, not proven). CPU clocks, GPU clocks, temperature, PCIe probe, PCIe share, hit rates and uptime (30-35 h) do not explain it. 62-78 % of vanilla's remaining run-to-run spread (sd 13 tok/s inside the good class) is round time, not acceptance, and nothing I recorded correlates with it.
## 2. Method
* **Ours** = `dt/bin-footprint3b` (claude/slots-footprint3 9e13fc809). `git diff 9e13fc809 e381c3082` outside `docs/` and `scripts/` is empty, so this is the code of main e381c3082 (the task's minimum). Shipped lossless defaults: seed off, upstream ranked profile, auto slots (12,192), budget 31,300 MiB, spec-min-p 0, prefix cache auto, nothing experimental. The harness `run-e2e.sh` exports `LELEKA_ORIGINAL_SERVE_PCIE_FRAC=0.55` when unset (the product default is 0.45; cpu-service found this): **every ours arm of parts a and b ran PCIe share 0.55**. Vanilla settles at 0.35 by itself in every run (M, CPU pool 42-44 us per expert, probe 49.8-51.0 GB/s).
* **v1** vanilla Strata 0.2.6 shipped defaults (route tail skip ON rank 7, prefill CPU share ON). **v2** `STRATA_ROUTE_TAIL_SKIP=0 STRATA_PREFILL_CPU_SHARE=0` (lossless-comparable). Same launch line and client as `speedtrain3-ab.sh`.
* **Order.** Part a: 6 blocks of the three arms in the 6 permutations (three reversed pairs: every arm is first, second, last twice; ABBA generalised). A block is the unit of pairing. Part b: 5 x (v2 v2 ours), a predecessor test (vanilla directly after ours against vanilla directly after vanilla, interleaved in time).
* **Warm-up discipline.** Identical start procedure for every arm (no GPU process, load1 < 0.5, GPU <= 48 C, nothing dropped or pre-touched); the state is recorded, not normalised. Block 1 is not discarded.
* **State record** (`baseline-sampler.py`, read-only, pinned to CPU 31): `pre.jsonl` before an arm, `state.jsonl` during it (full sample every 15 s, per-CPU clocks and load every 2 s), `post.jsonl` after: per-CPU `scaling_cur_freq` and utilisation, governor / driver (powersave, amd-pstate-epp, balance_performance, boost 1), `/proc/meminfo` (AnonHugePages, HugePages_*, MemAvailable, Cached, Shmem), THP `enabled` (madvise) / `defrag` (madvise), `/proc/buddyinfo`, THP / compaction / allocstall counters of `/proc/vmstat`, uptime, loadavg, PSI, `nvidia-smi` (SM and memory clocks, temperature, power, P-state, throttle reasons), for the GPU process its `Cpus_allowed_list`, `smaps_rollup` (AnonHugePages, Rss), every thread (tid, name, last CPU, CPU ticks, affinity), and the top-5 other CPU consumers. Client lines are timestamped (`client.ts.log`) so decode windows can be joined to samples.
* **tokens/round, ms/round.** Ours: `produced / rounds` of the request outcome line and decode time = 300 / client tok/s. Vanilla: engine line "N generated in X ms, drafts accepted A of M": rounds = N - A.
* **Provenance and frozen inputs:** `/data/leleka-e2e/baseline-pair/MANIFEST.sha256` (tools, ours binaries, harness, profile, corpus manifest, vanilla launcher and engine 0.1.50, settings) is verified at every job start; `PROVENANCE.txt`. The tools were reinstalled three times between jobs (line endings, options); the sampler and job logic of part a are those of the first install apart from line endings and the later `SEQ`, `PRE_ARM_HOOK`, `ours45` additions. Part b's first launch failed in the first second (CRLF line endings my edit introduced, no GPU time used) and was re-queued as `bp-b2`.
## 3. Part a: balanced blocks (M, `runs/baseline-pair`, uptime 29.8-31.3 h)
| run | tok/s T1..T5 | all-turn | tok/round | ms/round | arena AnonHugePages GiB | thp fallback pages |
| --- | --- | ---: | ---: | ---: | ---: | ---: |
| b01 ours | 146.0 143.7 142.5 137.2 157.1 | 145.3 | 2.08 | 14.32 | 0 | 0 |
| b01 v1 | 128.9 177.9 162.6 154.2 155.8 | 155.9 | 1.76 | 11.43 | 44.6 | 1144 |
| b01 v2 | 136.7 149.7 146.0 134.4 137.1 | 140.8 | 1.81 | 12.89 | 46.6 | 145 |
| b02 v2 | 165.5 175.4 186.2 157.8 186.2 | 174.2 | 2.01 | 11.55 | 46.7 | 61 |
| b02 v1 | 146.6 158.9 158.7 172.0 169.7 | 161.2 | 1.82 | 11.32 | 46.6 | 143 |
| b02 ours | 139.9 144.8 137.0 148.5 151.7 | 144.4 | 2.04 | 14.14 | 0 | 0 |
| b03 v1 | 151.3 122.7 151.4 124.9 117.8 | 133.6 | 1.80 | 13.57 | 44.7 | 1102 |
| b03 v2 | 140.4 152.1 143.9 138.7 120.9 | 139.2 | 1.83 | 13.20 | 46.4 | 232 |
| b03 ours | 140.1 145.3 142.9 142.6 137.9 | 141.8 | 1.98 | 13.97 | 0 | 0 |
| b04 ours | 140.0 145.1 137.4 148.6 152.0 | 144.6 | 2.04 | 14.09 | 0 | 0 |
| b04 v2 | 157.5 144.0 172.0 123.0 121.7 | 143.6 | 1.89 | 13.27 | 44.7 | 1073 |
| b04 v1 | 136.8 135.2 165.8 137.3 155.6 | 146.1 | 1.89 | 12.99 | 46.5 | 187 |
| b05 v2 | 167.0 136.6 135.1 133.6 132.4 | 140.9 | 1.93 | 13.75 | 46.7 | 60 |
| b05 ours | 139.9 145.1 137.2 148.2 145.8 | 143.2 | 2.00 | 14.01 | 0 | 0 |
| b05 v1 | 134.0 135.7 147.1 120.7 124.2 | 132.3 | 1.86 | 14.04 | 44.7 | 1095 |
| b06 v1 | 159.6 139.3 142.0 138.1 136.2 | 143.0 | 1.87 | 13.05 | 46.5 | 157 |
| b06 ours | 140.1 145.0 136.5 140.6 142.5 | 140.9 | 1.95 | 13.87 | 0 | 0 |
| b06 v2 | 121.9 123.9 126.1 130.1 114.5 | 123.3 | 1.86 | 15.11 | 44.5 | 1194 |
(Rows in run order within a block as executed; the block number is the pairing unit.)
| arm | n | all-turn tok/s mean (sd) | min..max | tok/round | ms/round (sd) |
| --- | ---: | ---: | --- | ---: | ---: |
| ours | 6 | 143.4 (1.7) | 140.9..145.3 | 2.02 | 14.06 (0.15) |
| v1 | 6 | 145.4 (11.6) | 132.3..161.2 | 1.83 | 12.73 (1.12) |
| v2 | 6 | 143.7 (16.6) | 123.3..174.2 | 1.89 | 13.29 (1.16) |
Block-paired differences (same block, a - b, all-turn mean tok/s):
| pair | per block 1..6 | mean | pairs a faster | ms/round | tok/round |
| --- | --- | ---: | ---: | ---: | ---: |
| ours - v1 | -10.6 -16.8 +8.1 -1.5 +10.9 -2.1 | -2.0 (-0.9 %), se 4.3 | 2 of 6 | +1.33 | +0.18 |
| ours - v2 | +4.5 -29.8 +2.6 +1.0 +2.3 +17.6 | -0.3 (+0.8 %), se 6.4 | 5 of 6 | +0.77 | +0.13 |
| v1 - v2 | +15.1 -13.0 -5.6 +2.5 -8.6 +19.7 | +1.7 (+1.8 %), se 5.4 | 3 of 6 | -0.56 | -0.06 |
v1 and v2 are not different; the lossy tail skip and the prefill CPU share buy nothing measurable on this card at this context.
Position in the block: ours 145.0 / 142.1 / 143.1 (first / second / third), v1 138.3 / 158.5 / 139.2, v2 157.6 / 141.4 / 132.0 (n=2 each; the vanilla pattern is the predecessor effect of section 5, not position).
## 4. Part b: predecessor test (M, `runs/baseline-pair-b`, uptime 33.5-34.7 h)
5 x (v2, v2, ours); the first v2 of a triple follows ours, the second follows v2.
| run | tok/s T1..T5 | all-turn | tok/round | ms/round | AnonHugePages GiB | thp fallback |
| --- | --- | ---: | ---: | ---: | ---: | ---: |
| b01 v2 (after cpu-service jobs) | 160.0 171.4 164.3 137.2 127.8 | 152.1 | 1.90 | 12.59 | 44.4 | 1231 |
| b01 v2 | 140.1 152.4 140.4 125.1 134.1 | 138.4 | 1.84 | 13.30 | 46.4 | 213 |
| b01 ours | 139.8 145.0 142.6 147.8 148.3 | 144.7 | 2.05 | 14.19 | 0 | 0 |
| b02 v2 (after ours) | 113.6 151.8 115.9 113.5 122.2 | 123.4 | 1.74 | 14.25 | 45.1 | 905 |
| b02 v2 | 133.9 177.0 174.6 174.8 141.1 | 160.3 | 1.95 | 12.39 | 46.6 | 141 |
| b02 ours | 142.3 161.2 143.6 145.3 142.2 | 146.9 | 2.11 | 14.36 | 0 | 0 |
| b03 v2 (after ours) | 153.9 171.3 151.1 136.1 129.0 | 148.3 | 1.91 | 12.96 | 44.0 | 1453 |
| b03 v2 | 120.5 126.6 153.0 137.8 131.9 | 133.9 | 1.92 | 14.39 | 46.6 | 118 |
| b03 ours | 139.7 147.2 141.0 140.0 135.1 | 140.6 | 2.02 | 14.39 | 0 | 0 |
| b04 v2 (after ours) | 112.7 131.2 110.4 135.0 115.8 | 121.1 | 1.77 | 14.63 | 44.3 | 1297 |
| b04 v2 | 119.3 134.4 133.8 140.1 136.4 | 132.8 | 1.80 | 13.64 | 46.6 | 110 |
| b04 ours | 146.1 143.8 143.3 142.1 144.4 | 143.9 | 2.04 | 14.19 | 0 | 0 |
| b05 v2 (after ours) | 157.2 144.2 141.2 120.8 127.3 | 138.1 | 1.89 | 13.69 | 44.5 | 1204 |
| b05 v2 | 157.5 163.3 168.7 156.6 166.3 | 162.5 | 1.79 | 11.02 | 46.5 | 177 |
| b05 ours | 139.7 142.4 145.9 141.1 138.2 | 141.5 | 1.98 | 13.99 | 0 | 0 |
Ours: 143.5 (sd 2.5, n=5). v2: 141.1 (sd 14.3, n=10). Vanilla after ours (4 runs here) 132.7 against after vanilla (5 runs) 145.6; the first v2 of block 1 followed cpu-service jobs and also got partial coverage.
## 5. Drift analysis (parts a + b pooled, vanilla n=22, ours n=11)
1. **Predecessor, huge pages and free 2 MiB blocks (M).** Vanilla requests `MADV_HUGEPAGE` for its 23,983 x 2 MiB (46.8 GiB) expert arena (`MAP_HUGETLB unavailable, vm.nr_hugepages=0`; THP is `madvise`, defrag `madvise`). Free memory in blocks of 2 MiB or more before the launch (buddyinfo) was 48.1-49.6 GiB after a vanilla run and 40.0-45.9 GiB after an ours run (ours holds 57 GiB in 4 KiB pages and exits leaving a fragmented free list; it uses no huge pages: AnonHugePages 0 in all 11 runs). With >= 48 GiB free the arena got 46.4-46.7 GiB of huge pages (fallback 60-232 pages of 2 MiB); with <= 46 GiB it got 44.0-45.1 GiB (fallback 905-1453 pages). The classification is perfect in 22 of 22 runs. Per class: full coverage n=12 147.8 tok/s, 12.79 ms/round; partial n=10 137.2, 13.55 ms/round. Vanilla after ours - after vanilla: -12.3 tok/s (-8 %), +0.87 ms/round (Welch t -2.2 and +1.9; I looked at about 20 variables, so read this as suggestive). The kernel does compact: `kcompactd0` burned 5-31 s of CPU per vanilla launch (ours 0.4-1.8 s), mostly before the first request; during the session itself it used 0-4.5 s and does not correlate with decode speed (r about +-0.4, n=12, mixed sign).
2. **Uptime.** Part a alone looked like a trend (vanilla ms/round +1.9 ms per hour over 29.9-31.3 h, r 0.79); part b, 3 hours later, has the same predecessor pattern and no trend (pooled +0.13 ms per hour over 29.8-34.7 h). The part-a trend was the predecessor pattern aliased with time. Uptime beyond that range (the 175 tok/s right after a reboot) is not covered; a freshly booted machine has unfragmented memory, which fits the mechanism but was not tested.
3. **Frequency.** Busy cores (utilisation > 40 %) averaged 5.43-5.52 GHz in the decode windows of 30 of 33 runs, all arms (max 5.756 GHz); three runs show lower means (5083 vanilla b06, 5215 vanilla b-b01, 4968 ours b-b01), which I read as a sample where a lightly loaded core sat at its 2.98 GHz idle clock but did not check per run. Correlation with tok/s or ms/round is not significant (r -0.34..+0.46, n=12-30) and flips sign between v1 and v2. Governor is `powersave` with amd-pstate-epp and EPP balance_performance, boost on; it did not limit the busy cores.
4. **GPU.** SM clock 2872-2917 MHz, temperature 56-66 C, power 304-458 W (full samples inside decode windows, runs that had one); the throttle-reason field was recorded but not analysed. Correlation with vanilla speed is confounded by time and not independent.
5. **Not explanatory:** PCIe probe (49.8-51.0 GB/s, r about 0), final `pcie_frac` (0.35 in all 22), CPU pool us per expert (42-44), decode VRAM hit rate (97.1-98.5 %; v1 98.4-98.5 vs v2 97.1-97.4 by construction of the tail skip), PCIe-read share, foreign process CPU (nothing but kernel threads, the agent daemons and the sampler), page cache (Cached 57.5 or 59.2 GiB before a run is the same predecessor pattern).
6. **Variance split (turn level, 30 turns per arm of part a):** ours' turn-to-turn spread is acceptance (tokens/round explains ~110 % of the log tok/s variance, round time ~-10 %); vanilla's is 62-78 % round time (ms/round) and 21-38 % acceptance. So vanilla's instability is mostly in how long its rounds take, and inside the full-coverage class (sd 13 tok/s) I have no explanatory variable. Ours is stable (sd 2.0, ms/round sd 0.17) in all three state classes.
7. **Does ours drift too?** Part a: all-turn 145.3, 144.4, 141.8, 144.6, 143.2, 140.9 over 1.6 h (r with uptime -0.77, n=6); part b 144.7, 146.9, 140.6, 143.9, 141.5. Pooled over 29.8-34.7 h r = -0.11 (slope -0.11 tok/s per hour). No drift established. Ours' predecessor does not matter (after vanilla 143.1, n=9; after ours 144.6, n=1).
Limitations: the sampler runs on CPU 31, the SMT sibling of pool worker 15, for ~2 ms per 2 s plus ~100 ms per 15 s, in every arm alike; it was not switched off for a control. n is small (6 blocks); intervals are t-approximations. The harness gives ours PCIe share 0.55, vanilla self-tunes to 0.35. Vanilla runs at its shipped settings including its own pinned-memory behaviour; the 54 GiB `Shmem` of the KAR holder is present in all arms and leaves ~9-11 GiB MemAvailable during a vanilla run, which may be what makes huge-page availability matter. Nothing was changed on the machine.
## 6. Owner-run test of the mechanism (not run by me)
`scripts/e2e/decode/owner-compact-memory.sh` (root) asks the kernel to compact free memory once and prints free 2 MiB+ blocks before and after. Used through the job's `PRE_ARM_HOOK` with `SEQ="v2 ours v2 ours ..."` it tests whether "vanilla after ours" loses its penalty once memory is compacted before the launch. It changes no setting. Nothing else (THP knobs, governor) needs changing for the hypotheses above; I did not test any.
## 7. Part c (queued): main 11e021161, both PCIe shares
Per the orchestrator: `dt/bin-cpuservice` = claude/cpu-service bba658f20; `git diff bba658f20 11e021161` outside docs/scripts is empty, so it is the code of main 11e021161 (vectorised single-token IQ3 CPU kernel, bit-identical). Job `bp-c` (6 balanced blocks x {ours at 0.55 = harness default, ours45 at the product default 0.45, vanilla v2}, 18 runs, ~90 GPU-min, `runs/baseline-pair-c`) is queued FIFO behind the cpu-service2 jobs. Results are not in this page. Analyse with `python3 -I /data/leleka-e2e/baseline-pair/analysis/baseline-analyze.py /data/leleka-e2e/runs/baseline-pair-c --csv bp-c.csv` and `baseline-pred.py`. v1 is not re-run (v1 = v2 within noise in part a).
## 8. Reproduce
`scripts/e2e/decode/baseline-install.sh` (on the server) installs the tools; stubs `bp-a.sh`, `bp-b2.sh`, `bp-c.sh` in `~/work/gpu-runs/holder2/jobs/` hold the environment of each part (`BLOCKS`, `SEQ`, `OUTR`, `BINDIR`, `SUBST_V1`). Analysis: `baseline-analyze.py`, `baseline-turns.py`, `baseline-compact.py`, `baseline-pred.py` (outputs in `/data/leleka-e2e/baseline-pair/analysis/`). Data: `/data/leleka-e2e/runs/baseline-pair{,-b,-c}/<run>/` (`long-session.json`, `client.ts.log`, `engine.log` or `inference.log`, `pre/state/post.jsonl`, `startup.txt`, `VALIDITY.txt`).