AI Quality Metrics
This lesson explains groundedness, relevance, coherence, fluency and other quality metrics, how scores and thresholds work, and how results are interpreted.
Learning outcomes
After completing this lesson, you will be able to:
- Distinguish groundedness from relevance.
- Explain what coherence and fluency measure.
- Describe scores, reasons and thresholds.
- Explain how to interpret evaluation results.
Groundedness and relevance
Groundedness measures whether the claims in a response are supported by the supplied context. A response can be factually true and still ungrounded if the sources do not support it, which is exactly what matters in a RAG application, where answers must come from the company's documents. It needs the response and context, and optionally the query. Groundedness pro (preview) is a service-based variant that returns a binary result without a judge deployment.
Relevance measures how well the response addresses the query: whether it answers what was asked, completely and without drifting. An answer can be perfectly grounded and irrelevant, for example a correct quotation from the policy that does not answer the customer's question. Relevance needs the query and response.
Coherence and fluency
Coherence measures logical flow: whether the response's ideas connect, follow a sensible order and do not contradict each other. Fluency measures language quality: grammar, word choice and readability. Both need the response, and coherence also uses the query.
Coherence and fluency judge how a response reads, not whether it is correct. Modern models usually score highly on both, so they are most useful for detecting regressions, such as a prompt change that produces fragmented or truncated answers, and for applications that generate long-form text.
Other quality metrics
Several further evaluators complete the picture for RAG systems, reference-based checks and agents.
| Evaluator | Measures | Needs |
|---|---|---|
| Retrieval | How relevant the retrieved context is to the query (AI-assisted) | Query and context |
| Document retrieval | Ranking quality of retrieved documents, such as NDCG, against labelled relevance | Retrieved documents and relevance labels |
| Response completeness (preview) | Whether the response covers everything in the ground truth | Response and ground truth |
| Similarity | Semantic similarity to the ground truth (AI-assisted) | Query, response and ground truth |
| F1, BLEU, GLEU, ROUGE, METEOR | Word and n-gram overlap with the ground truth | Response and ground truth |
| Intent resolution | Whether an agent identified and addressed the user's intent | Query and response |
| Task adherence | Whether an agent followed its instructions and task | Query, response and tool definitions |
| Tool call accuracy | Whether an agent called the right tools with the right arguments | Query, tool calls and tool definitions |
Scores, reasons and thresholds
AI-assisted quality evaluators return a score, typically on a 1 to 5 scale where higher is better, a reason written by the judge explaining the score, and a result of pass or fail against a threshold, which defaults to 3 and can be set when the evaluator is created. NLP evaluators return a score from 0 to 1 with their own thresholds.
groundedness = GroundednessEvaluator(judge, threshold=4)
row = groundedness(query="Is a burst pipe covered?",
response="Yes, sudden escape of water is covered, minus the excess [doc-12].",
context="[doc-12] Sudden and accidental escape of water from pipes is covered...")
print(row["groundedness"], row["groundedness_result"], row["groundedness_reason"])Aggregate results report averages and pass rates. Pass rates are often more useful for release decisions, because an average of 4.2 can hide 15 percent of responses scoring 1 or 2. The reasons, read for the failing rows, show what to fix.
Interpreting results
Judge models are themselves imperfect, so evaluation results are evidence to interpret rather than truth. Good practice keeps the judge consistent and checks it.
- Use the same judge deployment and version for results that will be compared; a new judge can shift scores.
- Use a capable judge model; small models make poorer judges.
- Spot-check failing and passing rows by hand, especially after changes to evaluators or mappings.
- Look at distributions and failures, not just averages.
- Combine metrics: a drop in groundedness with stable relevance points to the prompt or retrieval, not the question set.
Matching the metric to the complaint
Users of an HR policy assistant complain about two things: some answers quote policy text accurately but do not actually answer their question, and some answers state leave entitlements that appear in no policy document. The team wants one metric for each problem.
The first complaint is about relevance: accurate quotations that do not address the query score low on relevance even though they are grounded. The second is about groundedness: entitlements not found in the sources are unsupported claims, which groundedness detects when it receives the retrieved context.
Coherence and fluency would rate both kinds of answer as well written. Similarity to ground truth would penalize both, but without distinguishing the two problems, and it needs reference answers for every question. Retrieval would show whether the right passages were found, which is useful but does not measure either complaint directly.
An answer is accurate and supported by the retrieved context, but does not address what the user asked. Which metric reveals this?
Show answer
Relevance, which judges whether the response addresses the query. Groundedness would score it highly, because it measures only support by the context.
Exam Tips
Remember for the exam
- Groundedness: is the answer supported by the context? Relevance: does it address the query?
- Coherence and fluency judge how the answer reads, not correctness.
- AI-assisted scores are usually 1 to 5 with a reason and pass or fail against a threshold (default 3).
- Report pass rates, keep the judge consistent and spot-check results.