> ## 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 Attribution Utilization

> Understand how to measure and optimize the impact of retrieved chunks in your RAG pipeline

export const Scale = ({low, mid, high, lowLabel = "Low", midLabel = "Mid", highLabel = "High", lowDescription, midDescription, highDescription, midColor = "yellow", inverted = false}) => {
  const lowColor = inverted ? "green" : "red";
  const highColor = inverted ? "red" : "green";
  const gradientId = inverted ? "greenToRed" : "redToGreen";
  return <div style={{
    display: 'flex',
    flexDirection: 'column',
    width: '100%'
  }}>
      <svg width="100%" height="30" style={{
    marginBottom: '8px'
  }}>
        <defs>
          <linearGradient id={gradientId} x1="0%" y1="0%" x2="100%" y2="0%">
            <stop offset="0%" stopColor={lowColor} />
            <stop offset="100%" stopColor={highColor} />
          </linearGradient>
        </defs>
        <rect width="100%" height="100%" fill={`url(#${gradientId})`} rx="4" ry="4" />
      </svg>

      <div style={{
    display: 'flex',
    justifyContent: 'space-between',
    width: '100%',
    marginBottom: '16px'
  }}>
        <p style={{
    margin: 0,
    fontSize: '12px'
  }}>{low}</p>
        {mid && <p style={{
    margin: 0,
    fontSize: '12px'
  }}>{mid}</p>}
        <p style={{
    margin: 0,
    fontSize: '12px'
  }}>{high}</p>
      </div>

      <div style={{
    display: 'flex',
    justifyContent: 'space-between',
    width: '100%'
  }}>
        <div style={{
    maxWidth: '40%'
  }}>
          <div style={{
    display: 'flex',
    alignItems: 'center',
    marginBottom: '4px'
  }}>
            <div style={{
    width: '12px',
    height: '12px',
    backgroundColor: lowColor,
    borderRadius: '50%',
    marginRight: '8px'
  }}></div>
            <p style={{
    margin: 0,
    fontWeight: 'bold',
    fontSize: '14px'
  }}>{lowLabel}</p>
          </div>
          {lowDescription && <p style={{
    margin: 0,
    fontSize: '14px',
    color: '#666',
    maxWidth: '250px',
    lineHeight: '1.4'
  }}>{lowDescription}</p>}
        </div>
        {mid && <div style={{
    maxWidth: '40%',
    textAlign: 'center'
  }}>
            <div style={{
    display: 'flex',
    alignItems: 'center',
    justifyContent: 'center',
    marginBottom: '4px'
  }}>
              <div style={{
    width: '12px',
    height: '12px',
    backgroundColor: midColor,
    borderRadius: '50%',
    marginRight: '8px'
  }}></div>
              <p style={{
    margin: 0,
    fontWeight: 'bold',
    fontSize: '14px'
  }}>{midLabel}</p>
            </div>
            {midDescription && <p style={{
    margin: 0,
    fontSize: '14px',
    color: '#666',
    maxWidth: '250px',
    textAlign: 'center',
    lineHeight: '1.4'
  }}>{midDescription}</p>}
          </div>}


        <div style={{
    maxWidth: '40%',
    textAlign: 'right'
  }}>
          <div style={{
    display: 'flex',
    alignItems: 'center',
    justifyContent: 'flex-end',
    marginBottom: '4px'
  }}>
            <p style={{
    margin: 0,
    fontWeight: 'bold',
    fontSize: '14px'
  }}>{highLabel}</p>
            <div style={{
    width: '12px',
    height: '12px',
    backgroundColor: highColor,
    borderRadius: '50%',
    marginLeft: '8px'
  }}></div>
          </div>
          {highDescription && <p style={{
    margin: 0,
    fontSize: '14px',
    color: '#666',
    maxWidth: '250px',
    marginLeft: 'auto',
    lineHeight: '1.4'
  }}>{highDescription}</p>}
        </div>
      </div>
    </div>;
};

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>;

