Reducing IVF routing with FP8 centroids
RAG can retrieve better context when an index contains more documents and embeddings. A broad corpus covers queries that a small collection does not contain, but it also makes each query search through many more vectors.
With a small number of vectors, exact search compares a query with every embedding and ranks the results. The cost of that brute-force approach grows with the corpus, and becomes unsustainable with millions or billions of vectors when the system must return results at low latency. Approximate nearest-neighbor (ANN) indexes reduce the space explored before retrieving candidates, which, in return, can miss the exact nearest neighbor.
Two index families often appear in this scenario. HNSW builds a navigable graph of vectors and usually achieves good recall with low latency. Its graph and the vectors needed to traverse it grow with the corpus and need to stay in RAM in many configurations. IVF indexes divide the space into regions and first choose which regions are worth exploring. They can keep the vector lists outside memory and retain the layer that routes the search in RAM.
In our paper, Memory Optimization of IVF Indices for RAG Systems Using FP8 Centroid Quantization, we focus on the IVF routing layer because of that separation. With IVF, centroids can remain in memory while posting lists containing the document vectors can be stored on SSDs.
We study whether centroids can move from float32 to FP8 without changing the document vectors or their posting lists and how this affects the routing quality.
Why centroids are on the critical path
An IVF index splits embeddings into nlist regions. Each region has a centroid. To answer a query, the index compares its embedding with every centroid and selects the nprobe closest regions. It then searches only the corresponding posting lists. This reduces the number of comparisons needed.
The index starts with no assigned clusters.
This separation allows the large corpus to live in cheaper storage, but the centroid table is consulted for every query and needs to remain in memory. Its cost is:
where is routing memory, is the embedding dimensionality, and is bytes per coordinate. In float32, is 4. In FP8, it is 1.
The point here is not to compress the entire index, but only the representations used to decide which lists to explore. Once the lists have been selected, the document vectors and the ranking continue to use the index’s original representation, as they are loaded from cheaper storage
Precision or range
We tested the E4M3FN and E5M2 FP8 formats. Both use 8 bits, but distribute them differently between exponent and mantissa. E5M2 has more dynamic range. E4M3FN allocates one additional bit to the mantissa, so it represents nearby values more precisely.
For a centroid table, that local precision proved more useful than wider range. Cluster assignment depends on fine comparisons between similar distances. A small shift in a centroid can change which list is explored even when the stored vectors have not changed.
Evaluation
For each dataset, search engine and FP8 format, we trained a separate IVF index. We extracted its float32 centroids, cast them to E4M3FN or E5M2, then converted them back to float32 before putting them back into the index. The search engine therefore follows the same float32 path in every run. Only the rounding error left by the FP8 conversion changes the routing table.
We ran the protocol in both FAISS and ScaNN, with the same corpus and index configuration for each FP32 baseline and its FP8 counterpart.
For geometric retrieval, we used glove-100-angular, which asks the index to recover the nearest vectors under angular distance. We report Recall@10, and compare results to see whether FP8 centroids change which parts of the vector space IVF explores.
For semantic retrieval, we encoded three MTEB Retrieval datasets with the 384-dimensional all-MiniLM-L6-v2 model: FiQA2018, MLQuestions and QuoraRetrieval. They cover financial questions, multilingual question retrieval and duplicate questions, with different corpus sizes. We report nDCG@10, which rewards relevant documents near the top of the ranking, and MRR@10, which measures the position of the first relevant result. Together, the two benchmarks test geometric nearest-neighbour recovery and retrieval quality on semantic embeddings.
Results
E4M3FN has the tighter recall distribution
We measured absolute Recall@10 degradation over the full glove-100-angular configuration sweep. E4M3FN stays closer to the FP32 baseline in both engines, while E5M2 produces a wider spread and the largest outliers. The extra mantissa bit matters more than E5M2’s additional exponent range when IVF decides which lists to probe.
Geometric retrieval
Across the full configuration sweep, mean Recall@10 degradation with E4M3FN was 0.085% in FAISS and 0.095% in ScaNN, while E5M2 averaged 0.304% and 0.405%, respectively. The QPS-recall frontiers remain almost on top of their FP32 equivalents. QPS is included to show the configurations that were evaluated, not as a claim that FP8 made the engines faster. Centroids are restored to FP32 before search, so the experiment preserves the search path and measures the routing error left by the conversion.
Semantic retrieval
Across all metric values from the semantic benchmark, E4M3FN had a mean absolute difference of 0.262 percentage points from FP32 and E5M2 reached 0.295 percentage points. The differences are small enough that routing preserves the ranking. Occasional small improvements can appear when approximate routing swaps nearly tied candidates, rather than because quantization improves retrieval. The plots below break this down by engine and task for Recall@10, nDCG@10 and MRR@10.
When this is useful
FP8 centroids are a localized optimization. They do not automatically reduce the size of the full index, because posting lists, vectors, metadata and auxiliary structures can use much more memory. The approach is useful when the routing table itself is large enough to pressure RAM, especially in hybrid architectures where the corpus lives outside memory.
These experiments make E4M3FN the more consistent FP8 option. It should still be tested with the model, metric and embedding distribution used in production. IVF either searches a posting list or skips it, so centroid quantization depends on the gap between candidate centroids.
The full paper, including the experimental protocol and result tables, is available on Springer.
