passdrill
AI & LLM Engineering · RAG & Embeddings · Card 031/032 easy

A team's embedding model produces 1536-dimensional vectors, and storing and comparing vectors at full length is expensive at their corpus scale. They discover their embedding model was trained using Matryoshka Representation Learning (Kusupati et al., 2022), which lets them simply truncate each vector down to its first 256 dimensions and still get a useful representation, without retraining anything. What makes this truncation trick work, when truncating an ordinarily-trained embedding model's vector would badly damage its quality?

  1. The model was trained twice, once at the full dimension and once at the smaller dimension, and truncation simply switches which of the two independently trained vectors is used
  2. The later dimensions of the vector are trained to contain pure random noise on purpose, so removing them cannot remove any real information
  3. The model is trained so that information is organized coarse-to-fine across the dimensions, with each nested prefix of the vector, not just the full vector, optimized to be a usable representation on its own, so truncating to a shorter prefix still yields a meaningful embedding rather than an arbitrarily damaged one
  4. Truncation is only ever applied to the query vector at search time and never to the stored document vectors, so the two sides of every comparison are always at different lengths by design
Next card → Shuffle