Embedding evaluation

Do More Embedding Dimensions Improve Retrieval Quality?

Test embedding size without confusing it with model quality, index recall, or answer accuracy.

Start with a retrieval failure, then decide what to measure

Imagine an internal knowledge search for a solar maintenance team. A technician asks whether an inverter with hardware revision B can use the same replacement module as revision C. The search returns a plausible manual for the device family, but the only relevant evidence is a small compatibility note in a different bulletin. The team suspects the embedding is too small. That might be true. It might also be that the searchable text never included the note, that the identifier was discarded during extraction, or that approximate search dropped the right neighbour.

An embedding is a fixed-length array of numbers computed from text by a model. Its dimensions are the count of numbers in that array. Search compares vectors under a chosen similarity measure and returns neighbours. The meaningful question is whether those neighbours contain the evidence the user needs. Embedding quality is therefore a property of a model, its encoding procedure, the corpus and the retrieval task together. An attractive similarity score or a vector length on a specification sheet tells you very little about decision quality at the help desk.

Dimension is one part of the representation

A larger output vector gives the model more coordinates in which to encode distinctions. It does not follow that every extra coordinate encodes useful distinctions for your workload. The training objectives, positive and negative examples, language coverage and amount of input the model can see all shape the representation. A compact encoder trained to separate nearly identical technical queries may rank service passages better than a larger-output encoder trained for a different task. If you compare those two systems, you are comparing models and encodings together.

A practical way to see the distinction is to try three intents on the same catalogue. “Why does the inverter shut down when it gets hot?” is a paraphrase problem. “Which procedure applies to revision B?” adds a constraint. “Find AX-450-B-07” is an identifier lookup. A model may improve on the first and second tasks at higher dimensionality while exact lookup barely changes. The identifier still deserves a dedicated exact-match path. MTEB groups embedding evaluations by task for a similar reason. Strong results in one task do not establish that the same model leads on another.

Compare supported dimensions from the same model

The cleanest experiment uses one model with explicitly supported reduced output sizes. A model trained with a nested representation can learn to make successive prefixes useful. Matryoshka Representation Learning is an example of training the representation to work at several granularities. Its results support evaluating a trained prefix at a smaller size. They give no reason to slice an arbitrary embedding model's output and assume the prefix preserves retrieval quality.

Generate query and document vectors for each supported size using the provider's documented method. If the encoder expects a different prefix or instruction for each side, keep those roles fixed between experiments. Keep the intended distance metric and follow the model's normalisation guidance. For example, truncation can change the norm of a previously unit-normalised vector. If you use dot product as a substitute for cosine, the normalisation assumptions matter. Align the index and query code paths before measuring scores.

If the available candidates are two different models, evaluate them as two full setups. Keep the document text, permissions and evaluation labels fixed, and record dimension alongside language coverage, encoding format, latency and model version.

Separate a weaker embedding from a weaker index

For a manageable sample of the corpus, first compare each representation with exact nearest-neighbour search. Suppose an illustrative 768-dimension configuration finds a labelled passage for 86 out of 100 answerable questions in its top 10. A supported 384-dimension output finds 83. At this stage the difference reflects the representations and their controlled scoring setup. Now test the approximate index for each configuration. If the deployed 768-dimension index finds only 78, the immediate gap to investigate is between approximate and exact search at the same dimension.

Measure index recall against exact neighbours under the same eligibility rules. Also measure task recall against human-labelled passages. Those metrics answer different questions. An approximate index can recover all the exact neighbours while neither search gives a useful result for a question the embedding misunderstands. Conversely, a few neighbour substitutions could have little user impact if several authorised passages contain equivalent evidence.

Graph search parameters, filtering behaviour, index construction and quantisation can all affect the comparison. Record them alongside query latency, memory and corpus size. Use repeat trials and hold the normal traffic mix steady when you compare tail latency.

Worked example on the same 100 answerable queries
ConfigurationPassage hit rate at 10What to compare
768 dimensions, exact search86%Reference for the 768-dimensional index
384 dimensions, exact search83%3-point gap between representations
768 dimensions, approximate search78%8-point gap at the same dimension

Work out the storage cost before a migration

Raw bytes = chunk count × dimensions × bytes per coordinate

A plain float32 vector takes about four bytes per coordinate. At one million chunks, 384 coordinates require 1.536 GB of raw vector data in decimal units. At 768 coordinates the same corpus requires 3.072 GB, and at 1,536 coordinates it requires 6.144 GB. These are raw payload calculations. The index may also store a graph, document IDs, and metadata. Replicas, stored text and storage-engine overhead change the total. Compression or lower-precision storage can change the payload again.

The practical question usually concerns the whole deployment. If a small representation saves enough memory to cache the index more reliably and improves tail latency, a modest decline in average task recall could be acceptable for a low-risk search. The same trade could be unacceptable if the loss concentrates in product-revision constraints. On a remote embedding service, output bytes and similarity work are only pieces of latency. Tokenisation, network transfer, batching and provider inference can dominate. A lower dimension does not guarantee a proportional reduction in encoding time, and charges depend on the actual pricing model.

