Skip to main content

Universal Thermodynamic Framework for Neural Network Robustness (Vision, LLM, Router)

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.

PyPI Version Downloads License Hugging Face Zenodo


⚡ What is DeepDrift?

Traditional AI monitoring looks at inputs (data drift) or outputs (confidence, perplexity).
DeepDrift looks inside the model itself.

Think of it as an MRI for neural networks.

DeepDrift measures Semantic Velocity — the rate of change of hidden representations — and uses it as a real-time stability signal.
It functions like a “Check Engine” light for AI systems.

Domain Failure Mode DeepDrift Diagnosis
👁️ Vision OOD / geometric stress Global Collapse, Avalanche Effect
🗣️ LLMs Confident hallucinations Semantic Tremor (7–8 tokens early)
🤖 RL / Robotics Silent policy failure Panic Zone (seconds before crash)

Softmax tells you where the model ends up.
Semantic Velocity tells you whether it is losing control on the way.


🚀 Quick Start

Installation

pip install deepdrift

🧪 Usage Examples

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")

monitor.calibrate(clean_loader)

status, _ = monitor.step(ood_image)
print(f"Drift Score: {status['IR']['drift']:.2f}")

2️⃣ LLM — Real-Time Hallucination Detector

from transformers import AutoModelForCausalLM
from deepdrift import DeepDriftMonitor

model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-7B-Instruct")
monitor = DeepDriftMonitor(model, arch_name="Qwen", strategy="last_token")

status, _ = monitor.step(input_ids)
velocity = status["IR"]["velocity"]

if velocity > 300:
    print("⚠️ High Semantic Tremor — possible hallucination")

🔬 The Science: Optical Depth Dynamics (ODD)

DeepDrift implements Optical Depth Dynamics (ODD) — a thermodynamic diagnostic framework for neural networks.

  • Laminar Flow → stable reasoning
  • Turbulent Flow → hallucination, panic, collapse

📄 Full paper: https://doi.org/10.5281/zenodo.18086612


⚡ Performance (v0.4.0)

Method Inference Monitor Overhead
Full monitor 12.8 ms 16.2 ms 126%
DeepDrift v0.4 12.8 ms 0.03 ms 0.2%

🛠️ Features

  • Plug & Play (PyTorch, Transformers, SB3)
  • Auto-detect architectures
  • <1% inference overhead
  • Unsupervised
  • Interpretable diagnostics

👤 Author

Alexey Evtushenko
Independent Researcher & Engineer

GitHub: https://github.com/Eutonics
X: https://x.com/axelgravitone


Stop guessing why your model failed.
See exactly where it broke.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deepdrift-1.0.0.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deepdrift-1.0.0-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file deepdrift-1.0.0.tar.gz.

File metadata

  • Download URL: deepdrift-1.0.0.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for deepdrift-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d840939eec29ec493916e6a77daedf742f6e1ff78d1c860c37940518cfc13118
MD5 78b19e6e6d99db9dcb8723f6d9402ede
BLAKE2b-256 582718609e91be218991493b11656edcee7c745c550d4f8a6f43ff49b12bc621

See more details on using hashes here.

File details

Details for the file deepdrift-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: deepdrift-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for deepdrift-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cf4cd374275c57c22bf2da018b790a66df739c920a66c8ba00e3862bc8c50443
MD5 5cdde33775b94f49c31a7e9b46b2b43f
BLAKE2b-256 f9c20778ef95d18c9f3133501279bb3784da82a9e5dd421f03bba5e0496a2e11

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page