Five-dimensional drift detection for production RAG systems. Rust core, Python bindings.
Project description
ragdrift
Five-dimensional drift detection for production RAG systems. Rust core, Python bindings.
The problem
Your RAG system is in production. The retriever silently starts returning slightly worse results because your corpus drifted. The model gets more confident but no better calibrated. The mix of intents your users send shifts week-over-week. None of this surfaces as a 5xx, none of it fails your tests, none of it fires your latency alerts.
By the time someone notices in a Slack thread, it has been broken for weeks.
ragdrift watches five dimensions at once and gives you a single threshold-able
report. The numerical core is Rust; the Python wheel is a thin PyO3 binding that
releases the GIL on the heavy paths.
Install
pip install ragdrift-py
The PyPI distribution is
ragdrift-py(the bareragdriftname on PyPI was taken by an unrelated project). The Python import is stillimport ragdrift, same convention aspyyaml/yamloropencv-python/cv2. The Rust crates on crates.io are unaffected —cargo add ragdriftworks.
Optional extras:
pip install 'ragdrift-py[opensearch,aws]' # adapter + CloudWatch exporter
pip install 'ragdrift-py[pgvector,prometheus]'
pip install 'ragdrift-py[pinecone,datadog]'
30-second quickstart
import numpy as np
from ragdrift import RagDriftMonitor
baseline = np.load("baseline_embeddings.npy") # (n, 768) float32
current = np.load("current_embeddings.npy")
monitor = RagDriftMonitor(embedding_threshold=0.05)
report = monitor.evaluate(
baseline_embeddings=baseline,
current_embeddings=current,
)
if report.any_exceeded():
print(report.to_json())
The five dimensions
| Dimension | Method | What it catches |
|---|---|---|
| Embedding | MMD² (RBF) + sliced Wasserstein | corpus or model embedding distribution shift |
| Data | per-feature KS + PSI | tabular feature drift (latency, retrieval count, etc.) |
| Response | KS on lengths, optional SW | response length / semantic shift |
| Confidence | KS, optional ECE delta | confidence score collapse, calibration breakage |
| Query | k-means + symmetric KL | intent-mix shift in incoming queries |
See docs for the math and citations.
Why not X?
- Arize Phoenix is great for embedding visualization and notebook-style exploration. It does not give you a single Rust-fast scalar you can alert on from Lambda.
- Evidently is excellent for tabular drift and report generation. It does not have a sliced-Wasserstein-on-embeddings primitive in the hot path.
- WhyLabs / NannyML are mature monitoring platforms — useful, vendor-tied, not embeddable as a library inside your service.
- Roll your own: most teams write the first 80% in 200 lines of numpy and then hit a wall when MMD on 10k×768 takes 8 seconds in pure Python.
ragdrift is the library you reach for when you want the math right, the
runtime tight, and a single dependency that handles all five dimensions.
Architecture
+----------------------+
| RagDriftMonitor |
| (Python facade) |
+----------+-----------+
|
+---------+-----------+-----------+--------+
| | | | |
EmbeddingDrift DataDrift ResponseDrift ConfidenceDrift QueryDrift
| | | | |
+---------+-----------+-----------+--------+
|
ragdrift._native
(PyO3, GIL-released)
|
ragdrift-core (Rust)
KS PSI MMD SW k-means
Status
0.1.0 — alpha. API may change in 0.x. Semver respected within 0.x.y; minor versions are allowed to break the surface. Core math is well-tested (45+ Rust tests, 25+ Python tests); production deployments should pin an exact version.
Contributing
See CONTRIBUTING.md. All quality gates must pass on Linux, macOS, and Windows for Python 3.10–3.13 before merge.
License
Dual-licensed under MIT or Apache-2.0 (Rust convention). Pick whichever suits.
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 Distributions
Built Distributions
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 ragdrift_py-0.1.2-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: ragdrift_py-0.1.2-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 320.0 kB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94e8fbb71fe7a27647e03dabdf6386e492bd93a90a2593b36ee33be5d39e6fa5
|
|
| MD5 |
b3a1c400235c18dac32677043a8ad9e4
|
|
| BLAKE2b-256 |
5cee8fa5fbc7b123188964223cdc2fd1e11ca7205f4440ce45926dc50c7005ea
|
Provenance
The following attestation bundles were made for ragdrift_py-0.1.2-cp310-abi3-win_amd64.whl:
Publisher:
release.yml on MukundaKatta/ragdrift
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ragdrift_py-0.1.2-cp310-abi3-win_amd64.whl -
Subject digest:
94e8fbb71fe7a27647e03dabdf6386e492bd93a90a2593b36ee33be5d39e6fa5 - Sigstore transparency entry: 1487005894
- Sigstore integration time:
-
Permalink:
MukundaKatta/ragdrift@b2198d75ceb68602e567ff88da136a679c9be75b -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/MukundaKatta
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b2198d75ceb68602e567ff88da136a679c9be75b -
Trigger Event:
push
-
Statement type:
File details
Details for the file ragdrift_py-0.1.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: ragdrift_py-0.1.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 413.5 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90eccbc9f4f0f696320fa818b7a3aa1fed26c60bae0081d4b70fe7e61df5879d
|
|
| MD5 |
93bbc0142e7b3822288b62b7a6c4158b
|
|
| BLAKE2b-256 |
85547e5f380602be7133d128ae2979813682aeda42970d490dcc007eb3269625
|
Provenance
The following attestation bundles were made for ragdrift_py-0.1.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on MukundaKatta/ragdrift
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ragdrift_py-0.1.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
90eccbc9f4f0f696320fa818b7a3aa1fed26c60bae0081d4b70fe7e61df5879d - Sigstore transparency entry: 1487006024
- Sigstore integration time:
-
Permalink:
MukundaKatta/ragdrift@b2198d75ceb68602e567ff88da136a679c9be75b -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/MukundaKatta
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b2198d75ceb68602e567ff88da136a679c9be75b -
Trigger Event:
push
-
Statement type:
File details
Details for the file ragdrift_py-0.1.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: ragdrift_py-0.1.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 395.5 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa206b3f9e7b0dc905a7b4c93753bee2a50e9d034eb8f64cd7d8cdc11398f3d3
|
|
| MD5 |
247086a6200b1476289bbc6b4640f820
|
|
| BLAKE2b-256 |
3738eed778d81e18b0825c6aa8e9375cbbdc79441c85551571abd3486500c5f5
|
Provenance
The following attestation bundles were made for ragdrift_py-0.1.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release.yml on MukundaKatta/ragdrift
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ragdrift_py-0.1.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
fa206b3f9e7b0dc905a7b4c93753bee2a50e9d034eb8f64cd7d8cdc11398f3d3 - Sigstore transparency entry: 1487005931
- Sigstore integration time:
-
Permalink:
MukundaKatta/ragdrift@b2198d75ceb68602e567ff88da136a679c9be75b -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/MukundaKatta
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b2198d75ceb68602e567ff88da136a679c9be75b -
Trigger Event:
push
-
Statement type:
File details
Details for the file ragdrift_py-0.1.2-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: ragdrift_py-0.1.2-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 370.4 kB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12fe21a462f76b23c3d3a685212a027b46a91498f984480cbc50235668aa9666
|
|
| MD5 |
9039f8a61e9bd3f60c65fac2e4bd951a
|
|
| BLAKE2b-256 |
88e5758ab111813a9878b63226ff8332f7f706ed570e1a062d71dd4f9a1e3690
|
Provenance
The following attestation bundles were made for ragdrift_py-0.1.2-cp310-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on MukundaKatta/ragdrift
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ragdrift_py-0.1.2-cp310-abi3-macosx_11_0_arm64.whl -
Subject digest:
12fe21a462f76b23c3d3a685212a027b46a91498f984480cbc50235668aa9666 - Sigstore transparency entry: 1487005997
- Sigstore integration time:
-
Permalink:
MukundaKatta/ragdrift@b2198d75ceb68602e567ff88da136a679c9be75b -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/MukundaKatta
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b2198d75ceb68602e567ff88da136a679c9be75b -
Trigger Event:
push
-
Statement type:
File details
Details for the file ragdrift_py-0.1.2-cp310-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: ragdrift_py-0.1.2-cp310-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 381.5 kB
- Tags: CPython 3.10+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19b4dd285cf75eba19b9b984aa5ae8fa3997f75c326f3f86a0be0443798c7ada
|
|
| MD5 |
bc42fc7006ad1a22c5e0b8561a68c7b7
|
|
| BLAKE2b-256 |
a9bd5e189933e96ccb596c4ae5b79142424196b22adb7f84b97d9e327311adf0
|
Provenance
The following attestation bundles were made for ragdrift_py-0.1.2-cp310-abi3-macosx_10_12_x86_64.whl:
Publisher:
release.yml on MukundaKatta/ragdrift
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ragdrift_py-0.1.2-cp310-abi3-macosx_10_12_x86_64.whl -
Subject digest:
19b4dd285cf75eba19b9b984aa5ae8fa3997f75c326f3f86a0be0443798c7ada - Sigstore transparency entry: 1487005962
- Sigstore integration time:
-
Permalink:
MukundaKatta/ragdrift@b2198d75ceb68602e567ff88da136a679c9be75b -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/MukundaKatta
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b2198d75ceb68602e567ff88da136a679c9be75b -
Trigger Event:
push
-
Statement type: