Stanford Just "Solved" AI Memory (Memorilla)

summarized

TLDR

Memorilla, Stanford's new memory method, compresses long chat histories into 16 learned tokens, achieving significant speedups over full context on benchmarks like FactKG (84.3% vs 80.4% with 108x fewer tokens). However, independent tests reveal it loses fine-grained details like exact names and can fabricate personal information, leading the authors to recommend combining it with retrieval rather than using it alone.

Key points

Memorilla compresses document stores into 16 tokens, enabling fast inference (0.74s vs 19.9s for full context on 512 documents).

On the FactKG benchmark, Memorilla scores 84.3% with 108x fewer tokens than full context (80.4%).

Independent tester Gowraths found Memorilla scored zero on a buried clue test and invented facts like shellfish allergies.

On a novel comprehension test, Memorilla got only 1 out of 8 plot questions, while full context got 5 despite seeing only half the book.

The authors suggest combining Memorilla with retrieval, as each method catches different correct answers.

Tools mentioned

Techniques

  • memory compression via learned tokens
  • cross-attention between slots and document vectors
  • embedding averaging
  • three-stage training
Transcript (captions)

0:00 The example that sold me on Stanford's Marilla was a breakfast question answered from 107 old chats packed into 16 memory tokens. If your chatbot hauls its whole chat history into every

0:11 prompt, that's the memory you've wanted. The user in the README never says diabetes runs in the family. Once in one chat, they ask whether diabetes on the mother's side raises the risk more than

0:22 on the father's. Marilla's breakfast advice catches that. Then I read an outside tester's notes on the Hound of the Baskervilles. One of Marilla's answers there, Sir Charles

0:32 Baskerville is the escaped convict. So the call is yours. Replace retrieval with it, run it beside retrieval, or skip it. If 16 tokens can do that, why keep retrieval at all?

0:43 Coverage on the 5th of November had it beating full context on five benchmarks. The paper says something narrower, best among memory methods like mem zero and memo R A G on five of eight. I went

0:55 through the paper, the README and Andreas Gowrat's is public hands-on tests. His runs, not ours. In his runs, the 27 times speed up shrinks to about six once you count one

1:06 step. And on that novel, Marilla got one plot question in eight. How does the same design catch a single diabetes aside then lose track of who the convict is? By the end, you'll know what those

1:16 16 tokens hold, what the 27 times includes, and which of those three calls fits you. Start with the pain it's aimed at. Full context means pasting every document into the prompt.

1:28 In the paper's timing on 1 H 100, the 8 billion can three answers over one document in about three quarters of a second. Over 512 documents, it takes nearly 20 seconds, long enough to wonder

1:39 whether your agent has crashed. Retrieval, the usual workaround, paste in only a handful of matching passages. Marilla pitches a third way. Keep every document but hand the model 16 memory

1:51 tokens built for the question you just asked. I expected that squeeze to cost it clear points on the benchmarks. On the author's own tables, it mostly doesn't. The holds up outside the lab

2:01 too. Gao Rats reproduced the README's breakfast answer almost word for word. On the paper's own numbers, Mamarilla scores 84.3% on FactKG. Full Context with every source document in the prompt

2:15 gets 80.4 and Mamarilla gets there with 108 times fewer tokens. Coverage also quotes 44.6% on a personalization benchmark, Persona Mem V2, against 30.9 for the next best

2:28 method. That sent me to the speed claim next. The README puts Full Context at 27 times slower, 19.9 seconds against 0.74. Gao Rats's final runs from the 13th of November used 512 passages of about 250

2:45 tokens each. That's roughly 128,000 tokens in all on the PCIE version of an H100. Mamarilla's answering held flat at around 0.12 seconds. Full Context

2:57 climbed from 0.37 to 19.33. Then he counted the step that happens before any answer, turning the documents into vectors. With that included, Mamarilla took 3.25 seconds. That's

3:09 about six times faster than Full Context by his numbers. The cost isn't hidden either. In the paper's own table, it sits a couple of rows above the number the README quotes. Whether it's six or

3:20 27 depends on what that step is. So follow one document through Mamarilla. There are two paths. One writes documents into memory and one reads them back when a question arrives. The right

3:31 path comes first. A separate frozen model, the 4 billion Qwen 3 embedding, reads each document once. It produces numbers for every token, then averages them into a single list of 2,569 numbers

