RiptideRiptide
Download Riptide SDKInstall Riptorch
Menu
Whitepapers · Riptorch · Vector search

Exact vector search on GPUs and CPUs

An exact search index for int8 vectors, measured on six NVIDIA GPUs and four CPUs against PyTorch's fastest brute force, F.cosine_similarity, FAISS and NVIDIA cuVS. Every Riptorch result returned the float64 top-10, in order, on every query.

Version
1.2 (updated 1 December 2026: limitations section retitled; added "Reproduce it yourself")
Date
30 November 2026
Author
Samario Torres, Riptide
Software
Riptorch 0.4.0 (release pending) and development builds of 29 November 2026; PyTorch 2.13.0 (CUDA 12.9) and 2.15.0 (CPU)
Download PDFOpen in new tabriptidecompute.com/whitepapers/exact-vector-search

Abstract

A brute-force vector search computes the similarity of each query to every stored vector and keeps the best . In PyTorch the fastest way to do that on a GPU is to normalise the vectors once and run a half-precision matrix multiply followed by torch.topk. Rounding in that pipeline merges close scores, so the returned top-10 is often not the true top-10 order of the stored vectors.

Riptorch's exact similarity index stores integer vectors and returns the top-10 in the order a float64 reference gives. On the measurements in this paper it returned the float64 top-10, in the same order, for every query on every machine. It was also faster than PyTorch's fastest brute force at the sizes where search is expensive: 1.89–3.85× at 8 million vectors on five data-centre and workstation GPUs, 1.86× at 10 million 384-dimensional vectors on an RTX 4090 (where float16 returned the exact order for 7 of 16 queries), 4.2× NVIDIA cuVS brute force and 7.0× FAISS GpuIndexFlatIP on the same vectors, and 1.58–8.49× at 2 million vectors on four CPUs. It is slower at 100 thousand vectors on GPUs and on most GPUs at 500 thousand, at 64 or more queries per call, and against approximate indexes.

The problem

A search result is exact in this paper when its top-10 identifiers equal the top-10 of a float64 reference computed from the same stored vectors, in the same order, with ties broken by the lowest index. The question is whether a pipeline returns that ranking, and how fast.

Cosine scores near the top of a ranking are close together. A float16 number carries 11 significant bits, so near 0.9 consecutive float16 values are about 0.0005 apart, and bfloat16 values about 0.004 apart. When the gap between neighbours in a top-10 is smaller than that, rounding turns the pair into a tie or swaps it, and which document wins then depends on the kernel, the batch size and the device. In the BEIR FiQA data used in the companion paper, How embedding pipelines change the answer, 38.9% of queries have a gap below 0.001 between the 10th and 11th score with bge-base.

Float32 scoring avoids most of that drift but took 1.9–2.6 times as long as float16 on the GPUs measured here. The plain spelling most code uses, F.cosine_similarity per query followed by torch.topk, is exact enough in float32 and 56–114 times slower again.

Method

What is measured

Riptorch's exact similarity index takes int8 vectors (float embeddings are quantised to int8 first; the companion paper measures what quantisation does to rankings) and a batch of int8 queries, and returns the top-10 identifiers per query. The claim under test is behavioural: the returned top-10 equals the float64 top-10 of the same stored vectors, in order, with ties to the lowest index, and the question is how long it takes. How the index reaches that result is not described here.

Baselines

Every baseline ran on the same machine as Riptorch, in the same session, on the same stored values.

  • PyTorch's fastest brute force (normdot): the documents are normalised once with F.normalize (not timed), then torch.topk(F.normalize(Q) @ Xn.T, 10). In the GPU sweep (Tables 2 and 3) this ran in float32 with PyTorch's default matmul settings; on that data float32 also returned the exact order on every query, so those rows compare speed at equal exactness. In the embedding-scale runs (Tables 4 and 5) it is named by precision: float16 (.half() vectors, PyTorch's fastest) and float32.
  • The common spelling: torch.topk(F.cosine_similarity(q[None], X, dim=1), 10) per query.
  • FAISS GpuIndexFlatIP on the normalised float32 vectors (faiss-gpu-cu12 1.14.1). The pip wheels have no sm_90 kernels, so FAISS GPU did not run on the H100.
  • NVIDIA cuVS 26.10 brute_force (exact float32 inner product).
  • On CPUs, PyTorch's fastest is the same normdot spelling in float32 on the CPU (it was faster there than on Apple's MPS back end, so the CPU row is the baseline on the Apple M4).

