Compose drift detectors (embedding, retrieval, response, latency) into one report. Library-only, no server, no UI.
Project description
driftvane
Compose drift detectors for RAG and agent systems.
Most drift libraries are either tabular-only (Evidently, DataDrift) or are
platforms that want you to ship telemetry to their backend (Phoenix, Arize).
driftvane is a small Python library that lets you wire up multiple drift
signals — embedding, retrieval, response, latency — into one report. No
server, no UI, no telemetry. Plug it into a Lambda or Glue job, get a
pandas.DataFrame or a JSON dict back.
Install
pip install driftvane
# optional
pip install "driftvane[pandas]" # to_pandas()
pip install "driftvane[external-response]" # delegate response scoring to context-drift-detector-py
Quickstart
import numpy as np
from driftvane import (
DriftReport,
EmbeddingDrift,
RetrievalDrift,
ResponseDrift,
LatencyDrift,
)
from driftvane.detectors.response import Triple
ref_emb = np.load("reference_query_embeddings.npy") # (n, 768)
cur_emb = np.load("current_query_embeddings.npy")
report = DriftReport.from_signals([
EmbeddingDrift(threshold=0.1).compute(ref_emb, cur_emb),
RetrievalDrift(k=10, threshold=0.3).compute(ref_top_k, cur_top_k),
ResponseDrift(threshold=0.15).compute(ref_triples, cur_triples),
LatencyDrift(p_threshold=0.01).compute(ref_latencies, cur_latencies),
])
if report.any_drifted():
print(report.to_pandas())
Or fail a CI job when retrieval moves too much:
from driftvane import DriftAlert
try:
report.alert_if({"retrieval_jaccard_at_10": 0.2})
except DriftAlert as e:
sys.exit(f"drift gate failed: {e}")
Detectors
| Detector | Input | Statistic | Notes |
|---|---|---|---|
EmbeddingDrift |
two (n, d) arrays |
MMD with RBF kernel, median-heuristic sigma | numpy-only, O(n²) — subsample for n > a few thousand |
RetrievalDrift |
paired top-k id lists | 1 − mean Jaccard@k; reports RBO too | aligned queries required |
ResponseDrift |
(intent, context, answer) triples |
shift in mean answer-to-context grounding | uses context-drift-detector-py if installed |
LatencyDrift |
two 1-D arrays of floats | Kolmogorov–Smirnov D + asymptotic p-value | scipy-free |
Each detector returns a DriftSignal(name, value, threshold, drifted, metadata).
DriftReport collects them.
What it does NOT do
- No server. No UI. No telemetry shipping.
- No tabular feature drift — use DataDrift for KS/PSI on classical features.
- No live trace ingestion or OTel collection — point this at parquet/numpy arrays you already have.
- No causal root-cause analysis. It tells you that drift is there, not why.
- No model retraining triggers — emit your own when
report.any_drifted().
Why not Phoenix / Arize / Evidently / Ragas?
| driftvane | Phoenix | Arize | Evidently | Ragas | |
|---|---|---|---|---|---|
| Library-only (no server) | ✓ | ✗ | ✗ | partial | ✓ |
| RAG-shaped detectors | ✓ | ✓ | ✓ | ✗ | ✓ |
| Embedding MMD out of the box | ✓ | partial | ✓ | ✗ | ✗ |
| Retrieval rank-shift | ✓ | ✗ | partial | ✗ | ✗ |
| Run inside a 5s Lambda | ✓ | ✗ | ✗ | ✓ | partial |
| numpy-only core deps | ✓ | ✗ | ✗ | ✗ | ✗ |
Status
v0.1 — alpha. The four detectors above work and have tests. Public API may change before v1.0. Issues and PRs welcome.
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 driftvane-0.1.0.tar.gz.
File metadata
- Download URL: driftvane-0.1.0.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f141d9e7b73e8d1b8f1edcc6bdbe9866c3593a9dd43d109a8315d0da1bbca7d
|
|
| MD5 |
4aa4509a767ad3dfa8509d7b7ad564fe
|
|
| BLAKE2b-256 |
2e5f861d06aafbde44e9b5989ea1e6c6c217d89f72e2875f749b001bdcc4658d
|
File details
Details for the file driftvane-0.1.0-py3-none-any.whl.
File metadata
- Download URL: driftvane-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccf100efab722e95bbd7c3d7353d2893508da97ecdbf3c6b134a1b1308831a94
|
|
| MD5 |
f83f0315d116ebf4b1f7ce82337f29d6
|
|
| BLAKE2b-256 |
60d1f5ad387168193114dbdcc2a55b2681db0c11fab901e7e675b7c8cb098ee1
|