RAG development

Answers grounded in your documents, with a citation for every claim

A retrieval system is only as good as the passages it finds. We build the chunking, hybrid search, reranking and evaluation layers that decide whether your users get a verifiable answer or a confident invention.

  • 6-8 weeks to production
  • Fixed-price corpus audit
  • pgvector
  • Qdrant
  • Elasticsearch

What is rag development?

RAG development is the work of building a system that retrieves the right passages from your own documents and gives them to a language model, so answers are grounded in your data rather than in the model's training. Done properly it produces answers with citations a user can open and verify. Almost all RAG failures are retrieval failures, not generation failures — the model was simply handed the wrong context, so the fix is in chunking, hybrid search, reranking and evaluation rather than in prompting.

Why teams call us

What usually goes wrong before we get involved

Almost every engagement starts from one of these. If none of them sound familiar, you probably do not need us yet.

The answers are plausible and wrong

The system retrieves passages that are topically related but do not contain the answer, and the model summarises them anyway. To a user it reads as authoritative. This is the single most common RAG failure, and it is a search problem wearing a generation problem's clothing.

One confidently wrong answer to a customer or auditor can end internal support for the tool.

Nobody can say how accurate it is

Without a labelled question set and separate retrieval metrics, accuracy discussions become anecdotal — someone tried six questions and formed an impression. There is no way to know whether last week's chunking change helped or hurt.

Blocks approval in any environment with a compliance review.

It cannot find exact identifiers

Vector search matches on meaning, which is exactly wrong for a part number, contract ID, drug name or SKU. Teams that went vector-only discover their system cannot reliably retrieve a document when the user quotes its reference code.

Fails the first realistic user test, which is almost always a lookup by identifier.

Answers go stale and nobody notices

Documents are updated, superseded or withdrawn, but the index still holds the old chunks. The system keeps answering from a policy that was replaced four months ago, with a citation that looks legitimate.

Creates a compliance exposure that is worse than having no tool at all.

Scope

What rag development covers

Document preparation and chunking

More final accuracy is decided here than anywhere else. We handle real-world source material — PDFs with tables, scanned documents, decks, spreadsheets, wiki exports — and chunk on document structure rather than on a fixed token count, so a retrieved passage arrives with the heading and context that make it interpretable.

  • Layout-aware extraction for tables, headers and multi-column PDFs
  • Structure-based chunking with parent-document context retained
  • Metadata extraction for filtering by date, source, region or entity

Hybrid retrieval and reranking

Keyword search for exact terms, vector search for meaning, then a reranking model to order a wider candidate set. This combination is what makes the system work for both "what is our parental leave policy" and "clause 14.2 of contract AC-8871".

  • BM25 and dense vector retrieval fused with tuned weighting
  • Cross-encoder reranking over a broad candidate pool
  • Metadata pre-filtering so tenant, region and recency are enforced, not hoped for

Grounding and citation enforcement

Every claim in an answer is tied to the retrieved passage that supports it, and unsupported claims are rejected before the user sees them. Refusal is treated as a correct outcome when the corpus does not cover the question.

  • Inline citations linking to the exact source passage
  • Sentence-level grounding checks against retrieved context
  • Calibrated refusal so gaps in the corpus surface instead of being filled in

Retrieval evaluation

We build a labelled question set from real user queries and score retrieval independently of generation, so when quality moves you know which stage moved it.

  • Recall and precision at k measured per query category
  • End-to-end answer scoring for correctness, grounding and refusal accuracy
  • Regression gates in CI on every index or model change

Freshness and index operations

Incremental re-indexing on document change, supersession handling so withdrawn documents stop being cited, and deletion propagation that actually removes content from the index rather than just hiding it.

  • Change-data-capture pipelines from your document sources
  • Version and supersession awareness in retrieval
  • Verifiable deletion for data-subject and retention requirements

Access control at retrieval time

Permissions are enforced in the retrieval query, not filtered from results afterwards. A user cannot receive an answer synthesised from a document they have no right to read.

  • Per-user and per-tenant permission filters applied pre-retrieval
  • Row and document level security mirrored from your source systems
  • Audit log of which sources were used for each answer

How it runs

The delivery process