Data

  • GPU sweep and CPU runs: N documents × 256 dimensions and 16 queries, integers in the int8 range drawn from NumPy's default_rng(1234), with 3 planted near-duplicates per query so the top of each ranking is meaningful. Float32 holds these values and their dot products exactly, so every method scores the same numbers.
  • Embedding-scale runs: N unit vectors in 384, 768 or 1,024 dimensions from 8,192 Gaussian clusters (spread 0.6), 1% exact duplicates, quantised to int8; queries are corpus vectors plus noise, re-quantised; seed 7. These are synthetic vectors shaped like an int8 vector store, not a public dataset.

Timing and truth

  • Each method ran in its own process. One warm-up call, then the median of 7 calls (3 calls for F.cosine_similarity at 1 million vectors or more). A call is the whole query batch until the result identifiers are a Python list on the host, so all of Riptorch's work is included.
  • Truth: float64 cosine of the stored vectors (NumPy, or a float64 GPU matmul for the embedding-scale runs), top-10 per query, ties by the lowest index.
  • These runs did not compute confidence intervals. Repeatability was checked instead: the pinned CUDA 12 rerun of Tables 4 and 5 ran every row twice, and the two passes agree within 0.3 ms on every row and within 4% of the original campaign.

Machines and software

Table 1. Machines. Every GPU was a rented RunPod instance; every CPU was an AWS EC2 instance.
machinewherehostdriver / CUDAstock softwareRiptorch
NVIDIA H100 SXM 80GB, H200 SXM, B200, RTX PRO 6000 Blackwell Server, A100 SXM 80GBRunPod, 29 Nov 2026Xeon 8470 / Xeon 6548Y+ / Xeon 6972P / EPYC 9554 / EPYC 7742595.112.07 / 13.2 (H200: 575.57.08 / 12.9)PyTorch 2.13.0+cu129development build, 29 Nov
NVIDIA RTX 4090 24 GBRunPod, 29 Nov 2026–CUDA 13.2PyTorch 2.13.0+cu129later development build, 29 Nov
NVIDIA RTX 4090 24 GB, H100 80GB HBM3 (original campaign)RunPod, 30 Nov 2026EPYC 75F3 / Xeon 8470595.112.07PyTorch 2.13.0+cu129, FAISS 1.14.1, cuVS 26.100.4.0 wheel (see note below)
NVIDIA RTX 4090 24 GB, H100 80GB HBM3 (pinned rerun)RunPod, 30 Nov 2026Ryzen 9 9950X / Xeon 8468595.112.07 / 13.2PyTorch 2.13.0+cu129, FAISS 1.14.1, cuVS 26.10; every library on the same CUDA 12.9 libraries0.4.0 wheel
Intel Xeon Platinum 8488C (Sapphire Rapids), 8 coresEC2 c7i.4xlarge, us-east-2, 30 Nov 2026PyTorch 2.15.0+cpu0.4.0 release wheel
AMD EPYC 9R14 (Genoa), 16 coresEC2 c7a.4xlargePyTorch 2.15.0+cpu0.4.0 release wheel
AWS Graviton4 (Neoverse V2), 16 coresEC2 c8g.4xlargePyTorch 2.15.0+cpu0.4.0 release wheel
Apple M4, 10-core CPUEC2 mac-m4.metal, us-east-2PyTorch 2.15.00.4.0 release wheel

Tables 4 and 5 are from the pinned rerun. The 1M-vector rows, the 64-query rows and the comparisons with F.cosine_similarity at embedding scale are from the original campaign of the same day, in which Riptorch probably loaded CUDA 13 libraries through an ONNX Runtime dependency while stock PyTorch used CUDA 12.9; the pinned rerun removed that difference and agreed with the original within 4%.

Results

