How embedding pipelines change the answer
The same texts and the same model can retrieve different passages depending on the precision of the model, the precision of the search and how the vectors are stored. This paper measures how often, on two BEIR datasets and two embedding models, against a float64 reference.
Abstract
Retrieval-augmented generation puts the top results of a vector search in front of a language model, so a different top-10 means a different answer. On BEIR FiQA (57,638 passages, 648 queries) and SciFact (5,183 passages, 300 queries), with all-MiniLM-L6-v2 and bge-base-en-v1.5 on an NVIDIA RTX 4090 and an H100, every result was compared with the same model run in float64 and scored in float64.
Three steps change the ranking. The model's precision: embeddings computed in bfloat16 changed the top-10 order for 45–51% of FiQA queries and the top-10 set for 9–12%; float16 for 6–7% (7–13% with eager attention); float32 for none. The search precision: scoring float32 vectors with a float16 matrix multiply, PyTorch's fastest brute force, changed the order for 11.4% (MiniLM) and 33.0% (bge-base) of FiQA queries, and bfloat16 for 67.6% and 92.3%. The storage format: the int8 recipe in sentence-transformers changed every query's top-10 and lowered nDCG@10 by 8% and 12%.
int16 storage of the float32 vectors, scored by Riptorch's exact index, returned the float64 ranking of the stored vectors on every query and matched the float32 vectors' top-10 set on every query (recall@10 1.0000, nDCG@10 unchanged to four decimals for MiniLM and within 0.0001 for bge-base), at half the memory of float32. nDCG@10 hardly moves under most of these changes, which is why leaderboards do not show them.
The problem
Retrieval benchmarks score a ranking against human relevance labels. Those labels are sparse (a few relevant passages per query), so two near-equal passages swapping places in a top-10 rarely changes nDCG@10. A user asking the same question twice, or a system re-indexed on another GPU, sees the swap.
The size of the problem depends on how close the scores are at the cut-off. On FiQA with bge-base, the median gap between the 10th and 11th float64 score is 0.0015; 38.9% of queries have a gap below 0.001 and 6.0% below 0.0001. With MiniLM the median gap is 0.0029, with 21.6% of queries below 0.001. A float16 number near 0.9 has a spacing of about 0.0005, so ordinary rounding is enough to reorder a large share of these rankings.
Method
Reference and metrics
- Reference ("truth"): the same model in float64 on the GPU, eager (math) attention, float64 pooling and normalisation, scored in float64 with NumPy; top-10 per query, ties broken by the lowest document index.
- Different order: the share of queries whose top-10 identifiers, in order, differ from the reference. Different set: the share whose top-10 identifiers differ as a set. Recall@10 against the reference top-10. nDCG@10 against the BEIR relevance labels (qrels).
- For stored integer vectors there are two references: the float64 ranking of the original float32 vectors, and the float64 cosine ranking of the integer vectors themselves ("own truth"). The second isolates the search step from the storage step.
Data and models
- BEIR FiQA (57,638 passages, 648 test queries) and SciFact (5,183 passages, 300 test queries). Texts are title + ". " + text, truncated to 256 tokens, with the query and passage prefixes from each model card.
sentence-transformers/all-MiniLM-L6-v2(mean pooling, 384 dimensions) andBAAI/bge-base-en-v1.5(CLS pooling, 768 dimensions).- Embedding settings in stock PyTorch: float32 (SDPA attention, TF32 off), float32 with TF32, float32 eager attention, float16 (SDPA with fused kernels), float16 eager, bfloat16, bfloat16 eager, float16 one text at a time, float16 in batches of 256 in corpus order (maximal padding). Default batches are 64 texts sorted by length. The same model was also run through Riptorch in float32, float16 and bfloat16.
- Search methods on the stored vectors: PyTorch float32, TF32, float16 and bfloat16 (normalise, matmul,
topk);F.cosine_similarityper query; FAISSIndexFlatIP,SQfp16,SQ8,HNSW32(efSearch 128),IVF(nprobe 16) andPQ48x8; sign-bit binary codes, with and without a float32 rerank of 100; Riptorch's float32 index and its exact index on int8 and int16 vectors. - Integer storage: int16 and int8 quantisations of the float32 vectors made by the benchmark (queries quantised the same way), and the sentence-transformers recipe,
quantize_embeddings(precision="int8"), which calibrates a range per dimension and is scored by the integer dot product.
Exact scoring
Riptorch's exact index takes integer vectors and returns, for every query, the top-10 in the order of the float64 cosine similarity of those vectors, ties to the lowest index. The companion paper, Exact vector search on GPUs and CPUs, measures its speed and exactness on six GPUs and four CPUs.
Machines
RunPod RTX 4090 (24 GB, AMD EPYC 75F3 host) and H100 80GB HBM3 (Xeon Platinum 8470 host), driver 595.112.07, 29–30 November 2026. PyTorch 2.13.0+cu129, transformers 5.24.1, sentence-transformers 6.3.0, FAISS 1.14.1 (CPU FAISS for the drift analysis), Riptorch 0.4.0 wheel. The H100 ran bge-base on both datasets and MiniLM on FiQA; the RTX 4090 ran MiniLM on both datasets. Where both GPUs ran the same search row, the rates agree within 0.2 percentage points.
Results
Step 1: the model's precision
| embedding setting | FiQA, MiniLM-L6 | FiQA, bge-base | FiQA bge-base nDCG@10 | SciFact, MiniLM-L6 (RTX 4090) | SciFact, bge-base |
|---|---|---|---|---|---|
| float64 (reference) | – | – | 0.4008 | – | – |
| float32 (stock or Riptorch) | 0% (0%) | 0% (0%) | 0.4008 | 0% (0%) | 0% (0%) |
| float32 with TF32 matmuls | 4.3% (0.6%) | 5.1% (0.8%) | 0.4008 | 2.7% (1.0%) | 1.3% (0.3%) |
| float16 | 5.7% (1.4%) | 7.1% (1.5%) | 0.4008 | 4.3% (1.0%) | 4.3% (1.0%) |
| float16, eager attention | 7.1% (1.5%) | 12.8% (2.5%) | 0.4008 | 4.7% (0.7%) | 5.3% (0.0%) |
| float16 through Riptorch | 6.2% (1.2%) | 8.5% (1.7%) | 0.4008 | 6.0% (1.7%) | 5.3% (0.7%) |
| bfloat16 | 45.1% (9.3%) | 50.5% (11.3%) | 0.3998 | 36.7% (12.3%) | 40.0% (9.0%) |
| bfloat16, eager attention | 46.5% (10.2%) | 67.6% (18.4%) | 0.3987 | 37.7% (11.7%) | 49.0% (13.0%) |
| bfloat16 through Riptorch | 45.7% (11.0%) | 50.3% (12.0%) | 0.4006 | 38.7% (11.3%) | 37.7% (8.0%) |


