diff --git a/.gitattributes b/.gitattributes index c3fdea635a1229b34580cdb3d7165ebdcf2a4292..913b902fca96c79f66435be426c38bcc8dc74d3f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,3 @@ *.bin filter=lfs diff=lfs merge=lfs -text model/*/substrate.bin filter=lfs diff=lfs merge=lfs -text +build/libsyfox_core.so filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md index c843bb5143a1f09504fd6fc8e074e674ff6f3c9b..0eef3aad17dcdfd4ea7cfc4876046cb3267f1b19 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,166 @@ empty per-row instructions, globally-unique opaque anchors (278), and round-robin domain interleaving. Full measured evaluation: [docs/EVALUATION.md](docs/EVALUATION.md). +--- + +--- + + +## v4.0 — the affinity field readout (AFR) + +The engine could **retrieve** but never **measure**. Two defects, both +measured on the shipped fabrics: + +1. **The readout never read the fabric's own anchor affinity.** Every lesson + binds the state's tokens to the outcome anchor, so the fabric holds + `w(u,c)` — "which intent did this word teach". The legacy readout only + sampled the field and let a capped diffusion carry the evidence, so one + constant had to serve both precision and reach, and the measured optimum + was **per-domain** (tickets_en wanted 0.45, agnews/dbpedia wanted 0.02). +2. **The readout had no null model.** A candidate's score was an + unnormalised *sum* over its probe bag — for Banking77, 20 mined phrases + (~60 token occurrences) mostly shared with other candidates, so shared + words added a large common offset and the one discriminative word was one + term out of sixty. + +v4.0 adds one channel, with **no training and no neural network**: + +``` +P(c|u) = w(u,c) / sum_{c' in C} w(u,c') posterior over the candidate set +P0(c) = mass(c) / sum_{c'} mass(c') a priori share of the candidate set +L(c) = sum_u E_u * [ P(c|u) - P0(c) ] the contrast +score(c) = (1-mix) * legacy(c)/max|legacy| + mix * L(c)/max|L| +``` + +A token that points at every candidate cancels against the null model; a +token that points at one candidate contributes strongly, positive for that +candidate and negative for the rest. This is the **first-order resolvent of +the propagation the settle simulates** — the same operator, read exactly +instead of approximated by a capped and smeared diffusion. `mix = 0` (the +default) is bit-identical to v3.9.1. + +v4.0 also fits **one temperature per distinct candidate count**: a 14-way +question's score spread is not a 2-way question's spread, and one scalar +fitted across both left `polarity` at ECE 0.395 while `dbpedia` sat at 0.064 +in the same fit. + +### What changed in THIS repo + +**Seven of the nine fabrics are updated** — repaired where the lane decay had +killed them, and re-calibrated under the new readout. The readout mode is +recorded in each fabric's `physics.json` (`"affinity_mix":0.3`), so the +deployed model decides under the readout its temperature was fitted for. + +| fabric | change | measured | +|---|---|---| +| `b77-sem` | lane repair + AFR + per-count temperature | hidden 3,080: **0.158 → 0.4800**, ECE **0.809 → 0.0460** | +| `router16` | lane repair + AFR | cal 12,593: **0.5060 → 0.5850**; handmade OOD 0.267 → **0.467** | +| `giant-latin` | lane repair + AFR | agnews **0.7520**, emotion **0.3930**, polarity **0.5960**, dbpedia **0.7970**, tickets_en **0.9570** | +| `giant-bengali` | AFR | hidden 540: **0.9260 → 1.0000**, ECE 0.0270 → **0.0000** | +| `giant-devanagari` | AFR | hidden 539: **0.9110 → 1.0000**, ECE 0.0180 → **0.0010** | +| `giant-cyrillic` | AFR | hidden 539: **0.9520 → 1.0000**, ECE 0.0170 → **0.0000** | +| `agnews` | AFR | novel probes: **0.5833 → 0.7500** (gate ≥ 0.40) | +| `sst2` | **unchanged** | novel probes 0.7500 (gate ≥ 0.65) | +| `amazon` | **unchanged** | novel probes 0.7000 (gate ≥ 0.65) | + +**Two fabrics are deliberately NOT updated.** `sst2` and `amazon` are the +two-class fabrics, and the contrast is degenerate there: with two +candidates a single token points at one of them or the other, so one +mis-pointed token dominates. Measured on their own admission probes, the +AFR gives **sst2 0.5830** and **amazon 0.6000** — **both below their own +0.65 admission gate**, so the shipped fabric would fail the gate that +exists to catch exactly this. They ship unchanged, with the legacy readout. +That is the gate doing its job, and it is why the readout is applied per +fabric rather than globally. + +The `tickets_en` number is the one to look at: the shared giant fabric +scored 0.9040 before the lane repair and 0.4480 after it. With the affinity +readout the SAME repaired fabric scores **0.9570** — above the original. + +### Reproducing + +```bash +cd engine && make all && make sync-so && cd .. +python3 examples/smoke.py +``` + +`engine/` is the v4.0 source (core/, src/, tools/) — the same tree as the +GitHub repo, so the code and the weights that ship with it are the code +that was measured. + +## The three defects (found by re-testing on the v3.9.1 engine) + +### 1. The calibration was fitted under a different physics than the decision runs + +The choice/score temperature is fitted on energies that come out of a settle +pass, and those energies depend on the **whole decide-side composition** — +the energy gain, the diffusion constant, the decay, the settle-pass cap. In +this repo the banking and router fabrics were calibrated **without** the +decide-side energy gain while every `bench` and every `decide` call ran +**with** it. + +Measured on the shipped `model/b77-sem` fabric and the 1,003-row cal split +that ships with it — same engine, one flag apart: + +| calibration | fitted `T` | rows the fit saw | ECE before → after | +|---|---:|---:|---:| +| without the energy gain (**what shipped**) | **0.0037** | **556 of 2,006 (27.7%)** | 0.4567 → 0.4057 | +| with the energy gain (**what the bench runs**) | **0.3552** | 2,006 of 2,006 (100%) | 0.3183 → 0.3056 | + +The published `model/b77-sem/calibration.json` carried `T = 0.00472645` +fitted over **211 rows**; `model/router16` carried `T = 0.00491756` over +**160 rows**. + +A near-floor temperature saturates the softmax. The post-temperature top-2 +probability gap goes to ~0.93 on every row, which breaks three things at +once: the honest-defer gate (an absolute 0.05 margin) **can never fire** — +the model never abstains, on any input, ever; every answer carries ~0.98 +confidence whether it is right or wrong; and the ECE reported by +`calibrate` does not describe the ECE the bench measures. + +**Fix:** a fabric now carries the composition it was calibrated under +(`physics.json`, next to `calibration.json`). `calibrate` records it; +`decide`, `bench`, `demo` and `stats` apply it on load. `calibrate` also +**refuses** to run when the fit would see less than half the question-rows +(it names the cause and leaves the fabric untouched). The three shipped +fabrics have been re-calibrated under the matched composition. + +### 2. The diffusion constant was never re-tuned for the dense fabrics + +`diffusion` is the fraction of retained energy that flows along the Hebbian +lanes per settle pass. It is a config value, not an equation, and its +optimum is a property of the fabric: 0.45 was validated on the small v2-era +fabrics and is far off the optimum for a 217k-lane fabric. Measured on the +**cal** split of the shipped banking fabric (selection never touches +hidden): + +| diffusion | accuracy (argmax) on cal | +|---|---:| +| 0.45 (shipped default) | 0.1316 | +| **0.02** | **0.4237** | + +**Fix:** the diffusion value is now a per-fabric property recorded in +`physics.json`, chosen on the cal split +(`tools/cal_diffusion_sweep.py`), not a global default. + +### 3. The headline table was measured against the wrong fabric, on the wrong engine + +The bank77 row in the old table (`class acc 0.023`) was measured on the +**shared** `model/giant-latin` fabric, not on the dedicated `model/b77-sem` +fabric this repo ships and `router.json` routes bank77 to. It was also +measured with the v3.2.0 engine, which had no honesty gates: under +v3.9.1 the same run defers **2,129 of 3,080 rows (69%)**, because the +newer engine refuses to answer a field that carries no candidate energy. + +Separately: the four `model/giant-*` fabrics were built by the **v3.1.2** +engine and carry **no semantic field** (their `substrate.bin` has no `SEM4` +tail), so the v3.2 semantic layer described below is **inert on them**. No +shipped fabric carries the `IDF5` tail either, so the v3.6 document- +frequency weighting is inert everywhere. + +--- + + ## Headline measured numbers (hidden splits, scored once) > **⚠ Measured with the v3.2.0 engine.** The core in this repo is now v3.9.1, @@ -136,19 +296,26 @@ field does not fake it. ## Files ``` -engine/ C++ SI substrate core v3.9.1 (core/*.hpp, src/*.cpp) — builds with make +engine/ C++ SI substrate core v4.0 (core/*.hpp, src/*.cpp, tools/) — builds with make NOTE: refresh ../build/libsyfox_core.so after rebuilding, or the python bridge will keep loading the stale core (ENGINE_PORT.md) server/ HTTP bridge (v3 API, CLI-equal flags incl. the v3.2 knobs) inference.py thin python wrapper (auto script routing) -model/ giant-{latin,bengali,devanagari,cyrillic}/substrate.bin (v3.2-era, 16 domains) - sst2/ agnews/ amazon/ NEW v3.9.1 fabrics, handcrafted-probe gated - b77-sem/ dedicated 77-way banking fabric (v3.2 semantic layer) - router16/ two-stage physics router (router.json: anchors+models) +model/ NINE fabrics, all carrying their recorded decide-side + composition in physics.json (diffusion, energy_norm, affinity_mix): + giant-latin/ 16-domain shared fabric AFR, diffusion 0.45 + giant-bengali/ Bengali script fabric AFR, diffusion 0.45 + giant-devanagari/ Hindi script fabric AFR, diffusion 0.45 + giant-cyrillic/ Russian script fabric AFR, diffusion 0.45 + b77-sem/ dedicated 77-way banking AFR, diffusion 0.02 + router16/ two-stage physics router AFR, diffusion 0.45 + agnews/ handcrafted-probe gated AFR, diffusion 0.45 + sst2/ handcrafted-probe gated LEGACY readout (see v4.0) + amazon/ handcrafted-probe gated LEGACY readout (see v4.0) datasets/ eval hidden splits, probes, schemas, MANIFEST (SHA-256), novel_probes/ (handcrafted admission probes + RESULTS.json), router16_router.json, zeroshot_v32_results.json, DATASETS.md -docs/ ENGINE_PORT.md (v3.9.1 port + caveats), EVALUATION.md, +docs/ ENGINE_PORT.md (v4.0 port + caveats), EVALUATION.md, ARCHITECTURE.md, PROBING.md, ZEROSHOT.md examples/ JSON payloads + curl + python usage Dockerfile HuggingFace Spaces (builds engine, serves on 7860) diff --git a/build/libsyfox_core.so b/build/libsyfox_core.so index 46b43bbeee0963e91f79b94503d6d90c82beba13..3788d39023b5ce00322cfc623cb7262cb8a488ba 100644 --- a/build/libsyfox_core.so +++ b/build/libsyfox_core.so @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7ecb7c2ac7bc1d7f044f6daa0eb82af988013a7c64ec898ad3abaead3bb4995f -size 533848 +oid sha256:75d062a5a7faca291b1d6f687ef91204c42e31b44aad156d388b59e0297c69e8 +size 419520 diff --git a/datasets/bench_hidden_summary.json b/datasets/bench_hidden_summary.json new file mode 100644 index 0000000000000000000000000000000000000000..685f9321df1bcbc8694e0ce9ddb489654705f9a6 --- /dev/null +++ b/datasets/bench_hidden_summary.json @@ -0,0 +1,14 @@ +[ + { + "domain": "bank77", + "n": 3080, + "router_acc": 0.5889610389610389, + "class_acc": 0.15791316526610644, + "e2e_acc": 0.0801948051948052, + "deferred": 224, + "secs": 65.7, + "ms_per_row": 21.33, + "qkey": "intent", + "note": "" + } +] \ No newline at end of file diff --git a/datasets/eval_summary_v400.json b/datasets/eval_summary_v400.json new file mode 100644 index 0000000000000000000000000000000000000000..7aaa27118110baa084a1c32c9f92193d833ae077 --- /dev/null +++ b/datasets/eval_summary_v400.json @@ -0,0 +1,64 @@ +{ + "engine": "syfox 4.0.0 (v3.9.1 + v3.9.2 fit==decide composition + v3.9.3 lane repair + v4.0 affinity field readout)", + "note": "every number measured in THIS repo against the SHIPPED fabrics and the SHIPPED splits; selection on cal, hidden scored once. The v4.0 rows are the fabrics as they ship here (each carries its recorded composition in physics.json).", + "v400_affinity_field_readout": { + "mechanism": "score(c) = (1-mix)*legacy(c)/max|legacy| + mix*L(c)/max|L|, L(c) = sum_u E_u*[P(c|u)-P0(c)], P(c|u)=w(u,c)/sum_c' w(u,c'), P0(c)=mass(c)/sum_c' mass(c')", + "training": "none — every quantity was already learned by hebbian_lesson; O(|lit|*degree) per question; one CPU core; no neural network", + "default": "mix = 0 (bit-identical to v3.9.1); seven of the nine fabrics here ship with affinity_mix = 0.3 recorded in physics.json", + "also_in_v400": "one softmax temperature per distinct candidate count (the count is a property of the QUESTION): the shared giant fabric's single fitted temperature left polarity at ECE 0.395 while dbpedia sat at 0.064 in the SAME fit", + "per_fabric": { + "b77-sem": { + "readout": "affinity_mix 0.3, diffusion 0.02", + "cal_1003": {"legacy": 0.4340, "v400": 0.4560}, + "hidden_3080_scored_once": {"legacy": 0.4660, "v400": 0.4800}, + "ece_hidden": {"legacy": 0.2200, "v400": 0.0460}, + "handmade_ood_68": {"legacy": 0.132, "v400": 0.191} + }, + "router16": { + "readout": "affinity_mix 0.3, diffusion 0.45", + "cal_12593": {"legacy": 0.5060, "v400": 0.5850}, + "ece_cal": {"legacy": 0.0460, "v400": 0.0610}, + "handmade_ood_15": {"legacy": 0.267, "v400": 0.467} + }, + "giant-latin": { + "readout": "affinity_mix 0.3, diffusion 0.45", + "per_domain_hidden": { + "agnews": {"legacy": 0.3730, "v400": 0.7520}, + "emotion": {"legacy": 0.1960, "v400": 0.3930}, + "polarity": {"legacy": 0.5440, "v400": 0.5960}, + "dbpedia": {"legacy": 0.5530, "v400": 0.7970}, + "tickets_en": {"legacy": 0.4480, "v400": 0.9570} + }, + "tickets_en_shipped_fabric": 0.9040, + "comment": "the round-2 tickets_en regression (0.9040 -> 0.4480 after the lane repair) is INVERTED: the same repaired fabric scores 0.9570 with the affinity readout, above the original" + }, + "giant-bengali": {"readout": "affinity_mix 0.3", "hidden_540": {"legacy": 0.9260, "v400": 1.0000}, "ece": {"legacy": 0.0270, "v400": 0.0000}}, + "giant-devanagari": {"readout": "affinity_mix 0.3", "hidden_539": {"legacy": 0.9110, "v400": 1.0000}, "ece": {"legacy": 0.0180, "v400": 0.0010}}, + "giant-cyrillic": {"readout": "affinity_mix 0.3", "hidden_539": {"legacy": 0.9520, "v400": 1.0000}, "ece": {"legacy": 0.0170, "v400": 0.0000}}, + "agnews": {"readout": "affinity_mix 0.3", "novel_probes_12": {"legacy": 0.5833, "v400": 0.7500}, "admission_required": 0.40}, + "sst2": {"readout": "LEGACY (unchanged)", "novel_probes_12": {"legacy": 0.7500, "if_affinity_were_enabled": 0.5830}, "admission_required": 0.65, + "reason": "the affinity readout would drop this fabric BELOW its own admission gate, so it ships unchanged"}, + "amazon": {"readout": "LEGACY (unchanged)", "novel_probes_10": {"legacy": 0.7000, "if_affinity_were_enabled": 0.6000}, "admission_required": 0.65, + "reason": "the affinity readout would drop this fabric BELOW its own admission gate, so it ships unchanged"} + }, + "why_two_class_fabrics_are_excluded": "the contrast is degenerate on a two-candidate set: with two candidates a token points at one or the other, so one mis-pointed token dominates. The gate on the fabric's own novel probes is the arbiter, not a global rule.", + "cost": { + "latency": "unchanged in practice (the channel is O(|lit|*degree), microseconds against a 6-11 ms decision)", + "memory": "one per-fabric cache of node lane-mass" + } + }, + "b77_sem": { + "fabric": "model/b77-sem", + "shipped_v391": { + "calibration": {"choice_temperature": 0.00472645, "rows": 211, "composition": "unknown (no physics.json)"}, + "cal_1003": {"n": 1003, "accuracy_argmax": 0.1316, "ece_top_prob_10bin": 0.838, "answered_frac": 0.996, "honest_total": 0.1316}, + "hidden_3080": {"n": 3080, "accuracy_argmax": 0.1584, "ece_top_prob_10bin": 0.8085} + }, + "v400": { + "calibration": {"composition": "affinity_mix 0.3, diffusion 0.02, energy_norm true"}, + "cal_1003": {"n": 1003, "accuracy_argmax": 0.4560, "ece_top_prob_10bin": 0.0740}, + "hidden_3080": {"n": 3080, "accuracy_argmax": 0.4800, "ece_top_prob_10bin": 0.0460} + } + }, + "note_on_splits": "the handmade OOD numbers (148 hand-written probes, tools/handmade_gate.py + data/handmade_probes.jsonl) are NOT a training or calibration set; they are reported next to every number so the in-distribution / out-of-distribution gap stays visible." +} diff --git a/datasets/novel_probes/RESULTS.json b/datasets/novel_probes/RESULTS.json index 2c8873625c282ba938aa5aa12e2d0e0138d22b9b..ab4df3219f7f2d98e52355c6b0ffb546bbd05d35 100644 --- a/datasets/novel_probes/RESULTS.json +++ b/datasets/novel_probes/RESULTS.json @@ -1,40 +1,44 @@ { - "admitted": [ - { - "domain": "sst2", - "novel_accuracy": 0.75, - "required": 0.65, - "n": 12 - }, - { - "domain": "agnews", - "novel_accuracy": 0.5833, - "required": 0.4, - "n": 12 - }, - { - "domain": "amazon", - "novel_accuracy": 0.7, - "required": 0.65, - "n": 10 - } - ], - "rejected": [ - { - "domain": "toxic", - "novel_accuracy": 0.2857, - "required": 0.65, - "collapse": true, - "reason": "below required margin + prediction collapse" - }, - { - "domain": "emotion", - "novel_accuracy": 0.25, - "required": 0.3167, - "collapse": false, - "reason": "below required margin" - } - ], - "gate": "tools/novel_gate.py", - "rule": "accuracy > max(majority_baseline, uniform_chance + 0.15) and no prediction collapse > 60%" + "admitted": [ + { + "domain": "sst2", + "novel_accuracy": 0.75, + "required": 0.65, + "n": 12, + "note": "v4.0: the affinity readout measured 0.5830 on these probes, BELOW this gate, so the fabric ships UNCHANGED with the legacy readout" + }, + { + "domain": "agnews", + "novel_accuracy": 0.75, + "required": 0.4, + "n": 12, + "note": "v4.0: the affinity readout (mix 0.3) raised this from 0.5833; the fabric ships with affinity_mix 0.3" + }, + { + "domain": "amazon", + "novel_accuracy": 0.7, + "required": 0.65, + "n": 10, + "note": "v4.0: the affinity readout measured 0.6000 on these probes, BELOW this gate, so the fabric ships UNCHANGED with the legacy readout" + } + ], + "rejected": [ + { + "domain": "toxic", + "novel_accuracy": 0.2857, + "required": 0.65, + "collapse": true, + "reason": "below required margin + prediction collapse" + }, + { + "domain": "emotion", + "novel_accuracy": 0.25, + "required": 0.3167, + "collapse": false, + "reason": "below required margin" + } + ], + "gate": "tools/novel_gate.py", + "rule": "accuracy > max(majority_baseline, uniform_chance + 0.15) and no prediction collapse > 60%", + "v400_note": "The v4.0 affinity readout is applied PER FABRIC and gated by this file's own rule: a fabric whose readout change would drop it below its 'required' margin is shipped unchanged. agnews passes (0.5833 -> 0.7500, required 0.40); sst2 (0.5830) and amazon (0.6000) would fail their 0.65 gate and ship unchanged. The contrast is degenerate on two-class candidate sets, which is why." } \ No newline at end of file diff --git a/docs/ENGINE_PORT.md b/docs/ENGINE_PORT.md index 20bcb8c275b6cc70e915cfa18bb8eb166f85954d..03ff0fd4010e7095c430342e5948626e3c0694dc 100644 --- a/docs/ENGINE_PORT.md +++ b/docs/ENGINE_PORT.md @@ -1,4 +1,4 @@ -# Engine port — v3.2.0 → v3.9.1 +# Engine port — v3.2.0 → v4.0.0 ## What changed @@ -108,4 +108,69 @@ weight instead: **`abstention` / `uncertainty-quantification` / `selective-prediction`**, alongside `no-transformer` / `no-neural-network` / `no-pattern-matching`. A decision engine that can say "I don't know", with no neural network anywhere, is a more defensible claim than a multimodal one, and -it is the one this repo actually demonstrates. \ No newline at end of file +it is the one this repo actually demonstrates. + +--- + +# v4.0.0 — the affinity field readout (2026-11) + +The engine in `engine/` is now the **v4.0.0** tree: the same source as the +GitHub repo at the v4.0 commit, so the code and the weights that ship here +are the code that produced every number in the card. + +| | before | after | +|---|---:|---:| +| `core/*.hpp` | 16 files | 16 files | +| `core/syfox.hpp` | 2,415 lines | 2,756 lines | +| `core/si_substrate.hpp` | 2,415 lines | 2,539 lines | +| string | `syfox-3.9.1` | `syfox-4.0.0` | + +## What v4.0 adds + +1. **The affinity field readout (AFR)** — `core/syfox.hpp`, `--affinity-mix F` + (0 = legacy, bit-identical to v3.9.1; 1 = affinity only) and + `--affinity-pmi` (the log-odds form). No training, no neural network: it + reads the Hebbian affinity the fabric already learned, against the + candidate set as its own null model. +2. **The lane repair** — `core/si_substrate.hpp`, `syfox repair-lanes + --model DIR [--dead-threshold F] [--dry-run]`, plus `--lane-floor F` for + new fabrics. The port applied CMD §2.3's decay to every lane on every + lesson, so a lane last bound long ago underflows to the float32 denormal + floor and the Hebbian memory is erased; the repair rebuilds it from the + persisted evidence ledger in CMD's saturating form. +3. **The per-candidate-count temperature** — one scalar per distinct + candidate count, because one scalar cannot serve a 14-way and a 2-way + spread at once. Persisted in `calibration.json` + (`choice_temperature_by_count`). + +## The recorded composition moved + +`model/*/physics.json` now carries the **readout** as well as the physics: + +```json +{"affinity_mix":0.3,"affinity_pmi":false,"decay":0.82,"diffusion":0.45, + "energy_norm":true,"hop_coupling":0.35,"k_settle":8,"recorded":true} +``` + +so a deployed model decides under the readout its temperature was fitted for. +Seven of the nine fabrics here carry `affinity_mix: 0.3`; `sst2` and `amazon` +carry none, because the affinity readout would drop them below their own +admission gate (see the card's v4.0 section). + +**The C API now applies the recorded composition on load.** +`syfox_engine_create()` loads `physics.json` and *applies* it, so the +python bridge, the HTTP server and the Space decide under the same physics +as the CLI. Before this, the server path decided under a different +composition — and, after v4.0, under a different readout than the fitted +temperature. + +## Rebuilding + +```bash +cd engine && make all && make sync-so && cd .. +``` + +`make sync-so` copies `engine/build/libsyfox_core.so` to the **repo-root** +`build/`, which is where `server/syfox_bridge.py` loads it from. Skipping it +is the most common setup failure: the CLI and the tests pass, then +`from inference import SyFox` dies with `undefined symbol`. diff --git a/engine/CHANGELOG.md b/engine/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..05cbef4704bcada936986a451f44bef86c0243af --- /dev/null +++ b/engine/CHANGELOG.md @@ -0,0 +1,1476 @@ +## v4.0 — the affinity field readout (AFR): measuring an anchor instead of retrieving one + +A new READOUT, not a new fabric and not a new model. No neural network, no +training, no new corpus pass: every quantity AFR reads was already learned +by `hebbian_lesson`. It costs O(|lit| * degree) per question on one core, +and it is OFF by default so every pre-v4.0 fabric replays bit-identically. + +THE DEFECT. Three measurements, on the shipped model and the v3.9.3 engine: + +1. THE READOUT NEVER READS THE FABRIC'S STRONGEST SIGNAL. Every lesson + binds the state's tokens to the outcome anchor (outcome_text = the label + key + its description), so the fabric holds an explicit affinity + w(u, c) between a query-side token and a candidate anchor -- literally + "which intent did this word teach". The legacy readout never reads it: + Substrate::readout() sums the probe token's own energy plus a + weight-averaged neighbourhood, and the anchor's affinity enters only + indirectly, through whether a capped, decaying diffusion carried energy + to the anchor. One constant therefore has to serve both PRECISION (the + field must not smear onto wrong anchors) and REACH (the right anchor + must light up at all), and the two want opposite values -- measured: the + diffusion optimum is per-DOMAIN (tickets_en 0.45, agnews/dbpedia 0.02). + A constant that must be re-tuned per domain is a sign the readout is + asking the wrong question. + +2. THE READOUT HAS NO NULL MODEL. A candidate's score is an unnormalised + SUM over its probe bag. A Banking77 description is 20 mined phrases -- + ~60 token occurrences -- most of them shared with other candidates + ("not", "working", "the"). Shared words add a large common offset; the + one discriminative word is one term out of sixty. The mined phrases + make the sum a repetition-weighted VOTE, not a measurement. + +3. THE CONSEQUENCE IS A RETRIEVAL SCORE, NOT A MEASUREMENT SCORE. Measured + on the repaired b77-sem fabric, query "the cash machine swallowed my + card and it never came back": + candidate[c04]=0.0933 ("cash withdrawal not working") + candidate[c19]=0.0919 ("card payment not working") + -- two intents differing by ONE word score within 1.5% of each other; + the decision was a coin flip. The fabric KNOWS that "card" belongs to + c19; the readout could not see it. + + And the vocabulary was NOT the cause: 98.8% of the handmade Banking77 + probe tokens (577/584) are already nodes. An OOV-first design would have + been the wrong fix for the measured failure. + +THE MECHANISM. For the lit query tokens u with field energy E_u and the +candidate set C: + + P(c|u) = w(u,c) / sum_{c' in C} w(u,c') posterior over C + P0(c) = mass(c) / sum_{c' in C} mass(c') a priori share of C + L(c) = sum_u E_u * [ P(c|u) - P0(c) ] the contrast + or, with --affinity-pmi, the log-odds form L(c) = sum_u E_u * log(P(c|u)/P0(c)). + +A token that points at EVERY candidate cancels against the null model and +contributes nothing -- ubiquity stops being evidence. A token that points +at ONE candidate contributes strongly, positive for that candidate and +negative for the rest, so discrimination becomes sign-carrying instead of +drowned in a shared offset. mass(c) is the anchor's own total lane weight: +the prior is measured, not assumed. + +The channel is blended with the legacy readout: + score(c) = (1-mix) * legacy(c)/max|legacy| + mix * L(c)/max|L| +with mix defaulting to 0 (legacy, bit-identical). The measured optimum is a +SMALL dose -- mix = 0.3 wins on every fabric and every diffusion tested. + +This is the FIRST-ORDER RESOLVENT of the propagation the settle simulates: +the same operator, read exactly instead of approximated by a capped and +smeared diffusion. In the literature it is the same object as Kanerva's SDM +read out by a kernel/least-squares solve (Iatropoulos et al., "Kernel Memory +Networks", NeurIPS 2022), which likewise replaces a hand-tuned decay +schedule with a closed-form retrieval and a capacity law; and its ORDER +counterpart is Plate's Holographic Reduced Representations (IEEE TNN 1995), +whose crosstalk failure mode is cured by projecting the retrieved trace onto +the span of the known anchors -- which is what the candidate set does here. +The non-neural char n-gram representation that would remove the dark node +STRUCTURALLY is Schutze, Adel & Asgari, "Nonsymbolic Text Representation", +EACL 2017 (char n-gram counts -> SVD -> summed; no gradient training). + +THE HONEST-SILENCE FLOOR, RESTATED. kUnknownCandidateFloor defers when the +settled field carries no energy on any candidate -- which in the +novel-wording case is exactly the situation the affinity channel exists to +rescue. The floor now fires only when NEITHER channel carries evidence, +and is still evaluated on the legacy channel's maximum, so its meaning (it +measures the FIELD) is unchanged. + +MEASURED -- router16 (16 intents), CAL split (12,593 rows): + 0.45 0.0 0.5060 0.0460 0.267 (4/15) + 0.45 0.3 0.5850 0.0610 0.400 (6/15) <- +7.9 points + 0.02 0.0 0.5290 0.0920 0.133 (2/15) + 0.02 0.3 0.5600 0.1030 0.400 (6/15) + +MEASURED -- giant-latin, per-domain HIDDEN splits (one fabric, 16 domains): + domain classes legacy d0.45 AFR d0.45 legacy d0.02 AFR d0.02 + agnews 4 0.3730 0.7520 0.6790 0.7740 + emotion 6 0.1960 0.3930 0.2590 0.3980 + polarity 2 0.5440 0.5960 0.6380 0.6030 + dbpedia 14 0.5530 0.7970 0.7800 0.7660 + tickets_en 3 0.4480 0.9570 0.5660 0.9620 + + The round-2 tickets_en regression (0.9040 -> 0.4480 after the lane + repair on the shared fabric) is not merely undone: the SAME repaired + fabric scores 0.9570 with the affinity readout, and 0.9620 at diffusion + 0.02 -- above the SHIPPED model's 0.9040. And the per-domain diffusion + problem disappears with it: the handmade OOD number is 0.176 at EVERY + diffusion tested, because the affinity channel reads the evidence instead + of asking a smeared field to carry it. + +MEASURED -- b77-sem (Banking77), CAL split selects, hidden scored once: + + diffusion mix CAL acc CAL ECE handmade(OOD) + 0.45 0.0 0.2490 0.2070 0.059 (4/68) + 0.45 0.3 0.2510 0.0820 0.176 (12/68) + 0.10 0.0 0.4170 0.2020 0.059 (4/68) + 0.10 0.3 0.4230 0.0890 0.176 (12/68) + 0.02 0.0 0.4340 0.2070 0.044 (3/68) + 0.02 0.3 0.4560 0.0740 0.176 (12/68) + + HIDDEN (3,080 rows), the selected configuration and the baseline only: + 0.45 0.0 0.2850 0.2330 + 0.45 0.3 0.2750 0.0680 + 0.02 0.0 0.4660 0.2200 + 0.02 0.3 0.4800 0.0460 <- selected on CAL + +So at the selected diffusion: accuracy 0.4660 -> 0.4800 on the hidden +split, ECE 0.2200 -> 0.0460 (4.8x better). mix = 0.3 improves CAL accuracy +at EVERY diffusion tested and never hurts ECE. + +THE AUTHORITATIVE OUT-OF-DISTRIBUTION A/B (both fabrics calibrated by the +same build, scored through the same path, corrected probe labels): + b77-sem handmade (68): legacy 0.132 (9/68) -> AFR 0.191 (13/68) + router16 handmade (15): legacy 0.267 (4/15) -> AFR 0.467 (7/15) +and the DIFFUSION-INDEPENDENCE, which is the architectural claim: across a +22x range of the diffusion constant the affinity readout's handmade accuracy +moves by 0.030 (0.176 @ 0.45, 0.206 @ 0.10, 0.191 @ 0.02), where the +legacy readout's optimum was PER DOMAIN (tickets_en 0.45, agnews/dbpedia +0.02). The readout reads the evidence instead of asking a smeared field to +carry it. + +The PMI (log-odds) form was also measured and is WORSE than the linear +contrast (CAL acc 0.194 vs 0.221 at mix 0.5/diffusion 0.45; OOD 0.132 vs +0.176): normalising over a 77-way candidate set makes the log-odds +variance-heavy. Shipped: the linear form; --affinity-pmi remains available. + +THE ORDER CHANNEL. The lit set also carries the state's bigram nodes when +the fabric has them; bigram nodes are bound to the outcome anchors by the +same Hebbian lesson, so their affinity to a candidate is an ORDERED +relation -- CMD 2.5's escape, carried into the affinity channel. On the +shipped b77-sem (learned before bigram lanes existed) the extension is a +verified no-op: the numbers are bit-identical with and without it. + +THE PER-CANDIDATE-COUNT TEMPERATURE (v4.0, second half). The giant +fabric's ECE exposed a second, independent defect: ONE softmax temperature +cannot serve candidate sets of different sizes. A 14-way question's score +spread is not a 2-way question's spread, and the shared fabric's single +fitted temperature left polarity at ECE 0.395 while dbpedia sat at 0.064 in +the SAME fit. v4.0 therefore fits ONE temperature per distinct candidate +count -- the count is a property of the QUESTION, so it leaks nothing about +the label -- with the same 1-bit ECE selection guard and the same rows; a +count with fewer than 64 calibration rows keeps the global scalar. The table +persists in calibration.json (choice_temperature_by_count) and the decision +path reads it through choice_temperature_for(n). The argmax never moves. +MEASURED on the giant fabric (legacy readout, diffusion 0.45), ECE before +-> after the per-count temperature: agnews 0.2750 -> 0.0860, emotion +0.0780 -> 0.0240, polarity 0.1280 -> 0.0690, dbpedia 0.1650 -> 0.1330, +tickets_en 0.1100 -> 0.1050. The fitted table for that fabric: +{2: 1.666, 3: 0.470, 4: 2.105, 6: 11.314, 14: 0.749, 77: 0.068}. + +THE READOUT MODE IS PART OF THE RECORDED COMPOSITION. physics.json now +carries affinity_mix and affinity_pmi, so a deployed model decides under the +readout its temperature was fitted for -- the fit==decide parity contract, +extended from the physics to the measurement. --affinity-mix still overrides +explicitly. + +TWO CORRECTIONS FOUND WHILE MEASURING (both fixed, both disclosed): +1. A MISLABELLED PROBE IN THE HANDMADE SET. rt_01 ("he sank a curling + three-pointer in the fourth quarter") was labelled rt01 -- the BANKING + anchor -- when a curling three-pointer is SPORTS, i.e. rt00 ("news + headlines world sports business technology"). The gold label is now + rt00. +2. THE C API / PYTHON BRIDGE IGNORED THE MODEL'S RECORDED COMPOSITION. + syfox_engine_create() loaded physics.json but never APPLIED it, so the + server, the Space and the handmade gate decided under different physics + than the CLI -- and, after v4.0, under a different READOUT than the + temperature was fitted for. It now calls apply_composition(); applying + it twice is idempotent, and the CLI is unaffected. (The bug surfaced + because the gate's own --affinity-mix flag was silently overriding the + model's recorded readout with the flag's default; the gate now leaves + the recorded readout alone unless the operator asks otherwise.) + +TESTS: test_affinity_readout pins the mechanism -- the channel is OFF by +default (the replay contract), the EXCLUSIVE token decides even when the +query shares no vocabulary with any candidate's description, the decision +is deterministic, a token bound to every candidate changes nothing, and +mix = 0 reproduces the legacy decision. Full unit suite green. + +FLAGS: --affinity-mix F (0 = legacy, 1 = affinity only; default 0) and +--affinity-pmi (the log-odds form). The flag is applied in apply_physics so +that cmd_calibrate -- which calls apply_physics only -- fits the SAME +channel the decision scores (the v3.8 fit==decide parity contract). + +VERSION 3.9.3 -> 4.0.0 + +## v3.9.3 — the dead-lane repair, the router-criteria measurement, and the handmade gate + +Three defects measured on the PUBLISHED model (HF sha 5aa69627) and the +v3.9.1 engine. One of them is a large win; one of them has a true diagnosis +and a HARMFUL proposed remedy; one of them is a calibration/reference +problem that flattered SyFox. + +DEFECT 1 — THE DEAD LANES (the diagnosis is TRUE; the command did not exist +and is added here). enforce_lane_decay() multiplies EVERY lane by 0.995 on +EVERY lesson, so a lane last bound at lesson k in an N-lesson fabric carries +w0 * 0.995^(N-k) — which underflows to the float32 denormal floor (1.4e-43) +after ~20,670 lessons and then STOPS decreasing. MEASURED on the shipped +model/giant-latin (114,060 lessons, 1,905,169 lanes): 95.09% of lanes carry a +weight in (0, 1e-12), the MEDIAN lane weight is 1.4e-43, and only 2.42% +exceed 1e-6. The Hebbian memory was erased; what survived was a recency +window over the tail of the corpus. The base repository's law is different +(research-paper/cmd.md 2.3): w <- tanh((w*lambda + eta*v_b*v_c)/w_max)*w_max +— SATURATING, with continuous co-activity growth, so a starved lane keeps a +real value; research-paper/tsda.md 2: "It remains in long-term memory (the +edge still exists), but it requires more cognitive energy to retrieve." The +port kept the decay and lost the saturation. + +FIX 1a — NEW COMMAND `syfox repair-lanes --model DIR [--dead-threshold F] +[--dry-run]`: rebuilds every lane's weight from the persisted EVIDENCE LEDGER +(v3 Milestone 3), which holds the integral of exactly the growth term the +decay destroyed, in CMD 2.3's saturating form: + w = w_max * tanh( net_events * bind_scale / w_max ) +No equation moves and no learn-time behaviour changes; a fabric re-learned +from scratch is byte-identical. MEASURED: giant-latin revives 1,330,812 of +1,859,008 dead lanes (weight sum 681 -> 117,478); b77-sem revives 159,449 +(912 -> 58,210); router16 rebuilds 43,117 (1,012 -> 10,360). + +FIX 1b — cfg_.lane_decay_floor + `--lane-floor F`: the ROOT-CAUSE guard for +new fabrics. A starved lane keeps a floor instead of falling off the +number line (TSDA 2: the edge persists with reduced retrievability). +Default 0 = OFF, so every pre-v3.9.3 fabric replays bit-identically. + +MEASURED EFFECT (argmax accuracy — temperature-independent, so this is the +repair alone): router16 on its 12,593-row cal split 0.4210 -> 0.5060 +(+8.5 points); b77-sem on hidden 3,080 rows 0.4500 -> 0.4662 at diffusion +0.02; giant-latin per domain (hidden, class question only): agnews 0.498 -> +0.679, dbpedia 0.578 -> 0.780, polarity 0.560 -> 0.638, emotion 0.129 -> +0.259, with ECE 0.402 -> 0.128 (agnews) and 0.300 -> 0.124 (dbpedia). + +DEFECT 2 — THE ROUTER CRITERIA (the diagnosis is TRUE; the proposed remedy +is HARMFUL). MEASURED against the shipped giant-latin's 43,420 nodes: the +router descriptions are mostly words the fabric never interned — rt01 +("banking cards payments transfers refunds loans") has 0 of 6 words as +nodes, rt00 1 of 6, rt13 1 of 6, rt05 and rt08 0 of 4/5. Two code facts make +that matter: Substrate::readout() SKIPS every token that is not a node (so a +non-node description contributes nothing to its own candidate), and decide() +injects EVERY candidate's description tokens into ONE shared field (so words +that ARE nodes cross-contaminate all candidates at once). +tools/rebuild_router_criteria.py implements the proposed rebuild (each +candidate described by the tokens with the highest w(x,A) * exclusive(x,A)). +MEASURED on the repaired router16, 12,593-row cal split, each criteria set +with its own matched calibration: + old text ("banking cards payments...") argmax 0.5060 ECE 0.046 + EMPTY text ("") argmax 0.4320 ECE 0.018 + one exclusive token ("monei") argmax 0.5060 ECE 0.041 + label-exclusive 4 tokens (the remedy) argmax 0.4147 ECE 0.062 +The proposed remedy COSTS 9 POINTS of routing accuracy: the description is +not a lever, it is a shared-field injector, and the richer it gets the more +the candidates contaminate each other — the repo's own documented +"direct-term harvest" effect (its wording sweep already found short4 0.426 > +mid8 0.164 > rich12 0.079). The remedy is therefore shipped as a TOOL, not +as a default, and the finding recorded: keep the criteria MINIMAL. Empty +criteria gives the best calibration measured anywhere in this tree +(ECE 0.018, beating Jev's third-party 0.246 and Laya's 0.081). + +DEFECT 3 — THE JEV REFERENCE NUMBERS FLATTERED SYFOX. The bench's +jev_reference block carried the LAUNCH-DAY self-report (workflow 0.678, +latency 70-500 ms, "calibration claimed, not public"). Independent +third-party measurements are materially STRONGER for Jev: arxiv 2609.37647 +(37 datasets, 346,009 requests, jev-1.13.0) measures 95-99% on IMDB / SST-2 +/ HellaSwag / ARC and 79.7% on Banking77 at full coverage (-> 96.3% at 50% +coverage); laya-model.com/benchmarks publishes Jev at typed-decisions 0.727, +AG News 0.910, DAIR Emotion 0.480, Banking77 0.870, ECE 0.246, p50 latency +236-276 ms. The block now carries those, with the vendor's own 0.955 workflow +claim labelled as such. + +NEW — THE HANDMADE GENERALISATION GATE. data/handmade_probes.jsonl (148 +probes) + tools/handmade_gate.py: hand-written sentences, deliberately +outside every training split, every eval split and every mined-criteria +vocabulary. It is the only check in the tree that can see a fabric that has +memorised its corpus instead of learning it. MEASURED on the SHIPPED +fabrics: total 0.291 (bank77 0.103, emotion 0.167, dbpedia 0.286, router +0.400) — the published bank77 number (0.158) is optimistic because the +hidden split shares the training templates. It also exposed the DIFFUSION +TRADE-OFF: diffusion 0.02 (selected on cal) buys bank77 hidden 0.2854 -> +0.4662 in-distribution and costs handmade 0.118 -> 0.044 out-of-distribution. +A cal-only selection cannot see that cost. Wired into make ci. + +FURTHER MEASUREMENT — THE DIFFUSION OPTIMUM IS PER-DOMAIN, NOT PER-FABRIC. +The giant fabric is one directory carrying 16 domains with very different +geometry. At diffusion 0.02 tickets_en (3 classes) REGRESSES from 0.9040 to +0.5660 while agnews (4) and dbpedia (14) gain 18-20 points. One diffusion +per fabric dir is therefore not enough for a multi-domain fabric — the +per-fabric mechanism (physics.json) is the right primitive but the value +has to be chosen per DOMAIN, or the domains split into per-domain fabrics. + +TESTS: test_lane_repair (the global decay really kills lanes; the ledger can +revive them; the dry run reports without touching the fabric; the repair is +deterministic; no rebuildable lane is still dead afterwards) and +test_physics_composition. Full unit suite green. + +DOCS: docs/FIT_DECIDE_PARITY.md (the fit==decide contract) and the v3.9.3 +section of this changelog. + +VERSION 3.9.2 -> 3.9.3 + +## v3.9.2 — fit == decide: the calibration composition contract + +The fix for the wrong-answer bug the v3.9.1 diagnostics exposed. Two +independent defects, both in the tool layer; NO physics equation changed. + +DEFECT 1 — THE CALIBRATION WAS FITTED UNDER A DIFFERENT PHYSICS THAN THE +DECISION RUNS. The choice/score temperature is fitted on settle-pass +energies, and those depend on the whole decide-side composition (the +energy gain, diffusion, decay, k_settle, hop coupling). The energy gain is +PER-STATE, so it is not a uniform rescale. In this tree b77-sem, router16 +and model-bank77-best calibrated WITHOUT --energy-norm while every bench +and decide call ran WITH it. Measured on the shipped b77-sem fabric and +the 1,003-row cal split, same engine, one flag apart: + calibrate WITHOUT --energy-norm -> T = 0.0037, fit saw 556 of 2,006 + question-rows (27.7% coverage), + ECE 0.4567 -> 0.4057 + calibrate WITH --energy-norm -> T = 0.3552, fit saw 2,006 of 2,006, + ECE 0.3183 -> 0.3056 +A ~100x sharper temperature, chosen on a 27.7%-covered BIASED subset (the +other 1,450 rows settle to a SILENT field and are dropped from the fit). A +near-floor T saturates the softmax: the post-temperature top-2 gap goes to +~0.93 on every row, so the honest-defer gate (an absolute 0.05 margin) can +NEVER fire — the model never abstains — and every answer carries ~0.98 +confidence whether it is right or wrong (measured on the shipped fabric, +hidden: mean p1 0.9819 on correct rows vs 0.9641 on wrong, ECE 0.809). +The calibrate report's own ECE did not describe the bench's ECE because the +two ran under different physics. + +DEFECT 2 — THE DIFFUSION CONSTANT WAS NEVER RE-TUNED FOR THE DENSE +FABRICS. diffusion is a config value (not an equation) whose optimum is a +property of the fabric; 0.45 was validated on the small v2-era fabrics and +smears a 217k-lane fabric's field, merging intents that share vocabulary. +Measured on the bank77 CAL split (selection never touches hidden): +0.45 -> 0.1316 accuracy, 0.10 -> 0.4237, 0.02 -> 0.4237. + +FIX 1 — PHYSICS.JSON: a fabric now carries the decide-side composition it +was calibrated under (physics.json, next to calibration.json). calibrate +RECORDS it; decide/bench/demo/stats APPLY it on load +(Engine::apply_composition). Explicit CLI flags still win. A fabric with no +physics.json is a pre-v3.9.2 fabric: nothing is applied and behaviour is +bit-identical (replay contract preserved). + +FIX 2 — THE FIT REFUSES TO RUN ON A BIASED SUBSET. calibrate counts the +question-rows it was offered and the ones it saw; below 50% coverage it +refuses (exit 2), names the cause, and leaves the fabric untouched. The +coverage is always disclosed: fit_offered_rows, fit_dropped_silent, +fit_coverage. + +FIX 3 — THE MAKEFILE STOPS LYING: b77-sem, router16 and model-bank77-best +now calibrate with --energy-norm (the composition their benches run). + +FIX 4 — TOOLS + CI GATE: tools/cal_diffusion_sweep.py sweeps diffusion on +the CAL split only, re-calibrating at each candidate so the temperature is +always fitted under the composition it is applied to, and records the +winner into physics.json (this also delivers the standing recommendation in +docs/INTRACATEGORY_ATTACK.md section 4: a per-fabric diffusion value, not a +new global default). tools/assert_fit_decide_parity.py is the CI gate: a +FITTED fabric with no physics.json has an unknown calibration provenance and +FAILS. Wired into make ci. + +MEASURED (v3.9.1 engine, shipped fabrics, shipped splits; selection on cal, +hidden scored once; bank77 intent-only): + bank77 hidden 3,080: accuracy (argmax) 0.1584 -> 0.4500 (+29.2 pts), + ECE 0.809 -> 0.225, accuracy over answered at margin 0.05 + 0.159 -> 0.542, honest total at margin 0.05 0.1581 -> 0.3760, + deferral rate at margin 0.05 0.5% -> 30.7% (the axis is alive) + router16 cal 12,593: ECE 0.443 -> 0.054, accuracy over answered + 0.4299 -> 0.5989. At margin 0 both configurations produce the + IDENTICAL argmax (0.4210) — the temperature never changes a decision, + only how confidently it is made and whether it is made at all. + re-calibrated fabrics: b77-sem T = 0.346736 over 1,003 rows (was + 0.00472645 over 211), diffusion 0.02; router16 T = 0.0509 over 12,574 + rows (was 0.00491756 over 160). + +TESTS: test_physics_composition (16 checks: a pre-3.9.2 fabric carries no +composition and is bit-identical; a recorded composition survives the +save/load round trip; apply_composition reaches the live substrate; the +fit's offered/seen/dropped row bookkeeping adds up). Full unit suite green. + +DOCS: docs/FIT_DECIDE_PARITY.md (the bug, the measurement, the fix, and why +the base repository does not have it — SI reads out by ARG-MAX over the +settled field, with no softmax, no temperature and no fitted parameter, so +there is nothing to fit against the wrong physics; the probability readout +and the temperature are a SyFox addition and the defect came in with them). + +VERSION 3.9.1 -> 3.9.2 + +## v3.9.1 — intra-category diagnostics: confusion matrix + honest totals + the diffusion finding + +Diagnostics-then-intervention per the tester's revised plan. Everything +measured in-tree, tuning on cal only, hidden touched only for final +validation; no global defer default shipped; no parity claims without the +honest total (docs/HONEST_TOTAL.md). + +- BENCH (opt-in, default byte-identical): --confusion (NxN gold-x-pred JSON + matrix, DEFER pseudo-class, pairs_top; rows==labels alignment pinned by + unit test after the DEFER-shift bug was caught cross-checking the hidden + dump), --dump-perrow (per-choice-question records with the RAW + pre-temperature energy gap), Answer.raw_margin disclosure. +- PHYSICS SWEEP KNOBS: set_decay/set_diffusion/set_hop_coupling/ + set_learn_eta/set_lane_cap on the substrate (frozen defaults, clamped; + CLI --decay --diffusion --k-settle --hop-coupling --learn-eta --lane-cap + on bench/calibrate/learn/decide paths). +- MEASURED (model-b77-sem, 19,690 nodes / 1.31M lanes, banking77): + calibration T=0.0019 makes the probability-gap defer axis inert + (0/1003) and ECE 0.597/0.573 measured; no global margin improves the + honest total; per-intent thresholds overfit cal (-2.0 hidden); class + frequency does not predict accuracy (r=-0.043); semantics -6.1 pts + without; decay/k_settle/hop_coupling/learn_eta flat; lane_cap 1024 +1.6; + DIFFUSION monotone to a boundary optimum: cal 0.401 -> 0.537, hidden + 0.424 -> 0.571 (+14.7), card_management 0.389 -> 0.632 (+24.3). Replicates + on an independent reduced fabric family (+16.4). SI equations frozen + throughout - a CONFIG value, not a physics change. +- TOOLS: b77_confusion_report.py, b77_margin_sweep.py, b77_apply_policy.py, + b77_freq_cut.py, b77_ablation_compare.py. ARTIFACTS: data/b77_diag/. +- DOCS: docs/INTRACATEGORY_ATTACK.md + docs/HONEST_TOTAL.md. TESTS: + test_bench_diagnostics (confusion/dump/knobs/alignment invariant). + +## v3.9.0 — the constructive substrate: SI's Layer-2 reasoning stack + the remaining paper mechanisms + +Answers the v3.9 audit ("SyFox is not a port of SI — it shares two +constants"; "many papers unimplemented"). Both charges verified, both +addressed; the false port claim is retracted in the substrate header itself. + +- core/reason.hpp (NEW, ~1,530 lines): the faithful port of SI's Layer-2 — + typed graph with full provenance (rule/parent_a/parent_b/step), O(1) + edge existence, O(deg) adjacency, bounded retraction (RADE); the NINE + reasoning primitives (transitive, modus ponens, inheritance, contrapositive, + case analysis, induction with min-witnesses, analogy, abduction via + backward chaining, recursion via the fixpoint loop); forward chaining to + fixpoint under a tension budget; adaptive backward chaining with an active + goal stack; proof traces + the §5.3.4 verifier; the meta-learner + (sub-chain counting -> macro-rule promotion at the 2-bit MDL threshold); + the thinker index C/R; the SIX discovery queries; the .axioms triple + format (SI's own data files load unchanged). Determinism hardening over + SI: primitive candidate sets sorted before commit (SI iterated hash maps). +- ENGINE BRIDGE: `syfox axioms --load FILE` loads triples into BOTH stores + (typed graph + fabric lanes, idempotent); load_model auto-loads + /axioms.txt + v39.json (tension + OOD signatures) when present; + absent = every pre-3.9 model replays bit-identically. New commands: ask + (forward/backward with proof JSON), reason (fixpoint report), discover + (six queries + classifier), thinker (C/R + macro count over a query file), + audit (CMA/CCH DERIVED-vs-INDUCED path-additivity report). +- DECISION-LAYER PAPER GATES (opt-in, default OFF, read-only over the + settled field): --proof / --require-proof (RADE proof pass, no_proof_path + defer); --wavefront-gate (CMD §4 reached-candidates, unreached_candidates + defer); --momentum-readout (MCPE/CPME echo suppression, echo_only defer; + ported as peak-diffusion-gain after BOTH the raw final-pass delta and a + beta=0.9 envelope measured every candidate echo-suppressed on the bench + fabrics); --coherence-gate (HTR ΔR participation-ratio rise, + no_structural_rise defer); --vght-gate (VGHT coincidence C=σ(12(E·E−0.05)) + on the hop walk, gated_lane_frac disclosure); --cem-plan (P-CMA shell, + gradient-free CEM over deterministic source-cap variants, plan restores + the winning field; first cut snapshotted post-settle and double-decayed + every variant — caught by think30 bisection at 0.600 -> 0.267 and fixed); + --ood-knn (fixes.md signature-density defer, ood_density); --tension-gate + (RIFA SIL with the sign defect fixed: contradictions ACCUMULATE tension, + conflicted_state defer at >= 2 unresolved conflicts on the state hash). +- LEARN-SIDE PAPERS (opt-in, replay-safe): --fingerprints (CME graded + half-dose re-teach, capped 1024-entry table, deterministic eviction); + --sentinels on (CMD §2.5 ^w0~w1 / wn~wn$ boundary pairs); --pro-con on + (RB surrogate: negated lessons bind through "!token" con-namespaces); + --order-consolidation on (CPME-II discrete surrogate: per-lane order + evidence, Phi = 0.4 + 0.6*(2c/t - 1) blend, ORD1 magic tail, replay + no-op on pre-v3.9 fabrics). +- HONEST LINEAGE: si_substrate.hpp header retracted the "faithful + standalone port" claim; now states shared vs different (scalar energy vs + oscillators, lanes vs tunnels, passes vs dt=0.02, native 0.82/0.45) and + records the CSAT boundary theorem (global decay/diffusion modulation is + rank-preserving, arg-max invariant — readout-affecting mechanisms must + couple per-node; settle physics stays frozen). +- BUGS CAUGHT BY THE NEW TESTS: add_primitive double-padded prim_meta + (every primitive kind shifted off by one; contrapositive and induction + never fired); Engine never installed the default rule set (forward + chaining was a no-op); momentum envelope out-of-bounds read on pass 0 + (segfault); CME fingerprint test used an unstemmed token (unordered_map::at). +- TESTS: test_reason (18 checks: primitives, proofs, verifier, retraction, + discovery, thinker index, contradiction guard, the engine bridge, + idempotent reload) + test_v39_gates (26 checks: replay contract, + per-gate defer reasons, determinism, ORD1 roundtrip, fingerprint + half-dose, sentinel/pro-con interning). Full suite + readout-silence + + jas-test + make ci green; bench bit-identical to the v3.8 record. +- MEASURED: think30 baseline 0.467 -> thinking 0.600 -> multivector 0.633 + -> v3.9 stack 0.700 (21/30; thinking flags + --wavefront-gate --cem-plan + on a --distvec --multi-vector fabric). Honest negatives measured and + documented: momentum alone 0.533, coherence/vght alone 0.567, learn-side + flags combined 0.433 at demo scale (corpus-scale features), cem alone + neutral 0.600. JEV axes unchanged (95.5% answered n=44, <=591 us, + ECE 0.131, OOD defer 1.0) + new axes JEV lacks: proof traces, discovery, + thinker index, .axioms knowledge format. + +## v3.8.0 — physics-native thinking (no token prediction, no ML, physics frozen) + +Four opt-in mechanisms + the v3.7.1 scaling fix. Spec: deepen the field's +thinking without token prediction; SI core untouched; bit-identical replay on +default flags (bench verified against the v3.7 record). + +- v3.7.1 DISTVEC SCALING FIX: measured O(n^1.9) build (76 s @ 5,595 nodes, + 156 s @ 7,985, ~15 h extrapolated @ 94,773) root-caused to the exact + neighbour scan (O(n^2*k), cap 8000 -> 2000), strided row-major MGS with + ~840k OpenMP regions per call (-> column-major blocked BCGS2), and the + subspace/Ritz kernels (-> contiguous cm passes, cached init hashes). + Measured: 17.1 -> 7.2 s @ 5,107 nodes; 95.4 s @ 40,850; ~15 h -> ~5 min + extrapolated at the generalist size. Determinism md5-verified. +- TASK 1 ADAPTIVE DEPTH (`--adaptive-depth`, `--adaptive-max-k`): difficulty + = unknown-token fraction + lane isolation, k = base + round(d*max_extra) + (8..16 defaults), deterministic, ratchet-guarded, mirrored in + harvest_rows; disclosed as difficulty/k_settle_used/k_settle_base. +- TASK 2 MULTI-VECTOR (`--multi-vector`, `--multi-vector-k`): K=8 spectral + channel gates from the distvec axes (lane flow scaled by + exp(-(u_k(a)-u_k(b))^2/2s^2)), frozen physics per channel, readout on the + mean superposed field; honest no-op without --distvec; dead axes skipped. +- TASK 3 CAUSAL SIGNATURES (`--causal-lanes`): cause?>effect and + means!>goal pair nodes from a deterministic connective scan (stemmed + forms), interned/df-noted/bound like the bigrams, injected in + decide/harvest/perturb at kCausalDose=0.5; replay no-op on old fabrics. +- TASK 4 ENERGY SELF-VERIFICATION: settle trace (passes, final/initial + energy, relative motion rate) always in the decide usage; opt-in + `--self-verify` defers choice answers measured on fields still moving + above the floor (default 0.25, measured settled baseline 0.189-0.212), + reason `unconverged_field`. +- TESTS: test_thinking group (adaptive depth incl. ratchet guard, + self-verify gate both sides, multi-vector no-op/determinism/effect, + causal emission directions + fabric interning + replay both ways); full + suite green; readout-silence ALL PASS; jas-test ALL PASS; bench + bit-identical (tickets 1.000/1.000 defer 0.063, game defer 0.333, guard + 0.778, OOD defer 1.0 x3, deterministic x3). +- MEASURED: think30 suite (`make think30` -> data/think30_tables.json) — + 30 tests, 6 categories x 5: baseline 0.467 (14/30) -> thinking flags + 0.600 (18/30) -> +multi-vector 0.633 (19/30). Honesty category 0/5 -> + 5/5 (noise answers on near-vocabulary OOD states now defer); chains + 0/5 -> 3/5. Causal categories showed no additional delta at demo scale + (bigram lanes already carry the signal; disclosed honestly). + +## v3.6.0 — the fabric-construction papers land + the JEV head-to-head + +Implements the top of v3.5's paper port order on the v3.5.0 tree (settle +physics frozen; old fabrics replay bit-identically): + +- ORDERED BIGRAM LANES (MRS SS4b.1-4b.2 measured 7/7; CMD SS2.5; CPSB; HTR + arrival-order): learn interns adjacent token pairs ("w1~w2") and binds them + to the outcome anchors; decide injects the state's bigram nodes at + kBigramDose=0.5 of the state dose, mirrored bit-exactly in harvest_rows. + Escape from the multiset-invariance theorem (paws 0.500 / xnli 0.333 are + chance because a token bag cannot encode order). Old fabrics have no + "w1~w2" nodes so the decide-side block is a no-op on them (replay + contract, unit-tested both ways). --bigrams on|off (default on). +- DOCUMENT-FREQUENCY RARITY WEIGHTING (CMD SS2.2 log(N/(1+df)); MIMS SS6 + fan-out): substrate df table (one note per (lesson, node), persisted in a + magic-guarded 'IDF5' tail) + hebbian_lesson scales STATE-side bind weights + by log1p(L/(1+df))/log1p(L) in (0,1]. No stopword list; one counted + formula. Fabrics without the tail reproduce v3.5 weights (factor 1.0). +- PERTURBATION-CONTRAST HONESTY CHECK (BED SS8, opt-in --perturb-check): + decide() additionally settles a structure-broken copy of the state (same + token multiset, adjacent pairs transposed, deterministic); when the broken + state's margin matches the real one the readout was bag-carried, and + choice questions defer with reason "perturbation_tie". Field snapshotted + and restored — the readout measures exactly what an unchecked decide() + measures. Usage discloses perturb_margin_real / perturb_margin_broken. +- MEASURED (train split, in-sample; heldout n=6/0/2): tickets choice + 0.875 -> 1.000 (16/16, defer 0), score 1.000 defer 0.063 unchanged; game + choice_defer_rate 1.0 -> 0.333 with 4/4 answered correct; guard 0.778 + unchanged; ood_defer_rate 1.0 x3. test_fabric36: 22 new checks (bigram + lay/inject, multiset-invariance pinned bit-equal on a bag fabric and + broken on an ordered one, IDF same-token weaker-lane isolation, IDF5 + roundtrip, old-fabric replay bit-identity, perturbation defer/preserve). + Full unit suite, readout-silence, jas gates ALL PASS. +- BUGFIX (fresh clones): `make ci` failed because its router/ablation gates + need model-router16 / model-b77-sem / data/bank77_cal.jsonl — all + gitignored. Those gates now SKIP loudly when absent; core gates (unit + tests, readout-silence, jas — now wired explicitly) always run. +- JEV HEAD-TO-HEAD (tools/jev_bench.py, make jev-compare -> + build/jev_comparison.json): JEV AI (TypeSafe AI, Sept 2026) is the closed + "System One" decision model on the same API shape. Measured on JEV's + published axes: workflow accuracy 95.5% (n=44 answered, train split) vs + 67.8% published; latency <= 474 us vs 70-500 ms published; $0 local vs + $0.042/M input; plus the axes JEV does not publish — ECE (mean 0.131), + honest defer with reasons (OOD 100%), bit-reproducibility, evidence JSON. + Every syfox number measured by core/bench.hpp in this tree; every JEV + number is their published self-reported figure (source cited in JSON). +- README v3.6 section + boundary updates (subject-object scope-escape by + bigram lanes; temporal adjacency; perturbation defer). VERSION 3.5.0 -> + 3.6.0. + +## v3.5.0 — JAS: the J-A-S cycle, the impossibility register, the arithmetic oracle + +Ported from research-paper/jas.md + the central paper's substrate/thinker +division of labour; the SI settle physics stays frozen and decide() is +bit-identical (bench verified). Three additive CLI commands, one new test +group, one new CI gate. + +- `core/jas.hpp` — the cycle: E labeled rows -> J the jump (counting leaps + to a universal STRONGER than the evidence; axioms ranked + confidence/support/token, deterministic) -> A->S deduction per holdout + row -> experiment (oracle = observed label) -> refutation -> revision + under a structural restriction (T AND U, fit on TRAIN only, never on its + own counterexamples) -> round 2 on fresh rows. Verdicts: + SURVIVES | REFUTED_AND_REVISED_SURVIVES_HELDOUT | + REFUTED_AND_REVISION_ALSO_REFUTED | REFUTED_AND_REVISION_UNTESTED | + REFUTED_IN_ROUND2_REVISE_NEXT_CYCLE | NO_TESTABLE_AXIOMS. Refutations + append to /refuted.axioms (with the counterexample row); + survivors to /verified.axioms (provenance INDUCED). The frozen + field is scored on the same rows as the disclosed "relevance heuristic" + column. Per-row experiment disclosure in JSON (predicted/actual/ + CONSISTENT|REFUTES|NO_PREDICTION, conflicts flagged). +- `syfox register [--model M] [--text]` — the impossibility register: + five architectural boundaries seeded with warrants + (2 THEOREM / 2 INDUCED / 1 DERIVED), each with parent + status + bypass; + two THEOREM claims are SCOPE-ESCAPED (arithmetic -> calc oracle; + subject-object -> ordered/typed lanes); persists + /impossibility.json. +- `core/calc.hpp` + `syfox calc --expr ... [--compile]` — the arithmetic + derivation oracle: 6 primitives, one recursive-descent grammar, a + verifier that rejects (1/0 errors), overflow-guarded exact integer path, + word-problem mapping (times->*, plus->+, ...). --compile EMITS a C++ + translation unit, compiles with g++, runs it, discloses + agreement + provenance established_by_experiment. MEASURED: 17*23=391 + (g++ agrees), 2+3*4=14, (2+3)^2/5=5, 2^10=1024, word problem -> 396, + 1/0 rejected. The field never computes — the theorem stands, the + capability escaped its scope. +- Tests: unit group test_jas (oracle exactness, detection, register + invariants, full cycle arc incl. refutation->revision->convergence, + survival-is-not-proof); CI gate tests/jas_test.sh (make jas-test, wired + into make ci; pins oracle values, register shape, verdict space, + byte-determinism of cycle JSON x2); demo fabric data/jas_cycle_demo.jsonl. +- README: v3.5 section + "Why the 24-domain accuracy is low" table mapping + each measured failure shape to its fabric-construction root cause and the + paper that unlocks the fix (MRS/CPSB/RADE ordered+typed lanes, CMD IDF + weights, rbg+graph_fisher Fisher-gated bridge lanes, BED perturbation + negatives, l9 transitive pre-derivation); Architectural boundaries now + cross-reference the register. +- MEASURED regression: bench bit-identical to v3.4.0 (tickets choice + 0.875 / score 1.000 defer 0.063; guard 0.778; game all-deferred + choice_defer_rate 1.0; ood_defer_rate 1.0; deterministic x3). Full unit + suite passes. VERSION 3.4.0 -> 3.5.0 + +## v3.4.0 — honest defer for ties, multi-hop readout walk, question-context gate + +Three decision-layer mechanisms; the SI substrate physics (decay 0.82, +diffusion 0.45, K_settle 8, silence floors) stays frozen. Everything is +measured, deterministic, and disclosed. + +**HONEST DEFER FOR NEAR-TIES (engine default ON, margin 0.05).** When the +top two probabilities are closer than the margin the readout does not carry +a decision: the answer defers with `reason: ambiguous_tie` instead of +shipping a coin-flip as a confident label. Engine-level (members +`defer_margin_`, `set_defer_margin`), so CLI, C API, HTTP bridge and bench +share ONE behavior — the v3.1 CLI post-pass (`low_margin`, default OFF) is +removed; `--defer-margin P` now sets the engine knob and `--no-defer` +restores the v3.3 answer-always behavior (both verified end-to-end on a +measured gap-0.186 fabric: default answers, `--defer-margin 0.25` defers +`ambiguous_tie`, `--no-defer` overrides). Score questions defer on the same +margin over level probabilities. MEASURED bench impact (train-split, +v3.3.1 -> v3.4.0): tickets choice 0.875 unchanged (defer 0), score 0.938 -> +1.000 with defer 0.063 (the one wrong score row was a near-tie, now honestly +deferred); guard 0.778 unchanged (defer 0); the 6-row game toy fabric +discloses as all-deferred (`choice_defer_rate` 1.0 — its decisions sit at +mean margin 0.023, i.e. they never carried signal; v3.3's 1.000 was +in-sample noise-picking that happened to be right). Bench JSON gained +`choice_defer_rate`/`score_defer_rate` (accuracy over ANSWERED questions, +defers counted separately — selective accuracy reads honestly). Unit tests: +5 legacy groups pin `set_defer_margin(0)` (bengali argmax, M3 contradiction +evidence, M3 ledger persistence, hierarchy, question-gate readout contract), +new group `test_defer_ties` pins the defer (near-tie defers with +probabilities intact, decisive row answers, margin 0 answers the same +near-tie, score flavor defers). + +**MULTI-HOP READOUT WALK (opt-in, `--hops N`, default 1 = legacy).** +`Substrate::set_hop_depth` (clamped 1..8): depths > 1 walk lanes BFS-style +from each probe anchor up to N levels with per-hop damping +`hop_coupling/sqrt(hop+1)` (hop 1 x0.707 ... hop 4 x0.447), levels collected +in ascending NodeId order (std::map), width-capped at 64 nodes per level +(`kHopWidthCap`), never revisited — deterministic and bounded. Default +depth 1 keeps the legacy single-hop code path BIT-IDENTICAL (test-enforced: +default == explicit 1). MEASURED on chain probes (2-hop already answers at +N=1 — diffusion carries alarm->lights at probs 0.314 top, unchanged at N=4; +3-hop sparrow->animal target 0.1061 -> 0.1097; 4-hop relay far target echo +visible at 0.210 at N=4) — damped lanes keep far targets near-tied, so the +reported conf-0.019 noise answers now surface as honest `ambiguous_tie` +deferrals instead. Probe suite extended with the Test 18 (sparrow->bird-> +animal) and Test 21 (alpha..echo 4-hop relay) analogs + hops configs; +unit group `test_multi_hop` pins default/clamp/bit-identity/determinism. + +**QUESTION-CONTEXT GATE (opt-in, `--ctx-gate`, `--ctx-alpha F`).** Two-stage +settle: stage 1 settles the question's own tokens (instructions + criteria +descriptions, NO labels) into a context field; stage 2 re-settles the state +(prime + state + bridges, unchanged) and `Substrate::blend_field` composes +`e = (1-alpha)*state + alpha*context` (alpha default 0.5, clamped [0,1]). +Two ALREADY-SETTLED fields composed at the decision layer — settle() physics +untouched, deterministic, disclosed as `usage.ctx_gate`/`usage.ctx_alpha`. +MEASURED on the probe fabric: who-found answer holds (Tariq), confidence +0.056 -> 0.061; OOD submarine probe still abstains (`unknown_candidates`); +latest-temperature holds with a disclosed confidence tradeoff (0.007 -> +0.003). Unit group `test_ctx_gate` pins OFF-unchanged / ON-disclosure / +answer-holds / determinism / OOD-preserved. + +**Surface.** CLI `--defer-margin P` (engine knob), `--no-defer`, `--hops N` +(1..8), `--ctx-gate`, `--ctx-alpha F`; C API decide opts `defer_margin`, +`no_defer`, `hops`, `ctx_gate`, `ctx_alpha`; bridge opts docs; usage JSON +`ctx_gate`/`ctx_alpha` disclosure. README: v3.4 section + "Architectural +boundaries (System-2 limits)" honest list. Verified: full unit suite passes +(incl. 3 new groups), `make readout-silence` ALL PASS, bench deterministic +x3 with OOD defer 1.0 x3. VERSION 3.3.1 -> 3.4.0. + +## v3.3.1 — readout-silence threshold made explicit (BLOCKER fix) + +**The reported false defer, root-caused on the shipped tree.** The report +said `{Tariq, Salma}` false-defers with `unknown_candidates` because the +readout threshold (~0.35) sits above a valid candidate's energy (0.301). +On the shipped v3.3.0 code the check is an implicit `> 0` — there is no +0.35 constant — and the case does NOT reproduce: on the QA probe fabric +(`model-reasoning-probe`), Test 2 `{Tariq, Salma}` ANSWERS `Tariq` +(max candidate 0.8759, Salma 0.4811, settled field 2.4594, all measured +with `SYFOX_DEBUG_READOUT=1`). The reported threshold matches a local +mid-v3.4 worktree state, not this tree. The hardening below landed +regardless, because the implicit `> 0` form has a real defect: a best +candidate carrying dust-level diffusion carryover (`0 < e < 0.01`) +was ANSWERED — a pick by noise — instead of deferred. + +**Fix (Option B, absolute floor).** `kUnknownCandidateFloor = 0.01f` — +a named, documented, ABSOLUTE constant in `core/syfox.hpp`: defer with +`reason: unknown_candidates` when the BEST candidate's readout energy is +below 0.01. Deliberately absolute, not relative-to-field: a bright field +sitting entirely on non-candidate nodes must defer, and a valid candidate +on a dim field must answer. Measured guardrails: probe-fabric candidates +0.19–0.88 all answer (0.19 measured WITHOUT energy-norm — do not raise +the floor above 0.10); dark candidates 0.0000 still defer; the lit-field/ +dark-candidates OOD shape (`purple`/`submarine`) still defers with +`unknown_candidates`; a fully dark field (`xyz abc def`) defers at the +decide level with `unknown_vocabulary` (floor 0.05) before readout. + +**Debug visibility.** `SYFOX_DEBUG_READOUT=1` prints, on stderr: the +decide-level field (`settled_energy`, `silence_floor`) and, per question, +`max_candidate` + the active threshold + every candidate energy — a false +defer is now diagnosable from one run. + +**Regression gate.** `tests/readout_silence_test.sh` pins 7 checks +(2-candidate and 3-candidate valid cases answer; lowercase answers; dim +energy-norm-OFF case answers; dark field defers with the decide-level +reason; lit-field/dark-candidates defers with the readout-level reason). +New `make readout-silence` target, wired into `make ci` (the script +builds its own probe fabric from the committed +`data/reasoning_probe_lessons.jsonl`). Verified: unit suite all pass; +`make bench` bit-identical to the pre-fix snapshot (tickets 0.875/0.938, +game 1.000, guard 0.778, `ood_defer_rate` 1.0 on all three, +`deterministic` true on all three). README honest-silence section now +documents both silence layers and their floors. VERSION 3.3.0 -> 3.3.1. + +## v3.3.0 — question-conditioned readout, tie disclosure, readout silence + +**The `--evidence` "empty model" bug — root-caused, already cured, better +hint.** The reported symptom (lanes 0, vocabulary 0, calibrated false, all +`unknown_vocabulary` with `--evidence`, healthy without) is reproduced +exactly on a v3.2.0 build with `decide --evidence --state ... --questions ...` +and NO `--model`: the harness that emitted the flag treated it as +value-taking and swallowed the following `--model` token, and v3.2.0's +silent load then decided on an empty default fabric — with the evidence +block in the output, which made the flag look guilty. The flag itself is a +plain boolean in both versions. v3.2.1's loud load failure already exits +with `syfox: decide model "model": cannot read model/substrate.bin`; +v3.3 adds a stderr hint when the failed dir is the default `model` value, +naming the swallow-the-argument failure pattern explicitly. + +**Question-conditioned readout (opt-in) — ported from the original +Synthetic-Intelligence repo.** There, EVERY token of the turn drove the +activation field (`si_main.cpp`: `for (int id : matched) +physics.drive(id, 3.0f, 6.0f, 20)`) — the question was never a bystander. +SyFox's contract keeps state and question separate, and the readout only +measured state energy: the question's instructions gated nothing, so the +salient state noun beat the question-relevant entity ("Who found the +radio?" → `radio` over `Tariq`). The portable form gates the READOUT: +question tokens that are NEW relative to the state (the `who` in "Who found +the radio?") distribute lane mass over the candidate anchors, and each +candidate is scaled by its share (`floor + (1-floor) x r/max_r`), floor +0.25 default. Read-only over the settled field — same shape as the +hierarchy gate; disclosed as `question_gate: [tokens]` in every reply +path. **Measured (tools/reasoning_probes.py, QA-style probe fabric):** +gate ON doubles the who-found margin (0.056 -> 0.113 at floor 0.10), lifts +the latest-temperature confidence 14x (0.008 -> 0.117), and never flips a +correct answer off. **Measured regression that sets the default:** on +tickets-cal the gate costs 5.3 points (0.9533 -> 0.9000 — "which team" +lanes mislead), so the gate ships OPT-IN exactly like the M1 energy-norm: +`--question-gate` / `--question-gate-floor F` / opts `question_gate`, +`question_gate_floor`. + +**Exact-tie disclosure + readout silence.** The tie-break truth (measured): +criteria iterate in `std::map` key order and `max_element` keeps the first +max, so exact ties go to the alphabetically-first candidate — the reported +"Salma wins (last position)" was S < T, not a `>=` bug. Two structural +tie-breakers were measured along the way: the v3.2 sem_hop term +deterministically separates differently-spelled labels (aaa/bbb with +IDENTICAL lane sums 0.679428518 still end at 0.500078 vs 0.499921 through +their different trigram vectors), and per-lesson lane decay makes +same-structure candidates from separate lessons near-ties rather than +exact ones. What was missing was HONESTY about ties: every reply now sets +`tied: true` when the top two probabilities are equal (near-ties remain the +`--defer-margin` knob's business). And when the readout measures ZERO +energy on every candidate, decide now defers with +`reason: "unknown_candidates"` instead of answering a uniform distribution +by criteria order — the same honest-silence contract the dark-field case +already followed (measured: the reported unknown-options test answered +`abc` at 0.344 by noise; it now defers; the OOD "submarine's favorite +color" probe defers in a fabric that never saw the entities). + +**The five reported reasoning failure modes — status.** (1) multi-hop +chaining: diffusion already propagates through learned lanes (the +alarm→lights probe answers `lights`), 3+ hop composition stays weak; +(2) temporal ordering: the gate carries `latest`/`after` signal when the +fabric has those lanes — a training-side fix, tool-supported; (3) +arithmetic: architectural limit, unchanged in both repos; (4) OOD +abstention: the all-dark-readout defer fixes the pure case; the +state-lit-but-unanswerable case (purple 0.472) remains open — the state +salience override needs a mechanism the gate does not provide; (5) +subject-object relations: the old repo solves it with TYPED graph edges +(`Tariq -found-> radio`), which the bag-of-words core deliberately lacks — +architectural limit, documented. + +Tools: reasoning_probes.py (probe fabric builder + before/after suite); +data/v33_reasoning_tables.json archives every number. Tests: 9 new checks +(gate on/off/disclosure/determinism, tie disclosure, criteria-order pick, +readout silence). VERSION 3.2.1 -> 3.3.0. + +## v3.2.1 — the three paper-blocking bug fixes (ablation kill switches, confidence calibration, router config) + +**BUG #1 — ablation kill switches were silently inert (root-caused, disclosed, +test-pinned).** The switches themselves were wired correctly all the way into +settle() and readout() — on a v3.2 fabric (model-b77-sem) the five paper +configs produce 4 distinct outputs. The reported byte-identical behavior is +the replay contract on a PRE-v3.2 fabric: no SEM4 tail => --no-semantics has +nothing to switch off, no memories.jsonl => --no-retrieval primes nothing, no +hierarchy.json (or floor 1.0 = the measured-off default) => --no-hierarchy +moves nothing. Fixes: (1) `decide` now prints a loud stderr note per inert +switch naming the missing feature and the rebuild path +(./build/rebuild_sem SRC DST); (2) tools/ablation_suite.py runs the five +configs over an eval set, reports per-config accuracy/meanC/medC plus an +answer-signature distinctness count, DISCLOSES inertness, and exits non-zero +when a v3.2-featured fabric collapses — a null ablation can never reach the +paper silently again; (3) unit test test_ablation_distinctness builds a fabric +with all three layers ARMED (hierarchy floor 0.35) and asserts >= 4 distinct +outputs across default/--no-semantics/--no-retrieval/--no-hierarchy on the +same input (got 4); (4) the semantic effect is measured-visible (tickets-cal +accuracy 0.9533 -> 0.9733 with --no-semantics), so no leak-fraction change. + +**BUG #2 — confidence collapse (96.6% accuracy at mean confidence 0.0016) +root-caused: the calibration fit ran on a different physics composition and +dose regime than decide.** Two concrete engine bugs and one data fix: +(1) harvest_rows() re-implemented injection inline and SKIPPED the retrieval +priming block — every fabric WITH memories was calibrated on a no-prime field +while decide primes; the priming prologue is now a shared prime_field() used +by both paths, bit-identical to the old decide behavior; (2) the mode match: +calibrate must run under the same --energy-norm regime the fabric is benched +in (readout gaps are dose-dependent at fixed temperature — the v3.1.2 +measurement of conf 0.002 -> 0.923 under energy-norm is the same lever); +(3) recalibration of the shipped v3.2 fabrics under the fixed paths. +Measured after: tickets-big-latin-sem mean confidence 0.0016 -> 0.8736 +(median 0.9835, C|ok 0.898 vs C|bad 0.373, accuracy held 0.9533), easy cases +0.636-0.965, b77-sem C|ok/C|bad separation 2.3x with the semantic leak +verified as signal (accuracy collapses without it). Router16 recalibrated on +its anchor-worded cal rows (ECE 0.368 -> 0.099, in-distribution mean +confidence 0.298). Acceptance criteria met: avg >= 0.20 on a well-trained +domain, >= 0.50 on easy cases. tools/confidence_ablation.py produces the +per-config ablation table and the diagnosis (retrieval dose and semantic +leak are NOT the diluters — the stale fit was); tables archived in +data/v321_bugfix_tables.json. + +**BUG #3 — `decide --router model-router16` failed with "lacks router.json +anchors".** Root cause: the router dir didn't exist in the caller's layout +(the HF package nests fabrics at model/, the syfox repo at +model-) and a missing substrate loaded SILENTLY as an empty fabric, so +the failure surfaced as the misleading router.json message. Fixes: +(1) Substrate::load and Engine::load_model report failure; every CLI command +now fails loudly naming the model dir it could not read (first learn stays +tolerant — a fresh fabric is intended there; the ctypes bridge returns a +null handle so Python raises); (2) resolve_model_dir() tries as-given, +model/, model-, model/model- — one CLI invocation works in +both repo layouts, and router.json models mapping targets resolve the same +way; (3) the router.json error now names the expected file and the builder +tool; (4) router.json models mapping updated to the v3.2 -sem fabrics; +(5) router16 rebuilt (sorted save) and recalibrated; (6) `make ci` gate +includes a route-field assertion (tools/assert_route.py). Verified +end-to-end: "Why am I missing my refund" -> route rt01 -> model-b77-sem -> +c00 answered; route distribution across all 16 hidden domain files measured +(language anchors 12/12 perfect; bank77 rows route to the support anchor +rt13 11/12 — honest limitation, disclosed; modal agreement 0.663). + +**PERSISTENCE DETERMINISM (found during the ablation investigation).** +save() iterated unordered_map members directly, so every load->save cycle +PERMUTED substrate.bin — measured: three different md5s over two rebuild +passes on one fabric with an identical lane multiset. Same-lane physics per +file, but the settled field's floating-point sum order drifted across save +cycles: model dirs were never byte-stable and an ablation re-run after a +re-save was silently a different experiment. Fix: every map-backed section +(out_, derived_gen_, lane_evidence_, lane_ctx_) is written in SORTED key +order; load rebuilds out_ in file order, so one sorted save converges the +format and every later roundtrip is bit-identical (rebuild_sem x3: +md5 06011b36... stable; unit-test enforced). All shipped v3.2 fabrics were +rebuilt through the converged path. + +Tools: ablation_suite.py, confidence_ablation.py, router_routes.py, +assert_route.py, sub_diff.py; Makefile: `ci` gate + rebuild_sem now in +`all` (the stale-binary trap that masked the first sorted-save attempt). +Data: v321_bugfix_tables.json (every number above, archived). + +## v3.2.0 — the semantic layer (Stages 1-4), retrieval by default, the two-stage physics router, the dedicated bank77 fabric + +**The semantic field (core, deterministic, no ML).** Every concept node +carries a 64-dim semantic vector: signed character-trigram hashing of the +string (Stage 1 "concept frequency encoding" generalizes to a full vector) +plus two fabric-grounding passes over the Hebbian lanes — meaning diffuses +along the fabric, nothing is fitted. From the vectors: omega_semantic (fixed +scalar projection), top-6 resonance edges (cos >= 0.50, persisted in a +magic-guarded v4 substrate.bin tail), and typed reads (cos >= 0.82 +synonym-grade, >= 0.66 related — Option 2 derived from the vectors rather +than a hand table). At settle, sources leak sem_coupling 0.12 of their +post-diffusion energy along resonance edges, distributed by cos x +frequency-match — ENERGY CONSERVED exactly (test-enforced); readout gains a +semantic-neighbour term (sem_hop 0.10). **Context-sensitive lanes (Stage +2)**: lanes accumulate required/forbidden context words from the lessons +that laid them; at settle a mismatched lane carries less (forbidden x0.20, +missing-required x0.60..1.0 by match count, all-1.0 bit-identical to the +plain path) — contextual disambiguation as dampened coupling, not rules. +**Stage 3 semantic hierarchy** ships as hierarchy.json (intents/categories/ +floor) and gates intent candidates by stage-1 category energies at readout. +**Replay contract**: pre-v3.2 files end at the v3 tail, semantics inert, +bit-for-bit replay (test-enforced); intern() invalidates a stale field +(segfault fix caught by the M3 ledger test); --no-semantics is the runtime +kill switch. **Retrieval by default**: a memories.jsonl in the model dir is +fingerprinted once at load; every decide primes the field with the top-5 +resonating memories' outcomes at dose 0.30 x inject (deterministic, +disclosed in usage.retrieval); --memories/--retrieval-topk/--retrieval-dose/ +--no-retrieval. + +**Dedicated bank77 fabric (the v3.0 architecture, now with physics that +match it).** 9,000 opaque-anchor intent lessons + 9,000 category lessons +(12 chunks, zero false contradictions after de-colliding the twins), +1,648 nodes / 217,729 lanes / 7,728 resonance edges / 141,920 context-signed +lanes / 256 retrieval memories. Hidden 3,080 rows scored once (energy-norm): +**0.158 top-1** vs 0.081 (v3.1.0 dedicated+opaque) and 0.023 (77-way in the +shared giant fabric). Ablations on cal (1,003): --no-semantics 0.039 (the +semantic field is the jump), retrieval neutral, hierarchy gate +measured-negative (floor 0.35: 0.111 vs gate-off 0.133; monotone in the +floor sweep) — the shipped model carries floor 1.0 = gate off, documented. + +**Two-stage physics router.** tools/router_prepare.py carves a +router-question-only sample (16 domains x 60 rows) into a dedicated small +fabric: model-router16, 4,742 nodes, cal 16-way routing **0.444** (chance +0.0625), ECE 0.380 -> 0.086. `decide --router model-router16 ...` settles +the state on the router fabric, then the mapped domain fabric decides +(router.json anchors/models); the route is disclosed as route:{anchor, +confidence,top,model}. Bank77 queries route to the dedicated fabric; all +other domains to the giant fabric. + +**Zero-shot re-run under v3.2** (docs/ZEROSHOT.md Part 4, +tools/zeroshot_suite.py, data/zeroshot_v32_results.json): email spam on the +tickets-only fabric 6/6 plain and 6/6 semantic-rebuild (conf 0.91-0.99); +SMS spam 5/6 both (the error at conf 0.103 — honest low-conf disclosure); +snake 1/8 both; tic-tac-toe picks cell 1 at conf 0 — multi-constraint +composition fails exactly as in Part 1, and the semantic field does not +fake it (honest scope: it moves trained discrimination, not symbolic +reasoning). + +**Surface.** CLI: --router, --no-semantics, --no-retrieval, --no-hierarchy, +--retrieval-topk, --retrieval-dose, decide --memories FILE; stats reports +semantics/sem_edges/lane_contexts/retrieval/hierarchy. C API + HTTP bridge: +set_semantics/set_retrieval/set_retrieval_topk/set_retrieval_dose/ +set_hierarchy + decide_ex opts keys + usage.retrieval + engine info fields. +Tests: 4 new groups (semantic field determinism/conservation/round-trip/ +pre-v3.2 contract, context lanes learn+gate, retrieval-by-default + +kill switch + inert-without-memories, hierarchy load+gate). Tools: +bank77_hier.py, router_prepare.py, zeroshot_suite.py, rebuild_sem.cpp; +Makefile b77-hier-data/b77-sem/b77-sem-bench/b77-sem-hidden/router-data/ +router16/router16-bench/zeroshot-sem/zeroshot. Core physics (injection, +settle lane diffusion, Hebbian learning, honest silence) unchanged where +the semantic tail is absent. + +## v3.1.3 — routed-learn isolation bugfix; the 16-domain giant model + syfox-hf packaging + +**Bugfix (CLI, boundary layer):** `learn --lang auto` taught EVERY script +family the ENTIRE corpus — the routed loop iterated all rows instead of the +family's rows, so each per-script substrate (`-`) was a full +copy of everything and the "one fabric per script" isolation contract was +broken since v2.2. Fixed: families now teach only their own rows (epochs +applied per family). All tests pass; multilingual fabrics should be +retrained — the giant model below was trained post-fix, and its +bengali/devanagari/cyrillic substrates (546-680 nodes) answer their +held-out tickets at 0.920-0.959 with a trivially perfect in-substrate +router. + +**The giant model** (built in the sandbox, packaged in the separate +`syfox-hf` repo): 16 domains — bank77 (9k), UCI SMS (3.9k), the 6 data/big +corpora (27.2k), plus 8 newly downloaded real HF datasets (CLINC-150, +enron_spam, emotion, Davidson hate, ag_news, amazon_polarity, dbpedia_14, +boolq) — 76,142 train rows / 152,284 lessons per epoch, 278 globally unique +opaque anchors, empty instructions everywhere, round-robin domain +interleave, mined top-10 criteria for the new domains, per-script +calibration. One interleaved pass: giant-latin 43,420 nodes / 1,905,170 +lanes. Hidden (scored once, energy-norm on): tickets_en 0.904, sms 0.752, +enron 0.752, hate 0.653, agnews 0.604, polarity 0.571, dbpedia 0.475, boolq +0.531 (majority-level), bank77 0.023 (77-way collapses in a shared fabric); +bn 0.943 / hi 0.920 / ru 0.959 on their own substrates. Router measured +under THREE conditions: informed 0.432 (weighted, the bench condition), +blind 0.400 hidden (23,528 rows) / 0.399 cal, all-questions 0.399 cal — +asking everything dilutes the anchoring instead of recovering it. Router +wording sweep (cal only): short4 0.426 > abstract 0.208 > mid8 0.164 > +rich12 0.079 — richer specific criteria HARVEST worse (PROBING.md +mechanism). Tooling: tools/hf_fetch.py (cached parquet fetcher), +tools/giant_prepare.py (corpus builder with the three failure-mode fixes), +tools/giant_bench.py (router+class+e2e per-row bench, slim-format aware), +tools/router_sweep.py, tools/wrapper_condition_experiment.py; Makefile +targets giant-fetch/-prepare/-chunks. data/giant bulk gitignored +(schemas/probes/MANIFEST committed). + +## v3.1.2 — zero-shot probe reports archived; the runtime-flag mechanism measured + +The model-xl zero-shot experiments (Snake 8-scenario suite + the A–E flag +experiment, Tic-Tac-Toe symbolic composition, file-organizer routing) are +archived in `docs/ZEROSHOT.md`, and the report's central observation — +winner flips at constant settled energy, Miller-window confidence 0.805 on +an illegal move — is now mechanism-explained in code and re-measured on +repo fabrics with real held-out rows (`tools/flag_probe_experiment.py`, +2,638 hidden rows, trained schema, deterministic): + +- **Source modes don't touch the field.** With the injection dose held + constant, settled energy is bit-identical across salience/miller configs + (spread ≤ 0.001 on 99.5% / 99.8% of rows) because a settle pass conserves + energy up to uniform decay — source gating only decides which nodes + propagate ("gated nodes keep their energy (readout-visible) but stay + silent as sources", `si_substrate.hpp settle()`). The same invariance is + why the model-xl A–E run reported 83.928 in every amplified config. +- **Energy-norm DOES change the field** (injection dose): 0% of rows keep + their settled energy vs baseline. On trained schemas it is pure + amplification — tickets-big flips 0.1% of winners at identical 0.971 + accuracy while margins rise 0.0355 → 0.9430 and confidence 0.002 → 0.923; + baseline deferrals 35 → 0 (the documented M1 purpose). +- **Flags are diagnostic instruments, not defaults.** Salience gating is + fabric-dependent: −4.1 points on tickets-big (0.971 → 0.930), +19 points + on sms-natural (0.160 → 0.360) where the full-source readout is dominated + by harvest noise. High-confidence-wrong rows (conf ≥ 0.5 while wrong): + 0 at baseline on both fabrics → 15–86 under amplified configs. +- Zero-shot and trained-domain results stay in separate buckets; the + interpretation rules (confidence = concentration, never correctness; + `--defer-margin` for honest ties) are in ZEROSHOT.md §Part 3 and + PROBING.md §6. + +Also: the four SMS probe data files (`data/sms_train.jsonl`, +`sms_hidden_match/reworded/empty.jsonl`) are now committed so the v3.1.1 +probe experiment and this flag experiment reproduce from a fresh clone. + +## v3.1.1 — the probe experiment: criteria wording is a first-class input; honest ties via --defer-margin + +The model-xl diagnostic (handcrafted Bangla/English/SMS probes tying at +~0.50/0.50 with confidence 0 and deferred:false) reproduced and explained on +real data. Experiment: one fabric trained on real UCI SMS spam (5,574 rows, +stratified 70/15/15), the SAME hidden rows decided under three criteria +wordings: + +| decide-side criteria | hidden top-1 | mean margin | +|---|---|---| +| matched (trained schema) | 0.160 | 0.444 | +| reworded (handcrafted, abstract) | 0.842 | 0.043 | +| empty (labels only) | 0.422 | 0.017 | + +Findings (all measured, `tools/sms_probe_experiment.py`): +- The criteria text at decide selects which nodes the question probes. + Matched-trained criteria can HURT: their state-overlapping words harvest + direct hits (anchor-hub noise) and land worse than the majority baseline, + with huge misleading margins. Abstract reworded criteria suppress the + harvest and let the anchor one-hop (class-typicality) carry the decision — + at tie-sized margins. Same fabric: accuracy swings 0.16 <-> 0.84. +- The model-xl probe pattern (near-tied probabilities, confidence 0, + deferred:false) is the reworded/empty condition of this mechanism: the + probes were measuring a DIFFERENT system than the benchmark number + (SMS 0.937 was measured under the trained schema). Handcrafted probes + bound; held-out runs conclude. Methodology written up in docs/PROBING.md. +- Decision-layer honesty: new `decide --defer-margin P` (and server + `options.defer_margin`) discloses p1-p2 below P as `deferred: true, + reason: "low_margin"` instead of a confident-looking label on tied + candidates. The substrate still decides; physics untouched. Measured live: + a 0.509/0.491 tie now returns a deferral, not a spam label. +- Packaging note (from the model-xl diagnostic): a fresh checkout has no + build/ directory (gitignored) — run `make all` first; that also produces + libsyfox_core.so for the HTTP server. + +## v3.1.0 — banking77: real 77-way benchmark, the manual error anatomy, and the hub-pollution fixes + +Real dataset, not synthetic: PolyAI banking77 — 10,003 official train rows / +3,080 official test rows / 77 intents (`tools/bank77_prepare.py` pulls the +CSVs). The official test split becomes the hidden test (firewall-enforced +naming); 10% of train is carved stratified (seed 77) for calibration. + +### Measured fix ladder (selection on cal ONLY, hidden scored once) +| config change | cal top-1 | +|---|---| +| naive: generic criteria, instructions inline, natural labels | 0.029 | +| + mined per-class criteria (log-ratio, unigrams+bigrams, top-20) | (baseline run) | +| + empty instructions (learn folds instructions into the state side; identical per-row instructions are hub pollution — they are never injected at decide) | 0.041 | +| + opaque anchors `c00..c76` (natural labels like `card_arrival` tokenize into shared hubs; "card" spans many classes. Opaque ids give every class a DEDICATED anchor node) | 0.073 | +| + consolidation epochs 3 (reproduces the model-xl recipe on the clean schema) | 0.081–0.085 | +| + top-20 terms + anchor arbitration (flat top-5 re-ranked by bare-anchor readout — product of two readout views) | **0.091** | + +HIDDEN (official test, 3,080 rows, scored once): **top-1 0.081, top-3 0.221, +top-5 0.326** vs chance 0.013 — 6.3× chance at top-1, 25× at top-5. +No cal overfit: cal predicted 0.091, hidden gave 0.081. + +### What the manual benchmark exposed (the point of doing it by hand) +- Without `--energy-norm`, corpus-scale masses silence the readout: all 77 + options sit at exactly 1/77 and argmax degrades to alphabetical order. + The M1 measurement gain is MANDATORY at this scale (0% -> 100% coverage). +- The error anatomy (`tools/bank77_analysis.py`): gold sits at ranks 2-20 for + ~60% of rows; margin-when-correct is ~2x margin-when-wrong; a single class + (`wrong_exchange_rate_for_cash_withdrawal`) absorbs wrong predictions from + every other class via hub-word bigrams ("cash abroad" is class-pure as a + bigram while "cash" is global as a word — the readout tokens are words). +- Measured NEGATIVE (kept off, documented): stopword filtering (0.036 — + verb+stop combos like "was taken" are the signal), term-level purity caps + (0.035), word-level purity caps (0.031-0.053), first-token hierarchical + two-stage (0.051), shorter criteria under the clean schema, unigram-only + criteria (0.045-0.052). The hub phrases are simultaneously the noise and + the signal. +- Honest gap note: 0.081 hidden here is not model-xl's 0.284 — model-xl is a + 14-domain consolidated fabric (45,892 nodes / 1.9M lanes) whose mining + recipe this sandbox rebuild does not replicate. What transfers is the + SCHEMA (opaque anchors + empty instructions + mined criteria + energy-norm) + and the measurement tooling: point `tools/bank77_analysis.py --model + model-xl` at any hidden file to re-run the same anatomy there. + +### Infrastructure +- `tools/bank77_prepare.py`: CSV -> train/cal/hidden JSONL (firewall naming), + stratified carve, deterministic criteria mining, SHA-256 manifest. +- `tools/bank77_analysis.py`: the manual benchmark — per-row probabilities + through the ctypes bridge; top-1/3/5, gold-rank bands, margin and + confidence-when-wrong, worst confusion pairs, per-class accuracy, deferral + anatomy, per-row JSONL dump. `--arbitrate` = anchor product-of-experts. +- Makefile: `bank77` (prepare + learn + cal-bench), `bank77-report` (hidden + run). Bulk splits are gitignored (167 MB inline criteria); the tool + regenerates them deterministically. + +## v3.0.0 — milestones 1–5: scale discipline, distinct experience, provenance, adversarial suite, multicore + +Every claim below is a number from a real run on this repo (commands in the +Makefile; raw JSON in `build/`). Nothing is projected or estimated. + +### Milestone 1 — large held-out datasets, hidden-test firewall +- `tools/gen_corpus.py` (+`tools/corpus_pools.py`): deterministic generator, + seed 20260927. Per domain — tickets_en 12,000 rows (8,400/1,800/1,800), + game 8,000 (5,600/1,200/1,200), guard 8,000 (5,600/1,200/1,200); Bengali / + Hindi / Russian tickets 3,600-ish each with hidden splits of 540 / 539 / 539 + (all ≥ the 500 the milestone requires). 70/15/15 train/cal/hidden, label + distributions in `data/big/MANIFEST.json` with a SHA-256 per file. +- `core/firewall.hpp` (new): the hidden-test contract ENFORCED in code, not + prose. `learn` refuses `_hidden`/`_cal`; `calibrate` refuses `_hidden`; + `derive --gate` refuses `_hidden`. `make firewall-check` proves all four + refusals on the real CLI. +- Hidden-test reports (`make bench-big`, `--energy-norm`, calibration fit on + the `_cal` split only): **tickets_en 0.971** (ECE 0.005), **game 0.763** + (ECE 0.049), **guard 0.638** (ECE 0.037; guardrail hold precision 0.782, + recall 0.910). p95 latency 126–441 µs, decisions bit-deterministic. +- Multilingual hidden (`make bench-big-ml`, per-script routing): + **Bengali 0.969** (ECE 0.015), **Hindi 0.965** (ECE 0.020), + **Russian 0.970** (ECE 0.011). +- Coverage-vs-accuracy on the hidden tests (`make coverage-big`), all three + operating points feasible: tickets 96.4%@53% / 90.1%@73% / 83.0%@93%; + game 94.3%@52% / 86.7%@76% / 80.2%@91%; guard 76.2%@54% / 68.1%@80% / + 65.8%@90%. Dose-response (`make scale-probe`): 0.603@250 → 0.825@8,400 + distinct rows — distinct experience keeps paying at scale. + +### Milestone 2 — distinct experience beats repeated phrasings (measured) +- `learn --dedup`: exact-duplicate lessons skipped, auditable via + `dedup_skipped` in the learn report. +- The A/B at EQUAL lesson counts (25,200 each; `make ab-distinct`): + **8,400 distinct rows 0.825** (39,158 lanes, 1,898 nodes) vs **1,050 rows + re-taught 8× 0.782** (18,633 lanes, 530 nodes). Distinct experience wins + and builds a 2.1× denser fabric. B-dedup (duplicates skipped) lands at + 0.609 with dedup_skipped=22,050 — consistent with the dose-response curve + at ~1,000 rows, cross-checking both measurements. +- `--novelty` per-lesson novelty weighting: measured NEUTRAL at floor 0.90 + (0.827 vs 0.825 baseline) — ships OFF; dedup is the mechanism that pays. + +### Milestone 3 — contradiction handling and machine-auditable evidence +- Every lane carries an evidence ledger: support events, counter events + (anti-Hebbian dissolutions), generation, first/last teach seq, substrate + context. `decide --evidence` prints it per channel — e.g. `department` + resolved with 62 supporting lanes, top lane `the -> problem` w=0.2896, + 10,870 support events, seq window [1, 25198]. +- Contradictions (same state+question taught with a different outcome) are + DETECTED, counted in the learn report, and recorded — never silently + overridden. Live test: teach `a` ×3 then `b` ×3 → decide keeps `a`, + `contested: true`, contradiction record carries old/new outcome, both seqs, + state hash; lanes show counter events. The ledger is read-only: lane + weights drive the field, the ledger never does. + +### Milestone 4 — adversarial/OOD suite (`bench --adversarial`, `make adv-big`) +Deterministic families on the hidden tests, honest per-family metrics: +- tickets: reorder 0.971, padding 0.968, typos 0.968, intensifiers 0.976, + self-contradiction 0.969, negation 0.974, double-negation 0.942 (weakest), + near-miss 0.933, cross-domain 0.908; **unknown concepts defer 100%** + (zero false confidence — honest silence under attack). +- Conflicting-lessons attack (40 real contradictions taught post-hoc, with a + control arm re-taught at gold to isolate the teach-event cost): + silent_override = FALSE on all three domains, contested 40/40, decisions + bit-deterministic after. Contradiction-specific damage on untouched rows + (tickets): 0.7193 → 0.6517 vs control 0.7027 — the anti-Hebbian law costs + ~5.1 pts beyond generic re-teaching, now measured instead of guessed. + +### Milestone 5 — multicore settle, batched throughput, the GPU gate +- CSR mirror of the lane fabric (contiguous offsets/targets/weights, lazily + rebuilt, order-preserving — every float sum keeps its exact operand order). +- OpenMP build (`make omp`, same sources, `-fopenmp`): parallel settle with + static partitioning + per-thread scatter buffers combined in fixed thread + order. **Bit-identity proven**: `make omp-identity` — sequential and + `--threads 2` produce identical routing/calibration/honesty/guardrail + blocks at 0.971 on the hidden test. `syfox-test-omp` all-pass. +- Honest performance note: at this fabric size on a 2-core sandbox the + deterministic parallel settle is SLOWER (p50 620 µs vs 415 µs) — thread + coordination exceeds the gain below ~10k nodes. It exists for dense + fabrics; the numbers say when to use it. +- Batched multicore throughput (`bench --throughput N`, private engine per + worker, checksum proves real work): 2,390 → 3,714 decisions/sec + (**1.554×** on 2 cores) on the 3,518-node tickets fabric. +- GPU gate measured (`make density`): per-fabric density 0.0067 (tickets, + 3,518 nodes / 82,655 lanes, degree 23.5) — the SoA/CSR layout is in place; + a GPU port stays DESIGN-ONLY until substrates are dense enough to justify + it. No GPU claims. + +### Fixed in v3 (found by running the milestones, not by reading) +- `si_substrate.hpp`: Substrate class was left unclosed by an interrupted + edit (build broken); CSR cache members needed `mutable`. +- Parallel settle segfault: per-thread scatter buffers were constructed + EMPTY (n vectors of size 0) → out-of-bounds combine. Now sized n. +- `omp-identity`/`throughput`/`density` targets silently measured an EMPTY + fabric (missing `--lang auto` on a per-script-routed model) — the "ok" + was vacuous. All three now load real substrates; identity re-proven at + 0.971, throughput checksum non-zero. + +## v2.2.0 — multilingual boundary, trigram bridges, active learning + +The language barrier was at the tokenizer: v2.1's byte-level `std::isalnum` +scan produced ZERO tokens for any multi-byte UTF-8 query — Bengali, Hindi, +Russian, every non-ASCII language deferred forever. v2.2 rebuilds the input +boundary (si_substrate.hpp still byte-identical to v0.2): + +### Multilingual boundary +- `core/script.hpp` (new): UTF-8 decode + 35 Unicode script families by + block-range majority vote (deterministic; ties by table order; digits + neutral; malformed bytes are separators). Families cover 100+ languages. +- `core/normalize.hpp`: codepoint-aware tokenization. Pure-ASCII input keeps + the byte-identical v2.1 path (test-guarded); non-ASCII decodes UTF-8 into + script-homogeneous runs; Cyrillic/Greek/Latin lowercase maps; Porter + + synonyms apply to pure-ASCII tokens only (Porter 1980 is English-only). +- `--lang auto|`: per-script routing. learn routes lessons into + `-