# Ground (`ground-1`): Grounding check (hallucination detection)

Does the source back up what your model said?

Ground checks each sentence of an answer against the source text it should come from and flags the ones the source doesn't support. Use it after RAG: send the retrieved context in `context` and your model's answer as `input`.

You get a score for the whole answer (the weakest sentence) and a score per sentence, so you can highlight or drop the unsupported parts.

- **Price:** $0.04 per 1,000 sentences. One unit per sentence of the answer checked against the context.
- **Languages:** Multilingual, tested in 7 languages
- **Input:** The answer or claim to check (a string, up to 8,000 characters).
- **Batch:** no, one input per call
- **Status:** live
- **Built on:** [Horizon-Labs/hallucination-guard-small](https://huggingface.co/Horizon-Labs/hallucination-guard-small), Apache-2.0, 141M (mmBERT-small encoder)

## Request

```bash
curl https://labs.greatwork.company/v1/run \
  -H "Authorization: Bearer $GWL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"ground-1","context":"The Eiffel Tower was completed in 1889 for the World's Fair in Paris. It is 330 meters tall and was the tallest structure in the world until 1930.","input":"The Eiffel Tower was finished in 1889. It was built for the Olympic Games and is about 330 meters tall."}'
```

## Options

| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| `input` | string | yes | | The answer or claim to check (a string, up to 8,000 characters). |
| `context` | string | yes |  | The source text the answer should be based on (up to 8,000 characters). |
| `threshold` | number | no | `0.5` | Score at or above which a sentence counts as supported. |

## Output

| Field | Type | Description |
|---|---|---|
| `supported` | boolean | True when every sentence is supported. |
| `score` | number | Support score of the weakest sentence, 0 to 1. |
| `sentences` | object[] | Each sentence: `text`, `score`, `supported`. |

The response envelope is always `{"id", "object": "run", "model", "created", "output", "usage": {"units", "unit", "cost_usd", "cost_micros"}, "latency_ms"}`.

## Examples (real outputs from our servers)

### Half right

```json
{
  "model": "ground-1",
  "context": "The Eiffel Tower was completed in 1889 for the World's Fair in Paris. It is 330 meters tall and was the tallest structure in the world until 1930.",
  "input": "The Eiffel Tower was finished in 1889. It was built for the Olympic Games and is about 330 meters tall."
}
```

```json
{
  "supported": false,
  "score": 0.3905,
  "sentences": [
    {
      "text": "The Eiffel Tower was finished in 1889.",
      "score": 0.9686,
      "supported": true
    },
    {
      "text": "It was built for the Olympic Games and is about 330 meters tall.",
      "score": 0.3905,
      "supported": false
    }
  ]
}
```

173 ms, $0.00008.

### Supported

```json
{
  "model": "ground-1",
  "context": "Our Pro plan costs $29 per month and includes 10 seats. Annual billing saves 20%.",
  "input": "Pro is $29 a month with 10 seats included."
}
```

```json
{
  "supported": true,
  "score": 0.8851,
  "sentences": [
    {
      "text": "Pro is $29 a month with 10 seats included.",
      "score": 0.8851,
      "supported": true
    }
  ]
}
```

52 ms, $0.00004.

## Good for

- Flag unsupported claims in RAG answers
- Score summaries against their source
- Check generated product descriptions against specs
- Gate answers before they reach a customer

## Limits and caveats

- Judges against the context only: a true fact the context doesn't contain is unsupported.
- Arithmetic and date inferences are often marked unsupported.
- Some paraphrases are missed.
