Skip to content

armgit / xerj

Public Imported from GitHub
0

AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.

bench: commit the two gate-evidence files .gitignore '*.md' silently dropped

xerj-org5ddd7e8b99ec
diff --git a/benchmarks/decisions-as-retrieval/results/2026-09-30-rc80gates/PROVENANCE.md b/benchmarks/decisions-as-retrieval/results/2026-09-30-rc80gates/PROVENANCE.md
new file mode 100644
index 000000000..95fce37af
--- /dev/null
+++ b/benchmarks/decisions-as-retrieval/results/2026-09-30-rc80gates/PROVENANCE.md
@@ -0,0 +1,51 @@
+# Provenance — inputs to the 2026-09-30 rc.80 decide-gate runs
+
+## Binaries
+
+| binary | what it is | how obtained |
+|---|---|---|
+| `/tmp/xerj-rc80gates-bin/xerj` | the staged release binary, main @ `a179e1ef3`, version string `xerj v1.0.0-rc.78` | provided by the release-cut orchestrator |
+| `/tmp/xtarget-decide/release/xerj` | **same commit** `a179e1ef3`, built with `cargo build --release --locked -p xerj-server --features decide-local` (the AC's own documented arming path, printed by `--help`) | built by this run; the stock release build does NOT include the `decide-local` cargo feature (see `stock-binary-noop.txt`) |
+
+All quality/latency numbers below were measured on the decide-local build of
+`a179e1ef3`; the staged release binary was used only to measure what `--decide-mode
+local` does on a stock release build (answer: nothing — a boot warning, tier stays off).
+
+## Model artifact
+
+`/tmp/xerj-rc80gates-artifact/xerj-decide-v1` (staged, read-only):
+`model.safetensors` sha256 `2dfdb8c33be5ace69243ea6d8a20a9ee905cfcfdf454f7eb7c49c05f73982bf0`
+— matches the artifact's own `MANIFEST.sha256` and the weights hash the task brief states.
+Verified with `sha256sum -c MANIFEST.sha256` (all three files OK).
+
+## Datasets (all staged by the orchestrator at /tmp/xerj-rc80gates-data/)
+
+| file | sha256 | licence | source |
+|---|---|---|---|
+| `b77_train.csv` | `b06e26ac675513959a63135f11b94ea7786ed02da65db93a5650d8838cbc664b` | CC-BY-4.0 | PolyAI-LDN/task-specific-datasets `banking_data/train.csv` — hash matches the xerj-decide-v1 manifest's recorded training input |
+| `b77_test.csv` | `d12d6e3bc4c3103966ae786dc435913c0c563dfa328f5a3646d0e62cfeeb474d` | CC-BY-4.0 | same repo, `test.csv` (3,080 rows) |
+| `sms.tsv` | `7d039a24a6083ed9ef0f806ebad56bbb976e3aeb8de05669173bfdc4996c239d` | CC-BY-4.0 (UCI page) | justmarkham/pycon-2016-tutorial mirror — hash matches the xerj-decide-v1 manifest |
+
+SMS held-out split: `load.py`'s exact method — `random.Random(7).shuffle` over the
+5,574 rows, first 4,000 = indexed history (not used here), remainder = the 1,574
+held-out rows scored.
+
+## AG News (fetched by this run, 2026-09-30)
+
+- File: `ag_news_test.csv` — 7,600 rows, no header, columns `class,title,description`
+ (class 1..4 = World / Sports / Business / SciTech).
+- sha256 `521465c2428ed7f02f8d6db6ffdd4b5447c1c701962353eb2c40d548c3c85699`
+- URL: `https://raw.githubusercontent.com/mhjabreel/CharCnn_Keras/master/data/ag_news_csv/test.csv`
+- Cross-check: the HuggingFace `fancyzhx/ag_news` card (whose parquet this repo's
+ 2026-09-20 AG News run used) declares test = 7,600 examples — same split size.
+ The HF parquet (sha256 `71de87ec66bc5737752a2502204dfa6d7fe9856ade3ea444dc6317789a4f13fb`)
+ was fetched too but not parsed (no pyarrow in this sandbox); the CSV mirror is the
+ same Zhang et al. test split.
+- **Licence: "unknown"** — that is the HuggingFace dataset card's own declaration
+ (`cardData.license = ["unknown"]`), and the CharCnn_Keras mirror repo carries no
+ licence file. Original corpus: Zhang, Zhao, LeCun, *Character-level Convolutional
+ Networks for Text Classification*, NeurIPS 2015 (arXiv:1509.01626). The file is used
+ here for evaluation only and is NOT committed to this repository — only its hash and
+ the measured numbers are.
+- Text fed to the model: `title + " " + description`, CSV-parsed, AG's original
+ escape sequences (e.g. `\ `, `#36;`) left verbatim.
diff --git a/benchmarks/decisions-as-retrieval/results/2026-09-30-rc80gates/run-2026-09-30.md b/benchmarks/decisions-as-retrieval/results/2026-09-30-rc80gates/run-2026-09-30.md
new file mode 100644
index 000000000..ec26ccb2b
--- /dev/null
+++ b/benchmarks/decisions-as-retrieval/results/2026-09-30-rc80gates/run-2026-09-30.md
@@ -0,0 +1,162 @@
+# rc.80 release gates — decide quality (#1057, #1064), latency (#1057 AC), flywheel replay (#1061)
+
+Run: 2026-09-30. All numbers below are measured on live nodes booted from
+**commit `a179e1ef3`** (main at cut time), version string **`xerj v1.0.0-rc.78`**.
+
+## Run header
+
+| item | value |
+|---|---|
+| release binary (staged) | `/tmp/xerj-rc80gates-bin/xerj` — `xerj v1.0.0-rc.78`, main @ `a179e1ef3`, stock release build (`cargo build --release --locked -p xerj-server`, release.yml:191) |
+| feature binary (all tier-2 numbers) | `/tmp/xtarget-decide/release/xerj` — same commit `a179e1ef3`, built with `--features decide-local` (the AC's own documented arming path, printed by `--help`); build log line: `Finished release profile in 12m 47s` |
+| why two binaries | **the stock release binary does not include the `decide-local` cargo feature** — `--decide-mode local` on it logs `WARN ... built without the decide-local feature` and tier 2 stays off (evidence: `stock-binary-noop.txt`). Tier-2 quality is therefore unmeasurable on the stock artifact; measured on the feature build of the same commit |
+| model artifact | staged `xerj-decide-v1` (weights sha256 `2dfdb8c3…`, manifest verified with `sha256sum -c MANIFEST.sha256`) |
+| node ports | 9600/9601 (tier-2 quality + latency), 9604/9605 (flywheel replay), 9608/9609 (tier-1 comparison) — private, throwaway data dirs under `/tmp` |
+| embed mode | `--embed-mode lexical` (tier 2 uses no embedder; tier-1 arms here are BM25-only, matching the published bm25 arm) |
+| machine | 32-core sandbox, co-tenant measurement agents active (loadavg 2–11 during the runs; noted per gate) |
+| datasets | SMS seed-7 held-out 1,574; Banking77 full test 3,080 (+ train 10,003 for tier-1); AG News full test 7,600 (fetched this run — `PROVENANCE.md`) |
+
+## Gate 1 — #1057 tier-2 zero-shot quality. Verdict: **FAIL** (all bars)
+
+Gate text: "zero-shot SMS accuracy >=0.95 and ECE <=0.05, AG News >=0.85, Banking77
+reported not gated; below the bar it ships behind a flag with the numbers published."
+
+What the "zero-shot head" is, determined from #1057/#1072 + the binary: there is
+**no downloaded pretrained model** — `--decide-mode local` has no download path and no
+egress (`engine/crates/xerj-ai/src/decide.rs` "no hub download"); it loads whatever NLI
+model directory `--decide-model-dir` names. The only release artifact is the trained
+`xerj-decide-v1` (#1064), scored here through the node's zero-shot answering mode
+(labels arrive per request; tier 2 = no history). AG News is the genuinely zero-shot
+dataset (never in the artifact's training); SMS and Banking77 are in its training
+corpus. Scored on the feature build, no `[decisions]` index, every answer tier `local`.
+
+| dataset | n | accuracy | ECE | conf≥0.8 | acc@≥0.8 | ms/item | bar | verdict |
+|---|---:|---:|---:|---:|---:|---:|---|---|
+| SMS held-out, noul (`/_decide`, positive_label=spam) | 1,574 | **0.9193** | **0.287** (p_raw-based: 0.3439) | 18.11% | 0.8035 | 14.6 | acc ≥0.95, ECE ≤0.05 | **FAIL / FAIL** |
+| AG News test, 4-way choice (`/v1/systemone`) | 7,600 | **0.2599** | 0.060 | 0.00% | — | 52.8 | ≥0.85 | **FAIL** (chance = 0.25) |
+| Banking77 test, 77-way choice (`/v1/systemone`) | 3,080 | **0.1185** | 0.0717 | 0.00% | — | 376.1 | reported, not gated | reported |
+
+SMS spam P/R/F1 through the node: 0.643 / 0.982 / 0.778. The rule for a failed
+gate — "ships behind a flag with the numbers published" — is doubly true here: the
+flag is the `decide-local` cargo feature, which stock release builds do not enable
+(see run header), i.e. in the shipped binary tier 2 is absent, not merely flagged off.
+
+Cross-check vs the model card (`docs/DECIDE_MODEL.md`, same artifact, same rows,
+in-harness `Head::score`): Banking77 reproduces **exactly** (0.1185 / ECE 0.072 /
+0% at 0.8 — the choice path renormalises identically). SMS differs: card 0.8850 /
+ECE 0.310 vs node 0.9193 / 0.287. Verified on the wire: for a noul the two
+hypothesis scores sum to 1 and `confidence = max(p_raw, 1−p_raw)` (1,574/1,574 rows),
+so the node's argmax-over-pair is a slightly different decision rule than the card's
+eval; the borderline rows differ. Both numbers are published; the release-path number
+is the node one.
+
+## Gate 2 — #1057 latency + download ACs
+
+AC: "p50 ≤ 50 ms for 30 questions on 8 CPU cores; quantized weights, download ≤ 300 MB".
+
+Method: node booted under `taskset -c 0-7` (verified: `pid 1339286's current
+affinity list: 0-7`), 30 distinct questions per shape, single sequential client,
+wall-clock, warm-up excluded (reported as cold), loadavg 2.2–3.1 (co-tenant agents
+active — upper-bound-ish, not a quiet-machine number).
+
+| shape | cold | p50 | p99 | mean | verdict vs 50 ms |
+|---|---:|---:|---:|---:|---|
+| `POST /_decide`, no index, noul (2 hypotheses) | 40.1 ms | **8.4 ms** | 14.2 ms | 8.9 ms | **PASS** |
+| `/v1/systemone`, one noul | 13.3 ms | **8.4 ms** | 14.2 ms | 9.0 ms | **PASS** |
+| `/v1/systemone`, 5-option choice | 28.7 ms | **20.0 ms** | 32.3 ms | 20.4 ms | **PASS** |
+| `/v1/systemone`, 77-option choice | 509.7 ms | 282.6 ms | 549.0 ms | 317.0 ms | over bar (context) |
+
+Weights/download: the tier downloads **0 MB** — there is no download path
+(`--decide-model-dir` is a local directory; no hf-hub, no egress). The artifact on
+disk is **28.5 MiB** (29,883,831 bytes: `model.safetensors` 29,683,844 +
+`tokenizer.json` 189,846 + `config.json` 641 + manifest/version) — far under the
+300 MB budget. It is **F32, not quantized** (candle 0.9 has no quantized
+safetensors `VarBuilder`; PR #1072 documents this as deliberate). AC met on size
+and latency; "quantized" is not met and was never buildable on this loader.
+
+## Gate 3 — #1064 artifact comparison, same rows, both tiers through live nodes
+
+| dataset + rows | tier | accuracy | ECE | conf≥0.8 | acc@≥0.8 | ms/item |
+|---|---|---:|---:|---:|---:|---:|
+| Banking77 test (all 3,080) | **tier 1** BM25 history vote, 10,003 gold train docs, k=10 | **0.8289** | 0.0808 | 51.43% | 0.9855 | 3.5 |
+| Banking77 test (all 3,080) | **tier 2** xerj-decide-v1, no history | **0.1185** | 0.0717 | 0.00% | — | 376.1 |
+| SMS held-out (all 1,574) | **tier 1** BM25 history vote, 4,000 seed-7 train docs, k=10 (`/_decide`) | **0.9848** | 0.0129 | 96.38% | 0.9914 | 3.9 |
+| SMS held-out (all 1,574) | **tier 2** xerj-decide-v1, no history (`/_decide`) | **0.9193** | 0.287 | 18.11% | 0.8035 | 14.6 |
+| AG News test (all 7,600) | tier 1 BM25 vote, 120,000 docs (2026-09-20 run, cited) | 0.9182 | — | 83.1% | 0.9669 | ~69 |
+| AG News test (all 7,600) | **tier 2** xerj-decide-v1, no history | **0.2599** | 0.060 | 0.00% | — | 52.8 |
+
+Tier-1 SMS spam P/R/F1: 0.976 / 0.916 / 0.945. The task asked for "zero-shot head
+vs trained xerj-decide-v1": **these are the same weights on this binary** — there is
+no second, pretrained model and no download path, so no zero-shot-vs-trained contrast
+exists to measure; the measurable comparison on identical rows is tier 1 vs tier 2,
+above, both re-derived through nodes (not pasted from the card — the card's numbers
+are cited beside Gate 1's table where they cross-check). Tier 1 stays ahead on its
+home ground everywhere, as docs/DECISIONS.md predicts: it has labelled history,
+tier 2 has none.
+
+## Gate 4 — #1061 flywheel replay. Verdict: **FAIL** (both arms miss a bar)
+
+Gate text: "Banking77 replay, after 2,000 cached hosted answers, >=80% of later
+traffic answered by history at >=0.8 confidence with accuracy >=0.97."
+
+Tier 3 (hosted) is not built, so the replay runs twice: arm a is the ladder exactly
+as shipped (the node's own tier-2 answers are the cached ones — the only answers the
+flywheel can actually cache today); arm b instantiates the gate's premise (2,000
+gold answers cached in the write-back's own document shape, `source="hosted"`).
+Both use eval.py's seed-11 shuffle of the 3,080 test rows (the file is label-sorted;
+an unshuffled head/tail split measures label ordering, not the flywheel — the first,
+unshuffled run is preserved in `replay1061.history-sorted-run.out` and showed
+accuracy 0.0 by construction).
+
+**Arm a — live flywheel (as shipped).** 2,000 fill requests fired; only **12**
+tier-2 answers were ever cached (write-back only fires when tier 2 answers, and
+after the first cached doc the history vote returns support for ~99.4% of traffic —
+a BM25 `match` hit on any cached document counts as support). The last fill request
+tier 2 answered was #1,684; the cache asymptotes at 12 docs. The gate's premise
+("after 2,000 cached answers") is **unreachable through the ladder itself** on
+Banking77-shaped traffic. Later traffic (the other 1,080 rows):
+
+| metric | value | bar | verdict |
+|---|---:|---|---|
+| share answered by history (any conf) | 99.72% | — | — |
+| share answered by history at conf ≥0.8 | **4.91%** | ≥80% | **FAIL** |
+| accuracy of that share | **0.0377** | ≥0.97 | **FAIL** |
+| accuracy of all history answers | 0.0334 | — | — |
+| overall accuracy on later traffic | 0.0333 | — | — |
+
+Reading: the flywheel locks in a tiny, mostly-wrong cache and then answers
+essentially everything from it — the measured mechanism failure is the freeze plus
+tier-2's own 0.1185 Banking77 accuracy compounding into 3.3% accuracy on later
+traffic.
+
+**Arm b — the gate's premise (2,000 gold answers cached, shuffled identically).**
+
+| metric | value | bar | verdict |
+|---|---:|---|---|
+| share of later traffic (1,080 rows) answered by history at conf ≥0.8 | **19.72%** | ≥80% | **FAIL** (4× under) |
+| accuracy of that share | **0.9953** | ≥0.97 | **PASS** |
+| overall history accuracy | 0.7009 | — | — |
+
+Reading: with a correct 2,000-answer cache, the vote's confident slice is easily
+accurate enough, but a 2,000-doc history only clears confidence 0.8 on ~20% of
+traffic (the vote's published 50.6%-at-0.8 coverage was with the full 10,003-doc
+train history; the blog's 87% basis likewise). The 80% share bar needs a far larger
+cache than 2,000 answers at k=10 — or the hybrid/minilm neighbour arms.
+
+## Files
+
+- `score_local.py`, `rows.jsonl`, `summary.json`, `score_local.out` — gate 1 + tier-2 rows of gate 3
+- `score_history.py`, `rows_history.jsonl`, `summary_history.json`, `score_history.out` — tier-1 rows of gate 3
+- `latency30.py`, `latency30.json`, `latency30.out` — gate 2 (taskset evidence + loadavg inside)
+- `replay1061.py`, `replay_rows.jsonl`, `replay_summary.json`, `replay1061.out` — gate 4 (plus `*.history-sorted-run.*` — the discarded first design, kept for the record)
+- `stock-binary-noop.txt` — the staged release binary's tier-2 no-op evidence
+- `PROVENANCE.md` — binaries, artifact, dataset hashes/licences (AG News fetched this run)
+
+## Caveats
+
+- Wall-clock timings on a 32-core box with other measurement agents running
+ (loadavg 2–11); the latency node was pinned to cores 0-7 but the client was not.
+- Tier-2 quality/latency numbers are from the `decide-local` feature build of
+ `a179e1ef3`, not the stock release binary (which cannot run tier 2 — run header).
+- Arm b's stand-in hosted answers are gold labels at p=0.99 (no hosted tier exists);
+ `p` is not used by the vote, so the substitution is exact for the vote's inputs.