Five GPUs, 100 thousand to 8 million vectors

Table 2. Exact index vs PyTorch's fastest brute force (float32 normdot), 256 dimensions, 16 queries, top-10. Ratio = PyTorch time / Riptorch time. Both sides returned the exact order on all 16 queries at every size.
GPU100K500K2M8M8M time, PyTorch → Riptorch8M vs F.cosine_similarity
H100 SXM0.47×0.91×1.67×2.09×5.81 → 2.78 ms156×
H200 SXM0.55×1.00×1.48×2.05×5.66 → 2.76 ms136×
B2000.31×0.89×1.52×1.89×4.86 → 2.57 ms123×
RTX PRO 60000.22×0.80×2.62×3.85×13.13 → 3.41 ms214×
A100 SXM0.59×1.13×1.65×2.35×11.00 → 4.69 ms150×
Bar chart: exact index speed-up over PyTorch fastest at 8M vectors, H100 2.09, H200 2.05, B200 1.89, RTX PRO 6000 3.85, A100 2.35
Figure 1. Speed-up of the exact index over PyTorch’s fastest brute force at 8 million vectors, 16 queries. Tick labels give PyTorch’s time and Riptorch’s time; the dashed line is parity.
Five log-log panels of milliseconds per call against stored vectors for PyTorch fastest, Riptorch exact and F.cosine_similarity
Figure 2. Time per 16-query call against collection size on each GPU (log scales). Riptorch’s exact index starts above PyTorch’s fastest path at 100 thousand vectors and crosses below it by 2 million (by 500 thousand on the A100).
Line chart of speed-up against collection size for five GPUs, below 1 at 100K and rising to 1.9–3.85 at 8M
Figure 3. Speed-up over PyTorch’s fastest path by collection size; values below the dashed line mean Riptorch is slower.
Bar chart of speed-up over F.cosine_similarity at 8M vectors: 123 to 214 times
Figure 4. Against the common spelling, F.cosine_similarity per query followed by topk, at 8 million vectors.
Table 3. The same comparison at 2 million vectors with more queries per call.
GPU16 queries64 queries256 queries
H100 SXM1.67×1.17×0.77×
H200 SXM1.48×1.18×1.19×
B2001.52×1.05×1.06×
RTX PRO 60002.62×1.13×1.03×
A100 SXM1.65×1.43×1.50×
Grouped bars of speed-up at 2M vectors for 16, 64 and 256 queries per call on five GPUs
Figure 5. Speed-up at 2 million vectors by queries per call. The advantage shrinks as more queries share one call.

On the RTX 4090 the same benchmark at 2 million vectors, run on 29 November with a later development build, gave 1.46 ms for the exact index against 3.29 ms for PyTorch's fastest (2.26×), and 1.21× at 500 thousand vectors.

Run gpu-sweep-2026-11-29 (sections 1–2) and cuda-search-2026-11-29. Correctness in the same sweep: the GPU search matched Riptorch's CPU back end on 704 of 704 checks (4 metrics, 44 shapes including ties) on every GPU.

Embedding-scale search: 10 and 50 million vectors

Table 4. RTX 4090, 10 million vectors, top-10. Milliseconds per call; in brackets, queries whose top-10 is exact and in order. Pinned CUDA 12 rerun of 30 November.
vectors × dimsqueriesRiptorch exact int8PyTorch float16PyTorch float32cuVS brute forceFAISS GpuIndexFlatIPvs float16
10M × 38416.41 (1/1)8.30 (0/1)16.50 (1/1)17.26 (1/1)40.04 (1/1)1.30×
10M × 384165.47 (16/16)10.17 (7/16)21.24 (16/16)22.99 (16/16)38.16 (15/16)1.86×
10M × 76819.34 (1/1)16.36 (0/1)out of memoryout of memoryout of memory1.75×
10M × 7681610.05 (16/16)18.38 (3/16)out of memoryout of memoryout of memory1.83×
Horizontal bars: Riptorch exact 5.47 ms, PyTorch float16 10.17, float32 21.24, cuVS 22.99, FAISS 38.16, with exact-order counts
Figure 6. RTX 4090, 10M × 384, 16 queries, pinned CUDA 12 rerun. Whiskers span the two passes of the rerun (each a median of 7 calls); labels give the time and how many of 16 queries came back in the exact float64 order.

