Evaluating LLM Systems
Evaluating generative AI systems beyond static exact-match accuracy metrics.
Evaluating LLM Systems requires moving beyond classical ML metrics (Accuracy, F1) to handle non-deterministic, open-ended text generations. Evaluation methods form a 3-tier hierarchy: 1) Automated String & Overlap Metrics (ROUGE, BLEU, Exact Match), 2) Model-Based Evaluators (BERTScore, RAGAS, G-Eval), and 3) LLM-as-a-Judge or Human Preference Rating (Elo rating / A/B testing). A robust LLM evaluation pipeline combines continuous CI/CD automated test suites with golden dataset benchmarks.
The 3-Tier LLM Evaluation Pyramid
HUMAN / ELO EVALUATION
- Side-by-side Chatbot Arena
- High cost, highest authority
──────────────────────────────────
LLM-AS-A-JUDGE / G-EVAL
- GPT-4 evaluation rubrics
- Medium cost, high correlation
────────────────────────────────────────
AUTOMATED METRICS & RAGAS
- RAGAS, BERTScore, ROUGE, BLEU
- Instant, continuous CI/CD testing
| Metric / Framework | Type | Evaluation Scope | Pros & Cons |
|---|---|---|---|
| Exact Match (EM) / Pass@k | Code / QA | Binary correctness of code tests or exact string matches | Precise for code/math. Con: Fails on paraphrases |
| ROUGE / BLEU | Text Overlap | N-gram overlap with reference text | Fast, cheap. Con: Ignores semantics |
| BERTScore | Semantic Similarity | Embedding cosine distance between candidate & reference | Captures synonyms. Con: Misses subtle factual errors |
| RAGAS | RAG Pipeline | Faithfulness, Context Precision, Answer Relevance | Gold standard for RAG auditing |
| G-Eval (LLM-as-Judge) | Open-ended | Multi-criteria scoring via GPT-4 + Chain-of-Thought | High correlation with human judgment |
The RAG Triad Metrics (RAGAS)
User Query
│
┌────────────────┴────────────────┐
▼ ▼
Context Precision ──► Context Chunks ──► Answer Relevance
│ ▲
▼ │
Faithfulness ──► LLM Answer
- Context Precision: Are retrieved context chunks relevant to the user query?
- Faithfulness: Is the generated answer 100% grounded in retrieved context (Zero Hallucinations)?
- Answer Relevance: Does the generated answer directly address the user query?
Say this out loud
"Evaluating LLMs requires a 3-tier stack: automated string/semantic metrics (ROUGE, BERTScore) for fast CI/CD checks, RAGAS for auditing retrieval and faithfulness in RAG pipelines, and LLM-as-a-Judge (G-Eval) or LMSYS Elo ratings for open-ended response quality. We use golden dataset benchmarks to catch regressions before deployment."
Follow-ups to expect
- What is Pass@k in code generation evaluation? Evaluates whether at least one out of $k$ generated code samples passes all unit tests: $\text{Pass}@k = 1 - \frac{\binom{n-c}{k}}{\binom{n}{k}}$, where $n$ samples are generated and $c$ pass tests.
- What is the Position Bias in LLM-as-a-Judge? Judges favor whichever model's response is placed first (Model A). Mitigate by swapping response order (evaluating both A-B and B-A) and averaging scores.
Check yourself
Question 1 of 3
Why do classical overlap metrics like BLEU and ROUGE fail when evaluating open-ended LLM text generations (e.g. summarization or creative writing)?