Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ jobs:
bash scripts/experiments/e0s/run_e0s.sh --self-test
python3 scripts/experiments/e0s/fusion_attribution.py --self-test
python3 scripts/experiments/e0s/summary_delta.py --self-test
python3 -m py_compile scripts/experiments/backend_ab/backend_ab_eval.py \
scripts/experiments/backend_ab/error_report.py \
scripts/experiments/backend_ab/repro-81507db6/timed.py
python3 scripts/experiments/backend_ab/backend_ab_eval.py --self-test
python3 scripts/experiments/backend_ab/error_report.py --self-test
bash scripts/experiments/backend_ab/run_conv26.sh --self-test
bash scripts/experiments/backend_ab/run_lme.sh --self-test

fmt:
name: rustfmt
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,9 @@ target-linux/
# Default data and output for scripts/experiments/e0s/run_e0s.sh.
/e0-data/
/e0s-results/

# Default output for scripts/experiments/backend_ab/run_*.sh.
/backend-ab-results/
# Committed timing and resolved-config logs for this eval (global *.log would drop them).
!/scripts/experiments/backend_ab/repro-81507db6/timed.log
!/scripts/experiments/backend_ab/results/**/*.log
161 changes: 161 additions & 0 deletions scripts/experiments/backend_ab/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# Backend A/B eval (graph-lite vs flat)

Two-arm storage-backend A/B on locomo-conv26 and lme-oracle. The single
variable is `storage.backend` (`graph-lite` vs `flat`). Both arms use TinyBERT
and `broker.rerank_min_score=0.0` (fill-to-cap, reorder only). The scorer also
reports a `vector` arm as a ceiling; that arm is not part of the A/B variable.

Scorer: `scripts/retrieval_eval.py` (retrieval-only, not an official judge).

On this branch, `scripts/retrieval_eval.py` has the same sha256 as the as-run
copy (`6e2b69257b1133202ec69fe48e4dcdaf46dfda2162201c804a4a95497d983442`).
`scripts/retrieval_eval_profiles.py` differs only in `sweep_profile`
(`rerank_off` now spreads fused defaults, plus a comment wording change).
This profile uses `bench_profile`, not `sweep_profile`.

## Run1 and run2

Each table in the PR and in `results/*-summary.json` has two values per arm
because the same command was run twice (`run1` and `run2`) as a determinism
check. No component takes a seed; the runner pins `PYTHONHASHSEED=0`. The
output is not deterministic (`deterministic` is false in both summaries).

On locomo-conv26, flat beats graph-lite by +21 / +20 hits (+0.1066 / +0.1015
R@8) against 1 hit of run-to-run drift on flat (graph-lite R@8 is identical
across runs). On lme-oracle the run-to-run drift is identical in both arms
(the same 9 rank flips): flat minus graph-lite is +2/479 hits in both runs,
which is the same size as the run-to-run drift. So: a clear win on conv-26,
and no measurable difference on lme.

The `determinism.run1` / `determinism.run2` fields in the committed summaries
keep the as-run box paths (`/workspace/fuse/backend-ab/results/...`). A
checkout `--summarize-pair` regen matches the summaries byte-for-byte except
those two path strings. `--self-test` checks that.
Comment on lines +32 to +33

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the regen really is byte-for-byte apart from the 2 path lines (checked by hand). --self-test compares parsed json with the paths dropped, though, so "self-test checks that" is a bit stronger than what it actually checks.


## Rerun

`run_conv26.sh` and `run_lme.sh` take paths from flags or environment
(`BIN`, `DATA`, `RESULTS`, `MEMCAP`, `MODEL_CACHE`, `EVAL`) and default to
repo-relative locations:

- `BIN`: `$REPO/e0s-results/bin/kimetsu`
- `DATA`: `$REPO/e0-data/locomo-conv26.json` or `$REPO/e0-data/lme-oracle.json`
- `RESULTS`: `$REPO/backend-ab-results` (gitignored)
- `MEMCAP`: `scripts/experiments/e0s/memcap.py` (in-repo)
- `MODEL_CACHE`: `$REPO/e0s-results/model-cache`
- `EVAL`: `scripts/experiments/backend_ab/backend_ab_eval.py`

Example:

```
BIN=/path/to/kimetsu DATA=/path/to/e0-data/locomo-conv26.json \
MODEL_CACHE=/path/to/model-cache \
scripts/experiments/backend_ab/run_conv26.sh
```