At 10M × 384 with 16 queries the exact index is 1.86× PyTorch's fastest, 3.9× PyTorch float32, 4.2× cuVS brute force and 7.0× FAISS GpuIndexFlatIP. At 10M × 768, float32 vectors take 30.7 GB, more than the card's 24 GB, so only the float16 and int8 paths fit.

Table 5. H100 80GB HBM3. Same columns as Table 4; FAISS GPU has no sm_90 kernels, and cuVS was not part of the 50M rows.
vectors × dimsqueriesRiptorch exact int8PyTorch float16PyTorch float32cuVS brute forcevs float16vs float32
10M × 76814.13 (1/1)5.18 (0/1)10.02 (1/1)10.41 (1/1)1.25×2.43×
10M × 768165.51 (16/16)6.63 (3/16)16.34 (16/16)16.05 (15/16)1.20×2.97×
10M × 102415.22 (1/1)6.79 (0/1)13.39 (1/1)13.80 (1/1)1.30×2.57×
10M × 1024166.52 (16/16)8.26 (4/16)21.16 (15/16)20.73 (15/16)1.27×3.25×
50M × 384111.31 (1/1)13.03 (0/1)25.59 (1/1)–1.15×2.26×
50M × 3841617.47 (16/16)19.43 (4/16)46.57 (16/16)–1.11×2.67×
50M × 3846465.43 (64/64)41.08 (15/64)out of memory–0.63×–
Grouped bars of Riptorch exact speed-up over PyTorch float16 (1.11 to 1.30) and float32 (2.26 to 3.25) on the H100
Figure 7. H100: speed-up of the exact index over PyTorch float16 and float32 for each shape with 1 or 16 queries.
Grouped bars: Riptorch 16 of 16 exact on every shape, PyTorch float16 3 to 7 of 16
Figure 8. Queries (of 16) whose top-10 matched the float64 ranking in order, for every 16-query shape of the pinned rerun.
Horizontal bars: 50M × 384 vectors take 76.8 GB in float32, 38.4 GB in float16, 19.2 GB in int8; dashed line at 80 GB
Figure 9. Memory needed to hold 50 million 384-dimensional vectors. The dashed red line is the H100’s 80 GB; float32 leaves too little room for 64-query scoring.

At 50 million 384-dimensional vectors, float32 takes 76.8 GB and int8 19.2 GB. With 64 queries per call, PyTorch's float32 search stopped with "CUDA out of memory" on the 80 GB card; the exact index answered in 65.43 ms with all 64 top-10s exact. Float16 fits and is faster there (41.08 ms) with 15 of 64 orders exact.

Against the common spelling, F.cosine_similarity per query, the exact index was 302× faster on the RTX 4090 and 206× on the H100 at 1M × 1,024 with 16 queries (original campaign run).

Four CPUs, 2 million vectors

Table 6. Exact index vs PyTorch's fastest on the CPU (float32 normdot), 256 dimensions, 16 queries, top-10, Riptorch 0.4.0 release wheel vs PyTorch 2.15.0. Both sides exact on all 16 queries at every size. Riptorch rows use automatic device selection, its default; the explicit-CPU rows are within 1 ms of them.
CPU100K500K2M2M time, PyTorch → Riptorch2M vs F.cosine_similarity
AMD EPYC 9R14 (c7a.4xlarge)6.38×6.57×8.49×156.46 → 18.43 ms674×
Apple M4 (mac-m4.metal)3.21×3.53×3.75×66.89 → 17.84 ms178×
Intel Xeon 8488C (c7i.4xlarge)2.86×1.97×2.93×95.01 → 32.42 ms308×
AWS Graviton4 (c8g.4xlarge)1.10×1.20×1.58×70.29 → 44.36 ms40×
Four log-log panels of milliseconds per call against stored vectors on EPYC, Apple M4, Xeon and Graviton4
Figure 10. Time per 16-query call against collection size on four CPUs (log scales), PyTorch 2.15 and the Riptorch 0.4.0 wheel.
Grouped bars of exact-index speed-up on four CPUs at 100K, 500K and 2M vectors; EPYC up to 8.49, M4 3.75, Xeon 2.93, Graviton4 1.58
Figure 11. Speed-up of the exact index over PyTorch’s fastest CPU path at three collection sizes.

