Compare two embedding sets and detect drift between versions.
Project description
embedding-drift-lite
Compare two embedding sets and detect drift between versions.
Installation
pip install embedding-drift-lite
Usage
from embedding_drift_lite import compare_embeddings
baseline = [
[0.10, 0.20, 0.30],
[0.40, 0.50, 0.60],
]
current = [
[0.11, 0.19, 0.31],
[0.70, 0.80, 0.90],
]
report = compare_embeddings(baseline, current)
print(report)
Output
{
"count_baseline": 2,
"count_current": 2,
"dimension": 3,
"score": 85,
"drift_detected": True,
"metrics": {
"mean_cosine_similarity": 0.99622,
"mean_cosine_distance": 0.00378,
"centroid_cosine_distance": 0.003691,
"mean_norm_baseline": 0.81132,
"mean_norm_current": 1.131448,
"mean_norm_shift": 0.320128,
"max_pairwise_cosine_distance": 0.005859,
"compared_count": 2,
},
"issues": [
{
"type": "norm_shift",
"severity": "medium",
"message": "Mean embedding norm changed noticeably.",
}
],
}
Load embeddings
from embedding_drift_lite import load_embeddings, compare_embeddings
baseline = load_embeddings("baseline.json")
current = load_embeddings("current.json")
report = compare_embeddings(baseline, current)
print(report)
Overview
embedding-drift-lite is a tiny Python utility for comparing embedding sets across versions.
It is useful when building:
- RAG pipelines
- vector database ingestion workflows
- embedding model migrations
- dataset versioning workflows
- AI search systems
- LLM evaluation pipelines
Features
- Compares two embedding sets
- Computes cosine drift metrics
- Computes centroid movement
- Detects norm shifts
- Supports id-aligned comparisons
- Loads embeddings from JSON
- Returns a simple drift report
- Uses the Python standard library
- Simple API
Limitations
embedding-drift-lite uses simple deterministic metrics. It is not a complete statistical monitoring system and does not replace deeper evaluation, retrieval benchmarks, human review, or production observability. Use it as one signal in your embedding quality workflow.
Issues
Report issues at: https://github.com/edujbarrios/embedding-drift-lite
Author
Eduardo J. Barrios
edujbarrios@outlook.com
License
Mozilla Public License 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file embedding_drift_lite-0.1.0.tar.gz.
File metadata
- Download URL: embedding_drift_lite-0.1.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f61015387f6b4310142fd72e8984748ba3c31694b844242bfc7943667b5f7e5
|
|
| MD5 |
949e973fc29b05249ac369f3aaa2ca54
|
|
| BLAKE2b-256 |
59e3c7b16ed08b85c53c3063102788855fc4208873c160010d2314115b1140b4
|
File details
Details for the file embedding_drift_lite-0.1.0-py3-none-any.whl.
File metadata
- Download URL: embedding_drift_lite-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c014247715618757461111be62dbc5bb47be88ca01e52f2ebfaf7314545ee58a
|
|
| MD5 |
09d7c6a8cb6666def07a9a1fc7634b18
|
|
| BLAKE2b-256 |
023f9e2b3bb1ea5413fdd9ebcce2a7d9b12bfd2e625ea0f1f9911a5ea0de5e8f
|