> ## Documentation Index
> Fetch the complete documentation index at: https://docs.galileo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Chunk Relevance

> Understand how to measure and optimize the relevance of retrieved chunks to user queries in your RAG pipeline

export const DefinitionCard = ({children}) => {
  return <Card variant="secondary">
    <div style={{
    padding: '0.5rem',
    border: '5px solid var(--primary-light)',
    borderRadius: '0.5rem',
    fontSize: '1.3rem',
    lineHeight: '1.4',
    boxShadow: '0 0 10px 10px var(--primary-light)'
  }}>
        {children}
      </div>

</Card>;
};

export const Pill = ({label, color, backgroundColor}) => <span style={{
  display: "inline-block",
  backgroundColor: backgroundColor ?? "#C0C0C0",
  color: color ?? "#333",
  padding: "2px 8px",
  borderRadius: "12px",
  fontSize: "12px",
  fontWeight: "500",
  lineHeight: "1"
}}>
    {label}
  </span>;

<DefinitionCard>
  <strong>Chunk Relevance</strong> measures whether a given chunk of text contains information that could help answer the user's query in a RAG pipeline.
</DefinitionCard>

Chunk Relevance is a binary metric: each chunk is either <Pill label="Relevant" /> or <Pill label="Not Relevant" />.

A chunk is considered <Pill label="Relevant" /> when:

* The chunk contains at least some information that is useful to answer the query (even partially)
* The chunk provides a key piece of information (such as the name of an entity or a specific fact) that can be used to find the answer in another chunk
* Any part of the chunk helps answer the query either partially or completely

A chunk is considered <Pill label="Not Relevant" /> when:

* The chunk contains no useful information for answering the query
* The chunk is completely off-topic or only contains background/tangential information with no bearing on the query
* The content is topically related but doesn't answer the question even partially

<Note>
  We do not require the chunk to fully answer the query—even partial relevance is sufficient. We do not penalize for incompleteness; as long as something in the chunk is relevant, we label it as Relevant.
</Note>

## Calculation method

Chunk Relevance is computed through a multi-step process:

<Steps>
  <Step title="Model Request">
    Additional evaluation requests are sent to an LLM to analyze each chunk's relevance to the user query.
  </Step>

  <Step title="Independent Evaluation">
    Each chunk is evaluated independently against the query to determine its relevance, without using outside knowledge or making assumptions.
  </Step>

  <Step title="Binary Classification">
    Each chunk receives a binary classification: Relevant (true) if it provides any useful information, or Not Relevant (false) if it contains no useful information for the query.
  </Step>

  <Step title="Result Generation">
    The evaluation produces both a classification for each chunk and an overall explanation of the reasoning.
  </Step>
</Steps>

<Note>
  This metric is computed by prompting an LLM, and thus requires additional LLM calls to compute, which may impact usage and billing.
</Note>

## Understanding chunk relevance

<Card>
  <div style={{display: 'flex', alignItems: 'center', gap: '0.5rem', marginBottom: '0.75rem'}}>
    <div style={{fontSize: '1.25rem', color: 'var(--primary-color)'}}>
      <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
        <path d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10z" />

        <path d="m9 12 2 2 4-4" />
      </svg>
    </div>

    <h3 style={{margin: 0, fontSize: '1.25rem', fontWeight: '600'}}>Example Scenario</h3>
  </div>

  This example illustrates chunk relevance:

  <div style={{ marginTop: "1rem", paddingTop: "0.75rem", borderTop: "1px solid rgba(209, 213, 219, 0.33)" }}>
    <strong>User query:</strong> "What is the population of the capital city of France?"
  </div>

  <div style={{ marginTop: "0.75rem", paddingTop: "0.75rem", borderTop: "1px solid rgba(209, 213, 219, 0.33)" }}>
    <strong>Retrieved chunks:</strong>

    <ul style={{ marginTop: "0.5rem" }}>
      <li>Chunk 1: "The capital city of France is Paris."</li>
      <li>Chunk 2: "Paris has a population of approximately 2.1 million people."</li>
      <li>Chunk 3: "France is a country located in Western Europe."</li>
    </ul>
  </div>

  <div style={{ marginTop: "1rem", paddingTop: "0.75rem", borderTop: "1px solid rgba(209, 213, 219, 0.33)" }}>
    <strong>Relevance analysis:</strong> Chunks 1 and 2 are <Pill label="Relevant" /> because they provide information directly related to answering the query. Chunk 1 provides crucial context (the capital is Paris) that enables the answer to be found, and Chunk 2 provides the actual answer. Chunk 3 is <Pill label="Not Relevant" /> because it only provides general background information about France's location, which doesn't help answer the population question.
  </div>
