# Grounding

> The Grounding is a technique of connecting model answers to reliable sources of information.

## What is grounding in AI and how does it reduce hallucinations?

The technique of basing model answers on provided data, such as documents, search results or code, instead of only the model's memory. Often combined with citations so users can verify the source of each statement.

- Topic: Language Models
- Type: technique

## Example

Wrong:

```text
Here are some docs:
{{docs}}
When does the free trial end?
```

Right:

```text
<doc id="1">{{doc1}}</doc>
<doc id="2">{{doc2}}</doc>
Answer only from the docs above and cite ids like [1].
If the docs do not contain the answer, say so.
Question: When does the free trial end?
```

Ids make citations checkable, and the explicit rule stops the model from filling gaps from memory.

## Common mistakes

- Retrieving sources but not telling the model to rely on them, so it answers from memory.

## Key points

- Source documents are passed in the prompt with ids the model can cite.
- The prompt tells the model to answer only from the given sources and say when they lack the answer.
- Citations in the answer are checked against the retrieved sources before showing them.

## Interview questions

### Is grounding the same as RAG?

RAG is one way to ground answers: it retrieves sources and adds them to the prompt. Grounding also covers tool results, web search and documents the user provides.

### Does grounding stop all hallucinations?

No. The model can still misread or misquote a source, so check citations against the retrieved text.

### What makes a good grounding source?

Current, authoritative text that directly covers the question, with a clear id or URL the answer can cite.

## Related cards

- [RAG](https://wonderium.dev/ai/rag.md)
- [Hallucination](https://wonderium.dev/ai/hallucination.md)
- [Semantic Search](https://wonderium.dev/ai/semantic-search.md)
- [System Prompt](https://wonderium.dev/ai/system-prompt.md)

---

- Level: [Artificial Intelligence](https://wonderium.dev/ai.md)
- HTML version: https://wonderium.dev/ai/grounding
- Last updated: 2026-11-25
