ml-debugging

A step-by-step guide for finding why a machine-learning model trains badly or produces suspicious results. It separates problems in the data, training process, and ability to generalise to new data.

In plain words
What is it for?
Use it to test whether a model can overfit one batch, diagnose data and label wiring, investigate unstable optimisation, and find leakage or generalisation problems.
Why use it?
It provides a systematic way to investigate NaN losses, stuck training, implausibly high scores, or differences between training and validation results.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/param087/agent-ml-skills/ml-debugging
Any agent
npx skills add param087/agent-ml-skills --skill ml-debugging
Clone the repo
git clone --depth 1 https://github.com/param087/agent-ml-skills

Made for: Claude Code, Codex.

Per session 44 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 703 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00044 $0.00703
Opus 5 $0.00022 $0.00351
Sonnet 5 $0.00009 $0.00141
Haiku 4.5 $0.00004 $0.00070

Measured 2d ago against content hash 235366ddab71, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

ml-debugging scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/ml-debugging/SKILL.md · 70 lines

How it starts

The opening of the file, as written. The whole thing — 70 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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.

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

Symptom Likely cause Fix
Loss = NaN LR too high; log(0); /0; bad input scaling Lower LR, clip grads, add eps, normalize inputs
Loss flat at start LR too low; dead ReLUs; wrong loss Raise LR; check init; verify loss/target shapes
Train great, val terrible Overfitting or leakage Regularize/augment; audit for leakage
Val better than train Leakage; val too easy; dropout-at-train artifact Re-check split; inspect val set
Metric implausibly high Target leakage Hunt leaked features (see EDA skill)
Stuck at chance Labels misaligned; data not shuffled; LR off Verify 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).

Read the full file on GitHub · 70 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 70 lines · 44 tokens per session scan A 235366ddab71

Subscribe to this mod's changes

ml-debugging is a skill published in the GitHub repository param087/agent-ml-skills (9 stars, last pushed 2mo ago), licensed MIT. It adds 44 tokens to every session and 703 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

stock-data-fetch

Fetch multi-market financial data — US (FMP→Finnhub), A/HK (Tencent→Sina), crypto (OKX→Hyperliquid), commodities (Hyperliquid+Finnhub), news (Marketaux), backup (Longbridge). Battle-tested in restricted network environments.

realnaka/alphaloop · 62 tokens

data-scientist

数据分析全流程:数据画像、统计检验、可视化、报告生成。三阶段流程(数据摄入→分析执行→报告生成),单 agent 完成,无需多 agent 编排。当用户提到 CSV/Excel/Parquet 数据分析、假设检验、统计报告、制造业分析(良率/SPC/Cpk)、A/B 测试、或数据质量问题诊断时使用。.

realnghon/data-scientist · 95 tokens

auth-web-cloudbase

CloudBase Web Authentication Quick Guide for frontend integration after auth-tool has already been checked. Provides concise and practical Web authentication solutions with multiple login methods and complete user management.

TencentCloudBase/CloudBase-AI-Toolkit · 38 tokens

browse-and-evaluate

Use when exploring the ai-agent-skills catalog to find, compare, and evaluate skills before installing. Always use --fields to limit output size and --dry-run before committing to an install.

MoizIbnYousaf/Ai-Agent-Skills · 43 tokens

telnyx-messaging-hosted-curl

Set up hosted SMS numbers, toll-free verification, and RCS messaging. Use when migrating numbers or enabling rich messaging features. This skill provides REST API (curl) examples.

team-telnyx/ai · 45 tokens

render-airdrop-carousel

Assemble a viral iOS "AirDrop" notification-carousel video ad (≈6–8s, 9:16) from a brand line plus 6–16 real product photos — a native AirDrop share-sheet card ("Brand would like to share a · Decline / Accept") springs up and its preview window CYCLES through the products, landing on a range/lineup payoff with an…

gooseworks-ai/goose-skills · 207 tokens