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
Release files for embedding-drift-lite 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| embedding_drift_lite-0.1.0.tar.gz | 5.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| embedding_drift_lite-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.4 kB
Release files / embedding_drift_lite-0.1.0.tar.gz
| Download URL | embedding_drift_lite-0.1.0.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5f61015387f6b4310142fd72e8984748ba3c31694b844242bfc7943667b5f7e5
|
|
BLAKE2b-256 checksum How to use checksums |
59e3c7b16ed08b85c53c3063102788855fc4208873c160010d2314115b1140b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Release files / embedding_drift_lite-0.1.0-py3-none-any.whl
| Download URL | embedding_drift_lite-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c014247715618757461111be62dbc5bb47be88ca01e52f2ebfaf7314545ee58a
|
|
BLAKE2b-256 checksum How to use checksums |
023f9e2b3bb1ea5413fdd9ebcce2a7d9b12bfd2e625ea0f1f9911a5ea0de5e8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|