3:44 called a vector. One document, one vector, whether it's a two-line chat or a long chapter. Averaging like that is a bit like shrinking a photo down to its average color. A beach and a forest

3:55 still come out different, but you can't read the name on a sign anymore. The picture breaks quickly though. A vector holds far more than one color, so treat it as a hint about what's at risk,

4:05 nothing more. Those vectors pile up in a store. New documents are added without re-encoding the old ones, which is why the paper calls this cost paid once per document.

4:15 If your data is a live chat, you can pay it as each message arrives, rather than when someone asks a question. Your question goes through the same encoder and becomes one vector too. That's the

4:25 step the 27 times leaves out. The paper's table on 1H100 has encoding 512 documents at 2.59 seconds. Add the 0.74 second answer, and you're near 3.3 against 19.9 for full context. Divide

4:42 one by the other, and you land around six, close to what Gau Rats got on a different serving setup, VLLM 0.9.1. Both numbers are fair at different moments. Once your documents are stored,

4:55 the next question only pays for the answer, and 27 times is the right comparison. On the first question over brand new documents, six is. The paper also frames encoding as a cost

5:06 a retrieval index pays anyway, and notes full context speed depends on the serving stack. Now the read path where the 16 tokens come from. Memorilla keeps 16 learned slots, 16 vectors it settled

5:18 on during training. First, the slots take in your question's vector so they know what they're looking for. Then the slots read the store through cross attention. Each slot scores every

5:27 document vector, then pulls in a weighted mix. Two layers of it, eight heads each with all 16 slots reading at once. In principle, that's how a breakfast question can reach a chat that

5:37 never mentions breakfast. Which details a slot keeps and which it drops isn't explained in any primary source. One consequence is easy to miss. The 16 tokens get rebuilt for every question

5:49 because the slots read the question first. What's stored is the document vectors, and the 16 are built fresh from them. Ask about breakfast, then about travel, and the model gets two different

5:59 sets of 16. Last, a size change. A normalization layer and one linear projection stretch each slot from 2,560 numbers to 4,096 the size of one input token for the 8

6:12 billion Quinn three. Those 16 stretched vectors go in front of your question in the positions where words would normally sit. The language model itself doesn't

6:19 change. The paper says no layer or attention mechanism is touched. From the model side, your entire chat history arrives as 16 words it has no spelling for parked just before your question.

6:30 That's also why answering stays fast. The memory module takes about two milliseconds whether the store holds one document or 512. After that, the model reads 16 tokens plus your question. In

6:42 the paper's table, the whole answer takes 740 milliseconds over one document and 739 over 512. Full context reads everything every time. The fixed size cuts both ways a

6:55 two-line chat and a whole novel both come out as 16 tokens. The trainable part is small. The paper counts 194 million parameters and the hugging face card matches against the eight billion

7:07 in the model it feeds call it under two and a half percent. You still run the 4B embedding model next to it. The catch is that it's tied to one model. Checkpoints exist for the eight billion Quinn three

7:18 plus a 4B variant for agents and a newer model means retraining. Training is the step that shapes the slots only the memory module and its projection learned. The loss is scored on the

7:28 answer tokens alone never on the prompt or the memory positions. The module then is graded on one thing whether Quinn's answer comes out right. Whatever the slots learn to grab they grab because it

7:39 helped answer training questions. That training runs in three stages on 4H 100s. First about 1.98 million Wikipedia paraphrase examples then about 1.34 million multitask examples.

7:53 Then the training splits of the eight benchmarks with extra tuning just for Persona Mem V2 and personalization V4. Keep that Persona Mem tuning in mind. It comes up again once the data stops

8:03 looking like Persona Mem. The design holds together 16 slots trained to help one frozen model answer, partly on the training splits of the benchmarks it scored on, which is

8:13 standard. The scores come from held-out test rows. My worry was the obvious one, data that looks nothing like those benchmarks. Gowraths built a test for exactly that, called the Buried Clue. He

8:24 handwrote 150 chats about 29,000 tokens from a made-up username, Sam. Three clues sit inside unrelated chats, nine lookalike chats sit around them, and chat 57 is a control. This is the

8:37 Breakfast Examples home turf, a personal clue buried somewhere unrelated. I expected Memorilla to at least beat retrieval here. It didn't. No memory scored zero out of four. Retrieval

8:48 scored one, and that was only the control. Full context, zero. Memorilla, zero. Using the checkpoint tuned on Persona Mem V2, and Gowraths says the stage three checkpoint without the extra

