plugins/yzmir-training-optimization/skills/using-training-optimization/SKILL.md
Use when encountering training problems (loss not decreasing, instability, NaN, overfitting, slow training) or selecting training dynamics (optimizer / LR / schedule / batch / precision / clipping / regularization) — routes to specialist sheets for the 2026-era landscape (Lion, Sophia, Muon, AdEMAMix, Schedule-Free, Prodigy, AdamW8bit, paged optimizers, WSD schedules, FP8 / BF16 precision, muP / mu-Transfer, ZeRO/FSDP strategy).
npx skillsauth add tachyon-beep/skillpacks using-training-optimizationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This meta-skill routes you to the right training optimization specialist based on symptoms. Training issues often have multiple potential causes—this skill helps diagnose symptoms and route to the appropriate specialist. Load this skill when you encounter training problems but aren't sure which specific technique to apply.
Core Principle: Diagnose before routing. Training issues often have multiple causes. Ask clarifying questions to understand symptoms before routing to specific skills. Wrong diagnosis wastes time—systematic routing saves it.
Knowledge cutoff (2026-05): The optimizer / schedule / precision landscape covered in this pack is calibrated to early-2026. Modern entries (Lion, Sophia, Muon, AdEMAMix, Schedule-Free, Prodigy, AdamW8bit / paged optimizers, FP8, WSD schedules, muP/mu-Transfer, ZeRO/FSDP strategy choice) are all routable. AdamW + cosine schedule + BF16 mixed precision remains the boring-and-correct default for most workloads; modern alternatives are pointed-tool replacements with documented trade-offs, not blanket upgrades. The router does not hardcode model IDs or vendor-specific recipes — capability tiers and symptom signatures drive routing.
Cross-pack frame (frozen vocabulary):
llm-finetuning-strategies.md) owns preference-tuning method choice: DPO, GRPO, SimPO, ORPO, KTO, IPO, RLHF/RLAIF. The boundary: "should I use DPO or SFT for my task?" is a method question → llm-specialist. "Does Lion beat AdamW for my DPO run?" is a training-dynamics question → here (optimizer choice) plus llm-specialist (preference method).torch.compile, torch.amp, DataLoader internals, distributed bring-up. We make the strategy call (e.g. "you need ZeRO-3"); they handle the API.Load this skill when:
Don't use for: PyTorch implementation bugs and APIs (use pytorch-engineering), model architecture selection (use neural-architectures), production deployment / model registry (use ml-production), RL-specific training (use deep-rl), LLM preference-tuning method choice (use llm-specialist).
IMPORTANT: All reference sheets are located in the SAME DIRECTORY as this SKILL.md file.
When this skill is loaded from:
skills/using-training-optimization/SKILL.md
Reference sheets like optimization-algorithms.md are at:
skills/using-training-optimization/optimization-algorithms.md
NOT at:
skills/optimization-algorithms.md ← WRONG PATH
When you see a link like [optimization-algorithms.md](optimization-algorithms.md), read the file from the same directory as this SKILL.md.
Keywords: stuck, flat loss, not improving, not learning, accuracy not increasing
Diagnostic questions (ask BEFORE routing):
Route based on answers:
| Loss Behavior | Likely Cause | Route To | Why | |---------------|--------------|----------|-----| | Flat from epoch 0 | LR too low OR wrong optimizer OR inappropriate loss | learning-rate-scheduling + optimization-algorithms | Need to diagnose starting conditions | | Was learning, then plateaued | Local minima OR LR too high OR overfitting | learning-rate-scheduling (scheduler) + check validation loss for overfitting | Adaptation needed during training | | Oscillating wildly | LR too high OR gradient instability | learning-rate-scheduling + gradient-management | Instability issues | | NaN or Inf | Gradient explosion OR numerical instability OR FP8/AMP loss-scale issue | gradient-management (PRIMARY) + loss-functions-and-objectives + batch-size-and-memory-tradeoffs (precision section) | Stability critical | | Loss function doesn't match task | Wrong objective | loss-functions-and-objectives | Fundamental mismatch |
Multi-skill routing: Often need optimization-algorithms (choose optimizer) + learning-rate-scheduling (choose LR/schedule) together for "not learning" issues.
Keywords: NaN, Inf, exploding, diverging, unstable, spikes, FP8 underflow, loss scale
Diagnostic questions:
Route to (in priority order):
gradient-management (PRIMARY)
learning-rate-scheduling (SECONDARY)
batch-size-and-memory-tradeoffs (precision section)
torch.amp / FP8 API itselfloss-functions-and-objectives (if numerical issues)
Cross-pack note: The strategy (which precision, when to clip, what loss-scale window) is here. The API (torch.amp.autocast, GradScaler, FP8 hooks) is in pytorch-engineering.
Keywords: overfitting, train/val gap, poor generalization, memorizing training data
Diagnostic questions:
Route to (multi-skill approach):
overfitting-prevention (PRIMARY)
data-augmentation-strategies (HIGHLY RECOMMENDED)
hyperparameter-tuning
Decision factors:
Keywords: slow training, low GPU utilization, takes too long, time per epoch
CRITICAL: Diagnose bottleneck before routing
Diagnostic questions:
Route based on bottleneck:
| GPU Utilization | Likely Cause | Route To | Why | |-----------------|--------------|----------|-----| | < 50% consistently | Data loading bottleneck OR CPU preprocessing | pytorch-engineering (data loading, profiling) | Not compute-bound, infrastructure issue | | High (> 80%) but still slow | Batch size too small OR precision too high OR need distributed training | batch-size-and-memory-tradeoffs (incl. FP8/BF16) + possibly pytorch-engineering (distributed) | Compute-bound, need scaling | | High + heavy augmentation | Augmentation overhead | data-augmentation-strategies (optimization) + pytorch-engineering (profiling) | Augmentation CPU cost | | Memory-limited batch size | Can't increase batch size due to OOM | batch-size-and-memory-tradeoffs (gradient accumulation, 8-bit/paged optimizers, ZeRO/FSDP strategy) + pytorch-engineering (memory) | Memory constraints limiting throughput |
Cross-pack boundaries:
Key principle: Profile FIRST before optimizing. Low GPU utilization = wrong optimization target.
Direct hyperparameter questions route to specific skills:
| Question | Route To | Examples | |----------|----------|----------| | "Which optimizer?" | optimization-algorithms | SGD, Adam, AdamW, Lion, Sophia, Muon, Shampoo, AdEMAMix, Schedule-Free, Prodigy, AdamW8bit, paged variants | | "Which learning rate?" | learning-rate-scheduling | Initial LR, warmup, cosine vs WSD vs linear, infinite-LR variants | | "Which batch size? Which precision?" | batch-size-and-memory-tradeoffs | Batch size effects on convergence and speed; FP8/BF16/FP16 trade-offs; gradient accumulation | | "Which loss function?" | loss-functions-and-objectives | Cross-entropy vs focal vs custom | | "How to prevent overfitting?" | overfitting-prevention | Dropout, weight decay, early stopping | | "Which augmentation?" | data-augmentation-strategies | Type and strength of augmentation | | "How to tune hyperparameters? muP / mu-Transfer?" | hyperparameter-tuning | Search strategies, AutoML, muP for transfer across scale | | "How to track experiments?" | experiment-tracking | MLflow, W&B, TensorBoard (in-flight; production registry → ml-production) | | "ZeRO stage / FSDP sharding strategy?" | optimization-algorithms (strategy) + batch-size-and-memory-tradeoffs (memory math); cross-ref pytorch-engineering for API | ZeRO-1/2/3, FSDP full vs hybrid shard | | "DPO vs SFT vs GRPO vs SimPO for my model?" | yzmir-llm-specialist / llm-finetuning-strategies.md (CROSS-PACK) | Preference-tuning method choice is task-driven, lives there |
For new project setup, route to MULTIPLE in sequence:
Keywords: Lion, Sophia, Muon, Shampoo, AdEMAMix, Schedule-Free, Prodigy, 8-bit optimizer, bitsandbytes, paged optimizer, WSD schedule, warmup-stable-decay, FP8, BF16, mixed precision, muP, mu-Transfer, ZeRO, FSDP strategy
Routing table:
| Trigger | Route To | Notes | |---------|----------|-------| | Lion / Sophia / Muon / Shampoo / AdEMAMix / Schedule-Free / Prodigy | optimization-algorithms | Modern-optimizer landscape sheet; includes "when X beats AdamW / when not" tables | | 8-bit optimizer / bitsandbytes / paged optimizer (AdamW8bit, paged AdamW, etc.) | optimization-algorithms | Memory-efficient optimizer variants live here | | WSD schedule / warmup-stable-decay / infinite-LR | learning-rate-scheduling | Modern schedule alongside cosine and linear | | FP8 / BF16 / FP16 / mixed precision strategy | batch-size-and-memory-tradeoffs | Precision trade-offs live in the memory sheet (no dedicated precision sheet); FP8 specifically here | | muP / mu-Transfer | hyperparameter-tuning | Hyperparameter transfer across width/scale | | ZeRO stage choice / FSDP sharding-strategy choice | optimization-algorithms (strategy section) + batch-size-and-memory-tradeoffs (memory math) | Cross-ref pytorch-engineering for the FSDP API itself | | DPO / GRPO / SimPO / ORPO / KTO / IPO / preference loss / RLHF method | yzmir-llm-specialist / llm-finetuning-strategies.md | CROSS-PACK — method choice is task-driven, lives there. Optimizer choice for the run still routes here. |
Cross-pack split (preference tuning):
Keywords: experiment tracking, MLflow, wandb, tensorboard, compare runs, log metrics
Route to:
experiment-tracking (PRIMARY)
hyperparameter-tuning (if systematic search)
training-loop-architecture (for integration)
Cross-pack boundary: Long-lived model registry, model lineage, and production artifact tracking → yzmir-ml-production / experiment-tracking-and-versioning.md. This pack covers the training-time logging surface; ml-production owns what happens after the run is done.
Route to (in order):
Why this order: Foundation (optimizer/LR/batch/precision) → Objective (loss) → Infrastructure (tracking/loop)
Route to (diagnose first, then in order):
Why this order: Stability (gradients) → Adaptation (LR) → Algorithm (optimizer)
Common mistakes:
Route to (multi-pronged approach):
Why all three: Overfitting needs comprehensive strategy, not single technique.
Prioritization:
Route to:
torch.compileWhy: Speed and memory are coupled. We make the strategy call (precision, optimizer memory, sharding choice); pytorch-engineering provides the API.
Route to:
Why: Custom losses need careful design + gradient analysis + tuning.
This is intentionally a cross-pack scenario.
Routing rule: If the user asks "which preference method?" the answer comes from llm-specialist. If they ask "my DPO run is unstable, what optimizer / LR / clipping?" the answer is both packs jointly — never assume optimizer choice alone fixes a preference-tuning instability.
When symptom unclear, ASK ONE diagnostic question before routing:
| Vague Query | Clarifying Question | Why | |-------------|---------------------|-----| | "Fix my training" | "What specific issue? Not learning? Unstable? Overfitting? Too slow?" | 4+ different routing paths | | "Improve model" | "Improve what? Training speed? Accuracy? Generalization?" | Different optimization targets | | "Training not working well" | "What's 'not working'? Loss behavior? Accuracy? Convergence speed?" | Need specific symptoms | | "Optimize hyperparameters" | "Which hyperparameters? All of them? Specific ones like LR?" | Specific vs broad search | | "Model performs poorly" | "Training accuracy poor or validation accuracy poor or both?" | Underfitting vs overfitting | | "Should I use Lion / Sophia / Muon?" | "What symptom is making you consider switching from AdamW?" | Modern optimizer is rarely the right first move | | "DPO isn't working" | "Method-side issue (β, pairs, reference model) or training-dynamics issue (loss spiking, NaN)?" | Cross-pack split |
Never guess when ambiguous. Ask once, route accurately.
| Symptom | Wrong Route | Correct Route | Why | |---------|-------------|---------------|-----| | "Training slow" | batch-size-and-memory | ASK: Check GPU utilization first | Might be data loading, not compute | | "Not learning" | optimization-algorithms | ASK: Diagnose loss behavior | Could be LR, gradients, loss function | | "Loss NaN" | learning-rate-scheduling | gradient-management FIRST (then check FP8/AMP loss-scale) | Gradient explosion most common cause | | "Overfitting" | overfitting-prevention only | overfitting-prevention + data-augmentation | Need multi-pronged approach | | "Need to speed up training" | optimization-algorithms | Profile first (pytorch-engineering) | Don't optimize without measuring | | "Which optimizer for transformer" | neural-architectures | optimization-algorithms | Optimizer choice, not architecture | | "Use Lion because it's modern" | Switch optimizer | optimization-algorithms — read the "when Lion beats AdamW / when not" table; AdamW remains the boring-correct default for most workloads | Modernity is not a reason; symptom + evidence is | | "DPO training unstable, fix optimizer" | optimization-algorithms alone | llm-specialist (preference-tuning method) jointly with gradient-management + learning-rate-scheduling here | Preference-tuning instability is usually method-side (β, ref model, pairs) before it's optimizer-side | | "FP8 underflow / loss-scale issue" | learning-rate-scheduling | batch-size-and-memory-tradeoffs (precision) + pytorch-engineering (AMP/FP8 API) | Precision issue, not LR | | "ZeRO-3 vs FSDP full-shard?" | pytorch-engineering only | optimization-algorithms (strategy) + batch-size-and-memory-tradeoffs (memory math); pytorch-engineering for API | Strategy choice is here; API is there | | "muP for scaling up" | optimization-algorithms | hyperparameter-tuning | muP is a hyperparameter-transfer technique |
Key principle: Diagnosis before solutions, clarification before routing, multi-skill for complex issues.
Skip training-optimization when:
| Symptom | Wrong Pack | Correct Pack | Why | |---------|------------|--------------|-----| | "CUDA out of memory" | training-optimization | pytorch-engineering | Infrastructure issue, not training algorithm | | "DDP / FSDP not working" (API failures) | training-optimization | pytorch-engineering | Distributed setup API, not strategy choice | | "torch.compile errors" | training-optimization | pytorch-engineering | Compiler/API issue | | "torch.amp / GradScaler API" | training-optimization | pytorch-engineering | Mixed-precision API; strategy (when to use FP8/BF16) is here | | "Which architecture to use" | training-optimization | neural-architectures | Architecture choice precedes training | | "Model won't load" | training-optimization | pytorch-engineering | Checkpointing/serialization issue | | "Inference too slow" | training-optimization | ml-production | Production optimization, not training | | "How to deploy model" | training-optimization | ml-production | Deployment concern | | "Production model registry / lineage" | training-optimization | ml-production (experiment-tracking-and-versioning) | Long-lived registry vs in-flight tracking | | "RL exploration issues" | training-optimization | deep-rl | RL-specific training concern | | "DPO / GRPO / SimPO method choice" | training-optimization | llm-specialist (llm-finetuning-strategies) | Preference-tuning method is task-driven | | "RLHF for LLM" | training-optimization | llm-specialist | LLM-specific technique |
Training-optimization pack is for: Framework-agnostic training algorithms, hyperparameters, optimization techniques, and training strategies that apply across architectures.
Boundaries:
If you catch yourself about to:
All of these mean: You're about to give incomplete advice. Route to specialist instead.
| Rationalization | Reality | What To Do Instead | |-----------------|---------|-------------------| | "User is rushed, skip diagnostic questions" | Diagnosis takes 30 seconds, wrong route wastes 10+ minutes | Ask ONE quick diagnostic question: "Is loss flat, oscillating, or NaN?" | | "Symptoms are obvious, route immediately" | Symptoms often have multiple causes | Ask clarifying question to eliminate ambiguity | | "User suggested optimizer change" | User self-diagnosis can be wrong | "What loss behavior are you seeing?" to verify root cause | | "Expert user doesn't need routing" | Expert users benefit from specialist skills too | Route based on symptoms, not user sophistication | | "Just a quick question" | Quick questions deserve correct answers | Route to specialist—they have quick diagnostics too | | "Single solution will fix it" | Training issues often multi-causal | Consider multi-skill routing for complex symptoms | | "Time pressure means guess quickly" | Wrong guess wastes MORE time | Fast systematic diagnosis faster than trial-and-error | | "They already tried X" | Maybe tried X wrong or X wasn't the issue | Route to specialist to verify X was done correctly | | "Too complex to route" | Complex issues need specialists MORE | Use multi-skill routing for complex scenarios | | "Direct answer is helpful" | Wrong direct answer wastes time | Routing IS the helpful answer |
If you catch yourself thinking ANY of these, STOP and route to specialist or ask diagnostic question.
| Pressure | Wrong Response | Correct Response | |----------|----------------|------------------| | "Demo tomorrow, need quick fix" | Give untested suggestions | "Fast systematic diagnosis ensures demo success: [question]" | | "Production training failing" | Panic and guess | "Quick clarification prevents longer outage: [question]" | | "Just tell me which optimizer" | "Use Adam" | "30-second clarification ensures right choice: [question]" |
Emergency protocol: Fast clarification (30 sec) → Correct routing (60 sec) → Specialist handles efficiently
| Pressure | Wrong Response | Correct Response | |----------|----------------|------------------| | "Senior said use SGD" | Accept without verification | "To apply SGD effectively, let me verify the symptoms: [question]" | | "PM wants optimizer change" | Change without diagnosis | "Let's diagnose to ensure optimizer is the issue: [question]" |
Authority protocol: Acknowledge → Verify symptoms → Route based on evidence, not opinion
| Pressure | Wrong Response | Correct Response | |----------|----------------|------------------| | "I think it's the optimizer" | Discuss optimizer choice | "What loss behavior makes you think optimizer? [diagnostic]" | | "Obviously need to clip gradients" | Implement clipping | "What symptoms suggest gradient issues? [verify]" |
Verification protocol: User attribution is hypothesis, not diagnosis. Verify with symptoms.
Before giving ANY training advice or routing, ask yourself:
❓ Did I identify specific symptoms?
❓ Is this symptom in my routing table?
❓ Am I about to give direct advice?
❓ Could this symptom have multiple causes?
❓ Is this training-optimization or another pack?
❓ Am I feeling pressure to skip routing?
If you failed ANY check, do NOT give direct advice. Route to specialist or ask clarifying question.
After routing, load the appropriate specialist skill for detailed guidance. The pack contains exactly 10 specialist sheets alongside this router:
| Symptom | Primary Skill | Secondary Skills | Diagnostic Question | |---------|---------------|------------------|---------------------| | Loss flat/stuck | learning-rate-scheduling | optimization-algorithms | "Flat from start or plateaued later?" | | Loss NaN/Inf | gradient-management | learning-rate-scheduling, loss-functions, batch-size-and-memory (precision) | "When does NaN appear? Using FP8/AMP?" | | Overfitting | overfitting-prevention | data-augmentation, hyperparameter-tuning | "Dataset size? Current regularization?" | | Training slow | batch-size-and-memory OR pytorch-engineering | data-augmentation | "GPU utilization percentage?" | | Oscillating loss | learning-rate-scheduling | gradient-management | "What's your current LR?" | | Which optimizer (incl. Lion/Sophia/Muon/AdEMAMix/Schedule-Free) | optimization-algorithms | learning-rate-scheduling | "What symptom is driving the switch from AdamW?" | | Which LR / WSD vs cosine | learning-rate-scheduling | optimization-algorithms | Optimizer, task, will you resume training? | | Which precision (FP8 / BF16) | batch-size-and-memory-tradeoffs | gradient-management; cross-ref pytorch-engineering for API | Hardware? Stability constraints? | | muP / mu-Transfer | hyperparameter-tuning | optimization-algorithms | Scaling width or depth? | | ZeRO / FSDP strategy | optimization-algorithms (strategy) + batch-size-and-memory-tradeoffs (memory) | pytorch-engineering (API) | Model size, GPU count, memory budget? | | 8-bit / paged optimizer | optimization-algorithms | batch-size-and-memory-tradeoffs | Memory pressure? Optimizer-state size? | | Track experiments (in-flight) | experiment-tracking | hyperparameter-tuning, training-loop | Tools preference, scale of experiments | | Production registry / lineage | ml-production / experiment-tracking-and-versioning (cross-pack) | experiment-tracking (here, for in-flight) | After-training artifact lifecycle? | | Poor generalization | overfitting-prevention | data-augmentation | Train vs val accuracy gap | | Convergence issues | gradient-management | learning-rate-scheduling, optimization-algorithms | Gradient norms, loss curve | | DPO / GRPO / SimPO method | llm-specialist / llm-finetuning-strategies (cross-pack) | optimization-algorithms + gradient-management here for dynamics | Method-side or dynamics-side issue? |
Cross-pack boundaries (bidirectional):
torch.compile, torch.amp, DataLoader, distributed bring-up, memory profiling. We pick the strategy; they implement it.llm-finetuning-strategies.md) — Preference-tuning method choice (DPO / GRPO / SimPO / ORPO / KTO / IPO), RLHF/RLAIF, fine-tuning recipes. We supply training dynamics for those runs (optimizer / LR / clipping / precision).experiment-tracking-and-versioning.md) — Long-lived model registry, lineage, deployment artifacts. We own in-flight logging during training; they own the artifact lifecycle after.This meta-skill: Diagnose symptoms → Route to specialists → Resist pressure to give direct advice. Training issues often have multiple causes. Clarify symptoms, route to specialists. Wrong routing wastes more time than asking one clarifying question.
Modern landscape (2026-05) is integrated: Lion, Sophia, Muon, AdEMAMix, Schedule-Free, Prodigy, AdamW8bit, paged optimizers, WSD schedules, FP8, muP, ZeRO/FSDP strategy. AdamW + cosine + BF16 remains the boring-and-correct default — modern alternatives are symptom-driven choices, not blanket upgrades.
Cross-pack discipline: Preference-tuning method choice (DPO/GRPO/SimPO/etc.) lives in yzmir-llm-specialist; PyTorch APIs live in yzmir-pytorch-engineering; production registry lives in yzmir-ml-production. Route deliberately across pack boundaries when the question spans them.
Route based on symptoms, not guesses.
tools
Use when designing, implementing, or auditing an MCP (Model Context Protocol) server — tool API design, idempotency under agent retry, structured error envelopes agents can recover from, schema versioning across model drift, transport reliability (stdio / HTTP), output-shape and pagination discipline, and choosing between tools / resources / prompts / sampling. Also use when an MCP server's tools confuse agents, return unstructured errors, deadlock under concurrent calls, double-execute under retry, or lose state across reconnects. Do not use for general REST/GraphQL API design (use `/web-backend`), for client-side prompt engineering or tool-loop design (use `/llm-specialist`), for general in-process plugin architecture (use `/system-architect`), or for cryptographic-provenance audit trails (use `/audit-pipelines`).
development
Use when running **SQLite or DuckDB inside an application process** as the durable store — not as a development convenience but as the production database. Use when scaling an SQLite layer that worked at low concurrency and is now hitting SQLITE_BUSY, WAL bloat, lock contention, schema-migration ceremony, or correctness gaps under multi-process writers. Use when introducing DuckDB as an OLAP complement to an OLTP SQLite store, or when picking between the two for a new component. Pairs with `/web-backend` (the API surface above the DB) and `/audit-pipelines` (when the DB is also the audit trail). Do not load for server databases (Postgres, MySQL), key-value stores, or ORM choice in isolation.
development
Use when designing or critiquing the structure of a staged procedure — a wizard, configuration flow, troubleshooting tree, training curriculum, multi-stage approval pipeline, decision pipeline, or any decomposition of expert work into composable stages. Use for both producer work (build the decomposition) and critic work (audit a proposed decomposition). Use when reasoning about capacity, bottlenecks, or soundness of a procedural flow. Do not use for implementation-plan critique of code changes (use `/axiom-planning` instead), for execution-time dynamics (use `/simulation-foundations`), or for rendering an already-designed procedure as docs or UI (use `/technical-writer` or `/ux-designer`).
testing
Use when the user wants to draft fiction or creative nonfiction prose, get craft critique on prose they have written, or plan story structure, outline, or premise. Workshop-voiced. Three explicit modes (draft, critique, plan) and the router will refuse to begin work without a declared mode.