r/softwaretesting • u/CasualScroller2901 • 11d ago
How are you guys testing RAG apps and handling hallucinations in production?
RAG app hallucinations are driving us nuts! I recently checked out AI system testing with DeepEval on Rahul Shetty Academy to learn more about evaluation metrics. What tools do you guys use for testing RAG applications and handling hallucinations?
9
Upvotes
7
u/TheHallowedArchery 11d ago
Eval harnesses with golden datasets and an LLM judge catch most drift before it gets to users.
3
u/bostonaholic 11d ago
Two checks I'd add on top of the golden set. Put in questions whose answer isn't in your docs at all, where the only passing answer is some form of "I don't know." And have the model quote the source text behind each claim, then check in code that every quote actually appears in the retrieved chunks. That one is deterministic, so it doesn't depend on another model's opinion.
2
u/LukaRozman27 11d ago
Manual spot checks with a set of 50-100 gold standard queries caught way more hallucinations than automated metrics alone. Human review is slow but still best for edge cases, especially when retrieval quality changes after data updates.
1
u/FollowingProof9647 8d ago
DeepEval is a good place to start. Most of what helped us was less about the tool and more about splitting the problem:
For Production Specifically:
Tools-wise: DeepEval or Ragas for the metrics, promptfoo is nice for running eval suites in CI, and Langfuse or LangSmith for tracing in production.
1
u/ChatteryChap 4d ago
Testing retrieval and generation separately, like the comment says, is the big one. Two things I'd add since you mention production.
Put questions in your test set that the documents can't answer. A lot of hallucination testing only uses questions that have a right answer, so you never find out whether the app says "I don't know" or makes something up. Passing those tells you more than a high faithfulness score does.
In production, the useful signal comes from users. Log conversations where someone says the answer is wrong, rephrases the same question, or asks for a person right after an answer, and turn the bad ones into new test cases. That keeps the test set tied to what people actually ask instead of what someone guessed they'd ask. I work at Botpress and we build custom CS agents for businesses, and that loop is the first thing I'd set up.