9:00 Persona Mem tuning behaves the same way. One result surprised me more than Memorilla's. By my count, 29,000 tokens fits inside Quinn's native window of about 41,000.

9:11 So full context likely saw every chat, and it still missed. With every method missing Sam's three clues, the test is simply hard. Memorilla did something else as well, though. It added facts.

9:22 Its answers open with lines like, since you're allergic to shellfish and since you've had a mild ankle sprain, neither appears anywhere in Sam's history, which would be news to Sam. No primary source

9:32 explains why. Gowraths points out that the checkpoint got extra tuning on Persona Mem V2, and the made-up lines sound a lot like that benchmark. Nobody has shown that's the cause. The book

9:43 test raises the stakes. Gowraths split the Hound of the Baskervilles, the Project Gutenberg text, into 364 passages, about 72,000 tokens, and asked eight plot questions.

9:55 The whole novel squeezed into 16 tokens works out to roughly 4 and 1/2 thousand to one. A plot question is the opposite of a buried hint. It wants who did what. Retrieval got four out of eight, full

10:06 context got five, and here it saw only about 55% of the book, because the eight billion Quince-3's native window stops at 40,960 tokens.

10:17 That five is a score on just over half the novel, and it's still the best of the four. Memorilla with that stage three checkpoint got one. The plain model with no memory at all got two.

10:27 On this book, 16 tokens of memory did worse than no notes. The convict answer from the start came out of this run. Before anyone puts that score on a slide, Gawrad flags the limit

10:38 himself. It's four to 10 questions per demo, and he says to read them as behavior, not statistics. Nobody we found has rerun the paper's full benchmark averages either. His runs show

10:49 how it behaves on new data, and the paper's averages stand on the paper's data. Back to the puzzle from the start. The diabetes aside survived the squeeze into

10:58 16 tokens. The convict's name didn't. The best explanation was in the author's own pages. The project page says Memorilla can lose fine-grained details such as exact names. The paper puts that

11:09 down to an encoder that was never trained for memory compression. And on narrative QA, a benchmark of questions about long stories, retrieval with 50 passages leads on who questions

11:20 by 3.45 points, and on which by 2.93. Put that next to the tester's misses. On the author's data, 16 tokens keep links. A breakfast question tied to a worry about family history. On Sam's made-up

11:35 chats, no method found the clues, Memorilla included. And on the book, the 16 tokens didn't keep the name on the sign. That's my reading of the two together, and it's my answer to the

11:45 puzzle. The authors measured the flip side too. On Fact KG, 15.9% of questions were answered by Memorilla alone, and 10% by retrieval alone. On Persona Mem V2 short answers, it's 27.1 against 9.2.

12:01 Count a question is right if either one gets it, and the pair beats each of them on every benchmark. The authors themselves suggest combining Memorilla with retrieval rather than

12:10 replacing it. Their own suggestion is a long way from solved, and it's the one I'd follow. Check the plumbing before you plan anything. It needs open weights because those 16 vectors go straight

12:20 into the model's input. It needs a memory module trained for that exact model, and it's only been tested on Quen models and text. The author's one agent test covers a single text game suite at

12:31 most 50 turns. And one practical note from Galvratz, the pinned software stack won't run on an RTX 5090. My call then. If you're building an assistant or agent with a long personal chat history, add

12:44 Memorilla beside retrieval for the loose hints the breakfast example shows. Run it on a sample of your own chats first. On Sam's, it made facts up. If your history already fits in the prompt, full

12:55 context is the safer default for exact details. On the book, full context scored best while seeing only half of it. Leave anything that needs an exact name, number, or quote to retrieval or

13:06 full context. If your product lives on exact recall, like a support bot quoting order numbers, don't swap retrieval out for it. Invented shellfish allergies are the kind of risk you'd be shipping. And

13:17 when someone quotes 27 times, ask whether the documents were already embedded. The rule fits in two lines. Let Memorilla suggest and let retrieval

13:26 site. Stanford built a fast way to keep the gist of 107 chats in 16 tokens, and the breakfast answer is real. So is Sir Charles Barrymore, escaped convict. That's useful and it's short of solved.

13:39 What I still want to know is whether a checkpoint trained on chats like yours would still invent allergies. If you run Memorilla on your own data, what did it remember and what did it make up?

Frontier News · by Hyperjump Technology