Regenerate a summary from committed jsonl:

```
python3 scripts/experiments/backend_ab/backend_ab_eval.py --summarize-pair \
scripts/experiments/backend_ab/results/run1/locomo-conv26.jsonl \
scripts/experiments/backend_ab/results/run2/locomo-conv26.jsonl
```

The as-run box paths that produced the committed results are in `as-run.env`.
Commit 1 also keeps the original hardcoded runners
(`git show 8257c3a3:scripts/experiments/backend_ab/run_conv26.sh`). The as-run
memcap was the box copy `/workspace/fuse/e0s/memcap.py`
(sha256 `6737690dbe820c2a3fe15081510c984c215c56de120ca116902a259f02db446e`);
the default here is the later in-tree `scripts/experiments/e0s/memcap.py`.

Data comes from `scripts/prepare_e0_data.py` (locomo-conv26 sha256
`a996cc78f35f78d24114800636e4a2425ddf60639254532bfacff35a2013dcd7`,
lme-oracle sha256
`1dcfd431b1a145d2a234e07d1a72f246fbc37019bb4e3409a6a191beb965b129`).

## Binary 262f17de

The recorded runs used `/workspace/fuse/e0s/bin/kimetsu-e0s`,
`kimetsu 2.11.0 (embeddings)`, sha256
`262f17def1cfd67f07aaec325a2f2d23aa058d393adefc463d4bfc4c33391985`.
The file on the box still hashes to that digest, and `--version` still prints
`kimetsu 2.11.0 (embeddings)`.

Box evidence for how it was built:

