Skip to content
MIRAGE

MIRAGE

Inspect the model before it inspects you

Created on 24th October 2026

•

MIRAGE

MIRAGE

Inspect the model before it inspects you

The problem MIRAGE solves

The Hidden Vulnerability in Modern AI

Modern AI development relies on pretrained checkpoints. Developers, researchers, and enterprises download open-source models from sources such as Hugging Face, Kaggle, and GitHub, then load them into GPU clusters, corporate networks, and production pipelines.

Traditional security tools may check file extensions and checksums, but these checks do not establish that a checkpoint is safe. AI checkpoints can present two distinct attack surfaces:

  1. Host compromise (malicious code execution): PyTorch checkpoints (.pt, .pth, .pkl) may use Python’s pickle serialization. Loading an unsafe pickle file can execute code.
  2. Model compromise (hidden payloads and tampering): Payloads or backdoor-related signals may be embedded in model weights while the model continues to behave normally on standard validation tasks.

Some scanners inspect serialization code but do not analyze model weights for hidden data or anomalies.


How MIRAGE Makes AI Workflows Safer

MIRAGE is a security gateway for AI model artifacts. It scans checkpoints before they are used in a runtime environment.

  • Dual-surface analysis: Inspects serialized code and numerical weight tensors.
  • Format-aware scanning: Routes checks according to file format, including skipping pickle opcode analysis for SafeTensors files.
  • Explainable results: Provides a risk score and structured findings about what the scan flagged.
  • Remediation and verification: Supports disarmament of detected threats and rescanning of the resulting artifact.

Project Results

The following results are reported in the project README:

EvaluationResultScope
10-model blind benchmark93.75% balanced accuracy; 100% clean specificity; 87.5% stego recall; 100% precision; 93.33% F150 samples across 10 unseen architectures
10-architecture stress test98.00% balanced accuracy; 100% clean specificity; 96.0% stego recall; 100% precision; 97.96% F160 samples across four payload families
Opcode classifier90.91% grouped accuracy; 0.90 ROC-AUC43-dimensional opcode unigram/bigram features
Disarmament rescan100% clean-pass rateReported after remediation
Automated tests143 / 143 passedpytest eval/ -v
Scan latencyAbout 8.3 s / 0.4 s46 MB PyTorch model / SafeTensors file

Who It’s For

  • AI/ML engineers: Scan community checkpoints before loading them.
  • MLOps and platform teams: Add a model security check before registering or deploying artifacts.
  • Security teams: Review third-party model artifacts using structured scan findings.

Challenges we ran into

1. Eliminating False Alarms on Clean Foundation Models

One of our biggest hurdles was false positives on completely benign checkpoints. Deep neural networks naturally contain subtle statistical quirks in their floating-point representations resulting from optimization and precision rounding, which early iterations of our detector misidentified as artificial tampering.

  • How we got over it: We developed statistical baseline calibration and noise-compensation techniques that isolate natural floating-point behavior from deliberate adversarial injections. This eliminated false alarms on legitimate models, achieving 100% specificity across clean baseline architectures.

2. Generalizing Across Radically Different Model Architectures

Teaching a security model to recognize weight tampering across completely different model families (standard CNNs, residual networks, lightweight inverted-bottlenecks, and modern transformer-like topologies) was a major challenge. Early models tended to overfit to specific tensor shapes and layer dimensions rather than universal anomaly patterns.

  • How we got over it: We re-engineered our feature extraction pipeline to be architecture-agnostic. By training on cross-family comparative distributions, we forced the detection engine to ignore layer geometry and evaluate macroscopic entropy transitions across the parameter space.

3. Catching Both Dense and High-Stealth Payloads

Attackers don't inject payloads in just one way. High-volume exfiltration attacks alter multiple bits across weights to maximize bandwidth, while ultra-stealthy payloads alter only micro-bits or use periodic stream ciphers to evade statistical detection. A single detection strategy could never catch both extremes.

  • How we got over it: We built an adaptive multi-stage inspection pipeline: pairing spatial distribution analysis (optimized for dense, multi-bit injections) with specialized frequency-domain autocorrelation (designed to catch sparse, periodic bit modifications invisible to macroscopic scans).

4. The "Catch-22" of Checkpoint Sanitization

Remediating a compromised model presents a dangerous catch-22: to sanitize an untrusted serialization stream, you typically have to unpack it into memory—which triggers the malicious payload before you can even clean it.

  • How we got over it: We built an offline, AST-level instruction parser. It intercepts the serialized instruction stream before execution, allowing us to safely neutralize dangerous calls and unlisted functions into inert stubs before any untrusted object is ever instantiated in the host runtime.

5. Preserving Model Accuracy Post-Remediation

Simply stripping or zeroing suspicious weight values often alters layer variance, which causes downstream logit drift and degrades the model's actual task performance.

  • How we got over it: We implemented a mathematical tensor rescaling step during the disinfection phase. This scrubs the covert payload while dynamically recalibrating parameter variance across the affected layers, ensuring the disarmed model retains its original inference performance.

Tracks Applied (1)

Open Track - Development

Discussion

Builders also viewed

See more projects on Devfolio