#5624·faiss

Docs: Suggested FAISS configurations for dataset population tiers cost more and cluster worse near lower bounds

Author: Darsh-MeeshoCreated Sep 11, 2026Updated Sep 25, 2026

Guidelines-to-choose-an-index.md, lines 82 to 110.

Concern

The tier table fixes nlist per size range (65536 for 1M to 10M, 262144 for 10M to 100M, and so on). Two things go wrong for a dataset near the bottom of its range.

Density. A centroid is the mean of the m = n/nlist points in its cell. Its standard error is sigma/sqrt(m), where sigma is the spread of the points within the cell. sigma is a property of the data, so m is the only lever on centroid quality. With too few points per centroid, centroids track sampling noise instead of structure, and empty cells have to be repaired by split_clusters.

FAISS already states this floor, as 30*K on the page and as min_points_per_centroid = 39 in the code:

python
import faiss, numpy as np                    # faiss 1.15.0
d, n = 64, 1_200_000
x = np.random.rand(n, d).astype('float32')
faiss.index_factory(d, "IVF65536_HNSW32,Flat").train(x)
# WARNING clustering 1200000 points to 65536 centroids:
#   please provide at least 2555904 training points

Cost. k-means work grows with nlist. At a tier boundary nlist jumps 4x while n barely changes, so the bottom of each tier does the most clustering work per vector, on the worst-determined centroids.

The 4*sqrt(N) to 16*sqrt(N) rule for N < 1M has neither problem: points per centroid is sqrt(N)/mult, which grows with N and never drops at a boundary.

Measured at the 10M boundary

A dataset grew by ~960k vectors and crossed 10M. d=64, IVFFlat, METRIC_INNER_PRODUCT, 4x L4, faiss-gpu-cu12:

before after
n 9,793,813 10,754,940
nlist (per the tier table) 65,536 262,144
points per centroid 149 41
k-means ~15 min >79 min, did not finish

10% more vectors, more than 5x the clustering time.

Same run, same GPUs, same nlist = 262,144: a 49.5M-vector dataset (188 points per centroid) finished in 39 minutes. A dataset 4.6x larger was faster, so neither n nor nlist explains the stall. Density does.

The run was not GPU-bound (about 98% of wall clock off-GPU). The page's remedy for this tier is "do just the training on GPU"; we were, and it does not help here.

Note that 39 x 262,144 = 10,223,616, so at 41 points per centroid no warning fired. The floor is a minimum, not a safe operating point.

At N = 1M the same shape holds: the tier gives 15 points per centroid where the sqrt rule gives 62 to 250, for 4x to 16x the clustering work.

Secondary (docs only, no runtime impact)

  1. Line 82 calls these figures the size of a sample of the dataset, but line 92 asks for 30 x 65,536 = 1,966,080 for a tier that begins at 1,000,000. Unsatisfiable for N in [1M, 1.97M].
  2. The page says 30*K; the code's min_points_per_centroid is 39.
  3. The sub-1M rule is self-consistent by contrast: 30*K with K = 4*sqrt(N) is 120*sqrt(N), which is below N for all N > 14,400.

Suggested fix

State that the training-density requirement takes precedence over the tier table, and that a dataset low in its tier should stay on the 4*sqrt(N) to 16*sqrt(N) rule.

One way to express it:

while nlist > 65536 and n / nlist < 50:
    nlist = <next tier down>

50 rather than 39 because 39 did not catch our case. On our data this moves the effective boundary from 10M to 13.1M.