nuonuo/doc/exp02_associative_recall.md
Fam Zheng d923aa1e31 NuoNuo: Hippocampal memory module prototype
Hopfield + Hebbian hybrid memory system for LLMs.
Two nights of experiments (16 iterations), validated on LongMemEval (ICLR 2025).

Architecture:
- Single-hop: Two-Stage Hopfield (NN top-20 → softmax settle)
- Multi-hop: Hebbian W matrix with WTA pattern separation
- 64% on LongMemEval (500 questions), retrieval-only, no LLM dependency
- 4ms latency @ 20K memories, ~1GB VRAM

Key findings:
- Hopfield attention solved noise tolerance (20% → 100% vs flat Hebbian)
- WTA pattern separation enables 20K+ capacity
- Multi-hop associative chains (6 hops, CosSim=1.0) — RAG can't do this
- MiniLM-L6 is optimal (discrimination gap > absolute similarity)
- Paraphrase cue augmentation: 55% → 100% on synthetic, 36% → 64% on benchmark
- SNN encoder viable (CosSim 0.99) but not needed for current architecture
2026-04-07 10:37:24 +01:00

69 lines
3.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 实验2STDP / Hebbian Associative Recall
## 系列实验总结
### 2a: 原始 STDP完全失败
- **问题**: W 初始化为 0 → 无脉冲 → STDP 不触发 → W 保持为 0鸡生蛋死循环
- **教训**: STDP 学习不能依赖网络自身产生 post-spikes必须 teacher forcing
### 2b: 修复后的 STDP + 直接 Hebbian
- **Direct Hebbian**: 1 对完美CosSim=1.0但多对时交叉干扰严重10 对 Disc=0.007
- **STDP v2**: 比 Hebbian 差LIF 阈值非线性扭曲输出
- **根因**: 随机 spike pattern 不够正交pattern 重叠导致灾难性干扰
### 2c: Pattern Separation突破性进展
- 引入 Winner-Take-All 模式分离(类比齿状回 dentate gyrus
- **结果**: code=16384, k=20 时,**2000 对记忆完美召回**Disc=0.999
- 500 对记忆Correct=1.0, Wrong=0.001
### 2d: 鲁棒性与容量
- **容量**: 20,000 对记忆仍然完美code=16384, k=20
- **Partial cue**: 30% 缺失仍 100% 召回50% 缺失 86% 准确
- **噪声**: ⚠️ 致命弱点——noise_std=0.1 就崩溃到 9% 准确率
- WTA 对输入微扰极其敏感(改变 top-k 排序)
### 2e: 抗噪方案
- **Soft WTA**: 虽然 CosSim 高但 discrimination=0所有 pattern 都一样,无法区分)
- **Multi-probe**: 完全失败
- **Coarse-to-fine**: noise≤0.2 完美,本质上是 NN lookup + Hebbian recall
- **Wider k**: 略有改善但不根本
### 2f: Learned Separator
- 随机 embedding 上训练失败pos_match ≈ neg_match
- 原因随机高维向量没有语义结构contrastive loss 无法学到有意义的分离
- **需要真实语义 embedding 才能验证**
### 2g: Multi-hop 联想(核心卖点)⭐⭐
- **A→B→C→D→E→F→G (6跳): CosSim=1.0**,完美链式联想
- 100 条长度为 4 的链300 个 pair零干扰
- 收敛链A→C, B→C: 两条路径都完美到达 C
- 发散链A→B, A→C: 自然产生 50/50 混合——符合生物记忆行为
- **这是 RAG 无法实现的能力**RAG 只能做单跳 NN 检索
## 架构决策
### 确定的方案
1. **Pattern Separation**: WTAcode_dim=16384, k=20是核心组件
2. **Hebbian Outer-Product**: 存储机制(不是 STDP trace-based
3. **Multi-hop**: 通过权重矩阵链式乘法实现
4. **容量**: 20K+ 记忆毫无压力
### 待解决
1. **噪声容忍**: 实际使用需要 coarse retrievalNN lookup辅助
- 或者: learned separator 在真实语义 embedding 上可能 work
2. **STDP 的角色**: 在此架构中,直接 Hebbian 比 STDP 好
- STDP 可能在 consolidationexp03中找到位置
3. **SNN 的角色**: encoder/decoder 验证通过,但 memory core 更适合 rate-based
- SNN 的价值在于: temporal encoding + neuromorphic hardware + consolidation dynamics
## 关键数字
| 指标 | 数值 |
|------|------|
| 最大容量 (code=16384, k=20) | >20,000 memories |
| 单跳召回精度 (clean cue) | 1.0000 |
| 多跳召回精度 (6 hops) | 1.0000 |
| 噪声容忍 (noise=0.1) | ❌ 0.09 exact rate |
| Partial cue 容忍 (30% missing) | ✅ 100% |
| Weight matrix 内存 | 16384² × 4B = 1GB |