Glossary

RAG pipeline

The chain of steps that lets a language model answer from your documents: load, split and index the sources ahead of time, then retrieve matching passages and pass them to the model for each question.

A RAG pipeline is the chain of steps that lets a language model answer from your own documents: load the sources, split and index them, retrieve the passages that match a question, and pass those passages to the model with the question. It has two halves. The indexing pipeline runs ahead of time and whenever content changes; the query pipeline runs for every question. Most quality problems in retrieval augmented generation trace back to one stage of this chain, so it helps to treat the stages separately.

The indexing pipeline

Indexing turns raw files into something searchable. A document loader reads PDFs, web pages, Word files or transcripts and returns text with metadata. Scanned pages need OCR at this point, and recordings need speech to text. A text splitter then cuts the text into pieces using one of several chunking strategies, and an embedding model turns each piece into a vector. Vectors, chunk text and metadata such as source, page and date go into a vector database, often with a keyword index beside it for hybrid search.

This half is a data pipeline like any other, with the usual concerns of data ingestion and scheduling. Documents change, so it also needs a way to re-index what changed without rebuilding everything, covered under incremental indexing.

The query pipeline

At question time the steps run in order. The question may be rewritten or expanded first, a step called query rewriting. The retriever fetches candidate chunks by vector similarity, keyword match or both, often narrowed by metadata filtering to one tenant, folder or date range. A reranking model reorders the candidates and the top few are kept. Those passages go into a prompt template with the question, and the language model writes the answer, ideally citing the passage behind each claim.

Pipeline stages at a glance

Stage

What it does

Common failure

Loading

Reads files and pages into text

Tables, scans and JavaScript pages come out garbled

Chunking

Splits text into retrievable pieces

A fact is separated from the context that explains it

Embedding and indexing

Stores vectors and metadata

The index drifts from the source documents

Retrieval

Finds candidate passages

Similar but irrelevant chunks outrank the answer

Reranking

Orders candidates by relevance

Cannot recover a passage that was never retrieved

Generation

Writes the answer from the prompt

The model fills gaps when the passage is missing

Pipeline patterns

The simplest arrangement, one retrieval pass with a fixed top k, is naive RAG. Modular RAG treats each stage as a swappable component with routing between them, corrective RAG grades retrieved passages and falls back to other sources, Self-RAG trains the model to decide when to retrieve, and agentic RAG lets an agent plan several searches. For a small, fixed corpus, cache-augmented generation skips retrieval by loading everything into context.

Building and evaluating a pipeline

Most teams assemble the pipeline from a framework such as LangChain or LlamaIndex, a hosted embedding model and a vector database, then tune chunk size, overlap, k and the reranker. Tuning only means something with measurement: a set of real questions with known answers, scored for retrieval with recall at k and for answers with faithfulness. Evaluating retrieval without a labelled dataset covers how to start, and RAG failure modes lists what usually goes wrong. Upkeep is the part teams underestimate: every stage is code to maintain, and the index goes stale unless something re-runs ingestion when sources change.

RAG pipelines on Exabase

Exabase folds the indexing half and the retrieval step into storage. Files, notes and bookmarks saved as Resources are extracted and indexed as they arrive, including PDFs, images, audio and video, so there is no loader, splitter, embedding model or vector database to run. Deep Search handles retrieval: text queries are hybrid by default, filters cover folders, tags, types and dates, results are sub-document passages with page numbers or timestamps, and a precision setting from 0 to 1 trades recall against relevance per query. For files that should not be stored, Extract returns chunks with the same location references through one endpoint.

A Worker can keep the index current by re-extracting changed documents on a schedule, and each customer can have an isolated Base with its own index. Prompt assembly and generation stay in your application, with whichever model you choose. The searching resources guide, the RAG pipelines use case and the knowledge base solution go into the details, and Exabase vs LlamaIndex compares it with a framework approach.

FAQs

What are the main stages of a RAG pipeline?

Loading, chunking, embedding and indexing on the ingestion side; query processing, retrieval, reranking and generation on the query side. Many teams add evaluation and monitoring as a final stage.

Which stage of a RAG pipeline causes most errors?

Usually retrieval. When the right passage is not among the candidates, no prompt or model change can recover it. Checking whether the answer appears in the retrieved text separates retrieval errors from generation errors, as the RAG accuracy page explains.

Do I need a vector database for a RAG pipeline?

You need some search index. A vector database is the common choice, often with a keyword index beside it, and best vector databases compares the options. Managed services such as Exabase include the index in storage, so there is no separate database to run.

How do I keep a RAG pipeline up to date?

Re-index documents when they change, ideally only the ones that changed, and remove deleted ones. A scheduled job or an agent such as an Exabase Worker can handle this; knowledge base maintenance covers the practice.

How does Exabase fit into a RAG pipeline?

It replaces the ingestion and retrieval stages. You store content in a Base, query it with Deep Search and pass the returned passages to your model. Generation, prompts and model choice stay in your code.

Related pages: Naive RAG, Modular RAG, Agentic RAG, Retriever, Chunking, Data ingestion, Knowledge base, RAG accuracy, RAG pipelines use case, Best RAG infrastructure, Source attribution.

Cut your token spend and give your agent precise context.

Get started in minutes.

Cut your token spend and give your agent precise context.

Get started in minutes.