<?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: ValeryKot</title>
    <description>The latest articles on DEV Community by ValeryKot (@valerykot).</description>
    <link>https://dev.to/valerykot</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%2F1041183%2Fba74d7ae-ff6d-458e-bf4d-7584d319211c.jpeg</url>
      <title>DEV Community: ValeryKot</title>
      <link>https://dev.to/valerykot</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/valerykot"/>
    <language>en</language>
    <item>
      <title>Bigger Context Windows Didn't Make Our RAG Smarter</title>
      <dc:creator>ValeryKot</dc:creator>
      <pubDate>Wed, 08 Jul 2026 10:23:41 +0000</pubDate>
      <link>https://dev.to/valerykot/bigger-context-windows-didnt-make-our-rag-smarter-4d0l</link>
      <guid>https://dev.to/valerykot/bigger-context-windows-didnt-make-our-rag-smarter-4d0l</guid>
      <description>&lt;p&gt;&lt;em&gt;We stopped measuring retrieval quality by how many tokens we could fit into the prompt.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;When long-context models became available, many of us made the same assumption.&lt;/p&gt;

&lt;p&gt;If an LLM can read 128K tokens, retrieval suddenly feels less important. Why spend time carefully selecting documents if the model can simply read everything?&lt;/p&gt;

&lt;p&gt;It sounds reasonable.&lt;/p&gt;

&lt;p&gt;In practice, it wasn't.&lt;/p&gt;

&lt;h2&gt;
  
  
  More context, worse answers
&lt;/h2&gt;

&lt;p&gt;Imagine asking your internal assistant:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Why did we abandon microservices?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Retrieval returns thirty documents.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;an architecture decision record&lt;/li&gt;
&lt;li&gt;a few Jira tickets&lt;/li&gt;
&lt;li&gt;Slack discussions&lt;/li&gt;
&lt;li&gt;meeting notes&lt;/li&gt;
&lt;li&gt;a glossary page&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything is related.&lt;/p&gt;

&lt;p&gt;Almost nothing answers the question.&lt;/p&gt;

&lt;p&gt;The actual decision lives in a single ADR written months earlier. It explains the trade-offs: team size, latency, deployment complexity, operational cost.&lt;/p&gt;

&lt;p&gt;But that document isn't especially similar to the query. It doesn't repeat the same vocabulary. It doesn't even mention "microservices" very often.&lt;/p&gt;

&lt;p&gt;So it gets buried.&lt;/p&gt;

&lt;p&gt;The model now receives thirty relevant documents and does what language models are very good at: it produces a coherent explanation.&lt;/p&gt;

&lt;p&gt;The problem is that coherence is not the same thing as faithfulness.&lt;/p&gt;

&lt;p&gt;Instead of recovering the original decision, it often synthesizes one from recurring themes across the retrieved documents.&lt;/p&gt;

&lt;p&gt;The answer sounds plausible.&lt;/p&gt;

&lt;p&gt;It just isn't the answer that was originally made.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bigger windows don't fix retrieval
&lt;/h2&gt;

&lt;p&gt;Research has already shown that models struggle with information buried inside very long contexts. The &lt;em&gt;Lost in the Middle&lt;/em&gt; paper is probably the best-known example.&lt;/p&gt;

&lt;p&gt;Our experience suggested something slightly different.&lt;/p&gt;

&lt;p&gt;Sometimes the answer isn't lost because the context is long.&lt;/p&gt;

&lt;p&gt;It's lost because the retrieval stage couldn't distinguish &lt;em&gt;the document that contains the decision&lt;/em&gt; from &lt;em&gt;documents that merely discuss the same topic&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Adding more context doesn't necessarily solve that problem.&lt;/p&gt;

&lt;p&gt;Sometimes it simply gives the model more material to average together.&lt;/p&gt;

&lt;h2&gt;
  
  
  We were optimizing the wrong thing
&lt;/h2&gt;

&lt;p&gt;For a while we treated retrieval as a packing exercise.&lt;/p&gt;

&lt;p&gt;How many useful chunks can we fit into the prompt?&lt;/p&gt;

&lt;p&gt;Over time the question changed.&lt;/p&gt;

&lt;p&gt;Why is this document here?&lt;/p&gt;

&lt;p&gt;Should it be here at all?&lt;/p&gt;

&lt;p&gt;Does it explain the decision, or does it merely mention the same technology?&lt;/p&gt;

&lt;p&gt;Those questions turned out to matter much more than the size of the context window.&lt;/p&gt;

&lt;h2&gt;
  
  
  Retrieval is a selection problem
&lt;/h2&gt;

&lt;p&gt;The biggest shift wasn't moving from 8K to 128K tokens.&lt;/p&gt;