Fixed checkpoints with a named deliverable at each one, so you can stop the engagement at any stage and still own something useful.

  1. Corpus audit and scoping

    Weeks 1-2

    We inspect the actual documents rather than the description of them. Formats, quality, duplication, contradictions between sources, and how often things change all determine the architecture — and occasionally reveal that the corpus needs cleaning before any retrieval will work well.

    You receive: Corpus assessment, retrieval architecture, labelled evaluation question set, cost model.

  2. Retrieval pipeline build

    Weeks 2-4

    Ingestion, chunking, embedding, hybrid index and reranking, tuned against the evaluation set. At this stage we optimise retrieval metrics alone, with generation deliberately held constant.

    You receive: Working retrieval layer with measured recall and precision at k.

  3. Generation and grounding layer

    Weeks 4-6

    The answering step, citation enforcement, refusal behaviour and output formatting — then end-to-end scoring against the labelled set.

    You receive: Full pipeline with baseline accuracy, grounding and refusal scores.

  4. Integration and rollout

    Weeks 6-8

    Wired into your product, portal or agent, with permission filters connected to your identity provider and a staged traffic ramp.

    You receive: System live with monitoring, alerting and access controls in production.

What you end up owning

  • Ingestion and chunking pipeline for your real document formats
  • Hybrid retrieval index with reranking, tuned against a labelled question set
  • Citation-enforced generation layer with calibrated refusal behaviour
  • Retrieval and answer evaluation suites running in CI
  • Permission filtering wired to your identity provider
  • Freshness pipeline with supersession and deletion handling
  • Operational runbook and cost-per-query model

Typical stack

  • pgvector
  • Qdrant
  • Elasticsearch
  • Claude
  • OpenAI
  • Cohere Rerank
  • LlamaIndex
  • Python
  • LangFuse

Engagement

Typical timeline
6-8 weeks to production
Starting at
Fixed-price corpus audit
Engagement models
Fixed-price corpus auditMilestone-based buildEmbedded with your teamManaged operation retainer

Results

What this typically moves

Answer accuracy on covered questions
85-95%
Retrieval precision gain from hybrid search and reranking
3-5x
Corpus audit to production
6-8 weeks
Answers traceable to a source passage
100%

Almost every RAG failure is a retrieval failure

When a RAG system answers badly, the instinct is to blame the model and start rewriting prompts. In our experience that is the wrong place to look roughly nine times out of ten. The model usually did its job faithfully — it summarised the passages it was given. The passages were simply the wrong ones.

This matters because it changes where the engineering effort goes. Prompt iteration produces small, unstable gains. Fixing retrieval — better chunking, adding keyword search alongside vectors, reranking a wider candidate pool, filtering on metadata — produces large and durable ones.

It also explains why so many teams plateau. They have built a single-stage vector search, they are measuring only end-to-end answer quality, and so they cannot see that their recall at k is 60%. No amount of prompt work recovers information that was never retrieved.

Measure the two stages separately

The most valuable instrumentation you can add is a retrieval metric that is independent of the answer. For a labelled set of questions, each with the passages that genuinely contain the answer, you can compute:

  • Recall at k — how often the correct passage appears in the top k results. If this is low, nothing downstream can save the answer.
  • Precision at k — how much of what you retrieved is actually relevant. Low precision means you are paying for tokens that dilute the context.
  • Grounding rate — what share of sentences in the final answer are supported by retrieved text.
  • Refusal accuracy — how often the system correctly declines when the corpus does not cover the question.

With those four numbers, a quality change becomes diagnosable. Without them, every discussion about accuracy is someone’s impression from six sample queries.

Why hybrid search is the default, not an optimisation

Dense vector search is good at meaning and bad at exact strings. That is not a tuning problem; it is what embeddings are. Ask for “contract AC-8871” and a vector index will happily return semantically similar contracts while missing the exact one, because the identifier carries almost no semantic signal.

Real users do both kinds of query constantly — conceptual questions and precise lookups — often in the same session. So the reliable architecture is:

  1. Retrieve a wide candidate set using both BM25 keyword search and vector search, fused with tuned weighting.
  2. Rerank that candidate set with a cross-encoder, which reads query and passage together and orders them far more accurately than either retriever.
  3. Pass only the top few passages to the expensive generation model.

