Matryoshka vs. PCA: The Old-School Trick That Beats MRL Truncation
A head-to-head benchmark shows PCA can shrink embeddings further than Matryoshka truncation while keeping more retrieval quality — and it works on any model, not just MRL-trained ones.

Vector databases are the default answer for storing and searching LLM embeddings, but as collections grow, the cost and latency of high-dimensional vectors bite. AI labs pushed Matryoshka Representation Learning (MRL) as the fix: train the model so the first few dimensions carry the most signal, then truncate at inference. It works — but only on models trained for it, and the quality drop at very small dimensions is steep.
Dylan Castillo ran a benchmark that pits MRL truncation against a much older technique: Principal Component Analysis (PCA). The results are a reminder that sometimes the boring, pre-deep-learning tool is the right one.
The experiment
Castillo took two MRL-trained models — OpenAI's text-embedding-3-small (1,536 dims) and Alibaba's qwen3-embedding-8b (4,096 dims) — and reduced their embeddings to 512, 256, 128, 64, and 32 dimensions using both truncation and PCA. He evaluated retrieval quality (NDCG@10) across eight BEIR datasets. He also added text-embedding-ada-002, a non-MRL model, as a control to see if PCA's performance depends on MRL training.
PCA wins at small dimensions
At 512 dimensions, truncation holds a slight edge. But as dimensions shrink, PCA catches up and then pulls ahead. On text-embedding-3-small, PCA retains 65% of quality at 32 dims versus 46% for truncation. On qwen3-embedding-8b, the gap is smaller (71% vs 68%) but still favors PCA. Across datasets, PCA wins on seven of eight for 3-small and six of eight for qwen3 at the smallest sizes.
The control test answered the second question: PCA works just as well on ada-002, which never had MRL training. So the advantage isn't an artifact of MRL's organized embedding space — PCA is a general-purpose shrinker.
The catch: operational complexity
PCA isn't free. You have to fit a projection matrix on a sample of your embeddings, store and version it, and apply the same version consistently when indexing and querying. Out-of-domain PCA — fitting on MS MARCO and reusing everywhere — degrades quality, so you likely need to fit per corpus. That's real overhead, but for a big index it might be worth it.
PCA matched or outperformed MRL truncation at nearly every dimension across both MRL-trained models.
The full code and data are on GitHub, so you can reproduce the numbers and decide for yourself.
PCA matched or outperformed MRL truncation at nearly every dimension across both MRL-trained models.
| Dimensions | 3-small Truncation | 3-small PCA | qwen3-8b Truncation | qwen3-8b PCA |
|---|---|---|---|---|
| 512 | 98% | 97% | 99% | 98% |
| 256 | 94% | 95% | 96% | 96% |
| 128 | 86% | 90% | 91% | 91% |
| 64 | 71% | 82% | 83% | 84% |
| 32 | 46% | 65% | 68% | 71% |
Source: Dylan Castillo
Discussion
0 Comments
Be the first to start the discussion.