Gemini Embedding 001 MRL Truncation: Why Unnormalized 768d Vectors Lose 0.54 Dot Product
Matryoshka Representation Learning (MRL) lets you slice high-dimensional embeddings (3072d or 2560d) down to 768d, 1024d, or 1536d to shrink HNSW memory footprints by 50% to 75%. Yet teams migrating to Google's gemini-em
Matryoshka Representation Learning (MRL) lets you slice high-dimensional embeddings (3072d or 2560d) down to 768d, 1024d, or 1536d to shrink HNSW memory footprints by 50% to 75%. Yet teams migrating to Google's gemini-embedding-001 frequently hit silent ranking regressions when indexing truncated output_dimensionality=768 vectors in pgvector (vector_ip_ops), Pinecone dot-product indexes, or FAISS IndexFlatIP.
The root cause is geometric: only the full 3072d output of gemini-embedding-001 is guaranteed unit-normalized (||v||_2 = 1.0). Truncated MRL prefixes (768d, 1536d) are not unit-length unless you re-normalize them.
Empirical Norm Collapse Across 5 Retrieval Probes
In our 2026 open benchmark (VoxellInc/rag-contradiction-benchmark v1.1.0), we measured 3072d full cosine similarity, L2-normalized 768d MRL cosine similarity, unnormalized 768d dot products, and 768d prefix L2 norms on gemini-embedding-001:
| Probe Query |
3072d Cosine |
768d MRL Cosine (L2 Normed) |
768d Unnormed Dot Product |
768d Prefix L2 Norm |
|---|---|---|---|---|
"Cohere Rerank 3.5 pricing" |
0.8385 |
0.8318 |
0.2883 |
0.5845 |
"Vertex AI Search pricing per GB" |
0.8211 |
0.8183 |
0.2878 |
0.5862 |
"pgvector 2000 dimension limit hnsw fix" |
0.8386 |
0.8338 |
0.2899 |
0.5835 |
"Model Context Protocol server for private engineering documentation" |
0.8185 |
0.8111 |
0.2793 |
0.5841 |
"ERROR: column cannot have more than 2000 dimensions pgvector" |
0.8506 |
0.8459 |
0.2918 |
0.5823 |
Notice two critical facts:
-
Semantic retention is excellent once re-normalized: L2-normalized
768dMRL stays within0.0028to0.0074cosine points of the full3072dvector while cutting index RAM by4x. -
Unnormalized inner products collapse: Because both query and document
768dprefixes sit around||v||_2 = 0.584, their raw dot product scales by roughly0.584 * 0.584 = 0.341, dropping0.8318down to0.2883. Worse, passage-to-passage variance in prefix energy (0.5823vs0.5862+) skews top-kcandidate ordering whenever an ANN engine assumes unit vectors or applies score thresholds (score >= 0.75) ahead of Model Context Protocol (MCP) or Agent2Agent (A2A) tool calls.
Fixing Client-Side L2 Normalization vs Server-Side Enforcement
If you call gemini-embedding-001 at < 3072 dimensions, enforce L2 re-normalization on every ingested batch and every query before storage or search:
package vecnorm
import "math"
func NormalizeL2(v []float32) []float32 {
var sum float64
for _, x := range v {
sum += float64(x) * float64(x)
}
if sum == 0 {
return v
}
inv := float32(1.0 / math.Sqrt(sum))
for i := range v {
v[i] *= inv
}
return v
}
Or eliminate client-side drift completely with Voxell Forge: both turbo (1024d, $0/forever, MRL 256..1024) and pro (2560d, $0.25/1M tokens, MRL 256..2560) execute fused GPU L2 re-normalization on the server whenever dimensions is passed, returning strict unit-norm vectors over HTTPS (/v1/embeddings) and mTLS gRPC.
Further Reading & Live Tools
- Canonical guide: Gemini Embedding 001 MRL L2 Normalization
- Optimization hub: Voxell Vector & RAG Engineering Guides
- Cost & dimension planner: Interactive Vector Calculator
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.