<?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: Addy | TheQuery</title>
    <description>The latest articles on DEV Community by Addy | TheQuery (@thequery_addy).</description>
    <link>https://dev.to/thequery_addy</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%2F4116330%2Fcd7ab8ad-cd21-4c63-8814-e5555eb71fae.jpg</url>
      <title>DEV Community: Addy | TheQuery</title>
      <link>https://dev.to/thequery_addy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/thequery_addy"/>
    <language>en</language>
    <item>
      <title>RAG Retrieval Can Look Relevant and Still Be Wrong</title>
      <dc:creator>Addy | TheQuery</dc:creator>
      <pubDate>Tue, 08 Sep 2026 20:50:39 +0000</pubDate>
      <link>https://dev.to/thequery_addy/rag-retrieval-can-look-relevant-and-still-be-wrong-11dh</link>
      <guid>https://dev.to/thequery_addy/rag-retrieval-can-look-relevant-and-still-be-wrong-11dh</guid>
      <description>&lt;p&gt;A retrieval-augmented generation system can return fluent answers from the wrong evidence. RAG connects a language model to retrieved documents before it answers a question. Think of it as handing a researcher a folder: a confident summary is only useful if the folder contains the right material.&lt;/p&gt;

&lt;p&gt;This is an abridged adaptation of &lt;a href="https://www.thequery.in/guides/rag-fails-in-production" rel="noopener noreferrer"&gt;RAG Works in Theory. Here's Why It Fails in Production&lt;/a&gt;, originally published on TheQuery by Addy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check the evidence before changing the model
&lt;/h2&gt;

&lt;p&gt;When a generated answer is wrong, inspect the retrieved passages alongside the question. Do they actually contain the information needed to answer it? Are they from the right customer, product version, contract, or period?&lt;/p&gt;

&lt;p&gt;A passage can be about the right topic and still answer a different question. A contract clause about termination may be irrelevant if it belongs to another agreement. Giving a stronger model that same passage does not correct the document mismatch.&lt;/p&gt;

&lt;p&gt;Save representative questions and the evidence they require. Include difficult cases: exact identifiers, old and new policy versions, conflicting documents, and questions that the collection cannot answer. This gives you something concrete to compare when changing the retrieval pipeline.&lt;/p&gt;

&lt;h2&gt;
  
  
  Treat chunk boundaries as part of the meaning
&lt;/h2&gt;

&lt;p&gt;Chunking divides documents into pieces small enough to retrieve and send to a model. Cutting at a fixed token count is like slicing a manual every few inches: an instruction may end up separated from the condition that makes it apply.&lt;/p&gt;

&lt;p&gt;Check whether a retrieved piece preserves its heading, subject, exceptions, and relevant metadata. A paragraph that says “this is permitted” is not useful evidence if the previous paragraph explains who “this” applies to.&lt;/p&gt;

&lt;p&gt;Document-aware splitting can preserve useful boundaries. It still needs evaluation on your documents. There is no universal chunk size that establishes relevance by itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Similarity is a candidate signal
&lt;/h2&gt;

&lt;p&gt;Embedding search represents text numerically so related passages can be retrieved. It resembles finding books on the same shelf: proximity suggests a relationship, but does not establish that a book answers a particular question.&lt;/p&gt;

&lt;p&gt;Exact strings can require a different retrieval signal. A section number, error code, or product identifier may be the decisive part of the query. Hybrid retrieval combines semantic search with keyword matching, much like consulting both a library's subject catalog and its alphabetical index.&lt;/p&gt;

&lt;p&gt;A reranker can then compare candidate passages more closely with the question. Think of it as a second reader inspecting the shortlist. Test whether it improves retrieval on the difficult cases; adding another stage also adds latency and cost.&lt;/p&gt;

&lt;h2&gt;
  
  
  Evaluate retrieval and answers separately
&lt;/h2&gt;

&lt;p&gt;A single end-to-end score can hide where the failure occurred. Track whether retrieval found the required evidence, then whether the generated answer stayed supported by that evidence. An answer should be able to acknowledge when the supplied documents do not establish a conclusion.&lt;/p&gt;

&lt;p&gt;Inspect the final context sent to the model, not just the search results. Selection and assembly can remove qualifiers or combine contradictory passages. More retrieved text is not automatically better evidence.&lt;/p&gt;

&lt;p&gt;The full guide on TheQuery covers context assembly and production failure modes in more detail. Start with the documents the system actually retrieved. The answer cannot repair evidence it never received.&lt;/p&gt;

</description>
      <category>rag</category>
    </item>
  </channel>
</rss>
