What it is
Memorilla attacks the too-many-documents problem from the other side: instead of growing the context window, it reads a whole collection into a fixed-size memory. A frozen Qwen3-Embedding-4B encodes documents offline, a trainable ~194M-parameter memory module cross-attends between the question and that store, and the result is squeezed into exactly 16 memory tokens projected into a frozen Qwen3-8B decoder. The base model never moves, so the only thing to evaluate is the small module.
Highlights
- 84.33% on FactKG versus 80.43% for stuffing every document into context, using 108x fewer document tokens
- Over 4,000x compression on book-length QA such as NarrativeQA
- 0.74s latency on 512 documents (
- 128k tokens) against 19.9s for full-context prompting
- Lifts a TextWorld agent’s success rate from 18.6% to 24.2% with compressed history
- About 19 hours of training on four H100 80GB GPUs; one 80GB card for inference
How to use
It wants Linux with CUDA and Python 3.11; set up a uv virtualenv and follow the README install. Encode your own document collection offline once, train the memory module through the PersonalizationV4 recipe, then attach it to the frozen decoder. Checkpoints are on Hugging Face, so you can run the evaluation scripts to reproduce the FactKG and NarrativeQA numbers before pointing it at your own data.
License
Released under Apache-2.0. Read the terms before commercial use or redistribution, especially if you plan to offer it as a service.