- `/workspace/fuse/e0s/run_e0s.log` (2026-11-13 13:16:08 / 13:22:36 ART):
`building release at 61dc9f01a60999d18d8614e0337272f893643fa0 (Rust == main 19112dae937fb3b1842983943a0def6fad75f4b1)`
then `built kimetsu 2.11.0 (embeddings) sha256=262f17def1cfd67f07aaec325a2f2d23aa058d393adefc463d4bfc4c33391985`.
- `/workspace/fuse/e0s/wrapper-sha256.txt` and
`docs/audits/2026-11-e0s/MANIFEST.md` record the same SHAs.
- `61dc9f01` is one commit on top of `19112dae` (message: "Add a bench-sweep
profile..."). GitHub compare shows a scripts-only diff
(`scripts/e0_eval.py`, `scripts/retrieval_eval_profiles.py`). The box runner
also required `git diff --quiet 19112dae 61dc9f01 -- crates Cargo.toml Cargo.lock`.
So the Rust tree equals main `19112dae`.
- The cargo argv is in `/workspace/fuse/e0s/run_e0s.sh` (the runner that wrote
`logs/build.log`) and is copied in `docs/audits/2026-11-e0s/MANIFEST.md`.
`logs/build.log` is cargo's stdout (`Finished release ... in 6m 27s`) and
does not itself contain the argv. This was not rebuilt here to reconfirm
the digest, so 262f17de is the sha of that box build, not a sha we
reproduced in this PR.

Recorded command (box toolchain under `/workspace/fuse/e0s/toolchain`):

```
(cd /workspace/fuse/e0s/kimetsu && env \
PATH=/home/box/.cargo/bin:/workspace/fuse/e0s/toolchain/bin:/usr/local/bin:/usr/bin:/bin \
CXX=/workspace/fuse/e0s/toolchain/zig-cxx \
OPENSSL_INCLUDE_DIR=/usr/include OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu \
LIBRARY_PATH=/workspace/fuse/e0s/toolchain/lib \
CARGO_BUILD_JOBS=2 CARGO_TARGET_DIR=/workspace/fuse/e0s/target \
nice -n 19 /home/box/.cargo/bin/cargo rustc -p kimetsu-cli --bin kimetsu \
--release --locked --features embeddings -j 2 -- \
-C link-arg=-L/workspace/fuse/e0s/toolchain/lib \
-C link-arg=-lc++ -C link-arg=-lc++abi -C link-arg=-lunwind)
```

A portable embeddings build from the same Rust tree is:

```
cargo build --release --locked -p kimetsu-cli --bin kimetsu --features embeddings
```

A different toolchain or linker may not reproduce sha256 262f17de
byte-for-byte. The recorded digest is tied to the box command above.

## Timing source for question 81507db6

The first lme-oracle attempt died on a 300 s MCP client timeout during a
~17 min box stall on 2026-11-29 (memcap silent 13:08:41–13:26:10 ART). The
call in flight was graph-lite on question `81507db6`.

The per-call times come from `repro-81507db6/timed.log` (sha256
`c1715f2e7a471536db5500c3c5cdacb07f37589e13df7a23d0e5dde7242390db`).
That log is the output of `timed.py` invoked three times against the as-run
eval `dbdb3ecc`, after one untimed pass through `run.sh`. Quoted from the
log, `brain_context` took 1.04 / 1.04 / 1.32 s on graph-lite and
0.87 / 0.87 / 1.03 s on flat (8 capsules every time; mcp_start 0.01 s).
Whole-question wall times were 10.1 / 9.6 / 11.0 s.

`repro-81507db6/run.sh`, `timed.py`, and `time_reps.sh` now default to
repo-relative paths. `q.json` is the single-question slice that was used.

## Earlier failed attempts (disclosure)

The reported locomo-conv26 and lme-oracle runs show no chunk reuse in their
logs. These earlier attempts are not in the committed results; their run-log
headers are in `results/run-log-headers.txt`.

- locomo-conv26 died 2026-11-27 (`run_conv26.died-20261127.log`). Same
binary and data shas; eval sha256 was
`e61b45e2d0f732f3c27d8240a42f653910d66f7fc6e05d9a15e994293f5375b6`
(earlier than the as-run `dbdb3ecc` used for the reported conv-26 runs).
- locomo-conv26 stalled 2026-11-28 (`run_conv26.stalled-20261128.log`).
Same binary, data, and eval `dbdb3ecc` as the reported conv-26 runs.
- lme-oracle died 2026-11-29 (`run_lme.died-20261129.log`), the stall
described above. Eval was `dbdb3ecc`. The reported lme runs used
`5c371964` (chunk retry). Resolved configs from that dead attempt are
under the box path `results/run1.lme-died-20261129/` and are not
committed; the committed resolved-config files are from the successful
`run1/` and `run2/` writes.
31 changes: 31 additions & 0 deletions scripts/experiments/backend_ab/as-run.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# As-run box paths for the recorded locomo-conv26 and lme-oracle A/B.
# The committed results were produced with these values, not the repo-relative
# defaults. Source this only on the box that still has those paths.
#
# BIN=/workspace/fuse/e0s/bin/kimetsu-e0s \
# DATA=/workspace/fuse/e0/data/locomo-conv26.json \
# RESULTS=/workspace/fuse/backend-ab/results \
# ... scripts/experiments/backend_ab/run_conv26.sh
#
# Binary sha256: 262f17def1cfd67f07aaec325a2f2d23aa058d393adefc463d4bfc4c33391985
# locomo-conv26 data sha256: a996cc78f35f78d24114800636e4a2425ddf60639254532bfacff35a2013dcd7
# lme-oracle data sha256: 1dcfd431b1a145d2a234e07d1a72f246fbc37019bb4e3409a6a191beb965b129
# conv-26 eval sha256: dbdb3ecc7f86f1ad60921b1afe5f075ef44c1b0f90d531cfae68c0505c1c04b6
# lme-oracle eval sha256: 5c371964c37b369bf53d63616ba30eb065e921da172252e33fcda2c485035fac
# memcap (as-run box copy): /workspace/fuse/e0s/memcap.py
# sha256 6737690dbe820c2a3fe15081510c984c215c56de120ca116902a259f02db446e
# The repo default is scripts/experiments/e0s/memcap.py (later in-tree copy).

export BIN=/workspace/fuse/e0s/bin/kimetsu-e0s
# Set DATA to one of these before launching the matching runner:
# /workspace/fuse/e0/data/locomo-conv26.json
# /workspace/fuse/e0/data/lme-oracle.json
export RESULTS=/workspace/fuse/backend-ab/results
export MEMCAP=/workspace/fuse/e0s/memcap.py
export MODEL_CACHE=/workspace/fuse/e0s/model-cache
export EVAL=/workspace/fuse/backend-ab/backend_ab_eval.py
export FASTEMBED_CACHE_DIR=/workspace/fuse/e0s/model-cache
export HF_HOME=/workspace/fuse/e0s/model-cache
export OPENBLAS_NUM_THREADS=1
export HF_HUB_OFFLINE=1
export PYTHONHASHSEED=0
Loading
Loading