Chunk Attribution Utilization is a dual metric that calculates two values - [chunk attribution](#chunk-attribution) and [chunk utilization](#chunk-utilization).

## Chunk attribution

<DefinitionCard>
  <strong>Chunk attribution</strong> measures whether or not each chunk retrieved in a RAG pipeline had an effect on the model's response.
</DefinitionCard>

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

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

* The model incorporated information from the chunk into its response
* The chunk influenced the model's reasoning or conclusions
* The chunk provided context that shaped the response in some way

Chunks that are retrieved but have no discernible impact on the model's output are marked as <Pill label="Not Attributed" />.

### Understanding attribution

<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>

  Consider this simple example that illustrates chunk attribution:

  <div style={{ marginTop: "1rem", paddingTop: "0.75rem", borderTop: "1px solid rgba(209, 213, 219, 0.33)" }}>
    <strong>User query:</strong> "What are the health benefits of green tea?"
  </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: "Green tea contains antioxidants that may reduce the risk of heart disease."</li>
      <li>Chunk 2: "Black tea is produced by oxidizing tea leaves after they are harvested."</li>
      <li>Chunk 3: "Studies suggest green tea may help with weight loss and metabolism."</li>
    </ul>
  </div>

  <div style={{ marginTop: "0.75rem", paddingTop: "0.75rem", borderTop: "1px solid rgba(209, 213, 219, 0.33)" }}>
    <strong>Model response:</strong> "Green tea offers several health benefits, including antioxidants that may reduce heart disease risk and potential effects on weight loss and metabolism."
  </div>

  <div style={{ marginTop: "1rem", paddingTop: "0.75rem", borderTop: "1px solid rgba(209, 213, 219, 0.33)" }}>
    <strong>Attribution analysis:</strong> Chunks 1 and 3 would be <Pill label="Attributed" /> because information from them appears in the response. Chunk 2 would be <Pill label="Not Attributed" /> because it contains information about black
    tea, which wasn't included in the response.
  </div>
</Card>

### Optimizing your RAG pipeline for chunk attribution

<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'}}>Recommended Strategies</h3>
  </div>

  When analyzing Chunk Attribution in your RAG system, consider these key optimization strategies:

  <div style={{ marginTop: "1rem", paddingTop: "0.75rem", borderTop: "1px solid rgba(209, 213, 219, 0.33)" }}>
    <strong>Tune retrieved chunk count:</strong> If many chunks are <Pill label="Not Attributed" />, reduce the number of chunks retrieved to improve efficiency without impacting quality.
  </div>

  <div style={{ marginTop: "0.75rem", paddingTop: "0.75rem", borderTop: "1px solid rgba(209, 213, 219, 0.33)" }}>
    <strong>Debug problematic responses:</strong> When responses are unsatisfactory, examine which chunks were attributed to identify the source of issues.
  </div>

  <div style={{ marginTop: "0.75rem", paddingTop: "0.75rem", borderTop: "1px solid rgba(209, 213, 219, 0.33)" }}>
    <strong>Improve retrieval quality:</strong> Use attribution data to refine your retrieval algorithms and embedding models.
  </div>
</Card>

## Chunk utilization

<DefinitionCard>
  <strong>Chunk Utilization</strong> measures the fraction of text in each retrieved chunk that had an impact on the model's response in a RAG pipeline.
</DefinitionCard>

Chunk Utilization is a continuous metric ranging from 0 to 1:

<Scale low="0" lowLabel="Low Utilization" mid="0.5" midLabel="Mid Utilization" high="1" highLabel="High Utilization" lowDescription="None of the chunk's content was utilized" midDescription="Only half of the chunk's content influenced the response" highDescription="The entire chunk's content influenced the response" />

A chunk with low utilization contains "extraneous" text that did not affect the final response, indicating potential inefficiencies in your chunking strategy.

<Note type="info">
  Chunk Utilization is closely related to [Chunk Attribution](/concepts/metrics/rag/generation-quality/chunk-attribution): Attribution measures whether or not a chunk affected the response, while Utilization measures how much of the chunk text
  was involved in the effect. Only chunks that were Attributed can have Utilization scores greater than zero.
</Note>

### Calculation method

<Steps>
  <Step title="Model Architecture">
    We use a fine-tuned in-house Galileo evaluation model based on a transformer encoder architecture.
  </Step>

  <Step title="Multi-metric Computation">
    The same model computes Chunk Adherence, Chunk Completeness, Chunk Attribution and Utilization in a single inference call.
  </Step>

  <Step title="Token-level Analysis">
    For each token in the provided context, the model outputs a utilization probability indicating if that token affected the response.
  </Step>

  <Step title="Score Calculation">
    Chunk Utilization is computed as the fraction of tokens with high utilization probability out of all tokens in the chunk.
  </Step>

  <Step title="Model Training">
    The model is trained on carefully curated RAG datasets and optimized to closely align with the RAG Plus metrics.
  </Step>
</Steps>

### Optimizing your RAG pipeline for chunk utilization

<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 Utilization Scores</h3>
  </div>

  Low Chunk Utilization scores could indicate one of two scenarios:

  <div style={{ marginTop: "1rem", paddingTop: "0.75rem", borderTop: "1px solid rgba(209, 213, 219, 0.33)" }}>
    <strong>Oversized Chunks:</strong> Your chunks are longer than they need to be

    <ul style={{ marginTop: "0.5rem" }}>
      <li>Check if [chunk relevance](/concepts/metrics/rag/retrieval-quality/chunk-relevance) is also low, which confirms this scenario</li>
      <li>Solution: Tune your retriever to return shorter, more focused chunks</li>
      <li>Benefits: Improved system efficiency, lower cost, and reduced latency</li>
    </ul>
  </div>

  <div style={{ marginTop: "0.75rem", paddingTop: "0.75rem", borderTop: "1px solid rgba(209, 213, 219, 0.33)" }}>
    <strong>Ineffective LLM Utilization:</strong> The LLM generator model is failing to incorporate all relevant information

    <ul style={{ marginTop: "0.5rem" }}>
      <li>Check if Chunk Relevance is high, which confirms this scenario</li>
      <li>Solution: Explore a different LLM that may leverage the relevant information more effectively</li>
      <li>Benefits: Better response quality and more efficient use of retrieved information</li>
    </ul>
  </div>
</Card>

### Best practices

<CardGroup cols={2}>
  <Card title="Monitor Attribution Rates" icon="chart-line">
    Track the percentage of chunks that are attributed over time to identify trends and potential issues in your retrieval system.
  </Card>

  <Card title="Balance with Other Metrics" icon="scale-balanced">
    Use Chunk Attribution Utilization alongside [Chunk Relevance](/concepts/metrics/rag/retrieval-quality/chunk-relevance) for a complete picture of retrieval effectiveness.
  </Card>

  <Card title="Optimize Chunk Size" icon="crop">
    Experiment with different chunk sizes to find the optimal balance between attribution rates and information density.
  </Card>

  <Card title="Improve Retrieval Quality" icon="filter">
    Use attribution data to refine your retrieval algorithms and embedding models.
  </Card>

  <Card title="Monitor Across Models" icon="chart-mixed">
    Compare Chunk Utilization scores across different LLMs to identify which models most efficiently use retrieved information.
  </Card>

  <Card title="Analyze Patterns" icon="magnifying-glass-chart">
    Look for patterns in low-utilization chunks to identify specific content types or formats that your system processes inefficiently.
  </Card>
</CardGroup>

<Note>
  When optimizing for Chunk Attribution Utilization, be careful not to reduce the number of chunks too aggressively, as this may limit the model's access to potentially useful information in edge cases.
</Note>
