interplane.Get Omega
Read in your language

aien-sovereign-core-mv

AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.

Brought by drakestapleton

GitHub aien-dev/aien-sovereign-core-mv#560 (code only)

closed derived 720eb3e389526971 #560

Imported from GitHub aien-dev/aien-sovereign-core-mv#560 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base 1615afbbece0d27a4f1f561176c44ef1a0215e70 · Head 835fb8acab52585dcfed89b3909295673469fb86

Fetch it

A git bundle of the pull request's head, 154676 bytes.

curl -fsSL https://interplane.io/drakestapleton/aien-sovereign-core-mv/patches/720eb3e389526971.bundle -o 720eb3e389526971.bundle
git fetch 720eb3e389526971.bundle refs/pull/560/head

Raw bundle · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/aien-sovereign-core-mv
560
835fb8acab52585dcfed89b3909295673469fb86
{"kind":"github-import","owner":"aien-dev","repo":"aien-sovereign-core-mv","number":560,"url":"https://github.com/aien-dev/aien-sovereign-core-mv/pull/560","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:37:31Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/.crumb b/.crumb
index 0b3883e0..7cbfcfdb 100644
--- a/.crumb
+++ b/.crumb
@@ -101,7 +101,7 @@
         },
         {
           "digest": "459e0218a85fe55235bcbdf94455e069c52b77c0811063105da5bf438995b7a4",
-          "last_commit": "1681069",
+          "last_commit": "1615afb",
           "name": "scripts",
           "purpose": ""
         },
@@ -119,14 +119,14 @@
         }
       ],
       "children_root": "sha256:9c8f34b4f863ab4604666e780128e486c6b32d512c2f8c9342f8b26a582874d3",
-      "compiled_at": "2026-10-16T07:44:02Z",
+      "compiled_at": "2026-10-16T08:14:38Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:c8131f9f913300e149e06ed6fb419d49e248de3f1f86c58541ff3afd5dc59174",
-      "evidence_files": 1561,
-      "evidence_root": "sha256:a315b980314448faf057152edf0a20aa28310d8ab4277d22762100ff444e3fa1",
-      "files": 5854,
-      "generated_at_commit": "1681069b921de335bd5a8bee9c24ff2eae3559ab",
-      "source_tree": "sha256:c4f0b50a32afdf867d2a86ea512537e5213c16de53ef87d8e3f6509064937787"
+      "digest": "sha256:2d3c31afb4fb05cbf064123c0040c48e5d684bb3e13c5c4ece4eba98ee5b82bf",
+      "evidence_files": 1571,
+      "evidence_root": "sha256:3daf70b2d921e14a5ec37662f2210a6e3b677f5e7b4ca8c723a30bf922411fad",
+      "files": 5869,
+      "generated_at_commit": "ff829a69ade15ee44f06e1905c605ec7fd29993d",
+      "source_tree": "sha256:2ea56307ce1636fc2314e52f6d186ebb60d11ba835e96ad4e04ee2e7b6946e19"
     }
   },
   "history": [],
