Knowledge assistants

Improve RAG retrieval with hybrid search and reranking

Reading time
12 minutes
Updated
Published
Written by
modernagents editorial teammodernagents is an AI automation agency from Austria for SMEs, based in the Vienna region.
AI-generated image: Stacked brass test sieves with an indigo top rim on brushed aluminium

An employee asks your AI knowledge assistant about an exact error code and gets the instructions for a similar-sounding code. If this happens to you, the question is whether hybrid search and reranking for RAG help. RAG means that the assistant first searches for suitable passages in your documents and then writes an answer from them.

Hybrid search combines different ways of searching, commonly classic text search for words and semantic vector search for meaning. Reranking then reorders the candidates that have already been found. The combination can help when your employees use both exact product codes and freely phrased questions. But it does not replace complete sources or proper preservation of document structure when documents are read in.

An example: suppose a laboratory equipment manufacturer in Košice with 60 employees is testing a knowledge assistant for its technical support team. So far, Tomáš from technical support searches the service manual himself for every call from a laboratory, often under time pressure. The assistant should find the right passage in the manual and propose an answer to Tomáš.

Key takeaways

  • First diagnose whether the required evidence is absent from the candidate set or merely ranked too low: missing evidence points to ingestion and retrieval, poor ordering may justify reranking.
  • Text and vector scores do not automatically share meaning or scale; rank-based fusion considers an item's position in multiple lists.
  • A reranker does not automatically search the complete corpus again. Evidence absent from the candidates remains absent after reordering.
  • Compare text retrieval, vector retrieval, hybrid retrieval and hybrid retrieval with reranking with the same questions, and measure retrieval and answers separately.

So when the assistant gives Tomáš a wrong answer, first check whether the search did not find the right passage in the manual at all, or whether it was among the hits, but too far down. In the first case, you need to improve how the documents are read in and searched, and in the second, reranking can help. If you separate the two, additional model calls do not conceal a problem that arose earlier.

01 / 16

Why does a single kind of search not answer every question equally well?

Tomáš types: "What does error E-417 mean?" This question contains an exact identifier. Instructions for E-471 sound similar to a semantic search, but may be entirely wrong. Exact strings and appropriate text analysis matter especially here.

A colleague asks instead: "How do I get the device working again after an interruption?" He may mean the same instructions without using their technical term. Semantic search can bridge such differences in wording. But it does not guarantee that every similar document concerns the correct device.

Azure describes how to use full-text and vector queries together and merge their results. This is a documented product pattern, but not proof that it works better for every collection of documents. Azure AI Search: hybrid search.

02 / 16

Suppose Tomáš asks a question. Then a hybrid RAG search could run through these stages:

  1. First, the permitted scope of sources and the relevant filters are determined, for example only manuals Tomáš is allowed to see.
  2. Then text search and vector search each produce their own candidates.
  3. A fusion step creates one combined ranking from them.
  4. Optionally, another method, such as a model, evaluates the candidates more closely against the question. This is the reranking.
  5. Only after that does context assembly decide which passages go to the model that writes the answer. It can remove duplicate passages, add necessary neighbouring sections and allocate the available space in the context.

Reranking and context assembly are therefore different jobs.

During the trial, have the results of each stage recorded. If you only see the finished answer, it remains unclear whether the right source was never found or discarded later. A small, traceable list of candidates can be more useful than another complex component in the search.

03 / 16

What do text search and BM25 contribute?

Classic full-text search evaluates how well the query terms, meaning the words being searched for, match the content of a document. BM25 is a widely used method for this. It is particularly useful when exact labels, rare terms or identifiers such as "E-417" matter.

How exactly the text search analyses and processes the text affects the result. Capitalisation, hyphens, word forms and abbreviations, including internal ones, may be treated differently. So test with real product codes and technical terms from your business, rather than assuming correct behaviour from the name of the method.

A glossary can connect words that mean the same thing in your business. Somebody with subject knowledge should maintain it, because two similar-sounding product names are not automatically interchangeable. If the glossary replaces too broadly, it can reduce the precision for which you use text search in the first place.

04 / 16

Treat vector similarity as similarity, not validity

Vector search compares the question and the content as series of numbers that represent their meaning. It can bring different wordings together and so find suitable passages that share hardly any words with the question.

