Show HN: Trainlint, static checks for ML bugs that don't crash github.com · 2 po...
Show HN @show
Show HN: Trainlint, static checks for ML bugs that don't crash github.com · 2 points · 0 comments · HN thread
TL;DR Trainlint is an offline, standard-library-only Python checker that flags ML training and evaluation bugs that run without crashing, such as fitting a scaler before a split or leaving a model in eval mode. It ships 14 rules (TL001 to TL014) plus four agent skills that teach coding agents to avoid the same mistakes. The author reports 20 of 20 bugs caught on their own benchmark and a manual review of pytorch/examples, but the story has no comments yet.
- Runs with uvx, pipx or pip; needs Python 3.10+, has no dependencies, and never runs the code or touches the network or a GPU.
- Fourteen rules cover data leakage (TL001, TL002, TL013), training loop mistakes (TL003, TL009, TL010, TL014), mixed precision and checkpoints (TL006, TL007), loss and metric misuse (TL008, TL011), and seeds (TL005).
- Analysis is AST-based with name matching, so splits are recognized by variable names and there is no type inference or cross-file analysis.
- On its own 20-file bug corpus it caught all 20 buggy files with zero false alarms on fixed twins; the author notes they wrote the corpus alongside the rules.
- On pytorch/examples (93 files) it reported 22 findings, of which the author judged 20 real and 2 harmless, after fixing earlier false positives.
- Ignore comments (# trainlint: ignore[TL002]) silence single lines; output can be text or JSON, and the exit code is 0, 1 or 2.
Discussion The story has no comments yet, so there is no discussion to summarize. It was posted as a Show HN with 2 points.
#machineLearning #staticAnalysis #linter #pytorch #codingAgents #showHN