Skip to content
Development
Skill

/training-optimization

Use when training or fine-tuning a deep model and tuning it for best accuracy. Covers transfer learning, two-phase fine-tuning, discriminative/layer-wise LR, LR schedules + warmup, regularization tuned to over/under-fit (dropout, weight decay, label smoothing, MixUp), mixed

From plugin
mlcraft
823 skills1 agent1 command

Claude Code

$ npx -y skills add mxslr/mlcraft --skill training-optimization --agent claude-code

SKILL.md

training-optimization.SKILL.md
name: training-optimization
description: "Use when training or fine-tuning a deep model and tuning it for best accuracy. Covers transfer learning, two-phase fine-tuning, discriminative/layer-wise LR, LR schedules + warmup, regularization tuned to over/under-fit (dropout, weight decay, label smoothing, MixUp), mixed precision, gradient checkpointing, EMA, checkpoint/resume, and fitting a GPU/time budget. Triggers on 'fine-tune', 'train the model', 'best hyperparameters', 'overfitting', 'learning rate', 'out of memory', 'training is too slow'."

Training & Fine-Tuning

Best-practice recipe for transfer-learning a strong model, and how to fix over/under-fitting.

Fine-tuning recipe (default that works)

1. **Transfer learning**: start from ImageNet/pretrained weights; train from scratch only with lots of data. 2. **Two phases**: (1) freeze backbone, train the new head; (2) unfreeze and fine-tune end-to-end at a lower LR. 3. **Discriminative / layer-wise LR**: small LR for early backbone layers, higher for the head. Biggest single fine-tuning win. 4. **Schedule**: cosine decay with a short warmup. Log the LR curve. 5. **Optimizer**: AdamW (decoupled weight decay). Gradient clipping ~1.0. 6. **Selection**: checkpoint the best epoch by the **validation** metric; early stopping.

Diagnose then regularize (don't guess)

  • **Overfitting** (train accuracy keeps rising while val loss rises or plateaus): raise weight decay, dropout, label smoothing; add MixUp; stronger-but-domain-appropriate augmentation; reduce epochs/patience; smaller/less-capacity head.
  • **Underfitting** (train acc low too): reduce regularization, raise LR / capacity / resolution, train longer, check data quality.
  • Match augmentation to the domain - do **not** use aggressive photometric/geometric ops that destroy the signal (e.g., harsh color/solarize on medical scans, or flips that change semantics).

Compute & memory (fit the budget)

  • **Mixed precision (AMP)** always on GPU.
  • **Gradient checkpointing** to fit high resolution / big models in limited VRAM (~3× memory saving, ~30% slower).
  • **Small batch + gradient accumulation** to keep an effective batch size when VRAM is tight; **freeze BatchNorm** stats at very small batch (LayerNorm backbones like ConvNeXt are safer there).
  • **Preprocess once to disk** if per-epoch CPU work (decode/enhance) starves the GPU - huge speedups.
  • Budget = seconds/epoch × epochs × models. Measure on a quick run first; pick resolution/epochs to fit the quota. Prefer one honest fit over a run that dies mid-way.

Robustness

  • Fixed seeds; **checkpoint per epoch + resume** so an interrupted long run continues, not restarts.
  • EMA of weights and/or averaging often helps generalization - but verify it beats the plain best checkpoint on val before keeping it.
Read more
@mxslr
Ships withmlcraft

A research-first AI/ML research-engineer workflow for Claude Code

823 skills1 agent
Get the whole plugin

Stars on GitHub

Momentum

stars in total
8
Star history of mxslr/mlcraft on GitHub, a chart by star-history.com

Other skills on mlcraft.

accuracy-improvement-loop

accuracy-improvement-l…

Use when an existing model's results are disappointing and the user wants higher accuracy - 'accuracy is still too low',…

@mxslr@mxslrInstall Skill
data-rigor-and-leakage

data-rigor-and-leakage

Use BEFORE training any model, to build correct train/val/test splits and hunt data leakage - the #1 cause of fake-high accuracy.…

@mxslr@mxslrInstall Skill
dataset-profiling

dataset-profiling

Use as the FIRST step of any ML task, before choosing a model, to inspect and understand the actual dataset. Works for a LOCAL…

@mxslr@mxslrInstall Skill
deployment-explainability

deployment-explainabil…

Use when turning a trained model into something usable (an app, an inference function, a demo) or adding explainability. Selects…

@mxslr@mxslrInstall Skill
domain-3d

domain-3d

Use for 3D and point cloud tasks: point cloud classification, 3D semantic or instance segmentation, 3D object detection from…

@mxslr@mxslrInstall Skill
domain-anomaly-detection

domain-anomaly-detecti…

Use for anomaly, outlier, and novelty detection across data types: industrial or visual defect detection, time-series or sensor…

@mxslr@mxslrInstall Skill

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills10d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc12d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react1d252k
@facebook@facebookInstall Skill

Questions about training-optimization.

Which coding agents can use training-optimization?
training-optimization installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.