🦍 Introducing Memorilla: memory as a modality for LLMs
@adibvafa4.1K followers
101,950 views
51 Comments
Comments from the original post on X (Twitter)

@adibvafa
A frozen encoder embeds each document once into a persistent store. Conditioned on the question, 16 memory slots read the store and produce embeddings fed directly into the LLM, like image embeddings. The LLM stays frozen. Only the memory module is trained.
10 likes

@adibvafa
We tested it on personalization, long-document and knowledge QA against full context, RAG, agentic memory and compression methods. Memorilla sits on the Pareto frontier of all 8 benchmarks and leads on 5.
9 likes

@adibvafa
Memorilla also works as an agent's memory. In TextWorld, every turn becomes a new memory, and RL on the game reward trains only the memory module. Compared to in-context learning alone, the same frozen agent solves 24.2% of games instead of 18.6%.
6 likes

@adibvafa
"What are some suitable foods for me to boost my energy during the day?" RAG suggests oats and brown rice. Memorilla remembers the user's iron-deficiency anemia from an old chat, even though that chat has little semantic connection to the question. On PersonaMem-v2 it gets 44.6% vs 30.9% for the next best method.
3 likes

@adibvafa
It's also better at connecting facts. On FactKG, RAG-50 drops from 79% to 52% as a claim combines more facts. Memorilla stays between 80% and 89%.
4 likes

@adibvafa
Memorilla and RAG get different questions right. Their union covers 94.3% of FactKG, vs 84.3% for Memorilla and 78.4% for RAG-50 alone.
4 likes

@adibvafa
Latency stays flat as memory grows. With 512 documents on one H100, Memorilla answers in 0.74 s and full context takes 19.9 s.
4 likes

@adibvafa
It of course has limitations Memorilla can lose fine-grained information, so RAG still wins "who" and "which" questions on NarrativeQA. The memory module is also tied to the LLM it was trained with, and moving to another LLM or a new domain takes some fine-tuning.
4 likes

@adibvafa
Humans have both episodic and semantic memory. If RAG is episodic, Memorilla is semantic. Just like us, LLMs need both. Memorilla isn't perfect, but we see it as a 0→1 change in how LLMs use memory, and we look forward to seeing where the community takes these ideas.
14 likes

@adibvafa
Big thank you the entire amazing team! @Radii2323 @kvignesh1420 @ShayanPardis @nikitamounier @ShirleyYXWu @jure @Stanford Website: Paper: Code: HuggingFace:
10 likes

@b_geist
@jure @Stanford @kvignesh1420 @Radii2323 @ShirleyYXWu @nikitamounier @ShayanPardis nice to see this out !
6 likes

@adibvafa
@jure @Stanford @kvignesh1420 @Radii2323 @ShirleyYXWu @nikitamounier @ShayanPardis thank you for the great support ben!
1 like

@farazdotai
@jure @Stanford @kvignesh1420 @Radii2323 @ShirleyYXWu @nikitamounier @ShayanPardis Very sick, ultra cool, congrats!
3 likes

@adibvafa
@jure @Stanford @kvignesh1420 @Radii2323 @ShirleyYXWu @nikitamounier @ShayanPardis Thank you!

@polymorfaisal
@jure @Stanford @kvignesh1420 @Radii2323 @ShirleyYXWu @nikitamounier @ShayanPardis Adib you legend
2 likes

@adibvafa
@jure @Stanford @kvignesh1420 @Radii2323 @ShirleyYXWu @nikitamounier @ShayanPardis 🔥
1 like

@amirzeinaalii
@jure @Stanford @kvignesh1420 @Radii2323 @ShirleyYXWu @nikitamounier @ShayanPardis sick!
2 likes

@adibvafa
@jure @Stanford @kvignesh1420 @Radii2323 @ShirleyYXWu @nikitamounier @ShayanPardis 🔥

@J_V_V_07
@jure @Stanford @kvignesh1420 @Radii2323 @ShirleyYXWu @nikitamounier @ShayanPardis Cool! In what ways would you adapt Memorilla for biomedical reasoning? [like a bio-specific encoder]
2 likes

@adibvafa
@jure @Stanford @kvignesh1420 @Radii2323 @ShirleyYXWu @nikitamounier @ShayanPardis Haha that is BioReason territory now
1 like




















