What Causes Embedding Drift After Reindexing the Same Document Library?

Eva Wong is the Technical Writer and resident tinkerer at ZimaSpace. A lifelong geek with a passion for homelabs and open-source software, she specializes in translating complex technical concepts into accessible, hands-on guides. Eva believes that self-hosting should be fun, not intimidating. Through her tutorials, she empowers the community to demystify hardware setups, from building their first NAS to mastering Docker containers.

Embedding drift appears when reindexing changes the model, text, encoder settings, numeric path, or comparison rules used to represent the library.

A home knowledge base may contain the same PDFs, notes, manuals, and family records before and after a rebuild yet return different nearest neighbors or similarity scores. Some changes are true embedding drift: the vector produced for identical input moved. Others are ingestion drift, where the text sent to the encoder changed, or retrieval drift, where identical vectors are searched with different metrics or index settings. The first diagnostic boundary is therefore to compare source bytes, extracted text, chunk identity, raw vectors, and ranked results as separate artifacts.

Actual Vector Drift and Apparent Retrieval Drift Are Different

Actual drift means the same normalized text produces a different vector. Apparent drift means the vector is stable but chunk membership, similarity metric, filtering, quantization, or approximate-neighbor search changes the ranked results.

Qdrant collections define vector size and distance metric as collection-level parameters. Rebuilding into a collection with another metric can change scores and ordering without changing the embedding values themselves.

Comparing only top search results merges these causes. A raw-vector checksum for fixed test strings separates encoder drift from index or ranking drift.

An Unpinned Model Revision Can Replace the Encoder

A model name is not always a permanent set of weights and configuration files. A repository owner can update weights, tokenizer files, pooling configuration, or model code while preserving the public repository name.

Hugging Face repositories are version controlled, and downloads can use a specific revision rather than the latest branch state.

This cause produces broad movement across a fixed probe set, often with a changed model commit, cache path, configuration hash, or tokenizer asset. It differs from document-specific drift, which affects only files whose extraction or chunking changed.

Encoder Options Can Change Vector Length, Scale, and Geometry

The same weights can emit different representations when pooling, normalization, precision, prompt prefixes, maximum sequence length, or output dimensions change.

Sentence Transformers exposes encoder controls including precision, normalization, prompts, and truncated dimensions.

A normalization change may preserve direction while changing vector magnitude; a prompt prefix can move every document into another task-conditioned space; truncation can discard dimensions. These are configuration changes, not random instability.

The Text Reaching the Encoder May Not Be the Same

Reindexing can invoke another parser version, OCR path, whitespace normalizer, page-order rule, or chunking strategy even when the original files are byte-for-byte identical.

Unstructured performs chunking after partitioning and documents how chunk size, overlap, and section boundaries determine which text enters each chunk.

If one heading is newly detected or one page produces different OCR, every later chunk boundary can shift. The resulting vectors are not drifted representations of identical input; they represent different text spans.

Nondeterministic Execution Can Create Small Numeric Differences

Parallel kernels, hardware libraries, operation ordering, and random components can make repeated inference differ slightly even with the same model and input.

PyTorch notes that complete reproducibility is not guaranteed across releases, platforms, or devices and provides deterministic-algorithm controls for supported operations.

This cause usually creates small coordinate differences rather than a completely reorganized semantic space. If cosine similarity between old and new probe vectors remains extremely high, the change may be numerical noise that becomes visible only near ranking ties.

Precision and Quantization Can Move Borderline Neighbors

A rebuild may switch from float32 to float16, int8, or another optimized runtime profile to reduce memory and improve throughput.

ONNX Runtime explains that float16 conversion can introduce accuracy differences that require tolerance testing.

The semantic effect is often small, but a local library may contain many similar chunks. Small coordinate shifts can swap the order of neighbors whose original scores were nearly equal.

Reindexing Can Mix Old and New Vector Generations

A partially rebuilt collection can contain vectors generated with different model commits, chunk settings, dimensions, or normalization rules.

Mixed generations create irregular behavior: unchanged documents may remain stable while only reprocessed files move, and query vectors may be incompatible with part of the stored collection.

ZimaSpace’s guide to NAS semantic indexing provides the adjacent boundary: the source library, extracted records, embeddings, and search index are separate layers and must not be treated as one immutable object.

FAQ

Should identical text always produce bit-for-bit identical embeddings?

Only under a pinned model, identical configuration, deterministic execution path, and matching hardware and software environment. Small floating-point differences can still occur otherwise.

Can unchanged search results prove embeddings did not drift?

No. Vectors may move without crossing ranking boundaries. Compare raw vectors or their hashes and similarities on a fixed probe set.

Does a changed nearest neighbor always indicate model drift?

No. Chunking, filters, distance metrics, quantization, and approximate index construction can change retrieval while the encoder output remains stable.

Tech & AI HUB

More to Read

Get More Builds Like This

Stay in the Loop

Get updates from Zima - new products, exclusive deals, and real builds from the community.

Stay in the Loop preferences

We respect your inbox. Unsubscribe anytime.