Mithridatium is a research-oriented CLI and Python package for checking pretrained image classifiers for possible backdoors. It currently supports running one selected defense at a time:
- FreeEagle
- STRIP
- MMBD
- AEVA
The project has local PyTorch checkpoint support, initial Hugging Face image-classification support, JSON reporting, a Typer CLI, a Gradio entry point, and tests around key defense/report contracts.
The main flow is:
mithridatium/cli.pyparsesmithridatium detectoptions.mithridatium/loader.pyormithridatium/loader_hf.pyloads the model.mithridatium/utils.pybuilds preprocessing config and dataloaders.- The selected defense runs from
mithridatium/defenses/. mithridatium/report.pybuilds and validates report JSON.
See architecture overview for diagrams.
- Typer CLI with
detect,defenses, anduicommands. - Individual defense dispatch for
mmbd,strip,aeva, andfreeeagle. - Local
.ptand.pthcheckpoint validation. - ResNet-18 variant detection for standard and CIFAR-style checkpoints.
- Hugging Face image-classification wrapper.
- JSON report builder and schema validation.
- FreeEagle wrapper and core tests.
- STRIP entropy and threshold tests.
- Example docs for invisible and semantic backdoor demos.
| File | Why it matters |
|---|---|
mithridatium/cli.py |
Primary user entry point and defense dispatch |
mithridatium/loader.py |
Local checkpoint loading and compatibility checks |
mithridatium/loader_hf.py |
Hugging Face model wrapper |
mithridatium/utils.py |
Dataset configs and dataloaders |
mithridatium/defenses/freeeagle.py |
FreeEagle integration wrapper |
mithridatium/defenses/strip.py |
STRIP implementation and dynamic/static thresholds |
mithridatium/defenses/mmbd.py |
MMBD implementation |
mithridatium/defenses/aeva.py |
AEVA implementation and caching |
mithridatium/report.py |
Report builder, summary renderer, JSON-safe conversion |
reports/report_schema.json |
Report validation contract |
tests/ |
Regression and contract tests |
docs/ |
Reorganized project documentation |
pip install -e .
pytest
mithridatium defenses
mithridatium detect --model models/resnet18_poison.pth --data cifar10 --defense mmbd --out reports/mmbd.json --force
mithridatium detect --provider huggingface --hf-model-id microsoft/resnet-50 --data cifar10_for_imagenet --defense strip --out reports/hf_strip.json --force- Calibrate defense thresholds on a shared benchmark set.
- Add CI coverage for fast tests.
- Decide how broad Hugging Face support should be and document supported model families.
- Add clearer benchmark model management, including expected metrics and download/training instructions.
- Read known issues.
- Read future work.
- Run
pytest. - Run one local smoke test and one Hugging Face smoke test if network/model cache is available.
- Confirm docs match any new CLI flags before releasing.