Step three is where the cost savings come from. Retrieving broadly and reranking cheaply, then generating narrowly, gives better accuracy than dumping twenty passages into a frontier model’s context — and costs a fraction as much.

Chunking decides more than the vector database does

Teams spend weeks comparing vector databases and an afternoon on chunking. The weighting should be reversed. Any competent vector store will serve a mid-size corpus adequately; a bad chunking strategy caps your accuracy regardless of what is underneath.

The failure mode is splitting on a fixed token count. It cuts tables in half, separates a clause from the heading that scopes it, and produces passages that are meaningless out of context. What works better:

  • Split on document structure — sections, headings, list boundaries, table rows.
  • Keep the parent context with the child chunk, so a retrieved paragraph arrives with the heading it sat under.
  • Extract tables separately and preserve their structure rather than flattening them into prose.
  • Attach metadata — source, date, version, owning team, jurisdiction — so retrieval can filter before it ranks.

Refusal is a feature, and it has to be measured

A system that always produces an answer is a system that invents one when the corpus is silent. For any use case where the answer has consequences, “this is not covered in the documents I have access to” is the correct output, and it needs to be treated as a scored behaviour in the evaluation set rather than as an embarrassing edge case.

This is usually the point where a compliance or clinical reviewer decides whether to approve the tool. A system that cites its sources and admits its gaps is auditable. One that answers everything fluently is not, no matter how high its average accuracy looks.

Frequently asked questions

What is RAG in simple terms?
Retrieval-augmented generation means looking things up before answering. Instead of relying on what a language model memorised during training, the system searches your own documents for the passages relevant to the question, hands those passages to the model, and asks it to answer using only that material. The practical benefits are that answers reflect your current data, that you can show the user exactly which source was used, and that adding new information means indexing a document rather than retraining anything.
Is RAG better than fine-tuning a model?
They solve different problems and are frequently confused. RAG supplies knowledge — facts, documents, policies, records that change over time. Fine-tuning shapes behaviour — tone, output format, following a domain-specific convention. If your problem is that the model does not know your data, fine-tuning is the wrong tool and will produce a model that confidently invents plausible details. If your problem is that the model knows the answer but formats it wrong, RAG will not help. Many production systems use both, for those two separate reasons.
How accurate can a RAG system realistically be?
On a well-prepared corpus with a properly built retrieval layer, 85-95% answer accuracy on questions the documents genuinely cover is a realistic target. The number is meaningless without two qualifiers: what counts as correct, and what the system does when the answer is not in the corpus. A system that answers 95% correctly but confidently guesses on the remaining 5% is often worse in practice than one that answers 88% correctly and says "not found" the rest of the time.
How do you stop a RAG system from hallucinating?
Four controls, in order of impact. First, retrieval quality — most hallucination is the model reasoning over irrelevant passages it was handed. Second, an explicit instruction and evaluation for refusal, so "the documents do not cover this" is treated as a correct answer rather than a failure. Third, citation enforcement, where a claim without a supporting retrieved passage is rejected. Fourth, grounding checks in the evaluation suite that score whether each sentence is supported by the retrieved context.
What does a RAG system cost to run?
Embedding and storage costs are usually minor. The recurring cost is inference on the answering step, and it is driven by how much context you retrieve per query. Retrieving twenty passages when four would do multiplies the bill by five for no accuracy gain, which is why we tune retrieval depth against the evaluation set rather than defaulting to "more context is safer". Reranking a wider candidate set with a small cheap model, then passing only the top few to the expensive one, is usually the best cost-accuracy trade.
Can RAG work over data we cannot send to a third-party model?
Yes. The retrieval layer runs entirely in your infrastructure, and the only question is where the generation step runs. Options in descending order of convenience: a commercial provider with zero-retention terms inside your cloud region, a managed model in your own cloud tenancy such as Bedrock or Vertex, or an open-weight model self-hosted on your hardware. We size the accuracy trade-off for each before you commit.

Next Step

Tell us what you are trying to automate

A 30-minute technical call with an engineer who has shipped this before — not a sales qualification round. You leave with a feasibility read, a rough shape for the build, and an honest answer about whether it is worth doing at all.

Book a Technical Call
  • No sales script
  • NDA on request
  • Scoping notes sent within 48 hours
Call us Book a call