&lt;p&gt;It was realizing that retrieval isn't about fitting more information into a prompt.&lt;/p&gt;

&lt;p&gt;It's about selecting the few pieces of information that actually explain the answer.&lt;/p&gt;

&lt;p&gt;Large context windows are incredibly useful.&lt;/p&gt;

&lt;p&gt;They just don't compensate for weak retrieval.&lt;/p&gt;

&lt;p&gt;If anything, they make weak retrieval look convincing.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Next time I'll look at another assumption I no longer believe: that documents should be treated as bags of chunks.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>machinelearning</category>
      <category>rag</category>
    </item>
    <item>
      <title>Why RAG Finds Documents but Still Misses the Answer</title>
      <dc:creator>ValeryKot</dc:creator>
      <pubDate>Mon, 06 Jul 2026 10:22:20 +0000</pubDate>
      <link>https://dev.to/valerykot/why-rag-finds-documents-but-still-misses-the-answer-4jjl</link>
      <guid>https://dev.to/valerykot/why-rag-finds-documents-but-still-misses-the-answer-4jjl</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F29jch57m9kjd0w6mwmq0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F29jch57m9kjd0w6mwmq0.jpg" alt=" " width="800" height="533"&gt;&lt;/a&gt;&lt;br&gt;
After building and evaluating dozens of retrieval systems, I stopped thinking retrieval was the real problem.&lt;/p&gt;

&lt;p&gt;Over the last couple of years I've spent a lot of time building and evaluating RAG systems.&lt;/p&gt;

&lt;p&gt;Some were quick prototypes.&lt;/p&gt;

&lt;p&gt;Some powered internal knowledge bases.&lt;/p&gt;

&lt;p&gt;Some eventually became parts of products.&lt;/p&gt;

&lt;p&gt;And I kept seeing the same pattern.&lt;/p&gt;

&lt;p&gt;A user would ask a perfectly reasonable question.&lt;/p&gt;

&lt;p&gt;The search would work.&lt;/p&gt;

&lt;p&gt;The LLM would answer confidently.&lt;/p&gt;

&lt;p&gt;And the answer would still be wrong.&lt;/p&gt;

&lt;p&gt;Not because the model hallucinated.&lt;/p&gt;

&lt;p&gt;Not because embeddings were bad.&lt;/p&gt;

&lt;p&gt;Not because vector search failed.&lt;/p&gt;

&lt;p&gt;The system had simply retrieved the wrong kind of information.&lt;/p&gt;

&lt;p&gt;A question every RAG system should answer&lt;/p&gt;

&lt;p&gt;Imagine a company with a thousand engineering documents.&lt;/p&gt;

&lt;p&gt;Architecture decisions.&lt;/p&gt;

&lt;p&gt;Meeting notes.&lt;/p&gt;

&lt;p&gt;RFCs.&lt;/p&gt;

&lt;p&gt;Runbooks.&lt;/p&gt;

&lt;p&gt;ADRs.&lt;/p&gt;

&lt;p&gt;Internal documentation.&lt;/p&gt;

&lt;p&gt;Now someone asks:&lt;/p&gt;

&lt;p&gt;Why did we choose Kafka over RabbitMQ?&lt;/p&gt;

&lt;p&gt;A typical RAG pipeline looks like this:&lt;/p&gt;

&lt;p&gt;Documents&lt;br&gt;
    ↓&lt;br&gt;
Chunking&lt;br&gt;
    ↓&lt;br&gt;
Embeddings&lt;br&gt;
    ↓&lt;br&gt;
Vector Database&lt;br&gt;
    ↓&lt;br&gt;
Top-K Retrieval&lt;br&gt;
    ↓&lt;br&gt;
LLM&lt;/p&gt;

&lt;p&gt;Everything seems reasonable.&lt;/p&gt;

&lt;p&gt;The question becomes an embedding.&lt;/p&gt;

&lt;p&gt;The nearest chunks are retrieved.&lt;/p&gt;

&lt;p&gt;The chunks are added to the prompt.&lt;/p&gt;

&lt;p&gt;The LLM generates an answer.&lt;/p&gt;

&lt;p&gt;Simple.&lt;/p&gt;

&lt;p&gt;Except this is often where things start going wrong.&lt;/p&gt;

&lt;p&gt;Semantic similarity isn't the same as relevance&lt;/p&gt;

&lt;p&gt;Suppose your knowledge base contains fifteen documents about Kafka.&lt;/p&gt;

&lt;p&gt;Architecture guides.&lt;/p&gt;

&lt;p&gt;Broker configuration.&lt;/p&gt;

