---
title: "Discussion on \"Day 18: pdf_loader.ipynb — Adding Groq, and Teaching RAG to Say No\" | Hashnode"
description: "Discussion on \"Day 18: pdf_loader.ipynb — Adding Groq, and Teaching RAG to Say No\". My RAG pipeline answered a question none of my PDFs could. That turned out to be a bug."
url: "https://hashnode.com/posts/day-18-pdf-loader-ipynb-adding-groq-and-teaching-rag-to-say-no/6aafd6b9a6c1867cb726d732"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Day 18: pdf\_loader.ipynb — Adding Groq, and Teaching RAG to Say No](https://parthkg.hashnode.dev/day-18-pdf-loader-ipynb-adding-groq-and-teaching-rag-to-say-no?utm_source=hashnode&utm_medium=feed)

My RAG pipeline answered a question none of my PDFs could. That turned out to be a bug.

Sep 20 · 7 min read · parthkg.hashnode.dev  
Read the article

-   [#machine-learning](https://hashnode.com/tag/machine-learning)
-   [#python](https://hashnode.com/tag/python)
-   [#rag](https://hashnode.com/tag/rag)
-   [#langchain](https://hashnode.com/tag/langchain)
-   [#llm](https://hashnode.com/tag/llm)

## Written by

[Parth krishan Goswami](https://hashnode.com/@ParthKG)

@ParthKG

  
[View profile](https://hashnode.com/@ParthKG)

Learning AIML with everyone

## Responses 2

Markdown supported · ⌘↵ to post

[Ahmet Özel](https://hashnode.com/@ahmetozel)

[Sep 20](https://hashnode.com/posts/day-18-pdf-loader-ipynb-adding-groq-and-teaching-rag-to-say-no/6aafd6b9a6c1867cb726d732/comment/6ab0473373e3cc4a0302069c)

Treating a confident answer with no supporting chunk as a bug rather than a quirk is exactly the right lesson to take from this one.

Worth knowing the shape it keeps as you scale: abstention is not something you reliably prompt your way into, because the model cannot distinguish "this context is thin" from "this context is enough". The version that held up for me is a threshold before generation rather than an instruction inside it. If the top retrieval score is below a floor you derived from a labelled set, you return the refusal yourself and never call the model at all. It also gives you a number you can tune, which "say I don't know" never does.

[Mihai\_LeanZero](https://hashnode.com/@mihaileanzero)

[Sep 20](https://hashnode.com/posts/day-18-pdf-loader-ipynb-adding-groq-and-teaching-rag-to-say-no/6aafd6b9a6c1867cb726d732/comment/6aafda8be4543e0506016159)

The gap I'd flag is that the threshold and the refusal line only catch the case where nothing relevant came back at all. They don't catch the harder one, where a chunk clears 0.3 on topic but the model still writes an answer that goes beyond what that chunk actually supports, or blends two chunks into a claim neither makes on its own. The "confidence" you're returning is really just the top retrieval score, not a measure of whether the generated sentence is actually entailed by the sources you're citing.

The fix I've used for that is a cheap post-hoc check rather than a stronger prompt: after generation, verify each cited source snippet against the answer text (even a simple substring/overlap or embedding-similarity check between claim and citation) and drop or flag any sentence whose citation doesn't back it up. It won't stop the model from trying to overreach, but it stops an overreach from reaching the user silently, which a prompt instruction alone can't guarantee once the threshold has already let the chunk through.
