DEV Community

My Simulation Exaggerated the Cost of My Own Safety Feature

Ayush Singh on November 26, 2026

In my last post, I wrote that checking every sentence before showing it made my RAG system worse under load: 62.8% delivered against 67.4% for the ...
Collapse
 
aheadkit profile image
AheadKit •

The 130 ms scorer sitting next to the 3 ms checker is such a familiar shape. Our fetch-on-demand arm did the same thing in reverse: the fetch wasn't the expensive part, the instruction to fetch plus the summary it was supposed to save on cost more than the fetch itself — 1,944 tokens a task against 1,472 for the plain trimmed version that never fetched at all. And your word-checks finding is the one that stuck with me: every word present, only the relationship wrong. Our small local model does the same thing at a cruder level, it just answers the loudest issue whatever the question asked. The words are all there. The claim still isn't true.

Collapse
 
ayush_singh321 profile image
Ayush Singh •

That is a great parallel thanks for sharing the numbers. The fetch being cheaper than the instructions around it is the same lesson I learned that the cost was in the machinery next to the feature, not the feature itself. I wouldn't have guessed that until I switched each part off one at a time. And "answers the loudest issue whatever the question asked" is a really good way to put it. It is the same failure one level up: and actually in my case the words match but the relationship is wrong in yours the topic matches but the question is wrong. Both pass any check that only asks whether the right words are present. It makes me think a useful check has to compare the answer with the question not just with the source.

Collapse
 
aheadkit profile image
AheadKit •

That last line is the one I'm stealing — a check that compares the answer with the question, not just with the source. Most checks I know only do the second half. Going to try building that one over our own runs and see what it catches. Have you tried it yourself, or is it still the shape on paper?

Thread Thread
 
ayush_singh321 profile image
Ayush Singh •

Honestly, it is still on paper 😄 Nothing in my pipeline checks the answer against the question yet. The closest thing is the evidence gate, which compares the question with the retrieved passages but that runs before the model and never sees the answer. The only real answer-vs-question check I did was by hand: when I graded 45 answers, most of the "partly correct" ones were on the right topic but incomplete. An automatic check would need to catch that. I'd really like to hear what it catches on your runs, please share if you try it!

Collapse
 
userxnom profile image
Abdullah Naseer •

Respect for publishing the correction this thoroughly — most people would have quietly moved on after the first post. The simulator bug is the part that will stay with me: the stand-in splitting sentences differently from the checker, so 15 false stops looked like the safety feature was expensive when it was not. That is exactly the kind of measurement error that is hardest to spot, because the numbers looked plausible.

Profiling the suspects one at a time was the right move too. The advisory scoring model costing about 130 ms per request while blocking nothing, and the fair queue costing about an answer per run, are both features sitting next to the checker rather than the checker itself. And the encoder/decoder swap example is perfect — all 7 of those false claims passed the word checks because every word was present, only the relationship was wrong. Word presence is not truth.

What would you change in the simulator to catch a sentence-splitting mismatch automatically next time — for example, asserting the stand-in and the checker share the same splitter before any run starts?

Collapse
 
ayush_singh321 profile image
Ayush Singh •

Thanks a lot I really appreciate this. That's close to what I actually did. The stand-in no longer has its own splitter what it does is that it imports the checker's sentence-split function so the two can't drift apart. There is also a test that splits stand-in answers the way the checker does and fails if any sentence comes out without a citation.
The one thing I would still add is a check before each load run. Run a short warm-up with failures switched off and refuse to start if the checker stops anything. Then on a clean stand-in the expected number of stops is zero so any stop means that the simulator is wrong, not the model. The 15 false stops would have been caught before any numbers were recorded.
The broader lesson for me is that when a simulator imitates a component it should reuse that component's code not to copy its logic.

Collapse
 
paullovelace profile image
Paul Lovelace •

Respect for publishing the correction this thoroughly — most people would've quietly moved on after the first post. "The checker was right; the simulator was wrong" is the line that stays with me. And the judge getting worse on blind review, 1 in 4 good sentences blocked — that's the honest kind of result. One question: at 27% bad answers v2 fell behind because cancelled streams held quota — did the call-spacing fix change that math at all, or is that just the price of the safety?

Collapse
 
ayush_singh321 profile image
Ayush Singh •

Thank you so much and as an undergraduate getting this kind of feedback from so many experienced engineers has taught me more than any course. Actually looking for an internship and building projects like this on the side and getting thoughtful feedback from people like you has taught me more than I expected.
So on your question: no, the call spacing doesn't change that math. It fixes a different problem. On the real Groq I hit a 429 even though tokens and daily requests were far from their limits so there is a request-rate limit the headers don't show. Spacing out call starts avoids that 429, but it doesn't release quota from a cancelled stream.
What I actually saw at 27% is that the guard keeps the full reservation when a stream is cancelled because the real usage report never arrives there the likely fix is to release the unused part on cancel or to let the stream finish in the background so the real usage comes back. I haven't tested either yet. So for now, partly yes, it is the price of safety but only at a very high failure rates. At about 6% bad answers or less I couldn't measure any cost. A real model in my replay produced about 1 bad answer in 55.

Collapse
 
gautamtalksdev profile image
Gautam K •

Respect for going back and measuring again in public. Finding that most of the cost came from a simulator bug and two neighbouring features, and the checks themselves take about 3 ms, is a much more useful result than the first one. Did the forced-failure test change how you think about what to show the user when a sentence fails?

Collapse
 
ayush_singh321 profile image
Ayush Singh •

Thanks and that means a lot . So it doesn't actually change what the user sees: an unchecked sentence is still never shown. v2 keeps the sentences that passed and adds a note while the v1 replaces the whole answer with a refusal. What it changed is where I think the cost is. The cost of stopping wasn't in the screen it was in the quota and at about 1 bad answer in 4, cancelled streams were still holding their reservation so the other users got turned away.
The judge test also made me more careful about what actually the "passed" means because word-level checks let through the claims where only the relationship was wrong. One thing I still haven't measured is whether a partial answer with a note is actually more useful to a reader than a clean refusal. That needs real users not a simulator.

Collapse
 
brookiecat profile image
Brookie •

the queue rule is my favorite bit. a lone user pushing out their own older request isn't unfair, it's a cat at a flap. asks in, gets in, immediately asks out, and the only thing it shoves aside is itself. so the answer you lost per run wasn't the checker's bill. it was a door tax.

Collapse
 
ayush_singh321 profile image
Ayush Singh •

Haha "door tax" is perfect, I am stealing that 😄 It is exactly what actually happened. The rule was meant to stop one user from crowding out others but when only one user was waiting the only person it pushed aside was themselves. The fix was to apply it only when someone else is actually waiting. Now a user alone in the queue is just served in arrival order. One answer per run doesn't sound like much but it was the "4th lost answer" that several people asked about after my first post.

Collapse
 
the_daily_flare profile image
The daily flare •

I think the simulator hid the real cost until the live numbers told a clearer story.