RAG Evaluation Frameworks

The three checks that tell you if a RAG answer is right and grounded.

🔴 advanced5 min readragevaluation
Evaluating RAG architectures requires auditing both the Retrieval component and the Generation component independently. The RAG Triad framework (RAGAS / TruLens) breaks down evaluation into three fundamental metrics: 1) Context Precision (evaluating if retrieved context chunks are relevant to the query), 2) Faithfulness (measuring what share of the answer's claims are supported by the retrieved context), and 3) Answer Relevance (evaluating if the LLM output directly answers the user prompt).

The RAG Triad Architecture

                                USER QUERY
                                    │
         ┌──────────────────────────┴──────────────────────────┐
         ▼                                                     ▼
 [ CONTEXT PRECISION ]                                [ ANSWER RELEVANCE ]
 Is retrieved context                                 Does generated answer
 relevant to query?                                   directly address query?
         │                                                     │
         ▼                                                     ▼
Retrieved Context Chunks ──────► [ FAITHFULNESS ] ──────► Generated LLM Answer
                                 Is answer 100%
                                 grounded in context?

Deep-Dive: The 3 Core RAG Metrics

1. Context Precision (Retrieval Metric)

Evaluates whether top-ranked retrieved chunks are relevant to user query qq:

Context Precision@K=∑k=1KPrecision@k⋅vkTotal Relevant Chunks in Top K\text{Context Precision@K} = \frac{\sum_{k=1}^K \text{Precision}@k \cdot v_k}{\text{Total Relevant Chunks in Top } K}

2. Faithfulness / Groundedness (Generation Metric)

Prevents Hallucinations! Evaluates if claims in answer aa are supported by context cc:

Faithfulness=Number of Claims in a Supported by cTotal Number of Claims Extracted from a\text{Faithfulness} = \frac{\text{Number of Claims in } a \text{ Supported by } c}{\text{Total Number of Claims Extracted from } a}
  1. LLM breaks response aa into discrete atomic statements S={s1,s2,…,sn}S = \{s_1, s_2, \dots, s_n\}.
  2. LLM verifies if each statement sis_i is directly supported by retrieved context cc.

3. Answer Relevance (Generation Metric)

Evaluates if answer aa directly addresses query qq, ignoring context grounding:

  1. Prompt an LLM to generate N=3N=3 artificial questions qi∗q_i^* based on generated answer aa.
  2. Compute average embedding cosine similarity:
Answer Relevance=1N∑i=1Ncos⁡(eq,eqi∗)\text{Answer Relevance} = \frac{1}{N} \sum_{i=1}^N \cos(\mathbf{e}_q, \mathbf{e}_{q_i^*})

Component Breakdown Diagnostics

  Context Precision    Faithfulness    Answer Relevance    Diagnosis / Fix Required
──────────────────────────────────────────────────────────────────────────────────────────────────
       LOW                 HIGH              HIGH          Retriever is noisy! (Tune Chunking / BM25 Hybrid)
       HIGH                LOW               HIGH          LLM is Hallucinating! (Lower Temp / Add Strict System Rules)
       HIGH                HIGH              LOW           LLM is Off-Topic! (Improve Prompt Instructions)

Say this out loud

"RAGAS evaluates RAG pipelines across the RAG Triad: Context Precision measures retriever signal-to-noise ratio, Faithfulness measures what fraction of the answer's claims are supported by the retrieved context, and Answer Relevance measures if the response directly addresses the query. Breaking down metrics isolates whether failures stem from retrieval noise or LLM generation."

Follow-ups to expect

Check yourself

Question 1 of 3

Which metric in the RAG Triad detects whether an LLM is hallucinating facts NOT present in the retrieved context chunks?

More in LLMs & GenAI

See all →
Pretraining → SFT → RLHF5 minFine-Tune vs RAG vs Prompt: Choosing5 minRetrieval-Augmented Generation5 min