RAG Relevance Tuning: How to Make Retrieval Return What Matters

RAG Relevance Tuning: How to Make Retrieval Return What Matters

RAG relevance tuning is the disciplined work of closing the gap between what your retriever returns and what your users actually need. The question teams ask when their system goes live is why the answers feel slightly off even though the documents are all there. The answer is usually relevance, not coverage: the retriever is finding related material, but not the passages that would let the model answer well, and tuning is the process of finding out why and fixing it.

Tuning is not a single setting. It is a loop: define what relevant means for your users, measure how the system does today, change one thing, and measure again. Teams that skip the measurement step end up tuning by anecdote, chasing the last bad answer they saw. Teams that measure can improve steadily and can tell whether a change helped or quietly made things worse.

Key takeaways

  • RAG relevance tuning is a measure-then-change loop, not a one-off configuration task.
  • Define relevance for your users before tuning anything, because generic relevance is not the same as useful relevance.
  • Most gains come from query handling, chunk quality and retrieval settings, not from a new embedding model.
  • Change one lever at a time and measure on a fixed test set, or you cannot tell what helped.
  • Relevance drifts as the corpus and the questions change, so tuning is ongoing maintenance, not a launch task.

What relevance means in a RAG system

Relevance is often treated as a property of a passage, but in practice it is a relationship between a passage, a question and a purpose. A passage can be topically related yet useless for the question asked: a product overview is related to a question about pricing, but the pricing table is the relevant passage. A passage can also be relevant but unusable, for instance when it is outdated, contradicts a newer source, or comes from a document the user should not see.

That is why tuning starts with a definition. For your system, decide what counts as a good retrieval: the passage that directly answers the question, the passage that supports the answer, or the set of passages that together cover it. Different use cases need different definitions. A support assistant needs the single passage that resolves the issue; a research tool needs the set of passages that represent the range of views.

The three places relevance is won or lost

Relevance is decided in three places. The first is the query: how the user’s question is turned into a search. The second is the index: how documents were split, embedded and stored. The third is the retrieval and ranking configuration: which signals are used and how they are weighted. Put most tuning effort into the first two: configuration cannot rescue a badly phrased query or a broken chunk. Check the retrieved passages before blaming the model: if the right passage is not in the top results, the problem is retrieval.

Start with a test set, not with settings

Before changing anything, build a test set of real questions with known good answers. Fifty questions is a practical minimum; a hundred is better. Draw them from real usage where possible: support tickets, search logs, questions colleagues actually asked. For each question, note which passages should be retrieved. This labelling is the most valuable hour you will spend on tuning, because without it every change is a guess.

Include awkward questions deliberately. Real users ask vague questions, use the wrong terminology, misspell product names and ask things the corpus cannot answer. A test set of only clean, well-phrased questions will tell you the system works right up until it meets a real user.

How to measure without a data science team

You do not need complex machinery to measure relevance. For each test question, record whether a correct passage appears in the top five results, and where it ranks. Two simple numbers cover most needs: the share of questions where a good passage appears in the top five, and the average rank of the first good passage. Track both before and after each change. If the share rises and the average rank falls, the change helped. If you want a single summary number, the proportion of questions answered from a top-five passage is easy to explain to stakeholders and hard to game.

Keep the test set fixed while you tune. Changing the test at the same time as the system makes results incomparable. When real usage reveals a new failure mode, add questions that capture it, but note the date so you know the set changed.

The levers that move relevance most

Query handling is usually the highest-return lever. Users rarely phrase questions the way documents phrase answers, so a raw query often misses the vocabulary of the corpus. Query rewriting expands or rephrases the question before retrieval: adding synonyms, expanding abbreviations, or breaking a complex question into sub-questions that are searched separately. A related technique generates a hypothetical answer and searches for passages similar to it, which bridges the gap between question language and document language. Our article on RAG query rewriting explains these methods in detail.

Chunk quality is the second lever. Chunks that are too long dilute the signal, because a relevant sentence sits inside a passage that is mostly irrelevant. Chunks that are too short lose the context that makes them match the query. The fix is usually structural: split on paragraphs and sections, keep related material together, and attach metadata such as the document title and section heading to each chunk so the retriever can use it.

Retrieval settings and signal weights

Once queries and chunks are sound, tune the retrieval configuration. If you use hybrid search, adjust the balance between keyword and vector scores and measure the effect on your test set. Terminology-heavy corpora usually need more keyword weight; conversational queries usually need more vector weight. The number of candidates passed to the re-ranker matters too: too few and the re-ranker cannot rescue a passage the first stage undervalued; too many and latency rises for little gain. Fifty candidates is a reasonable starting point for most systems.

