Skip to content

Releases: amabito/tri-memory

v0.1.1 -- Mathematical Correctness Hardening

14 Mar 14:22

Choose a tag to compare

Summary

F.R.I.D.A.Y. 3-body parallel review found 34 mathematical bugs across 11 source files. All fixed with 3-round review-fix loop (2 consecutive CLEAN).

Critical (5)

  • omega Nyquist aliasing -- high-k oscillators silently aliased, halving representational capacity
  • alpha tensor reuse in associative_scan -- potential in-place mutation corrupting imaginary decay
  • W=0 all-inf mask producing NaN in SDPA
  • Dead StateTokenAdapter consuming optimizer budget
  • trn_ratio=1.0 (float) treated as int 1 instead of 100% TRN

High (9)

  • L-inf normalization replaced with complex modulus (phase preservation)
  • bf16 latch bug in both forward() and step_single() paths
  • Cumsum double-correction producing O(1) error instead of O(alpha_cum)
  • SafeCumprod backward contract violation
  • gate_bias_init default mismatch (0.85 vs 0.65)
  • PE truncation guard for both forward paths
  • Backward-compat shim for retrieval_temperature rename

Medium/Low (20)

Amplitude gradient vanishing, odd d_model PE, deque.sort() crash, std Bessel correction, assert->ValueError, thread safety docs, and more.

Benchmark (RTX 5090, synthetic data)

Config Params Final Loss Throughput Stability
Toy (d=128, K=64, L=2) 509K 5.5456 93K tok/s std=0.001
TRN-100M (d=512, K=256, L=8) 40.5M 10.3879 6.8K tok/s --

Breaking Changes

  • Existing checkpoints are incompatible due to normalization (H2) and amplitude (M1) changes. Retrain from scratch.
  • retrieval_temperature parameter renamed to retrieval_sharpness (backward-compat shim provided).

v0.1.0 -- initial public release

14 Mar 10:51

Choose a tag to compare

TriMemory v0.1.0

Three-path memory architecture for LLM agents.

What's included

  • TriMemoryEngine: KV window + retrieval index + TRN recurrent state with 3-way softmax gate
  • AgentMemory: Stateful per-token streaming wrapper (save/load across turns)
  • TRNModel: Standalone recurrent model with O(1) memory per step
  • PolicyBench N=10: Document authority QA benchmark (Japanese corporate IT security policy)
  • Config presets: toy (1 KB), trn_100m (16 KB), trn_400m (64 KB), trn_1b (96 KB)

Benchmark highlights

  • Config D (Full) composite: 0.676, D >= max(A,B,C) in 10/10 seeds
  • TRN throughput: 231 tps at T=10,000 (vs 15.5 tps Transformer+KV)
  • TRN state: 8 KB constant (vs 156 MB KV cache at T=10,000)
  • 1,000 agents: 15.6 MB TRN total vs 31 GB KV (fp32)

Known limitations

  • Toy-scale models only (1--100M params). Scaling to 1B+ is untested.
  • TRN selective copy accuracy: 8.8% (vs Transformer 96.2%). Needle-in-Haystack: 0.0.
  • Alpha status. No production deployment.

277 tests. Python 3.10+. PyTorch 2.1+. Apache-2.0.