Qwen3.5-0.8B-NestedMemory-L18-v2 (research checkpoints)
Status: experimental β memory retrieval does NOT work yet. Published for reproducibility. Recall of a newly told name/occupation is 0% for every variant.
One unified model: Qwen3.5-0.8B with a NestedMemoryLayer injected after decoder layer 18. The layer writes to its own weights at inference time and reads them back, all with learned neural gates (no retrieval code / RAG):
- fast memory β Titans-style linear associative memory
M(delta rule + momentum + forget gate), per-tokengate_write/gate_read - episodic buffer β top-64 tokens by write gate
- long memory β
consolidate()at session end moves buffer cues into routed slots (MoE, softmax read), gated bygate_consol - forgetting β
forget(days)Ebbinghaus-style decay between sessions
Files
| file | variant |
|---|---|
unified_nested_L18_v2_blank.pt |
base (d_mem 256, 4 inner steps) |
unified_nested_L18_v2_base_lora_blank.pt |
base + LoRA phase 2 (merged) |
unified_nested_L18_v2_atlas_blank.pt |
Atlas: polynomial features (24), Omega window 16, Muon |
unified_nested_L18_v2_atlas_lora_blank.pt |
Atlas + LoRA (merged) |
unified_nested_L18_v2_wide_blank.pt |
wide: d_mem 512 |
unified_nested_L18_v2_wide_lora_blank.pt |
wide + LoRA (merged) |
Each is a full state_dict (Qwen + memory layer, memory blank). Code is in code/.
import torch
from config import ProjectConfig
from Model.qwen_memory import QwenMemoryWrapper
from train_nested import variant_options
v = "atlas" # base | atlas | wide | *_lora
cfg = ProjectConfig(dtype=torch.bfloat16, **variant_options(v))
w = QwenMemoryWrapper(cfg=cfg, memory_type="nested")
w.model.load_state_dict(torch.load("unified_nested_L18_v2_atlas_blank.pt"), strict=False)
Results (val+test, 19 unseen lives, life-simulation protocol)
| variant | with memory | memory wiped | name | occupation | "never told" (mem / wiped) | gate_write on questions | gate_read on general Qs |
|---|---|---|---|---|---|---|---|
| base | 2.4% | 5.9% | 0% | 0% | 5.3% / 52.6% | 0.115 | 0.005 |
| base_lora | 6.5% | 6.5% | 0% | 0% | 42.1% / 47.4% | 0.101 | 0.004 |
| atlas | 10.0% | 5.9% | 0% | 0% | 84.2% / 52.6% | 0.094 | 0.003 |
| atlas_lora | 10.6% | 4.1% | 0% | 0% | 84.2% / 31.6% | 0.103 | 0.003 |
| wide | 10.6% | 5.9% | 0% | 0% | 84.2% / 52.6% | 0.103 | 0.003 |
| wide_lora | 11.2% | 5.3% | 0% | 0% | 79.0% / 36.8% | 0.112 | 0.003 |
What works: write gate closes on questions; read gate stays closed on general knowledge (base Qwen knowledge preserved).
What does not: retrieving stored facts. Gains come only from answering "never told". wide_lora shows repetition.
Likely cause: memory keys and values come from the same token, so the query at "your name is ___" has no key that points to the name. Next version: shifted keys / short causal conv (as in Titans), random names per step, synthetic recall curriculum.
Previous version: Jommarn/Qwen3.5-0.8B-NestedMemory-L18.