RAGLens
/AboutWhat RAGLens is
RAGLens is a compact retrieval-augmented answering pipeline wrapped in a diagnosis layer. Most RAG demos show an answer and a similarity score. RAGLens says what actually happened: whether supporting evidence was retrievable at all, whether retrieval surfaced it, and whether the answer used it — or went beyond it.
Why diagnosis matters
Ask the Google Developer Style Guide corpus: “How should I write alt text for images in documentation?” It sounds like exactly the kind of question a style guide answers. In a live run, retrieval scored 0.15 and the answer scored 0.95 — a spread a single aggregate score would flatten into an unremarkable “borderline.”
The two numbers tell different stories, and both are correct. Retrieval scored low because the indexed corpus did not provide retrievable support: an exhaustive pass over every indexed chunk found nothing above the calibrated relevance threshold. The answer scored high because it did the right thing with that situation — it said the sources don’t cover alt text instead of inventing guidance.
That is likely a content gap — and “likely” is doing deliberate work. An exhaustive retrieval pass proves only that this retriever found nothing; the content may exist in a form this retriever cannot match. Confirming a gap is the corpus owner’s call, so the diagnosis routes the question there rather than declaring the corpus incomplete.
When refusing is the right answer
Language models are not deterministic, and the same question does not always get the same behavior. Sometimes the model declines cleanly — a correct refusal, scored as healthy behavior, not failure. Sometimes it answers anyway, producing plausible-sounding alt-text guidance from its training data with nothing retrievable behind it.
The evidence facts are identical in both runs; what changes is what the model did with them. The diagnosis tells the branches apart: the refusal is labeled a correct abstention, the confident answer is labeled answered without retrievable support. That variance isn’t a flaw in the demo — it is the failure mode RAGLens exists to catch, because the unsupported answer is the one that reads most convincingly.
How the diagnosis works
Retrieve evidence
Dense vector search pulls the top paragraph chunks into the generation window. A deterministic broad pass — exhaustive on these corpora — records what exists beyond it.
Generate answer
One generation call, grounded on the retrieved window only. The pipeline is deliberately compact; the evaluation questions apply unchanged to hybrid and agentic stacks.
Judge relevance + evidence
An LLM judge scores the retrieved window only: relevance, evidence sufficiency, answer groundedness, and whether the answer correctly abstained.
Diagnose outcome
Judge scores combine with broad-pass availability into a failure label, and every verdict states its coverage: exhaustive, broad pass, or window-only.
Relevance thresholds are calibrated per corpus against human-labeled test cases. No golden evaluation set is required to start — any question gets a full diagnosis, and expert labels sharpen it. One limitation is disclosed rather than hidden: the same model family generates and judges, so self-evaluation bias is real. A cross-model judge is future work.
See it live
Run the alt-text example from the single-query page — it’s the “Evidence not found” card under the Developer Style Guide corpus. Or run the Evaluation Suite, where curated cases — including expected refusals — run against the live pipeline.