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

# Completeness

> LLM outputs can often fixate on subsets of complex prompts and can occasionally deviate from the user's intended topic. The Completeness metric evaluates whether a response completely answers a prompt without going off track.

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 Scale = ({low, mid, high, lowLabel = "Low", midLabel = "Mid", highLabel = "High", lowDescription, midDescription, highDescription, midColor = "yellow"}) => {
  return <div style={{
    display: 'flex',
    flexDirection: 'column',
    width: '100%'
  }}>
      <svg width="100%" height="30" style={{
    marginBottom: '8px'
  }}>
        <defs>
          <linearGradient id="redToGreen" x1="0%" y1="0%" x2="100%" y2="0%">
            <stop offset="0%" stopColor="red" />
            <stop offset="100%" stopColor="green" />
          </linearGradient>
        </defs>
        <rect width="100%" height="100%" fill="url(#redToGreen)" 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: 'red',
    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: 'green',
    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>;
};

<DefinitionCard>
  <strong>Completeness</strong> measures the degree to which an AI-generated response fully addresses every necessary aspect of the user's query, with sufficient detail. Off topic deviations and incoherence result in deductions.
</DefinitionCard>

Completeness is returned as a continuous score ranging from 0 to 1:

<Scale low="0" lowLabel="Low Completeness" high="1" highLabel="High Completeness" lowDescription="The response misses key parts of the query or goes off topic" highDescription="The response addresses all aspects of the query thoroughly" />

***

## Understanding Completeness

The Completeness metric evaluates each model response along five key dimensions:

* **Coverage:** Does the response address all parts of the user's query?
* **Detail and Depth:** Does it consistently provide sufficient elaboration?
* **Factual Correctness:** Is the information given sufficiently accurate?
* **Relevance:** Is the content strictly pertinent to the query?
* **Logical Coherence:** Is the response clearly organized and well structured?

A separate pass/fail assessment for each dimension is conducted before the evaluation model decides a final grade for Completeness.

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

  Completeness detects when a response may be technically correct but fails to satisfy the full intent of the user's query.

  <div style={{ marginTop: "1rem", paddingTop: "0.75rem", borderTop: "1px solid rgba(209, 213, 219, 0.33)" }}>
    <strong>User query:</strong> "Describe how a bill becomes a law in the U.S., and give an example of a recent bill."
  </div>

  <div style={{ marginTop: "0.75rem", paddingTop: "0.75rem", borderTop: "1px solid rgba(209, 213, 219, 0.33)" }}>
    <strong>Model response:</strong> "A bill becomes a law after being approved by Congress and signed by the President."
  </div>

  <div style={{ marginTop: "0.75rem", paddingTop: "0.75rem", borderTop: "1px solid rgba(209, 213, 219, 0.33)" }}>
    <strong>Analysis:</strong> The content given in the response is factually correct and coherent, but it fails to mention an example and lacks procedural detail. It would score poorly on the Coverage and Detail dimensions, leading to a low overall Completeness score.
  </div>
</Card>

## Details of the Five Dimensions

<Accordion title="Coverage">
  This aspect is the most important, since missing a sub-request is the most common error models make in terms of completeness. The evaluation model enumerates each request in the user prompt and verifies if each one was met by the model response.
</Accordion>

<Accordion title="Detail and Depth">
  LLMs sometimes use "fluffy" sentences with little substance, and those responses cannot be considered completely satisfactory. Each sentence in the response is analyzed and the evaluation model fails the response if any of them could've included more detail.
</Accordion>

<Accordion title="Factual Correctness">
  This dimension seems like it should be unnecessary at first glance since DeepRails provides a Correctness metric separate from Completeness. However, during development of the prompt, we found that evaluation models struggled to accurately assess completeness without a component confirming that the response's claims were true.
</Accordion>

<Accordion title="Relevance">
  Sometimes an AI response can be too complete. This dimension of the Completeness evaluation fails if any sentences in the response are not directly related to the user's query.
</Accordion>

<Accordion title="Logical Coherence">
  A response's completeness is not all about its content. A finished response has a good logical flow and provides indentation, proper spacing, and bullet points as needed, and our evaluation model checks the response for all of this structure.
</Accordion>

## Evaluation Process

DeepRails performs a Multimodal Partitioned Evaluation of every model output to assess its completeness in each of the five dimensions as visualized below. This flow is completed on two separate models and their evaluations are averaged to arrive at a final score. See <a href="/engine/multimodal-partitioned-evaluation">the MPE page</a> for more information.

```mermaid theme={null}
flowchart LR
  A["Input + Output"]
  B1["Coverage Evaluation"]
  B2["Detail and Depth Evaluation"]
  B3["Factual Correctness Evaluation"]
  B4["Relevance Evaluation"]
  B5["Logical Coherence Evaluation"]
  C1["Coverage Verdict"]
  C2["Detail and Depth Verdict"]
  C3["Factual Correctness Verdict"]
  C4["Relevance Verdict"]
  C5["Logical Coherence Verdict"]
  D["Score Summary Generation"]
  E["Score Aggregation"]

  A --> B1
  A --> B2
  A --> B3
  A --> B4
  A --> B5
  B1 --> C1
  B2 --> C2
  B3 --> C3
  B4 --> C4
  B5 --> C5
  C1 --> D
  C2 --> D
  C3 --> D
  C4 --> D
  C5 --> D
  D --> E

```

## Improving Low Completeness Scores

<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 Fixes</h3>
  </div>

  To improve low completeness scores:

  <div style={{ marginTop: "1rem", paddingTop: "0.75rem", borderTop: "1px solid rgba(209, 213, 219, 0.33)" }}>
    <strong>Use prompt structure effectively:</strong> You should tailor your prompts to emphasize structure and completeness in response; add specific validation rules for each important part of your request to the end of your prompts.
  </div>

  <div style={{ marginTop: "0.75rem", paddingTop: "0.75rem", borderTop: "1px solid rgba(209, 213, 219, 0.33)" }}>
    <strong>Guide for elaboration:</strong> You should instruct the model to use examples and detail specifically in each of your prompts to reinforce its adherence to all aspects of your request.
  </div>
</Card>

***

<Note>
  Completeness evaluates the robustness of your AI outputs, but remember to combine it with Correctness, Instruction Adherence, or other metrics for a more holistic review of the response contents.
</Note>