But similar meaning does not mean the passage applies. Suppose the manual for an older device model sounds almost the same as the one for the new model, but contains a different maintenance rule. Then the passage is very similar and still wrong. Details on product, version, location and effective period therefore still matter.

05 / 16

Combine rankings without assuming scores are comparable

Text search and vector search each deliver their own list with point values, the scores. These scores do not automatically share meaning or scale. If you simply add them, one kind of search can unintentionally tip the balance. Rank-based methods avoid part of this problem, because they consider the position of a document in the individual lists. Which methods exist and what your IT team should watch for is in the section "For your IT team" below.

06 / 16

What can reranking do, and what can it not recover?

A reranker looks more closely at the question and the selected candidates and can therefore move a suitable passage to the front. It does not automatically search the complete corpus again. If the right instructions are already missing from the candidate list, they are still missing after reordering.

Microsoft explicitly describes its semantic ranker as an additional evaluation of an existing result set. The specific limits of this product depend on the version and are not a general rule for RAG. Azure AI Search: semantic ranking.

Also distinguish a search answer copied directly from the document from an answer the language model then writes anew. A search service may highlight useful passages, and the language model may then compose a new explanation from them. The two outputs need different checks.

07 / 16

An illustrative two-list example

In this example, the lab equipment manufacturer's service manual contains the correct instructions for error E-417. Text search finds this identifier very well. A second set of instructions, in another document, describes general startup problems in plain language, and vector search ranks it high.

Tomáš now asks: "E-417 after a power cut, what next?" The question combines both. The merged list should contain the exact instructions for the error. A reranker can then prefer the passage that also covers the power cut.

Before the assistant answers, the application still checks the device type and the applicable version. If the instructions contain a mandatory safety prerequisite, such as a step that must be completed before restarting, it must remain in the context. The example describes how the selection should look, and it is not a measured improvement of a particular product.

08 / 16

Filters are part of retrieval quality

Filters for permissions and validity change which candidates are eligible at all. A search that looks good without filters can return less relevant hits in real operation. So test with the same restrictions that will actually apply later.

A filter error can look like a poor search method. Suppose the filter accidentally excludes the manuals for the site where Tomáš works. Then a different reranker will not help him either. First check whether the required source is in the permitted search space at all.

Do not weaken access control to improve retrieval, for example to make the search score better. More hits because restricted documents are included are not progress. The SharePoint guide explains why the technical path of permissions needs separate acceptance.

Got a workflow like this?

Tell me about it. Honest take and a rough price, usually within a day.

09 / 16

How do you compare four retrieval variants fairly?

A useful series of trials can compare four variants:

  • text retrieval
  • vector retrieval
  • hybrid retrieval
  • hybrid retrieval with reranking

Use the same versions of the sources, the same roles and identities and the same business references, such as the correct answers, as the benchmark for all variants. That way you can see what each stage adds.

Group the test questions into these types. In brackets is an example of how Tomáš might ask:

  • exact identifiers ("What does E-417 mean?")
  • paraphrased technical requests ("The device won't start after the power cut.")
  • multilingual wording (a question in a different language from the manual)
  • rules with exceptions (a maintenance rule that does not apply to one model)
  • questions with no available answer

For each question, mark the passages a correct answer needs. Then a person with subject knowledge, for example an experienced technician, assesses the answer.

Alongside the correct hits, also record unsuitable candidates, the added waiting time and the cost. A variant that improves a few difficult cases can be worthwhile, and it does not necessarily have to run for every easy question. But such a split needs clear rules and its own evaluation.

10 / 16

How do you measure retrieval and answers separately?

First check whether the required passage is in the candidate set that is actually used. Then check which position it has and whether it reaches the model's context. Only then assess the answer the model has written.

Microsoft accordingly distinguishes between process and system evaluations in its RAG evaluators. This helps with diagnosing failures, but does not replace a subject review of your specific tasks. Microsoft: RAG evaluators.

Strong retrieval, or a high search score, does not prove a complete answer. A model can leave out an exception despite good evidence. Conversely, it can produce a correct answer from general knowledge even though the search failed. If your assistant has to back every answer with a source, as we assume in the example for Tomáš's support team, you also need to detect this second case.

11 / 16

Check duplication and evidence coverage

Several almost identical text sections, known as chunks, can occupy the top positions. Another necessary piece of evidence may then be missing from the limited context. Check whether the selection covers different relevant sections and sources.