diff --git a/Cargo.lock b/Cargo.lock
index f1fdee63..cef9d9f5 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -185,6 +185,7 @@ dependencies = [
  "async-trait",
  "parking_lot",
  "rayon",
+ "regex-syntax",
  "serde",
  "serde_json",
  "sha2 0.10.9",
diff --git a/crates/aien-inference-abi/Cargo.toml b/crates/aien-inference-abi/Cargo.toml
index c9121ad6..1131a028 100644
--- a/crates/aien-inference-abi/Cargo.toml
+++ b/crates/aien-inference-abi/Cargo.toml
@@ -26,6 +26,7 @@ aien-omega-pf = { path = "../aien-omega-pf" }
 aien-omega-dgraph = { path = "../aien-omega-dgraph" }
 parking_lot = "0.12"
 sha2 = "0.10"
+regex-syntax = "0.8"
 
 
 
diff --git a/crates/aien-inference-abi/src/bin/own_tern_check.rs b/crates/aien-inference-abi/src/bin/own_tern_check.rs
new file mode 100644
index 00000000..2394862c
--- /dev/null
+++ b/crates/aien-inference-abi/src/bin/own_tern_check.rs
@@ -0,0 +1,282 @@
+//! OWN-TERN check, stage T2: the sealed golden of our CPU reference for BitNet b1.58 2B-4T.
+//!
+//!   own_tern_check golden <checkpoint-dir> <passage.txt|passage.json> <out-dir>
+//!
+//! Host only (no chip). Loads the bf16 master with our loader into i8 trit matrices, then:
+//! - teacher-forced loss and perplexity over the whole passage (BOS first), for the reference and
+//!   the three negative controls (wrong norm order, skipped sub-norms, q and v scales swapped);
+//! - greedy continuations (32 tokens) of our five prompts, and of the spec's five acceptance
+//!   prompts for information;
+//! - hidden-state dumps after layers 0, 1, 15, 29 and after the final norm, plus the last
+//!   position's logits, for every prompt and for a 512-token prompt (BOS and the passage's
+//!   first 511 tokens).
+//!
+//! Writes `<out-dir>/golden.json` (ids, perplexity receipt, decode timing, dump sha256s),
+//! `<out-dir>/passage-nll-<variant>.f64` (per-token losses, little-endian f64) and
+//! `<out-dir>/dumps/*.f32` (little-endian f32, `[tokens][hidden]`; logits `[vocab]`).
+
+use std::path::{Path, PathBuf};
+use std::time::Instant;
+
+use aien_inference_abi::bitnet_forward::{
+    argmax, HostBitNetForward, HostRefUploader, KvCache, Variant,
+};
+use aien_inference_abi::bitnet_omega::{
+    load_bitnet_omega, sha256_file, BITNET_2B4T_SAFETENSORS_SHA256, BITNET_2B4T_TOKENIZER_SHA256,
+    TERN_LAYOUT_ID,
+};
+use aien_inference_abi::bitnet_tokenizer::BitNetTokenizer;
+use serde_json::{json, Value};
+use sha2::{Digest, Sha256};
+
+const OWN_PROMPTS: [(&str, &str); 5] = [
+    (
+        "own1-flat-tyre",
+        "The first thing to do when a bicycle tyre goes flat is",
+    ),
+    (
+        "own2-mountain-water",
+        "Water boils at a lower temperature high on a mountain because",
+    ),
+    (
+        "own3-bread",
+        "A simple loaf of bread needs only four ingredients:",
+    ),
+    ("own4-light", "The three primary colours of light are"),
+    (
+        "own5-lighthouse",
+        "Once upon a time, an old lighthouse keeper",
+    ),
+];
+
+/// Spec section 6 acceptance prompts: recorded for information, not a gate.
+const SPEC_PROMPTS: [(&str, &str); 5] = [
+    ("spec1-france", "The capital of France is"),
+    ("spec2-germany", "The capital of Germany is"),
+    ("spec3-count", "Count from 6 to 10:"),
+    ("spec4-boiling", "The boiling point of water in Celsius is"),
+    ("spec5-planet", "The largest planet in the solar system is"),
+];
+
+const TAP_LAYERS: [usize; 4] = [0, 1, 15, 29];
+const NEW_TOKENS: usize = 32;
+const LONG_PROMPT: usize = 512;
+const MIN_PASSAGE_TOKENS: usize = 2000;
+
+fn main() {
+    let args: Vec<String> = std::env::args().collect();
+    let r = match args.get(1).map(String::as_str) {
+        Some("golden") if args.len() == 5 => golden(
+            Path::new(&args[2]),
+            Path::new(&args[3]),
+            Path::new(&args[4]),
+        ),
+        _ => Err(
+            "usage: own_tern_check golden <checkpoint-dir> <passage.txt|passage.json> <out-dir>"
+                .into(),
+        ),
+    };
+    if let Err(e) = r {
+        eprintln!("own_tern_check: {e}");
+        std::process::exit(1);
+    }
+}
+
+fn sha_hex(bytes: &[u8]) -> String {
+    Sha256::digest(bytes)
+        .iter()
+        .map(|b| format!("{b:02x}"))
+        .collect()
+}
+
+fn write_f32(path: &Path, v: &[f32]) -> Result<String, String> {
+    let bytes: Vec<u8> = v.iter().flat_map(|x| x.to_le_bytes()).collect();
+    std::fs::write(path, &bytes).map_err(|e| format!("{}: {e}", path.display()))?;
+    Ok(sha_hex(&bytes))
+}
+
+fn golden(ckpt: &Path, passage_path: &Path, out: &Path) -> Result<(), String> {
+    let t_all = Instant::now();
+    let dumps = out.join("dumps");
+    std::fs::create_dir_all(&dumps).map_err(|e| format!("{}: {e}", dumps.display()))?;
+
+    for (file, want) in [
+        ("model.safetensors", BITNET_2B4T_SAFETENSORS_SHA256),
+        ("tokenizer.json", BITNET_2B4T_TOKENIZER_SHA256),
+    ] {
+        let got = sha256_file(&ckpt.join(file))?;
+        if got != want {
+            return Err(format!("{file} sha256 {got} is not the pinned {want}"));
+        }
+    }
+    let tok = BitNetTokenizer::from_file(&ckpt.join("tokenizer.json"))?;
+    let passage = read_passage(passage_path)?;
+    let passage_sha = sha_hex(passage.as_bytes());
+    let ids = tok.encode(&passage, true);
+    if ids.len() - 1 < MIN_PASSAGE_TOKENS {
+        return Err(format!(
+            "passage has {} tokens, the gate needs at least {MIN_PASSAGE_TOKENS}",
+            ids.len() - 1
+        ));
+    }
+    if tok.decode(&ids[1..])? != passage {
+        return Err("passage does not round-trip through the tokenizer".into());
+    }
+    eprintln!(
+        "passage: {} tokens after BOS, sha256 {passage_sha}",
+        ids.len() - 1
+    );
+
+    let t_load = Instant::now();
+    let (w, report) = load_bitnet_omega(ckpt, &HostRefUploader, &mut |m| eprintln!("load: {m}"))?;
+    let load_s = t_load.elapsed().as_secs_f64();
+    let eos = w.config.eos_token_ids.clone();
+    let mut f = HostBitNetForward::new(&w);
+    let h = w.config.hidden;
+
+    // Perplexity: row i predicts ids[i + 1].
+    let mut ppl = serde_json::Map::new();
+    for v in [
+        Variant::Reference,
+        Variant::SubNormAfterO,
+        Variant::SkipSubNorms,
+        Variant::SwapQvScales,
+    ] {
+        f.variant = v;
+        let t0 = Instant::now();
+        let normed = f.forward(&ids, &mut KvCache::new(&w.config), &[], &mut Vec::new())?;
+        let n = ids.len() - 1;
+        let nll = f.nll(&normed[..n * h], &ids[1..])?;
+        let sum: f64 = nll.iter().sum();
+        let bytes: Vec<u8> = nll.iter().flat_map(|x| x.to_le_bytes()).collect();
+        let file = format!("passage-nll-{}.f64", v.name());
+        std::fs::write(out.join(&file), &bytes).map_err(|e| format!("{file}: {e}"))?;
+        let mean = sum / n as f64;
+        eprintln!(
+            "{}: {n} tokens, sum nll {sum:.17e}, perplexity {:.6} ({:.1} s)",
+            v.name(),
+            mean.exp(),
+            t0.elapsed().as_secs_f64()
+        );
+        ppl.insert(
+            v.name().into(),
+            json!({
+                "predicted_tokens": n,
+                "sum_nll_nats": format!("{sum:.17e}"),
+                "mean_nll_nats": format!("{mean:.17e}"),
+                "perplexity": format!("{:.9}", mean.exp()),
+                "nll_file": file,
+                "nll_sha256": sha_hex(&bytes),
+                "seconds": t0.elapsed().as_secs_f64(),
+            }),
+        );
+    }
+    f.variant = Variant::Reference;
+
+    // Prompts: dumps, then greedy decode with the KV cache.
+    let mut prompts = Vec::new();
+    let mut step_ms = Vec::new();
+    let mut texts: Vec<(String, String, Vec<u32>, bool)> = OWN_PROMPTS
+        .iter()
+        .map(|(n, t)| (n.to_string(), t.to_string(), tok.encode(t, true), true))
+        .collect();
+    texts.extend(
+        SPEC_PROMPTS
+            .iter()
+            .map(|(n, t)| (n.to_string(), t.to_string(), tok.encode(t, true), true)),
+    );
+    texts.push((
+        format!("long{LONG_PROMPT}-passage-head"),
+        format!("BOS and the first {} passage tokens", LONG_PROMPT - 1),
+        ids[..LONG_PROMPT].to_vec(),
+        false,
+    ));
+    for (name, text, pids, generate) in texts {
+        let mut cache = KvCache::new(&w.config);
+        let mut taps = Vec::new();
+        let normed = f.forward(&pids, &mut cache, &TAP_LAYERS, &mut taps)?;
+        let t = pids.len();
+        let mut files = Vec::new();
+        for (layer, rows) in &taps {
+            let file = format!("{name}.layer{layer:02}.f32");
+            let sha = write_f32(&dumps.join(&file), rows)?;
+            files.push(json!({"tap": format!("layer{layer:02}"), "file": file, "shape": [t, h], "sha256": sha}));
+        }
+        let file = format!("{name}.final-norm.f32");
+        let sha = write_f32(&dumps.join(&file), &normed)?;
+        files.push(json!({"tap": "final_norm", "file": file, "shape": [t, h], "sha256": sha}));
+        let last = f.logits(&normed[(t - 1) * h..]);
+        let file = format!("{name}.last-logits.f32");
+        let sha = write_f32(&dumps.join(&file), &last)?;
+        files.push(
+            json!({"tap": "last_logits", "file": file, "shape": [w.config.vocab], "sha256": sha}),
+        );
+
+        let mut entry = json!({"name": name, "text": text, "ids": pids, "dumps": files});
+        if generate {
+            let mut next = argmax(&last);
+            let mut gen = Vec::new();
+            while gen.len() < NEW_TOKENS {
+                gen.push(next);
+                if eos.contains(&next) || gen.len() == NEW_TOKENS {
+                    break;
+                }
+                let t0 = Instant::now();
+                let row = f.forward(&[next], &mut cache, &[], &mut Vec::new())?;
+                next = argmax(&f.logits(&row));
+                step_ms.push(t0.elapsed().as_secs_f64() * 1e3);
+            }
+            let cont = tok.decode(&gen)?;
+            eprintln!("{name}: {text:?} -> {cont:?}");
+            entry["greedy_ids"] = json!(gen);
+            entry["greedy_text"] = json!(cont);
+        }
+        prompts.push(entry);
+    }
+    step_ms.sort_by(f64::total_cmp);
+    let median = step_ms.get(step_ms.len() / 2).copied().unwrap_or(0.0);
+
+    let golden: Value = json!({
+        "stage": "bitnet-t2-host-reference",
+        "layout_id": TERN_LAYOUT_ID,
+        "model_sha256": BITNET_2B4T_SAFETENSORS_SHA256,
+        "tokenizer_sha256": BITNET_2B4T_TOKENIZER_SHA256,
+        "arithmetic": "f32; exact int32 ternary products; per-token int8 activation absmax, round half to even; RMSNorm square sums in f64; half-split RoPE, f64 angles; tied bf16 table widened to f32",
+        "bos": "every prompt and the passage start with BOS 128000 at position 0",
+        "passage": {"file": passage_path.file_name().and_then(|s| s.to_str()), "sha256": passage_sha, "tokens_after_bos": ids.len() - 1},
+        "passage_ids_sha256": sha_hex(&ids.iter().flat_map(|x| x.to_le_bytes()).collect::<Vec<u8>>()),
+        "perplexity": ppl,
+        "prompts": prompts,
+        "greedy": {"new_tokens_max": NEW_TOKENS, "stop_ids": eos},
+        "decode": {"steps": step_ms.len(), "median_ms_per_token": median, "note": "host reference: one-token forward plus the full-vocabulary logits, i8 trits and f32 table"},
+        "load": {"seconds": load_s, "resident_bytes": report.resident_bytes},
+        "total_seconds": t_all.elapsed().as_secs_f64(),
+    });
+    let text = serde_json::to_string_pretty(&golden).map_err(|e| e.to_string())?;
+    let path: PathBuf = out.join("golden.json");
+    std::fs::write(&path, text + "\n").map_err(|e| format!("{}: {e}", path.display()))?;
+    eprintln!("wrote {}", path.display());
+    Ok(())
+}
+
+/// The passage text: a plain file, or the `text` field of a JSON file whose `text_sha256` must
+/// match (the evidence keeps the passage as JSON data, dashes and all).
+fn read_passage(path: &Path) -> Result<String, String> {
+    let raw = std::fs::read_to_string(path).map_err(|e| format!("{}: {e}", path.display()))?;
+    if path.extension().and_then(|e| e.to_str()) != Some("json") {
+        return Ok(raw);
+    }
+    let j: Value = serde_json::from_str(&raw).map_err(|e| format!("{}: {e}", path.display()))?;
+    let text = j["text"]
+        .as_str()
+        .ok_or_else(|| format!("{}: no text field", path.display()))?;
+    let sha = sha_hex(text.as_bytes());
+    if j["text_sha256"] != sha.as_str() {
+        return Err(format!(
+            "{}: text sha256 {sha} is not the recorded {}",
+            path.display(),
+            j["text_sha256"]
+        ));
+    }
+    Ok(text.to_string())
+}
diff --git a/crates/aien-inference-abi/src/bitnet_forward.rs b/crates/aien-inference-abi/src/bitnet_forward.rs
new file mode 100644
index 00000000..35202c87
--- /dev/null
+++ b/crates/aien-inference-abi/src/bitnet_forward.rs
@@ -0,0 +1,596 @@
+//! Our CPU reference forward for BitNet b1.58 2B-4T (stage T2): the oracle the chip engine is
+//! checked against. f32 arithmetic throughout, exact int32 ternary products.
+//!
+//! One layer, as spec 1.2 states it from `REF/model.py:237-242` (prefill path, `use_kernel=False`,
+//! `REF/generate.py:56,63,70`), cross-checked with `HF/models/bitnet/modeling_bitnet.py`:
+//!
+//! ```text
+//! a   = rms_norm(x, input_norm)                       model.py:237-241
+//! q,k,v = BitLinear_qkv(a)  (one fused linear, rows [q | k | v], one weight scale per segment)
+//! q,k = rope_half_split(q, k, position)               spec 1.3, HF :83-85, :299, :314
+//! o   = causal GQA softmax(q k^T / sqrt(128)) v       HF :161; q head h reads kv head h / 4
+//! h   = x + BitLinear_o(rms_norm(o, attn_sub_norm))   model.py:159-160
+//! g,u = BitLinear_gate_up(rms_norm(h, post_norm))
+//! out = h + BitLinear_down(rms_norm(relu(g)^2 * u, ffn_sub_norm))   model.py:192-197
+//! logits = rms_norm(x_last_layer, final_norm) . embed^T            model.py:280-281 (tied)
+//! ```
+//!
+//! BitLinear (spec 2.2, `REF/model.py:78-81`): per token `s_a = 127 / max(max|x|, 1e-5)`,
+//! `q = clamp(round_half_even(x * s_a), -128, 127)`, then `y[r] = acc[r] / s_a * w_scale(r)` with
+//! `acc` the exact int32 ternary product and `w_scale` the bf16 scale of the segment row `r`
+//! belongs to (one scale each for q, k, v, gate, up; never the decode kernel's thirds,
+//! `bitnet_kernels.h:80`).
+//!
+//! RMSNorm is `w * x / sqrt(mean(x^2) + eps)` with the square sum in f64 (HF :53-58 upcasts to
+//! f32; f64 is the more exact oracle). RoPE angles are `pos * 500000^(-2j/128)` in f64, position
+//! 0 for the first token (BOS when present).
+
+use rayon::prelude::*;
+
+use crate::bitnet_omega::{
+    check_ternary_upload, code_trit, BitNetConfig, BitNetOmegaWeights, TernMatrix, TernPart,
+    TernSegment, TernTensor, TernUploader, TRITS_PER_WORD,
+};
+use crate::qwen3_dense_omega::{DenseGemv, HostFp8Gemv};
+use crate::qwen3_moe::bf16_to_f32;
+use std::sync::Arc;
+
+// ---------------------------------------------------------------------------
+// Host matrices: the packed words unpacked once to one i8 trit per weight.
+// ---------------------------------------------------------------------------
+
+/// A ternary matrix held as `[n][k]` i8 trits (unpacked from [`crate::bitnet_omega::TERN_LAYOUT_ID`]
+/// words after [`check_ternary_upload`]), with a token-batched exact int32 product.
+#[derive(Debug)]
+pub struct I8TernMatrix {
+    n: usize,
+    k: usize,
+    trits: Vec<i8>,
+    segments: Vec<TernSegment>,
+}
+
+impl I8TernMatrix {
+    pub fn from_words(
+        n: usize,
+        k: usize,
+        words: &[u32],
+        segments: &[TernSegment],
+    ) -> Result<Self, String> {
+        check_ternary_upload(n, k, words, segments)?;
+        let mut trits = vec![0i8; n * k];
+        trits
+            .par_chunks_mut(TRITS_PER_WORD)
+            .zip(words.par_iter())
+            .for_each(|(t, &w)| {
+                for (i, v) in t.iter_mut().enumerate() {
+                    // Validated above: no 0b11 code.
+                    *v = code_trit(w >> (2 * i)).unwrap_or(0);
+                }
+            });
+        Ok(Self {
+            n,
+            k,
+            trits,
+            segments: segments.to_vec(),
+        })
+    }
+
+    /// `acc[t][r] = sum_c W[r][c] * x[t][c]` for `t` tokens, exact.
+    pub fn gemm(&self, x: &[i8], t: usize, acc: &mut [i32]) -> Result<(), String> {
+        let (n, k) = (self.n, self.k);
+        if x.len() != t * k || acc.len() != t * n {
+            return Err(format!(
+                "ternary gemm [{n}][{k}] for {t} tokens given x {} acc {}",
+                x.len(),
+                acc.len()
+            ));
+        }
+        const ROWS: usize = 32;
+        const TOKENS: usize = 16;
+        let blocks: Vec<Vec<i32>> = self
+            .trits
+            .par_chunks(ROWS * k)
+            .map(|rows| {
+                let nr = rows.len() / k;
+                let mut out = vec![0i32; nr * t];
+                for t0 in (0..t).step_by(TOKENS) {
+                    let t1 = (t0 + TOKENS).min(t);
+                    for (r, row) in rows.chunks_exact(k).enumerate() {
+                        for tt in t0..t1 {
+                            out[r * t + tt] = dot_i8(row, &x[tt * k..(tt + 1) * k]);
+                        }
+                    }
+                }
+                out
+            })
+            .collect();
+        for (b, out) in blocks.iter().enumerate() {
+            let nr = out.len() / t.max(1);
+            for r in 0..nr {
+                for tt in 0..t {
+                    acc[tt * n + b * ROWS + r] = out[r * t + tt];
+                }
+            }
+        }
+        Ok(())
+    }
+}
+
+impl TernMatrix for I8TernMatrix {
+    fn n(&self) -> usize {
+        self.n
+    }
+    fn k(&self) -> usize {
+        self.k
+    }
+    fn segments(&self) -> &[TernSegment] {
+        &self.segments
+    }
+    fn gemv_i8(&self, x: &[i8], acc: &mut [i32]) -> Result<(), String> {
+        self.gemm(x, 1, acc)
+    }
+    fn gemm_i8(&self, x: &[i8], t: usize, acc: &mut [i32]) -> Result<(), String> {
+        self.gemm(x, t, acc)
+    }
+}
+
+#[inline]
+fn dot_i8(a: &[i8], b: &[i8]) -> i32 {
+    // Lanes of 16 so the compiler keeps independent vector sums.
+    let mut lanes = [0i32; 16];
+    let (ca, cb) = (a.chunks_exact(16), b.chunks_exact(16));
+    let (ra, rb) = (ca.remainder(), cb.remainder());
+    for (x, y) in ca.zip(cb) {
+        for i in 0..16 {
+            lanes[i] += x[i] as i32 * y[i] as i32;
+        }
+    }
+    let tail: i32 = ra.iter().zip(rb).map(|(&x, &y)| x as i32 * y as i32).sum();
+    lanes.iter().sum::<i32>() + tail
+}
+
+#[inline]
+fn dot_f32(a: &[f32], b: &[f32]) -> f32 {
+    let mut lanes = [0f32; 8];
+    let (ca, cb) = (a.chunks_exact(8), b.chunks_exact(8));
+    let (ra, rb) = (ca.remainder(), cb.remainder());
+    for (x, y) in ca.zip(cb) {
+        for i in 0..8 {
+            lanes[i] += x[i] * y[i];
+        }
+    }
+    let tail: f32 = ra.iter().zip(rb).map(|(&x, &y)| x * y).sum();
+    lanes.iter().sum::<f32>() + tail
+}
+
+/// The host uploader for the reference: i8 trit matrices and the host e4m3 table.
+#[derive(Debug, Default)]
+pub struct HostRefUploader;
+
+impl TernUploader for HostRefUploader {
+    fn upload_ternary(
+        &self,
+        _layer: usize,
+        _what: TernTensor,
+        n: usize,
+        k: usize,
+        words: &[u32],
+        segments: &[TernSegment],
+    ) -> Result<Arc<dyn TernMatrix>, String> {
+        Ok(Arc::new(I8TernMatrix::from_words(n, k, words, segments)?))
+    }
+
+    fn upload_table_fp8(
+        &self,
+        n: usize,
+        k: usize,
+        w: &[u8],
+        scales: &[u16],
+    ) -> Result<Arc<dyn DenseGemv>, String> {
+        Ok(Arc::new(HostFp8Gemv::new(
+            n,
+            k,
+            w.to_vec(),
+            scales.to_vec(),
+        )?))
+    }
+}
+
+// ---------------------------------------------------------------------------
+// The pieces of one layer.
+// ---------------------------------------------------------------------------
+
+/// Per-token int8 absmax quantisation (spec 2.2): returns `s_a`.
+pub fn quant_act(x: &[f32], q: &mut [i8]) -> f32 {
+    let amax = x.iter().fold(0f32, |m, v| m.max(v.abs()));
+    let s = 127.0 / amax.max(1e-5);
+    for (o, &v) in q.iter_mut().zip(x) {
+        *o = (v * s).round_ties_even().clamp(-128.0, 127.0) as i8;
+    }
+    s
+}
+
+/// `w * x / sqrt(mean(x^2) + eps)`, square sum in f64.
+pub fn rms_norm(x: &[f32], w: &[f32], eps: f32, out: &mut [f32]) {
+    let ss: f64 = x.iter().map(|&v| v as f64 * v as f64).sum();
+    let inv = 1.0 / (ss / x.len() as f64 + eps as f64).sqrt();
+    for ((o, &v), &g) in out.iter_mut().zip(x).zip(w) {
+        *o = (v as f64 * inv) as f32 * g;
+    }
+}
+
+fn rms_norm_rows(x: &[f32], w: &[f32], eps: f32) -> Vec<f32> {
+    let d = w.len();
+    let mut out = vec![0f32; x.len()];
+    out.par_chunks_mut(d)
+        .zip(x.par_chunks(d))
+        .for_each(|(o, xr)| rms_norm(xr, w, eps, o));
+    out
+}
+
+/// cos and sin of `pos * theta^(-2j/d)`, j < d/2, in f64 then rounded to f32.
+pub fn rope_table(pos: usize, d: usize, theta: f64) -> Vec<(f32, f32)> {
+    (0..d / 2)
+        .map(|j| {
+            let a = pos as f64 * theta.powf(-((2 * j) as f64) / d as f64);
+            let (s, c) = a.sin_cos();
+            (c as f32, s as f32)
+        })
+        .collect()
+}
+
+/// Half-split rotation of one head: dim j pairs with j + d/2 (HF `rotate_half`).
+pub fn rope_half_split(v: &mut [f32], table: &[(f32, f32)]) {
+    let half = v.len() / 2;
+    for (j, &(c, s)) in table.iter().enumerate() {
+        let (x0, x1) = (v[j], v[j + half]);
+        v[j] = x0 * c - x1 * s;
+        v[j + half] = x1 * c + x0 * s;
+    }
+}
+
+/// Deliberately wrong forwards, the negative controls of the T2 perplexity gate.
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub enum Variant {
+    /// Spec 1.2.
+    Reference,
+    /// Wrong norm order: `attn_sub_norm` after `o_proj` instead of before it.
+    SubNormAfterO,
+    /// Both sub-norms skipped.
+    SkipSubNorms,
+    /// The q and v segment scales swapped. Swapping q and k alone would be a no-op (scores
+    /// scale by `s_q * s_k` either way) and a v scale is undone by `attn_sub_norm`, so this
+    /// scales every attention score by `s_v / s_q`.
+    SwapQvScales,
+    /// The q and k segment scales swapped: kept to show that control is vacuous.
+    SwapQkScales,
+}
+
+impl Variant {
+    pub fn name(self) -> &'static str {
+        match self {
+            Self::Reference => "reference",
+            Self::SubNormAfterO => "sub-norm-after-o",
+            Self::SkipSubNorms => "skip-sub-norms",
+            Self::SwapQvScales => "swap-q-v-scales",
+            Self::SwapQkScales => "swap-q-k-scales",
+        }
+    }
+}
+
+/// Keys and values of every layer, `[len][kv_dim]` f32, roped keys.
+#[derive(Debug, Clone)]
+pub struct KvCache {
+    pub len: usize,
+    k: Vec<Vec<f32>>,
+    v: Vec<Vec<f32>>,
+}
+
+impl KvCache {
+    pub fn new(c: &BitNetConfig) -> Self {
+        Self {
+            len: 0,
+            k: vec![Vec::new(); c.layers],
+            v: vec![Vec::new(); c.layers],
+        }
+    }
+
+    /// Drops every position from `len` on.
+    pub fn truncate(&mut self, len: usize, kv_dim: usize) {
+        for x in self.k.iter_mut().chain(self.v.iter_mut()) {
+            x.truncate(len * kv_dim);
+        }
+        self.len = self.len.min(len);
+    }
+}
+
+/// Causal GQA attention for `t` query rows at positions `pos0 ..` over the cached keys (roped)
+/// and values `[pos0 + t][kv_dim]`: query head `h` reads kv head `h / (q_heads / kv_heads)`,
+/// scores scaled by `head_dim^-0.5`, softmax over positions `0..=pos0 + i`. Returns `[t][q_dim]`.
+pub fn attend(c: &BitNetConfig, q: &[f32], kc: &[f32], vc: &[f32], pos0: usize) -> Vec<f32> {
+    let (qd, kvd, hd) = (c.q_dim(), c.kv_dim(), c.head_dim);
+    let group = c.q_heads / c.kv_heads;
+    let scale = (hd as f32).powf(-0.5);
+    let t = q.len() / qd;
+    let mut att = vec![0f32; t * qd];
+    att.par_chunks_mut(hd).enumerate().for_each(|(idx, o)| {
+        let (i, head) = (idx / c.q_heads, idx % c.q_heads);
+        let kvh = head / group;
+        let p = pos0 + i;
+        let qv = &q[i * qd + head * hd..i * qd + (head + 1) * hd];
+        let scores: Vec<f32> = (0..=p)
+            .map(|j| dot_f32(qv, &kc[j * kvd + kvh * hd..j * kvd + (kvh + 1) * hd]) * scale)
+            .collect();
+        let m = scores.iter().fold(f32::NEG_INFINITY, |a, &b| a.max(b));
+        let e: Vec<f32> = scores.iter().map(|&s| (s - m).exp()).collect();
+        let sum: f64 = e.iter().map(|&v| v as f64).sum();
+        let inv = (1.0 / sum) as f32;
+        for (j, &ej) in e.iter().enumerate() {
+            let wgt = ej * inv;
+            let vv = &vc[j * kvd + kvh * hd..j * kvd + (kvh + 1) * hd];
+            for (od, &vd) in o.iter_mut().zip(vv) {
+                *od += wgt * vd;
+            }
+        }
+    });
+    att
+}
+
+/// The reference model over loaded weights.
+pub struct HostBitNetForward<'a> {
+    pub w: &'a BitNetOmegaWeights,
+    pub variant: Variant,
+    /// The tied table widened to f32 once, `[vocab][hidden]`.
+    embed: Vec<f32>,
+}
+
+impl<'a> HostBitNetForward<'a> {
+    pub fn new(w: &'a BitNetOmegaWeights) -> Self {
+        let embed = w.embed_bf16.par_iter().map(|&b| bf16_to_f32(b)).collect();
+        Self {
+            w,
+            variant: Variant::Reference,
+            embed,
+        }
+    }
+
+    fn config(&self) -> &BitNetConfig {
+        &self.w.config
+    }
+
+    /// One BitLinear over `t` token rows of `x`: `[t][n]` outputs.
+    fn bit_linear(&self, m: &dyn TernMatrix, x: &[f32], t: usize) -> Result<Vec<f32>, String> {
+        let (n, k) = (m.n(), m.k());
+        let mut q = vec![0i8; t * k];
+        let s_a: Vec<f32> = q
+            .par_chunks_mut(k)
+            .zip(x.par_chunks(k))
+            .map(|(qr, xr)| quant_act(xr, qr))
+            .collect();
+        let mut acc = vec![0i32; t * n];
+        m.gemm_i8(&q, t, &mut acc)?;
+        let mut seg: Vec<(TernPart, f32, usize)> = m
+            .segments()
+            .iter()
+            .map(|s| (s.part, bf16_to_f32(s.scale_bf16), s.rows))
+            .collect();
+        let swap = match self.variant {
+            Variant::SwapQvScales => Some((TernPart::Q, TernPart::V)),
+            Variant::SwapQkScales => Some((TernPart::Q, TernPart::K)),
+            _ => None,
+        };
+        if let Some((a, b)) = swap {
+            let ia = seg.iter().position(|s| s.0 == a);
+            let ib = seg.iter().position(|s| s.0 == b);
+            if let (Some(ia), Some(ib)) = (ia, ib) {
+                let sa = seg[ia].1;
+                seg[ia].1 = seg[ib].1;
+                seg[ib].1 = sa;
+            }
+        }
+        let mut row_scale = Vec::with_capacity(n);
+        for &(_, s, rows) in &seg {
+            row_scale.extend(std::iter::repeat_n(s, rows));
+        }
+        let mut y = vec![0f32; t * n];
+        y.par_chunks_mut(n)
+            .zip(acc.par_chunks(n))
+            .zip(s_a.par_iter())
+            .for_each(|((yr, ar), &s)| {
+                for ((o, &a), &ws) in yr.iter_mut().zip(ar).zip(&row_scale) {
+                    *o = a as f32 / s * ws;
+                }
+            });
+        Ok(y)
+    }
+
+    /// Runs `tokens` (positions `cache.len ..`) through every layer, appending to `cache`.
+    /// Returns the final-norm hidden rows `[t][hidden]`; `taps` receives the residual stream
+    /// after each listed layer, `[t][hidden]`. On an error the cache is rolled back to where it
+    /// was, so it stays usable.
+    pub fn forward(
+        &self,
+        tokens: &[u32],
+        cache: &mut KvCache,
+        tap_layers: &[usize],
+        taps: &mut Vec<(usize, Vec<f32>)>,
+    ) -> Result<Vec<f32>, String> {
+        let len = cache.len;
+        let r = self.forward_inner(tokens, cache, tap_layers, taps);
+        if r.is_err() {
+            cache.truncate(len, self.config().kv_dim());
+        }
+        r
+    }
+
+    fn forward_inner(
+        &self,
+        tokens: &[u32],
+        cache: &mut KvCache,
+        tap_layers: &[usize],
+        taps: &mut Vec<(usize, Vec<f32>)>,
+    ) -> Result<Vec<f32>, String> {
+        let c = self.config();
+        let (h, qd, kvd, hd, eps) = (c.hidden, c.q_dim(), c.kv_dim(), c.head_dim, c.rms_eps);
+        let t = tokens.len();
+        if t == 0 {
+            return Err("forward of no tokens".into());
+        }
+        let pos0 = cache.len;
+        if pos0 + t > c.max_position {
+            return Err(format!(
+                "positions {pos0}..{} beyond max_position {}",
+                pos0 + t,
+                c.max_position
+            ));
+        }
+        let mut x = Vec::with_capacity(t * h);
+        for &tok in tokens {
+            x.extend(self.w.embed_row(tok)?);
+        }
+        let tables: Vec<Vec<(f32, f32)>> = (0..t)
+            .map(|i| rope_table(pos0 + i, hd, f64::from(c.rope_theta)))
+            .collect();
+
+        for (li, layer) in self.w.layers.iter().enumerate() {
+            // Attention.
+            let a = rms_norm_rows(&x, &layer.input_norm, eps);
+            let qkv = self.bit_linear(layer.qkv.as_ref(), &a, t)?;
+            let n_qkv = qd + 2 * kvd;
+            let mut q = vec![0f32; t * qd];
+            for i in 0..t {
+                let row = &qkv[i * n_qkv..(i + 1) * n_qkv];
+                q[i * qd..(i + 1) * qd].copy_from_slice(&row[..qd]);
+                for head in q[i * qd..(i + 1) * qd].chunks_exact_mut(hd) {
+                    rope_half_split(head, &tables[i]);
+                }
+                let mut k = row[qd..qd + kvd].to_vec();
+                for head in k.chunks_exact_mut(hd) {
+                    rope_half_split(head, &tables[i]);
+                }
+                cache.k[li].extend_from_slice(&k);
+                cache.v[li].extend_from_slice(&row[qd + kvd..]);
+            }
+            let att = attend(c, &q, &cache.k[li], &cache.v[li], pos0);
+            let o = match self.variant {
+                Variant::SubNormAfterO => {
+                    let y = self.bit_linear(layer.o.as_ref(), &att, t)?;
+                    rms_norm_rows(&y, &layer.attn_sub_norm, eps)
+                }
+                Variant::SkipSubNorms => self.bit_linear(layer.o.as_ref(), &att, t)?,
+                _ => {
+                    let n = rms_norm_rows(&att, &layer.attn_sub_norm, eps);
+                    self.bit_linear(layer.o.as_ref(), &n, t)?
+                }
+            };
+            for (xv, ov) in x.iter_mut().zip(&o) {
+                *xv += ov;
+            }
+
+            // Feed-forward.
+            let f = rms_norm_rows(&x, &layer.post_norm, eps);
+            let gu = self.bit_linear(layer.gate_up.as_ref(), &f, t)?;
+            let im = c.intermediate;
+            let mut inner = vec![0f32; t * im];
+            for i in 0..t {
+                let row = &gu[i * 2 * im..(i + 1) * 2 * im];
+                let (g, u) = row.split_at(im);
+                for ((o, &gv), &uv) in inner[i * im..(i + 1) * im].iter_mut().zip(g).zip(u) {
+                    let r = gv.max(0.0);
+                    *o = r * r * uv;
+                }
+            }
+            let inner = match self.variant {
+                Variant::SkipSubNorms => inner,
+                _ => rms_norm_rows(&inner, &layer.ffn_sub_norm, eps),
+            };
+            let d = self.bit_linear(layer.down.as_ref(), &inner, t)?;
+            for (xv, dv) in x.iter_mut().zip(&d) {
+                *xv += dv;
+            }
+            if tap_layers.contains(&li) {
+                taps.push((li, x.clone()));
+            }
+        }
+        cache.len += t;
+        Ok(rms_norm_rows(&x, &self.w.final_norm, eps))
+    }
+
+    /// Logits `[t][vocab]` of final-norm rows, with the tied 16-bit table (exact in f32).
+    pub fn logits(&self, normed: &[f32]) -> Vec<f32> {
+        let c = self.config();
+        let (h, vocab) = (c.hidden, c.vocab);
+        let t = normed.len() / h;
+        if t == 0 {
+            return Vec::new();
+        }
+        const ROWS: usize = 64;
+        let blocks: Vec<Vec<f32>> = self
+            .embed
+            .par_chunks(ROWS * h)
+            .map(|rows| {
+                let nr = rows.len() / h;
+                let mut out = vec![0f32; nr * t];
+                for (r, row) in rows.chunks_exact(h).enumerate() {
+                    for i in 0..t {
+                        out[r * t + i] = dot_f32(row, &normed[i * h..(i + 1) * h]);
+                    }
+                }
+                out
+            })
+            .collect();
+        let mut logits = vec![0f32; t * vocab];
+        for (b, out) in blocks.iter().enumerate() {
+            for r in 0..out.len() / t {
+                for i in 0..t {
+                    logits[i * vocab + b * ROWS + r] = out[r * t + i];
+                }
+            }
+        }
+        logits
+    }
+
+    /// Teacher-forced negative log-likelihoods (natural log, f64): row `i` of `normed`
+    /// predicts `targets[i]`. Done in chunks so the logits never exceed 64 rows.
+    pub fn nll(&self, normed: &[f32], targets: &[u32]) -> Result<Vec<f64>, String> {
+        let (h, vocab) = (self.config().hidden, self.config().vocab);
+        if normed.len() != targets.len() * h {
+            return Err(format!(
+                "{} hidden rows for {} targets",
+                normed.len() / h,
+                targets.len()
+            ));
+        }
+        let mut out = Vec::with_capacity(targets.len());
+        for (rows, tg) in normed.chunks(64 * h).zip(targets.chunks(64)) {
+            let lg = self.logits(rows);
+            for (l, &tgt) in lg.chunks_exact(vocab).zip(tg) {
+                if tgt as usize >= vocab {
+                    return Err(format!("target {tgt} outside the vocabulary"));
+                }
+                out.push(log_sum_exp(l) - l[tgt as usize] as f64);
+            }
+        }
+        Ok(out)
+    }
+}
+
+/// `ln(sum exp(l))` in f64.
+pub fn log_sum_exp(l: &[f32]) -> f64 {
+    let m = l.iter().fold(f32::NEG_INFINITY, |a, &b| a.max(b)) as f64;
+    m + l.iter().map(|&v| (v as f64 - m).exp()).sum::<f64>().ln()
+}
+
+/// The highest logit, lowest id on a tie.
+pub fn argmax(l: &[f32]) -> u32 {
+    let mut best = 0;
+    for (i, &v) in l.iter().enumerate() {
+        if v > l[best] {
+            best = i;
+        }
+    }
+    best as u32
+}
+
+#[cfg(test)]
+mod tests;
diff --git a/crates/aien-inference-abi/src/bitnet_forward/tests.rs b/crates/aien-inference-abi/src/bitnet_forward/tests.rs
new file mode 100644
index 00000000..6126b5c1
--- /dev/null
+++ b/crates/aien-inference-abi/src/bitnet_forward/tests.rs
@@ -0,0 +1,286 @@
+use super::*;
+use crate::bitnet_omega::test_support::{memory_source, tiny_config};
+use crate::bitnet_omega::{load_bitnet_omega_from, pack_trits, HostTernMatrix};
+use crate::qwen3_moe::f32_to_bf16;
+use crate::qwen3_moe_omega::test_support::prand;
+
+fn tiny() -> BitNetOmegaWeights {
+    let c = tiny_config();
+    load_bitnet_omega_from(&c, &mut memory_source(&c), &HostRefUploader, &mut |_| {})
+        .unwrap()
+        .0
+}
+
+fn tokens() -> Vec<u32> {
+    vec![1, 17, 200, 45, 45, 3, 99, 128, 7]
+}
+
+fn max_rel(a: &[f32], b: &[f32]) -> f32 {
+    let scale = a.iter().fold(0f32, |m, v| m.max(v.abs())).max(1e-12);
+    a.iter().zip(b).fold(0f32, |m, (x, y)| m.max((x - y).abs())) / scale
+}
+
+#[test]
+fn batched_ternary_product_equals_the_packed_gemv() {
+    let (n, k, t) = (70, 96, 5);
+    let trits: Vec<i8> = (0..n * k)
+        .map(|i| (prand(3, i) * 3.0).floor().clamp(-1.0, 1.0) as i8)
+        .collect();
+    let mut words = vec![0u32; n * k / TRITS_PER_WORD];
+    pack_trits(&trits, k, &mut words).unwrap();
+    let seg = [TernSegment {
+        part: TernPart::O,
+        rows: n,
+        scale_bf16: f32_to_bf16(1.0),
+    }];
+    let packed = HostTernMatrix::new(n, k, words.clone(), seg.to_vec()).unwrap();
+    let ours = I8TernMatrix::from_words(n, k, &words, &seg).unwrap();
+    let x: Vec<i8> = (0..t * k)
+        .map(|i| (prand(5, i) * 256.0).clamp(-128.0, 127.0) as i8)
+        .collect();
+    let mut acc = vec![0i32; t * n];
+    ours.gemm(&x, t, &mut acc).unwrap();
+    for i in 0..t {
+        let mut want = vec![0i32; n];
+        packed.gemv_i8(&x[i * k..(i + 1) * k], &mut want).unwrap();
+        assert_eq!(acc[i * n..(i + 1) * n], want, "token {i}");
+    }
+    assert!(ours.gemm(&x, t + 1, &mut acc).is_err());
+}
+
+#[test]
+fn activation_quant_rounds_half_to_even_per_token() {
+    let mut q = [0i8; 6];
+    let s = quant_act(&[127.0, 0.5, 1.5, -0.5, 2.5, -127.0], &mut q);
+    assert_eq!(s, 1.0);
+    assert_eq!(q, [127, 0, 2, 0, 2, -127]);
+    let s = quant_act(&[0.0; 6], &mut q);
+    assert_eq!((s, q), (127.0 / 1e-5, [0; 6]));
+}
+
+#[test]
+fn rope_is_half_split_and_starts_at_position_zero() {
+    let mut v = vec![0f32; 128];
+    v[0] = 1.0;
+    let at0 = v.clone();
+    rope_half_split(&mut v, &rope_table(0, 128, 500000.0));
+    assert_eq!(v, at0);
+    rope_half_split(&mut v, &rope_table(1, 128, 500000.0));
+    // Dim 0 pairs with dim 64 at frequency 1: (cos 1, sin 1); nothing else moves.
+    assert!((v[0] - 1f32.cos()).abs() < 1e-7 && (v[64] - 1f32.sin()).abs() < 1e-7);
+    assert!(v
+        .iter()
+        .enumerate()
+        .all(|(i, &x)| i == 0 || i == 64 || x == 0.0));
+    // The last pair turns at 500000^(-126/128) radians per position.
+    let t = rope_table(1000, 128, 500000.0);
+    let want = 1000.0 * 500000f64.powf(-126.0 / 128.0);
+    assert!((t[63].1 as f64 - want.sin()).abs() < 1e-7);
+}
+
+#[test]
+fn rms_norm_is_weighted_x_over_root_mean_square() {
+    let mut out = [0f32; 4];
+    rms_norm(&[3.0, -4.0, 0.0, 0.0], &[1.0, 2.0, 1.0, 1.0], 0.0, &mut out);
+    // mean square 25/4, root 2.5.
+    assert_eq!(out, [1.2, -3.2, 0.0, 0.0]);
+}
+
+#[test]
+fn kv_cache_decode_equals_the_whole_prefill_bit_for_bit() {
+    let w = tiny();
+    let f = HostBitNetForward::new(&w);
+    let toks = tokens();
+    let mut whole = KvCache::new(&w.config);
+    let all = f.forward(&toks, &mut whole, &[], &mut Vec::new()).unwrap();
+    let mut step = KvCache::new(&w.config);
+    let mut rows = f
+        .forward(&toks[..4], &mut step, &[], &mut Vec::new())
+        .unwrap();
+    for &t in &toks[4..] {
+        rows.extend(f.forward(&[t], &mut step, &[], &mut Vec::new()).unwrap());
+    }
+    assert_eq!(step.len, toks.len());
+    assert_eq!(all, rows);
+}
+
+#[test]
+fn taps_are_the_residual_stream_after_each_listed_layer() {
+    let w = tiny();
+    let f = HostBitNetForward::new(&w);
+    let mut taps = Vec::new();
+    let fin = f
+        .forward(&tokens(), &mut KvCache::new(&w.config), &[0, 1], &mut taps)
+        .unwrap();
+    assert_eq!(taps.iter().map(|t| t.0).collect::<Vec<_>>(), [0, 1]);
+    let h = w.config.hidden;
+    assert!(taps.iter().all(|t| t.1.len() == tokens().len() * h));
+    let mut normed = vec![0f32; fin.len()];
+    for (o, x) in normed.chunks_mut(h).zip(taps[1].1.chunks(h)) {
+        rms_norm(x, &w.final_norm, w.config.rms_eps, o);
+    }
+    assert_eq!(normed, fin);
+}
+
+#[test]
+fn variants_change_the_output_except_the_vacuous_q_k_swap() {
+    let w = tiny();
+    let run = |v: Variant| {
+        let mut f = HostBitNetForward::new(&w);
+        f.variant = v;
+        f.forward(
+            &tokens(),
+            &mut KvCache::new(&w.config),
+            &[],
+            &mut Vec::new(),
+        )
+        .unwrap()
+    };
+    let r = run(Variant::Reference);
+    for v in [
+        Variant::SubNormAfterO,
+        Variant::SkipSubNorms,
+        Variant::SwapQvScales,
+    ] {
+        assert!(max_rel(&r, &run(v)) > 1e-2, "{} left the output", v.name());
+    }
+    assert!(max_rel(&r, &run(Variant::SwapQkScales)) < 1e-4);
+}
+
+#[test]
+fn nll_is_log_softmax_of_the_tied_logits() {
+    let w = tiny();
+    let f = HostBitNetForward::new(&w);
+    let toks = tokens();
+    let fin = f
+        .forward(&toks, &mut KvCache::new(&w.config), &[], &mut Vec::new())
+        .unwrap();
+    let h = w.config.hidden;
+    let targets = &toks[1..];
+    let nll = f.nll(&fin[..targets.len() * h], targets).unwrap();
+    let lg = f.logits(&fin);
+    let vocab = w.config.vocab;
+    for (i, &tg) in targets.iter().enumerate() {
+        let row = &lg[i * vocab..(i + 1) * vocab];
+        let e = &w.embed_row(tg).unwrap();
+        let direct: f64 = e
+            .iter()
+            .zip(&fin[i * h..(i + 1) * h])
+            .map(|(&a, &b)| a as f64 * b as f64)
+            .sum();
+        assert!((row[tg as usize] as f64 - direct).abs() < 1e-4);
+        let want = log_sum_exp(row) - row[tg as usize] as f64;
+        assert_eq!(nll[i], want);
+        assert!(nll[i] > 0.0);
+    }
+    assert!(f.nll(&fin, targets).is_err());
+    assert_eq!(argmax(&[1.0, 3.0, 3.0, 2.0]), 1);
+}
+
+#[test]
+fn attention_equals_a_naive_masked_loop() {
+    // tiny_config: 4 query heads over 2 kv heads of 64, so heads 0,1 read kv 0 and 2,3 read kv 1.
+    let c = tiny_config();
+    let (qd, kvd, hd) = (c.q_dim(), c.kv_dim(), c.head_dim);
+    let (pos0, t) = (3, 4);
+    let q: Vec<f32> = (0..t * qd).map(|i| prand(11, i) * 4.0 - 2.0).collect();
+    let k: Vec<f32> = (0..(pos0 + t) * kvd)
+        .map(|i| prand(12, i) * 4.0 - 2.0)
+        .collect();
+    let v: Vec<f32> = (0..(pos0 + t) * kvd)
+        .map(|i| prand(13, i) * 4.0 - 2.0)
+        .collect();
+    let got = attend(&c, &q, &k, &v, pos0);
+    for i in 0..t {
+        for head in 0..c.q_heads {
+            let kvh = [0, 0, 1, 1][head];
+            let mut w = vec![0f64; pos0 + t];
+            for (j, wj) in w.iter_mut().enumerate() {
+                if j > pos0 + i {
+                    *wj = f64::NEG_INFINITY; // causal mask
+                    continue;
+                }
+                let s: f64 = (0..hd)
+                    .map(|d| q[i * qd + head * hd + d] as f64 * k[j * kvd + kvh * hd + d] as f64)
+                    .sum();
+                *wj = s / 8.0; // sqrt(64)
+            }
+            let m = w.iter().cloned().fold(f64::NEG_INFINITY, f64::max);
+            let z: f64 = w.iter().map(|&x| (x - m).exp()).sum();
+            for d in 0..hd {
+                let want: f64 = (0..pos0 + t)
+                    .map(|j| (w[j] - m).exp() / z * v[j * kvd + kvh * hd + d] as f64)
+                    .sum();
+                let g = got[i * qd + head * hd + d] as f64;
+                assert!(
+                    (g - want).abs() < 1e-5,
+                    "token {i} head {head} dim {d}: {g} vs {want}"
+                );
+            }
+        }
+    }
+}
+
+#[test]
+fn bit_linear_scales_each_segment_by_its_own_scale() {
+    let w = tiny();
+    let f = HostBitNetForward::new(&w);
+    let m = w.layers[0].qkv.as_ref();
+    let (n, k) = (m.n(), m.k());
+    let x: Vec<f32> = (0..2 * k).map(|i| prand(21, i) * 2.0 - 1.0).collect();
+    let y = f.bit_linear(m, &x, 2).unwrap();
+    let mut row_scale = Vec::new();
+    for s in m.segments() {
+        row_scale.extend(std::iter::repeat_n(bf16_to_f32(s.scale_bf16), s.rows));
+    }
+    let scales: Vec<f32> = m
+        .segments()
+        .iter()
+        .map(|s| bf16_to_f32(s.scale_bf16))
+        .collect();
+    assert!(
+        scales.windows(2).any(|p| p[0] != p[1]),
+        "tiny q/k/v scales all equal"
+    );
+    for i in 0..2 {
+        let mut q = vec![0i8; k];
+        let s_a = quant_act(&x[i * k..(i + 1) * k], &mut q);
+        let mut acc = vec![0i32; n];
+        m.gemv_i8(&q, &mut acc).unwrap();
+        for r in 0..n {
+            assert_eq!(
+                y[i * n + r],
+                acc[r] as f32 / s_a * row_scale[r],
+                "token {i} row {r}"
+            );
+        }
+    }
+}
+
+#[test]
+fn a_failed_forward_leaves_the_cache_where_it_was() {
+    let w = tiny();
+    let f = HostBitNetForward::new(&w);
+    let mut cache = KvCache::new(&w.config);
+    f.forward(&tokens()[..4], &mut cache, &[], &mut Vec::new())
+        .unwrap();
+    cache.truncate(3, w.config.kv_dim());
+    let before = cache.clone();
+    // Token 999 is outside the 256-token vocabulary.
+    assert!(f
+        .forward(&[5, 999], &mut cache, &[], &mut Vec::new())
+        .is_err());
+    assert_eq!(
+        (cache.len, &cache.k, &cache.v),
+        (before.len, &before.k, &before.v)
+    );
+    let mut whole = KvCache::new(&w.config);
+    let all = f
+        .forward(&tokens()[..4], &mut whole, &[], &mut Vec::new())
+        .unwrap();
+    let last = f
+        .forward(&tokens()[3..4], &mut cache, &[], &mut Vec::new())
+        .unwrap();
+    assert_eq!(all[3 * w.config.hidden..], last[..]);
+    assert!(f.logits(&[]).is_empty());
+}
diff --git a/crates/aien-inference-abi/src/bitnet_omega.rs b/crates/aien-inference-abi/src/bitnet_omega.rs
index 6927fcbf..37b6bdb9 100644
--- a/crates/aien-inference-abi/src/bitnet_omega.rs
+++ b/crates/aien-inference-abi/src/bitnet_omega.rs
@@ -826,6 +826,22 @@ pub trait TernMatrix: Send + Sync + std::fmt::Debug {
     fn k(&self) -> usize;
     fn segments(&self) -> &[TernSegment];
     fn gemv_i8(&self, x: &[i8], acc: &mut [i32]) -> Result<(), String>;
+
+    /// The same product for `t` tokens: `x` is `[t][k]`, `acc` is `[t][n]`.
+    fn gemm_i8(&self, x: &[i8], t: usize, acc: &mut [i32]) -> Result<(), String> {
+        let (n, k) = (self.n(), self.k());
+        if x.len() != t * k || acc.len() != t * n {
+            return Err(format!(
+                "ternary gemm [{n}][{k}] for {t} tokens given x {} acc {}",
+                x.len(),
+                acc.len()
+            ));
+        }
+        for (xr, ar) in x.chunks_exact(k).zip(acc.chunks_exact_mut(n)) {
+            self.gemv_i8(xr, ar)?;
+        }
+        Ok(())
+    }
 }
 
 /// Makes packed ternary matrices and the e4m3 word table resident. The real one (omega's KT1
