Skip navigation
🦍 Introducing Memorilla: memory as a modality for LLMs
0:00 / 1:28

🦍 Introducing Memorilla: memory as a modality for LLMs

Adib

@adibvafa4.1K followers

Visit on X
1,011 likesDownloadOriginal post

101,950 views

🦍 Introducing Memorilla: memory as a modality for LLMs Memorilla turns everything a frozen LLM needs to remember into just 16 memory embeddings ⚡ It uses up to 4,212× fewer tokens and is 27× faster than full context inference while more accurate 🎯 Pushes the Pareto frontier over RAG and agentic memory in personalization, long-document and knowledge QA A thread 🧵:

51 Comments

Comments from the original post on X (Twitter)

  • Adib's profile picture

    @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

  • Adib's profile picture

    @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

  • Adib's profile picture

    @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

  • Adib's profile picture

    @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

  • Adib's profile picture

    @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

  • Adib's profile picture

    @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

  • Adib's profile picture

    @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

  • Adib's profile picture

    @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

  • Adib's profile picture

    @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

  • Adib's profile picture

    @adibvafa

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

    10 likes

  • Ben Geist's profile picture

    @b_geist

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

    6 likes

  • Adib's profile picture

    @adibvafa

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

    1 like

  • faraz's profile picture

    @farazdotai

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

    3 likes

  • Adib's profile picture

    @adibvafa

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

  • Faisal AlZaben • فيصل الزبن's profile picture

    @polymorfaisal

    @jure @Stanford @kvignesh1420 @Radii2323 @ShirleyYXWu @nikitamounier @ShayanPardis Adib you legend

    2 likes

  • Adib's profile picture

    @adibvafa

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

    1 like

  • Amir Zeinali's profile picture

    @amirzeinaalii

    @jure @Stanford @kvignesh1420 @Radii2323 @ShirleyYXWu @nikitamounier @ShayanPardis sick!

    2 likes

  • Adib's profile picture

    @adibvafa

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

  • J Vijayavallabh @ NEURIPS 2026's profile picture

    @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

  • Adib's profile picture

    @adibvafa

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

    1 like