Bottom line: Dimension count is a cost multiplier on both storage and query latency, and the recall difference between 256 and 1,536 dimensions on ordinary text is smaller than most people assume. Measure recall@10 on your own data at 256, 512 and 1,536 before defaulting to the largest model available.

The storage maths first

One million vectors at each width, float32:

Dimensions Raw size With HNSW overhead (~1.5×) Monthly RAM at $6/GB
256 1.02 GB 1.5 GB $9.20
768 3.07 GB 4.6 GB $27.60
1,536 6.14 GB 9.2 GB $55.20

Quantisation to int8 divides that by four; binary quantisation by 32 with a rescoring pass. Width decides the floor.

The recall experiment

Build a labelled set: 300 queries with known-correct passages from your corpus. Then for each width, compute recall@10.

1
2
3
4
5
6
def recall_at_k(queries, correct, k=10):
hits = 0
for q, want in zip(queries, correct):
got = [d.id for d in store.search(embed(q), k=k)]
hits += bool(set(got) & set(want))
return hits / len(queries)

Typical shape on ordinary prose with a domain-tuned model: 256 dims loses 4–9 points against 1,536 on long queries, and 0–3 points on queries under 12 words. If your queries are short, 512 is usually within noise of 1,536 at a third of the cost.

Dimension truncation is free-ish

Many models are trained so that the first N dimensions remain usable when truncated (Matryoshka representation learning). Truncate then re-normalise:

1
2
3
4
import numpy as np
def truncate(v, dims):
v = np.asarray(v)[:dims]
return v / (np.linalg.norm(v) + 1e-9)

Verify truncation still beats the next-best width on your eval set. If it does, you get a tunable knob without re-embedding the corpus.

Where width actually matters

  • Mixed-language corpora: wider helps, because scripts share less structure
  • Code: wider helps on symbol-heavy queries
  • Short FAQ style queries: width is nearly irrelevant, use 256 and save 6×
  • Long documents with subtle semantic distinctions: width helps, but a reranker helps more

The honest ordering of impact is: chunking strategy > reranker > model choice > dimensions. Optimising dimensions first is polishing the wrong end.

Query latency

HNSW search time scales with dimension because distance computation does. At one million vectors, p50 went from 3 ms at 256 dims to 11 ms at 1,536 on the same hardware. At 10 million that difference becomes the difference between a snappy UI and a spinner.

Practise

Fix the eval set before touching anything. Store it as JSONL in the repo and run it in CI so a dimension change ships with its recall number attached. A width decision without a recall figure is a guess with extra steps.

Designing the measurement

Recall@k on a labelled set is the whole experiment. Build 300 query-passage pairs from real queries, label the correct passages, and freeze the file. Then vary dimensions only — same model, same chunking, same corpus.

1
2
3
for dims in (256, 512, 1024, 1536):
store = build_index(corpus, dims)
print(dims, recall_at_k(queries, correct, k=10))

Report the curve, not a single point. A curve that is flat from 512 upward means 512 is the answer; a curve still climbing at 1536 means the task genuinely needs width.

Boundary conditions

Truncation is not neutral for all models. Verify it against the full width before shipping — some models degrade sharply past half their dimensions. Re-normalise after truncating, or cosine similarity is comparing unequal norms.

Storage cost is the smaller half of the trade. Query latency scales with dimension too, and at ten million vectors that is the difference between 3 ms and 40 ms p50, which is the difference between an interactive product and a spinner.

Quantisation changes the maths: with binary quantisation, width matters less because the rescoring pass recovers ranking, and 1,536 binary vectors are smaller than 256 float32. Choose quantisation before choosing width, not after.

When recall collapses

  1. Fall from 0.9 to 0.4 after a dimension change → truncation unsupported for that model; revert
  2. Low at every width → chunking is wrong, fix chunk boundaries first
  3. Fine at k=50, bad at k=10 → reranker missing, width will not substitute
  4. Only bad on one language → tokenizer, not dimensions

Width is the fourth lever. Reaching for it before chunking and reranking is the standard order-of-operations error.

FAQ

How much does storage cost for one million vectors at different dimensions?

At float32, one million vectors use 1.02 GB at 256 dimensions, 3.07 GB at 768, and 6.14 GB at 1,536. With HNSW overhead of roughly 1.5×, that becomes 1.5 GB, 4.6 GB, and 9.2 GB. At $6/GB monthly RAM, those tiers cost $9.20, $27.60, and $55.20 per month respectively.

Does using fewer dimensions hurt recall?

On ordinary prose with a domain-tuned model, 256 dimensions loses 4–9 points against 1,536 on long queries, but only 0–3 points on queries under 12 words. If your queries are short, 512 is usually within noise of 1,536 at a third of the cost. Measure recall@10 on your own data before deciding.

What is dimension truncation and how do I apply it?

Some models are trained so the first N dimensions remain usable when truncated, known as Matryoshka representation learning. You truncate the vector to the target width and then re-normalise it, since cosine similarity otherwise compares unequal norms. Verify truncation still beats the next-best width on your eval set before shipping.

How does dimension count affect query latency?

HNSW search time scales with dimension because distance computation does. At one million vectors, p50 went from 3 ms at 256 dimensions to 11 ms at 1,536 on the same hardware. At ten million vectors, that gap becomes the difference between 3 ms and 40 ms p50.

Should I choose quantisation before or after picking dimensions?

Choose quantisation first. With binary quantisation, width matters less because the rescoring pass recovers ranking, and 1,536 binary vectors are smaller than 256 float32 vectors. Quantisation changes the storage maths, so deciding it after width means redoing the trade-off.