ml-training

Plans, debugs, and reviews LLM fine-tuning runs with memory ledgers and distributed training rules.

22|Updated Sep 10, 2026
One-click install
npx skills add https://github.com/Lynricsy/HyperSkills --skill ml-training-lynricsy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ml-training
Source: https://github.com/Lynricsy/HyperSkills/tree/main/skills/ml-training
Command: npx skills add https://github.com/Lynricsy/HyperSkills --skill ml-training-lynricsy

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Fine-tuning runs fail in expensive ways: scripts raise TypeError on transformers 5 / trl 1 APIs, OOMs get misdiagnosed, benchmark scores are inflated by data leakage, and preference runs inherit SFT learning rates. This Skill encodes the memory arithmetic, API migrations, dataset hygiene order, and evaluation discipline needed to plan and review training runs before GPU hours are spent. ## Core Features & Use Cases - Memory ledger and OOM triage: Computes the four memory terms (weights, gradients, optimizer state, activations) via scripts/vram_ledger.py, names the dominant term, and applies the fixed remedy order starting with expandable_segments. - Method selection and hyperparameter guardrails: Chooses between SFT, DPO, GRPO, LoRA, QLoRA, and full fine-tuning based on data shape, with verified trl 1.13 defaults (SFT 2e-5 vs DPO/GRPO 1e-6) and GRPO batch divisibility checks. - Dataset hygiene and evaluation: Runs scripts/dataset_overlap.py to detect exact, near-duplicate, and cross-split n-gram leakage (n=13), enforces dedup-before-split ordering, and requires base-model baselines plus regression suites. - Use Case: Before launching an 8B full fine-tune on one A100, run the ledger to show it needs ~119 GiB of model state alone, switch to LoRA, fix the trl 1.13 config renames, and gate the pipeline on the overlap check. ## Quick Start Ask the agent to review my training script and run notes, compute the memory ledger for my hardware, and tell me whether the run fits and what to change first.

Frequently Asked Questions about ml-training

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix CUDA out of memory during LLM fine-tuning?

First set PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True, then compute the memory ledger to identify the dominant term. Lower the micro-batch only if activations dominate; use LoRA or QLoRA when optimizer state or weights dominate, since sharding does not reduce activations.

How much GPU memory does full fine-tuning an 8B model need?

Full fine-tuning costs roughly 16 bytes per parameter of model state: 2 for bf16 weights, 2 for gradients, 8 for Adam's fp32 moments, and 4 for the fp32 master copy. An 8B model needs about 119 GiB before activations, so it cannot fit on one 80 GB card at any batch size.

Should I use SFT, DPO, or GRPO for fine-tuning?

Choose by data shape: SFT needs prompt-completion demonstrations, DPO needs chosen/rejected preference pairs plus a frozen reference model, and GRPO needs prompts with a verifiable reward function. Preference methods run at about 1e-6 learning rate versus 2e-5 for SFT, and DPO should start from the SFT checkpoint.

Why does my training script fail with TypeError on trl 1.13?

trl 1.x and transformers 5 renamed several arguments: max_seq_length became max_length, evaluation_strategy became eval_strategy, warmup_ratio was removed in favor of warmup_steps, and Trainer takes processing_class instead of tokenizer. Fix all renames in one pass rather than one TypeError per launch.

How do I check for benchmark contamination in training data?

An eval document is contaminated if it shares any n-gram with any training document, with n=13 as the standard. Index the training set's n-grams once, stream the eval set through the index, and report the contaminated fraction alongside any benchmark score.

Does LoRA reduce the memory needed for the base model weights?

No. LoRA freezes the base model but keeps it fully resident; only gradients and optimizer state shrink to the adapter's size. If the weights alone exceed the card, use QLoRA, which keeps the frozen base in 4-bit quantization.