<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
  <title>Paper TL;DR · Avinash Gosavi</title>
  <subtitle>Plain-language summaries of papers on AI memory, retrieval and systems — what each one says, why it matters, and its caveats.</subtitle>
  <id>https://www.avinashgosavi.com/feed/paper-tldr.xml</id>
  <link href="https://www.avinashgosavi.com/feed/paper-tldr.xml" rel="self" type="application/atom+xml"/>
  <link href="https://www.avinashgosavi.com/series/#paper-tldr" rel="alternate" type="text/html"/>
  <updated>2026-10-20T15:45:00+00:00</updated>
  <author><name>Avinash Gosavi</name><uri>https://www.avinashgosavi.com/</uri></author>
  <entry>
    <title type="html">Paper TL;DR: RAG — The Paper That Named Retrieval-Augmented Generation</title>
    <link href="https://www.avinashgosavi.com/post/paper-tldr-retrieval-augmented-generation/" rel="alternate" type="text/html" title="Paper TL;DR: RAG — The Paper That Named Retrieval-Augmented Generation"/>
    <id>https://www.avinashgosavi.com/post/paper-tldr-retrieval-augmented-generation/</id>
    <published>2026-10-20T15:45:00+00:00</published>
    <updated>2026-10-20T15:45:00+00:00</updated>
    <category term="Research"/>
    <category term="Agent memory"/>
    <summary type="html">A plain-language TL;DR of Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks (Lewis et al., 2020): a language model paired with a searchable Wikipedia index, trained together, and why you can update what it knows by swapping the index.</summary>
    <content type="html" xml:base="https://www.avinashgosavi.com/post/paper-tldr-retrieval-augmented-generation/">&lt;p&gt;&lt;strong&gt;Paper:&lt;/strong&gt; Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Küttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, Sebastian Riedel &amp;amp; Douwe Kiela (Facebook AI Research, University College London, New York University), &lt;a href=&quot;https://arxiv.org/abs/2005.11401v4&quot;&gt;&lt;em&gt;Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks&lt;/em&gt;&lt;/a&gt; (arXiv, 2020; revised 2021)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One-line TL;DR:&lt;/strong&gt; Instead of hoping a language model memorized the right fact, give it a search step: look up a few relevant Wikipedia passages, generate the answer from them, and train the search and the writer together.&lt;/p&gt;

&lt;h2 id=&quot;the-question&quot;&gt;The question&lt;/h2&gt;

&lt;p&gt;By 2020, large language models clearly stored a lot of facts in their weights. But the paper points out the downsides: that knowledge is hard to expand or revise, the model can’t show where an answer came from, and it can hallucinate. Earlier hybrid models that paired a language model with a retriever (REALM and ORQA) had only been tried on &lt;em&gt;extractive&lt;/em&gt; question answering — pulling answer spans out of passages rather than writing new text. This paper asks whether one general recipe can combine the two: a model that retrieves documents &lt;em&gt;and&lt;/em&gt; generates free-form answers, fine-tuned end to end for many different tasks.&lt;/p&gt;

&lt;h2 id=&quot;how-it-works&quot;&gt;How it works&lt;/h2&gt;

&lt;p&gt;The paper splits knowledge into two kinds of memory:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Parametric memory&lt;/strong&gt; — what’s baked into the model’s weights. Here that’s BART-large, a pre-trained sequence-to-sequence generator.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Non-parametric memory&lt;/strong&gt; — an external index you can search. Here that’s a December 2018 Wikipedia dump cut into 100-word chunks (about 21 million of them), each turned into an &lt;a href=&quot;/post/agent-memory-glossary/#embedding&quot;&gt;embedding&lt;/a&gt; by a BERT document encoder from DPR (Dense Passage Retrieval). The vectors live in a FAISS index using an &lt;a href=&quot;/post/agent-memory-glossary/#hnsw&quot;&gt;HNSW&lt;/a&gt; approximation, so lookups stay fast.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At question time, a second BERT encoder turns the input into a query vector, the index returns the &lt;a href=&quot;/post/agent-memory-glossary/#top-k-retrieval&quot;&gt;top-k&lt;/a&gt; passages, and BART generates an answer conditioned on the input plus each passage. Nobody labels which passage is “right”: the retriever learns only from whether the final answer comes out well.&lt;/p&gt;

&lt;p&gt;Two variants decide how the passages get combined:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;RAG-Sequence&lt;/strong&gt; uses the same passage for the whole answer, then weighs the answers it would give for each passage.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;RAG-Token&lt;/strong&gt; can lean on a different passage for each word, so one answer can stitch together facts from several documents.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One practical shortcut: only the query encoder and the generator are trained. The document encoder — and so the whole 21-million-vector index — stays frozen, because re-embedding Wikipedia during training is expensive. The authors report they didn’t need that step for strong results.&lt;/p&gt;