But coverage does not mean forcing different documents into the mix at any cost. If a single applicable set of instructions answers the question completely, further sources can confuse. The selection should cover the statements needed, not reach a certain number of different files.

Handle old and new versions explicitly. Suppose the instructions for E-417 exist in the 2023 version and in the current version side by side. Then the model may blend an answer from both. Validity filters and clear labelling therefore belong before or in the selection, not only in a notice at the end.

12 / 16

Evaluate latency and cost under realistic use

More candidates and reranking can cause more processing. Measure the entire time until the answer, including search, reordering and writing the answer. A fast search can be part of a slow overall process, and Tomáš would have to wait on the phone for the whole answer.

Also check what happens when several people ask at the same time and when questions are difficult and have several parts. Averages alone conceal outliers. Decide whether, if there is an outage, for example of the reranker, a simpler, already evaluated search may step in, or whether the assistant may then only answer in a restricted way.

Calculate the cost per successfully completed task, not only per search request. Less rework can justify additional technical cost. Without a measurable quality improvement, an extra stage mainly makes everything more complicated.

13 / 16

Record a defensible retrieval decision

Write down which combination you chose, which evaluation set you used, meaning which test questions and expected evidence or answers, and which groups of failures improved as a result. Record known weaknesses as well. This helps when the model or the search index is changed later.

If the right source is repeatedly missing, go back to how sources are taken in and split into sections and which filters apply. And if it is present but too far down, examine fusion and reranking. The chunking guide and RAG acceptance plan connect those decisions to concrete evidence.

Keep a simple baseline for comparison, such as a simple search, even after you have chosen a more elaborate setup. It is a useful benchmark when later changes increase response time or make something worse. An elaborate setup should keep earning its place through visible benefits, and it should not stay only because it has been hard to remove since it went live first.

14 / 16

For your IT team

The embedding model used, meaning the model that turns texts into vectors, belongs in the experiment record. Changing it can alter rankings and require reprocessing of the collection. Do not compare old document vectors with a new method for query vectors without explicitly verifying compatibility.

Azure documents Reciprocal Rank Fusion, one concrete fusion method, for its hybrid search. Other products may use different settings or combinations. Verify the actual implementation rather than treating a broad label as an exact configuration. Azure: hybrid queries.

Choose weights using a separate development collection. If you keep changing them until a few favourite questions look good, the search can get worse for other task types. So hold back an unchanged evaluation set for the final comparison.

Keep the source collection unchanged while you tune thresholds. If a document changes or a permission is corrected between two runs, the score difference may not come from the setting under evaluation. Where appropriate, restore the earlier state, or rerun all compared variants against the new approved collection. That way you do not choose a configuration because of an apparent gain that actually comes from unrelated source maintenance.

Do not read thresholds as the probability of truth

A search score is not a universal probability that the later answer is correct. Values can differ between search methods, model versions and index configurations. So do not take over a cutoff from an example without checking its effect on your own collection.

Evaluate both rejected correct hits and admitted unsuitable hits, and with them missed answers as well as unsupported answers. A higher threshold can reduce irrelevant passages but exclude rare correct wordings, while a lower threshold can find more suitable sources and at the same time supply misleading context. The decision must fit the task and the intended behaviour for asking back or stopping, and this clarification or abstention path must be retained. Record this trade-off so that a later update does not silently shift the existing answer boundary.

15 / 16

Take the worksheet

Worksheet

Download the editable CSV table

QueryUseful signalCheck
Exact identifierLexical matchNo similar wrong code
Informal wordingSemantic matchCorrect rule
AbbreviationGlossary and contextIntended meaning
Exception-sensitive ruleComplete passageException retained
No supporting sourceEvidence absenceNo forced answer

Columns to fill in, in the file: Your value / observation, Owner, Next action.

Download the editable CSV table (CSV). Add your own values, owners and open actions. This worksheet contains no measured client results.

16 / 16

These modernagents guides cover related decisions about AI knowledge assistants:

For a workflow review, start with the task, systems involved and typical exceptions. Discuss it with modernagents.

ShareEmail

Related reading

AI knowledge assistants

Got a workflow like this?

Tell me about it. Honest take and a rough price, usually within a day.

Robert Van Ysendyck · Founder & Managing Director