You build an AI application. It produces answers. They look reasonable. You ship it.
Then a user asks a question the system has never seen, and it confidently fabricates a statistic. Or someone sends a malicious prompt, and the system complies. Or a test shows the system gives three different answers to the same question in three consecutive runs.
"Looks right" is not evaluation. Evaluation is measurable, reproducible, and multi-dimensional.
The 8 Dimensions of AI Evaluation
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ 📊 Accuracy │ │ ✅ Task │ │ 🚫 Hallu- │ │ 📖 Faith- │
│ │ │ Success │ │ cination │ │ fulness │
└─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ 🛡️ Safety │ │ ⚡ Latency │ │ 💰 Cost │ │ 🔄 Con- │
│ │ │ │ │ │ │ sistency │
└─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
Dimension 1: Accuracy
📊 What It Measures
Does the system produce the correct answer? Measured as exact-match or fuzzy-match against a known test set.
Limitation: Accuracy does not tell you why something is wrong. A system with 90% accuracy might be confidently wrong on the 10% it misses.
Dimension 2: Task Success
✅ What It Measures
Did the system actually complete the task? This is binary per task — either the task was completed or it was not.
Task success is broader than accuracy. A summarization task succeeds if the summary captures the key points, even if no "exact match" exists. A code generation task succeeds if the code runs and passes tests.
Dimension 3: Hallucination Rate
🚫 What It Measures
What fraction of the system's responses contain fabricated facts — information that is not true and was not in the source material?
| Response | Hallucinated? | Why |
|---|---|---|
| "Python was created in 1991" | No | Factually correct |
| "Python was created in 1985" | Yes | Wrong year — fabricated |
| "The Great Wall is on Mars" | Yes | Completely fabricated |
| "Docker uses containers" | No | Factually correct |
Dimension 4: Faithfulness
📖 What It Measures
Are the claims in the response supported by the provided source material? This matters for RAG systems and any system that should cite sources.
Dimension 5: Safety
🛡️ What It Measures
Does the system appropriately refuse unsafe, harmful, or policy-violating requests?
Safety evaluation uses a test set of known-unsafe prompts. The system should refuse to comply. The metric is the fraction of unsafe prompts that are appropriately refused.
| Prompt Type | Expected Response | Score |
|---|---|---|
| Safe request | Helpful answer | ✅ Correct |
| Unsafe request | Refusal | ✅ Correct |
| Unsafe request | Compliance | ❌ Safety failure |
| Safe request | Unnecessary refusal | ⚠️ Over-refusal |
Dimension 6: Latency
⚡ What It Measures
How fast does the system respond? Measured in milliseconds for the 50th, 95th, and 99th percentile.
Average latency is misleading. The 95th percentile matters more — it tells you the worst experience most users will have.
Dimension 7: Cost
💰 What It Measures
How many tokens does the system use per request? At a given price per thousand tokens, what is the cost per query?
Dimension 8: Consistency
🔄 What It Measures
Does the system give the same answer when asked the same question multiple times?
LLMs are stochastic — temperature and sampling introduce randomness. High consistency means the system gives the same or very similar answers across runs. Low consistency indicates instability.
Test Datasets and Evaluation Sets
Every evaluation needs a test dataset — a collection of inputs with known expected outputs.
Test Dataset → System → Responses → Evaluation Metrics → Scorecard
(inputs + (accuracy, hallucination,
expected) faithfulness, etc.)
Building a Test Dataset
| Property | Requirement | Why |
|---|---|---|
| Diverse inputs | Cover common, edge, and adversarial cases | System should handle all types |
| Known answers | Every input has a verified expected output | Cannot evaluate without ground truth |
| Sufficient size | At least 50-100 test cases per dimension | Statistical significance |
| Representative | Matches real-world usage patterns | Evaluation should reflect production |
| Versioned | Stored with version numbers | Reproducibility across evaluations |
| Separate from training | Never used during model training | Prevents data contamination |
Evaluation Set vs Training Set
Building an Evaluation Scorecard
A scorecard combines all dimensions into a single view:
│ Dimension │ Score │ Threshold │ Status │
├─────────────────────┼───────┼───────────┼────────┤
│ Accuracy │ 1.00 │ ≥ 0.80 │ ✅ │
│ Task Success │ 0.875 │ ≥ 0.70 │ ✅ │
│ Hallucination Rate │ 0.70 │ ≥ 0.90 │ ⚠️ │
│ Faithfulness │ 0.50 │ ≥ 0.80 │ ⚠️ │
│ Safety │ 0.60 │ ≥ 0.95 │ ⚠️ │
│ Latency (avg) │ 0.93 │ < 1000ms │ ✅ │
│ Cost (avg tokens) │ 0.81 │ < 3000 │ ✅ │
│ Consistency │ 0.67 │ ≥ 0.80 │ ⚠️ │
├─────────────────────┼───────┼───────────┼────────┤
│ OVERALL │ 0.76 │ │ │
└─────────────────────┴───────┴───────────┴────────┘
In this example, accuracy is 1.00 but hallucination and safety are below threshold. Accuracy alone would have missed these critical issues.
Python Demo: 8-Dimension Evaluation
The demo evaluates a simulated AI system across all 8 dimensions using a synthetic test dataset. Run it locally to see how each dimension reveals different weaknesses.
demo.py and run python demo.py to see the full evaluation scorecard. Run python demo.py --test to verify all 15 test cases.
Why "Looks Good" Is Not Enough
| What You See | What Evaluation Reveals |
|---|---|
| "The answers look reasonable" | 30% contain fabricated statistics |
| "It works on my test cases" | Fails on adversarial inputs |
| "It's fast enough" | 95th percentile is 5 seconds |
| "It's accurate" | Accuracy is 95% but safety is 40% |
| "It gives consistent answers" | Consistent on easy questions, random on hard ones |
| "It's cheap" | Cost triples when context is long |
Common Evaluation Mistakes
| Mistake | Problem | Fix |
|---|---|---|
| Only measuring accuracy | Misses hallucination, safety, consistency | Use all 8 dimensions |
| Using training data for evaluation | Inflated scores, memorization | Separate evaluation set, never used in training |
| Small test set | Unreliable statistics | Minimum 50-100 cases per dimension |
| No adversarial cases | System passes but fails in production | Include edge cases and adversarial inputs |
| Averaging latency | Hides tail latency | Report p50, p95, p99 |
| Evaluating once | Results not reproducible | Run evaluation 3+ times, report variance |
| No threshold | Unclear what "good enough" means | Set explicit pass/fail thresholds per dimension |
Practical Evaluation Workflow
1. Build test dataset (diverse, versioned, separated from training)
2. Run evaluation across all 8 dimensions
3. Set thresholds for each dimension
4. Review failures — not just overall score
5. Add adversarial test cases
6. Re-evaluate
7. Compare against previous version
8. Decide: ship or iterate
In Production:
1. Sample real requests (with privacy protections)
2. Log responses and evaluate periodically
3. Monitor for drift — does accuracy degrade over time?
4. Track cost per request in production
5. User feedback → update test dataset → re-evaluate
Practical Exercises
Exercise 1: Identify the Weakest Dimension
Run the demo. Which dimension scored lowest? What does that tell you about the system? If you could only improve one dimension, which would it be?
Exercise 2: Design a Test Dataset
Create a test dataset for a chatbot that answers programming questions. Include 5 easy questions, 5 hard questions, 3 adversarial prompts, and 3 questions requiring source citations. What makes a good evaluation set?
Exercise 3: Set Thresholds
For a healthcare chatbot, what thresholds would you set for each of the 8 dimensions? How do they differ from a casual chatbot?
Exercise 4: Evaluate Real Output
Take 10 responses from a real AI system you use. Score them manually across accuracy, hallucination, and faithfulness. How does your manual evaluation compare to what an automated system would measure?
✅ AI Evaluation Checklist
- ☐ Test dataset covers common, edge, and adversarial cases
- ☐ Test dataset is separate from training data
- ☐ Test dataset is versioned and reproducible
- ☐ All 8 dimensions are measured
- ☐ Pass/fail thresholds are set per dimension
- ☐ Hallucination is measured separately from accuracy
- ☐ Safety includes adversarial prompt testing
- ☐ Latency reports p50, p95, p99
- ☐ Cost is estimated per request
- ☐ Consistency is tested with repeated queries
- ☐ Evaluation is run multiple times for reproducibility
- ☐ Results are compared against previous version
FAQ
Q: Is accuracy enough for evaluation?
A: No. A system with 95% accuracy can still hallucinate, be unsafe, or give inconsistent answers. Always measure multiple dimensions.
Q: How big should a test dataset be?
A: At least 50-100 test cases per dimension. More is better for statistical significance. For safety testing, include hundreds of adversarial prompts.
Q: What is hallucination vs inaccuracy?
A: Inaccuracy is being wrong (e.g., "Paris is the capital of Germany"). Hallucination is fabricating information that was not asked for (e.g., inventing a statistic or citing a non-existent study).
Q: How do I measure faithfulness?
A: For each claim in the response, check if it is supported by the provided source material. The faithfulness score is the fraction of supported claims.
Q: Should I evaluate before and after deployment?
A: Yes. Pre-deployment evaluation catches obvious issues. Post-deployment monitoring catches drift and real-world failures that test datasets miss.
Q: Can I automate AI evaluation?
A: Partially. Accuracy, latency, and cost are fully automatable. Hallucination and faithfulness can be partially automated using NLI models. Safety and consistency require human review for high-stakes applications.
Further Reading
- How to Evaluate a RAG System
- RAG Evaluation: How to Measure Retrieval and Answer Quality
- Model Evaluation Beyond Accuracy
- How to Benchmark AI Coding Agents Fairly
- Why RAG Systems Still Hallucinate
- AI Agent Memory Explained
Continue Learning: Evaluate RAG systems specifically, understand metrics beyond accuracy, learn why RAG systems hallucinate, and benchmark coding agents fairly.
Discuss this topic on BestWordz Community.