# Retrieval

The process that finds external records and supplies them to a model as context — commonly shortened to RAG, for retrieval-augmented generation.

Source: https://aecon.ai/glossary/retrieval
Updated: 2026-09-15

## In practice

Before answering a policy question, the system searches the company's approved document store, filters to records this user may see, and places the three most relevant passages in front of the model.

## The distinction

Retrieval is a supply chain, not a search box. Ingestion, labelling, permission filtering, ranking and freshness all decide what the model sees, and semantic similarity alone says nothing about whether a record is current or permitted.

## Every arrow is a failure boundary

```text
source system
  -> acquire under an identity and licence
  -> parse and normalise
  -> split, label and index
  -> apply tenant, role, purpose and time filters
  -> retrieve lexical and semantic candidates
  -> rerank and select
  -> attach source and freshness metadata
  -> place records in model context
```

Chunks that are too small lose their context; chunks that are too large dilute the relevant passage and cost more tokens. Without source, owner, effective date, access labels and version metadata, search can still return plausible text that the application cannot judge.

## Permission filtering belongs before the model

Retrieving everything and asking the model to ignore what it should not have seen is not an access-control design.

The search boundary restricts candidates first — by tenant, user, role, purpose, region and time — and ranks within the eligible set. Major providers document exactly this ordering, with filters applied before semantic search rather than after.

The application still has to translate the signed-in person's real authority into those filters, and prevent an agent from altering them through instructions buried in retrieved content.

## Quality is not one number

Lexical search finds matching words and identifiers. Semantic search finds related meaning. Hybrid retrieval combines them. A product-code lookup wants exact text; a policy question wants semantic search constrained to the effective version; a customer balance wants a structured query against the source system, not a similarity score.

## Sources & context

- [Retrieval](https://platform.openai.com/docs/guides/retrieval) — OpenAI, 2026. Documents automatic chunking, embedding and indexing, results carrying the originating file, and attribute filters applied before semantic search. Checked 2026-09-13.
- [RAG Engine overview](https://cloud.google.com/vertex-ai/generative-ai/docs/rag-overview) — Google Cloud, 2026. Documents a sequence from ingestion and transformation through indexing, retrieval and generation. Checked 2026-09-13.

## Related reading

- [Context](https://aecon.ai/glossary/context)
- [Memory](https://aecon.ai/glossary/memory)
- [Provenance](https://aecon.ai/glossary/provenance)
- [AI model](https://aecon.ai/glossary#ai-model)
