Skip to main content
TrainCheck logo

TrainCheck: Invariant Checking for AI Training

Chat on Discord Ask DeepWiki

TrainCheck catches silent training bugs by learning what a healthy run does, then checking a new run against those learned invariants. It works by tracing PyTorch API calls and model state changes, so you can inspect training behavior before a loss curve or final metric tells you something went wrong.

Install

Install TrainCheck in the same Python environment that runs your training script:

pip3 install traincheck

For CUDA, conda, and source-install details, see the Installation Guide.

Use TrainCheck

TrainCheck has four main steps.

1. Collect a Reference Trace

Run traincheck-collect on a known-good training script. This should be a short run that covers the training behavior you want TrainCheck to learn.

traincheck-collect \
  --pyscript reference.py \
  --models-to-track model \
  --output-dir reference_trace

2. Infer Invariants

Turn the reference trace into invariants:

traincheck-infer -f reference_trace -o invariants.json

3. Collect a Target Trace

Run the target training script with the inferred invariants. Passing --invariants lets TrainCheck trace only the APIs and variables needed for those checks.

traincheck-collect \
  --pyscript target.py \
  --models-to-track model \
  --invariants invariants.json \
  --output-dir target_trace

For long target runs, trace fewer steps:

traincheck-collect \
  --pyscript target.py \
  --models-to-track model \
  --invariants invariants.json \
  --sampling-interval 10 \
  --warm-up-steps 10 \
  --output-dir target_trace

4. Check the Target Run

For live checking, start traincheck-onlinecheck while the target run is writing traces:

traincheck-onlinecheck -f target_trace -i invariants.json

The easier offline path is to wait for trace collection to finish, then run:

traincheck-check -f target_trace -i invariants.json

Both checkers write a results directory with failure logs and a report.html summary.

Learn More

Status

TrainCheck is under active development. Please join our Discord server, file a GitHub issue, or email traincheck@umich.edu.

Contributing

We welcome contributions. See Contributing to TrainCheck for setup and contribution guidance.

License

TrainCheck is licensed under the Apache License 2.0.

Citation

If TrainCheck is relevant to your work, please cite our paper:

@inproceedings{TrainCheckOSDI2025,
  author = {Jiang, Yuxuan and Zhou, Ziming and Xu, Boyu and Liu, Beijie and Xu, Runhui and Huang, Peng},
  title = {Training with Confidence: Catching Silent Errors in Deep Learning Training with Automated Proactive Checks},
  booktitle = {Proceedings of the 19th USENIX Symposium on Operating Systems Design and Implementation},
  series = {OSDI '25},
  month = {July},
  year = {2025},
  address = {Boston, MA, USA},
  publisher = {USENIX Association},
}

Artifact Evaluation

OSDI AE members should use the TrainCheck AE Guide.

Metadata

Release files for traincheck 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for traincheck 0.2.0
File Size Uploaded Provenance Actions
traincheck-0.2.0.tar.gz 334.2 kB Without provenance Details for traincheck-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for traincheck 0.2.0
File Interpreter ABI Platform Actions
traincheck-0.2.0-py3-none-any.whl Python 3 none any Details for traincheck-0.2.0-py3-none-any.whl

Total release size: 621.7 kB

Release files / traincheck-0.2.0.tar.gz

Download URL traincheck-0.2.0.tar.gz
Size 334.2 kB
Tags Source
SHA-256 checksum
How to use checksums
04a17c59170f26ec26555d4aa793dfc080d944d6970f60aa41d662dcb310ffc9
BLAKE2b-256 checksum
How to use checksums
17c71a5dfb229d39fa07ae59b08f943fbfe5f932ab60feeac507b8bb8adeac34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.16

Release files / traincheck-0.2.0-py3-none-any.whl

Download URL traincheck-0.2.0-py3-none-any.whl
Size 287.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8200e0d07232b61f0f01aba733a834006a430d00a9ea7b850aa3cdefb0dd7559
BLAKE2b-256 checksum
How to use checksums
900401616723d9295ec1d69382870c85eda88da415ce70512fae6e4853a4bdf1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.16

Security for traincheck 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page