On Graviton4, Riptorch's float32 index (not exact by construction, but exact on this data) was faster than its exact index at 2 million vectors: 34.76 ms, 2.02× PyTorch.

Limitations and next steps

The limits of these results, each with its cause and, where one is planned, the next step.

  • Small collections on GPUs. Below about one million vectors Riptorch's fixed cost per call dominates: 0.22–0.59× of PyTorch's fastest at 100 thousand vectors and 0.80–1.13× at 500 thousand on the five sweep GPUs; on the RTX 4090 at 100 thousand, 0.61 ms against 0.34 ms, and 0.80× of float16 at 1M × 384 with one query. At 100 thousand vectors Riptorch's float index is faster than its exact index, and still slower than PyTorch.
  • Many queries per call. With 64 queries per call it was 0.45–0.75× of PyTorch float16 on the RTX 4090 and H100 (float16 then returns the exact order for 13–38 of 64 queries), and 0.77× of float32 on the H100 at 256 queries in the sweep. Large query batches are open work; the reason is under investigation.
  • The H100 at one million vectors with 1–16 queries: 0.71–1.00× of float16. Cause: under investigation.
Bars below 1: Riptorch exact relative speed against PyTorch float16 at 64 queries, 0.49 to 0.75, with float16 exact counts 13 to 25 of 64
Figure 12. 64 queries per call at 10M and 50M vectors: PyTorch float16 is faster (ratios below 1), while returning the exact order for 13–25 of 64 queries.
  • Approximate indexes. FAISS IVF and cuVS IVF answered in 0.13–2.9 ms with recall@10 of 0.99–1.0 at 16 or more queries on the clustered synthetic data (0.87–0.90 on FiQA). Cause: Riptorch has no approximate index; when an approximate top-10 is acceptable, those are faster.
  • int16 exact search on CUDA is slow: 157 ms for 648 queries over 57,638 FiQA passages against 6.7 ms for int8. The int16 path is the one that keeps the float ranking of the original embeddings (see the companion paper), so bringing it near int8 speed is open work. Cause: under investigation.
  • Integer data only. The exact index takes integer vectors; float embeddings must be quantised first.
  • Statistics. The search rows are medians of 7 calls without confidence intervals; the evidence for stability is the repeated pass (within 0.3 ms) and the rerun (within 4%). The runs used development builds and 0.4.0 wheels of Riptorch, named in the machines table.

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 PyTorch's fastest brute force in float32, float16 and bfloat16 against a float64 top-10, and Riptorch 0.4.0's exact index returning the float64 order on every query. 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

  • Software. Riptorch is distributed as binary wheels; release 0.4.0 is pending, and until it is published the Riptorch page and the playgrounds are the public entry points. Evaluation builds are available through Request an evaluation.
  • GPU sweep and CPU rows. Data as in the Method section, one process per (method, size, device), median of 7, float64 truth cached per size. The 1-minute load average is recorded with every timing; the Linux EC2 hosts ran nothing else.
  • Embedding-scale rows. The int8 corpus, queries and float64 truth are generated once per shape, then each method is timed in its own process. The pinned rerun used a fresh virtual environment with no ONNX Runtime and every library loading the same CUDA 12.9 libraries, checked in each process.
  • Records. Each run keeps its raw JSON lines, logs and machine records (driver, CUDA, CPU, clocks; serials and addresses removed). Run names: gpu-sweep-2026-11-29, cuda-search-2026-11-29, workloads-2026-11-30 (with pinned-cu12), showcase/ec2-2026-11-30, dec-posts-rerun-2026-11-30. Evaluation partners can have the raw files on request.

Date and version

Version 1.2, 30 November 2026. Measurements from 29 and 30 November 2026. Corrections will be published as new versions of this page with the changes listed. 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.