---
title: "Comment by Ahmet Özel on \"My RAG prototype gave a confident, well-formatted answer with citations. One line read:\" | Hashnode"
description: "Auditing all 4,300 chunks directly in Postgres instead of tweaking the system prompt is how every RAG postmortem should start. Finding broken ligatures like shu"
url: "https://hashnode.com/posts/debugging-rag-citations-data-quality/6b044a9805ee082ef72dfd60/comment/6b04bd4ca14b26c9cd1ab26f"
---

[Discussion](https://hashnode.com/posts/debugging-rag-citations-data-quality/6b044a9805ee082ef72dfd60)

Comment [My RAG prototype gave a confident, well-formatted answer with citations. One line read:](https://hashnode.com/posts/debugging-rag-citations-data-quality/6b044a9805ee082ef72dfd60)

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

[1d ago](https://hashnode.com/posts/debugging-rag-citations-data-quality/6b044a9805ee082ef72dfd60/comment/6b04bd4ca14b26c9cd1ab26f)

Auditing all 4,300 chunks directly in Postgres instead of tweaking the system prompt is how every RAG postmortem should start. Finding broken ligatures like shuﬄe across 88 percent of chunks and discovering that citation \[3\] was actually a conference talk title explains both retrieval noise and false citations without blaming the 3B generator.

That off-topic score—0.578 cosine similarity for a weather question against AWS docs—is also a great reminder that raw cosine floors behave wildly differently across embedding models and always need calibration on negative queries.

[Ashok Gharpankar](https://hashnode.com/@cloudcompass)

[1d ago](https://hashnode.com/posts/debugging-rag-citations-data-quality/6b044a9805ee082ef72dfd60/comment/6b04bd4ca14b26c9cd1ab26f#reply-6b052498bd953dca395f9b5e)

Thanks, that's exactly the point I wanted to land. The prompt is the quickest lever, so it's tempting to start there, but the model can only be as good as the chunks it's handed.

You're right about the floor too. 0.578 for a weather question only means something relative to nomic-embed-text and this corpus; swap the embedding model and the whole distribution shifts. That's what I'm working on now: a small evaluation set with answerable questions alongside off-topic and prompt-injection ones, so the floor comes from the measured gap between the two groups instead of a handful of manual searches. It also scores retrieval (hit rate, MRR) separately from the answers, so the next change can be judged with numbers.

Writing it up as the next post in the series. Stay tuned.

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

[14h ago](https://hashnode.com/posts/debugging-rag-citations-data-quality/6b044a9805ee082ef72dfd60/comment/6b04bd4ca14b26c9cd1ab26f#reply-6b066e3b226caede0fed97db)

Separating retrieval metrics like hit rate and MRR from generator scoring while including off-topic and prompt-injection negatives is a clean way to calibrate the similarity floor empirically. Tracking the score gap between the lowest true-positive chunk and the highest off-topic match also gives you an immediate alert whenever an embedding model upgrade shifts the distribution.

[Ashok Gharpankar](https://hashnode.com/@cloudcompass)

[14h ago](https://hashnode.com/posts/debugging-rag-citations-data-quality/6b044a9805ee082ef72dfd60/comment/6b04bd4ca14b26c9cd1ab26f#reply-6b06779571c8673a8f48e37e)

Exactly, and the gap turned out more humbling than I expected. On the first run the groups didn't separate at all: the gap was −0.013. A prompt-injection question scored 0.727, above my weakest real question at 0.714. Cosine similarity measures topic, not answerability.

So the floor stays as a cheap cost shortcut, and the gate checks the outcome instead: 100% of off-topic and injection questions must be refused, whichever layer refuses them. The gap is still reported on every run, as you suggest. After switching to hybrid search it's +0.007, far too narrow to tune a threshold to, but it's the number to watch on the next embedding change.

The full results, including a reranker that made retrieval worse, are in the new post: [cloudcompass.hashnode.dev/from-79-to-100-retrieva…](https://cloudcompass.hashnode.dev/from-79-to-100-retrieval-hit-rate-hybrid-search-helped-a-reranker-made-it-worse)
