A neuro-symbolic micro-Transformer with speculative decoding, constraint pruning, recurrent attention, and adaptive test-time scaling — built in Rust.
Rust
123
6,197 commits
updated Sep 23, 2026
Boundary contract: BOUNDARY.md — what lives here, what may depend on it, known drift.
A GOAT-proved neuro-symbolic micro-Transformer with speculative decoding, constraint pruning, and 641 feature flags (204 default-on, all GOAT-proved) — built in Rust. Pure algorithms, zero side effects, MIT licensed.
Inspired by Andrej Karpathy's microgpt.
| Result | Number | Feature |
|---|---|---|
| TTFT Speedup | 29× (X16 compression) | MUX-Latent zero-training context compression |
| KV Memory Reduction | 93.8% | MUX superposition fusion |
| Prefill Seq Reduction | 21×, 100% NIAH retrieval | PFlash block-sparse prefill |
| KV Rotation FMAs | 64× fewer, best MSE | Hybrid OCT+PQ codec |
| RMSNorm Speedup | 2.4× | Kog CPU fusion kernel |
| Sudoku Compression | 7,079× on Inkala's Hardest | Path-aware ConstraintPruner |
| Bomber HL Score | +177 vs Random −55 | Adaptive intelligence arena proof |
| NFSP/MCTS Duality | 75% vs MCTS 8% | Bandit-guided backward→forward search |
| BoM Belief Sampling | +31.49pp arena win rate (K=8 @ 1.87× step) | Single-pass K-hypothesis belief sampling |
| Self-Advantage Gate | 18× forward-pass reduction (paper claim) | Dead-compute detector via pre/post log-ratio |
| Temporal Derivative | 4/4 fusion gates PASS (HLA, δ-Mem, collapse, curiosity) | Dual fast/slow EMA surprise signal |
| Triggered Injection | 50% skips @ 0.63% quality delta | Sigmoid-thresholded inject/skip hot-path gate |
| KARC Trajectory Forecast | NRMSE 9.43e-4 at d_h=18_720 (Phase 5.1 K=8/M=8/R=2 λ=5e-2; threshold leg 10% short — stays opt-in) | Delay-basis ridge forecaster (Plan 308 Phase 5.1 λ-sweep, Issue 187 T7) |
| Latent Field Steering | 1.50× fear-axis shift, ≤4.5e-5 leakage | Top-down direction-vector injection (Plan 309) |
| Cross-Resolution Transport | 0.9300 mean cos rank preservation (16→256 tier transfer) | Train-small-deploy-large asymmetric-basis FUNCATTN (Plan 310) |
| Manifold Walk Viability | 100% playability vs free 74.2% (paper's SMB headline reproduced); 7.10 ns/step post-CSR (68.4× speedup, 14× under target) | Viable Manifold Graph safe-navigation (Plan 312, DEFAULT-ON) |
| AC-Prefix Modelless G1 | 0.0 diff (bit-identical to iterative-MLM) via attends_dedup; 27.258× speedup vs 64 iterative forwards | §3.5 modelless unblock of AC-GPT arbitrary-conditional eval (Plan 313, DEFAULT-ON) |
| Renoise-CE Self-Verifier | renoise=1.000 vs plurality=0.000 (100pp), +30.5pp CLR fusion (6× target) | Perturb-output + re-resolve + measure-drift, operator-agnostic (Plan 406, DEFAULT-ON) |
| Velocity Field Ensemble | beats conformal-naive floor (Plan 340); ridge-solved η weights regression-optimal | Algebraic combination of P frozen velocity fields (Plan 376, DEFAULT-ON) |
| Local Branch Routing | +9pp to +26pp quality gain (K=3 candidates), argmax 51ns / sampled 69ns | Post-candidate-set attention + relative routing (Plan 377, DEFAULT-ON) |
| Set Attention (NPT half) | 75.7µs/tick @ 100 NPCs (6.6× headroom), G1–G5 PASS, G8 CLOSED by CLR-weighted sibling (+8.7pp ID, 3.88× amplification) | Permutation-equivariant sigmoid-gated cross-entity attention (Plan 354 + Plan 570 CLR-weighted sibling, DEFAULT-ON) |
| Step Attribution Qualifier | 81.6% drift reduction (riir-ai PoC), 13ns aggregate @ W=64 | Δ≥0 commit gate (SkillAdaptor eq.8) + StepLocalizer (Plan 381, DEFAULT-ON) |
| Heat Kernel Trajectory | exact at long horizons vs O(T·dt²) Euler error | Single-shot DEC cochain field prediction via operator exponential (Plan 359, DEFAULT-ON) |
| QMC Belief Sampling | G1–G6 ALL PASS (Lattice/Stratified/Sobol drop-in for iid) | QuasiMoTTo QMC uniform sources in K-rollout paths (Plan 367, DEFAULT-ON) |
| Zone Density Routing | +41.54% routing, 99.1% cache hit, 0 stale reads | Density-aware zone routing + papaya LRU cache (Plan 351, DEFAULT-ON) |
| Tropical (max,+) Algebra | 0.96× of simd_matvec (NEON); 3/3 fusion gates PASS | Worst-case/bottleneck aggregation via tropical semiring (Plan 337, Super-GOAT) |
| Cross-Resolution SIMD Encode | 11–15× faster encode at production scales (target was 1.5×) | Transposed basis layout + simd_matmul_rows replaces strided gather-dot (Plan 417) |
| GDN Tree Verification | 7.09× at T=128 (matches paper B200 GPU on CPU SIMD) | Rollback-free tree verify for delta-rule speculative trees via masked triangular solve (Plan 424) |
| MANCE SVD Caching | ~5× loop speedup (skip ~9 of 10 SVDs in 10-round loop) | Tangent basis reuse keyed on k-NN neighbor indices (Plan 427) |
| Newton-Schulz Blocked Matmul | 1.37× faster NS inv-sqrt r=64; per LoRA-Muon step 595µs→432µs | Rank-K blocked matmul eliminates per-dot call overhead (Plan 421) |
Matching the talos-vs-macbook reference model:
| Parameter | Value |
|---|---|
vocab_size | 27 (a–z + BOS) |
block_size | 16 |
n_embd | 16 |
n_head | 4 |
mlp_hidden | 64 (4×) |
n_layer | 1 |
temperature | 0.5 |
ModelArchitecture | NanoGpt, QwenDeltaNet |
AttentionMode | Standard, SpKvQuant, DashAttn |
WeightDtype | F32, F16, BF16 |
LLM drafts logits → ConstraintPruner filters invalid → DDTree builds valid-only tree → Target verifies
// From katgpt-core/src/traits.rs (signatures abbreviated)
pub trait ConstraintPruner: Send + Sync {
fn is_valid(&self, depth: usize, token_idx: usize, parent_tokens: &[usize]) -> bool;
fn batch_is_valid(&self, depth: usize, tokens: &[usize], parent_tokens: &[usize], out: &mut [bool]);
fn propagate(&self, depth: usize, token_idx: usize, parent_tokens: &[usize]) { }
fn manifold_score(&self, depth: usize, token_idx: usize, parent_tokens: &[usize]) -> f32 { 0.0 }
fn constraint_vector(&self, depth: usize, parent_tokens: &[usize]) -> Vec<f32> { vec![] }
}
pub trait ScreeningPruner: Send + Sync {
fn relevance(&self, depth: usize, token_idx: usize, parent_tokens: &[usize]) -> f32;
}
pub trait SpeculativeGenerator {
type Condition;
type Output;
type Error;
fn generate(&mut self, condition: &Self::Condition, rng: &mut fastrand::Rng) -> Result<Vec<Self::Output>, Self::Error>;
fn generate_batch(&mut self, conditions: &[Self::Condition], rng: &mut fastrand::Rng) -> Result<Vec<Vec<Self::Output>>, Self::Error>;
}
Additional core traits in katgpt-core/src/traits.rs: DominoPruner, CompletionHorizon, CollapseDetector, GameState, StateHeuristic, RolloutPolicy, LeoHead, AllGoalsUpdate, DualLeoMixer, AutocurriculumSampler, GenerativeConstraintPruner, QGradientOracle, PartialScorer, ProblemMutator, BestBuddyAligner. Plus DataGate in types.rs, and InferenceBackend (prompt→string contract, Issue 580) in the dedicated katgpt-core::prompt_backend module — hoisted from riir-game-sdk::gm::prompt so multiple consumers (riir-agents, the SDK, future callers) share one trait; ships a CannedResponseBackend mock. See crates/katgpt-core/src/traits.rs + crates/katgpt-core/src/prompt_backend.rs for full signatures.
KeywordRouter scores prompt against domain keywords, ExpertRegistry selects ScreeningPruner + LoRA. InferenceBackend trait + CpuBackend for backend abstraction.reader_lora active during prefill, writer_lora active during decode. Reference swap, zero data movement.The workspace has 27 in-tree crates (plus the root) organized in three
layers: shared leaves (depend on katgpt-types or nothing), katgpt-core
(traits + cognitive kernels, depends on leaves), domain stacks (depend on
katgpt-core + other domain crates), and the root crate (katgpt-rs) which
is the feature-aggregation surface that wires every domain crate into the
transformer runtime via ForwardContext. See .proposals/003_src_consolidation_master.md for the
full Phase 0–12 consolidation history. Phase 12 (Plans 378–404) completed
the substrate-extraction sweep; Issue 121 (2026-07-09) collapsed the last
6 shim folders into inline pub mod blocks. Only training code + benchmark
tooling + ForwardContext glue remain permanently root-resident.
graph TD
subgraph Leaves["Leaves (depend on katgpt-types or nothing)"]
types["katgpt-types<br/>(Config, Rng, SIMD)"]
hla["katgpt-hla<br/>(HLA substrate)"]
tokenizer["katgpt-tokenizer<br/>(BPE, ConvexTok)"]
dec["katgpt-dec<br/>(DEC operators)"]
microbelief["katgpt-micro-belief<br/>(BeliefKernel, BoMSampler)"]
personality["katgpt-personality<br/>(sigmoid composition)"]
sense["katgpt-sense<br/>(NPC sense composition)"]
sleep["katgpt-sleep<br/>(consolidation)"]
validator["katgpt-validator<br/>(partial parser, syn pruner)"]
percepta["katgpt-percepta<br/>(transformer-VM, zero katgpt deps)"]
proofcert["katgpt-proof-cert<br/>(GOAT proof certificates)"]
deprecated["katgpt-deprecated<br/>(exiled losers)"]
end
subgraph Core["Core layer"]
core["katgpt-core<br/>(traits, attention primitives, cognitive kernels)"]
end
subgraph Domain["Domain stacks"]
transformer["katgpt-transformer<br/>(weights, packing, mbu, tf_loop, swir, dense_mesh)"]
forward["katgpt-forward<br/>(ForwardContext top tier)"]
quant["katgpt-quant<br/>(KV codecs)"]
spectral["katgpt-spectral<br/>(eigenbasis)"]
attn["katgpt-attn<br/>(GDN2, CHIAR, RAT+, EGA)"]
attnmatch["katgpt-attn-match<br/>(MaxSim rerank)"]
kv["katgpt-kv<br/>(SP-KV, cache prune, segment ckpt)"]
spec["katgpt-speculative<br/>(DDTree, DFlash, spechop)"]
pruners["katgpt-pruners<br/>(bandit, screening, closure wire)"]
band["katgpt-band<br/>(band conditioner, collider pruner)"]
sparse["katgpt-sparse<br/>(SOPTV task vector, SPLAT)"]
claim["katgpt-claim<br/>(claim rubric, CLR)"]
ruliology["katgpt-ruliology<br/>(Wolfram ruliology)"]
backend["katgpt-backend<br/>(CPU/ANE/GPU inference backends)"]
end
root["katgpt-rs (root)<br/>(runtime, feature surface)"]
hla --> types
dec --> types
microbelief --> types
personality --> types
sense --> types
sleep --> types
validator --> types
core --> types
core --> hla
core --> dec
core --> microbelief
core --> personality
core --> sense
core --> sleep
transformer --> core
forward --> core
forward --> hla
forward --> pruners
forward --> spec
forward --> transformer
forward --> types
quant --> core
quant --> transformer
spectral --> core
spectral --> transformer
spectral --> types
attn --> core
attn --> forward
attn --> kv
attn --> pruners
attn --> spectral
attn --> transformer
attnmatch --> core
attnmatch --> kv
kv --> core
kv --> spectral
kv --> types
spec --> core
spec --> kv
spec --> pruners
spec --> transformer
spec --> types
pruners --> core
pruners --> percepta
pruners --> spec
pruners --> transformer
pruners --> types
band --> core
sparse --> core
sparse --> band
sparse --> spectral
claim --> core
ruliology --> core
ruliology --> pruners
backend --> forward
backend --> transformer
backend --> types
validator --> core
validator --> tokenizer
deprecated --> core
root --> core
root --> transformer
root --> forward
root --> quant
root --> spectral
root --> attn
root --> attnmatch
root --> kv
root --> spec
root --> pruners
root --> band
root --> sparse
root --> claim
root --> ruliology
root --> backend
root -.optional.-> proofcert
root --> validator
root --> tokenizer
root --> percepta
root --> microbelief
root --> personality
root --> sense
root --> dec
root --> deprecated
Dependency rules:
katgpt-types (or nothing, for katgpt-percepta
and katgpt-proof-cert). katgpt-core consumes the leaf substrate crates
(katgpt-hla, katgpt-dec, katgpt-micro-belief, katgpt-personality,
katgpt-sense, katgpt-sleep) and re-exports them as katgpt_core::*.katgpt-core attention primitives (attention, parallax_attn, set_attention,
funcattn) live in core and are NOT in katgpt-attn — they can't move up
without inverting the DAG.katgpt-hla (leaf); katgpt-core re-exports it as
katgpt_core::hla. The root's pub mod hla { ... } in lib.rs is pure
composition glue (Issue 121 collapsed the src/hla/ folder into an inline
module).katgpt-forward is the top-tier domain crate — it depends on katgpt-core,
katgpt-transformer, katgpt-pruners, katgpt-speculative, katgpt-hla,
and katgpt-types. katgpt-attn and katgpt-backend depend on forward.katgpt-band, katgpt-validator, katgpt-sparse, katgpt-claim,
katgpt-ruliology) plus katgpt-backend (Issue 413, 2026-07-08) and
root shims preserving every historical katgpt_rs::* path. Phase 12
(Plans 383–404) finished the substrate sweep; Issue 121 (2026-07-09)
collapsed the last 6 shim folders into inline pub mod blocks. Only
training code + benchmark tooling + ForwardContext glue remain
permanently root-resident.pub use katgpt_X as Y in lib.rs
(or inline pub mod X { pub use katgpt_X::*; ... } post-Issue-121) so
existing katgpt_rs::* paths resolve.The default production stack has 204 GOAT-proved default-on features (641 total flags), but they don't all run on every token. The architecture uses layered gating — most features are bandit-driven, Option-gated, or compile-time-only.
flowchart TD
subgraph HOT["🔴 Always-On Hot Path — 12 features per token"]
KOG["kog_cpu_fusion\nFused RMSNorm+QKV kernel"]
SPARSE["sparse_mlp\nTwELL sparse matmul"]
DELTA["delta_routing\nBlock-boundary delta accumulate"]
MLS["mls_aggregate\nMulti-layer residual sum"]
DOMAIN["domain_latent\nMid-layer K/V inject"]
PPOT["ppot\nCPU resampling"]
SPECTRAL["spectral_quant + hybrid_oct_pq\nKV cache storage format"]
KVARNS["kvarn + kv_share\nVariance-norm KV + Q-K=V sharing"]
ATTNS["gdn2_attention + lt2_looped\nO(1) decode recurrent attention"]
ELF["elf_sde\nDDTree noise injection"]
end
subgraph GATED["🟡 Conditional — ~30 features, 1 check each"]
BANDIT["Bandit-driven arm select\nbandit, bandit_top_p, freq_bandit\nsr2am, curvature_alloc, wealth_pruner\nrosetta, directional_credit, self_distilling"]
OPTION["Option-gated\nhydra_budget, cna_steering\nkurtosis_gate, domino_correction"]
THINK["Thinking mode only\nthinking_cot, chain_fold\nthinking_prune, parallel_probe"]
SPEC["Speculative pipeline\nbt_rank, lodestar, best_buddies\ntrust_region_spec, corr_budget\nbelief_drafter, bfcf_tree"]
end
subgraph OFFLINE["🔵 Offline — ~8 features, not in forward pass"]
DIAG["Training/diagnostics\nnewton_schulz, river_valley\nspectral_hierarchy, roofline_cost\nsigmoid_margin, stability_metrics"]
BG["Background\nsleep_consolidation\ndreamer"]
end
HOT --> GATED
HOT -.->|"post-token"| BG
GATED -.->|"offline"| DIAG
GATED -.->|"between sessions"| BG
These execute unconditionally on every token — they replace kernels, formats, or accumulate state:
| Feature | What | Why Always-On |
|---|---|---|
sparse_mlp | Skip dead ReLU in w2 matmul | Replaces dense matmul kernel |
kog_cpu_fusion | RMSNorm gamma folding + QKV interleaving | Fused kernel replacement |
delta_routing | Cross-layer residual delta routing at block boundary | Accumulates per-layer, routes at block edge |
mls_aggregate | Average last K layer residuals before LM head | Structural blend into final logits |
domain_latent | Mid-layer K/V injection | Option-gated inject at n_layer/2 |
spectral_quant | Calibrated eigenbasis + water-fill KV codec | Storage format, not conditional |
hybrid_oct_pq | OCT triplet + PQ 2D Givens KV compression | Replaces quantization codec |
kvarn | Variance-normalized KV cache quantization | Cache format when selected |
kv_share | Q-K=V projection sharing, 50% KV reduction | Weight merge at load time |
gdn2_attention | Gated DeltaNet-2 O(1) decode | Replaces KV cache with fixed state matrix |
lt2_looped | Weight-shared T-pass loop + AHLA | Changes forward function signature |
elf_sde | Logit-normal noise injection for DDTree diversity | Applied during draft tree build |
graph LR
subgraph Input
A[Tokenizer] --> B[PFlash/DashAttn Prefill]
end
subgraph Model
B --> C[Transformer Forward]
C --> D[Delta Routing]
C --> E[Hybrid OCT+PQ KV]
C --> F[Sparse MLP]
C --> G[MLS Aggregate]
end
subgraph Decode
C --> H[DDTree Search]
H --> I[BT Rank]
I --> J[Leviathan Verify]
end
subgraph Adapt
K[SR2AM Config] --> H
L[BanditPruner] --> H
M[CNA Steering] --> C
end
| Component | What | Gate |
|---|---|---|
| BPE Tokenizer | Train/encode/decode | always |
| PFlash | Block-sparse speculative prefill, 21× seq reduction | always |
| DashAttention | α-entmax (1.5) adaptive routing replaces fixed top-k | dash_attn |
| RTPurbo | Head-wise retrieval/local classification, dynamic top-p | rt_turbo |
| Budget Adaptation | Compression-adaptive DDTree budget [0.5×, 2.0×] | budget_adaptation |
| Component | What | Gate |
|---|---|---|
| Sparse MLP | Skip dead ReLU neurons in w2 matmul | sparse_mlp |
| Delta Routing | Cross-layer residual delta routing at block boundary | delta_routing |
| Hybrid OCT+PQ | Default KV codec — OCT triplet + PQ 2D Givens, best MSE | hybrid_oct_pq |
| SpectralQuant | Calibrated eigenbasis + water-fill (secondary) | spectral_quant |
| MLS Aggregate | Average last K layer residuals before LM head | mls_aggregate |
| Domain Latent | Mid-layer K/V injection | domain_latent |
| PPoT | CPU logit resampling at high-entropy positions | ppot |
Note: These are opt-in alternative forward paths (
forward_gdn2(),forward_raven(),forward_looped()). The defaultforward()→forward_base()uses standard O(N) softmax attention.
| Component | What | Gate |
|---|---|---|
| GDN2 | Gated DeltaNet-2 — O(1) decode, constant state per head | gdn2_attention |
| Raven RSM | Fixed-slot Top-K routing memory, frozen unselected slots | always compiled, opt-in forward_raven() |
| HLA/AHLA | Higher-order Linear Attention — O(1) prefix stats | hla_attention |
| LT2 Looped | Weight-shared T-pass loop, hybrid SDPA+AHLA | lt2_looped |
| TF Loop | Training-free ODE-motivated sub-stepping | tf_loop |
| DMax SPD | Soft parallel decode, hybrid token/mask embeddings | dmax_spd |
| FlashAR Consensus | Dual-path ternary thermal routing | flashar_consensus |
| Component | What | Gate |
|---|---|---|
| DDTree | Best-first tree from marginal log-probs | always |
| LeviathanVerifier | p/q rejection sampling, identical output distribution | always |
| BT Rank | Bradley-Terry pairwise ranking, +10.6pp over pointwise | bt_rank |
| BanditPruner | UCB1/ε-greedy/Thompson adaptive ScreeningPruner | bandit |
| ELF SDE | 10-22× path diversity via logit-normal noise | elf_sde |
| Lattice Deduction | α-intersection pruning + conflict detection | lattice_deduction |
| PhraseBoost | Context trie phrase boosting for DDTree | phrase_boost |
| Parallel-Probe | Consensus-based parallel branch control | parallel_probe |
| Component | What | Gate |
|---|---|---|
| SR²AM Configurator | Per-turn planning regulation (PlanNew/Extend/Skip) | sr2am_configurator |
| Data Gate | Task-level filtering before solver | data_gate |
| CNA Steering | Contrastive Neuron Attribution + runtime modulation | cna_steering |
| Deep Manifold | L2/KL fixed-point residual scoring | deep_manifold |
| Federation | Symmetric KL coupling between domain experts | federation |
| SimpleTES | RPUCG graph-based bandit loop | tes_loop |
| Stability Metrics | P50/P99/CV per-step latency instrumentation | stability_metrics |
| PlasmaPath (Hot) | Bit-plane ternary SIMD matvec, 1.71 bits/weight — the Hot-tier CPU path (Issue 145 reclassified binary to Plasma, ternary to Hot) | plasma_path |
| BinaryPlasma (Plasma) | Single bit-plane ±scale SIMD matvec, 1.125 bits/weight — the fastest tier (opt-in; 1.22× faster + 1.82× smaller than ternary) | binary_plasma |
| MoA Inference | Token-adaptive Mixture-of-Activations SwiGLU | moa_inference |
| Newton-Schulz | Cubic fixed-point orthogonalization + Muon momentum | newton_schulz |
| Spectral Hierarchy | Eigenspace alignment, Haar wavelets, Cauchy interlacing | spectral_hierarchy |
| Roofline Cost | GPU operator runtime prediction (~5µs CPU) | roofline_cost |
| Kog CPU Fusion | RMSNorm gamma folding + QKV interleaving | kog_cpu_fusion |
| PEIRA Distill | Collapse-free inter-view regressor alignment | peira_distill |
| ILC Distill | Synonym-aware DDTree pruning via offline k-means | ilc_distill |
| Hydra Budget | Emergent self-repair layer skipping | hydra_budget |
| Trigger Gate | CPU/GPU/ANE tier promotion via QPS/latency/queue monitoring | inference_router |
| FreqBandit | Oscillatory spectral bandit — cyclic pattern detection → adaptive speculative decode | freq_bandit |
📖 Full GOAT audit table with research source, real gain, and replaced feature: See .docs/01_orientation/overview.md.
| Feature | Plan | GOAT | Key Gain |
|---|---|---|---|
Posterior-Guided Pruner Evolution (posterior_evolution) | 239 | 8/8 ✅ | Bayesian precision-gated lifecycle actions (Patch/Split/Compress/Retire), 258ns overhead |
Spectral Irrep Pruner (spectral_pruner) | 246 | ✅ | Spectral flatness detection for converged logit distributions, +3.6% overhead only |
Spectral Budget Router (spectral_budget) | 254 | 19/19 ✅ | Layer-adaptive NS depth + rank-p spectral truncation (opt-in — GOAT-gated, not in default) |
Regime Transition (regime_transition) | 215 | 8/8+4/4 ✅ | Self-revising discovery, -0.3% overhead vs real decode |
SubstrateGate (substrate_gate) | 216 | ✅ | Inference-time capability substrate routing via MLP masks |
Critical Interval Gate (critical_interval_gate) | 222 | ✅ | Entropy-triggered solver switch, zero cost (entropy already computed) |
LLMExecGuard (llmexec_guard) | 223 | ✅ | Entropy-driven verification budgeting, zero cost when guard holds |
Outlier-Aware Quant Guard (outlier_guard) | 224 | ✅ | KS-test outlier detection for weight matrices |
EGCS (egcs) | 206 | ✅ | Episode-guided constraint synthesis from successful translations |
Three-Mode Router (three_mode_router) | 211 | ✅ | Neuro-symbolic bandit: Direct/CoT/Symbolic per-query routing |
Breakeven Routing (breakeven_routing) | 250 | 7/7 ✅ | 49% wallclock savings on long sequences, ~9ns overhead |
DEC Operators (dec_operators) | 251 | Foundational ✅ | Discrete Exterior Calculus on cell complexes, conservation-guaranteed |
Cubical Topology (lattice_operad) | 252 | Foundational ✅ | IntervalPruner + CubicalNerve + LatticeOpernad composition |
Segment Checkpoint (segment_checkpoint) | 226 | ✅ | Cached KV segment checkpoints at segment boundaries |
RCD Residual (rcd_residual) | 258 | ✅ | Entropy-weighted residual context injection for D2F |
Spec Pruner (spec_pruner) | 259 | ✅ | Modelless spec-to-constraint O(1) RoaringBitmap compilation |
Epiplexity Bandit (epiplexity_bandit) | — | ✅ | Epistemic perplexity bandit for domain-aware routing |
CADDTree Budget (caddtree_budget) | 219 | ✅ | Compositional adaptive DDTree budget allocation |
Static Cal Tables (static_cal_tables) | 227 | ✅ | Pre-computed quantization calibration, zero inference cost |
Targeted Precision (targeted_precision) | 227 | ✅ | Per-head bit allocation from weight statistics |
Modality Pruned Load (modality_pruned_load) | 227 | ✅ | Pipeline pruning for modality-specific context loading |
Precision Aware Draft (precision_aware_draft) | 227 | ✅ | Quantization-aware speculative draft scoring |
Async QDQ Overlap (async_qdq_overlap) | 227 | ✅ | Overlapped quantize-dequantize with compute |
Sparse Off-Principal Task Vector (sparse_task_vector) | 264 | G1–G2 ✅ | OPD-grounded sparse delta format, 2.9–5.7× storage reduction vs dense LoRA |
Off-Principal Retrieval (off_principal_retrieval) | 264 | G3–G4 ✅ | ≥99% principal energy removed, off-principal beats cosine top-1 |
Spectral-Concentration Adaptive Rank (spectral_rank) | 264 | G5–G6 ✅ | ≥30% avg rank reduction via OPD spectrum concentration |
Module-Energy Compute Routing (module_energy_route) | 264 | G7–G8 ✅ | Paper FFN profile match (Plasma/GPU/ANE/SIMD), monotone QPS routing |
Band Conditioner (band_conditioner) | 265 | G0a/G0b ✅ | Band conditioning set + Fisher-z CI test primitives for task-relevant identifiability (arXiv 2605.12733) — band-set exact match to paper Fig 2; Fisher-z power ≥90% at n=1000 α=0.05. Default-on (T5.3, 2026-07-02). |
SPLAT Specialist Projection (specialist_projection) | 265 | G4–G6 ✅ | Specialist latent projection (Fusion B) — ≥30% hidden-dim reduction at parity, mask discovery ≤ d_hidden samples, MSA rescue at 50% density. Default-on (T5.3, 2026-07-02). |
CCCP Collider-Consistency Pruner (collider_consistency) | 265 | G7–G9 ✅ | Collider-consistency ConstraintPruner for DDTree (Fusion C) — dead-branch rejection ≥90%, expansion reduction ≥25%, no-task overhead <5ns. Default-on (T5.3, 2026-07-02). |
Gauge-Invariant Adapter Composition (gauge_invariant) | 270 | 17/17 ✅ | LoRA-Muon NS inv-sqrt + gauge rebalance + compose, 4609%→0% error |
CHIAR Chiaroscuro Attention (chiaroscuro) | 269 | 9/9 ✅ | Per-token DCT spectral entropy KV strategy (3.03× compression), operator routing, collapse discovery |
Attention Matching (attn_match) | 271 | 9/9 ✅ | Modelless KV compaction (K,V)→(Ck,β,Cv): β-recovery 1e-6, Cv Frobenius 0.0, 3.01× SIMD, blocked Cholesky (32×32), adaptive router (scalar/SIMD/rayon/GPU/ANE) |
Manifold Power Iteration MoE Router (manifold_power_iter_router) | 279 | 9/9 ✅ | One-shot router-row conditioning at snapshot swap, sub-ms swap (0.076ms N=8 D=256), byte-identical determinism |
Quantile Balancing MoE Router (quantile_balance_router) | 455 | G1–G8 12/12 ✅ + Phase 3 Case C ✅ | One-shot per-expert bias β at snapshot swap via alternating-coordinate descent on the balanced-assignment LP (Su blog + Marin 32B validation). MaxVio 3.000→0.0625 (48× at M=64), 0.131ms swap (N=8 M=256). Phase 3 head-to-head vs MPI: Case C — composed pipeline strictly Pareto-dominates either alone (λ 0.65→0.99 from MPI, MaxVio 1.84→0.00 from QB on orthogonal axes). DEFAULT-ON since Plan 455 Phase 3 (2026-07-17) |
Temporal Derivative Kernel (temporal_deriv) | 277 | 4/4 fusions ✅ | Dual fast/slow EMA surprise signal — state-vector companion, surprise-gated writes, collapse detection, curiosity signal |
Triggered Injection Gate (triggered_injection) | 278 | G1/G2/G3/G8 ✅ | Sigmoid-thresholded inject/skip gate — 50% skips w/ 0.63% quality parity in saturated regime |
FaithfulnessProbe (faithfulness_probe) | 278 | G1/G2/G8 ✅ | Causal intervention diagnostic — 100%/100% detection, IG surrogate Spearman ρ=1.0, audit cadence |
SmearClassifier (smear_classifier) | 298 | G1/G2/G3 ✅ | Ternary (CoherentSingle/TokenSmear/SequenceSmear) latent-mass vocabulary extending Plan 278 — SequenceSmear/TokenSmear unfaithfulness ratio 2.11×, k=8 d=32 at 107.6 ns |
Salience Tri-Gate (salience_tri_gate) | 303 | 4/4 ✅ | 3-way per-tick emit gate (Speak / Silent / Delegate) with silence as a first-class variant, two stacked sigmoids (never softmax), zero-allocation hot path. decide() 9.11 ns for D=8 (target <50ns, ~5 ns over single-sigmoid), decide_batch() 120.6 M/s for D=8 N=1000 (target ≥50M). Default-on (Plan 303 Phase 5, 2026-06-23). |
Engram (engram) | 299 | G1/G2/G4 ✅ (G6 deferred) | Hash-addressed sigmoid-fused static pattern memory — N-gram → multi-head hash → O(1) lookup → sigmoid gate → residual fuse. 48 ns/retrieval, Spearman ρ=1.0. Opt-in pending G6 (effective-depth) in riir-ai |
CS-KV-Importance Probe (cs_kv_probe) | 280 | G1/G2/G3 ✅ | Compressed-sensing KV-group importance probe + density-budget interpolator, sigmoid-compatible |
BoMSampler (bom_sampling) | 281 | G1/G2/G3 ✅ | K-hypothesis single-pass belief sampling — K=8 at 1.87× step, +31.49pp arena win in riir-ai Plan 314 |
Self-Advantage Gate (self_advantage_gate) | 283 | 4/4 ✅ | Dead-compute detector via log π+(a) − log π̂(a) — paper 18× forward-pass reduction, vocab ≤ 128 |
CLR Claim-Level Reliability (clr) | 284 | ✅ | Runtime CLR — sigmoid projection vote over claim embeddings, self-adaptive test-time scaling |
Sink-Aware Attention (sink_aware_attn) | 287 | G1/G2 cached ✅ | NOP/Broadcast classifier + dual-policy sigmoid gate — cache cadence=16 ≤5% steady-state |
ICT Branching Detector (ict_branching) | 294 | G1/G3/G4/G5/G6/G10 ✅ | collision_purity β(π) = Σ π², JS-divergence novelty, BranchingDetector — ρ(H₁,JS)=0.065 (Super-GOAT proceeds) |
CCE Moderator (cce_moderator) | 295 | G1/G2/G3 ✅ | LP-CCE solver + Bregman primal-dual iterator (arxiv 2606.20062). Chicken CCE welfare +37.5% over Nash; designer steering demo shows two Γ₀ → two different CCEs. DEFAULT-ON after Plan 295 + Plan 300 T4.3b GOAT (homogeneous equivalence + regret transfer + heterogeneous primal-dual convergence + 16p 33.97ms < 50ms target). |
MicroRecurrentBeliefState (micro_belief) | 276 | G1.1–G1.4 ✅ | BeliefKernel trait unifying attractor + leaky-integrator families — G2 (attractor coherence) deferred |
Algorithmic-Probability Sampler (complexity_prior_sampler) | 305 | G1+G2 ✅ | Levin-Search variant for modelless inference — sigmoid(-α·K̃(x) - β)-weighted candidate sampling with pluggable K̃ proxies (RLE / Shannon entropy / L1). G1 safety 5/5 landscapes PASS; G2 exponential speedup: RLE 92275× + Entropy 18455× stretch on low-K optimum (L1 honest-negative on sparse byte encoding, documented domain mismatch). Per-candidate sigmoid never softmax. Default-on (Plan 305 Phase 2, 2026-06-23). |
| Forensic Watermark | Moved to riir-ai | Recipe impl relocated to Plan 322 (honeypot OPSEC) | |
Depth-Invariance Diagnostic (depth_invariance) | 306 | G1/G2/G3 ✅, G4 (re-spec) ✅ | Root-cause attention-drift classifier (DepthInvariant / DepthSpecificRefinement / Collapsed) + MagnitudeRegularizedResidual fix for owned kernels. G2 reproduces paper Figure 10 on random-init BeliefDrafter; G3 negative control on micro_belief/attractor classifies as DepthInvariant. SIMD inner-loop via simd::simd_sum_sq_quartic. Zero runtime cost unless invoked. Default-on (T7.4, 2026-06-23). |
Claim Rubric Runtime (claim_rubric) | 307 | 17/17 round-trip ✅ | L1/L2/L3 evidence-ladder validator — executable rubric for probe/steering claims. Vocabulary must match evidence ("causally controls" requires L3; "reads" is L1-safe). 17/17 Phase 2 round-trip + 1/1 GOAT gate green. Meta-discipline primitive, zero runtime cost unless invoked. Default-on (T3.3, 2026-06-23). |
Closed-Unit Compaction Gate (closed_unit_compaction) | 333 | 7/7 ✅ | Generic rubric-gated trajectory compaction primitive (SelfCompact, arxiv 2606.23525) — fires at structurally-safe moments (closed-unit ∧ summarizable ∧ progress ∧ ¬stuck). evaluate() 8.91 ns (target <50ns), 112.9 M/s (target >=50M). Super-GOAT: trajectory compaction and shard freeze are the same primitive (G7 proven structurally). Default-on (Phase 6, 2026-06-25). |
Sigmoid-Graded Reject Confidence (sigmoid_graded_reject) | 310 T1 | T3.2 6/6 + T3.1 5/5 ✅ | Tolerant soft-reject relax-and-retry on ConstraintPruner — default reject_confidence() reproduces is_valid() bit-identically (zero-behavior-change); sigmoid-graded impl + soft_reject_with_relax pipeline routes borderline candidates through relaxation. HarnessBridge Table 7: tolerant > strict because false_reject_cost > false_pass_cost. Default Δ 0.000ns, graded +3.734ns, batch 2647M/s, pipeline +0.241ns; tolerant FR 1.69% vs strict 5.49% (Δ −3.80pp), net reward +603.3, precision ratio 0.9456. Zero runtime cost unless caller invokes soft_reject_with_relax. Default-on (T4.1, 2026-06-26). |
CausalHeadImportance (causal_head_importance) | 358 | G1/G2/G3/G4 ✅ | Causal-intervention head scorer (HydraHead arXiv:2606.20097) — activation patching (Eq 10) + path patching (Eq 11) + span-level logit-diff readout (Eq 9) + cross-capability fusion (Eq 12). Strictly stronger than RTPurbo's attention-mass calibration: G2 bystander discrimination Jaccard 1.000 vs 0.000 (causal invariant, attention-mass collapses). G3 partition ≤ 2× attention-mass (faster at n≥64). Plus ScaleNormalizedFusion (Eq 13–14, currently unused). Opt-in — CalibrationMode::AttentionMass stays default (causal score production is ~10–100× costlier); use CausalNecessity for the long-context-extreme bystander regime. |
Misalignment Indicator Probe Bank (indicator_probe_bank) | 320 | G1–G7 ✅ | Structured N-direction cognitive-indicator detector (arxiv 2606.24251 Zhou et al.) — BLAKE3-committed direction vectors projected via dot-product + sigmoid, OR-fused into one firing label. G1 per-indicator AU-ROC 1.000, G2 OR-fusion TPR 1.000/FPR 0.041, G3 cascade 100× FPR reduction at 0pp cost, G4 53.9 ns (N=8, D=72) + 0 allocs, G5 similarity block ARI 1.000, G6 feature-off clean, G7 wire tamper-evident. indicator_similarity also default-ON; indicator_cascade opt-in (consumer-crate verifier territory). Default-on (Plan 320 Phase 5, 2026-06-25). |
Tropical (max,+) Algebra (tropical_algebra) | 337 | Super-GOAT ✅ | (max,+) tropical semiring matvec + DEC wrappers for worst-case/bottleneck aggregation (arxiv 2403.04807). D=64 matvec 0.96× of simd_matvec (NEON); 3/3 fusion gates PASS. Default-on. |
Temp-Loss Fingerprint Selector (temp_loss_fingerprint) | 341 | G1 ✅ | Perturbed-loss-vector diversity selector via Lipschitz gradient bounds (arxiv 2606.26797). G1 15.44× diversity ratio; select_diverse_subset 130µs (<1ms); cross-repo neuron-db gain +0.1672. Default-on. |
Zone Density Routing (zone_density_routing) | 351 | G5a/b/c ✅ | Density-aware zone routing: classify + outer-first schedule + papaya LRU cache with 3 invalidation rules. G5a +41.54% routing, G5b 99.1% cache hit, G5c 0 stale reads. Default-on. |
Set Attention (NPT half) (set_attention) | 354 | G1–G5 ✅ (G8 CLOSED) | Permutation-equivariant sigmoid-gated cross-entity set attention (arxiv 2106.02584). Production 75.7µs/tick @ 100 NPCs (6.6× headroom). G8 collective inference closed by the CLR-weighted sibling (Plan 570). Default-on. |
CLR-Weighted Set Attention (clr_weighted_set_attention) | 570 | G1/G2/G4/G8 ✅ | Reliability-weighted sibling of set_sigmoid_attention_into — output_i = h_i + (γ/Σ r_j)·Σ α_ij·r_j·(v_j−h_i), uniform r_j=1 reduces bit-identically to plain SA. CLR ^M reliability gate converts averaging into amplification: +8.7pp identification accuracy + 3.88× aggregate amplification over plain SA on the N=64 crowd threat-detection fixture (Issue 575 PoC). Default-on. |
Heat Kernel Trajectory (heat_kernel_trajectory) | 359 | All 5 phases ✅ | Single-shot DEC cochain field prediction via operator exponential (arxiv 2606.27364) — exact at long horizons vs O(T·dt²) Euler error. Default-on (katgpt-dec). |
QMC Belief Sampling (qmc_sampling) | 367 | G1–G6 ✅ | QuasiMoTTo — QMC uniform sources (Lattice/Stratified/Sobol) + arithmetic-coding descend, drop-in for iid in K-rollout paths (arxiv 2607.01179). 850/850 lib tests, 26 bootstrap tests. Default-on. |
Manifold Bandit Latent Task Tree (manifold_bandit) | 370 | G1/G3/G4/G5 ✅ | LatentTaskTree + HierarchicalThompsonSampler + BayesianFilterArm (arxiv 2606.19750). G1-real 0.740 ratio; R279 N≥d phase gate ships opt-in (+11% convergence). Default-on. |
Mean-Field Regime Classifier (mean_field_regime) | 371 | G1–G5 ✅ | MeanFieldOverlap + HopfBoundary + RegimeClassifier (Static/NSO/IS/GLC) — crowd oscillation regime classifier (arxiv 2606.30366). PoC 25/25 (4/4 regimes). Default-on. |
Velocity Field Ensemble (velocity_field_ensemble) | 376 | G1–G4 ✅ | Algebraic combination of P frozen velocity fields via ridge-solved η weights (arxiv 2602.20070). Beats conformal-naive floor (Plan 340). Heterogeneous-D variant opt-in. Default-on. |
Local Branch Routing (local_branch_routing) | 377 | G1–G6 ✅ | PostCandidateRouter trait + DotProduct/ColliderAdapters (arxiv 2606.25354). Samples K candidates, forwards, set-attends, commits via relative routing. PoC +9pp to +26pp quality gain; argmax 51ns + sampled 69ns at K=3 D=64. Default-on. |
ANE Roofline Cost Model (ane_roofline) | 379 | G1/G2/G4 ✅ | ANE-aware roofline cost model with third axis (working-set size), M1–M5 peaks (arxiv 2606.22283). G1 ±30% on 4 ref shapes; G4 p50 <1µs. Refines NpcBrainRouter's hardcoded threshold. Default-on. |
Step Attribution Qualifier (step_attribution_qualifier) | 381 | G1/G2/G4 ✅ | StepAttributionQualifier — Δ≥0 commit gate (SkillAdaptor eq.8) + StepLocalizer trait fusing Localize+Link (arxiv 2606.01311). G1 14/14, G2 81.6% drift reduction (riir-ai PoC), G4 13ns aggregate @ W=64. Default-on. |
Spherical Geodesic Steering (spherical_steering) | 405 | G1–G5 ✅ | Geodesic Slerp rotation of latent vector toward unit-norm target + vMF confidence gate; norm-preserving on S^{d-1} (arxiv 2602.08169). Phase 5 (F1 fusion) deferred. Default-on. |
Renoise-CE Self-Verifier (renoise_ce) | 406 | G1/G2/G4/G5 ✅ | Perturb-completed-output + re-resolve + measure-drift self-verifier, operator-agnostic, no labels/verifier head (arxiv 2606.29150). G1 renoise=1.000 vs plurality=0.000 (100pp); G2 CLR fusion +30.5pp (6× target); G4 0 allocs, G5 36µs. Default-on. |
Sheaf-ADMM Coordination (sheaf_admm) | 407 | G1–G6 ✅ | Three-state primal/consensus/dual ADMM on a cellular sheaf (arxiv 2605.31005, ICML 2026). G1 DEC identity ‖F x‖∞=3.26e-8, G4 1.808 µs (K=100, d_v=8, d_e=5, T=5), G5 zero-alloc, G6 bit-exact determinism. Generic math operator — the private consumer runtime (riir-ai Plan 394 sheaf_coordination) is default-on as of 2026-07-07 (Super-GOAT: G7–G11 all PASS — collective inference, emergent divergence, forensic tamper-evidence). Default-on in katgpt-dec. |
Region-Conditioned Subspace Field (region_subspace_steering) | 416 | G1–G5 ✅ | MFA local-geometry steering — K regions × per-region centroid + per-region R-dim subspace (arxiv 2602.02464). Two-mode steering: centroid interpolation + local subspace offset. K=1 degenerate parity with Plan 412 bit-identical (0/800 mismatches). 943ns/call. Default-on. |
| Cross-Resolution SIMD Encode | 417 | G1–G5 ✅ | Pure perf: transposed basis layout + simd_matmul_rows replaces strided gather-dot. 11–15× faster encode at production scales (target was 1.5×). No new flag — optimization on DEFAULT-ON cross_resolution_transport. |
| Newton-Schulz Blocked Matmul | 421 | G1–G5 ✅ | Pure perf: rank-K blocked matmul eliminates per-dot call overhead in NS inv-sqrt (LoRA-Muon Plan 270). ns_inv_sqrt_psd_into r=64: 297µs→216µs (1.37×); per LoRA-Muon step: 595µs→432µs. No new flag — optimization on DEFAULT-ON newton_schulz. |
TILR (tilr_invariant_subspace) | 425 | G1–G4 ✅ | Trajectory-Invariant Latent Refinement — alignment-gated subspace-projected correction with bit-identical γ→0 no-harm contract. 24.7ns/call HLA scale, 0 allocs. Default-on. |
| MANCE SVD Caching | 427 | G1–G5 ✅ | Pure perf: cache tangent basis {B,σ} keyed on k-NN neighbor indices. ~5× loop speedup (skip ~9 of 10 SVDs). No new flag — optimization on DEFAULT-ON manifold_erasure (Plan 426). |
Cross-Stage Residual Relocation (cross_stage_relocation) | 431 | G1–G6 ✅ / G7 ⏳ | Knowing-Using Gap (arxiv 2607.08393) — permeation_scan_into 2D (src,dst) intervention heatmap reusing Plan 358's direct_effect_importance + two-cluster classification; RelocateOp applied operator with paper's fixed (0.82L→0.45L)+(0.10L→0.45L) default (RelocatePair::LateEarly, 58–75% oracle recovery). Scan 10–25% faster than hand-rolled; operator <0.03% of forward pass; 0 allocs. Opt-in — G7 (58–75% recovery transfer to our substrate) deferred to Phase 3 PoC in riir-poc/; our latent functors/HLA don't have the paper's early/late MLP structure. |
SIMD LUT Fused Dequant+Dot (simd_lut_dequant) | 452 | G1–G4 ✅ (split) | Software SIMD LUT-accelerated dequant distilled from StreamDQ's hardware DQB (arxiv 2607.11262 §2.3). Split decision: the fused dequant_dot_via_lut kernel wins 4.58× over the two-step path (NEON FMA + no buffer spill) → default-on; the plain dequant_via_lut is 3.5× slower than the arithmetic cast on NEON (scalar gather, no native instruction) → stays opt-in infrastructure for future FP8/INT8. Cross-repo: simd_lut_q4k promoted to default-on in riir-engine (Plan 486 T3.3, multi-block 2.300× / full-GEMV 1.971× / single-block 2.027×). |
3D CellComplex grid_3d + Stochastic Birth/Death NCA (grid_3d) | 454 | G1a/G1b/G2/G3/G4/G5/G6 ✅ | 3D cubical CellComplex::grid_3d + 7-point-stencil graph_laplacian_grid_3d_into + zero-alloc stochastic_birth_death_step NCA growth + argmax_block_type raw→categorical bridge (arxiv 2103.08737 Sudhakaran 3D NCA). G1a growth reach 6.0×, G1b branched morphology 1.80× roughness (modelless crowding-death fix), G2 regeneration 100%, G4a stencil 1.74× 3D/2D, G4b overhead 64.4%, G5 0 allocs, G6 bit-identical. Default-on in katgpt-dec. |
Conformal Predictive Intervals (conformal_predictive_intervals) | 340 + 468 promo | G1–G4 ✅ | Modelless conformal UQ overlay wrapping any PointForecaster — ConformalIntervalCalibrator<F> with exp-recency-weighted residual ring buffer + empirical-quantile reads producing coverage-guaranteed [point+q_{α/2}, point+q_{1−α/2}] (Plan 340, arxiv 2605.03789 CSP + 2606.09473 "Report the Floor"). Also ships the canonical UQ floor — ConformalIntervalCalibrator<SeasonalNaiveForecaster> m=1 — that every UQ-bearing primitive's GOAT gate MUST beat (Issue 010 "Report the Floor" rule, codified in AGENTS.md Feature Flag Discipline). Primitive-level G1–G4 PASS (Bench 340): coverage [0.9445, 0.9493] ∈ [0.93, 0.97], interval_into H=1 642 ns (≤1 µs target), 0 allocs/100 calls, bit-reproducible. Pure modelless (empirical-quantile calibration, no training, no learned params). Default-on (Plan 468 promotion, 2026-07-20): runtime-consumer gate satisfied by Bench 564 (MCTS collapse G3 PASS — per-NPC calibrated τ beats fixed magic number on collapse-detection F1) + Bench 565 (Salience Tri-Gate G3 PASS — interval-width Delegate nudge beats KARC anticipation, dF1=+0.3145 at 6.3× gate margin, dFP=−0.8155). Plan 513 width-definition fix vindicated Bench 565 bit-identically. Two consumers FAILED (Bench 562 curiosity — wider than 5×EMA; Bench 563 sleep-time — distribution-level summary loses cycle info); Cargo.toml language required only one PASS, two landed. Consumer-level gates STAY opt-in — karc_conformal_width (riir-engine, +113.9% overhead per Plan 512 — FAIL default promotion), salience_conformal_width, 4 probe features. The three-layer split (primitive DEFAULT-ON + consumer gates opt-in) is the canonical append-only pattern. Zero runtime cost unless invoked. |
Poincaré Adapter (poincare_navigator) | 449 | G1–G7 ✅ | Closed-form latent navigation distilled from SeeSE3 (Plan 449, arXiv:2607.14228 Chen et al. DeepMind 2026). Frozen PoincareAdapter Pod holds (φ, W, W†) — given a desired movement in target space (3D pose / HLA affect), recover the latent step via z_dest = z_src + φ⁻¹(φ(z_src) + W†·Δtarget). Inverse navigation G3 Hit@0.3=1.000 (perfect), poincare_navigate_into 809 ns/call at d=64 (≤1µs target, 20% headroom), 0 allocs steady-state, 4-step open-loop trajectory bit-identical. G2 caveat (modelless PCA-tanh R²=0.71 < linear ridge R²=0.93) closed by riir-train Plan 317 — trained 2-layer MLP φ reaches R²=0.9997. Default-on (Phase 19, 2026-07-18): load-bearing value is closed-form inverse navigation + frozen Pod pattern (neither depends on G2 strict-domination). Promotion pattern matches manifold_bandit P370 / set_attention P354 / ac_prefix P313. Pure modelless (closed-form PCA + ridge + thin SVD pseudoinverse). Zero runtime cost unless invoked. |
ChunkedContentStore (chunked_content_store) | 448 | G1–G7 ✅ | Lore-distilled chunked content-addressed Merkle blob store (Plan 448, Research 262, EpicGames/lore). Bytes → FixedSizeChunker / FastCdcChunker → BLAKE3 per chunk → papaya lock-free dedup → binary Merkle root BlobId. O(log n) inclusion proofs via build_binary_merkle_proof + light-client-friendly associated fn verify_binary_merkle_proof (no &self). G1 dedup 8.47× on 90%-shared corpus, G2 incremental push 1.35% bytes touched (CDC) vs 52.94% (FixedSize control), G3 prove 588 ns + verify < 1µs (release; 2088× speedup after cached Merkle levels fix), G4 type-system-enforced light-client verify, G5 hot-path p99 < 200 ns (release), G7 tamper detection 10000/10000. Default-on (Phase 19b fix-up, 2026-07-18 — bench recorded promotion but Cargo.toml entry was missed until then). Pure modelless (BLAKE3 + binary Merkle). Zero runtime cost unless a caller constructs a store. Consumed by riir-ai Plan 319 (Asset Vessel + Quorum Gitflow). |
Smooth-Min Soft Similarity (smooth_min_similarity) | 437 + Issue 041 T6 | G1/G2/G3 ✅ | Smooth-minimum soft similarity for variable-length multi-token retrieval (Plan 437, Research 385, arXiv:2602.10908 SoftMatcha 2 Yoneda et al. ICML 2026). Aggregates per-position cosines via smooth_min_similarity(cosines, β) interpolating between plain-min (β→∞, strictest) and plain-sum (β≈1, most lenient) — penalizes low-cosine positions more than plain mean. PoC GOAT (Issue 041, 2026-07-12): G1 recall@5 +12.0pp (0.815 vs 0.695 plain cosine) on synthetic 200-item / 200-query fixture; G2 latency overhead ~0 ns (LLVM vectorized); G3 β sensitivity all β ∈ [10¹, 10⁶] beat plain cosine. Consumer GOAT (Issue 041 T6): RerankMethod::SmoothMinAligned in katgpt-attn-match achieved recall@5 = 1.000 vs Cosine 0.495 (+50.5pp) on position-aligned multi-token retrieval. Default-on (2026-07-12). Pure modelless (arithmetic on pre-computed cosines, zero deps). Zero runtime cost unless called. |
OctreeCTC Reconstructive Memory Navigation (octree_ctc) | 248 | G1–G5 ✅ | Reconstructive memory navigation (Plan 248, Research 216, arXiv:2606.06036). octree_ctc is an alias feature for sense_composition in katgpt-core (the standalone feature was removed from the root crate after Issue 007 Phase C moved the only consumers — octree_ctc_demo + recall test — to riir-engine; katgpt-core still ships the alias for direct consumers). Default-on (Plan 248 Phase 5): GOAT PASS — recall ≥ 20%, 93.2 ns < 200 ns target. Pure modelless (octree reconstruction + cosine gates). Zero runtime cost unless a caller constructs a reconstruction. |
SectorProjection (sector_projection) | 262 | GOAT ✅ | Multi-sector spatial projection primitive (Plan 262, Research 216). SectorProjection<N_DIR, N_SECTOR> projects an observation onto a fixed bank of canonical sector directions — the spatial-cognition half of the Latent Physics pair (with action_bridge). Latent→raw bridge for NPC perception ("where am I being pushed from?"). Default-on since Plan 262 Phase 2 GOAT gate. Pure modelless (closed-form dot products). Zero runtime cost unless constructed. |
Spectral Differentiation (spectral_differentiation) | 325 | G1–G4 ✅ | Standalone FFT-based spectral differentiation for periodic uniform 1D grids (Plan 325, Research 307 §3 candidate #2, arXiv:2511.05963 Fourier Neural Operators Explained §2.1). The specialized case where DEC's general exterior_derivative (cell-complex machinery) is overkill — closed-form FFT + frequency-domain multiplier (iω)^m. G1 order-1 err 5.4e-7 <1e-4 + order-2 err 1.3e-6<1e-3 + spectral-vs-FD 290× ≥100x; G2 N=1024 3.82µs <50µs (13× under); G3 order=0 identity bit-identical; G4 0 allocs/100 calls. Default-on since Plan 325 Phase 3 (2026-06-25). Pure modelless closed-form FFT. |
ARG Protocol Primitives (arg_protocol) | 327 | G1–G5 ✅ | Generic protocol primitives distilled from the ARG Standard (Plan 327, Research 309, Iris Technologies 2026). Ships: PolicyEnvelope + TaxonomyValidator (264-node) + LifecycleState + RedirectTable + TypedOfflineCandidate + OfflineCandidateScorer + InfoRegistry. G1 61 tests; G2a PolicyEnvelope ~0.4ns<50ns; G2b TaxonomyValidator ~170ns<200ns; G3 all-features/default/no-default clean; G4 0 allocs/100 calls (fixed via scratch + clone-instead-of-mem::take); G5 silence-bias strict inequalities. Default-on since Plan 327 Phase 4 (2026-06-25). Pure modelless protocol vocabulary — no game/chain/shard IP. Composes with non_interference_branches LifecycleState when both features on. |
Phase-Modulated Coupling (phase_rotation_coupling) | 322 | G1–G6 ✅ | Norm-preserving subspace rotation gate (Plan 322, Research 305, arXiv:2605.12700 UFO). cos α ⊙ a + sin α ⊙ b where α comes from a sigmoid projection — the open math hook for norm-preserving NPC affect rotation / crowd-coherent mode transition / chain-committed phase. G1 per-channel Pythagorean drift 5.96e-8<1e-4 (1677× headroom); G2 0 reversals/100-step sweep (monotone); G3 D=8 scalar+mix 18.9ns<50ns + D=8 mix-only 5.0ns<20ns + D=64 per-channel+mix 355.7ns<1500ns; G4 0 allocs; G6 sigmoid(0)=0.5→cos=sin=1/√2 (softmax would give 1.0). Default-on since Plan 322 Phase 2 (2026-06-25). Design pivot: independent Padé cos/sin drifts in cos²+sin²=1 by ~5e-3 (50× G1 budget) — replaced with phase_safe_cos_sin (libm sin + Pythagorean sqrt(1−sin²) recovery). Pure modelless. |
Non-Interference Memory Branches (non_interference_branches) | 329 | G1–G5 ✅ | Continual adaptation primitive distilled from RIZZ (Plan 329, Research 310, arXiv:2606.20638 Goel et al. Oxford Jun 2026). Five generic primitives: BranchBank + BranchRouter + VerifierGate + NonInterferenceProjection + BudgetCompiler. The Super-GOAT fusion of BAKE × CLR × MCGS × Engram × ARG × closure-instrument × Salience into per-NPC continual adaptation without catastrophic forgetting. G1 8 orthogonal directions in D=8 (pairwise interference 0.00e0 <1e-6; 9th direction correctly rejected at 0.3536≥1/√8); G2 route 301.5ns<1µs (64-branch bank, 3.3× margin); G3 all-feature combos clean; G4 0 allocs/100 calls; G5 [] deps. 101/101 unit tests. Default-on since Plan 329 Phase 3 (2026-06-26). Pure modelless (structural geometric orthogonality, not learned). |
Best-Belief Beta Selector (best_belief) | 336 | G1–G4 ✅ + Issue 010 T5 BEATS FLOOR | ε-quantile Beta lower bound for conservative selection (Plan 336, Research 320, RQGM arXiv:2606.26294 Prop. 4). Complements sample_beta (Thompson sampling for EXPLORATION) with a conservative EXPLOITATION/SELECTION counterpart. LUT hot path 3.38ns, G1 3.099e-5<1e-4 vs statrs, G4 0 allocs. Default-on since Plan 336 Phase 2 G2-unblock (2026-06-28). Issue 010 T5 "Report the Floor" comparison: BEATS the MLE floor in the heteroscedastic regime (variable observation counts — the real-world use case for frozen snapshots/archetype shards with different deployment durations); ties at uniform n (the monotonicity theorem). Confirms DEFAULT-ON promotion. Pure modelless (closed-form Beta inverse-CDF via LUT). |
Cognitive Architecture Root (cognitive_architecture_root) | Issue 039 | G1–G6 ✅ | Whole-architecture BLAKE3 commitment — CognitiveArchitectureRoot([u8; 32]) (Issue 039, 2026-07-04). The anti-cheat / quorum-attested personality freeze-thaw / on-chain NPC avatar portability primitive. Implies engram (so engram is transitively default-on via this feature — the Plan 299 "default-off" label predates this promotion). G1 spec-match 13/13 + bit-flip every input; G1-avalanche min 120/256 avg 126/256 (BLAKE3 ~128, floor 96); G2 from_parts 208ns + verify 208ns (<500ns); G2-alloc 0/1000; G3 --all-features + --no-default clean; G4 size_of == 32. Default-on since Issue 039 (2026-07-04). Pure modelless. Zero runtime cost unless a caller constructs/verifies a root. |
PTG × latent_functor Edge (ptg_functor_edges) | Issue 040 | G1–G6 ✅ | PTG × latent_functor edge composition (Issue 040, 2026-07-04). Adds FunctorPtg composite (wraps an unchanged PrimitiveTransitionGraph with a parallel Vec<Option<FunctorEdgeParams>>) + apply_functor_edge_into (zero-alloc sigmoid-gated cosine·direction apply path) + functor_edge_gate (diagnostic gate query). Wire-format safe: the inner PTG is byte-identical to a bare PTG (T1 audit found postcard #[serde(default)] does NOT work for missing trailing fields, so the composite approach is mandatory). Implies closure_instrument. G1 6/6 sub-checks + 17 unit tests; G2 apply_functor_edge_into 28.5ns at D=64 (target <200ns, 7× headroom); G2-alloc 0/1000; G3 default + --all-features + --no-default clean; G4 size_of::<FunctorEdgeParams> == 44 bytes (no heap indirection); G5/G6 pure modelless (closed-form cosine + sigmoid + SAXPY). Default-on since Issue 040 T7 (2026-07-04). |
Heal-Validation Conflict Detector (heal_validation) | Issue 133 | G1–G6 ✅ | HealConflictDetector trait for healed-state semantic validation (Issue 133, 2026-07-12). The heal-path analog of LDT's ConflictDetector — where ConflictDetector checks token candidate sets for satisfiability, this checks healed flat &[f32] state (style_weights for shards, emotion axes for HLA) for semantic impossibility (NaN, degenerate blend, anger+calm both >0.7, etc.). Passive trait — zero behavior change unless consumers implement it. Two consumer impls pass GOAT: ShardConflictDetector (riir-neuron-db, 30ns) and HlaConflictDetector (riir-games, 2ns), both <50ns target. G1–G6 ALL PASS. Default-on since Issue 133 (2026-07-12). Pure modelless (threshold checks). |
EventLog Query Combinator (event_log_query) | 562 | G1–G4 ✅ (ship-quality) | Programmatic-search axis over EventLog<A> — PRO-LONG distillation (arxiv 2607.20064, Research 461). Adds Predicate<A> enum (EventTypeIs / IdRange / And / Or / Not / All / None_ / Custom) + filter / query_window / count_where / first_where / last_where — the deterministic, LLM-free analog of "coding agent greps the log." G1 13/13 predicate combinations; G2 filter 4.99 ns/result-event (200× under 1µs target) + query_window 0.46 ns/call (217× under 100ns target); G3 feature-off build clean; G4 zero steady-state allocation (lazy iterators). Opt-in — ship-quality gate met; promotion requires a downstream consumer (riir-engine CLR/KARC, riir-neuron-db Raven/δ-Mem, or katgpt-pruners MCTS) to prove a measurable gain (Plan 562 Phase 3). Pure modelless (predicate enum + slice iterators). Zero runtime cost unless invoked. |
SWE Trajectory Freeze (swe_trajectory_freeze) | P011 / Issues 569–571 | G1–G5 ✅ | Modelless committed freeze of an inference attempt's trajectory through patch-space (Proposal 011 Layer 4). Composes tf_loop + latent_trajectory_geometry + committed_field_blend (FAME) + local BLAKE3 envelope. Two encoders, two discrimination axes: GeometrySummaryEncoder for STRUCTURAL discrimination (failure-mode classification — bench_014 G5 100% on real Kimi-K3 vs random) + StateMagnitudeEncoder (d=8 single-pass Welford, zero-alloc) for VALUE discrimination (cross-snapshot identification — bench_018/020 100% at σ≥0.1, d_M=14.526). The flipped R463 insight: even when a model proposes zero valid patches, the trajectory geometry is freezable + comparable. G2: geometry 4582ns/call; value 51.8µs (2× faster than geometry, single-pass). G4: 0 allocs (from_states_into + freeze_attempt_into/freeze_attempt_value_into). Opt-in — synthetic + σ-perturbation G5; promotion deferred until (a) real checkpoint validation + (b) a production consumer (SWE-bench pruner wiring, blocked on Layer 3 rubrc maturity). See .docs/09_feature_catalog/opt_in_features.md §29 for the full discrimination trail (benches 012–020, including the 5-bench NEGATIVE-result path to the sequence-trajectory breakthrough). Pure modelless (aggregate statistics + FAME sigmoid + BLAKE3). Zero runtime cost unless invoked. |
GOAT failures / negative results this session (kept opt-in, documented): Plan 397 HGA (Hierarchical Global Attention, G2-proxy FAIL 2/12 vs DashAttention — same failure mode as MSA R225); Plan 374 ReMax (argmax_a EI_m = argmax_a q theorem — no modelless exploration, exploration → riir-train); Plan 375 Factorized Action (G2b+G3 FAIL — trained GateNetwork + VQ-VAE needed); Plan 557 RoVE (inference-time retrofit HURTS perplexity — paper's equivalence is training-time); Plan 558 Variable-Rank Domain Expert (G2 FAIL ~2× — entropy gain real, trait-object dispatch cost too high; Issue 189 macro escape hatch is the promotion path).
Each arena proves: adaptive intelligence (HL/Bandit) > static rules > random.
| Arena | Result | Feature |
|---|---|---|
| Bomberman | HL (+177) > Greedy (+131) > Validator (-30) > Random (-55) | bomber |
| Monopoly | HL 56.5% win rate, +41.3pp over Validator | monopoly |
| FFT Tactics | TFT 99% win rate — game theory optimal | fft |
| Go | Greedy/Validator/HL 100% vs Random 35% | go |
| NFSP/MCTS Duality | BanditMCTS 75% vs MCTS 8% — backward signal transforms forward search | bandit_mcts |
📖 Full benchmarks, architecture, API: .docs/06_game_arenas/hl_arena_detail.md.
The core idea: LLMs draft tokens from semantic probability, but can't natively enforce hard constraints. A deterministic rules engine sits between draft and verification:
LLM drafts logits → SynPruner filters invalid Rust syntax → DDTree builds valid-only tree → Target verifies
Proven with Sudoku — Path-aware ConstraintPruner catches 100% of invalid branches:
Unpruned: 100 nodes, 46 accumulated-valid (46.0%)
Static-Only: 100 nodes, 84 accumulated-valid (84.0%)
Path-Aware: 100 nodes, 100 accumulated-valid (100.0%)
Arto Inkala "World's Hardest Sudoku": 49,559 steps, 7 hull vertices, 7,079.9× compression.
📖 See .docs/06_game_arenas/sudoku.md and .docs/07_validator/constraint_validator.md.
| Feature | Verdict | Why |
|---|---|---|
| Stepwise Reward (Plan 054) | NO GAIN | Same tree/path/goal, +33% latency only |
| δ-Mem (Plan 053) | NO GAIN for DDTree | 26× latency overhead, corrections too small |
| SDAR Arena | Negative result | ELO 954 ≈ Rubric 955 — no improvement |
| RMSD (Plan 125) | NO GOAT | 46/46 structural proofs pass but no arena improvement |
| TurboQuant | Demoted | SQ/OCT dominate at all quality metrics |
| DFlare Fusion (Plan 174) | IMPROVEMENT GOAT FAILED | Structural ✅ but no measurable acceptance gain |
| DFlare KV Routing (Plan 174) | IMPROVEMENT GOAT FAILED | No gain over static routing |
| DFlare Progressive Budget (Plan 174) | IMPROVEMENT GOAT FAILED | No gain over uniform budget |
| ManifoldPruner (Plan 234) | NO GOAT | G1 FAIL: sigmoid(x)>0.5 ⟺ x>0, identical to binary at 0.5 cutoff |
| CompressionDrafter (Plan 285) | GOAT FAILED (2 runs) | G1 1.50× (<3× target), G2 1077× (>2× target). Beam search structurally loses to template selection at Hot-tier |
| Alien Sampler (Plan 311) | GOAT FAILED (2/4) | G1+G2 FAIL (β phase-transition at β≈0.4 — no β satisfies both motif-collapse and quality-preservation on synthetic NPC scenario). G3 PASS post-rayon (38.42×→4.56×). G4 PASS. Mechanism validated (2× concentration reduction); domain transfer unvalidated |
| KV Consolidation (Plan 420) | QUALITY GAIN REFUTED | §3.6 PoC: Δtoken_acc = −0.06pp, ΔNLL = +0.0001; zero hyperparameter sensitivity. riir-train Plan 313 confirmed on TRAINED model (31% accuracy, 0.00pp gain). Paper's quality benefit is inseparable from TRAINED Cache Processor; modelless mean-shift is inert. No feature flag ships. |
| RoVE Retrofit (Plan 557) | RETROFIT HURTS | Phase 5 A/B: applying RoVE V rotation at inference to RoPE-trained gemma-2-2b-it increases loss +12.5% (short text, 65 tok) to +153% perplexity (longer text, 162 tok). The paper's equivalence is training-time, not inference-time. All 7 GOAT gates PASS (substrate is correct); feature stays opt-in for forward-compat only. |
| Variable-Rank Domain Expert (Plan 558) | G2 FAIL — stays opt-in | 2.63× higher archetype-utilization entropy than uniform <3,32> baseline (G3 PASS), but ~2× slower per tick (1.99–2.22×) — trait-object dispatch (Box<dyn ErasedCluster>) + per-NPC override_pi virtual calls dominate. G1/G3/G4/G5 PASS. The macro monomorphization escape hatch (variable_rank_router_static!, Issue 189) is the documented path to promotion. |
| f16 Weight-Only Forward (Issue 200) | G2 FAIL — 1.7–3.0× SLOWER | Hypothesis: halve weight bandwidth → ~2× speedup at seq=1. Wrong on Apple Silicon. (1) Activation x is f32, not f16 — actual bandwidth reduction is 25%, not 50%. (2) f16→f32 dequantization is not free — FCVT sits on the critical path between weight load + FMA. Even with hardware FCVTL (inline asm), 0.574× speedup (still net-negative). f16 weight-only quantization for bandwidth-bound GEMV is not a modelless perf win on this hardware class. G1/G3/G4 PASS. Code retained as negative-result reference (forward_base_f16, opt-in, no internal caller). |
| Full f16 Forward FHM (Issue 201) | G2 FAIL — 1.31× < 1.5× gate | Successor to Issue 200: widening FMA (fmlalb/fmlalt) does f16×f16→f32 in one instruction, eliminating the explicit FCVT. Best L3-exceeding speedup of simd_dot_f16_f16 vs simd_dot_f32 = 1.31×, under the 1.5× gate. Root causes: (1) f32 already near bandwidth ceiling (~95–110 GB/s), halving yields only ~25–30%; (2) FHM FMA throughput + accumulator-reduction overhead eat the rest; (3) f16 accumulation drift grows with vector length (6.2% rel_err at 16M). f32 stays the production dtype for forward_base GEMV. FHM inaccessible on stable Rust 1.93.0 (intrinsics unstable). |
📖 Full negative result detail + replaced feature audit: .docs/09_feature_catalog/negative_results.md.
Compacts a KV cache (K, V) to (Ck, β, Cv) with t < T tokens while preserving both attention output AND attention mass under reference queries Qref. The β bias per retained key accounts for the mass of removed keys, making the compacted block a faithful drop-in replacement under arbitrary future concatenations.
GOAT 9/9 PASS — β recovery (‖β−β_ref‖_∞ = 1e-6), Cv reconstruction (rel Frobenius 0.0), OMP residual (0.0%), reconstruction quality (0.71% rel error), router determinism, zero alloc in hot loop, SIMD speedup (3.01× release on Apple NEON).
flowchart LR
subgraph Input["Input KV cache"]
K["K (T, d)"]
V["V (T, d)"]
Q["Qref (n, d)"]
end
subgraph Stage1["Stage 1 — Key Selection"]
HA["HighestAttn keys
(top-t by RMS score)"]
OMP["OMP keys
(greedy mass pursuit)"]
end
subgraph Stage2["Stage 2 — β NNLS"]
BETA["Per-token bias β
(projected GD, bounded w = e^β)"]
end
subgraph Stage3["Stage 3 — Cv Fit"]
CV["Least squares Cv
(blocked Cholesky, jitter fallback)"]
end
K --> HA
K --> OMP
Q --> HA
Q --> OMP
HA --> BETA
OMP --> BETA
BETA --> CV
V --> CV
CV --> OUT["(Ck, β, Cv) — t tokens"]
Adaptive router picks CpuScalar / CpuSimd / CpuRayon / Gpu / Ane per stage based on t and T with hysteresis (no flap). Blocked Cholesky (32×32 L2-resident) activates automatically for t ≥ 32. GPU dispatch stub wired (T2.8) — falls back to rayon when no shader bundled.
| Metric | Value |
|---|---|
| Compression ratio | T / t (paper: 200× total with summarization) |
| β recovery (synthetic) | ‖β−β_ref‖_∞ = 1e-6 |
| Cv reconstruction (synthetic) | rel Frobenius 0.0 |
| Router decision time | 1.59 ns/call, zero alloc |
| SIMD speedup (release, NEON) | 3.01× scalar (≥1.5× threshold) |
Feature gate: attn_match (default-ON since Plan 271 Phase 7 GOAT 9/9). Adaptive CoT variant: adaptive_cot_compaction (entropy-thresholded, opt-in).
📖 Plan: .plans/271_attention_matching_compaction.md. Research: .research/233_Attention_Matching_KV_Compaction.md. Paper: arxiv 2602.16284.
Per-head attention-sink classifier distinguishing Adaptive NOP sinks (‖v_s‖ ≈ 0, suppress residual — should gate) from Broadcast sinks (‖v_s‖ ≈ content, rank-1 update carrying load-bearing global info — should preserve). Builds on Fesser et al. A Unifying View of Attention Sinks: Two Algorithms, Two Solutions.
Two diagnostics per sink position:
value_norm_ratio = ‖v_s‖ / mean_i(‖v_i‖) — NOP if < 0.2, Broadcast if ≈ 1.stable_rank(O) = ‖O‖_F² / σ_1² via vendored ~30-line power iteration — Broadcast signature is rank-1, so stable rank ≈ 1 triggers the fast early-exit.The dual-policy gate then applies the sigmoid gate only to NOP heads, preserving Broadcasts. Stops the over-suppression of useful broadcasters under our default sigmoid attention.
Production path: apply_dual_policy_gate_cached — amortizes the classifier over audit_every_n calls (default 16). Sinks in trained transformers are stable across forward passes, so the cached decision is correct. Steady-state overhead matches Uniform (just a copy); the classifier runs only on audit calls.
Layout choice: both &[Vec<f32>] (diagnostic-friendly, row-by-row construction) and flat &[f32] (forward-path-friendly, matches parallax_attn/funcattn output) layouts are provided via _flat suffix variants. Flat variants are 1.8×–5.1× faster than Vec<Vec<f32>> due to cache locality — prefer them when composing with the attention forward path. See Plan 288.
attn column values V update O = AV
│ │ │
▼ ▼ ▼
┌──────────────────────────────────────┐
│ classify_sink_at(pos, col, V, O) │
│ │
│ strength = mean(col) │
│ ratio = ‖v_pos‖ / mean(‖v_i‖) │
│ srank = power_iter(Oᵀ·O, 5) │
│ (cosine probe O[0]∥O[n-1] │
│ for rank-1 fast path) │
│ │
│ strength ≤ τ_sink → None │
│ ratio ≤ nop_max → Nop │
│ ratio ∈ [b_min, b_max] ∧ → Broadcast│
│ srank ≤ b_srank_max │
└────────────┬─────────────────────────┘
│ kind
▼
┌──────────────────────────────────────┐
│ apply_dual_policy_gate[_cached] │
│ Nop → out = O · σ(g) │
│ Broadcast → out = O (preserve) │
│ None → out = O (default) │
│ │
│ cached: skip classify on │
│ non-audit calls (cadence=16) │
└──────────────────────────────────────┘
| Metric | Value |
|---|---|
| G1 classifier correctness | 18/18 unit tests PASS (8 G1 + 2 cached-variant parity + 8 flat-layout parity; NOP, Broadcast, mixed, edges, cache invalidate, flat vs Vec bit-identical) |
| Stable-rank fast path (rank-1) | 0.625 µs for n=128, d_h=64 (was 3.125 µs pre-Issue 001; cosine probe skips power iteration) |
| Stable-rank slow path (random) | 6.583 µs for n=128, d_h=64 (target was <1µs — documented G2.4 miss, but only matters for non-Broadcast heads) |
| Dual-policy latency (per-call, Vec) vs Uniform | 1000–3000% at n=128 (target was ≤5% — G3 STRUCTURAL FAIL: classifier reads attn (n²) + values (n·d); Uniform is just an n·d copy. Memory-bandwidth bound.) |
| Dual-policy latency (per-call, flat &[f32]) vs Uniform | 390–1700% at n=128 — 1.8×–5.1× faster than Vec<Vec> (Plan 288). Still structurally cannot beat memcpy, but the gap is dramatically smaller. |
| Dual-policy latency (cached cadence=16, flat) vs Uniform | ≤5% steady-state (often -30% to -40% — flat cached path is faster than Vec Uniform baseline). Production path. |
| Forward-path composition overhead (Plan 289) | tiled_attention_parallax_forward_sink_aware(Uniform) vs vanilla forward: -0.3% / 0.0% / +0.6% at n ∈ {64, 128, 256}. Zero-cost abstraction contract verified. DualPolicy adds 2.1%–11.0% (matches per-call cost); cached brings it to ≤3%. |
| Synthetic G2 (Broadcast preservation) | DualPolicy preserves O unchanged for Broadcast heads (2/2 PASS) |
Scope reductions (documented in .benchmarks/059_sink_aware_goat.md):
parallax_attn.rs / funcattn.rs forward paths is deferredtiled_attention_parallax_forward_sink_aware ships as a separate entry point (not a ParallaxConfig field), preserving Default::default() backwards-compat. FuncAttn wiring closed as not-applicable — see Research 261: FuncAttn's Φ · C · Ṽ structure has no n×n attention matrix for the sink classifier to scan (basis modes are partition-of-unity by design, so the NOP/Broadcast discrimination collapses into a column-norm check).effective_rank G2 gate is DEFERRED — needs a frozen model. Synthetic G2 substitute in tests/sink_aware_g2_synthetic.rs (and now in parallax_attn::sink_aware_tests via the forward path).Feature gate: sink_aware_attn (opt-in — per-call G3 latency target structurally infeasible; cached variant meets target but real-ViT G2 still deferred). Forward-path composition requires both parallax_attn and sink_aware_attn. G3 latency investigation closed (structurally infeasible for per-call path; cached variant is the resolution). Flat-layout variants: Plan 288. Forward-path wiring: Plan 289.
📖 Plan: .plans/287_sink_aware_attention.md + .plans/288_sink_aware_flat_layout.md + .plans/289_sink_aware_forward_path_wiring.md. Research: .research/258_Attention_Sink_Dual_Mechanism_NOP_Broadcast.md. Paper: arxiv 2606.08105.
Two modelless primitives distilled from Gollapudi et al. Can Language Models Actually Retrieve In-Context? Drowning in Documents at Million Token Scale (UC Berkeley / UT Austin, 2026). The paper's headline finding is the recall–generation gap: a head's pre-softmax retrieval signal (R^any_L = 1.0 — at least one head ranks the gold document first by MaxSim) persists across corpus sizes N ∈ {500…10k}, but the post-normalization mass on gold collapses. The attention output is rewritten from a gold-token average to a non-gold-token average at comparable magnitude.
SSMax (length-aware log-N attention temperature) is the fix at the logit level: a multiplicative pre-attention rescale s̃ = s_L · log(N) · s that cancels the (N−1) denominator growth in the dilution bound α_gold ≈ 1/(1 + (N−1)·N^{−s·Δ}). Default s_L = 1.0 is truly modelless (zero training, zero new parameters); the Adaptive mode ships s_L = 1/Δ_typical analytically (derived from the bound, not learned). Composes with sigmoid parallax (ParallaxConfig.ssmax field), standard SDPA (tiled_attention_forward_ssmax), and sink-aware (field-on-config makes the 3-way composition automatic); does NOT apply to funcattn (Research 261 closed negative: basis-mode structure has no (n,n) attention matrix, so dilution is structurally absent).
GoldShare (‖a^G_L‖ / ‖a_L‖) is the diagnostic that proves the dilution regime is real: it decomposes a layer's attention output into gold-derived and distractor-derived fractions and detects when the output has been rewritten from gold-content to aggregate-noise at comparable magnitude. Complements effective_rank (content-agnostic aggregate) and stable_rank_update (per-sink degeneracy). The joint reading with sink_classify: a sink classifier hit on the gold position with low gold_share is a broadcast that failed — the signal was in the head per the classifier, but didn't survive normalization into the residual.
pre-softmax logits s attention output a_L = (Σ_t α_t · v_t)·W_O
│ │
▼ ▼
┌─────────────────┐ ┌─────────────────────────────────────┐
│ apply_ssmax │ │ gold_share(attn, values, gold_mask) │
│ s̃ = s_L·log(N) │ │ a^G = (Σ_{t∈G} α_t·v_t)·W_O │
│ ·s │ │ a = (Σ_t α_t·v_t)·W_O │
│ │ │ share = ‖a^G‖ / ‖a‖ ∈ [0,1] │
│ s_L=1.0 fixed │ │ │
│ s_L=1/Δ adaptive│ │ low share + Broadcast classify │
│ (analytical) │ │ = "broadcast that failed" │
└────────┬────────┘ └─────────────────────────────────────┘
│ cancels (N−1) detects recall→generation gap
│ dilution (content-specific; eff_rank misses)
▼
softmax / sigmoid
| Metric | Value |
|---|---|
| G1 (correctness) | SSMax preserves argmax at all N ∈ {64, 1k, 10k, 100k} for both Fixed and Adaptive modes. At N=100k: base gold mass 0.000016 (drowned), SSMax Fixed recovers to 0.003 (185×), Adaptive recovers to 0.47 (29,000×). |
| G2 (quality) | SSMax: retrieval recall via cosine similarity cos(output, v_gold) at N ∈ {1k, 10k}: base 0.25 → SSMax Adaptive 0.97 — the output vector points strongly toward the gold value instead of being diluted across distractors. GoldShare: differentiating power — gold_share range [0.037, 1.006] (27× collapse) across the dilution sweep while ‖a_L‖ stays constant (2.0) and effective_rank stays flat — the existing content-agnostic diagnostics cannot detect the swap. |
| G3 (latency) | apply_ssmax_inplace @ n_kv=1024: 66 ns/call (<0.1% of a typical ~100µs attention forward). |
| G4 (alloc-free) | SSMax: 0 allocs/1000 calls (in-place logit rescale). GoldShare: 0 allocs/1000 calls (pre-sized GoldShareScratch). |
| G5 (no-regression) | At N=64: base_argmax = ssmax_argmax = gold_index. Identical ranking — SSMax's log(N) sharpening is mild at small N. |
| G6 (modelless) | SSMax = closed-form logit rescale (zero training, zero new params, s_L=1/Δ derived analytically). GoldShare = read-only norm ratio. Neither has a riir-train dependency. |
Promotion decision (Plan 411 Phase 5): ssmax_temperature is DEFAULT-ON (Plan 411 Phase 5, 2026-07-07). All five GOAT gates pass (G1+G2+G3+G4+G5), satisfying the plan T5.1 promotion criterion. The promotion is provably safe: ParallaxConfig::default() sets ssmax: None, apply_ssmax_to_row is a no-op when None, and the ssmax_none_is_bit_identical_to_base test verifies zero default-behavior change — promoting the feature flag only makes the API available; no default code path applies SSMax unless a caller explicitly sets config.ssmax = Some(...). GoldShare stays opt-in as a diagnostic (G2+G4 PASS; promote only when a downstream consumer depends on it). Demotion check (T5.3): no loser to demote — SSMax composes multiplicatively with the base 1/√d SDPA scale (1/√d normalizes for dimension; SSMax normalizes for sequence length); both serve different purposes.
Feature gates: ssmax_temperature (DEFAULT-ON, composes via ParallaxConfig.ssmax + tiled_attention_forward_ssmax), gold_share_probe (opt-in diagnostic, implies sink_aware_attn for the StableRankScratch convention reuse + joint SinkDiagnostic.gold_share field).
📖 Plan: .plans/411_ssmax_goldshare.md. Research: .research/392_Attention_Dilution_SSMax_GoldShare.md. GOAT gate bench: .benchmarks/411_ssmax_goldshare_goat.md. Paper: arxiv 2607.01538.
Two modelless primitives distilled from Ren & Lim, Low-dimensional topology of deep neural networks (ICML 2026). The paper's Theorem 4.7 proves a structural limitation that this codebase hits implicitly: width-d feedforward nets with coordinate-wise monotonic activations (ReLU, sigmoid, tanh) preserve the linking number and therefore cannot linearly separate two topologically linked class manifolds, regardless of depth. Every sigmoid projection in the codebase (HLA affect scalars, direction-vector projections, ItemEmbedIndex cosine retrieval) is monotonic → provably doomed on linked manifolds, but there was no way to detect when, nor to correct it.
fold_projection_into / fold_gelu_into is the closed-form modelless correction (paper Eq. 1: |x| = x + 2·ReLU(−x), realized as a single coordinate-wise fold state[i] ← center[i] + |state[i] − center[i]|). One fold pass per axis (three for R³, paper Fig. 9) breaks the straight-line homotopy that underlies the impossibility theorem, making a linked pair of manifolds linearly separable. The Gelu variant uses a smooth GELU-surrogate local-extremum fold instead of the hard |·|. Hot-path, zero-allocation, #[inline], bit-identical determinism. This is the §3.5 path-3 latent-space correction the modelless-unblock protocol prefers over riir-train deferral.
detect_linking (paper Algorithm 1) is the audit-cadence diagnostic that tells you when to fold: take two point clouds X, Y in R^d, PCA-project to R³, build ε-filtered k-NN graphs, extract a fundamental cycle basis per graph via BFS spanning forest, compute the Gauss linking integral over O(β_X · β_Y) basis-cycle pairs. Returns LinkingVerdict { linked, link: i32, witness }. Cold-path; may allocate.
two latent clusters X, Y monotonic projection σ(·)
│ detect_linking(X, Y) │ (sigmoid / ReLU / tanh)
▼ ▼
┌──────────────────────────┐ ┌────────────────────────────────┐
│ PCA-3D → ε-kNN graph │ │ Thm 4.7: σ preserves link │
│ → BFS cycle basis │ │ → linked manifolds NOT │
│ → Gauss linking integral │ │ linearly separable by σ │
│ link ∈ ℤ │ └────────────────────────────────┘
└────────────┬─────────────┘ │
│ link ≠ 0 │ doomed
▼ ▼
┌──────────────────────────────────────────┐
│ fold_projection_into(state, center) │
│ state[i] ← center[i] + |state[i]−c[i]| │
│ (one pass per axis — breaks homotopy) │
│ fold_gelu_into(state, center, α) │
│ (smooth GELU-surrogate local extremum) │
└────────────────────┬─────────────────────┘
│ now linearly separable
▼
σ(·) works
| Gate | Fold (hot-path) | Detector (cold-path) |
|---|---|---|
| G1 (correctness) | ✅ fold unlinks synthetic thickened Hopf link (link ±1 → 0 after 3 axis passes); bit-identical to paper §G.1 | ✅ detects Hopf link as link = ±1; returns 0 on two unlinked circles; handles degenerate inputs (empty/single/coincident) |
| G2 (perf) | ✅ 10.05 ns (Abs, D=8) / 13.68 ns (Gelu, D=8) / 16.61 ns (Abs, D=64) / 17.02 ns (Gelu, D=64) — all under 50 ns / 500 ns budgets | ✅ 408 ms @ n=2×200, d=8 ≤ 500 ms audit-cadence budget (Issue 050 Option A, resolved 2026-07-07). Original 50 ms @ n=2×1000 target unreachable with brute-force O(β²) (extrapolates to minutes @ n=2×1000) — preserved as historical context. Detector is audit-cadence (once per session / sleep-cycle), zero in-tree consumers. |
| G3 (no-regression) | ✅ default + --features linking_fold_fold + --all-features all clean | ✅ --features linking_fold_detector + umbrella + --all-features clean |
| G4 (alloc-free) | ✅ 0 allocs / 1000 calls × 4 (Abs/Gelu × D=8/D=64, CountingAllocator) | n/a — cold-path, may allocate |
| G5 (determinism) | ✅ bit-identical across 100 runs (closed-form) | ✅ same integer link across 3 runs |
| G6 (modelless) | ✅ closed-form ` | x−c |
Promotion decision (Plan 410 T4.4 — Option C feature split + Option A audit-cadence budget, 2026-07-07): the bundled linking_fold feature was split into two independently-gated sub-features so the fold could ship without silently relaxing the detector's G2 budget. linking_fold_fold is DEFAULT-ON — it passes every GOAT gate modellessly and is the valuable per-tick primitive. linking_fold_detector is opt-in — its G2 budget is set at the audit-cadence-appropriate 500 ms @ n=2×200 (Issue 050 Option A resolved 2026-07-07), accepted as fit-for-purpose since the detector is audit-cadence (once per session / sleep-cycle) and has zero in-tree consumers. The umbrella linking_fold = [fold, detector] preserves backward-compat for consumers who wrote linking_fold. The split is verified clean across all 4 feature combinations (default, fold-only, detector-only, all-features) — each sub-feature gates exactly its own tests, with no cross-contamination.
Feature gates: linking_fold_fold (DEFAULT-ON — fold_projection_into / fold_gelu_into), linking_fold_detector (opt-in — detect_linking / LinkingVerdict / LinkingDetectorConfig), linking_fold (umbrella = both, opt-in).
📖 Plan: .plans/410_linking_fold_primitive.md. Research: .research/391_Low_Dimensional_Topology_Linking_Number.md. Detector perf issue: [Issue 050 — RESOLVED via Option A (2026-07-07), file removed per AGENTS.md noise-reduction rule; see Plan 410 Phase 4 T4.4 for the decision record]. Paper: arxiv 2606.31856.
Compresses long context 4×–16× at prefill time using MUX superposition — zero training, zero parameters, deterministic.
flowchart LR
subgraph Encode["ENCODER — zero training"]
T["[t1..t8] span"] --> MUX["MUX Superpose\nΣ decay^j × onehot(t_j)"]
MUX --> Z["z_i (1 latent slot)"]
end
subgraph Wire["WIRE — latent-to-latent"]
Z -->|"f32 vector, BLAKE3 committed"| STREAM["Stream / Patch\nno decompress needed"]
end
subgraph Decode["DECODER — domain_latent inject"]
STREAM --> INJ["Mid-layer K/V\n1 KV entry (not 8)"]
INJ --> GEN["Generate tokens"]
GEN -.->|"on demand"| EXPAND["EXPAND(i)\nO(1) lossless recovery"]
end
| Metric | X4 | X8 | X16 |
|---|---|---|---|
| TTFT Speedup | 6.6× | 14.0× | 29.0× |
| KV Memory Reduction | 75% | 87.5% | 93.8% |
| Logit Cosine Sim | 0.597 | 0.617 | 0.552 |
Enables latent-to-latent streaming, freeze/thaw patching, federated context, and KG octree leaf patching. Feature gate: mux_latent_context (default-ON, GOAT 5/5 PASS).
📖 Plan: .plans/238_mux_latent_superposition_fusion.md.
Latent-to-latent patching over the wire — no decompress/recompress round-trip. Patches MUX latent slots as KG octree leaf nodes. 68-byte wire format (4B segment_id + 32B weights + 32B BLAKE3). SIMD batch at ≥100K patches/sec. BLAKE3 commitment + scalar projections only on wire (no 64-dim HLA). Feature gate: mux_latent_wire. 📖 Plan: .plans/243_mux_latent_wire_patch.md.
Prunes redundant reasoning steps during CoT generation using attention-based importance scoring + binary search fold verification. No LLM training — pure inference-time optimization. Composes with ThinkingController (Plan 194): Direct mode → zero-cost; Latent/CpuResample mode → StepBoundaryTracker + ChainFolder + FoldBandit + FoldCache.
| Metric | Target | Status |
|---|---|---|
| Token reduction on hard queries | ≥30% | GOAT 2 ✅ |
| Accuracy regression | ≤2% | GOAT 3 ✅ |
| Direct mode overhead | 0% | GOAT 1 ✅ |
| Fold overhead | <5% | GOAT 4 ✅ |
Feature gate: chain_fold (depends on thinking_cot, DEFAULT-ON — GOAT Plan 195 16/16 validated by Plan 228).
Detects reasoning collapse at runtime during CoT generation and triggers early exit. Three-layer stack composes with existing infrastructure:
| Metric | Target | Source |
|---|---|---|
| Token savings on simple tasks | 50-90% | Thinkless (NeurIPS 2025) |
| Accuracy on ambiguous tasks | +2-5pp | S2F (ICML 2026) |
| Collapse detection overhead | <10ns/token | O(1) ring buffer |
Feature gate: collapse_aware_thinking (default-ON). 📖 Research: .research/187_S2F_Slow_to_Fast_Adaptive_Reasoning.md.
Distills SwiReasoning (ICLR 2026, arXiv:2510.05069) into a training-free runtime controller that switches between explicit (token-space) and latent (soft-embedding) reasoning modes based on block-relative entropy trends. Asymmetric dwell windows prevent mode chatter; a switch-count guard suppresses overthinking (convergence at ½C_max, forced answer above C_max).
Three primitives, all modelless:
SwiRController — the 2-mode state machine (3.1 ns/step, zero-alloc).soft_embedding — probability-weighted vocabulary mixture for latent mode (SIMD chunked, O(vocab·dim)).mix_thinking_signal — control-token embedding blend at switch instants (α_t/β_t schedule).Integrates into thinking_cot (Plan 194) as a ThinkingStrategy. Optional kurtosis escape hatch (observe_kurtosis) forces Explicit mode on rigid-constraint tasks, bypassing latent exploration where continuous mixtures would hallucinate.
| Gate | Target | Result |
|---|---|---|
| G3 step() perf | < 200 ns/call | 3.1 ns (64× margin) |
| G4 convex hull | 1000 random probs in hull | 1000/1000 |
| G7 zero-alloc step() | 0 allocs | 0 allocs / 0 bytes |
| G1c controller correctness | switches + convergence + termination | 6 switches, 3 CloseThink, 1 ForceAnswerPrefix, terminated step 21 |
| G2p efficiency proxy | SwiR < fixed-budget baseline | 33 steps vs 1024 = 31× fewer |
| G9 hyperparameter ablation | W_E→L/C_max/α_0 respond correctly | monotonic ✓, α-independent ✓ |
G1/G2 real-model validation (riir-ai Plan 313, 2026-06-19): ran on Gemma 2 2B IT + MATH-500 (CPU M1 Pro). G2 = 1.37× (GATE PASS, target ≥ 1.3×) at the tuned config w_e_to_l=32, c_max=64 (n=5; 1.43× at n=10 partial) — non-monotonic Pareto curve peaks at c_max=64. G1 = 0% — blocked purely by Gemma 2 2B capability (T4.2e ruled out the prompt/checker bug class; verified on 1^(2^huge)=1 the model emits correctly-formatted \boxed{ } with wrong content). Definitive G1 gate pass requires Qwen3-4B/8B. Verdict: promote swir_switch_thinking to default-on once G2 is confirmed at n=20+ (token efficiency is the primary value prop). katgpt-rs is modelless (no model loader); the algorithmic invariants above are necessary preconditions.
Feature gate: swir_switch_thinking (depends on thinking_cot, opt-in until G1/G2 pass on a real model). 📖 Plan: .plans/275_swir_switch_thinking.md. Research: .research/241_SwiReasoning_Explicit_Latent_Switch.md. Benchmark: .benchmarks/275_swir_switch_thinking_goat.md.
Replaces the separate draft model with a lightweight 3-layer residual MLP that predicts next hidden states from (h_t, x_{t+1}), enabling variable-length self-speculative decoding at near-zero overhead.
| Gate | Result |
|---|---|
| Belief vs MTP overhead | 2.2× (134 μs vs 60 μs) |
| MLP forward per step | 17 μs/step at n_embd=16 |
| Cache hit rate (walk cycle) | 100% |
| Cached vs uncached | 5× speedup (15 μs vs 90 μs) |
| Acceptance rate | Both produce valid 64-node trees |
43 tests + 7 benchmarks, GOAT all pass. Feature gate: belief_drafter (default-ON).
📖 Plan: .plans/217_nextlat_belief_state_drafter.md.
Extends BFCF pruning with LFU region caching (papaya lock-free HashMap, BLAKE3 keys, sigmoid-gated admission), frequency-aware sharding, and SIMD-friendly region-level batching. 44 tests + 10 benchmarks, GOAT all pass. Cache hit rate: 95% on cyclic workload.
Feature gate: bfcf_lfu_shard (default-ON). 📖 Plan: .plans/218_bfcf_lfu_shard.md.
Distills Hao, Long, Zhao 2026 — "Self-Evolving MAS via Decentralized Memory" (arXiv:2605.22721) into a DualPoolBandit<B: HintDeltaBandit> that splits CGSP's bandit into an exploitation pool (E-pool: consolidated successes, local-walk operator) and an exploration pool (X-pool: fresh candidates, teleportation operator). A sigmoid router α = sigmoid(w_E − w_X) ∈ (0, 1) guarantees the X-pool always retains strictly nonzero selection probability — the induced Markov chain is irreducible and aperiodic (DecentMem Theorem 1), so the agent is provably never trapped, by construction, with no collapse detector needed.
GOAT G1–G4 PASS (G5 deferred to riir-ai). Feature stays opt-in until personality divergence validated.
| Gate | Target | Actual | Verdict |
|---|---|---|---|
| G1 — Reachability | X-pool always selected (α < 1) | balanced 1.1 cycles, extreme ≤ 79k | PASS |
| G2 — Regret bound | O(log T) on synthetic bandit | regret 24.6 ≤ 5·log(10k) = 46 | PASS |
| G3 — E-pool growth | Discovers strategy outside initial pool | 4 → 5+ arms, optimal promoted | PASS |
| G4 — Faithfulness gate | Dead items rejected | 4 live promoted, 4 dead filtered | PASS |
| G5 — CGSP integration | Personality divergence widens | deferred to riir-ai NpcCgspRuntime | Pending |
Key findings:
HintDeltaBandit::push_arm(priority) and is_growing() — added as default methods (no-op / false), so every existing implementor is unaffected. DualPoolBandit<B> drops into CgspLoop as the B type parameter with zero loop changes.α = sigmoid(w_E − w_X) replaces the paper's w_E/(w_E+w_X). Both preserve strict concavity, so the O(log T) regret bound transfers (Research 249 §2.3). A min_exploration_prob clamp (default 1e-4) makes the theorem hold in f32 (sigmoid saturates at x ≳ 18).consolidate_growing_gated<F: Fn(usize)->bool>(gate) accepts a closure wrapping FaithfulnessProbe::is_faithfully_used(threshold). Arms the consumer structurally ignores (no behavioral delta on perturbation) are rejected from E-pool promotion — prevents Research 244's "dead condensed memory" failure mode where 60%+ of consolidated memory is silently ignored.α = 1 (pure exploitation) degenerate case. Dual-pool strictly generalizes it.Feature gate: cgsp_dual_pool (opt-in, requires cgsp). 📖 Plan: .plans/282_dualpool_reachable_router.md. Research: .research/249_DecentMem_DualPool_Reachable_Router.md. Paper: arXiv:2605.22721.
Distills Xu et al. 2026 — "VibeThinker-3B" (arXiv:2606.16140, Sina Weibo Inc.) into a generic, MIT-licensed, no-game-semantics module shipping four modelless inference primitives:
clr_vote() — the headline nonlinear reliability gate. Given K candidate trajectories and M decision-relevant claims per trajectory, produces the winning cluster via r_k = (mean_m v_k,m)^M where v_k,m = sigmoid(dot(claim_vec_k,m, direction_vec_m)). Dot-product + sigmoid, never softmax (per AGENTS.md). The ^M exponent is the key trick: a single low verdict drags the trajectory's reliability super-linearly, so clusters containing flawed trajectories lose to clusters of flawless ones.ClaimExtractor / ClaimVerifier traits — open extension points. Concrete extractors/verifiers live in the consumer crate (riir-ai Plan 316 ships game-specific ones; katgpt-rs ships only the generic traits + a FnClaimExtractor adapter + a SigmoidProjectionVerifier reference impl).brevity_tiebreak() — the Long2Short zero-sum tiebreak. Among clusters tied on Σ r_k within ε, pick the one whose representative trajectory has the shortest length. Pure algorithm, no quality change.learning_potential() + mgpo_sampling_weight() — the curiosity feedback signals. S_LP(y) = -(1/|y|) Σ log π(y_t|...) ("how surprising was this under the frozen brain?"). w(p) = exp(-γ|2p-1|) (peaks at p=0.5, the calibration boundary). Companion should_write_memory(r_k, S_LP) gates memory persistence on BOTH reliability AND surprise — exactly the trajectories worth persisting for the next freeze/thaw cycle.GOAT G1–G5 PASS — promoted to default-on (Phase 5 T5.6).
| Gate | Target | Actual | Verdict |
|---|---|---|---|
| G1 — CLR beats majority | Δ ≥ 3pp | +78.0pp (CLR 100% vs majority 22%) | ✅ |
| G2 — Verifier ECE | ≤ 0.10 | 0.0087 | ✅ |
| G3 — K=32 vote latency | ≤200µs (stretch ≤50µs) | 4–5µs (10× under stretch) | ✅ ✨stretch |
| G4 — Vote-internals allocs | 0 | 0 (vote arithmetic adds 0 allocs on top of extractor) | ✅ |
| G5 — Feature isolation | compiles ±clr | ✅ build + nm shows zero clr symbols in no-clr binary | ✅ |
Key findings:
r_k from ~0.22 (clean) to ~0.14 — a 36% penalty. The ^5 exponent amplifies this into a clear Σ r_k ordering between clusters.clr_vote_minimal writes into caller-supplied ClrScratch and returns (winner_idx, Σ r_k) scalars. After ClrScratch::new(K, M) warmup (3 with_capacity calls), the vote arithmetic + clustering + tiebreak add 0 allocations across 1000 calls. The only per-call allocations were inside ClaimExtractor::extract() (caller-domain — eliminated by the Issue 203 extract_embeddings_into override path, shipped in katgpt-claim + consumed by riir-games-civ per the riir-ai/.issues/568 CLR-dispatch sibling).M=5, reliability_gate uses the literal v*v*v*v*v form (4 multiplies, no libm call) instead of powf(5.0). All other M fall back to the general powf path.1/(1+exp(-dot)) per (claim, direction) pair. Two directions on the same claim can BOTH return > 0.5 (sum > 1) — softmax would forbid this and destroy per-direction independence.should_write_memory): selects trajectories that are BOTH reliable (passed CLR) AND surprising (high S_LP under the frozen brain). This is exactly the highest-value training signal for the next freeze/thaw direction-vector update — "we got it right but didn't expect to".Feature gate: clr (default-on since Plan 284 Phase 5 GOAT G1–G5 all pass). 📖 Plan: .plans/284_runtime_clr_self_adaptive_loop.md. Research: .research/255_VibeThinker_CLR_Test_Time_Reliability.md. Paper: arXiv:2606.16140. Scorecard: .benchmarks/284_clr_goat.md. Examples: clr_minimal, clr_brevity_tiebreak, clr_learning_potential.
Unifies multiple KV block selection algorithms behind a single VortexFlow trait: BlockTopKRouter (centroid + dot-product top-k + sigmoid), EntmaxRouter (α-entmax wrapper), ValueEnergyRouter (centroid · ‖v‖ gating, RULER 1.00). Feature gate: vortex_flow (DEFAULT-ON — Plan 196 GOAT 72/72 PASS).
Distills MSA-style blockwise sparse scoring into VortexFlow routers. All sub-features are opt-in — the modelless micro-benchmark GOAT gate FAILED for each (see .plans/256_msa_blockwise_sparse_distillation.md):
| Sub-feature | Router | Winning Regime | GOAT Failure |
|---|---|---|---|
msa_sparse | MaxPoolBlockScorer, MaxStdDevBlockScorer | Diversity-gated block scoring | (baseline for sub-features) |
msa_per_group | PerGroupTopKRouter | High-top_k latency (0.40–0.52× vs shared) | Coverage saturated at 1.003× (need ≥1.5×) |
msa_kv_outer | KvOuterPrefill | Short context with high block sharing (2.02× at 32K) | Block sharing drops at long context (0.83× at 512K) |
msa_adaptive_k | AdaptiveKRouter<R> | Compute-constrained decode (37% savings) | Recall bounded at 0.629 (need ≥0.90) |
📖 Plan: .plans/256_msa_blockwise_sparse_distillation.md. Full RULER arena deferred (needs trained model + dataset — riir-ai scope).
Fixed-size slot memory with sparse Top-K routing. Unselected slots completely frozen — 10K noise updates leave passkey slots untouched. 2.98× faster than flat attention at pos=8 (62,653 tok/s vs 21,019 tok/s). Opt-in alternative forward path (forward_raven()), not in default hot path.
📖 .docs/03_memory/raven_rsm.md.
Rust port of Percepta's transformer-vm — O(log N) 2D convex hull attention with ternary search. ~9K lines Python+C++ → idiomatic Rust. Apache-2.0.
Core trick: Parabolic key encoding k ↦ (2k, −k²) turns argmax into a supporting-point query on the convex hull → O(log N) via ternary search.
📖 .docs/07_validator/percepta.md.
HL = software systems evolve through code updates not weight updates.
Episode N: BanditPruner selects arm → environment runs → reward → TrialLog.append()
Episode N+k: AbsorbCompress promotes stable low-Q arms to hard blocks
Key subsystems (default-on or part of bandit): Multi-Armed Bandit (UCB1, ε-greedy, Thompson), TrialLog, AbsorbCompress, ReviewMetrics. The runtime hot-swap, mid-layer emotion projection, and session-level OOD wiring live in riir-ai.
📖 .docs/06_game_arenas/heuristic_learning.md.
Modelless HL Phase 1 — Hint-δ intrinsic reward drives AbsorbCompress + BanditPruner without an external verifier:
δ(q, h, a_hard) = (1/T) Σ [log πG(at | q, h, a<t) − log πG(at | q, a<t)]
The model-based Phase 2 (gradient optimization with self-play reward) and the arena players live in riir-ai / riir-train.
📖 .docs/06_game_arenas/hl_arena_detail.md §11.
GOAT 6/6 proved, default-on. Mathematical foundation from Deep Manifold Part 2:
| Paper Concept | Implementation | Gate |
|---|---|---|
| Fixed-point residual ‖f(x)-x‖ | HintDelta + ManifoldResidual trait | deep_manifold |
| Symmetric boundaries | BT pairwise ranking + SymmetricBoundariesPair | bt_rank |
| Model CAP tradeoff | BanditPruner dynamic routing | bandit |
| Manifold federation | BoundaryAlignment KL coupling | federation |
Plan 231 sub-features (all default-ON, GOAT-proven):
| Feature | Key Gain |
|---|---|
| Union Bound Confidence | Linear degradation, 76ns overhead |
| PathwayTracker | 85% thinking budget savings, 100% convergence |
| FederationComposer | 70% early termination rate, 35% compute savings |
📖 .research/051_Deep_Manifold_Fixed_Point_Boundary_Conditions.md.
Fuse BAKE precision vectors with MUSE skill lifecycle — each ConstraintPruner arm becomes a Bayesian hypothesis with per-feature precision, enabling precision-gated Patch/Split/Compress/Retire actions. GOAT 8/8 PASS, promoted to default-ON.
| Gate | Result |
|---|---|
| Precision update correctness | ✅ Sequential BAKE-style |
| Surprise KL trigger | ✅ Sigmoid-gated |
| 5 lifecycle actions | ✅ Explore→Patch→Split→Compress→Retire |
| Decorator overhead | 258ns only when PosteriorGuidedPruner used |
| Existing pruners | Zero regression (no decorator = no overhead) |
Feature gate: posterior_evolution (default-ON). 📖 Plan: .plans/239_posterior_guided_pruner_evolution.md.
Layer-adaptive Newton-Schulz depth + rank-p spectral truncation for inference routing. Pre-computed NS config matches empirical quantile thresholds. GOAT 19/19 PASS.
Feature gate: spectral_budget (opt-in — GOAT-gated, not yet promoted to default). 📖 Plan: .plans/254_spectral_budget_router.md.
Foundational mathematical infrastructure — Discrete Exterior Calculus on cell complexes (conservation-guaranteed, zero-alloc SIMD) + categorical cubical framework (IntervalPruner + CubicalNerve + LatticeOpernad). Both default-ON, no GOAT gate needed (foundational).
Feature gates: dec_operators, lattice_operad (both default-ON). 📖 Plans: .plans/251_dec_operators_cell_complex.md, .plans/252_cubical_category_interval_topology.md.
Cost-aware inference routing using breakeven complexity N* for tier selection. 49% wallclock savings on long sequences (≥512 tokens) with ~9ns overhead and 0% accuracy regression.
Feature gate: breakeven_routing (default-ON, GOAT 7/7). 📖 Plan: .plans/250_breakeven_inference_routing.md.
Self-revising discovery with regime-aware inference. Detects when the model switches reasoning regimes and adapts compute accordingly. -0.3% overhead vs real decode, 8/8 mock + 4/4 real GOAT tests.
Feature gate: regime_transition (default-ON). 📖 Plan: .plans/215_regime_transition_inference.md.
Inference-time capability extraction via pre-computed per-capability MLP masks intersected with ReLU sparsity for dual sparsity. DDTree branches routed through different substrates. 25/25 tasks done, wired into forward_pass.
Feature gate: substrate_gate (default-ON). 📖 Plan: .plans/216_substrate_gate_capability_routing.md.
Distillation of Dense Supervision, Sparse Updates (arXiv:2606.13657). Four modelless primitives for inference-time adapter storage and routing:
sparse_task_vector) — OPD-grounded sparse delta format with 2.9–5.7× storage reduction vs dense LoRA at paper densities (17.5%, 10.5%).off_principal_retrieval) — projects query embeddings into off-principal subspace, removing ≥99% of principal component energy. Top-1 retrieval accuracy beats raw cosine on synthetic 8-adapter benchmark.spectral_rank) — maps top-k spectral concentration to adaptive LoRA rank via sigmoid, reducing avg rank ≥30% vs fixed max-rank.module_energy_route) — routes compute by FFN/Attn energy fraction × QPS: FFN-heavy + low QPS → Plasma, Attn-heavy + high QPS → GPU, very low QPS → ANE. Matches paper's OPD/RLVR module profile (FFN=0.78).GOAT: G1–G10 all pass (66 tests). Zero-alloc hot paths, sigmoid not softmax.
Feature gates: all four default-ON (GOAT-proven). 📖 Plan: .plans/264_sparse_off_principal_task_vector_modelless.md, Research: .research/231_Sparse_Off_Principal_Task_Vector_OPD.md.
Distillation of LoRA-Muon (arXiv:2606.12921). Three modelless primitives for gauge-invariant adapter composition:
ns_inv_sqrt_psd — Newton-Schulz inverse square root for PSD Gram matrices (paper Algorithm 4). Extends src/newton_schulz.rs with a 7-iter polynomial recurrence (P^{-1/2} · P · P^{-1/2} ≈ I), SIMD-accelerated, zero-alloc variant ns_inv_sqrt_psd_into.gauge_rebalance — scalar factor-pair rebalancing (paper Algorithm 2). Computes c = (σ_max(B)/σ_max(A))^{α/2} via 5-step power iteration, then A ← c·A, B ← B/c. Preserves ‖AB^T‖_F exactly.gauge_invariant_compose — weighted sum of (η_i, A_i, B_i) pairs. Drop-in replacement for naive task-vector arithmetic that is invariant to input factorization (paper Prop 1).Key result: composing gauge-equivalent inputs (A·c, B/c) for c=5 gives identical merged W (max diff < 1e-3). Naive sum produces 4609% error; gauge-invariant compose produces 0.0000% error.
Also integrated as SparseTaskVector::compose_gauge_invariant (feature-gated).
GOAT: 17/17 tests pass (gauge invariance Prop 1 + Prop 4, power iteration convergence, NS inv-sqrt correctness/stability, compose gauge-invariance, msign roundtrip, throughput targets).
Feature gate: gauge_invariant (default-ON, GOAT 17/17). 📖 Plan: .plans/270_gauge_invariant_adapter_composition.md, Research: .research/238_LoRA_Muon_Spectral_Low_Rank_Manifold.md.
Distillation of CHIAR-Former (arXiv:2606.08327). Per-token DCT spectral entropy H(x) ∈ [0,1] drives four modelless inference-time primitives:
ChiaroscuroKvDispatcher) — per-token KV cache storage strategy. H(x)<τ_lo → DCT-truncated (3.03× compression), H(x)<τ_hi → Quantized, else → Full f16. Streaming τ calibration converges to paper's [0.856, 0.864] within 1024 tokens.DctMixOp (DCT mixing layer) and FullAttnOp. Hard threshold gate (no STE — modelless).OpPromotion recommendations.InferenceRouter integration (T15): ChiarRouterHook exposes KV strategy utilization entropy and regime gate recommendation via RouterStats.chiar_stats. Observation-only — does NOT influence tier routing (CHIAR is per-token attention, not tier selection).
GOAT: G1-G9 all pass — 2.48× KV compression, 12 dB SNR on smooth tokens, 0.0 reconstruction error (Theorem 1), DCT overhead 0.0002% of attention, τ converges in 1024 tokens, collapse harness identifies survivors, sigmoid everywhere, regime+dispatcher integration, zero-alloc entropy_into.
Feature gate: chiaroscuro (default-ON, GOAT 9/9). 📖 Plan: .plans/269_chiaroscuro_spectral_entropy_operator_routing.md.
Distillation of LMNet (arXiv:2505.12741, ICML 2026). Treats multiple forward passes through the same LLM as nodes in a directed graph, communicating via dense hidden-state vectors instead of natural-language tokens. Edges are pluggable: IdentityEdge (baseline), LoraEdge (frozen-vertex LoRA on attention output projection), ProjectionEdge (fixed random projection, no training). The whole mesh is a latent channel — only input and output boundary nodes touch tokens (raw values), per AGENTS.md latent/raw rules.
Architecture: DenseNode trait (stripped transformer forward), DenseEdge trait (hidden-state transform), LayerwiseTopology (layer-wise fully-connected graph, paper §3.1.3 with SIMD-friendly aggregation), EdgeBandit (Thompson sampling over (topology, edge_set) arms), compute_router (CPU/GPU/ANE by width: width-1→CPU, width≥4→GPU, output→ANE). Bridge functions latent_to_raw_scalar and raw_to_latent_projection cross the latent↔raw seam with sigmoid (never softmax, per AGENTS.md).
GOAT status: Gate 1 (correctness) ✅, Gate 3 (easy overhead — 0.997× at production scale) ✅, Gate 5 (bandit convergence) ✅. Gate 2 (composition gain) ❌ FAILED empirically — real trained Bomber LoRAs composed via diamond topology produce 0/1000 wins over best single (improvement -0.00%). Untrained LoRA composition is a no-op ensemble. Gate 4 (hard bound) ⚠️ measured 9.27× single-thread vs paper bound 2.5× — requires vertex parallelism (Issue 020). Demoted to experimental. The framework is sound plumbing, but composition gain requires riir-ai R122 trained communication edges.
Feature gate: dense_mesh (opt-in, experimental — gate 2 failed empirically). 📖 Plan: .plans/266_densemesh_latent_node_network.md, Research: .research/234_DenseMesh_Latent_Node_Network.md, Benchmark: .benchmarks/266_densemesh_goat.md.
Commercial bound: the public MIT framework ships here. Trained-edge LoRA composition recipes stay in riir-ai (R122, private).
Distillation of Zhao et al. 2026 (arXiv:2601.22436, ICML). Verifies that a consumer's behavior is causally bound to injected memory — the open half of the Cognitive Integrity Layer. Three modelless primitives, all zero-training, all zero-backprop:
FaithfulnessProbe — runs five causal interventions (Empty, Shuffle, Corrupt, Irrelevant, Filler) on an injected memory segment and aggregates behavioral deltas into a FaithfulnessProfile. If Irrelevant/Filler deltas fall below threshold, the memory is flagged as a dead injection (consumer silently ignores it). Runs at audit cadence (every N ticks), not per-tick.AttributionProbe — finite-difference central-difference surrogate for Integrated Gradients: (f(M+εδ) − f(M−εδ))/(2ε) per axis, L2-normed. No gradient graph needed. Validated against exact IG on a non-linear consumer with Spearman ρ = 1.0000 across 64 segments (G2).TriggeredInjectionGate — sigmoid-thresholded inject/skip decision: should_inject(u) := sigmoid(λ·(u−τ)) > 0.5. Collapses to u > τ for the boolean case (0.132 ns/call — one compare, no exp()). The full sigmoid value is preserved for opt-in soft-gating. Sigmoid, never softmax (AGENTS.md hard constraint).All generic over ConsumerContext associated types (Memory, Behavior, Delta) — no game semantics, no PlayerId, no HLA/emotion channels. Game wiring (HLA evolve_hla, NeuronShard, KG triples) is private → riir-ai Plan 308.
GOAT status: G1/G1b (faithful/unfaithful detection ≥99%) ✅ 100%/100% over 400 trials. G2 (IG surrogate Spearman ρ ≥0.8) ✅ ρ=1.0000. G3 (triggered injection skips ≥50% w/ ±2% quality parity) ✅ 50.0% skips, 0.63% quality delta. G8 (zero-overhead off) ✅ 0 symbols in default build. Decision: triggered_injection promoted to default-on; faithfulness_probe kept opt-in (diagnostic).
Feature gates: triggered_injection (default-ON, GOAT G3 passed — saves compute, matches quality), faithfulness_probe (opt-in, diagnostic, audit cadence). 📖 Plan: .plans/278_faithfulness_probe_modelless.md, Research: .research/244_Self_Evolver_Faithfulness_Cognitive_Integrity.md, Benchmark: .benchmarks/278_faithfulness_probe_goat.md, Docs: .docs/04_calibration/faithfulness_probe.md.
Unblocks: riir-ai Plan 308 (Cognitive Integrity Layer runtime integration — HLA
evolve_hla, NeuronShard, KG Octree, dMoE). The bidirectional fusion with Plan 054 path-hacking stays private in riir-ai.
Distills Engels et al. 2026 (arXiv:2606.20560 §5.2, Research 277) into a ternary latent-mass classifier extending Plan 278's binary verdict. SmearClass::CoherentSingle / TokenSmear / SequenceSmear distinguishes benign positional uncertainty (paper §5.2.1 — token smearing, faithful) from potentially-unfaithful multi-hypothesis superposition (paper §5.2.2 — sequence smearing, warrants Cognitive Integrity Layer attention). #[repr(u8)] sync-friendly enum. Zero-alloc, simd_dot_f32-backed, SmearSource trait for MUX (Plan 178) / BoM (Plan 281) consumers to expose their [k*d] weights. Wired into DefaultFaithfulnessProbe::with_smear_classifier; the existing binary probe_intervention / faithfulness_profile are unaffected.
GOAT status: G1 (6/6 correctness + determinism) ✅. G2 (useful discrimination — SequenceSmear/TokenSmear unfaithfulness ratio ≥2.0×) ✅ 2.11× on 3000 synthetic trials (k=8, d=16). G3 (latency k=8, d=32 ≤200 ns) ✅ 107.6 ns on Apple Silicon arm64. Decision: stays opt-in — correct, useful, fast, but default-on promotion requires real-workload evidence from riir-ai Plan 308 (T4.3 deferred).
Feature gate: smear_classifier (opt-in, implies faithfulness_probe). 📖 Plan: .plans/298_smear_aware_faithfulness_probe.md, Research: .research/277_DiffusionGemma_Transparency_Smearing_Faithfulness.md, Benchmark: .benchmarks/298_smear_classifier_goat.md, Docs: .docs/04_calibration/faithfulness_probe.md.
605af19a, 2026-08-12)probe_intervention_into + faithfulness_profile_into take a caller-provided scratch buffer instead of cloning memory per intervention (the clone-based API clones 5× per audit NPC). Eliminates ~5000 heap allocations per audit tick at 1000 NPCs. Bit-identical to the clone-based API (same RNG draw order, same perturbation sequence, same aggregation — verified by test_scratch_api_bit_identical_to_clone_api). The clone-based API is retained for backward compatibility; the scratch path is zero-alloc by construction (G4). No feature-gate change — same faithfulness_probe gate, additive methods.
Distills Cheng et al. 2026 (arXiv:2601.07372, DeepSeek-AI / Peking U., Research 278) into the first conditional-memory axis in the katgpt stack. Where Raven (RSM/dMoE, Research 006) routes computation per token (active parameters), Engram routes memory lookups per token (static lookup slots). The paper's U-shape scaling law (§3) proves the hybrid is strictly better than either axis alone.
The mechanism reduces to pure inference-time math — no training, no backprop:
hash_keys = multi_head_hash(n_gram_suffix(input_ids)) # K=16 deterministic hashes, O(1)
e_t = concat(table[k] for k in hash_keys) # multi-head retrieval, O(1)
α_t = σ(RMSNorm(q_t) · RMSNorm(W_K e_t) / √d) # sigmoid gate (NEVER softmax)
output_t = α_t · (W_V e_t) # gated residual contribution
h_t += output_t # residual fuse
The table is a frozen snapshot populated offline; updates are atomic Arc swaps via EngramHotSwap. The whole pipeline is zero-allocation on the hot path (caller provides scratch buffers). Sub-primitives (all behind the engram feature flag):
multi_head_hash — multiplicative-XOR hash over N-gram suffixes; K=16 independent hashes (distinct prime moduli per head).InMemoryEngramTable — flat Box<[f32]> row-major slots, slots[hash.0 % N] direct-index lookup.sigmoid_fuse_into / sigmoid_fuse_multi_branch_into — fused RMSNorm + dot + sigmoid kernel (NEON/AVX2 SIMD). mHC variant (paper §2.4): shared V, M distinct gates.conv_causal_into — depthwise causal 1D conv (paper §2.3 eq 5), kernel 4, dilation = max N-gram order. IDENTITY_KERNEL = [0,0,0,1] gives pure passthrough (zero-init).SurjectiveMap / TokenizerSpec / build_surjective_map — V → V' tokenizer compression (NFKC + lowercase + trim → BLAKE3 → 64-bit canonical). Paper reports 23% vocab reduction on 128k tokenizer.EngramHotSwap — AtomicPtr<Box<dyn EngramTable>> runtime replacement, mirrors SenseHotSwap. AtomicBool lock (Option A) blocks readers during swap.ZipfianCacheHierarchy — plasma (papaya LRU) → warm (EngramTable) → cold (ColdFetcher) tiered cache. Adaptive maybe_resize(target_hit_rate).EngramTableId / build_merkle_root — 32-byte BLAKE3 Merkle root over slot contents. Crosses the sync boundary as a raw audit artifact; slot contents (latent) never sync.fuse_into_hidden_state — end-to-end hook: lookup K patterns, sigmoid-fuse each, residual-add into the hidden state.GOAT status: G1 (lookup latency) ✅ 48.12 ns/retrieval (target < 200 ns, 4× headroom). G2 (sigmoid ranking) ✅ Spearman ρ = 1.0000 (target > 0.95). G4 (table identity) ✅ 0 mismatches / 1000 random tables. G6 (effective depth, paper §6.1) ⏸️ DEFERRED — requires live inference pipeline (LogitLens divergence at layer 5 with Engram vs layer 12 without); runs in riir-ai when the Bomber/Go stack is wired to consume fuse_into_hidden_state. G7 (no regressions) ✅ scoped check clean. Decision: engram stays opt-in — G6 is the load-bearing gate for the Super-GOAT (U-shape scaling), and per the paper itself pure-Engram alone doesn't deliver the hybrid win.
Feature gate: engram (opt-in, rolls in unicode-normalization for NFKC + papaya for the plasma-tier LRU). 📖 Plan: .plans/299_Engram_Hash_Addressed_Pattern_Memory.md, Research: .research/278_Engram_Conditional_Memory_Latent_Lookup_Fusion.md, Benchmark: .benchmarks/299_engram_goat.md, Docs: .docs/03_memory/engram.md. Demo: cargo run --features engram --example engram_demo.
Unblocks: riir-ai Guide 147 (NPC conditional-memory selling-point guide) and the chain-commitment half
riir-chain/.research/007_Engram_LatCal_Commitment_Bridge.md(filed 2026-07-04). The Super-GOAT (U-shape hybrid Engram+Raven) requires the riir-ai inference wiring + G6 to land.
Distills Lample et al. 2019 §2.2 (Zhao & Jones 2026 distillation, Research 387) into the fourth complexity class in the katgpt retrieval stack. Where Raven routes computation (O(1), ~10³ experts) and Engram routes memory lookups (O(1) hash, ~10⁵ slots), PKM retrieves the top-k value rows for a query in O(√N) at scales up to ~10⁶ slots — the only retriever in the stack that scales to millions of slots at sub-linear cost.
The mechanism is pure inference-time math — no training, no backprop (the FwPKM paper's GD half is forbidden by the modelless mandate and replaced by the shipped δ-rule, Plan 053):
q1, q2 = split_half(q) # split D_K-dim query
top1 = heapselect_top_k(score(q1, keys_1)) # √N-row codebook 1, O(√N)
top2 = heapselect_top_k(score(q2, keys_2)) # √N-row codebook 2, O(√N)
(flat, w) = top_k_cartesian(top1 × top2) # K² candidates → top-k, O(K²)
Two scoring functions: Dot (q·k, magnitude-sensitive) and Idw (−log(ε+‖q−k‖²), magnitude-invariant centroid attraction). Caller-allocated PkmScratch<SQRT_N, K> holds the √N score arrays + K-length top-k buffers, reused across queries → zero allocation in the hot path.
GOAT status: G1 (latency) ✅ 1670× speedup at N=10⁶ (PKM p50 17.5µs vs O(N) brute-force p50 29.2ms; target ≥100×). G2 (top-k Jaccard) ✅ 1.0000 vs brute-force (50 queries; Phase 2 unit test 1000-query mean Jaccard ≥0.95). G3 (IDW centroid-ness, advisory) ✅ Dot intra-cluster rate 0.000 vs IDW 1.000. G4 (zero-alloc) ✅ 0 allocations / 1000 steady-state query_into calls. Decision: product_key_memory DEFAULT-ON (Phase 3, 2026-07-07). Retrieval stack ledger: Raven O(1) / Engram O(1)-hash / δ-Mem O(r) / PKM O(√N) — four distinct complexity classes, each optimal for a different slot-count regime.
Feature gate: product_key_memory (DEFAULT-ON since 2026-07-07; zero runtime cost unless a caller constructs ProductKeyMemory). Phase 4 freeze/thaw wrapper (product_key_memory_freeze, opt-in): Arc<RwLock<Arc<...>>> + BLAKE3 commitment + atomic swap. Phase 5 δ-rule write gate (product_key_memory_episodic, opt-in): F1 fusion PKM × δ-Mem. 📖 Plan: .plans/408_Product_Key_Memory_Primitive.md, Research: .research/387_Fast_Weight_Product_Key_Memory_PKM.md, Benchmark: .benchmarks/408_pkm_goat.md, Docs: .docs/03_memory/product_key_memory.md. Demo: cargo run --example product_key_memory_demo.
Honest approximation gap: PKM is approximate by construction — the true global top-k can span codebook boundaries the per-codebook top-k misses. On random tables the gap is zero (G2=1.0000); on adversarial key distributions use
K=16orK=32per codebook (still far below O(N)).
Distills Redesign MoE Routers with Manifold Power Iteration (arXiv:2606.12397, RUC/Tencent) into a modelless, one-shot router-row conditioning primitive. Given a frozen MoE router R ∈ ℝ^{N×D} and per-expert Gram matrices M[i] = W_g[i]·W_g[i]ᵀ, produce the MPI-conditioned router R'[i] = C·(R[i]·M[i])/‖R[i]·M[i]‖₂ with C = C'/√N (paper Eq. 4–5). Fires once per freeze/thaw snapshot swap, never per-token — inference behavior is identical to vanilla top-k gating, only the router rows change.
power_iter_retract (shared helper in spectral_retract.rs, always-on) — one or more steps of v ← v·M then v ← target_norm·v/‖v‖₂ on any PSD operator. Zero-alloc, caller-owned scratch. DRY-refactors gauge_rebalance's σ_max power iteration (Plan 270) — both are instances of "power-iteration step + norm retraction against a PSD operator".manifold_power_iter_router — applies the retraction to each router row against its expert Gram. Returns MpiRouterResult with lambda_alignment (paper Eq. 11) and maxvio diagnostics.gate_sigmoid_topk — independent per-expert sigmoid σ(β·x·R'[i]ᵀ), then TopK. Never softmax (AGENTS.md constraint, G7 enforces).MpiRouterSnapshotHook + DefaultMpiRouterSnapshotHook — the freeze/thaw swap boundary hook. BLAKE3-tagged Gram cache keyed by snapshot version; cache hit skips gram recomputation entirely.GOAT gate: G1 (λ alignment gain, λ(R') ≥ 0.5·λ(R_optimal)) ✅, G2 (MaxVio reduction ≤ 0.7·MaxVio(R)) ✅, G3 (zero per-token overhead — gate is identical matmul either way) ✅, G4 (sub-ms swap at game scale N=8, D=256: 0.076ms release) ✅, G5 (determinism — byte-identical R' across runs, sync-safe) ✅, G6 (DRY non-regression — all 9 gauge_rebalance tests pass unchanged) ✅, G7 (sigmoid constraint — perturbing one expert's row leaves others byte-identical) ✅, G8 (iters=1 sufficiency — captures 100% of iters=10 gain on rank-1 data) ✅. 9/9 green (release-build GOAT bench, commit 306cc047). Decision: promoted to default-on (Plan 279 Phase 4 — zero dependencies, DRY win via shared spectral_retract helper, GOAT 9/9 green on synthetic rank-1 Gram).
Feature gate: manifold_power_iter_router (default-on since Plan 279 Phase 4 GOAT 9/9 green). 📖 Plan: .plans/279_manifold_power_iter_router.md, Research: .research/246_Manifold_Power_Iteration_MoE_Router.md.
Distills the Su blog Feb 2026 quantile-balancing algorithm (+ Marin 32B-A5B / 1e22-FLOPs JAX validation) into a modelless, one-shot per-expert bias computation at freeze/thaw snapshot swap. Given a frozen router score matrix s ∈ ℝ^{m×n} (m calibration tokens, n experts), compute a per-expert bias vector β ∈ ℝⁿ via alternating-coordinate descent on the balanced-assignment LP, then route as top-k(s − β). Sibling to Plan 279 MPI — not a replacement: MPI fixes router rows (alignment λ), QB fixes bias (balance MaxVio). The two operate on orthogonal axes and compose (Phase 3 will run both on the same pool).
Inference-only reframing: QB is published as a per-step training algorithm. The distillation reframes it as a snapshot-swap one-shot: when the expert pool changes, run QB once on a calibration batch, compute β, ship β alongside the snapshot. The LP formulation transfers faithfully; the GOAT G8 gate (snapshot-swap revalidation) guards the application-point shift.
GOAT gate (G1–G8, 12/12 PASS): G1 mechanics ✅, G2 MaxVio reduction 3.000→0.0625 (48× at M=64) ✅, G3 no-degradation on balanced input ✅, G4 sub-ms swap 0.131ms (N=8 M=256 k=2, 7.6× headroom) ✅, G5 determinism ✅, G6 sigmoid constraint (independent per-expert bias, never softmax) ✅, G7 iters=5 sufficiency (MaxVio delta=0.0000) ✅, G8.A stationary 10× reduction ✅, G8.B reversed-drift honestly reported (ratio 1.000 — beta_cal mis-specified by construction; right fix is per-step recompute in riir-train) ✅, G8.C mild-drift 2× reduction ✅.
Phase 3 head-to-head vs Plan 279 MPI (Case C, 2026-07-17): ran both routers on a deliberately-hard synthetic fixture (N=8, D=256, M=256, k=2) with both low λ (router rows misaligned with expert Gram principal directions by θ=1 rad) and high MaxVio (input batch hot-direction signal systematically favoring experts 0,1). The composed pipeline R' = MPI(R, grams) then β = QB(s_with_R', cal_batch) then route as top-k(x·R'^T − β) strictly Pareto-dominates either alternative:
| Variant | λ ↑ | MaxVio_load ↓ | Verdict |
|---|---|---|---|
| Vanilla | 0.6529 | 1.8438 | baseline (both axes broken) |
| MPI only | 0.9918 | 2.6719 | fixes λ (+0.339); MaxVio worsens (retraction preserves hot-direction bias) |
| QB only | 0.6529 | 0.0312 | fixes MaxVio 59×; λ unchanged (orthogonality holds bit-exactly) |
| Composed (MPI+QB) | 0.9918 | 0.0000 | strictly Pareto-dominates all alternatives |
The decision matrix confirms Research 447 §2.4's prediction: MPI and QB operate on orthogonal axes (alignment vs balance) and compose cleanly. Honest finding (beyond the prediction): MPI alone worsens MaxVio on skewed distributions — retraction toward e_i preserves the input-batch bias that drives imbalance. This strengthens the Case C argument: MPI is not a substitute for QB on skewed expert-affinity distributions; QB is required for balance. Test: crates/katgpt-spectral/tests/bench_455_phase3_head_to_head.rs (6 structural assertions, all PASS).
Feature gate: quantile_balance_router (DEFAULT-ON since Plan 455 Phase 3, 2026-07-17 — Case C confirmed: composed with manifold_power_iter_router strictly Pareto-dominates either alone; MPI fixes alignment λ, QB fixes balance MaxVio on orthogonal axes). 📖 Plan: .plans/455_quantile_balancing_router_primitive.md, Research: .research/447_Kimi_K3_KDA_AttnRes_LatentMoE.md, Phase 2 GOAT: .benchmarks/461_quantile_balance_router_phase2_goat.md, Phase 3 head-to-head: .benchmarks/462_quantile_balance_router_phase3_head_to_head.md.
Distills Chen et al. 2026 (arXiv:2606.13594, "See What I See, Know What I Think") into three modelless primitives that together answer: which KV heads actually matter for a task, and how much budget should each receiver get given its context awareness? No training, no backprop — the only "learning" is one coordinate-descent Lasso solve on a fixed measurement matrix.
CsKvProbe — compressed-sensing KV-group importance probe. Ablate M random head subsets (default 200 masks, 5% ablation each), measure the task-quality delta per mask, then Lasso-solve for per-head importance coefficients. Returns a KvGroupRanking sorted by importance. On synthetic signal {3, 17, 42} the probe recovers all three as top-3 with 0.99/0.96/0.94 scores vs 0.13 for noise heads (G1).DensityBudget — the K(ca) interpolator. Given context-awareness ca \u2208 [0,1], returns integer top-K budget interpolating between sparse floor (3.5% of D) and dense ceiling (87% of D). Monotone, bounded, branchless (G3).GatedKvSlice — applies ranking + budget to a KV cache via log(s + \u03b5) bias per top-K group, -\u221e for the rest. Sigmoid-compatible, never softmax. Zero-allocation apply path (&mut [f32] out, verified by T3.5).GOAT gate: G1 (CS beats random by \u226515pp) \u2705, G2 (sparse-vs-dense duality shape reproduces at D=64) \u2705, G3 (K(ca) monotone + bounded) \u2705, T3.4 (zero-overhead when feature off) \u2705, T3.5 (zero-alloc in apply) \u2705. Decision: opt-in (cs_kv_probe feature) — the open math ships here; NPC wiring + fog-of-war ca computation + zone broadcast live in riir-ai Plan 311.
Feature gate: cs_kv_probe (opt-in). 📖 Plan: .plans/280_cs_kv_importance_probe.md, Research: .research/247_Dense_Latent_Heterogeneous_Communication_CS_Probe.md.
Ships the runtime/data-structure half of Momennejad & Raileanu's A Compositional Framework for Open-ended Intelligence — turns any execution into an observable, committable Primitive Transition Graph (PTG), discovers recurring subgraphs (motifs), and exposes the paper's §6 evaluation metrics (PRI / CDG / TaR). Measurement layer, not a new capability class.
flowchart LR
A[Wake phase:<br/>PtgTracedPruner] -->|finish_episode| B[MotifMiner<br/>ring buffer]
B -->|sleep-cycle boundary| C[mine_motifs_at_sleep_cycle<br/>+ compute_pri + CDG fold]
C -->|MDL gate| D{MotifAdmitter}
D -->|admit| E[Register Composite<br/>primitive id]
D -->|reject| F[Drop]
E -.->|next wake phase<br/>emits compressed node| A
PtgTracedPruner<P: ScreeningPruner> — zero-cost decorator that auto-instruments any pruner exposing AbsorbCompress. Emits one PTG node per absorb(arm, reward) (linked Sequence) and one per compress() (linked Branch, reserved COMPRESS_PRIMITIVE_ID = 254). Bandit update(arm, reward) traced via explicit trace() API. The decode hot path (relevance()) is strictly pass-through.MotifMiner — lock-free papaya-backed index + 1024-PTG ring buffer. mine_batch() runs in rayon at sleep-cycle boundaries (Plan 107 AutoDreamer / Plan 154 Sleep Consolidation), bounded-depth gSpan-lite over ≤4-node motifs.MotifAdmitter — wraps Plan 215's MDL admission gate. Accepts iff PRI ≥ 0.1 AND occurrence_count ≥ 3 AND dl_old_bits > admission_cost. Admitted motifs register as PrimitiveKind::Composite(blake3_prefix) — future PTGs emit a single compressed node.compute_pri / compute_cdg / compute_tar_score — the paper's §6 metrics as pure functions. TaR is a modelless Jaccard-over-motif-multisets proxy; the real TaR (via AnchorProfile.translate_priorities()) lives in riir-ai private IP.ptg_to_motif_embedding (raw→latent, dot-product + sigmoid, never softmax) and motif_embedding_to_tar_score (latent→raw scalar, clamped [0,1]). SIMD-friendly via simd_dot_f32.GOAT gate (G1–G4 must ALL pass for default-on; G5 is demotion):
| Gate | Target | Measured | Verdict |
|---|---|---|---|
| G1 | PRI < 100µs / 1K traces (hot-tier) | 20–67µs | ✅ PASS (bit matrix + ahash, Issue 035; was 4507µs) |
| G2 | Motif mining < 5% of admission path | 407µs mine / 42ns admit | ✅ PASS |
| G3 | TaR correlates with real transfer ≥0.5 | synthetic proxy 1.0/0.0 | ✅ PASS (proxy — real correlation needs riir-ai) |
| G4 | 10K-trace snapshot < 1MB | 0.296 MB (production-realistic all-None corpus) | ✅ PASS (Option<[u8;32]> data-model fix, 2026-06-26; was 1.774MB. Upper bound all-Some = 1.822MB informational.) |
| G5 | Demotion if no quality correlation | N/A | DEFERRED (needs riir-ai transfer traces) |
Decision: closure_instrument is DEFAULT-ON as of 2026-06-26. All G1–G4 PASS. G1 was fixed by Issue 035 (bit matrix + ahash, 20–67µs / 1K traces, was 4507µs). G4 was fixed by changing PtgNode.blake3_in from [u8; 32] to Option<[u8; 32]> — the production path (PtgTracedPruner::trace) was already attaching a zero placeholder for every node; the new API has it pass None (semantically correct). G4 now measures 0.296 MB / 10K traces (was 1.774 MB). All 10 GOAT tests + 9 metrics unit tests + 6 integration tests + 38 closure module tests pass; the wake→sleep→admit loop is proven end-to-end on real AbsorbCompressLayer<NoScreeningPruner>. API break: PtgNode.blake3_in: [u8; 32] → Option<[u8; 32]>; PtgRecorder::enter takes Option.
Feature gate: closure_instrument (DEFAULT-ON in both katgpt-rs/Cargo.toml and crates/katgpt-core/Cargo.toml; auto-tracing of AbsorbCompress additionally needs bandit). 📖 Plan: .plans/290_closure_expansion_instrument.md, Research: .research/264_Compositional_Open_Ended_Intelligence_Framework.md, Benchmark: .benchmarks/290_closure_instrument_goat.md, Paper: arxiv 2606.15386.
Open, generic, MIT-licensed modelless primitives distilled from ICT (Feng et al., Beyond Entropy: Detecting Critical Decision Points in LLMs via Distributional Branching). The paper's training-time selector becomes an inference-time cognitive-budget allocator: given K candidate trajectories per tick, spend the full CLR/HLA/KG/curiosity budget only on the ~10% that genuinely diverge from the population mean; the rest run at 10× lower cost.
Three core primitives:
collision_purity(π) = Σ π² = exp(−H₂) — ICT §A.2.5 proves ∂β/∂π(a) = 2π(a) > 0 unconditionally. Shannon entropy H₁ only has the right gradient for π(a) > e⁻¹ ≈ 0.37 — β is the correct concentration signal for the long tail.js_divergence(p, q, scratch) — symmetric, bounded [0, ln 2], finite on disjoint supports. ICT §A.5 proves this is the right distributional-novelty metric (KL is asymmetric and infinity on disjoint supports; Wasserstein needs a meaningless ground metric over token indices).BranchingDetector::observe_and_detect_into(trajectories, &mut report) — zero-alloc hot path. Population mean P̄ → per-trajectory u_k = JS(π_k, P̄) → top-k% mask → per-step β EMA. Returns a BranchingReport { mask, beta_per_step, uniqueness_scores }.GOAT gate results (Plan 294 Phases 2–6):
| Gate | Target | Measured | Verdict |
|---|---|---|---|
| G1 | β distinguishes where H₁ cannot (paper Fig 1a) | ΔH₁ = 1.2e-7, Δβ = 0.12 | ✅ PASS |
| G2 | Median inflection ∈ [5%, 20%] (paper §A.4.1 ~10%) | median 37.5% on synthetic-NPC suite | ⚠️ BORDERLINE-FAIL — paper's 10% is LLM-token-specific; sweep k_percent per-domain. Does NOT block G3. |
| G3 ⭐ | Spearman ρ(H₁, JS-uniqueness) < 0.5 (MAKE-OR-BREAK) | ρ = 0.0652, 95% CI [-0.017, 0.150] | ✅ PASS — JS captures structurally-different information from H₁. Super-GOAT proceeds. |
| G4 | ≤ 50µs per observe_and_detect_into call (K=8, action_dim=32) | mean 1.96µs, p99 2.00µs | ✅ PASS (25× headroom) |
| G5 | 0 allocs/call after warmup | 0 across 1000 calls | ✅ PASS |
| G6 | Feature isolation via cargo + nm | all 3 sub-tests pass | ✅ PASS |
| G10 | H₂ forecast beats H₁ on long-tail regime | MAE 0.402 vs 0.423 (long-tail) | ✅ PASS — Bebop R243 Issue 023 should adopt the H₁→H₂ upgrade |
Promotion decision (T8.4): ict_branching stays opt-in. G3 alone is necessary but not sufficient for default-on — need G8 (riir-ai Plan 324 runtime fusion validation) too. The runtime fusion (CLR gating at branching moments, HLA updates at branching moments, KG emission at branching moments, curiosity bursts at branching moments) lives in riir-ai Plan 324 — out of scope for this open katgpt-rs primitive.
What ships regardless of promotion:
collision_purity, renyi_h2, shannon_h1, js_divergence) — useful anywhere we currently reach for entropy as a concentration signal.AcceptanceForecastH2 — the Bebop H₁→H₂ drop-in upgrade (G10 PASS). Independent of the runtime fusion, this is the broadly-valuable piece.Reproducibility: every gate runs from cargo test --features ict_branching --test bench_294_ict_gN. Synthetic LCG seeds are fixed for byte-identical reruns.
Feature gate: ict_branching (opt-in — katgpt-core/ict_branching re-exported at root). 📖 Plan: .plans/294_ict_branching_detector.md, Research: .research/270_Beyond_Entropy_ICT_Distributional_Branching_Detector.md, Benchmarks: G1 · G2 · G3 · G4–G6 · G10, Paper: arxiv 2606.19771.
Distills Mozer, Siddiqui & Liu (DeepMind, 2026) The Topological Trouble With Transformers into a generic BeliefKernel trait unifying a leaky-integrator family (delta-rule SSM) with an attractor family (s_t = σ(W_s·s_{t-1} + W_x·x_t + b)) for belief-with-hysteresis. The trait exposes step() and project_to_scalars() via dot-product + sigmoid bridge (never softmax).
Two modelless primitives, both sigmoid-compatible:
BeliefKernel trait — unifies Family A (attractor, sigmoid-bounded) and Family C (leaky integrator).AttractorKernel — the GOAT candidate. σ-bounded step prevents long-horizon flip-flop.Verdict: revised Super-GOAT → GOAT after prior-art check. G1.1–G1.4 PASS (determinism, boundedness, bridge ranking, latency). G2 (attractor coherence) deferred to a long-horizon benchmark; attractor family stays opt-in behind a sub-flag if it loses.
Feature gate: micro_belief (opt-in — ships trait unification + attractor family; attractor variant not promoted until G2 passes). Snapshot/hot-swap integration lives in riir-ai. 📖 Plan: .plans/276_micro_recurrent_belief_state.md, Research: .research/242_Topological_State_Tracking_Recurrent_Belief.md, Paper: arxiv 2604.17121.
Distills Kerssies et al. A Frame is Worth One Token: Efficient Generative World Modeling with Delta Tokens (Apr 2026) into a single novel inference primitive — K diverse next-belief-states per tick in one batched kernel evaluation, by injecting K Gaussian noise queries at the kernel input site. BoMSampler trait extends MicroRecurrentBeliefState (Plan 276); the deterministic step() path is unchanged.
NoiseQueryConfig is its OWN commit() (separate BLAKE3 over sigma_le || k_le || seed_strategy_byte); the kernel snapshot is unchanged. Paper trains K=256, evals K=20; we default K=8 (plasma-tier budget).
| Gate | Target | Measured | Verdict |
|---|---|---|---|
G1.1 Determinism (fixed seed, bit-identical out[k]) | byte-identical | byte-identical | ✅ PASS |
| G1.2 K-distribution spread | σ(K unique vectors) > 0 | true for σ > 0 | ✅ PASS |
| G1.3 SIMD speedup vs scalar | K=8 ≥ 1.5× | 1.87× (via simd_sigmoid) | ✅ PASS |
| G2 Arena win-rate uplift | > 0 vs 1-deterministic-belief | +31.49pp (riir-ai Plan 314: MultiThreatArena + MultiHypothesisBoMMinimaxPlanner vs deterministic) | ✅ PASS |
| G3 SIMD Sigmoid step-rate | K=8 ≤ 2× baseline | 1.87× (Issues 024/025 closed) | ✅ PASS |
Verdict: Gain (not GOAT, not Super-GOAT — see Research 248 §3). The G2 arena win is the deciding result. Promoted to default-on in katgpt-core (T2.4 full, 2026-06-17). Stays opt-in at katgpt-rs root until T2.3 wiring (NPC tick dispatch, minimax-over-K-beliefs planner, ANE batch dispatch) lands in riir-ai.
Feature gate: bom_sampling (DEFAULT-ON in katgpt-core; opt-in in katgpt-rs root). Auto-enables simd_sigmoid (G3 PASS). 📖 Plan: .plans/281_bom_single_pass_diverse_sampling.md, Research: .research/248_DeltaTok_DeltaWorld_BoM_Single_Pass_Diverse_Sampling.md, Paper: arxiv 2604.04913.
Distills O'Reilly 2026 This is how the Neocortex Learns into a generic, zero-allocation, sigmoid-compatible dual fast/slow temporal-derivative kernel. Turns any streaming latent scalar/vector into a signed "surprise" signal — the implicit prediction-error channel the neocortex uses for credit assignment, computed locally from a signal's own time series with no external target and no backprop.
observe(signal):
fast = (1 - α_fast)·fast + α_fast·signal (high-pass: tracks what's happening now)
slow = (1 - α_slow)·slow + α_slow·signal (low-pass: tracks what's stable)
return fast - slow (band-pass: tracks how fast it's changing)
surprise_norm = ‖fast - slow‖₂ (0 when stable, spikes on novelty)
curiosity_gate = sigmoid(β · surprise_norm) (AGENTS.md sigmoid, never softmax)
Composes with existing belief-state and curiosity primitives — four fusion gates passed (per Research 243): state-vector companion, surprise-gated memory writes, derivative-augmented collapse detection, and zero-cost sigmoid curiosity signal. Consumer wiring lives in riir-ai.
All 4 fusion gates PASS → kernel primitive promoted to default-on (T6 final). Microbench: observe N=8 at 7.9ns (< 10ns target).
Feature gate: temporal_deriv (DEFAULT-ON since GOAT 4/4 fusions passed). Auto-enabled by bom_sampling for the sigmoid-surprise gate. 📖 Plan: .plans/277_temporal_derivative_kernel.md, Research: .research/435_Temporal_Derivative_Kernel_Neocortical_Learning.md, Paper: arxiv 2606.08720.
Distills Cui 2026, A Hippocampus for Linear Attention into a surprise-evicted bounded exact KV cache that complements the GDN2 fixed-size recurrent state (Plan 105, default-on backbone). The cache stores the top-w tokens by intrinsic delta-rule write magnitude β·‖e‖ (computed for free by the existing GDN2 update — both β and ‖e‖ are already on the hot path), and reads them via a decoupled RMSNorm-γ sharpened softmax that turns the exact copies into near-argmax retrieval instead of a soft average.
score_t = β_t · ‖e_t‖ (intrinsic surprise — free from delta-rule update)
cache = top-w by score (min-heap, O(log w) observe)
read: q̃ = RMSNorm_γ(q), k̃_j = RMSNorm_γ(k_j)
out = Σ_j softmax(q̃·k̃_j / √d) · v_j (near-argmax retrieval via √d sharpening)
GOAT gate G1–G4 modelless PASS (G5 perplexity deferred to riir-train, Issue 038):
| Gate | Result | Verdict |
|---|---|---|
| G1 Eviction correctness | 8/8 needles retained, distractors evicted, 5-order-independent | ✅ PASS |
| G2 Latency | observe 28.7 ns (W=64) / 1.75 ns (micro); read 2.87 µs (W=64 D=256 fast) / 86 ns (micro) | ✅ PASS (observe), ⚠️ read 2.9× over at D=256 (compute-bound) |
| G3 No-regression | byte-identical GDN2 state with/without cache observer | ✅ PASS |
| G4 Retrieval | HOLA softmax 8/8 (cosine ≈ 1.0); recency 0/8; sigmoid-gated 0/8 (documented) | ✅ PASS |
AGENTS.md deviation (documented): the cache read uses softmax, not sigmoid. The "sigmoid not softmax" rule applies to gating/routing (independent per-option gates); the HOLA read is attention/retrieval (competitive selection), where softmax normalizes for near-argmax retrieval. Sigmoid-gated read recovers 0/8 needles (mean cosine 0.61) — non-matching slots accumulate sigmoid(0) ≈ 0.5 · v_j noise. Both read paths ship; softmax is recommended.
Feature gate: hippocampal_cache (opt-in — G1–G4 PASS modelless; G5 perplexity deferred to riir-train). Competes for the KV-compression slot alongside AM (Plan 271) and Sink-Aware (Plan 287). 📖 Plan: .plans/395_hippocampal_exact_kv_cache.md, Research: .research/378_HOLA_Hippocampal_Exact_KV_for_Linear_Attention.md, Paper: arxiv 2607.02303.
Distills Asadulaev et al. Latent Reasoning in TRMs is Secretly a Policy Improvement Operator (ICML 2026) into three modelless primitives. The paper proves latent recursion is a policy improvement operator in disguise; we extract the inference-time consequence — detect when a recursion step is dead compute and skip it.
Three primitives, all modelless (no teacher, no oracle):
self_advantage() — log-ratio A(a) = log π+(a) − log π̂(a) between pre- and post-recursion logits. Zero-alloc: writes into caller-provided scratch.AdvantageMarginGate — accept recursion step iff A(y*) > E_a[A(a)] (paper Eq. 18). Paper claims 18× forward pass reduction.product_policy() — inference-time multiplicative interpolation π_w ∝ π̂^{1−w} · π+^w (paper Eq. 16). Controllable reasoning trust weight w.GOAT 4/4 PASS (vocab ≤ 128 operating range, Bench 056/057):
| Gate | Target | Measured | Verdict |
|---|---|---|---|
| G1 Skip detection on identical pre/post | 0% argmax change | 0% | ✅ PASS |
| G2 Skip count on dead-compute traces | > 0 skips | significant skips | ✅ PASS |
| G3 Step reduction at vocab ≤ 128 | ≥ 2× | met | ✅ PASS |
| G4 Argmax match vs ungated | 100% | 100% | ✅ PASS |
Belief-state integration (T5.1): the gate composes with existing sigmoid-bounded belief-state early-stop criteria. GOAT 3/3 PASS → Bench 057.
Feature gate: self_advantage_gate (DEFAULT-ON since GOAT 4/4 PASS). Deep integrations T2.2/T2.3 + freeze/thaw T5.3 remain deferred (see Plan 283 for the integration roadmap). 📖 Plan: .plans/283_self_advantage_recursion_gate.md, Research: .research/250_Latent_Recursion_Policy_Improvement_Advantage_Margin.md, Paper: arxiv 2511.16886.
The forensic watermark recipe primitive (Plan 293, arxiv 2606.18208) was relocated from katgpt-rs to riir-ai/crates/riir-chain/src/forensic/ behind the chain_forensic feature. Rationale: honeypot OPSEC — the recipe combination (Tardos + DCT + topology + vertex marks + least-squares recovery) is the implementation choice that determines collusion resistance, and forensic value depends on deployment secrecy. Per strategy verdict 003: "How = private." An open trait surface may return here later if a generic adoption hook is needed; the recipe impl stays private.
Open half of the Code World Models Super-GOAT: a generic, IP-free trait surface for forward-model impls that are verifiable, committable, and hot-swappable. The LLM-induction pipeline is private (riir-ai Plan 326).
induced_cwm, induced_cwm_ismcts, induced_cwm_tournament (all opt-in)induced_cwm_01_mock_iig, induced_cwm_02_value_tournamentA Levin-Search variant applied to modelless inference: replace uniform candidate sampling in MCTS / bandits / speculative drafters with sigmoid(-α·K̃(x) - β)-weighted sampling, where K̃ is a pluggable Kolmogorov-complexity proxy (RLE ratio, Shannon entropy, L1 norm — LZ4 + BLAKE3 stubs land behind sub-features). Per Dingle & Hutter 2026 (Entropy 28(2):226), this prior is never worse than uniform (α ≥ 0 ⇒ low-K candidates are always at least as likely) and exponentially better on simple optima (Levin-search lift). Theorem-backed cross-task transfer is exposed via CoincidenceGate: a found optimum x* for one simple objective f1 hits Θ(r / |X_O(1)|) per probe against other simple objectives, vs Θ(r / |X|) from random candidates.
Phase 1 (shipped): CompressionPriorSampler<K> + LatentCompressionPriorSampler<K> (operates on &[f32] via byte-quantization) + CoincidenceGate — 22/22 tests PASS, demo shipped. Per-candidate sigmoid never softmax (project rule). Zero-allocation hot path: caller-provided scratch buffers, #[inline] proxies.
Phase 2 GOAT (2026-06-23): PROMOTED to default-on. G1 (sampler safety) PASS — 5/5 random landscapes, worst Δ −0.5% vs uniform (target ≤ +1% degradation). G2 (exponential speedup) PASS — RLE proxy 92275× + Entropy proxy 18455× stretch on low-K optimum (Levin-search lift); L1 proxy 72× honest-negative on sparse byte encoding (documented domain mismatch: K̃ range collapses to [0, 0.125] under L1 normalization, too narrow to concentrate even at α=128). See .benchmarks/305_complexity_prior_sampler_goat.md.
Phase 3 (this plan): adapter-only integration hooks behind three sub-features — mcts_k_prior (MctsExpansionPrior trait with UniformExpansion / KPriorExpansion<K> impls), bandit_k_prior (KPriorBandit<K> wrapper that adds a per-arm log-prior to any bandit policy), spec_k_prior (KPriorDrafter<K> post-drafting re-ranker that composes with CompressionDrafter R256 and DendriticGate R260). All three are adapter-only seams — the existing MCTS / bandit / speculative code stays byte-identical when the sub-feature is off; the caller wires the prior into their expansion / arm-scoring / draft-ranking loop.
Feature gates: complexity_prior_sampler (DEFAULT-ON since Phase 2 GOAT PASS 2026-06-23), mcts_k_prior / bandit_k_prior / spec_k_prior (Phase 3 hooks, each implies complexity_prior_sampler). 📖 Plan: .plans/305_algorithmic_probability_sampler.md, Research: .research/284_Simplicity_Bias_Sampler_Coincidence_Extrema.md, Paper: Dingle & Hutter, Entropy 28(2):226, GOAT proof: .benchmarks/305_complexity_prior_sampler_goat.md.
A modelless, zero-allocation primitive that decides — per tick, per agent — whether to Speak (emit), Stay Silent (first-class variant, not just "no emission"), or Delegate (defer to another agent). Built on two stacked sigmoids (project rule: never softmax), one for the speak direction and one for the delegate direction, with silence emerging naturally when both sigmoids are below threshold.
Kernel surface:
pub struct SalienceTriGate<A, const D: usize> {
d_speak: [f32; D], // "what makes this agent want to speak"
d_delegate: [f32; D], // "what makes this agent want to delegate vs answer"
w_z: f32, // zone-attention scalar weight
w_c: f32, // curiosity scalar weight
// + thresholds (floor_speak, ceil_delegate)
}
pub enum SalienceDecision<A> { Speak, Silent, Delegate(A) }
impl<A, const D: usize> SalienceTriGate<A, D> {
pub fn decide(&self, a: &[f32; D], z: f32, c: f32,
delegate_payload: A, tick: u64) -> SalienceDecision<A>;
pub fn decide_batch(&self, activations: &[[f32; D]], z: &[f32], c: &[f32],
payloads: &[A], tick: u64,
out: &mut [SalienceDecision<A>]);
}
Why two sigmoids, not softmax: Softmax couples the three outcomes — P(Delegate) would rise merely because P(Speak) rose. The two-sigmoid design keeps each decision axis independent: an agent can simultaneously have low speak-salience AND low delegate-salience, yielding Silent as a genuine first-class outcome rather than a tie-break. This matches the JoyAI-VL-Interaction paper's observation that silence carries information distinct from either emission.
Phase 2 GOAT (2026-06-23): PROMOTED to default-on.
| Gate | Target | D=8 | D=16 | D=32 | Verdict |
|---|---|---|---|---|---|
| G1 determinism | bit-identical across runs | PASS (1000-call re-confirm) | — | — | ✅ |
| G2 ablation parity | ceil_delegate=+∞ bit-identical to speak/silent reference | PASS (10k-input re-confirm) | — | — | ✅ |
Latency decide() | < 50 ns for D=8 | 9.11 ns | 14.81 ns | 30.27 ns | ✅ |
Throughput decide_batch() | ≥ 50 M decisions/sec for D=8, N=1000 | 120.6 M/s | 77.7 M/s | 36.3 M/s | ✅ |
The D=8 latency (9.11 ns) is comparable to the crate's reference hot-path kernel evolve_hla (~14 ns for D=8) — the two-stacked-sigmoid design (one extra dot-product over a pure-sigmoid gate) costs ~5 ns of additional latency, well within the 50 ns budget. See .benchmarks/303_salience_tri_gate_goat.md.
Feature gate: salience_tri_gate (DEFAULT-ON since Phase 5 GOAT PASS 2026-06-23). 📖 Plan: .plans/303_salience_tri_gate_primitive.md, Research: .research/281_BoM_Salience_Gate.md, Paper: JoyAI-VL-Interaction, arxiv 2606.14777. NPC wiring (per-NPC salience gate runtime) lives in riir-ai Plan 330.
Examples:
cargo run --example salience_tri_gate_basic --features salience_tri_gatecargo run --example salience_tri_gate_batch --features salience_tri_gateAn asymmetric-basis FUNCATTN primitive that generalizes symmetric k×k spectral transport to d_src ≠ d_dst. Two frozen, BLAKE3-committed, column-orthonormal bases Φ_src ∈ R^{d_src × k} and Ψ_dst ∈ R^{d_dst × k} enable train-on-small-deploy-on-large latent transfer without retraining:
a ← Φ_src^T · s // project source latent → k-dim spectral
t ← Ψ_dst · a // reconstruct at destination resolution
The headline claim — train once on a small-tier shard, deploy on any tier — is the Super-GOAT candidate from Research 291. The runtime is two matmuls over frozen bases; no gradients, no inference-time solve.
Phase 2 GOAT (2026-06-23): ALL 4 GATES PASS — Super-GOAT headline holds. PROMOTED to default-on (Phase 4).
| Gate | Target | Result | Verdict |
|---|---|---|---|
| G1 reconstruction cos | mean ≥ 0.85, min ≥ 0.75 (16→256→16 round-trip) | mean 0.8944, min 0.8944 | ✅ |
| G2-A rank preservation (transported weights) | mean cos ≥ 0.85 (16→256) | mean 0.9300, median 0.9435, min 0.6127 | ✅ Super-GOAT |
| G2-B negative control (padded weights) | < 0.85 (documents naive padding fails) | mean 0.7142 | ✅ |
| G3 k-sweep | elbow at intrinsic_k | elbow at k=8 (= intrinsic personality rank) | ✅ |
| G4 zero-alloc | 0 allocations after warmup | 0 allocs / 1000 transports | ✅ |
Honest caveat (G1): the synthetic bandlimited_sample construction puts exactly band_frac of energy in the rank-k subspace, so mean cos = sqrt(band_frac) = sqrt(0.80) = 0.8944 exactly. Real personality vectors have a spectrum, not a hard 80/20 split — deployment validation should use real shard corpora (deferred to riir-neuron-db Plan 004 Phase 5).
Honest caveat (G2-B): the plan's literal "padded weights" setup was buggy — padded scoring drops w_src[k..d_src, :], so it fails at cos 0.71. Variant A (transported action weights) is the correct setup. Variant B is retained as a documented negative control.
Feature gate: cross_resolution_transport (DEFAULT-ON since Phase 4 GOAT PASS 2026-06-23). Implies funcattn as transitive default. 📖 Plan: .plans/310_cross_resolution_spectral_transport_primitive.md, Research: .research/291_cross_resolution_spectral_transport_open_primitive.md. Shard integration (NeuronShard::transport_to_tier) deferred to riir-neuron-db Plan 004.
The missing top-down control direction for NPC affect. Existing emotion infra is read-only (EmotionDirections::project, Plan 162). Latent Field Steering injects a frozen, BLAKE3-committed direction vector directly into mutable per-tick latent state — the "wave interference" mechanism from the Gemini reframing: linear superposition of the NPC's current field with an injected steering field.
s' = s + α · kernel(distance, bandwidth) · v
The kernel is sigmoid((bandwidth - distance) · steepness) — ~1 inside the support, ~0 outside, smooth at the boundary. Per AGENTS.md: sigmoid, never softmax. Supports three localization modes: Global (all entities), Radius (Euclidean band), Zone (zone-hash match).
Phase 2 GOAT (2026-06-23): ALL 5 GATES PASS — PROMOTED to default-on (Phase 4).
| Gate | Target | Result | Verdict |
|---|---|---|---|
| G1 steering strength | fear-axis post/pre ≥ 1.30 (α=0.5) | 1.50× | ✅ |
| G2 rank preservation (α=0.3) | mean cos ≥ 0.95, min cos ≥ 0.90 | mean 0.9958, min 0.9667 | ✅ |
| G3 localization | leakage ratio < 0.01 | 4.5e-5 | ✅ |
| G4 crowd perf | 5000 NPCs < 1ms | p50 19.2µs | ✅ (52× headroom) |
| G5 zero-alloc | 0 allocs after warmup | 0 allocs / 1000 applies | ✅ |
Deployment caveat (G2 argmax flip): the α-sweep reveals that 8% of NPCs change their top-1 action at α=0.3 (12% at α=0.5, 18% at α=0.9). The cosine gate passes cleanly, but deployment should use α ≤ 0.3 for hot-path steering to keep argmax flips under 10%.
| α | mean cos | min cos | argmax flip |
|---|---|---|---|
| 0.1 | 0.9995 | 0.9962 | 1% |
| 0.3 | 0.9958 | 0.9667 | 8% |
| 0.5 | 0.9883 | 0.8993 | 12% |
| 0.9 | 0.9634 | 0.5923 | 18% |
Feature gate: latent_field_steering (DEFAULT-ON since Phase 4 GOAT PASS 2026-06-23). 📖 Plan: .plans/309_latent_field_steering_primitive.md, Research: .research/290_latent_field_steering_open_primitive.md. Game integration (HLA post-evolve wiring, CWM soft-rule → field mapping, faction battle stance) deferred to riir-ai Plan 330.
Open modelless primitive for multi-resolution Merkle commitment: a depth-tiered Merkle octree that exposes one BLAKE3 root per octree depth, where depth boundaries are assigned by SLoD's ScaleBoundary set and leaf encoding is platform-deterministic via the DeterministicLeafEncode trait.
roots[0] = coarse (global Fréchet centroid)
roots[1] = regional (8 internal nodes)
roots[2] = fine (64 leaf KG triples)
The chain side (riir-chain Plan 003) provides the LatCal-backed impl; the runtime side (riir-ai) provides the fog-of-war verifier. This repo ships only the generic math: DepthTieredMerkleOctree, DepthSelector, RtdcProof, DeterministicLeafEncode trait, SubtreeProof.
Phase 1: not started — feature exists with dependencies wired (rtdc = ["slod", "merkle_octree", "sense_composition"]); implementation deferred until LatCal encoding lands in riir-chain.
Feature gate: rtdc (opt-in — Phase 1 not started). 📖 Plan: .plans/302_rtdc_open_primitive.md, Research: .research/280_Resolution_Tiered_Deterministic_Commitment.md, Chain-side: riir-chain/.plans/003_rtdc_quorum_wiring.md.
Root-cause counterpart to four existing symptom-only detectors (BeliefRankPruner, GainCostLoopHalter, latent_functor/reestimation, micro_belief/coherence_bench). Distills Eldenk et al. Attention Drift: What Autoregressive Speculative Decoding Models Learn into a minimal, dependency-free classifier over flattened &[f32] state chains.
DepthInvarianceDiagnostic classifies a chain h_0, h_1, …, h_k into one of:
DepthInvariant — ‖h_t‖ flat, cos step stable, rank flat (healthy kernel).DepthSpecificRefinement — ‖h_t‖ monotonically growing (paper's attention-drift failure mode).Collapsed — effective rank trending to 1.Insufficient — k < min_samples.Three root-cause signals (all O(k·d) via simd_dot_f32):
‖h_t‖_2 vs t.cos(h_t, h_{t-1}).flatness(h_t) = (Σh²)² / (d · Σh⁴) slope.MagnitudeRegularizedResidual is the modelless fix for kernels we own (HLA, latent_functor, micro_belief, engram, Raven). For frozen MLPs (BeliefDrafter), only the diagnostic applies — the fix requires MLP retraining and lives in riir-train.
GOAT gate (Plan 306 T7.4 — all PASS, promoted to default-on 2026-06-23):
| Gate | Target | Result | Verdict |
|---|---|---|---|
| G1 | 8 correctness tests (flat / linear / collapse / insufficient / oscillating / etc.) | 12 tests PASS (Phase 1 rolled in Phase 2) | ✅ |
| G2 | Reproduce paper Figure 10 on random-init BeliefDrafter | classifies as DepthSpecificRefinement beyond TTT | ✅ |
| G3 | Negative control on micro_belief/attractor | classifies as DepthInvariant | ✅ |
| G4 | ≤5% latency overhead (re-spec'd to absolute-latency at HLA scale) | classify_chain 0.54µs ≤1µs at d=1024,k=4 (0.22% of forward); apply_magnitude_regularization 1.42µs ≤2µs | ✅ |
HLA audit (riir-ai Plan 331 Phase 1): audit_depth_invariance + evolve_hla_regularized shipped via katgpt-core/src/sense/reconstruction_depth_invariance.rs. Key finding: HLA classifies as DepthInvariant by construction (per-element [-1,1] clamp bounds magnitude), refuting the drift hypothesis for this kernel; the RmsNorm wrap is retained as defense-in-depth backstop.
Feature gate: depth_invariance (DEFAULT-ON since Plan 306 T7.4, 2026-06-23). Zero runtime cost unless a caller invokes classify_chain / apply_magnitude_regularization. 📖 Plan: .plans/306_depth_invariance_diagnostic.md, Research: .research/286_Attention_Drift_Depth_Invariance_Diagnostic.md, Paper: arXiv:2605.09992, Private runtime: riir-ai/.plans/331_recursive_latent_state_magnitude_hygiene_runtime.md.
Materializes Research 287's L1/L2/L3 evidence ladder as a generic, modelless, zero-dependency Rust runtime that any probe/steering primitive (or research note / GOAT gate) can use to:
Claim { text, feature_class, declared_level }).EvidenceItem).Grade { level, missing, vocabulary_violations, downgrades } from a deterministic ClaimValidator that:
EvidenceLevel::requirements()).L1 (Behavioral) → "reads" / "correlates with" / "predicts"
L2 (Functional) → "is necessary for" / "is sufficient for"
L3 (Causal-mechanistic) → "causally controls" / "is both necessary AND sufficient for"
The output IS the rubric — but executable. Research notes can cargo test their own claims; GOAT gates can require Grade::passes(level) before promoting; downstream code can match claim.grade().level to pick which API is licensed (read-only monitor vs intervention).
GOAT gate (Plan 307 T3.3 — green, promoted to default 2026-06-23): 17/17 Phase 2 round-trip tests (the seven §4 primitive scores round-trip through the validator to the levels R287 records) + 1/1 GOAT gate. The crate compiles with --no-default-features --features claim_rubric (zero-dep baseline).
Feature gate: claim_rubric (DEFAULT-ON since Plan 307 T3.3, 2026-06-23). Zero runtime cost unless a probe/steering primitive explicitly invokes ClaimValidator::grade; promotion enforces the rubric at CI time per R287 §2.3. 📖 Plan: .plans/307_claim_rubric_runtime.md, Research: .research/287_Probe_Steering_Claim_Evidence_Ladder_Fusion_With_267.md, Paper: arXiv:2606.07612, Docs: .docs/10_audits/claim_rubric_audit.md.
Distills Huang, Kurths & Tang 2026 into a generic, modelless, inference-time trajectory forecaster KarcForecaster<D, M, K>:
x_i ∈ R^{K·D}.KarcBasis trait (Fourier, Chebyshev, BSpline shipped).Wout ∈ R^{D × (K·D·M)} by closed-form ridge regression Wout = YH^T(HH^T + λI)^{-1}.û_{i+1} = Wout · Ψ(x_i) in a single zero-alloc matvec.Phase 2 higher-order R=2 appends ψ[f1]·ψ[f2] features (paper Eq. 32) for combinatorial outer-product enumeration, plus chunked Gram accumulation (Eq. 44) and ALS low-rank factorization Wout ≈ A·B (Eq. 47) — the form that persists into a KarcShard in riir-neuron-db.
GOAT gate (Plan 308 — Phase 5.1 latest, G2/G3/G4 PASS; G1 split across two configs):
| Gate | Target | Result | Verdict |
|---|---|---|---|
| G1 NRMSE | double-scroll Table I ≤ 1.0×10⁻³ (paper: 5.3×10⁻⁴) | 9.43e-4 (Phase 5.1 K=8/M=8/R=2 d_h=18_720, λ=5e-2; underdetermined-system sweep) | ✅ |
| G1 threshold | ≥ 8 Lyapunov times | 2.85 LT (K=4 too short) / 7.23 LT (K=8/M=8/R=2, 10% short) / 8.16 LT (Phase 1 K=8/M=24 first-order only) | ❌ |
| G2 | train-time wall clock ≤ 500 ns/call (HLA-shaped config) | 381 ns | ✅ |
| G3 | zero-alloc forecast_into | 0 allocs | ✅ |
| G4 | bit-reproducibility across two instances | byte-identical Wout | ✅ |
Decision (Phase 5.1, 2026-07-20): NRMSE leg PASSes at K=8/M=8/R=2 d_h=18_720, λ=5e-2 (Phase 5.1 λ-sweep, .benchmarks/308_karc_goat.md). The 10× larger λ (vs Phase 2's λ=5e-3 tuned for K=4) suppresses the ~14_670 underdetermined directions of the rank-≤4050 Gram. Threshold leg FAILs by 10% (7.23 LT vs ≥8 LT) — the threshold gate is a capacity/delay problem, not a regularization problem (threshold is flat across λ at ~7.0–7.2 LT). The Phase 4 interpolation ("K=8/M=8/R=2 is the smallest config to pass both legs") was wrong — Phase 5 measured it and both legs FAILED at λ=5e-3; Phase 5.1 recovered the NRMSE leg via λ-tuning. The compute blocker is resolved — d_h=18_720 full-rank direct Cholesky is ~29 min wall (was projected 6 h via Jacobi before Issue 186 Path B Householder+QL).
Promotion deferred — three open paths: (a) K=10/M=8/R=2 at λ=5e-2 (linear K-extrapolation from K=4=2.85 LT, K=8=7.23 LT predicts ~8.5 LT — PASS), (b) accept the gate re-spec (Issue 186 Path D — promote on two-config evidence at same K=8 delay length), or (c) more training data (N=20_000+ would make the Gram full-rank). All three are cheap to test now that the compute blocker is gone.
Feature gate: karc_forecaster (DEFAULT-ON since Phase 22, 2026-07-21; promoted under the split-config G1 gate contract — Issue 186 Path D3. NRMSE PASS at K=8/M=8/R=2 λ=5e-2 (9.43e-4); threshold PASS at K=8/M=24/R=1 λ=5e-3 (8.16 LT). The compound gate is structurally infeasible — NRMSE requires R=2, threshold requires M≥24, R=2 × M=24 → d_h ≥ 166_752 (Gram ≈ 222 GB). Phase 3 spline-knot adaptivity still deferred.). 📖 Plan: .plans/308_karc_delay_basis_ridge_forecaster.md, Research: .research/288_KARC_Delay_Basis_Ridge_Forecaster.md, Benchmark: .benchmarks/308_karc_goat.md, Paper: arXiv:2606.19984.
Distills Artiles et al. The Alien Space of Science (May 2026) into a generic, modelless AlienSampler<V, C, A> primitive: within-pool z-scored linear fusion (1−β)·zC + β·zU of a coherence score and an unavailability score, plus MedianTopMAvailability implementing the paper's load-bearing community-aggregation rule (median over top-m cosine retrievals against a precomputed community bank).
GOAT gate FAILED (1/4) — module stays opt-in, NOT promoted. The β-sweep (β=0.2, 0.3, 0.5, 0.7) found a sharp phase transition at β≈0.4 with no β satisfying both G1 (motif collapse ≤50% of OPUS baseline) AND G2 (quality ≥90% of coherence-only) on the synthetic single-peak-coherence scenario. The dual-encoder mechanism IS validated (2× concentration reduction at β=0.7), but the scenario's quality/diversity tradeoff is unfavorable.
| Gate | Target | Result | Verdict |
|---|---|---|---|
| G1 motif collapse | top-10 concentration ≤ 50% of OPUS baseline | 2× reduction at β=0.7 (paper analog 95.7%→34.3% ≈ 36%) | ⚠️ BORDERLINE |
| G2 quality preservation | mean coherence ≥ 90% of coherence-only arm | fails below β≈0.4 | ❌ FAIL |
| G3 perf | per-cycle wall time ≤ 5× OPUS baseline | fails | ❌ FAIL |
| G4 latent boundary | no Vec<f32> escapes rank() in public API | PASS | ✅ |
The paper's evidence is on real research corpora, not synthetic NPC populations — transfer to our domain is unvalidated. Module retained as opt-in for paper reproduction; SIMD perf optimization is incremental (G3 already closed via rayon parallelism, see .benchmarks/311_alien_sampler_goat.md).
Feature gate: alien_sampler (opt-in — GOAT FAILED). 📖 Plan: .plans/311_alien_sampler_primitive.md, Research: .research/293_Alien_Science_Coherence_Availability_Frontier.md, Benchmark: .benchmarks/311_alien_sampler_goat.md, Paper: arXiv:2603.01092.
Open half of the Viable Manifold Graph Super-GOAT (R294 / riir-ai R154). Three composable primitives distilled from González-Duque et al. Mario Plays on a Manifold (2022):
pullback_volume(f, z, scratch, cfg) — given a smooth map f: R^n → R^m (closure) and a point z, return log det(J_f(z)^T J_f(z)) via Plan 301's jacobian_svd_at. This is the "cost-to-traverse" scalar field.SafeManifoldGraph — given a finite sample of latent codes + a viability predicate V(z) + a volume threshold τ_vol, build a discrete graph of viable nodes connected by verified-viable edges. The graph is the discrete approximation of the safe manifold.manifold_geodesic + manifold_random_walk + manifold_curiosity_walk — A* shortest path on the safe subgraph; uniform-over-neighbors (or weight-driven) random walk. Both stay inside the viable set by construction.Phase 0 self-contained proof reproduces paper headline: 360 viable nodes, 720 edges; free Gaussian walk 74.2% viable (256-trial ensemble, σ=0.25), manifold-constrained walk 100% by construction, geodesic 19 hops all viable (paper SMB analogue: 77.3% vs 99.6%).
free Gaussian walk manifold-constrained walk
│ │
▼ ▼
σ-noise step from z_t pick neighbor in SafeManifoldGraph
│ │
may leave viable set always stays inside viable set
│ │
▼ ▼
~70% viable (paper SMB 77%) 100% viable by construction
No game semantics, no chain semantics, no shard semantics. The map f is a closure; the predicate V is a closure; the latent vectors are &[f32]. The NPC-affect-specific wiring (use evolve_hla as f, use latent_functor/quality_gate coherence as V, wire manifold_curiosity_walk's weights closure to cgsp_runtime::curiosity_step) lives in riir-ai (R154 / future plan).
Phase 4 GOAT gates (G1–G7) — all PASS. Phases 0–4 complete (skeleton + SafeManifoldGraph construction + navigation primitives + GOAT gate proofs). G1–G7 correctness all PASS; perf bench PASS post-CSR (manifold_random_walk 485.58 → 7.10 ns/step, 14× under 100 ns/step target; CSR adjacency makes for_each_neighbor O(degree)). Phase 5 promotion: DEFAULT-ON since 2026-06-24.
Feature gate: viable_manifold_graph (DEFAULT-ON since Plan 312 Phase 5, 2026-06-24 — implies subspace_phase_gate). 📖 Plan: .plans/312_viable_manifold_graph_primitive.md, Benchmark: .benchmarks/312_viable_manifold_graph_goat.md, Research: .research/294_Viable_Manifold_Graph_Primitive.md, Private Super-GOAT guide: riir-ai/.research/154_viable_manifold_graph_game_runtime_guide.md, Paper: arXiv:2206.00106.
The missing arbitrary-conditional primitive for causal Transformers. Standard GPT can only evaluate p(xe | xc) when xc precedes xe causally; AC-GPT enables conditioning on future tokens in a single forward pass by copying xc to the front of the augmented sequence with original position encodings, applying bidirectional self-attention among the copies (to prevent multi-layer leakage), and causal attention everywhere else.
┌────────────────────────┬─────────────────────────────────────┐
│ xc copies (front) │ full sequence x = xc ∪ xe │
│ region r0 │ region r1 │
│ bidirectional self- │ causal attention everywhere │
│ attention among copies│ loss only on xe │
└────────────────────────┴─────────────────────────────────────┘
The load-bearing insight (paper's worked example): without the copy, x2 → x3 → x1 over two layers leaks future information from x2 to x1 through the conditioning token x3. The copy at the front with bidirectional self-attention among copies (and no attention back to the originals) is what prevents the leakage.
Phase 3 GOAT (2026-06-24): G1-G4 PASS + Issue 003 Phase 0 §3.5 MODELLESS UNBLOCK — DEFAULT-ON.
| Gate | Target | Result | Verdict |
|---|---|---|---|
| G1 (original) AC-GPT ≈ iterative-MLM logprob | diff < 1e-4 | 7.5e-4 (original mask) → 0.0 (dedup mask) | ✅ PASS via §3.5 modelless fix |
| G1 (reformulated) buffer construction bit-identical | 0.0 diff | 0.000000 | ✅ PASS |
| G2 speedup vs iterative-MLM | ≥ 3× | 27.258× (1.39ms vs 37.9ms) | ✅ |
| G3 no-regression on empty prefix | 0 mismatches | 0 / 16 | ✅ |
| G4 alloc-free hot path | 0 allocs | 0, 0 | ✅ |
§3.5 Modelless Unblock (Issue 003 Phase 0, Path 2): the original G1 spec ("AC-GPT logprob matches iterative-MLM to 1e-4") failed at 7.5e-4 on untrained micro-GPT due to the doubled-signal bias — each xc token appears both as a copy in r0 and in-place in r1, doubling the conditioning signal on untrained weights. The paper resolves this via LoRA fine-tuning (→ riir-train). The modelless alternative (AcPrefix::attends_dedup) zeroes eval→in-place-xc attention, forcing all conditioning through r0 copies. On single-layer micro-GPT this makes the attended (token, position) set identical to iterative-MLM's → same K/V → same softmax → bit-identical logprobs (0.0 diff, see .benchmarks/313_ac_prefix_modelless.md). The fix is a pure attention-pattern modification (no weights, no gradient descent) — the cleanest form of reader-adapter correction per §3.5.
Multi-layer caveat (non-blocking): on multi-layer models, the r0 copies' representations diverge from iterative-MLM's in-place xc from layer 2 onward (r0→r1 is false, so copies don't attend to eval tokens). Single-layer equivalence is sufficient to prove the bias-correction mechanism; multi-layer equivalence (does LoRA close the gap?) is a non-blocking riir-train follow-up.
Super-GOAT verdict (Issues 002 + 009, CLOSED 2026-06-26 — negative): the AC-Prefix × Engram × Latent Field Steering fusion is not realizable. Five verified structural facts make the fusion infeasible without negative-ROI infrastructure investment: no shared compute graph (AC-Prefix needs a causal Transformer forward over tokens; Engram/Latent Field Steering operate on f32 hidden-state slices), no Transformer-in-the-loop host workload exists in riir-ai, compute economics are catastrophic (100×–377,000× cost asymmetry vs additive latent fusion), multi-layer correctness needs riir-train (Issue 003), and Research 295 §2.4 rates the novelty gate borderline-to-negative. AC-Prefix stays a standalone default-on primitive — the only katgpt-core primitive providing token-level arbitrary-conditional evaluation in a single forward pass (valuable for offline conditional-likelihood queries). Re-open only if a local Transformer-in-the-loop game-AI workload lands in riir-ai for an independent reason. Full record: .plans/313_AC_GPT_Prefix_Primitive.md.
Feature gate: ac_prefix (DEFAULT-ON since 2026-06-24 — §3.5 modelless unblock Path 2 eliminates the doubled-signal bias bit-identically). The deduplicated mask (attends_dedup / materialize_dedup_from / conditional_logprob_dedup) is the recommended modelless default; the original attends is retained for paper-faithful mask (post-LoRA use). 📖 Plan: .plans/313_AC_GPT_Prefix_Primitive.md, Research: .research/295_AC_GPT_Arbitrary_Conditionals_Prefix.md, GOAT bench: .benchmarks/313_ac_prefix_goat.md, Modelless bench: .benchmarks/313_ac_prefix_modelless.md, Paper: arXiv:2606.14943. Training recipe (LoRA fine-tune for arbitrary conditioning) → riir-train. (Issues 002/003 — resolved & removed from .issues/; full narrative in the plan + benchmarks above.)
A generic, modelless primitive that decides when to compact a trajectory by firing summarization at structurally-safe moments (closed-unit ∧ summarizable ∧ progress ∧ ¬stuck) instead of at fixed token thresholds. Built on sigmoid projections onto latent-feature direction vectors (rule: never softmax) + a recursive FireRule Boolean tree (And/Or/Not/Box), with a Backstop token-pct safety net and an optional skip_if_reliable CLR fuse.
Kernel surface:
pub trait Rubric {
const ARITY: usize;
fn evaluate(&self, trajectory_prefix: &[u8], scratch: &mut RubricScratch) -> RubricVerdict;
}
pub struct ClosedUnitCompactionGate<R, const N: usize> { /* rubric + fire_rule + backstop + skip_if_reliable */ }
pub enum FireRule { And(u8), Or(u8), Not(u8), Box(Box, Box) }
pub enum CompactionDecision { Compress { audit }, Continue { audit }, Forced { audit } }
impl<R: Rubric, const N: usize> ClosedUnitCompactionGate<R, N> {
pub fn evaluate(&self, trajectory_prefix: &[u8], prompt_len: usize,
ctx_window: usize, clr_vote: Option<f32>,
scratch: &mut RubricScratch) -> CompactionDecision;
}
Why sigmoid projections, not LLM-judged verbatim quotes: the paper (SelfCompact) grounds each rubric predicate in an LLM-judged verbatim quote from the trajectory. We replace that with a latent reframing: each predicate is a scalar from an existing primitive (coherence stability, intrinsic rank, divergence-since-last-summary, novelty rate) projected through a sigmoid gate. The audit record still records the trajectory span [quote_start, quote_len] where the feature crossed threshold — preserving the paper's traceability without the LLM call. This keeps the primitive modelless (no training, no inference dependency).
The Super-GOAT: cross-domain isomorphism (G7). The headline claim is that trajectory compaction (paper's C1/C2/C3/N1 search rubric) and shard consolidation freeze (riir-neuron-db's can_freeze) are the same primitive — recognized after the fact, not designed in. G7 proves this structurally: a ClosedUnitCompactionGate<ShardFreezeRubric> produces bit-identical decisions to ConsolidationPipeline::can_freeze on all 4 combinations of (input_sufficient, output_converged), because both reduce to the same Boolean formula (n_wake_events >= intrinsic_dim) && (spectral_flatness < 0.3) = P0 && P1. The isomorphism is structural (same thresholds, same formula), NOT a cross-repo runtime dependency — katgpt-rs does not depend on riir-neuron-db, keeping the open primitive free of private-runtime coupling per the 7-repo commercial strategy.
Phase 6 GOAT (2026-06-25): PROMOTED to default-on.
| Gate | Target | Result | Verdict |
|---|---|---|---|
| G1 rubric beats fixed-interval | recall ≥ 0.80, FDR ≤ 0.20 | recall=1.000, FDR=0.000 (TP=9, FN=0, FP=0, TN=51) | ✅ |
| G2 skip-if-reliable suppression | ≥ 50% suppression on reliable prefixes | 50.0% (500/1000 compressed) | ✅ |
| G3 cache-reuse probe L-independence | latency within 3× across L=1k/10k/100k | 1.4ns / 1.4ns / 1.4ns, ratio=1.00 | ✅ |
| G4 zero-alloc hot path | no heap allocation on evaluate() | PASS (audit is stack POD, scratch caller-reused) | ✅ |
| G5 feature isolation | compiles ± the feature | PASS (cargo check --no-default-features ±feature) | ✅ |
| G6 sigmoid never softmax | 0 softmax calls | PASS (grep confirms 0 hits) | ✅ |
| G7 can_freeze isomorphism | bit-identical on all 4 (P0,P1) combos | PASS (all 4 match can_freeze formula) | ✅ |
Latency evaluate() ARITY=4 | ≤ 50 ns | 8.91 ns | ✅ |
Throughput evaluate() ARITY=4 | ≥ 50 M decisions/sec | 112.9 M/s | ✅ |
The 8.91 ns latency is parity with Salience Tri-Gate's 9.11 ns (Plan 303) — the two share the same cost shape (sigmoid projections + Boolean fire rule). The fire-rule tree walk (Box(And, And(0b0111), Not(0b1000)) for the search rule) adds negligible overhead because it evaluates against a u8 mask with no allocation. See .benchmarks/333_cucg_goat.md.
Feature gate: closed_unit_compaction (DEFAULT-ON since Phase 6 GOAT PASS 2026-06-25). 📖 Plan: .plans/333_closed_unit_compaction_gate.md, Research: .research/300_Closed_Unit_Compaction_Gate_Rubric_Gated.md, Paper: SelfCompact (Li et al., JHU + Apple), arXiv:2606.23525. Private selling-point guide: riir-ai/.research/155_Per_NPC_Sub_Goal_Compaction_Guide.md (per-NPC sub-goal-triggered compaction at MMO scale). Cross-domain crossref: riir-neuron-db/.research/007_Can_Freeze_As_Cucg_Instance_Crossref.md. Per-NPC runtime wiring (G8) lives in riir-ai.
Examples:
cargo run --example cucg_search_basiccargo run --example cucg_shard_freeze_isomorphismcargo run --example cucg_skip_if_reliableThe fifth typed cochain for the DEC terrain substrate, plus the SIMD per-edge utility op that consumes it. Closes the spatial-reasoning gap: the existing SafetyCohain / ThreatCohain / OccupancyCohain / DestructionCohain quartet had no slot for notability (fame, reward, attention). Plan 335 adds InterestCohain as a rank-0 cochain — the "f" lane the eggshell matrix was missing — and ships lattice_edge_utility_into, the leaf-clean SIMD hot path that blends all five cochains + NPC HLA state into a per-edge traversal utility.
NPC HLA (5 scalars) 5 typed cochains (rank 0 + rank 1)
┌───────────────┐ ┌──────────────────────────────┐
│ valence │─────────▶│ interest[src] · curiosity_w │
│ calm │─────────▶│ safety[src] · calm_w │
│ fear │─────────▶│ − threat[edge] · fear_w │
│ desperation │─────────▶│ destruction[src]·desp_w │
│ arousal │ │ + occupancy[face]·good_w │
└───────────────┘ └──────────────┬───────────────┘
▼
sigmoid → per-edge utility
│
utility > τ ───▶ emit KG triple
(zone_a, reachable_from, zone_b)
lattice_edge_utility_into takes raw slices (&[f32] cochain data + HlaToCohainWeights), not typed ValidatedZoneView / HlaState handles — this keeps katgpt-core leaf-clean (those consumer types live above the leaf in riir-ai). The inner loop is chunked for auto-vectorization and allocation-free by construction (no Vec/Box/collect/format! in the body).
Plan 335 GOAT (2026-06-25): 8/8 PASS (full results in riir-ai .benchmarks/335_zone_eggshell_goat.md).
| Gate | Target | Result | Verdict |
|---|---|---|---|
| G1 regen determinism | 100% byte-identical | 10/10, pod = 228 bytes | ✅ PASS |
| G4 zero-alloc hot path | 0 heap allocs | by construction (code-review verified) | ✅ PASS |
| G5a cache HIT latency | < 100 ns | 68.8 ns (31% margin) | ✅ PASS |
| G5b cache MISS latency | < 1 ms | 7.45 µs (134× under, post anon-mmap fix) | ✅ PASS |
| G6 two-node convergence | bit-identical | headers + all cochains + eggshell identical | ✅ PASS |
Leaf lattice op throughput: 738.89 Melem/s (649.63 ns for 480 edges on 16×16 grid).
Feature gates: interest_cochain was a DEFAULT-ON tracking flag in katgpt-core from Plan 335 Phase 7 (9330e6cb, 2026-06-25) until 2026-06-28 when the eggshell IP was migrated to riir-neuron-db's private dec_arena module (katgpt-rs Issue 008, commit cb3cb35c) — the katgpt-core/interest_cochain flag no longer exists; interest_cochain is now DEFAULT-ON in riir-neuron-db since 2026-07-17 (b345244, Issue 023 T1). lattice_utility (opt-in — pulls dec_operators, consumer-crate boundary) remains in katgpt-rs. The eggshell coexists with pathfinder.rs A* (zone-level KG reasoning vs tactical single-path movement); it does not dominate or replace A* (G2 framing-corrected — see benchmark). 📖 Plan: riir-ai/.plans/335_zone_eggshell_spatial_lattice.md (riir-ai), GOAT bench: riir-ai/.benchmarks/335_zone_eggshell_goat.md.
Adds a reject_confidence() default method to ConstraintPruner returning a [0,1] sigmoid confidence instead of a hard binary bit, plus a caller-side soft_reject_with_relax pipeline that routes borderline candidates through a relaxation retry instead of hard-failing them. HarnessBridge Table 7 proves tolerant rejection strictly beats strict rejection because false-reject cost > false-pass cost — a wrongly-rejected good candidate is a missed gain, while a wrongly-accepted bad candidate is caught downstream at partial cost.
reject_confidence() soft_reject_decide()
│ │
▼ ▼
sigmoid(β·evidence) ──▶ ≤ τ_low ──▶ Accept (outright)
Truncated — view the full README on GitHub.
Rust
93.2%
Python
6.1%
A neuro-symbolic micro-Transformer with speculative decoding, constraint pruning, recurrent attention, and adaptive test-time scaling — built in Rust.
Rust
123
6,197 commits
updated Sep 23, 2026
Boundary contract: BOUNDARY.md — what lives here, what may depend on it, known drift.
A GOAT-proved neuro-symbolic micro-Transformer with speculative decoding, constraint pruning, and 641 feature flags (204 default-on, all GOAT-proved) — built in Rust. Pure algorithms, zero side effects, MIT licensed.
Inspired by Andrej Karpathy's microgpt.
| Result | Number | Feature |
|---|---|---|
| TTFT Speedup | 29× (X16 compression) | MUX-Latent zero-training context compression |
| KV Memory Reduction | 93.8% | MUX superposition fusion |
| Prefill Seq Reduction | 21×, 100% NIAH retrieval | PFlash block-sparse prefill |
| KV Rotation FMAs | 64× fewer, best MSE | Hybrid OCT+PQ codec |
| RMSNorm Speedup | 2.4× | Kog CPU fusion kernel |
| Sudoku Compression | 7,079× on Inkala's Hardest | Path-aware ConstraintPruner |
| Bomber HL Score | +177 vs Random −55 | Adaptive intelligence arena proof |
| NFSP/MCTS Duality | 75% vs MCTS 8% | Bandit-guided backward→forward search |
| BoM Belief Sampling | +31.49pp arena win rate (K=8 @ 1.87× step) | Single-pass K-hypothesis belief sampling |
| Self-Advantage Gate | 18× forward-pass reduction (paper claim) | Dead-compute detector via pre/post log-ratio |
| Temporal Derivative | 4/4 fusion gates PASS (HLA, δ-Mem, collapse, curiosity) | Dual fast/slow EMA surprise signal |
| Triggered Injection | 50% skips @ 0.63% quality delta | Sigmoid-thresholded inject/skip hot-path gate |
| KARC Trajectory Forecast | NRMSE 9.43e-4 at d_h=18_720 (Phase 5.1 K=8/M=8/R=2 λ=5e-2; threshold leg 10% short — stays opt-in) | Delay-basis ridge forecaster (Plan 308 Phase 5.1 λ-sweep, Issue 187 T7) |
| Latent Field Steering | 1.50× fear-axis shift, ≤4.5e-5 leakage | Top-down direction-vector injection (Plan 309) |
| Cross-Resolution Transport | 0.9300 mean cos rank preservation (16→256 tier transfer) | Train-small-deploy-large asymmetric-basis FUNCATTN (Plan 310) |
| Manifold Walk Viability | 100% playability vs free 74.2% (paper's SMB headline reproduced); 7.10 ns/step post-CSR (68.4× speedup, 14× under target) | Viable Manifold Graph safe-navigation (Plan 312, DEFAULT-ON) |
| AC-Prefix Modelless G1 | 0.0 diff (bit-identical to iterative-MLM) via attends_dedup; 27.258× speedup vs 64 iterative forwards | §3.5 modelless unblock of AC-GPT arbitrary-conditional eval (Plan 313, DEFAULT-ON) |
| Renoise-CE Self-Verifier | renoise=1.000 vs plurality=0.000 (100pp), +30.5pp CLR fusion (6× target) | Perturb-output + re-resolve + measure-drift, operator-agnostic (Plan 406, DEFAULT-ON) |
| Velocity Field Ensemble | beats conformal-naive floor (Plan 340); ridge-solved η weights regression-optimal | Algebraic combination of P frozen velocity fields (Plan 376, DEFAULT-ON) |
| Local Branch Routing | +9pp to +26pp quality gain (K=3 candidates), argmax 51ns / sampled 69ns | Post-candidate-set attention + relative routing (Plan 377, DEFAULT-ON) |
| Set Attention (NPT half) | 75.7µs/tick @ 100 NPCs (6.6× headroom), G1–G5 PASS, G8 CLOSED by CLR-weighted sibling (+8.7pp ID, 3.88× amplification) | Permutation-equivariant sigmoid-gated cross-entity attention (Plan 354 + Plan 570 CLR-weighted sibling, DEFAULT-ON) |
| Step Attribution Qualifier | 81.6% drift reduction (riir-ai PoC), 13ns aggregate @ W=64 | Δ≥0 commit gate (SkillAdaptor eq.8) + StepLocalizer (Plan 381, DEFAULT-ON) |
| Heat Kernel Trajectory | exact at long horizons vs O(T·dt²) Euler error | Single-shot DEC cochain field prediction via operator exponential (Plan 359, DEFAULT-ON) |
| QMC Belief Sampling | G1–G6 ALL PASS (Lattice/Stratified/Sobol drop-in for iid) | QuasiMoTTo QMC uniform sources in K-rollout paths (Plan 367, DEFAULT-ON) |
| Zone Density Routing | +41.54% routing, 99.1% cache hit, 0 stale reads | Density-aware zone routing + papaya LRU cache (Plan 351, DEFAULT-ON) |
| Tropical (max,+) Algebra | 0.96× of simd_matvec (NEON); 3/3 fusion gates PASS | Worst-case/bottleneck aggregation via tropical semiring (Plan 337, Super-GOAT) |
| Cross-Resolution SIMD Encode | 11–15× faster encode at production scales (target was 1.5×) | Transposed basis layout + simd_matmul_rows replaces strided gather-dot (Plan 417) |
| GDN Tree Verification | 7.09× at T=128 (matches paper B200 GPU on CPU SIMD) | Rollback-free tree verify for delta-rule speculative trees via masked triangular solve (Plan 424) |
| MANCE SVD Caching | ~5× loop speedup (skip ~9 of 10 SVDs in 10-round loop) | Tangent basis reuse keyed on k-NN neighbor indices (Plan 427) |
| Newton-Schulz Blocked Matmul | 1.37× faster NS inv-sqrt r=64; per LoRA-Muon step 595µs→432µs | Rank-K blocked matmul eliminates per-dot call overhead (Plan 421) |
Matching the talos-vs-macbook reference model:
| Parameter | Value |
|---|---|
vocab_size | 27 (a–z + BOS) |
block_size | 16 |
n_embd | 16 |
n_head | 4 |
mlp_hidden | 64 (4×) |
n_layer | 1 |
temperature | 0.5 |
ModelArchitecture | NanoGpt, QwenDeltaNet |
AttentionMode | Standard, SpKvQuant, DashAttn |
WeightDtype | F32, F16, BF16 |
LLM drafts logits → ConstraintPruner filters invalid → DDTree builds valid-only tree → Target verifies
// From katgpt-core/src/traits.rs (signatures abbreviated)
pub trait ConstraintPruner: Send + Sync {
fn is_valid(&self, depth: usize, token_idx: usize, parent_tokens: &[usize]) -> bool;
fn batch_is_valid(&self, depth: usize, tokens: &[usize], parent_tokens: &[usize], out: &mut [bool]);
fn propagate(&self, depth: usize, token_idx: usize, parent_tokens: &[usize]) { }
fn manifold_score(&self, depth: usize, token_idx: usize, parent_tokens: &[usize]) -> f32 { 0.0 }
fn constraint_vector(&self, depth: usize, parent_tokens: &[usize]) -> Vec<f32> { vec![] }
}
pub trait ScreeningPruner: Send + Sync {
fn relevance(&self, depth: usize, token_idx: usize, parent_tokens: &[usize]) -> f32;
}
pub trait SpeculativeGenerator {
type Condition;
type Output;
type Error;
fn generate(&mut self, condition: &Self::Condition, rng: &mut fastrand::Rng) -> Result<Vec<Self::Output>, Self::Error>;
fn generate_batch(&mut self, conditions: &[Self::Condition], rng: &mut fastrand::Rng) -> Result<Vec<Vec<Self::Output>>, Self::Error>;
}
Additional core traits in katgpt-core/src/traits.rs: DominoPruner, CompletionHorizon, CollapseDetector, GameState, StateHeuristic, RolloutPolicy, LeoHead, AllGoalsUpdate, DualLeoMixer, AutocurriculumSampler, GenerativeConstraintPruner, QGradientOracle, PartialScorer, ProblemMutator, BestBuddyAligner. Plus DataGate in types.rs, and InferenceBackend (prompt→string contract, Issue 580) in the dedicated katgpt-core::prompt_backend module — hoisted from riir-game-sdk::gm::prompt so multiple consumers (riir-agents, the SDK, future callers) share one trait; ships a CannedResponseBackend mock. See crates/katgpt-core/src/traits.rs + crates/katgpt-core/src/prompt_backend.rs for full signatures.
KeywordRouter scores prompt against domain keywords, ExpertRegistry selects ScreeningPruner + LoRA. InferenceBackend trait + CpuBackend for backend abstraction.reader_lora active during prefill, writer_lora active during decode. Reference swap, zero data movement.The workspace has 27 in-tree crates (plus the root) organized in three
layers: shared leaves (depend on katgpt-types or nothing), katgpt-core
(traits + cognitive kernels, depends on leaves), domain stacks (depend on
katgpt-core + other domain crates), and the root crate (katgpt-rs) which
is the feature-aggregation surface that wires every domain crate into the
transformer runtime via ForwardContext. See .proposals/003_src_consolidation_master.md for the
full Phase 0–12 consolidation history. Phase 12 (Plans 378–404) completed
the substrate-extraction sweep; Issue 121 (2026-07-09) collapsed the last
6 shim folders into inline pub mod blocks. Only training code + benchmark
tooling + ForwardContext glue remain permanently root-resident.
graph TD
subgraph Leaves["Leaves (depend on katgpt-types or nothing)"]
types["katgpt-types<br/>(Config, Rng, SIMD)"]
hla["katgpt-hla<br/>(HLA substrate)"]
tokenizer["katgpt-tokenizer<br/>(BPE, ConvexTok)"]
dec["katgpt-dec<br/>(DEC operators)"]
microbelief["katgpt-micro-belief<br/>(BeliefKernel, BoMSampler)"]
personality["katgpt-personality<br/>(sigmoid composition)"]
sense["katgpt-sense<br/>(NPC sense composition)"]
sleep["katgpt-sleep<br/>(consolidation)"]
validator["katgpt-validator<br/>(partial parser, syn pruner)"]
percepta["katgpt-percepta<br/>(transformer-VM, zero katgpt deps)"]
proofcert["katgpt-proof-cert<br/>(GOAT proof certificates)"]
deprecated["katgpt-deprecated<br/>(exiled losers)"]
end
subgraph Core["Core layer"]
core["katgpt-core<br/>(traits, attention primitives, cognitive kernels)"]
end
subgraph Domain["Domain stacks"]
transformer["katgpt-transformer<br/>(weights, packing, mbu, tf_loop, swir, dense_mesh)"]
forward["katgpt-forward<br/>(ForwardContext top tier)"]
quant["katgpt-quant<br/>(KV codecs)"]
spectral["katgpt-spectral<br/>(eigenbasis)"]
attn["katgpt-attn<br/>(GDN2, CHIAR, RAT+, EGA)"]
attnmatch["katgpt-attn-match<br/>(MaxSim rerank)"]
kv["katgpt-kv<br/>(SP-KV, cache prune, segment ckpt)"]
spec["katgpt-speculative<br/>(DDTree, DFlash, spechop)"]
pruners["katgpt-pruners<br/>(bandit, screening, closure wire)"]
band["katgpt-band<br/>(band conditioner, collider pruner)"]
sparse["katgpt-sparse<br/>(SOPTV task vector, SPLAT)"]
claim["katgpt-claim<br/>(claim rubric, CLR)"]
ruliology["katgpt-ruliology<br/>(Wolfram ruliology)"]
backend["katgpt-backend<br/>(CPU/ANE/GPU inference backends)"]
end
root["katgpt-rs (root)<br/>(runtime, feature surface)"]
hla --> types
dec --> types
microbelief --> types
personality --> types
sense --> types
sleep --> types
validator --> types
core --> types
core --> hla
core --> dec
core --> microbelief
core --> personality
core --> sense
core --> sleep
transformer --> core
forward --> core
forward --> hla
forward --> pruners
forward --> spec
forward --> transformer
forward --> types
quant --> core
quant --> transformer
spectral --> core
spectral --> transformer
spectral --> types
attn --> core
attn --> forward
attn --> kv
attn --> pruners
attn --> spectral
attn --> transformer
attnmatch --> core
attnmatch --> kv
kv --> core
kv --> spectral
kv --> types
spec --> core
spec --> kv
spec --> pruners
spec --> transformer
spec --> types
pruners --> core
pruners --> percepta
pruners --> spec
pruners --> transformer
pruners --> types
band --> core
sparse --> core
sparse --> band
sparse --> spectral
claim --> core
ruliology --> core
ruliology --> pruners
backend --> forward
backend --> transformer
backend --> types
validator --> core
validator --> tokenizer
deprecated --> core
root --> core
root --> transformer
root --> forward
root --> quant
root --> spectral
root --> attn
root --> attnmatch
root --> kv
root --> spec
root --> pruners
root --> band
root --> sparse
root --> claim
root --> ruliology
root --> backend
root -.optional.-> proofcert
root --> validator
root --> tokenizer
root --> percepta
root --> microbelief
root --> personality
root --> sense
root --> dec
root --> deprecated
Dependency rules:
katgpt-types (or nothing, for katgpt-percepta
and katgpt-proof-cert). katgpt-core consumes the leaf substrate crates
(katgpt-hla, katgpt-dec, katgpt-micro-belief, katgpt-personality,
katgpt-sense, katgpt-sleep) and re-exports them as katgpt_core::*.katgpt-core attention primitives (attention, parallax_attn, set_attention,
funcattn) live in core and are NOT in katgpt-attn — they can't move up
without inverting the DAG.katgpt-hla (leaf); katgpt-core re-exports it as
katgpt_core::hla. The root's pub mod hla { ... } in lib.rs is pure
composition glue (Issue 121 collapsed the src/hla/ folder into an inline
module).katgpt-forward is the top-tier domain crate — it depends on katgpt-core,
katgpt-transformer, katgpt-pruners, katgpt-speculative, katgpt-hla,
and katgpt-types. katgpt-attn and katgpt-backend depend on forward.katgpt-band, katgpt-validator, katgpt-sparse, katgpt-claim,
katgpt-ruliology) plus katgpt-backend (Issue 413, 2026-07-08) and
root shims preserving every historical katgpt_rs::* path. Phase 12
(Plans 383–404) finished the substrate sweep; Issue 121 (2026-07-09)
collapsed the last 6 shim folders into inline pub mod blocks. Only
training code + benchmark tooling + ForwardContext glue remain
permanently root-resident.pub use katgpt_X as Y in lib.rs
(or inline pub mod X { pub use katgpt_X::*; ... } post-Issue-121) so
existing katgpt_rs::* paths resolve.The default production stack has 204 GOAT-proved default-on features (641 total flags), but they don't all run on every token. The architecture uses layered gating — most features are bandit-driven, Option-gated, or compile-time-only.
flowchart TD
subgraph HOT["🔴 Always-On Hot Path — 12 features per token"]
KOG["kog_cpu_fusion\nFused RMSNorm+QKV kernel"]
SPARSE["sparse_mlp\nTwELL sparse matmul"]
DELTA["delta_routing\nBlock-boundary delta accumulate"]
MLS["mls_aggregate\nMulti-layer residual sum"]
DOMAIN["domain_latent\nMid-layer K/V inject"]
PPOT["ppot\nCPU resampling"]
SPECTRAL["spectral_quant + hybrid_oct_pq\nKV cache storage format"]
KVARNS["kvarn + kv_share\nVariance-norm KV + Q-K=V sharing"]
ATTNS["gdn2_attention + lt2_looped\nO(1) decode recurrent attention"]
ELF["elf_sde\nDDTree noise injection"]
end
subgraph GATED["🟡 Conditional — ~30 features, 1 check each"]
BANDIT["Bandit-driven arm select\nbandit, bandit_top_p, freq_bandit\nsr2am, curvature_alloc, wealth_pruner\nrosetta, directional_credit, self_distilling"]
OPTION["Option-gated\nhydra_budget, cna_steering\nkurtosis_gate, domino_correction"]
THINK["Thinking mode only\nthinking_cot, chain_fold\nthinking_prune, parallel_probe"]
SPEC["Speculative pipeline\nbt_rank, lodestar, best_buddies\ntrust_region_spec, corr_budget\nbelief_drafter, bfcf_tree"]
end
subgraph OFFLINE["🔵 Offline — ~8 features, not in forward pass"]
DIAG["Training/diagnostics\nnewton_schulz, river_valley\nspectral_hierarchy, roofline_cost\nsigmoid_margin, stability_metrics"]
BG["Background\nsleep_consolidation\ndreamer"]
end
HOT --> GATED
HOT -.->|"post-token"| BG
GATED -.->|"offline"| DIAG
GATED -.->|"between sessions"| BG
These execute unconditionally on every token — they replace kernels, formats, or accumulate state:
| Feature | What | Why Always-On |
|---|---|---|
sparse_mlp | Skip dead ReLU in w2 matmul | Replaces dense matmul kernel |
kog_cpu_fusion | RMSNorm gamma folding + QKV interleaving | Fused kernel replacement |
delta_routing | Cross-layer residual delta routing at block boundary | Accumulates per-layer, routes at block edge |
mls_aggregate | Average last K layer residuals before LM head | Structural blend into final logits |
domain_latent | Mid-layer K/V injection | Option-gated inject at n_layer/2 |
spectral_quant | Calibrated eigenbasis + water-fill KV codec | Storage format, not conditional |
hybrid_oct_pq | OCT triplet + PQ 2D Givens KV compression | Replaces quantization codec |
kvarn | Variance-normalized KV cache quantization | Cache format when selected |
kv_share | Q-K=V projection sharing, 50% KV reduction | Weight merge at load time |
gdn2_attention | Gated DeltaNet-2 O(1) decode | Replaces KV cache with fixed state matrix |
lt2_looped | Weight-shared T-pass loop + AHLA | Changes forward function signature |
elf_sde | Logit-normal noise injection for DDTree diversity | Applied during draft tree build |
graph LR
subgraph Input
A[Tokenizer] --> B[PFlash/DashAttn Prefill]
end
subgraph Model
B --> C[Transformer Forward]
C --> D[Delta Routing]
C --> E[Hybrid OCT+PQ KV]
C --> F[Sparse MLP]
C --> G[MLS Aggregate]
end
subgraph Decode
C --> H[DDTree Search]
H --> I[BT Rank]
I --> J[Leviathan Verify]
end
subgraph Adapt
K[SR2AM Config] --> H
L[BanditPruner] --> H
M[CNA Steering] --> C
end
| Component | What | Gate |
|---|---|---|
| BPE Tokenizer | Train/encode/decode | always |
| PFlash | Block-sparse speculative prefill, 21× seq reduction | always |
| DashAttention | α-entmax (1.5) adaptive routing replaces fixed top-k | dash_attn |
| RTPurbo | Head-wise retrieval/local classification, dynamic top-p | rt_turbo |
| Budget Adaptation | Compression-adaptive DDTree budget [0.5×, 2.0×] | budget_adaptation |
| Component | What | Gate |
|---|---|---|
| Sparse MLP | Skip dead ReLU neurons in w2 matmul | sparse_mlp |
| Delta Routing | Cross-layer residual delta routing at block boundary | delta_routing |
| Hybrid OCT+PQ | Default KV codec — OCT triplet + PQ 2D Givens, best MSE | hybrid_oct_pq |
| SpectralQuant | Calibrated eigenbasis + water-fill (secondary) | spectral_quant |
| MLS Aggregate | Average last K layer residuals before LM head | mls_aggregate |
| Domain Latent | Mid-layer K/V injection | domain_latent |
| PPoT | CPU logit resampling at high-entropy positions | ppot |
Note: These are opt-in alternative forward paths (
forward_gdn2(),forward_raven(),forward_looped()). The defaultforward()→forward_base()uses standard O(N) softmax attention.
| Component | What | Gate |
|---|---|---|
| GDN2 | Gated DeltaNet-2 — O(1) decode, constant state per head | gdn2_attention |
| Raven RSM | Fixed-slot Top-K routing memory, frozen unselected slots | always compiled, opt-in forward_raven() |
| HLA/AHLA | Higher-order Linear Attention — O(1) prefix stats | hla_attention |
| LT2 Looped | Weight-shared T-pass loop, hybrid SDPA+AHLA | lt2_looped |
| TF Loop | Training-free ODE-motivated sub-stepping | tf_loop |
| DMax SPD | Soft parallel decode, hybrid token/mask embeddings | dmax_spd |
| FlashAR Consensus | Dual-path ternary thermal routing | flashar_consensus |
| Component | What | Gate |
|---|---|---|
| DDTree | Best-first tree from marginal log-probs | always |
| LeviathanVerifier | p/q rejection sampling, identical output distribution | always |
| BT Rank | Bradley-Terry pairwise ranking, +10.6pp over pointwise | bt_rank |
| BanditPruner | UCB1/ε-greedy/Thompson adaptive ScreeningPruner | bandit |
| ELF SDE | 10-22× path diversity via logit-normal noise | elf_sde |
| Lattice Deduction | α-intersection pruning + conflict detection | lattice_deduction |
| PhraseBoost | Context trie phrase boosting for DDTree | phrase_boost |
| Parallel-Probe | Consensus-based parallel branch control | parallel_probe |
| Component | What | Gate |
|---|---|---|
| SR²AM Configurator | Per-turn planning regulation (PlanNew/Extend/Skip) | sr2am_configurator |
| Data Gate | Task-level filtering before solver | data_gate |
| CNA Steering | Contrastive Neuron Attribution + runtime modulation | cna_steering |
| Deep Manifold | L2/KL fixed-point residual scoring | deep_manifold |
| Federation | Symmetric KL coupling between domain experts | federation |
| SimpleTES | RPUCG graph-based bandit loop | tes_loop |
| Stability Metrics | P50/P99/CV per-step latency instrumentation | stability_metrics |
| PlasmaPath (Hot) | Bit-plane ternary SIMD matvec, 1.71 bits/weight — the Hot-tier CPU path (Issue 145 reclassified binary to Plasma, ternary to Hot) | plasma_path |
| BinaryPlasma (Plasma) | Single bit-plane ±scale SIMD matvec, 1.125 bits/weight — the fastest tier (opt-in; 1.22× faster + 1.82× smaller than ternary) | binary_plasma |
| MoA Inference | Token-adaptive Mixture-of-Activations SwiGLU | moa_inference |
| Newton-Schulz | Cubic fixed-point orthogonalization + Muon momentum | newton_schulz |
| Spectral Hierarchy | Eigenspace alignment, Haar wavelets, Cauchy interlacing | spectral_hierarchy |
| Roofline Cost | GPU operator runtime prediction (~5µs CPU) | roofline_cost |
| Kog CPU Fusion | RMSNorm gamma folding + QKV interleaving | kog_cpu_fusion |
| PEIRA Distill | Collapse-free inter-view regressor alignment | peira_distill |
| ILC Distill | Synonym-aware DDTree pruning via offline k-means | ilc_distill |
| Hydra Budget | Emergent self-repair layer skipping | hydra_budget |
| Trigger Gate | CPU/GPU/ANE tier promotion via QPS/latency/queue monitoring | inference_router |
| FreqBandit | Oscillatory spectral bandit — cyclic pattern detection → adaptive speculative decode | freq_bandit |
📖 Full GOAT audit table with research source, real gain, and replaced feature: See .docs/01_orientation/overview.md.
| Feature | Plan | GOAT | Key Gain |
|---|---|---|---|
Posterior-Guided Pruner Evolution (posterior_evolution) | 239 | 8/8 ✅ | Bayesian precision-gated lifecycle actions (Patch/Split/Compress/Retire), 258ns overhead |
Spectral Irrep Pruner (spectral_pruner) | 246 | ✅ | Spectral flatness detection for converged logit distributions, +3.6% overhead only |
Spectral Budget Router (spectral_budget) | 254 | 19/19 ✅ | Layer-adaptive NS depth + rank-p spectral truncation (opt-in — GOAT-gated, not in default) |
Regime Transition (regime_transition) | 215 | 8/8+4/4 ✅ | Self-revising discovery, -0.3% overhead vs real decode |
SubstrateGate (substrate_gate) | 216 | ✅ | Inference-time capability substrate routing via MLP masks |
Critical Interval Gate (critical_interval_gate) | 222 | ✅ | Entropy-triggered solver switch, zero cost (entropy already computed) |
LLMExecGuard (llmexec_guard) | 223 | ✅ | Entropy-driven verification budgeting, zero cost when guard holds |
Outlier-Aware Quant Guard (outlier_guard) | 224 | ✅ | KS-test outlier detection for weight matrices |
EGCS (egcs) | 206 | ✅ | Episode-guided constraint synthesis from successful translations |
Three-Mode Router (three_mode_router) | 211 | ✅ | Neuro-symbolic bandit: Direct/CoT/Symbolic per-query routing |
Breakeven Routing (breakeven_routing) | 250 | 7/7 ✅ | 49% wallclock savings on long sequences, ~9ns overhead |
DEC Operators (dec_operators) | 251 | Foundational ✅ | Discrete Exterior Calculus on cell complexes, conservation-guaranteed |
Cubical Topology (lattice_operad) | 252 | Foundational ✅ | IntervalPruner + CubicalNerve + LatticeOpernad composition |
Segment Checkpoint (segment_checkpoint) | 226 | ✅ | Cached KV segment checkpoints at segment boundaries |
RCD Residual (rcd_residual) | 258 | ✅ | Entropy-weighted residual context injection for D2F |
Spec Pruner (spec_pruner) | 259 | ✅ | Modelless spec-to-constraint O(1) RoaringBitmap compilation |
Epiplexity Bandit (epiplexity_bandit) | — | ✅ | Epistemic perplexity bandit for domain-aware routing |
CADDTree Budget (caddtree_budget) | 219 | ✅ | Compositional adaptive DDTree budget allocation |
Static Cal Tables (static_cal_tables) | 227 | ✅ | Pre-computed quantization calibration, zero inference cost |
Targeted Precision (targeted_precision) | 227 | ✅ | Per-head bit allocation from weight statistics |
Modality Pruned Load (modality_pruned_load) | 227 | ✅ | Pipeline pruning for modality-specific context loading |
Precision Aware Draft (precision_aware_draft) | 227 | ✅ | Quantization-aware speculative draft scoring |
Async QDQ Overlap (async_qdq_overlap) | 227 | ✅ | Overlapped quantize-dequantize with compute |
Sparse Off-Principal Task Vector (sparse_task_vector) | 264 | G1–G2 ✅ | OPD-grounded sparse delta format, 2.9–5.7× storage reduction vs dense LoRA |
Off-Principal Retrieval (off_principal_retrieval) | 264 | G3–G4 ✅ | ≥99% principal energy removed, off-principal beats cosine top-1 |
Spectral-Concentration Adaptive Rank (spectral_rank) | 264 | G5–G6 ✅ | ≥30% avg rank reduction via OPD spectrum concentration |
Module-Energy Compute Routing (module_energy_route) | 264 | G7–G8 ✅ | Paper FFN profile match (Plasma/GPU/ANE/SIMD), monotone QPS routing |
Band Conditioner (band_conditioner) | 265 | G0a/G0b ✅ | Band conditioning set + Fisher-z CI test primitives for task-relevant identifiability (arXiv 2605.12733) — band-set exact match to paper Fig 2; Fisher-z power ≥90% at n=1000 α=0.05. Default-on (T5.3, 2026-07-02). |
SPLAT Specialist Projection (specialist_projection) | 265 | G4–G6 ✅ | Specialist latent projection (Fusion B) — ≥30% hidden-dim reduction at parity, mask discovery ≤ d_hidden samples, MSA rescue at 50% density. Default-on (T5.3, 2026-07-02). |
CCCP Collider-Consistency Pruner (collider_consistency) | 265 | G7–G9 ✅ | Collider-consistency ConstraintPruner for DDTree (Fusion C) — dead-branch rejection ≥90%, expansion reduction ≥25%, no-task overhead <5ns. Default-on (T5.3, 2026-07-02). |
Gauge-Invariant Adapter Composition (gauge_invariant) | 270 | 17/17 ✅ | LoRA-Muon NS inv-sqrt + gauge rebalance + compose, 4609%→0% error |
CHIAR Chiaroscuro Attention (chiaroscuro) | 269 | 9/9 ✅ | Per-token DCT spectral entropy KV strategy (3.03× compression), operator routing, collapse discovery |
Attention Matching (attn_match) | 271 | 9/9 ✅ | Modelless KV compaction (K,V)→(Ck,β,Cv): β-recovery 1e-6, Cv Frobenius 0.0, 3.01× SIMD, blocked Cholesky (32×32), adaptive router (scalar/SIMD/rayon/GPU/ANE) |
Manifold Power Iteration MoE Router (manifold_power_iter_router) | 279 | 9/9 ✅ | One-shot router-row conditioning at snapshot swap, sub-ms swap (0.076ms N=8 D=256), byte-identical determinism |
Quantile Balancing MoE Router (quantile_balance_router) | 455 | G1–G8 12/12 ✅ + Phase 3 Case C ✅ | One-shot per-expert bias β at snapshot swap via alternating-coordinate descent on the balanced-assignment LP (Su blog + Marin 32B validation). MaxVio 3.000→0.0625 (48× at M=64), 0.131ms swap (N=8 M=256). Phase 3 head-to-head vs MPI: Case C — composed pipeline strictly Pareto-dominates either alone (λ 0.65→0.99 from MPI, MaxVio 1.84→0.00 from QB on orthogonal axes). DEFAULT-ON since Plan 455 Phase 3 (2026-07-17) |
Temporal Derivative Kernel (temporal_deriv) | 277 | 4/4 fusions ✅ | Dual fast/slow EMA surprise signal — state-vector companion, surprise-gated writes, collapse detection, curiosity signal |
Triggered Injection Gate (triggered_injection) | 278 | G1/G2/G3/G8 ✅ | Sigmoid-thresholded inject/skip gate — 50% skips w/ 0.63% quality parity in saturated regime |
FaithfulnessProbe (faithfulness_probe) | 278 | G1/G2/G8 ✅ | Causal intervention diagnostic — 100%/100% detection, IG surrogate Spearman ρ=1.0, audit cadence |
SmearClassifier (smear_classifier) | 298 | G1/G2/G3 ✅ | Ternary (CoherentSingle/TokenSmear/SequenceSmear) latent-mass vocabulary extending Plan 278 — SequenceSmear/TokenSmear unfaithfulness ratio 2.11×, k=8 d=32 at 107.6 ns |
Salience Tri-Gate (salience_tri_gate) | 303 | 4/4 ✅ | 3-way per-tick emit gate (Speak / Silent / Delegate) with silence as a first-class variant, two stacked sigmoids (never softmax), zero-allocation hot path. decide() 9.11 ns for D=8 (target <50ns, ~5 ns over single-sigmoid), decide_batch() 120.6 M/s for D=8 N=1000 (target ≥50M). Default-on (Plan 303 Phase 5, 2026-06-23). |
Engram (engram) | 299 | G1/G2/G4 ✅ (G6 deferred) | Hash-addressed sigmoid-fused static pattern memory — N-gram → multi-head hash → O(1) lookup → sigmoid gate → residual fuse. 48 ns/retrieval, Spearman ρ=1.0. Opt-in pending G6 (effective-depth) in riir-ai |
CS-KV-Importance Probe (cs_kv_probe) | 280 | G1/G2/G3 ✅ | Compressed-sensing KV-group importance probe + density-budget interpolator, sigmoid-compatible |
BoMSampler (bom_sampling) | 281 | G1/G2/G3 ✅ | K-hypothesis single-pass belief sampling — K=8 at 1.87× step, +31.49pp arena win in riir-ai Plan 314 |
Self-Advantage Gate (self_advantage_gate) | 283 | 4/4 ✅ | Dead-compute detector via log π+(a) − log π̂(a) — paper 18× forward-pass reduction, vocab ≤ 128 |
CLR Claim-Level Reliability (clr) | 284 | ✅ | Runtime CLR — sigmoid projection vote over claim embeddings, self-adaptive test-time scaling |
Sink-Aware Attention (sink_aware_attn) | 287 | G1/G2 cached ✅ | NOP/Broadcast classifier + dual-policy sigmoid gate — cache cadence=16 ≤5% steady-state |
ICT Branching Detector (ict_branching) | 294 | G1/G3/G4/G5/G6/G10 ✅ | collision_purity β(π) = Σ π², JS-divergence novelty, BranchingDetector — ρ(H₁,JS)=0.065 (Super-GOAT proceeds) |
CCE Moderator (cce_moderator) | 295 | G1/G2/G3 ✅ | LP-CCE solver + Bregman primal-dual iterator (arxiv 2606.20062). Chicken CCE welfare +37.5% over Nash; designer steering demo shows two Γ₀ → two different CCEs. DEFAULT-ON after Plan 295 + Plan 300 T4.3b GOAT (homogeneous equivalence + regret transfer + heterogeneous primal-dual convergence + 16p 33.97ms < 50ms target). |
MicroRecurrentBeliefState (micro_belief) | 276 | G1.1–G1.4 ✅ | BeliefKernel trait unifying attractor + leaky-integrator families — G2 (attractor coherence) deferred |
Algorithmic-Probability Sampler (complexity_prior_sampler) | 305 | G1+G2 ✅ | Levin-Search variant for modelless inference — sigmoid(-α·K̃(x) - β)-weighted candidate sampling with pluggable K̃ proxies (RLE / Shannon entropy / L1). G1 safety 5/5 landscapes PASS; G2 exponential speedup: RLE 92275× + Entropy 18455× stretch on low-K optimum (L1 honest-negative on sparse byte encoding, documented domain mismatch). Per-candidate sigmoid never softmax. Default-on (Plan 305 Phase 2, 2026-06-23). |
| Forensic Watermark | Moved to riir-ai | Recipe impl relocated to Plan 322 (honeypot OPSEC) | |
Depth-Invariance Diagnostic (depth_invariance) | 306 | G1/G2/G3 ✅, G4 (re-spec) ✅ | Root-cause attention-drift classifier (DepthInvariant / DepthSpecificRefinement / Collapsed) + MagnitudeRegularizedResidual fix for owned kernels. G2 reproduces paper Figure 10 on random-init BeliefDrafter; G3 negative control on micro_belief/attractor classifies as DepthInvariant. SIMD inner-loop via simd::simd_sum_sq_quartic. Zero runtime cost unless invoked. Default-on (T7.4, 2026-06-23). |
Claim Rubric Runtime (claim_rubric) | 307 | 17/17 round-trip ✅ | L1/L2/L3 evidence-ladder validator — executable rubric for probe/steering claims. Vocabulary must match evidence ("causally controls" requires L3; "reads" is L1-safe). 17/17 Phase 2 round-trip + 1/1 GOAT gate green. Meta-discipline primitive, zero runtime cost unless invoked. Default-on (T3.3, 2026-06-23). |
Closed-Unit Compaction Gate (closed_unit_compaction) | 333 | 7/7 ✅ | Generic rubric-gated trajectory compaction primitive (SelfCompact, arxiv 2606.23525) — fires at structurally-safe moments (closed-unit ∧ summarizable ∧ progress ∧ ¬stuck). evaluate() 8.91 ns (target <50ns), 112.9 M/s (target >=50M). Super-GOAT: trajectory compaction and shard freeze are the same primitive (G7 proven structurally). Default-on (Phase 6, 2026-06-25). |
Sigmoid-Graded Reject Confidence (sigmoid_graded_reject) | 310 T1 | T3.2 6/6 + T3.1 5/5 ✅ | Tolerant soft-reject relax-and-retry on ConstraintPruner — default reject_confidence() reproduces is_valid() bit-identically (zero-behavior-change); sigmoid-graded impl + soft_reject_with_relax pipeline routes borderline candidates through relaxation. HarnessBridge Table 7: tolerant > strict because false_reject_cost > false_pass_cost. Default Δ 0.000ns, graded +3.734ns, batch 2647M/s, pipeline +0.241ns; tolerant FR 1.69% vs strict 5.49% (Δ −3.80pp), net reward +603.3, precision ratio 0.9456. Zero runtime cost unless caller invokes soft_reject_with_relax. Default-on (T4.1, 2026-06-26). |
CausalHeadImportance (causal_head_importance) | 358 | G1/G2/G3/G4 ✅ | Causal-intervention head scorer (HydraHead arXiv:2606.20097) — activation patching (Eq 10) + path patching (Eq 11) + span-level logit-diff readout (Eq 9) + cross-capability fusion (Eq 12). Strictly stronger than RTPurbo's attention-mass calibration: G2 bystander discrimination Jaccard 1.000 vs 0.000 (causal invariant, attention-mass collapses). G3 partition ≤ 2× attention-mass (faster at n≥64). Plus ScaleNormalizedFusion (Eq 13–14, currently unused). Opt-in — CalibrationMode::AttentionMass stays default (causal score production is ~10–100× costlier); use CausalNecessity for the long-context-extreme bystander regime. |
Misalignment Indicator Probe Bank (indicator_probe_bank) | 320 | G1–G7 ✅ | Structured N-direction cognitive-indicator detector (arxiv 2606.24251 Zhou et al.) — BLAKE3-committed direction vectors projected via dot-product + sigmoid, OR-fused into one firing label. G1 per-indicator AU-ROC 1.000, G2 OR-fusion TPR 1.000/FPR 0.041, G3 cascade 100× FPR reduction at 0pp cost, G4 53.9 ns (N=8, D=72) + 0 allocs, G5 similarity block ARI 1.000, G6 feature-off clean, G7 wire tamper-evident. indicator_similarity also default-ON; indicator_cascade opt-in (consumer-crate verifier territory). Default-on (Plan 320 Phase 5, 2026-06-25). |
Tropical (max,+) Algebra (tropical_algebra) | 337 | Super-GOAT ✅ | (max,+) tropical semiring matvec + DEC wrappers for worst-case/bottleneck aggregation (arxiv 2403.04807). D=64 matvec 0.96× of simd_matvec (NEON); 3/3 fusion gates PASS. Default-on. |
Temp-Loss Fingerprint Selector (temp_loss_fingerprint) | 341 | G1 ✅ | Perturbed-loss-vector diversity selector via Lipschitz gradient bounds (arxiv 2606.26797). G1 15.44× diversity ratio; select_diverse_subset 130µs (<1ms); cross-repo neuron-db gain +0.1672. Default-on. |
Zone Density Routing (zone_density_routing) | 351 | G5a/b/c ✅ | Density-aware zone routing: classify + outer-first schedule + papaya LRU cache with 3 invalidation rules. G5a +41.54% routing, G5b 99.1% cache hit, G5c 0 stale reads. Default-on. |
Set Attention (NPT half) (set_attention) | 354 | G1–G5 ✅ (G8 CLOSED) | Permutation-equivariant sigmoid-gated cross-entity set attention (arxiv 2106.02584). Production 75.7µs/tick @ 100 NPCs (6.6× headroom). G8 collective inference closed by the CLR-weighted sibling (Plan 570). Default-on. |
CLR-Weighted Set Attention (clr_weighted_set_attention) | 570 | G1/G2/G4/G8 ✅ | Reliability-weighted sibling of set_sigmoid_attention_into — output_i = h_i + (γ/Σ r_j)·Σ α_ij·r_j·(v_j−h_i), uniform r_j=1 reduces bit-identically to plain SA. CLR ^M reliability gate converts averaging into amplification: +8.7pp identification accuracy + 3.88× aggregate amplification over plain SA on the N=64 crowd threat-detection fixture (Issue 575 PoC). Default-on. |
Heat Kernel Trajectory (heat_kernel_trajectory) | 359 | All 5 phases ✅ | Single-shot DEC cochain field prediction via operator exponential (arxiv 2606.27364) — exact at long horizons vs O(T·dt²) Euler error. Default-on (katgpt-dec). |
QMC Belief Sampling (qmc_sampling) | 367 | G1–G6 ✅ | QuasiMoTTo — QMC uniform sources (Lattice/Stratified/Sobol) + arithmetic-coding descend, drop-in for iid in K-rollout paths (arxiv 2607.01179). 850/850 lib tests, 26 bootstrap tests. Default-on. |
Manifold Bandit Latent Task Tree (manifold_bandit) | 370 | G1/G3/G4/G5 ✅ | LatentTaskTree + HierarchicalThompsonSampler + BayesianFilterArm (arxiv 2606.19750). G1-real 0.740 ratio; R279 N≥d phase gate ships opt-in (+11% convergence). Default-on. |
Mean-Field Regime Classifier (mean_field_regime) | 371 | G1–G5 ✅ | MeanFieldOverlap + HopfBoundary + RegimeClassifier (Static/NSO/IS/GLC) — crowd oscillation regime classifier (arxiv 2606.30366). PoC 25/25 (4/4 regimes). Default-on. |
Velocity Field Ensemble (velocity_field_ensemble) | 376 | G1–G4 ✅ | Algebraic combination of P frozen velocity fields via ridge-solved η weights (arxiv 2602.20070). Beats conformal-naive floor (Plan 340). Heterogeneous-D variant opt-in. Default-on. |
Local Branch Routing (local_branch_routing) | 377 | G1–G6 ✅ | PostCandidateRouter trait + DotProduct/ColliderAdapters (arxiv 2606.25354). Samples K candidates, forwards, set-attends, commits via relative routing. PoC +9pp to +26pp quality gain; argmax 51ns + sampled 69ns at K=3 D=64. Default-on. |
ANE Roofline Cost Model (ane_roofline) | 379 | G1/G2/G4 ✅ | ANE-aware roofline cost model with third axis (working-set size), M1–M5 peaks (arxiv 2606.22283). G1 ±30% on 4 ref shapes; G4 p50 <1µs. Refines NpcBrainRouter's hardcoded threshold. Default-on. |
Step Attribution Qualifier (step_attribution_qualifier) | 381 | G1/G2/G4 ✅ | StepAttributionQualifier — Δ≥0 commit gate (SkillAdaptor eq.8) + StepLocalizer trait fusing Localize+Link (arxiv 2606.01311). G1 14/14, G2 81.6% drift reduction (riir-ai PoC), G4 13ns aggregate @ W=64. Default-on. |
Spherical Geodesic Steering (spherical_steering) | 405 | G1–G5 ✅ | Geodesic Slerp rotation of latent vector toward unit-norm target + vMF confidence gate; norm-preserving on S^{d-1} (arxiv 2602.08169). Phase 5 (F1 fusion) deferred. Default-on. |
Renoise-CE Self-Verifier (renoise_ce) | 406 | G1/G2/G4/G5 ✅ | Perturb-completed-output + re-resolve + measure-drift self-verifier, operator-agnostic, no labels/verifier head (arxiv 2606.29150). G1 renoise=1.000 vs plurality=0.000 (100pp); G2 CLR fusion +30.5pp (6× target); G4 0 allocs, G5 36µs. Default-on. |
Sheaf-ADMM Coordination (sheaf_admm) | 407 | G1–G6 ✅ | Three-state primal/consensus/dual ADMM on a cellular sheaf (arxiv 2605.31005, ICML 2026). G1 DEC identity ‖F x‖∞=3.26e-8, G4 1.808 µs (K=100, d_v=8, d_e=5, T=5), G5 zero-alloc, G6 bit-exact determinism. Generic math operator — the private consumer runtime (riir-ai Plan 394 sheaf_coordination) is default-on as of 2026-07-07 (Super-GOAT: G7–G11 all PASS — collective inference, emergent divergence, forensic tamper-evidence). Default-on in katgpt-dec. |
Region-Conditioned Subspace Field (region_subspace_steering) | 416 | G1–G5 ✅ | MFA local-geometry steering — K regions × per-region centroid + per-region R-dim subspace (arxiv 2602.02464). Two-mode steering: centroid interpolation + local subspace offset. K=1 degenerate parity with Plan 412 bit-identical (0/800 mismatches). 943ns/call. Default-on. |
| Cross-Resolution SIMD Encode | 417 | G1–G5 ✅ | Pure perf: transposed basis layout + simd_matmul_rows replaces strided gather-dot. 11–15× faster encode at production scales (target was 1.5×). No new flag — optimization on DEFAULT-ON cross_resolution_transport. |
| Newton-Schulz Blocked Matmul | 421 | G1–G5 ✅ | Pure perf: rank-K blocked matmul eliminates per-dot call overhead in NS inv-sqrt (LoRA-Muon Plan 270). ns_inv_sqrt_psd_into r=64: 297µs→216µs (1.37×); per LoRA-Muon step: 595µs→432µs. No new flag — optimization on DEFAULT-ON newton_schulz. |
TILR (tilr_invariant_subspace) | 425 | G1–G4 ✅ | Trajectory-Invariant Latent Refinement — alignment-gated subspace-projected correction with bit-identical γ→0 no-harm contract. 24.7ns/call HLA scale, 0 allocs. Default-on. |
| MANCE SVD Caching | 427 | G1–G5 ✅ | Pure perf: cache tangent basis {B,σ} keyed on k-NN neighbor indices. ~5× loop speedup (skip ~9 of 10 SVDs). No new flag — optimization on DEFAULT-ON manifold_erasure (Plan 426). |
Cross-Stage Residual Relocation (cross_stage_relocation) | 431 | G1–G6 ✅ / G7 ⏳ | Knowing-Using Gap (arxiv 2607.08393) — permeation_scan_into 2D (src,dst) intervention heatmap reusing Plan 358's direct_effect_importance + two-cluster classification; RelocateOp applied operator with paper's fixed (0.82L→0.45L)+(0.10L→0.45L) default (RelocatePair::LateEarly, 58–75% oracle recovery). Scan 10–25% faster than hand-rolled; operator <0.03% of forward pass; 0 allocs. Opt-in — G7 (58–75% recovery transfer to our substrate) deferred to Phase 3 PoC in riir-poc/; our latent functors/HLA don't have the paper's early/late MLP structure. |
SIMD LUT Fused Dequant+Dot (simd_lut_dequant) | 452 | G1–G4 ✅ (split) | Software SIMD LUT-accelerated dequant distilled from StreamDQ's hardware DQB (arxiv 2607.11262 §2.3). Split decision: the fused dequant_dot_via_lut kernel wins 4.58× over the two-step path (NEON FMA + no buffer spill) → default-on; the plain dequant_via_lut is 3.5× slower than the arithmetic cast on NEON (scalar gather, no native instruction) → stays opt-in infrastructure for future FP8/INT8. Cross-repo: simd_lut_q4k promoted to default-on in riir-engine (Plan 486 T3.3, multi-block 2.300× / full-GEMV 1.971× / single-block 2.027×). |
3D CellComplex grid_3d + Stochastic Birth/Death NCA (grid_3d) | 454 | G1a/G1b/G2/G3/G4/G5/G6 ✅ | 3D cubical CellComplex::grid_3d + 7-point-stencil graph_laplacian_grid_3d_into + zero-alloc stochastic_birth_death_step NCA growth + argmax_block_type raw→categorical bridge (arxiv 2103.08737 Sudhakaran 3D NCA). G1a growth reach 6.0×, G1b branched morphology 1.80× roughness (modelless crowding-death fix), G2 regeneration 100%, G4a stencil 1.74× 3D/2D, G4b overhead 64.4%, G5 0 allocs, G6 bit-identical. Default-on in katgpt-dec. |
Conformal Predictive Intervals (conformal_predictive_intervals) | 340 + 468 promo | G1–G4 ✅ | Modelless conformal UQ overlay wrapping any PointForecaster — ConformalIntervalCalibrator<F> with exp-recency-weighted residual ring buffer + empirical-quantile reads producing coverage-guaranteed [point+q_{α/2}, point+q_{1−α/2}] (Plan 340, arxiv 2605.03789 CSP + 2606.09473 "Report the Floor"). Also ships the canonical UQ floor — ConformalIntervalCalibrator<SeasonalNaiveForecaster> m=1 — that every UQ-bearing primitive's GOAT gate MUST beat (Issue 010 "Report the Floor" rule, codified in AGENTS.md Feature Flag Discipline). Primitive-level G1–G4 PASS (Bench 340): coverage [0.9445, 0.9493] ∈ [0.93, 0.97], interval_into H=1 642 ns (≤1 µs target), 0 allocs/100 calls, bit-reproducible. Pure modelless (empirical-quantile calibration, no training, no learned params). Default-on (Plan 468 promotion, 2026-07-20): runtime-consumer gate satisfied by Bench 564 (MCTS collapse G3 PASS — per-NPC calibrated τ beats fixed magic number on collapse-detection F1) + Bench 565 (Salience Tri-Gate G3 PASS — interval-width Delegate nudge beats KARC anticipation, dF1=+0.3145 at 6.3× gate margin, dFP=−0.8155). Plan 513 width-definition fix vindicated Bench 565 bit-identically. Two consumers FAILED (Bench 562 curiosity — wider than 5×EMA; Bench 563 sleep-time — distribution-level summary loses cycle info); Cargo.toml language required only one PASS, two landed. Consumer-level gates STAY opt-in — karc_conformal_width (riir-engine, +113.9% overhead per Plan 512 — FAIL default promotion), salience_conformal_width, 4 probe features. The three-layer split (primitive DEFAULT-ON + consumer gates opt-in) is the canonical append-only pattern. Zero runtime cost unless invoked. |
Poincaré Adapter (poincare_navigator) | 449 | G1–G7 ✅ | Closed-form latent navigation distilled from SeeSE3 (Plan 449, arXiv:2607.14228 Chen et al. DeepMind 2026). Frozen PoincareAdapter Pod holds (φ, W, W†) — given a desired movement in target space (3D pose / HLA affect), recover the latent step via z_dest = z_src + φ⁻¹(φ(z_src) + W†·Δtarget). Inverse navigation G3 Hit@0.3=1.000 (perfect), poincare_navigate_into 809 ns/call at d=64 (≤1µs target, 20% headroom), 0 allocs steady-state, 4-step open-loop trajectory bit-identical. G2 caveat (modelless PCA-tanh R²=0.71 < linear ridge R²=0.93) closed by riir-train Plan 317 — trained 2-layer MLP φ reaches R²=0.9997. Default-on (Phase 19, 2026-07-18): load-bearing value is closed-form inverse navigation + frozen Pod pattern (neither depends on G2 strict-domination). Promotion pattern matches manifold_bandit P370 / set_attention P354 / ac_prefix P313. Pure modelless (closed-form PCA + ridge + thin SVD pseudoinverse). Zero runtime cost unless invoked. |
ChunkedContentStore (chunked_content_store) | 448 | G1–G7 ✅ | Lore-distilled chunked content-addressed Merkle blob store (Plan 448, Research 262, EpicGames/lore). Bytes → FixedSizeChunker / FastCdcChunker → BLAKE3 per chunk → papaya lock-free dedup → binary Merkle root BlobId. O(log n) inclusion proofs via build_binary_merkle_proof + light-client-friendly associated fn verify_binary_merkle_proof (no &self). G1 dedup 8.47× on 90%-shared corpus, G2 incremental push 1.35% bytes touched (CDC) vs 52.94% (FixedSize control), G3 prove 588 ns + verify < 1µs (release; 2088× speedup after cached Merkle levels fix), G4 type-system-enforced light-client verify, G5 hot-path p99 < 200 ns (release), G7 tamper detection 10000/10000. Default-on (Phase 19b fix-up, 2026-07-18 — bench recorded promotion but Cargo.toml entry was missed until then). Pure modelless (BLAKE3 + binary Merkle). Zero runtime cost unless a caller constructs a store. Consumed by riir-ai Plan 319 (Asset Vessel + Quorum Gitflow). |
Smooth-Min Soft Similarity (smooth_min_similarity) | 437 + Issue 041 T6 | G1/G2/G3 ✅ | Smooth-minimum soft similarity for variable-length multi-token retrieval (Plan 437, Research 385, arXiv:2602.10908 SoftMatcha 2 Yoneda et al. ICML 2026). Aggregates per-position cosines via smooth_min_similarity(cosines, β) interpolating between plain-min (β→∞, strictest) and plain-sum (β≈1, most lenient) — penalizes low-cosine positions more than plain mean. PoC GOAT (Issue 041, 2026-07-12): G1 recall@5 +12.0pp (0.815 vs 0.695 plain cosine) on synthetic 200-item / 200-query fixture; G2 latency overhead ~0 ns (LLVM vectorized); G3 β sensitivity all β ∈ [10¹, 10⁶] beat plain cosine. Consumer GOAT (Issue 041 T6): RerankMethod::SmoothMinAligned in katgpt-attn-match achieved recall@5 = 1.000 vs Cosine 0.495 (+50.5pp) on position-aligned multi-token retrieval. Default-on (2026-07-12). Pure modelless (arithmetic on pre-computed cosines, zero deps). Zero runtime cost unless called. |
OctreeCTC Reconstructive Memory Navigation (octree_ctc) | 248 | G1–G5 ✅ | Reconstructive memory navigation (Plan 248, Research 216, arXiv:2606.06036). octree_ctc is an alias feature for sense_composition in katgpt-core (the standalone feature was removed from the root crate after Issue 007 Phase C moved the only consumers — octree_ctc_demo + recall test — to riir-engine; katgpt-core still ships the alias for direct consumers). Default-on (Plan 248 Phase 5): GOAT PASS — recall ≥ 20%, 93.2 ns < 200 ns target. Pure modelless (octree reconstruction + cosine gates). Zero runtime cost unless a caller constructs a reconstruction. |
SectorProjection (sector_projection) | 262 | GOAT ✅ | Multi-sector spatial projection primitive (Plan 262, Research 216). SectorProjection<N_DIR, N_SECTOR> projects an observation onto a fixed bank of canonical sector directions — the spatial-cognition half of the Latent Physics pair (with action_bridge). Latent→raw bridge for NPC perception ("where am I being pushed from?"). Default-on since Plan 262 Phase 2 GOAT gate. Pure modelless (closed-form dot products). Zero runtime cost unless constructed. |
Spectral Differentiation (spectral_differentiation) | 325 | G1–G4 ✅ | Standalone FFT-based spectral differentiation for periodic uniform 1D grids (Plan 325, Research 307 §3 candidate #2, arXiv:2511.05963 Fourier Neural Operators Explained §2.1). The specialized case where DEC's general exterior_derivative (cell-complex machinery) is overkill — closed-form FFT + frequency-domain multiplier (iω)^m. G1 order-1 err 5.4e-7 <1e-4 + order-2 err 1.3e-6<1e-3 + spectral-vs-FD 290× ≥100x; G2 N=1024 3.82µs <50µs (13× under); G3 order=0 identity bit-identical; G4 0 allocs/100 calls. Default-on since Plan 325 Phase 3 (2026-06-25). Pure modelless closed-form FFT. |
ARG Protocol Primitives (arg_protocol) | 327 | G1–G5 ✅ | Generic protocol primitives distilled from the ARG Standard (Plan 327, Research 309, Iris Technologies 2026). Ships: PolicyEnvelope + TaxonomyValidator (264-node) + LifecycleState + RedirectTable + TypedOfflineCandidate + OfflineCandidateScorer + InfoRegistry. G1 61 tests; G2a PolicyEnvelope ~0.4ns<50ns; G2b TaxonomyValidator ~170ns<200ns; G3 all-features/default/no-default clean; G4 0 allocs/100 calls (fixed via scratch + clone-instead-of-mem::take); G5 silence-bias strict inequalities. Default-on since Plan 327 Phase 4 (2026-06-25). Pure modelless protocol vocabulary — no game/chain/shard IP. Composes with non_interference_branches LifecycleState when both features on. |
Phase-Modulated Coupling (phase_rotation_coupling) | 322 | G1–G6 ✅ | Norm-preserving subspace rotation gate (Plan 322, Research 305, arXiv:2605.12700 UFO). cos α ⊙ a + sin α ⊙ b where α comes from a sigmoid projection — the open math hook for norm-preserving NPC affect rotation / crowd-coherent mode transition / chain-committed phase. G1 per-channel Pythagorean drift 5.96e-8<1e-4 (1677× headroom); G2 0 reversals/100-step sweep (monotone); G3 D=8 scalar+mix 18.9ns<50ns + D=8 mix-only 5.0ns<20ns + D=64 per-channel+mix 355.7ns<1500ns; G4 0 allocs; G6 sigmoid(0)=0.5→cos=sin=1/√2 (softmax would give 1.0). Default-on since Plan 322 Phase 2 (2026-06-25). Design pivot: independent Padé cos/sin drifts in cos²+sin²=1 by ~5e-3 (50× G1 budget) — replaced with phase_safe_cos_sin (libm sin + Pythagorean sqrt(1−sin²) recovery). Pure modelless. |
Non-Interference Memory Branches (non_interference_branches) | 329 | G1–G5 ✅ | Continual adaptation primitive distilled from RIZZ (Plan 329, Research 310, arXiv:2606.20638 Goel et al. Oxford Jun 2026). Five generic primitives: BranchBank + BranchRouter + VerifierGate + NonInterferenceProjection + BudgetCompiler. The Super-GOAT fusion of BAKE × CLR × MCGS × Engram × ARG × closure-instrument × Salience into per-NPC continual adaptation without catastrophic forgetting. G1 8 orthogonal directions in D=8 (pairwise interference 0.00e0 <1e-6; 9th direction correctly rejected at 0.3536≥1/√8); G2 route 301.5ns<1µs (64-branch bank, 3.3× margin); G3 all-feature combos clean; G4 0 allocs/100 calls; G5 [] deps. 101/101 unit tests. Default-on since Plan 329 Phase 3 (2026-06-26). Pure modelless (structural geometric orthogonality, not learned). |
Best-Belief Beta Selector (best_belief) | 336 | G1–G4 ✅ + Issue 010 T5 BEATS FLOOR | ε-quantile Beta lower bound for conservative selection (Plan 336, Research 320, RQGM arXiv:2606.26294 Prop. 4). Complements sample_beta (Thompson sampling for EXPLORATION) with a conservative EXPLOITATION/SELECTION counterpart. LUT hot path 3.38ns, G1 3.099e-5<1e-4 vs statrs, G4 0 allocs. Default-on since Plan 336 Phase 2 G2-unblock (2026-06-28). Issue 010 T5 "Report the Floor" comparison: BEATS the MLE floor in the heteroscedastic regime (variable observation counts — the real-world use case for frozen snapshots/archetype shards with different deployment durations); ties at uniform n (the monotonicity theorem). Confirms DEFAULT-ON promotion. Pure modelless (closed-form Beta inverse-CDF via LUT). |
Cognitive Architecture Root (cognitive_architecture_root) | Issue 039 | G1–G6 ✅ | Whole-architecture BLAKE3 commitment — CognitiveArchitectureRoot([u8; 32]) (Issue 039, 2026-07-04). The anti-cheat / quorum-attested personality freeze-thaw / on-chain NPC avatar portability primitive. Implies engram (so engram is transitively default-on via this feature — the Plan 299 "default-off" label predates this promotion). G1 spec-match 13/13 + bit-flip every input; G1-avalanche min 120/256 avg 126/256 (BLAKE3 ~128, floor 96); G2 from_parts 208ns + verify 208ns (<500ns); G2-alloc 0/1000; G3 --all-features + --no-default clean; G4 size_of == 32. Default-on since Issue 039 (2026-07-04). Pure modelless. Zero runtime cost unless a caller constructs/verifies a root. |
PTG × latent_functor Edge (ptg_functor_edges) | Issue 040 | G1–G6 ✅ | PTG × latent_functor edge composition (Issue 040, 2026-07-04). Adds FunctorPtg composite (wraps an unchanged PrimitiveTransitionGraph with a parallel Vec<Option<FunctorEdgeParams>>) + apply_functor_edge_into (zero-alloc sigmoid-gated cosine·direction apply path) + functor_edge_gate (diagnostic gate query). Wire-format safe: the inner PTG is byte-identical to a bare PTG (T1 audit found postcard #[serde(default)] does NOT work for missing trailing fields, so the composite approach is mandatory). Implies closure_instrument. G1 6/6 sub-checks + 17 unit tests; G2 apply_functor_edge_into 28.5ns at D=64 (target <200ns, 7× headroom); G2-alloc 0/1000; G3 default + --all-features + --no-default clean; G4 size_of::<FunctorEdgeParams> == 44 bytes (no heap indirection); G5/G6 pure modelless (closed-form cosine + sigmoid + SAXPY). Default-on since Issue 040 T7 (2026-07-04). |
Heal-Validation Conflict Detector (heal_validation) | Issue 133 | G1–G6 ✅ | HealConflictDetector trait for healed-state semantic validation (Issue 133, 2026-07-12). The heal-path analog of LDT's ConflictDetector — where ConflictDetector checks token candidate sets for satisfiability, this checks healed flat &[f32] state (style_weights for shards, emotion axes for HLA) for semantic impossibility (NaN, degenerate blend, anger+calm both >0.7, etc.). Passive trait — zero behavior change unless consumers implement it. Two consumer impls pass GOAT: ShardConflictDetector (riir-neuron-db, 30ns) and HlaConflictDetector (riir-games, 2ns), both <50ns target. G1–G6 ALL PASS. Default-on since Issue 133 (2026-07-12). Pure modelless (threshold checks). |
EventLog Query Combinator (event_log_query) | 562 | G1–G4 ✅ (ship-quality) | Programmatic-search axis over EventLog<A> — PRO-LONG distillation (arxiv 2607.20064, Research 461). Adds Predicate<A> enum (EventTypeIs / IdRange / And / Or / Not / All / None_ / Custom) + filter / query_window / count_where / first_where / last_where — the deterministic, LLM-free analog of "coding agent greps the log." G1 13/13 predicate combinations; G2 filter 4.99 ns/result-event (200× under 1µs target) + query_window 0.46 ns/call (217× under 100ns target); G3 feature-off build clean; G4 zero steady-state allocation (lazy iterators). Opt-in — ship-quality gate met; promotion requires a downstream consumer (riir-engine CLR/KARC, riir-neuron-db Raven/δ-Mem, or katgpt-pruners MCTS) to prove a measurable gain (Plan 562 Phase 3). Pure modelless (predicate enum + slice iterators). Zero runtime cost unless invoked. |
SWE Trajectory Freeze (swe_trajectory_freeze) | P011 / Issues 569–571 | G1–G5 ✅ | Modelless committed freeze of an inference attempt's trajectory through patch-space (Proposal 011 Layer 4). Composes tf_loop + latent_trajectory_geometry + committed_field_blend (FAME) + local BLAKE3 envelope. Two encoders, two discrimination axes: GeometrySummaryEncoder for STRUCTURAL discrimination (failure-mode classification — bench_014 G5 100% on real Kimi-K3 vs random) + StateMagnitudeEncoder (d=8 single-pass Welford, zero-alloc) for VALUE discrimination (cross-snapshot identification — bench_018/020 100% at σ≥0.1, d_M=14.526). The flipped R463 insight: even when a model proposes zero valid patches, the trajectory geometry is freezable + comparable. G2: geometry 4582ns/call; value 51.8µs (2× faster than geometry, single-pass). G4: 0 allocs (from_states_into + freeze_attempt_into/freeze_attempt_value_into). Opt-in — synthetic + σ-perturbation G5; promotion deferred until (a) real checkpoint validation + (b) a production consumer (SWE-bench pruner wiring, blocked on Layer 3 rubrc maturity). See .docs/09_feature_catalog/opt_in_features.md §29 for the full discrimination trail (benches 012–020, including the 5-bench NEGATIVE-result path to the sequence-trajectory breakthrough). Pure modelless (aggregate statistics + FAME sigmoid + BLAKE3). Zero runtime cost unless invoked. |
GOAT failures / negative results this session (kept opt-in, documented): Plan 397 HGA (Hierarchical Global Attention, G2-proxy FAIL 2/12 vs DashAttention — same failure mode as MSA R225); Plan 374 ReMax (argmax_a EI_m = argmax_a q theorem — no modelless exploration, exploration → riir-train); Plan 375 Factorized Action (G2b+G3 FAIL — trained GateNetwork + VQ-VAE needed); Plan 557 RoVE (inference-time retrofit HURTS perplexity — paper's equivalence is training-time); Plan 558 Variable-Rank Domain Expert (G2 FAIL ~2× — entropy gain real, trait-object dispatch cost too high; Issue 189 macro escape hatch is the promotion path).
Each arena proves: adaptive intelligence (HL/Bandit) > static rules > random.
| Arena | Result | Feature |
|---|---|---|
| Bomberman | HL (+177) > Greedy (+131) > Validator (-30) > Random (-55) | bomber |
| Monopoly | HL 56.5% win rate, +41.3pp over Validator | monopoly |
| FFT Tactics | TFT 99% win rate — game theory optimal | fft |
| Go | Greedy/Validator/HL 100% vs Random 35% | go |
| NFSP/MCTS Duality | BanditMCTS 75% vs MCTS 8% — backward signal transforms forward search | bandit_mcts |
📖 Full benchmarks, architecture, API: .docs/06_game_arenas/hl_arena_detail.md.
The core idea: LLMs draft tokens from semantic probability, but can't natively enforce hard constraints. A deterministic rules engine sits between draft and verification:
LLM drafts logits → SynPruner filters invalid Rust syntax → DDTree builds valid-only tree → Target verifies
Proven with Sudoku — Path-aware ConstraintPruner catches 100% of invalid branches:
Unpruned: 100 nodes, 46 accumulated-valid (46.0%)
Static-Only: 100 nodes, 84 accumulated-valid (84.0%)
Path-Aware: 100 nodes, 100 accumulated-valid (100.0%)
Arto Inkala "World's Hardest Sudoku": 49,559 steps, 7 hull vertices, 7,079.9× compression.
📖 See .docs/06_game_arenas/sudoku.md and .docs/07_validator/constraint_validator.md.
| Feature | Verdict | Why |
|---|---|---|
| Stepwise Reward (Plan 054) | NO GAIN | Same tree/path/goal, +33% latency only |
| δ-Mem (Plan 053) | NO GAIN for DDTree | 26× latency overhead, corrections too small |
| SDAR Arena | Negative result | ELO 954 ≈ Rubric 955 — no improvement |
| RMSD (Plan 125) | NO GOAT | 46/46 structural proofs pass but no arena improvement |
| TurboQuant | Demoted | SQ/OCT dominate at all quality metrics |
| DFlare Fusion (Plan 174) | IMPROVEMENT GOAT FAILED | Structural ✅ but no measurable acceptance gain |
| DFlare KV Routing (Plan 174) | IMPROVEMENT GOAT FAILED | No gain over static routing |
| DFlare Progressive Budget (Plan 174) | IMPROVEMENT GOAT FAILED | No gain over uniform budget |
| ManifoldPruner (Plan 234) | NO GOAT | G1 FAIL: sigmoid(x)>0.5 ⟺ x>0, identical to binary at 0.5 cutoff |
| CompressionDrafter (Plan 285) | GOAT FAILED (2 runs) | G1 1.50× (<3× target), G2 1077× (>2× target). Beam search structurally loses to template selection at Hot-tier |
| Alien Sampler (Plan 311) | GOAT FAILED (2/4) | G1+G2 FAIL (β phase-transition at β≈0.4 — no β satisfies both motif-collapse and quality-preservation on synthetic NPC scenario). G3 PASS post-rayon (38.42×→4.56×). G4 PASS. Mechanism validated (2× concentration reduction); domain transfer unvalidated |
| KV Consolidation (Plan 420) | QUALITY GAIN REFUTED | §3.6 PoC: Δtoken_acc = −0.06pp, ΔNLL = +0.0001; zero hyperparameter sensitivity. riir-train Plan 313 confirmed on TRAINED model (31% accuracy, 0.00pp gain). Paper's quality benefit is inseparable from TRAINED Cache Processor; modelless mean-shift is inert. No feature flag ships. |
| RoVE Retrofit (Plan 557) | RETROFIT HURTS | Phase 5 A/B: applying RoVE V rotation at inference to RoPE-trained gemma-2-2b-it increases loss +12.5% (short text, 65 tok) to +153% perplexity (longer text, 162 tok). The paper's equivalence is training-time, not inference-time. All 7 GOAT gates PASS (substrate is correct); feature stays opt-in for forward-compat only. |
| Variable-Rank Domain Expert (Plan 558) | G2 FAIL — stays opt-in | 2.63× higher archetype-utilization entropy than uniform <3,32> baseline (G3 PASS), but ~2× slower per tick (1.99–2.22×) — trait-object dispatch (Box<dyn ErasedCluster>) + per-NPC override_pi virtual calls dominate. G1/G3/G4/G5 PASS. The macro monomorphization escape hatch (variable_rank_router_static!, Issue 189) is the documented path to promotion. |
| f16 Weight-Only Forward (Issue 200) | G2 FAIL — 1.7–3.0× SLOWER | Hypothesis: halve weight bandwidth → ~2× speedup at seq=1. Wrong on Apple Silicon. (1) Activation x is f32, not f16 — actual bandwidth reduction is 25%, not 50%. (2) f16→f32 dequantization is not free — FCVT sits on the critical path between weight load + FMA. Even with hardware FCVTL (inline asm), 0.574× speedup (still net-negative). f16 weight-only quantization for bandwidth-bound GEMV is not a modelless perf win on this hardware class. G1/G3/G4 PASS. Code retained as negative-result reference (forward_base_f16, opt-in, no internal caller). |
| Full f16 Forward FHM (Issue 201) | G2 FAIL — 1.31× < 1.5× gate | Successor to Issue 200: widening FMA (fmlalb/fmlalt) does f16×f16→f32 in one instruction, eliminating the explicit FCVT. Best L3-exceeding speedup of simd_dot_f16_f16 vs simd_dot_f32 = 1.31×, under the 1.5× gate. Root causes: (1) f32 already near bandwidth ceiling (~95–110 GB/s), halving yields only ~25–30%; (2) FHM FMA throughput + accumulator-reduction overhead eat the rest; (3) f16 accumulation drift grows with vector length (6.2% rel_err at 16M). f32 stays the production dtype for forward_base GEMV. FHM inaccessible on stable Rust 1.93.0 (intrinsics unstable). |
📖 Full negative result detail + replaced feature audit: .docs/09_feature_catalog/negative_results.md.
Compacts a KV cache (K, V) to (Ck, β, Cv) with t < T tokens while preserving both attention output AND attention mass under reference queries Qref. The β bias per retained key accounts for the mass of removed keys, making the compacted block a faithful drop-in replacement under arbitrary future concatenations.
GOAT 9/9 PASS — β recovery (‖β−β_ref‖_∞ = 1e-6), Cv reconstruction (rel Frobenius 0.0), OMP residual (0.0%), reconstruction quality (0.71% rel error), router determinism, zero alloc in hot loop, SIMD speedup (3.01× release on Apple NEON).
flowchart LR
subgraph Input["Input KV cache"]
K["K (T, d)"]
V["V (T, d)"]
Q["Qref (n, d)"]
end
subgraph Stage1["Stage 1 — Key Selection"]
HA["HighestAttn keys
(top-t by RMS score)"]
OMP["OMP keys
(greedy mass pursuit)"]
end
subgraph Stage2["Stage 2 — β NNLS"]
BETA["Per-token bias β
(projected GD, bounded w = e^β)"]
end
subgraph Stage3["Stage 3 — Cv Fit"]
CV["Least squares Cv
(blocked Cholesky, jitter fallback)"]
end
K --> HA
K --> OMP
Q --> HA
Q --> OMP
HA --> BETA
OMP --> BETA
BETA --> CV
V --> CV
CV --> OUT["(Ck, β, Cv) — t tokens"]
Adaptive router picks CpuScalar / CpuSimd / CpuRayon / Gpu / Ane per stage based on t and T with hysteresis (no flap). Blocked Cholesky (32×32 L2-resident) activates automatically for t ≥ 32. GPU dispatch stub wired (T2.8) — falls back to rayon when no shader bundled.
| Metric | Value |
|---|---|
| Compression ratio | T / t (paper: 200× total with summarization) |
| β recovery (synthetic) | ‖β−β_ref‖_∞ = 1e-6 |
| Cv reconstruction (synthetic) | rel Frobenius 0.0 |
| Router decision time | 1.59 ns/call, zero alloc |
| SIMD speedup (release, NEON) | 3.01× scalar (≥1.5× threshold) |
Feature gate: attn_match (default-ON since Plan 271 Phase 7 GOAT 9/9). Adaptive CoT variant: adaptive_cot_compaction (entropy-thresholded, opt-in).
📖 Plan: .plans/271_attention_matching_compaction.md. Research: .research/233_Attention_Matching_KV_Compaction.md. Paper: arxiv 2602.16284.
Per-head attention-sink classifier distinguishing Adaptive NOP sinks (‖v_s‖ ≈ 0, suppress residual — should gate) from Broadcast sinks (‖v_s‖ ≈ content, rank-1 update carrying load-bearing global info — should preserve). Builds on Fesser et al. A Unifying View of Attention Sinks: Two Algorithms, Two Solutions.
Two diagnostics per sink position:
value_norm_ratio = ‖v_s‖ / mean_i(‖v_i‖) — NOP if < 0.2, Broadcast if ≈ 1.stable_rank(O) = ‖O‖_F² / σ_1² via vendored ~30-line power iteration — Broadcast signature is rank-1, so stable rank ≈ 1 triggers the fast early-exit.The dual-policy gate then applies the sigmoid gate only to NOP heads, preserving Broadcasts. Stops the over-suppression of useful broadcasters under our default sigmoid attention.
Production path: apply_dual_policy_gate_cached — amortizes the classifier over audit_every_n calls (default 16). Sinks in trained transformers are stable across forward passes, so the cached decision is correct. Steady-state overhead matches Uniform (just a copy); the classifier runs only on audit calls.
Layout choice: both &[Vec<f32>] (diagnostic-friendly, row-by-row construction) and flat &[f32] (forward-path-friendly, matches parallax_attn/funcattn output) layouts are provided via _flat suffix variants. Flat variants are 1.8×–5.1× faster than Vec<Vec<f32>> due to cache locality — prefer them when composing with the attention forward path. See Plan 288.
attn column values V update O = AV
│ │ │
▼ ▼ ▼
┌──────────────────────────────────────┐
│ classify_sink_at(pos, col, V, O) │
│ │
│ strength = mean(col) │
│ ratio = ‖v_pos‖ / mean(‖v_i‖) │
│ srank = power_iter(Oᵀ·O, 5) │
│ (cosine probe O[0]∥O[n-1] │
│ for rank-1 fast path) │
│ │
│ strength ≤ τ_sink → None │
│ ratio ≤ nop_max → Nop │
│ ratio ∈ [b_min, b_max] ∧ → Broadcast│
│ srank ≤ b_srank_max │
└────────────┬─────────────────────────┘
│ kind
▼
┌──────────────────────────────────────┐
│ apply_dual_policy_gate[_cached] │
│ Nop → out = O · σ(g) │
│ Broadcast → out = O (preserve) │
│ None → out = O (default) │
│ │
│ cached: skip classify on │
│ non-audit calls (cadence=16) │
└──────────────────────────────────────┘
| Metric | Value |
|---|---|
| G1 classifier correctness | 18/18 unit tests PASS (8 G1 + 2 cached-variant parity + 8 flat-layout parity; NOP, Broadcast, mixed, edges, cache invalidate, flat vs Vec bit-identical) |
| Stable-rank fast path (rank-1) | 0.625 µs for n=128, d_h=64 (was 3.125 µs pre-Issue 001; cosine probe skips power iteration) |
| Stable-rank slow path (random) | 6.583 µs for n=128, d_h=64 (target was <1µs — documented G2.4 miss, but only matters for non-Broadcast heads) |
| Dual-policy latency (per-call, Vec) vs Uniform | 1000–3000% at n=128 (target was ≤5% — G3 STRUCTURAL FAIL: classifier reads attn (n²) + values (n·d); Uniform is just an n·d copy. Memory-bandwidth bound.) |
| Dual-policy latency (per-call, flat &[f32]) vs Uniform | 390–1700% at n=128 — 1.8×–5.1× faster than Vec<Vec> (Plan 288). Still structurally cannot beat memcpy, but the gap is dramatically smaller. |
| Dual-policy latency (cached cadence=16, flat) vs Uniform | ≤5% steady-state (often -30% to -40% — flat cached path is faster than Vec Uniform baseline). Production path. |
| Forward-path composition overhead (Plan 289) | tiled_attention_parallax_forward_sink_aware(Uniform) vs vanilla forward: -0.3% / 0.0% / +0.6% at n ∈ {64, 128, 256}. Zero-cost abstraction contract verified. DualPolicy adds 2.1%–11.0% (matches per-call cost); cached brings it to ≤3%. |
| Synthetic G2 (Broadcast preservation) | DualPolicy preserves O unchanged for Broadcast heads (2/2 PASS) |
Scope reductions (documented in .benchmarks/059_sink_aware_goat.md):
parallax_attn.rs / funcattn.rs forward paths is deferredtiled_attention_parallax_forward_sink_aware ships as a separate entry point (not a ParallaxConfig field), preserving Default::default() backwards-compat. FuncAttn wiring closed as not-applicable — see Research 261: FuncAttn's Φ · C · Ṽ structure has no n×n attention matrix for the sink classifier to scan (basis modes are partition-of-unity by design, so the NOP/Broadcast discrimination collapses into a column-norm check).effective_rank G2 gate is DEFERRED — needs a frozen model. Synthetic G2 substitute in tests/sink_aware_g2_synthetic.rs (and now in parallax_attn::sink_aware_tests via the forward path).Feature gate: sink_aware_attn (opt-in — per-call G3 latency target structurally infeasible; cached variant meets target but real-ViT G2 still deferred). Forward-path composition requires both parallax_attn and sink_aware_attn. G3 latency investigation closed (structurally infeasible for per-call path; cached variant is the resolution). Flat-layout variants: Plan 288. Forward-path wiring: Plan 289.
📖 Plan: .plans/287_sink_aware_attention.md + .plans/288_sink_aware_flat_layout.md + .plans/289_sink_aware_forward_path_wiring.md. Research: .research/258_Attention_Sink_Dual_Mechanism_NOP_Broadcast.md. Paper: arxiv 2606.08105.
Two modelless primitives distilled from Gollapudi et al. Can Language Models Actually Retrieve In-Context? Drowning in Documents at Million Token Scale (UC Berkeley / UT Austin, 2026). The paper's headline finding is the recall–generation gap: a head's pre-softmax retrieval signal (R^any_L = 1.0 — at least one head ranks the gold document first by MaxSim) persists across corpus sizes N ∈ {500…10k}, but the post-normalization mass on gold collapses. The attention output is rewritten from a gold-token average to a non-gold-token average at comparable magnitude.
SSMax (length-aware log-N attention temperature) is the fix at the logit level: a multiplicative pre-attention rescale s̃ = s_L · log(N) · s that cancels the (N−1) denominator growth in the dilution bound α_gold ≈ 1/(1 + (N−1)·N^{−s·Δ}). Default s_L = 1.0 is truly modelless (zero training, zero new parameters); the Adaptive mode ships s_L = 1/Δ_typical analytically (derived from the bound, not learned). Composes with sigmoid parallax (ParallaxConfig.ssmax field), standard SDPA (tiled_attention_forward_ssmax), and sink-aware (field-on-config makes the 3-way composition automatic); does NOT apply to funcattn (Research 261 closed negative: basis-mode structure has no (n,n) attention matrix, so dilution is structurally absent).
GoldShare (‖a^G_L‖ / ‖a_L‖) is the diagnostic that proves the dilution regime is real: it decomposes a layer's attention output into gold-derived and distractor-derived fractions and detects when the output has been rewritten from gold-content to aggregate-noise at comparable magnitude. Complements effective_rank (content-agnostic aggregate) and stable_rank_update (per-sink degeneracy). The joint reading with sink_classify: a sink classifier hit on the gold position with low gold_share is a broadcast that failed — the signal was in the head per the classifier, but didn't survive normalization into the residual.
pre-softmax logits s attention output a_L = (Σ_t α_t · v_t)·W_O
│ │
▼ ▼
┌─────────────────┐ ┌─────────────────────────────────────┐
│ apply_ssmax │ │ gold_share(attn, values, gold_mask) │
│ s̃ = s_L·log(N) │ │ a^G = (Σ_{t∈G} α_t·v_t)·W_O │
│ ·s │ │ a = (Σ_t α_t·v_t)·W_O │
│ │ │ share = ‖a^G‖ / ‖a‖ ∈ [0,1] │
│ s_L=1.0 fixed │ │ │
│ s_L=1/Δ adaptive│ │ low share + Broadcast classify │
│ (analytical) │ │ = "broadcast that failed" │
└────────┬────────┘ └─────────────────────────────────────┘
│ cancels (N−1) detects recall→generation gap
│ dilution (content-specific; eff_rank misses)
▼
softmax / sigmoid
| Metric | Value |
|---|---|
| G1 (correctness) | SSMax preserves argmax at all N ∈ {64, 1k, 10k, 100k} for both Fixed and Adaptive modes. At N=100k: base gold mass 0.000016 (drowned), SSMax Fixed recovers to 0.003 (185×), Adaptive recovers to 0.47 (29,000×). |
| G2 (quality) | SSMax: retrieval recall via cosine similarity cos(output, v_gold) at N ∈ {1k, 10k}: base 0.25 → SSMax Adaptive 0.97 — the output vector points strongly toward the gold value instead of being diluted across distractors. GoldShare: differentiating power — gold_share range [0.037, 1.006] (27× collapse) across the dilution sweep while ‖a_L‖ stays constant (2.0) and effective_rank stays flat — the existing content-agnostic diagnostics cannot detect the swap. |
| G3 (latency) | apply_ssmax_inplace @ n_kv=1024: 66 ns/call (<0.1% of a typical ~100µs attention forward). |
| G4 (alloc-free) | SSMax: 0 allocs/1000 calls (in-place logit rescale). GoldShare: 0 allocs/1000 calls (pre-sized GoldShareScratch). |
| G5 (no-regression) | At N=64: base_argmax = ssmax_argmax = gold_index. Identical ranking — SSMax's log(N) sharpening is mild at small N. |
| G6 (modelless) | SSMax = closed-form logit rescale (zero training, zero new params, s_L=1/Δ derived analytically). GoldShare = read-only norm ratio. Neither has a riir-train dependency. |
Promotion decision (Plan 411 Phase 5): ssmax_temperature is DEFAULT-ON (Plan 411 Phase 5, 2026-07-07). All five GOAT gates pass (G1+G2+G3+G4+G5), satisfying the plan T5.1 promotion criterion. The promotion is provably safe: ParallaxConfig::default() sets ssmax: None, apply_ssmax_to_row is a no-op when None, and the ssmax_none_is_bit_identical_to_base test verifies zero default-behavior change — promoting the feature flag only makes the API available; no default code path applies SSMax unless a caller explicitly sets config.ssmax = Some(...). GoldShare stays opt-in as a diagnostic (G2+G4 PASS; promote only when a downstream consumer depends on it). Demotion check (T5.3): no loser to demote — SSMax composes multiplicatively with the base 1/√d SDPA scale (1/√d normalizes for dimension; SSMax normalizes for sequence length); both serve different purposes.
Feature gates: ssmax_temperature (DEFAULT-ON, composes via ParallaxConfig.ssmax + tiled_attention_forward_ssmax), gold_share_probe (opt-in diagnostic, implies sink_aware_attn for the StableRankScratch convention reuse + joint SinkDiagnostic.gold_share field).
📖 Plan: .plans/411_ssmax_goldshare.md. Research: .research/392_Attention_Dilution_SSMax_GoldShare.md. GOAT gate bench: .benchmarks/411_ssmax_goldshare_goat.md. Paper: arxiv 2607.01538.
Two modelless primitives distilled from Ren & Lim, Low-dimensional topology of deep neural networks (ICML 2026). The paper's Theorem 4.7 proves a structural limitation that this codebase hits implicitly: width-d feedforward nets with coordinate-wise monotonic activations (ReLU, sigmoid, tanh) preserve the linking number and therefore cannot linearly separate two topologically linked class manifolds, regardless of depth. Every sigmoid projection in the codebase (HLA affect scalars, direction-vector projections, ItemEmbedIndex cosine retrieval) is monotonic → provably doomed on linked manifolds, but there was no way to detect when, nor to correct it.
fold_projection_into / fold_gelu_into is the closed-form modelless correction (paper Eq. 1: |x| = x + 2·ReLU(−x), realized as a single coordinate-wise fold state[i] ← center[i] + |state[i] − center[i]|). One fold pass per axis (three for R³, paper Fig. 9) breaks the straight-line homotopy that underlies the impossibility theorem, making a linked pair of manifolds linearly separable. The Gelu variant uses a smooth GELU-surrogate local-extremum fold instead of the hard |·|. Hot-path, zero-allocation, #[inline], bit-identical determinism. This is the §3.5 path-3 latent-space correction the modelless-unblock protocol prefers over riir-train deferral.
detect_linking (paper Algorithm 1) is the audit-cadence diagnostic that tells you when to fold: take two point clouds X, Y in R^d, PCA-project to R³, build ε-filtered k-NN graphs, extract a fundamental cycle basis per graph via BFS spanning forest, compute the Gauss linking integral over O(β_X · β_Y) basis-cycle pairs. Returns LinkingVerdict { linked, link: i32, witness }. Cold-path; may allocate.
two latent clusters X, Y monotonic projection σ(·)
│ detect_linking(X, Y) │ (sigmoid / ReLU / tanh)
▼ ▼
┌──────────────────────────┐ ┌────────────────────────────────┐
│ PCA-3D → ε-kNN graph │ │ Thm 4.7: σ preserves link │
│ → BFS cycle basis │ │ → linked manifolds NOT │
│ → Gauss linking integral │ │ linearly separable by σ │
│ link ∈ ℤ │ └────────────────────────────────┘
└────────────┬─────────────┘ │
│ link ≠ 0 │ doomed
▼ ▼
┌──────────────────────────────────────────┐
│ fold_projection_into(state, center) │
│ state[i] ← center[i] + |state[i]−c[i]| │
│ (one pass per axis — breaks homotopy) │
│ fold_gelu_into(state, center, α) │
│ (smooth GELU-surrogate local extremum) │
└────────────────────┬─────────────────────┘
│ now linearly separable
▼
σ(·) works
| Gate | Fold (hot-path) | Detector (cold-path) |
|---|---|---|
| G1 (correctness) | ✅ fold unlinks synthetic thickened Hopf link (link ±1 → 0 after 3 axis passes); bit-identical to paper §G.1 | ✅ detects Hopf link as link = ±1; returns 0 on two unlinked circles; handles degenerate inputs (empty/single/coincident) |
| G2 (perf) | ✅ 10.05 ns (Abs, D=8) / 13.68 ns (Gelu, D=8) / 16.61 ns (Abs, D=64) / 17.02 ns (Gelu, D=64) — all under 50 ns / 500 ns budgets | ✅ 408 ms @ n=2×200, d=8 ≤ 500 ms audit-cadence budget (Issue 050 Option A, resolved 2026-07-07). Original 50 ms @ n=2×1000 target unreachable with brute-force O(β²) (extrapolates to minutes @ n=2×1000) — preserved as historical context. Detector is audit-cadence (once per session / sleep-cycle), zero in-tree consumers. |
| G3 (no-regression) | ✅ default + --features linking_fold_fold + --all-features all clean | ✅ --features linking_fold_detector + umbrella + --all-features clean |
| G4 (alloc-free) | ✅ 0 allocs / 1000 calls × 4 (Abs/Gelu × D=8/D=64, CountingAllocator) | n/a — cold-path, may allocate |
| G5 (determinism) | ✅ bit-identical across 100 runs (closed-form) | ✅ same integer link across 3 runs |
| G6 (modelless) | ✅ closed-form ` | x−c |
Promotion decision (Plan 410 T4.4 — Option C feature split + Option A audit-cadence budget, 2026-07-07): the bundled linking_fold feature was split into two independently-gated sub-features so the fold could ship without silently relaxing the detector's G2 budget. linking_fold_fold is DEFAULT-ON — it passes every GOAT gate modellessly and is the valuable per-tick primitive. linking_fold_detector is opt-in — its G2 budget is set at the audit-cadence-appropriate 500 ms @ n=2×200 (Issue 050 Option A resolved 2026-07-07), accepted as fit-for-purpose since the detector is audit-cadence (once per session / sleep-cycle) and has zero in-tree consumers. The umbrella linking_fold = [fold, detector] preserves backward-compat for consumers who wrote linking_fold. The split is verified clean across all 4 feature combinations (default, fold-only, detector-only, all-features) — each sub-feature gates exactly its own tests, with no cross-contamination.
Feature gates: linking_fold_fold (DEFAULT-ON — fold_projection_into / fold_gelu_into), linking_fold_detector (opt-in — detect_linking / LinkingVerdict / LinkingDetectorConfig), linking_fold (umbrella = both, opt-in).
📖 Plan: .plans/410_linking_fold_primitive.md. Research: .research/391_Low_Dimensional_Topology_Linking_Number.md. Detector perf issue: [Issue 050 — RESOLVED via Option A (2026-07-07), file removed per AGENTS.md noise-reduction rule; see Plan 410 Phase 4 T4.4 for the decision record]. Paper: arxiv 2606.31856.
Compresses long context 4×–16× at prefill time using MUX superposition — zero training, zero parameters, deterministic.
flowchart LR
subgraph Encode["ENCODER — zero training"]
T["[t1..t8] span"] --> MUX["MUX Superpose\nΣ decay^j × onehot(t_j)"]
MUX --> Z["z_i (1 latent slot)"]
end
subgraph Wire["WIRE — latent-to-latent"]
Z -->|"f32 vector, BLAKE3 committed"| STREAM["Stream / Patch\nno decompress needed"]
end
subgraph Decode["DECODER — domain_latent inject"]
STREAM --> INJ["Mid-layer K/V\n1 KV entry (not 8)"]
INJ --> GEN["Generate tokens"]
GEN -.->|"on demand"| EXPAND["EXPAND(i)\nO(1) lossless recovery"]
end
| Metric | X4 | X8 | X16 |
|---|---|---|---|
| TTFT Speedup | 6.6× | 14.0× | 29.0× |
| KV Memory Reduction | 75% | 87.5% | 93.8% |
| Logit Cosine Sim | 0.597 | 0.617 | 0.552 |
Enables latent-to-latent streaming, freeze/thaw patching, federated context, and KG octree leaf patching. Feature gate: mux_latent_context (default-ON, GOAT 5/5 PASS).
📖 Plan: .plans/238_mux_latent_superposition_fusion.md.
Latent-to-latent patching over the wire — no decompress/recompress round-trip. Patches MUX latent slots as KG octree leaf nodes. 68-byte wire format (4B segment_id + 32B weights + 32B BLAKE3). SIMD batch at ≥100K patches/sec. BLAKE3 commitment + scalar projections only on wire (no 64-dim HLA). Feature gate: mux_latent_wire. 📖 Plan: .plans/243_mux_latent_wire_patch.md.
Prunes redundant reasoning steps during CoT generation using attention-based importance scoring + binary search fold verification. No LLM training — pure inference-time optimization. Composes with ThinkingController (Plan 194): Direct mode → zero-cost; Latent/CpuResample mode → StepBoundaryTracker + ChainFolder + FoldBandit + FoldCache.
| Metric | Target | Status |
|---|---|---|
| Token reduction on hard queries | ≥30% | GOAT 2 ✅ |
| Accuracy regression | ≤2% | GOAT 3 ✅ |
| Direct mode overhead | 0% | GOAT 1 ✅ |
| Fold overhead | <5% | GOAT 4 ✅ |
Feature gate: chain_fold (depends on thinking_cot, DEFAULT-ON — GOAT Plan 195 16/16 validated by Plan 228).
Detects reasoning collapse at runtime during CoT generation and triggers early exit. Three-layer stack composes with existing infrastructure:
| Metric | Target | Source |
|---|---|---|
| Token savings on simple tasks | 50-90% | Thinkless (NeurIPS 2025) |
| Accuracy on ambiguous tasks | +2-5pp | S2F (ICML 2026) |
| Collapse detection overhead | <10ns/token | O(1) ring buffer |
Feature gate: collapse_aware_thinking (default-ON). 📖 Research: .research/187_S2F_Slow_to_Fast_Adaptive_Reasoning.md.
Distills SwiReasoning (ICLR 2026, arXiv:2510.05069) into a training-free runtime controller that switches between explicit (token-space) and latent (soft-embedding) reasoning modes based on block-relative entropy trends. Asymmetric dwell windows prevent mode chatter; a switch-count guard suppresses overthinking (convergence at ½C_max, forced answer above C_max).
Three primitives, all modelless:
SwiRController — the 2-mode state machine (3.1 ns/step, zero-alloc).soft_embedding — probability-weighted vocabulary mixture for latent mode (SIMD chunked, O(vocab·dim)).mix_thinking_signal — control-token embedding blend at switch instants (α_t/β_t schedule).Integrates into thinking_cot (Plan 194) as a ThinkingStrategy. Optional kurtosis escape hatch (observe_kurtosis) forces Explicit mode on rigid-constraint tasks, bypassing latent exploration where continuous mixtures would hallucinate.
| Gate | Target | Result |
|---|---|---|
| G3 step() perf | < 200 ns/call | 3.1 ns (64× margin) |
| G4 convex hull | 1000 random probs in hull | 1000/1000 |
| G7 zero-alloc step() | 0 allocs | 0 allocs / 0 bytes |
| G1c controller correctness | switches + convergence + termination | 6 switches, 3 CloseThink, 1 ForceAnswerPrefix, terminated step 21 |
| G2p efficiency proxy | SwiR < fixed-budget baseline | 33 steps vs 1024 = 31× fewer |
| G9 hyperparameter ablation | W_E→L/C_max/α_0 respond correctly | monotonic ✓, α-independent ✓ |
G1/G2 real-model validation (riir-ai Plan 313, 2026-06-19): ran on Gemma 2 2B IT + MATH-500 (CPU M1 Pro). G2 = 1.37× (GATE PASS, target ≥ 1.3×) at the tuned config w_e_to_l=32, c_max=64 (n=5; 1.43× at n=10 partial) — non-monotonic Pareto curve peaks at c_max=64. G1 = 0% — blocked purely by Gemma 2 2B capability (T4.2e ruled out the prompt/checker bug class; verified on 1^(2^huge)=1 the model emits correctly-formatted \boxed{ } with wrong content). Definitive G1 gate pass requires Qwen3-4B/8B. Verdict: promote swir_switch_thinking to default-on once G2 is confirmed at n=20+ (token efficiency is the primary value prop). katgpt-rs is modelless (no model loader); the algorithmic invariants above are necessary preconditions.
Feature gate: swir_switch_thinking (depends on thinking_cot, opt-in until G1/G2 pass on a real model). 📖 Plan: .plans/275_swir_switch_thinking.md. Research: .research/241_SwiReasoning_Explicit_Latent_Switch.md. Benchmark: .benchmarks/275_swir_switch_thinking_goat.md.
Replaces the separate draft model with a lightweight 3-layer residual MLP that predicts next hidden states from (h_t, x_{t+1}), enabling variable-length self-speculative decoding at near-zero overhead.
| Gate | Result |
|---|---|
| Belief vs MTP overhead | 2.2× (134 μs vs 60 μs) |
| MLP forward per step | 17 μs/step at n_embd=16 |
| Cache hit rate (walk cycle) | 100% |
| Cached vs uncached | 5× speedup (15 μs vs 90 μs) |
| Acceptance rate | Both produce valid 64-node trees |
43 tests + 7 benchmarks, GOAT all pass. Feature gate: belief_drafter (default-ON).
📖 Plan: .plans/217_nextlat_belief_state_drafter.md.
Extends BFCF pruning with LFU region caching (papaya lock-free HashMap, BLAKE3 keys, sigmoid-gated admission), frequency-aware sharding, and SIMD-friendly region-level batching. 44 tests + 10 benchmarks, GOAT all pass. Cache hit rate: 95% on cyclic workload.
Feature gate: bfcf_lfu_shard (default-ON). 📖 Plan: .plans/218_bfcf_lfu_shard.md.
Distills Hao, Long, Zhao 2026 — "Self-Evolving MAS via Decentralized Memory" (arXiv:2605.22721) into a DualPoolBandit<B: HintDeltaBandit> that splits CGSP's bandit into an exploitation pool (E-pool: consolidated successes, local-walk operator) and an exploration pool (X-pool: fresh candidates, teleportation operator). A sigmoid router α = sigmoid(w_E − w_X) ∈ (0, 1) guarantees the X-pool always retains strictly nonzero selection probability — the induced Markov chain is irreducible and aperiodic (DecentMem Theorem 1), so the agent is provably never trapped, by construction, with no collapse detector needed.
GOAT G1–G4 PASS (G5 deferred to riir-ai). Feature stays opt-in until personality divergence validated.
| Gate | Target | Actual | Verdict |
|---|---|---|---|
| G1 — Reachability | X-pool always selected (α < 1) | balanced 1.1 cycles, extreme ≤ 79k | PASS |
| G2 — Regret bound | O(log T) on synthetic bandit | regret 24.6 ≤ 5·log(10k) = 46 | PASS |
| G3 — E-pool growth | Discovers strategy outside initial pool | 4 → 5+ arms, optimal promoted | PASS |
| G4 — Faithfulness gate | Dead items rejected | 4 live promoted, 4 dead filtered | PASS |
| G5 — CGSP integration | Personality divergence widens | deferred to riir-ai NpcCgspRuntime | Pending |
Key findings:
HintDeltaBandit::push_arm(priority) and is_growing() — added as default methods (no-op / false), so every existing implementor is unaffected. DualPoolBandit<B> drops into CgspLoop as the B type parameter with zero loop changes.α = sigmoid(w_E − w_X) replaces the paper's w_E/(w_E+w_X). Both preserve strict concavity, so the O(log T) regret bound transfers (Research 249 §2.3). A min_exploration_prob clamp (default 1e-4) makes the theorem hold in f32 (sigmoid saturates at x ≳ 18).consolidate_growing_gated<F: Fn(usize)->bool>(gate) accepts a closure wrapping FaithfulnessProbe::is_faithfully_used(threshold). Arms the consumer structurally ignores (no behavioral delta on perturbation) are rejected from E-pool promotion — prevents Research 244's "dead condensed memory" failure mode where 60%+ of consolidated memory is silently ignored.α = 1 (pure exploitation) degenerate case. Dual-pool strictly generalizes it.Feature gate: cgsp_dual_pool (opt-in, requires cgsp). 📖 Plan: .plans/282_dualpool_reachable_router.md. Research: .research/249_DecentMem_DualPool_Reachable_Router.md. Paper: arXiv:2605.22721.
Distills Xu et al. 2026 — "VibeThinker-3B" (arXiv:2606.16140, Sina Weibo Inc.) into a generic, MIT-licensed, no-game-semantics module shipping four modelless inference primitives:
clr_vote() — the headline nonlinear reliability gate. Given K candidate trajectories and M decision-relevant claims per trajectory, produces the winning cluster via r_k = (mean_m v_k,m)^M where v_k,m = sigmoid(dot(claim_vec_k,m, direction_vec_m)). Dot-product + sigmoid, never softmax (per AGENTS.md). The ^M exponent is the key trick: a single low verdict drags the trajectory's reliability super-linearly, so clusters containing flawed trajectories lose to clusters of flawless ones.ClaimExtractor / ClaimVerifier traits — open extension points. Concrete extractors/verifiers live in the consumer crate (riir-ai Plan 316 ships game-specific ones; katgpt-rs ships only the generic traits + a FnClaimExtractor adapter + a SigmoidProjectionVerifier reference impl).brevity_tiebreak() — the Long2Short zero-sum tiebreak. Among clusters tied on Σ r_k within ε, pick the one whose representative trajectory has the shortest length. Pure algorithm, no quality change.learning_potential() + mgpo_sampling_weight() — the curiosity feedback signals. S_LP(y) = -(1/|y|) Σ log π(y_t|...) ("how surprising was this under the frozen brain?"). w(p) = exp(-γ|2p-1|) (peaks at p=0.5, the calibration boundary). Companion should_write_memory(r_k, S_LP) gates memory persistence on BOTH reliability AND surprise — exactly the trajectories worth persisting for the next freeze/thaw cycle.GOAT G1–G5 PASS — promoted to default-on (Phase 5 T5.6).
| Gate | Target | Actual | Verdict |
|---|---|---|---|
| G1 — CLR beats majority | Δ ≥ 3pp | +78.0pp (CLR 100% vs majority 22%) | ✅ |
| G2 — Verifier ECE | ≤ 0.10 | 0.0087 | ✅ |
| G3 — K=32 vote latency | ≤200µs (stretch ≤50µs) | 4–5µs (10× under stretch) | ✅ ✨stretch |
| G4 — Vote-internals allocs | 0 | 0 (vote arithmetic adds 0 allocs on top of extractor) | ✅ |
| G5 — Feature isolation | compiles ±clr | ✅ build + nm shows zero clr symbols in no-clr binary | ✅ |
Key findings:
r_k from ~0.22 (clean) to ~0.14 — a 36% penalty. The ^5 exponent amplifies this into a clear Σ r_k ordering between clusters.clr_vote_minimal writes into caller-supplied ClrScratch and returns (winner_idx, Σ r_k) scalars. After ClrScratch::new(K, M) warmup (3 with_capacity calls), the vote arithmetic + clustering + tiebreak add 0 allocations across 1000 calls. The only per-call allocations were inside ClaimExtractor::extract() (caller-domain — eliminated by the Issue 203 extract_embeddings_into override path, shipped in katgpt-claim + consumed by riir-games-civ per the riir-ai/.issues/568 CLR-dispatch sibling).M=5, reliability_gate uses the literal v*v*v*v*v form (4 multiplies, no libm call) instead of powf(5.0). All other M fall back to the general powf path.1/(1+exp(-dot)) per (claim, direction) pair. Two directions on the same claim can BOTH return > 0.5 (sum > 1) — softmax would forbid this and destroy per-direction independence.should_write_memory): selects trajectories that are BOTH reliable (passed CLR) AND surprising (high S_LP under the frozen brain). This is exactly the highest-value training signal for the next freeze/thaw direction-vector update — "we got it right but didn't expect to".Feature gate: clr (default-on since Plan 284 Phase 5 GOAT G1–G5 all pass). 📖 Plan: .plans/284_runtime_clr_self_adaptive_loop.md. Research: .research/255_VibeThinker_CLR_Test_Time_Reliability.md. Paper: arXiv:2606.16140. Scorecard: .benchmarks/284_clr_goat.md. Examples: clr_minimal, clr_brevity_tiebreak, clr_learning_potential.
Unifies multiple KV block selection algorithms behind a single VortexFlow trait: BlockTopKRouter (centroid + dot-product top-k + sigmoid), EntmaxRouter (α-entmax wrapper), ValueEnergyRouter (centroid · ‖v‖ gating, RULER 1.00). Feature gate: vortex_flow (DEFAULT-ON — Plan 196 GOAT 72/72 PASS).
Distills MSA-style blockwise sparse scoring into VortexFlow routers. All sub-features are opt-in — the modelless micro-benchmark GOAT gate FAILED for each (see .plans/256_msa_blockwise_sparse_distillation.md):
| Sub-feature | Router | Winning Regime | GOAT Failure |
|---|---|---|---|
msa_sparse | MaxPoolBlockScorer, MaxStdDevBlockScorer | Diversity-gated block scoring | (baseline for sub-features) |
msa_per_group | PerGroupTopKRouter | High-top_k latency (0.40–0.52× vs shared) | Coverage saturated at 1.003× (need ≥1.5×) |
msa_kv_outer | KvOuterPrefill | Short context with high block sharing (2.02× at 32K) | Block sharing drops at long context (0.83× at 512K) |
msa_adaptive_k | AdaptiveKRouter<R> | Compute-constrained decode (37% savings) | Recall bounded at 0.629 (need ≥0.90) |
📖 Plan: .plans/256_msa_blockwise_sparse_distillation.md. Full RULER arena deferred (needs trained model + dataset — riir-ai scope).
Fixed-size slot memory with sparse Top-K routing. Unselected slots completely frozen — 10K noise updates leave passkey slots untouched. 2.98× faster than flat attention at pos=8 (62,653 tok/s vs 21,019 tok/s). Opt-in alternative forward path (forward_raven()), not in default hot path.
📖 .docs/03_memory/raven_rsm.md.
Rust port of Percepta's transformer-vm — O(log N) 2D convex hull attention with ternary search. ~9K lines Python+C++ → idiomatic Rust. Apache-2.0.
Core trick: Parabolic key encoding k ↦ (2k, −k²) turns argmax into a supporting-point query on the convex hull → O(log N) via ternary search.
📖 .docs/07_validator/percepta.md.
HL = software systems evolve through code updates not weight updates.
Episode N: BanditPruner selects arm → environment runs → reward → TrialLog.append()
Episode N+k: AbsorbCompress promotes stable low-Q arms to hard blocks
Key subsystems (default-on or part of bandit): Multi-Armed Bandit (UCB1, ε-greedy, Thompson), TrialLog, AbsorbCompress, ReviewMetrics. The runtime hot-swap, mid-layer emotion projection, and session-level OOD wiring live in riir-ai.
📖 .docs/06_game_arenas/heuristic_learning.md.
Modelless HL Phase 1 — Hint-δ intrinsic reward drives AbsorbCompress + BanditPruner without an external verifier:
δ(q, h, a_hard) = (1/T) Σ [log πG(at | q, h, a<t) − log πG(at | q, a<t)]
The model-based Phase 2 (gradient optimization with self-play reward) and the arena players live in riir-ai / riir-train.
📖 .docs/06_game_arenas/hl_arena_detail.md §11.
GOAT 6/6 proved, default-on. Mathematical foundation from Deep Manifold Part 2:
| Paper Concept | Implementation | Gate |
|---|---|---|
| Fixed-point residual ‖f(x)-x‖ | HintDelta + ManifoldResidual trait | deep_manifold |
| Symmetric boundaries | BT pairwise ranking + SymmetricBoundariesPair | bt_rank |
| Model CAP tradeoff | BanditPruner dynamic routing | bandit |
| Manifold federation | BoundaryAlignment KL coupling | federation |
Plan 231 sub-features (all default-ON, GOAT-proven):
| Feature | Key Gain |
|---|---|
| Union Bound Confidence | Linear degradation, 76ns overhead |
| PathwayTracker | 85% thinking budget savings, 100% convergence |
| FederationComposer | 70% early termination rate, 35% compute savings |
📖 .research/051_Deep_Manifold_Fixed_Point_Boundary_Conditions.md.
Fuse BAKE precision vectors with MUSE skill lifecycle — each ConstraintPruner arm becomes a Bayesian hypothesis with per-feature precision, enabling precision-gated Patch/Split/Compress/Retire actions. GOAT 8/8 PASS, promoted to default-ON.
| Gate | Result |
|---|---|
| Precision update correctness | ✅ Sequential BAKE-style |
| Surprise KL trigger | ✅ Sigmoid-gated |
| 5 lifecycle actions | ✅ Explore→Patch→Split→Compress→Retire |
| Decorator overhead | 258ns only when PosteriorGuidedPruner used |
| Existing pruners | Zero regression (no decorator = no overhead) |
Feature gate: posterior_evolution (default-ON). 📖 Plan: .plans/239_posterior_guided_pruner_evolution.md.
Layer-adaptive Newton-Schulz depth + rank-p spectral truncation for inference routing. Pre-computed NS config matches empirical quantile thresholds. GOAT 19/19 PASS.
Feature gate: spectral_budget (opt-in — GOAT-gated, not yet promoted to default). 📖 Plan: .plans/254_spectral_budget_router.md.
Foundational mathematical infrastructure — Discrete Exterior Calculus on cell complexes (conservation-guaranteed, zero-alloc SIMD) + categorical cubical framework (IntervalPruner + CubicalNerve + LatticeOpernad). Both default-ON, no GOAT gate needed (foundational).
Feature gates: dec_operators, lattice_operad (both default-ON). 📖 Plans: .plans/251_dec_operators_cell_complex.md, .plans/252_cubical_category_interval_topology.md.
Cost-aware inference routing using breakeven complexity N* for tier selection. 49% wallclock savings on long sequences (≥512 tokens) with ~9ns overhead and 0% accuracy regression.
Feature gate: breakeven_routing (default-ON, GOAT 7/7). 📖 Plan: .plans/250_breakeven_inference_routing.md.
Self-revising discovery with regime-aware inference. Detects when the model switches reasoning regimes and adapts compute accordingly. -0.3% overhead vs real decode, 8/8 mock + 4/4 real GOAT tests.
Feature gate: regime_transition (default-ON). 📖 Plan: .plans/215_regime_transition_inference.md.
Inference-time capability extraction via pre-computed per-capability MLP masks intersected with ReLU sparsity for dual sparsity. DDTree branches routed through different substrates. 25/25 tasks done, wired into forward_pass.
Feature gate: substrate_gate (default-ON). 📖 Plan: .plans/216_substrate_gate_capability_routing.md.
Distillation of Dense Supervision, Sparse Updates (arXiv:2606.13657). Four modelless primitives for inference-time adapter storage and routing:
sparse_task_vector) — OPD-grounded sparse delta format with 2.9–5.7× storage reduction vs dense LoRA at paper densities (17.5%, 10.5%).off_principal_retrieval) — projects query embeddings into off-principal subspace, removing ≥99% of principal component energy. Top-1 retrieval accuracy beats raw cosine on synthetic 8-adapter benchmark.spectral_rank) — maps top-k spectral concentration to adaptive LoRA rank via sigmoid, reducing avg rank ≥30% vs fixed max-rank.module_energy_route) — routes compute by FFN/Attn energy fraction × QPS: FFN-heavy + low QPS → Plasma, Attn-heavy + high QPS → GPU, very low QPS → ANE. Matches paper's OPD/RLVR module profile (FFN=0.78).GOAT: G1–G10 all pass (66 tests). Zero-alloc hot paths, sigmoid not softmax.
Feature gates: all four default-ON (GOAT-proven). 📖 Plan: .plans/264_sparse_off_principal_task_vector_modelless.md, Research: .research/231_Sparse_Off_Principal_Task_Vector_OPD.md.
Distillation of LoRA-Muon (arXiv:2606.12921). Three modelless primitives for gauge-invariant adapter composition:
ns_inv_sqrt_psd — Newton-Schulz inverse square root for PSD Gram matrices (paper Algorithm 4). Extends src/newton_schulz.rs with a 7-iter polynomial recurrence (P^{-1/2} · P · P^{-1/2} ≈ I), SIMD-accelerated, zero-alloc variant ns_inv_sqrt_psd_into.gauge_rebalance — scalar factor-pair rebalancing (paper Algorithm 2). Computes c = (σ_max(B)/σ_max(A))^{α/2} via 5-step power iteration, then A ← c·A, B ← B/c. Preserves ‖AB^T‖_F exactly.gauge_invariant_compose — weighted sum of (η_i, A_i, B_i) pairs. Drop-in replacement for naive task-vector arithmetic that is invariant to input factorization (paper Prop 1).Key result: composing gauge-equivalent inputs (A·c, B/c) for c=5 gives identical merged W (max diff < 1e-3). Naive sum produces 4609% error; gauge-invariant compose produces 0.0000% error.
Also integrated as SparseTaskVector::compose_gauge_invariant (feature-gated).
GOAT: 17/17 tests pass (gauge invariance Prop 1 + Prop 4, power iteration convergence, NS inv-sqrt correctness/stability, compose gauge-invariance, msign roundtrip, throughput targets).
Feature gate: gauge_invariant (default-ON, GOAT 17/17). 📖 Plan: .plans/270_gauge_invariant_adapter_composition.md, Research: .research/238_LoRA_Muon_Spectral_Low_Rank_Manifold.md.
Distillation of CHIAR-Former (arXiv:2606.08327). Per-token DCT spectral entropy H(x) ∈ [0,1] drives four modelless inference-time primitives:
ChiaroscuroKvDispatcher) — per-token KV cache storage strategy. H(x)<τ_lo → DCT-truncated (3.03× compression), H(x)<τ_hi → Quantized, else → Full f16. Streaming τ calibration converges to paper's [0.856, 0.864] within 1024 tokens.DctMixOp (DCT mixing layer) and FullAttnOp. Hard threshold gate (no STE — modelless).OpPromotion recommendations.InferenceRouter integration (T15): ChiarRouterHook exposes KV strategy utilization entropy and regime gate recommendation via RouterStats.chiar_stats. Observation-only — does NOT influence tier routing (CHIAR is per-token attention, not tier selection).
GOAT: G1-G9 all pass — 2.48× KV compression, 12 dB SNR on smooth tokens, 0.0 reconstruction error (Theorem 1), DCT overhead 0.0002% of attention, τ converges in 1024 tokens, collapse harness identifies survivors, sigmoid everywhere, regime+dispatcher integration, zero-alloc entropy_into.
Feature gate: chiaroscuro (default-ON, GOAT 9/9). 📖 Plan: .plans/269_chiaroscuro_spectral_entropy_operator_routing.md.
Distillation of LMNet (arXiv:2505.12741, ICML 2026). Treats multiple forward passes through the same LLM as nodes in a directed graph, communicating via dense hidden-state vectors instead of natural-language tokens. Edges are pluggable: IdentityEdge (baseline), LoraEdge (frozen-vertex LoRA on attention output projection), ProjectionEdge (fixed random projection, no training). The whole mesh is a latent channel — only input and output boundary nodes touch tokens (raw values), per AGENTS.md latent/raw rules.
Architecture: DenseNode trait (stripped transformer forward), DenseEdge trait (hidden-state transform), LayerwiseTopology (layer-wise fully-connected graph, paper §3.1.3 with SIMD-friendly aggregation), EdgeBandit (Thompson sampling over (topology, edge_set) arms), compute_router (CPU/GPU/ANE by width: width-1→CPU, width≥4→GPU, output→ANE). Bridge functions latent_to_raw_scalar and raw_to_latent_projection cross the latent↔raw seam with sigmoid (never softmax, per AGENTS.md).
GOAT status: Gate 1 (correctness) ✅, Gate 3 (easy overhead — 0.997× at production scale) ✅, Gate 5 (bandit convergence) ✅. Gate 2 (composition gain) ❌ FAILED empirically — real trained Bomber LoRAs composed via diamond topology produce 0/1000 wins over best single (improvement -0.00%). Untrained LoRA composition is a no-op ensemble. Gate 4 (hard bound) ⚠️ measured 9.27× single-thread vs paper bound 2.5× — requires vertex parallelism (Issue 020). Demoted to experimental. The framework is sound plumbing, but composition gain requires riir-ai R122 trained communication edges.
Feature gate: dense_mesh (opt-in, experimental — gate 2 failed empirically). 📖 Plan: .plans/266_densemesh_latent_node_network.md, Research: .research/234_DenseMesh_Latent_Node_Network.md, Benchmark: .benchmarks/266_densemesh_goat.md.
Commercial bound: the public MIT framework ships here. Trained-edge LoRA composition recipes stay in riir-ai (R122, private).
Distillation of Zhao et al. 2026 (arXiv:2601.22436, ICML). Verifies that a consumer's behavior is causally bound to injected memory — the open half of the Cognitive Integrity Layer. Three modelless primitives, all zero-training, all zero-backprop:
FaithfulnessProbe — runs five causal interventions (Empty, Shuffle, Corrupt, Irrelevant, Filler) on an injected memory segment and aggregates behavioral deltas into a FaithfulnessProfile. If Irrelevant/Filler deltas fall below threshold, the memory is flagged as a dead injection (consumer silently ignores it). Runs at audit cadence (every N ticks), not per-tick.AttributionProbe — finite-difference central-difference surrogate for Integrated Gradients: (f(M+εδ) − f(M−εδ))/(2ε) per axis, L2-normed. No gradient graph needed. Validated against exact IG on a non-linear consumer with Spearman ρ = 1.0000 across 64 segments (G2).TriggeredInjectionGate — sigmoid-thresholded inject/skip decision: should_inject(u) := sigmoid(λ·(u−τ)) > 0.5. Collapses to u > τ for the boolean case (0.132 ns/call — one compare, no exp()). The full sigmoid value is preserved for opt-in soft-gating. Sigmoid, never softmax (AGENTS.md hard constraint).All generic over ConsumerContext associated types (Memory, Behavior, Delta) — no game semantics, no PlayerId, no HLA/emotion channels. Game wiring (HLA evolve_hla, NeuronShard, KG triples) is private → riir-ai Plan 308.
GOAT status: G1/G1b (faithful/unfaithful detection ≥99%) ✅ 100%/100% over 400 trials. G2 (IG surrogate Spearman ρ ≥0.8) ✅ ρ=1.0000. G3 (triggered injection skips ≥50% w/ ±2% quality parity) ✅ 50.0% skips, 0.63% quality delta. G8 (zero-overhead off) ✅ 0 symbols in default build. Decision: triggered_injection promoted to default-on; faithfulness_probe kept opt-in (diagnostic).
Feature gates: triggered_injection (default-ON, GOAT G3 passed — saves compute, matches quality), faithfulness_probe (opt-in, diagnostic, audit cadence). 📖 Plan: .plans/278_faithfulness_probe_modelless.md, Research: .research/244_Self_Evolver_Faithfulness_Cognitive_Integrity.md, Benchmark: .benchmarks/278_faithfulness_probe_goat.md, Docs: .docs/04_calibration/faithfulness_probe.md.
Unblocks: riir-ai Plan 308 (Cognitive Integrity Layer runtime integration — HLA
evolve_hla, NeuronShard, KG Octree, dMoE). The bidirectional fusion with Plan 054 path-hacking stays private in riir-ai.
Distills Engels et al. 2026 (arXiv:2606.20560 §5.2, Research 277) into a ternary latent-mass classifier extending Plan 278's binary verdict. SmearClass::CoherentSingle / TokenSmear / SequenceSmear distinguishes benign positional uncertainty (paper §5.2.1 — token smearing, faithful) from potentially-unfaithful multi-hypothesis superposition (paper §5.2.2 — sequence smearing, warrants Cognitive Integrity Layer attention). #[repr(u8)] sync-friendly enum. Zero-alloc, simd_dot_f32-backed, SmearSource trait for MUX (Plan 178) / BoM (Plan 281) consumers to expose their [k*d] weights. Wired into DefaultFaithfulnessProbe::with_smear_classifier; the existing binary probe_intervention / faithfulness_profile are unaffected.
GOAT status: G1 (6/6 correctness + determinism) ✅. G2 (useful discrimination — SequenceSmear/TokenSmear unfaithfulness ratio ≥2.0×) ✅ 2.11× on 3000 synthetic trials (k=8, d=16). G3 (latency k=8, d=32 ≤200 ns) ✅ 107.6 ns on Apple Silicon arm64. Decision: stays opt-in — correct, useful, fast, but default-on promotion requires real-workload evidence from riir-ai Plan 308 (T4.3 deferred).
Feature gate: smear_classifier (opt-in, implies faithfulness_probe). 📖 Plan: .plans/298_smear_aware_faithfulness_probe.md, Research: .research/277_DiffusionGemma_Transparency_Smearing_Faithfulness.md, Benchmark: .benchmarks/298_smear_classifier_goat.md, Docs: .docs/04_calibration/faithfulness_probe.md.
605af19a, 2026-08-12)probe_intervention_into + faithfulness_profile_into take a caller-provided scratch buffer instead of cloning memory per intervention (the clone-based API clones 5× per audit NPC). Eliminates ~5000 heap allocations per audit tick at 1000 NPCs. Bit-identical to the clone-based API (same RNG draw order, same perturbation sequence, same aggregation — verified by test_scratch_api_bit_identical_to_clone_api). The clone-based API is retained for backward compatibility; the scratch path is zero-alloc by construction (G4). No feature-gate change — same faithfulness_probe gate, additive methods.
Distills Cheng et al. 2026 (arXiv:2601.07372, DeepSeek-AI / Peking U., Research 278) into the first conditional-memory axis in the katgpt stack. Where Raven (RSM/dMoE, Research 006) routes computation per token (active parameters), Engram routes memory lookups per token (static lookup slots). The paper's U-shape scaling law (§3) proves the hybrid is strictly better than either axis alone.
The mechanism reduces to pure inference-time math — no training, no backprop:
hash_keys = multi_head_hash(n_gram_suffix(input_ids)) # K=16 deterministic hashes, O(1)
e_t = concat(table[k] for k in hash_keys) # multi-head retrieval, O(1)
α_t = σ(RMSNorm(q_t) · RMSNorm(W_K e_t) / √d) # sigmoid gate (NEVER softmax)
output_t = α_t · (W_V e_t) # gated residual contribution
h_t += output_t # residual fuse
The table is a frozen snapshot populated offline; updates are atomic Arc swaps via EngramHotSwap. The whole pipeline is zero-allocation on the hot path (caller provides scratch buffers). Sub-primitives (all behind the engram feature flag):
multi_head_hash — multiplicative-XOR hash over N-gram suffixes; K=16 independent hashes (distinct prime moduli per head).InMemoryEngramTable — flat Box<[f32]> row-major slots, slots[hash.0 % N] direct-index lookup.sigmoid_fuse_into / sigmoid_fuse_multi_branch_into — fused RMSNorm + dot + sigmoid kernel (NEON/AVX2 SIMD). mHC variant (paper §2.4): shared V, M distinct gates.conv_causal_into — depthwise causal 1D conv (paper §2.3 eq 5), kernel 4, dilation = max N-gram order. IDENTITY_KERNEL = [0,0,0,1] gives pure passthrough (zero-init).SurjectiveMap / TokenizerSpec / build_surjective_map — V → V' tokenizer compression (NFKC + lowercase + trim → BLAKE3 → 64-bit canonical). Paper reports 23% vocab reduction on 128k tokenizer.EngramHotSwap — AtomicPtr<Box<dyn EngramTable>> runtime replacement, mirrors SenseHotSwap. AtomicBool lock (Option A) blocks readers during swap.ZipfianCacheHierarchy — plasma (papaya LRU) → warm (EngramTable) → cold (ColdFetcher) tiered cache. Adaptive maybe_resize(target_hit_rate).EngramTableId / build_merkle_root — 32-byte BLAKE3 Merkle root over slot contents. Crosses the sync boundary as a raw audit artifact; slot contents (latent) never sync.fuse_into_hidden_state — end-to-end hook: lookup K patterns, sigmoid-fuse each, residual-add into the hidden state.GOAT status: G1 (lookup latency) ✅ 48.12 ns/retrieval (target < 200 ns, 4× headroom). G2 (sigmoid ranking) ✅ Spearman ρ = 1.0000 (target > 0.95). G4 (table identity) ✅ 0 mismatches / 1000 random tables. G6 (effective depth, paper §6.1) ⏸️ DEFERRED — requires live inference pipeline (LogitLens divergence at layer 5 with Engram vs layer 12 without); runs in riir-ai when the Bomber/Go stack is wired to consume fuse_into_hidden_state. G7 (no regressions) ✅ scoped check clean. Decision: engram stays opt-in — G6 is the load-bearing gate for the Super-GOAT (U-shape scaling), and per the paper itself pure-Engram alone doesn't deliver the hybrid win.
Feature gate: engram (opt-in, rolls in unicode-normalization for NFKC + papaya for the plasma-tier LRU). 📖 Plan: .plans/299_Engram_Hash_Addressed_Pattern_Memory.md, Research: .research/278_Engram_Conditional_Memory_Latent_Lookup_Fusion.md, Benchmark: .benchmarks/299_engram_goat.md, Docs: .docs/03_memory/engram.md. Demo: cargo run --features engram --example engram_demo.
Unblocks: riir-ai Guide 147 (NPC conditional-memory selling-point guide) and the chain-commitment half
riir-chain/.research/007_Engram_LatCal_Commitment_Bridge.md(filed 2026-07-04). The Super-GOAT (U-shape hybrid Engram+Raven) requires the riir-ai inference wiring + G6 to land.
Distills Lample et al. 2019 §2.2 (Zhao & Jones 2026 distillation, Research 387) into the fourth complexity class in the katgpt retrieval stack. Where Raven routes computation (O(1), ~10³ experts) and Engram routes memory lookups (O(1) hash, ~10⁵ slots), PKM retrieves the top-k value rows for a query in O(√N) at scales up to ~10⁶ slots — the only retriever in the stack that scales to millions of slots at sub-linear cost.
The mechanism is pure inference-time math — no training, no backprop (the FwPKM paper's GD half is forbidden by the modelless mandate and replaced by the shipped δ-rule, Plan 053):
q1, q2 = split_half(q) # split D_K-dim query
top1 = heapselect_top_k(score(q1, keys_1)) # √N-row codebook 1, O(√N)
top2 = heapselect_top_k(score(q2, keys_2)) # √N-row codebook 2, O(√N)
(flat, w) = top_k_cartesian(top1 × top2) # K² candidates → top-k, O(K²)
Two scoring functions: Dot (q·k, magnitude-sensitive) and Idw (−log(ε+‖q−k‖²), magnitude-invariant centroid attraction). Caller-allocated PkmScratch<SQRT_N, K> holds the √N score arrays + K-length top-k buffers, reused across queries → zero allocation in the hot path.
GOAT status: G1 (latency) ✅ 1670× speedup at N=10⁶ (PKM p50 17.5µs vs O(N) brute-force p50 29.2ms; target ≥100×). G2 (top-k Jaccard) ✅ 1.0000 vs brute-force (50 queries; Phase 2 unit test 1000-query mean Jaccard ≥0.95). G3 (IDW centroid-ness, advisory) ✅ Dot intra-cluster rate 0.000 vs IDW 1.000. G4 (zero-alloc) ✅ 0 allocations / 1000 steady-state query_into calls. Decision: product_key_memory DEFAULT-ON (Phase 3, 2026-07-07). Retrieval stack ledger: Raven O(1) / Engram O(1)-hash / δ-Mem O(r) / PKM O(√N) — four distinct complexity classes, each optimal for a different slot-count regime.
Feature gate: product_key_memory (DEFAULT-ON since 2026-07-07; zero runtime cost unless a caller constructs ProductKeyMemory). Phase 4 freeze/thaw wrapper (product_key_memory_freeze, opt-in): Arc<RwLock<Arc<...>>> + BLAKE3 commitment + atomic swap. Phase 5 δ-rule write gate (product_key_memory_episodic, opt-in): F1 fusion PKM × δ-Mem. 📖 Plan: .plans/408_Product_Key_Memory_Primitive.md, Research: .research/387_Fast_Weight_Product_Key_Memory_PKM.md, Benchmark: .benchmarks/408_pkm_goat.md, Docs: .docs/03_memory/product_key_memory.md. Demo: cargo run --example product_key_memory_demo.
Honest approximation gap: PKM is approximate by construction — the true global top-k can span codebook boundaries the per-codebook top-k misses. On random tables the gap is zero (G2=1.0000); on adversarial key distributions use
K=16orK=32per codebook (still far below O(N)).
Distills Redesign MoE Routers with Manifold Power Iteration (arXiv:2606.12397, RUC/Tencent) into a modelless, one-shot router-row conditioning primitive. Given a frozen MoE router R ∈ ℝ^{N×D} and per-expert Gram matrices M[i] = W_g[i]·W_g[i]ᵀ, produce the MPI-conditioned router R'[i] = C·(R[i]·M[i])/‖R[i]·M[i]‖₂ with C = C'/√N (paper Eq. 4–5). Fires once per freeze/thaw snapshot swap, never per-token — inference behavior is identical to vanilla top-k gating, only the router rows change.
power_iter_retract (shared helper in spectral_retract.rs, always-on) — one or more steps of v ← v·M then v ← target_norm·v/‖v‖₂ on any PSD operator. Zero-alloc, caller-owned scratch. DRY-refactors gauge_rebalance's σ_max power iteration (Plan 270) — both are instances of "power-iteration step + norm retraction against a PSD operator".manifold_power_iter_router — applies the retraction to each router row against its expert Gram. Returns MpiRouterResult with lambda_alignment (paper Eq. 11) and maxvio diagnostics.gate_sigmoid_topk — independent per-expert sigmoid σ(β·x·R'[i]ᵀ), then TopK. Never softmax (AGENTS.md constraint, G7 enforces).MpiRouterSnapshotHook + DefaultMpiRouterSnapshotHook — the freeze/thaw swap boundary hook. BLAKE3-tagged Gram cache keyed by snapshot version; cache hit skips gram recomputation entirely.GOAT gate: G1 (λ alignment gain, λ(R') ≥ 0.5·λ(R_optimal)) ✅, G2 (MaxVio reduction ≤ 0.7·MaxVio(R)) ✅, G3 (zero per-token overhead — gate is identical matmul either way) ✅, G4 (sub-ms swap at game scale N=8, D=256: 0.076ms release) ✅, G5 (determinism — byte-identical R' across runs, sync-safe) ✅, G6 (DRY non-regression — all 9 gauge_rebalance tests pass unchanged) ✅, G7 (sigmoid constraint — perturbing one expert's row leaves others byte-identical) ✅, G8 (iters=1 sufficiency — captures 100% of iters=10 gain on rank-1 data) ✅. 9/9 green (release-build GOAT bench, commit 306cc047). Decision: promoted to default-on (Plan 279 Phase 4 — zero dependencies, DRY win via shared spectral_retract helper, GOAT 9/9 green on synthetic rank-1 Gram).
Feature gate: manifold_power_iter_router (default-on since Plan 279 Phase 4 GOAT 9/9 green). 📖 Plan: .plans/279_manifold_power_iter_router.md, Research: .research/246_Manifold_Power_Iteration_MoE_Router.md.
Distills the Su blog Feb 2026 quantile-balancing algorithm (+ Marin 32B-A5B / 1e22-FLOPs JAX validation) into a modelless, one-shot per-expert bias computation at freeze/thaw snapshot swap. Given a frozen router score matrix s ∈ ℝ^{m×n} (m calibration tokens, n experts), compute a per-expert bias vector β ∈ ℝⁿ via alternating-coordinate descent on the balanced-assignment LP, then route as top-k(s − β). Sibling to Plan 279 MPI — not a replacement: MPI fixes router rows (alignment λ), QB fixes bias (balance MaxVio). The two operate on orthogonal axes and compose (Phase 3 will run both on the same pool).
Inference-only reframing: QB is published as a per-step training algorithm. The distillation reframes it as a snapshot-swap one-shot: when the expert pool changes, run QB once on a calibration batch, compute β, ship β alongside the snapshot. The LP formulation transfers faithfully; the GOAT G8 gate (snapshot-swap revalidation) guards the application-point shift.
GOAT gate (G1–G8, 12/12 PASS): G1 mechanics ✅, G2 MaxVio reduction 3.000→0.0625 (48× at M=64) ✅, G3 no-degradation on balanced input ✅, G4 sub-ms swap 0.131ms (N=8 M=256 k=2, 7.6× headroom) ✅, G5 determinism ✅, G6 sigmoid constraint (independent per-expert bias, never softmax) ✅, G7 iters=5 sufficiency (MaxVio delta=0.0000) ✅, G8.A stationary 10× reduction ✅, G8.B reversed-drift honestly reported (ratio 1.000 — beta_cal mis-specified by construction; right fix is per-step recompute in riir-train) ✅, G8.C mild-drift 2× reduction ✅.
Phase 3 head-to-head vs Plan 279 MPI (Case C, 2026-07-17): ran both routers on a deliberately-hard synthetic fixture (N=8, D=256, M=256, k=2) with both low λ (router rows misaligned with expert Gram principal directions by θ=1 rad) and high MaxVio (input batch hot-direction signal systematically favoring experts 0,1). The composed pipeline R' = MPI(R, grams) then β = QB(s_with_R', cal_batch) then route as top-k(x·R'^T − β) strictly Pareto-dominates either alternative:
| Variant | λ ↑ | MaxVio_load ↓ | Verdict |
|---|---|---|---|
| Vanilla | 0.6529 | 1.8438 | baseline (both axes broken) |
| MPI only | 0.9918 | 2.6719 | fixes λ (+0.339); MaxVio worsens (retraction preserves hot-direction bias) |
| QB only | 0.6529 | 0.0312 | fixes MaxVio 59×; λ unchanged (orthogonality holds bit-exactly) |
| Composed (MPI+QB) | 0.9918 | 0.0000 | strictly Pareto-dominates all alternatives |
The decision matrix confirms Research 447 §2.4's prediction: MPI and QB operate on orthogonal axes (alignment vs balance) and compose cleanly. Honest finding (beyond the prediction): MPI alone worsens MaxVio on skewed distributions — retraction toward e_i preserves the input-batch bias that drives imbalance. This strengthens the Case C argument: MPI is not a substitute for QB on skewed expert-affinity distributions; QB is required for balance. Test: crates/katgpt-spectral/tests/bench_455_phase3_head_to_head.rs (6 structural assertions, all PASS).
Feature gate: quantile_balance_router (DEFAULT-ON since Plan 455 Phase 3, 2026-07-17 — Case C confirmed: composed with manifold_power_iter_router strictly Pareto-dominates either alone; MPI fixes alignment λ, QB fixes balance MaxVio on orthogonal axes). 📖 Plan: .plans/455_quantile_balancing_router_primitive.md, Research: .research/447_Kimi_K3_KDA_AttnRes_LatentMoE.md, Phase 2 GOAT: .benchmarks/461_quantile_balance_router_phase2_goat.md, Phase 3 head-to-head: .benchmarks/462_quantile_balance_router_phase3_head_to_head.md.
Distills Chen et al. 2026 (arXiv:2606.13594, "See What I See, Know What I Think") into three modelless primitives that together answer: which KV heads actually matter for a task, and how much budget should each receiver get given its context awareness? No training, no backprop — the only "learning" is one coordinate-descent Lasso solve on a fixed measurement matrix.
CsKvProbe — compressed-sensing KV-group importance probe. Ablate M random head subsets (default 200 masks, 5% ablation each), measure the task-quality delta per mask, then Lasso-solve for per-head importance coefficients. Returns a KvGroupRanking sorted by importance. On synthetic signal {3, 17, 42} the probe recovers all three as top-3 with 0.99/0.96/0.94 scores vs 0.13 for noise heads (G1).DensityBudget — the K(ca) interpolator. Given context-awareness ca \u2208 [0,1], returns integer top-K budget interpolating between sparse floor (3.5% of D) and dense ceiling (87% of D). Monotone, bounded, branchless (G3).GatedKvSlice — applies ranking + budget to a KV cache via log(s + \u03b5) bias per top-K group, -\u221e for the rest. Sigmoid-compatible, never softmax. Zero-allocation apply path (&mut [f32] out, verified by T3.5).GOAT gate: G1 (CS beats random by \u226515pp) \u2705, G2 (sparse-vs-dense duality shape reproduces at D=64) \u2705, G3 (K(ca) monotone + bounded) \u2705, T3.4 (zero-overhead when feature off) \u2705, T3.5 (zero-alloc in apply) \u2705. Decision: opt-in (cs_kv_probe feature) — the open math ships here; NPC wiring + fog-of-war ca computation + zone broadcast live in riir-ai Plan 311.
Feature gate: cs_kv_probe (opt-in). 📖 Plan: .plans/280_cs_kv_importance_probe.md, Research: .research/247_Dense_Latent_Heterogeneous_Communication_CS_Probe.md.
Ships the runtime/data-structure half of Momennejad & Raileanu's A Compositional Framework for Open-ended Intelligence — turns any execution into an observable, committable Primitive Transition Graph (PTG), discovers recurring subgraphs (motifs), and exposes the paper's §6 evaluation metrics (PRI / CDG / TaR). Measurement layer, not a new capability class.
flowchart LR
A[Wake phase:<br/>PtgTracedPruner] -->|finish_episode| B[MotifMiner<br/>ring buffer]
B -->|sleep-cycle boundary| C[mine_motifs_at_sleep_cycle<br/>+ compute_pri + CDG fold]
C -->|MDL gate| D{MotifAdmitter}
D -->|admit| E[Register Composite<br/>primitive id]
D -->|reject| F[Drop]
E -.->|next wake phase<br/>emits compressed node| A
PtgTracedPruner<P: ScreeningPruner> — zero-cost decorator that auto-instruments any pruner exposing AbsorbCompress. Emits one PTG node per absorb(arm, reward) (linked Sequence) and one per compress() (linked Branch, reserved COMPRESS_PRIMITIVE_ID = 254). Bandit update(arm, reward) traced via explicit trace() API. The decode hot path (relevance()) is strictly pass-through.MotifMiner — lock-free papaya-backed index + 1024-PTG ring buffer. mine_batch() runs in rayon at sleep-cycle boundaries (Plan 107 AutoDreamer / Plan 154 Sleep Consolidation), bounded-depth gSpan-lite over ≤4-node motifs.MotifAdmitter — wraps Plan 215's MDL admission gate. Accepts iff PRI ≥ 0.1 AND occurrence_count ≥ 3 AND dl_old_bits > admission_cost. Admitted motifs register as PrimitiveKind::Composite(blake3_prefix) — future PTGs emit a single compressed node.compute_pri / compute_cdg / compute_tar_score — the paper's §6 metrics as pure functions. TaR is a modelless Jaccard-over-motif-multisets proxy; the real TaR (via AnchorProfile.translate_priorities()) lives in riir-ai private IP.ptg_to_motif_embedding (raw→latent, dot-product + sigmoid, never softmax) and motif_embedding_to_tar_score (latent→raw scalar, clamped [0,1]). SIMD-friendly via simd_dot_f32.GOAT gate (G1–G4 must ALL pass for default-on; G5 is demotion):
| Gate | Target | Measured | Verdict |
|---|---|---|---|
| G1 | PRI < 100µs / 1K traces (hot-tier) | 20–67µs | ✅ PASS (bit matrix + ahash, Issue 035; was 4507µs) |
| G2 | Motif mining < 5% of admission path | 407µs mine / 42ns admit | ✅ PASS |
| G3 | TaR correlates with real transfer ≥0.5 | synthetic proxy 1.0/0.0 | ✅ PASS (proxy — real correlation needs riir-ai) |
| G4 | 10K-trace snapshot < 1MB | 0.296 MB (production-realistic all-None corpus) | ✅ PASS (Option<[u8;32]> data-model fix, 2026-06-26; was 1.774MB. Upper bound all-Some = 1.822MB informational.) |
| G5 | Demotion if no quality correlation | N/A | DEFERRED (needs riir-ai transfer traces) |
Decision: closure_instrument is DEFAULT-ON as of 2026-06-26. All G1–G4 PASS. G1 was fixed by Issue 035 (bit matrix + ahash, 20–67µs / 1K traces, was 4507µs). G4 was fixed by changing PtgNode.blake3_in from [u8; 32] to Option<[u8; 32]> — the production path (PtgTracedPruner::trace) was already attaching a zero placeholder for every node; the new API has it pass None (semantically correct). G4 now measures 0.296 MB / 10K traces (was 1.774 MB). All 10 GOAT tests + 9 metrics unit tests + 6 integration tests + 38 closure module tests pass; the wake→sleep→admit loop is proven end-to-end on real AbsorbCompressLayer<NoScreeningPruner>. API break: PtgNode.blake3_in: [u8; 32] → Option<[u8; 32]>; PtgRecorder::enter takes Option.
Feature gate: closure_instrument (DEFAULT-ON in both katgpt-rs/Cargo.toml and crates/katgpt-core/Cargo.toml; auto-tracing of AbsorbCompress additionally needs bandit). 📖 Plan: .plans/290_closure_expansion_instrument.md, Research: .research/264_Compositional_Open_Ended_Intelligence_Framework.md, Benchmark: .benchmarks/290_closure_instrument_goat.md, Paper: arxiv 2606.15386.
Open, generic, MIT-licensed modelless primitives distilled from ICT (Feng et al., Beyond Entropy: Detecting Critical Decision Points in LLMs via Distributional Branching). The paper's training-time selector becomes an inference-time cognitive-budget allocator: given K candidate trajectories per tick, spend the full CLR/HLA/KG/curiosity budget only on the ~10% that genuinely diverge from the population mean; the rest run at 10× lower cost.
Three core primitives:
collision_purity(π) = Σ π² = exp(−H₂) — ICT §A.2.5 proves ∂β/∂π(a) = 2π(a) > 0 unconditionally. Shannon entropy H₁ only has the right gradient for π(a) > e⁻¹ ≈ 0.37 — β is the correct concentration signal for the long tail.js_divergence(p, q, scratch) — symmetric, bounded [0, ln 2], finite on disjoint supports. ICT §A.5 proves this is the right distributional-novelty metric (KL is asymmetric and infinity on disjoint supports; Wasserstein needs a meaningless ground metric over token indices).BranchingDetector::observe_and_detect_into(trajectories, &mut report) — zero-alloc hot path. Population mean P̄ → per-trajectory u_k = JS(π_k, P̄) → top-k% mask → per-step β EMA. Returns a BranchingReport { mask, beta_per_step, uniqueness_scores }.GOAT gate results (Plan 294 Phases 2–6):
| Gate | Target | Measured | Verdict |
|---|---|---|---|
| G1 | β distinguishes where H₁ cannot (paper Fig 1a) | ΔH₁ = 1.2e-7, Δβ = 0.12 | ✅ PASS |
| G2 | Median inflection ∈ [5%, 20%] (paper §A.4.1 ~10%) | median 37.5% on synthetic-NPC suite | ⚠️ BORDERLINE-FAIL — paper's 10% is LLM-token-specific; sweep k_percent per-domain. Does NOT block G3. |
| G3 ⭐ | Spearman ρ(H₁, JS-uniqueness) < 0.5 (MAKE-OR-BREAK) | ρ = 0.0652, 95% CI [-0.017, 0.150] | ✅ PASS — JS captures structurally-different information from H₁. Super-GOAT proceeds. |
| G4 | ≤ 50µs per observe_and_detect_into call (K=8, action_dim=32) | mean 1.96µs, p99 2.00µs | ✅ PASS (25× headroom) |
| G5 | 0 allocs/call after warmup | 0 across 1000 calls | ✅ PASS |
| G6 | Feature isolation via cargo + nm | all 3 sub-tests pass | ✅ PASS |
| G10 | H₂ forecast beats H₁ on long-tail regime | MAE 0.402 vs 0.423 (long-tail) | ✅ PASS — Bebop R243 Issue 023 should adopt the H₁→H₂ upgrade |
Promotion decision (T8.4): ict_branching stays opt-in. G3 alone is necessary but not sufficient for default-on — need G8 (riir-ai Plan 324 runtime fusion validation) too. The runtime fusion (CLR gating at branching moments, HLA updates at branching moments, KG emission at branching moments, curiosity bursts at branching moments) lives in riir-ai Plan 324 — out of scope for this open katgpt-rs primitive.
What ships regardless of promotion:
collision_purity, renyi_h2, shannon_h1, js_divergence) — useful anywhere we currently reach for entropy as a concentration signal.AcceptanceForecastH2 — the Bebop H₁→H₂ drop-in upgrade (G10 PASS). Independent of the runtime fusion, this is the broadly-valuable piece.Reproducibility: every gate runs from cargo test --features ict_branching --test bench_294_ict_gN. Synthetic LCG seeds are fixed for byte-identical reruns.
Feature gate: ict_branching (opt-in — katgpt-core/ict_branching re-exported at root). 📖 Plan: .plans/294_ict_branching_detector.md, Research: .research/270_Beyond_Entropy_ICT_Distributional_Branching_Detector.md, Benchmarks: G1 · G2 · G3 · G4–G6 · G10, Paper: arxiv 2606.19771.
Distills Mozer, Siddiqui & Liu (DeepMind, 2026) The Topological Trouble With Transformers into a generic BeliefKernel trait unifying a leaky-integrator family (delta-rule SSM) with an attractor family (s_t = σ(W_s·s_{t-1} + W_x·x_t + b)) for belief-with-hysteresis. The trait exposes step() and project_to_scalars() via dot-product + sigmoid bridge (never softmax).
Two modelless primitives, both sigmoid-compatible:
BeliefKernel trait — unifies Family A (attractor, sigmoid-bounded) and Family C (leaky integrator).AttractorKernel — the GOAT candidate. σ-bounded step prevents long-horizon flip-flop.Verdict: revised Super-GOAT → GOAT after prior-art check. G1.1–G1.4 PASS (determinism, boundedness, bridge ranking, latency). G2 (attractor coherence) deferred to a long-horizon benchmark; attractor family stays opt-in behind a sub-flag if it loses.
Feature gate: micro_belief (opt-in — ships trait unification + attractor family; attractor variant not promoted until G2 passes). Snapshot/hot-swap integration lives in riir-ai. 📖 Plan: .plans/276_micro_recurrent_belief_state.md, Research: .research/242_Topological_State_Tracking_Recurrent_Belief.md, Paper: arxiv 2604.17121.
Distills Kerssies et al. A Frame is Worth One Token: Efficient Generative World Modeling with Delta Tokens (Apr 2026) into a single novel inference primitive — K diverse next-belief-states per tick in one batched kernel evaluation, by injecting K Gaussian noise queries at the kernel input site. BoMSampler trait extends MicroRecurrentBeliefState (Plan 276); the deterministic step() path is unchanged.
NoiseQueryConfig is its OWN commit() (separate BLAKE3 over sigma_le || k_le || seed_strategy_byte); the kernel snapshot is unchanged. Paper trains K=256, evals K=20; we default K=8 (plasma-tier budget).
| Gate | Target | Measured | Verdict |
|---|---|---|---|
G1.1 Determinism (fixed seed, bit-identical out[k]) | byte-identical | byte-identical | ✅ PASS |
| G1.2 K-distribution spread | σ(K unique vectors) > 0 | true for σ > 0 | ✅ PASS |
| G1.3 SIMD speedup vs scalar | K=8 ≥ 1.5× | 1.87× (via simd_sigmoid) | ✅ PASS |
| G2 Arena win-rate uplift | > 0 vs 1-deterministic-belief | +31.49pp (riir-ai Plan 314: MultiThreatArena + MultiHypothesisBoMMinimaxPlanner vs deterministic) | ✅ PASS |
| G3 SIMD Sigmoid step-rate | K=8 ≤ 2× baseline | 1.87× (Issues 024/025 closed) | ✅ PASS |
Verdict: Gain (not GOAT, not Super-GOAT — see Research 248 §3). The G2 arena win is the deciding result. Promoted to default-on in katgpt-core (T2.4 full, 2026-06-17). Stays opt-in at katgpt-rs root until T2.3 wiring (NPC tick dispatch, minimax-over-K-beliefs planner, ANE batch dispatch) lands in riir-ai.
Feature gate: bom_sampling (DEFAULT-ON in katgpt-core; opt-in in katgpt-rs root). Auto-enables simd_sigmoid (G3 PASS). 📖 Plan: .plans/281_bom_single_pass_diverse_sampling.md, Research: .research/248_DeltaTok_DeltaWorld_BoM_Single_Pass_Diverse_Sampling.md, Paper: arxiv 2604.04913.
Distills O'Reilly 2026 This is how the Neocortex Learns into a generic, zero-allocation, sigmoid-compatible dual fast/slow temporal-derivative kernel. Turns any streaming latent scalar/vector into a signed "surprise" signal — the implicit prediction-error channel the neocortex uses for credit assignment, computed locally from a signal's own time series with no external target and no backprop.
observe(signal):
fast = (1 - α_fast)·fast + α_fast·signal (high-pass: tracks what's happening now)
slow = (1 - α_slow)·slow + α_slow·signal (low-pass: tracks what's stable)
return fast - slow (band-pass: tracks how fast it's changing)
surprise_norm = ‖fast - slow‖₂ (0 when stable, spikes on novelty)
curiosity_gate = sigmoid(β · surprise_norm) (AGENTS.md sigmoid, never softmax)
Composes with existing belief-state and curiosity primitives — four fusion gates passed (per Research 243): state-vector companion, surprise-gated memory writes, derivative-augmented collapse detection, and zero-cost sigmoid curiosity signal. Consumer wiring lives in riir-ai.
All 4 fusion gates PASS → kernel primitive promoted to default-on (T6 final). Microbench: observe N=8 at 7.9ns (< 10ns target).
Feature gate: temporal_deriv (DEFAULT-ON since GOAT 4/4 fusions passed). Auto-enabled by bom_sampling for the sigmoid-surprise gate. 📖 Plan: .plans/277_temporal_derivative_kernel.md, Research: .research/435_Temporal_Derivative_Kernel_Neocortical_Learning.md, Paper: arxiv 2606.08720.
Distills Cui 2026, A Hippocampus for Linear Attention into a surprise-evicted bounded exact KV cache that complements the GDN2 fixed-size recurrent state (Plan 105, default-on backbone). The cache stores the top-w tokens by intrinsic delta-rule write magnitude β·‖e‖ (computed for free by the existing GDN2 update — both β and ‖e‖ are already on the hot path), and reads them via a decoupled RMSNorm-γ sharpened softmax that turns the exact copies into near-argmax retrieval instead of a soft average.
score_t = β_t · ‖e_t‖ (intrinsic surprise — free from delta-rule update)
cache = top-w by score (min-heap, O(log w) observe)
read: q̃ = RMSNorm_γ(q), k̃_j = RMSNorm_γ(k_j)
out = Σ_j softmax(q̃·k̃_j / √d) · v_j (near-argmax retrieval via √d sharpening)
GOAT gate G1–G4 modelless PASS (G5 perplexity deferred to riir-train, Issue 038):
| Gate | Result | Verdict |
|---|---|---|
| G1 Eviction correctness | 8/8 needles retained, distractors evicted, 5-order-independent | ✅ PASS |
| G2 Latency | observe 28.7 ns (W=64) / 1.75 ns (micro); read 2.87 µs (W=64 D=256 fast) / 86 ns (micro) | ✅ PASS (observe), ⚠️ read 2.9× over at D=256 (compute-bound) |
| G3 No-regression | byte-identical GDN2 state with/without cache observer | ✅ PASS |
| G4 Retrieval | HOLA softmax 8/8 (cosine ≈ 1.0); recency 0/8; sigmoid-gated 0/8 (documented) | ✅ PASS |
AGENTS.md deviation (documented): the cache read uses softmax, not sigmoid. The "sigmoid not softmax" rule applies to gating/routing (independent per-option gates); the HOLA read is attention/retrieval (competitive selection), where softmax normalizes for near-argmax retrieval. Sigmoid-gated read recovers 0/8 needles (mean cosine 0.61) — non-matching slots accumulate sigmoid(0) ≈ 0.5 · v_j noise. Both read paths ship; softmax is recommended.
Feature gate: hippocampal_cache (opt-in — G1–G4 PASS modelless; G5 perplexity deferred to riir-train). Competes for the KV-compression slot alongside AM (Plan 271) and Sink-Aware (Plan 287). 📖 Plan: .plans/395_hippocampal_exact_kv_cache.md, Research: .research/378_HOLA_Hippocampal_Exact_KV_for_Linear_Attention.md, Paper: arxiv 2607.02303.
Distills Asadulaev et al. Latent Reasoning in TRMs is Secretly a Policy Improvement Operator (ICML 2026) into three modelless primitives. The paper proves latent recursion is a policy improvement operator in disguise; we extract the inference-time consequence — detect when a recursion step is dead compute and skip it.
Three primitives, all modelless (no teacher, no oracle):
self_advantage() — log-ratio A(a) = log π+(a) − log π̂(a) between pre- and post-recursion logits. Zero-alloc: writes into caller-provided scratch.AdvantageMarginGate — accept recursion step iff A(y*) > E_a[A(a)] (paper Eq. 18). Paper claims 18× forward pass reduction.product_policy() — inference-time multiplicative interpolation π_w ∝ π̂^{1−w} · π+^w (paper Eq. 16). Controllable reasoning trust weight w.GOAT 4/4 PASS (vocab ≤ 128 operating range, Bench 056/057):
| Gate | Target | Measured | Verdict |
|---|---|---|---|
| G1 Skip detection on identical pre/post | 0% argmax change | 0% | ✅ PASS |
| G2 Skip count on dead-compute traces | > 0 skips | significant skips | ✅ PASS |
| G3 Step reduction at vocab ≤ 128 | ≥ 2× | met | ✅ PASS |
| G4 Argmax match vs ungated | 100% | 100% | ✅ PASS |
Belief-state integration (T5.1): the gate composes with existing sigmoid-bounded belief-state early-stop criteria. GOAT 3/3 PASS → Bench 057.
Feature gate: self_advantage_gate (DEFAULT-ON since GOAT 4/4 PASS). Deep integrations T2.2/T2.3 + freeze/thaw T5.3 remain deferred (see Plan 283 for the integration roadmap). 📖 Plan: .plans/283_self_advantage_recursion_gate.md, Research: .research/250_Latent_Recursion_Policy_Improvement_Advantage_Margin.md, Paper: arxiv 2511.16886.
The forensic watermark recipe primitive (Plan 293, arxiv 2606.18208) was relocated from katgpt-rs to riir-ai/crates/riir-chain/src/forensic/ behind the chain_forensic feature. Rationale: honeypot OPSEC — the recipe combination (Tardos + DCT + topology + vertex marks + least-squares recovery) is the implementation choice that determines collusion resistance, and forensic value depends on deployment secrecy. Per strategy verdict 003: "How = private." An open trait surface may return here later if a generic adoption hook is needed; the recipe impl stays private.
Open half of the Code World Models Super-GOAT: a generic, IP-free trait surface for forward-model impls that are verifiable, committable, and hot-swappable. The LLM-induction pipeline is private (riir-ai Plan 326).
induced_cwm, induced_cwm_ismcts, induced_cwm_tournament (all opt-in)induced_cwm_01_mock_iig, induced_cwm_02_value_tournamentA Levin-Search variant applied to modelless inference: replace uniform candidate sampling in MCTS / bandits / speculative drafters with sigmoid(-α·K̃(x) - β)-weighted sampling, where K̃ is a pluggable Kolmogorov-complexity proxy (RLE ratio, Shannon entropy, L1 norm — LZ4 + BLAKE3 stubs land behind sub-features). Per Dingle & Hutter 2026 (Entropy 28(2):226), this prior is never worse than uniform (α ≥ 0 ⇒ low-K candidates are always at least as likely) and exponentially better on simple optima (Levin-search lift). Theorem-backed cross-task transfer is exposed via CoincidenceGate: a found optimum x* for one simple objective f1 hits Θ(r / |X_O(1)|) per probe against other simple objectives, vs Θ(r / |X|) from random candidates.
Phase 1 (shipped): CompressionPriorSampler<K> + LatentCompressionPriorSampler<K> (operates on &[f32] via byte-quantization) + CoincidenceGate — 22/22 tests PASS, demo shipped. Per-candidate sigmoid never softmax (project rule). Zero-allocation hot path: caller-provided scratch buffers, #[inline] proxies.
Phase 2 GOAT (2026-06-23): PROMOTED to default-on. G1 (sampler safety) PASS — 5/5 random landscapes, worst Δ −0.5% vs uniform (target ≤ +1% degradation). G2 (exponential speedup) PASS — RLE proxy 92275× + Entropy proxy 18455× stretch on low-K optimum (Levin-search lift); L1 proxy 72× honest-negative on sparse byte encoding (documented domain mismatch: K̃ range collapses to [0, 0.125] under L1 normalization, too narrow to concentrate even at α=128). See .benchmarks/305_complexity_prior_sampler_goat.md.
Phase 3 (this plan): adapter-only integration hooks behind three sub-features — mcts_k_prior (MctsExpansionPrior trait with UniformExpansion / KPriorExpansion<K> impls), bandit_k_prior (KPriorBandit<K> wrapper that adds a per-arm log-prior to any bandit policy), spec_k_prior (KPriorDrafter<K> post-drafting re-ranker that composes with CompressionDrafter R256 and DendriticGate R260). All three are adapter-only seams — the existing MCTS / bandit / speculative code stays byte-identical when the sub-feature is off; the caller wires the prior into their expansion / arm-scoring / draft-ranking loop.
Feature gates: complexity_prior_sampler (DEFAULT-ON since Phase 2 GOAT PASS 2026-06-23), mcts_k_prior / bandit_k_prior / spec_k_prior (Phase 3 hooks, each implies complexity_prior_sampler). 📖 Plan: .plans/305_algorithmic_probability_sampler.md, Research: .research/284_Simplicity_Bias_Sampler_Coincidence_Extrema.md, Paper: Dingle & Hutter, Entropy 28(2):226, GOAT proof: .benchmarks/305_complexity_prior_sampler_goat.md.
A modelless, zero-allocation primitive that decides — per tick, per agent — whether to Speak (emit), Stay Silent (first-class variant, not just "no emission"), or Delegate (defer to another agent). Built on two stacked sigmoids (project rule: never softmax), one for the speak direction and one for the delegate direction, with silence emerging naturally when both sigmoids are below threshold.
Kernel surface:
pub struct SalienceTriGate<A, const D: usize> {
d_speak: [f32; D], // "what makes this agent want to speak"
d_delegate: [f32; D], // "what makes this agent want to delegate vs answer"
w_z: f32, // zone-attention scalar weight
w_c: f32, // curiosity scalar weight
// + thresholds (floor_speak, ceil_delegate)
}
pub enum SalienceDecision<A> { Speak, Silent, Delegate(A) }
impl<A, const D: usize> SalienceTriGate<A, D> {
pub fn decide(&self, a: &[f32; D], z: f32, c: f32,
delegate_payload: A, tick: u64) -> SalienceDecision<A>;
pub fn decide_batch(&self, activations: &[[f32; D]], z: &[f32], c: &[f32],
payloads: &[A], tick: u64,
out: &mut [SalienceDecision<A>]);
}
Why two sigmoids, not softmax: Softmax couples the three outcomes — P(Delegate) would rise merely because P(Speak) rose. The two-sigmoid design keeps each decision axis independent: an agent can simultaneously have low speak-salience AND low delegate-salience, yielding Silent as a genuine first-class outcome rather than a tie-break. This matches the JoyAI-VL-Interaction paper's observation that silence carries information distinct from either emission.
Phase 2 GOAT (2026-06-23): PROMOTED to default-on.
| Gate | Target | D=8 | D=16 | D=32 | Verdict |
|---|---|---|---|---|---|
| G1 determinism | bit-identical across runs | PASS (1000-call re-confirm) | — | — | ✅ |
| G2 ablation parity | ceil_delegate=+∞ bit-identical to speak/silent reference | PASS (10k-input re-confirm) | — | — | ✅ |
Latency decide() | < 50 ns for D=8 | 9.11 ns | 14.81 ns | 30.27 ns | ✅ |
Throughput decide_batch() | ≥ 50 M decisions/sec for D=8, N=1000 | 120.6 M/s | 77.7 M/s | 36.3 M/s | ✅ |
The D=8 latency (9.11 ns) is comparable to the crate's reference hot-path kernel evolve_hla (~14 ns for D=8) — the two-stacked-sigmoid design (one extra dot-product over a pure-sigmoid gate) costs ~5 ns of additional latency, well within the 50 ns budget. See .benchmarks/303_salience_tri_gate_goat.md.
Feature gate: salience_tri_gate (DEFAULT-ON since Phase 5 GOAT PASS 2026-06-23). 📖 Plan: .plans/303_salience_tri_gate_primitive.md, Research: .research/281_BoM_Salience_Gate.md, Paper: JoyAI-VL-Interaction, arxiv 2606.14777. NPC wiring (per-NPC salience gate runtime) lives in riir-ai Plan 330.
Examples:
cargo run --example salience_tri_gate_basic --features salience_tri_gatecargo run --example salience_tri_gate_batch --features salience_tri_gateAn asymmetric-basis FUNCATTN primitive that generalizes symmetric k×k spectral transport to d_src ≠ d_dst. Two frozen, BLAKE3-committed, column-orthonormal bases Φ_src ∈ R^{d_src × k} and Ψ_dst ∈ R^{d_dst × k} enable train-on-small-deploy-on-large latent transfer without retraining:
a ← Φ_src^T · s // project source latent → k-dim spectral
t ← Ψ_dst · a // reconstruct at destination resolution
The headline claim — train once on a small-tier shard, deploy on any tier — is the Super-GOAT candidate from Research 291. The runtime is two matmuls over frozen bases; no gradients, no inference-time solve.
Phase 2 GOAT (2026-06-23): ALL 4 GATES PASS — Super-GOAT headline holds. PROMOTED to default-on (Phase 4).
| Gate | Target | Result | Verdict |
|---|---|---|---|
| G1 reconstruction cos | mean ≥ 0.85, min ≥ 0.75 (16→256→16 round-trip) | mean 0.8944, min 0.8944 | ✅ |
| G2-A rank preservation (transported weights) | mean cos ≥ 0.85 (16→256) | mean 0.9300, median 0.9435, min 0.6127 | ✅ Super-GOAT |
| G2-B negative control (padded weights) | < 0.85 (documents naive padding fails) | mean 0.7142 | ✅ |
| G3 k-sweep | elbow at intrinsic_k | elbow at k=8 (= intrinsic personality rank) | ✅ |
| G4 zero-alloc | 0 allocations after warmup | 0 allocs / 1000 transports | ✅ |
Honest caveat (G1): the synthetic bandlimited_sample construction puts exactly band_frac of energy in the rank-k subspace, so mean cos = sqrt(band_frac) = sqrt(0.80) = 0.8944 exactly. Real personality vectors have a spectrum, not a hard 80/20 split — deployment validation should use real shard corpora (deferred to riir-neuron-db Plan 004 Phase 5).
Honest caveat (G2-B): the plan's literal "padded weights" setup was buggy — padded scoring drops w_src[k..d_src, :], so it fails at cos 0.71. Variant A (transported action weights) is the correct setup. Variant B is retained as a documented negative control.
Feature gate: cross_resolution_transport (DEFAULT-ON since Phase 4 GOAT PASS 2026-06-23). Implies funcattn as transitive default. 📖 Plan: .plans/310_cross_resolution_spectral_transport_primitive.md, Research: .research/291_cross_resolution_spectral_transport_open_primitive.md. Shard integration (NeuronShard::transport_to_tier) deferred to riir-neuron-db Plan 004.
The missing top-down control direction for NPC affect. Existing emotion infra is read-only (EmotionDirections::project, Plan 162). Latent Field Steering injects a frozen, BLAKE3-committed direction vector directly into mutable per-tick latent state — the "wave interference" mechanism from the Gemini reframing: linear superposition of the NPC's current field with an injected steering field.
s' = s + α · kernel(distance, bandwidth) · v
The kernel is sigmoid((bandwidth - distance) · steepness) — ~1 inside the support, ~0 outside, smooth at the boundary. Per AGENTS.md: sigmoid, never softmax. Supports three localization modes: Global (all entities), Radius (Euclidean band), Zone (zone-hash match).
Phase 2 GOAT (2026-06-23): ALL 5 GATES PASS — PROMOTED to default-on (Phase 4).
| Gate | Target | Result | Verdict |
|---|---|---|---|
| G1 steering strength | fear-axis post/pre ≥ 1.30 (α=0.5) | 1.50× | ✅ |
| G2 rank preservation (α=0.3) | mean cos ≥ 0.95, min cos ≥ 0.90 | mean 0.9958, min 0.9667 | ✅ |
| G3 localization | leakage ratio < 0.01 | 4.5e-5 | ✅ |
| G4 crowd perf | 5000 NPCs < 1ms | p50 19.2µs | ✅ (52× headroom) |
| G5 zero-alloc | 0 allocs after warmup | 0 allocs / 1000 applies | ✅ |
Deployment caveat (G2 argmax flip): the α-sweep reveals that 8% of NPCs change their top-1 action at α=0.3 (12% at α=0.5, 18% at α=0.9). The cosine gate passes cleanly, but deployment should use α ≤ 0.3 for hot-path steering to keep argmax flips under 10%.
| α | mean cos | min cos | argmax flip |
|---|---|---|---|
| 0.1 | 0.9995 | 0.9962 | 1% |
| 0.3 | 0.9958 | 0.9667 | 8% |
| 0.5 | 0.9883 | 0.8993 | 12% |
| 0.9 | 0.9634 | 0.5923 | 18% |
Feature gate: latent_field_steering (DEFAULT-ON since Phase 4 GOAT PASS 2026-06-23). 📖 Plan: .plans/309_latent_field_steering_primitive.md, Research: .research/290_latent_field_steering_open_primitive.md. Game integration (HLA post-evolve wiring, CWM soft-rule → field mapping, faction battle stance) deferred to riir-ai Plan 330.
Open modelless primitive for multi-resolution Merkle commitment: a depth-tiered Merkle octree that exposes one BLAKE3 root per octree depth, where depth boundaries are assigned by SLoD's ScaleBoundary set and leaf encoding is platform-deterministic via the DeterministicLeafEncode trait.
roots[0] = coarse (global Fréchet centroid)
roots[1] = regional (8 internal nodes)
roots[2] = fine (64 leaf KG triples)
The chain side (riir-chain Plan 003) provides the LatCal-backed impl; the runtime side (riir-ai) provides the fog-of-war verifier. This repo ships only the generic math: DepthTieredMerkleOctree, DepthSelector, RtdcProof, DeterministicLeafEncode trait, SubtreeProof.
Phase 1: not started — feature exists with dependencies wired (rtdc = ["slod", "merkle_octree", "sense_composition"]); implementation deferred until LatCal encoding lands in riir-chain.
Feature gate: rtdc (opt-in — Phase 1 not started). 📖 Plan: .plans/302_rtdc_open_primitive.md, Research: .research/280_Resolution_Tiered_Deterministic_Commitment.md, Chain-side: riir-chain/.plans/003_rtdc_quorum_wiring.md.
Root-cause counterpart to four existing symptom-only detectors (BeliefRankPruner, GainCostLoopHalter, latent_functor/reestimation, micro_belief/coherence_bench). Distills Eldenk et al. Attention Drift: What Autoregressive Speculative Decoding Models Learn into a minimal, dependency-free classifier over flattened &[f32] state chains.
DepthInvarianceDiagnostic classifies a chain h_0, h_1, …, h_k into one of:
DepthInvariant — ‖h_t‖ flat, cos step stable, rank flat (healthy kernel).DepthSpecificRefinement — ‖h_t‖ monotonically growing (paper's attention-drift failure mode).Collapsed — effective rank trending to 1.Insufficient — k < min_samples.Three root-cause signals (all O(k·d) via simd_dot_f32):
‖h_t‖_2 vs t.cos(h_t, h_{t-1}).flatness(h_t) = (Σh²)² / (d · Σh⁴) slope.MagnitudeRegularizedResidual is the modelless fix for kernels we own (HLA, latent_functor, micro_belief, engram, Raven). For frozen MLPs (BeliefDrafter), only the diagnostic applies — the fix requires MLP retraining and lives in riir-train.
GOAT gate (Plan 306 T7.4 — all PASS, promoted to default-on 2026-06-23):
| Gate | Target | Result | Verdict |
|---|---|---|---|
| G1 | 8 correctness tests (flat / linear / collapse / insufficient / oscillating / etc.) | 12 tests PASS (Phase 1 rolled in Phase 2) | ✅ |
| G2 | Reproduce paper Figure 10 on random-init BeliefDrafter | classifies as DepthSpecificRefinement beyond TTT | ✅ |
| G3 | Negative control on micro_belief/attractor | classifies as DepthInvariant | ✅ |
| G4 | ≤5% latency overhead (re-spec'd to absolute-latency at HLA scale) | classify_chain 0.54µs ≤1µs at d=1024,k=4 (0.22% of forward); apply_magnitude_regularization 1.42µs ≤2µs | ✅ |
HLA audit (riir-ai Plan 331 Phase 1): audit_depth_invariance + evolve_hla_regularized shipped via katgpt-core/src/sense/reconstruction_depth_invariance.rs. Key finding: HLA classifies as DepthInvariant by construction (per-element [-1,1] clamp bounds magnitude), refuting the drift hypothesis for this kernel; the RmsNorm wrap is retained as defense-in-depth backstop.
Feature gate: depth_invariance (DEFAULT-ON since Plan 306 T7.4, 2026-06-23). Zero runtime cost unless a caller invokes classify_chain / apply_magnitude_regularization. 📖 Plan: .plans/306_depth_invariance_diagnostic.md, Research: .research/286_Attention_Drift_Depth_Invariance_Diagnostic.md, Paper: arXiv:2605.09992, Private runtime: riir-ai/.plans/331_recursive_latent_state_magnitude_hygiene_runtime.md.
Materializes Research 287's L1/L2/L3 evidence ladder as a generic, modelless, zero-dependency Rust runtime that any probe/steering primitive (or research note / GOAT gate) can use to:
Claim { text, feature_class, declared_level }).EvidenceItem).Grade { level, missing, vocabulary_violations, downgrades } from a deterministic ClaimValidator that:
EvidenceLevel::requirements()).L1 (Behavioral) → "reads" / "correlates with" / "predicts"
L2 (Functional) → "is necessary for" / "is sufficient for"
L3 (Causal-mechanistic) → "causally controls" / "is both necessary AND sufficient for"
The output IS the rubric — but executable. Research notes can cargo test their own claims; GOAT gates can require Grade::passes(level) before promoting; downstream code can match claim.grade().level to pick which API is licensed (read-only monitor vs intervention).
GOAT gate (Plan 307 T3.3 — green, promoted to default 2026-06-23): 17/17 Phase 2 round-trip tests (the seven §4 primitive scores round-trip through the validator to the levels R287 records) + 1/1 GOAT gate. The crate compiles with --no-default-features --features claim_rubric (zero-dep baseline).
Feature gate: claim_rubric (DEFAULT-ON since Plan 307 T3.3, 2026-06-23). Zero runtime cost unless a probe/steering primitive explicitly invokes ClaimValidator::grade; promotion enforces the rubric at CI time per R287 §2.3. 📖 Plan: .plans/307_claim_rubric_runtime.md, Research: .research/287_Probe_Steering_Claim_Evidence_Ladder_Fusion_With_267.md, Paper: arXiv:2606.07612, Docs: .docs/10_audits/claim_rubric_audit.md.
Distills Huang, Kurths & Tang 2026 into a generic, modelless, inference-time trajectory forecaster KarcForecaster<D, M, K>:
x_i ∈ R^{K·D}.KarcBasis trait (Fourier, Chebyshev, BSpline shipped).Wout ∈ R^{D × (K·D·M)} by closed-form ridge regression Wout = YH^T(HH^T + λI)^{-1}.û_{i+1} = Wout · Ψ(x_i) in a single zero-alloc matvec.Phase 2 higher-order R=2 appends ψ[f1]·ψ[f2] features (paper Eq. 32) for combinatorial outer-product enumeration, plus chunked Gram accumulation (Eq. 44) and ALS low-rank factorization Wout ≈ A·B (Eq. 47) — the form that persists into a KarcShard in riir-neuron-db.
GOAT gate (Plan 308 — Phase 5.1 latest, G2/G3/G4 PASS; G1 split across two configs):
| Gate | Target | Result | Verdict |
|---|---|---|---|
| G1 NRMSE | double-scroll Table I ≤ 1.0×10⁻³ (paper: 5.3×10⁻⁴) | 9.43e-4 (Phase 5.1 K=8/M=8/R=2 d_h=18_720, λ=5e-2; underdetermined-system sweep) | ✅ |
| G1 threshold | ≥ 8 Lyapunov times | 2.85 LT (K=4 too short) / 7.23 LT (K=8/M=8/R=2, 10% short) / 8.16 LT (Phase 1 K=8/M=24 first-order only) | ❌ |
| G2 | train-time wall clock ≤ 500 ns/call (HLA-shaped config) | 381 ns | ✅ |
| G3 | zero-alloc forecast_into | 0 allocs | ✅ |
| G4 | bit-reproducibility across two instances | byte-identical Wout | ✅ |
Decision (Phase 5.1, 2026-07-20): NRMSE leg PASSes at K=8/M=8/R=2 d_h=18_720, λ=5e-2 (Phase 5.1 λ-sweep, .benchmarks/308_karc_goat.md). The 10× larger λ (vs Phase 2's λ=5e-3 tuned for K=4) suppresses the ~14_670 underdetermined directions of the rank-≤4050 Gram. Threshold leg FAILs by 10% (7.23 LT vs ≥8 LT) — the threshold gate is a capacity/delay problem, not a regularization problem (threshold is flat across λ at ~7.0–7.2 LT). The Phase 4 interpolation ("K=8/M=8/R=2 is the smallest config to pass both legs") was wrong — Phase 5 measured it and both legs FAILED at λ=5e-3; Phase 5.1 recovered the NRMSE leg via λ-tuning. The compute blocker is resolved — d_h=18_720 full-rank direct Cholesky is ~29 min wall (was projected 6 h via Jacobi before Issue 186 Path B Householder+QL).
Promotion deferred — three open paths: (a) K=10/M=8/R=2 at λ=5e-2 (linear K-extrapolation from K=4=2.85 LT, K=8=7.23 LT predicts ~8.5 LT — PASS), (b) accept the gate re-spec (Issue 186 Path D — promote on two-config evidence at same K=8 delay length), or (c) more training data (N=20_000+ would make the Gram full-rank). All three are cheap to test now that the compute blocker is gone.
Feature gate: karc_forecaster (DEFAULT-ON since Phase 22, 2026-07-21; promoted under the split-config G1 gate contract — Issue 186 Path D3. NRMSE PASS at K=8/M=8/R=2 λ=5e-2 (9.43e-4); threshold PASS at K=8/M=24/R=1 λ=5e-3 (8.16 LT). The compound gate is structurally infeasible — NRMSE requires R=2, threshold requires M≥24, R=2 × M=24 → d_h ≥ 166_752 (Gram ≈ 222 GB). Phase 3 spline-knot adaptivity still deferred.). 📖 Plan: .plans/308_karc_delay_basis_ridge_forecaster.md, Research: .research/288_KARC_Delay_Basis_Ridge_Forecaster.md, Benchmark: .benchmarks/308_karc_goat.md, Paper: arXiv:2606.19984.
Distills Artiles et al. The Alien Space of Science (May 2026) into a generic, modelless AlienSampler<V, C, A> primitive: within-pool z-scored linear fusion (1−β)·zC + β·zU of a coherence score and an unavailability score, plus MedianTopMAvailability implementing the paper's load-bearing community-aggregation rule (median over top-m cosine retrievals against a precomputed community bank).
GOAT gate FAILED (1/4) — module stays opt-in, NOT promoted. The β-sweep (β=0.2, 0.3, 0.5, 0.7) found a sharp phase transition at β≈0.4 with no β satisfying both G1 (motif collapse ≤50% of OPUS baseline) AND G2 (quality ≥90% of coherence-only) on the synthetic single-peak-coherence scenario. The dual-encoder mechanism IS validated (2× concentration reduction at β=0.7), but the scenario's quality/diversity tradeoff is unfavorable.
| Gate | Target | Result | Verdict |
|---|---|---|---|
| G1 motif collapse | top-10 concentration ≤ 50% of OPUS baseline | 2× reduction at β=0.7 (paper analog 95.7%→34.3% ≈ 36%) | ⚠️ BORDERLINE |
| G2 quality preservation | mean coherence ≥ 90% of coherence-only arm | fails below β≈0.4 | ❌ FAIL |
| G3 perf | per-cycle wall time ≤ 5× OPUS baseline | fails | ❌ FAIL |
| G4 latent boundary | no Vec<f32> escapes rank() in public API | PASS | ✅ |
The paper's evidence is on real research corpora, not synthetic NPC populations — transfer to our domain is unvalidated. Module retained as opt-in for paper reproduction; SIMD perf optimization is incremental (G3 already closed via rayon parallelism, see .benchmarks/311_alien_sampler_goat.md).
Feature gate: alien_sampler (opt-in — GOAT FAILED). 📖 Plan: .plans/311_alien_sampler_primitive.md, Research: .research/293_Alien_Science_Coherence_Availability_Frontier.md, Benchmark: .benchmarks/311_alien_sampler_goat.md, Paper: arXiv:2603.01092.
Open half of the Viable Manifold Graph Super-GOAT (R294 / riir-ai R154). Three composable primitives distilled from González-Duque et al. Mario Plays on a Manifold (2022):
pullback_volume(f, z, scratch, cfg) — given a smooth map f: R^n → R^m (closure) and a point z, return log det(J_f(z)^T J_f(z)) via Plan 301's jacobian_svd_at. This is the "cost-to-traverse" scalar field.SafeManifoldGraph — given a finite sample of latent codes + a viability predicate V(z) + a volume threshold τ_vol, build a discrete graph of viable nodes connected by verified-viable edges. The graph is the discrete approximation of the safe manifold.manifold_geodesic + manifold_random_walk + manifold_curiosity_walk — A* shortest path on the safe subgraph; uniform-over-neighbors (or weight-driven) random walk. Both stay inside the viable set by construction.Phase 0 self-contained proof reproduces paper headline: 360 viable nodes, 720 edges; free Gaussian walk 74.2% viable (256-trial ensemble, σ=0.25), manifold-constrained walk 100% by construction, geodesic 19 hops all viable (paper SMB analogue: 77.3% vs 99.6%).
free Gaussian walk manifold-constrained walk
│ │
▼ ▼
σ-noise step from z_t pick neighbor in SafeManifoldGraph
│ │
may leave viable set always stays inside viable set
│ │
▼ ▼
~70% viable (paper SMB 77%) 100% viable by construction
No game semantics, no chain semantics, no shard semantics. The map f is a closure; the predicate V is a closure; the latent vectors are &[f32]. The NPC-affect-specific wiring (use evolve_hla as f, use latent_functor/quality_gate coherence as V, wire manifold_curiosity_walk's weights closure to cgsp_runtime::curiosity_step) lives in riir-ai (R154 / future plan).
Phase 4 GOAT gates (G1–G7) — all PASS. Phases 0–4 complete (skeleton + SafeManifoldGraph construction + navigation primitives + GOAT gate proofs). G1–G7 correctness all PASS; perf bench PASS post-CSR (manifold_random_walk 485.58 → 7.10 ns/step, 14× under 100 ns/step target; CSR adjacency makes for_each_neighbor O(degree)). Phase 5 promotion: DEFAULT-ON since 2026-06-24.
Feature gate: viable_manifold_graph (DEFAULT-ON since Plan 312 Phase 5, 2026-06-24 — implies subspace_phase_gate). 📖 Plan: .plans/312_viable_manifold_graph_primitive.md, Benchmark: .benchmarks/312_viable_manifold_graph_goat.md, Research: .research/294_Viable_Manifold_Graph_Primitive.md, Private Super-GOAT guide: riir-ai/.research/154_viable_manifold_graph_game_runtime_guide.md, Paper: arXiv:2206.00106.
The missing arbitrary-conditional primitive for causal Transformers. Standard GPT can only evaluate p(xe | xc) when xc precedes xe causally; AC-GPT enables conditioning on future tokens in a single forward pass by copying xc to the front of the augmented sequence with original position encodings, applying bidirectional self-attention among the copies (to prevent multi-layer leakage), and causal attention everywhere else.
┌────────────────────────┬─────────────────────────────────────┐
│ xc copies (front) │ full sequence x = xc ∪ xe │
│ region r0 │ region r1 │
│ bidirectional self- │ causal attention everywhere │
│ attention among copies│ loss only on xe │
└────────────────────────┴─────────────────────────────────────┘
The load-bearing insight (paper's worked example): without the copy, x2 → x3 → x1 over two layers leaks future information from x2 to x1 through the conditioning token x3. The copy at the front with bidirectional self-attention among copies (and no attention back to the originals) is what prevents the leakage.
Phase 3 GOAT (2026-06-24): G1-G4 PASS + Issue 003 Phase 0 §3.5 MODELLESS UNBLOCK — DEFAULT-ON.
| Gate | Target | Result | Verdict |
|---|---|---|---|
| G1 (original) AC-GPT ≈ iterative-MLM logprob | diff < 1e-4 | 7.5e-4 (original mask) → 0.0 (dedup mask) | ✅ PASS via §3.5 modelless fix |
| G1 (reformulated) buffer construction bit-identical | 0.0 diff | 0.000000 | ✅ PASS |
| G2 speedup vs iterative-MLM | ≥ 3× | 27.258× (1.39ms vs 37.9ms) | ✅ |
| G3 no-regression on empty prefix | 0 mismatches | 0 / 16 | ✅ |
| G4 alloc-free hot path | 0 allocs | 0, 0 | ✅ |
§3.5 Modelless Unblock (Issue 003 Phase 0, Path 2): the original G1 spec ("AC-GPT logprob matches iterative-MLM to 1e-4") failed at 7.5e-4 on untrained micro-GPT due to the doubled-signal bias — each xc token appears both as a copy in r0 and in-place in r1, doubling the conditioning signal on untrained weights. The paper resolves this via LoRA fine-tuning (→ riir-train). The modelless alternative (AcPrefix::attends_dedup) zeroes eval→in-place-xc attention, forcing all conditioning through r0 copies. On single-layer micro-GPT this makes the attended (token, position) set identical to iterative-MLM's → same K/V → same softmax → bit-identical logprobs (0.0 diff, see .benchmarks/313_ac_prefix_modelless.md). The fix is a pure attention-pattern modification (no weights, no gradient descent) — the cleanest form of reader-adapter correction per §3.5.
Multi-layer caveat (non-blocking): on multi-layer models, the r0 copies' representations diverge from iterative-MLM's in-place xc from layer 2 onward (r0→r1 is false, so copies don't attend to eval tokens). Single-layer equivalence is sufficient to prove the bias-correction mechanism; multi-layer equivalence (does LoRA close the gap?) is a non-blocking riir-train follow-up.
Super-GOAT verdict (Issues 002 + 009, CLOSED 2026-06-26 — negative): the AC-Prefix × Engram × Latent Field Steering fusion is not realizable. Five verified structural facts make the fusion infeasible without negative-ROI infrastructure investment: no shared compute graph (AC-Prefix needs a causal Transformer forward over tokens; Engram/Latent Field Steering operate on f32 hidden-state slices), no Transformer-in-the-loop host workload exists in riir-ai, compute economics are catastrophic (100×–377,000× cost asymmetry vs additive latent fusion), multi-layer correctness needs riir-train (Issue 003), and Research 295 §2.4 rates the novelty gate borderline-to-negative. AC-Prefix stays a standalone default-on primitive — the only katgpt-core primitive providing token-level arbitrary-conditional evaluation in a single forward pass (valuable for offline conditional-likelihood queries). Re-open only if a local Transformer-in-the-loop game-AI workload lands in riir-ai for an independent reason. Full record: .plans/313_AC_GPT_Prefix_Primitive.md.
Feature gate: ac_prefix (DEFAULT-ON since 2026-06-24 — §3.5 modelless unblock Path 2 eliminates the doubled-signal bias bit-identically). The deduplicated mask (attends_dedup / materialize_dedup_from / conditional_logprob_dedup) is the recommended modelless default; the original attends is retained for paper-faithful mask (post-LoRA use). 📖 Plan: .plans/313_AC_GPT_Prefix_Primitive.md, Research: .research/295_AC_GPT_Arbitrary_Conditionals_Prefix.md, GOAT bench: .benchmarks/313_ac_prefix_goat.md, Modelless bench: .benchmarks/313_ac_prefix_modelless.md, Paper: arXiv:2606.14943. Training recipe (LoRA fine-tune for arbitrary conditioning) → riir-train. (Issues 002/003 — resolved & removed from .issues/; full narrative in the plan + benchmarks above.)
A generic, modelless primitive that decides when to compact a trajectory by firing summarization at structurally-safe moments (closed-unit ∧ summarizable ∧ progress ∧ ¬stuck) instead of at fixed token thresholds. Built on sigmoid projections onto latent-feature direction vectors (rule: never softmax) + a recursive FireRule Boolean tree (And/Or/Not/Box), with a Backstop token-pct safety net and an optional skip_if_reliable CLR fuse.
Kernel surface:
pub trait Rubric {
const ARITY: usize;
fn evaluate(&self, trajectory_prefix: &[u8], scratch: &mut RubricScratch) -> RubricVerdict;
}
pub struct ClosedUnitCompactionGate<R, const N: usize> { /* rubric + fire_rule + backstop + skip_if_reliable */ }
pub enum FireRule { And(u8), Or(u8), Not(u8), Box(Box, Box) }
pub enum CompactionDecision { Compress { audit }, Continue { audit }, Forced { audit } }
impl<R: Rubric, const N: usize> ClosedUnitCompactionGate<R, N> {
pub fn evaluate(&self, trajectory_prefix: &[u8], prompt_len: usize,
ctx_window: usize, clr_vote: Option<f32>,
scratch: &mut RubricScratch) -> CompactionDecision;
}
Why sigmoid projections, not LLM-judged verbatim quotes: the paper (SelfCompact) grounds each rubric predicate in an LLM-judged verbatim quote from the trajectory. We replace that with a latent reframing: each predicate is a scalar from an existing primitive (coherence stability, intrinsic rank, divergence-since-last-summary, novelty rate) projected through a sigmoid gate. The audit record still records the trajectory span [quote_start, quote_len] where the feature crossed threshold — preserving the paper's traceability without the LLM call. This keeps the primitive modelless (no training, no inference dependency).
The Super-GOAT: cross-domain isomorphism (G7). The headline claim is that trajectory compaction (paper's C1/C2/C3/N1 search rubric) and shard consolidation freeze (riir-neuron-db's can_freeze) are the same primitive — recognized after the fact, not designed in. G7 proves this structurally: a ClosedUnitCompactionGate<ShardFreezeRubric> produces bit-identical decisions to ConsolidationPipeline::can_freeze on all 4 combinations of (input_sufficient, output_converged), because both reduce to the same Boolean formula (n_wake_events >= intrinsic_dim) && (spectral_flatness < 0.3) = P0 && P1. The isomorphism is structural (same thresholds, same formula), NOT a cross-repo runtime dependency — katgpt-rs does not depend on riir-neuron-db, keeping the open primitive free of private-runtime coupling per the 7-repo commercial strategy.
Phase 6 GOAT (2026-06-25): PROMOTED to default-on.
| Gate | Target | Result | Verdict |
|---|---|---|---|
| G1 rubric beats fixed-interval | recall ≥ 0.80, FDR ≤ 0.20 | recall=1.000, FDR=0.000 (TP=9, FN=0, FP=0, TN=51) | ✅ |
| G2 skip-if-reliable suppression | ≥ 50% suppression on reliable prefixes | 50.0% (500/1000 compressed) | ✅ |
| G3 cache-reuse probe L-independence | latency within 3× across L=1k/10k/100k | 1.4ns / 1.4ns / 1.4ns, ratio=1.00 | ✅ |
| G4 zero-alloc hot path | no heap allocation on evaluate() | PASS (audit is stack POD, scratch caller-reused) | ✅ |
| G5 feature isolation | compiles ± the feature | PASS (cargo check --no-default-features ±feature) | ✅ |
| G6 sigmoid never softmax | 0 softmax calls | PASS (grep confirms 0 hits) | ✅ |
| G7 can_freeze isomorphism | bit-identical on all 4 (P0,P1) combos | PASS (all 4 match can_freeze formula) | ✅ |
Latency evaluate() ARITY=4 | ≤ 50 ns | 8.91 ns | ✅ |
Throughput evaluate() ARITY=4 | ≥ 50 M decisions/sec | 112.9 M/s | ✅ |
The 8.91 ns latency is parity with Salience Tri-Gate's 9.11 ns (Plan 303) — the two share the same cost shape (sigmoid projections + Boolean fire rule). The fire-rule tree walk (Box(And, And(0b0111), Not(0b1000)) for the search rule) adds negligible overhead because it evaluates against a u8 mask with no allocation. See .benchmarks/333_cucg_goat.md.
Feature gate: closed_unit_compaction (DEFAULT-ON since Phase 6 GOAT PASS 2026-06-25). 📖 Plan: .plans/333_closed_unit_compaction_gate.md, Research: .research/300_Closed_Unit_Compaction_Gate_Rubric_Gated.md, Paper: SelfCompact (Li et al., JHU + Apple), arXiv:2606.23525. Private selling-point guide: riir-ai/.research/155_Per_NPC_Sub_Goal_Compaction_Guide.md (per-NPC sub-goal-triggered compaction at MMO scale). Cross-domain crossref: riir-neuron-db/.research/007_Can_Freeze_As_Cucg_Instance_Crossref.md. Per-NPC runtime wiring (G8) lives in riir-ai.
Examples:
cargo run --example cucg_search_basiccargo run --example cucg_shard_freeze_isomorphismcargo run --example cucg_skip_if_reliableThe fifth typed cochain for the DEC terrain substrate, plus the SIMD per-edge utility op that consumes it. Closes the spatial-reasoning gap: the existing SafetyCohain / ThreatCohain / OccupancyCohain / DestructionCohain quartet had no slot for notability (fame, reward, attention). Plan 335 adds InterestCohain as a rank-0 cochain — the "f" lane the eggshell matrix was missing — and ships lattice_edge_utility_into, the leaf-clean SIMD hot path that blends all five cochains + NPC HLA state into a per-edge traversal utility.
NPC HLA (5 scalars) 5 typed cochains (rank 0 + rank 1)
┌───────────────┐ ┌──────────────────────────────┐
│ valence │─────────▶│ interest[src] · curiosity_w │
│ calm │─────────▶│ safety[src] · calm_w │
│ fear │─────────▶│ − threat[edge] · fear_w │
│ desperation │─────────▶│ destruction[src]·desp_w │
│ arousal │ │ + occupancy[face]·good_w │
└───────────────┘ └──────────────┬───────────────┘
▼
sigmoid → per-edge utility
│
utility > τ ───▶ emit KG triple
(zone_a, reachable_from, zone_b)
lattice_edge_utility_into takes raw slices (&[f32] cochain data + HlaToCohainWeights), not typed ValidatedZoneView / HlaState handles — this keeps katgpt-core leaf-clean (those consumer types live above the leaf in riir-ai). The inner loop is chunked for auto-vectorization and allocation-free by construction (no Vec/Box/collect/format! in the body).
Plan 335 GOAT (2026-06-25): 8/8 PASS (full results in riir-ai .benchmarks/335_zone_eggshell_goat.md).
| Gate | Target | Result | Verdict |
|---|---|---|---|
| G1 regen determinism | 100% byte-identical | 10/10, pod = 228 bytes | ✅ PASS |
| G4 zero-alloc hot path | 0 heap allocs | by construction (code-review verified) | ✅ PASS |
| G5a cache HIT latency | < 100 ns | 68.8 ns (31% margin) | ✅ PASS |
| G5b cache MISS latency | < 1 ms | 7.45 µs (134× under, post anon-mmap fix) | ✅ PASS |
| G6 two-node convergence | bit-identical | headers + all cochains + eggshell identical | ✅ PASS |
Leaf lattice op throughput: 738.89 Melem/s (649.63 ns for 480 edges on 16×16 grid).
Feature gates: interest_cochain was a DEFAULT-ON tracking flag in katgpt-core from Plan 335 Phase 7 (9330e6cb, 2026-06-25) until 2026-06-28 when the eggshell IP was migrated to riir-neuron-db's private dec_arena module (katgpt-rs Issue 008, commit cb3cb35c) — the katgpt-core/interest_cochain flag no longer exists; interest_cochain is now DEFAULT-ON in riir-neuron-db since 2026-07-17 (b345244, Issue 023 T1). lattice_utility (opt-in — pulls dec_operators, consumer-crate boundary) remains in katgpt-rs. The eggshell coexists with pathfinder.rs A* (zone-level KG reasoning vs tactical single-path movement); it does not dominate or replace A* (G2 framing-corrected — see benchmark). 📖 Plan: riir-ai/.plans/335_zone_eggshell_spatial_lattice.md (riir-ai), GOAT bench: riir-ai/.benchmarks/335_zone_eggshell_goat.md.
Adds a reject_confidence() default method to ConstraintPruner returning a [0,1] sigmoid confidence instead of a hard binary bit, plus a caller-side soft_reject_with_relax pipeline that routes borderline candidates through a relaxation retry instead of hard-failing them. HarnessBridge Table 7 proves tolerant rejection strictly beats strict rejection because false-reject cost > false-pass cost — a wrongly-rejected good candidate is a missed gain, while a wrongly-accepted bad candidate is caught downstream at partial cost.
reject_confidence() soft_reject_decide()
│ │
▼ ▼
sigmoid(β·evidence) ──▶ ≤ τ_low ──▶ Accept (outright)
Truncated — view the full README on GitHub.
Rust
93.2%
Python
6.1%