Raw vector payload for one million float32 vectors
DimensionsBytes per vectorTotal payload
3841,5361.536 GB
7683,0723.072 GB
1,5366,1446.144 GB

Build the evaluation from failures you can name

Start with queries from real work, with sensitive material removed or handled in an approved environment. Include short identifiers, multilingual terms, paraphrases, version corrections, near-duplicate manuals and questions that require two passages together. Label the minimum supporting evidence, the expected resource version and the permissions of the requesting role. Keep an answerable subset for recall comparisons and an unanswerable subset for checking whether the assistant asks for clarification or abstains.

Report hit rate at k for questions where any one passage suffices. For questions that need a compatibility chart and a separate exception, label both and measure whether both reach the candidate pool. Track the first relevant rank if people inspect search results directly. A metric such as nDCG is useful when relevance has grades, for example a directly applicable bulletin versus a generic guide. Decide in advance how to classify contradictory, stale and unauthorised results. An evaluation that gives those passages credit will reward the wrong behaviour.

Compare per-query differences. Suppose the 384-dimensional setup gains four successes and loses seven compared with 768. Investigate the seven losses even if the aggregate difference is only three points. If five concern nearly identical specifications with one crucial revision change, you have a design problem the average hides.

Check what the generator actually received

Retrieval failure and answer failure occur at different points. A relevant document can enter the candidate pool and then be displaced by overlapping chunks, removed during reranking, cut at the token budget, or cited for a claim its text does not support. Save enough information in the evaluation to see whether the required evidence made it into the final model input and whether the answer used it correctly. Keep traces proportionate to the diagnostic purpose and enforce the same access boundaries as your corpus.

One worked example labels the compatibility bulletin as the expected source. With the smaller embedding it lands at rank 11, so it never reaches a reranker that accepts only 10 candidates. With the larger embedding it lands at rank 6 and the reranker promotes it. In another query both configurations retrieve the bulletin, but the prompt packs only its introductory page and omits the table. Increasing dimension helps the first failure. Passage construction and packing explain the second.

Run the end-to-end check after the retrieval-only comparison, then report both. Include example answers where they clarify the difference between an evidence miss and an unsupported inference.

Change the index in a way you can reverse

Treat a dimension change as a new vector-space version. Document the encoder version, dimensions, encoding instructions, preprocessing, normalisation and metric. Backfill a separate index and run the same permission and version filters against both. Validate sampled documents and queries before routing any production traffic to it. Matching dimensions alone are insufficient because two encoders can assign entirely different meanings to the same coordinates.

A safe rollout can start with shadow reads over a controlled slice, provided the data-handling policy allows the extra processing. Watch index freshness during the backfill and decide how updates and deletes reach both versions. Switch the query encoder and its index together. Keep the old pair available until the latency, quality and freshness checks meet your rollout criteria. If the corpus changes during the experiment, record the snapshot or rerun with identical data. Otherwise a new service bulletin added midway could look like a model improvement.

Embedding migration workflow. Build a separate versioned index, validate it against the current configuration, and switch the query encoder and its index together only after the candidate meets the agreed criteria.

Stress-test the dimension at the point of ambiguity

Build a cluster of hard negatives before selecting a smaller embedding. If a passage about revision C mentions the same connector, harness and firmware terms as the revision B bulletin, it is a better test than a random unrelated document. Add an archived revision, a supplier's substitute and a near-duplicate with the compatibility row missing. Observe which candidate displaces the right passage at each supported dimension. This can show whether a representation has trouble with a specific distinction or whether the query failed to state it.

Change one fact at a time in the test queries. Ask about revision B, then about revision C, with everything else fixed. Review whether ranking follows the changed constraint, and whether an exact filter makes the outcome more reliable. Record both experiments. The embedding test measures the signal the representation carries, while the filtered test measures the system the technician will actually use.

Make a decision the operations team can use

Write a short decision record with the change under test, the query distribution, evidence metrics by slice, storage costs and expected response time. Choose the smallest supported output that meets the workload's quality and latency constraints. If the problem is a small slice of compatibility queries, consider fixing the identifier or revision path before spending more on every vector. If you need different policies for different corpora, keep separate evaluations and state which search uses each encoder.

For the original revision question, success means finding the right compatibility evidence for the authenticated technician and preserving it through generation. If a smaller encoding consistently meets that bar, the extra coordinates have no demonstrated value for that deployment yet. Keep the harder examples in the regression set and revisit the decision when the embedding model, document mix or indexing strategy changes.

The original RAG paper is a useful reminder of the architectural distinction. Retrieval supplies evidence to generation, and each component can be changed and evaluated on its own. Start your dimension experiment with that separation and finish it on the actual task people care about.

More in the retrieval engineering series

Contact Cortex IR