In the print dialog, choose “Save as PDF”.
Adservio

Semantic Search and Information Retrieval with Transformers

Semantic search in 2026: embeddings, cosine similarity, the retriever + reranker duo, vector databases and hybrid search for building an accurate RAG at scale.

ADSERVIO INSIGHTS · GENAI

CATEGORYGenAI
READING TIME7 min
DATE8 November 2025
FORMATAdservio Insights article
CONTACThello@adservio.fr

KEY POINTS

  • Semantic search understands the meaning of a query, beyond simple keyword matching, using vector embeddings.
  • A retriever (Sentence Transformer) quickly selects a large set of candidates; a cross-encoder reranker then refines that subset.
  • Vector databases and approximate indexes (HNSW, IVF) make this pipeline viable on corpora of millions of documents.
  • Hybrid search, combining semantic similarity with lexical matching (BM25), corrects the blind spots of pure vector search.
  • This retrieval layer directly determines the quality of RAG systems and enterprise conversational assistants.

SECTION 1

What is semantic search?

Semantics means understanding the context, the meaning of language. Semantic search refers to search that doesn't rely solely on keyword matching, but also understands the meaning of the query and of the documents from which the required text needs to be retrieved.

The better our models can understand the semantics of language, the more effectively our query will be resolved, with the model able to retrieve relevant text within documents, even when the query and the relevant document share no words in common.

Semantic search plays an important role in various business applications and technical use cases, including search engines, e-commerce platforms like Amazon, internal knowledge bases, and, since the rise of large language models, the retrieval-augmented generation (RAG) systems that power nearly every enterprise conversational assistant in 2026.

SECTION 2

How semantic search works: from embeddings to vector similarity

### Representing text as vectors

The core idea behind semantic search is to develop embeddings of text, sentences, paragraphs or whole documents, and store them as a collection of high-dimensional numeric vectors, typically between 384 and 3072 dimensions depending on the model used. These vectors are built so that two texts close in meaning end up close in vector space, regardless of the exact vocabulary used.

At inference time, when a query is given as input, it is embedded with the same model used to index the documents, and the system then looks for the semantically closest text.

### Measuring similarity

Cosine similarity is the most commonly used metric to quantify this semantic closeness: it measures the angle between two vectors rather than their raw distance, which makes it robust to variations in text length. Other metrics, Euclidean distance, dot product, are sometimes preferred depending on the embedding model and how it was trained and normalized.

However, there's more to it than that: raw embedding quality alone isn't enough to guarantee good results at scale. This is where retrieval systems and rerankers come into play.

SECTION 3

Retrieval and reranking: the retriever-reranker duo

### The retriever: fast and broad

Searching a large text corpus can be slow and computationally expensive. To optimize this process and make it efficient, we need both a retriever and a reranker, which play complementary roles and don't operate at the same computational cost.

The retriever converts the query and the entire corpus into vectors. These embeddings are typically developed using Sentence Transformer models (bi-encoder architecture), which encode the query and each document independently, allowing document embeddings to be pre-computed and indexed once, offline. At query time, the retrieval system computes similarity between the query and the index, and quickly produces a large set of candidate results, for example the top 50 or 100 nearest documents.

### The reranker: precise and costly

Some documents show up in the retriever's results without being truly relevant to the query, that's the price paid for the speed of a bi-encoder, which never directly compares the query and the document word by word. That's why reranking that output matters.

A cross-encoder-based reranker significantly improves the final results. The query and a candidate document are passed simultaneously into the transformer network, which then produces a single score between 0 and 1 indicating how relevant the document is to the given query. This joint computation is more expensive than a simple vector dot product, which is why the cross-encoder is only applied to the small subset already filtered by the retriever, never to the whole corpus.

From the reranker, we thus obtain a much smaller subset of candidate documents that are genuinely relevant to the query. There are many Sentence Transformer models trained on large datasets sourced from real search queries, as well as multiple families of cross-encoders specialized by domain or language, which can be used for retrieval and reranking respectively.

SECTION 4

Vector databases and indexing at scale

### Exact search versus approximate search

