Qwen3.5-0.8B-NestedMemory-L18-v4

One unified model: Qwen3.5-0.8B (frozen) + a NestedMemoryLayer after decoder layer 18 that writes facts into its own weights while you chat and reads them back later. All control is learned neural gates (no RAG, no retrieval code).

Status: research checkpoint. v4 copies arbitrary new values from memory, even with sentence patterns never seen in training, and survives a few interfering chats. But having memory loaded hurts normal conversation (general-knowledge accuracy 92% → 71%, the remembered value leaks into unrelated answers 17% of the time), and it still fails a full 90-day / ~30-session life. Read the limitations before using it.

Files

file variant
unified_nested_L18_v4_atlas_wide_blank.pt (recommended) shift-key Atlas memory (poly 24, Omega 16, Muon), d_mem 512
unified_nested_L18_v4_atlas_blank.pt same, d_mem 256

Both: best held-out checkpoint at step 5600 of an 8000-step run (the run was cut at ~5900 by a cloud incident). Warm-started from v3_atlas. Code in code/ (train_v4.py trainer, eval_v4_ood.py, eval_chat_return.py, eval_nested.py).

import torch
from config import ProjectConfig
from Model.qwen_memory import QwenMemoryWrapper
from train_nested import variant_options

cfg = ProjectConfig(dtype=torch.bfloat16, **variant_options("v4_atlas_wide"))
w = QwenMemoryWrapper(cfg=cfg, memory_type="nested")
w.model.load_state_dict(torch.load("unified_nested_L18_v4_atlas_wide_blank.pt"), strict=False)
w.memorize_text("ผมตั้งชื่อเกมเซฟว่า BQpXvjHA")
w.end_session(); w.memory.forget(days=2)
print(w.generate("ผมตั้งชื่อเกมเซฟว่าอะไร", update_memory=False))   # -> ชื่อเกมเซฟของคุณคือ BQpXvjHA ครับ

What changed from v3

  • Training data: public memory datasets converted to tell → (interference) → ask episodes: iapp_wiki_qa_squad (Thai Wikipedia QA), bAbI (state tracking), MSC chit-chat as interference, a RULER-style generator of random key → random value (Latin / Thai characters / digits / codes, updates), plus the v3 synthetic + life episodes.
  • Multi-session training: half of the episodes get 1-3 interfering sessions (each consolidated, with day gaps) between telling and asking.

Results

"wiped" = the same model asked the same question after reset_memory() → what it can answer without memory.

1. OOD test — sentence patterns never used in training (600 items, half with 3 interfering sessions)

Built after an external test report showed v3 failed on new phrasings. Tell/ask templates verified absent from the training code (eval_v4_ood.py).

type (example) v4_atlas_wide immediate after 3 other sessions v4_atlas immediate wiped
odd string (รหัสเข้าบ้านหลังใหม่คือ vSphMSXU) 82% 64% 72% 0%
number (บ้านเลขที่ของผมคือ 57003) 63% 47% 63% 0%
pet name that is a real word (หมาที่บ้านผมชื่อเจ้าลูกชิ้น) 60% 35% 63% 0%
name, new pattern (เรียกผมว่า ธนพล ก็ได้นะ) 51% 22% 46% 0%
foreign name (หัวหน้าใหม่ของผมชื่อ Xanthippe) 32% 19% 35% 0%
province (แฟนผมเป็นคนจังหวัดบึงกาฬ) 30% 26% 30% 0%
all 48.2% 46.7% 0%

(The "immediate" column includes the interfered items of that type; English-only sentences mostly fail.)

2. Real life-dataset, short protocol (val, 222 questions)

version all wiped name occupation
v2 5.1% 2.3% 0% 0%
v3_atlas 40.5% 1.8% 36% 68%
v4_atlas 53.2% 2.7% 54% 85%
v4_atlas_wide 59.9% 2.3% 61% 91%

Life-event questions remain weak (episode detail 0-18%, temporal 10%, multi-hop 11%).

3. Chat, then come back (eval_chat_return.py, 40 conversations × 2 modes)

Tell a fact → 3-7 turns about other things (general questions, small talk; memory keeps writing) → sometimes ask the fact midway → come back to it at the end.

new chat every turn (memory only) one continuous chat
fact recalled midway 67% 74%
fact recalled at the end 60% (wiped: 0%) 73%*
general-knowledge answers correct 71% (original Qwen: 92%) 67% (original Qwen: 93%)
remembered value leaks into unrelated answers 17% 18%

* in a continuous chat the fact is also in the context window.

Observed failures: คำว่าแมวในภาษาอังกฤษคืออะไร → คำว่า ปลาทูครับ (the cat's name), small talk answered in the memory template (วันนี้เหนื่อยมาก ทำไงดี → คุณยังไม่เคยบอกเรื่องนี้กับผมเลยครับ), very short answers. Cause: training was dominated by memory questions with short answers; general behaviour was only protected by a KL term on a few general prompts.

4. Full life simulation (19 unseen lives, 90 days, ~30 sessions)

with memory wiped name occupation
v4_atlas_wide 8.2% 5.9% 0% 0%
v4_atlas 8.2% 7.1% 0% 5%

Not solved: training covered ≤ 3 interfering sessions; after ~30 sessions the stored facts are overwritten.

5. Held-out checks during training (20 items each, test splits)

step random-value copy (now / after 3 sessions) synthetic facts (now / after 3 sessions) bAbI (wiped 10%) iapp Thai Wikipedia
0 (= v3_atlas) 0% / 0% 90% / 10% 0% 0%
2400 30% / 25% 75% / 85% 35% 0%
5600 (published) 60% / 40% 100% / 100% 20-25% 0-5%

Normal (256) vs wide (512) memory: almost identical on every test — capacity is not the bottleneck.

Limitations (honest summary)

  1. Memory hurts general chat (−21 to −26 points on general knowledge, value leakage 17%). Fix in progress (v4.1): ~40% general / small-talk episodes with full-answer KL to the original Qwen, and a penalty for leaking memory.
  2. Long lives fail (~30 sessions): needs many-session training / better consolidation into long-term slots.
  3. Long values sometimes loop (VAxCQgWkqgWkq...); English-only tells mostly fail; "never told" is sometimes said for facts that were told.
  4. Thai Wikipedia reading-comprehension (paraphrased questions) ~0%: this memory recalls what followed a context, it does not paraphrase.

Previous: v3, v2, v1.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Jommarn/Qwen3.5-0.8B-NestedMemory-L18-v4

Finetuned
(1,065)
this model

Datasets used to train Jommarn/Qwen3.5-0.8B-NestedMemory-L18-v4