Explain what NVIDIA CAGRA buys you over CPU HNSW and the operational catch that decides whether you should reach for it.
CAGRA (NVIDIA's GPU graph-ANN, inside the RAFT library) gives you roughly 5-10x QPS over CPU HNSW at the same recall.
A CPU is like one really smart accountant doing additions one at a time. A GPU is like a stadium full of slightly dumber accountants who can all add at the same time. For vector search, where you need to compute thousands of small dot products, the stadium wins by a huge margin, often 10x faster. **But** the stadium has a tiny private vault, way smaller than the accountant's filing cabinet, and renting the stadium is much more expensive per square foot. So you bring the stadium in when you have a lot of queries pouring in and need them answered now; you don't bring it in just to store a billion items cheaply.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
GPU accelerated ANN has been around for a decade (Faiss had GPU indexes in 2017), but the 2023-2024 NVIDIA RAFT / CAGRA release was the moment GPU-ANN became a serious production option rather than a research curiosity. The interview signal is whether the candidate understands what GPU-ANN actually buys, what it actually costs, and when to reach for it.
The headline: 5-10x QPS over CPU HNSW at the same recall, paired with 5-10x worse cost-per-byte-of-storage. That makes CAGRA the right tool for QPS-binding or latency-binding workloads and the wrong tool for storage-binding workloads. Calibrating to that distinction is the whole answer.
What CAGRA actually is
CAGRA (CUDA Accelerated Graph Index) is a GPU-native graph ANN algorithm, published by NVIDIA in 2023 and shipped inside their RAFT library of GPU primitives. The graph structure is similar in spirit to HNSW (small world graph, greedy walk) but flatter (single or shallow hierarchy) to match GPU SIMT execution.
During serving, both the graph topology and the raw vectors live in GPU HBM. Each query launches a CUDA kernel that maintains a candidate list in shared memory, evaluates many candidate distances in parallel using tensor cores or SIMD float lanes, expands neighbors, and iterates until convergence. The end to end query cost is dominated by HBM bandwidth and the cost of the distance kernel, both of which are dramatically better on GPU than CPU.
The public CAGRA paper claims 4-25x query speedup over CPU HNSW depending on dimensionality and recall target, with the high end on 1024+-dim vectors at recall 0.95. Independent benchmarks (BAAI, Anthropic, Milvus) confirm the 5-10x range as the typical production win.
Situations where this technique stops working.
2–4 min · Everything important, quickly.
| Property | CPU HNSW | CAGRA (GPU) | DiskANN |
|---|---|---|---|
| Primary storage | RAM | GPU HBM | SSD |
| Per-query latency | ~1-3 ms | ~0.2-1 ms | ~5-15 ms |
| Sustained QPS | 100-1000/core | 10k-100k/GPU | 100-500/box |
| $/byte of storage | 1x baseline | 5-10x worse | 0.1-0.3x baseline |
| Max single-node index | ~1TB RAM | 80-192GB HBM | Multi-TB SSD |
| Best for | Default production | High QPS, low latency, mid-scale | Cost first billion scale |
Real products, models, and research that use this idea.
- Milvus 2.4+ ships CAGRA as a first class index type, recommended for high-QPS RAG and recommendation backends.
- Vespa offers CAGRA integration via its tensor framework for hybrid scoring at scale.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow does CAGRA pair with PQ to handle indexes that exceed HBM?
RAFT exposes PQ encoding on the GPU; CAGRA-PQ compresses vectors to ~32-64 bytes each, letting a single H100 hold ~1-2B vectors. Recall drops are similar to CPU IVF-PQ at the same compression.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Assuming GPU-ANN is universally better than CPU HNSW because GPUs are faster. The cost per byte of memory inversion means GPU-ANN is the wrong choice for cost first storage bound workloads; it shines only when QPS or latency is the binding constraint.
60 second bullets to scan on the way to the call.
CAGRA sits inside NVIDIA RAFT; it is GPU-native graph ANN
5-10x QPS over CPU HNSW at the same recall on equivalent hardware
Primary sources. Browse if you want the original framing.
Same topic, related formats. Practice these next.