Embedding model choice matters less than teams expect, but it is not irrelevant. A model trained on general web text may underperform on specialised vocabulary, and a domain-tuned model may do better. Before switching models, check whether the current one is actually the bottleneck: if the right passages are already in the top fifty but not the top five, the problem is ranking, not embedding. Our guide to RAG embedding models covers how to choose and when to fine-tune.

Comparing tuning levers

Not every lever is worth the same effort. The table below ranks the common levers by typical return, so you can work in the order that pays off fastest.

Lever Typical return Effort When it matters most
Query rewriting High Low to medium Vague or jargon-mismatched questions
Chunk quality High Medium Long documents; tables and lists
Hybrid signal weights Medium to high Low Mixed corpora; exact terms matter
Re-ranking Medium to high Low to medium Top results are near-misses
Embedding model change Low to medium Medium to high Specialised vocabulary dominates
Metadata and filters Medium Low Large, fast-changing corpora

Best first move for most teams: query rewriting plus chunk repair, measured on a fixed test set, before touching the embedding model.

Close-up of an audio mixing console with rows of knobs and white faders
Tuning relevance is like a mixing desk: small moves on the right levers.

The tuning loop in practice

A practical tuning loop runs in small cycles. First, run the test set and record the baseline. Second, look at the failures and sort them: how many are query problems, how many are chunk problems, how many are ranking problems. Third, pick the largest group and change one thing to address it. Fourth, re-run the test set and compare. If the numbers improved, keep the change; if not, revert it. This discipline feels slow, but it is far faster than changing five settings at once and then spending a week working out which one broke the system.

Keep a log of every change and its measured effect. The log is what turns tuning from folklore into engineering, and it is what lets a new team member understand why a setting has its current value six months later.

Watch for overfitting to the test set. If you tune aggressively against fifty questions, the system can improve on those fifty while getting worse on real questions. Guard against this by holding out a small set of questions you never tune against, and checking it periodically. For the wider evaluation picture, see our guide to RAG evaluation metrics.

When relevance tuning is not the answer

Some failures look like relevance problems but are not. If the corpus does not contain the answer, no tuning will retrieve it, and the correct response is to expand the corpus or to have the system say the answer is not available. If users keep asking questions the system was not designed for, the scope may need redefining rather than the retrieval retuning. And if the retrieved passages are right but the answers are wrong, the problem is generation, not relevance: check the prompt, the context passed to the model, and whether the model is being asked to do more than the passages support.

Relevance also drifts. A corpus grows, terminology changes, new products replace old ones, and questions shift with them. A system tuned in January can be quietly stale by July. Schedule a regular review: re-run the test set monthly, refresh it with recent real questions, and check the failure log for new patterns.

RAG relevance tuning checklist

Use this checklist to run a tuning cycle or to review a system someone else built.

  • Relevance is defined in writing for this system and its users.
  • A test set of at least fifty real questions with labelled good passages exists and is fixed during tuning.
  • Failures are sorted into query, chunk, ranking and generation causes before changes are made.
  • Only one lever changes per cycle, and the test set is re-run after each change.
  • Query rewriting and chunk quality are addressed before the embedding model is changed.
  • Hybrid signal weights are set from test data, not from defaults or guesswork.
  • A held-out question set guards against overfitting to the tuning set.
  • Every change and its measured effect is logged, and the test set is re-run on a schedule.

Frequently asked questions

What is RAG relevance tuning?

RAG relevance tuning is the process of improving which passages a retrieval system returns for a given question, using a labelled test set to measure each change. It covers query handling, chunking, retrieval settings and ranking.

How is relevance tuning different from re-ranking?

Re-ranking is one lever within relevance tuning: a second pass that re-orders retrieved candidates. Tuning is the wider loop of measuring relevance, finding the cause of failures, and changing the right lever, which may be the query, the chunks, the signals or the ranker.

How many test questions do I need?

Fifty is a practical minimum and a hundred is better. The questions should come from real usage, include awkward and vague phrasing, and cover the main ways people actually ask.

Should I fine-tune my embedding model?

Usually not first. Most relevance gains come from query handling, chunk quality and signal weights. Consider a different or fine-tuned embedding model only when the test set shows the retriever itself is the bottleneck, such as highly specialised vocabulary.

How often should I re-tune a RAG system?

Re-run the test set monthly and refresh it with recent real questions. Re-tune whenever the corpus changes substantially, new question patterns appear, or the measured scores fall.

Can relevance tuning fix hallucinated answers?

Only partly. Good retrieval reduces hallucination by giving the model correct evidence, but if the model ignores the passages or goes beyond them, the fix is in generation: the prompt, the context and the instruction to stay within the retrieved text.

Latest articles

Scroll to Top