&lt;p&gt;Monitoring.&lt;/p&gt;

&lt;p&gt;Deployment.&lt;/p&gt;

&lt;p&gt;Developer documentation.&lt;/p&gt;

&lt;p&gt;Vector search will happily retrieve them.&lt;/p&gt;

&lt;p&gt;And technically, it's correct.&lt;/p&gt;

&lt;p&gt;They are semantically close to the question.&lt;/p&gt;

&lt;p&gt;But none of them explain why Kafka was chosen.&lt;/p&gt;

&lt;p&gt;The actual answer might live inside a two-page Architecture Decision Record written eighteen months earlier.&lt;/p&gt;

&lt;p&gt;That document mostly discusses RabbitMQ, latency, throughput, operational complexity, and load testing.&lt;/p&gt;

&lt;p&gt;The word Kafka barely appears.&lt;/p&gt;

&lt;p&gt;From the perspective of embeddings, it isn't particularly similar.&lt;/p&gt;

&lt;p&gt;From the perspective of an engineer, it's exactly the document you needed.&lt;/p&gt;

&lt;p&gt;That's the disconnect.&lt;/p&gt;

&lt;p&gt;Search found similar documents.&lt;/p&gt;

&lt;p&gt;It didn't find the decision.&lt;/p&gt;

&lt;p&gt;Then we start optimizing&lt;/p&gt;

&lt;p&gt;Once teams notice retrieval isn't great, the usual optimization cycle begins.&lt;/p&gt;

&lt;p&gt;First we reduce Top-K.&lt;/p&gt;

&lt;p&gt;Instead of retrieving 100 chunks, we retrieve 10.&lt;/p&gt;

&lt;p&gt;Then we shrink chunk sizes.&lt;/p&gt;

&lt;p&gt;500 tokens become 250.&lt;/p&gt;

&lt;p&gt;250 become 150.&lt;/p&gt;

&lt;p&gt;Then we add rerankers.&lt;/p&gt;

&lt;p&gt;Cross-encoders.&lt;/p&gt;

&lt;p&gt;Hybrid retrieval.&lt;/p&gt;

&lt;p&gt;Bigger context windows.&lt;/p&gt;

&lt;p&gt;I tried all of these.&lt;/p&gt;

&lt;p&gt;Most of them help.&lt;/p&gt;

&lt;p&gt;None of them completely solve the problem.&lt;/p&gt;

&lt;p&gt;Because they're still optimizing retrieval inside the same mental model.&lt;/p&gt;

&lt;p&gt;The document slowly disappears&lt;/p&gt;

&lt;p&gt;One thing surprised me more than anything else.&lt;/p&gt;

&lt;p&gt;The smaller our chunks became, the less context survived.&lt;/p&gt;

&lt;p&gt;Eventually the system remembered paragraphs.&lt;/p&gt;

&lt;p&gt;But forgot the document.&lt;/p&gt;

&lt;p&gt;Headings disappeared.&lt;/p&gt;

&lt;p&gt;Structure disappeared.&lt;/p&gt;

&lt;p&gt;Arguments disappeared.&lt;/p&gt;

&lt;p&gt;What remained was a collection of isolated text fragments.&lt;/p&gt;

&lt;p&gt;I started calling this chunk amnesia.&lt;/p&gt;

&lt;p&gt;It's not a scientific term.&lt;/p&gt;

&lt;p&gt;Just a name for something I kept observing.&lt;/p&gt;

&lt;p&gt;Humans don't search that way&lt;/p&gt;

&lt;p&gt;This is where my thinking changed.&lt;/p&gt;

&lt;p&gt;When I need information, I don't start by looking for a paragraph.&lt;/p&gt;

&lt;p&gt;I usually ask myself:&lt;/p&gt;

&lt;p&gt;Which document was this?&lt;/p&gt;

&lt;p&gt;Then:&lt;/p&gt;

&lt;p&gt;What decision did we make?&lt;/p&gt;

&lt;p&gt;Only after that do I look for implementation details.&lt;/p&gt;

&lt;p&gt;It's almost hierarchical.&lt;/p&gt;

&lt;p&gt;Document&lt;br&gt;
    ↓&lt;br&gt;
Decision&lt;br&gt;
    ↓&lt;br&gt;
Evidence&lt;br&gt;
    ↓&lt;br&gt;
Implementation&lt;/p&gt;

&lt;p&gt;Most RAG systems reverse that process.&lt;/p&gt;

&lt;p&gt;They search for paragraphs first and hope context reconstructs itself.&lt;/p&gt;

&lt;p&gt;Sometimes it does.&lt;/p&gt;

&lt;p&gt;Often it doesn't.&lt;/p&gt;

