◉CLAUDE LABJP
●2.1.301 — Adds the vim % motion, LaTeX math rendering in the VS Code panel, and a retry-watchdog limit for usage-limit waits (10/15)●2.1.299 — Conversations over 200K tokens left idle about 54 minutes get compacted; MCP allow rules now match only the server they name●SONNET 4.5 — Retires on the Claude API on 11/30, 45 days left. Migrate to Sonnet 5.5●WINDOWS — Reports say hooks break silently only on Japanese-locale Windows; check the character encoding first●FAST MODE — Opus 5.5 fast mode is out of research preview and no longer needs the beta header (10/15)●NEW — I Put a Ten-Line Promise File at the To…●2.1.301 — Adds the vim % motion, LaTeX math rendering in the VS Code panel, and a retry-watchdog limit for usage-limit waits (10/15)●2.1.299 — Conversations over 200K tokens left idle about 54 minutes get compacted; MCP allow rules now match only the server they name●SONNET 4.5 — Retires on the Claude API on 11/30, 45 days left. Migrate to Sonnet 5.5●WINDOWS — Reports say hooks break silently only on Japanese-locale Windows; check the character encoding first●FAST MODE — Opus 5.5 fast mode is out of research preview and no longer needs the beta header (10/15)●NEW — I Put a Ten-Line Promise File at the To…
Articles/API & SDK
⬡ API & SDK/2026-07-09Advanced

When the RAG Started Being Confidently Wrong — Field Notes on Measuring Retrieval Misses With Groundedness

In a Claude API RAG, the answers stay fluent while the facts drift. Often the cause is a silent recall decay on the retrieval side, missing the document that holds the answer. Field notes on measuring groundedness and retrieval hit rate and walking the system back, with working code and real numbers.

Claude API128RAG4vector searchretrieval augmented generationgroundednessevaluation3TypeScript24

✦ Premium Article

I asked our support RAG, "How many days is the refund window?" Claude answered smoothly: "Within 14 days." The actual policy was 30. The answer was fluent, cited its sources, and radiated confidence — which is exactly what made my stomach drop.

The model wasn't broken. Retrieval was. It had failed to fetch the document holding the answer, yet generation carried on, and Claude assembled a plausible falsehood from the unrelated fragments it happened to have.

These are field notes on a silent recall decay — a retrieval miss — in a Claude API RAG I ran in production: how I surfaced it with a groundedness number and walked it back in stages. This is not about building a RAG. It is about how to notice, and fix, when retrieval quietly degrades after you've built it. I'll leave the build steps to pieces like prompt caching design for the Claude API and focus here on measurement.

Generation never stops, so decay stays invisible

The awkward thing about RAG is that generation continues even when retrieval fails. With zero relevant documents, or a few unrelated fragments hovering near the threshold, Claude still returns something that reads well. The API throws nothing. The logs are a wall of 200s.

The decay I hit didn't arrive one morning — it crept. I added documents to the knowledge base, tweaked chunking, swapped the embedding model for a newer version. Every change was well-intentioned. And each time, the document containing the answer got quietly pushed out of the top-K.

The trouble is that none of this shows up in how the answer looks. The prose stays fluent — the confidence, if anything, grows. Only a vague "it's felt off lately" from users arrives, and late. So I needed to measure whether retrieval was actually grabbing the answer, separately from generation.

Doubt it as two numbers

Treating "the RAG is drifting" as one lump makes the cause impossible to isolate. I split the problem in two and gave each its own number.

MetricWhat it measuresWhat a low value means
Retrieval hit rateShare of queries where the answer-bearing doc lands in the top KRetrieval (embeddings, chunks, threshold) is broken
GroundednessShare of answers actually supported by the retrieved docsRetrieval works but generation ignores the docs

If retrieval hit rate is low, the cause is the retrieval pipeline. If hit rate is high but groundedness is low, the cause is the generation prompt or how the context is packed. Just being able to make that cut ended the blind trial-and-error.

The first time I measured, retrieval hit rate was 68% and groundedness 61%. One in three times, the document with the answer never even reached Claude. Seeing the numbers is what finally made the problem's location click.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦How to split a fluent-but-wrong RAG into two numbers — groundedness and retrieval hit rate — to tell a retrieval failure from a generation failure
✦A working implementation that puts Claude in the grader's seat to score whether an answer is actually grounded in the retrieved docs, run daily
✦The staged fixes — chunk bloat, embedding-model swaps, threshold drift — that walked groundedness from 61% back to 94%
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

⬡ API & SDK2026-05-04
Claude API on Bun in Production: Migration Decisions and Implementation Patterns That Actually Survive Real Traffic
A practical guide to running Claude API services on Bun in production. Covers migration triggers from Node.js, built-in SQLite/WebSocket usage, streaming optimization, and the pitfalls that only surface after deployment — with working code and measured numbers.
⬡ API & SDK2026-04-25
Claude API × Convex: Reactive AI Apps — Data Flow, Streaming, and Agent Patterns
How to combine Convex's reactive database with the Claude API to build chat and agent applications that hold up in production. Covers schema design, the Action/Mutation/Query boundary, streaming, tool-call state, and the cold-start pitfalls nobody warns you about.
⬡ API & SDK2026-04-17
Building a GitHub PR Review Bot with Claude API — From Webhook Signature Verification to Structured Reviews with Tool Use
Build a production PR review bot with Claude API and GitHub Webhooks. Enforce structured scoring and security scanning via Tool Use, then handle the parts that bite in production — signature checks that pass only locally, 202 responses that hide failures, debouncing, and cost tracking.