Computing exact cosine similarity between a query and millions of documents quickly becomes impractical in production. Vector databases solve this with approximate nearest neighbor (ANN) search algorithms, which trade a tiny amount of accuracy for a speed gain of several orders of magnitude. HNSW (Hierarchical Navigable Small World) and IVF (Inverted File Index) are the two most widely used index families in 2026, often combined with vector quantization to reduce memory footprint.

### Choosing a vector database

The choice usually comes down to specialized vector databases, extensions bolted onto an existing relational database, and managed offerings integrated into cloud platforms. Selection criteria are less about raw performance, now comparable across mature solutions, and more about integration with the rest of the data stack, metadata filtering capabilities, and operating cost at the scale of the target corpus.

SECTION 5

Hybrid search: combining semantic and lexical matching

Pure vector search has a known blind spot: it can miss an exact match on an identifier, a product reference, a business acronym or a rare proper noun, precisely because it favors general meaning over the exact word. Hybrid search corrects this by combining the scores of a classic lexical engine, typically BM25, the direct descendant of TF-IDF, with vector search scores, then merging the two rankings through a weighting scheme or a fusion method such as Reciprocal Rank Fusion.

In practice, most enterprise retrieval architectures deployed in 2026 are hybrid by default: they combine a lexical index, a vector index and a reranking step, with adjustable weights depending on the business domain, more lexical weight on legal or regulatory corpora rich in precise references, more semantic weight on conversational or customer-support corpora.

@cite:quatre-techniques-de-recuperation-pour-ameliorer-la-rag

SECTION 6

Business use cases and the limits of semantic search

### Use cases

Semantic search now powers a wide range of use cases: internal enterprise search engines, e-commerce platforms for product search and recommendations, customer support augmented by knowledge-base search, and above all the retrieval layer of RAG systems that let a conversational assistant answer by drawing on proprietary documents rather than on the model's parametric knowledge alone.

### Limits and pitfalls

Semantic search isn't without limits. Chunking quality, how documents are split before indexing, often has more impact on final results than the choice of embedding model itself. Poor chunking can split a relevant piece of information across two fragments, each too unspecific to be retrieved. Embedding model bias, drift between the training domain and the application domain, and the cost of reindexing when switching models are other common pitfalls encountered in production.

@cite:comment-construire-une-base-de-connaissances-prete-pour-l-ia

SECTION 7

Semantic search and RAG in 2026: the state of the art

In 2026, the retrieval foundation described here, embeddings, retriever, reranker, hybrid index, remains the backbone of nearly every production RAG architecture, despite the continued growth of large language models' context windows. Targeted retrieval remains more economical, faster and often more reliable than dumping raw documents wholesale into a model's context, particularly on large or fast-changing corpora.

Systematically evaluating this pipeline, retriever precision and recall, perceived relevance of the reranking, quality of the final generated answer, has become a step in its own right in the lifecycle of a RAG system, on par with evaluating the generation model itself.

@cite:comment-evaluer-un-systeme-llm

FAQ

Frequently asked questions

What's the difference between a retriever and a reranker?

The retriever (bi-encoder) converts the query and documents into vectors and quickly computes cosine similarity to extract a large set of candidates, for example the top 50 results. The reranker, based on a cross-encoder, then re-analyzes each query/document pair to refine that subset and keep only the genuinely relevant documents, at the cost of a more expensive computation, reserved for that small subset.

Why combine semantic search with lexical search?

Pure vector search can miss an exact match on an identifier, an acronym or a rare proper noun because it favors general meaning. Hybrid search combines the scores of a lexical engine like BM25 with vector search scores, which corrects this blind spot and improves result robustness, particularly on corpora rich in precise references.

Why does semantic search still matter as LLM context windows keep growing?

Even with extended context windows, feeding an entire large corpus into every request remains more expensive, slower and often less reliable than targeted retrieval. The retriever + reranker duo therefore remains the foundation of most production RAG architectures in 2026.

ABOUT ADSERVIO

Adservio is an AI-native digital transformation partner: AI-augmented IT departments, software engineering, DevOps, MLOps, cybersecurity and AI governance.

Let's talk about your project: hello@adservio.fr · adservio.fr/contact