RiptideRiptide
Download Riptide SDKInstall Riptorch
Menu
Whitepapers · Riptorch · Embeddings and retrieval

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.

Version
1.2 (updated 1 December 2026: limitations section retitled; added "Reproduce it yourself")
Date
30 November 2026
Author
Samario Torres, Riptide
Software
PyTorch 2.13.0 (CUDA 12.9), transformers 5.24.1, sentence-transformers 6.3.0, FAISS 1.14.1, Riptorch 0.4.0 (release pending)
Download PDFOpen in new tabriptidecompute.com/whitepapers/embedding-pipelines

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) and BAAI/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_similarity per query; FAISS IndexFlatIP, SQfp16, SQ8, HNSW32 (efSearch 128), IVF (nprobe 16) and PQ48x8; 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

Table 1. Embedding settings against the float64 model, top-10 scored in float64. Percent of queries whose top-10 differs in order (set in brackets); nDCG@10 for the bge-base column. MiniLM and bge-base on FiQA from the H100.
embedding settingFiQA, MiniLM-L6FiQA, bge-baseFiQA bge-base nDCG@10SciFact, MiniLM-L6 (RTX 4090)SciFact, bge-base
float64 (reference)––0.4008––
float32 (stock or Riptorch)0% (0%)0% (0%)0.40080% (0%)0% (0%)
float32 with TF32 matmuls4.3% (0.6%)5.1% (0.8%)0.40082.7% (1.0%)1.3% (0.3%)
float165.7% (1.4%)7.1% (1.5%)0.40084.3% (1.0%)4.3% (1.0%)
float16, eager attention7.1% (1.5%)12.8% (2.5%)0.40084.7% (0.7%)5.3% (0.0%)
float16 through Riptorch6.2% (1.2%)8.5% (1.7%)0.40086.0% (1.7%)5.3% (0.7%)
bfloat1645.1% (9.3%)50.5% (11.3%)0.399836.7% (12.3%)40.0% (9.0%)
bfloat16, eager attention46.5% (10.2%)67.6% (18.4%)0.398737.7% (11.7%)49.0% (13.0%)
bfloat16 through Riptorch45.7% (11.0%)50.3% (12.0%)0.400638.7% (11.3%)37.7% (8.0%)
Grouped bars per dataset and model of the share of queries whose top-10 order changes for six embedding settings; bfloat16 37 to 68 percent
Figure 1. Embedding settings against the float64 model: share of queries whose top-10 order changes. FiQA and bge-base SciFact rows from the H100, MiniLM SciFact from the RTX 4090.
Grouped bars of the share of queries whose top-10 set changes; bfloat16 9 to 18 percent, float16 at most 2.5 percent
Figure 2. The same settings, counting only changes to the top-10 set (a different passage enters the top-10).

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.

Grouped bars comparing PyTorch and Riptorch forwards in float16 and bfloat16; both drift by similar amounts
Figure 3. Riptorch’s and PyTorch’s forwards at the same precision drift by about the same amount: the precision, not the library, moves the ranking.
Bars of the share of queries with a 10th-to-11th score gap below 0.001 (18 to 39 percent) and below 0.0001 (2 to 6 percent)
Figure 4. How close the 10th and 11th float64 scores are, per dataset and model. A float16 value near 0.9 has a spacing of about 0.0005.

Step 2: the search precision, on the same float32 vectors

Table 2. Search methods on the stored float32 vectors, FiQA, against the float64 ranking of those vectors (H100). Percent of queries with a different top-10 order (set in brackets).
searchMiniLM-L6bge-basebge-base nDCG@10
PyTorch float32 normalise + matmul + topk0% (0%)0% (0%)0.4008
F.cosine_similarity per query, float320% (0%)0% (0%)0.4008
FAISS IndexFlatIP (float32)0% (0%)0% (0%)0.4008
Riptorch float32 index0% (0%)0% (0%)0.4008
FAISS float16 storage (SQfp16)1.2% (0.2%)2.3% (0.6%)0.4007
PyTorch with TF321.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 10034.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 matmul67.6% (19.4%)92.3% (40.3%)0.4000
FAISS PQ48x8100% (99.1%)100% (100%)0.2911
Horizontal paired bars of search methods by share of FiQA queries reordered, from 0 percent for float32 to 100 percent for PQ; PyTorch float16 11.4 and 33.0 percent highlighted
Figure 5. Search methods on the same float32 vectors, FiQA (H100). Upper bar MiniLM-L6, lower bar bge-base; PyTorch’s fastest path in orange. *Riptorch int16 is measured against its own stored vectors (Table 3).

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