diff --git a/crates/aien-inference-abi/src/bitnet_tokenizer.rs b/crates/aien-inference-abi/src/bitnet_tokenizer.rs
new file mode 100644
index 00000000..3a5b30cf
--- /dev/null
+++ b/crates/aien-inference-abi/src/bitnet_tokenizer.rs
@@ -0,0 +1,648 @@
+//! Our own tokenizer for BitNet b1.58 2B-4T (stage T2): the LLaMA-3 byte-level BPE read from the
+//! checkpoint's `tokenizer.json`, with no tokenizer library in the path.
+//!
+//! What it implements, and where each rule comes from (spec section 4):
+//! - Special tokens are cut out of the text first (the 256 `added_tokens`, all `special`,
+//!   `normalized: false`), longest match at the leftmost position.
+//! - The pre-tokenizer splits with the LLaMA-3 pattern (`tokenizer.json` pre_tokenizer, and
+//!   `REF/tokenizer.py:43`), here a hand-written scanner that follows the regex's leftmost,
+//!   first-alternative, greedy-with-backtracking semantics exactly:
+//!   `(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\r\n\p{L}\p{N}]?\p{L}+|\p{N}{1,3}| ?[^\s\p{L}\p{N}]+[\r\n]*|\s*[\r\n]+|\s+(?!\S)|\s+`.
+//!   `\p{L}`, `\p{N}`, `\s` and the case folds come from the Unicode tables of `regex-syntax`
+//!   (data only; no regex engine runs).
+//! - Each piece's UTF-8 bytes map to the GPT-2 byte alphabet; `ignore_merges: true` means a
+//!   piece that is itself a vocabulary entry is one token; otherwise BPE merges the adjacent pair
+//!   of lowest merge rank, leftmost first, until none applies.
+//! - BOS 128000 is prepended when asked (the `TemplateProcessing` post-processor).
+
+use std::collections::HashMap;
+use std::path::Path;
+
+use regex_syntax::hir::{Class, HirKind};
+
+/// The split pattern this scanner implements; any other pattern is refused.
+pub const LLAMA3_SPLIT_PATTERN: &str = r"(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\r\n\p{L}\p{N}]?\p{L}+|\p{N}{1,3}| ?[^\s\p{L}\p{N}]+[\r\n]*|\s*[\r\n]+|\s+(?!\S)|\s+";
+
+/// The contractions of the first alternative, in pattern order.
+const CONTRACTIONS: [&str; 7] = ["s", "t", "re", "ve", "m", "ll", "d"];
+
+/// A sorted, disjoint set of inclusive char ranges.
+#[derive(Debug, Clone)]
+struct CharSet(Vec<(char, char)>);
+
+impl CharSet {
+    fn from_class(pattern: &str) -> Result<Self, String> {
+        let hir = regex_syntax::parse(pattern).map_err(|e| format!("class {pattern}: {e}"))?;
+        match hir.kind() {
+            HirKind::Class(Class::Unicode(c)) => Ok(Self(
+                c.ranges().iter().map(|r| (r.start(), r.end())).collect(),
+            )),
+            HirKind::Literal(_) => {
+                let c = pattern
+                    .chars()
+                    .last()
+                    .ok_or_else(|| format!("class {pattern}: empty"))?;
+                Ok(Self(vec![(c, c)]))
+            }
+            other => Err(format!(
+                "class {pattern}: not a character class ({other:?})"
+            )),
+        }
+    }
+
+    fn contains(&self, c: char) -> bool {
+        self.0
+            .binary_search_by(|&(lo, hi)| {
+                if hi < c {
+                    std::cmp::Ordering::Less
+                } else if lo > c {
+                    std::cmp::Ordering::Greater
+                } else {
+                    std::cmp::Ordering::Equal
+                }
+            })
+            .is_ok()
+    }
+}
+
+/// The character classes of the split pattern.
+#[derive(Debug, Clone)]
+struct Classes {
+    letter: CharSet,
+    number: CharSet,
+    space: CharSet,
+    /// Case-insensitive sets for the contraction letters, keyed by the lowercase ASCII letter.
+    folds: Vec<(char, CharSet)>,
+}
+
+impl Classes {
+    fn new() -> Result<Self, String> {
+        let mut folds = Vec::new();
+        for c in "strevmld".chars() {
+            folds.push((c, CharSet::from_class(&format!("(?i:{c})"))?));
+        }
+        Ok(Self {
+            letter: CharSet::from_class(r"\p{L}")?,
+            number: CharSet::from_class(r"\p{N}")?,
+            space: CharSet::from_class(r"\s")?,
+            folds,
+        })
+    }
+
+    fn l(&self, c: char) -> bool {
+        if c.is_ascii() {
+            c.is_ascii_alphabetic()
+        } else {
+            self.letter.contains(c)
+        }
+    }
+
+    fn n(&self, c: char) -> bool {
+        if c.is_ascii() {
+            c.is_ascii_digit()
+        } else {
+            self.number.contains(c)
+        }
+    }
+
+    fn s(&self, c: char) -> bool {
+        self.space.contains(c)
+    }
+
+    /// `[^\s\p{L}\p{N}]`
+    fn other(&self, c: char) -> bool {
+        !self.s(c) && !self.l(c) && !self.n(c)
+    }
+
+    fn folds_to(&self, c: char, lower: char) -> bool {
+        self.folds
+            .iter()
+            .find(|(k, _)| *k == lower)
+            .is_some_and(|(_, set)| set.contains(c))
+    }
+}
+
+/// Splits `text` into pre-tokens with the LLaMA-3 pattern; returns char-index ranges.
+fn split_pieces(cl: &Classes, chars: &[char]) -> Vec<(usize, usize)> {
+    let n = chars.len();
+    let at = |i: usize| chars.get(i).copied();
+    let mut out = Vec::new();
+    let mut i = 0;
+    while i < n {
+        let c = chars[i];
+        let run = |from: usize, f: &dyn Fn(char) -> bool| {
+            let mut e = from;
+            while e < n && f(chars[e]) {
+                e += 1;
+            }
+            e
+        };
+        // 1. (?i:'s|'t|'re|'ve|'m|'ll|'d)
+        let alt1 = (c == '\'')
+            .then(|| {
+                CONTRACTIONS.iter().find_map(|w| {
+                    let ok = w
+                        .chars()
+                        .enumerate()
+                        .all(|(j, lc)| at(i + 1 + j).is_some_and(|x| cl.folds_to(x, lc)));
+                    ok.then_some(i + 1 + w.len())
+                })
+            })
+            .flatten();
+        // 2. [^\r\n\p{L}\p{N}]?\p{L}+
+        let alt2 = || {
+            if cl.l(c) {
+                Some(run(i, &|x| cl.l(x)))
+            } else if c != '\r' && c != '\n' && !cl.n(c) && at(i + 1).is_some_and(|x| cl.l(x)) {
+                Some(run(i + 1, &|x| cl.l(x)))
+            } else {
+                None
+            }
+        };
+        // 3. \p{N}{1,3}
+        let alt3 = || {
+            cl.n(c).then(|| {
+                let mut e = i;
+                while e < n && e < i + 3 && cl.n(chars[e]) {
+                    e += 1;
+                }
+                e
+            })
+        };
+        // 4. ' ?[^\s\p{L}\p{N}]+[\r\n]*'
+        let alt4 = || {
+            let start = if c == ' ' && at(i + 1).is_some_and(|x| cl.other(x)) {
+                i + 1
+            } else if cl.other(c) {
+                i
+            } else {
+                return None;
+            };
+            let e = run(start, &|x| cl.other(x));
+            Some(run(e, &|x| x == '\r' || x == '\n'))
+        };
+        // 5-7 start on whitespace; `e` is the end of the whitespace run.
+        let ws = || {
+            if !cl.s(c) {
+                return None;
+            }
+            let e = run(i, &|x| cl.s(x));
+            // 5. \s*[\r\n]+ : greedy \s* backs off to the last newline of the run, and the
+            //    newline run from there ends at the next non-newline.
+            if let Some(last) = (i..e).rev().find(|&j| chars[j] == '\r' || chars[j] == '\n') {
+                return Some(last + 1);
+            }
+            // 6. \s+(?!\S) : the whole run at the end of text, else all but its last char.
+            if e == n {
+                return Some(e);
+            }
+            if e - i >= 2 {
+                return Some(e - 1);
+            }
+            // 7. \s+
+            Some(e)
+        };
+        let end = alt1
+            .or_else(alt2)
+            .or_else(alt3)
+            .or_else(alt4)
+            .or_else(ws)
+            // Every char is a letter, number, whitespace or other, so one alternative matched.
+            .unwrap_or(i + 1);
+        out.push((i, end));
+        i = end;
+    }
+    out
+}
+
+/// GPT-2's byte-to-char alphabet: printable bytes stand for themselves, the rest move to 256+.
+fn byte_alphabet() -> [char; 256] {
+    let mut map = ['\0'; 256];
+    let mut next = 256u32;
+    for b in 0..256u32 {
+        let printable =
+            (33..=126).contains(&b) || (161..=172).contains(&b) || (174..=255).contains(&b);
+        let cp = if printable {
+            b
+        } else {
+            let v = next;
+            next += 1;
+            v
+        };
+        map[b as usize] = char::from_u32(cp).expect("alphabet char");
+    }
+    map
+}
+
+/// The BitNet 2B-4T tokenizer, built from `tokenizer.json`.
+#[derive(Debug, Clone)]
+pub struct BitNetTokenizer {
+    classes: Classes,
+    /// Base vocabulary keyed by raw bytes.
+    vocab: HashMap<Vec<u8>, u32>,
+    /// `(left, right) -> (rank, merged)`.
+    merges: HashMap<(u32, u32), (u32, u32)>,
+    /// Every id's bytes (specials as their UTF-8 text), for decoding.
+    id_bytes: Vec<Vec<u8>>,
+    /// Special tokens by text, longest first.
+    specials: Vec<(String, u32)>,
+    byte_id: [u32; 256],
+    pub bos: u32,
+}
+
+impl BitNetTokenizer {
+    pub fn from_file(path: &Path) -> Result<Self, String> {
+        let text = std::fs::read_to_string(path).map_err(|e| format!("{}: {e}", path.display()))?;
+        Self::from_json(&text)
+    }
+
+    /// Reads `tokenizer.json`; every setting this scanner does not implement is refused by name.
+    pub fn from_json(text: &str) -> Result<Self, String> {
+        let j: serde_json::Value =
+            serde_json::from_str(text).map_err(|e| format!("tokenizer.json: {e}"))?;
+        if !j["normalizer"].is_null() {
+            return Err("tokenizer.json: a normalizer is set (none is implemented)".into());
+        }
+        let m = &j["model"];
+        let want = |k: &str, v: serde_json::Value| -> Result<(), String> {
+            if m[k] != v {
+                return Err(format!("tokenizer.json: model.{k} is {}, need {v}", m[k]));
+            }
+            Ok(())
+        };
+        want("type", "BPE".into())?;
+        want("ignore_merges", true.into())?;
+        want("byte_fallback", false.into())?;
+        want("dropout", serde_json::Value::Null)?;
+        want("continuing_subword_prefix", serde_json::Value::Null)?;
+        want("end_of_word_suffix", serde_json::Value::Null)?;
+        let pre = &j["pre_tokenizer"];
+        let parts = pre["pretokenizers"].as_array();
+        let ok_pre = pre["type"] == "Sequence"
+            && parts.is_some_and(|p| {
+                p.len() == 2
+                    && p[0]["type"] == "Split"
+                    && p[0]["pattern"]["Regex"] == LLAMA3_SPLIT_PATTERN
+                    && p[0]["behavior"] == "Isolated"
+                    && p[0]["invert"] == false
+                    && p[1]["type"] == "ByteLevel"
+                    && p[1]["add_prefix_space"] == false
+                    && p[1]["use_regex"] == false
+            });
+        if !ok_pre {
+            return Err(
+                "tokenizer.json: pre_tokenizer is not the LLaMA-3 split then ByteLevel".into(),
+            );
+        }
+
+        let alphabet = byte_alphabet();
+        let mut unmap = HashMap::new();
+        for (b, &c) in alphabet.iter().enumerate() {
+            unmap.insert(c, b as u8);
+        }
+        let to_bytes = |s: &str| -> Result<Vec<u8>, String> {
+            s.chars()
+                .map(|c| {
+                    unmap.get(&c).copied().ok_or_else(|| {
+                        format!("vocab entry {s:?}: char {c:?} not in the byte alphabet")
+                    })
+                })
+                .collect()
+        };
+
+        let vocab_json = m["vocab"]
+            .as_object()
+            .ok_or("tokenizer.json: model.vocab is not an object")?;
+        let mut vocab = HashMap::with_capacity(vocab_json.len());
+        let mut id_bytes: Vec<Option<Vec<u8>>> = Vec::new();
+        for (s, id) in vocab_json {
+            let id = id
+                .as_u64()
+                .and_then(|v| u32::try_from(v).ok())
+                .ok_or_else(|| format!("vocab entry {s:?}: id {id} is not a token id"))?;
+            let bytes = to_bytes(s)?;
+            if vocab.insert(bytes.clone(), id).is_some() {
+                return Err(format!("vocab entry {s:?}: duplicate bytes"));
+            }
+            if id_bytes.len() <= id as usize {
+                id_bytes.resize(id as usize + 1, None);
+            }
+            if id_bytes[id as usize].replace(bytes).is_some() {
+                return Err(format!("vocab id {id} used twice"));
+            }
+        }
+        let mut byte_id = [0u32; 256];
+        for b in 0..=255u8 {
+            byte_id[b as usize] = *vocab
+                .get(&vec![b])
+                .ok_or_else(|| format!("byte {b} has no vocabulary entry"))?;
+        }
+
+        let mut specials = Vec::new();
+        for t in j["added_tokens"]
+            .as_array()
+            .ok_or("tokenizer.json: added_tokens is not a list")?
+        {
+            let id = t["id"]
+                .as_u64()
+                .and_then(|v| u32::try_from(v).ok())
+                .ok_or_else(|| format!("added token {t}: no id"))?;
+            let content = t["content"]
+                .as_str()
+                .ok_or_else(|| format!("added token {id}: no content"))?;
+            if t["special"] != true
+                || t["normalized"] != false
+                || t["lstrip"] != false
+                || t["rstrip"] != false
+                || t["single_word"] != false
+                || !content.starts_with("<|")
+            {
+                return Err(format!(
+                    "added token {id} {content:?}: only plain special tokens starting with <| are implemented"
+                ));
+            }
+            if id_bytes.len() <= id as usize {
+                id_bytes.resize(id as usize + 1, None);
+            }
+            if id_bytes[id as usize]
+                .replace(content.as_bytes().to_vec())
+                .is_some()
+            {
+                return Err(format!("added token {id} {content:?} reuses an id"));
+            }
+            specials.push((content.to_string(), id));
+        }
+        specials.sort_by_key(|(s, _)| std::cmp::Reverse(s.len()));
+        let id_bytes = id_bytes
+            .into_iter()
+            .enumerate()
+            .map(|(i, b)| b.ok_or_else(|| format!("token id {i} is missing")))
+            .collect::<Result<Vec<_>, _>>()?;
+
+        let merges_json = m["merges"]
+            .as_array()
+            .ok_or("tokenizer.json: model.merges is not a list")?;
+        let mut merges = HashMap::with_capacity(merges_json.len());
+        for (rank, mj) in merges_json.iter().enumerate() {
+            let (a, b) = match mj {
+                serde_json::Value::String(s) => s
+                    .split_once(' ')
+                    .ok_or_else(|| format!("merge {rank} {s:?}: no space"))?,
+                serde_json::Value::Array(p) if p.len() == 2 => (
+                    p[0].as_str()
+                        .ok_or_else(|| format!("merge {rank}: not text"))?,
+                    p[1].as_str()
+                        .ok_or_else(|| format!("merge {rank}: not text"))?,
+                ),
+                other => return Err(format!("merge {rank}: {other} is not a pair")),
+            };
+            let (ba, bb) = (to_bytes(a)?, to_bytes(b)?);
+            let id = |x: &Vec<u8>| {
+                vocab.get(x).copied().ok_or_else(|| {
+                    format!("merge {rank} {a:?} {b:?}: a side is not in the vocabulary")
+                })
+            };
+            let joined = [ba.as_slice(), bb.as_slice()].concat();
+            let key = (id(&ba)?, id(&bb)?);
+            let merged = id(&joined)?;
+            merges.entry(key).or_insert((rank as u32, merged));
+        }
+
+        let bos = j["post_processor"]["processors"]
+            .as_array()
+            .and_then(|ps| {
+                ps.iter()
+                    .find(|p| p["type"] == "TemplateProcessing")
+                    .and_then(|p| p["special_tokens"]["<|begin_of_text|>"]["ids"][0].as_u64())
+            })
+            .and_then(|v| u32::try_from(v).ok())
+            .ok_or("tokenizer.json: no <|begin_of_text|> in the template post-processor")?;
+
+        Ok(Self {
+            classes: Classes::new()?,
+            vocab,
+            merges,
+            id_bytes,
+            specials,
+            byte_id,
+            bos,
+        })
+    }
+
+    /// Vocabulary size including the special tokens.
+    pub fn vocab_len(&self) -> usize {
+        self.id_bytes.len()
+    }
+
+    /// Encodes `text`, BOS first when `bos`.
+    pub fn encode(&self, text: &str, bos: bool) -> Vec<u32> {
+        let mut out = Vec::new();
+        if bos {
+            out.push(self.bos);
+        }
+        let mut rest = text;
+        while !rest.is_empty() {
+            // Leftmost special token, longest at that position.
+            let found = rest.match_indices("<|").find_map(|(at, _)| {
+                self.specials
+                    .iter()
+                    .find(|(s, _)| rest[at..].starts_with(s.as_str()))
+                    .map(|(s, id)| (at, s.len(), *id))
+            });
+            match found {
+                Some((at, len, id)) => {
+                    self.encode_plain(&rest[..at], &mut out);
+                    out.push(id);
+                    rest = &rest[at + len..];
+                }
+                None => {
+                    self.encode_plain(rest, &mut out);
+                    rest = "";
+                }
+            }
+        }
+        out
+    }
+
+    fn encode_plain(&self, text: &str, out: &mut Vec<u32>) {
+        let chars: Vec<char> = text.chars().collect();
+        let mut buf = [0u8; 4];
+        for (a, b) in split_pieces(&self.classes, &chars) {
+            let mut bytes = Vec::new();
+            for &c in &chars[a..b] {
+                bytes.extend_from_slice(c.encode_utf8(&mut buf).as_bytes());
+            }
+            self.bpe(&bytes, out);
+        }
+    }
+
+    /// One pre-token: whole if it is a vocabulary entry (`ignore_merges`), else ranked merges.
+    fn bpe(&self, bytes: &[u8], out: &mut Vec<u32>) {
+        if let Some(&id) = self.vocab.get(bytes) {
+            out.push(id);
+            return;
+        }
+        let mut sym: Vec<u32> = bytes.iter().map(|&b| self.byte_id[b as usize]).collect();
+        loop {
+            let best = sym
+                .windows(2)
+                .enumerate()
+                .filter_map(|(p, w)| self.merges.get(&(w[0], w[1])).map(|&(r, m)| (r, p, m)))
+                .min_by_key(|&(r, p, _)| (r, p));
+            match best {
+                Some((_, p, m)) => {
+                    sym[p] = m;
+                    sym.remove(p + 1);
+                }
+                None => break,
+            }
+        }
+        out.extend_from_slice(&sym);
+    }
+
+    /// The text of `ids` (invalid UTF-8 replaced); an unknown id is refused.
+    pub fn decode(&self, ids: &[u32]) -> Result<String, String> {
+        let mut bytes = Vec::new();
+        for &id in ids {
+            bytes.extend_from_slice(
+                self.id_bytes
+                    .get(id as usize)
+                    .ok_or_else(|| format!("token id {id} outside the vocabulary"))?,
+            );
+        }
+        Ok(String::from_utf8_lossy(&bytes).into_owned())
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    fn pieces(text: &str) -> Vec<String> {
+        let cl = Classes::new().unwrap();
+        let chars: Vec<char> = text.chars().collect();
+        split_pieces(&cl, &chars)
+            .into_iter()
+            .map(|(a, b)| chars[a..b].iter().collect())
+            .collect()
+    }
+
+    #[test]
+    fn split_follows_the_llama3_pattern() {
+        assert_eq!(
+            pieces("The capital of France is"),
+            ["The", " capital", " of", " France", " is"]
+        );
+        assert_eq!(
+            pieces("Count from 6 to 10:"),
+            ["Count", " from", " ", "6", " to", " ", "10", ":"]
+        );
+        assert_eq!(pieces("12345"), ["123", "45"]);
+        assert_eq!(pieces("I'm, they'LL"), ["I", "'m", ",", " they", "'LL"]);
+        assert_eq!(pieces("x'ſ"), ["x", "'ſ"]);
+        assert_eq!(pieces("'xy"), ["'xy"]);
+        assert_eq!(pieces("a  b"), ["a", " ", " b"]);
+        assert_eq!(pieces("a \n\n b"), ["a", " \n\n", " b"]);
+        assert_eq!(pieces("a.\n\nB"), ["a", ".\n\n", "B"]);
+        assert_eq!(pieces("x   "), ["x", "   "]);
+        assert_eq!(pieces("x \t!"), ["x", " ", "\t", "!"]);
+        assert_eq!(pieces("x  !!"), ["x", " ", " !!"]);
+        assert_eq!(pieces("\tword"), ["\tword"]);
+        assert_eq!(pieces("über 3½"), ["über", " ", "3½"]);
+        assert_eq!(pieces("a\r\n \r\nb"), ["a", "\r\n \r\n", "b"]);
+        assert_eq!(
+            pieces("it'ſ \u{3000}x;  über-naïve 12345 ٣٤٥ 🙂🙂\u{200d} end  "),
+            [
+                "it",
+                "'ſ",
+                " ",
+                "\u{3000}x",
+                ";",
+                " ",
+                " über",
+                "-naïve",
+                " ",
+                "123",
+                "45",
+                " ",
+                "٣٤٥",
+                " 🙂🙂\u{200d}",
+                " end",
+                "  "
+            ]
+        );
+    }
+
+    #[test]
+    fn byte_alphabet_is_gpt2s() {
+        let a = byte_alphabet();
+        assert_eq!(a[b' ' as usize], 'Ġ');
+        assert_eq!(a[b'\n' as usize], 'Ċ');
+        assert_eq!(a[b'A' as usize], 'A');
+        assert_eq!(a[0xAD], char::from_u32(256 + 33 + 34).unwrap());
+        let mut seen: Vec<char> = a.to_vec();
+        seen.sort();
+        seen.dedup();
+        assert_eq!(seen.len(), 256);
+    }
+
+    /// A toy vocabulary: bytes plus "ab", "abc", "Ġab"; merges a b, ab c, Ġ ab.
+    fn toy() -> BitNetTokenizer {
+        let a = byte_alphabet();
+        let mut vocab = serde_json::Map::new();
+        for (b, c) in a.iter().enumerate() {
+            vocab.insert(c.to_string(), (b as u64).into());
+        }
+        vocab.insert("ab".into(), 256.into());
+        vocab.insert("abc".into(), 257.into());
+        vocab.insert("Ġab".into(), 258.into());
+        vocab.insert("bc".into(), 259.into());
+        let j = serde_json::json!({
+            "normalizer": null,
+            "pre_tokenizer": {"type": "Sequence", "pretokenizers": [
+                {"type": "Split", "pattern": {"Regex": LLAMA3_SPLIT_PATTERN}, "behavior": "Isolated", "invert": false},
+                {"type": "ByteLevel", "add_prefix_space": false, "trim_offsets": true, "use_regex": false}]},
+            "post_processor": {"type": "Sequence", "processors": [{"type": "TemplateProcessing",
+                "special_tokens": {"<|begin_of_text|>": {"ids": [260]}}}]},
+            "added_tokens": [
+                {"id": 260, "content": "<|begin_of_text|>", "special": true, "normalized": false, "lstrip": false, "rstrip": false, "single_word": false},
+                {"id": 261, "content": "<|eot_id|>", "special": true, "normalized": false, "lstrip": false, "rstrip": false, "single_word": false}],
+            "model": {"type": "BPE", "ignore_merges": true, "byte_fallback": false, "dropout": null,
+                "continuing_subword_prefix": null, "end_of_word_suffix": null,
+                "vocab": vocab, "merges": ["b c", "a b", "ab c", "Ġ ab"]}
+        });
+        BitNetTokenizer::from_json(&j.to_string()).unwrap()
+    }
+
+    #[test]
+    fn bpe_merges_by_rank_and_specials_split_out() {
+        let t = toy();
+        // "abc" is in the vocabulary: one token even though "b c" outranks "a b".
+        assert_eq!(t.encode("abc", false), [257]);
+        // "abd": "a b" merges; "abcc" would merge "b c" first (rank 0) then nothing joins "a".
+        assert_eq!(t.encode("abd", false), [256, b'd' as u32]);
+        assert_eq!(t.encode("abcc", false), [b'a' as u32, 259, b'c' as u32]);
+        assert_eq!(t.encode("x ab", true), [260, b'x' as u32, 258]);
+        assert_eq!(
+            t.encode("a<|eot_id|>b", false),
+            [b'a' as u32, 261, b'b' as u32]
+        );
+        assert_eq!(
+            t.decode(&[260, 258, 261]).unwrap(),
+            "<|begin_of_text|> ab<|eot_id|>"
+        );
+        assert!(t.decode(&[999]).is_err());
+    }
+
+    #[test]
+    fn unimplemented_settings_are_refused_by_name() {
+        let mut j: serde_json::Value = serde_json::json!({"normalizer": {"type": "NFC"}});
+        assert!(BitNetTokenizer::from_json(&j.to_string())
+            .unwrap_err()
+            .contains("normalizer"));
+        j = serde_json::json!({"normalizer": null, "model": {"type": "BPE", "ignore_merges": false}});
+        assert!(BitNetTokenizer::from_json(&j.to_string())
+            .unwrap_err()
+            .contains("ignore_merges"));
+    }
+}
diff --git a/crates/aien-inference-abi/src/lib.rs b/crates/aien-inference-abi/src/lib.rs
index ef5704ef..b6e9ff89 100644
--- a/crates/aien-inference-abi/src/lib.rs
+++ b/crates/aien-inference-abi/src/lib.rs
@@ -7,7 +7,9 @@ use async_trait::async_trait;
 use serde::{Deserialize, Serialize};
 
 pub mod backend;
+pub mod bitnet_forward;
 pub mod bitnet_omega;
+pub mod bitnet_tokenizer;
 pub mod capsule;
 pub mod checkpoint;
 pub mod gb10_serving;
diff --git a/crates/aien-inference-abi/tests/bitnet_tokenizer_real.rs b/crates/aien-inference-abi/tests/bitnet_tokenizer_real.rs
new file mode 100644
index 00000000..cc78d8fe
--- /dev/null
+++ b/crates/aien-inference-abi/tests/bitnet_tokenizer_real.rs
@@ -0,0 +1,76 @@
+//! Our BitNet tokenizer on the real `tokenizer.json` (ignored: needs the checkpoint).
+//!
+//!   BITNET_DIR=~/models/BitNet-b1.58-2B-4T-bf16 cargo test -p aien-inference-abi \
+//!       --test bitnet_tokenizer_real -- --ignored
+//!
+//! The yardsticks are our own: the five acceptance id lists recorded in the ternary-oracle spec
+//! (section 6), spot ranks from the reference `tokenizer.model` (spec section 6: "The" = 791,
+//! " is" = 374, " France" = 9822), and exact round trips. No other tokenizer runs.
+
+use std::path::PathBuf;
+
+use aien_inference_abi::bitnet_omega::{sha256_file, BITNET_2B4T_TOKENIZER_SHA256};
+use aien_inference_abi::bitnet_tokenizer::BitNetTokenizer;
+
+fn dir() -> PathBuf {
+    std::env::var_os("BITNET_DIR")
+        .map(PathBuf::from)
+        .unwrap_or_else(|| {
+            PathBuf::from(std::env::var("HOME").expect("HOME"))
+                .join("models/BitNet-b1.58-2B-4T-bf16")
+        })
+}
+
+#[test]
+#[ignore = "needs the BitNet 2B-4T checkpoint"]
+fn real_tokenizer_matches_the_spec_ids_and_round_trips() {
+    let path = dir().join("tokenizer.json");
+    assert_eq!(
+        sha256_file(&path).unwrap(),
+        BITNET_2B4T_TOKENIZER_SHA256,
+        "tokenizer.json is not the pinned file"
+    );
+    let t = BitNetTokenizer::from_file(&path).unwrap();
+    assert_eq!(t.vocab_len(), 128_256);
+    assert_eq!(t.bos, 128_000);
+
+    let spec: [(&str, &[u32]); 5] = [
+        (
+            "The capital of France is",
+            &[128000, 791, 6864, 315, 9822, 374],
+        ),
+        (
+            "The capital of Germany is",
+            &[128000, 791, 6864, 315, 10057, 374],
+        ),
+        (
+            "Count from 6 to 10:",
+            &[128000, 2568, 505, 220, 21, 311, 220, 605, 25],
+        ),
+        (
+            "The boiling point of water in Celsius is",
+            &[128000, 791, 50937, 1486, 315, 3090, 304, 62447, 374],
+        ),
+        (
+            "The largest planet in the solar system is",
+            &[128000, 791, 7928, 11841, 304, 279, 13238, 1887, 374],
+        ),
+    ];
+    for (text, ids) in spec {
+        assert_eq!(t.encode(text, true), ids, "{text:?}");
+        assert_eq!(t.decode(&ids[1..]).unwrap(), text);
+    }
+    let chat = t.encode("<|begin_of_text|>User: hi<|eot_id|>", false);
+    assert_eq!((chat[0], *chat.last().unwrap()), (128000, 128009));
+    assert_eq!(
+        t.decode(&chat).unwrap(),
+        "<|begin_of_text|>User: hi<|eot_id|>"
+    );
+    assert_eq!(*t.encode("<|eot_id|>", false), [128009]);
+
+    let stress = "Tab\there, CRLF\r\n\r\n  spaced   out \u{3000}x; I'M we'Ve it'ſ \
+                  über-naïve 東京タワー 12345 ½ ٣٤٥ emoji 🙂🙂 \u{200d} trailing  ";
+    let ids = t.encode(stress, false);
+    assert_eq!(t.decode(&ids).unwrap(), stress);
+    assert!(ids.iter().all(|&i| i < 128_000));
+}
diff --git a/docs/inference/evidence/bitnet-t2-20261015/DUMPS.SHA256SUMS b/docs/inference/evidence/bitnet-t2-20261015/DUMPS.SHA256SUMS
new file mode 100644
index 00000000..511a8d87
--- /dev/null
+++ b/docs/inference/evidence/bitnet-t2-20261015/DUMPS.SHA256SUMS
@@ -0,0 +1,66 @@
+814f730ff84a4c5c41ac69cf256b2e7245c3f66246619622297223444b4055e0  long512-passage-head.final-norm.f32
+5fafb3597a6c1505410c6702ed1ce9c0a121b3cd8004519d2a3186fb5c3b3a81  long512-passage-head.last-logits.f32
+bed621e3053e2caf6875cce4905a489cd6ae812e4674d6f07918710d4eee7a7a  long512-passage-head.layer00.f32
+dc339cad449c5a65470a01f2a20aa96a12e6a3c0611ad9b1e0de21abc66ccac0  long512-passage-head.layer01.f32
+bf3a8fa2e419b26e81d9f294f3ffefaa6383dad552d972d221e4aec107c9a87f  long512-passage-head.layer15.f32
+8f0672d95362c25e1156157f6c9caffbd731f597cdb73cfa1ceb0e428aca580d  long512-passage-head.layer29.f32
+599c3cdad87d0782635c4473c4544efc801fc7e5cfc64c6b96cab04d1d74b5d9  own1-flat-tyre.final-norm.f32
+e02f8f3a3b4e45b394676a7ee37cd49fafd47ad6239ffc2d2e7401abb34f90a9  own1-flat-tyre.last-logits.f32
+fbf7636be25c0eac5592928d0170cfbb5b13832c9119546dbcce047483630dc4  own1-flat-tyre.layer00.f32
+3836b8a449c00dc91ed27d51a06b9519e18fe358c7ad6fac0fc83d5cae6ecbca  own1-flat-tyre.layer01.f32
+a4156a672494791b386fc6e47097e76403ce729fa16b3904963623f84d304b82  own1-flat-tyre.layer15.f32
+61a0fcf4ea36212a30f11fd2cba5de60e6debf04092cea2cf12ef823475ed510  own1-flat-tyre.layer29.f32
+2f14f1842db3f0c7770d792687395c10c89cdef7169d7bd6c0edc416ea07dd6f  own2-mountain-water.final-norm.f32
+e31b22d810051ce9ba2cd399264216e0b6d9f767867f9c9c1bdbd8b585f35bcb  own2-mountain-water.last-logits.f32
+865f518581451a24cd8d5db7763dbebacb3b6d32aba01c2634e86cfc12c64e6f  own2-mountain-water.layer00.f32
+410bb332d92436283a322593638bf54ab51fe66496ade1f10022cab64ffd6034  own2-mountain-water.layer01.f32
+29deb378e01d3244b7fcaf25432688fc89628006a2ddd1c98ea4e128edf4bed9  own2-mountain-water.layer15.f32
+846bb8ab5451cc643211ed3564265a01bafcd138af65ff74a99c31f8fd319128  own2-mountain-water.layer29.f32
+f4f3d7173d9673d241366e9f4768bddedaa708b7966cd5414fac5edf387b21f6  own3-bread.final-norm.f32
+ce32888c5be0ccee7662420f97ac77f7a171f30cfd353fcdcc3182fcb4fb9b86  own3-bread.last-logits.f32
+07f51ca751a77c67224ac34e49325197e87a364ee9f3d9f0850376722b2b0717  own3-bread.layer00.f32
+92f56a816251caad90420e1a4eb47c9e7e210b724948a5d66ebb0cf86e8a9e9a  own3-bread.layer01.f32
+df6d55bf3e88c2d13f594142373ad62d2c90a66573c89a0f86ea10146c3a8e45  own3-bread.layer15.f32
+1ada8f9c6b2f8e5685cb140933ed252faf9ea65cebba06458bc15a64e5b6fdd5  own3-bread.layer29.f32
+1d85fe39f29761451b02dbb4fd5e0a9aa0391b6d94a97b1e345d90b45c6f92c1  own4-light.final-norm.f32
+e73e011bbb316afc397b06e4d4b6a1f0212c97f4a3d32fb30473d605ab64e5ee  own4-light.last-logits.f32
+39204706ccd5460d59972c9e317cf5954aa47070da9a6e17c77ff8c128182a64  own4-light.layer00.f32
+cb85e516dc82fe65b945801f5cdce87bfad2ebb168a34e21da98a5fef15ea639  own4-light.layer01.f32
+475aa8847ab5fc5ccd8fd26f56045626bd63edaa0a24cb7b1ef80f728319d7f7  own4-light.layer15.f32
+938cf64229c2b95f40b62910c20296c7f29c49b83601cfae589bdf6b683bc4ac  own4-light.layer29.f32
+cd49ce5de4929bd168d42fcae1e7d65e846ef9342821f2b0a3680fdd798adcbd  own5-lighthouse.final-norm.f32
+609d50aabafdb7377ba466acf8aef388b516393859690b65b7c065fb219e01b0  own5-lighthouse.last-logits.f32
+5b454a52e7952bdfd428085f14d85a9344a8970da5af29346de72967592634af  own5-lighthouse.layer00.f32
+ca07fe70e2b45641ecc47f5b6121eef3298b3f047a194fcc5122069666d48602  own5-lighthouse.layer01.f32
+e805311aa29462502b43fcaa1c4c4e9596a6aed9554a0f442871aaf6ce4393b0  own5-lighthouse.layer15.f32
+b1f8ddd70717f366dc8941c272b321c75cb4819bb434d696e47d84131b1d405c  own5-lighthouse.layer29.f32
+03d9f8d06d8a666b3201ea68bf228a69927760ac47c418a21488cbc246608725  spec1-france.final-norm.f32
+b71a7bcf8a901663849adff94ff8542004756d40bbdd8633a04c44de4ed04355  spec1-france.last-logits.f32
+141acb63cc0c815dbfa6bd9919d374712e3165f747be46cdd9b7874b91f6e98a  spec1-france.layer00.f32
+9dd6b78d29ce26c63bd69380139e8d75298f6e92ddc5e4f71eb49950bd4cbcc3  spec1-france.layer01.f32
+d0f1ca10a188ce785a3ce381956ab8f2674cf23bf55fcc2c12216d87f092377c  spec1-france.layer15.f32
+0f28de5cbe156fef50683398447d7b306d8a00159609c449c7838a3be133c7bf  spec1-france.layer29.f32
+aa365e639e44004c44caa801b7d44d84ce87f0bfc17477fbf09487f03491d67b  spec2-germany.final-norm.f32
+e2cf87170240eefa3a77f8a3e67e4bd9f1aae7622aa17acbd5db8e92e99e39fb  spec2-germany.last-logits.f32
+1dfa3e742aa62a178f4ba9eb63284217033d374f981a34cdfdcc9741b9804a2e  spec2-germany.layer00.f32
+f368dc4fd9a7df841c81495000e4b1365c939415aea610f6761bee2dd2b18a74  spec2-germany.layer01.f32
+d6799a53210fed6412d800d09e07774c6be73db73c9f317627767686dca9718c  spec2-germany.layer15.f32
+eaddf550f5fed08ca4b193a8202dd1b7dd521abadc98e8834430abf0e03af0ac  spec2-germany.layer29.f32
+85322ddf148ac10329624b42baea0c0bc17b1f48b63ebde3b88dadc10d1dac27  spec3-count.final-norm.f32
+7dc2cc6b21fb46f12f5a668c06f24271d137eb5edcf25ccd92288d42d158a08a  spec3-count.last-logits.f32
+935dab22d7712d68651ec71174145c501fab11eb967cb3a46cbfd51e5068724e  spec3-count.layer00.f32
+143eb6dd249f545fc0e6f7e95b7bb5d3fff2401357fc571d7c18e43e263a4386  spec3-count.layer01.f32
+fcdf51cad51fd2d2ec1ec92bf449dbde924f9e2b3c0020a5aee1c3b880a53e06  spec3-count.layer15.f32
+54c871c47c15bc3b80ca095a26b1c72e037e87604bb31f5e2c2a2fcf8942eff7  spec3-count.layer29.f32
+d0ad826182642a0f9bbce148be285a45bd2f2adaa2fd935d80a5e59f200373ff  spec4-boiling.final-norm.f32
+21c00423591c7b725d5803049f3ab0a9e9066fe63a4604a94b887e215093510c  spec4-boiling.last-logits.f32
+d51801c2022a3b5dedb6d62e84c7c8a652df7e47a0d05fc42035d4df07a2ae07  spec4-boiling.layer00.f32
+23baf62ace31813fa571d4157f9819f066a16db29f1441f93112477d5655c85b  spec4-boiling.layer01.f32
+721ed59ccaaf7ea0e8a77dd300671cb9dfe86afe0f8763a8f12f28149fecfe57  spec4-boiling.layer15.f32
+56057c780f62d8267e4c659aee671631e4f45d3d5f90eb8d56911c2050295c99  spec4-boiling.layer29.f32
+758ee0ec06d97e5932dc7a3a8451c252689e12521d8f5a40b66add61e03a96bc  spec5-planet.final-norm.f32
+b1d544fe9fc4f941b7e67849eb33231170f759198b93d41789fc8fc74e3c7a1c  spec5-planet.last-logits.f32
+4205034ec77dd5fdb44134ca7b9216284ba2e591bccb6b09c9d51136820dbca4  spec5-planet.layer00.f32
+552c65352315e09c5648c9fa99eca6bebaa34f55e88a33ebe099416ff608aa21  spec5-planet.layer01.f32
+cbd7c40ec946c2043348216e78564f6e00bc39702f9ab1948b9ae87ca5592c85  spec5-planet.layer15.f32
+93c71ff5150894754cde20b9cbd33c28be48c5357a3f18880453ebf486646a60  spec5-planet.layer29.f32
diff --git a/docs/inference/evidence/bitnet-t2-20261015/NOTES.md b/docs/inference/evidence/bitnet-t2-20261015/NOTES.md
new file mode 100644
index 00000000..33535ca5
--- /dev/null
+++ b/docs/inference/evidence/bitnet-t2-20261015/NOTES.md
@@ -0,0 +1,79 @@
+# BitNet T2: our CPU reference forward and its sealed golden, host only, 2026-10-15
+
+Design: `~/handoffs/2026-10-15-ternary-engine-design.md` section 5 row T2 and its binding
+amendment (perplexity gate). Code: `crates/aien-inference-abi/src/bitnet_forward.rs`
+(`HostBitNetForward`), `src/bitnet_tokenizer.rs` (our own byte-level BPE), binary
+`src/bin/own_tern_check.rs`. No chip run; no other engine or tokenizer was run.
+
+Run: `own_tern_check golden ~/models/BitNet-b1.58-2B-4T-bf16 passage-faraday-candle-lecture1.json
+~/workspace/bitnet-t2-golden-20261015` (4 min 1 s wall, peak RSS 5.8 GB, `run.log`; run three times, dumps, losses and ids bit-identical).
+Layout id `omega-trit2-rm16-hfrows-v1`; model and tokenizer sha256 pinned and checked.
+
+## Passage
+
+Faraday, "The Chemical History of a Candle", Lecture I (Project Gutenberg #14474, public domain),
+paragraphs reflowed, footnote markers and underscores removed. sha256
+`4b59948c0c829f7d47c8e8302ebb9400e0de86db67695d5fe4d017137f00343a`, committed (538b7730) before
+any perplexity was measured. 2,654 tokens after BOS; it round-trips through our tokenizer.
+The exact text is the `text` field of `passage-faraday-candle-lecture1.json` (it keeps Faraday's own
+dashes, which the repository's dash audit refuses in plain text files; JSON is audited as data).
+The binary checks the text against the recorded sha256 before use.
+
+## Gates
+
+| gate | result | receipt |
+|---|---|---|
+| tokenizer: the spec's five acceptance id lists, exact | pass | `tests/bitnet_tokenizer_real.rs` |
+| teacher-forced perplexity under 20 | mean loss 2.84966711 nats (calc:1aaad5a0); perplexity 17.282028, below the upper bound 17.28259628 < 20 (calc:ba7ad8ca) | `golden.json`, `passage-nll-reference.f64` |
+| wrong norm order (attn sub-norm after o) raises perplexity by at least 10 % | loss +5.79774559 nats per token (calc:768251f5): perplexity 5,695.39 | `passage-nll-sub-norm-after-o.f64` |
+| skipped sub-norms raise it by at least 10 % | +12.34408089 (calc:bfe40a3e): 3,967,901.8 | `passage-nll-skip-sub-norms.f64` |
+| q and v scales swapped raise it by at least 10 % | +0.350252295 (calc:9a6a4db6): 24.530553 | `passage-nll-swap-q-v-scales.f64` |
+| five own prompts, greedy 32 tokens, coherent | all five read as fluent, on-topic English (`golden.json`, `run.log`) | |
+| decode speed | 54.818 ms per token median over 310 steps: 0.0906 of 237.2 GB/s / 1,178,568,100 B (16-bit table, calc:27682bb9); 0.0654 of the 8-bit-table figure 850,230,180 B (calc:e1f43359). Both are against the model's minimum bytes per token; this host code actually streams 3,397,386,240 B per token (one byte per trit and the f32 table, calc:02eb83dc) | `golden.json` |
+
+Each control's loss rise is above 0.1 nats, so its perplexity ratio is above
+e^0.1 >= 1 + 0.1 + 0.1^2/2 = 1.105 (calc:f864e259). The perplexity bound is the Taylor sum of
+e^2.8497 to 20 terms plus its tail bound; 2.8497 is above the measured mean loss.
+
+Why q and v: swapping only the q and k scales changes nothing (the scores scale by s_q * s_k
+either way; the unit test shows the output within 1e-4), and a v scale is undone by
+`attn_sub_norm`. Swapping q and v scales every score by s_v / s_q.
+
+Microsoft's five acceptance prompts, for information only (not a gate): Paris, Berlin,
+"6, 7, 8, 9, 10", 100 degrees, Jupiter.
+
+## The golden
+
+`golden.json` seals: the passage sha256 and its token ids' sha256, the perplexity receipt of the
+reference and the three controls (sum and mean loss to 17 digits, per-token loss files with
+sha256), every prompt's ids and greedy ids, and the sha256 of every dump. Dumps (36 MB, f32
+little-endian `[tokens][2560]`) stay outside git in `~/workspace/bitnet-t2-golden-20261015/dumps`,
+listed in `DUMPS.SHA256SUMS`: the residual stream after layers 0, 1, 15 and 29, the final-norm
+output and the last position's logits, for the five own prompts, the five spec prompts and a
+512-token prompt (BOS and the passage's first 511 tokens).
+
+## Arithmetic of the reference (spec 1.2, 1.3, 2.2, 4)
+
+f32; exact int32 ternary products; per token int8 absmax with round half to even; one weight
+scale per q, k, v, gate and up segment; RMSNorm square sums in f64; half-split RoPE with f64
+angles; BOS 128000 at position 0; tied bf16 table widened to f32 for the logits. The reference
+runs in bf16; ours is the more exact f32 oracle.
+
+## UNVERIFIED items of spec section 7, how each was settled
+
+1. RMSNorm precision, RoPE pairing and origin, softmax scale: by reading. HF
+   `modeling_bitnet.py:53-58` (norm in f32), `:83-85` (rotate_half: j with j+64), `:299`
+   (inv_freq), `:314` (cos/sin duplicated), `:161` (scale head_dim^-0.5); `REF/convert_safetensors.py:43-47`
+   (the reference permutes q and k rows for adjacent pairs, so half-split is right for the
+   bf16 master); `REF/model.py:291-295` (positions from 0). Unit tests pin the half-split pairing,
+   the frequencies, the softmax scale and the GQA head map (against a naive loop); the f32 norm
+   precision rests on reading plus the end-to-end perplexity gate. In exact arithmetic the position
+   origin does not change attention (RoPE scores depend only on the distance between positions).
+2. bf16 mean of the weight scales: settled by T1 (all 21 spec scales equal).
+3. GGUF I2_S internals: settled by T1 (block 128, checkpoint row order, 97.25 % agreement).
+4. Decode-kernel qkv mis-scaling effect: not measured, by Drake's binding change; we use one
+   scale per segment, never `bitnet_kernels.h:80`.
+5. Oracle path: this host reference is the oracle (prefill path maths, `REF/generate.py:56,63,70`).
+
+CALC-EXEMPT: perplexities, timings, token counts and RSS are measured values copied from
+`golden.json` and `run.log`.
diff --git a/docs/inference/evidence/bitnet-t2-20261015/SHA256SUMS b/docs/inference/evidence/bitnet-t2-20261015/SHA256SUMS
new file mode 100644
index 00000000..e9ba2eb2
--- /dev/null
+++ b/docs/inference/evidence/bitnet-t2-20261015/SHA256SUMS
@@ -0,0 +1,9 @@
+aef43c9ea69288f22ebf6977ba15d10b8e411ca75b107b68ea13487cad5f8c61  DUMPS.SHA256SUMS
+8c46bd96ea7d9c50a4d0b484784966fcce5bfd0160e9cef0e4901aea39bbb901  golden.json
+4b95f71f8e0ce881eaf541e5b2a63eb4d61f7907e0cb5b9784f13fa4db021143  NOTES.md
+25b47e7d69b9b436d21f988fd03e50be8774e15bb705fae194b0e9ad59951d49  passage-faraday-candle-lecture1.json
+81b3d92bc509b1d387abe9088202da4a10f5cf7b4de1ca580669bcf82bff76ba  passage-nll-reference.f64
+a50e22a05c515aa3fddf58819bd63d5f3b92d48e2c6d3e5380af11bc5079ec0c  passage-nll-skip-sub-norms.f64
+8ff78ffaef82a0f0a3bd81009439221c5ebf5a7c63a03311c68a3667feaf6b6b  passage-nll-sub-norm-after-o.f64
+26348ee95d969e0cf88c262358acfa164f732c460cbd273f228d30a1a4b30f2c  passage-nll-swap-q-v-scales.f64
+8774ad289399e3949d6ebae8198bc57fca6107606d22693dd8bdfded03660e75  run.log
diff --git a/docs/inference/evidence/bitnet-t2-20261015/golden.json b/docs/inference/evidence/bitnet-t2-20261015/golden.json
new file mode 100644
index 00000000..d419647d
--- /dev/null
+++ b/docs/inference/evidence/bitnet-t2-20261015/golden.json
@@ -0,0 +1,1698 @@
+{
+  "arithmetic": "f32; exact int32 ternary products; per-token int8 activation absmax, round half to even; RMSNorm square sums in f64; half-split RoPE, f64 angles; tied bf16 table widened to f32",
+  "bos": "every prompt and the passage start with BOS 128000 at position 0",
+  "decode": {
+    "median_ms_per_token": 54.818155,
+    "note": "host reference: one-token forward plus the full-vocabulary logits, i8 trits and f32 table",
+    "steps": 310
+  },
+  "greedy": {
+    "new_tokens_max": 32,
+    "stop_ids": [
+      128001,
+      128009
+    ]
+  },
+  "layout_id": "omega-trit2-rm16-hfrows-v1",
+  "load": {
+    "resident_bytes": 849387060,
+    "seconds": 3.898233915
+  },
+  "model_sha256": "529637ff6dab1f5890767356928693f69ffe61d3b6040a43de9306b37bfd5ae1",
+  "passage": {
+    "file": "passage-faraday-candle-lecture1.json",
+    "sha256": "4b59948c0c829f7d47c8e8302ebb9400e0de86db67695d5fe4d017137f00343a",
+    "tokens_after_bos": 2654
+  },
+  "passage_ids_sha256": "51c78d92b93a7012185ec650ec81ed5dd06103e12382e3c06f2db766d4362a84",
+  "perplexity": {
+    "reference": {
+      "mean_nll_nats": "2.84966711023172659e0",
+      "nll_file": "passage-nll-reference.f64",
+      "nll_sha256": "81b3d92bc509b1d387abe9088202da4a10f5cf7b4de1ca580669bcf82bff76ba",
+      "perplexity": "17.282027873",
+      "predicted_tokens": 2654,
+      "seconds": 49.104964818,
+      "sum_nll_nats": "7.56301651055500224e3"
+    },
+    "skip-sub-norms": {
+      "mean_nll_nats": "1.51937480024210547e1",
+      "nll_file": "passage-nll-skip-sub-norms.f64",
+      "nll_sha256": "a50e22a05c515aa3fddf58819bd63d5f3b92d48e2c6d3e5380af11bc5079ec0c",
+      "perplexity": "3967901.813190344",
+      "predicted_tokens": 2654,
+      "seconds": 48.716747792,
+      "sum_nll_nats": "4.03242071984254799e4"
+    },
+    "sub-norm-after-o": {
+      "mean_nll_nats": "8.64741270437642662e0",
+      "nll_file": "passage-nll-sub-norm-after-o.f64",
+      "nll_sha256": "8ff78ffaef82a0f0a3bd81009439221c5ebf5a7c63a03311c68a3667feaf6b6b",
+      "perplexity": "5695.391991770",
+      "predicted_tokens": 2654,
+      "seconds": 51.328369777,
+      "sum_nll_nats": "2.29502333174150372e4"
+    },
+    "swap-q-v-scales": {
+      "mean_nll_nats": "3.19991940521857465e0",
+      "nll_file": "passage-nll-swap-q-v-scales.f64",
+      "nll_sha256": "26348ee95d969e0cf88c262358acfa164f732c460cbd273f228d30a1a4b30f2c",
+      "perplexity": "24.530553083",
+      "predicted_tokens": 2654,
+      "seconds": 49.282800408,
+      "sum_nll_nats": "8.49258610145009698e3"
+    }
+  },
+  "prompts": [
+    {
+      "dumps": [
+        {
+          "file": "own1-flat-tyre.layer00.f32",
+          "sha256": "fbf7636be25c0eac5592928d0170cfbb5b13832c9119546dbcce047483630dc4",
+          "shape": [
+            13,
+            2560
+          ],
+          "tap": "layer00"
+        },
+        {
+          "file": "own1-flat-tyre.layer01.f32",
+          "sha256": "3836b8a449c00dc91ed27d51a06b9519e18fe358c7ad6fac0fc83d5cae6ecbca",
+          "shape": [
+            13,
+            2560
+          ],
+          "tap": "layer01"
+        },
+        {
+          "file": "own1-flat-tyre.layer15.f32",
+          "sha256": "a4156a672494791b386fc6e47097e76403ce729fa16b3904963623f84d304b82",
+          "shape": [
+            13,
+            2560
+          ],
+          "tap": "layer15"
+        },
+        {
+          "file": "own1-flat-tyre.layer29.f32",
+          "sha256": "61a0fcf4ea36212a30f11fd2cba5de60e6debf04092cea2cf12ef823475ed510",
+          "shape": [
+            13,
+            2560
+          ],
+          "tap": "layer29"
+        },
+        {
+          "file": "own1-flat-tyre.final-norm.f32",
+          "sha256": "599c3cdad87d0782635c4473c4544efc801fc7e5cfc64c6b96cab04d1d74b5d9",
+          "shape": [
+            13,
+            2560
+          ],
+          "tap": "final_norm"
+        },
+        {
+          "file": "own1-flat-tyre.last-logits.f32",
+          "sha256": "e02f8f3a3b4e45b394676a7ee37cd49fafd47ad6239ffc2d2e7401abb34f90a9",
+          "shape": [
+            128256
+          ],
+          "tap": "last_logits"
+        }
+      ],
+      "greedy_ids": [
+        311,
+        4148,
+        279,
+        13587,
+        505,
+        279,
+        13260,
+        13,
+        1115,
+        374,
+        1606,
+        279,
+        74028,
+        374,
+        1457,
+        711,
+        22851,
+        323,
+        499,
+        1205,
+        311,
+        4148,
+        433,
+        505,
+        279,
+        13260,
+        311,
+        8454,
+        433,
+        13,
+        9843,
+        279
+      ],
+      "greedy_text": " to remove the wheel from the bike. This is because the tyre is now deflated and you need to remove it from the bike to replace it. Once the",
+      "ids": [
+        128000,
+        791,
+        1176,
+        3245,
+        311,
+        656,
+        994,
+        264,
+        36086,
+        74028,
+        5900,
+        10269,
+        374
+      ],
+      "name": "own1-flat-tyre",
+      "text": "The first thing to do when a bicycle tyre goes flat is"
+    },
+    {
+      "dumps": [
+        {
+          "file": "own2-mountain-water.layer00.f32",
+          "sha256": "865f518581451a24cd8d5db7763dbebacb3b6d32aba01c2634e86cfc12c64e6f",
+          "shape": [
+            12,
+            2560
+          ],
+          "tap": "layer00"
+        },
+        {
+          "file": "own2-mountain-water.layer01.f32",
+          "sha256": "410bb332d92436283a322593638bf54ab51fe66496ade1f10022cab64ffd6034",
+          "shape": [
+            12,
+            2560
+          ],
+          "tap": "layer01"
+        },
+        {
+          "file": "own2-mountain-water.layer15.f32",
+          "sha256": "29deb378e01d3244b7fcaf25432688fc89628006a2ddd1c98ea4e128edf4bed9",
+          "shape": [
+            12,
+            2560
+          ],
+          "tap": "layer15"
+        },
+        {
+          "file": "own2-mountain-water.layer29.f32",
+          "sha256": "846bb8ab5451cc643211ed3564265a01bafcd138af65ff74a99c31f8fd319128",
+          "shape": [
+            12,
+            2560
+          ],
+          "tap": "layer29"
+        },
+        {
+          "file": "own2-mountain-water.final-norm.f32",
+          "sha256": "2f14f1842db3f0c7770d792687395c10c89cdef7169d7bd6c0edc416ea07dd6f",
+          "shape": [
+            12,
+            2560
+          ],
+          "tap": "final_norm"
+        },
+        {
+          "file": "own2-mountain-water.last-logits.f32",
+          "sha256": "e31b22d810051ce9ba2cd399264216e0b6d9f767867f9c9c1bdbd8b585f35bcb",
+          "shape": [
+            128256
+          ],
+          "tap": "last_logits"
+        }
+      ],
+      "greedy_ids": [
+        279,
+        3805,
+        7410,
+        374,
+        4827,
+        13,
+        578,
+        3805,
+        7410,
+        374,
+        4827,
+        520,
+        5190,
+        4902,
+        21237,
+        11,
+        779,
+        3090,
+        90055,
+        520,
+        264,
+        4827,
+        9499,
+        13,
+        1115,
+        374,
+        1606,
+        279,
+        35715,
+        315,
+        3090,
+        527
+      ],
+      "greedy_text": " the air pressure is lower. The air pressure is lower at higher altitudes, so water boils at a lower temperature. This is because the molecules of water are",
+      "ids": [
+        128000,
+        29353,
+        90055,
+        520,
+        264,
+        4827,
+        9499,
+        1579,
+        389,
+        264,
+        16700,
+        1606
+      ],
+      "name": "own2-mountain-water",
+      "text": "Water boils at a lower temperature high on a mountain because"
+    },
+    {
+      "dumps": [
+        {
+          "file": "own3-bread.layer00.f32",
+          "sha256": "07f51ca751a77c67224ac34e49325197e87a364ee9f3d9f0850376722b2b0717",
+          "shape": [
+            11,
+            2560
+          ],
+          "tap": "layer00"
+        },
+        {
+          "file": "own3-bread.layer01.f32",
+          "sha256": "92f56a816251caad90420e1a4eb47c9e7e210b724948a5d66ebb0cf86e8a9e9a",
+          "shape": [
+            11,
+            2560
+          ],
+          "tap": "layer01"
+        },
+        {
+          "file": "own3-bread.layer15.f32",
+          "sha256": "df6d55bf3e88c2d13f594142373ad62d2c90a66573c89a0f86ea10146c3a8e45",
+          "shape": [
+            11,
+            2560
+          ],
+          "tap": "layer15"
+        },
+        {
+          "file": "own3-bread.layer29.f32",
+          "sha256": "1ada8f9c6b2f8e5685cb140933ed252faf9ea65cebba06458bc15a64e5b6fdd5",
+          "shape": [
+            11,
+            2560
+          ],
+          "tap": "layer29"
+        },
+        {
+          "file": "own3-bread.final-norm.f32",
+          "sha256": "f4f3d7173d9673d241366e9f4768bddedaa708b7966cd5414fac5edf387b21f6",
+          "shape": [
+            11,
+            2560
+          ],
+          "tap": "final_norm"
+        },
+        {
+          "file": "own3-bread.last-logits.f32",
+          "sha256": "ce32888c5be0ccee7662420f97ac77f7a171f30cfd353fcdcc3182fcb4fb9b86",
+          "shape": [
+            128256
+          ],
+          "tap": "last_logits"
+        }
+      ],
+      "greedy_ids": [
+        20415,
+        11,
+        3090,
+        11,
+        41580,
+        11,
+        323,
+        12290,
+        13,
+        578,
+        2853,
+        315,
+        20415,
+        374,
+        400,
+        16,
+        13,
+        1135,
+        824,
+        31123,
+        11,
+        3090,
+        374,
+        400,
+        15,
+        13,
+        605,
+        824,
+        50680,
+        11,
+        41580,
+        374
+      ],
+      "greedy_text": " flour, water, yeast, and salt. The cost of flour is $1.50 per pound, water is $0.10 per gallon, yeast is",
+      "ids": [
+        128000,
+        32,
+        4382,
+        77248,
+        315,
+        16385,
+        3966,
+        1193,
+        3116,
+        14293,
+        25
+      ],
+      "name": "own3-bread",
+      "text": "A simple loaf of bread needs only four ingredients:"
+    },
+    {
+      "dumps": [
+        {
+          "file": "own4-light.layer00.f32",
+          "sha256": "39204706ccd5460d59972c9e317cf5954aa47070da9a6e17c77ff8c128182a64",
+          "shape": [
+            8,
+            2560
+          ],
+          "tap": "layer00"
+        },
+        {
+          "file": "own4-light.layer01.f32",
+          "sha256": "cb85e516dc82fe65b945801f5cdce87bfad2ebb168a34e21da98a5fef15ea639",
+          "shape": [
+            8,
+            2560
+          ],
+          "tap": "layer01"
+        },
+        {
+          "file": "own4-light.layer15.f32",
+          "sha256": "475aa8847ab5fc5ccd8fd26f56045626bd63edaa0a24cb7b1ef80f728319d7f7",
+          "shape": [
+            8,
+            2560
+          ],
+          "tap": "layer15"
+        },
+        {
+          "file": "own4-light.layer29.f32",
+          "sha256": "938cf64229c2b95f40b62910c20296c7f29c49b83601cfae589bdf6b683bc4ac",
+          "shape": [
+            8,
+            2560
+          ],
+          "tap": "layer29"
+        },
+        {
+          "file": "own4-light.final-norm.f32",
+          "sha256": "1d85fe39f29761451b02dbb4fd5e0a9aa0391b6d94a97b1e345d90b45c6f92c1",
+          "shape": [
+            8,
+            2560
+          ],
+          "tap": "final_norm"
+        },
+        {
+          "file": "own4-light.last-logits.f32",
+          "sha256": "e73e011bbb316afc397b06e4d4b6a1f0212c97f4a3d32fb30473d605ab64e5ee",
+          "shape": [
+            128256
+          ],
+          "tap": "last_logits"
+        }
+      ],
+      "greedy_ids": [
+        2579,
+        11,
+        6307,
+        11,
+        323,
+        6437,
+        13,
+        4314,
+        8146,
+        527,
+        279,
+        4857,
+        10215,
+        315,
+        682,
+        1023,
+        8146,
+        13,
+        3277,
+        11093,
+        11,
+        814,
+        649,
+        1893,
+        264,
+        7029,
+        2134,
+        315,
+        8146,
+        13,
+        1789,
+        3187
+      ],
+      "greedy_text": " red, green, and blue. These colors are the building blocks of all other colors. When combined, they can create a wide range of colors. For example",
+      "ids": [
+        128000,
+        791,
+        2380,
+        6156,
+        27230,
+        315,
+        3177,
+        527
+      ],
+      "name": "own4-light",
+      "text": "The three primary colours of light are"
+    },
+    {
+      "dumps": [
+        {
+          "file": "own5-lighthouse.layer00.f32",
+          "sha256": "5b454a52e7952bdfd428085f14d85a9344a8970da5af29346de72967592634af",
+          "shape": [
+            11,
+            2560
+          ],
+          "tap": "layer00"
+        },
+        {
+          "file": "own5-lighthouse.layer01.f32",
+          "sha256": "ca07fe70e2b45641ecc47f5b6121eef3298b3f047a194fcc5122069666d48602",
+          "shape": [
+            11,
+            2560
+          ],
+          "tap": "layer01"
+        },
+        {
+          "file": "own5-lighthouse.layer15.f32",
+          "sha256": "e805311aa29462502b43fcaa1c4c4e9596a6aed9554a0f442871aaf6ce4393b0",
+          "shape": [
+            11,
+            2560
+          ],
+          "tap": "layer15"
+        },
+        {
+          "file": "own5-lighthouse.layer29.f32",
+          "sha256": "b1f8ddd70717f366dc8941c272b321c75cb4819bb434d696e47d84131b1d405c",
+          "shape": [
+            11,
+            2560
+          ],
+          "tap": "layer29"
+        },
+        {
+          "file": "own5-lighthouse.final-norm.f32",
+          "sha256": "cd49ce5de4929bd168d42fcae1e7d65e846ef9342821f2b0a3680fdd798adcbd",
+          "shape": [
+            11,
+            2560
+          ],
+          "tap": "final_norm"
+        },
+        {
+          "file": "own5-lighthouse.last-logits.f32",
+          "sha256": "609d50aabafdb7377ba466acf8aef388b516393859690b65b7c065fb219e01b0",
+          "shape": [
+            128256
+          ],
+          "tap": "last_logits"
+        }
+      ],
+      "greedy_ids": [
+        7086,
+        4491,
+        13,
+        7957,
+        12439,
+        304,
+        264,
+        2678,
+        35335,
+        6424,
+        13,
+        1283,
+        574,
+        264,
+        3169,
+        323,
+        22443,
+        893,
+        889,
+        10456,
+        813,
+        2683,
+        323,
+        3952,
+        2294,
+        2512,
+        315,
+        279,
+        326,
+        59009,
+        13,
+        7357
+      ],
+      "greedy_text": " named Mr. James lived in a small coastal town. He was a kind and gentle man who loved his job and took great care of the lighthouse. Every",
+      "ids": [
+        128000,
+        12805,
+        5304,
+        264,
+        892,
+        11,
+        459,
+        2362,
+        326,
+        59009,
+        54516
+      ],
+      "name": "own5-lighthouse",
+      "text": "Once upon a time, an old lighthouse keeper"
+    },
+    {
+      "dumps": [
+        {
+          "file": "spec1-france.layer00.f32",
+          "sha256": "141acb63cc0c815dbfa6bd9919d374712e3165f747be46cdd9b7874b91f6e98a",
+          "shape": [
+            6,
+            2560
+          ],
+          "tap": "layer00"
+        },
+        {
+          "file": "spec1-france.layer01.f32",
+          "sha256": "9dd6b78d29ce26c63bd69380139e8d75298f6e92ddc5e4f71eb49950bd4cbcc3",
+          "shape": [
+            6,
+            2560
+          ],
+          "tap": "layer01"
+        },
+        {
+          "file": "spec1-france.layer15.f32",
+          "sha256": "d0f1ca10a188ce785a3ce381956ab8f2674cf23bf55fcc2c12216d87f092377c",
+          "shape": [
+            6,
+            2560
+          ],
+          "tap": "layer15"
+        },
+        {
+          "file": "spec1-france.layer29.f32",
+          "sha256": "0f28de5cbe156fef50683398447d7b306d8a00159609c449c7838a3be133c7bf",
+          "shape": [
+            6,
+            2560
+          ],
+          "tap": "layer29"
+        },
+        {
+          "file": "spec1-france.final-norm.f32",
+          "sha256": "03d9f8d06d8a666b3201ea68bf228a69927760ac47c418a21488cbc246608725",
+          "shape": [
+            6,
+            2560
+          ],
+          "tap": "final_norm"
+        },
+        {
+          "file": "spec1-france.last-logits.f32",
+          "sha256": "b71a7bcf8a901663849adff94ff8542004756d40bbdd8633a04c44de4ed04355",
+          "shape": [
+            128256
+          ],
+          "tap": "last_logits"
+        }
+      ],
+      "greedy_ids": [
+        12366,
+        13,
+        12366,
+        374,
+        264,
+        3363,
+        304,
+        9822,
+        430,
+        374,
+        3967,
+        369,
+        1202,
+        6366,
+        18112,
+        11,
+        1989,
+        11,
+        323,
+        7829,
+        13,
+        1102,
+        374,
+        1101,
+        3967,
+        369,
+        1202,
+        11495,
+        61024,
+        1778,
+        439,
+        279
+      ],
+      "greedy_text": " Paris. Paris is a city in France that is known for its beautiful architecture, art, and culture. It is also known for its famous landmarks such as the",
+      "ids": [
+        128000,
+        791,
+        6864,
+        315,
+        9822,
+        374
+      ],
+      "name": "spec1-france",
+      "text": "The capital of France is"
+    },
+    {
+      "dumps": [
+        {
+          "file": "spec2-germany.layer00.f32",
+          "sha256": "1dfa3e742aa62a178f4ba9eb63284217033d374f981a34cdfdcc9741b9804a2e",
+          "shape": [
+            6,
+            2560
+          ],
+          "tap": "layer00"
+        },
+        {
+          "file": "spec2-germany.layer01.f32",
+          "sha256": "f368dc4fd9a7df841c81495000e4b1365c939415aea610f6761bee2dd2b18a74",
+          "shape": [
+            6,
+            2560
+          ],
+          "tap": "layer01"
+        },
+        {
+          "file": "spec2-germany.layer15.f32",
+          "sha256": "d6799a53210fed6412d800d09e07774c6be73db73c9f317627767686dca9718c",
+          "shape": [
+            6,
+            2560
+          ],
+          "tap": "layer15"
+        },
+        {
+          "file": "spec2-germany.layer29.f32",
+          "sha256": "eaddf550f5fed08ca4b193a8202dd1b7dd521abadc98e8834430abf0e03af0ac",
+          "shape": [
+            6,
+            2560
+          ],
+          "tap": "layer29"
+        },
+        {
+          "file": "spec2-germany.final-norm.f32",
+          "sha256": "aa365e639e44004c44caa801b7d44d84ce87f0bfc17477fbf09487f03491d67b",
+          "shape": [
+            6,
+            2560
+          ],
+          "tap": "final_norm"
+        },
+        {
+          "file": "spec2-germany.last-logits.f32",
+          "sha256": "e2cf87170240eefa3a77f8a3e67e4bd9f1aae7622aa17acbd5db8e92e99e39fb",
+          "shape": [
+            128256
+          ],
+          "tap": "last_logits"
+        }
+      ],
+      "greedy_ids": [
+        20437,
+        13,
+        20437,
+        374,
+        264,
+        3363,
+        430,
+        706,
+        264,
+        9257,
+        3925,
+        323,
+        7829,
+        13,
+        1102,
+        374,
+        7559,
+        304,
+        279,
+        4851,
+        315,
+        4606,
+        323,
+        374,
+        3967,
+        369,
+        1202,
+        6366,
+        18112,
+        323,
+        61024,
+        13
+      ],
+      "greedy_text": " Berlin. Berlin is a city that has a rich history and culture. It is located in the heart of Europe and is known for its beautiful architecture and landmarks.",
+      "ids": [
+        128000,
+        791,
+        6864,
+        315,
+        10057,
+        374
+      ],
+      "name": "spec2-germany",
+      "text": "The capital of Germany is"
+    },
+    {
+      "dumps": [
+        {
+          "file": "spec3-count.layer00.f32",
+          "sha256": "935dab22d7712d68651ec71174145c501fab11eb967cb3a46cbfd51e5068724e",
+          "shape": [
+            9,
+            2560
+          ],
+          "tap": "layer00"
+        },
+        {
+          "file": "spec3-count.layer01.f32",
+          "sha256": "143eb6dd249f545fc0e6f7e95b7bb5d3fff2401357fc571d7c18e43e263a4386",
+          "shape": [
+            9,
+            2560
+          ],
+          "tap": "layer01"
+        },
+        {
+          "file": "spec3-count.layer15.f32",
+          "sha256": "fcdf51cad51fd2d2ec1ec92bf449dbde924f9e2b3c0020a5aee1c3b880a53e06",
+          "shape": [
+            9,
+            2560
+          ],
+          "tap": "layer15"
+        },
+        {
+          "file": "spec3-count.layer29.f32",
+          "sha256": "54c871c47c15bc3b80ca095a26b1c72e037e87604bb31f5e2c2a2fcf8942eff7",
+          "shape": [
+            9,
+            2560
+          ],
+          "tap": "layer29"
+        },
+        {
+          "file": "spec3-count.final-norm.f32",
+          "sha256": "85322ddf148ac10329624b42baea0c0bc17b1f48b63ebde3b88dadc10d1dac27",
+          "shape": [
+            9,
+            2560
+          ],
+          "tap": "final_norm"
+        },
+        {
+          "file": "spec3-count.last-logits.f32",
+          "sha256": "7dc2cc6b21fb46f12f5a668c06f24271d137eb5edcf25ccd92288d42d158a08a",
+          "shape": [
+            128256
+          ],
+          "tap": "last_logits"
+        }
+      ],
+      "greedy_ids": [
+        220,
+        21,
+        11,
+        220,
+        22,
+        11,
+        220,
+        23,
+        11,
+        220,
+        24,
+        11,
+        220,
+        605,
+        198,
+        14196,
+        19884,
+        644,
+        420,
+        3187,
+        11,
+        279,
+        1595,
+        2000,
+        63,
+        6471,
+        5480,
+        988,
+        505,
+        220,
+        21,
+        311
+      ],
+      "greedy_text": " 6, 7, 8, 9, 10\n```\n\nIn this example, the `for` loop iterates from 6 to",
+      "ids": [
+        128000,
+        2568,
+        505,
+        220,
+        21,
+        311,
+        220,
+        605,
+        25
+      ],
+      "name": "spec3-count",
+      "text": "Count from 6 to 10:"
+    },
+    {
+      "dumps": [
+        {
+          "file": "spec4-boiling.layer00.f32",
+          "sha256": "d51801c2022a3b5dedb6d62e84c7c8a652df7e47a0d05fc42035d4df07a2ae07",
+          "shape": [
+            9,
+            2560
+          ],
+          "tap": "layer00"
+        },
+        {
+          "file": "spec4-boiling.layer01.f32",
+          "sha256": "23baf62ace31813fa571d4157f9819f066a16db29f1441f93112477d5655c85b",
+          "shape": [
+            9,
+            2560
+          ],
+          "tap": "layer01"
+        },
+        {
+          "file": "spec4-boiling.layer15.f32",
+          "sha256": "721ed59ccaaf7ea0e8a77dd300671cb9dfe86afe0f8763a8f12f28149fecfe57",
+          "shape": [
+            9,
+            2560
+          ],
+          "tap": "layer15"
+        },
+        {
+          "file": "spec4-boiling.layer29.f32",
+          "sha256": "56057c780f62d8267e4c659aee671631e4f45d3d5f90eb8d56911c2050295c99",
+          "shape": [
+            9,
+            2560
+          ],
+          "tap": "layer29"
+        },
+        {
+          "file": "spec4-boiling.final-norm.f32",
+          "sha256": "d0ad826182642a0f9bbce148be285a45bd2f2adaa2fd935d80a5e59f200373ff",
+          "shape": [
+            9,
+            2560
+          ],
+          "tap": "final_norm"
+        },
+        {
+          "file": "spec4-boiling.last-logits.f32",
+          "sha256": "21c00423591c7b725d5803049f3ab0a9e9066fe63a4604a94b887e215093510c",
+          "shape": [
+            128256
+          ],
+          "tap": "last_logits"
+        }
+      ],
+      "greedy_ids": [
+        220,
+        1041,
+        12628,
+        13,
+        578,
+        50937,
+        1486,
+        315,
+        3090,
+        304,
+        69823,
+        374,
+        220,
+        11227,
+        12628,
+        13,
+        578,
+        50937,
+        1486,
+        315,
+        3090,
+        304,
+        92073,
+        374,
+        220,
+        18017,
+        13,
+        868,
+        12628,
+        13,
+        578,
+        50937
+      ],
+      "greedy_text": " 100 degrees. The boiling point of water in Fahrenheit is 212 degrees. The boiling point of water in Kelvin is 373.15 degrees. The boiling",
+      "ids": [
+        128000,
+        791,
+        50937,
+        1486,
+        315,
+        3090,
+        304,
+        62447,
+        374
+      ],
+      "name": "spec4-boiling",
+      "text": "The boiling point of water in Celsius is"
+    },
+    {
+      "dumps": [
+        {
+          "file": "spec5-planet.layer00.f32",
+          "sha256": "4205034ec77dd5fdb44134ca7b9216284ba2e591bccb6b09c9d51136820dbca4",
+          "shape": [
+            9,
+            2560
+          ],
+          "tap": "layer00"
+        },
+        {
+          "file": "spec5-planet.layer01.f32",
+          "sha256": "552c65352315e09c5648c9fa99eca6bebaa34f55e88a33ebe099416ff608aa21",
+          "shape": [
+            9,
+            2560
+          ],
+          "tap": "layer01"
+        },
+        {
+          "file": "spec5-planet.layer15.f32",
+          "sha256": "cbd7c40ec946c2043348216e78564f6e00bc39702f9ab1948b9ae87ca5592c85",
+          "shape": [
+            9,
+            2560
+          ],
+          "tap": "layer15"
+        },
+        {
+          "file": "spec5-planet.layer29.f32",
+          "sha256": "93c71ff5150894754cde20b9cbd33c28be48c5357a3f18880453ebf486646a60",
+          "shape": [
+            9,
+            2560
+          ],
+          "tap": "layer29"
+        },
+        {
+          "file": "spec5-planet.final-norm.f32",
+          "sha256": "758ee0ec06d97e5932dc7a3a8451c252689e12521d8f5a40b66add61e03a96bc",
+          "shape": [
+            9,
+            2560
+          ],
+          "tap": "final_norm"
+        },
+        {
+          "file": "spec5-planet.last-logits.f32",
+          "sha256": "b1d544fe9fc4f941b7e67849eb33231170f759198b93d41789fc8fc74e3c7a1c",
+          "shape": [
+            128256
+          ],
+          "tap": "last_logits"
+        }
+      ],
+      "greedy_ids": [
+        50789,
+        13,
+        578,
+        11841,
+        374,
+        779,
+        3544,
+        430,
+        433,
+        706,
+        264,
+        23899,
+        315,
+        220,
+        10290,
+        11,
+        931,
+        41668,
+        320,
+        4578,
+        11,
+        931,
+        8931,
+        570,
+        50789,
+        374,
+        279,
+        18172,
+        11841,
+        505,
+        279,
+        7160
+      ],
+      "greedy_text": " Jupiter. The planet is so large that it has a diameter of 143,000 kilometers (89,000 miles). Jupiter is the fifth planet from the sun",
+      "ids": [
+        128000,
+        791,
+        7928,
+        11841,
+        304,
+        279,
+        13238,
+        1887,
+        374
+      ],
+      "name": "spec5-planet",
+      "text": "The largest planet in the solar system is"
+    },
+    {
+      "dumps": [
+        {
+          "file": "long512-passage-head.layer00.f32",
+          "sha256": "bed621e3053e2caf6875cce4905a489cd6ae812e4674d6f07918710d4eee7a7a",
+          "shape": [
+            512,
+            2560
+          ],
+          "tap": "layer00"
+        },
+        {
+          "file": "long512-passage-head.layer01.f32",
+          "sha256": "dc339cad449c5a65470a01f2a20aa96a12e6a3c0611ad9b1e0de21abc66ccac0",
+          "shape": [
+            512,
+            2560
+          ],
+          "tap": "layer01"
+        },
+        {
+          "file": "long512-passage-head.layer15.f32",
+          "sha256": "bf3a8fa2e419b26e81d9f294f3ffefaa6383dad552d972d221e4aec107c9a87f",
+          "shape": [
+            512,
+            2560
+          ],
+          "tap": "layer15"
+        },
+        {
+          "file": "long512-passage-head.layer29.f32",
+          "sha256": "8f0672d95362c25e1156157f6c9caffbd731f597cdb73cfa1ceb0e428aca580d",
+          "shape": [
+            512,
+            2560
+          ],
+          "tap": "layer29"
+        },
+        {
+          "file": "long512-passage-head.final-norm.f32",
+          "sha256": "814f730ff84a4c5c41ac69cf256b2e7245c3f66246619622297223444b4055e0",
+          "shape": [
+            512,
+            2560
+          ],
+          "tap": "final_norm"
+        },
+        {
+          "file": "long512-passage-head.last-logits.f32",
+          "sha256": "5fafb3597a6c1505410c6702ed1ce9c0a121b3cd8004519d2a3186fb5c3b3a81",
+          "shape": [
+            128256
+          ],
+          "tap": "last_logits"
+        }
+      ],
+      "ids": [
+        128000,
+        40,
+        7580,
+        11,
+        304,
+        471,
+        369,
+        279,
+        34662,
+        499,
+        656,
+        603,
+        555,
+        5108,
+        311,
+        1518,
+        1148,
+        527,
+        1057,
+        29407,
+        1618,
+        11,
+        311,
+        4546,
+        1603,
+        499,
+        11,
+        304,
+        279,
+        3388,
+        315,
+        1521,
+        46232,
+        11,
+        279,
+        36424,
+        11346,
+        315,
+        264,
+        73997,
+        13,
+        358,
+        617,
+        4529,
+        420,
+        3917,
+        389,
+        264,
+        4846,
+        13402,
+        26,
+        323,
+        1051,
+        433,
+        2163,
+        311,
+        856,
+        1866,
+        690,
+        11,
+        358,
+        1288,
+        10932,
+        311,
+        13454,
+        433,
+        4661,
+        1475,
+        1060,
+        2345,
+        708,
+        44611,
+        374,
+        279,
+        2802,
+        430,
+        85603,
+        5196,
+        311,
+        279,
+        3917,
+        11,
+        779,
+        11364,
+        527,
+        279,
+        36680,
+        315,
+        27487,
+        902,
+        433,
+        6209,
+        1139,
+        279,
+        5370,
+        26280,
+        315,
+        19675,
+        13,
+        2684,
+        374,
+        539,
+        264,
+        2383,
+        1234,
+        902,
+        904,
+        961,
+        315,
+        420,
+        15861,
+        374,
+        27800,
+        902,
+        1587,
+        539,
+        2586,
+        1139,
+        1514,
+        11,
+        323,
+        374,
+        24891,
+        5304,
+        304,
+        1521,
+        44247,
+        13,
+        2684,
+        374,
+        912,
+        2731,
+        11,
+        1070,
+        374,
+        912,
+        810,
+        1825,
+        6134,
+        555,
+        902,
+        499,
+        649,
+        3810,
+        1139,
+        279,
+        4007,
+        315,
+        5933,
+        19675,
+        11,
+        1109,
+        555,
+        13126,
+        279,
+        7106,
+        44247,
+        315,
+        264,
+        38899,
+        13,
+        358,
+        7095,
+        11,
+        9093,
+        11,
+        358,
+        4985,
+        539,
+        14429,
+        499,
+        304,
+        19301,
+        420,
+        369,
+        856,
+        3917,
+        4856,
+        1109,
+        904,
+        26627,
+        8712,
+        11,
+        902,
+        1436,
+        539,
+        387,
+        2731,
+        11,
+        1051,
+        433,
+        1524,
+        779,
+        1695,
+        382,
+        3112,
+        1603,
+        39547,
+        11,
+        1095,
+        757,
+        2019,
+        420,
+        1101,
+        41128,
+        3582,
+        1057,
+        3917,
+        387,
+        779,
+        2294,
+        11,
+        323,
+        1057,
+        14944,
+        430,
+        315,
+        27723,
+        433,
+        27136,
+        11,
+        14243,
+        11,
+        323,
+        13868,
+        2740,
+        11,
+        3686,
+        358,
+        3152,
+        311,
+        1522,
+        3201,
+        505,
+        682,
+        1884,
+        889,
+        527,
+        38349,
+        24059,
+        603,
+        13,
+        358,
+        3802,
+        279,
+        26632,
+        315,
+        12365,
+        311,
+        99545,
+        3742,
+        439,
+        264,
+        48770,
+        7182,
+        13,
+        358,
+        617,
+        2884,
+        779,
+        389,
+        4846,
+        25975,
+        17223,
+        11,
+        422,
+        499,
+        4587,
+        11,
+        358,
+        4985,
+        656,
+        779,
+        1578,
+        13,
+        1628,
+        3582,
+        358,
+        2559,
+        1618,
+        449,
+        279,
+        6677,
+        315,
+        3515,
+        279,
+        4339,
+        358,
+        22256,
+        2728,
+        311,
+        279,
+        1917,
+        11,
+        3686,
+        430,
+        4985,
+        539,
+        4130,
+        757,
+        505,
+        12365,
+        304,
+        279,
+        1890,
+        11537,
+        1648,
+        311,
+        1884,
+        8884,
+        358,
+        85597,
+        24379,
+        311,
+        757,
+        389,
+        420,
+        13402,
+        382,
+        3112,
+        1457,
+        11,
+        856,
+        13305,
+        323,
+        7724,
+        11,
+        358,
+        2011,
+        1176,
+        3371,
+        499,
+        315,
+        1148,
+        52305,
+        527,
+        1903,
+        13,
+        4427,
+        527,
+        2294,
+        2917,
+        3614,
+        1385,
+        13,
+        358,
+        617,
+        1618,
+        1063,
+        9660,
+        315,
+        45888,
+        11,
+        23962,
+        315,
+        12690,
+        8104,
+        11495,
+        369,
+        872,
+        20252,
+        13,
+        1628,
+        1618,
+        499,
+        1518,
+        264,
+        6710,
+        315,
+        430,
+        1633,
+        22999,
+        20278,
+        4529,
+        704,
+        315,
+        1063,
+        315,
+        279,
+        293,
+        27403,
+        304,
+        14990,
+        11,
+        2663,
+        38899,
+        12,
+        6798,
+        96197,
+        64,
+        2653,
+        11,
+        3831,
+        11,
+        9250,
+        7732,
+        11,
+        67170,
+        29441,
+        369,
+        1695,
+        990,
+        439,
+        264,
+        594,
+        1601,
+        315,
+        5457,
+        11,
+        323,
+        3686,
+        449,
+        278,
+        20252,
+        779,
+        1664,
+        430,
+        1405,
+        433,
+        374,
+        1766,
+        814,
+        1304,
+        12786,
+        51040,
+        315,
+        433,
+        11,
+        323,
+        7990,
+        288,
+        11,
+        2533,
+        433,
+        44154,
+        1093,
+        264,
+        38899,
+        11,
+        323,
+        6835,
+        264,
+        1633,
+        1695,
+        3177,
+        13118,
+        13,
+        1628,
+        304,
+        420,
+        7732,
+        584,
+        617,
+        832,
+        315,
+        279,
+        1455,
+        6366,
+        45543,
+        315,
+        279,
+        4689,
+        7138,
+        315,
+        264,
+        38899,
+        430,
+        358,
+        649,
+        11000,
+        3041,
+        13,
+        578,
+        10633,
+        3984,
+        11,
+        279,
+        3445,
+        315,
+        12967,
+        430,
+        10633,
+        311,
+        279,
+        2035,
+        315,
+        11742,
+        1957,
+        11,
+        279,
+        5912,
+        323,
+        53722,
+        8312,
+        315,
+        3805,
+        311,
+        430,
+        2035,
+        315,
+        1957,
+        2345,
+        20559,
+        323,
+        3177,
+        87247,
+        9124,
+        555,
+        264,
+        2697,
+        6710,
+        315
+      ],
+      "name": "long512-passage-head",
+      "text": "BOS and the first 511 passage tokens"
+    }
+  ],
+  "stage": "bitnet-t2-host-reference",
+  "tokenizer_sha256": "e134af98b985517b4f068e3755ae90d4e9cd2d45d328325dc503f1c6b2d06cc7",
+  "total_seconds": 240.498809515
+}
diff --git a/docs/inference/evidence/bitnet-t2-20261015/passage-faraday-candle-lecture1.json b/docs/inference/evidence/bitnet-t2-20261015/passage-faraday-candle-lecture1.json
new file mode 100644
index 00000000..92510e4a
--- /dev/null
+++ b/docs/inference/evidence/bitnet-t2-20261015/passage-faraday-candle-lecture1.json
@@ -0,0 +1,6 @@
+{
+  "source": "Michael Faraday, The Chemical History of a Candle, Lecture I. Project Gutenberg #14474, public domain. Paragraphs reflowed, footnote markers and underscores removed.",
+  "text_sha256": "4b59948c0c829f7d47c8e8302ebb9400e0de86db67695d5fe4d017137f00343a",
+  "note": "The text keeps Faraday's own dashes; it is stored as JSON data so the byte-exact passage stays sealed.",
+  "text": "I purpose, in return for the honour you do us by coming to see what are our proceedings here, to bring before you, in the course of these lectures, the Chemical History of a Candle. I have taken this subject on a former occasion; and were it left to my own will, I should prefer to repeat it almost every year—so abundant is the interest that attaches itself to the subject, so wonderful are the varieties of outlet which it offers into the various departments of philosophy. There is not a law under which any part of this universe is governed which does not come into play, and is touched upon in these phenomena. There is no better, there is no more open door by which you can enter into the study of natural philosophy, than by considering the physical phenomena of a candle. I trust, therefore, I shall not disappoint you in choosing this for my subject rather than any newer topic, which could not be better, were it even so good.\n\nAnd before proceeding, let me say this also—that though our subject be so great, and our intention that of treating it honestly, seriously, and philosophically, yet I mean to pass away from all those who are seniors amongst us. I claim the privilege of speaking to juveniles as a juvenile myself. I have done so on former occasions—and, if you please, I shall do so again. And though I stand here with the knowledge of having the words I utter given to the world, yet that shall not deter me from speaking in the same familiar way to those whom I esteem nearest to me on this occasion.\n\nAnd now, my boys and girls, I must first tell you of what candles are made. Some are great curiosities. I have here some bits of timber, branches of trees particularly famous for their burning. And here you see a piece of that very curious substance taken out of some of the bogs in Ireland, called candle-wood,—a hard, strong, excellent wood, evidently fitted for good work as a resister of force, and yet withal burning so well that where it is found they make splinters of it, and torches, since it burns like a candle, and gives a very good light indeed. And in this wood we have one of the most beautiful illustrations of the general nature of a candle that I can possibly give. The fuel provided, the means of bringing that fuel to the place of chemical action, the regular and gradual supply of air to that place of action—heat and light—all produced by a little piece of wood of this kind, forming, in fact, a natural candle.\n\nBut we must speak of candles as they are in commerce. Here are a couple of candles commonly called dips. They are made of lengths of cotton cut off, hung up by a loop, dipped into melted tallow, taken out again and cooled, then re-dipped until there is an accumulation of tallow round the cotton. In order that you may have an idea of the various characters of these candles, you see these which I hold in my hand—they are very small, and very curious. They are, or were, the candles used by the miners in coal mines. In olden times the miner had to find his own candles; and it was supposed that a small candle would not so soon set fire to the fire-damp in the coal mines as a large one; and for that reason, as well as for economy’s sake, he had candles made of this sort—20, 30, 40, or 60 to the pound. They have been replaced since then by the steel-mill, and then by the Davy-lamp, and other safety-lamps of various kinds. I have here a candle that was taken out of the Royal George, it is said, by Colonel Pasley. It has been sunk in the sea for many years, subject to the action of salt water. It shews you how well candles may be preserved; for though it is cracked about and broken a good deal, yet, when lighted, it goes on burning regularly, and the tallow resumes its natural condition as soon as it is fused.\n\nMr. Field, of Lambeth, has supplied me abundantly with beautiful illustrations of the candle and its materials. I shall therefore now refer to them. And, first, there is the suet—the fat of the ox—Russian tallow, I believe, employed in the manufacture of these dips, which Gay Lussac, or some one who entrusted him with his knowledge, converted into that beautiful substance, stearin, which you see lying beside it. A candle, you know, is not now a greasy thing like an ordinary tallow candle, but a clean thing, and you may almost scrape off and pulverise the drops which fall from it without soiling anything. This is the process he adopted:—The fat or tallow is first boiled with quick-lime, and made into a soap, and then the soap is decomposed by sulphuric acid, which takes away the lime, and leaves the fat re-arranged as stearic acid, whilst a quantity of glycerin is produced at the same time. Glycerin—absolutely a sugar, or a substance similar to sugar—comes out of the tallow in this chemical change. The oil is then pressed out of it; and you see here this series of pressed cakes, shewing how beautifully the impurities are carried out by the oily part as the pressure goes on increasing, and at last you have left that substance which is melted, and cast into candles as here represented. The candle I have in my hand is a stearin candle, made of stearin from tallow in the way I have told you. Then here is a sperm candle, which comes from the purified oil of the spermaceti whale. Here also are yellow bees-wax and refined bees-wax, from which candles are made. Here, too, is that curious substance called paraffin, and some paraffin candles made of paraffin obtained from the bogs of Ireland. I have here also a substance brought from Japan, since we have forced an entrance into that out-of-the-way place—a sort of wax which a kind friend has sent me, and which forms a new material for the manufacture of candles.\n\nAnd how are these candles made? I have told you about dips, and I will shew you how moulds are made. Let us imagine any of these candles to be made of materials which can be cast. “Cast!” you say. “Why, a candle is a thing that melts; and surely if you can melt it, you can cast it.” Not so. It is wonderful, in the progress of manufacture, and in the consideration of the means best fitted to produce the required result, how things turn up which one would not expect beforehand. Candles cannot always be cast. A wax candle can never be cast. It is made by a particular process, which I can illustrate in a minute or two: but I must not spend much time on it. Wax is a thing which, burning so well, and melting so easily in a candle, cannot be cast. However, let us take a material that can be cast. Here is a frame, with a number of moulds fastened in it. The first thing to be done is to put a wick through them. Here is one—a plaited wick, which does not require snuffing—supported by a little wire. It goes to the bottom, where it is pegged in—the little peg holding the cotton tight, and stopping the aperture, so that nothing fluid shall run out. At the upper part there is a little bar placed across, which stretches the cotton and holds it in the mould. The tallow is then melted, and the moulds are filled. After a certain time, when the moulds are cool, the excess of tallow is poured off at one corner, and then cleaned off altogether, and the ends of the wick cut away. The candles alone then remain in the mould, and you have only to upset them, as I am doing, when out they tumble, for the candles are made in the form of cones, being narrower at the top than at the bottom; so that what with their form and their own shrinking, they only need a little shaking, and out they fall. In the same way are made these candles of stearin and of paraffin. It is a curious thing to see how wax candles are made. A lot of cottons are hung upon frames, as you see here, and covered with metal tags at the ends to keep the wax from covering the cotton in those places. These are carried to a heater, where the wax is melted. As you see, the frames can turn round; and as they turn, a man takes a vessel of wax and pours it first down one, and then the next and the next, and so on. When he has gone once round, if it is sufficiently cool, he gives the first a second coat, and so on until they are all of the required thickness. When they have been thus clothed, or fed, or made up to that thickness, they are taken off, and placed elsewhere. I have here, by the kindness of Mr. Field, several specimens of these candles. Here is one only half-finished. They are then taken down, and well rolled upon a fine stone slab, and the conical top is moulded by properly shaped tubes, and the bottoms cut off and trimmed. This is done so beautifully that they can make candles in this way weighing exactly four, or six, to the pound, or any number they please.\n\nWe must not, however, take up more time about the mere manufacture, but go a little further into the matter. I have not yet referred you to luxuries in candles (for there is such a thing as luxury in candles). See how beautifully these are coloured: you see here mauve, magenta, and all the chemical colours recently introduced, applied to candles. You observe, also, different forms employed. Here is a fluted pillar most beautifully shaped; and I have also here some candles sent me by Mr. Pearsall, which are ornamented with designs upon them, so that as they burn you have as it were a glowing sun above, and a bouquet of flowers beneath. All, however, that is fine and beautiful is not useful. These fluted candles, pretty as they are, are bad candles; they are bad because of their external shape. Nevertheless, I shew you these specimens sent to me from kind friends on all sides, that you may see what is done, and what may be done in this or that direction; although, as I have said, when we come to these refinements, we are obliged to sacrifice a little in utility.\n\nNow, as to the light of the candle. We will light one or two, and set them at work in the performance of their proper functions. You observe a candle is a very different thing from a lamp. With a lamp you take a little oil, fill your vessel, put in a little moss or some cotton prepared by artificial means, and then light the top of the wick. When the flame runs down the cotton to the oil, it gets extinguished, but it goes on burning in the part above. Now, I have no doubt you will ask, how is it that the oil, which will not burn of itself, gets up to the top of the cotton, where it will burn? We shall presently examine that; but there is a much more wonderful thing about the burning of a candle than this. You have here a solid substance with no vessel to contain it; and how is it that this solid substance can get up to the place where the flame is? How is it that this solid gets there, it not being a fluid? or, when it is made a fluid, then how is it that it keeps together? This is a wonderful thing about a candle.\n\nWe have here a good deal of wind, which will help us in some of our illustrations, but tease us in others; for the sake, therefore, of a little regularity, and to simplify the matter, I shall make a quiet flame—for who can study a subject when there are difficulties in the way not belonging to it? Here is a clever invention of some costermonger or street stander in the market-place for the shading of their candles on Saturday nights, when they are selling their greens, or potatoes, or fish. I have very often admired it. They put a lamp-glass round the candle, supported on a kind of gallery, which clasps it, and it can be slipped up and down as required. By the use of this lamp-glass, employed in the same way, you have a steady flame, which you can look at, and carefully examine, as I hope you will do, at home.\n"
+}
diff --git a/docs/inference/evidence/bitnet-t2-20261015/passage-nll-reference.f64 b/docs/inference/evidence/bitnet-t2-20261015/passage-nll-reference.f64
new file mode 100644
index 00000000..8960b9c3
Binary files /dev/null and b/docs/inference/evidence/bitnet-t2-20261015/passage-nll-reference.f64 differ
diff --git a/docs/inference/evidence/bitnet-t2-20261015/passage-nll-skip-sub-norms.f64 b/docs/inference/evidence/bitnet-t2-20261015/passage-nll-skip-sub-norms.f64
new file mode 100644
index 00000000..639d590e
Binary files /dev/null and b/docs/inference/evidence/bitnet-t2-20261015/passage-nll-skip-sub-norms.f64 differ
diff --git a/docs/inference/evidence/bitnet-t2-20261015/passage-nll-sub-norm-after-o.f64 b/docs/inference/evidence/bitnet-t2-20261015/passage-nll-sub-norm-after-o.f64
new file mode 100644
index 00000000..e40fdd17
Binary files /dev/null and b/docs/inference/evidence/bitnet-t2-20261015/passage-nll-sub-norm-after-o.f64 differ
diff --git a/docs/inference/evidence/bitnet-t2-20261015/passage-nll-swap-q-v-scales.f64 b/docs/inference/evidence/bitnet-t2-20261015/passage-nll-swap-q-v-scales.f64
new file mode 100644
index 00000000..0cc3c239
Binary files /dev/null and b/docs/inference/evidence/bitnet-t2-20261015/passage-nll-swap-q-v-scales.f64 differ
diff --git a/docs/inference/evidence/bitnet-t2-20261015/run.log b/docs/inference/evidence/bitnet-t2-20261015/run.log
new file mode 100644
index 00000000..8bb17e05
--- /dev/null
+++ b/docs/inference/evidence/bitnet-t2-20261015/run.log
@@ -0,0 +1,19 @@
+passage: 2654 tokens after BOS, sha256 4b59948c0c829f7d47c8e8302ebb9400e0de86db67695d5fe4d017137f00343a
+reference: 2654 tokens, sum nll 7.56301651055500224e3, perplexity 17.282028 (49.1 s)
+sub-norm-after-o: 2654 tokens, sum nll 2.29502333174150372e4, perplexity 5695.391992 (51.3 s)
+skip-sub-norms: 2654 tokens, sum nll 4.03242071984254799e4, perplexity 3967901.813190 (48.7 s)
+swap-q-v-scales: 2654 tokens, sum nll 8.49258610145009698e3, perplexity 24.530553 (49.3 s)
+own1-flat-tyre: "The first thing to do when a bicycle tyre goes flat is" -> " to remove the wheel from the bike. This is because the tyre is now deflated and you need to remove it from the bike to replace it. Once the"
+own2-mountain-water: "Water boils at a lower temperature high on a mountain because" -> " the air pressure is lower. The air pressure is lower at higher altitudes, so water boils at a lower temperature. This is because the molecules of water are"
+own3-bread: "A simple loaf of bread needs only four ingredients:" -> " flour, water, yeast, and salt. The cost of flour is $1.50 per pound, water is $0.10 per gallon, yeast is"
+own4-light: "The three primary colours of light are" -> " red, green, and blue. These colors are the building blocks of all other colors. When combined, they can create a wide range of colors. For example"
+own5-lighthouse: "Once upon a time, an old lighthouse keeper" -> " named Mr. James lived in a small coastal town. He was a kind and gentle man who loved his job and took great care of the lighthouse. Every"
+spec1-france: "The capital of France is" -> " Paris. Paris is a city in France that is known for its beautiful architecture, art, and culture. It is also known for its famous landmarks such as the"
+spec2-germany: "The capital of Germany is" -> " Berlin. Berlin is a city that has a rich history and culture. It is located in the heart of Europe and is known for its beautiful architecture and landmarks."
+spec3-count: "Count from 6 to 10:" -> " 6, 7, 8, 9, 10\n```\n\nIn this example, the `for` loop iterates from 6 to"
+spec4-boiling: "The boiling point of water in Celsius is" -> " 100 degrees. The boiling point of water in Fahrenheit is 212 degrees. The boiling point of water in Kelvin is 373.15 degrees. The boiling"
+spec5-planet: "The largest planet in the solar system is" -> " Jupiter. The planet is so large that it has a diameter of 143,000 kilometers (89,000 miles). Jupiter is the fifth planet from the sun"
+wrote /home/drakestapleton/workspace/bitnet-t2-golden-20261015/golden.json
+	Elapsed (wall clock) time (h:mm:ss or m:ss): 4:00.84
+	Maximum resident set size (kbytes): 5795112
+third run (passage read from the JSON file): dumps, per-token losses and ids bit-identical to the first two runs