<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Reranker on lo0 — Tech Blog</title><link>https://blog.lo0.es/en/tags/reranker/</link><description>Recent content in Reranker on lo0 — Tech Blog</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Thu, 11 Jun 2026 09:40:00 +0000</lastBuildDate><atom:link href="https://blog.lo0.es/en/tags/reranker/index.xml" rel="self" type="application/rss+xml"/><item><title>Serving embeddings and rerankers with TEI in production</title><link>https://blog.lo0.es/en/posts/serving-embeddings-rerankers-tei-production/</link><pubDate>Thu, 11 Jun 2026 09:40:00 +0000</pubDate><guid>https://blog.lo0.es/en/posts/serving-embeddings-rerankers-tei-production/</guid><description>&lt;blockquote>
&lt;p>Sixth piece in an operational series about squeezing a generic on-premise LLM cluster of &lt;strong>4×H100 SXM 80 GB&lt;/strong>. If &lt;a href="https://blog.lo0.es/en/posts/rag-cpu-data-plane-generation-plane/">RAG on the CPU&lt;/a> argued &lt;em>where&lt;/em> the data plane runs and &lt;a href="https://blog.lo0.es/en/posts/embeddings-2026-dense-sparse-multivector-families/">the embedder zoo&lt;/a> decided &lt;em>which model&lt;/em> you serve, this post looks at &lt;em>the engine&lt;/em> that serves them: the embeddings and rerankers server. The sisters in this batch, &lt;a href="https://blog.lo0.es/en/posts/end-to-end-document-ingestion-pdf-to-indexed-chunk/">document ingestion from PDF to indexed chunk&lt;/a>, &lt;a href="https://blog.lo0.es/en/posts/gitops-inference-stack-flux/">GitOps for the inference stack with Flux&lt;/a> and &lt;a href="https://blog.lo0.es/en/posts/hardening-secrets-sovereign-llm-stack-defence-in-depth/">hardening and secrets for the sovereign stack&lt;/a>, build the rest of the system around this piece. The closer of the series, the end-to-end sovereign assistant with LibreChat + LiteLLM + RAG, is still in draft.&lt;/p>
&lt;/blockquote>
&lt;h2 id="tldr">TL;DR&lt;/h2>
&lt;p>Serving embeddings is not &lt;code>model.encode(text)&lt;/code> scattered through the ingestion code. Just as you do not put a &lt;code>transformers.generate()&lt;/code> inside your API and call it vLLM, you do not put the embedder inline either: you put it &lt;strong>behind a dedicated server&lt;/strong> that does batching, controls concurrency, emits metrics and exposes a single HTTP contract that both ingestion and query-time reuse. In the 2026 open source ecosystem that server is &lt;strong>TEI, Text Embeddings Inference&lt;/strong> from Hugging Face: a Rust binary that serves embedding, reranker (cross-encoder) and sequence classification models, with &lt;strong>token-based dynamic batching&lt;/strong>, and that exposes OpenAI-compatible endpoints (&lt;code>/v1/embeddings&lt;/code>) on top of the native &lt;code>/embed&lt;/code>, &lt;code>/embed_sparse&lt;/code>, &lt;code>/rerank&lt;/code> and &lt;code>/predict&lt;/code> (&lt;a href="https://github.com/huggingface/text-embeddings-inference">TEI repo&lt;/a>, &lt;a href="https://huggingface.co/docs/text-embeddings-inference">docs&lt;/a>). It runs on CPU (ONNX Runtime, Intel MKL) and on CUDA (with FlashAttention and cuda graphs), with the same contract on both sides, so the rest of the system does not know, or care, what silicon sits behind it. The technical piece that gives almost all the performance is dynamic batching: TEI groups requests that arrive separately into a batch that shares the fixed cost of the forward, controlled by &lt;code>--max-batch-tokens&lt;/code> (how many tokens fit per batch) and &lt;code>--max-concurrent-requests&lt;/code> (backpressure). Grouping raises throughput, going from serving 1 sequence to 32 multiplies tokens/s at almost constant cost until the hardware saturates, in exchange for some latency while the tray fills. The numbers: a 568M encoder (&lt;code>bge-m3&lt;/code>, &lt;code>bge-reranker-v2-m3&lt;/code>) takes ~1.1 GB in fp16 and ~0.57 GB in int8, so several replicas fit even in a small H100 slice; embedding a short query online costs tens of ms, but reranking the top-50 costs &lt;strong>linearly in candidates&lt;/strong> because a cross-encoder evaluates each (query, doc) pair separately. The split across the 4×H100 cluster: TEI-CPU on the fleet for batch ingestion (no SLA, throughput/€), TEI-GPU in a MIG slice of one H100 for high-QPS online embeddings and rerank, talking to ingestion and to the LiteLLM gateway through the OpenAI contract.&lt;/p>
&lt;h2 id="the-analogy-the-stamping-press-that-only-stamps-vectors">The analogy: the stamping press that only stamps vectors&lt;/h2>
&lt;p>Picture a workshop with a specialised &lt;strong>stamping press&lt;/strong>. It does not make varied parts; it does one single thing: it takes flat material and, in one stroke, stamps a shape into it. In our case it takes text and stamps a vector. And like every industrial press, it has one property that defines all its behaviour: &lt;strong>the cost of the stroke is almost fixed&lt;/strong>, no matter how much material you put on the tray.&lt;/p>
&lt;p>Lowering the press, heating the die, aligning, pressing and lifting costs, say, one second. If you put a single sheet in, you spend that whole second stamping one part: a waste. If you fill the tray with thirty sheets and lower the press once, you spend nearly the same second and come out with thirty stamped parts. The cost per part collapses. The press &lt;strong>performs far better when it fills the tray before pressing&lt;/strong>.&lt;/p>
&lt;p>This is exactly the &lt;strong>dynamic batching&lt;/strong> of an embeddings server. The &amp;ldquo;stroke&amp;rdquo; is the model&amp;rsquo;s forward pass on the GPU or the CPU: an operation that loads the weights, multiplies them by the activations and emits the vectors, with a large fixed cost that does not scale with how many sequences you process at once, until you saturate memory bandwidth or the compute units. Serving requests one at a time is stamping one sheet per stroke. Grouping them into a batch is filling the tray.&lt;/p>
&lt;p>But the press has an operational dilemma, and here is the heart of the post. If you wait until the tray is completely full before pressing, the first sheets that arrived sit waiting for the rest: &lt;strong>latency&lt;/strong>. If you press as soon as one sheet drops so nobody has to wait, you go back to the waste of one stroke per part: &lt;strong>low throughput&lt;/strong>. The embeddings server solves this with a &lt;strong>bounded wait window&lt;/strong>: it gathers whatever arrives within a window of microseconds to milliseconds, or until the batch token budget is full, and then it presses. That is the policy that turns a pile of independent requests into a few efficient strokes without anyone waiting too long.&lt;/p>
&lt;p>The rest of the post is, at bottom, about configuring that press properly: how many sheets fit on the tray (&lt;code>max-batch-tokens&lt;/code>), how much queue is tolerated before work is rejected (&lt;code>max-concurrent-requests&lt;/code>), whether the press lives on the cheap CPU fleet (nightly ingestion, pure throughput) or in a slice of the expensive GPU (online, bounded latency), and why the reranker is a different press whose cost does grow with the number of parts.&lt;/p>
&lt;h2 id="what-tei-is-exactly">What TEI is, exactly&lt;/h2>
&lt;p>&lt;strong>Text Embeddings Inference (TEI)&lt;/strong> is Hugging Face&amp;rsquo;s inference server for the family of models that &lt;strong>does not generate tokens&lt;/strong>: embedders, cross-encoder rerankers and sequence classifiers. It is to encoders what vLLM is to generative LLMs: a high-performance server, written in Rust, that handles tokenisation, batching, concurrency, metrics and the HTTP contract, leaving the application code to only make calls (&lt;a href="https://github.com/huggingface/text-embeddings-inference">TEI repo&lt;/a>).&lt;/p>
&lt;p>Three model types, three jobs:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Embedding&lt;/strong> (bi-encoder): turns a text into a reusable vector. &lt;code>bge-m3&lt;/code>, &lt;code>Snowflake Arctic Embed&lt;/code>, &lt;code>multilingual-e5&lt;/code>. The vector is stored in the index and reused on every search.&lt;/li>
&lt;li>&lt;strong>Reranker&lt;/strong> (cross-encoder): takes a pair (query, document) and emits a relevance score, not a vector. &lt;code>bge-reranker-v2-m3&lt;/code>. It produces nothing reusable: every pair is evaluated again.&lt;/li>
&lt;li>&lt;strong>Sequence classification&lt;/strong>: emits labels/probabilities over a text. Useful for lightweight guardrails, routing, language or toxicity detection.&lt;/li>
&lt;/ul>
&lt;h3 id="the-endpoints">The endpoints&lt;/h3>
&lt;p>TEI exposes both an &lt;strong>OpenAI-compatible&lt;/strong> endpoint and its native endpoints, verified against the current documentation (&lt;a href="https://huggingface.co/docs/text-embeddings-inference/quick_tour">Quick Tour&lt;/a>, &lt;a href="https://deepwiki.com/huggingface/text-embeddings-inference">DeepWiki&lt;/a>):&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Endpoint&lt;/th>
&lt;th>What for&lt;/th>
&lt;th>Model type&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;strong>&lt;code>/v1/embeddings&lt;/code>&lt;/strong>&lt;/td>
&lt;td>Embeddings with the &lt;strong>OpenAI contract&lt;/strong> (drop-in for clients that already speak OpenAI)&lt;/td>
&lt;td>embedder&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>/embed&lt;/code>&lt;/td>
&lt;td>Dense embeddings, TEI&amp;rsquo;s native API&lt;/td>
&lt;td>embedder&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>/embed_sparse&lt;/code>&lt;/td>
&lt;td>Sparse embeddings (lexical head of models like &lt;code>bge-m3&lt;/code>/SPLADE)&lt;/td>
&lt;td>embedder&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>/rerank&lt;/code>&lt;/td>
&lt;td>Orders a list of texts by relevance against a query&lt;/td>
&lt;td>reranker (cross-encoder)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>/predict&lt;/code>&lt;/td>
&lt;td>Sequence classification (labels/scores)&lt;/td>
&lt;td>classifier&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>/embed_all&lt;/code>&lt;/td>
&lt;td>Per-token embeddings (no pooling)&lt;/td>
&lt;td>embedder&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>/similarity&lt;/code>&lt;/td>
&lt;td>Direct similarity between texts&lt;/td>
&lt;td>embedder&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>/metrics&lt;/code>, &lt;code>/health&lt;/code>, &lt;code>/info&lt;/code>, &lt;code>/tokenize&lt;/code>, &lt;code>/decode&lt;/code>&lt;/td>
&lt;td>Operation, observability and utilities&lt;/td>
&lt;td>all&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>The operational key is in the first row: TEI speaking the OpenAI contract on &lt;code>/v1/embeddings&lt;/code> means the embedder is &lt;strong>swappable without touching client code&lt;/strong>. The same code that called OpenAI&amp;rsquo;s &lt;code>text-embedding-3-large&lt;/code> points at your on-prem TEI by changing the &lt;code>base_url&lt;/code>, and the gateway (&lt;a href="https://blog.lo0.es/en/posts/choosing-oss-gateway-llm-inference/">LiteLLM&lt;/a>) routes it as one more provider. &lt;code>/rerank&lt;/code>, by contrast, is not part of the OpenAI standard, no such endpoint exists in their API, so the gateway treats it as a reranking-specific endpoint (&lt;a href="https://github.com/BerriAI/litellm/issues/8372">LiteLLM TEI rerank&lt;/a>).&lt;/p>
&lt;h3 id="the-backends">The backends&lt;/h3>
&lt;p>TEI runs on CPU and on GPU with the same HTTP contract, which is exactly the property the &lt;a href="https://blog.lo0.es/en/posts/rag-cpu-data-plane-generation-plane/">CPU/GPU split of RAG&lt;/a> needs (&lt;a href="https://huggingface.co/docs/text-embeddings-inference/index">TEI docs, hardware&lt;/a>):&lt;/p>
&lt;ul>
&lt;li>CPU: &lt;code>cpu-*&lt;/code> image. ONNX Runtime (recommended) or Intel MKL backend. It exploits the integer compute paths (AVX-512+VNNI, AMX on 4th-gen Xeon) when the model is in int8. It is the batch ingestion engine.&lt;/li>
&lt;li>CUDA: architecture-specific images (&lt;code>cuda-*&lt;/code>, with variants for different compute capabilities). It uses FlashAttention and cuda graphs to squeeze the GPU. It requires compute capability ≥ 7.5 (Volta is out) and CUDA 12.2+ compatible drivers. It is the high-QPS online engine.&lt;/li>
&lt;li>There is also Metal support (Apple Silicon) and experimental ROCm (AMD Instinct), less relevant to the on-prem case of this post.&lt;/li>
&lt;/ul>
&lt;p>The golden rule: &lt;strong>the same &lt;code>bge-m3&lt;/code> served by TEI-CPU and by TEI-GPU exposes an identical &lt;code>/v1/embeddings&lt;/code>&lt;/strong>. The client does not notice the silicon. That is what lets you put ingestion on CPU and online on GPU without rewriting anything.&lt;/p>
&lt;h2 id="why-a-dedicated-server-and-not-calling-the-model-inline">Why a dedicated server and not calling the model inline&lt;/h2>
&lt;p>The temptation, especially in the prototype, is to load the embedder into the application process and call &lt;code>model.encode()&lt;/code> directly. It works in the demo and breaks in production for five reasons, all solved by the dedicated server:&lt;/p>
&lt;ol>
&lt;li>
&lt;p>&lt;strong>Batching.&lt;/strong> Your ingestion code processes documents; your query code embeds one query at a time. Inline, each &lt;code>encode()&lt;/code> is an independent forward, one press stroke per sheet. A dedicated server joins requests from different origins (ingestion + several concurrent queries) into a single batch and amortises the fixed cost. This is what really multiplies throughput, and you cannot do it if the model lives inside each isolated process.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Concurrency and backpressure.&lt;/strong> Under load, what happens when 10,000 requests arrive at once? Inline, you run out of memory or queue without control. TEI has &lt;code>--max-concurrent-requests&lt;/code>: above that limit it rejects instead of degrading everyone, which is the correct way to manage overload (&lt;a href="https://github.com/huggingface/text-embeddings-inference/blob/main/docs/source/en/cli_arguments.md">TEI CLI args&lt;/a>).&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Metrics.&lt;/strong> TEI exposes &lt;code>/metrics&lt;/code> in Prometheus format: latencies, batch size, tokens/s, queued requests. Inline you have none of this without hand-instrumenting every &lt;code>encode()&lt;/code>. To &lt;a href="https://blog.lo0.es/en/posts/gpu-observability-llm-inference-twelve-dcgm-vllm-metrics/">observe the data plane&lt;/a> you need that endpoint.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>A reusable HTTP contract.&lt;/strong> The same server is consumed by batch ingestion, by online query-time and by any other service that needs vectors. One copy of the model in memory, one version point, one place to change the model. Inline, each service loads its own copy and the version drifts on its own.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Lifecycle separation.&lt;/strong> The embedder is updated, restarted or scaled without touching the application. If tomorrow you swap &lt;code>bge-m3&lt;/code> for &lt;code>Snowflake Arctic&lt;/code>, you change the server container, not the code of N services. (Remember the &lt;a href="https://blog.lo0.es/en/posts/embeddings-2026-dense-sparse-multivector-families/">embedder drift&lt;/a> trap: changing embedder forces a reindex; having a single server makes that change atomic and auditable.)&lt;/p>
&lt;/li>
&lt;/ol>
&lt;p>It is the same argument for why nobody serves an LLM with &lt;code>transformers.generate()&lt;/code> in production: you serve it with a dedicated engine. The embedder is no different.&lt;/p>
&lt;h2 id="dynamic-batching-the-mechanics-of-the-press">Dynamic batching: the mechanics of the press&lt;/h2>
&lt;p>Here is the performance engine. TEI does &lt;strong>token-based dynamic batching&lt;/strong>: instead of processing requests one at a time or grouping them by a fixed number of requests, it groups them by token budget (&lt;a href="https://github.com/huggingface/text-embeddings-inference/blob/main/README.md">TEI README&lt;/a>, &lt;a href="https://github.com/huggingface/text-embeddings-inference/discussions/367">Discussion #367&lt;/a>).&lt;/p>
&lt;p>Two knobs rule:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>&lt;code>--max-batch-tokens&lt;/code>&lt;/strong> (the default depends on the build, typically 16384): the total tokens that fit in a batch. With &lt;code>max-batch-tokens=1000&lt;/code> you get 10 requests of 100 tokens, or one of 1000. The docs say it clearly: this number &lt;em>should be as large as possible until the model becomes compute-bound&lt;/em>. It is the size of the press tray, &lt;strong>measured in tokens, not in parts&lt;/strong>, because the real cost scales with tokens, not with number of texts.&lt;/li>
&lt;li>&lt;strong>&lt;code>--max-concurrent-requests&lt;/code>&lt;/strong> (default 512): how many requests it admits in flight before rejecting. It is the backpressure control, not the batching one: it protects against surges by returning an error instead of queuing indefinitely.&lt;/li>
&lt;/ul>
&lt;p>The policy: TEI keeps an internal queue. When there is work, it fills a batch up to the &lt;code>max-batch-tokens&lt;/code> budget (or until there are no more requests waiting) and sends it to the model in one stroke. Requests that arrive while the previous batch is being processed wait in the queue and go into the next one. Watch out for a real operational detail: if &lt;code>max-batch-tokens&lt;/code> is smaller than the model&amp;rsquo;s maximum input length, you can trigger a loop where a long request never fits into a batch (&lt;a href="https://github.com/huggingface/text-embeddings-inference/issues/723">Issue #723&lt;/a>); the token budget has to be at least as large as the longest sequence you accept.&lt;/p>
&lt;h3 id="the-number-throughput-with-batching-vs-without-batching">The number: throughput with batching vs without batching&lt;/h3>
&lt;p>Let us model the press. Let $C$ be the fixed cost of a forward pass (loading weights, launching kernels) and $c$ the marginal cost per sequence inside the batch. For a batch of size $B$, the stroke time is roughly:&lt;/p>
$$t(B) \approx C + c \cdot B$$
&lt;p>as long as the batch fits in the hardware (memory-bandwidth-bound, which is the normal regime of a small encoder on GPU). The throughput, sequences per second, is:&lt;/p>
$$\text{throughput}(B) = \frac{B}{t(B)} = \frac{B}{C + c \cdot B}$$
&lt;p>Let us put in concrete numbers, indicative but of the right order for &lt;code>bge-m3&lt;/code> (568M) on a GPU serving ~256-token sequences. Say $C = 4$ ms of fixed cost per stroke and $c = 0.5$ ms per marginal sequence.&lt;/p>
&lt;p>&lt;strong>Without batching&lt;/strong> ($B=1$):&lt;/p>
$$t(1) = 4 + 0.5 = 4.5 \text{ ms} \quad\Rightarrow\quad \text{throughput} = \frac{1}{4.5\text{ms}} \approx 222 \text{ sec/s}$$
&lt;p>&lt;strong>With batching&lt;/strong> ($B=32$):&lt;/p>
$$t(32) = 4 + 0.5 \times 32 = 20 \text{ ms} \quad\Rightarrow\quad \text{throughput} = \frac{32}{20\text{ms}} = 1600 \text{ sec/s}$$
&lt;p>The batch of 32 multiplies throughput by ~7.2× compared with serving one at a time, because the fixed cost $C$, which at $B=1$ was 89% of the time, is spread across 32. And the asymptotic limit, as $B \to \infty$, is $1/c = 2000$ sec/s: the press cannot go faster than its marginal cost, and we are already at 80% of that ceiling with $B=32$. Going up to $B=128$ would give ~1969 sec/s, a marginal improvement in exchange for a good deal more latency and memory. &lt;strong>Batching has diminishing returns&lt;/strong>: most of the gain is in going from 1 to a few dozen.&lt;/p>
&lt;p>The &lt;strong>latency trade-off&lt;/strong> is the other face. The request that arrived first in the batch of 32 does not see its response until the whole stroke finishes: it waits for the tray to fill plus the 20 ms of the forward. If the 32 requests arrived within a window of, say, 5 ms, the first request suffers ~5 ms of batching wait + 20 ms of compute = 25 ms of latency, against the 4.5 ms it would have had being served alone. The &lt;strong>p99 latency gets worse&lt;/strong>, that is the price of the full tray, but in exchange the system absorbs 7× more load with the same silicon. That is why the correct configuration &lt;strong>depends on the use case&lt;/strong>: in batch ingestion (no user waiting) you maximise &lt;code>max-batch-tokens&lt;/code> and latency does not matter; online (user waiting) you bound the wait window to keep p99 under control even at the cost of some throughput.&lt;/p>
&lt;div class="diagram" style="max-width:840px;margin:1.5rem auto;">
&lt;svg viewBox="0 0 840 380" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Dynamic batching in TEI: incoming requests, queue, token-based batch, forward, responses">
&lt;text x="420" y="24" text-anchor="middle" font-size="15" font-weight="700" fill="currentColor">Token-based dynamic batching in TEI&lt;/text>
&lt;text x="80" y="60" text-anchor="middle" font-size="12" font-weight="700" fill="currentColor">Requests&lt;/text>
&lt;text x="80" y="76" text-anchor="middle" font-size="10" fill="currentColor">arrive separately&lt;/text>
&lt;rect x="30" y="92" width="100" height="22" rx="4" fill="none" stroke="#3b82f6" stroke-width="1.2"/>
&lt;text x="80" y="107" text-anchor="middle" font-size="10" fill="currentColor">query A · 80 tok&lt;/text>
&lt;rect x="30" y="120" width="100" height="22" rx="4" fill="none" stroke="#3b82f6" stroke-width="1.2"/>
&lt;text x="80" y="135" text-anchor="middle" font-size="10" fill="currentColor">query B · 120 tok&lt;/text>
&lt;rect x="30" y="148" width="100" height="22" rx="4" fill="none" stroke="#3b82f6" stroke-width="1.2"/>
&lt;text x="80" y="163" text-anchor="middle" font-size="10" fill="currentColor">ingestion · 256 tok&lt;/text>
&lt;rect x="30" y="176" width="100" height="22" rx="4" fill="none" stroke="#3b82f6" stroke-width="1.2"/>
&lt;text x="80" y="191" text-anchor="middle" font-size="10" fill="currentColor">ingestion · 256 tok&lt;/text>
&lt;rect x="30" y="204" width="100" height="22" rx="4" fill="none" stroke="#3b82f6" stroke-width="1.2"/>
&lt;text x="80" y="219" text-anchor="middle" font-size="10" fill="currentColor">query C · 60 tok&lt;/text>
&lt;path d="M135,150 L185,150" stroke="currentColor" stroke-width="1.4" fill="none" marker-end="url(#tb)"/>
&lt;rect x="190" y="80" width="150" height="160" rx="6" fill="#f59e0b" opacity="0.12" stroke="#f59e0b" stroke-width="1.4"/>
&lt;text x="265" y="102" text-anchor="middle" font-size="12" font-weight="700" fill="currentColor">Internal queue&lt;/text>
&lt;text x="265" y="120" text-anchor="middle" font-size="10" fill="currentColor">fills the tray up to&lt;/text>
&lt;text x="265" y="134" text-anchor="middle" font-size="10" font-weight="700" fill="currentColor">max-batch-tokens&lt;/text>
&lt;rect x="210" y="146" width="110" height="18" rx="3" fill="none" stroke="#f59e0b" stroke-width="1"/>
&lt;rect x="210" y="168" width="110" height="18" rx="3" fill="none" stroke="#f59e0b" stroke-width="1"/>
&lt;rect x="210" y="190" width="110" height="18" rx="3" fill="none" stroke="#f59e0b" stroke-width="1"/>
&lt;text x="265" y="226" text-anchor="middle" font-size="10" font-style="italic" fill="currentColor">bounded window or full budget&lt;/text>
&lt;path d="M345,160 L395,160" stroke="currentColor" stroke-width="1.4" fill="none" marker-end="url(#tb)"/>
&lt;text x="370" y="152" text-anchor="middle" font-size="9" fill="currentColor">batch&lt;/text>
&lt;rect x="400" y="110" width="180" height="100" rx="6" fill="#ef4444" opacity="0.10" stroke="#ef4444" stroke-width="1.6"/>
&lt;text x="490" y="134" text-anchor="middle" font-size="12" font-weight="700" fill="currentColor">ONE forward pass&lt;/text>
&lt;text x="490" y="152" text-anchor="middle" font-size="10" fill="currentColor">GPU (CUDA, FlashAttn)&lt;/text>
&lt;text x="490" y="166" text-anchor="middle" font-size="10" fill="currentColor">or CPU (ONNX/AMX int8)&lt;/text>
&lt;text x="490" y="184" text-anchor="middle" font-size="10" font-weight="700" fill="currentColor">cost C + c·B&lt;/text>
&lt;text x="490" y="200" text-anchor="middle" font-size="9" font-style="italic" fill="currentColor">"one press stroke"&lt;/text>
&lt;path d="M585,160 L635,160" stroke="currentColor" stroke-width="1.4" fill="none" marker-end="url(#tb)"/>
&lt;text x="730" y="100" text-anchor="middle" font-size="12" font-weight="700" fill="currentColor">Responses&lt;/text>
&lt;rect x="660" y="112" width="140" height="20" rx="4" fill="none" stroke="#22c55e" stroke-width="1.2"/>
&lt;text x="730" y="126" text-anchor="middle" font-size="10" fill="currentColor">vector A&lt;/text>
&lt;rect x="660" y="138" width="140" height="20" rx="4" fill="none" stroke="#22c55e" stroke-width="1.2"/>
&lt;text x="730" y="152" text-anchor="middle" font-size="10" fill="currentColor">vector B&lt;/text>
&lt;rect x="660" y="164" width="140" height="20" rx="4" fill="none" stroke="#22c55e" stroke-width="1.2"/>
&lt;text x="730" y="178" text-anchor="middle" font-size="10" fill="currentColor">ingestion vectors&lt;/text>
&lt;rect x="660" y="190" width="140" height="20" rx="4" fill="none" stroke="#22c55e" stroke-width="1.2"/>
&lt;text x="730" y="204" text-anchor="middle" font-size="10" fill="currentColor">vector C&lt;/text>
&lt;line x1="30" y1="270" x2="800" y2="270" stroke="currentColor" stroke-width="0.8"/>
&lt;text x="30" y="292" font-size="11" font-weight="700" fill="currentColor">The trade-off:&lt;/text>
&lt;text x="30" y="312" font-size="11" fill="currentColor">large batch → high throughput (fixed cost C spread over B) but worse p99 (the 1st waits for the fill)&lt;/text>
&lt;text x="30" y="330" font-size="11" fill="currentColor">batch=1 → minimum latency per request but dreadful throughput (one stroke per sheet)&lt;/text>
&lt;text x="30" y="352" font-size="11" font-style="italic" fill="currentColor">Ingestion: maximise max-batch-tokens. Online: bound the wait window to protect p99.&lt;/text>
&lt;defs>&lt;marker id="tb" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto">&lt;path d="M0,0 L10,5 L0,10 z" fill="currentColor"/>&lt;/marker>&lt;/defs>
&lt;/svg>
&lt;/div>
&lt;h2 id="deployment-compose-for-embedder-and-reranker">Deployment: compose for embedder and reranker&lt;/h2>
&lt;p>TEI is deployed as a container. The key arguments: &lt;code>--model-id&lt;/code> (the model from the Hub), &lt;code>--pooling&lt;/code> (how it aggregates tokens into the vector: &lt;code>cls&lt;/code>, &lt;code>mean&lt;/code>, &lt;code>splade&lt;/code>, &lt;code>last-token&lt;/code>), &lt;code>--dtype&lt;/code> (precision), and the batching knobs already seen. Two separate services, since the embedder and the reranker are &lt;strong>different models and different endpoints&lt;/strong>, each with its own container.&lt;/p>
&lt;h3 id="embedder-bge-m3-on-gpu">Embedder (&lt;code>bge-m3&lt;/code>) on GPU&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="c"># docker-compose: TEI serving bge-m3 as an embedder, on GPU&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">services&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">tei-embed&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">image&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">ghcr.io/huggingface/text-embeddings-inference:cuda-1.9&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">command&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- --&lt;span class="l">model-id=BAAI/bge-m3&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- --&lt;span class="l">pooling=cls&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- --&lt;span class="l">dtype=float16&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">--max-batch-tokens=16384 # big tray&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">the press performs&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">--max-concurrent-requests=512 # backpressure&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">reject above this&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">ports&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;8081:80&amp;#34;&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">volumes&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;./hf-cache:/data&amp;#34;&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">deploy&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">resources&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">reservations&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">devices&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>{&lt;span class="nt">driver: nvidia, count: 1, capabilities&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="l">gpu]}]&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="c"># exposes /v1/embeddings (OpenAI), /embed, /embed_sparse, /metrics&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="reranker-bge-reranker-v2-m3-on-gpu">Reranker (&lt;code>bge-reranker-v2-m3&lt;/code>) on GPU&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">tei-rerank&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">image&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">ghcr.io/huggingface/text-embeddings-inference:cuda-1.9&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">command&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- --&lt;span class="l">model-id=BAAI/bge-reranker-v2-m3 &lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># cross-encoder, ~568M&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- --&lt;span class="l">dtype=float16&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- --&lt;span class="l">max-batch-tokens=16384&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- --&lt;span class="l">max-concurrent-requests=256&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">ports&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;8082:80&amp;#34;&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">volumes&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;./hf-cache:/data&amp;#34;&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">deploy&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">resources&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">reservations&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">devices&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>{&lt;span class="nt">driver: nvidia, count: 1, capabilities&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="l">gpu]}]&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="c"># exposes /rerank — invoked ONLY over top-k (20/50), not over hundreds&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;code>bge-reranker-v2-m3&lt;/code> is a &lt;strong>~568M cross-encoder&lt;/strong> built on &lt;code>bge-m3&lt;/code>, multilingual, that takes (query, document) and emits a relevance score directly, without producing a reusable vector (&lt;a href="https://huggingface.co/BAAI/bge-reranker-v2-m3">model card&lt;/a>, &lt;a href="https://bge-model.com/bge/bge_reranker_v2.html">BGE docs&lt;/a>). It carries no &lt;code>--pooling&lt;/code> because it emits no embedding: it emits a scalar.&lt;/p>
&lt;h3 id="cpu-for-batch-ingestion">CPU for batch ingestion&lt;/h3>
&lt;p>For the CPU fleet, it is enough to change the image and the dtype; the HTTP contract is identical:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">tei-embed-cpu&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">image&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">ghcr.io/huggingface/text-embeddings-inference:cpu-1.6&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">command&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- --&lt;span class="l">model-id=BAAI/bge-m3&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- --&lt;span class="l">pooling=cls&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- --&lt;span class="l">dtype=float16 &lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># on CPU, ONNX int8 if the export supports it&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">--max-batch-tokens=8192 # smaller tray&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">the CPU saturates sooner&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">ports&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;8083:80&amp;#34;&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">volumes&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;./hf-cache:/data&amp;#34;&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="c"># ONNX/MKL backend: exploits AVX-512+VNNI / AMX on 4th-gen Xeon&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Any OpenAI client embeds against the endpoint without knowing what is behind it:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-python" data-lang="python">&lt;span class="line">&lt;span class="cl">&lt;span class="kn">from&lt;/span> &lt;span class="nn">openai&lt;/span> &lt;span class="kn">import&lt;/span> &lt;span class="n">OpenAI&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">client&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">OpenAI&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">base_url&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s2">&amp;#34;http://tei-embed:80/v1&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">api_key&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s2">&amp;#34;-&amp;#34;&lt;/span>&lt;span class="p">)&lt;/span> &lt;span class="c1"># api_key ignored&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">r&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">client&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">embeddings&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">create&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">model&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s2">&amp;#34;BAAI/bge-m3&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="nb">input&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;user query&amp;#34;&lt;/span>&lt;span class="p">])&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">vec&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">r&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">data&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="mi">0&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">embedding&lt;/span> &lt;span class="c1"># same contract as OpenAI; the silicon is invisible&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>And the rerank, through its native (non-OpenAI) endpoint:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-python" data-lang="python">&lt;span class="line">&lt;span class="cl">&lt;span class="kn">import&lt;/span> &lt;span class="nn">requests&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">docs&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;retrieved chunk 1&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="s2">&amp;#34;retrieved chunk 2&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="s2">&amp;#34;...top-20 from retrieval...&amp;#34;&lt;/span>&lt;span class="p">]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">r&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">requests&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">post&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="s2">&amp;#34;http://tei-rerank:80/rerank&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">json&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="p">{&lt;/span>&lt;span class="s2">&amp;#34;query&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;user query&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="s2">&amp;#34;texts&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="n">docs&lt;/span>&lt;span class="p">})&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">ranked&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">r&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">json&lt;/span>&lt;span class="p">()&lt;/span> &lt;span class="c1"># [{index, score}, ...] ordered by relevance&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="integration-how-ingestion-and-the-gateway-consume-it">Integration: how ingestion and the gateway consume it&lt;/h2>
&lt;p>The TEI server has &lt;strong>two clients&lt;/strong> with opposite profiles, and that is precisely the reason to centralise it:&lt;/p>
&lt;p>&lt;strong>Ingestion&lt;/strong> (batch, no SLA) calls &lt;code>/v1/embeddings&lt;/code> or &lt;code>/embed&lt;/code> with &lt;strong>large lots&lt;/strong> of chunks. Here throughput is what matters: ingestion pushes thousands of texts and TEI groups them into large batches against the high &lt;code>max-batch-tokens&lt;/code>. It is the case of the press with a full tray. Ingestion then writes the vectors (dense + sparse) into the vector DB; the specific PDF-to-indexed-chunk pipeline is the sister piece of this series in preparation, and meanwhile the &lt;a href="https://blog.lo0.es/en/posts/postgresql-qdrant-rag-ingestion-postman-syncing-two-worlds/">PostgreSQL + Qdrant schema in microservices&lt;/a> covers the structure of the pipeline.&lt;/p>
&lt;p>&lt;strong>The gateway&lt;/strong> (query-time, online) consumes TEI through two different routes:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>Embedding the query&lt;/strong>: a single call to &lt;code>/v1/embeddings&lt;/code> with a short text. The gateway, &lt;a href="https://blog.lo0.es/en/posts/choosing-oss-gateway-llm-inference/">LiteLLM&lt;/a> or another L7 router, treats it as one more OpenAI embeddings provider, routed by model. That embedded query goes to the vector DB for the hybrid search.&lt;/li>
&lt;li>&lt;strong>Reranking the top-k&lt;/strong>: after retrieving 20-50 candidates from the retriever, the gateway calls &lt;code>/rerank&lt;/code> on the reranker server with the query and the candidate list, and keeps the best ones. Since &lt;code>/rerank&lt;/code> is not an OpenAI standard, LiteLLM exposes it through its own reranking contract (&lt;a href="https://github.com/BerriAI/litellm/issues/8372">LiteLLM rerank with TEI&lt;/a>).&lt;/li>
&lt;/ol>
&lt;p>The full query-time pattern: &lt;em>embed query (TEI dense) → search (vector DB, &lt;a href="https://blog.lo0.es/en/posts/reranker-hybrid-retrieval-five-chunks-llm-reads/">hybrid retrieval&lt;/a>) → rerank top-k (TEI rerank) → send query + top-5 to the LLM&lt;/em>. Two different TEI endpoints, one for dense and another for rerank, both behind the gateway, both swappable.&lt;/p>
&lt;h2 id="sizing-memory-replicas-and-latency-budget">Sizing: memory, replicas and latency budget&lt;/h2>
&lt;h3 id="footprint-of-a-568m-encoder">Footprint of a 568M encoder&lt;/h3>
&lt;p>The weight footprint of &lt;code>bge-m3&lt;/code> (568M params) depends only on precision:&lt;/p>
$$\text{fp16: } 568 \times 10^6 \times 2 \text{ B} \approx 1.14 \text{ GB} \qquad \text{int8: } 568 \times 10^6 \times 1 \text{ B} \approx 0.57 \text{ GB}$$
&lt;p>On top of this comes the space for the batch&amp;rsquo;s &lt;strong>temporary activations&lt;/strong> (proportional to &lt;code>max-batch-tokens&lt;/code> × hidden dimension) and, in TEI, the FlashAttention/cuda graphs structures. In practice, a &lt;code>bge-m3&lt;/code> in fp16 is served comfortably in &lt;strong>~6 GB of VRAM&lt;/strong> even at high batch, and in int8 on CPU the whole model (0.57 GB) fits in the cache and RAM of any server without blinking, activating the AMX/VNNI paths that make it viable, which is exactly the argument of &lt;a href="https://blog.lo0.es/en/posts/rag-cpu-data-plane-generation-plane/">RAG on the CPU&lt;/a>.&lt;/p>
&lt;p>&lt;strong>How many replicas fit?&lt;/strong> If we reserve a &lt;strong>10 GB&lt;/strong> slice of an H100 for serving embeddings online, with an effective footprint of ~2.5 GB per replica (fp16 weights + activations + overhead), around &lt;strong>3-4 replicas&lt;/strong> of &lt;code>bge-m3&lt;/code> fit in that slice, splitting the QPS between them. In int8 the footprint drops and more fit, at the cost of a full point of quality. For the reranker, the weight footprint is the same (568M), but its batch pattern is different (query-doc pairs), so it is worth sizing it separately.&lt;/p>
&lt;h3 id="latency-budget-short-query-vs-top-50-rerank">Latency budget: short query vs top-50 rerank&lt;/h3>
&lt;p>Here is the fundamental asymmetry between embedder and reranker, and it is what decides the sizing.&lt;/p>
&lt;p>&lt;strong>Embedding a short query&lt;/strong> (online): it is &lt;strong>one&lt;/strong> forward over a text of tens of tokens. On GPU, inside a dynamic batch, it is &lt;strong>tens of ms&lt;/strong> including the batching wait, the order of the earlier numerical example, ~5-25 ms. It is cheap and constant: a query is a query, no matter how many documents are in the corpus. That is why embedding online fits easily into an interactive latency budget.&lt;/p>
&lt;p>&lt;strong>Reranking the top-50&lt;/strong> (online): a cross-encoder does &lt;strong>not&lt;/strong> produce a reusable vector; it evaluates &lt;strong>every pair&lt;/strong> (query, document) in a forward. The cost is &lt;strong>linear in the number of candidates&lt;/strong>:&lt;/p>
$$\text{cost}_{\text{rerank}} \propto k \times \text{forward}(\text{query} + \text{doc})$$
&lt;p>Reranking a top-50 is &lt;strong>50 forwards&lt;/strong> of (query + doc) pairs, where each pair is longer than the query alone (query + ~256-token chunk). TEI groups them into batches, and batching helps again there, but the &lt;strong>total work&lt;/strong> is ~50× that of embedding one query. If embedding a query costs of the order of 10-20 ms, reranking 50 candidates costs of the order of &lt;strong>hundreds of ms&lt;/strong> depending on the batch and the hardware. Hence the operational rule repeated throughout the series: &lt;strong>broad, cheap recall in the retriever, precision rerank over FEW candidates&lt;/strong>. Reranking a top-20/50 fits in the online budget; reranking hundreds at high QPS does not, and that is where the reranker demands a dedicated GPU or a larger slice. The detail of why the cross-encoder is expensive but precise is in &lt;a href="https://blog.lo0.es/en/posts/reranker-hybrid-retrieval-five-chunks-llm-reads/">reranker and hybrid retrieval&lt;/a>.&lt;/p>
&lt;p>The query-time latency budget, added up:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Stage&lt;/th>
&lt;th>Typical cost (order)&lt;/th>
&lt;th>Scales with&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Embed query (TEI dense)&lt;/td>
&lt;td>~10-20 ms&lt;/td>
&lt;td>constant (1 short text)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Hybrid search (vector DB, HNSW+sparse)&lt;/td>
&lt;td>single-digit ms&lt;/td>
&lt;td>index size (sublinear)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Rerank top-k (TEI cross-encoder)&lt;/td>
&lt;td>~100-300 ms&lt;/td>
&lt;td>&lt;strong>linear in k&lt;/strong>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Generation (LLM, outside TEI)&lt;/td>
&lt;td>seconds&lt;/td>
&lt;td>output tokens&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>The reranker is the most expensive stage of the data plane, and the only one that scales badly with the width of retrieval. Size it as the critical component.&lt;/p>
&lt;h2 id="applied-to-the-generic-4h100-cluster">Applied to the generic 4×H100 cluster&lt;/h2>
&lt;p>Let us come down to the cluster of the series: &lt;strong>4×H100 SXM 80 GB&lt;/strong> plus a generic CPU fleet (Xeon with AMX, NUCs). TEI lives in &lt;strong>two places&lt;/strong> depending on the load profile, and the identical OpenAI contract is what makes each place swappable.&lt;/p>
&lt;p>&lt;strong>TEI-CPU on the fleet → batch ingestion.&lt;/strong> Re-embedding the corpus is throughput-bound work with no latency SLA: its place is the CPU fleet with &lt;code>bge-m3&lt;/code> in int8 (ONNX/AMX). Here you maximise &lt;code>max-batch-tokens&lt;/code> because nobody is waiting, and the press performs with the tray brimming. No H100 should spend a cycle reindexing a corpus that changes once a day, which is exactly the bad split that &lt;a href="https://blog.lo0.es/en/posts/rag-cpu-data-plane-generation-plane/">RAG on the CPU&lt;/a> takes apart. The CPU fleet scales horizontally and cheaply; the corpus is chopped up and spread across nodes.&lt;/p>
&lt;p>&lt;strong>TEI-GPU in a MIG slice → high-QPS online embeddings and rerank.&lt;/strong> Query-time has a latency SLA and, if the system serves many requests per second, it needs the GPU&amp;rsquo;s throughput and low latency. But a 568M encoder &lt;strong>does not deserve a whole H100&lt;/strong>: it takes ~2.5 GB effective, and leaving it 80 GB wastes 97% of the card. The right answer is a &lt;strong>MIG slice&lt;/strong>: partition an H100 into hardware-isolated instances and give TEI one of the small slices (a &lt;code>1g.10gb&lt;/code>, for example), leaving the large slices for generation or for other tenants. The online embedder and reranker live there, with memory and compute isolation guaranteed by the partitioning. The how of the partitioning, MIG, MPS, time-slicing and when to use each, is in &lt;a href="https://blog.lo0.es/en/posts/sharing-one-gpu-time-slicing-mps-mig/">sharing a GPU&lt;/a>; the reading for TEI is direct: &lt;strong>MIG gives the hard isolation that an online service with bounded latency wants&lt;/strong>, while batch ingestion on CPU does not even touch the GPU.&lt;/p>
&lt;p>The split, in one sentence: &lt;strong>ingestion squeezes throughput/€ on CPU with a full tray; online squeezes latency/QPS in a MIG slice of an H100; both speak the same &lt;code>/v1/embeddings&lt;/code> and &lt;code>/rerank&lt;/code>, so moving load from one side to the other is changing a URL in the gateway.&lt;/strong>&lt;/p>
&lt;p>If at some point you need a &lt;strong>7B embedder&lt;/strong> (gte-Qwen2, NV-Embed) whose quality &lt;code>bge-m3&lt;/code> cannot reach, that is no longer small-encoder work: it drags an LLM&amp;rsquo;s cost profile with it and is served where 7Bs are served, with vLLM &lt;code>--task embed&lt;/code> in a large GPU slice, not with TEI-CPU. But it is the occasional exception, not the base load.&lt;/p>
&lt;h2 id="conclusion">Conclusion&lt;/h2>
&lt;p>TEI is the stamping press of the RAG data plane: a specialised server that only stamps vectors and scores, and that &lt;strong>performs far better when it fills the tray before pressing&lt;/strong>. The technical piece that gives the performance is token-based dynamic batching, controlled by &lt;code>max-batch-tokens&lt;/code> and &lt;code>max-concurrent-requests&lt;/code>, with a clear trade-off between throughput and p99 latency that is resolved differently in ingestion (tray brimming, no SLA) and online (bounded window, p99 protected). The architectural virtue is the OpenAI-compatible contract on &lt;code>/v1/embeddings&lt;/code>, which makes the embedder swappable without touching code, plus the native &lt;code>/embed_sparse&lt;/code> and &lt;code>/rerank&lt;/code> endpoints for the sparse head of &lt;code>bge-m3&lt;/code> and for the &lt;code>bge-reranker-v2-m3&lt;/code> cross-encoder. The numbers drive the sizing: a 568M encoder fits in gigabytes, not tens of gigabytes, so several replicas live in a MIG slice; embedding a query is cheap and constant, but reranking is linear in candidates and is the critical stage of the latency budget. On the 4×H100 cluster, the right split is TEI-CPU for batch ingestion and TEI-GPU in a MIG slice for high-QPS online: two presses, two silicons, one contract.&lt;/p>
&lt;h2 id="see-also">See also&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/rag-cpu-data-plane-generation-plane/">Taking RAG to the CPU: separating the data plane from the generation plane&lt;/a> — why embeddings ingestion goes to the CPU fleet; TEI-CPU is the concrete engine of that plane.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/embeddings-2026-dense-sparse-multivector-families/">Embeddings in 2026: dense, sparse and multivector&lt;/a> — which model you serve with TEI and why &lt;code>bge-m3&lt;/code> is the multilingual default; this post serves what that one chooses.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/reranker-hybrid-retrieval-five-chunks-llm-reads/">Reranking and hybrid retrieval: fundamentals&lt;/a> — why the cross-encoder is expensive but precise, and the rule of reranking few candidates that sizes TEI&amp;rsquo;s &lt;code>/rerank&lt;/code>.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/mixed-nvidia-intel-environments-llm-inference/">Mixed NVIDIA + Intel environments: from the H100 cluster to the NUC&lt;/a> — the concrete hardware of the CPU fleet (Xeon AMX, NUC) where TEI-CPU runs for ingestion.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/semantic-cache-rag-receptionist-photographic-memory/">Semantic cache for RAG&lt;/a> — the layer that avoids calling TEI when the query has already been answered, saving even the cost of the online embedding.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/sharing-one-gpu-time-slicing-mps-mig/">Sharing a GPU: time-slicing, MPS and MIG&lt;/a> — the MIG partitioning where online TEI-GPU lives, coexisting with generation on the same H100.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/end-to-end-document-ingestion-pdf-to-indexed-chunk/">End-to-end document ingestion: from PDF to indexed chunk&lt;/a> — the pipeline that consumes TEI&amp;rsquo;s &lt;code>/v1/embeddings&lt;/code> to populate the index (sister piece).&lt;/li>
&lt;/ul>
&lt;h2 id="references">References&lt;/h2>
&lt;ul>
&lt;li>Hugging Face — &lt;em>Text Embeddings Inference (TEI)&lt;/em>, repo y docs (Rust, backends CPU ONNX/MKL y CUDA, endpoints OpenAI-compatibles). &lt;a href="https://github.com/huggingface/text-embeddings-inference">https://github.com/huggingface/text-embeddings-inference&lt;/a> · &lt;a href="https://huggingface.co/docs/text-embeddings-inference">https://huggingface.co/docs/text-embeddings-inference&lt;/a>&lt;/li>
&lt;li>Hugging Face — &lt;em>TEI Quick Tour&lt;/em> (endpoints &lt;code>/embed&lt;/code>, &lt;code>/embed_sparse&lt;/code>, &lt;code>/rerank&lt;/code>, &lt;code>/predict&lt;/code>, &lt;code>/v1/embeddings&lt;/code>). &lt;a href="https://huggingface.co/docs/text-embeddings-inference/quick_tour">https://huggingface.co/docs/text-embeddings-inference/quick_tour&lt;/a>&lt;/li>
&lt;li>Hugging Face — &lt;em>TEI CLI arguments&lt;/em> (&lt;code>--model-id&lt;/code>, &lt;code>--pooling&lt;/code>, &lt;code>--dtype&lt;/code>, &lt;code>--max-batch-tokens&lt;/code>, &lt;code>--max-concurrent-requests&lt;/code>). &lt;a href="https://github.com/huggingface/text-embeddings-inference/blob/main/docs/source/en/cli_arguments.md">https://github.com/huggingface/text-embeddings-inference/blob/main/docs/source/en/cli_arguments.md&lt;/a>&lt;/li>
&lt;li>Hugging Face — &lt;em>TEI README / Discussion #367&lt;/em> (token-based dynamic batching; semántica de &lt;code>max-batch-tokens&lt;/code>). &lt;a href="https://github.com/huggingface/text-embeddings-inference/blob/main/README.md">https://github.com/huggingface/text-embeddings-inference/blob/main/README.md&lt;/a> · &lt;a href="https://github.com/huggingface/text-embeddings-inference/discussions/367">https://github.com/huggingface/text-embeddings-inference/discussions/367&lt;/a>&lt;/li>
&lt;li>BAAI — &lt;em>BGE-M3 model card&lt;/em> (568M, XLM-RoBERTa, dense+sparse+colbert, MIT). &lt;a href="https://huggingface.co/BAAI/bge-m3">https://huggingface.co/BAAI/bge-m3&lt;/a>&lt;/li>
&lt;li>BAAI — &lt;em>bge-reranker-v2-m3 model card&lt;/em> (cross-encoder ~568M sobre bge-m3, multilingüe). &lt;a href="https://huggingface.co/BAAI/bge-reranker-v2-m3">https://huggingface.co/BAAI/bge-reranker-v2-m3&lt;/a> · &lt;a href="https://bge-model.com/bge/bge_reranker_v2.html">https://bge-model.com/bge/bge_reranker_v2.html&lt;/a>&lt;/li>
&lt;li>Chen, J., et al. &lt;em>BGE M3-Embedding&lt;/em>. arXiv:2402.03216. &lt;a href="https://arxiv.org/abs/2402.03216">https://arxiv.org/abs/2402.03216&lt;/a>&lt;/li>
&lt;li>BerriAI — &lt;em>LiteLLM: proveedor TEI para &lt;code>/rerank&lt;/code>&lt;/em>. &lt;a href="https://github.com/BerriAI/litellm/issues/8372">https://github.com/BerriAI/litellm/issues/8372&lt;/a>&lt;/li>
&lt;/ul></description></item><item><title>Taking RAG to the CPU: separating the data plane from the generation plane</title><link>https://blog.lo0.es/en/posts/rag-cpu-data-plane-generation-plane/</link><pubDate>Thu, 11 Jun 2026 03:20:00 +0000</pubDate><guid>https://blog.lo0.es/en/posts/rag-cpu-data-plane-generation-plane/</guid><description>&lt;blockquote>
&lt;p>Third piece in an operational series about squeezing a generic on-premise LLM cluster of &lt;strong>4×H100 SXM 80 GB&lt;/strong>. Its siblings: &lt;a href="https://blog.lo0.es/en/posts/sharing-one-gpu-time-slicing-mps-mig/">sharing one GPU between workloads&lt;/a> (time-slicing, MPS, MIG) and &lt;a href="https://blog.lo0.es/en/posts/serving-several-models-single-gpu-co-residency-swapping-sleep-mode/">serving several models on one GPU&lt;/a> (swap + sleep) attack the split &lt;em>inside&lt;/em> the GPU. This one attacks the split &lt;em>outside&lt;/em>: which parts of RAG never need to touch the GPU at all. The closing piece of the series, the end-to-end sovereign assistant (fourth instalment, in preparation), assembles the complete system where these pieces fit together.&lt;/p>
&lt;/blockquote>
&lt;h2 id="tldr">TL;DR&lt;/h2>
&lt;p>A RAG system is not one thing, it is three phases with opposing compute profiles, and putting them all on the GPU &amp;ldquo;because it is AI&amp;rdquo; is an allocation mistake. (1) &lt;strong>Build/ingest&lt;/strong>, embedding the corpus and building the index, is batch, throughput-bound work with no latency SLA: its natural home is the CPU. (2) &lt;strong>Query-time retrieval&lt;/strong>, embedding the query, HNSW search, RRF fusion, lightweight rerank, is mostly CPU, with caveats only for heavy reranking; vector search always ran on CPU, even in stacks sold as &amp;ldquo;GPU&amp;rdquo;. (3) &lt;strong>Generation&lt;/strong>, the LLM producing the answer, is latency-bound, and there the GPU is irreplaceable: a 7B on CPU gives a &lt;em>time to first token&lt;/em> of seconds, unacceptable for chat. The technical key to why (1) and (2) fit on CPU: the embedder is not an LLM. &lt;code>bge-m3&lt;/code> is &lt;strong>around 568M parameters&lt;/strong> (an XLM-RoBERTa encoder), not 7B+; in int8 it occupies about 580 MB and activates fast integer compute paths (Intel &lt;strong>AVX-512 + VNNI + AMX&lt;/strong> on 4th-gen Xeon and later; &lt;strong>NEON SDOT/UDOT&lt;/strong> on ARM). The runtimes are ready: &lt;strong>TEI&lt;/strong> with a CPU backend (same OpenAI API &lt;code>/v1/embeddings&lt;/code> and &lt;code>/rerank&lt;/code>), Qdrant&amp;rsquo;s &lt;strong>fastembed&lt;/strong> (ONNX-CPU), &lt;code>bge-m3&lt;/code> in ONNX int8 with its three heads (dense/sparse/ColBERT). The Intel + Hugging Face blog post with Optimum Intel and fastRAG reports up to around 10× on indexing for BGE-large int8 on a 4th-gen Xeon (their benchmark figure, encoding-only; I quote it and qualify it below). The operational conclusion: &lt;strong>separate the data plane (CPU) from the generation plane (GPU)&lt;/strong>. In the 4×H100 cluster, no H100 should be spent re-indexing a corpus that changes once a day. That goes to the generic CPU fleet (Xeon AMX, NUCs), and the H100s are reserved for generation and, at most, for rerank peaks or large 7B embedders. What does not go down to CPU: interactive generation, massive reranking at high QPS, re-indexing with a strict real-time SLA, and 7B embedders (gte-Qwen2, NV-Embed).&lt;/p>
&lt;h2 id="the-analogy-the-library-and-the-librarian">The analogy: the library and the librarian&lt;/h2>
&lt;p>Picture a serious research library. There are three distinct jobs, done by different people, on different clocks.&lt;/p>
&lt;p>The first is &lt;strong>cataloguing&lt;/strong>. Boxes of new books arrive; someone opens them, classifies them, assigns a shelf mark, indexes them in the catalogue and puts them on the right shelf. It is patient background work, done at night or between other tasks. Nobody is standing over you with a stopwatch waiting for today&amp;rsquo;s batch to be catalogued: what matters is that tomorrow it is done and done well. It is pure throughput: how many books you catalogue per hour, not how long you take on one specific book. This is &lt;strong>ingestion&lt;/strong>.&lt;/p>
&lt;p>The second is &lt;strong>handling an enquiry at the desk&lt;/strong>. A reader turns up and asks about a topic. The librarian goes to the catalogue, which already exists, finds half a dozen relevant shelf marks, fetches them and puts the books on the desk. It is fast, light, and consists of searching an index that already exists, not building it. This is &lt;strong>retrieval&lt;/strong>.&lt;/p>
&lt;p>The third is &lt;strong>writing a reasoned report&lt;/strong> from those books. The reader, or an expert you commission, reads the six books, compares them, synthesises, and writes an argued answer with citations. This is slow, demands a very well-trained mind, and the reader is waiting: here there is a human stopwatch. This is &lt;strong>generation&lt;/strong>, the LLM.&lt;/p>
&lt;p>The moral is about staff allocation. You do not put your star writer, expensive, scarce, with a queue of people waiting for reports, to catalogue boxes of books at dawn. Cataloguing is done by a large, cheap team that works through the night without rushing. The star writer touches only what genuinely needs their mind: writing. In our system, the star writer is the H100, and cataloguing at dawn is corpus ingestion. Spending the H100 on re-indexing is exactly the error of putting the writer to work labelling boxes.&lt;/p>
&lt;p>The rest of the post is, essentially, which parts of the library work the cheap CPU team can do (almost all of them) and which is irreducibly the GPU writer&amp;rsquo;s job (only the last one).&lt;/p>
&lt;h2 id="the-three-phases-and-their-compute-profiles">The three phases and their compute profiles&lt;/h2>
&lt;div class="diagram" style="max-width:820px;margin:1.5rem auto;">
&lt;svg viewBox="0 0 820 360" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="The three RAG phases: build and retrieval on CPU, generation on GPU">
&lt;text x="410" y="24" text-anchor="middle" font-size="15" font-weight="700" fill="currentColor">The three RAG phases and where each one runs&lt;/text>
&lt;rect x="20" y="50" width="250" height="190" fill="none" stroke="#22c55e" stroke-width="1.6"/>
&lt;text x="145" y="74" text-anchor="middle" font-size="13" font-weight="700" fill="currentColor">1 · BUILD / INGEST&lt;/text>
&lt;text x="145" y="94" text-anchor="middle" font-size="11" fill="currentColor">corpus chunking&lt;/text>
&lt;text x="145" y="111" text-anchor="middle" font-size="11" fill="currentColor">dense embedding (bge-m3)&lt;/text>
&lt;text x="145" y="128" text-anchor="middle" font-size="11" fill="currentColor">sparse / SPLADE head&lt;/text>
&lt;text x="145" y="145" text-anchor="middle" font-size="11" fill="currentColor">build HNSW index&lt;/text>
&lt;rect x="45" y="162" width="200" height="26" fill="#22c55e" stroke="none"/>
&lt;text x="145" y="180" text-anchor="middle" font-size="12" font-weight="700" fill="#ffffff">[CPU]&lt;/text>
&lt;text x="145" y="208" text-anchor="middle" font-size="11" font-style="italic" fill="currentColor">throughput-bound · batch&lt;/text>
&lt;text x="145" y="224" text-anchor="middle" font-size="11" font-style="italic" fill="currentColor">no latency SLA · overnight&lt;/text>
&lt;rect x="285" y="50" width="250" height="190" fill="none" stroke="#3b82f6" stroke-width="1.6"/>
&lt;text x="410" y="74" text-anchor="middle" font-size="13" font-weight="700" fill="currentColor">2 · RETRIEVAL (query-time)&lt;/text>
&lt;text x="410" y="94" text-anchor="middle" font-size="11" fill="currentColor">query embedding&lt;/text>
&lt;text x="410" y="111" text-anchor="middle" font-size="11" fill="currentColor">HNSW search (dense)&lt;/text>
&lt;text x="410" y="128" text-anchor="middle" font-size="11" fill="currentColor">sparse search + RRF&lt;/text>
&lt;text x="410" y="145" text-anchor="middle" font-size="11" fill="currentColor">rerank top-20/50 (light)&lt;/text>
&lt;rect x="310" y="162" width="200" height="26" fill="#3b82f6" stroke="none"/>
&lt;text x="410" y="180" text-anchor="middle" font-size="12" font-weight="700" fill="#ffffff">[CPU] (rerank: caveat)&lt;/text>
&lt;text x="410" y="208" text-anchor="middle" font-size="11" font-style="italic" fill="currentColor">low but tolerable latency&lt;/text>
&lt;text x="410" y="224" text-anchor="middle" font-size="11" font-style="italic" fill="currentColor">tens of ms · HNSW always CPU&lt;/text>
&lt;rect x="550" y="50" width="250" height="190" fill="none" stroke="#ef4444" stroke-width="1.6"/>
&lt;text x="675" y="74" text-anchor="middle" font-size="13" font-weight="700" fill="currentColor">3 · GENERATION&lt;/text>
&lt;text x="675" y="98" text-anchor="middle" font-size="11" fill="currentColor">the LLM produces the answer&lt;/text>
&lt;text x="675" y="115" text-anchor="middle" font-size="11" fill="currentColor">prefill of the augmented context&lt;/text>
&lt;text x="675" y="132" text-anchor="middle" font-size="11" fill="currentColor">token-by-token decode&lt;/text>
&lt;rect x="575" y="162" width="200" height="26" fill="#ef4444" stroke="none"/>
&lt;text x="675" y="180" text-anchor="middle" font-size="12" font-weight="700" fill="#ffffff">[GPU]&lt;/text>
&lt;text x="675" y="208" text-anchor="middle" font-size="11" font-style="italic" fill="currentColor">latency-bound · TTFT matters&lt;/text>
&lt;text x="675" y="224" text-anchor="middle" font-size="11" font-style="italic" fill="currentColor">7B on CPU = TTFT in seconds&lt;/text>
&lt;path d="M270,145 L285,145" stroke="currentColor" stroke-width="1.6" fill="none"/>
&lt;path d="M535,145 L550,145" stroke="currentColor" stroke-width="1.6" fill="none"/>
&lt;line x1="20" y1="270" x2="800" y2="270" stroke="currentColor" stroke-width="1"/>
&lt;text x="20" y="290" font-size="12" font-weight="700" fill="currentColor">DATA PLANE (CPU)&lt;/text>
&lt;text x="520" y="290" font-size="12" font-weight="700" fill="currentColor">GENERATION PLANE (GPU)&lt;/text>
&lt;rect x="20" y="300" width="510" height="20" fill="#22c55e" opacity="0.25" stroke="#22c55e" stroke-width="1"/>
&lt;rect x="550" y="300" width="250" height="20" fill="#ef4444" opacity="0.25" stroke="#ef4444" stroke-width="1"/>
&lt;text x="275" y="314" text-anchor="middle" font-size="11" fill="currentColor">phases 1 and 2 · generic CPU fleet · cheap and horizontal&lt;/text>
&lt;text x="675" y="314" text-anchor="middle" font-size="11" fill="currentColor">phase 3 · scarce GPU&lt;/text>
&lt;text x="410" y="345" text-anchor="middle" font-size="12" font-style="italic" fill="currentColor">The system boundary falls between retrieval and generation, not between "AI" and "non-AI"&lt;/text>
&lt;/svg>
&lt;/div>
&lt;p>The confusion that GPU over-provisioning feeds on is treating &amp;ldquo;RAG&amp;rdquo; as a monolithic block that &amp;ldquo;uses AI, therefore goes on the GPU&amp;rdquo;. No. RAG is a data pipeline with a generative model plugged in at the end. The correct architectural boundary does not separate &amp;ldquo;what uses models&amp;rdquo; from &amp;ldquo;what does not&amp;rdquo;, because both sides use models, but throughput-bound from latency-bound, which is the same as separating the data plane from the generation plane.&lt;/p>
&lt;h2 id="why-ingestion-fits-on-cpu-the-embedder-is-not-an-llm">Why ingestion fits on CPU: the embedder is not an LLM&lt;/h2>
&lt;p>The whole argument rests on a size asymmetry that gets overlooked. People hear &amp;ldquo;embeddings&amp;rdquo; and &amp;ldquo;generation&amp;rdquo; and put them in the same bag of &amp;ldquo;big models that need a GPU&amp;rdquo;. But the embedding encoder and the generative LLM are two orders of magnitude apart in parameters.&lt;/p>
&lt;p>&lt;code>bge-m3&lt;/code>, the reference multilingual embedder, is an &lt;strong>XLM-RoBERTa of around 568M parameters&lt;/strong> (&lt;a href="https://huggingface.co/BAAI/bge-m3">model card&lt;/a>, &lt;a href="https://arxiv.org/abs/2402.03216">paper arXiv:2402.03216&lt;/a>). Its sibling reranker, &lt;code>bge-reranker-v2-m3&lt;/code>, is built on the same base and lands at roughly the same 568M parameters (&lt;a href="https://huggingface.co/BAAI/bge-reranker-v2-m3">model card&lt;/a>). Compare that with an entry-level generative LLM: a Llama 3.1 &lt;strong>8B&lt;/strong> has around 14× more parameters, and the big production models sit at 70B+. A 568M encoder is, in compute budget terms, a different animal.&lt;/p>
&lt;p>Two structural differences make that encoder comfortable on CPU:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>It is an encoder, not an autoregressive decoder.&lt;/strong> It processes the whole sequence in a single forward pass and emits the vector. There is no token-by-token decode, no growing KV cache, none of the memory-bound generation phase that kills the CPU. It is a dense matrix pass and that is it.&lt;/li>
&lt;li>&lt;strong>It quantises to int8 with almost no loss.&lt;/strong> In int8, &lt;code>bge-m3&lt;/code> occupies on the order of 580 MB and, above all, activates the integer compute paths that a modern CPU executes quickly: matrix instructions such as &lt;strong>Intel AMX&lt;/strong> (Advanced Matrix Extensions, 4th-generation Xeon and later), &lt;strong>AVX-512 with VNNI&lt;/strong> (Vector Neural Network Instructions) on earlier Xeons, and &lt;strong>NEON SDOT/UDOT&lt;/strong> on ARM. The quality loss from going FP32 to int8 on these models usually stays below 1% of retrieval recall, practically invisible (&lt;a href="https://huggingface.co/blog/intel-fast-embedding">Intel + Hugging Face, &lt;em>CPU Optimized Embeddings&lt;/em>&lt;/a>).&lt;/li>
&lt;/ul>
&lt;p>Let us quantify the int8 size. For $P = 568 \times 10^6$ parameters at 1 byte each:&lt;/p>
$$\text{size}_{\text{int8}} \approx 568 \times 10^6 \text{ params} \times 1 \text{ byte/param} \approx 568 \text{ MB}$$
&lt;p>In other words, the model fits in the cache and RAM of any server or NUC without blinking, and the bottleneck is integer compute, exactly what AMX/VNNI accelerate. There is nothing in this profile that asks for a GPU.&lt;/p>
&lt;h3 id="runtimes-that-already-do-this-effortlessly">Runtimes that already do this effortlessly&lt;/h3>
&lt;p>Nothing needs inventing. The CPU ecosystem for the data plane is mature:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Text Embeddings Inference (TEI)&lt;/strong> from Hugging Face: a Rust server with &lt;strong>CPU backends&lt;/strong> via ONNX Runtime (recommended) or Intel MKL, and &lt;strong>OpenAI-compatible&lt;/strong> endpoints (&lt;code>/v1/embeddings&lt;/code>) plus &lt;code>/rerank&lt;/code> (&lt;a href="https://github.com/huggingface/text-embeddings-inference">TEI repo&lt;/a>). That is, the data plane on CPU exposes exactly the same HTTP contract as a GPU server; the rest of the system never learns which silicon is behind it.&lt;/li>
&lt;li>&lt;strong>fastembed&lt;/strong> from Qdrant: a lightweight library that loads embedders on &lt;strong>ONNX-CPU&lt;/strong> and generates dense, sparse and ColBERT vectors (&lt;a href="https://github.com/qdrant/fastembed">fastembed repo&lt;/a>). Designed from the start to run without a GPU.&lt;/li>
&lt;li>&lt;strong>&lt;code>bge-m3&lt;/code> in ONNX int8&lt;/strong> with its three heads (dense / sparse-lexical / ColBERT multivector) exported and quantised, ready for ONNX Runtime CPU.&lt;/li>
&lt;/ul>
&lt;p>The Intel and Hugging Face figure that anchors viability: in their benchmark with &lt;strong>Optimum Intel + fastRAG&lt;/strong> on a 4th-generation Xeon (8480+, 56 cores, 1 socket), the int8 variant of &lt;strong>BGE-large&lt;/strong> reaches up to around 10× indexing throughput against FP32 (&lt;a href="https://huggingface.co/blog/intel-fast-embedding">HF blog&lt;/a>, &lt;a href="https://haystack.deepset.ai/blog/cpu-optimized-models-with-fastrag">Haystack/deepset&lt;/a>). The small print needs reading, so I read it: that ~10× is encoding-only (tokenisation excluded), at sequence length 256, comparing int8 against FP32 on the same CPU. It is not &amp;ldquo;CPU 10× faster than GPU&amp;rdquo;, it is &amp;ldquo;int8 10× faster than FP32 on CPU&amp;rdquo;. It is still the relevant figure: it tells you that with quantisation the CPU goes from unworkable to perfectly useful for batch ingestion.&lt;/p>
&lt;h2 id="viability-table-cpu-for-each-component">Viability table: CPU for each component?&lt;/h2>
&lt;p>This is the operational table. The column that matters is the &lt;strong>caveat&lt;/strong>, because a bare &amp;ldquo;yes&amp;rdquo; or &amp;ldquo;no&amp;rdquo; lies.&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Component&lt;/th>
&lt;th>CPU viable?&lt;/th>
&lt;th>Caveat&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;strong>Chunking&lt;/strong> (slicing the corpus)&lt;/td>
&lt;td>Yes, always&lt;/td>
&lt;td>It is regex, parsing and windows; it never had anything to do with the GPU.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Ingest embedding&lt;/strong> &lt;code>bge-m3&lt;/code> dense&lt;/td>
&lt;td>Yes, its best case&lt;/td>
&lt;td>Overnight batch, int8 + AMX/VNNI. This is exactly what the CPU shines at.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Sparse / SPLADE / BM25 head&lt;/strong>&lt;/td>
&lt;td>Yes, CPU-native&lt;/td>
&lt;td>Lexical work is pure inverted index; the GPU adds nothing here.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Building the HNSW index&lt;/strong> (Qdrant, pgvector)&lt;/td>
&lt;td>Yes, always CPU&lt;/td>
&lt;td>The HNSW graph build is CPU by design in these engines.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Query embedding&lt;/strong> (online)&lt;/td>
&lt;td>Yes&lt;/td>
&lt;td>A single short text; tens of ms on CPU, more than enough for chat.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Dense + sparse search + RRF&lt;/strong>&lt;/td>
&lt;td>Yes&lt;/td>
&lt;td>Vector search always ran on CPU, even in &amp;ldquo;GPU&amp;rdquo; stacks. RRF is sorting lists.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Cross-encoder reranker&lt;/strong> &lt;code>bge-reranker-v2-m3&lt;/code> top-20/50&lt;/td>
&lt;td>Yes, with care&lt;/td>
&lt;td>A cross-encoder evaluates $k$ query-doc pairs: cost $\propto k$. Over 20-50 candidates it works; over hundreds at high QPS, no.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>ColBERT late interaction&lt;/strong>&lt;/td>
&lt;td>Marginal on CPU&lt;/td>
&lt;td>The token-by-token matrix product of late interaction is heavy; viable at low volumes, suffers with QPS.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>LLM generation&lt;/strong>&lt;/td>
&lt;td>No, in practice&lt;/td>
&lt;td>A 7B on CPU gives TTFT in seconds. Interactive latency = GPU.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>Two rows deserve underlining because they dismantle myths.&lt;/p>
&lt;p>&lt;strong>&amp;ldquo;Vector search needs a GPU.&amp;rdquo;&lt;/strong> False from the start. The &lt;strong>HNSW&lt;/strong> index, the navigable small-world graph used by Qdrant, pgvector with &lt;code>vector&lt;/code>/&lt;code>halfvec&lt;/code>, Milvus in CPU mode and almost everything else, was always built and traversed on CPU. Even the stacks advertised as &amp;ldquo;GPU-accelerated RAG&amp;rdquo; do the embedding on GPU but the ANN search stays on CPU in the vast majority of deployments; the GPU variants of the index (CAGRA and similar) are the expensive exception, not the norm, and are justified only with billions of vectors and extreme QPS. For a corporate corpus of millions of chunks, HNSW on CPU resolves in single-digit milliseconds.&lt;/p>
&lt;p>&lt;strong>&amp;ldquo;The reranker is a model, therefore GPU.&amp;rdquo;&lt;/strong> The &lt;code>bge-reranker-v2-m3&lt;/code> reranker is a cross-encoder of around 568M: it runs on CPU. The caveat is the &lt;strong>number of pairs&lt;/strong>. A cross-encoder does not produce a reusable vector; it evaluates the (query, document) pair jointly, so its cost grows linearly with the number of candidates $k$:&lt;/p>
$$\text{cost}_{\text{rerank}} \propto k \times \text{forward}(\text{query} + \text{doc})$$
&lt;p>Reranking the top-20 or top-50 coming out of hybrid retrieval is perfectly affordable on CPU. Reranking hundreds of candidates at high QPS is not: there the linear cost explodes and the GPU wins. The rule of thumb: broad cheap recall in the retriever, precision rerank over few candidates. (The detail of hybrid retrieval and reranking is in the fundamentals piece linked below.)&lt;/p>
&lt;h2 id="the-numbers-with-honest-methodology">The numbers, with honest methodology&lt;/h2>
&lt;p>Here comes the part where a lot of people lie by omission. I am going to give throughput ranges, but they are literature ranges and orders of magnitude, not my own measurements on this hardware. Take them as such: the right decision does not depend on nailing the number, it depends on understanding the allocation.&lt;/p>
&lt;p>For &lt;code>bge-m3&lt;/code> dense, sequence ≈256 tokens, embedding throughput moves roughly like this:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Platform&lt;/th>
&lt;th>Dense throughput (order of magnitude)&lt;/th>
&lt;th>Reading&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;strong>High-end GPU&lt;/strong> (5090 fp16, TEI)&lt;/td>
&lt;td>~12k tok/s+ (indicative)&lt;/td>
&lt;td>The ceiling; expensive and scarce.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Large server CPU&lt;/strong> (Xeon ~56 cores, int8 ONNX)&lt;/td>
&lt;td>low band of thousands tok/s&lt;/td>
&lt;td>~1/5–1/10 of the GPU, but horizontally scalable and cheap.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Edge CPU / NUC&lt;/strong> (4-8 cores, int8)&lt;/td>
&lt;td>tens to low hundreds tok/s&lt;/td>
&lt;td>Enough for overnight ingestion of a local corpus.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>The temptation is to read the second row as &amp;ldquo;CPU is 5-10× slower, discarded&amp;rdquo;. That is the wrong reading for ingestion. For batch work with no SLA, what rules is not absolute tok/s but throughput per euro and throughput per watt, and there the arithmetic changes sign.&lt;/p>
&lt;p>Take a numerical example of allocation. Suppose a corpus of 2 million chunks of around 256 tokens that has to be re-indexed once a day (the corpus changes, the embeddings have to be redone). That is:&lt;/p>
$$2 \times 10^6 \text{ chunks} \times 256 \text{ tok/chunk} \approx 5.1 \times 10^8 \text{ tokens}$$
&lt;p>At a conservative CPU throughput of, say, 3,000 tok/s per int8 Xeon server:&lt;/p>
$$t_{\text{ingest}} \approx \frac{5.1 \times 10^8 \text{ tok}}{3000 \text{ tok/s}} \approx 1.7 \times 10^5 \text{ s} \approx 47 \text{ hours on a single server}$$
&lt;p>47 hours on one box sounds bad until you remember two things. First, this is embarrassingly parallel: the corpus is sliced and distributed; with 8 CPU servers it drops to around 6 hours, with 16 to around 3 hours, comfortably inside the overnight window. Second, and more importantly: that same work on the GPU blocks the GPU. If the H100 does 12k tok/s, it takes around 12 hours, but they are 12 hours of the H100, the resource the whole organisation fights over in order to generate. Spending the scarce, expensive resource on re-indexing a corpus that changes once a day is bad allocation, even if it is &amp;ldquo;faster&amp;rdquo;: you are optimising the wrong tok/s.&lt;/p>
&lt;p>The mental rule: for ingestion, optimise throughput/€ and throughput/W; absolute tok/s belongs to the generation plane, where the human stopwatch really is running.&lt;/p>
&lt;h2 id="decision-tree-cpu-or-gpu-for-this-piece">Decision tree: CPU or GPU for this piece?&lt;/h2>
&lt;div class="diagram" style="max-width:780px;margin:1.5rem auto;">
&lt;svg viewBox="0 0 780 420" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="CPU vs GPU decision tree per RAG component">
&lt;defs>&lt;marker id="dt" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto">&lt;path d="M0,0 L10,5 L0,10 z" fill="currentColor"/>&lt;/marker>&lt;/defs>
&lt;text x="390" y="24" text-anchor="middle" font-size="14" font-weight="700" fill="currentColor">Does this RAG piece go to CPU or GPU?&lt;/text>
&lt;rect x="270" y="44" width="240" height="40" rx="6" fill="#f59e0b" opacity="0.18" stroke="#f59e0b" stroke-width="1.4"/>
&lt;text x="390" y="68" text-anchor="middle" font-size="12" font-weight="700" fill="currentColor">Is the user waiting (interactive SLA)?&lt;/text>
&lt;path d="M390,84 L200,120" stroke="currentColor" stroke-width="1.4" fill="none" marker-end="url(#dt)"/>
&lt;text x="270" y="104" text-anchor="middle" font-size="11" fill="currentColor">no (batch)&lt;/text>
&lt;path d="M390,84 L580,120" stroke="currentColor" stroke-width="1.4" fill="none" marker-end="url(#dt)"/>
&lt;text x="510" y="104" text-anchor="middle" font-size="11" fill="currentColor">yes (online)&lt;/text>
&lt;rect x="60" y="124" width="280" height="38" rx="6" fill="#22c55e" opacity="0.15" stroke="#22c55e" stroke-width="1.4"/>
&lt;text x="200" y="148" text-anchor="middle" font-size="12" font-weight="700" fill="currentColor">Ingest/index → [CPU] cheap fleet&lt;/text>
&lt;rect x="440" y="124" width="290" height="40" rx="6" fill="#f59e0b" opacity="0.18" stroke="#f59e0b" stroke-width="1.4"/>
&lt;text x="585" y="142" text-anchor="middle" font-size="12" font-weight="700" fill="currentColor">Does it generate tokens (is it the LLM)?&lt;/text>
&lt;text x="585" y="157" text-anchor="middle" font-size="11" fill="currentColor">or is it retrieval/rerank?&lt;/text>
&lt;path d="M585,164 L460,210" stroke="currentColor" stroke-width="1.4" fill="none" marker-end="url(#dt)"/>
&lt;text x="500" y="190" text-anchor="middle" font-size="11" fill="currentColor">retrieval&lt;/text>
&lt;path d="M585,164 L690,210" stroke="currentColor" stroke-width="1.4" fill="none" marker-end="url(#dt)"/>
&lt;text x="680" y="190" text-anchor="middle" font-size="11" fill="currentColor">generates&lt;/text>
&lt;rect x="330" y="214" width="250" height="40" rx="6" fill="#f59e0b" opacity="0.18" stroke="#f59e0b" stroke-width="1.4"/>
&lt;text x="455" y="232" text-anchor="middle" font-size="11" font-weight="700" fill="currentColor">embed query / HNSW / RRF / rerank&lt;/text>
&lt;text x="455" y="248" text-anchor="middle" font-size="11" fill="currentColor">how many candidates and at what QPS?&lt;/text>
&lt;rect x="600" y="214" width="150" height="38" rx="6" fill="#ef4444" opacity="0.18" stroke="#ef4444" stroke-width="1.4"/>
&lt;text x="675" y="238" text-anchor="middle" font-size="12" font-weight="700" fill="currentColor">[GPU] generation&lt;/text>
&lt;path d="M455,254 L250,300" stroke="currentColor" stroke-width="1.4" fill="none" marker-end="url(#dt)"/>
&lt;text x="320" y="280" text-anchor="middle" font-size="11" fill="currentColor">embed/HNSW/RRF, or rerank top-20/50&lt;/text>
&lt;path d="M455,254 L600,300" stroke="currentColor" stroke-width="1.4" fill="none" marker-end="url(#dt)"/>
&lt;text x="600" y="280" text-anchor="middle" font-size="11" fill="currentColor">rerank hundreds&lt;/text>
&lt;text x="600" y="293" text-anchor="middle" font-size="11" fill="currentColor">high QPS / ColBERT&lt;/text>
&lt;rect x="110" y="304" width="280" height="38" rx="6" fill="#22c55e" opacity="0.15" stroke="#22c55e" stroke-width="1.4"/>
&lt;text x="250" y="328" text-anchor="middle" font-size="12" font-weight="700" fill="currentColor">[CPU] data plane&lt;/text>
&lt;rect x="510" y="304" width="200" height="38" rx="6" fill="#ef4444" opacity="0.18" stroke="#ef4444" stroke-width="1.4"/>
&lt;text x="610" y="322" text-anchor="middle" font-size="11" font-weight="700" fill="currentColor">[GPU] heavy rerank&lt;/text>
&lt;text x="610" y="336" text-anchor="middle" font-size="10" fill="currentColor">(or large 7B embedder)&lt;/text>
&lt;text x="390" y="372" text-anchor="middle" font-size="12" font-style="italic" fill="currentColor">Rule: only what is latency-bound (generation) and massively online (rerank at high QPS) crosses to GPU.&lt;/text>
&lt;text x="390" y="392" text-anchor="middle" font-size="12" font-style="italic" fill="currentColor">Everything else, which is almost everything, stays in the CPU data plane.&lt;/text>
&lt;/svg>
&lt;/div>
&lt;h2 id="reference-architecture-a-cpu-only">Reference architecture (a): CPU-only&lt;/h2>
&lt;p>The first case is a node with no GPU: a NUC, an office Xeon, a sovereign edge server in a branch or in an air-gapped environment. The whole data plane lives there; generation is delegated to a remote GPU endpoint or done in batch with an SLM when latency is not pressing.&lt;/p>
&lt;p>The stack:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>TEI-CPU&lt;/strong> serving &lt;code>bge-m3&lt;/code> int8 with dense + sparse (same OpenAI contract &lt;code>/v1/embeddings&lt;/code>, plus &lt;code>/rerank&lt;/code> for the reranker).&lt;/li>
&lt;li>&lt;strong>Qdrant&lt;/strong> with a dense &lt;strong>HNSW&lt;/strong> index plus &lt;strong>sparse&lt;/strong> vectors, native &lt;strong>RRF&lt;/strong> fusion.&lt;/li>
&lt;li>&lt;strong>Reranker&lt;/strong> &lt;code>bge-reranker-v2-m3&lt;/code> over the top-k (via TEI&amp;rsquo;s &lt;code>/rerank&lt;/code>).&lt;/li>
&lt;li>&lt;strong>Gateway&lt;/strong> that orchestrates and, for generation, calls an external endpoint.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="c"># docker-compose: full RAG data plane on CPU (no GPU)&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">services&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">tei-embed&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">image&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">ghcr.io/huggingface/text-embeddings-inference:cpu-latest&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">command&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;--model-id&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;BAAI/bge-m3&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;--pooling&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;cls&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;--dtype&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;int8&amp;#34;&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">ports&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;8081:80&amp;#34;&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="c"># ONNX/MKL backend: exploits AVX-512+VNNI / AMX if the Xeon supports it&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">tei-rerank&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">image&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">ghcr.io/huggingface/text-embeddings-inference:cpu-latest&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">command&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;--model-id&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;BAAI/bge-reranker-v2-m3&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;--dtype&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;int8&amp;#34;&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">ports&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;8082:80&amp;#34;&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="c"># exposes /rerank — invoked ONLY over top-20/50, never over hundreds&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">qdrant&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">image&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">qdrant/qdrant:latest&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">ports&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;6333:6333&amp;#34;&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">volumes&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;./qdrant_storage:/qdrant/storage&amp;#34;&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="c"># HNSW dense + sparse vectors + RRF, all CPU&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Hybrid search with RRF fusion in Qdrant (dense + sparse in a single query):&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-python" data-lang="python">&lt;span class="line">&lt;span class="cl">&lt;span class="kn">from&lt;/span> &lt;span class="nn">qdrant_client&lt;/span> &lt;span class="kn">import&lt;/span> &lt;span class="n">QdrantClient&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">models&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">client&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">QdrantClient&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">url&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s2">&amp;#34;http://qdrant:6333&amp;#34;&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># query embedding: dense and sparse from TEI-CPU (HTTP wiring omitted)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">hits&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">client&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">query_points&lt;/span>&lt;span class="p">(&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">collection_name&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s2">&amp;#34;corpus&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">prefetch&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="p">[&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">models&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">Prefetch&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">query&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="n">dense_vec&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">using&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s2">&amp;#34;dense&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">limit&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="mi">50&lt;/span>&lt;span class="p">),&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">models&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">Prefetch&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">query&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="n">sparse_vec&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">using&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s2">&amp;#34;sparse&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">limit&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="mi">50&lt;/span>&lt;span class="p">),&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">query&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="n">models&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">FusionQuery&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">fusion&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="n">models&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">Fusion&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">RRF&lt;/span>&lt;span class="p">),&lt;/span> &lt;span class="c1"># native RRF&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">limit&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="mi">20&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">)&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">points&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># -&amp;gt; then: POST /rerank (TEI) over these 20, keep the top-5&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># -&amp;gt; then: the gateway sends query + top-5 to the GENERATION endpoint (GPU)&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Generation, on this CPU-only node, leaves the node: the gateway builds the augmented prompt and sends it to a vLLM endpoint on the GPU cluster (or, if there is no interactive SLA, to an SLM on CPU in batch mode, accepting a TTFT of seconds). The entire data plane, everything above, runs without a single GPU.&lt;/p>
&lt;h2 id="reference-architecture-b-the-recommended-hybrid">Reference architecture (b): the recommended hybrid&lt;/h2>
&lt;p>This is the one I recommend for the general case with a GPU cluster available: &lt;strong>data plane on CPU, generation plane on GPU&lt;/strong>, connected by OpenAI-compatible HTTP contracts so that each side is replaceable.&lt;/p>
&lt;div class="diagram" style="max-width:820px;margin:1.5rem auto;">
&lt;svg viewBox="0 0 820 300" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Hybrid architecture: CPU data plane + GPU generation plane">
&lt;defs>&lt;marker id="hy" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto">&lt;path d="M0,0 L10,5 L0,10 z" fill="currentColor"/>&lt;/marker>&lt;/defs>
&lt;text x="410" y="24" text-anchor="middle" font-size="14" font-weight="700" fill="currentColor">Hybrid architecture: two planes, two silicons&lt;/text>
&lt;rect x="30" y="50" width="470" height="210" rx="8" fill="#22c55e" opacity="0.08" stroke="#22c55e" stroke-width="1.6"/>
&lt;text x="265" y="72" text-anchor="middle" font-size="13" font-weight="700" fill="currentColor">DATA PLANE — CPU fleet (Xeon AMX / NUC)&lt;/text>
&lt;rect x="50" y="88" width="130" height="50" rx="5" fill="none" stroke="#3b82f6" stroke-width="1.3"/>
&lt;text x="115" y="108" text-anchor="middle" font-size="11" font-weight="700" fill="currentColor">Batch ingest&lt;/text>
&lt;text x="115" y="124" text-anchor="middle" font-size="10" fill="currentColor">chunk + embed int8&lt;/text>
&lt;rect x="200" y="88" width="130" height="50" rx="5" fill="none" stroke="#3b82f6" stroke-width="1.3"/>
&lt;text x="265" y="108" text-anchor="middle" font-size="11" font-weight="700" fill="currentColor">Qdrant&lt;/text>
&lt;text x="265" y="124" text-anchor="middle" font-size="10" fill="currentColor">HNSW+sparse+RRF&lt;/text>
&lt;rect x="350" y="88" width="130" height="50" rx="5" fill="none" stroke="#3b82f6" stroke-width="1.3"/>
&lt;text x="415" y="108" text-anchor="middle" font-size="11" font-weight="700" fill="currentColor">TEI rerank&lt;/text>
&lt;text x="415" y="124" text-anchor="middle" font-size="10" fill="currentColor">light top-20/50&lt;/text>
&lt;rect x="50" y="160" width="430" height="44" rx="5" fill="none" stroke="#22c55e" stroke-width="1.3"/>
&lt;text x="265" y="180" text-anchor="middle" font-size="11" font-weight="700" fill="currentColor">TEI-CPU /v1/embeddings + /rerank · int8 · AVX-512/AMX&lt;/text>
&lt;text x="265" y="196" text-anchor="middle" font-size="10" fill="currentColor">OpenAI-compatible contract: the GPU does not know this is CPU&lt;/text>
&lt;rect x="540" y="50" width="250" height="210" rx="8" fill="#ef4444" opacity="0.08" stroke="#ef4444" stroke-width="1.6"/>
&lt;text x="665" y="72" text-anchor="middle" font-size="13" font-weight="700" fill="currentColor">GENERATION PLANE — GPU&lt;/text>
&lt;rect x="560" y="100" width="210" height="60" rx="5" fill="none" stroke="#ef4444" stroke-width="1.3"/>
&lt;text x="665" y="124" text-anchor="middle" font-size="12" font-weight="700" fill="currentColor">vLLM · LLM 7B+&lt;/text>
&lt;text x="665" y="142" text-anchor="middle" font-size="10" fill="currentColor">interactive prefill + decode&lt;/text>
&lt;rect x="560" y="172" width="210" height="44" rx="5" fill="none" stroke="#ef4444" stroke-width="1.3"/>
&lt;text x="665" y="192" text-anchor="middle" font-size="10" font-weight="700" fill="currentColor">optional: heavy rerank / 7B embedder&lt;/text>
&lt;text x="665" y="207" text-anchor="middle" font-size="10" fill="currentColor">only peaks the CPU cannot absorb&lt;/text>
&lt;path d="M480,182 L540,150" stroke="currentColor" stroke-width="1.8" fill="none" marker-end="url(#hy)"/>
&lt;text x="510" y="155" text-anchor="middle" font-size="10" fill="currentColor">query+top-k&lt;/text>
&lt;text x="410" y="284" text-anchor="middle" font-size="12" font-style="italic" fill="currentColor">The gateway speaks OpenAI over HTTP to both sides; each plane scales separately.&lt;/text>
&lt;/svg>
&lt;/div>
&lt;p>Generation server, minimal, on GPU:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="c"># vLLM on the GPU cluster — generation ONLY&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">services&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">vllm-gen&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">image&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">vllm/vllm-openai:latest&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">command&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">&amp;gt;&lt;/span>&lt;span class="sd">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="sd"> --model meta-llama/Llama-3.1-8B-Instruct
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="sd"> --dtype bfloat16 --max-model-len 8192
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="sd"> --gpu-memory-utilization 0.85&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="c"># exposes /v1/chat/completions — the gateway sends it query + the top-5 already retrieved&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">deploy&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">resources&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">reservations&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">devices&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>{&lt;span class="nt">driver: nvidia, count: 1, capabilities&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="l">gpu]}]&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The virtue of the design: because &lt;strong>both sides speak the OpenAI contract over HTTP&lt;/strong>, the CPU data plane and the GPU generation plane scale separately and are replaceable. If tomorrow you want to move the rerank to GPU because QPS went up, you change one URL. If you want to add more CPU ingest nodes, you add them without touching generation. The whole stack is OSS and licence-clean: &lt;code>bge-m3&lt;/code> and &lt;code>bge-reranker-v2-m3&lt;/code> are &lt;strong>MIT&lt;/strong> (&lt;a href="https://huggingface.co/BAAI/bge-m3">bge-m3&lt;/a>, &lt;a href="https://huggingface.co/BAAI/bge-reranker-v2-m3">reranker&lt;/a>), Qdrant is Apache-2.0, TEI and vLLM are OSS.&lt;/p>
&lt;h2 id="applied-to-the-generic-4h100-cluster">Applied to the generic 4×H100 cluster&lt;/h2>
&lt;p>Let us bring this down to the cluster in the series: &lt;strong>4×H100 SXM 80 GB&lt;/strong> plus a generic CPU fleet (Xeon with AMX, NUCs). The correct allocation:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Build and indexing → CPU fleet.&lt;/strong> No H100 should spend a cycle re-embedding the corpus. That goes to the Xeon AMX machines (large servers, throughput in the thousands of tok/s in int8) or, for small local corpora, to the NUCs overnight. Overnight re-indexing of a corpus that changes once a day is the textbook case of &amp;ldquo;unhurried CPU work&amp;rdquo;.&lt;/li>
&lt;li>&lt;strong>The H100s → generation.&lt;/strong> All four cards are reserved for what only they do well: producing tokens at interactive latency. This is what the sibling pieces in the series, &lt;a href="https://blog.lo0.es/en/posts/sharing-one-gpu-time-slicing-mps-mig/">sharing a GPU&lt;/a> and &lt;a href="https://blog.lo0.es/en/posts/serving-several-models-single-gpu-co-residency-swapping-sleep-mode/">several models on one GPU&lt;/a>, help to squeeze: once ingestion stops competing for the GPU, all the expensive silicon is free to generate and is shared better between models and tenants.&lt;/li>
&lt;li>&lt;strong>The H100s, at most, → rerank peaks or large embedders.&lt;/strong> If at some point you need a &lt;strong>7B&lt;/strong> embedder (gte-Qwen2, NV-Embed) for a domain where &lt;code>bge-m3&lt;/code> does not reach, or a massive rerank at a QPS the CPU cannot absorb, those peaks can indeed visit the GPU. But they are the occasional exception, not the base load.&lt;/li>
&lt;/ul>
&lt;h3 id="the-auditability-angle-ens--nis2">The auditability angle: ENS / NIS2&lt;/h3>
&lt;p>There is a compliance argument that rarely gets mentioned and that the CPU/GPU split gives you almost for free.&lt;/p>
&lt;p>A &lt;strong>CPU-only node with no proprietary driver&lt;/strong> is easier to audit. There is no closed NVIDIA kernel stack, no CUDA and firmware versions to reconcile with the supply chain, no proprietary driver surface to document for an ENS or a NIS2 assessment. The whole data plane, chunking, embeddings, index, search, runs on OSS software on generic CPU with standard instructions. For a sovereign or classified environment, being able to say &amp;ldquo;the plane that touches the corpus depends on no proprietary binary&amp;rdquo; is a real argument, not marketing.&lt;/p>
&lt;p>And there is a second auditability angle intrinsic to RAG done well: &lt;strong>source traceability&lt;/strong>. A RAG system that retrieves identifiable chunks and cites them is auditable, since you can reconstruct which document each claim came from, as opposed to &lt;em>context-stuffing&lt;/em> or the model&amp;rsquo;s opaque parametric knowledge, where there is no way to know where a fact came from. That traceability lives in the &lt;strong>data plane&lt;/strong> (what was retrieved, from which source, with what score), precisely the plane we are putting on auditable CPU. The two arguments reinforce each other: the auditable silicon and the auditable chain of evidence are the same plane.&lt;/p>
&lt;h2 id="when-not-to-take-it-to-cpu">When NOT to take it to CPU&lt;/h2>
&lt;p>For honesty, and to avoid falling into the mirror image of the hype, the cases where CPU is not the answer:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Generation at interactive latency.&lt;/strong> The obvious case. A 7B on CPU gives TTFT in seconds: unacceptable for chat. If the user is waiting, generation goes to GPU. With no practical exceptions today.&lt;/li>
&lt;li>&lt;strong>Massive reranking at high QPS.&lt;/strong> A cross-encoder or ColBERT over hundreds of candidates, multiplied by many requests per second, saturates the CPU. The cost $\propto k \times \text{QPS}$ crosses the threshold where the GPU pays off. Keep CPU rerank bounded to top-20/50; if you need more breadth at higher QPS, move up to GPU.&lt;/li>
&lt;li>&lt;strong>Real-time re-indexing with a strict SLA.&lt;/strong> If the corpus changes continuously and freshness is measured in seconds (not hours), CPU throughput may not fit the window. There, ingest embedding may need a GPU, but note that this is rare: most corporate corpora change at the pace of hours or days, not seconds.&lt;/li>
&lt;li>&lt;strong>Large embedders (7B).&lt;/strong> &lt;code>bge-m3&lt;/code> (568M) is comfortable on CPU; a &lt;strong>gte-Qwen2&lt;/strong> or &lt;strong>NV-Embed&lt;/strong> at 7B is LLM-class again and drags the same cost profile as generation. If your retrieval quality demands a 7B embedder, that embedder lives where 7Bs live: on the GPU.&lt;/li>
&lt;/ul>
&lt;p>The sentence that sums it all up: &lt;strong>the CPU is the default home of the data plane; the GPU is the justified exception for what is latency-bound and massively online.&lt;/strong> Start by putting everything on CPU and move up to GPU only what proves it does not fit, not the other way round.&lt;/p>
&lt;h2 id="see-also">See also&lt;/h2>
&lt;ul>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/end-to-end-document-ingestion-pdf-to-indexed-chunk/">End-to-end document ingestion: from PDF to indexed chunk&lt;/a> — the ingestion pipeline that runs on that CPU data plane.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/serving-embeddings-rerankers-tei-production/">Serving embeddings and rerankers with TEI in production&lt;/a> — the engine (TEI) that serves the embeddings and rerankers of that data plane.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/sharing-one-gpu-time-slicing-mps-mig/">Sharing a GPU: time-slicing, MPS and MIG&lt;/a> — the sibling piece on the split &lt;em>inside&lt;/em> the GPU; once ingestion leaves the GPU, this squeezes what remains.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/embeddings-2026-dense-sparse-multivector-families/">Embeddings 2026: dense, sparse and multivector&lt;/a> — the three heads of &lt;code>bge-m3&lt;/code> that the data plane serves on CPU, and when a 7B embedder that does demand a GPU is justified.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/reranker-hybrid-retrieval-five-chunks-llm-reads/">Reranking and hybrid retrieval: fundamentals&lt;/a> — the detail of RRF and of the cross-encoder rerank whose linear cost decides the CPU/GPU boundary for the top-k.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/postgresql-qdrant-rag-ingestion-postman-syncing-two-worlds/">Ingestion with PostgreSQL and Qdrant in microservices&lt;/a> — how the ingestion pipeline we put on the CPU fleet here is structured.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/mixed-nvidia-intel-environments-llm-inference/">Mixed NVIDIA + Intel environments: from the H100 cluster to the NUC&lt;/a> — the concrete hardware of the CPU fleet (Xeon AMX, NUC) that sustains the data plane.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/semantic-cache-rag-receptionist-photographic-memory/">Semantic cache for RAG&lt;/a> — another layer that lives in the CPU data plane and avoids touching the GPU when the query has already been answered.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/aggressive-rag-small-models-trading-parameters-for-retrieval/">Aggressive RAG on small models&lt;/a> — the generation side of this coin: how a curated data plane unloads the model in the generative phase.&lt;/p>
&lt;/li>
&lt;/ul>
&lt;h2 id="references">References&lt;/h2>
&lt;ul>
&lt;li>Chen, J., et al. &lt;em>BGE M3-Embedding: Multi-Lingual, Multi-Functionality, Multi-Granularity Text Embeddings&lt;/em>. arXiv 2402.03216. &lt;a href="https://arxiv.org/abs/2402.03216">https://arxiv.org/abs/2402.03216&lt;/a>&lt;/li>
&lt;li>BAAI — &lt;em>BGE-M3 model card&lt;/em> (568M params, XLM-RoBERTa, 8192 tokens, MIT). &lt;a href="https://huggingface.co/BAAI/bge-m3">https://huggingface.co/BAAI/bge-m3&lt;/a>&lt;/li>
&lt;li>BAAI — &lt;em>bge-reranker-v2-m3 model card&lt;/em> (cross-encoder on top of bge-m3, ~568M). &lt;a href="https://huggingface.co/BAAI/bge-reranker-v2-m3">https://huggingface.co/BAAI/bge-reranker-v2-m3&lt;/a>&lt;/li>
&lt;li>Intel + Hugging Face — &lt;em>CPU Optimized Embeddings with Optimum Intel and fastRAG&lt;/em> (~10× indexing for BGE-large int8, 4th-gen Xeon). &lt;a href="https://huggingface.co/blog/intel-fast-embedding">https://huggingface.co/blog/intel-fast-embedding&lt;/a>&lt;/li>
&lt;li>deepset / Haystack — &lt;em>CPU-Optimized Embedding Models with fastRAG and Haystack&lt;/em>. &lt;a href="https://haystack.deepset.ai/blog/cpu-optimized-models-with-fastrag">https://haystack.deepset.ai/blog/cpu-optimized-models-with-fastrag&lt;/a>&lt;/li>
&lt;li>Hugging Face — &lt;em>Text Embeddings Inference (TEI)&lt;/em>, CPU ONNX/MKL backends, OpenAI-compatible endpoints. &lt;a href="https://github.com/huggingface/text-embeddings-inference">https://github.com/huggingface/text-embeddings-inference&lt;/a>&lt;/li>
&lt;li>Qdrant — &lt;em>fastembed&lt;/em> (ONNX-CPU, dense/sparse/ColBERT) and &lt;em>Hybrid Search with RRF&lt;/em>. &lt;a href="https://github.com/qdrant/fastembed">https://github.com/qdrant/fastembed&lt;/a> · &lt;a href="https://qdrant.tech/documentation/beginner-tutorials/hybrid-search-fastembed/">https://qdrant.tech/documentation/beginner-tutorials/hybrid-search-fastembed/&lt;/a>&lt;/li>
&lt;/ul></description></item><item><title>Reranker and hybrid retrieval: the committee that decides the 5 chunks the LLM will actually read</title><link>https://blog.lo0.es/en/posts/reranker-hybrid-retrieval-five-chunks-llm-reads/</link><pubDate>Mon, 25 May 2026 14:00:00 +0200</pubDate><guid>https://blog.lo0.es/en/posts/reranker-hybrid-retrieval-five-chunks-llm-reads/</guid><description>&lt;blockquote>
&lt;p>This post takes apart the retrieval layer inside the RAG piece of the &lt;a href="https://blog.lo0.es/en/posts/six-stage-llmops-pipeline-architecture-and-deep-dive/">six-stage LLMOps pipeline&lt;/a>. It sits directly on top of the &lt;a href="https://blog.lo0.es/en/posts/rag-corpus-curation-active-librarian/">corpus curation post&lt;/a>: if the librarian decided &lt;strong>what enters the index&lt;/strong>, the committee in this post decides &lt;strong>what leaves the index for the LLM&amp;rsquo;s face&lt;/strong>. It is the stage that moves the real quality of a RAG in production the most, and the one most teams solve with &amp;ldquo;dense top-k and off we go&amp;rdquo;.&lt;/p>
&lt;/blockquote>
&lt;h2 id="tldr">TL;DR&lt;/h2>
&lt;p>The most widespread antipattern in real RAG is: curated corpus, dense embeddings with &lt;code>bge-m3&lt;/code>, the user&amp;rsquo;s query straight through, &lt;code>top_k=5&lt;/code> of cosine similarity and off to the LLM. The system delivers answers that look good in the demo, mediocre with real traffic and dreadful with three-word queries, technical jargon, internal abbreviations or anything outside the embedder&amp;rsquo;s fine-tuning domain. The root cause is almost never the model: it is that &lt;strong>a single pass of dense retrieval over the raw query is structurally insufficient&lt;/strong> for the cases a real user produces. In 2026 the field has consolidated the &lt;strong>three-layer retrieval&lt;/strong> pattern: a broad layer that mixes dense + sparse (BM25 / SPLADE) via Reciprocal Rank Fusion to secure recall, a fine layer with a &lt;strong>cross-encoder reranker&lt;/strong> (BAAI/bge-reranker-v2-m3, Cohere Rerank 3, mxbai-rerank-large) that reorders the 30-50 candidates by true relevance, and optionally a late interaction layer with ColBERT-v2 or an LLM reranker for critical cases. On top of it all, a &lt;strong>query rewriting&lt;/strong> pattern that rewrites malformed queries and HyDE, which generates a hypothetical document so you embed the &lt;em>expected answer&lt;/em> instead of the &lt;em>question&lt;/em>. This post goes through them one by one: why each layer exists, what latency budget it consumes, the minimum maths of RRF and of the recall/precision trade-off, the dominant OSS stack in 2026, the on-premise hardware for serving it under data sovereignty, and the seven operational traps that kill the stage.&lt;/p>
&lt;h2 id="the-analogy-the-committee-for-a-professorial-chair">The analogy: the committee for a professorial chair&lt;/h2>
&lt;p>A university department has a chair to fill and receives 3,000 applications. Nobody is going to read 3,000 CVs in depth. The real process is organised in rounds:&lt;/p>
&lt;p>&lt;strong>Round 1, mass pre-screening.&lt;/strong> A system of automatic filters reads each CV in seconds. One route looks at the keywords of the post (publications in specific journals, languages, certifications); another route looks at the overall profile (research area, h-index, career). The two routes run in parallel. Each proposes its shortlist of 30-50 candidates. The two rankings are combined and what remains is a list of some 50-100 candidates for the next round to act on. The metric that matters here is &lt;strong>recall&lt;/strong>: not losing the good candidate through a filter error.&lt;/p>
&lt;p>&lt;strong>Round 2, careful reading.&lt;/strong> A member of the panel reads each CV on the shortlist thoroughly and scores it against the real profile of the post. It is slow, 10-20 minutes per CV, but it discriminates far better than the automatic filter. It reorders the 100 candidates into a fine ranking and keeps the 5 finalists. The metric that matters here is &lt;strong>precision&lt;/strong>: that the top-5 is genuinely the real top-5.&lt;/p>
&lt;p>&lt;strong>Round 3 (optional), personal interview.&lt;/strong> Long interviews are held for the 5 finalists. Face to face, questions adapted to each candidate&amp;rsquo;s profile, a check against the reality of the post. It is extremely expensive and very slow, but for critical chairs it justifies the cost.&lt;/p>
&lt;p>The retrieval of a modern RAG works exactly like this. Change the vocabulary and the structure holds:&lt;/p>
&lt;div class="diagram" style="max-width:780px;margin:1.5rem auto;">
&lt;svg viewBox="0 0 780 380" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="RAG retrieval as a committee for a professorial chair">
&lt;style>
.rbox{fill:#f8f8f8;stroke:#444;stroke-width:1.4;rx:8}
.rhead{fill:#ff8a4c;stroke:#444;stroke-width:1.4;rx:8}
.rspar{fill:#a8d5a8;stroke:#444;stroke-width:1.4;rx:8}
.rdens{fill:#7aafff;stroke:#444;stroke-width:1.4;rx:8}
.rfuse{fill:#d8a8ff;stroke:#444;stroke-width:1.4;rx:8}
.rrer{fill:#ffb86b;stroke:#444;stroke-width:1.4;rx:8}
.rllm{fill:#ffe18a;stroke:#444;stroke-width:1.4;rx:8}
.rfin{fill:#f4f4f4;stroke:#444;stroke-width:1.4;rx:8}
.rblt{font:600 13px sans-serif;fill:#222}
.rsub{font:400 11px sans-serif;fill:#444}
.rarr{stroke:#666;stroke-width:1.5;fill:none;marker-end:url(#mr1)}
.rlbl{font:600 11px sans-serif;fill:#555}
&lt;/style>
&lt;defs>&lt;marker id="mr1" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6" markerHeight="6" orient="auto">&lt;path d="M0,0 L10,5 L0,10 z" fill="#666"/>&lt;/marker>&lt;/defs>
&lt;rect x="20" y="20" width="160" height="60" class="rhead"/>
&lt;text x="100" y="44" text-anchor="middle" class="rblt">User query&lt;/text>
&lt;text x="100" y="62" text-anchor="middle" class="rsub">"how do I cancel subscription"&lt;/text>
&lt;text x="100" y="76" text-anchor="middle" class="rsub">+ rewriter / HyDE&lt;/text>
&lt;rect x="220" y="20" width="160" height="60" class="rspar"/>
&lt;text x="300" y="42" text-anchor="middle" class="rblt">Layer 1a · Sparse&lt;/text>
&lt;text x="300" y="60" text-anchor="middle" class="rsub">BM25 / SPLADE&lt;/text>
&lt;text x="300" y="76" text-anchor="middle" class="rsub">top-50 lexical&lt;/text>
&lt;rect x="220" y="100" width="160" height="60" class="rdens"/>
&lt;text x="300" y="122" text-anchor="middle" class="rblt">Layer 1b · Dense&lt;/text>
&lt;text x="300" y="140" text-anchor="middle" class="rsub">bi-encoder (bge-m3)&lt;/text>
&lt;text x="300" y="156" text-anchor="middle" class="rsub">top-50 semantic&lt;/text>
&lt;rect x="420" y="60" width="150" height="60" class="rfuse"/>
&lt;text x="495" y="82" text-anchor="middle" class="rblt">Layer 2 · Fusion&lt;/text>
&lt;text x="495" y="100" text-anchor="middle" class="rsub">Reciprocal Rank Fusion&lt;/text>
&lt;text x="495" y="116" text-anchor="middle" class="rsub">→ top-30 combined&lt;/text>
&lt;rect x="600" y="60" width="160" height="60" class="rrer"/>
&lt;text x="680" y="82" text-anchor="middle" class="rblt">Layer 3 · Reranker&lt;/text>
&lt;text x="680" y="100" text-anchor="middle" class="rsub">cross-encoder bge-rerank-v2&lt;/text>
&lt;text x="680" y="116" text-anchor="middle" class="rsub">→ top-5 reordered&lt;/text>
&lt;rect x="280" y="200" width="220" height="60" class="rllm"/>
&lt;text x="390" y="222" text-anchor="middle" class="rblt">Layer 4 (optional) · ColBERT / LLM reranker&lt;/text>
&lt;text x="390" y="240" text-anchor="middle" class="rsub">late interaction or LLM judge&lt;/text>
&lt;text x="390" y="256" text-anchor="middle" class="rsub">for critical cases&lt;/text>
&lt;rect x="280" y="290" width="220" height="60" class="rfin"/>
&lt;text x="390" y="312" text-anchor="middle" class="rblt">LLM context&lt;/text>
&lt;text x="390" y="330" text-anchor="middle" class="rsub">5 chunks ready to answer&lt;/text>
&lt;text x="390" y="346" text-anchor="middle" class="rsub">~2,000 tokens&lt;/text>
&lt;path class="rarr" d="M180,40 L220,40"/>
&lt;path class="rarr" d="M180,60 L220,120"/>
&lt;path class="rarr" d="M380,40 L420,80"/>
&lt;path class="rarr" d="M380,120 L420,100"/>
&lt;path class="rarr" d="M570,90 L600,90"/>
&lt;path class="rarr" d="M680,120 L390,200"/>
&lt;path class="rarr" d="M390,260 L390,290"/>
&lt;text x="200" y="200" class="rlbl">broad recall&lt;/text>
&lt;text x="200" y="216" class="rlbl">~50-100ms total&lt;/text>
&lt;text x="450" y="40" class="rlbl">k=60 typical&lt;/text>
&lt;text x="630" y="50" class="rlbl">fine precision&lt;/text>
&lt;text x="630" y="66" class="rlbl">~80-300ms&lt;/text>
&lt;/svg>
&lt;/div>
&lt;p>The equivalence is exact. The &lt;strong>broad layer&lt;/strong> guarantees that the right chunk is on the shortlist (recall). The &lt;strong>fine layer&lt;/strong> orders well inside the shortlist (precision). Each layer is justified by an operational asymmetry: the broad one is cheap and parallelises, the fine one is expensive and sequential. Solving everything with the expensive one, a single cross-encoder over the whole corpus, is operationally unsustainable. Solving everything with the cheap one, a single dense top-k, is functionally insufficient.&lt;/p>
&lt;h2 id="the-problem-why-dense-on-its-own-is-not-enough">The problem: why dense on its own is not enough&lt;/h2>
&lt;p>The argument against dense-only is not theoretical. It is that the queries a real user produces have patterns the dense bi-encoder &lt;em>does not capture well by construction&lt;/em>:&lt;/p>
&lt;p>&lt;strong>Short queries.&lt;/strong> &amp;ldquo;IRPF dates 2026&amp;rdquo; goes through the embedder and produces a vector close to any chunk that mentions dates and IRPF, including chunks from 2023, chunks of generic calendars, chunks of corporate IRPF when you were asking about personal income tax. &lt;strong>BM25 disambiguates better&lt;/strong> because the weight of the infrequent terms (&amp;ldquo;2026&amp;rdquo;, &amp;ldquo;IRPF&amp;rdquo;) dominates the score.&lt;/p>
&lt;p>&lt;strong>Infrequent or internal technical terms.&lt;/strong> Product codes (&lt;code>FBR-X42-PRO&lt;/code>), organisation abbreviations (&lt;code>PYM-23-bis&lt;/code>), internal variable names. The embedder, trained on a public corpus, breaks them down into sub-tokens and pushes them into the &amp;ldquo;noisy&amp;rdquo; zone of the latent space. Two completely different codes can end up 0.02 cosine distance apart. &lt;strong>BM25 treats them as exact tokens&lt;/strong> and scores them correctly.&lt;/p>
&lt;p>&lt;strong>Polysemy.&lt;/strong> &amp;ldquo;Java&amp;rdquo; as a language vs Java as an island vs Java as coffee. The dense embedding averages the meanings; the ranking becomes mediocre. Here dense can beat BM25 &lt;em>if&lt;/em> the query carries enough context, but that &amp;ldquo;if&amp;rdquo; is rarely met with real user queries.&lt;/p>
&lt;p>&lt;strong>Synonyms and rephrasings.&lt;/strong> &amp;ldquo;How do I cancel my subscription&amp;rdquo; vs a chunk titled &amp;ldquo;Service termination procedure&amp;rdquo;. Here dense beats BM25: the semantic space brings them together even though they share no tokens. It is exactly the case where dense shines and BM25 fails.&lt;/p>
&lt;p>The operational conclusion: &lt;strong>no single retriever covers the four cases&lt;/strong>. The combination covers them all. And for the cases where both retrievers fail (very ambiguous queries, contradictory context between chunks), the &lt;strong>third layer&lt;/strong> comes in: the reranker that reads the query and each chunk together with a cross-encoder, and produces a &lt;em>real&lt;/em> relevance score far more discriminating than cosine similarity.&lt;/p>
&lt;h2 id="layer-1--hybrid-retrieval-dense--sparse">Layer 1 — Hybrid retrieval: dense + sparse&lt;/h2>
&lt;h3 id="why-bm25-is-still-alive-in-2026">Why BM25 is still alive in 2026&lt;/h3>
&lt;p>BM25 is from 1994. It is not deep learning. It needs no GPU. And it is still competitive with dense retrievers of hundreds of millions of parameters on many retrieval benchmarks (&lt;a href="https://github.com/beir-cellar/beir">BEIR&lt;/a>, 2021-2024). Its formula is simple:&lt;/p>
$$
\mathrm{BM25}(q, d) = \sum_{t \in q} \mathrm{IDF}(t) \cdot \frac{\mathrm{tf}(t,d) \cdot (k_1 + 1)}{\mathrm{tf}(t,d) + k_1 \cdot (1 - b + b \cdot \frac{|d|}{\overline{|d|}})}
$$
&lt;p>Where $\mathrm{tf}(t,d)$ is the frequency of term $t$ in document $d$, $|d|$ the document length, $\overline{|d|}$ the mean length of the corpus, and IDF the inverse document frequency. $k_1$ and $b$ are hyperparameters (typically $k_1 = 1.2$, $b = 0.75$). In practice you use &lt;code>pyserini&lt;/code>, &lt;code>Tantivy&lt;/code>, &lt;code>Elasticsearch&lt;/code> or &lt;code>OpenSearch&lt;/code> and never write the formula.&lt;/p>
&lt;p>SPLADE (&lt;a href="https://arxiv.org/abs/2107.05720">Formal et al., 2021&lt;/a>) is the neural generation of BM25: it learns sparse weights over the BERT vocabulary, expanding each token to its related terms. It keeps BM25&amp;rsquo;s interpretability (you can see which query terms match which document terms) and beats plain BM25 on BEIR. The price is that you need GPU inference over the query (and over each document at indexing time, once).&lt;/p>
&lt;p>The rule of thumb in 2026:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Corpus &amp;lt; 10M chunks, queries with a broad vocabulary&lt;/strong>: plain BM25 via Elasticsearch / Tantivy. Trivial indexing, 1-5ms queries.&lt;/li>
&lt;li>&lt;strong>Corpus 10M-100M, specific domain&lt;/strong>: SPLADE-v3 indexed in Elasticsearch or Vespa. Slow indexing (you need a GPU once), 5-20ms queries.&lt;/li>
&lt;li>&lt;strong>Corpus &amp;gt; 100M, latency critical&lt;/strong>: BM25 with external query expansion (synonyms, query2doc) is the operational option, with SPLADE reserved for the critical segments.&lt;/li>
&lt;/ul>
&lt;h3 id="dense-bi-encoder-the-second-lane">Dense bi-encoder: the second lane&lt;/h3>
&lt;p>The bi-encoder produces one vector per chunk and another per query, and relevance is the cosine similarity (or dot product) between the two. The dominant multilingual model in 2026 is &lt;code>BAAI/bge-m3&lt;/code>: 568M params, 1024 dimensions, support for up to 8,192 context tokens per chunk, multivector (dense + sparse + ColBERT-style multi-vec in the same embedder), trained on 100+ languages. Alternatives:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Embedder&lt;/th>
&lt;th style="text-align:right">Params&lt;/th>
&lt;th style="text-align:right">Dim&lt;/th>
&lt;th style="text-align:center">Multilingual&lt;/th>
&lt;th>Comment&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;code>BAAI/bge-m3&lt;/code>&lt;/td>
&lt;td style="text-align:right">568M&lt;/td>
&lt;td style="text-align:right">1024&lt;/td>
&lt;td style="text-align:center">yes&lt;/td>
&lt;td>the default all-rounder in 2026&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>intfloat/multilingual-e5-large-instruct&lt;/code>&lt;/td>
&lt;td style="text-align:right">560M&lt;/td>
&lt;td style="text-align:right">1024&lt;/td>
&lt;td style="text-align:center">yes&lt;/td>
&lt;td>direct competitor, instruct-style queries&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>nomic-ai/nomic-embed-text-v1.5&lt;/code>&lt;/td>
&lt;td style="text-align:right">137M&lt;/td>
&lt;td style="text-align:right">768&lt;/td>
&lt;td style="text-align:center">English&lt;/td>
&lt;td>fast, variable Matryoshka dimension&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>jinaai/jina-embeddings-v3&lt;/code>&lt;/td>
&lt;td style="text-align:right">570M&lt;/td>
&lt;td style="text-align:right">1024&lt;/td>
&lt;td style="text-align:center">yes&lt;/td>
&lt;td>with task-specific LoRAs per domain&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>mixedbread-ai/mxbai-embed-large-v1&lt;/code>&lt;/td>
&lt;td style="text-align:right">335M&lt;/td>
&lt;td style="text-align:right">1024&lt;/td>
&lt;td style="text-align:center">English&lt;/td>
&lt;td>top English on MTEB&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>Snowflake/arctic-embed-l-v2.0&lt;/code>&lt;/td>
&lt;td style="text-align:right">568M&lt;/td>
&lt;td style="text-align:right">1024&lt;/td>
&lt;td style="text-align:center">yes&lt;/td>
&lt;td>enterprise-oriented, Apache licence&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>The practical selection criterion: &lt;strong>multilingual no matter what if your corpus or queries need it&lt;/strong> (&lt;code>bge-m3&lt;/code>, &lt;code>multilingual-e5&lt;/code>, &lt;code>jina-v3&lt;/code>, &lt;code>arctic-l-v2&lt;/code>), Matryoshka if you want to save vector store memory by reducing dimensions without re-embedding (&lt;code>nomic&lt;/code>), and the MTEB leaderboard ranking only as a &lt;strong>tie-breaker&lt;/strong>, never as the sole criterion, since MTEB benchmarks are contaminable and a 1-2 point difference rarely translates into a real improvement in your domain.&lt;/p>
&lt;h3 id="the-fusion-reciprocal-rank-fusion-rrf">The fusion: Reciprocal Rank Fusion (RRF)&lt;/h3>
&lt;p>You have two rankings, one from BM25 and one from dense. How do you combine them? The naive option, adding the scores, fails because the scores are not comparable (BM25 produces numbers of 0-30, cosine 0-1, L2 distances 0-2…). The option that has consolidated is Reciprocal Rank Fusion (&lt;a href="https://dl.acm.org/doi/10.1145/1571941.1572114">Cormack, Clarke, Buettcher 2009&lt;/a>), which ignores absolute scores and uses only the &lt;em>rankings&lt;/em>:&lt;/p>
$$
\mathrm{RRF}(d) = \sum_{r \in R} \frac{1}{k + \mathrm{rank}_r(d)}
$$
&lt;p>Where $R$ is the set of retrievers and $\mathrm{rank}_r(d)$ is the position of document $d$ in the ranking of retriever $r$. The constant $k$ is typically $60$ and smooths the weight of the first positions.&lt;/p>
&lt;p>A numerical example. You have BM25 with top-5: &lt;code>[d_a, d_b, d_c, d_d, d_e]&lt;/code> and dense with top-5: &lt;code>[d_b, d_f, d_a, d_g, d_h]&lt;/code>. You compute the RRF of each candidate:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Doc&lt;/th>
&lt;th style="text-align:right">BM25 rank&lt;/th>
&lt;th style="text-align:right">dense rank&lt;/th>
&lt;th style="text-align:right">$\frac{1}{60+r_{\text{BM25}}}$&lt;/th>
&lt;th style="text-align:right">$\frac{1}{60+r_{\text{dense}}}$&lt;/th>
&lt;th style="text-align:right">total RRF&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;code>d_b&lt;/code>&lt;/td>
&lt;td style="text-align:right">2&lt;/td>
&lt;td style="text-align:right">1&lt;/td>
&lt;td style="text-align:right">0.01613&lt;/td>
&lt;td style="text-align:right">0.01639&lt;/td>
&lt;td style="text-align:right">0.03252&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>d_a&lt;/code>&lt;/td>
&lt;td style="text-align:right">1&lt;/td>
&lt;td style="text-align:right">3&lt;/td>
&lt;td style="text-align:right">0.01639&lt;/td>
&lt;td style="text-align:right">0.01587&lt;/td>
&lt;td style="text-align:right">0.03226&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>d_c&lt;/code>&lt;/td>
&lt;td style="text-align:right">3&lt;/td>
&lt;td style="text-align:right">—&lt;/td>
&lt;td style="text-align:right">0.01587&lt;/td>
&lt;td style="text-align:right">0&lt;/td>
&lt;td style="text-align:right">0.01587&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>d_f&lt;/code>&lt;/td>
&lt;td style="text-align:right">—&lt;/td>
&lt;td style="text-align:right">2&lt;/td>
&lt;td style="text-align:right">0&lt;/td>
&lt;td style="text-align:right">0.01613&lt;/td>
&lt;td style="text-align:right">0.01613&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>d_d&lt;/code>&lt;/td>
&lt;td style="text-align:right">4&lt;/td>
&lt;td style="text-align:right">—&lt;/td>
&lt;td style="text-align:right">0.01562&lt;/td>
&lt;td style="text-align:right">0&lt;/td>
&lt;td style="text-align:right">0.01562&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>&lt;code>d_b&lt;/code> wins because it appears well ranked in both. &lt;code>d_a&lt;/code> follows it. Those that appear in only one list stay below. With nothing tuned, RRF tends to push the &lt;em>consensus&lt;/em> candidates to the top, which is exactly what you want as a coarse filter before the reranker.&lt;/p>
&lt;p>Variants: weighted RRF assigns a multiplier per retriever ($w_r \cdot \frac{1}{k + \mathrm{rank}_r(d)}$) when you have reasons to trust one more; learning-to-rank trains a model (LambdaMART or a LightGBM ranker) over features from the two retrievers, a more powerful option but one that demands relevance labels most teams do not have.&lt;/p>
&lt;p>In Qdrant, Vespa, Weaviate and Elastic 8.11+ the RRF fusion is built in as a native mode: you ask for hybrid search with a lexical query and a vector and they return the combined top-k without you having to compute the fusion.&lt;/p>
&lt;h2 id="layer-2--the-reranker-bi-encoder-vs-cross-encoder">Layer 2 — The reranker: bi-encoder vs cross-encoder&lt;/h2>
&lt;p>The bi-encoder looks at query and document &lt;em>separately&lt;/em> and compares the resulting vectors. It is extremely fast (a dot product) and lets you index the document embeddings once and for all. The price is that the model never sees query and document together, and the compressed representation loses nuance.&lt;/p>
&lt;p>The cross-encoder looks at query and document &lt;em>concatenated&lt;/em>: &lt;code>[CLS] query [SEP] document [SEP]&lt;/code> goes through the model and the output is a relevance score. It discriminates far better, since shades of ordering and of local relationship between terms are captured, but the cost explodes: each (query, doc) pair requires a full inference of the model. You cannot precompute anything. If you want to rerank 50 candidates, that is 50 inferences.&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Aspect&lt;/th>
&lt;th>Bi-encoder&lt;/th>
&lt;th>Cross-encoder&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Inference per chunk at indexing&lt;/td>
&lt;td>yes, once&lt;/td>
&lt;td>not precomputable&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Inference at query time&lt;/td>
&lt;td>1 (query) + dot product per chunk&lt;/td>
&lt;td>1 per (query, chunk) pair&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Typical latency for top-50&lt;/td>
&lt;td>5-20 ms (CPU possible)&lt;/td>
&lt;td>80-300 ms (GPU recommended)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Discrimination&lt;/td>
&lt;td>medium&lt;/td>
&lt;td>high&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Typical use&lt;/td>
&lt;td>recall (layer 1)&lt;/td>
&lt;td>precision (layer 2)&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>This asymmetry is why the canonical pattern is a &lt;strong>two-step funnel&lt;/strong>: the bi-encoder does cheap broad recall and the cross-encoder does expensive fine precision, over 30-50 candidates instead of millions.&lt;/p>
&lt;h3 id="2026-oss-cross-encoder-reranker-stack">2026 OSS cross-encoder reranker stack&lt;/h3>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Reranker&lt;/th>
&lt;th style="text-align:right">Params&lt;/th>
&lt;th style="text-align:center">Multilingual&lt;/th>
&lt;th style="text-align:right">top-50 latency (A100)&lt;/th>
&lt;th>Comment&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;code>BAAI/bge-reranker-v2-m3&lt;/code>&lt;/td>
&lt;td style="text-align:right">568M&lt;/td>
&lt;td style="text-align:center">yes (100+ languages)&lt;/td>
&lt;td style="text-align:right">~90 ms&lt;/td>
&lt;td>the de facto default in 2026&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>BAAI/bge-reranker-v2-gemma&lt;/code>&lt;/td>
&lt;td style="text-align:right">2B&lt;/td>
&lt;td style="text-align:center">yes&lt;/td>
&lt;td style="text-align:right">~250 ms&lt;/td>
&lt;td>more quality, more cost&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>mixedbread-ai/mxbai-rerank-large-v2&lt;/code>&lt;/td>
&lt;td style="text-align:right">1.5B&lt;/td>
&lt;td style="text-align:center">English&lt;/td>
&lt;td style="text-align:right">~180 ms&lt;/td>
&lt;td>top English on BEIR rerank&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>jinaai/jina-reranker-v2-base-multilingual&lt;/code>&lt;/td>
&lt;td style="text-align:right">278M&lt;/td>
&lt;td style="text-align:center">yes&lt;/td>
&lt;td style="text-align:right">~50 ms&lt;/td>
&lt;td>fast and enough for many cases&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>Alibaba-NLP/gte-multilingual-reranker-base&lt;/code>&lt;/td>
&lt;td style="text-align:right">306M&lt;/td>
&lt;td style="text-align:center">yes&lt;/td>
&lt;td style="text-align:right">~55 ms&lt;/td>
&lt;td>direct competitor to jina&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>Cohere Rerank 3&lt;/code>&lt;/td>
&lt;td style="text-align:right">(closed)&lt;/td>
&lt;td style="text-align:center">yes (100+ languages)&lt;/td>
&lt;td style="text-align:right">~120 ms (API)&lt;/td>
&lt;td>commercial, not on-prem&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>Voyage rerank-2&lt;/code>&lt;/td>
&lt;td style="text-align:right">(closed)&lt;/td>
&lt;td style="text-align:center">yes&lt;/td>
&lt;td style="text-align:right">~100 ms (API)&lt;/td>
&lt;td>commercial, not on-prem&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>For deployments under data sovereignty the obvious choice is &lt;strong>&lt;code>bge-reranker-v2-m3&lt;/code>&lt;/strong> as a starting point, with &lt;code>jina-reranker-v2-base&lt;/code> as the lightweight alternative. If the domain is exclusively English and the hardware budget allows it, &lt;code>mxbai-rerank-large-v2&lt;/code> takes a point or two more on BEIR. Cohere and Voyage are the option when you can reach out to an external API, ruled out in ENS / NIS2 scenarios with sensitive data.&lt;/p>
&lt;h3 id="late-interaction-colbert-v2-as-a-compromise">Late interaction: ColBERT-v2 as a compromise&lt;/h3>
&lt;p>There is a third option gaining traction: late interaction, embodied in ColBERT-v2 (&lt;a href="https://arxiv.org/abs/2112.01488">Santhanam et al., 2022&lt;/a>). The idea is that the document is embedded not as a single vector but as a &lt;em>matrix&lt;/em> of embeddings, one per token. And at query time the query is also embedded as a matrix, and the similarity is the sum of the maxima per column (&lt;code>MaxSim&lt;/code>):&lt;/p>
$$
S(q, d) = \sum_{i \in q} \max_{j \in d} \langle E_q[i], E_d[j] \rangle
$$
&lt;p>The result is retrieval with quality close to a cross-encoder but at a much lower cost (there is no need to run the whole model over each pair). The price is space: each chunk is ~150-200 vectors instead of 1, and that multiplies the index size by ~100. For small to medium corpora (&amp;lt;10M chunks) it is manageable; for huge corpora &lt;code>PLAID&lt;/code> compression and &lt;code>ColBERT-v2 quantization&lt;/code> make it viable up to 100M.&lt;/p>
&lt;p>In 2026 the reference implementations are &lt;code>RAGatouille&lt;/code> (Python wrapper), &lt;code>JaColBERT&lt;/code> (Japanese), &lt;code>Vespa.ai&lt;/code> (a search engine with native ColBERT support as a first-class citizen), and the native integration in &lt;code>bge-m3&lt;/code> that produces the ColBERT-style multivectors as part of the same dense model.&lt;/p>
&lt;p>My operational recommendation: &lt;strong>start with a cross-encoder reranker&lt;/strong> over the top-30 of the hybrid retrieval. Only if the precision numbers fall short, try late interaction as an alternative to the cross-encoder (not as an additional layer). Late interaction as a &lt;em>third&lt;/em> layer rarely pays back the operational cost for most cases.&lt;/p>
&lt;h2 id="query-rewriting-and-hyde-correcting-the-query-before-retrieval">Query rewriting and HyDE: correcting the query before retrieval&lt;/h2>
&lt;p>The user&amp;rsquo;s query is the worst-controlled input in the whole system. The most frequent problems:&lt;/p>
&lt;p>&lt;strong>Queries that are too short&lt;/strong>: &amp;ldquo;GDPR fines&amp;rdquo; → retrieves any chunk about GDPR or about fines.&lt;/p>
&lt;p>&lt;strong>Queries with typos or jargon&lt;/strong>: &amp;ldquo;i wnat to know how to cancel the premium subscripton&amp;rdquo; → the embedder is noisy because of the typos.&lt;/p>
&lt;p>&lt;strong>Multi-intent queries&lt;/strong>: &amp;ldquo;compare the premium and enterprise plans and tell me which has the better SLA&amp;rdquo; → dense will try to embed the three questions into one vector.&lt;/p>
&lt;p>&lt;strong>Queries with references resolved in context&lt;/strong>: &amp;ldquo;and for next month?&amp;rdquo; → without the previous context, dense does not know what it is about.&lt;/p>
&lt;p>&lt;strong>Canonical 2026 patterns to mitigate&lt;/strong>:&lt;/p>
&lt;p>&lt;strong>Query rewriting with a light LLM.&lt;/strong> Before retrieval, a small model (Qwen2.5-7B, Llama-3.2-3B, Phi-4-mini) rewrites the user&amp;rsquo;s query into a &amp;ldquo;canonical&amp;rdquo; version: it expands abbreviations, fixes typos, breaks multi-intent into sub-queries, resolves references using the conversation history. Cost: one cheap inference (~50-100 ms). Benefit: the four pathologies above are noticeably reduced.&lt;/p>
&lt;p>&lt;strong>Multi-query&lt;/strong>: the LLM generates 3-5 rephrasings of the query and you retrieve with each one; then you fuse with RRF. It increases recall at the cost of time and LLM tokens.&lt;/p>
&lt;p>&lt;strong>Step-back prompting&lt;/strong> (&lt;a href="https://arxiv.org/abs/2310.06117">Zheng et al., 2023&lt;/a>): the LLM generates a &lt;em>more general&lt;/em> question than the original query (&amp;ldquo;what is a premium subscription in this system?&amp;rdquo;), you retrieve with both and combine. It helps with very specific queries that need context.&lt;/p>
&lt;p>&lt;strong>HyDE — Hypothetical Document Embeddings&lt;/strong> (&lt;a href="https://arxiv.org/abs/2212.10496">Gao et al., 2022&lt;/a>): instead of embedding the question, you ask a light LLM to generate a &lt;em>hypothetical answer&lt;/em> and you embed that. The reasoning is that the semantic space of answers is closer to that of the real chunks than the space of questions. It works especially well in domains with very specific vocabulary. Cost: one inference of the light LLM (~100-200 ms). Benefit: in many cases +5-15 points of Recall@10.&lt;/p>
&lt;p>The operational trade-off is the added latency. Each technique adds 50-300 ms to the pipeline. In synchronous interactions with a 2s SLO there is still headroom; in agentic interactions with tool-use loops, every ms counts. The practical choice in 2026: &lt;strong>rewriting with a light LLM as the default&lt;/strong>, &lt;strong>HyDE for specific cases where it has been measured to help&lt;/strong>, &lt;strong>multi-query and step-back only when the case justifies it with numbers&lt;/strong>.&lt;/p>
&lt;h2 id="minimum-maths-latency-budget-and-metrics">Minimum maths: latency budget and metrics&lt;/h2>
&lt;h3 id="latency-budget-of-a-canonical-pipeline">Latency budget of a canonical pipeline&lt;/h3>
&lt;p>A typical hybrid + rerank pipeline in 2026 production over a corpus of 5M chunks with bge-m3 + bge-reranker-v2-m3 on an H100 with TEI:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Stage&lt;/th>
&lt;th style="text-align:right">p50 latency&lt;/th>
&lt;th style="text-align:right">p95 latency&lt;/th>
&lt;th>Comment&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Query rewrite (LLM 3B)&lt;/td>
&lt;td style="text-align:right">60 ms&lt;/td>
&lt;td style="text-align:right">150 ms&lt;/td>
&lt;td>only if enabled&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>HyDE (LLM 3B)&lt;/td>
&lt;td style="text-align:right">90 ms&lt;/td>
&lt;td style="text-align:right">220 ms&lt;/td>
&lt;td>only if enabled&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>BM25 / SPLADE top-50&lt;/td>
&lt;td style="text-align:right">8 ms&lt;/td>
&lt;td style="text-align:right">20 ms&lt;/td>
&lt;td>Elasticsearch or local Tantivy&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Dense embedding of the query&lt;/td>
&lt;td style="text-align:right">12 ms&lt;/td>
&lt;td style="text-align:right">35 ms&lt;/td>
&lt;td>bge-m3 with batch=1&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Dense top-50 (filterable HNSW)&lt;/td>
&lt;td style="text-align:right">6 ms&lt;/td>
&lt;td style="text-align:right">18 ms&lt;/td>
&lt;td>Qdrant with scalar quantization&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>RRF fusion → top-30&lt;/td>
&lt;td style="text-align:right">&amp;lt;1 ms&lt;/td>
&lt;td style="text-align:right">&amp;lt;1 ms&lt;/td>
&lt;td>arithmetic&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Cross-encoder rerank top-30&lt;/td>
&lt;td style="text-align:right">60 ms&lt;/td>
&lt;td style="text-align:right">180 ms&lt;/td>
&lt;td>bge-reranker-v2-m3 batched&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Top-5 selection + format&lt;/td>
&lt;td style="text-align:right">&amp;lt;1 ms&lt;/td>
&lt;td style="text-align:right">&amp;lt;1 ms&lt;/td>
&lt;td>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Total without rewrite/HyDE&lt;/strong>&lt;/td>
&lt;td style="text-align:right">~90 ms&lt;/td>
&lt;td style="text-align:right">~270 ms&lt;/td>
&lt;td>realistic range on an H100&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Total with rewrite + HyDE&lt;/strong>&lt;/td>
&lt;td style="text-align:right">~240 ms&lt;/td>
&lt;td style="text-align:right">~640 ms&lt;/td>
&lt;td>+ ~150-370 ms&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>On an RTX 4090 (~3× slower than an H100 on a large cross-encoder, similar on everything else) the numbers shift: ~180 ms p50 without rewrite, ~400 ms p50 with rewrite + HyDE. It is perfectly serviceable for a synchronous assistant with a 2-3s SLO, but tight for one with a 500 ms SLO.&lt;/p>
&lt;h3 id="metrics-ndcg-mrr-recallk">Metrics: nDCG, MRR, Recall@k&lt;/h3>
&lt;p>There are three classic metrics that any retrieval eval reports:&lt;/p>
&lt;p>&lt;strong>Recall@k&lt;/strong>: is the relevant chunk among the top-k? A binary metric, it ignores ordering. The one that matters for the &lt;strong>broad layer&lt;/strong>.&lt;/p>
$$
\mathrm{Recall@k} = \frac{|\{\text{relevant}\} \cap \{\text{top-k}\}|}{|\{\text{relevant}\}|}
$$
&lt;p>&lt;strong>Mean Reciprocal Rank (MRR@k)&lt;/strong>: in which position does the first relevant chunk appear? It penalises placing it far down.&lt;/p>
$$
\mathrm{MRR@k} = \frac{1}{|Q|} \sum_{q \in Q} \frac{1}{\mathrm{rank}_q}
$$
&lt;p>where $\mathrm{rank}_q$ is the position of the first relevant item for query $q$ (or $\infty$ if it does not appear in the top-k).&lt;/p>
&lt;p>&lt;strong>nDCG@k&lt;/strong>: it takes into account multiple relevant chunks with degrees of relevance. The most used metric for evaluating rerankers:&lt;/p>
$$
\mathrm{DCG@k} = \sum_{i=1}^{k} \frac{2^{\mathrm{rel}_i} - 1}{\log_2(i+1)} \quad \mathrm{nDCG@k} = \frac{\mathrm{DCG@k}}{\mathrm{IDCG@k}}
$$
&lt;p>The operational heuristic: &lt;strong>Recall@50 measures the quality of your broad layer&lt;/strong> (we want &amp;gt; 95%; otherwise layer 2 will never be able to recover what was lost), &lt;strong>nDCG@5 measures the quality of your reranker&lt;/strong> (we want &amp;gt; 0.75 on the golden set to consider the system &amp;ldquo;good&amp;rdquo;) and &lt;strong>MRR@5 measures the quality of your top-1&lt;/strong> (it matters especially in systems with &lt;code>top_k=1&lt;/code> or where the LLM&amp;rsquo;s answer is based mainly on the first chunk).&lt;/p>
&lt;h3 id="costs-and-throughput">Costs and throughput&lt;/h3>
&lt;p>Assuming a bge-reranker-v2-m3 cross-encoder (568M params) on an H100 SXM with TEI 1.7 and dynamic batching:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Throughput&lt;/strong>: ~280 queries/sec with top-30 each (= ~8,400 chunk-query pairs/sec).&lt;/li>
&lt;li>&lt;strong>VRAM used&lt;/strong>: ~3.5 GB for the model + ~6 GB of KV cache + activations at batch=32.&lt;/li>
&lt;li>&lt;strong>Energy cost&lt;/strong>: an H100 SXM draws ~700 W. At 8,400 pairs/sec, the energy cost of pure reranking is ~0.083 mJ per pair. In Spanish industrial electricity bill terms (~0.12 €/kWh, May 2026): ~0.000003 € per rerank of 30 candidates. The bill is negligible compared with the cost of the downstream LLM.&lt;/li>
&lt;/ul>
&lt;p>On an RTX 4090 with TEI: ~95 queries/sec at top-30 (~2,850 pairs/sec), VRAM ~3.5 GB + ~5 GB. Serviceable for an internal assistant with modest traffic (~5 QPS sustained, peaks at 20-30).&lt;/p>
&lt;h2 id="the-canonical-pattern--which-piece-goes-where">The canonical pattern — which piece goes where&lt;/h2>
&lt;p>The 2026 operational reference stack for an on-premise hybrid + rerank RAG under data sovereignty:&lt;/p>
&lt;pre tabindex="0">&lt;code> ┌─────────────────┐
User query ────────▶│ Query rewriter │ (optional, LLM 3B)
│ (Qwen2.5-7B-IT) │
└────────┬────────┘
▼
┌─────────────────┐
│ HyDE │ (optional)
│ (same LLM) │
└────────┬────────┘
┌─────────────────┼─────────────────┐
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ BM25/SPLADE │ │ Dense bi-enc │ │ (metadata │
│ Elasticsearch│ │ bge-m3 + TEI │ │ filters │
│ top-50 │ │ + Qdrant │ │ per tenant) │
│ │ │ top-50 │ │ │
└──────┬───────┘ └──────┬───────┘ └──────┬───────┘
└─────────┬───────┘ │
▼ │
┌──────────────┐ │
│ RRF k=60 │◀─────────────────┘
│ → top-30 │
└──────┬───────┘
▼
┌──────────────────┐
│ Cross-encoder │
│ bge-reranker-v2 │
│ TEI batch=32 │
│ → final top-5 │
└──────┬───────────┘
▼
┌──────────────────┐
│ LLM context │
│ ~2,000 tokens │
└──────────────────┘
&lt;/code>&lt;/pre>&lt;p>Key services:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Sparse index&lt;/strong>: Elasticsearch 8.16, OpenSearch 2.18 or embedded Tantivy. Native BM25, SPLADE optional via plugin.&lt;/li>
&lt;li>&lt;strong>Vector index&lt;/strong>: Qdrant 1.13 (filterable HNSW, scalar quantization, multivectors). Covered in detail in the &lt;a href="https://blog.lo0.es/en/posts/postgresql-qdrant-rag-ingestion-postman-syncing-two-worlds/">PostgreSQL + Qdrant in ingestion post&lt;/a>.&lt;/li>
&lt;li>&lt;strong>Embedder serving&lt;/strong>: HuggingFace&amp;rsquo;s &lt;a href="https://github.com/huggingface/text-embeddings-inference">TEI (Text Embeddings Inference)&lt;/a> for bge-m3, multilingual-e5 and compatible models. OpenAI-compatible endpoint.&lt;/li>
&lt;li>&lt;strong>Reranker serving&lt;/strong>: TEI too, for the rerankers of the bge-reranker, jina-reranker and mxbai-rerank families. Separate &lt;code>/rerank&lt;/code> endpoint.&lt;/li>
&lt;li>&lt;strong>LLM for rewriter/HyDE&lt;/strong>: vLLM 0.7+ serving Qwen2.5-7B-Instruct or Phi-4-mini-Instruct. If the main LLM is the same, it shares resources; if not, a dedicated pod with GPTQ-INT4 quantization.&lt;/li>
&lt;li>&lt;strong>Orchestration&lt;/strong>: the RAG client (FastAPI, LangChain, LlamaIndex) composes the three lanes. Each parallel call (Sparse + Dense) is made concurrently; rewriter, HyDE and rerank are sequential.&lt;/li>
&lt;/ul>
&lt;p>Minimum Kubernetes manifests are already developed in the &lt;a href="https://blog.lo0.es/en/posts/vllm-kubernetes-llm-inference-that-scales/">vLLM on Kubernetes post&lt;/a> and the full orchestration piece fits the pattern of the &lt;a href="https://blog.lo0.es/en/posts/gpu-cluster-as-multi-tenant-platform/">multi-tenant H100 cluster&lt;/a>.&lt;/p>
&lt;h2 id="on-premise-hardware-what-fits-in-an-rtx-4090-vs-a-generic-4h100-sxm-configuration">On-premise hardware: what fits in an RTX 4090 vs a generic 4×H100 SXM configuration&lt;/h2>
&lt;p>The operational reality matters. Two typical profiles:&lt;/p>
&lt;p>&lt;strong>Modest configuration — 1× RTX 4090 (24 GB Ada Lovelace)&lt;/strong>&lt;/p>
&lt;p>It comfortably serves:&lt;/p>
&lt;ul>
&lt;li>bge-m3 (568M) for dense embedding of the query → ~1 GB VRAM&lt;/li>
&lt;li>bge-reranker-v2-m3 (568M) cross-encoder → ~3.5 GB VRAM at batch=32&lt;/li>
&lt;li>A light LLM for rewriter/HyDE (Qwen2.5-7B GPTQ-INT4) → ~5-6 GB VRAM&lt;/li>
&lt;li>The main LLM (Llama-3.1-8B-Instruct FP8) → ~11-12 GB VRAM&lt;/li>
&lt;/ul>
&lt;p>Total VRAM used: ~21 GB. That leaves ~3 GB for the main LLM&amp;rsquo;s KV cache, enough for 4-8 concurrent users with ~4K token contexts. For an internal corporate assistant it is viable. If you need a larger context or more concurrency, you have to split things up: either the main LLM is served outside the 4090 (another GPU, another node), or you fall back on quantising the reranker (not advisable: you lose the nDCG points that justify the cost of adding it).&lt;/p>
&lt;p>&lt;strong>Generic configuration — 4×H100 SXM (320 GB total, NVLink)&lt;/strong>&lt;/p>
&lt;p>It comfortably serves everything above multiplied by 30-50× in throughput and opens the door to:&lt;/p>
&lt;ul>
&lt;li>A large main LLM (Llama 3.3 70B FP8 or Qwen2.5-72B FP8) on 2 GPUs with tensor parallelism&lt;/li>
&lt;li>Large rerankers (bge-reranker-v2-gemma 2B) with quality ~2 points higher&lt;/li>
&lt;li>Late interaction (ColBERT-v2) on one of the nodes for critical cases&lt;/li>
&lt;li>Several light LLMs in parallel for rewriter, HyDE and the evals judge&lt;/li>
&lt;/ul>
&lt;p>The practical rule: &lt;strong>the reranker is one of the most efficient things you can put on a GPU&lt;/strong>. The VRAM used is modest, the throughput is high, and the quality improvement per euro of extra hardware is among the best in the RAG stack.&lt;/p>
&lt;h2 id="the-seven-traps-that-kill-retrieval">The seven traps that kill retrieval&lt;/h2>
&lt;p>&lt;strong>Trap 1 — Top-k to the LLM with no reranker.&lt;/strong> Dense retrieval returns a top-5 and those 5 chunks go straight to the LLM. Without a reranker, the order of the 5 is the cosine similarity order, which is not the real relevance order. The LLM answers based much more on the first chunks than the last ones, and the nuance is lost. Symptom: confident answers with citations that are not the most relevant in the corpus.&lt;/p>
&lt;p>&lt;strong>Trap 2 — Dense-only with no BM25.&lt;/strong> Short queries and queries with internal jargon work badly, the demos look pretty, real traffic complains. Symptom: on QA with real support tickets, the system fails specifically on queries of fewer than 5 words or with product codes.&lt;/p>
&lt;p>&lt;strong>Trap 3 — Reranker badly calibrated on top-k.&lt;/strong> A layer 1 top-k that is too small (top-10) cuts before the reranker can do its job. A top-k that is too large (top-200) blows up latency without improving nDCG. The canonical sweet spot is top-30 to top-50 from the hybrid → top-5 to top-10 from the reranker. Symptom: the reranker&amp;rsquo;s nDCG@5 stuck no matter which reranker model you try.&lt;/p>
&lt;p>&lt;strong>Trap 4 — Embedder and reranker in different languages.&lt;/strong> The corpus is Spanish + Catalan, the embedder is &lt;code>all-MiniLM&lt;/code> (English only), the reranker is &lt;code>bge-reranker-v2-m3&lt;/code> (multilingual). The broad layer retrieves badly because of the embedder, and the reranker has little to rerank. Symptom: Recall@50 &amp;lt; 80%, unrecoverable by changing the reranker.&lt;/p>
&lt;p>&lt;strong>Trap 5 — RRF with &lt;code>k=1&lt;/code>.&lt;/strong> Someone reads the paper, copies the formula and sets &lt;code>k=1&lt;/code> &amp;ldquo;because they do not understand what it does&amp;rdquo;. The result: the first positions of the worst ranking (whichever it is) dominate. The fusion stops averaging and becomes &amp;ldquo;winner-takes-all&amp;rdquo;. Symptom: the final ranking is almost identical to that of just one of the retrievers.&lt;/p>
&lt;p>&lt;strong>Trap 6 — A query rewriter that changes the meaning.&lt;/strong> The LLM rewriter &amp;ldquo;improves&amp;rdquo; &lt;code>&amp;quot;how do I cancel&amp;quot;&lt;/code> into &lt;code>&amp;quot;termination procedure for the premium service for corporate customers&amp;quot;&lt;/code>. It retrieves chunks about corporate customers when the user was a private individual. Over-specification by the rewriter is worse than no rewriter. Symptom: queries from &amp;ldquo;normal&amp;rdquo; users come back worse than the old ones. Mitigation: the rewriter must keep the user&amp;rsquo;s intent and only add context, never assume.&lt;/p>
&lt;p>&lt;strong>Trap 7 — No retrieval telemetry.&lt;/strong> The system serves, the user complains, you do not know whether the fault was the corpus, the retrieval, the reranker or the LLM. Without emitting traces with &lt;code>retrieved_chunks_ids&lt;/code>, &lt;code>retrieved_chunks_scores&lt;/code>, &lt;code>rerank_scores&lt;/code>, &lt;code>query_rewritten_to&lt;/code>, &lt;code>selected_top_k&lt;/code>, debugging is theatre. Symptom: each incident takes days to investigate. The &lt;a href="https://blog.lo0.es/en/posts/mcp-deep-observability-opentelemetry/">tracing with OTel and MCP&lt;/a> piece covers the canonical pattern.&lt;/p>
&lt;p>All seven are operational. Just as with the corpus, retrieval does not break because the maths is wrong: it breaks because the discipline relaxes. And as in Eval, the metrics can go up while the real experience gets worse, because the golden set accommodates itself to the system instead of the system accommodating itself to the golden set.&lt;/p>
&lt;h2 id="what-we-have-not-covered-upcoming-posts">What we have not covered (upcoming posts)&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>Embedding model selection and fine-tuning&lt;/strong>: how to choose among the embedders on the MTEB leaderboard without falling into goodharting, when and how to fine-tune an embedder on your own domain with MNR loss or triplet loss, which synthetic dataset is generated with an LLM for training (GPL, InPars, Promptagator), and the gotchas of massive re-embedding when you change model.&lt;/li>
&lt;li>&lt;strong>Semantic cache for RAG&lt;/strong>: how to cache semantically similar queries to serve answers without going through retrieval or the LLM, GPTCache, MeanCache, and the cache&amp;rsquo;s precision/coverage trade-off. It saves 30-70% of the cost on workloads with repeated queries.&lt;/li>
&lt;li>&lt;strong>Multi-vector and ColBERT-v2 at scale&lt;/strong>: how PLAID and CITADEL indexes are designed to serve corpora of 100M+ chunks with late interaction without burning the memory budget.&lt;/li>
&lt;li>&lt;strong>RAG-specific eval — RAGAS deep dive&lt;/strong>: faithfulness, answer relevance, context precision, context recall, noise sensitivity. How the RAG-specific golden set is built (with chunks labelled as relevant/irrelevant) and which metrics correlate with real user satisfaction.&lt;/li>
&lt;li>&lt;strong>Function calling and tool-augmented retrieval&lt;/strong>: when the LLM decides which retriever to invoke (SQL for structured data, vector for unstructured, web search for real time), the ReAct pattern, handling tool errors.&lt;/li>
&lt;li>&lt;strong>Agentic retrieval loops&lt;/strong>: when a single retrieval pass is not enough and the agent iterates (planning, sub-queries, summary-and-refine). The latency / quality trade-off and the anti-patterns (infinite loops, diverging sub-queries).&lt;/li>
&lt;/ul>
&lt;h2 id="see-also">See also&lt;/h2>
&lt;ul>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/serving-embeddings-rerankers-tei-production/">Serving embeddings and rerankers with TEI in production&lt;/a> — how to deploy the cross-encoder reranker with TEI and its /rerank endpoint.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/rag-cpu-data-plane-generation-plane/">Taking RAG to the CPU: separating the data plane from the generation plane&lt;/a> — where each piece runs: light rerank over a top-k fits on CPU; massive rerank demands a GPU.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/six-stage-llmops-pipeline-architecture-and-deep-dive/">The six-stage LLMOps pipeline&lt;/a> — the master map where the RAG piece crosses Data + Deploy + Observe. Retrieval lives between the curated corpus and the served LLM.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/rag-corpus-curation-active-librarian/">RAG corpus curation: the active librarian&lt;/a> — the previous layer. Without a curated corpus, no reranker rescues the system. Reranking is built on the librarian&amp;rsquo;s work.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/embeddings-2026-dense-sparse-multivector-families/">Embeddings in 2026: the three families, the model zoo and the decision that matters&lt;/a> — the piece that produces the vectors this retrieval consumes. bge-m3 runs dense + sparse + colbert in a single pass; the selection criteria and the real cost per million chunks are there.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/ontologies-knowledge-graphs-llmops-linnaean-nomenclature/">Ontologies and knowledge graphs in LLMOps&lt;/a> — the fourth retrieval channel alongside dense / sparse / multi-vector. GraphRAG (Microsoft v2 / LightRAG / HippoRAG 2 / KAG) joins the three-round committee via RRF, and typed chunks enable reranking by graph distance.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/postgresql-qdrant-rag-ingestion-postman-syncing-two-worlds/">PostgreSQL + Qdrant in the ingestion stage&lt;/a> — the retrieval microservice consumes the vector store that this architecture keeps in sync.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/rag-on-kafka-reference-architecture-streaming-datalakes/">RAG over Kafka and a datalake&lt;/a> — the streaming transport that keeps fresh the index this post&amp;rsquo;s retrieval operates over.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/anatomy-llm-request-production-tour-six-stages/">Anatomy of an LLM request in production, May 2026&lt;/a> — the forensic tour of the request crosses retrieval; this post details what happens inside that box.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/evals-llm-layer-after-tracing/">Evals for LLMs: the layer after tracing&lt;/a> — the retrieval&amp;rsquo;s Recall@k and nDCG@k are metrics the eval gate can use as a promotion criterion. If they drop, the adapter deploy is blocked.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/data-versioning-llmops-dvc-lakefs-reproducible-golden-dataset/">Data versioning: DVC, lakeFS and the challenge of a reproducible golden dataset&lt;/a> — the retrieval golden eval (queries with relevance-labelled chunks) is one of the four data artefacts worth versioning separately.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/llm-guardrails-safety-four-lines-of-defence/">Guardrails and safety for LLMs&lt;/a> — output filters are applied after the LLM, but retrieval also receives adversarial queries worth filtering beforehand (prompt injection via the query). The reranker is also a natural point for discarding chunks with sensitive material that slipped into the corpus.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/vllm-kubernetes-llm-inference-that-scales/">vLLM on Kubernetes&lt;/a> — the downstream LLM and the light LLMs for rewriter/HyDE are served with the same engine.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/oss-catalogue-llmops-six-stages-tool-by-tool/">The OSS catalogue for LLMOps in six stages&lt;/a> — spec sheets for Qdrant, Elasticsearch, TEI, vLLM, Langfuse, Phoenix.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/semantic-cache-rag-receptionist-photographic-memory/">Semantic cache in RAG: the receptionist with a photographic memory&lt;/a> — the middleware placed before this retrieval; when the query is semantically similar to one already answered (cosine ≥ θ), the reranking committee never even fires.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/evaluating-rag-ragas-golden-dataset-metrics/">Evaluating a RAG without fooling yourself: RAGAS, the golden dataset and the four metrics that matter&lt;/a> — context precision and context recall measure exactly the quality of this three-round committee; faithfulness measures what the LLM does with the resulting top-5.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/function-calling-tool-augmented-retrieval-detective-knows-which-file/">Function calling and tool-augmented retrieval: the detective who knows which file to ask for&lt;/a> — the retriever in this post is the &lt;code>vector_search&lt;/code> tool the LLM invokes in the ReAct pattern; the three-layer pipeline described here runs every time the agent picks that tool.&lt;/p>
&lt;/li>
&lt;/ul>
&lt;h2 id="references">References&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>BEIR&lt;/strong>: Thakur et al. (2021). &amp;ldquo;BEIR: A Heterogeneous Benchmark for Zero-shot Evaluation of Information Retrieval Models.&amp;rdquo; NeurIPS 2021 Datasets and Benchmarks Track. &lt;a href="https://github.com/beir-cellar/beir">https://github.com/beir-cellar/beir&lt;/a>&lt;/li>
&lt;li>&lt;strong>SPLADE&lt;/strong>: Formal et al. (2021). &amp;ldquo;SPLADE: Sparse Lexical and Expansion Model for First Stage Ranking.&amp;rdquo; SIGIR 2021. &lt;a href="https://arxiv.org/abs/2107.05720">https://arxiv.org/abs/2107.05720&lt;/a>&lt;/li>
&lt;li>&lt;strong>ColBERT-v2&lt;/strong>: Santhanam et al. (2022). &amp;ldquo;ColBERTv2: Effective and Efficient Retrieval via Lightweight Late Interaction.&amp;rdquo; NAACL 2022. &lt;a href="https://arxiv.org/abs/2112.01488">https://arxiv.org/abs/2112.01488&lt;/a>&lt;/li>
&lt;li>&lt;strong>Reciprocal Rank Fusion&lt;/strong>: Cormack, Clarke, Buettcher (2009). &amp;ldquo;Reciprocal Rank Fusion outperforms Condorcet and individual Rank Learning Methods.&amp;rdquo; SIGIR 2009. &lt;a href="https://dl.acm.org/doi/10.1145/1571941.1572114">https://dl.acm.org/doi/10.1145/1571941.1572114&lt;/a>&lt;/li>
&lt;li>&lt;strong>HyDE&lt;/strong>: Gao et al. (2022). &amp;ldquo;Precise Zero-Shot Dense Retrieval without Relevance Labels.&amp;rdquo; &lt;a href="https://arxiv.org/abs/2212.10496">https://arxiv.org/abs/2212.10496&lt;/a>&lt;/li>
&lt;li>&lt;strong>Step-back prompting&lt;/strong>: Zheng et al. (2023). &amp;ldquo;Take a Step Back: Evoking Reasoning via Abstraction in Large Language Models.&amp;rdquo; &lt;a href="https://arxiv.org/abs/2310.06117">https://arxiv.org/abs/2310.06117&lt;/a>&lt;/li>
&lt;li>&lt;strong>BGE-M3&lt;/strong>: Chen et al. (2024). &amp;ldquo;BGE M3-Embedding: Multi-Lingual, Multi-Functionality, Multi-Granularity Text Embeddings Through Self-Knowledge Distillation.&amp;rdquo; &lt;a href="https://arxiv.org/abs/2402.03216">https://arxiv.org/abs/2402.03216&lt;/a>&lt;/li>
&lt;li>&lt;strong>MTEB leaderboard&lt;/strong>: &lt;a href="https://huggingface.co/spaces/mteb/leaderboard">https://huggingface.co/spaces/mteb/leaderboard&lt;/a> — útil como punto de partida, peligroso como criterio único (overfitting al benchmark, dataset contamination).&lt;/li>
&lt;li>&lt;strong>TEI (Text Embeddings Inference)&lt;/strong>: &lt;a href="https://github.com/huggingface/text-embeddings-inference">https://github.com/huggingface/text-embeddings-inference&lt;/a> — el motor de serving de HuggingFace para embedders y rerankers de tamaño pequeño-mediano. Endpoint OpenAI-compatible.&lt;/li>
&lt;li>&lt;strong>Qdrant hybrid search&lt;/strong>: &lt;a href="https://qdrant.tech/documentation/concepts/hybrid-queries/">https://qdrant.tech/documentation/concepts/hybrid-queries/&lt;/a> — implementación nativa de RRF y multi-vector queries.&lt;/li>
&lt;li>&lt;strong>RAGatouille&lt;/strong>: &lt;a href="https://github.com/AnswerDotAI/RAGatouille">https://github.com/AnswerDotAI/RAGatouille&lt;/a> — wrapper Python para ColBERT-v2 que reduce drásticamente la curva de entrada.&lt;/li>
&lt;li>&lt;strong>Cohere Rerank 3&lt;/strong>: &lt;a href="https://docs.cohere.com/docs/rerank-2">https://docs.cohere.com/docs/rerank-2&lt;/a> — referencia técnica del reranker comercial multilingüe líder.&lt;/li>
&lt;/ul></description></item></channel></rss>