Building With Retrieval: A Practical System
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.
RAG (Retrieval-Augmented Generation)
Inject external knowledge into an LLM at query time.
Semantic Search
Finding information by meaning rather than exact keyword match.
Agentic RAG
RAG where an agent decides what to retrieve, when, and from which source — instead of a single static query.
Embedding
A numerical vector representation of text, image or audio that captures meaning for similarity search.
Retrieval
Selecting the most relevant chunks for a query before generation.
Reranker
A second-stage model that reorders retrieved chunks for precision.
Hybrid Search
Combining keyword (BM25) and vector search for better recall.
Chunk Size
The length of text segments stored in a vector index.
BM25
The keyword-ranking algorithm behind classic search engines.
Cosine Similarity
The dot-product-of-unit-vectors metric that ranks embeddings.
Vector Index
A data structure that makes nearest-neighbor search fast.
Embedding Dimensions
The vector length of an embedding model's output.
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.