A universal thermodynamic framework for neural network robustness monitoring.
Project description
🧠 DeepDrift: Neural MRI for AI Robustness
Detect hallucinations, model collapse, and policy panic before they happen.
A universal thermodynamic framework for monitoring internal neural stability across Vision, Language, and Control.
⚡ What is DeepDrift?
Traditional AI monitoring looks at inputs (data drift) or outputs (confidence, perplexity).
DeepDrift scans the model’s internal physics — like an MRI for neural networks.
By measuring Semantic Velocity — the rate of change in hidden states — DeepDrift acts as a "Check Engine" light for AI systems:
| Domain | Problem | DeepDrift Diagnosis |
|---|---|---|
| 👁️ Vision | Geometric stress, OOD data | Detects Global Collapse (ViT) or Avalanche Effect (CNN) at input layers. |
| 🗣️ LLM | Confident hallucinations | Detects Semantic Tremor — high-frequency velocity spikes 7–8 tokens before the lie finishes. |
| 🤖 RL / Robotics | Silent policy failure | Identifies the Panic Zone — internal instability seconds before crash (p < 0.001, Cohen’s d > 2.0). |
“Softmax measures the final destination. Semantic Velocity measures the stability of the journey.”
🚀 Quick Start
Installation
pip install deepdrift
1. Vision — Detect Architectural Collapse
from deepdrift import DeepDriftMonitor
import torchvision.models as models
model = models.resnet50(pretrained=True)
monitor = DeepDriftMonitor(model, arch_name="ResNet")
# Calibrate on clean data
monitor.calibrate(clean_loader)
# Monitor new batch
status, _ = monitor.step(ood_image)
print(f"Drift Score: {status['IR']['drift']:.2f}") # > 3.0 → anomaly
2. LLM — Real-Time Lie Detector
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-7B-Instruct")
monitor = DeepDriftMonitor(model, arch_name="Qwen", strategy="last_token")
# During generation
status, _ = monitor.step(input_ids)
velocity = status['IR']['velocity']
if velocity > 300:
print("⚠️ WARNING: High Semantic Tremor! Possible hallucination.")
🔬 The Science: Optical Depth Dynamics (ODD)
DeepDrift implements the Optical Depth Dynamics (ODD) framework — a unified diagnostic lens for neural networks.
We treat depth (spatial in vision, temporal in language) as a diagnostic dimension:
Laminar Flow: Low velocity → stable, factual, grounded processing. Turbulent Flow: High velocity → confabulation, panic, structural failure. This isn’t just theory — it’s a production-ready diagnostic tool with <1% overhead.
📄 Read the full work:
Confidently Wrong: ODD as a Universal Thermodynamic Framework (Zenodo)
🛠️ Features
Plug & Play: Works out-of-the-box with torch, transformers, stable-baselines3. Auto-Detect: Supports ResNet, ViT, ConvNeXt, Llama, Qwen, GPT, and more. Lightweight: <1% inference overhead via PyTorch forward hooks. Unsupervised: No labels needed — only a small calibration set from nominal operation. Interpretable: Outputs human-readable diagnostics: “Global Collapse”, “Mid-Layer Bulge”, “Policy Panic”.
👤 Author
Alexey Evtushenko — Independent Researcher & Engineer Built this to bring reliability-first engineering to the world of neural networks.
- GitHub: @Eutonics
- X (Twitter): @axelgravitone
- Hugging Face: DeepDrift-Explorer
“Stop guessing why your model failed. See exactly where it broke.”
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 deepdrift-0.3.2.tar.gz.
File metadata
- Download URL: deepdrift-0.3.2.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8af128d3fb4566521ab96b6022beea4b9ef0acf241c2918f447e5a6eb4a90c59
|
|
| MD5 |
4216b83dfe2a255dd27416412c7d7833
|
|
| BLAKE2b-256 |
2195cd9e5290cbea42c9328ec524068ac5497b8eabf1d3faddfeefbd76077557
|
File details
Details for the file deepdrift-0.3.2-py3-none-any.whl.
File metadata
- Download URL: deepdrift-0.3.2-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac2d263a01c43a2efb666e7bf85d55fe3753ed6237a1ae8040cc2cca0351f9ac
|
|
| MD5 |
5a988f821a31dc228f26252b46207839
|
|
| BLAKE2b-256 |
afc3d58008766563a94b9da2c1b3763fb6ecc8bf1ba58e7b1cee3e42531b1073
|