</Card>

Chunk Relevance forms the foundation for other retrieval metrics, including [Context Precision](/concepts/metrics/rag/retrieval-quality/context-precision) and [Precision @ K](/concepts/metrics/rag/retrieval-quality/precision-at-k).

### Chunk Relevance vs. Context Relevance

* **Chunk Relevance** answers: "Is this specific chunk useful for this query?" Use it when you want to debug retrieval at the **chunk level** — pruning noisy chunks, tuning your chunking strategy, or checking which documents are actually helpful.
* **Context Relevance** ([Context Relevance](/concepts/metrics/rag/retrieval-quality/context-relevance)) answers: "Taken together, does my retrieved context contain enough information to answer the query?" Use it when you want a **single signal for the whole retrieved context** — deciding whether to increase Top K, change your retriever, or trigger a fallback flow.

In practice, start with **Context Relevance** to see if retrieval is working at all, then drill down with **Chunk Relevance** to understand which specific chunks are helping or hurting.

## Optimizing your RAG pipeline

<Card>
  <div style={{display: 'flex', alignItems: 'center', gap: '0.5rem', marginBottom: '0.75rem'}}>
    <div style={{fontSize: '1.25rem', color: 'var(--primary-color)'}}>
      <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
        <path d="M12 20h9" />

        <path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" />
      </svg>
    </div>

    <h3 style={{margin: 0, fontSize: '1.25rem', fontWeight: '600'}}>Addressing Low Relevance Scores</h3>
  </div>

  When many chunks are marked as <Pill label="Not Relevant" />, it indicates issues with the retrieval system. To improve the system:

  <div style={{ marginTop: "1rem", paddingTop: "0.75rem", borderTop: "1px solid rgba(209, 213, 219, 0.33)" }}>
    <strong>Improve retrieval quality:</strong> Refine embedding models, similarity search algorithms, or retrieval parameters to better match queries with relevant content.
  </div>

  <div style={{ marginTop: "0.75rem", paddingTop: "0.75rem", borderTop: "1px solid rgba(209, 213, 219, 0.33)" }}>
    <strong>Optimize chunking strategy:</strong> Ensure chunks are semantically coherent and contain complete information units rather than arbitrary text splits.
  </div>

  <div style={{ marginTop: "0.75rem", paddingTop: "0.75rem", borderTop: "1px solid rgba(209, 213, 219, 0.33)" }}>
    <strong>Adjust retrieval parameters:</strong> Experiment with different Top K values, similarity thresholds, or reranking strategies to improve relevance.
  </div>

  <div style={{ marginTop: "0.75rem", paddingTop: "0.75rem", borderTop: "1px solid rgba(209, 213, 219, 0.33)" }}>
    <strong>Analyze patterns:</strong> Identify common characteristics of non-relevant chunks to understand why the retrieval system is selecting them.
  </div>
</Card>

## Best practices

<CardGroup cols={2}>
  <Card title="Combine with Other Metrics" icon="link">
    Chunk Relevance works alongside [Context Precision](/concepts/metrics/rag/retrieval-quality/context-precision) and [Precision @ K](/concepts/metrics/rag/retrieval-quality/precision-at-k) for a comprehensive view of retrieval effectiveness.
  </Card>

  <Card title="Optimize Retrieval Strategy" icon="sliders">
    Relevance scores help refine embedding models, similarity search algorithms, and retrieval parameters.
  </Card>

  <Card title="Monitor Across Queries" icon="chart-line">
    Tracking relevance rates across different query types helps identify patterns and improve retrieval system performance.
  </Card>
</CardGroup>

<Note>
  Chunk Relevance is designed to be lenient—we mark chunks as relevant if they provide any useful information, even if incomplete. This ensures that chunks with partial answers or bridging information are not incorrectly marked as irrelevant.
</Note>
