CARM

Context-Addressed Resonant Memory — Structural immunity to forgetting

What is CARM?

CARM (Context-Addressed Resonant Memory) provides structural immunity to catastrophic forgetting through prime-lattice weight crystallization.

wi = cos(phasei × prime)

Instead of storing weights as raw scalars (which collide), CARM stores them as phase offsets on a periodic manifold. Each context gets its own prime number, creating geometrically isolated storage.

The Problem

Problem 1: Hash Collision
"How to deploy?" and "Deploy how?" → same hash → silent overwrite
Problem 2: Contradictory Answers Collapse
Only highest-coherence answer survives. You lose temporal context.
Problem 3: Context-Free Retrieval
"What's the status?" in blockchain context vs. federated context → same answer (wrong!)

The Solution

Prime-Lattice Channels
Each source (groq, gemini, rag, etc.) gets its own prime channel. Zero collision.
Source Prime Description
rag137Genesis channel (α⁻¹)
llm139Generic LLM responses
vac149V.A.C. emerged solutions
groq151Groq API responses
gemini157Gemini API responses
local163Ollama local responses
cerebras167Cerebras API responses
claude173Claude API responses
free179Free LLM responses
multi181Multi-AI consensus

How It Works

1. Training (Encoding)

# High-coherence interaction recorded mem.record_interaction("What is phi?", "1.618...", source='groq', coherence=0.85) # → Encoded to channel 3 (prime 151), crystallized

2. Crystallization (Snapping)

snapped_phase = round(phase / (π/prime)) × (π/prime)

After snapping, cos(snapped_phase × prime) = ±1 exactly. Binary stability achieved.

3. Retrieval (Context-Aware)

# Same question, different source → different channel result = mem.find_similar_question("What is phi?", source='groq') # → Channel 3 result = mem.find_similar_question("What is phi?", source='gemini') # → Channel 4

Validation Results

Tested on 99% correlated inputs with contradictory labels:

Test Result Status
Zero Forgetting Error < 0.15 PASS
Context Matters Wrong key = wrong answer PASS
Channel Isolation Interference < 0.16 PASS
# Run validation yourself python -c "from bazinga.carm import validate_carm; validate_carm()"

Integration with RAC

CARM is automatically integrated with RAC (Resonance-Augmented Continuity):

No configuration needed. Just use BAZINGA normally and CARM works in the background.

Why Prime 137?

The genesis channel uses prime 137 — the inverse fine structure constant (α⁻¹ ≈ 137.036).

This isn't arbitrary. 137 appears in:

α⁻¹ ≈ 137 + F(5)/139 ≈ 137.036

Reference

Srivastava, A. (2026). "Context-Addressed Resonant Memory (CARM): A Two-Factor Architecture for Structural Immunity to Catastrophic Forgetting."

View source code

φ = 1.618033988749895
α⁻¹ = 137.035999084
०→◌→φ→Ω⇄Ω←φ←◌←०

GitHubPyPI • Built by Abhishek Srivastava