STRA-338: integrate the engine track (kar-off-ab base, S5a, S5b, S13 ratchets) into the hexagonal base; the baseline is recomputed on the merged tree (growth only in the seven kar-off-ab files)

This commit is contained in:
Pavlo Ratushnyi
2026-11-05 21:51:28 +01:00
180 changed files with 28421 additions and 3731 deletions
@@ -0,0 +1,63 @@
# Codex + runtime + model: vanilla Strata against Leleka, results (RTX 5090, 2026-11-05)
Design: [codex-compare-5090.md](codex-compare-5090.md). Tables: `docs/e2e-data/codex-compare/` (`compare.md`, `compare.csv`, `index.md`, `rounds.csv`). 18 cells = 3 arms x 2 tasks x 3 repetitions, all finished, every one accepted.
This page states what the data shows and what it cannot resolve. It claims nothing as a performance improvement (AGENTS.md): the one clear signal below is **against** Leleka on speed.
## 1. What was run
* Arms: **LEL** = Leleka release package `leleka-0.1.0-17e372944279-5090-linux-x86_64.tar.xz` (sha256 `c4bbee3f...d356d69`), KAR, shipped configuration. **VANL** = vanilla Strata 0.2.6 with both lossy defaults off, the **reference** (owner).
**VAN** = vanilla Strata 0.2.6 with its shipped defaults (route tail skip and CPU prefill share ON; the stack log of `VAN/stack-r1` shows both). Same machine, model files and Codex CLI 0.163.0 (sha256 `399ff69c...c4215`), Node 22.23.4.
Temperature 0 injected for every arm; no AGENTS.md pad; limits 3000 s and 150 requests per cell (none reached).
* Tasks: `ttt` (three.js tic-tac-toe, the earlier prompt) and `nestng-crm` (new: NestJS REST + Angular 20 CRM, no network, Node on PATH, no browser). Repetition order per arm: r1 LEL, VAN, VANL; r2 VANL, VAN, LEL; r3 LEL, VANL, VAN.
* Tools: commit `42dcceff2` of branch `claude/codex-compare`; task manifest sha256 `246ccf203ddd69f3...`.
### Deviations (all recorded in `decode/notes.md`)
1. First pass: the NestJS dependency setup failed twice (`npm` needs `node` on PATH; then `cp -al` of a read-only tree), so `nestng-crm` was dropped everywhere; fixed, and a second pass ran only the missing cells.
2. The restarted lab holder passed the window's `CMP_*` variables on, so the first-pass `VAN` r2 and r3 blocks ran as `VANL` (their cells were skipped as finished; the `VANL` data is genuine). `VAN` r2 and r3 were rerun in the second pass. Fixed in `cmp_window.sh`; stubs now set every variable.
3. Blocks of the second pass have no warm-up cell (the warm-up cells of the first pass exist and are skipped); the first cell of those blocks therefore ran on a cold stack. The `nestng-crm` cells of a block follow the `ttt` cell, which is itself a warm-up.
4. **Post-hoc acceptance fix.** The static check "a board with one column per stage" required the five stages and the loop in one file and failed identically in all nine `nestng-crm` cells (55 of 56); every model keeps the stage list in `models.ts`. The check now looks across files; the nine cells were re-accepted offline (old logs kept as `acceptance.log.prev`). The failure was the same in all arms, so it cannot favour one; the real board is present (read in the sources).
5. The Codex sandbox (default, no network) refuses `listen` even on 127.0.0.1 (EPERM). The agents could not start the server and tested with in-process shims or supertest-free scripts. Same for all arms, but it changes what "verify your work" can mean.
## 2. Results
### Quality
* Objective acceptance: 18 of 18 accepted, 0 failed requests, no round cap, no wall limit. `nestng-crm` 56/56 in all nine cells, `ttt` 14/14 in all nine. The acceptance saturates: it cannot rank the arms.
* Browser checks of the nine `ttt` pages (six real-mouse checks, Chromium on the laptop, software GL): LEL r1 6/6, **LEL r2 2/6**, LEL r3 6/6; VAN r1 6/6, VAN r2 6/6, VAN r3 5/6; VANL r1 6/6, r2 6/6, r3 6/6.
* **LEL r2 is a real defect**: the `#hud` (with the Restart button) and the full-screen canvas are both `position: fixed` with no `z-index`, and the canvas comes later in the DOM, so the canvas covers the button; a mouse cannot press Restart (Playwright: "canvas intercepts pointer events"). The game otherwise runs. The static acceptance cannot see this.
* VAN r1 and r3 first failed the draw step because the probe that locates the nine cells splits the perspective board into thirds of the clickable range; a screenshot showed marks in the wrong rows. With a probe that clusters by gaps VAN r1 is 6/6 and VAN r2, LEL r1 stay 6/6. **VAN r3 still fails the draw step ("X wins")** with the new probe; its win and draw logic is present in the source and the probe geometry is the likely cause, but this is **not established**. Count it as 5/6 inconclusive.
* Code metrics of the nine `nestng-crm` projects (read blind, labels shuffled; not a code review): backend 789-1,310 lines, 39-78 test cases, README about 2.3-3.2 kB, class-validator used in 8 of 9. No pattern by arm; the spread inside an arm is as large as between arms. I did **not** read the nine codebases in full, so "equal quality" is not claimed, only "no difference visible in these measures".
### Iterations (model requests per cell, mean ± sd over 3 repetitions)
| task | LEL | VAN | VANL (reference) |
| --- | --- | --- | --- |
| ttt rounds | 17.7 ± 3.8 | 12.7 ± 3.2 | 19.0 ± 4.6 |
| ttt tool calls | 19.7 ± 5.0 | 13.7 ± 2.3 | 18.3 ± 4.2 |
| nestng-crm rounds | 54.0 ± 7.5 | 71.3 ± 18.5 | 62.0 ± 19.0 |
| nestng-crm tool calls | 58.7 ± 7.5 | 58.0 ± 25.5 | 54.3 ± 11.7 |
The repetition-to-repetition spread inside one arm (up to 19 rounds, CV 25-30 %) is larger than the differences between arms, so **no arm is shown to need fewer or more iterations**. Paired by repetition, LEL minus VANL on `nestng-crm`: rounds -8 (pairs -20, +21, -25). `VAN` needing fewer rounds on `ttt` (9, 15, 14 against 15-24) is consistent over the three pairs but three pairs of a greedy, non-reproducible session are thin evidence.
### Speed
The metric: output tokens (including reasoning) divided by the time of each model request, summed over the cell. The proxy's first-byte time is the response header, so the time **includes preparing the request (prefill of the new tokens)**; it is request throughput, not pure decode.
| task | LEL tok/s | VAN tok/s | VANL tok/s | LEL minus VANL, per pair |
| --- | --- | --- | --- | --- |
| ttt | 164.3 ± 2.7 | 225.7 ± 0.6 | 202.0 ± 1.7 | -39.8, -40.5, -32.7 |
| nestng-crm | 163.1 ± 1.3 | 221.4 ± 5.7 | 202.1 ± 3.8 | -36.8, -44.1, -36.0 |
* **Leleka is about 19 % slower than the reference and about 26 % slower than vanilla's shipped defaults on this workload** (contexts 30-120k, prefix-cache hit 98-99 % in both stacks, 1-2k uncached input tokens per request). The six pairs are consistent with a tiny spread; this is not noise. Vanilla's lossy defaults buy about 10 % (VAN against VANL, +19 to +24 tok/s).
* Model time per `nestng-crm` cell: LEL 396, 468, 480 s; VAN 382, 393, 309 s; VANL 388, 318, 420 s, for similar token totals (LEL 65-78k output tokens, VAN 70-85k, VANL 65-83k). Wall time per cell does not separate the arms (LEL 488 ± 59 s, VAN 434 ± 99 s, VANL 462 ± 106 s) because the number of rounds varies more than the speed.
* This contradicts the earlier agent-workload numbers of `docs/e2e-run.md` (Leleka ahead of an older vanilla). Different vanilla version and shape, different tasks; not reconciled here. **The cause is not investigated**: the per-request engine logs (`stack-r*/engine.log`, `requests.log`) hold the split between prefill, decode and the speculative-decode statistics and were not read. That is the next step before any statement about why.
## 3. What the data cannot resolve
* Quality or iteration differences below roughly the run-to-run spread (rounds CV 20-30 % with n = 3): not resolvable here; 20+ repetitions per cell would be needed for a 10 % round difference.
* Whether the Leleka `ttt` r2 Restart defect is Leleka-specific: one of three pages, same prompt; the other 14 pages of the other arms did not show it. Greedy sessions are not reproducible, so one defect in nine pages is an observation, not a rate.
* Quality on long, real tasks: both tasks end within ~125k tokens of context.
* Arm order effects: the blocks of one repetition ran within about two hours; server drift (clocks, temperature) is in `stack-r*/mon.csv` and was not analysed.
## 4. Files
Server `/data/leleka-e2e/codex-compare/`: `runs/main/{LEL,VAN,VANL}/<task>-r<k>/` (cell.json, proxy/, transcript.md, workspace), `runs/main/_compare`, `_index`, `results-20261105-0558/`, `reaccept-1/reaccept.out`, `window-*.out`, job logs `runs/main/job-*.log`. Laptop scratch (not kept in Git): workspaces without `node_modules`, the Playwright 1.49.1 install, probe variants (`check_ttt_v2.mjs`: gap clustering). Evidence tables in this repository: `docs/e2e-data/codex-compare/`.
+54
View File
@@ -0,0 +1,54 @@
# Codex + runtime + model: vanilla Strata against Leleka on two real tasks (RTX 5090)
Branch `claude/codex-compare` (from `claude/quality-245k`, which carries the `--agents-md` option of `cell.py`). Owner request (2026-11-05): test the model and the runtime, KAR included, the way it is used,
with Codex CLI + runtime + model, on two tasks, handed out to the vanilla build (Strata) and to ours in turn, and compare **relative quality, number of iterations and speed**.
This page fixes the design before the first run; it contains no result. Numbers go to `codex-compare/runs/main/_compare/` on the server and are quoted here after the runs.
## 1. Arms
| id | stack | configuration |
| --- | --- | --- |
| LEL | Leleka release package `leleka-0.1.0-17e372944279-5090-linux-x86_64.tar.xz` (tag `leleka-5090-v0.1` plus the deploy-only follow-up commits), `leleka up --foreground --kar-fd` from the holder's sealed memfd | shipped: profile `rtx5090-32g`, KAR level-2 PLE, prefix cache auto, tail `reply`, greedy |
| VAN | vanilla Strata 0.2.6 (launcher `~/work/vanilla-strata/control`, engine 0.1.50), `launch --model iq3_s --context 256k --kv int8 --vision off --parallel 1 --tune skip` | **shipped defaults** (route tail skip ON, CPU prefill share auto); default GGUF PLE |
| **VANL = the reference** (owner, 2026-11-05: "in principle this is the reference") | same, `STRATA_ROUTE_TAIL_SKIP=0 STRATA_PREFILL_CPU_SHARE=0` | lossy defaults off, the Original of the 245k study; LEL is judged against it first, VAN shows what vanilla's lossy defaults cost |
Same machine, same model files, same Codex CLI 0.163.0 (`~/work/codex-e2e/bin/codex`), same `config.toml.tmpl` (reasoning effort medium, context window 262144, no web search, workspace-write sandbox, no network).
The logging proxy injects `temperature: 0` into every request of every arm (Codex sends none; vanilla would otherwise sample), so both are greedy. Greedy agent sessions are still not reproducible run to run
(adaptive expert tier, prefix cache), which is why every cell is repeated. No AGENTS.md pad: the sessions are what a user gets, contexts grow naturally (tens of thousands of tokens).
## 2. Tasks (frozen in `scripts/e2e/codex/tasks/`, installed read-only on the server)
* `ttt`: three.js tic-tac-toe in one `index.html` (prompt of the earlier jobs 943*, unchanged; the vendored `three.module.min.js` is an external seed file). Acceptance: static checks on the server;
the six real-mouse browser checks (`hidden/check_ttt.mjs`, Playwright) run afterwards on the laptop over the stored workspaces (`delta/browser_check_ttt.sh`) and go into `_compare/browser.json`.
* `nestng-crm`: a simple NestJS REST API + Angular front-end CRM (companies, contacts, deals with stages, search, pipeline). New task, authored for this study: seed = scaffolded Nest and Angular projects with
pinned dependencies and `package-lock.json`; `node_modules` are not in the seed: the runner hard-links two shared, read-only trees (`codex-compare/nm/backend`, `nm/frontend`) into the workspace (`cell.py --link-tree`),
so the agent has Node 22 + the real dependency set and no network, and no bulk data is written per cell. No browser on the server: verification is the Nest tests, a started server and `npm run build` of the Angular app.
Acceptance (`accept.py`, variant-blind): black-box REST checks, the agent's own backend tests, production build of both projects, static checks of the Angular sources.
* `smoke-mini` runs first in every block as the warm-up cell (identical for both arms; not compared).
Limits, identical for both arms: cell wall limit 3000 s, 150 model requests (the proxy answers 503 beyond it: recorded `round_cap`), Codex medium reasoning. A cell that hits a limit is not completed.
## 3. Protocol
One **block** = one stack start of one arm (LEL load about 7-8 min, VAN about 5 min) running the warm-up cell and the tasks of one repetition. Three repetitions per arm and task, balanced against drift:
rep 1 LEL, VAN, VANL; rep 2 VANL, VAN, LEL; rep 3 LEL, VANL, VAN (9 blocks); the task order inside a block alternates with the repetition. Both arms run on the same server state otherwise (the lab holder is stopped for VAN by the usual
holder-free window and restarted afterwards). Server drift (uptime, GPU clocks, temperature) is recorded per block (`stack-r<k>/mon.csv`, `host-r<k>.txt`).
Stage 1 (queued behind the window-policy batch 2): `ttt` repetition 1 for LEL and VAN, which also shakes out the harness. Stage 2: the remaining repetitions and `nestng-crm` once its task is frozen and its dependencies are installed.
## 4. What is compared
* **Quality (relative):** objective acceptance (pass / fail and checks passed of N), the browser checks of `ttt`, failed or malformed model requests and tool-call errors, termination reason; then a blinded read of the final
workspaces and sessions against a fixed rubric (correct behaviour, completeness against the prompt, code structure, tests written and run, how the agent used its feedback), with the arm hidden from the reader, done after all cells exist.
* **Iterations:** model requests per cell (rounds), Codex tool calls, rounds that ended in an error, input tokens re-read in total.
* **Speed:** wall time to completion, decode tok/s (output tokens over decode time), time to first byte, seconds per request. Speed is only comparable between completed cells of the same task; a longer session is not slower.
`scripts/e2e/codex/compare/cmp_report.py RUNS_ROOT` prints per task and arm every repetition, mean and sd, and the paired difference LEL minus VAN by repetition. With three repetitions per cell it cannot resolve small differences (the
lossy-delta study measured the run-to-run CV of rounds; see `codex-lossy-delta.md` section 6); the report states the spread, not a verdict.
## 5. Provenance and rules kept
Test tooling only, never in serving. Server work folder `/data/leleka-e2e/codex-compare/` (tasks, delta, tools read-only with `INSTALL.sha256`; `toolchain/` Node.js with the tarball sha256 in the notes; `nm/` shared dependencies; `runs/main/`).
Every run is a GPU-queue stub; jobs append to `decode/notes.md`. Nothing is claimed as a performance improvement from this study: it compares products on two workloads, and a faster or slower arm
is reported with its quality and its iteration count beside it (AGENTS.md rule on A/B claims).
Results: [codex-compare-5090-results.md](codex-compare-5090-results.md).
@@ -0,0 +1,71 @@
# nestng-crm: notes for the orchestrator (never sent to Codex)
Written 2026-11-05 on the laptop (Windows 11, Node 22.16.0, npm 10.9.2, Python 3.9.13). Nothing here was run on the server.
## Pinned versions (exact, `package.json` and `package-lock.json` are in `seed/`)
backend (`seed/backend/package.json`): @nestjs/common, core, platform-express, testing 11.2.8; @nestjs/cli 11.0.24; @nestjs/schematics 11.1.0; class-validator 0.15.1;
class-transformer 0.5.1; reflect-metadata 0.2.2; rxjs 7.8.2; jest 29.7.0; ts-jest 29.4.15; supertest 7.3.1; typescript 5.9.3; @types/express 5.0.6, jest 29.5.14,
node 22.20.5, supertest 6.0.3. 579 packages after `npm ci`, node_modules about 214 MB, about 28,000 files.
Scaffold is hand-made (no `nest new`, so no git init and no eslint/prettier): classic CommonJS tsconfig (no `module: nodenext`/`isolatedModules`, which make decorator
metadata imports awkward), `nest build` to `dist/main.js`, no `incremental`. The seed has an EMPTY `AppModule`, a `main.ts` that listens on 3000 (the agent must add PORT and
127.0.0.1), the jest config for unit tests (in package.json, `src/**/*.spec.ts`) and `test/jest-e2e.json` (`*.e2e-spec.ts`), and no tests.
frontend (`seed/frontend/package.json`): @angular/common, compiler, core, forms, platform-browser, router 20.3.35; @angular/build, cli 20.3.42; @angular/compiler-cli 20.3.35;
rxjs 7.8.2; tslib 2.8.1; zone.js 0.15.1; typescript 5.9.3. 410 packages, node_modules about 218 MB, about 19,000 files.
Angular 20, not the 22.x that is current on the registry (22.x needs Node >= 22.22.3; the laptop has 22.16 and Angular 20 accepts ^22.12). Standalone components, esbuild
`@angular/build:application`, strict TS and strict templates, the dev server target exists, no `test` target (Karma/Jasmine removed), `cli.analytics=false`.
Lockfile digests (sha256): `seed/backend/package-lock.json` 23a3084dc848bf127f97696563cab0ec113358585df6245d270b1f123c7fd533,
`seed/frontend/package-lock.json` 87f8dc2edd3bb892330bb23ea3675dc2e173cbafbd35865fccc9168a58bca72c (the manifest records them with the other seed files).
`npm ci` on both from a clean directory works and the reference then passes 56/56 (checked 2026-11-05).
## Installing node_modules on the server (once, by the main session, network is available there)
One shared tree per project outside any workspace, for example `/data/leleka-e2e/codex-compare/node_modules-nestng/{backend,frontend}/node_modules`. Install from the
frozen seed lockfiles, low priority, because the root NVMe stalls under sustained writes (about 430 MB, 47,000 small files, about 45 s on the laptop):
```sh
for d in backend frontend; do
mkdir -p $NM/$d && cp $TASKS/nestng-crm/seed/$d/package.json $TASKS/nestng-crm/seed/$d/package-lock.json $NM/$d/
( cd $NM/$d && nice -n 19 ionice -c3 npm ci --ignore-scripts=false --no-audit --no-fund )
done
```
then `chmod -R a-w $NM` and record `find $NM -type f | sort | sha256sum`-style digest in the run metadata (it is not part of the task manifest). Node 22 itself: a pinned
tarball (the version and its sha256 recorded) in the same directory, put on PATH for Codex's shell and for `accept.py` (`NESTNG_NODE_BIN=<dir with node and npm>`).
Angular 20 needs Node >= 20.19 or >= 22.12; any 22.x LTS from this year is fine.
## What accept.py needs
* `python3 accept.py WORKSPACE`, stdlib only, 56 checks, prints `PASS`/`FAIL name :: detail` and `SUMMARY n/m`. Nothing in WORKSPACE is modified (the self-test confirms it).
* node_modules: `WORKSPACE/<dir>/node_modules` if present, else `$NESTNG_NM_ROOT/<dir>/node_modules` (a directory holding `backend/node_modules` and `frontend/node_modules`).
It symlinks them (junction on Windows) into a temp copy that excludes node_modules, dist, .angular, coverage, out-tsc, *.tsbuildinfo and .git. The runner's workspace copy of
node_modules is therefore never copied or written.
* Node and npm from PATH, or `$NESTNG_NODE_BIN`. It sets CI=1, NG_CLI_ANALYTICS=false, NG_DISABLE_VERSION_CHECK=1 for its own children.
* The backend is started with `node dist/main.js` on a free port in `PORT`; a server that ignores PORT fails the whole REST group (35 checks).
* Time on the laptop: reference 22-24 s; bare seed 79 s (30 s of waiting for a server that never listens on `PORT`). Worst case with a slow agent solution well below 300 s.
On the server expect 2-3x the CPU-bound parts (ng build, tsc, jest).
* Groups: 7 structure, 2 backend build/listen, 35 REST, 3 own tests (npm test, npm run test:e2e, >= 15 cases in total), 1 frontend build, 9 static frontend checks.
* Does NOT check the UI in a browser (none on the server). A later laptop check with Playwright over the stored workspaces is possible (serve `frontend/dist/frontend/browser`
with the backend on 3000 and a proxy), not written.
## Laptop timings (reference solution)
`npm run build` backend 3.7 s; `npm test` 5.9 s (15 tests); `npm run test:e2e` 5.4 s (15 tests); `ng build` production 5.4 s; whole accept.py 22 s (seed + overlay self-test: seed
rc=1 79 s, overlay rc=0 22 s).
## Gotchas for the server and the Codex sandbox
* The runner must copy the seed FIRST, check SEEDTREE (`taskfile.workspace_lines`) and only then add the hard-linked node_modules; `workspace_lines` would otherwise hash 47,000
files of node_modules (`cell.py` does it again after the run for `workspace.sha256`: exclude `node_modules`, `dist`, `.angular` there, or it reads 430 MB per cell).
* Hard-linked files are shared: make the shared tree read-only (`chmod -R a-w`) so an agent cannot edit a package of every later cell. `cp -al` (hard links) writes no data.
A symlinked node_modules also works with `accept.py`, but Angular/Jest under a symlink inside a Codex sandbox was not tried; hard links are what the prompt promises.
* esbuild and the Angular CLI fetch platform-specific optional dependencies (`@esbuild/linux-x64`, `@parcel/watcher-linux-x64-glibc`, `lmdb` prebuilds for the Angular cache) at
`npm ci` time from the registry. Install on the server (linux-x64), never copy the laptop's tree. Check `npm ls @esbuild/linux-x64` after the install.
* The agent's `ng build` writes `frontend/.angular/cache` into its workspace (fine); jest/ts-jest write a cache under the OS temp dir: the Codex workspace-write sandbox allows
the temp dir, but confirm once with a smoke cell. If `HOME` is not writable, `ng` may try to write `~/.angular-config.json` (analytics is disabled in the seed `angular.json`).
* `ng serve` and `nest start --watch` need a listening port and file watching; Codex may start them. `cell.py` kills the process group at the end, accept.py uses a random port,
so a leftover server on 3000 does not disturb the acceptance, but check that 3000 is free before the first cell (the agent's own tests use supertest, no port).
* Round estimate 30-70 is the author's guess; the prompt is a single phase and the seed has no tests, so the agent must create about 15+ test cases.
* After the main session freezes `MANIFEST.sha256` do not edit any file in this directory (including this one): `TASK`/`SEEDTREE` digests cover it.
+116
View File
@@ -0,0 +1,116 @@
# KAR on / off in the Leleka runtime: speed, logits and agent sessions (RTX 5090, 2026-11-05)
Owner request: "KAR must give extra speed and lower quality, and both must be measured; our runtime must also be tested with GGUF." The same Leleka runtime was run with the shipped KAR level-2 PLE (**KAR**) and with the PLE rows read from the GGUF shard (**GGUF**, no archive), on identical workloads.
Everything below is a paired A/B inside this one runtime; vanilla Strata is not involved (it is the subject of [codex-compare-5090-results.md](codex-compare-5090-results.md)). Raw tables: `docs/e2e-data/kar-off-ab/`.
## 0. Result in six lines
1. **Speed.** KAR gives **no decode speed-up** on this workload: decode 180.5 ± 1.2 tok/s (KAR) against 181.6 ± 0.8 (GGUF), 3 interleaved passes each, difference +0.6 % for GGUF, inside the noise (paired 1.1 ± 1.1). KAR is **faster in prefill**: 4206 ± 28 against 3741 ± 5 tok/s (GGUF −11.1 %), 132 s against 149 s of prefill for the same 555k uncached prompt tokens (about 0.28 s per request, roughly 2-3 % of the model time of the replay).
2. **Logits.** KAR is a real, small numerical perturbation of GGUF: on the same 3000 forced rows the argmax differs in **4.3 %** of rows (twin runs of one PLE source: 1.5-1.9 %), d_top1 p99 0.47 (twins 0.15-0.16). Section 4.
3. **Agent level** (real Codex CLI, 2 tasks x 3 repetitions x 2 arms): **no growth in rounds** with GGUF (`nestng-crm` 67.0 ± 20.1 against 84.7 ± 24.6, `ttt` 21.0 ± 7.2 against 20.7 ± 1.5); all 12 cells accepted (56/56 and 14/14; the `nestng-crm` figure after the known board-check correction). GGUF's six `ttt` pages pass every browser probe; KAR has one page with a real click defect and two that the stricter probe fails. n = 3 cannot resolve rounds differences below about 20 %.
4. **Owner criterion** ("rounds must not grow by a larger percentage than the speed gain"): the speed gain of KAR is about 0 % in decode and 2-3 % in model time; GGUF rounds did not grow (−21 % and +1.4 %, both inside the noise). The criterion is **not violated by the data**, and the data cannot exclude a growth of 10-20 %.
5. **Consequence for the product question.** On these measurements KAR buys a prefill gain of about 12 % and costs a measurable logit perturbation, and no decode gain. A GGUF-PLE profile is functionally sound in Leleka (`rtx5090-32g-gguf-ple`, experimental, never auto-selected).
6. **The earlier LEL-against-VANL speed gap (-19 %, [results](codex-compare-5090-results.md)) is not explained by KAR**: both arms here run at about 162 tok/s per Codex request, as LEL did (163-164).
Nothing in this page changes a default. No performance claim is made beyond the paired numbers and their spread.
## 1. What was built
* **Deploy** (`crates/deploy`): `kar_source: none` and the built-in profile `rtx5090-32g-gguf-ple` (identical to `rtx5090-32g` except: no archive, no memfd lock/heal, `LELEKA_PLE_DIRECT=0`, `LELEKA_ORIGINAL_SERVE_GGUF_PLE=1`, RAM minimums of the file profile). It passes no `--kar-*` argument, loads `qwen4exp-native-mtp-v1`, skips the `kar` step and the archive checks, refuses `--kar-fd`, keeps `none` in the low-RAM fallback. Every other profile is byte-for-byte unchanged (tests `every_other_profile_keeps_its_archive_arguments_and_profile_id`, `the_gguf_ple_variant_differs_...`). `cargo test -p leleka-deploy`: 184 unit + 6 e2e on Linux (WSL), 176 on Windows.
* **Engine** (`leleka-runtime`): the Original serve path was **hard-wired to KAR in four places**, found one per failed start (a load that fails at its `Selection` phase prints only the phase, so each needed a queue cycle): (1) the start-up eligibility rule (`backend_original_serve.rs::ineligible`), (2) the expert-bank admission (`qwen4exp_resident_expert_source.rs`, three guards), (3) the Original-load gate in `backend.rs` (KAR profile id required), (4) the same requirement of the retained-GR execution gate. All four accept the native-PLE load **only** when `LELEKA_ORIGINAL_SERVE_GGUF_PLE=1` is set (the new profile sets it) and no KAR source is configured; without the variable nothing changed (unit tests for the start-up rule). The refused-gate also prints its boolean conditions now.
* **Replay smoke** (test only): `LELEKA_REPLAY_GGUF_PLE=1` binds the model without KAR for the teacher-forced runs.
* **Scripts** `scripts/e2e/kar-off/`: `kar_off_common.sh`, `kar_off_window.sh`, `kar_off_speed_job.sh`, `kar_off_codex_job.sh`, `kar_off_quality_job.sh`, `kar_off_stubs.sh`, `kar_off_install.sh`, `kar_off_speed.py`; `cmp_report.py` knows the variants LELK / LELG. Commits on `claude/kar-off-ab-c6bf4e` (never pushed): `98effcdab` … `740d84113`. Strata provenance (`docs/upstream.md`) untouched; production serving stays Python-free (Python is used only by the test scripts).
* **Package.** The server has no Rust toolchain; binaries were built in WSL Ubuntu on the laptop (rustc 1.99.0, `cargo build --release`). Installed package `/data/leleka-e2e/kar-off-ab/pkg/`: the release 17e3729 binaries (hard links) except `leleka` (sha256 `0a4c1633...2703ff`) and `leleka-inference` (`18cf75ca...19efdf`); `MANIFEST.json` carries the two new digests and a note. **Both arms ran this package.** The engine is therefore not the released 17e3729 binary (it contains the four gates above; the KAR path is logically unchanged, and the per-request speed of the KAR arm, 161-163 tok/s, equals that of the released LEL, 163-164).
## 2. Setup, decisions, cache state
* **Hardware / software.** RTX 5090 32 GB (driver 595.99.02, GPU clocks 2857 MHz mean, 2572 min, 61.7 C mean, 71 C max in both arms), 32 cores, 121 GB RAM, kernel 7.0.0-38-generic (Ubuntu 26.04), CUDA 13.2.2 toolkit with cuBLAS 12.9.1.4, Codex CLI 0.163.0, Node 22.23.4. Model: Qwen3.8-Flash-Next IQ3_S pair, digest `sha256:80d5e3333801cedbca81a5c19c24ed6bb48fd56977acd190318f66b23a1766a3`; KAR archive `qwen-iq3-s-l2-v4.kar` (55,295,529,472 B); expert profile sha256 `8f59b4aa...388975baf`.
* **Both arms standalone (holder-free windows).** The task text expected the lab holder's memfd to be 14.9 GiB. It is **51.5 GiB** allocated (`fstat` of the holder's fd: size and `st_blocks` both 51.50 GiB; `Shmem` 58 GB), which leaves about 66 GiB, less than the 50 GB expert bank plus the 28.8 GB PLE table. A holder job would have starved the GGUF arm's page cache and measured the SSD. So every speed and Codex run is a window: the holder is stopped, each arm starts its own stack with `leleka up --foreground` (KAR arm = shipped `rtx5090-32g` with its own **sparse 16 GB memfd**, GGUF arm = `rtx5090-32g-gguf-ple`), MemAvailable 118 GiB at start, the holder is restarted afterwards. The teacher-forced logit runs are holder jobs (logits do not depend on cache state).
* **GGUF PLE I/O.** `LELEKA_PLE_DIRECT=0` (page cache instead of the engine's default O_DIRECT SSD reads; the equivalent of vanilla's `--ple-io ram`), engine row cache and reader depth at their defaults. Before every GGUF run `cat shard1 > /dev/null` (36-45 s, cold) makes the 28.8 GB table fully resident (`fincore`: 28,800,139,264 of 28,800,138,432 B before the replay and after it). The KAR arm has no page-cache copy of the table (O_DIRECT fill of the memfd). SSD reads during the 59-request replay (sectors of 512 B): 402-408k (about 206 MB) in five of the six runs and 933k in one GGUF run (the second GGUF pass): the table was RAM-resident, the SSD is not what the replay measured.
* **Cache state.** Every run is a fresh process: prefix cache empty at start (6144 MiB cap, tail `reply`, block 8192), same recorded prompts, adaptive window and tier as shipped; prompts and cells were digest-checked at every start (`inputs.sha256`, 60 entries).
* **Workload (speed).** The recorded Codex requests of the two reference cells `VANL/nestng-crm-r2` and `VANL/ttt-r3` of the codex-compare study: 59 requests, replayed one at a time with `replay_fwd.py` (temperature 0, vanilla `encrypted_content` stripped), history of 10-120k tokens, 555,449 uncached prompt tokens per run; the recorded replies are not fed back. Order of the six stack starts (balanced): KAR, GGUF, GGUF, KAR, KAR, GGUF. Speed per request is the engine's own record (`ev:request`: output tokens, decode ms, prefill ms, speculative rounds), pooled per run.
* **Workload (agent).** `cmp_codex_job.sh` pattern: real Codex CLI, logging proxy, temperature 0 injected, medium reasoning, limits 3000 s / 150 requests (none reached), tasks `ttt` and `nestng-crm` (frozen, the codex-compare ones), warm-up cell `smoke-mini` per block, balanced blocks KAR r1, GGUF r1, GGUF r2, KAR r2, KAR r3, GGUF r3.
## 3. Speed (59 recorded requests, 3 passes of each arm)
| run (window order) | output tokens | decode tok/s | prefill tok/s | tokens / round |
| --- | --- | --- | --- | --- |
| KAR p1 (1) | 94,833 | 179.2 | 4223 | 3.303 |
| GGUF p1 (2) | 112,495 | 181.5 | 3737 | 3.307 |
| GGUF p2 (3) | 96,205 | 182.4 | 3739 | 3.388 |
| KAR p2 (4) | 79,856 | 181.6 | 4221 | 3.496 |
| KAR p3 (5) | 98,956 | 180.7 | 4173 | 3.332 |
| GGUF p3 (6) | 102,588 | 180.9 | 3747 | 3.300 |
| scope | metric | KAR mean ± sd | GGUF mean ± sd | GGUF − KAR (paired by pass index, mean ± sd) | GGUF / KAR − 1 |
| --- | --- | --- | --- | --- | --- |
| all 59 | decode tok/s | 180.5 ± 1.2 | 181.6 ± 0.8 | +1.1 ± 1.1 | +0.6 % |
| all 59 | prefill tok/s | 4206 ± 28 | 3741 ± 5 | −465 ± 33 | −11.1 % |
| all 59 | tokens / round | 3.377 ± 0.104 | 3.332 ± 0.048 | −0.045 ± 0.057 | −1.3 % |
| all 59 | output tokens | 91,215 ± 10,051 | 103,763 ± 8,208 | +12,548 ± 7,749 | +13.8 % |
| nestng-crm-r2 | decode tok/s | 182.7 ± 1.1 | 183.8 ± 1.9 | +1.1 ± 1.5 | +0.6 % |
| nestng-crm-r2 | prefill tok/s | 2028 ± 41 | 1918 ± 15 | −110 ± 49 | −5.4 % |
| ttt-r3 | decode tok/s | 174.9 ± 1.2 | 176.1 ± 1.7 | +1.2 ± 1.9 | +0.7 % |
| ttt-r3 | prefill tok/s | 5284 ± 1 | 4571 ± 5 | −714 ± 6 | −13.5 % |
* Distribution over the requests (pooled over the 3 runs, 177 requests per arm): output tokens p10 / p50 / p90 / max KAR 220 / 886 / 3912 / 10,517, GGUF 221 / 1122 / 4113 / 11,215; uncached prompt tokens 522 / 2453 / 32,121 / 39,037 in both (the prompts are the same); per-request decode tok/s (requests with at least 100 output tokens) p10 / p50 / p90 KAR 140.9 / 167.8 / 207.6, GGUF 149.5 / 170.3 / 209.0; per-request prefill tok/s (at least 1000 uncached tokens) KAR 1440 / 2560 / 5449, GGUF 1394 / 2366 / 4717.
* Prefill time of a run: KAR 131.5, 131.6, 133.1 s; GGUF 148.6, 148.9, 148.2 s. Decode time of a run: 440-548 s (KAR), 528-620 s (GGUF), which follows the output length (see below).
* **Reading.** The decode rate is the same within the pass-to-pass spread (about 0.7 %); the paired differences are +2.3, +0.8 and +0.2 tok/s. The prefill difference is 7-8 sd and consistent over cells and passes: KAR's PLE gather for a prompt is cheaper than reading the rows from the shard (CPU decode), and larger on the short, many-token prefills of `ttt`. In this replay the prefill gain of KAR is 16.5 s of about 640-720 s of model time (2-3 %).
* **Not a measure of work.** Because the replies are not fed back, each arm writes its own text: GGUF wrote 13.8 % more output tokens per pass (112k / 96k / 103k against 95k / 80k / 99k), tokens per round are equal within the spread. The difference in output length is a property of the two models' greedy texts on these prompts, not of the replay; three passes per arm and an sd of 8-10k tokens do not let me say it is systematic.
## 4. Quality (a): teacher-forced logits, KAR against GGUF in the Leleka stack
Method of `docs/quality-gate.md` sections 1 and 6, with the 245k tool chain (`q245_port.sh`, `q245_analyze.py`): the replay smoke of this branch (`backend::original_serve_replay`, test executable `rt-kar-off`, sha256 `d87d5f49...e737`), once with the inherited KAR memfd (holder job) and once with `LELEKA_REPLAY_GGUF_PLE=1` + `LELEKA_ORIGINAL_SERVE_GGUF_PLE=1`, on the capture `quality-245k/inputs/data/cap-both` (five prompts of 45,766 / 95,706 / 151,643 / 197,915 / 242,849 tokens, each followed by the recorded Original reply and the recorded port reply, 300 tokens: 10 requests, 3000 forced rows per arm), top-16 log-probabilities of every row (`LELEKA_TRACE_LOGPROBS=16`), static expert tier (`ADAPT_EVERY=0`), shipped serve shape (prefix cache reply, 8192 grid). Each run has two twin arms (`ship`, `shipb`), so the difference between twins of one PLE source is the noise floor, and the tolerance is the larger of the two twin envelopes (the method of the quality gate: no absolute threshold exists for "KAR equals GGUF").
| pair | d_top1 p50 / p99 / max | dmax16 p99 | argmax flips | decisive flips (margin ≥ 0.25) | top-5 overlap | mean dNLL |
| --- | --- | --- | --- | --- | --- | --- |
| KAR ship : KAR shipb (twins) | 0.0007 / 0.146 / 0.297 | 1.69 | 45 (1.50 %) | 3 | 0.968 | −0.0002 |
| GGUF ship : GGUF shipb (twins) | 0.0023 / 0.162 / 0.346 | 1.67 | 56 (1.87 %) | 5 | 0.967 | −0.0001 |
| **KAR ship : GGUF ship** | 0.0097 / **0.468** / **0.850** | 3.12 | **128 (4.27 %)** | **44** | 0.919 | −0.0040 ± 0.0019 (mean abs 0.050) |
| KAR ship : GGUF shipb | 0.0100 / 0.481 / 0.992 | 3.13 | 141 (4.70 %) | 52 | 0.920 | −0.0041 |
| KAR shipb : GGUF ship | 0.0090 / 0.455 / 1.660 | 3.04 | 126 (4.20 %) | 40 | 0.919 | −0.0037 |
* Tolerance (largest twin envelope): d_top1 p99 0.162, max 0.346, flip rate 1.87 %, mean |dNLL| 0.0178, top-5 0.967. All three KAR-GGUF pairs **fail** every statistic (d_top1 p99 2.8-3.0 x, flips 2.3-2.5 x the envelope). That is the expected sign: KAR level 2 is a quantised re-encoding of the PLE table.
* The capture holds two text sources per prompt. dNLL = log p(KAR) − log p(GGUF) of the recorded token: on the Original's recorded replies the mean over the five prompts is −0.012 nats/token (KAR scores them lower, about **+1.2 % perplexity**; per prompt −0.005 … −0.027), on the Leleka port's recorded replies +0.004 (per prompt −0.010 … +0.013). I did not establish which PLE source generated each recorded text, so this is not read as "KAR is worse on its own text" or the reverse. The older Original-based number (`quality-gate.md` §6: d_top1 p99 0.34, flips 3.4 %, +0.010 nats) is of the same size and the same sign.
* Limits: five prompts at five depths, 300 forced tokens each, no free greedy sequences and no tool-call or long-context benchmark in this section; the figures describe the perturbation, not a task quality. Tables: `docs/e2e-data/kar-off-ab/quality-a-kar-vs-gguf.txt`.
## 5. Quality (b): real Codex sessions, KAR (LELK) against GGUF (LELG)
12 cells (2 tasks x 3 repetitions x 2 arms), all finished, none reached a limit, 0 failed requests except one in LELK `nestng-crm` r1. Tables: `docs/e2e-data/kar-off-ab/codex/compare.md`, `compare.csv`, `browser-ttt.txt`.
| task | metric | LELK (KAR) mean ± sd | LELG (GGUF) mean ± sd | paired LELG − LELK (per repetition) |
| --- | --- | --- | --- | --- |
| nestng-crm | rounds | 84.7 ± 24.6 (108, 59, 87) | 67.0 ± 20.1 (46, 69, 86) | −17.7 ± 38.8 (−62, +10, −1) |
| nestng-crm | tool calls | 71.7 ± 19.5 | 45.3 ± 9.8 | −26.3 ± 15.6 |
| nestng-crm | wall s | 593.8 ± 129.7 | 543.8 ± 145.6 | −50 ± 138 |
| nestng-crm | request decode tok/s | 161.1 ± 5.4 | 162.8 ± 3.6 | +1.6 ± 8.1 |
| ttt | rounds | 20.7 ± 1.5 (19, 21, 22) | 21.0 ± 7.2 (15, 19, 29) | +0.3 ± 5.9 (−4, −2, +7) |
| ttt | tool calls | 22.0 ± 3.6 | 21.7 ± 7.6 | −0.3 ± 4.6 |
| ttt | wall s | 190.2 ± 10.7 | 143.7 ± 24.3 | −46.5 ± 17.0 |
| ttt | request decode tok/s | 162.9 ± 5.5 | 158.2 ± 2.9 | −4.8 ± 4.7 |
* **Acceptance.** `ttt` 14/14 in all six cells. `nestng-crm`: the installed acceptance reported 55/56 in all six cells (the static check "a board with one column per stage" wants the five stages and the loop in one file, identically false for every model; the post-hoc fix of the codex-compare study); re-accepted offline with the corrected `accept.py` (`reaccept-1/tasks`, `cmp_reaccept.py`): **56/56 in all six**; old logs are kept as `acceptance.log.prev`. The Codex sandbox forbids `listen`, as in the earlier study.
* **Browser checks of the six `ttt` pages** (`check_ttt.mjs` thirds probe / `check_ttt_v2.mjs` gap-clustering probe, real mouse, Chromium, software GL, laptop, one page at a time; `browser-ttt.txt`): **GGUF r1, r2, r3: 6/6 on both probes.** KAR r1: 6/6 and 3/6 (v2 gave 3/6 in 4 of 4 runs: clicks on the located cells do not change the turn text); KAR r2: 6/6 and 6, 3, 4, 5 of 6 over four v2 runs (the probe is not stable on this page); **KAR r3: both probes stop at check 3, `#restart` is covered by the full-screen canvas ("canvas intercepts pointer events", a real defect of the page, the one seen in the earlier LEL r2).** The v2-probe failures of KAR r1 and r2 were not investigated further (as in the earlier study, probe geometry cannot be excluded); they are reported, not counted as proven defects.
* **Rounds against speed gain (the owner's criterion).** KAR's speed gain over GGUF is 0 % in decode (section 3) and about 2-3 % in model time. GGUF needs 21 % fewer rounds on `nestng-crm` and 1.4 % more on `ttt`; the spread between repetitions inside one arm (CV 20-35 %, up to 49 rounds) is larger than any difference, so no arm is shown to need fewer or more rounds, and a 10-20 % growth with GGUF could not be seen with three repetitions. Within that resolution the criterion holds (no measurable growth, no measurable gain).
* **Comparison with the released KAR arm.** LELK (standalone stack, rebuilt engine) against the earlier LEL (release package, holder job, same tasks): `nestng-crm` 84.7 ± 24.6 against 54.0 ± 7.5 rounds, `ttt` 20.7 ± 1.5 against 17.7 ± 3.8, request speed 161-163 against 163-164 tok/s; the round counts differ by more than the sd in `nestng-crm` and are an example of how far two sessions of the same arm can lie apart (greedy agent sessions are not reproducible).
## 6. What this does and does not show
* It shows, on one workload shape (Codex sessions, contexts 10-120k, prefix-cache hit 98-99 %), that **KAR does not make decode faster** and makes prefill about 12 % faster, and that GGUF PLE works in the Leleka runtime at the same decode speed and with no sign of worse agent sessions.
* It does not show that KAR is useless: it saves RAM (16 GB sparse memfd against a 28.8 GB table in page cache, 12.8 GB), starts without reading the table, and the prefill gain would matter for cold, long prompts (the 245k first-turn prefill was **not** measured here; its share of a first request is larger than in the cached replay). It does not measure KAR at 245k/256k sessions ("real work = 256k"): the replay contexts are 10-120k, the logit capture reaches 243k.
* It does not resolve quality differences below the run-to-run spread of agent sessions (rounds CV 20-35 % with n = 3 per cell); 20+ repetitions per cell would be needed for 10 %.
* Three replay passes per arm: the sd of the decode rate (0.8-1.2) is small, but all windows ran within three hours of one boot with one GPU temperature band.
* The page claims nothing for vanilla Strata and nothing about the other KAR levels.
## 7. Deviations and traps (all recorded)
1. The holder's memfd is 51.5 GiB (not 14.9) → both arms are standalone windows (section 2).
2. Four KAR-only gates in the engine, found one per failed GGUF start (about 30 minutes each: window cycle). The first GGUF replay also failed the teacher-forced run (`resident expert source load failed: Metadata`, gate 2) → rerun as `quality2`.
3. The first `arm-*` states were prepared with earlier binaries and were moved to `~/work/leleka/garbage/` (lines in `garbage/LOG.txt`), then re-prepared with the final package.
4. `engine.log` is truncated per run; `requests.log` accumulates over passes (not used).
5. Two copies of the browser probe ran at once during the first laptop run; their output was discarded and every page rerun alone.
6. The smoke runs (`runs/smoke*`, 2-4 requests) are only start checks; they are not data.
## 8. Paths
Server `/data/leleka-e2e/kar-off-ab/`: `pkg/` (package), `tools/` (installed scripts, `INSTALL.sha256`), `inputs.sha256`, `incoming/` (build artefacts, `rt-kar-off`), `assets/` (links), `arm-kar/`, `arm-gguf/` (state and prefix of the two arms), `reaccept/` (corrected acceptance, `out.txt`), `runs/speed/{kar,gguf}-p{1,2,3}/` (replay.jsonl, engine.log, host.tsv, status.json, fincore), `runs/codex/{LELK,LELG}/` (cells, `stack-r*`), `runs/codex/_compare/`, `runs/quality/kar`, `runs/quality2/gguf` (port.full logs), `runs/quality-analysis/`, `runs/smoke*`, `window-*.out`. Queue stubs `kar-off-{smoke..smoke5,quality,quality2,speed,codex}` in `~/work/gpu-runs/holder2/jobs/` (backups `PRIORITY.bak-kar-off-*`). Laptop: this worktree (`scripts/e2e/kar-off/`, `docs/e2e-data/kar-off-ab/`, `target/wsl` build output, ignored) and the scratchpad of the session (ttt workspaces, Playwright 1.49.1 install, probe outputs).