AI Engineering · · 6 min

Evaluating RAG: beyond cosine similarity

Evaluate RAG with retrieval and generation metrics, labelled test sets, permission checks and grounded answers—not embedding similarity alone.

Abstract illustration of connected computing and data systems
Conceptual illustration; not a client system or measured result.

RAG is two systems, so evaluate two systems

A RAG pipeline retrieves passages and then generates an answer from them. When an answer is wrong, the cause is either that the right passage was never retrieved, or that the model ignored or distorted it. Blended metrics hide which one happened.

Retrieval metrics

Build a golden set of questions, each labelled with the passages that contain the answer. Then track:

  • Recall@k — is a correct passage in the top k results?
  • MRR — how high does the first correct passage rank?
  • Coverage of 'no answer' questions — does retrieval return low-confidence results when the corpus genuinely lacks the answer?

Generation metrics

Faithfulness checks that every claim in the answer is supported by the retrieved context. Answer relevance checks that the answer addresses the question. Refusal accuracy checks that the system says it does not know when the context is insufficient — often the most valuable behaviour in regulated industries.

Why cosine similarity is not enough

Embedding similarity between an answer and a reference rewards answers that sound alike, not answers that are correct. Two answers differing by a single negation or number can score almost identically. Use it as a cheap signal, never as the gate.

Use a diagnostic matrix before changing the model

Inspect the retrieved passages alongside the final answer. This distinguishes missing evidence from faulty generation and avoids paying for a larger model when the real problem is indexing or permissions.

  • Split evaluation questions by document or time period to reduce leakage.
  • Test tables, scanned documents, conflicting sources and unanswerable questions.
  • Measure citation correctness as well as whether a citation is present.
Use a diagnostic matrix before changing the model: decision checks
Observed failureLikely layer to inspectNext experiment
Relevant evidence is absentIngestion, chunking, filters and retrievalCheck source coverage and recall at a fixed retrieval depth
Evidence is present but the answer is wrongPrompt, context ordering and generationTest grounding instructions and claim-level review
A superseded policy is citedDocument versions and freshnessCheck indexing dates and prefer the current authoritative version
Restricted content appearsIdentity and retrieval permissionsTest access with distinct user roles before release

Catching regressions

Run the full harness in CI whenever chunking, embeddings, rerankers, prompts or models change. Re-index changes are the silent killer: a new chunking strategy can lift one metric and quietly drop recall on tables or long documents.

Working on something similar?

Discuss your workflow, available data and operating constraints with Talee’s engineers to assess a suitable next step.

Talk to an engineer
FAQ

Questions about this topic

03 · Questions

01

What is a good recall@k for RAG?

+

It depends on the domain, but teams usually target high recall at k=5–10 on their golden set before tuning generation, because the model cannot use a passage it never sees.

02

What is faithfulness in RAG?

+

Faithfulness measures whether every statement in the generated answer is supported by the retrieved context, rather than invented by the model.

03

How often should RAG be re-evaluated?

+

On every change to chunking, embeddings, retrieval, prompts or model, and on a schedule as the underlying document corpus changes.

Related reading