<?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: Rimsha Kanwal</title>
    <description>The latest articles on DEV Community by Rimsha Kanwal (@rimsha_kanwal).</description>
    <link>https://dev.to/rimsha_kanwal</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%2F4161863%2Fbe0665f2-c021-4a27-8cbb-483087e02423.png</url>
      <title>DEV Community: Rimsha Kanwal</title>
      <link>https://dev.to/rimsha_kanwal</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rimsha_kanwal"/>
    <language>en</language>
    <item>
      <title>Day 01/90: Teaching a RAG App When to Say “I Don’t Know”</title>
      <dc:creator>Rimsha Kanwal</dc:creator>
      <pubDate>Fri, 16 Oct 2026 22:55:54 +0000</pubDate>
      <link>https://dev.to/rimsha_kanwal/day-0190-teaching-a-rag-app-when-to-say-i-dont-know-352d</link>
      <guid>https://dev.to/rimsha_kanwal/day-0190-teaching-a-rag-app-when-to-say-i-dont-know-352d</guid>
      <description>&lt;p&gt;Getting an AI app to answer a question is exciting. Getting it to recognize when the documents don’t contain the answer is a more interesting challenge.&lt;/p&gt;

&lt;p&gt;For Day 1 of my AI challenge, I’m starting with a small problem:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How can we make a RAG application avoid answering questions its sources cannot support?&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;Imagine uploading a company’s leave policy and asking:&lt;/p&gt;

&lt;p&gt;“How many days of annual leave do employees get?”&lt;/p&gt;

&lt;p&gt;If the policy contains that information, the app should answer and show the supporting passage.&lt;/p&gt;

&lt;p&gt;Now ask:&lt;/p&gt;

&lt;p&gt;“Does the company pay for international travel?”&lt;/p&gt;

&lt;p&gt;If the document says nothing about travel, the app should explain that it couldn’t find the answer in the provided material.&lt;/p&gt;

&lt;p&gt;A confident guess could easily be mistaken for company policy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why RAG alone doesn’t solve this
&lt;/h2&gt;

&lt;p&gt;Retrieval-Augmented Generation retrieves relevant content and passes it to a language model to help answer a question.&lt;/p&gt;

&lt;p&gt;But the closest matching passage isn’t always a passage that answers the question.&lt;/p&gt;

&lt;p&gt;A search system can return something even when the information we need is missing. That makes retrieval a useful starting point, but it doesn’t guarantee a supported answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  My Day 1 approach
&lt;/h2&gt;

&lt;p&gt;I’m keeping the first version small:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Load a short document and split it into passages.&lt;/li&gt;
&lt;li&gt;Retrieve passages for a question.&lt;/li&gt;
&lt;li&gt;Ask the model to answer using only those passages.&lt;/li&gt;
&lt;li&gt;Require a source reference for the answer.&lt;/li&gt;
&lt;li&gt;Return a clear fallback when the passages don’t provide enough evidence.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The fallback can be simple:&lt;/p&gt;

&lt;p&gt;“I couldn’t find that information in the provided documents.”&lt;/p&gt;

&lt;p&gt;The important part is making that response a valid outcome.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I want to test
&lt;/h2&gt;

&lt;p&gt;I’ll use three types of questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Answerable:&lt;/strong&gt; The document directly contains the answer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Related but unsupported:&lt;/strong&gt; The question shares the document’s topic, but the answer is missing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unrelated:&lt;/strong&gt; The question is outside the document’s scope.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That middle group is especially interesting. A passage can look relevant while still failing to support an answer.&lt;/p&gt;

&lt;p&gt;For each response, I’ll check:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Is the answer correct?&lt;/li&gt;
&lt;li&gt;Does the cited passage actually support it?&lt;/li&gt;
&lt;li&gt;Did the app decline when the evidence was missing?&lt;/li&gt;
&lt;li&gt;Did it unnecessarily decline a question it could answer?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This should help expose both unsupported answers and overly cautious responses.&lt;/p&gt;

&lt;h2&gt;
  
  
  One thing I’m being careful about
&lt;/h2&gt;

&lt;p&gt;A valid citation ID doesn’t prove that an answer is correct. It only proves that the referenced passage exists.&lt;/p&gt;

&lt;p&gt;I still need to check whether that passage supports the claim.&lt;/p&gt;

&lt;p&gt;Similarly, I don’t want to choose a retrieval-score threshold and assume it works everywhere. Any cutoff needs testing with the actual documents and retrieval method.&lt;/p&gt;

&lt;h2&gt;
  
  
  The goal for today
&lt;/h2&gt;

&lt;p&gt;Build a small baseline, inspect where it fails, and record the results before adding more complexity.&lt;/p&gt;

&lt;p&gt;I’m starting here because knowing when to stop answering feels like a useful foundation for a document-based AI application.&lt;/p&gt;

&lt;p&gt;If you’re building a RAG app too, try asking a question that sounds relevant but whose answer is deliberately missing from the documents.&lt;/p&gt;

&lt;p&gt;Does your app notice?&lt;/p&gt;

&lt;h1&gt;
  
  
  Discussion
&lt;/h1&gt;

&lt;p&gt;What’s one question you would use to test whether a RAG application is guessing?&lt;/p&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>challenge</category>
      <category>rag</category>
    </item>
  </channel>
</rss>
