← All Engineering Notes / SCARLET Quadrilogy, Paper IV
[systems] Paper IV · SCARLET Quadrilogy · 29 November 2026TritCore v1.4: One Kernel, Four Architectures
Dense ternary transformers, O(1) state-space backbones, looped recurrent depth and 7-expert block-discrete diffusion on a single zero-multiply POPCNT substrate — with the four failure modes that appeared when they were combined, and the invariants that resolved each.
1. Abstract
Model serving remains bound to power-hungry accelerators, quadratic KV-cache growth and fragmented C++/Python runtimes. TritCore v1.4 shows that four distinct — and notoriously unstable when combined — mathematical paradigms can run on one zero-multiply POPCNT ternary kernel in pure Rust: dense ternary transformers (BitNet 2B-4T), O(1)-memory state-space backbones (BitMamba-2 1B), looped recurrent depth (R ∈ {1..5}) and 7-expert 64-token block-discrete diffusion (FM-MOSTEST, 273.39M parameters).
On BitNet 2B-4T the proven identity drives a NZ$3 2013 15 W Haswell laptop (i5-4300U, no battery) from 1.30 → 12.19 tok/s (9.4×, bit-exact argmax with a certified INT8 head) and a 2013 i5-4570 desktop to 15.89 tok/s exact (27.16 tok/s top-64 screen). Converting BitMamba-2 1B (644.3 MB of legacy 2-bit packing) into 65 native TRT2 dual-bitfield matrices (228.6 MB, max_err = 0) raises i7-13620H throughput to 30.20 tok/s (+20.9%) and cuts standalone cold boot from 754.8 ms to 144.7 ms (5.2×).
This paper also records four real failure modes met while unifying mixture-of-experts routing, recurrent depth, ternary export and cross-architecture conditioning — expert starvation, silent 0.683× export double-attenuation, bridge-induced rare-token drift and quadratic context blowup — alongside the invariants that resolved each.
2. Zero-multiply identity and bit-exact unification
Theorem 1. Let w ∈ {−1, 0, +1} be encoded as disjoint bitfields posj = 1[wj = +1] and negj = 1[wj = −1], with support mask D = pos ⊕ neg, and let INT8 activations x be decomposed into bit-planes with ck = 2k for k < 7 and c7 = −128. With mk = neg ⊕ (D ∧ Bk):
sum_j w_j x_j = sum_{k=0..7} c_k popcnt(m_k) + popcnt(neg)
The proof is the three-case inspection of each coordinate (w = 0, +1, −1), relying on Σk ck = −1. Applied to BitMamba-2 1B (32 layers, d = 2048, vocabulary 50,257 GPT-2 BPE), it converts all 65 ternary matrices — 32 in_proj, 32 out_proj and lm_head — from 644.3 MB to 228.6 MB native TRT2 in 16.0 s with popcnt_max_err = 0. On an Intel Core i7-13620H that is 5.2× faster cold boot (754.8 → 144.7 ms) and +20.9% sustained generation (24.97 → 30.20 tok/s).
3. Four failure modes, and what tamed them
3.1 Expert starvation in 7-expert block diffusion
Naive top-2 routing collapsed onto a single specialist. Adopting routed-only zero-mean bias balancing with no auxiliary loss, targeting 0.50/6 ≈ 0.0833 alongside a frozen trunk anchor, raised training router entropy to 0.9971 (validation 0.9238) and reduced domain-split validation perplexity from 86.25 to 39.63, then to 35.98 over a 12,000-step continuation (98.3M tokens at 22,032 tok/s).
3.2 Silent 0.683× double-attenuation on export
Auditing legacy .trit2 reload paths uncovered a silent 0.683× attenuation when re-quantising already-scaled ternary weights. Packing directly from FP32 training state into native TRT2 (25 layers, max_err = 0) and INT8 edge matrices (45 matrices, 181.77 MB) restored exact 1.000× per-row scales and numerical parity with JAX (cos(hkv) = 0.999959, cos(logits63) = 0.995246).
3.3 Bridge shock and rare-token loops
An initial stitching run lowered validation cross-entropy yet devolved into rare-token repetition during live 16-step demasking. Three causes were isolated: an unpinned Slot-0 router bias drifting to −0.99 and shutting off the shared trunk, a narrow [0.10, 0.85] masking band leaving endpoints under-trained, and an unfrozen token embedding drifting out of alignment.
Pinning Slot-0 bias to +3.5, widening the masking band to [0.05, 0.95], freezing both the recurrent core and the token embedding, and training 2,500 steps on clean conversational and educational data (60,000 windows) produced Stitched v8: clean-split validation perplexity fell from 30.66 to 23.62 (−23.0%, +0.26096 nats) with tanh(alpha) = −0.22833, eliminating rare-token collapse on live generation.
3.4 Quadratic context and crash fragility on edge nodes
Replacing KV caches with flat 2.1 MB BMS3 SSM snapshots and atomic .json / .bak salience working memory — both sealed with 256-bit keyed BLAKE3 MACs — removes context-length RAM growth and rejects single-bit disk or network tampering, checked by unit tests and by live HTTP 403 on a forged MAC.
4. Surgical 2048 → 1024 stitching
Design invariant. Widening the 273M block-diffusion head from d = 1024 to 2048 quadruples matrix area to roughly 1.0B parameters, exceeds 16 GB of consumer accelerator VRAM during training, and cuts CPU and mobile throughput 4×. Instead, the StitchBridge projects frozen BitMamba-2 1B hidden states:
h_stitched_kv = h_kv + tanh(alpha) RMSNorm(h_1B W_bridge), alpha_0 = 0
That requires only 2.1M parameters (8.1 MB FP32), gives zero step-0 shock, costs under 0.2 ms at runtime, and caches directly in the engine's radix state tree.
5. Benchmarks on commodity hardware
All measurements were collected with rustc 1.99.0 --release across unmodified consumer hardware spanning thirteen years of x86 silicon plus mobile ARM64: an i7-13620H (16 threads, AVX2), an i7-1165G7 (8 threads, hardware AVX-512 VPOPCNTDQ), a 2013 15 W i5-4300U Haswell laptop (2C/4T, no AVX-512, acquired for NZ$3 without a battery, running Linux Lite on wall power), a 2013 i5-4570 Haswell desktop, and a Snapdragon 8 Elite handset (Galaxy S25 Ultra, arm64-v8a NEON).
| Engine / subsystem | Cold start | Throughput | Parity | Hardware and property |
|---|---|---|---|---|
| BitNet 2B-4T (TRT2 + INT8 head) | 58.1 ms† | 12.19 tok/s | argmax exact | 2013 15 W i5-4300U (NZ$3 laptop), 9.4× scalar |
| BitNet 2B-4T (exact / top-64) | — | 15.89 / 27.16 tok/s | exact / 160 of 160 | 2013 i5-4570 versus 11.79 maddubs |
| BitMamba-2 1B (legacy 2-bit) | 754.8 ms | 24.97 tok/s | exact | i7-13620H, 2-bit unpack + maddubs |
| BitMamba-2 1B (native TRT2) | 144.7 ms | 30.20 tok/s | max_err = 0 | i7-13620H, 5.2× faster boot, +20.9% |
| FM-MOSTEST v6 (native TRT2) | 75.5 ms | 11.21 tok/s | cos = 0.99996 | i7-13620H, 16-step block diffusion at R = 4, 35.98 PPL |
| FM-MOSTEST Stitched v8 (live) | 150.3 ms | 10.36 tok/s | max_err = 0 | i7-13620H, 23.62 PPL (−23.0%), live 1B bridge |
| Two-node LAN distributed | 77.7 ms | 22.64 tok/s | MAC-checked | i7-13620H (AVX2) + i7-1165G7 (AVX-512) |
| FM-MOSTEST core sweep, R = 3 / R = 1 | 0.69 ms | 211.6 / 1199.2 tok/s | exact | i7-13620H, AVX2 Muła vpshufb |
| Episodic graph (256-bit SimHash) | under 1 ms | 112.9 μs per 10k | exact | keyed BLAKE3 + POPCNT uncertainty signal |
| BMS3 Radix SSM cache (disk) | under 1 ms | 2.1 MB flat | keyed BLAKE3 | O(1) RAM, bit-exact restore, tamper-evident |
† Cold start on the NZ$3 laptop is a cold 30-layer ternary pass (521 MB at 8.97 GB/s) — a weight pass, not a process start. Decode there progresses from 1.30 tok/s (scalar) → 6.58 (maddubs) → 10.05 (TRT2 exact, BF16 head) → 12.19 tok/s (TRT2 + certified INT8 head, bit-identical argmax 160 of 160 and 894 of 894), with 11.6–11.9 tok/s served over HTTP and 13.0–14.4 tok/s prefill.
The deployed export is 179.8 MB against 1093.6 MB unpacked FP32 — 23.4 MB of TRT2 core and 7 experts plus 156.5 MB of protected INT8 edge — a 6.08× compression, shown against recurrent loop depth R ∈ {1..5} in the paper's throughput sweep.
6. Limitations
- Short-horizon bridge fluency. After 2,500 bridge steps, Stitched v8 eliminates the earlier rare-token collapse and reliably produces structured reasoning tags and Python function signatures at 10.36 tok/s on CPU, but still shows mild local phrase repetition on short prompts. Multi-epoch continuation (v8 → v9) is under way.
- External baselines and downstream benchmarks. Perplexity and throughput are measured against our own earlier versions and legacy 2-bit baselines on identical splits and hardware. Head-to-head comparisons against llama.cpp and bitnet.cpp, and MMLU, GSM8K and HumanEval, are deferred to v1.5.
- Mobile runtime profiling. The arm64-v8a library is compiled, provenance-stamped and deployed on Galaxy S25 Ultra; sustained thermal and battery tokens-per-second curves remain to be logged.
Every figure here is an author build-log measurement on the named hardware with rustc 1.99.0 --release. None has been reproduced by a third party, and no external baseline is claimed.
References
- S. Ma et al., “The Era of 1-bit LLMs,” arXiv:2402.17764, 2024.
- T. Dao and A. Gu, “Transformers are SSMs,” ICML, 2024.
- M. Arriola et al., “Block Diffusion,” ICLR, 2025.
- W. Muła, N. Kurz and D. Lemire, “Faster Population Counts Using AVX2 Instructions,” The Computer Journal, 61(1):111–120, 2018.
- DeepSeek-AI, “DeepSeek-V3 Technical Report” (routed-only zero-mean bias balancing without an auxiliary loss), arXiv:2412.19437, 2024.
- M. S. Charikar, “Similarity Estimation Techniques from Rounding Algorithms,” STOC, 2002.
- J. O'Connor et al., “BLAKE3: One Function, Fast Everywhere,” blake3.io, 2020.
- D. Kelly, “Transformers: Pastry, Not Pie,” Paper I, 29 Nov 2026.
- D. Kelly, “SCARLET Is All You Need,” Paper II, 29 Nov 2026.
- D. Kelly, “POPCNT: State of the Art in the New Art of State,” Paper III, 29 Nov 2026.