<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Deepanjal Shukla</title>
    <description>The latest articles on DEV Community by Deepanjal Shukla (@deepanjal_shukla).</description>
    <link>https://dev.to/deepanjal_shukla</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4269192%2Ff3957792-5962-47f9-a1b7-9e195429b34e.png</url>
      <title>DEV Community: Deepanjal Shukla</title>
      <link>https://dev.to/deepanjal_shukla</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/deepanjal_shukla"/>
    <language>en</language>
    <item>
      <title>I gave my chatbot 4x more memory. It answered no better.</title>
      <dc:creator>Deepanjal Shukla</dc:creator>
      <pubDate>Fri, 27 Nov 2026 15:47:40 +0000</pubDate>
      <link>https://dev.to/deepanjal_shukla/i-gave-my-chatbot-4x-more-memory-it-answered-no-better-g04</link>
      <guid>https://dev.to/deepanjal_shukla/i-gave-my-chatbot-4x-more-memory-it-answered-no-better-g04</guid>
      <description>&lt;p&gt;Chat assistants with "memory" all do the same thing: when you ask something, they search your old conversations and paste the best matches into the prompt. Most benchmarks score that search step by &lt;em&gt;recall&lt;/em&gt;: did the fact the model needs make it into the prompt?&lt;/p&gt;

&lt;p&gt;I've been measuring this on LongMemEval (479 questions, each hidden in ~50 past chat sessions) with an open-source harness I wrote, &lt;a href="https://github.com/Deepanjal-s/memory-recall-bench" rel="noopener noreferrer"&gt;memory-recall-bench&lt;/a&gt;. Then I checked what actually matters: does the model answer correctly?&lt;/p&gt;

&lt;h2&gt;
  
  
  The setup
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Retriever: BM25 + bge-small embeddings, fused (a strong, cheap hybrid).&lt;/li&gt;
&lt;li&gt;Context budget: 4,000 or 16,000 tokens of retrieved chat history.&lt;/li&gt;
&lt;li&gt;Reader: Qwen3-4B-Instruct on a free Kaggle T4, greedy decoding.&lt;/li&gt;
&lt;li&gt;Judge: the same model with LongMemEval's official yes/no judge prompts. A 4B judge is rough, so I only trust &lt;em&gt;paired&lt;/em&gt; differences: same questions, same reader, same judge, only the context changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The result
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;budget&lt;/th&gt;
&lt;th&gt;evidence fully in context&lt;/th&gt;
&lt;th&gt;answered correctly&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;4k&lt;/td&gt;
&lt;td&gt;63.0%&lt;/td&gt;
&lt;td&gt;59.1%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;16k&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;89.8%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;58.9%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A 27-point recall gain bought nothing. Per question: 52 fixed, 53 broken.&lt;/p&gt;

&lt;p&gt;The reason shows up when you look only at the 302 questions where &lt;strong&gt;both&lt;/strong&gt; contexts contained all the evidence. Same facts available, more surrounding text:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;4k: 79.1% correct&lt;/li&gt;
&lt;li&gt;16k: 70.9% correct (18 fixed / 43 broken, sign test p≈0.002)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The 16k context holds ~65 messages against ~18 (medians). My reading: the extra messages are near-misses. They look relevant, so the retriever ranked them highly, and they distract the reader. More recall brought more distractors, and for a small model those seem to cost as much as the extra evidence gained.&lt;/p&gt;

&lt;p&gt;This isn't only my setup: Du et al. ("Context Length Alone Hurts LLM Performance Despite Perfect Retrieval", EMNLP 2025 Findings) report a similar effect on other tasks. I haven't seen it measured for chat memory.&lt;/p&gt;

&lt;p&gt;I also tried LLM query expansion (sub-queries from a small LLM, fused with the original ranking, with the original query keeping the first half of the budget). It added +1.8 points of recall at 16k (p≈0.05) and gave no significant change in accuracy.&lt;/p&gt;

&lt;p&gt;So what does help? Precision. I put a cross-encoder re-ranker (bge-reranker-v2-m3) on the hybrid's top 100 candidates and kept the context small. All-evidence recall at 4k went from 63% to 71% (58 fixed / 18 broken), and at 8k from 80% to 86%. This time accuracy moved too: the re-ranked 8k context scored 64.9%, the best of every configuration I've run, and clearly better than the old 4k setup (63 fixed / 35 broken, p≈0.006) or the 16k one (59 / 30, p≈0.003). The cost is about 1.5 seconds of GPU per question.&lt;/p&gt;

&lt;p&gt;The distractor penalty didn't disappear (accuracy with all evidence present still drops from 77% at 4k to 72% at 8k). My reading is that the re-ranker wins by fitting the evidence into fewer tokens.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd do differently when building chat memory
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Measure answers, not just recall.&lt;/strong&gt; Recall is necessary, not sufficient.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pick the budget for the reader you have.&lt;/strong&gt; With this 4B reader, a precise context beat a generous one (re-ranked 8k: 64.9%; plain 16k: 58.9%).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Spend effort on precision at small budgets&lt;/strong&gt; (re-ranking), not on stuffing more in.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The harness and per-question results are on the &lt;a href="https://github.com/Deepanjal-s/memory-recall-bench/tree/main/results" rel="noopener noreferrer"&gt;results page&lt;/a&gt;, and a public Kaggle notebook rebuilds the re-ranking tables from the saved outputs: &lt;a href="https://www.kaggle.com/code/deepanjalshukla95/more-context-didn-t-help-a-re-ranker-did" rel="noopener noreferrer"&gt;More context didn't help. A re-ranker did.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I'm a CS student at NIT Sikkim. I do retrieval audits for teams whose chatbot or RAG search forgets things: &lt;a href="https://portfolio-alpha-nine-0b6a1mvm9h.vercel.app/#services" rel="noopener noreferrer"&gt;my portfolio&lt;/a&gt;. Written with help from Claude; all numbers come from the linked runs.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>llm</category>
      <category>rag</category>
      <category>machinelearning</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
