Designing your own custom RAG pipeline.
A RAG pipeline is a sequence of decisions, not a product you install. Four of them deserve most of your attention — get these right and the rest follows.
The steps below are sequential. Each choice constrains the next — your use case shapes what you need from a parser, your parser shapes what document processing is possible, and your processing shapes how you can chunk. The expensive mistakes happen when a step gets skipped, or decided by default instead of on purpose.
The four decisions
Design the use case
What questions should the system answer?
Everything downstream is shaped by this. Define who is asking, what they ask, and what a good answer looks like — including the data sources those answers live in: PDFs, wikis, SharePoint, Confluence, ticket systems, websites. Scope kills more RAG projects than technology does — a system built to answer 'anything about the company' ends up answering nothing well. Decide up front what happens when there's no good answer: saying 'not found' beats a confident guess.
How to decide
Write down twenty real questions your users will actually ask, and find the documents that answer them. That list is your spec — every later decision gets tested against it.
Select the parser
Can it read your documents — not documents in general?
Parsers are benchmarked on clean text. Your corpus has scanned pages, tables, forms, and odd layouts. Parsing quality is corpus-specific, so evaluate on your own files, not a vendor's demo set. This is the highest-leverage, least-glamorous choice in the whole pipeline — a mistake here survives every downstream step, because you can't chunk, embed, or retrieve information the parser already threw away.
How to decide
Run ten representative documents — your worst ones, not your cleanest — through each candidate parser and read the raw output side by side. Pick the one that preserves what your answers depend on.
Design document processing
What structure do you keep, and what do you throw away?
Decide deliberately what survives parsing: OCR for scans, table structure, images, headers and footers, and the metadata worth extracting — dates, document type, owner, access rules. Cleaning is a design decision, not a chore. This step is mostly decisions and glue code rather than a single product you buy, and the access rules you establish here need to carry through the rest of the pipeline from day one.
How to decide
For each document type, decide what a chunk must carry for an answer to be trustworthy — then process for that, and discard the rest.
Choose a chunking strategy
Where do answers actually live in your documents?
Page-based, semantic, hierarchical, or hybrid — none is best in general. The right boundaries match how information sits in your corpus: a procedure step, a spec table, a contract clause. Chunk size is a trade-off, not a setting to get right once — smaller chunks favor precision, larger ones favor recall, and retrieval-time tricks can recover context a hard boundary cut off.
How to decide
Take your twenty questions and find the passage that answers each one. The shape of those passages is your chunking strategy — test it by checking whether each answer survives inside a single chunk.
The rest of the pipeline
What comes after.
The remaining decisions matter too — but they inherit from the four above.
Metadata
Tags, dates, document type, ownership, access.
Embedding model
Fit to your domain, cost, and latency.
Storage
Vector, keyword, relational, or graph — usually a mix.
Indexing
Hybrid search and relationships, not just vectors.
Retrieval logic
Filters, reranking, query rewriting, multi-stage retrieval.
The LLM
Quality, context window, latency, cost.
Prompts
Grounding, citations, formatting, hallucination control.
Evaluation
Accuracy and recall measured on your twenty questions.
Deployment
Your cloud, with authentication, scaling, and monitoring.
Operations
Re-indexing, document updates, versioning, feedback loops.
These are the decisions we make with clients every week.
Bring your documents and your questions — we'll come back with an architecture.
