Stanford memory gives AI 16 tokens to think with instead of whole piles of documents
The researchers behind Memorilla have built a memory module that compresses a large collection of text into 16 small units a language model can use. According to the authors, it beats several competing methods, but the figures have not been independently verified.

When you want an AI to remember something from long conversations or large documents, the simple solution is to give it everything at once. That is expensive and slow. Now researchers affiliated with Stanford have built a different solution, called Memorilla.
How it works
Memorilla reads an entire collection of documents, such as a user's past chats or a long book. The documents are converted once into numerical representations (embeddings) that can be reused. A memory module then learns to retrieve exactly the information each individual question requires.
The result is 16 memory tokens for the language model to work with. A token is a small chunk of text that language models operate on. The language model itself is frozen, so its weights do not change. Only the memory module is trained.
The results
According to the authors, Memorilla achieves the best results on five of eight benchmarks covering personalization, long documents and knowledge-intensive question answering. They compare against Mem0 and MemoRAG, among others.
On the FactKG test, Memorilla reached 84.33 percent accuracy, compared with 80.43 percent when the model was given the full context. It did so with 108 times fewer tokens to represent the source documents. In TextWorld, agents' success rate rose from 18.6 to 24.2 percent.
According to the code repository, response time is roughly 0.74 seconds regardless of the collection's size, compared with 19.9 seconds with full context. That is about 27 times faster.
Independent coverage on RuntimeWire reports that Memorilla scored 44.6 percent on PersonaMem-v2, compared with 30.9 percent for the next-best method.
All figures come from the authors' own tests and have not been independently verified.
Open source
The work was written by seven researchers, including Adibvafa Fallahpour, Parsa Idehpour, Vignesh Kothapalli, Nikita Mounier, Shirley Wu, Shayan Pardis and Jure Leskovec.
The code is openly available under the Apache 2.0 license. The PersonalizationV4 benchmark is released under CC BY 4.0, and the underlying datasets keep their own licenses. Trained models are available on Hugging Face and use Qwen3-8B as the language model and Qwen3-Embedding-4B to convert text into embeddings.
It does require heavy hardware, though: Linux with a CUDA graphics card, tested on an NVIDIA H100 with 80 GB, plus Python 3.11. For ordinary users, then, it is a research tool, not something you install on your laptop. But it suggests that AI memory may not have to mean stuffing everything into the model every time.
Read also