&lt;p&gt;Bigger context windows don't fix this&lt;/p&gt;

&lt;p&gt;A common reaction is:&lt;/p&gt;

&lt;p&gt;"Let's just send more context."&lt;/p&gt;

&lt;p&gt;I don't think that's the answer either.&lt;/p&gt;

&lt;p&gt;A 64K context window can hold far more text.&lt;/p&gt;

&lt;p&gt;It doesn't magically restore structure.&lt;/p&gt;

&lt;p&gt;The model still receives disconnected fragments.&lt;/p&gt;

&lt;p&gt;More fragments don't automatically become a coherent narrative.&lt;/p&gt;

&lt;p&gt;Large prompts reduce one bottleneck.&lt;/p&gt;

&lt;p&gt;They don't eliminate the retrieval problem.&lt;/p&gt;

&lt;p&gt;What changed my thinking&lt;/p&gt;

&lt;p&gt;Eventually I stopped thinking of retrieval as a single search problem.&lt;/p&gt;

&lt;p&gt;Instead, I started thinking about navigation across multiple levels of abstraction.&lt;/p&gt;

&lt;p&gt;Before asking:&lt;/p&gt;

&lt;p&gt;Which paragraph matters?&lt;/p&gt;

&lt;p&gt;I first wanted to answer:&lt;/p&gt;

&lt;p&gt;Which document matters?&lt;/p&gt;

&lt;p&gt;Then:&lt;/p&gt;

&lt;p&gt;Which decisions inside that document matter?&lt;/p&gt;

&lt;p&gt;Only then should retrieval dive into individual chunks.&lt;/p&gt;

&lt;p&gt;That's also how people naturally explore documentation.&lt;/p&gt;

&lt;p&gt;We rarely jump directly into paragraph number seventeen.&lt;/p&gt;

&lt;p&gt;We skim.&lt;/p&gt;

&lt;p&gt;We orient ourselves.&lt;/p&gt;

&lt;p&gt;Then we zoom in.&lt;/p&gt;

&lt;p&gt;This isn't just an LLM problem&lt;/p&gt;

&lt;p&gt;After a while I realized this discussion isn't really about language models.&lt;/p&gt;

&lt;p&gt;It's about organizational memory.&lt;/p&gt;

&lt;p&gt;Companies rarely lose information because documents disappear.&lt;/p&gt;

&lt;p&gt;They lose the relationships between documents.&lt;/p&gt;

&lt;p&gt;The ADR exists.&lt;/p&gt;

&lt;p&gt;The meeting notes exist.&lt;/p&gt;

&lt;p&gt;The design proposal exists.&lt;/p&gt;

&lt;p&gt;The Slack discussion exists.&lt;/p&gt;

&lt;p&gt;But the connections slowly fade.&lt;/p&gt;

&lt;p&gt;Search retrieves text.&lt;/p&gt;

&lt;p&gt;People are trying to recover context.&lt;/p&gt;

&lt;p&gt;Those aren't always the same problem.&lt;/p&gt;

&lt;p&gt;I'm still exploring this&lt;/p&gt;

&lt;p&gt;I don't have a universal solution.&lt;/p&gt;

&lt;p&gt;In fact, this realization is one of the reasons I started building Retineo.&lt;/p&gt;

&lt;p&gt;Not because I thought I had the answer.&lt;/p&gt;

&lt;p&gt;Because I couldn't find a system that treated organizational knowledge as something richer than independent chunks inside a vector database.&lt;/p&gt;

&lt;p&gt;Maybe the answer isn't hierarchical retrieval.&lt;/p&gt;

&lt;p&gt;Maybe it's something else entirely.&lt;/p&gt;

&lt;p&gt;I'm still experimenting.&lt;/p&gt;

&lt;p&gt;I'd love to hear your experience&lt;/p&gt;

&lt;p&gt;If you've built RAG systems at scale, what's the failure mode you've seen most often?&lt;/p&gt;

&lt;p&gt;For me, it isn't hallucination.&lt;/p&gt;

&lt;p&gt;It's this:&lt;/p&gt;

&lt;p&gt;The documents aren't missing.&lt;/p&gt;

&lt;p&gt;The relationships between them are.&lt;/p&gt;

&lt;p&gt;Discussion&lt;/p&gt;

&lt;p&gt;Have you encountered similar problems?&lt;/p&gt;

&lt;p&gt;Did hierarchical retrieval, knowledge graphs, rerankers, or another approach help?&lt;/p&gt;

&lt;p&gt;I'm genuinely interested in how others are tackling this.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>rag</category>
      <category>machinelearning</category>
      <category>knowledgemanagement</category>
    </item>
  </channel>
</rss>