Batch composition matters in float16 too: on FiQA with MiniLM, float16 one text at a time changed 6.3% of orders and maximal padding 6.8%, against 5.7% for length-sorted batches of 64. Riptorch's own float16 and bfloat16 forwards drift by about the same amounts as stock PyTorch: the precision of the model, not the library, is what moves the ranking.


Step 2: the search precision, on the same float32 vectors
| search | MiniLM-L6 | bge-base | bge-base nDCG@10 |
|---|---|---|---|
PyTorch float32 normalise + matmul + topk | 0% (0%) | 0% (0%) | 0.4008 |
F.cosine_similarity per query, float32 | 0% (0%) | 0% (0%) | 0.4008 |
FAISS IndexFlatIP (float32) | 0% (0%) | 0% (0%) | 0.4008 |
| Riptorch float32 index | 0% (0%) | 0% (0%) | 0.4008 |
FAISS float16 storage (SQfp16) | 1.2% (0.2%) | 2.3% (0.6%) | 0.4007 |
| PyTorch with TF32 | 1.4% (0.2%) | 2.5% (0.5%) | 0.4007 |
FAISS HNSW32, efSearch 128 (approximate) | 1.4% (1.4%) | 7.7% (7.7%) | 0.3982 |
| PyTorch float16 matmul (PyTorch's fastest) | 11.4% (3.1%) | 33.0% (7.3%) | 0.4005 |
FAISS SQ8 (per-dimension int8) | 30.9% (5.7%) | 34.6% (8.5%) | 0.4007 |
| binary codes + float32 rerank of 100 | 34.4% (34.4%) | 50.5% (50.5%) | 0.3967 |
FAISS IVF, nprobe 16 (approximate) | 45.1% (45.1%) | 57.4% (57.4%) | 0.3668 |
| PyTorch bfloat16 matmul | 67.6% (19.4%) | 92.3% (40.3%) | 0.4000 |
FAISS PQ48x8 | 100% (99.1%) | 100% (100%) | 0.2911 |

Scoring good float32 vectors with a float16 matrix multiply reorders a third of the bge-base rankings while nDCG@10 changes in the fourth decimal (0.4008 to 0.4005). The larger the model and the closer its scores at the cut-off, the more the search precision matters.
Step 3: how the vectors are stored
| storage and search | MiniLM own truth | MiniLM vs float32 | MiniLM recall@10, nDCG@10 | bge-base own truth | bge-base vs float32 | bge-base recall@10, nDCG@10 |
|---|---|---|---|---|---|---|
| float32 vectors, float64 scoring | – | 0% | 1.0000, 0.3687 | – | 0% | 1.0000, 0.4008 |
| int16, Riptorch exact | 0% | 0.3% | 1.0000, 0.3687 | 0% | 0.2% | 1.0000, 0.4007 |
| int16, PyTorch float16 cosine | 11.0% | 11.3% | 0.9971, 0.3689 | 32.3% | 32.3% | 0.9927, 0.4005 |
| int8, Riptorch exact | 0% | 49.5% | 0.9889, 0.3687 | 0% | 79.5% | 0.9710, 0.4004 |
| int8, PyTorch float32 cosine | 0.2% | 49.5% | 0.9889, 0.3687 | 0.2% | 79.5% | 0.9708, 0.4004 |
| int8, PyTorch float16 cosine | 14.2% | 48.9% | 0.9881, 0.3688 | 30.7% | 81.0% | 0.9711, 0.4004 |
| sentence-transformers int8 (per-dimension), dot product | 100% | 100% | 0.7466, 0.3382 | 100% | 100% | 0.6225, 0.3533 |



Two results stand out. int16 storage keeps the float ranking: the exact index returned the int16 vectors' own float64 ranking on every query, and that ranking differs from the float32 vectors' only in order, on 0.2–0.3% of FiQA queries, with recall@10 1.0000. It takes 2 bytes per dimension instead of 4. Per-dimension int8 calibration breaks the geometry: sentence-transformers' recipe rescales each dimension separately and then scores by the raw dot product, which no longer ranks like cosine similarity. It changed every top-10 and lowered nDCG@10 from 0.3687 to 0.3382 (MiniLM, −8%) and from 0.4008 to 0.3533 (bge-base, −12%). On SciFact the same recipe changed every top-10 for both models as well (bge-base nDCG@10 0.7340 to 0.7096).
int8 storage is exact for what is stored but stores less: 4× smaller than float32, with recall@10 of 0.971–0.989 against the float32 vectors on FiQA (0.986–0.991 on SciFact). The exact index cannot recover information that quantisation removed; it guarantees only that the search adds no further drift.
The pipeline these results support
- Embed in float16 with float32 accumulation, or in float32 where the answer must not change. Avoid bfloat16 for retrieval embeddings: it is the setting that moved about half the rankings.
- Normalise in float32 or float64 (the cost is negligible next to the model).
- Store int16 (half the memory of float32, the float ranking kept in these measurements) or int8 (a quarter, exact for what is stored). Avoid per-dimension int8 recipes scored by a raw dot product. Quantise queries the same way as the stored vectors.
- Score exactly with Riptorch's exact index: the same top-10 on every GPU, CPU and batch size measured.
Today the model forward runs fastest in stock PyTorch or ONNX Runtime, so the measured pipeline was hybrid: stock PyTorch for the transformer, Riptorch beside it in the same process for exact search. On FiQA with a cross-encoder rerank of 100, the hybrid int8 pipeline gave the same nDCG@10 as the all-stock pipeline (0.3675) at 25.0 ms per query against 24.9 ms on the RTX 4090, and 26.3 ms against 23.9 ms on the H100.


Limitations and next steps
The limits of these results, each with its cause and, where one is planned, the next step.
- Producing embeddings. Riptorch's own transformer forward ran at 0.04–0.21× the throughput of PyTorch's fastest configuration on the RTX 4090 and H100 (for example MiniLM at batch 32 on the H100: 797 against 22,590 texts per second with
torch.compilein float16), and at 0.23–0.58× of stock MPS on an Apple M4 (MiniLM, partial run). Cause: the time goes to preparing each forward on the host, not to GPU arithmetic, which is why precision makes no difference. Hence the hybrid pipeline above.

- End-to-end RAG in Riptorch alone took 88.6–100.7 ms per query against 23.9–24.9 ms for stock PyTorch. Cause: both transformer forwards run in Riptorch (previous item).
- int16 exact search on CUDA is much slower than int8: on FiQA, 157 ms (RTX 4090) and 88–135 ms (H100) for all 648 queries, against 5.9–8.0 ms for int8. int16 is the storage that keeps the float ranking, so speeding it up is the priority. Cause: under investigation.
- Riptorch's float16 and bfloat16 forwards drift like stock PyTorch's (Table 1). Cause: exactness today covers the search step, not the model.
- Loading models. Hugging Face
AutoModel.from_pretraineddoes not yet load into Riptorch directly, because the loader uses a storage API Riptorch does not yet provide (the measurements built the model from its config and loaded the safetensors weights);riptorch.compilewas about 5× slower than eager for encoder forwards (reason under investigation), so every Riptorch row is eager; the PEFT library does not import, because Riptorch lacks twotorch.nninternals it uses. - Scope. Two datasets, two models, two GPUs; the drift analysis ran once per configuration (the rates are counts over fixed query sets, not timings, so they are deterministic for a given GPU and library version).
Reproduce it yourself
Run kits/exact-vector-search from the public riptide-reproduce repository: one command, a few minutes on a laptop, public software only. It reproduces how often float16 and bfloat16 search change the top-10 order against float64, and Riptorch 0.4.0's exact index keeping it. Every baseline's value and its error against the exact answer are printed and saved to errors.csv, and the exact results print the same hash on every machine: if your float hash differs from ours or a colleague's, that is precision drift in your pipeline.
Reproduction notes
- Drift. For each dataset, model and setting: embed the corpus and queries, store the vectors, search, and compare every top-10 with the float64 reference. Datasets come from the BEIR collections (
BeIR/fiqa,BeIR/scifactand their qrels). - RAG. Chunking, corpus embedding, index, query embedding, retrieve 100, cross-encoder rerank, nDCG@10; six pipelines from all-stock to all-Riptorch.
- Software. Riptorch 0.4.0 is pending release; until it is published, the Riptorch page and the playgrounds are the public entry points, and evaluation builds are available through Request an evaluation.
- Records. Run
workloads-2026-11-30: raw JSON lines per machine, machine records, scripts, and the stored embeddings (RTX 4090 and H100). Evaluation partners can have the raw files on request. That campaign's CUDA library caveat (Riptorch probably loaded CUDA 13 libraries through an ONNX Runtime dependency while stock PyTorch used CUDA 12.9) applies to the timing rows here (throughput, RAG latency, int16 search times). None of the correctness numbers depend on it: each is a count against float64.
Date and version
Version 1.2, 30 November 2026. Measurements from 29 and 30 November 2026. Updated 1 December 2026: limitations section retitled. Updated 1 December 2026: added "Reproduce it yourself".
Working with Riptide
Riptide works with a small number of teams. Each engagement starts with 4 weeks inside your systems, learning how your models, data and infrastructure work. Only then does Riptide apply its software to them. Contact samario@riptidecompute.com or riptidecompute.com/evaluate.