TechByteByByte

Relevance

Whether an answer actually addresses what was asked — a genuinely separate question from whether it's true, since a perfectly accurate, perfectly faithful answer to the wrong question is still a failure.

#relevance#answer-relevance#semantic-search#llm-rag-evaluation-phase

The Toxicity article covered whether output is safe. This article returns to quality, covering a question so basic it’s easy to overlook: does the response actually answer the question asked at all? That’s relevance.

The simple definition

Relevance measures whether a generated response actually addresses the specific question or request it was given, rather than drifting off-topic, answering a related but different question, or burying the actual answer in irrelevant padding. Recall from the Semantic Search article, back in the Data Representation phase, that relevance is fundamentally about how well two things — there, a query and a document; here, a question and its answer — actually correspond to each other in meaning.

Why this is a genuinely separate failure mode from everything covered earlier in this phase

Recall from the Faithfulness and Answer Correctness articles’ shared focus on factual accuracy. A response can be perfectly faithful to its retrieved sources, perfectly correct against ground truth, and still fail this specific test — imagine asking “what’s your return policy for electronics” and receiving a technically accurate, faithful summary of the company’s general return policy that never actually addresses the electronics-specific question asked. Every fact stated might be true; the response still fails, because it didn’t actually answer what was asked.

flowchart LR
    A["Question: 'what's your return policy for electronics?'"] --> B[Response: accurate general return policy summary]
    B --> C{Does it actually address the electronics-specific question?}
    C -->|No| D[Low relevance, despite being factually accurate]

How this actually gets measured, technically

This is worth being concrete about, since it’s a real, specific technique used throughout the RAGAS framework covered across this phase. A common approach generates several plausible questions the given answer could be responding to, then measures how semantically similar those generated questions are to the original, actual question — using the same embedding and cosine similarity techniques covered throughout the Data Representation phase. If an answer genuinely addresses the original question, the questions it could plausibly be answering should closely match the one actually asked; if it drifted off-topic, they won’t.

ANALOGY vs. TECHNICAL REALITY

Analogy: Think of asking a colleague a specific, direct question in a meeting and receiving a technically accurate, well-informed answer to a completely different, adjacent question — everything they said might be true and useful in general, but you leave the meeting without your actual question answered, and have to ask again.

Where this breaks down: A human colleague’s off-topic answer might stem from genuine misunderstanding or deliberate evasion. A language model’s relevance failures, as covered throughout the Next-Token Prediction article’s core mechanism, are a statistical consequence of what patterns the model learned to associate with similar-sounding prompts — no misunderstanding or evasion involved, simply a generated sequence that drifted from the actual question’s specific intent.

A concrete example, layered

For a simple beginner example: asked “how do I reset my password,” a response explaining the company’s general account security features, without ever actually walking through the password reset steps, would score poorly on relevance despite being genuinely accurate information about a related topic.

For a production example: customer-support RAG systems, referenced throughout the RAG & Retrieval phase, commonly track relevance as a distinct, monitored metric specifically because a system can retrieve genuinely accurate content and still generate a response that technically discusses the topic without actually resolving the user’s specific request — a real, common, and otherwise easy-to-miss failure mode.

Why relevance and faithfulness can fail in genuinely opposite directions

It’s worth being direct about this real, useful diagnostic distinction. A response can be highly relevant but unfaithful — directly, on-topic addressing the question, but adding unsupported, hallucinated detail beyond what the retrieved source actually said. Or it can be highly faithful but irrelevant — a scrupulously accurate summary of retrieved content that simply doesn’t address the actual question asked. Tracking both metrics together, rather than relying on either alone, lets a team correctly diagnose which of these genuinely different problems is actually happening.

Common misconception

Multi-part questions need coverage

Question: “What does the Pro plan cost, and can I cancel anytime?”

Answer: “The Pro plan costs $20 per month.”

The answer is relevant to the first part but ignores the second. A single overall label can hide that omission.

part 1: price              -> answered
part 2: cancellation rule  -> missing
coverage = 1 / 2 required parts

First break the request into required parts. Then judge whether each part is addressed directly and without distracting material.

Relevant does not mean complete or correct

  • Relevant but incomplete: answers only the price.
  • Relevant but incorrect: gives the wrong price.
  • Correct but irrelevant: accurately describes another plan.
  • Relevant, complete, and correct: answers both requested parts using verified facts.

A current Gemini, GPT, or Claude application can use a pointwise rubric for each part or compare two responses pairwise. Human review should check whether the rubric matches what real users consider direct and complete.

Score the answer against the actual request

Question: “What time does the library close today?”

  • Answer A: “The library closes at 6 p.m. today.” — highly relevant.
  • Answer B: “The library was founded in 1924 and has three floors.” — possibly true, but irrelevant.
  • Answer C: “It closes at 6 p.m. today. Here is a ten-paragraph history.” — answers the question, but includes distracting material.

A simple rubric might be:

ScoreMeaning
0Does not address the question
1Addresses part of it or includes major distraction
2Directly and completely addresses it

Relevance can apply at several levels

  • Answer relevance: does the generated answer address the question?
  • Context relevance: are retrieved chunks useful for answering it?
  • Tool relevance: did an agent call a tool that helps with the task?

Do not combine them into one score when diagnosing a system. An irrelevant retrieved chunk is a retriever problem; an on-topic context followed by an off-topic response is a generator problem.

Current evaluation example

Ragas includes answer-relevancy metrics for RAG systems. Google Vertex AI allows custom pointwise rubrics and pairwise comparisons, so a team can compare whether Gemini 2.5 Pro or Gemini 2.5 Flash responses are more direct for its own dataset.

Verified sources

A frequent beginner assumption: that a response containing accurate, well-supported information is automatically a good response, regardless of whether it directly addresses the specific question asked. As this article’s electronics-return-policy example demonstrated, accuracy and relevance are genuinely independent dimensions — a response can be entirely true and still be a failure, if it never actually answers what the user specifically wanted to know.

Where this fits in what comes next

You now understand measuring whether a response actually addresses its question. The next two articles, Context Precision and Context Recall, apply this same underlying idea of relevance one step earlier in the pipeline — measuring not the final answer’s relevance, but the quality of the retrieved context that answer was actually built from.

In one sentence

Relevance measures whether a response actually addresses the specific question it was given, calculated in real evaluation frameworks like RAGAS by comparing the original question against questions the answer could plausibly be responding to, and it remains a genuinely separate failure mode from faithfulness and correctness — a response can be entirely accurate and still fail simply by not answering what was actually asked.

Author
TechByteByByte Editorial Team
Reviewed by
TechByteByByte Admin
Published
Last reviewed