Initial release of Tablinum-Loop: TBLR v1 34-table hierarchical router (210M passages), EngramBench atom shards, and Mode A/B prototypes
3f51d96 verified |
Download ARCHITECTURE.md from tablinum/tablinum-loop: direct link, hf CLI and curl.
- Browser
- Download file 5.03 kB
-
https://huggingface.co/datasets/tablinum/tablinum-loop/resolve/main/ARCHITECTURE.md
- Command line
-
hf download hf://datasets/tablinum/tablinum-loop/ARCHITECTURE.md
-
curl -L -o ARCHITECTURE.md https://huggingface.co/datasets/tablinum/tablinum-loop/resolve/main/ARCHITECTURE.md
5.03 kB
Tablinum-Loop (schema: 2): Scalable External Engram Architecture for Looped MoE Models
Why Tablinum-3 (schema: 1) Bottlenecks on Looped Models
Tablinum-3 + terrabeam 0.3 uses single-shot pre-turn retrieval (Pool::Global across N tables, injecting k=3 full passages before generation). While effective for single-pass models, it hits four structural bottlenecks as table counts grow and models loop:
- Loop Prefill Amplification: Every token injected into the prompt traverses all
Llayers pluspasses − 1extra executions of the looped band (L12–19 ×2on Moon-Beam 2 =+33%attention & MoE prefill compute per retrieved token). - Linear Table Scaling (
O(N)):Pool::Globalpulls8vector candidates +1BM25 hit from every table (9 × Ncandidates). Scaling from29tables to100+domain tables pushes cross-encoder reranking latency into multiple seconds per query. - Distractor Overload: Past engram ablations (
engram-knowledge-tables) showed injectingk=5full passages degraded AA-Omniscience from8.0down to0.5because off-target context lures small/quantized experts into near-miss hallucinations. - No Loop / Multi-Format Metadata:
schema: 1has no fields for looped band geometry (band,passes,reenter,per_pass_cache), adaptive early exit, or non-GGUF hardware formats (mlx,nvfp4,npu,pytorch_loop).
Four Pillars of Tablinum-Loop (schema: 2)
1. Hierarchical Centroid Table Router (domain_router.npz / .bin)
- Offline: Run
k-means(K=8centroids per table) on each table's256-dimensionalstatic-retrieval-mrl-en-v1embeddings and pack them into a tiny contiguous matrix[N × K, 256](~82 KBper10tables,<1 MBfor100tables). - Online: Single BLAS dot product (
q @ C.T) scores allNtables in<0.2 msCPU time and routes only to the top-M=5tables (plus fallback lexical triggers). - Scaling: Keeps IVF + BM25 + MiniLM cross-encoder cost strictly
O(1)inN(~45candidates regardless of whether the pack has20or200tables).
2. Atom-Then-Expand Shards (atoms.parquet)
- Instead of injecting three
200–350token passages upfront, each passage (pid) is indexed alongside distilled40–80token fact atoms (atom_id -> pid). - Pass 1 reads compact atoms (
~150tokens total instead of~900tokens — cutting looped prefill overhead by 6× and suppressing off-target distractors). - Pass 2 only calls
expand(pid)for the 1–2 passages the model actually cites or queries.
3. Mode A — Two-Stage Engram-Loop with Early Exit (Deployable Today on terrabeam + llama.cpp)
Runs directly over any OpenAI-compatible llama-server / terrabeam backend:
- Pass 1 (Fast Draft & Confidence Check): Model evaluates the user prompt (thinking off / short budget) with zero retrieval (
0extra engram tokens) and outputs either a high-confidence direct answer (confidence >= 0.85→ Early Exit, skipping both retrieval and Pass 2) OR1–2crisp targeted micro-queries (<query>...</query>). - Hierarchical Fetch:
HierarchicalTableRouterselects the top-Mtables andAtomStorefetches compact Pass-1 atoms (and optional expanded parent passages). - Pass 2 (Grounded Synthesis): Full thinking-ON synthesis grounded on retrieved evidence, preserving canonical reasoning traces.
4. Mode B — Mid-Band Hidden-State Engram Bridge (Zero Extra Context Tokens)
For native PyTorch / future llama.cpp loop execution inside loopmb.LoopBand:
- After Pass 1 exits
L19(hidden_size = 1536), a tiny projection headW_q: 1536 → 256maps the current token's hidden representation directly into normalizedstatic-retrieval-mrl-en-v1/ IVF-SQ8 space. - Top-
k=4retrieved passage/entity embeddings[K_mem, V_mem]are mixed via zero-initialized cross-attention (reenter_engram_up = 0at initialization, guaranteeing exact mathematical identity at step 0) into Pass 2's re-entry state beforeL12–19execute a second time. - Because knowledge enters directly between Pass 1 and Pass 2 inside the latent stream, zero retrieved context tokens enter the KV/KDA cache.
terrabeam 0.4 Rust Crate Touchpoints (~/optane-llm/terrabeam)
| Component | Target File | Change |
|---|---|---|
| Table Router | crates/engram/src/router.rs |
Memory-map domain_router.bin ([N×K, 256]), select top-M table IDs via SIMD dot product before Engram::retrieve() |
| Atom Expander | crates/engram/src/passages.rs |
Optional atoms.parquet lookup + expand_pid(pid) endpoint |
| Adaptive Loop Proxy | crates/terrabeam/src/proxy.rs |
Implement loop_policy: pass1_draft_pass2_verify with early-exit threshold and /v1 X-Tablinum-Loop telemetry header |
| Multi-Format Manifest | crates/terrabeam/src/manifest.rs |
Parse schema: 2 (loop, formats, engram.routing, engram.granularity) while staying backwards-compatible with schema: 1 |