Table 3. Integer storage on FiQA (H100). "Own truth" = the float64 cosine ranking of the stored integer vectors; "vs float32" = the float64 ranking of the original float32 vectors. Percent of queries with a different top-10 order.
storage and searchMiniLM own truthMiniLM vs float32MiniLM recall@10, nDCG@10bge-base own truthbge-base vs float32bge-base recall@10, nDCG@10
float32 vectors, float64 scoring–0%1.0000, 0.3687–0%1.0000, 0.4008
int16, Riptorch exact0%0.3%1.0000, 0.36870%0.2%1.0000, 0.4007
int16, PyTorch float16 cosine11.0%11.3%0.9971, 0.368932.3%32.3%0.9927, 0.4005
int8, Riptorch exact0%49.5%0.9889, 0.36870%79.5%0.9710, 0.4004
int8, PyTorch float32 cosine0.2%49.5%0.9889, 0.36870.2%79.5%0.9708, 0.4004
int8, PyTorch float16 cosine14.2%48.9%0.9881, 0.368830.7%81.0%0.9711, 0.4004
sentence-transformers int8 (per-dimension), dot product100%100%0.7466, 0.3382100%100%0.6225, 0.3533
Two panels of paired bars: for int16 and int8 storage, reorder rate against the stored integer vectors (0 for Riptorch exact) and against the float32 vectors
Figure 6. Integer storage on FiQA: reorder rate measured against the stored integer vectors (blue) and against the original float32 vectors (grey). Exact scoring adds no drift; int8 storage itself loses order information, int16 hardly any.
Paired bars of nDCG@10 by storage format; sentence-transformers int8 in red at 0.338 and 0.353 against 0.369 and 0.401 for float32
Figure 7. nDCG@10 on FiQA by storage format (left bar MiniLM-L6, right bar bge-base). The sentence-transformers int8 recipe is in red.
Paired bars of recall@10 against the float32 vectors by storage format; 1.00 for int16 exact, 0.62 to 0.75 for sentence-transformers int8
Figure 8. Recall@10 against the float32 vectors’ top-10, by storage format.

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

  1. 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.
  2. Normalise in float32 or float64 (the cost is negligible next to the model).
  3. 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.
  4. 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.

Two panels of stacked horizontal bars of RAG per-query latency by stage for six pipelines on the RTX 4090 and five on the H100, with totals and nDCG
Figure 9. RAG on FiQA, per-query latency by stage (embed query, retrieve 100, rerank 100) and the resulting nDCG@10. The hybrid int8 pipeline matches the all-stock nDCG at similar latency; all-Riptorch is slower because both transformer forwards run in Riptorch.
Log-scale grouped bars of maximum loss difference from stock float32 for three fine-tuning tasks; Riptorch float32 2e-7 to 4e-5, bf16 paths 3e-6 to 5e-2
Figure 10. Fine-tuning on the H100 (30 steps each): largest difference from the stock float32 loss curve. Riptorch float32 stays within 2e-7 to 4e-5; bfloat16 autocast and torch.compile drift by 4e-5 to 5e-2.

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.compile in 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.
Grouped bars of embedding texts per second on the H100 at batch 32 for five models; PyTorch fastest far ahead of Riptorch
Figure 11. Producing embeddings on the H100, batch 32: PyTorch’s fastest configuration, PyTorch float32 and Riptorch.
  • 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_pretrained does 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.compile was 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 two torch.nn internals 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/scifact and 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.