trainlint statically checks common ML training mistakes
Developer Satvik-jain created trainlint, a static checker for machine-learning training and evaluation code that identifies mistakes that may not cause a program to crash, including preprocessing leakage, incorrect evaluation mode, and logits-loss errors. The tool parses code by name and therefore requires no data, model, or GPU; the author says it currently supports only PyTorch and scikit-learn. In a manual review of findings in pytorch/examples, the author identified 20 real issues and two correct but harmless findings among 22 results, but did not report recall measurements.
Trainlint offers a lightweight way to catch consequential training-code errors before execution, although its name-based approach and limited PyTorch and scikit-learn support constrain where it can be used reliably.
I wrote a small checker for training and evaluation code. It looks for mistakes that do not raise
errors. The classic one is leakage through preprocessing. With 5,000 random features and random
labels, picking the top 20 features on the full dataset and then running 5-fold cross-validation
gives 85% accuracy (87.7% averaged over 20 seeds). Doing the selection inside a Pipeline gives 48%
(50.0%). Nothing can beat 50% on that data, so the whole gap is leakage.
trainlint finds that pattern statically, along with thirteen others: eval() left on during