I Made My RAG Safer. It Got Worse Under Load
AI Summary
*RAG isn't dead, but unverified RAG should be. Here's what checking every sentence actually cost me on Groq's free tier, and a few other things I learned along the way.* I rebuilt my RAG system so that no sentence reaches the user until it has been checked against the passage it cites. The first se...

RAG isn't dead, but unverified RAG should be. Here's what checking every sentence actually cost me on Groq's free tier, and a few other things I learned along the way.
I rebuilt my RAG system so that no sentence reaches the user until it has been checked against the passage it cites. The first sentence started showing up sooner, and nothing unverified was ever shown.
Then I ran it under heavy overload. It delivered 62.8% of requests. The old version delivered 67.4%.
Honestly this one hurt a bit, because my own safety feature was the reason. I will explain it below.
That run also changed how I read the "RAG is dead" posts. Yes, context windows are huge now, and coding agents find things with grep instead of vector databases. But none of that answers the question that actually cost me those requests: who checks the answer?
TL;DR
- Checking every sentence made answers appear sooner, but under heavy load it cost throughput: 62.8% delivered against 67.4%.
- When 30 requests came in 2 seconds, the system made only 6 model calls. Same questions share one answer.
- The cheapest correct answer is a refusal that never calls the model.
- My slowest request spent 29.2 of its 29.8 seconds just waiting in a queue.
- A small "is this sentence supported?" judge model would have blocked about 1 in 5 good sentences.
What I built
The Relay answers questions only from three research papers: Attention Is All You Need, Moshi and H-Net. Every sentence must cite the passage it came from. If the papers don't say something, it has to say so instead of guessing. And it has to survive Groq's free tier while requests come in bursts.
The flow is: queue → cache → retrieval (BM25 plus embeddings) → evidence check → model call → per-sentence verification. No LangChain, no vector database. The papers make only about a thousand chunks, so plain NumPy search takes under a millisecond. You can try it without any API key. It ships with a stand-in model that I calibrated from real Groq measurements and most of my load tests ran against that.
1. "RAG is dead" is really about retrieval. My problem was trust.
The good "RAG is dead" arguments aren't saying what the headlines say. This AI Engineer talk points out that grep and BM25 are retrieval and the debate mixes up RAG with vector search. This post by Akita argues that agents are moving to big context and simple text search.
I agree with both. But my requirements were:
- Answer only from these papers.
- Show where each claim came from.
- Say no when the papers don't cover it.
A bigger context window doesn't give you any of these. A model with all three papers in front of it can still write a sentence the papers don't support. On a free tier, sending all three papers with every question would also blow past the per-minute limit straight away. (To be fair, I didn't test a long-context version, so I'm not claiming it gives worse answers.)
So retrieval isn't dead. The mandatory vector database might be. Answering without checking should be.
2. When everyone asks at once, ask the model once
Bursts are when things break: something goes wrong, and suddenly everyone asks the same thing at the same moment.
So I added SingleFlight. If the same question is already being answered, a new request doesn't make its own model call. It just waits for that answer and gets the same verified sentences. Once the answer is done, repeats come straight from the cache.
In my burst test, 30 requests arrived within 2 seconds, but there were only 6 different questions. The result:
| What happened | Requests |
|---|---|
| Made a model call | 6 |
| Joined a call already in progress | 17 |
| Served from the cache | 7 |
| Delivered | 30 of 30 |
That's 30 answers from 6 model calls, one per distinct question. On a free tier, this is the difference between serving everyone and getting rate-limited in the first few seconds. It also works with more than one server. With Redis shared between workers, my tests send 10 identical requests to two workers at the same time, and they make exactly one model call in total.
3. The best "no" never calls the model
I wrote 21 test questions. Six of them the papers can't answer: blockchain, photosynthesis, the TCP handshake, Newton's laws, MySQL vs MongoDB, and one trap.
Across three retrieval settings, the system said no correctly on all 17 graded cases. The 18th hit a network error, and I left it in the results as an error rather than quietly re-running it.
The interesting part is how. With reranking on, five of the six were refused before any model call, because no passage was relevant enough to answer from. No quota spent, just an honest "the papers don't cover this."
4. Three papers can still fool a naive retriever
The bibliography trap. I asked how WavLM is pretrained. The Moshi paper uses WavLM and cites it, so the keywords match strongly, but it never explains WavLM's pretraining. A naive system finds those passages and the model fills the gap from memory. My widest retrieval setting fell for it.
Shared words. "Transformer", "attention" and "chunk" appear in all three papers, so they can't be trusted to tell the papers apart.
Broken PDF text. The attention formula came out garbled when the PDF was converted to text. One answer picked up a stray 0 from it, the checker caught it, and the user got a safe refusal. That was technically a wrong refusal, but it was wrong in the safe direction, and I'll take that trade every time.
5. Two reasoning models thought until they ran out of room
I compared three Groq models on the same six questions. On three of them, both gpt-oss-20b and gpt-oss-120b used their entire output limit on thinking and never wrote an answer. qwen3.8-27b was never cut off, and every answer passed the citation checks. I picked qwen.
Reasoning models aren't bad. But test the model inside your own limits, not on a leaderboard.
6. Read the rate-limit headers carefully
Groq's x-ratelimit-limit-requests: 1000 header looked per-minute to me at first. But its reset time grew by exactly 86.4 seconds per request, and 86,400 seconds in a day divided by 1,000 is 86.4. So it behaves like a daily limit. I haven't proven it, because that would mean watching it refill for hours (Groq's [rate limits page] has the official numbers.)
My quota guard therefore checks the budget before every call, and there are no hidden retries: every retry is counted. In a test where 30% of calls failed on purpose, a retry limit cut extra attempts (1.27 per request against 1.41), but with the limit on, 2 requests failed, and in the run without it, none did. I still keep the limit, because in a real outage, extra retries only hit a provider that is already struggling.
7. Your slow request is probably a queue
Under overload, my slowest request took 29.8 seconds. Of that, 29.2 seconds was waiting for quota. The actual work, retrieval plus the model, took about 0.6 seconds.
We usually blame the model when things are slow. Under load, my problem was the queue. I could only see that because every request records its waiting, working and retrying time separately.
8. Safety has a cost, and mine showed up under overload
v1 waited for the full answer, checked it, then sent it all at once. v2 checks each sentence as it streams. If a sentence fails, the answer stops there, and the bad sentence is never shown.
In normal bursts, this helped: the first verified sentence arrived in a median of 324.5 ms, where v1 showed nothing until the whole answer was ready (614.2 ms median).
Under heavy overload, though, v2 delivered 62.8% against v1's 67.4%.
The reason: when the checker stops an answer halfway, the model stream is cancelled, but the quota reserved for that call stays used for the rest of the minute. Seven answers were stopped early in that run. That held-up quota was worth about three calls, and v2 made exactly three fewer calls than v1.
I fixed the part on my side, and delivery went up from 55.8% to 62.8%. The rest is quota held by the provider. One important caveat: I measured this on my stand-in model. I don't know yet whether Groq gives that quota back on a cancelled stream. If it does, most of this gap may not exist in real use.
So the trade-off is clear: users see verified sentences sooner and never see a wrong one, and under heavy load, slightly fewer people get an answer.
9. Test your judge model before trusting it
The obvious next step was a small AI model that judges whether a passage really supports a sentence. I scored 224 real sentences with one. At the usual 0.5 threshold, it would have blocked about 1 in 5 good sentences, and still missed more than a third of the bad ones.
So it only records a score and blocks nothing. A judge model has its own error rate, so measure it before you let it decide anything. (The labels I compared against were drafted with AI help, and I haven't reviewed them myself yet, so treat these rates as rough.)
What I'm not claiming
- Answer correctness isn't final. Strict word matching marked 19 of 45 answers correct, but most of the "wrong" ones were flagged only because one exact phrase was missing, and several look like simple wording differences. I haven't graded them by hand yet. Citation checks are the firmer number: 44 of 45 passed.
- Most load numbers come from the stand-in, not real Groq. I kept real calls few on purpose, to protect the free quota.
- The samples are small, so small differences are within noise.
- The judge-model analysis isn't public yet. The raw data behind every other number is in the repo linked below.
So, is RAG dead?
The version where you embed everything, grab the top five chunks and trust whatever the model says, yes, that should go.
What should stay: find the right passages, cite them, check every claim before showing it, say no when the evidence isn't there, and plan for your limits. Whether you find those passages with vectors, BM25, grep or a huge context window matters much less than whether anything checks the answer.
Over to you all: when a sentence fails the check halfway through a stream, what would you do? Stop and lose the quota like I do, or let the model finish and throw the rest away? I'm really curious what you'd pick, and why.