Skip to content
derpx06.dev
WritingExplainersNotesAbout
works on my machineit's always DNSship itLGTMTODO: sleepoff by oneread the docsgit push --force-with-lease404: sleep not foundhave you tried turning it off and on againrubber duck says: explain itpremature optimisationworks on my machineit's always DNSship itLGTMTODO: sleepoff by oneread the docsgit push --force-with-lease404: sleep not foundhave you tried turning it off and on againrubber duck says: explain itpremature optimisation

Learning in public.

A student's notebook on system design, distributed systems and databases. Shared as I learn.

ReadWritingExplainersNotesAbout
ElsewhereGitHubLinkedInHugging FaceLeetCode
Say hellomanaskhairnar1511@gmail.com
derpx06
NORMALmain© 2026 Derpx06Pune, Indiatop ↑
Learn/LangChain Mastery/Part 9 · 8. Production, Evaluation & Governance
Lesson 64 of 68

RAG Evaluation Basics

Beyond 'vibes'. Measuring what matters.

Derpx0610 Jan · 1 min read
LangChain Mastery
Async & High-Throughput PatternsLatency & TTFT OptimizationTracing with LangSmithRAG Evaluation BasicsFaithfulness & RelevancePrompt Injection DefenseInput & Output GuardrailsDeployment & API Serving
Contents
1. The "Looks Good to Me" Trap2. Offline Evaluation (The Exam)3. Online Evaluation (The Feedback Form)4. LLM-as-a-Judge5. Summary
0% read · 1 min leftBack to top ↑
Course outline & contents0%
LangChain Mastery
Async & High-Throughput PatternsLatency & TTFT OptimizationTracing with LangSmithRAG Evaluation BasicsFaithfulness & RelevancePrompt Injection DefenseInput & Output GuardrailsDeployment & API Serving
Contents
1. The "Looks Good to Me" Trap2. Offline Evaluation (The Exam)3. Online Evaluation (The Feedback Form)4. LLM-as-a-Judge5. Summary

1. The "Looks Good to Me" Trap

You act as the QA. You ask 5 questions. The bot answers 4 correctly. You ship it. In production, users ask 5,000 questions. The bot fails 2,000 of them. Anecdotal Testing is not Evaluation.

2. Offline Evaluation (The Exam)

Before you deploy, run a test suite. You need a Gold Dataset: A CSV of (Question, Ground_Truth_Answer, Ground_Truth_Document_ID).

Metrics:

  1. Retrieval Metrics:
    • Recall@5: Is the correct Document ID in the top 5 results?
    • MRR (Mean Reciprocal Rank): How high up was it?
  2. Generation Metrics:
    • Semantic Similarity: Is the generated answer effectively the same as the Ground Truth answer? (Use an LLM to judge this).

3. Online Evaluation (The Feedback Form)

Users are the best testers. Add a "Thumbs Up / Thumbs Down" button. Log every Thumbs Down to LangSmith. Review them weekly. These are your "Hard Negatives." Add them to your Offline Dataset. This creates a Data Flywheel.

4. LLM-as-a-Judge

We can't manually read 5,000 logs. We use a strong model (GPT-4) to grade the weak model (GPT-3.5). Prompt: "You are a judge. Verify if the Student Answer matches the Ground Truth. Score 1 to 5."

5. Summary

Evaluation is not a one-time event. It is a Continuous Integration (CI) pipeline. Code has Unit Tests. AI has Evals.

Key Intuition: "If you don't measure it, you can't improve it."

Track your progressSign in and your progress follows you across devices.
Sign in to track progress Next lesson
← Previous lessonTracing with LangSmithNext lesson →Faithfulness & Relevance