456

Building With Retrieval: A Practical System

updated 2026-07-043 min read12 connected nodes

Retrieval-Augmented Generation (RAG) is the pattern of grounding an LLM's answer in documents fetched at query time instead of relying only on what the model memorised during training. A RAG system turns your knowledge base into embeddings, stores them in a vector database, and at question time retrieves the most relevant chunks to inject into the prompt. This guide pulls together everything on Onexial tagged retrieval — 12 connected nodes across definitions, workflows, tool stacks, comparisons, prompts and applied use cases — and orders it the way you would actually learn it: vocabulary first, then process, then tooling, then execution. Every item below links to a full node with its own examples and connections, so you can go as deep as you need without losing the map.

Core concepts behind Retrieval

Before wiring anything together, the vocabulary has to be precise. These 12 definitions cover the terms that show up in almost every Retrieval discussion — each one links to a full entry with an example and its own connections inside the graph.

DEFDictionaryNODE·72CB4B

RAG (Retrieval-Augmented Generation)

Inject external knowledge into an LLM at query time.

#ai#retrieval
/ragopen →
DEFDictionaryNODE·6F56BF

Semantic Search

Finding information by meaning rather than exact keyword match.

#retrieval#search
/semantic-searchopen →
DEFDictionaryNODE·5BFF00

Agentic RAG

RAG where an agent decides what to retrieve, when, and from which source — instead of a single static query.

#ai#retrieval#agents
/agentic-ragopen →
DEFDictionaryNODE·214A15

Embedding

A numerical vector representation of text, image or audio that captures meaning for similarity search.

#ai#infrastructure#retrieval
/embeddingopen →
DEFDictionaryNODE·386095

Retrieval

Selecting the most relevant chunks for a query before generation.

#ai#retrieval
/retrievalopen →
DEFDictionaryNODE·2BCFA7

Reranker

A second-stage model that reorders retrieved chunks for precision.

#ai#retrieval
/rerankeropen →
DEFDictionaryNODE·4DE225

Hybrid Search

Combining keyword (BM25) and vector search for better recall.

#ai#retrieval
/hybrid-searchopen →
DEFDictionaryNODE·2B32AF

Chunk Size

The length of text segments stored in a vector index.

#ai#retrieval
/chunk-sizeopen →
DEFDictionaryNODE·196903

BM25

The keyword-ranking algorithm behind classic search engines.

#search#retrieval
/bm25open →
DEFDictionaryNODE·1C505A

Cosine Similarity

The dot-product-of-unit-vectors metric that ranks embeddings.

#ai#retrieval
/cosine-similarityopen →
DEFDictionaryNODE·60C80C

Vector Index

A data structure that makes nearest-neighbor search fast.

#ai#retrieval
/vector-indexopen →
DEFDictionaryNODE·58B9C0

Embedding Dimensions

The vector length of an embedding model's output.

#ai#retrieval
/embedding-dimensionsopen →

Frequently asked questions

What does RAG stand for?
Retrieval-Augmented Generation. The model retrieves relevant documents at query time and generates an answer grounded in them.
When should I use RAG instead of fine-tuning?
Use RAG for factual, changing or private knowledge — docs, tickets, product data. Use fine-tuning for consistent style, format or a narrow behaviour that prompting cannot reach.
Do I always need a vector database for RAG?
No. For small corpora, in-memory search or keyword search (BM25) can outperform a naive vector setup. Vector DBs shine when you have thousands+ documents and need semantic recall.
How does RAG reduce hallucinations?
By passing the retrieved passages into the prompt and asking the model to answer only from them (with citations), the surface area for fabrication drops sharply — though prompt design and reranking still matter.
keep reading