param087/agent-ml-skills/ml-debugging

Claude Code and agent skill by param087/agent-ml-skills

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Use when a model won't learn, loss is NaN, metrics look too good/bad, or training is unstable. Provides a systematic decision tree for diagnosing data, optimization, and generalization failures.

Install

npx vskill@latest install param087/agent-ml-skills/ml-debugging

SKILL.md

The same SKILL.md was published earlier as param087/agent-ml-skills/ml-debugging.

ML Debugging

Overview

ML bugs are usually silent — the code runs, but the model is wrong. Debug systematically by isolating which layer is broken: data, optimization, or generalization. Form a hypothesis, test it with the cheapest possible experiment, then move on.

When to use

  • Loss is NaN/Inf or stuck.
  • Metrics are implausibly high (leakage) or stuck at chance.
  • Train/val curves diverge.

First move: can it overfit one batch?

The fastest sanity check in ML. Take a single small batch and train until loss ≈ 0.

python
x, y = next(iter(train_loader))
for _ in range(200):
optimizer.zero_grad()
loss = criterion(model(x), y)
loss.backward(); optimizer.step()
print(loss.item()) # should approach 0
  • Can't overfit one batch → bug in model/loss/labels/data wiring (not capacity).
  • Overfits one batch but not the dataset → optimization or regularization issue.

Symptom → cause decision tree

SymptomLikely causeFix
Loss = NaNLR too high; log(0); /0; bad input scalingLower LR, clip grads, add eps, normalize inputs
Loss flat at startLR too low; dead ReLUs; wrong lossRaise LR; check init; verify loss/target shapes
Train great, val terribleOverfitting or leakageRegularize/augment; audit for leakage
Val better than trainLeakage; val too easy; dropout-at-train artifactRe-check split; inspect val set
Metric implausibly highTarget leakageHunt leaked features (see EDA skill)
Stuck at chanceLabels misaligned; data not shuffled; LR offVerify label mapping; shuffle; sweep LR

Leakage hunt (when results are "too good")

  1. Any feature with |corr| ≈ 1.0 to target?
  2. Is preprocessing fit before the split?
  3. Do rows from one entity span train and test? (use GroupKFold)
  4. Time series shuffled? (must be chronological)
  5. Is a post-outcome column (e.g., refund_issued) used to predict the outcome?

Optimization checklist

  • Normalize/standardize inputs.
  • Sweep LR over [1e-5 ... 1e-1] (log scale) — wrong LR causes most failures.
  • Add gradient clipping for RNNs/transformers.
  • Check for NaNs in inputs/targets before training.
  • Verify loss matches task (CE for classification logits, not MSE).

Pitfalls

  • Changing five things at once — change one variable per experiment.
  • Debugging on the full dataset — shrink to fail fast.
  • Trusting metrics without inspecting predictions/confusion matrix.

Hand-off

A root-caused fix plus a regression check (the one-batch test + a held-out metric) so experiment-tracking can confirm the issue stays fixed.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/param087/agent-ml-skills/ml-debugging/badge)](https://verified-skill.com/skills/param087/agent-ml-skills/ml-debugging)

Something wrong with this skill or its page? Tell us.