Glossary
Dimensionality reduction
Techniques that represent high-dimensional data, such as embeddings, with fewer dimensions while keeping as much of the useful structure as possible.
Dimensionality reduction is the set of techniques that represent data with fewer dimensions while keeping as much of its useful structure as possible. For embeddings, that usually means turning a 1,024- or 1,536-dimensional vector into one with 256 or 128 dimensions, so that vectors take less storage, searches run faster and indexes fit in less memory, with only a small loss in retrieval quality. The most common methods are principal component analysis (PCA) and random projection for search, UMAP and t-SNE for visualisation, and, increasingly, embedding models trained so that their vectors can simply be truncated.
Why reduce dimensions
Every dimension in an embedding costs storage and compute. A float32 vector with 1,536 dimensions is about 6 KB, a million of them is about 6 GB, and every similarity comparison does one multiplication and addition per dimension. Cutting the dimension count by four cuts all of that by four. For large corpora, that can be the difference between an index that fits in memory on one machine and one that needs a cluster. Embedding dimensions covers this arithmetic in more detail.
Cost is not the only reason. High-dimensional data often contains redundancy: many dimensions move together, and a smaller set of directions explains most of the variation. Removing the rest can strip out some noise. Reduction to two or three dimensions also makes it possible to plot embeddings and see clusters, outliers and gaps in a corpus, which is a useful diagnostic when retrieval behaves oddly.
There is a quality argument too, though it needs care. In very high dimensions, distances between points tend to concentrate, so the nearest and the fiftieth-nearest neighbours can score almost the same. That effect contributes to semantic collapse in large collections. Reduction does not cure it, and aggressive reduction can make it worse, but a well-chosen projection sometimes sharpens the distinctions that matter for a specific domain.
Linear methods: PCA, SVD and random projection
Principal component analysis finds the directions along which a set of vectors varies most. The first principal component is the direction of greatest variance, the second is the next greatest at right angles to the first, and so on. Keeping the top 256 components and dropping the rest projects every vector onto a 256-dimensional space that preserves as much of the original variance as any linear projection can. PCA also reports how much variance each component explains, which gives a direct way to choose a size: keep enough components to explain, say, 90 or 95 percent.
Singular value decomposition (SVD) is the maths underneath PCA and has its own history in search. Latent semantic analysis applied truncated SVD to TF-IDF term-document matrices to find hidden topics, an early form of semantic search that predates neural embeddings by decades.
Random projection multiplies vectors by a random matrix with fewer columns than the original dimension count. It sounds too simple to work, but a result known as the Johnson-Lindenstrauss lemma shows that random projections approximately preserve distances between points, with error that shrinks as the target dimension grows. It needs no fitting step, so it is fast and data-independent, though it usually needs more output dimensions than PCA for the same quality.
Non-linear methods for visualisation
t-SNE and UMAP map high-dimensional vectors to two or three dimensions for plotting. They focus on keeping each point’s local neighbourhood intact, so clusters of similar documents appear as visible groups. They are excellent for exploring a corpus: you can see whether support tickets separate by product, whether a set of near-duplicates exists, or whether a class of documents sits far from everything else.
They are poor choices for retrieval. Distances between clusters in a t-SNE plot are not meaningful, results depend on random initialisation and tuning, and adding a new point (such as a query) is awkward or approximate. Use them to look at embeddings, not to search them.
Learned reduction: Matryoshka embeddings and distillation
The most practical option for many teams now is to use an embedding model that supports reduction directly. Matryoshka embeddings are trained so that the first 64, 128, 256 or 512 values of each vector form a usable embedding on their own, with the most important information packed into the earliest dimensions. Reducing is then a matter of keeping a prefix and re-normalising, with no fitting step and no extra matrix to manage. Several hosted and open models offer this, some through a parameter that returns shorter vectors.
Another route is to train a smaller model to imitate a larger one, a form of distillation, or to train a small projection layer on top of a fixed model using your own data. These take more effort but can adapt the reduced space to a specific domain.
Dimensionality reduction vs quantisation
Reduction is often confused with quantisation because both shrink vectors. They work on different axes and combine well.
Dimensionality reduction | Quantisation | |
|---|---|---|
What shrinks | The number of dimensions | The bytes per dimension |
Typical example | 1,024 dimensions to 256 | 32-bit floats to 8-bit integers or single bits |
Main methods | PCA, random projection, Matryoshka truncation | Scalar, binary and product quantisation |
Needs fitting | PCA yes, random projection and truncation no | Product quantisation yes, scalar and binary minimal |
Effect on search | Fewer operations per comparison | Cheaper operations and less memory traffic |
Vector quantisation covers the second column. Binary quantisation keeps a single bit per dimension, and product quantisation replaces groups of dimensions with short codes. A common setup reduces dimensions first, quantises the result, and re-scores a shortlist at full precision. Libraries such as FAISS support PCA as a preprocessing step in front of an IVF index with product quantisation for this reason.
Applying reduction in a retrieval system
The steps matter more than the method. First, fit the reduction (if it needs fitting) on a representative sample of your own vectors, not a public dataset. Second, apply exactly the same transformation to every stored vector and to every query at search time; forgetting the query side is the most common bug. Third, re-normalise the reduced vectors if you search with cosine similarity or dot product, because projection changes vector lengths. Fourth, measure: compare recall@k for a set of real queries before and after, following the approach in retrieval evaluation.
Treat the projection as part of the index. Record which transformation and which version produced each vector, and plan for change. If the corpus shifts a lot, a PCA fitted last year may no longer capture this year’s variation, which is a version of embedding drift. Refitting means transforming every vector again, so it is effectively a re-index, best done into a new index that replaces the old one when ready.
A worked example
A team runs k-nearest neighbours search over two million product descriptions embedded at 1,024 dimensions. The float32 vectors alone take about 8 GB, and the HNSW graph wants it all in memory. They fit PCA on a random sample of 100,000 vectors and find that the first 256 components explain most of the variance. They project every vector to 256 dimensions, re-normalise, and rebuild the index: raw vectors now take about 2 GB.
On a test set of 500 real queries with known correct products, recall@10 drops by a small margin, and query latency falls noticeably because each comparison does a quarter of the work. The team then adds a reranking pass that re-scores the top 50 results using the original 1,024-dimensional vectors kept on disk, which recovers most of the lost recall. The final setup uses a quarter of the memory with nearly the same accuracy. The specific numbers will differ for any other corpus, which is why the measurement step is not optional.
Common pitfalls
Reducing too far is the obvious one: below some size, distinctions that matter for your queries disappear, and the loss shows up as wrong answers rather than errors. Fitting PCA on unrepresentative data is another, for example fitting on English text and then indexing multilingual content. Mixing reduced and unreduced vectors in one index, or vectors reduced with different projections, quietly breaks every comparison, in the same way as mixing embedding models. And using visualisation methods such as t-SNE for search produces results that look reasonable in a demo and fail in production.
Where Exabase fits
Exabase does not ask you to pick a dimension count, fit a projection or rebuild an index when the corpus changes. Content stored as Resources is extracted and indexed automatically, and Deep Search handles retrieval across documents, images, audio and video. Text queries are hybrid by default, combining semantic search with typo-tolerant keyword matching, and the precision parameter (0 to 1, default 0.3) controls how strict results are. Indexing happens at write time, so there is no separate embedding or reduction pipeline to maintain; the post on the end of the embedding pipeline explains why we built it this way.
For large media libraries, where reduction is often considered to keep image and video indexes affordable, the asset search solution and the media asset management use case show the same index working across formats. The searching resources guide has the request details. If you are comparing this with tuning your own index, see best vector databases and Exabase vs Qdrant.
Frequently asked questions
What is dimensionality reduction?
Dimensionality reduction represents data with fewer dimensions while keeping as much of its structure as possible. For embeddings, it shrinks vectors so they are cheaper to store and faster to search.
Does dimensionality reduction hurt search accuracy?
Usually a little. Moderate reduction often costs only a small amount of recall, while aggressive reduction can lose distinctions your queries depend on. Measure recall on real queries before and after.
Is PCA good for embeddings?
Yes, PCA is a reliable way to reduce embedding dimensions for search, as long as it is fitted on your own data and applied identically to stored vectors and queries. Re-normalise afterwards if you use cosine similarity.
What is the difference between dimensionality reduction and quantisation?
Dimensionality reduction lowers the number of dimensions, while quantisation lowers the bytes used for each dimension. They are complementary and often used together.
Can I use t-SNE or UMAP for vector search?
They are designed for visualisation, not search. They preserve local neighbourhoods for plotting but do not keep distances reliable and handle new query points poorly.
What are Matryoshka embeddings?
Matryoshka embeddings are trained so that a prefix of each vector is a usable embedding on its own. You can keep the first 256 or 512 values and re-normalise, with no fitting step.
Do I need to reduce dimensions in Exabase?
No. Exabase indexes stored content automatically and Deep Search handles retrieval, so there are no vector sizes or projections to manage.
Related pages: Embedding dimensions, Matryoshka embeddings, Vector quantisation, Product quantisation, Embedding, Euclidean distance, Semantic collapse, Best embedding models, Asset search