&lt;figure class=&quot;diagram&quot;&gt;
&lt;svg viewBox=&quot;0 0 360 428&quot; role=&quot;img&quot; aria-labelledby=&quot;rag-dg-title rag-dg-desc&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
  &lt;title id=&quot;rag-dg-title&quot;&gt;How RAG retrieves, then generates&lt;/title&gt;
  &lt;desc id=&quot;rag-dg-desc&quot;&gt;The input goes to a BERT query encoder, which turns it into a query vector. The vector searches a FAISS index of about 21 million 100-word Wikipedia chunks from December 2018, whose document encoder stays frozen. The top-k passages go to a BART generator, the model&apos;s parametric memory, which writes the answer. The only training signal is whether the final answer is right, and it updates just the query encoder and the generator. The index can be swapped for one built from a 2016 Wikipedia dump, which changes what the model knows without retraining.&lt;/desc&gt;
  &lt;defs&gt;
    &lt;marker id=&quot;rag-dg-arrow&quot; viewBox=&quot;0 0 10 10&quot; refX=&quot;9&quot; refY=&quot;5&quot; markerWidth=&quot;7&quot; markerHeight=&quot;7&quot; orient=&quot;auto-start-reverse&quot;&gt;
      &lt;path class=&quot;dg-head&quot; d=&quot;M0 0 L10 5 L0 10 z&quot; /&gt;
    &lt;/marker&gt;
  &lt;/defs&gt;
  &lt;rect class=&quot;dg-pill&quot; x=&quot;22&quot; y=&quot;8&quot; width=&quot;268&quot; height=&quot;40&quot; rx=&quot;20&quot; /&gt;
  &lt;text class=&quot;dg-body&quot; x=&quot;156&quot; y=&quot;33&quot; text-anchor=&quot;middle&quot;&gt;Input: a question or claim&lt;/text&gt;
  &lt;line class=&quot;dg-line&quot; x1=&quot;156&quot; y1=&quot;48&quot; x2=&quot;156&quot; y2=&quot;70&quot; marker-end=&quot;url(#rag-dg-arrow)&quot; /&gt;
  &lt;rect class=&quot;dg-box&quot; x=&quot;22&quot; y=&quot;72&quot; width=&quot;268&quot; height=&quot;48&quot; rx=&quot;8&quot; /&gt;
  &lt;text class=&quot;dg-strong&quot; x=&quot;156&quot; y=&quot;93&quot; text-anchor=&quot;middle&quot;&gt;Query encoder&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;156&quot; y=&quot;111&quot; text-anchor=&quot;middle&quot;&gt;BERT · trained&lt;/text&gt;
  &lt;line class=&quot;dg-line&quot; x1=&quot;156&quot; y1=&quot;120&quot; x2=&quot;156&quot; y2=&quot;152&quot; marker-end=&quot;url(#rag-dg-arrow)&quot; /&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;166&quot; y=&quot;141&quot;&gt;query vector&lt;/text&gt;
  &lt;rect class=&quot;dg-group&quot; x=&quot;10&quot; y=&quot;154&quot; width=&quot;292&quot; height=&quot;124&quot; rx=&quot;12&quot; /&gt;
  &lt;text class=&quot;dg-label&quot; x=&quot;22&quot; y=&quot;174&quot;&gt;Non-parametric memory&lt;/text&gt;
  &lt;rect class=&quot;dg-box&quot; x=&quot;22&quot; y=&quot;184&quot; width=&quot;112&quot; height=&quot;62&quot; rx=&quot;8&quot; /&gt;
  &lt;text class=&quot;dg-strong&quot; x=&quot;78&quot; y=&quot;206&quot; text-anchor=&quot;middle&quot;&gt;Wikipedia&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;78&quot; y=&quot;224&quot; text-anchor=&quot;middle&quot;&gt;Dec 2018 dump&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;78&quot; y=&quot;240&quot; text-anchor=&quot;middle&quot;&gt;~21M chunks&lt;/text&gt;
  &lt;line class=&quot;dg-line&quot; x1=&quot;140&quot; y1=&quot;215&quot; x2=&quot;172&quot; y2=&quot;215&quot; marker-start=&quot;url(#rag-dg-arrow)&quot; marker-end=&quot;url(#rag-dg-arrow)&quot; /&gt;
  &lt;rect class=&quot;dg-box dg-muted&quot; x=&quot;178&quot; y=&quot;184&quot; width=&quot;112&quot; height=&quot;62&quot; rx=&quot;8&quot; /&gt;
  &lt;text class=&quot;dg-strong&quot; x=&quot;234&quot; y=&quot;206&quot; text-anchor=&quot;middle&quot;&gt;Wikipedia&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;234&quot; y=&quot;224&quot; text-anchor=&quot;middle&quot;&gt;2016 dump&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;234&quot; y=&quot;240&quot; text-anchor=&quot;middle&quot;&gt;no retraining&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;156&quot; y=&quot;266&quot; text-anchor=&quot;middle&quot;&gt;FAISS + HNSW · document encoder frozen&lt;/text&gt;
  &lt;line class=&quot;dg-line&quot; x1=&quot;156&quot; y1=&quot;278&quot; x2=&quot;156&quot; y2=&quot;310&quot; marker-end=&quot;url(#rag-dg-arrow)&quot; /&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;166&quot; y=&quot;299&quot;&gt;top-k passages&lt;/text&gt;
  &lt;rect class=&quot;dg-box&quot; x=&quot;22&quot; y=&quot;312&quot; width=&quot;268&quot; height=&quot;48&quot; rx=&quot;8&quot; /&gt;
  &lt;text class=&quot;dg-strong&quot; x=&quot;156&quot; y=&quot;333&quot; text-anchor=&quot;middle&quot;&gt;Generator&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;156&quot; y=&quot;351&quot; text-anchor=&quot;middle&quot;&gt;BART · trained · parametric memory&lt;/text&gt;
  &lt;line class=&quot;dg-line&quot; x1=&quot;156&quot; y1=&quot;360&quot; x2=&quot;156&quot; y2=&quot;382&quot; marker-end=&quot;url(#rag-dg-arrow)&quot; /&gt;
  &lt;rect class=&quot;dg-pill&quot; x=&quot;22&quot; y=&quot;384&quot; width=&quot;268&quot; height=&quot;40&quot; rx=&quot;20&quot; /&gt;
  &lt;text class=&quot;dg-body&quot; x=&quot;156&quot; y=&quot;409&quot; text-anchor=&quot;middle&quot;&gt;Answer, written from the passages&lt;/text&gt;
  &lt;path class=&quot;dg-line dg-dash&quot; d=&quot;M290 404 H326 V96 H294&quot; marker-end=&quot;url(#rag-dg-arrow)&quot; /&gt;
  &lt;path class=&quot;dg-line dg-dash&quot; d=&quot;M326 336 H294&quot; marker-end=&quot;url(#rag-dg-arrow)&quot; /&gt;
  &lt;text class=&quot;dg-note&quot; transform=&quot;translate(346 250) rotate(-90)&quot; text-anchor=&quot;middle&quot;&gt;learns only from the final answer&lt;/text&gt;
&lt;/svg&gt;
&lt;figcaption&gt;Only the query encoder and the generator are trained. The index stays frozen, so swapping it for an older Wikipedia dump changes what the model knows.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2 id=&quot;what-they-found&quot;&gt;What they found&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Strong open-domain question answering.&lt;/strong&gt; On Natural Questions, WebQuestions and CuratedTrec, RAG beat the previous best systems in the paper’s comparison, while writing answers instead of copying spans. On TriviaQA the picture is mixed: it led on one test split but not the standard one.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;It can answer even when the passage doesn’t spell it out.&lt;/strong&gt; On Natural Questions, RAG still got about 11.8% of answers right in cases where the exact answer wasn’t in any retrieved passage — something a pure extractor can’t do.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;More factual, more specific text.&lt;/strong&gt; In a human evaluation of generated Jeopardy-style questions, raters judged RAG more factual than plain BART far more often than the other way round (42.7% vs. 7.1% of cases), and more specific too.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Small next to giant models.&lt;/strong&gt; RAG has 626M trainable parameters; the largest closed-book model it’s compared to, T5-11B, has 11 billion — yet RAG scored higher on open-domain QA.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Swap the index, update the knowledge.&lt;/strong&gt; The authors built a second index from a 2016 Wikipedia dump and asked “Who is {position}?” about 82 world leaders who changed between 2016 and 2018. With the matching index RAG got roughly 70% right; with the mismatched one, 4–12%. Changing what the model knows meant replacing the index, not retraining.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;why-it-matters-for-builders&quot;&gt;Why it matters for builders&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;It’s the template most “chat with your docs” systems still follow.&lt;/strong&gt; Embed chunks, search by meaning, paste the top results into the prompt, generate. Agent memory systems do the same thing with memories instead of Wikipedia pages — the &lt;a href=&quot;/post/agent-memory-glossary/#storing-and-finding-memories&quot;&gt;glossary’s “Storing and finding memories” section&lt;/a&gt; walks through each piece.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Updating knowledge is a data problem, not a training problem.&lt;/strong&gt; The hot-swap experiment is the cleanest argument for keeping facts outside the weights: if something changes, you change the index. The same idea is why memory systems store facts with timestamps and &lt;a href=&quot;/post/agent-memory-glossary/#versioned-facts&quot;&gt;versions&lt;/a&gt; rather than hoping the model “knows” the latest.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Provenance comes for free.&lt;/strong&gt; Because the answer is conditioned on specific passages, you can show where it came from — useful for debugging and for trust.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Retrieval quality still caps everything.&lt;/strong&gt; The retriever here is learned only through the final answer, and the paper reports it can fail badly (see caveats). Later work in this series picks up from there: &lt;a href=&quot;/post/paper-tldr-lost-in-the-middle/&quot;&gt;Lost in the Middle&lt;/a&gt; shows that even good passages help less when they land mid-prompt, and &lt;a href=&quot;/post/paper-tldr-memgpt/&quot;&gt;MemGPT&lt;/a&gt; treats the context window as something to manage rather than fill.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;honest-caveats&quot;&gt;Honest caveats&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;This is 2020-era plumbing.&lt;/strong&gt; “RAG” today usually means an instruction-tuned LLM plus an off-the-shelf retriever, with no joint training. The paper’s specific recipe — BART, DPR, a frozen Wikipedia index — is mostly of historical interest now; the &lt;em&gt;idea&lt;/em&gt; is what stuck.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Retrieval can collapse.&lt;/strong&gt; In early story-generation experiments, the retriever learned to return the same documents no matter the input, after which the generator ignored them and RAG behaved just like plain BART. The authors suggest tasks with long outputs or less need for facts may give the retriever too weak a signal.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Not state of the art everywhere.&lt;/strong&gt; On FEVER fact verification, RAG came within about 4.3% of the best pipeline (3-way) without being given gold evidence — close, but not ahead.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;The index is only as good as its source.&lt;/strong&gt; The authors note that Wikipedia will likely never be fully factual or free of bias, and that the same misuse concerns as other text generators apply.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Big infrastructure for its time.&lt;/strong&gt; The paper notes the Wikipedia index initially needed about 100 GB of CPU memory, cut to 36 GB with FAISS compression.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Earlier in the series: &lt;a href=&quot;/post/paper-tldr-sentence-bert/&quot;&gt;Sentence-BERT&lt;/a&gt; (the kind of embeddings that make the search step work), &lt;a href=&quot;/post/paper-tldr-lost-in-the-middle/&quot;&gt;Lost in the Middle&lt;/a&gt; (where retrieved passages land in the prompt) and &lt;a href=&quot;/post/paper-tldr-memgpt/&quot;&gt;MemGPT&lt;/a&gt; (an agent that pages its own memory in and out).&lt;/p&gt;

&lt;p&gt;Terms like &lt;a href=&quot;/post/agent-memory-glossary/#rag&quot;&gt;&lt;em&gt;retrieval-augmented generation&lt;/em&gt;&lt;/a&gt;, &lt;a href=&quot;/post/agent-memory-glossary/#embedding&quot;&gt;&lt;em&gt;embedding&lt;/em&gt;&lt;/a&gt;, &lt;a href=&quot;/post/agent-memory-glossary/#semantic-search&quot;&gt;&lt;em&gt;semantic search&lt;/em&gt;&lt;/a&gt;, &lt;a href=&quot;/post/agent-memory-glossary/#top-k-retrieval&quot;&gt;&lt;em&gt;top-k retrieval&lt;/em&gt;&lt;/a&gt; and &lt;a href=&quot;/post/agent-memory-glossary/#hnsw&quot;&gt;&lt;em&gt;HNSW&lt;/em&gt;&lt;/a&gt; are defined in the &lt;a href=&quot;/post/agent-memory-glossary/&quot;&gt;agent memory glossary&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title type="html">Paper TL;DR: Lost in the Middle — Where You Put Context Matters</title>
    <link href="https://www.avinashgosavi.com/post/paper-tldr-lost-in-the-middle/" rel="alternate" type="text/html" title="Paper TL;DR: Lost in the Middle — Where You Put Context Matters"/>
    <id>https://www.avinashgosavi.com/post/paper-tldr-lost-in-the-middle/</id>
    <published>2026-10-20T10:45:00+00:00</published>
    <updated>2026-10-20T10:45:00+00:00</updated>
    <category term="Research"/>
    <category term="Agent memory"/>
    <summary type="html">A plain-language TL;DR of Lost in the Middle (Liu et al., 2023): language models use information at the start and end of a long prompt far better than information buried in the middle, and what that means for RAG and agent memory.</summary>
    <content type="html" xml:base="https://www.avinashgosavi.com/post/paper-tldr-lost-in-the-middle/">&lt;p&gt;&lt;strong&gt;Paper:&lt;/strong&gt; Nelson F. Liu, Kevin Lin, John Hewitt, Ashwin Paranjape, Michele Bevilacqua, Fabio Petroni &amp;amp; Percy Liang (Stanford, UC Berkeley, Samaya AI), &lt;a href=&quot;https://arxiv.org/abs/2307.03172v3&quot;&gt;&lt;em&gt;Lost in the Middle: How Language Models Use Long Contexts&lt;/em&gt;&lt;/a&gt; (arXiv, 2023)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One-line TL;DR:&lt;/strong&gt; Give a model a long prompt with one useful passage in it, and how well it answers depends on &lt;em&gt;where&lt;/em&gt; that passage sits: best at the very start or very end, noticeably worse in the middle — even for models built for long contexts.&lt;/p&gt;

&lt;h2 id=&quot;the-question&quot;&gt;The question&lt;/h2&gt;

&lt;p&gt;Retrieval-augmented generation and agent memory both work the same way at the last step: fetch some passages, paste them into the prompt, and hope the model reads them. Bigger context windows make it tempting to paste in more. This paper asks a simple question first: does the model actually use everything in a long prompt equally well?&lt;/p&gt;

&lt;h2 id=&quot;how-they-tested-it&quot;&gt;How they tested it&lt;/h2&gt;

&lt;p&gt;Two tasks, each designed so the authors could move the one relevant piece of information around while keeping everything else the same.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Multi-document question answering.&lt;/strong&gt; Questions from NaturalQuestions-Open, each paired with one Wikipedia passage that contains the answer plus distractor passages that look relevant but don’t. Prompts held 10, 20 or 30 passages, and the answer passage was moved from first to last.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Key-value retrieval.&lt;/strong&gt; A synthetic stress test: a JSON object of random UUID keys and values (75, 140 or 300 pairs), and the model has to return the value for one key. No language cues, just “find this and copy it.”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They ran open models (MPT-30B-Instruct, LongChat-13B) and API models (GPT-3.5-Turbo, Claude-1.3, and their longer-context versions, plus GPT-4 on a subset).&lt;/p&gt;

&lt;h2 id=&quot;what-they-found&quot;&gt;What they found&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;A U-shaped curve.&lt;/strong&gt; Accuracy was highest when the answer passage came at the very start or the very end, and dropped when it sat in the middle — by more than 20% in some settings. The authors describe this as a primacy bias plus a recency bias.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;The middle can be worse than nothing.&lt;/strong&gt; In one 20-document setting, GPT-3.5-Turbo with the answer buried mid-prompt scored lower than the same model answering with no documents at all.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;A longer window didn’t fix it.&lt;/strong&gt; When a prompt fit in both a model and its extended-context version, the two scored almost the same. A bigger window lets you paste more; it doesn’t make the model read it better.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;More retrieved documents stop helping early.&lt;/strong&gt; In an open-domain QA case study, the retriever kept finding the answer more often as it returned more passages, but the model’s accuracy flattened out well before that. Going from 20 to 50 passages bought only a point or two, at much higher cost and latency.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Asking the question twice helps for lookups.&lt;/strong&gt; Putting the query both before and after the data made key-value retrieval near-perfect, but it barely changed the multi-document QA results.&lt;/li&gt;
&lt;/ul&gt;

&lt;figure class=&quot;diagram&quot;&gt;
&lt;svg viewBox=&quot;0 0 360 300&quot; role=&quot;img&quot; aria-labelledby=&quot;litm-dg-title litm-dg-desc&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
  &lt;title id=&quot;litm-dg-title&quot;&gt;The U-shaped curve from Lost in the Middle&lt;/title&gt;
  &lt;desc id=&quot;litm-dg-desc&quot;&gt;A qualitative sketch, not the paper&apos;s data. The horizontal axis is where the one useful passage sits in a prompt of many passages, from first to last. The vertical axis is answer accuracy. The curve is high when the passage is first (primacy bias), dips lowest when it is in the middle, and rises again when it is last (recency bias).&lt;/desc&gt;
  &lt;text class=&quot;dg-label&quot; x=&quot;50&quot; y=&quot;18&quot;&gt;Answer accuracy&lt;/text&gt;
  &lt;line class=&quot;dg-axis&quot; x1=&quot;50&quot; y1=&quot;28&quot; x2=&quot;50&quot; y2=&quot;206&quot; /&gt;
  &lt;line class=&quot;dg-axis&quot; x1=&quot;50&quot; y1=&quot;206&quot; x2=&quot;340&quot; y2=&quot;206&quot; /&gt;
  &lt;path class=&quot;dg-line dg-curve&quot; d=&quot;M70 52 C120 175 269 175 319 70&quot; /&gt;
  &lt;circle class=&quot;dg-dot&quot; cx=&quot;70&quot; cy=&quot;52&quot; r=&quot;5&quot; /&gt;
  &lt;circle class=&quot;dg-dot&quot; cx=&quot;194.5&quot; cy=&quot;146.5&quot; r=&quot;5&quot; /&gt;
  &lt;circle class=&quot;dg-dot&quot; cx=&quot;319&quot; cy=&quot;70&quot; r=&quot;5&quot; /&gt;
  &lt;text class=&quot;dg-body&quot; x=&quot;82&quot; y=&quot;48&quot;&gt;primacy&lt;/text&gt;
  &lt;text class=&quot;dg-body&quot; x=&quot;307&quot; y=&quot;56&quot; text-anchor=&quot;end&quot;&gt;recency&lt;/text&gt;
  &lt;text class=&quot;dg-strong&quot; x=&quot;194.5&quot; y=&quot;180&quot; text-anchor=&quot;middle&quot;&gt;lost in the middle&lt;/text&gt;
  &lt;rect class=&quot;dg-pill&quot; x=&quot;58&quot; y=&quot;218&quot; width=&quot;25&quot; height=&quot;18&quot; rx=&quot;4&quot; /&gt;
  &lt;rect class=&quot;dg-box dg-muted&quot; x=&quot;89&quot; y=&quot;218&quot; width=&quot;25&quot; height=&quot;18&quot; rx=&quot;4&quot; /&gt;
  &lt;rect class=&quot;dg-box dg-muted&quot; x=&quot;120&quot; y=&quot;218&quot; width=&quot;25&quot; height=&quot;18&quot; rx=&quot;4&quot; /&gt;
  &lt;rect class=&quot;dg-box dg-muted&quot; x=&quot;151&quot; y=&quot;218&quot; width=&quot;25&quot; height=&quot;18&quot; rx=&quot;4&quot; /&gt;
  &lt;rect class=&quot;dg-box dg-muted&quot; x=&quot;182&quot; y=&quot;218&quot; width=&quot;25&quot; height=&quot;18&quot; rx=&quot;4&quot; /&gt;
  &lt;rect class=&quot;dg-box dg-muted&quot; x=&quot;213&quot; y=&quot;218&quot; width=&quot;25&quot; height=&quot;18&quot; rx=&quot;4&quot; /&gt;
  &lt;rect class=&quot;dg-box dg-muted&quot; x=&quot;244&quot; y=&quot;218&quot; width=&quot;25&quot; height=&quot;18&quot; rx=&quot;4&quot; /&gt;
  &lt;rect class=&quot;dg-box dg-muted&quot; x=&quot;275&quot; y=&quot;218&quot; width=&quot;25&quot; height=&quot;18&quot; rx=&quot;4&quot; /&gt;
  &lt;rect class=&quot;dg-pill&quot; x=&quot;306&quot; y=&quot;218&quot; width=&quot;25&quot; height=&quot;18&quot; rx=&quot;4&quot; /&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;70.5&quot; y=&quot;256&quot; text-anchor=&quot;middle&quot;&gt;first&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;194.5&quot; y=&quot;256&quot; text-anchor=&quot;middle&quot;&gt;middle&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;318.5&quot; y=&quot;256&quot; text-anchor=&quot;middle&quot;&gt;last&lt;/text&gt;
  &lt;text class=&quot;dg-label&quot; x=&quot;194.5&quot; y=&quot;284&quot; text-anchor=&quot;middle&quot;&gt;Where the answer passage sits&lt;/text&gt;
&lt;/svg&gt;
&lt;figcaption&gt;A sketch of the shape the paper reports, not its numbers: the same passage helps most at the edges of the prompt and least in the middle.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2 id=&quot;why-it-matters-for-builders&quot;&gt;Why it matters for builders&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Order is part of retrieval.&lt;/strong&gt; Ranking isn’t just about &lt;em&gt;which&lt;/em&gt; passages make the cut but &lt;em&gt;where&lt;/em&gt; they land. Putting the best matches first (and not burying them under weaker ones) is cheap and directly addresses this. A &lt;a href=&quot;/post/agent-memory-glossary/#re-ranking&quot;&gt;re-ranking&lt;/a&gt; pass earns its keep here.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Fewer, better passages beat more passages.&lt;/strong&gt; The case study suggests a tighter &lt;a href=&quot;/post/agent-memory-glossary/#top-k-retrieval&quot;&gt;top-k&lt;/a&gt; can be nearly as accurate and a lot cheaper. It also connects to the idea of &lt;a href=&quot;/post/agent-memory-glossary/#sufficient-evidence&quot;&gt;sufficient evidence&lt;/a&gt;: the goal is enough context, not all of it.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Test position, not just recall.&lt;/strong&gt; A memory system can retrieve the right fact and still fail if the fact lands mid-prompt. Benchmarks like &lt;a href=&quot;/post/paper-tldr-locomo-long-term-memory-benchmark/&quot;&gt;LoCoMo&lt;/a&gt; measure the end answer; this paper’s trick of moving the gold passage around is an easy extra check to run on your own pipeline.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Keep the important stuff at the edges.&lt;/strong&gt; Designs like &lt;a href=&quot;/post/paper-tldr-memgpt/&quot;&gt;MemGPT&lt;/a&gt; keep a small, always-visible working context near the top of the prompt. This paper is one reason that kind of layout makes sense.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;honest-caveats&quot;&gt;Honest caveats&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;These are 2023 models.&lt;/strong&gt; The results cover GPT-3.5, Claude-1.3, MPT and LongChat, with only partial GPT-4 runs because of cost. Newer models may show a weaker (or different) position effect, so it’s worth measuring on whatever you actually use.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;The “why” is still open.&lt;/strong&gt; The authors test a few explanations — architecture, instruction tuning, model size — and call those analyses preliminary. Encoder-decoder models were fairly robust within their training length but showed the U-shape on longer inputs; base models without instruction tuning showed it too.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;One answer per prompt.&lt;/strong&gt; Each test has a single relevant passage. Real questions often need several facts combined, which this setup doesn’t measure.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Greedy decoding only,&lt;/strong&gt; and the key-value task is deliberately artificial, so it shows a capability gap rather than typical real-world behavior.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Earlier in the series: &lt;a href=&quot;/post/paper-tldr-memgpt/&quot;&gt;MemGPT&lt;/a&gt; (paging what goes into the context window), &lt;a href=&quot;/post/paper-tldr-generative-agents/&quot;&gt;Generative Agents&lt;/a&gt; (ranking memories by recency, importance and relevance) and &lt;a href=&quot;/post/paper-tldr-sentence-bert/&quot;&gt;Sentence-BERT&lt;/a&gt; (the embeddings behind most of the retrieval step). Next in the series: &lt;a href=&quot;/post/paper-tldr-retrieval-augmented-generation/&quot;&gt;RAG&lt;/a&gt;, the 2020 paper that named the retrieve-then-generate setup this paper stress-tests.&lt;/p&gt;

&lt;p&gt;Terms like &lt;a href=&quot;/post/agent-memory-glossary/#context-window&quot;&gt;&lt;em&gt;context window&lt;/em&gt;&lt;/a&gt;, &lt;a href=&quot;/post/agent-memory-glossary/#position-bias&quot;&gt;&lt;em&gt;position bias&lt;/em&gt;&lt;/a&gt;, &lt;a href=&quot;/post/agent-memory-glossary/#re-ranking&quot;&gt;&lt;em&gt;re-ranking&lt;/em&gt;&lt;/a&gt; and &lt;a href=&quot;/post/agent-memory-glossary/#top-k-retrieval&quot;&gt;&lt;em&gt;top-k retrieval&lt;/em&gt;&lt;/a&gt; are defined in the &lt;a href=&quot;/post/agent-memory-glossary/&quot;&gt;agent memory glossary&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title type="html">Paper TL;DR: Generative Agents — Memory Streams, Reflection and Plans</title>
    <link href="https://www.avinashgosavi.com/post/paper-tldr-generative-agents/" rel="alternate" type="text/html" title="Paper TL;DR: Generative Agents — Memory Streams, Reflection and Plans"/>
    <id>https://www.avinashgosavi.com/post/paper-tldr-generative-agents/</id>
    <published>2026-10-19T21:40:00+00:00</published>
    <updated>2026-10-19T21:40:00+00:00</updated>
    <category term="Research"/>
    <category term="Agent memory"/>
    <summary type="html">A plain-language TL;DR of Generative Agents (Park et al., 2023): how 25 LLM characters in a sandbox town remember, reflect and plan, and which parts of that memory design builders still copy.</summary>
    <content type="html" xml:base="https://www.avinashgosavi.com/post/paper-tldr-generative-agents/">&lt;p&gt;&lt;strong&gt;Paper:&lt;/strong&gt; Joon Sung Park, Joseph C. O’Brien, Carrie J. Cai, Meredith Ringel Morris, Percy Liang &amp;amp; Michael S. Bernstein (Stanford, Google Research, Google DeepMind), &lt;a href=&quot;https://arxiv.org/abs/2304.03442&quot;&gt;&lt;em&gt;Generative Agents: Interactive Simulacra of Human Behavior&lt;/em&gt;&lt;/a&gt; (UIST 2023)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One-line TL;DR:&lt;/strong&gt; Give an LLM a running log of everything it observes, a way to score which memories matter right now, and a habit of periodically writing down higher-level conclusions — and simulated characters start to behave believably over days, not just single replies.&lt;/p&gt;

&lt;h2 id=&quot;the-setup&quot;&gt;The setup&lt;/h2&gt;

&lt;p&gt;The authors built &lt;strong&gt;Smallville&lt;/strong&gt;, a small sandbox town populated by 25 characters. Each one is driven by an LLM (gpt-3.5-turbo in the paper) and starts from a single paragraph describing who they are: job, relationships, habits. From there the characters wake up, go to work, chat, form opinions of each other and make plans — all generated, step by step, by the model.&lt;/p&gt;

&lt;p&gt;The interesting part isn’t the town. It’s the memory design that keeps each character consistent over time, which the paper splits into three pieces: a &lt;strong&gt;memory stream&lt;/strong&gt;, &lt;strong&gt;reflection&lt;/strong&gt; and &lt;strong&gt;planning&lt;/strong&gt;.&lt;/p&gt;

&lt;h2 id=&quot;1-the-memory-stream&quot;&gt;1. The memory stream&lt;/h2&gt;

&lt;p&gt;Every character keeps a &lt;strong&gt;memory stream&lt;/strong&gt;: a plain list of memories, each written in natural language with a creation time and a “last accessed” time. The basic memories are &lt;strong&gt;observations&lt;/strong&gt; — things the character perceived, such as (to give an illustrative example) “a neighbor is watering the garden.”&lt;/p&gt;

&lt;p&gt;The stream grows far too large to fit into a prompt, so each time a character needs to act, it retrieves only the most useful memories. Each memory gets three scores:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Recency:&lt;/strong&gt; recently used memories score higher, fading exponentially with each in-game hour (the paper uses a decay factor of 0.995).&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Importance:&lt;/strong&gt; when a memory is created, the model rates it from 1 (mundane, like cleaning a room) to 10 (poignant, like asking someone out).&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Relevance:&lt;/strong&gt; cosine similarity between the memory’s embedding and the current situation’s embedding.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each score is scaled to 0–1 and the three are added up (the paper weights them equally). The top-scoring memories that fit into the context window go into the prompt.&lt;/p&gt;

&lt;h2 id=&quot;2-reflection&quot;&gt;2. Reflection&lt;/h2&gt;

&lt;p&gt;Raw observations are too low-level to generalize from. Fifty separate observations of a neighbor reading in the library don’t, by themselves, tell a character “she cares a lot about her research.”&lt;/p&gt;

&lt;p&gt;So characters &lt;strong&gt;reflect&lt;/strong&gt;. When the summed importance of recent memories passes a threshold (150 in the paper — roughly two or three times per simulated day), the model looks at the 100 most recent memories, asks itself three high-level questions about them, retrieves memories relevant to each question, and writes down insights that cite the memories they came from.&lt;/p&gt;

&lt;p&gt;Those insights go back into the same memory stream, where they can be retrieved — and reflected on again. The result is a &lt;strong&gt;reflection tree&lt;/strong&gt;: raw observations at the leaves, more abstract conclusions higher up.&lt;/p&gt;

&lt;figure class=&quot;diagram&quot;&gt;
&lt;svg viewBox=&quot;0 0 378 366&quot; role=&quot;img&quot; aria-labelledby=&quot;ga-dg-title ga-dg-desc&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
  &lt;title id=&quot;ga-dg-title&quot;&gt;How a generative agent remembers, retrieves and reflects&lt;/title&gt;
  &lt;desc id=&quot;ga-dg-desc&quot;&gt;Each character keeps a memory stream of natural-language entries with a creation time and a last-accessed time: observations, plans and reflections. When the character needs to act, every memory is scored on recency (decaying each game hour), importance (rated 1 to 10 by the model) and relevance (cosine similarity of embeddings); the scores are scaled to 0 to 1 and added. The top memories go into the prompt to choose the next action. When the importance of recent memories adds up past a threshold, the character reflects, and the insights it writes are stored back in the memory stream.&lt;/desc&gt;
  &lt;defs&gt;
    &lt;marker id=&quot;ga-dg-arrow&quot; viewBox=&quot;0 0 10 10&quot; refX=&quot;9&quot; refY=&quot;5&quot; markerWidth=&quot;7&quot; markerHeight=&quot;7&quot; orient=&quot;auto-start-reverse&quot;&gt;
      &lt;path class=&quot;dg-head&quot; d=&quot;M0 0 L10 5 L0 10 z&quot; /&gt;
    &lt;/marker&gt;
  &lt;/defs&gt;
  &lt;rect class=&quot;dg-group&quot; x=&quot;6&quot; y=&quot;4&quot; width=&quot;348&quot; height=&quot;118&quot; rx=&quot;12&quot; /&gt;
  &lt;text class=&quot;dg-label&quot; x=&quot;22&quot; y=&quot;26&quot;&gt;Memory stream&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;338&quot; y=&quot;26&quot; text-anchor=&quot;end&quot;&gt;text + created + last used&lt;/text&gt;
  &lt;rect class=&quot;dg-box&quot; x=&quot;22&quot; y=&quot;40&quot; width=&quot;96&quot; height=&quot;66&quot; rx=&quot;8&quot; /&gt;
  &lt;text class=&quot;dg-body&quot; x=&quot;70&quot; y=&quot;66&quot; text-anchor=&quot;middle&quot;&gt;Observations&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;70&quot; y=&quot;86&quot; text-anchor=&quot;middle&quot;&gt;what it saw&lt;/text&gt;
  &lt;rect class=&quot;dg-box&quot; x=&quot;132&quot; y=&quot;40&quot; width=&quot;96&quot; height=&quot;66&quot; rx=&quot;8&quot; /&gt;
  &lt;text class=&quot;dg-body&quot; x=&quot;180&quot; y=&quot;66&quot; text-anchor=&quot;middle&quot;&gt;Plans&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;180&quot; y=&quot;86&quot; text-anchor=&quot;middle&quot;&gt;day → minutes&lt;/text&gt;
  &lt;rect class=&quot;dg-box&quot; x=&quot;242&quot; y=&quot;40&quot; width=&quot;96&quot; height=&quot;66&quot; rx=&quot;8&quot; /&gt;
  &lt;text class=&quot;dg-body&quot; x=&quot;290&quot; y=&quot;66&quot; text-anchor=&quot;middle&quot;&gt;Reflections&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;290&quot; y=&quot;86&quot; text-anchor=&quot;middle&quot;&gt;insights&lt;/text&gt;
  &lt;line class=&quot;dg-line&quot; x1=&quot;180&quot; y1=&quot;122&quot; x2=&quot;180&quot; y2=&quot;150&quot; marker-end=&quot;url(#ga-dg-arrow)&quot; /&gt;
  &lt;rect class=&quot;dg-group&quot; x=&quot;6&quot; y=&quot;152&quot; width=&quot;348&quot; height=&quot;112&quot; rx=&quot;12&quot; /&gt;
  &lt;text class=&quot;dg-label&quot; x=&quot;22&quot; y=&quot;174&quot;&gt;Score each memory · sum of 0–1&lt;/text&gt;
  &lt;rect class=&quot;dg-box&quot; x=&quot;22&quot; y=&quot;186&quot; width=&quot;92&quot; height=&quot;64&quot; rx=&quot;8&quot; /&gt;
  &lt;text class=&quot;dg-body&quot; x=&quot;68&quot; y=&quot;208&quot; text-anchor=&quot;middle&quot;&gt;Recency&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;68&quot; y=&quot;226&quot; text-anchor=&quot;middle&quot;&gt;decays each&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;68&quot; y=&quot;241&quot; text-anchor=&quot;middle&quot;&gt;game hour&lt;/text&gt;
  &lt;text class=&quot;dg-strong&quot; x=&quot;124&quot; y=&quot;224&quot; text-anchor=&quot;middle&quot;&gt;+&lt;/text&gt;
  &lt;rect class=&quot;dg-box&quot; x=&quot;134&quot; y=&quot;186&quot; width=&quot;92&quot; height=&quot;64&quot; rx=&quot;8&quot; /&gt;
  &lt;text class=&quot;dg-body&quot; x=&quot;180&quot; y=&quot;208&quot; text-anchor=&quot;middle&quot;&gt;Importance&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;180&quot; y=&quot;226&quot; text-anchor=&quot;middle&quot;&gt;rated 1–10&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;180&quot; y=&quot;241&quot; text-anchor=&quot;middle&quot;&gt;by the model&lt;/text&gt;
  &lt;text class=&quot;dg-strong&quot; x=&quot;236&quot; y=&quot;224&quot; text-anchor=&quot;middle&quot;&gt;+&lt;/text&gt;
  &lt;rect class=&quot;dg-box&quot; x=&quot;246&quot; y=&quot;186&quot; width=&quot;92&quot; height=&quot;64&quot; rx=&quot;8&quot; /&gt;
  &lt;text class=&quot;dg-body&quot; x=&quot;292&quot; y=&quot;208&quot; text-anchor=&quot;middle&quot;&gt;Relevance&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;292&quot; y=&quot;226&quot; text-anchor=&quot;middle&quot;&gt;cosine&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;292&quot; y=&quot;241&quot; text-anchor=&quot;middle&quot;&gt;similarity&lt;/text&gt;
  &lt;line class=&quot;dg-line&quot; x1=&quot;98&quot; y1=&quot;264&quot; x2=&quot;98&quot; y2=&quot;292&quot; marker-end=&quot;url(#ga-dg-arrow)&quot; /&gt;
  &lt;line class=&quot;dg-line&quot; x1=&quot;262&quot; y1=&quot;264&quot; x2=&quot;262&quot; y2=&quot;292&quot; marker-end=&quot;url(#ga-dg-arrow)&quot; /&gt;
  &lt;rect class=&quot;dg-box&quot; x=&quot;22&quot; y=&quot;294&quot; width=&quot;152&quot; height=&quot;66&quot; rx=&quot;8&quot; /&gt;
  &lt;text class=&quot;dg-strong&quot; x=&quot;98&quot; y=&quot;318&quot; text-anchor=&quot;middle&quot;&gt;Top memories&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;98&quot; y=&quot;338&quot; text-anchor=&quot;middle&quot;&gt;go into the prompt&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;98&quot; y=&quot;353&quot; text-anchor=&quot;middle&quot;&gt;→ next action&lt;/text&gt;
  &lt;rect class=&quot;dg-box&quot; x=&quot;186&quot; y=&quot;294&quot; width=&quot;152&quot; height=&quot;66&quot; rx=&quot;8&quot; /&gt;
  &lt;text class=&quot;dg-strong&quot; x=&quot;262&quot; y=&quot;318&quot; text-anchor=&quot;middle&quot;&gt;Reflect&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;262&quot; y=&quot;338&quot; text-anchor=&quot;middle&quot;&gt;when importance&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;262&quot; y=&quot;353&quot; text-anchor=&quot;middle&quot;&gt;adds up past 150&lt;/text&gt;
  &lt;path class=&quot;dg-line dg-dash&quot; d=&quot;M338 327 H368 V73 H341&quot; marker-end=&quot;url(#ga-dg-arrow)&quot; /&gt;
&lt;/svg&gt;
&lt;figcaption&gt;Everything lives in one stream. Retrieval ranks it three ways; reflection writes new, higher-level memories back into it (dashed loop).&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2 id=&quot;3-planning&quot;&gt;3. Planning&lt;/h2&gt;

&lt;p&gt;To keep behavior coherent across a day, each character drafts a rough plan (about five to eight chunks), then breaks each chunk into hour-long actions, then into 5–15 minute steps. Plans are stored in the memory stream too. At every step, the model decides whether something it just noticed is worth reacting to; if so, it rewrites the plan from that point.&lt;/p&gt;

&lt;h2 id=&quot;what-they-tested&quot;&gt;What they tested&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Interviews.&lt;/strong&gt; The authors “interviewed” characters with questions about themselves, their memories, plans, reactions and reflections. 100 human evaluators ranked answers from the full architecture, versions with pieces removed, and human crowdworkers role-playing the same characters. The full architecture ranked most believable; removing reflection, then planning, then memory each made answers noticeably worse. The crowdworker answers landed below every version that still had memory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Emergent behavior over two game days.&lt;/strong&gt; One character was seeded with the idea of throwing a Valentine’s Day party. Without further scripting, word spread from 1 character to 13 of 25, and 5 of the 12 who were invited showed up. A mayoral candidacy spread from 1 character to 8 the same way.&lt;/p&gt;

&lt;h2 id=&quot;why-it-matters-for-builders&quot;&gt;Why it matters for builders&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Rank memories on more than similarity.&lt;/strong&gt; Recency + importance + relevance is a simple, readable scoring rule, and variations of it show up across agent memory systems. &lt;a href=&quot;/post/vaultmem-encrypted-memory-for-ai-agents/&quot;&gt;VaultMem&lt;/a&gt;, for example, re-ranks on cosine similarity plus a significance score that decays over time.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Store conclusions, not just events.&lt;/strong&gt; Reflections are cheap summaries the agent can retrieve later, and keeping links back to the source memories makes them auditable.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Memory and planning are the same store.&lt;/strong&gt; Writing plans into the memory stream means “what am I doing next?” is answered by the same retrieval as “what happened?”&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;honest-caveats&quot;&gt;Honest caveats&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Retrieval still misses.&lt;/strong&gt; The authors show characters failing to recall something they had heard, or recalling a detail of an event but not the event itself.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Embellishment.&lt;/strong&gt; Characters sometimes added details nobody had said, or blended in the model’s world knowledge — one described a neighbor as the author of a famous 18th-century economics book.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Too polite.&lt;/strong&gt; The authors attribute overly formal, overly agreeable dialogue to instruction tuning; one character rarely said no to suggestions, and her own interests drifted as a result.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Expensive.&lt;/strong&gt; Running 25 characters for two game days took multiple days and, in the authors’ words, “thousands of dollars in token credits.”&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Believability isn’t accuracy.&lt;/strong&gt; The evaluation measured whether behavior &lt;em&gt;seemed&lt;/em&gt; human, not whether memories were retrieved correctly. Benchmarks like &lt;a href=&quot;/post/paper-tldr-locomo-long-term-memory-benchmark/&quot;&gt;LoCoMo&lt;/a&gt; test that more directly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Earlier in the series: &lt;a href=&quot;/post/paper-tldr-memgpt/&quot;&gt;MemGPT&lt;/a&gt; (an OS-style alternative where the model pages its own memory), &lt;a href=&quot;/post/paper-tldr-complementary-learning-systems/&quot;&gt;Complementary Learning Systems&lt;/a&gt; (the brain’s version of turning episodes into general knowledge — close in spirit to reflection), and &lt;a href=&quot;/post/paper-tldr-sentence-bert/&quot;&gt;Sentence-BERT&lt;/a&gt; (the kind of embeddings behind the relevance score).&lt;/p&gt;

&lt;p&gt;Terms like &lt;a href=&quot;/post/agent-memory-glossary/#reflection&quot;&gt;&lt;em&gt;reflection&lt;/em&gt;&lt;/a&gt;, &lt;a href=&quot;/post/agent-memory-glossary/#consolidation&quot;&gt;&lt;em&gt;consolidation&lt;/em&gt;&lt;/a&gt; and &lt;a href=&quot;/post/agent-memory-glossary/#decay&quot;&gt;&lt;em&gt;decay&lt;/em&gt;&lt;/a&gt; are defined in the &lt;a href=&quot;/post/agent-memory-glossary/#how-memories-change-over-time&quot;&gt;agent memory glossary&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title type="html">Paper TL;DR: MemGPT — Treating the Context Window Like RAM</title>
    <link href="https://www.avinashgosavi.com/post/paper-tldr-memgpt/" rel="alternate" type="text/html" title="Paper TL;DR: MemGPT — Treating the Context Window Like RAM"/>
    <id>https://www.avinashgosavi.com/post/paper-tldr-memgpt/</id>
    <published>2026-10-19T10:40:00+00:00</published>
    <updated>2026-10-19T10:40:00+00:00</updated>
    <category term="Research"/>
    <category term="Agent memory"/>
    <summary type="html">A plain-language TL;DR of MemGPT (Packer et al., 2023): how an LLM can page information in and out of a small context window with function calls, the way an operating system manages memory.</summary>
    <content type="html" xml:base="https://www.avinashgosavi.com/post/paper-tldr-memgpt/">&lt;p&gt;&lt;strong&gt;Paper:&lt;/strong&gt; Charles Packer, Sarah Wooders, Kevin Lin, Vivian Fang, Shishir G. Patil, Ion Stoica &amp;amp; Joseph E. Gonzalez (UC Berkeley), &lt;a href=&quot;https://arxiv.org/abs/2310.08560&quot;&gt;&lt;em&gt;MemGPT: Towards LLMs as Operating Systems&lt;/em&gt;&lt;/a&gt; (arXiv, 2023)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One-line TL;DR:&lt;/strong&gt; Instead of waiting for bigger context windows, MemGPT treats the prompt like a computer’s RAM and lets the model itself move information between that small fast space and larger external storage, using function calls.&lt;/p&gt;

&lt;h2 id=&quot;the-problem&quot;&gt;The problem&lt;/h2&gt;

&lt;p&gt;An LLM can only “see” what fits in its context window. Long chats and big document collections don’t fit, so something has to decide what stays in view. Operating systems solved a version of this decades ago: programs act as if they have lots of memory, while the OS quietly pages data between fast RAM and slower disk. The paper calls its version &lt;strong&gt;virtual context management&lt;/strong&gt;.&lt;/p&gt;

&lt;h2 id=&quot;how-it-works&quot;&gt;How it works&lt;/h2&gt;

&lt;p&gt;MemGPT splits memory into two places.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Main context&lt;/strong&gt; — what’s actually in the prompt — has three parts:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;System instructions:&lt;/strong&gt; read-only rules, including how to use the memory functions.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Working context:&lt;/strong&gt; a small, fixed-size scratchpad of key facts (for example, things learned about the user). The model can only change it through function calls.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;A FIFO message queue:&lt;/strong&gt; the recent conversation. Its first entry is a running summary of older messages that were pushed out.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;External context&lt;/strong&gt; lives outside the prompt:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Recall storage:&lt;/strong&gt; the full message history, searchable on demand.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Archival storage:&lt;/strong&gt; a store for arbitrary text the model chooses to save or look up later.&lt;/li&gt;
&lt;/ul&gt;

&lt;figure class=&quot;diagram&quot;&gt;
&lt;svg viewBox=&quot;0 0 360 432&quot; role=&quot;img&quot; aria-labelledby=&quot;memgpt-dg-title memgpt-dg-desc&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
  &lt;title id=&quot;memgpt-dg-title&quot;&gt;MemGPT&apos;s two tiers of memory&lt;/title&gt;
  &lt;desc id=&quot;memgpt-dg-desc&quot;&gt;Main context is what is in the prompt: read-only system instructions, a small working context of key facts edited through function calls, and a FIFO message queue that starts with a summary of older messages. External context sits outside the prompt: recall storage holds the full message history and archival storage holds any text the model chooses to save. The oldest messages are evicted from the queue into recall storage, and the model searches and saves across both tiers with function calls.&lt;/desc&gt;
  &lt;defs&gt;
    &lt;marker id=&quot;memgpt-dg-arrow&quot; viewBox=&quot;0 0 10 10&quot; refX=&quot;9&quot; refY=&quot;5&quot; markerWidth=&quot;7&quot; markerHeight=&quot;7&quot; orient=&quot;auto-start-reverse&quot;&gt;
      &lt;path class=&quot;dg-head&quot; d=&quot;M0 0 L10 5 L0 10 z&quot; /&gt;
    &lt;/marker&gt;
  &lt;/defs&gt;
  &lt;rect class=&quot;dg-group&quot; x=&quot;6&quot; y=&quot;4&quot; width=&quot;348&quot; height=&quot;206&quot; rx=&quot;12&quot; /&gt;
  &lt;text class=&quot;dg-label&quot; x=&quot;22&quot; y=&quot;26&quot;&gt;Main context · in the prompt&lt;/text&gt;
  &lt;rect class=&quot;dg-box&quot; x=&quot;22&quot; y=&quot;38&quot; width=&quot;316&quot; height=&quot;48&quot; rx=&quot;8&quot; /&gt;
  &lt;text class=&quot;dg-strong&quot; x=&quot;180&quot; y=&quot;59&quot; text-anchor=&quot;middle&quot;&gt;System instructions&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;180&quot; y=&quot;77&quot; text-anchor=&quot;middle&quot;&gt;read-only rules, incl. the memory functions&lt;/text&gt;
  &lt;rect class=&quot;dg-box&quot; x=&quot;22&quot; y=&quot;94&quot; width=&quot;316&quot; height=&quot;48&quot; rx=&quot;8&quot; /&gt;
  &lt;text class=&quot;dg-strong&quot; x=&quot;180&quot; y=&quot;115&quot; text-anchor=&quot;middle&quot;&gt;Working context&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;180&quot; y=&quot;133&quot; text-anchor=&quot;middle&quot;&gt;small scratchpad of key facts&lt;/text&gt;
  &lt;rect class=&quot;dg-box&quot; x=&quot;22&quot; y=&quot;150&quot; width=&quot;316&quot; height=&quot;48&quot; rx=&quot;8&quot; /&gt;
  &lt;text class=&quot;dg-strong&quot; x=&quot;180&quot; y=&quot;171&quot; text-anchor=&quot;middle&quot;&gt;FIFO message queue&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;180&quot; y=&quot;189&quot; text-anchor=&quot;middle&quot;&gt;running summary + recent messages&lt;/text&gt;
  &lt;line class=&quot;dg-line dg-dash&quot; x1=&quot;80&quot; y1=&quot;200&quot; x2=&quot;80&quot; y2=&quot;302&quot; marker-end=&quot;url(#memgpt-dg-arrow)&quot; /&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;90&quot; y=&quot;228&quot;&gt;oldest messages&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;90&quot; y=&quot;244&quot;&gt;evicted, not deleted&lt;/text&gt;
  &lt;line class=&quot;dg-line&quot; x1=&quot;280&quot; y1=&quot;202&quot; x2=&quot;280&quot; y2=&quot;302&quot; marker-start=&quot;url(#memgpt-dg-arrow)&quot; marker-end=&quot;url(#memgpt-dg-arrow)&quot; /&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;270&quot; y=&quot;266&quot; text-anchor=&quot;end&quot;&gt;function calls:&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;270&quot; y=&quot;282&quot; text-anchor=&quot;end&quot;&gt;search, save, edit&lt;/text&gt;
  &lt;rect class=&quot;dg-group&quot; x=&quot;6&quot; y=&quot;290&quot; width=&quot;348&quot; height=&quot;138&quot; rx=&quot;12&quot; /&gt;
  &lt;rect class=&quot;dg-box&quot; x=&quot;22&quot; y=&quot;306&quot; width=&quot;152&quot; height=&quot;86&quot; rx=&quot;8&quot; /&gt;
  &lt;text class=&quot;dg-strong&quot; x=&quot;98&quot; y=&quot;332&quot; text-anchor=&quot;middle&quot;&gt;Recall storage&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;98&quot; y=&quot;354&quot; text-anchor=&quot;middle&quot;&gt;full message history,&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;98&quot; y=&quot;372&quot; text-anchor=&quot;middle&quot;&gt;searchable&lt;/text&gt;
  &lt;rect class=&quot;dg-box&quot; x=&quot;186&quot; y=&quot;306&quot; width=&quot;152&quot; height=&quot;86&quot; rx=&quot;8&quot; /&gt;
  &lt;text class=&quot;dg-strong&quot; x=&quot;262&quot; y=&quot;332&quot; text-anchor=&quot;middle&quot;&gt;Archival storage&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;262&quot; y=&quot;354&quot; text-anchor=&quot;middle&quot;&gt;any text the model&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;262&quot; y=&quot;372&quot; text-anchor=&quot;middle&quot;&gt;chooses to keep&lt;/text&gt;
  &lt;text class=&quot;dg-label&quot; x=&quot;22&quot; y=&quot;416&quot;&gt;External context · outside the prompt&lt;/text&gt;
&lt;/svg&gt;
&lt;figcaption&gt;Main context is the prompt; external context is everything the model can page back in. The model itself moves information between them.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;The clever part is who moves things around: &lt;strong&gt;the model does&lt;/strong&gt;. Its output is parsed as function calls (search recall, write to archival, edit working context), and the results are fed back in. A few mechanics make this work:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Memory pressure warnings.&lt;/strong&gt; When the prompt gets close to full (the paper’s example uses 70%), the system adds a warning so the model can save what matters before it’s lost.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Eviction with summaries.&lt;/strong&gt; When the prompt is full, a chunk of the oldest messages is evicted and folded into the running summary. Evicted messages aren’t deleted — they stay in recall storage.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Heartbeats.&lt;/strong&gt; A function call can ask to keep going (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;request_heartbeat&lt;/code&gt;), so the model can chain several lookups before replying.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Events.&lt;/strong&gt; User messages, system alerts and scheduled timers all wake the agent up, so it doesn’t only act when a person types.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;what-they-tested&quot;&gt;What they tested&lt;/h2&gt;

&lt;p&gt;Two settings, each with a “can it really remember?” task:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Multi-session chat.&lt;/strong&gt; In a deep memory retrieval task, the agent is asked about something from an earlier session. MemGPT answered far more of these correctly than the same models with a fixed context. In a “conversation opener” task, its openers drew on what it knew about the person, and the authors found that saving facts to working context was key.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Document analysis.&lt;/strong&gt; For question answering over many documents, MemGPT could page through more search results than fit in one prompt. In a nested key-value lookup task, where one value points to another key, fixed-context models broke down as nesting got deeper, while MemGPT with GPT-4 kept answering by looking things up repeatedly.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;why-it-matters-for-builders&quot;&gt;Why it matters for builders&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Memory can be a set of tools, not just a bigger prompt.&lt;/strong&gt; Giving the model explicit read/write/search functions makes memory something you can inspect and log.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Separate “always in view” from “look it up.”&lt;/strong&gt; A small working context of key facts plus searchable history is a pattern that shows up again and again in agent memory designs.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Plan for overflow.&lt;/strong&gt; Warning before the window fills, and summarizing instead of silently truncating, is a simple idea worth copying.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;honest-caveats&quot;&gt;Honest caveats&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;It leans on the model’s function-calling skill.&lt;/strong&gt; The authors report that results dropped noticeably with GPT-3.5, which was weaker at calling functions.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Retrieval is still the bottleneck.&lt;/strong&gt; With embedding search, the right document often wasn’t near the top, and the agent tended to stop paging before exhausting the results.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;More model isn’t always better.&lt;/strong&gt; On the nested lookup task, the GPT-4 Turbo version did worse than GPT-4, and some versions gave up after too few lookups.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Self-managed memory is a judgment call by the model.&lt;/strong&gt; What gets saved, summarized or forgotten depends on the model’s choices, which is harder to predict than a fixed rule.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Earlier in the series: &lt;a href=&quot;/post/paper-tldr-locomo-long-term-memory-benchmark/&quot;&gt;LoCoMo&lt;/a&gt; (a benchmark for exactly this kind of long-term memory), &lt;a href=&quot;/post/paper-tldr-sentence-bert/&quot;&gt;Sentence-BERT&lt;/a&gt; (the embeddings behind most semantic search), and &lt;a href=&quot;/post/paper-tldr-complementary-learning-systems/&quot;&gt;Complementary Learning Systems&lt;/a&gt; (a brain-inspired split between fast and slow memory).&lt;/p&gt;

&lt;p&gt;Terms like &lt;a href=&quot;/post/agent-memory-glossary/#virtual-context&quot;&gt;&lt;em&gt;virtual context&lt;/em&gt;&lt;/a&gt;, &lt;a href=&quot;/post/agent-memory-glossary/#context-window&quot;&gt;&lt;em&gt;context window&lt;/em&gt;&lt;/a&gt;, &lt;a href=&quot;/post/agent-memory-glossary/#episodic-memory&quot;&gt;&lt;em&gt;episodic memory&lt;/em&gt;&lt;/a&gt; and &lt;a href=&quot;/post/agent-memory-glossary/#top-k-retrieval&quot;&gt;&lt;em&gt;top-k retrieval&lt;/em&gt;&lt;/a&gt; are defined in the &lt;a href=&quot;/post/agent-memory-glossary/&quot;&gt;agent memory glossary&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title type="html">Paper TL;DR: Hopfield (1982) — Memory as a Valley You Roll Into</title>
    <link href="https://www.avinashgosavi.com/post/paper-tldr-hopfield-1982/" rel="alternate" type="text/html" title="Paper TL;DR: Hopfield (1982) — Memory as a Valley You Roll Into"/>
    <id>https://www.avinashgosavi.com/post/paper-tldr-hopfield-1982/</id>
    <published>2026-10-18T22:00:00+00:00</published>
    <updated>2026-10-18T22:00:00+00:00</updated>
    <category term="Research"/>
    <category term="Agent memory"/>
    <summary type="html">A plain-language TL;DR of John Hopfield&apos;s 1982 paper on associative memory: energy landscapes, Hebbian storage, recall from partial cues and its limits — with a 25-line NumPy demo.</summary>
    <content type="html" xml:base="https://www.avinashgosavi.com/post/paper-tldr-hopfield-1982/">&lt;p&gt;&lt;strong&gt;Paper:&lt;/strong&gt; J. J. Hopfield, &lt;a href=&quot;https://www.pnas.org/doi/10.1073/pnas.79.8.2554&quot;&gt;&lt;em&gt;Neural networks and physical systems with emergent collective computational abilities&lt;/em&gt;&lt;/a&gt;, PNAS 79(8), 1982&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One-line TL;DR:&lt;/strong&gt; connect lots of simple on/off neurons with symmetric weights and the network gets an energy that only goes down as it runs — so stored memories become stable valleys, and a partial or noisy cue rolls downhill into the full memory.&lt;/p&gt;

&lt;p&gt;Almost everything I’ve built around memory started here. It’s also one of the most readable classic papers I know: five pages, very little math, a physicist explaining computation.&lt;/p&gt;

&lt;h2 id=&quot;the-setup&quot;&gt;The setup&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Neurons&lt;/strong&gt; are either on or off (+1 or −1).&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Every neuron connects to every other&lt;/strong&gt;, and the connection strengths are &lt;strong&gt;symmetric&lt;/strong&gt;: the weight from A to B equals the weight from B to A.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Storing a memory&lt;/strong&gt; uses a Hebbian rule — “neurons that fire together wire together.” For each pattern you want to remember, strengthen connections between neurons that agree and weaken those between neurons that disagree. Store several patterns by adding up their contributions.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Recalling&lt;/strong&gt; means picking neurons one at a time and flipping each to agree with the weighted vote of its neighbors, until nothing changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;the-key-insight-an-energy-that-only-goes-down&quot;&gt;The key insight: an energy that only goes down&lt;/h2&gt;

&lt;p&gt;Hopfield’s move was to define an &lt;strong&gt;energy&lt;/strong&gt; for the whole network’s state and show that, with symmetric weights and one-at-a-time updates, every update either lowers the energy or leaves it unchanged. The network can’t cycle forever; it has to settle.&lt;/p&gt;

&lt;p&gt;Stored patterns sit at the bottoms of valleys in that energy landscape. Start anywhere nearby — a corrupted photo, half a phone number — and the network slides down into the nearest stored memory. That’s &lt;strong&gt;content-addressable memory&lt;/strong&gt;: you retrieve by &lt;em&gt;what&lt;/em&gt; you remember, not by &lt;em&gt;where&lt;/em&gt; it’s stored. It’s also robust: knock out some neurons or connections and recall still mostly works.&lt;/p&gt;

&lt;h2 id=&quot;twenty-five-lines-of-numpy&quot;&gt;Twenty-five lines of NumPy&lt;/h2&gt;

&lt;p&gt;Store five random patterns in 100 neurons, flip 30% of the bits of one, and let it settle:&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;numpy&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;rng&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;random&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;default_rng&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;N&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;P&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;patterns&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rng&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;choice&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;P&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;N&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;W&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;patterns&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;T&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;@&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;patterns&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;N&lt;/span&gt;        &lt;span class=&quot;c1&quot;&gt;# Hebbian storage
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;fill_diagonal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;W&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;                 &lt;span class=&quot;c1&quot;&gt;# no self-connections
&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;energy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.5&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;@&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;W&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;@&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;recall&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sweeps&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;copy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sweeps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rng&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;permutation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;N&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;   &lt;span class=&quot;c1&quot;&gt;# one neuron at a time
&lt;/span&gt;            &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;W&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;@&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;target&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;patterns&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;noisy&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;copy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;noisy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rng&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;choice&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;N&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;False&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;out&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;recall&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;noisy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;noisy&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mean&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;out&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mean&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;   &lt;span class=&quot;c1&quot;&gt;# 0.7 -&amp;gt; 1.0
&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;round&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;energy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;noisy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;round&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;energy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;     &lt;span class=&quot;c1&quot;&gt;# -8.6 -&amp;gt; -50.5
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;70% correct goes to 100% correct, and the energy drops as it does.&lt;/p&gt;

&lt;h2 id=&quot;the-limits&quot;&gt;The limits&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Capacity is small.&lt;/strong&gt; Hopfield found the network reliably holds only about &lt;strong&gt;0.15 memories per neuron&lt;/strong&gt;. Push past that and recall falls apart.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Spurious memories.&lt;/strong&gt; The landscape also grows valleys nobody stored — blends of real memories — and a cue can get stuck in one.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Similar memories interfere.&lt;/strong&gt; Patterns that overlap a lot blur into each other.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those limits are exactly what the 2020 follow-up fixes: &lt;a href=&quot;/post/paper-tldr-hopfield-networks-is-all-you-need/&quot;&gt;modern Hopfield networks&lt;/a&gt; sharpen the valleys so capacity grows exponentially — and their update turns out to be transformer attention.&lt;/p&gt;

&lt;h2 id=&quot;why-it-still-matters-to-me&quot;&gt;Why it still matters to me&lt;/h2&gt;

&lt;p&gt;Databases retrieve by key. Vector stores retrieve by nearest neighbor. Hopfield networks retrieve by &lt;strong&gt;settling&lt;/strong&gt; — pattern completion from a partial cue, which is much closer to how remembering feels. That idea is the reason &lt;a href=&quot;/post/attractor-memory-engine/&quot;&gt;Attractor&lt;/a&gt; is called Attractor.&lt;/p&gt;

&lt;p&gt;That completes the six papers from &lt;a href=&quot;/post/paper-tldr-six-papers-on-memory/&quot;&gt;Part 1&lt;/a&gt;. The whole list, with short TL;DRs, lives on my &lt;a href=&quot;/research/#papershelf&quot;&gt;papershelf&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For a one-paragraph definition of &lt;a href=&quot;/post/agent-memory-glossary/#associative-memory&quot;&gt;&lt;em&gt;associative (content-addressable) memory&lt;/em&gt;&lt;/a&gt;, see the &lt;a href=&quot;/post/agent-memory-glossary/&quot;&gt;agent memory glossary&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title type="html">Paper TL;DR: Sentence-BERT — The Quiet Workhorse Behind Semantic Search</title>
    <link href="https://www.avinashgosavi.com/post/paper-tldr-sentence-bert/" rel="alternate" type="text/html" title="Paper TL;DR: Sentence-BERT — The Quiet Workhorse Behind Semantic Search"/>
    <id>https://www.avinashgosavi.com/post/paper-tldr-sentence-bert/</id>
    <published>2026-10-18T21:00:00+00:00</published>
    <updated>2026-10-18T21:00:00+00:00</updated>
    <category term="Research"/>
    <category term="Agent memory"/>
    <summary type="html">A plain-language TL;DR of Sentence-BERT (Reimers &amp; Gurevych, 2019): why plain BERT is too slow for search, how siamese training fixes it, and why it still powers most semantic search.</summary>
    <content type="html" xml:base="https://www.avinashgosavi.com/post/paper-tldr-sentence-bert/">&lt;p&gt;&lt;strong&gt;Paper:&lt;/strong&gt; Nils Reimers &amp;amp; Iryna Gurevych, &lt;a href=&quot;https://arxiv.org/abs/1908.10084&quot;&gt;&lt;em&gt;Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks&lt;/em&gt;&lt;/a&gt; (EMNLP 2019)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One-line TL;DR:&lt;/strong&gt; fine-tune BERT so that every sentence gets its own fixed-size embedding you can compare with cosine similarity — turning semantic search over thousands of sentences from hours into seconds.&lt;/p&gt;

&lt;p&gt;It’s the least flashy paper in this series and the one my code depends on most. Every time Attractor, VaultMem or daylog “searches by meaning,” it’s using a model descended from this paper.&lt;/p&gt;

&lt;h2 id=&quot;the-problem-bert-is-a-slow-judge&quot;&gt;The problem: BERT is a slow judge&lt;/h2&gt;

&lt;p&gt;In 2019, BERT was the best tool for deciding whether two sentences meant the same thing — but only if you fed it &lt;strong&gt;both sentences together&lt;/strong&gt;. That works for scoring one pair. It falls apart for search.&lt;/p&gt;

&lt;p&gt;The paper’s example: to find the most similar pair in a collection of 10,000 sentences, BERT would need around 50 million pairwise passes — roughly &lt;strong&gt;65 hours&lt;/strong&gt; on a GPU. And you can’t precompute anything, because every score depends on both sentences at once.&lt;/p&gt;

&lt;p&gt;The obvious shortcut — run each sentence through BERT alone and average its outputs (or take the special &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[CLS]&lt;/code&gt; token) — produced embeddings that were often &lt;em&gt;worse&lt;/em&gt; than old-fashioned averaged word vectors.&lt;/p&gt;

&lt;h2 id=&quot;the-fix-train-it-to-embed&quot;&gt;The fix: train it to embed&lt;/h2&gt;

&lt;p&gt;Sentence-BERT puts two copies of the same BERT side by side (a &lt;strong&gt;siamese&lt;/strong&gt; network — shared weights), runs one sentence through each, pools each output into a single vector, and trains the whole thing so that:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;sentences that mean similar things land close together, and&lt;/li&gt;
  &lt;li&gt;sentences that don’t land far apart.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They trained on natural-language-inference data (pairs labeled entailment / contradiction / neutral) and on similarity-scored pairs. Afterward you throw away the “pair” setup: each sentence goes through the model &lt;strong&gt;once&lt;/strong&gt;, you store its vector, and comparing two sentences is a cheap cosine similarity.&lt;/p&gt;

&lt;p&gt;That same 10,000-sentence search drops to about &lt;strong&gt;5 seconds&lt;/strong&gt;.&lt;/p&gt;

&lt;h2 id=&quot;why-it-still-matters&quot;&gt;Why it still matters&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;It made vector search practical.&lt;/strong&gt; Embed once, store in an index (pgvector, Qdrant, HNSW), and query in milliseconds. That’s the foundation of nearly every &lt;a href=&quot;/post/paper-tldr-retrieval-augmented-generation/&quot;&gt;RAG&lt;/a&gt; system and agent memory store.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;The library outlived the paper.&lt;/strong&gt; The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sentence-transformers&lt;/code&gt; package that came out of this work is still how most people get embedding models running in a few lines.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Small models are often enough.&lt;/strong&gt; The 384-dimension model I use in &lt;a href=&quot;/post/attractor-memory-engine/&quot;&gt;Attractor&lt;/a&gt; runs comfortably on a CPU — handy when the whole point is &lt;a href=&quot;/uses/&quot;&gt;keeping data on hardware you own&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;caveats-worth-knowing&quot;&gt;Caveats worth knowing&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Bi-encoders like SBERT trade a little accuracy for speed. When precision matters, a common pattern is to retrieve with embeddings, then &lt;strong&gt;re-rank&lt;/strong&gt; the top results with a slower cross-encoder.&lt;/li&gt;
  &lt;li&gt;“Similar meaning” is whatever the training data said it was. Domain-specific text (logs, configs, medical notes) often needs a domain-tuned model.&lt;/li&gt;
  &lt;li&gt;Embeddings find &lt;em&gt;related&lt;/em&gt; text; they don’t reason. Multi-hop questions — the ones &lt;a href=&quot;/post/paper-tldr-locomo-long-term-memory-benchmark/&quot;&gt;LoCoMo&lt;/a&gt; showed are hardest — need more than nearest neighbors.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Earlier in the series: &lt;a href=&quot;/post/paper-tldr-six-papers-on-memory/&quot;&gt;six papers on AI memory&lt;/a&gt;, &lt;a href=&quot;/post/paper-tldr-hopfield-networks-is-all-you-need/&quot;&gt;Hopfield Networks Is All You Need&lt;/a&gt;, &lt;a href=&quot;/post/paper-tldr-complementary-learning-systems/&quot;&gt;Complementary Learning Systems&lt;/a&gt;, &lt;a href=&quot;/post/paper-tldr-locomo-long-term-memory-benchmark/&quot;&gt;LoCoMo&lt;/a&gt; and &lt;a href=&quot;/post/paper-tldr-memory-as-asset/&quot;&gt;Memory as Asset&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/post/agent-memory-glossary/#embedding&quot;&gt;&lt;em&gt;Embeddings&lt;/em&gt;&lt;/a&gt;, &lt;a href=&quot;/post/agent-memory-glossary/#hnsw&quot;&gt;&lt;em&gt;HNSW&lt;/em&gt;&lt;/a&gt; and &lt;a href=&quot;/post/agent-memory-glossary/#re-ranking&quot;&gt;&lt;em&gt;re-ranking&lt;/em&gt;&lt;/a&gt; each get a short definition in the &lt;a href=&quot;/post/agent-memory-glossary/#storing-and-finding-memories&quot;&gt;agent memory glossary&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title type="html">Paper TL;DR: Memory as Asset — Whose Memory Is It Anyway?</title>
    <link href="https://www.avinashgosavi.com/post/paper-tldr-memory-as-asset/" rel="alternate" type="text/html" title="Paper TL;DR: Memory as Asset — Whose Memory Is It Anyway?"/>
    <id>https://www.avinashgosavi.com/post/paper-tldr-memory-as-asset/</id>
    <published>2026-10-18T20:00:00+00:00</published>
    <updated>2026-10-18T20:00:00+00:00</updated>
    <category term="Research"/>
    <category term="Agent memory"/>
    <category term="Privacy"/>
    <summary type="html">A plain-language TL;DR of Memory as Asset (Pan, Huang &amp; Yang, 2026): moving AI memory from agent-centric to human-centric, its three principles and three layers, and how it shaped VaultMem.</summary>
    <content type="html" xml:base="https://www.avinashgosavi.com/post/paper-tldr-memory-as-asset/">&lt;p&gt;&lt;strong&gt;Paper:&lt;/strong&gt; Yanqi Pan, Qinghao Huang &amp;amp; Weihao Yang, &lt;a href=&quot;https://arxiv.org/abs/2603.14212&quot;&gt;&lt;em&gt;Memory as Asset: From Agent-centric to Human-centric Memory Management&lt;/em&gt;&lt;/a&gt; (arXiv, March 2026)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One-line TL;DR:&lt;/strong&gt; the memory an AI keeps about you is designed today as the agent’s internal resource; this paper argues it should be &lt;em&gt;your&lt;/em&gt; asset — owned by you, shared only under your permissions, and able to grow over time.&lt;/p&gt;

&lt;p&gt;This is the paper that reshaped &lt;a href=&quot;/series/#vaultmem&quot;&gt;VaultMem&lt;/a&gt;. I found it while I was stuck on a vague feeling that something about agent memory was backwards, and it gave that feeling a name.&lt;/p&gt;

&lt;h2 id=&quot;the-problem-agent-centric-memory&quot;&gt;The problem: agent-centric memory&lt;/h2&gt;

&lt;p&gt;Most memory systems treat what an agent remembers about you as part of the agent — stored by the platform, shaped for the platform’s use, and stuck there. The authors call this &lt;strong&gt;agent-centric&lt;/strong&gt; memory. The consequences are familiar: you can’t take your history with you, you can’t decide who sees it, and every product rebuilds its own isolated “memory island” about the same person.&lt;/p&gt;

&lt;h2 id=&quot;the-proposal-memory-as-a-personal-asset&quot;&gt;The proposal: memory as a personal asset&lt;/h2&gt;

&lt;p&gt;They propose flipping the default, built on three principles:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Memory in hand&lt;/strong&gt; — individuals own and control their memories, not centralized platforms.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Memory groups&lt;/strong&gt; — memories can be shared and combined, but only through permissions the owner sets.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Collective memory evolution&lt;/strong&gt; — memory isn’t frozen: it’s recorded, consolidated and abstracted into higher-level knowledge over time, and can be exchanged between groups under control.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each memory object carries its content, context, an explicit &lt;strong&gt;owner&lt;/strong&gt;, an &lt;strong&gt;access policy&lt;/strong&gt; and a &lt;strong&gt;version&lt;/strong&gt;. Ownership and permissions are part of the data itself, not an afterthought in some admin panel.&lt;/p&gt;

&lt;h2 id=&quot;the-three-layers&quot;&gt;The three layers&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Personal storage&lt;/strong&gt; — fast storage of each person’s private memory objects.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Evolution&lt;/strong&gt; — updates memory from interactions: recording experiences, merging related memories, abstracting knowledge. It can run locally for privacy or remotely for compute.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Memory exchange network&lt;/strong&gt; — a decentralized way to discover, authenticate and exchange memory assets.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Notably, the paper doesn’t insist everything stays on your device. If a provider hosts your memory, it should be encrypted so only you can read it.&lt;/p&gt;

&lt;h2 id=&quot;how-it-shaped-what-i-built&quot;&gt;How it shaped what I built&lt;/h2&gt;

&lt;p&gt;That last point is where VaultMem lives. I treat it as an implementation of the &lt;strong&gt;first layer&lt;/strong&gt;: the platform stores your memories, but they’re encrypted with a key only you hold, so the operator cryptographically can’t read them. Everything in &lt;a href=&quot;/series/#vaultmem&quot;&gt;the VaultMem series&lt;/a&gt; — client-side encryption, encrypted search, &lt;a href=&quot;/post/vaultmem-part-3-pii-sanitizer/&quot;&gt;keeping PII away from the model provider&lt;/a&gt; — follows from taking “memory in hand” literally.&lt;/p&gt;

&lt;h2 id=&quot;caveats-worth-knowing&quot;&gt;Caveats worth knowing&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;The authors are upfront that this is an &lt;strong&gt;early draft&lt;/strong&gt;: the terms and design are still evolving.&lt;/li&gt;
  &lt;li&gt;It’s a &lt;strong&gt;conceptual and architectural&lt;/strong&gt; paper — there are no benchmarks or experiments yet. The claim that existing systems meet at most two of the three principles is an argument, not a measurement.&lt;/li&gt;
  &lt;li&gt;The exchange network raises hard questions (trust, incentives, revocation) that the paper sketches rather than solves.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I still think it’s the right question to ask before building any memory feature: &lt;em&gt;whose memory is this?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Earlier in the series: &lt;a href=&quot;/post/paper-tldr-six-papers-on-memory/&quot;&gt;six papers on AI memory&lt;/a&gt;, &lt;a href=&quot;/post/paper-tldr-hopfield-networks-is-all-you-need/&quot;&gt;Hopfield Networks Is All You Need&lt;/a&gt;, &lt;a href=&quot;/post/paper-tldr-complementary-learning-systems/&quot;&gt;Complementary Learning Systems&lt;/a&gt; and &lt;a href=&quot;/post/paper-tldr-locomo-long-term-memory-benchmark/&quot;&gt;LoCoMo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/post/agent-memory-glossary/#zero-knowledge-storage&quot;&gt;&lt;em&gt;Zero-knowledge storage&lt;/em&gt;&lt;/a&gt; and &lt;a href=&quot;/post/agent-memory-glossary/#client-side-encryption&quot;&gt;&lt;em&gt;client-side encryption&lt;/em&gt;&lt;/a&gt; are defined in the privacy section of the &lt;a href=&quot;/post/agent-memory-glossary/#privacy&quot;&gt;agent memory glossary&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title type="html">Paper TL;DR: LoCoMo — How Good Is Your Agent&apos;s Memory, Really?</title>
    <link href="https://www.avinashgosavi.com/post/paper-tldr-locomo-long-term-memory-benchmark/" rel="alternate" type="text/html" title="Paper TL;DR: LoCoMo — How Good Is Your Agent&apos;s Memory, Really?"/>
    <id>https://www.avinashgosavi.com/post/paper-tldr-locomo-long-term-memory-benchmark/</id>
    <published>2026-10-18T19:00:00+00:00</published>
    <updated>2026-10-18T19:00:00+00:00</updated>
    <category term="Research"/>
    <category term="Agent memory"/>
    <summary type="html">A plain-language TL;DR of the LoCoMo benchmark (Maharana et al., 2024) for very long-term conversational memory — what it tests, what it found, and how I used it to evaluate VaultMem.</summary>
    <content type="html" xml:base="https://www.avinashgosavi.com/post/paper-tldr-locomo-long-term-memory-benchmark/">&lt;p&gt;&lt;strong&gt;Paper:&lt;/strong&gt; Maharana et al., &lt;a href=&quot;https://arxiv.org/abs/2402.17753&quot;&gt;&lt;em&gt;Evaluating Very Long-Term Conversational Memory of LLM Agents&lt;/em&gt;&lt;/a&gt; (ACL 2024)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One-line TL;DR:&lt;/strong&gt; LoCoMo is a benchmark of very long, multi-session conversations with questions that probe whether a system really remembers — and even strong long-context models and retrieval setups fall well short of people on it.&lt;/p&gt;

&lt;p&gt;If you’re building memory for an agent, this is the paper that keeps you honest.&lt;/p&gt;

&lt;h2 id=&quot;whats-in-the-benchmark&quot;&gt;What’s in the benchmark&lt;/h2&gt;

&lt;p&gt;Most chat benchmarks are a few turns long. LoCoMo conversations run for &lt;strong&gt;dozens of sessions and hundreds of turns&lt;/strong&gt;, spread over simulated weeks and months. The authors generated them with LLM agents that each had a persona and a timeline of life events, then had people review and fix them so the conversations stay consistent. Some turns include shared images, too.&lt;/p&gt;

&lt;p&gt;On top of the conversations they built three tasks: answering questions, summarizing events, and generating responses. The question-answering part is the one I care about, and its categories are what make it useful:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Single-hop&lt;/strong&gt; — one fact from one place in the history.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Multi-hop&lt;/strong&gt; — needs to connect facts from different sessions.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Temporal&lt;/strong&gt; — when did something happen, or what happened before or after.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Open-domain&lt;/strong&gt; — combine the conversation with general knowledge.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Adversarial&lt;/strong&gt; — questions about things that &lt;em&gt;never&lt;/em&gt; happened, where the right answer is “that wasn’t mentioned.”&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;what-they-found&quot;&gt;What they found&lt;/h2&gt;

&lt;p&gt;Even with long context windows or &lt;a href=&quot;/post/paper-tldr-retrieval-augmented-generation/&quot;&gt;retrieval-augmented generation&lt;/a&gt;, models trail human performance by a wide margin. Retrieval helps, but the hard categories stay hard — especially reasoning about time and resisting the urge to make up answers to adversarial questions. Bigger context alone doesn’t fix it.&lt;/p&gt;

&lt;h2 id=&quot;how-i-used-it&quot;&gt;How I used it&lt;/h2&gt;

&lt;p&gt;When I built &lt;a href=&quot;/series/#vaultmem&quot;&gt;VaultMem&lt;/a&gt;, my first benchmark was 18 synthetic memories I wrote myself. It looked great — which was the problem. LoCoMo gave me a test I didn’t design. &lt;a href=&quot;/post/vaultmem-part-2-multimodal-temporal-backends/&quot;&gt;On a sample of its questions&lt;/a&gt;, retrieval was strong for single-hop facts and weakest for multi-hop, which needs pieces that weren’t individually asked about. That’s a retrieval problem before it’s a model problem, and it changed what I worked on next.&lt;/p&gt;

&lt;h2 id=&quot;the-takeaway-for-builders&quot;&gt;The takeaway for builders&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Test against data you didn’t write.&lt;/strong&gt; A memory system always looks good on its author’s examples.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Score by category, not just overall.&lt;/strong&gt; “85% accurate” hides that temporal and multi-hop questions might be failing.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Measure the “I don’t know.”&lt;/strong&gt; A memory that confidently invents a past is worse than one that admits a gap.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Earlier in the series: &lt;a href=&quot;/post/paper-tldr-six-papers-on-memory/&quot;&gt;six papers on AI memory&lt;/a&gt;, &lt;a href=&quot;/post/paper-tldr-hopfield-networks-is-all-you-need/&quot;&gt;Hopfield Networks Is All You Need&lt;/a&gt;, and &lt;a href=&quot;/post/paper-tldr-complementary-learning-systems/&quot;&gt;Complementary Learning Systems&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/post/agent-memory-glossary/#recall-at-k&quot;&gt;&lt;em&gt;Recall@k&lt;/em&gt;&lt;/a&gt; and &lt;a href=&quot;/post/agent-memory-glossary/#mrr&quot;&gt;&lt;em&gt;MRR&lt;/em&gt;&lt;/a&gt;, the usual ways to score retrieval, are explained in the &lt;a href=&quot;/post/agent-memory-glossary/#measuring-it&quot;&gt;agent memory glossary&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title type="html">Paper TL;DR: Complementary Learning Systems — Why Agents Need Two Kinds of Memory</title>
    <link href="https://www.avinashgosavi.com/post/paper-tldr-complementary-learning-systems/" rel="alternate" type="text/html" title="Paper TL;DR: Complementary Learning Systems — Why Agents Need Two Kinds of Memory"/>
    <id>https://www.avinashgosavi.com/post/paper-tldr-complementary-learning-systems/</id>
    <published>2026-10-18T18:00:00+00:00</published>
    <updated>2026-10-18T18:00:00+00:00</updated>
    <category term="Research"/>
    <category term="Agent memory"/>
    <summary type="html">A plain-language TL;DR of McClelland, McNaughton &amp; O&apos;Reilly (1995): the brain&apos;s fast and slow learners, catastrophic interference, and what it suggests for designing memory in AI agents.</summary>
    <content type="html" xml:base="https://www.avinashgosavi.com/post/paper-tldr-complementary-learning-systems/">&lt;p&gt;&lt;strong&gt;Paper:&lt;/strong&gt; McClelland, McNaughton &amp;amp; O’Reilly, &lt;a href=&quot;https://doi.org/10.1037/0033-295X.102.3.419&quot;&gt;&lt;em&gt;Why there are complementary learning systems in the hippocampus and neocortex&lt;/em&gt;&lt;/a&gt;, Psychological Review (1995)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One-line TL;DR:&lt;/strong&gt; the brain learns with two systems on purpose — a fast one that grabs specific experiences and a slow one that gradually extracts general knowledge — because a single system can’t do both without wrecking what it already knows.&lt;/p&gt;

&lt;p&gt;It’s a 1995 psychology paper, and it’s one of the most useful things I’ve read about designing memory for AI agents.&lt;/p&gt;

&lt;h2 id=&quot;the-problem-learning-fast-breaks-things&quot;&gt;The problem: learning fast breaks things&lt;/h2&gt;

&lt;p&gt;The paper starts from a puzzle that anyone who has fine-tuned a neural network will recognize. If you teach a network something new by adjusting the same shared weights that hold everything else, the new learning can overwrite the old. This is &lt;strong&gt;catastrophic interference&lt;/strong&gt;: learn B, forget A.&lt;/p&gt;

&lt;p&gt;The fix that works in artificial networks is to learn slowly and &lt;em&gt;interleave&lt;/em&gt; — mix new examples with old ones so the weights find a setting that serves both. But that’s slow. You can’t wait for hundreds of repetitions to remember where you parked this morning.&lt;/p&gt;

&lt;h2 id=&quot;the-brains-answer-two-learners&quot;&gt;The brain’s answer: two learners&lt;/h2&gt;

&lt;p&gt;The authors argue the brain splits the job:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Hippocampus — the fast learner.&lt;/strong&gt; Stores specific episodes quickly, often after a single exposure, using sparse, separate codes so similar memories don’t collide. Great for “what happened at Tuesday’s meeting.”&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Neocortex — the slow learner.&lt;/strong&gt; Learns gradually, with overlapping representations that capture structure shared across many experiences. Great for “how meetings at my company usually go.”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The bridge between them is &lt;strong&gt;replay&lt;/strong&gt;. Over time — notably during sleep — the hippocampus reactivates recent episodes, and the neocortex learns from those replays &lt;em&gt;interleaved&lt;/em&gt; with older knowledge. That’s consolidation: specific memories slowly become general knowledge without overwriting what came before.&lt;/p&gt;

&lt;figure class=&quot;diagram&quot;&gt;
&lt;svg viewBox=&quot;0 0 360 372&quot; role=&quot;img&quot; aria-labelledby=&quot;cls-dg-title cls-dg-desc&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
  &lt;title id=&quot;cls-dg-title&quot;&gt;Two learners connected by replay&lt;/title&gt;
  &lt;desc id=&quot;cls-dg-desc&quot;&gt;A new experience is written quickly into the hippocampus, the fast learner that stores specific episodes; in an agent this is an episodic log or vector store. Replay, interleaved with older knowledge, slowly teaches the neocortex, the slow learner that extracts general structure; in an agent this is consolidated facts and preferences.&lt;/desc&gt;
  &lt;defs&gt;
    &lt;marker id=&quot;cls-dg-arrow&quot; viewBox=&quot;0 0 10 10&quot; refX=&quot;9&quot; refY=&quot;5&quot; markerWidth=&quot;7&quot; markerHeight=&quot;7&quot; orient=&quot;auto-start-reverse&quot;&gt;
      &lt;path class=&quot;dg-head&quot; d=&quot;M0 0 L10 5 L0 10 z&quot; /&gt;
    &lt;/marker&gt;
  &lt;/defs&gt;
  &lt;rect class=&quot;dg-pill&quot; x=&quot;105&quot; y=&quot;4&quot; width=&quot;150&quot; height=&quot;36&quot; rx=&quot;18&quot; /&gt;
  &lt;text class=&quot;dg-strong&quot; x=&quot;180&quot; y=&quot;27&quot; text-anchor=&quot;middle&quot;&gt;New experience&lt;/text&gt;
  &lt;line class=&quot;dg-line&quot; x1=&quot;180&quot; y1=&quot;42&quot; x2=&quot;180&quot; y2=&quot;86&quot; marker-end=&quot;url(#cls-dg-arrow)&quot; /&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;192&quot; y=&quot;69&quot;&gt;written once, fast&lt;/text&gt;
  &lt;rect class=&quot;dg-box&quot; x=&quot;20&quot; y=&quot;90&quot; width=&quot;320&quot; height=&quot;92&quot; rx=&quot;10&quot; /&gt;
  &lt;text class=&quot;dg-strong&quot; x=&quot;180&quot; y=&quot;118&quot; text-anchor=&quot;middle&quot;&gt;Hippocampus · fast learner&lt;/text&gt;
  &lt;text class=&quot;dg-body&quot; x=&quot;180&quot; y=&quot;140&quot; text-anchor=&quot;middle&quot;&gt;keeps specific episodes apart&lt;/text&gt;
  &lt;text class=&quot;dg-agent&quot; x=&quot;180&quot; y=&quot;166&quot; text-anchor=&quot;middle&quot;&gt;agent: episodic log / vector store&lt;/text&gt;
  &lt;line class=&quot;dg-line dg-dash&quot; x1=&quot;180&quot; y1=&quot;184&quot; x2=&quot;180&quot; y2=&quot;254&quot; marker-end=&quot;url(#cls-dg-arrow)&quot; /&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;192&quot; y=&quot;214&quot;&gt;replay, mixed with&lt;/text&gt;
  &lt;text class=&quot;dg-note&quot; x=&quot;192&quot; y=&quot;232&quot;&gt;older knowledge&lt;/text&gt;
  &lt;rect class=&quot;dg-box&quot; x=&quot;20&quot; y=&quot;258&quot; width=&quot;320&quot; height=&quot;92&quot; rx=&quot;10&quot; /&gt;
  &lt;text class=&quot;dg-strong&quot; x=&quot;180&quot; y=&quot;286&quot; text-anchor=&quot;middle&quot;&gt;Neocortex · slow learner&lt;/text&gt;
  &lt;text class=&quot;dg-body&quot; x=&quot;180&quot; y=&quot;308&quot; text-anchor=&quot;middle&quot;&gt;extracts general structure&lt;/text&gt;
  &lt;text class=&quot;dg-agent&quot; x=&quot;180&quot; y=&quot;334&quot; text-anchor=&quot;middle&quot;&gt;agent: consolidated facts &amp;amp; preferences&lt;/text&gt;
&lt;/svg&gt;
&lt;figcaption&gt;The two-learner idea from the paper, with the agent-memory equivalent of each part.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;The paper backs this with evidence from people with hippocampal damage, who struggle to form new episodic memories yet keep older knowledge, and with network simulations showing why interleaved learning avoids interference.&lt;/p&gt;

&lt;h2 id=&quot;why-it-matters-for-ai-agents&quot;&gt;Why it matters for AI agents&lt;/h2&gt;

&lt;p&gt;Read with agents in mind, the paper is basically a design doc:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Keep an episodic store separate from the model.&lt;/strong&gt; Fine-tuning a model on every conversation is the “learn fast in shared weights” mistake. A separate, fast-writing memory — a log or vector store of specific events — is the hippocampus.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Consolidate on a schedule, not on every write.&lt;/strong&gt; Periodically summarize or distill many episodes into durable facts and preferences, mixing in what’s already known instead of overwriting it.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Let memories change over time.&lt;/strong&gt; Things that keep getting recalled should get stronger; one-off details can fade. A store that treats every memory as equally permanent forever is missing half the design.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is the model I borrowed for &lt;a href=&quot;/post/attractor-memory-engine/&quot;&gt;Attractor&lt;/a&gt;: memories carry the context they were formed in, track how often they’re used, and are meant to strengthen or decay rather than sit frozen.&lt;/p&gt;

&lt;h2 id=&quot;caveats-worth-knowing&quot;&gt;Caveats worth knowing&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;The theory has been extended since 1995 — the neocortex can learn new things quickly when they fit an existing schema — so “neocortex is always slow” is a simplification.&lt;/li&gt;
  &lt;li&gt;Brains aren’t databases; the analogy is a guide for design choices, not a blueprint.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next in the series: the benchmark that told me how good my own memory system actually was. Earlier parts: &lt;a href=&quot;/post/paper-tldr-six-papers-on-memory/&quot;&gt;six papers on AI memory&lt;/a&gt; and &lt;a href=&quot;/post/paper-tldr-hopfield-networks-is-all-you-need/&quot;&gt;Hopfield Networks Is All You Need&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Quick definitions of &lt;a href=&quot;/post/agent-memory-glossary/#consolidation&quot;&gt;&lt;em&gt;consolidation&lt;/em&gt;&lt;/a&gt; and &lt;a href=&quot;/post/agent-memory-glossary/#decay&quot;&gt;&lt;em&gt;decay&lt;/em&gt;&lt;/a&gt; are in the &lt;a href=&quot;/post/agent-memory-glossary/&quot;&gt;agent memory glossary&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title type="html">Paper TL;DR: Hopfield Networks Is All You Need — Attention Is a Memory Lookup</title>
    <link href="https://www.avinashgosavi.com/post/paper-tldr-hopfield-networks-is-all-you-need/" rel="alternate" type="text/html" title="Paper TL;DR: Hopfield Networks Is All You Need — Attention Is a Memory Lookup"/>
    <id>https://www.avinashgosavi.com/post/paper-tldr-hopfield-networks-is-all-you-need/</id>
    <published>2026-10-18T17:00:00+00:00</published>
    <updated>2026-10-18T17:00:00+00:00</updated>
    <category term="Research"/>
    <category term="Agent memory"/>
    <summary type="html">A plain-language walkthrough of Ramsauer et al. (2020): how modern Hopfield networks store exponentially many memories and why their update rule is transformer attention — with 20 lines of NumPy.</summary>
    <content type="html" xml:base="https://www.avinashgosavi.com/post/paper-tldr-hopfield-networks-is-all-you-need/">&lt;p&gt;&lt;strong&gt;Paper:&lt;/strong&gt; Ramsauer, Schäfl, Lehner et al., &lt;a href=&quot;https://arxiv.org/abs/2008.02217&quot;&gt;&lt;em&gt;Hopfield Networks is All You Need&lt;/em&gt;&lt;/a&gt; (2020)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One-line TL;DR:&lt;/strong&gt; a continuous version of the 1982 Hopfield network can store exponentially many memories, usually retrieves one in a single step — and that single step is exactly the attention operation inside every transformer.&lt;/p&gt;

&lt;p&gt;This is the paper that made me stop thinking of Hopfield networks as history. Here’s the idea in plain language, plus a tiny demo you can run.&lt;/p&gt;

&lt;h2 id=&quot;the-old-idea-memories-as-valleys&quot;&gt;The old idea: memories as valleys&lt;/h2&gt;

&lt;p&gt;In &lt;a href=&quot;https://www.pnas.org/doi/10.1073/pnas.79.8.2554&quot;&gt;Hopfield’s 1982 network&lt;/a&gt;, you store patterns (say, strings of +1 and −1) in the connection weights. The network has an “energy,” and each stored pattern sits at the bottom of a valley. Start from a corrupted pattern, let the network update, and it rolls downhill into the nearest stored memory. That’s &lt;em&gt;content-addressable memory&lt;/em&gt;: you find a memory by giving a piece of it, not by knowing its address.&lt;/p&gt;

&lt;p&gt;The catch: the classic network only holds about 0.14 patterns per neuron. Store more than that and the valleys blur together into spurious memories.&lt;/p&gt;

&lt;h2 id=&quot;the-new-idea-sharpen-the-valleys&quot;&gt;The new idea: sharpen the valleys&lt;/h2&gt;

&lt;p&gt;Ramsauer et al. swap the old quadratic energy for one built on &lt;strong&gt;log-sum-exp&lt;/strong&gt; — a smooth version of “max.” Intuitively, each stored pattern now carves a much sharper, deeper valley, so many more of them fit without interfering. The paper shows the capacity grows &lt;em&gt;exponentially&lt;/em&gt; with the dimension of the patterns, and that retrieval typically converges after &lt;strong&gt;one&lt;/strong&gt; update.&lt;/p&gt;

&lt;p&gt;That one update is:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;new_state = X · softmax(β · Xᵀ · state)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;where the columns of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;X&lt;/code&gt; are the stored patterns and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;β&lt;/code&gt; controls how sharp the valleys are.&lt;/p&gt;

&lt;h2 id=&quot;wait--thats-attention&quot;&gt;Wait — that’s attention&lt;/h2&gt;

&lt;p&gt;Now look at transformer attention:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;output = V · softmax(Kᵀ · q / √d)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Set the &lt;strong&gt;query&lt;/strong&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;q&lt;/code&gt; to the current state, use the stored patterns as both &lt;strong&gt;keys&lt;/strong&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;K&lt;/code&gt; and &lt;strong&gt;values&lt;/strong&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;V&lt;/code&gt;, and pick &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;β = 1/√d&lt;/code&gt;. It’s the same equation. Every attention head in an LLM is doing a one-step associative memory lookup: compare the query against everything stored, softmax the similarities, return a weighted blend that’s usually dominated by the best match.&lt;/p&gt;

&lt;p&gt;The paper goes further, showing how different heads and layers behave like different retrieval regimes — some settle on one memory, some average over many — but the core equivalence is the part that stuck with me.&lt;/p&gt;

&lt;h2 id=&quot;twenty-lines-of-numpy&quot;&gt;Twenty lines of NumPy&lt;/h2&gt;

&lt;p&gt;Store five random ±1 patterns, flip 40% of the bits in one of them, and do a single update:&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;numpy&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;rng&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;random&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;default_rng&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;X&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rng&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;choice&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;1.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;   &lt;span class=&quot;c1&quot;&gt;# stored memories (columns)
&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;softmax&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;z&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;exp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;z&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;z&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;retrieve&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;xi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;beta&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;X&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;@&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;softmax&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;beta&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;X&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;T&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;@&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;xi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;      &lt;span class=&quot;c1&quot;&gt;# one modern-Hopfield update
&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;target&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;X&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[:,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;noisy&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;copy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;noisy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rng&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;choice&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.4&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;False&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;out&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;retrieve&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;noisy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;overlap before:&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;noisy&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;@&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;       &lt;span class=&quot;c1&quot;&gt;# 14 / 64
&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;overlap after: &lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;sign&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;@&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# 64 / 64
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;One step takes a pattern that’s only loosely related to the target back to a perfect copy. The softmax weights tell the story: about 0.97 on the right memory and crumbs on the rest — exactly what an attention map looks like.&lt;/p&gt;

&lt;h2 id=&quot;why-i-care-as-someone-building-agent-memory&quot;&gt;Why I care, as someone building agent memory&lt;/h2&gt;

&lt;p&gt;Most agent memory today is “embed everything, return the top-k nearest neighbors.” This paper reframes that: nearest-neighbor search is a crude, non-differentiable cousin of what attention already does well. It nudged me to build &lt;a href=&quot;/post/attractor-memory-engine/&quot;&gt;Attractor&lt;/a&gt; around retrieval by partial cues and context, and to think of memory as something that &lt;em&gt;settles&lt;/em&gt; rather than something you &lt;em&gt;look up&lt;/em&gt;.&lt;/p&gt;

&lt;h2 id=&quot;caveats-worth-knowing&quot;&gt;Caveats worth knowing&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;“Exponential capacity” is a statement about well-separated patterns in high dimensions; real embeddings are messy and correlated.&lt;/li&gt;
  &lt;li&gt;The one-step convergence holds when β is large enough relative to how similar the stored patterns are — similar memories still blur together.&lt;/li&gt;
  &lt;li&gt;Treating attention as memory is a lens, not a full explanation of what transformers learn.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you read only one modern paper about associative memory, make it this one. The rest of what I’m reading is on my &lt;a href=&quot;/research/#papershelf&quot;&gt;papershelf&lt;/a&gt;, and &lt;a href=&quot;/post/paper-tldr-six-papers-on-memory/&quot;&gt;Part 1 of this series&lt;/a&gt; covers the other papers behind my memory projects.&lt;/p&gt;

&lt;p&gt;Terms like &lt;a href=&quot;/post/agent-memory-glossary/#top-k-retrieval&quot;&gt;&lt;em&gt;top-k retrieval&lt;/em&gt;&lt;/a&gt; and &lt;a href=&quot;/post/agent-memory-glossary/#associative-memory&quot;&gt;&lt;em&gt;associative memory&lt;/em&gt;&lt;/a&gt; are defined in plain language in the &lt;a href=&quot;/post/agent-memory-glossary/&quot;&gt;agent memory glossary&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title type="html">Paper TL;DR: Six Papers That Shaped How I Think About AI Memory</title>
    <link href="https://www.avinashgosavi.com/post/paper-tldr-six-papers-on-memory/" rel="alternate" type="text/html" title="Paper TL;DR: Six Papers That Shaped How I Think About AI Memory"/>
    <id>https://www.avinashgosavi.com/post/paper-tldr-six-papers-on-memory/</id>
    <published>2026-10-18T16:00:00+00:00</published>
    <updated>2026-10-18T16:00:00+00:00</updated>
    <category term="Research"/>
    <category term="Agent memory"/>
    <summary type="html">Short, plain-language summaries of six papers behind my AI memory side projects — from Hopfield&apos;s 1982 associative memory to user-owned memory for agents.</summary>
    <content type="html" xml:base="https://www.avinashgosavi.com/post/paper-tldr-six-papers-on-memory/">&lt;p&gt;Most of my side projects over the past year have circled one question: &lt;strong&gt;how should an AI system remember things?&lt;/strong&gt; Not just “where do we put the vectors,” but how memory gets formed, found again, strengthened or forgotten — and who gets to read it.&lt;/p&gt;

&lt;p&gt;I didn’t start with papers. I started building, got stuck, and went looking for how other people had thought about the problem. These six are the ones that actually changed what I built. Here’s each one in a few sentences, in plain language, plus what I took from it. If you only read one, read the first.&lt;/p&gt;

&lt;h2 id=&quot;1-hopfield-1982--memory-as-a-place-you-roll-into&quot;&gt;1. Hopfield (1982) — memory as a place you roll into&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://www.pnas.org/doi/10.1073/pnas.79.8.2554&quot;&gt;&lt;em&gt;Neural networks and physical systems with emergent collective computational abilities&lt;/em&gt;&lt;/a&gt; · PNAS&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; Wire up simple on/off neurons with symmetric connections and the network gets an “energy” that can only go down as it updates. Stored memories sit at the bottoms of valleys in that landscape. Give it a partial or noisy pattern and it slides downhill into the full memory. You don’t look memories up by key — you fall into them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I took from it:&lt;/strong&gt; this was the “oh” moment behind &lt;a href=&quot;/post/attractor-memory-engine/&quot;&gt;Attractor&lt;/a&gt;. Recall from partial cues feels much closer to how I actually remember things than a database lookup does.&lt;/p&gt;

&lt;h2 id=&quot;2-ramsauer-et-al-2020--attention-is-a-hopfield-update&quot;&gt;2. Ramsauer et al. (2020) — attention is a Hopfield update&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/2008.02217&quot;&gt;&lt;em&gt;Hopfield Networks is All You Need&lt;/em&gt;&lt;/a&gt; · arXiv&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; A “modern” Hopfield network with continuous states can store exponentially many patterns and usually retrieves one in a single step. And that single update step is mathematically the same operation as transformer attention.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I took from it:&lt;/strong&gt; the 1982 idea isn’t a museum piece — it’s sitting inside every LLM. That made me take attractor-style retrieval seriously as a design for agent memory, not just a curiosity.&lt;/p&gt;

&lt;h2 id=&quot;3-mcclelland-mcnaughton--oreilly-1995--two-learners-not-one&quot;&gt;3. McClelland, McNaughton &amp;amp; O’Reilly (1995) — two learners, not one&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://doi.org/10.1037/0033-295X.102.3.419&quot;&gt;&lt;em&gt;Why there are complementary learning systems in the hippocampus and neocortex&lt;/em&gt;&lt;/a&gt; · Psychological Review&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; The brain uses a fast learner that grabs specific episodes (hippocampus) and a slow learner that gradually pulls out general structure (neocortex). Replaying episodes into the slow system lets it learn without overwriting what it already knows.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I took from it:&lt;/strong&gt; a vocabulary for something agents get wrong — treating every memory the same forever. It’s why Attractor tracks access and why I think memories should strengthen with use and fade without it.&lt;/p&gt;

&lt;h2 id=&quot;4-reimers--gurevych-2019--embeddings-you-can-actually-search&quot;&gt;4. Reimers &amp;amp; Gurevych (2019) — embeddings you can actually search&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1908.10084&quot;&gt;&lt;em&gt;Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks&lt;/em&gt;&lt;/a&gt; · arXiv&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; Plain BERT has to compare sentences two at a time, which is painfully slow for search. Training it in a “siamese” setup gives every sentence its own embedding you can compare with cosine similarity, so finding the closest match among thousands takes seconds instead of hours.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I took from it:&lt;/strong&gt; the unglamorous workhorse. The sentence-transformers models behind semantic search in Attractor, VaultMem and daylog all come from this line of work.&lt;/p&gt;

&lt;h2 id=&quot;5-maharana-et-al-2024--testing-memory-honestly&quot;&gt;5. Maharana et al. (2024) — testing memory honestly&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/2402.17753&quot;&gt;&lt;em&gt;Evaluating Very Long-Term Conversational Memory of LLM Agents&lt;/em&gt; (LoCoMo)&lt;/a&gt; · arXiv&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; A benchmark of very long, multi-session conversations with questions that need single facts, multi-step reasoning, time awareness, or the sense to say “that never happened.” Even strong long-context models and &lt;a href=&quot;/post/agent-memory-glossary/#rag&quot;&gt;RAG&lt;/a&gt; setups struggle with it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I took from it:&lt;/strong&gt; my own little synthetic test was flattering me. Running &lt;a href=&quot;/post/vaultmem-part-2-multimodal-temporal-backends/&quot;&gt;VaultMem against LoCoMo&lt;/a&gt; gave me numbers I could actually trust — and showed me where retrieval was weak.&lt;/p&gt;

&lt;h2 id=&quot;6-pan-huang--yang-2026--whose-memory-is-it&quot;&gt;6. Pan, Huang &amp;amp; Yang (2026) — whose memory is it?&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/2603.14212&quot;&gt;&lt;em&gt;Memory as Asset: From Agent-centric to Human-centric Memory Management&lt;/em&gt;&lt;/a&gt; · arXiv&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; Argues that agent memory today is built for the agent rather than the person, and proposes treating the memory an AI keeps about you as an asset you own, share under your own permissions, and grow over time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I took from it:&lt;/strong&gt; this one reshaped &lt;a href=&quot;/series/#vaultmem&quot;&gt;VaultMem&lt;/a&gt; entirely. It gave words to the feeling that an agent’s memory of your life shouldn’t be readable by whoever runs the agent. VaultMem ended up implementing its first layer.&lt;/p&gt;

&lt;h2 id=&quot;what-ties-them-together&quot;&gt;What ties them together&lt;/h2&gt;

&lt;p&gt;Reading these in a row, I keep landing on the same picture: good memory is &lt;strong&gt;found by meaning and context&lt;/strong&gt;, &lt;strong&gt;changes over time&lt;/strong&gt;, and &lt;strong&gt;belongs to the person it’s about&lt;/strong&gt;. Most systems today nail the first, ignore the second, and get the third backwards.&lt;/p&gt;

&lt;p&gt;All six live on my &lt;a href=&quot;/research/#papershelf&quot;&gt;papershelf&lt;/a&gt; with the rest of what I’m reading. If any of the vocabulary here is new, the &lt;a href=&quot;/post/agent-memory-glossary/&quot;&gt;agent memory glossary&lt;/a&gt; has short definitions. If there’s a paper on memory or agents you think I should read next, I’d genuinely love to hear about it.&lt;/p&gt;
</content>
  </entry>
</feed>
