Why you can't simply swap embedding models (even with the same dimensions)
Part 2 of 7 in the Embedding Migration in Production series (change the model, not the reliability): engineer-level, on Azure AI Search and Microsoft Foundry, mapped to Microsoft exam AI-103.
TL;DR for managers. Vectors from two different embedding models are like map coordinates from two different map projections: both are lists of numbers, but you can't mix them. That stays true even when both models produce the same number of dimensions. So a model change needs new vectors in a new field or index, and the code that embeds questions has to switch at the same moment. Writing down an explicit "embedding contract" is the cheapest way to stop silent mismatches.
In part 1 we established that a retired or replaced embedding model means re-embedding every document. The obvious objection is: surely there's a shortcut? Maybe the new model has the same dimensions, or maybe we can transform the old vectors. This part explains why the shortcuts fail, and what to build instead.
The same-dimensions trap
text-embedding-ada-002 produces 1,536 dimensions. So does text-embedding-3-small. And
text-embedding-3-large can be asked for 1,536 dimensions through its dimensions parameter.
Your index field accepts any 1,536-number vector, so you could point the vectorizer at the new model and every query
would run without a single error.
The results would be close to random. Each model learned its own space during training. The first number of an ada-002 vector and the first number of a text-embedding-3 vector don't describe the same thing, any more than latitude in one coordinate system matches latitude in a system with a different origin and rotation. Cosine similarity between vectors from different spaces is a number with no meaning. Microsoft's guide puts it in one line: "Equal vector dimensions don't establish compatibility between models."
Why not learn a mapping from old vectors to new? Research on aligning embedding spaces exists, but a learned transform is approximate, needs its own training data and evaluation, and loses whatever the new model understands that the old one didn't, which is usually why you're migrating. For a production system, regenerating vectors from the source text is the only approach Microsoft documents, and it's the one this series uses.
The schema won't bend either
Even if you wanted to reuse the old field, Azure AI Search won't let you change it. A vector field's dimensions are fixed when the field is created. text-embedding-3-large at full size needs 3,072 dimensions, so it needs a new field. The guide also advises a separate field "even when the dimensions match, so you can compare results and keep the old vectors available for rollback". Overwriting vectors in place destroys your only rollback path and leaves the index in a mixed state halfway through.
The embedding contract
The real compatibility unit isn't the model name. It's everything that shapes the vector. Microsoft lists it for each vector field: model identity, version and deployment; output dimensions and similarity metric; preprocessing, chunking, truncation and normalisation; provider-specific document and query task settings; authentication, network access and region.
Change any of those and you have a different contract. If you re-chunk documents, the new vectors describe different text. Cohere's models also use different task settings for documents and for queries, so getting those backwards is a mismatch too. I find it helps to make the contract an object in code and stamp its version on everything:
import hashlib, json
from dataclasses import dataclass, asdict
@dataclass(frozen=True)
class EmbeddingContract:
"""Everything that must match between stored vectors and query vectors."""
model: str # e.g. "text-embedding-3-large"
model_version: str # e.g. "1"
deployment: str # the deployment name your code calls
dimensions: int # 3072, or a smaller value if the model supports the dimensions parameter
metric: str # "cosine"
preprocessing: str # e.g. "chunker-v3:500tok/50overlap;nfc;strip-boilerplate"
query_task: str = "" # provider-specific document/query task settings, if any
document_task: str = ""
@property
def version(self) -> str:
"""Short, stable id to stamp on every vector, cache key and release manifest."""
raw = json.dumps(asdict(self), sort_keys=True).encode()
return hashlib.sha256(raw).hexdigest()[:12]
OLD = EmbeddingContract("text-embedding-ada-002", "2", "emb-ada2", 1536, "cosine", "chunker-v3:500tok/50overlap")
NEW = EmbeddingContract("text-embedding-3-large", "1", "emb-3large", 3072, "cosine", "chunker-v3:500tok/50overlap")
assert OLD.version != NEW.version # different contract, different vectors, different index
That version string then goes on every chunk's migration record, in every embedding cache key and in the release manifest that decides which index and which query model the application uses (part 4). A deployment name can stay the same while the model behind it changes, so the deployment name alone is not a safe cache key.
Both sides of the contract
The contract has two sides, and they live in different places:
| Side | Where it lives | What changes in a migration |
|---|---|---|
| Document vectors | An embedding skill in a skillset, or your ingestion code | New skill or code pointing at the new deployment, writing to the new field or index |
| Query vectors (integrated) | The vectorizer on the field's vector profile, used by
VectorizableTextQuery
|
A new vectorizer and profile attached to the new field |
| Query vectors (client-side) | Application code that embeds the question and sends a
VectorizedQuery
|
The application's embedding call, switched at the same moment as the index |
Microsoft also says the skill and the vectorizer "must use the same embedding model", so choose a supported pair: the Azure OpenAI Embedding skill with the Azure OpenAI vectorizer for ada-002 and the text-embedding-3 models, the AML skill with the Foundry model catalogue vectorizer for Cohere models in preview, or a Custom Web API skill and vectorizer for anything else.
What the new index looks like
For a separate-index migration, start from the live definition rather than retyping it, so analysers, scoring
profiles, semantic configuration and security fields come across unchanged. Replace only the vector field, its profile
and its vectorizer. A sketch with the Python SDK (check the names against your azure-search-documents
version):
from azure.search.documents.indexes.models import (
SearchIndex, SearchField, SearchFieldDataType, SimpleField, SearchableField,
VectorSearch, HnswAlgorithmConfiguration, VectorSearchProfile,
AzureOpenAIVectorizer, AzureOpenAIVectorizerParameters)
old = index_client.get_index("rag-content-v1") # read the live definition, don't retype it
new_vector = SearchField(
name="content_vector_v2",
type=SearchFieldDataType.Collection(SearchFieldDataType.Single),
searchable=True, stored=False, # stored=False: see the partial-update warning
vector_search_dimensions=NEW.dimensions,
vector_search_profile_name="profile-v2")
fields = [f for f in old.fields if f.name != "content_vector"] + [new_vector]
vector_search = VectorSearch(
algorithms=[HnswAlgorithmConfiguration(name="hnsw-v2")],
profiles=[VectorSearchProfile(name="profile-v2", algorithm_configuration_name="hnsw-v2",
vectorizer_name="vec-v2")],
vectorizers=[AzureOpenAIVectorizer(
vectorizer_name="vec-v2",
parameters=AzureOpenAIVectorizerParameters(
resource_url=AOAI_ENDPOINT, deployment_name=NEW.deployment, model_name=NEW.model))])
index_client.create_index(SearchIndex(
name="rag-content-v2", fields=fields, vector_search=vector_search,
semantic_search=old.semantic_search, scoring_profiles=old.scoring_profiles))
Three details in that sketch matter:
- Everything except the vector stays the same. Same text fields, analysers, BM25 settings, semantic configuration and scoring profiles. That's what makes the comparison in part 5 fair, and part 6 relies on it.
-
Security fields are copied as schema, not as trust. A field called
group_idsin the new index proves nothing about whether the values in it are right. The permission data has to come from the same trusted ingestion flow as before (part 3 and part 7). -
stored: falsesaves space but has a cost. Vectors that aren't stored can't be exported later, and a partialmergeormergeOrUploadthat omits them can lose vector data. Decide deliberately.
Capacity: check before you create
Running two indexes side by side means two sets of vectors. In our scenario, 100 million chunks at 1,536 float32
dimensions are about 614 GB of raw vector data. The same chunks at 3,072 dimensions are about 1,229 GB. Together that's
roughly 1.84 TB before graph overhead, which is more than the 1.8 TB maximum vector quota of a fully partitioned S2
service. You have real options: scalar or binary quantisation on the new field, a smaller dimensions
value for text-embedding-3-large, or a larger tier during the overlap. Which one is right is a quality question, so
part 5 measures it rather than guessing.
Common mistakes
- Pointing the existing vectorizer at the new deployment "because the dimensions match".
- Caching query embeddings by question text only. After the switch, the cache serves old-model vectors to the new index.
- Re-chunking at the same time as changing the model, so the evaluation can't tell which change mattered.
- Carrying over vector similarity thresholds. Score distributions differ between models.
Key takeaways
- Vectors from different models are incompatible, whatever their dimensions.
- Field dimensions are fixed, so new vectors need a new field or index.
- Write the embedding contract down, version it, and stamp the version on vectors, caches and releases.
- Copy the live index definition and change only the vector side, so you measure one change at a time.
Next, part 3: re-embedding 100 million chunks: batching, rate limits, checkpoints, and changes that arrive while the backfill is running.
References
- Define the replacement embedding contract
- Supported skill and vectorizer pairs
- Vector storage options (stored and retrievable)
- Azure OpenAI embedding models
Learning this for AI-103? Microsoft's AI-103 exam (Azure AI Apps and Agents Developer Associate) covers implementing RAG with Azure AI Search, vector and hybrid search, and monitoring retrieval quality. Our live online AI-103 course builds these pipelines hands-on in Microsoft Foundry and Azure AI Search, on UK time, with mock assessments before you book the exam.
The Embedding Migration in Production series
Change the model, not the reliability.
- Part 1: Your embedding model is being retired
- Part 2: Why you can't simply swap embedding models (you are here)
- Part 3: Re-embedding 10 million documents
- Part 4: Blue-green migration for Azure AI Search
- Part 5: Did the new model improve retrieval?
- Part 6: BM25, hybrid and semantic ranking
- Part 7: The enterprise migration playbook
- Bonus: Document permissions in a migration