Recommend paper-backed diagnostics for PyTorch and Hugging Face training problems.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste into ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
Paper-backed ML training diagnostics for PyTorch. Small tools that answer practical questions while a run is still alive.
Have a real run or false alarm to share? Use the diagnostic report template.
Not sure which tool fits the problem?
Agents can use the JSON CLI, the agent guide, llms.txt, or the optional local MCP server:
The same local, read-only server is discoverable through the official MCP Registry and can be launched without a persistent install:
For AI coding assistants: start with traintools recommend "<training symptom>" --json, then insert the smallest diagnostic snippet into the user's existing
loop. The agent-facing entrypoints are AGENTS.md,
llms.txt, JSON
schemas, and the optional MCP server.
| Tool | Question it answers |
|---|---|
| Gradient Noise Scale (GNS) | Is my batch size wasting compute? |
| GradientAccumulationGNS | Can I get GNS for free during gradient accumulation? |
| PlasticityProbe | Is my network losing the ability to learn? |
| TrainGuard | Should I stop training yet? |
| BatchInspector | Is this batch broken, imbalanced, or out of scale? |
| GradientHealthMonitor | Are gradients finite, clipped, vanished, exploded, or too large for the weights? |
| ExampleDynamicsTracker | Which examples are forgotten, hard, ambiguous, or likely mislabeled? |
| GradientConfusionMonitor | Are micro-batch gradients fighting each other and slowing SGD? |
| AUMTracker | Which examples look mislabeled by margin dynamics? |
| EL2NTracker | Which examples are important or pruneable early in training? |
| NeuralCollapseMonitor | Has the classifier entered neural-collapse geometry? |
HuggingFace Trainer:
GNS is the ratio of per-example gradient variance to gradient signal:
It estimates the critical batch size B*: the point where larger batches stop buying much more optimization progress.
GNS > B: under-batched, larger batches can helpGNS < B: over-batched, the batch may be larger than neededGNS ~= B: near the efficient frontiertraintools uses the unbiased estimators from McCandlish et al. 2018
(Bessel-corrected variance, bias-corrected signal) and tracks GNS as
EMA(tr(Sigma)) / EMA(||G||^2).
If you already use gradient accumulation, the per-micro-batch gradients you compute anyway are exactly the samples GNS needs.
PlasticityProbe measures activations directly:
Those are combined into a plasticity score in [0, 1].
TrainGuard fits a power-law or exponential curve to validation loss, bootstraps uncertainty, and only stops when continuing looks unlikely to matter.
BatchInspector catches bad tensors and labels before they quietly poison a run.
It checks for empty tensors, NaNs/infs, extreme scales, constant tensors, labels outside the expected class range, and severe batch imbalance.
GradientHealthMonitor is called after backward() and before optimizer.step().
It reports global and per-layer gradient norms, non-finite gradients, likely vanishing/exploding gradients, clipping coefficient, and update-to-weight ratio.
ExampleDynamicsTracker implements two underused training-dynamics probes:
Use stable dataset ids, logits, and labels during a normal classification run.
A forgetting event is a transition from correct classification to incorrect classification for the same example. Repeatedly forgotten examples are often ambiguous, mislabeled, or distribution-edge cases. Unforgettable examples can be useful candidates for pruning or curriculum experiments.
GradientConfusionMonitor estimates whether micro-batch gradients are aligned or fighting each other, following the gradient-confusion idea from Sankararaman et al. 2019.
It reports mean/min/max pairwise gradient cosine, the fraction of negative gradient pairs, and a compact conflict score. High conflict can point to noisy labels, incompatible samples, depth/initialization issues, or a need for a different batching/curriculum strategy.
AUMTracker implements the Area Under the Margin statistic from Pleiss et al. 2020. For each example, it averages:
Low-AUM examples are candidates for label audit or ambiguity review.
EL2NTracker implements the cheap example-importance score from Paul et al. 2021:
High EL2N examples tend to be important, hard, noisy, or distribution-edge examples. Low EL2N examples can be candidates for data-pruning experiments.
NeuralCollapseMonitor measures late-stage classifier geometry from Papyan, Han, and Donoho 2020:
traintools is alpha software. The diagnostics are intentionally small and
well-tested, but thresholds are heuristics and should be interpreted as training
signals, not automatic truth. Bug reports, benchmark traces, and real-world
failure cases are especially welcome.
Problem-oriented guides live in the documentation. Diagnostic
objects can be written as versioned JSON with write_json_report.
MIT
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/traintools)<a href="https://allmcps.com/mcp/traintools"><img src="https://allmcps.com/api/badge/traintools?style=directory" alt="TrainTools on AllMCPs" /></a>