Engineering

How Projection Matrices Enable Zero-Cost Migration

The math behind migrating millions of vectors in minutes. No PhD required — we explain learned projection with plain language and concrete numbers.

When we say Schift migrates your vector database without re-embedding, a reasonable question follows: how? If two embedding models produce incompatible vector spaces, how do you translate from one to the other without going back to the original text?

The answer is a technique we call learned projection — a linear transformation trained on a small sample of paired embeddings. It is fast, accurate, and requires no deep background in machine learning to understand.

The core idea: embedding spaces have structure

Embedding models are not random. They are trained on enormous amounts of text, and they learn to arrange similar concepts near each other in vector space. "cat" and "kitten" end up close together. "revenue" and "earnings" cluster near each other. "Paris" and "France" have a relationship that mirrors the one between "Tokyo" and "Japan."

This structure is preserved across different models. If you take 1,000 documents and embed them with OpenAI's ada-002 and also with Gemini embedding-001, the relative arrangements of those vectors are highly consistent. The scale and rotation differ — but the neighborhood relationships are stable.

That structural consistency is the foundation Schift builds on. If the geometry is consistent, there should be a mathematical transformation that maps one space to the other. Finding that transformation is exactly what projection matrix training does.

Step 1: Collect paired samples

You start with a small, representative sample of your corpus — typically 500 to 2,000 documents. You embed each document with both your source model and your target model. This gives you a set of paired points: for document i, you have vector a_i in source space and vector b_i in target space.

This is the only step that costs API calls. The migration of your remaining millions of vectors happens entirely offline with no further embedding requests.

Step 2: Train the learned projection

The core challenge is that the two embedding spaces may differ in orientation, scale, and dimensionality. Schift's learned projection algorithm finds the optimal linear transformation that maps one space to the other — minimizing the distance between paired vectors.

Given your paired samples A (source, shape N x src_dim) and B (target, shape N x tgt_dim), the algorithm finds the matrix W of shape (src_dim, tgt_dim) that best aligns the two spaces. This is a closed-form solution — no iterative training, no hyperparameter tuning, no GPU required.

The result: to project any source vector, you compute:

projected = source_vector @ W   # one matrix multiply, sub-millisecond

That is it. No neural network. No GPU required. No API calls. A single matrix multiply on your existing CPU turns a source-model vector into a target-model compatible vector in microseconds.

What 99.7% recovery actually means

We measure quality using Recall@10: for a given query, what fraction of the top-10 relevant documents are retrieved? This is the standard metric for production retrieval systems.

"99.7% recovery" means: if your original model achieves R@10 = 0.978, after Schift migration your projected vectors achieve R@10 = 0.975. The retrieval quality is nearly identical.

For context, without any projection, switching models drops R@10 to exactly 0.000. The projection matrix recovers virtually all of that lost quality.

Recovery rates vary by model pair:

  • Same-family upgrades (e.g., Gemini-001 to Gemini-2): 99–100%
  • Same-vendor, same dimension (e.g., ada-002 to 3-small): 97–98%
  • Same-vendor, cross dimension (e.g., ada-002 to 3-large): 96–98%
  • Cross-vendor (e.g., Gemini to OpenAI): 94–97%

Why linear projection is enough

The obvious question: why not use a neural network? More parameters, better accuracy, right?

In practice, the geometric relationship between embedding spaces is approximately linear. Embedding models trained on similar data with similar objectives learn compatible representations — and the difference between them is well-described by a linear transformation. Non-linear approaches can overfit to the small training sample and perform worse on unseen vectors.

More importantly, linear projection is fast. A matrix multiply over 1 million 1536-dimensional vectors completes in seconds on a standard laptop. A neural network inference pass at the same scale requires a GPU and significantly more time.

The simplest approach that achieves >95% recovery at sub-millisecond per vector is the right approach.

The practical upshot

What this means in practice: migrating a 10 million vector corpus from ada-002 to text-embedding-3-large takes roughly 3–5 minutes. You need to embed 1,000 representative samples with both models (about $0.10 in API costs). The migration itself is free. And you get back 97% of your original retrieval quality — rather than the 0% you get without projection.

The math has been around for decades. Schift just applies it to the problem of embedding vendor lock-in.

Ready to run Schift on your data?

Pick a plan and check the first benchmark or answer flow with your own documents.

View pricing