This document describes the research project that led to sdr-memory.
Investigate whether a small model (trainable on consumer GPU hardware) can learn to encode experiences in compressed representations and reconstruct them by context -- similar to how human memory works.
Can a neural network learn to RECONSTRUCT memories from compressed representations triggered by context, rather than simply searching a database?
- DNA stores instructions, not data. Genes activate by context signals.
- Human memory is associative, reconstructive, lossy-but-meaningful.
- Current AI "memory" (RAG, vector DB, flat files) is primitive file search.
- NVIDIA T1000 8GB (FP32 only -- FP16 is 4.2x slower)
- Intel i7-13700T, 31GB RAM
- Ollama available for 7B models (inference + QLoRA fine-tune)
- Python 3.10+ via
uv run python - PyTorch for training, HuggingFace for tokenizers/models
- All experiments save JSON results to
results/
Hopfield network sharpening over TF-IDF latent space provided modest improvements over raw cosine similarity baseline.
Dual-encoder MLP with InfoNCE loss learned effective query/key embeddings that outperformed TF-IDF on semantically similar but lexically different pairs.
Pre-trained MiniLM embeddings + Hopfield sharpening achieved the best absolute retrieval metrics.
Weighted fusion of lexical (TF-IDF) and semantic (MiniLM) scores, with alpha tuned on validation, often beat either method alone.
Multi-head classifiers recovered semantic attributes (entity, status, cause, action, urgency) from a 32D bottleneck well above chance level, even with corrupted input. This supports the thesis that memories can be meaningfully reconstructed from compact encodings.
Sparse 4096-bit SDR vectors (random projection + k-WTA + Hamming) achieved 92% top-1 vs 81% for dense 32D (PCA + cosine) on noisy query retrieval with 1600 memories.
The SDR approach was selected for the production daemon because it offers the best combination of:
- Zero external dependencies (no GPU, no embedding model)
- High retrieval accuracy on the target memory sizes
- Deterministic, interpretable behavior
- Sub-millisecond search latency
The research experiments are preserved in examples/research/ for
reproducibility and further investigation.
- Every hypothesis must be testable with current hardware
- Every experiment must produce measurable results (JSON + plots)
- Negative results are documented -- they are findings, not failures
- No over-engineering: simplest approach first, iterate