model-training-engineering
GitHub指导端到端模型训练实验的工程化流程,涵盖数据预处理、防泄露检查、基线对比及实验记录管理。适用于ML研发阶段的数据与模型开发工作流编排。
Trigger Scenarios
Install
npx skills add overmind-core/overmind --skill model-training-engineering -g -y
SKILL.md
Frontmatter
{
"name": "model-training-engineering",
"description": "Engineer or restart an end-to-end model-training experiment, from source interpretation and leakage-safe transformation through baselines, training configuration, monitored launch and honest comparison. Use for training playbooks and workflows spanning data and model development; not isolated serving operations."
}
Model training engineering
Own the experimental claim, not just successful execution. A valid file, completed GPU job, lower loss and useful model are four different outcomes. Adapt this playbook to the task and provider; it does not mandate a model family, dataset, split ratio, pilot or universal quality threshold.
This is a practical synthesis of primary ML guidance, not a universal certified standard. Read practice foundations when designing or reviewing the workflow; it maps stages to maintained primary sources and distinguishes safeguards from conditional recommendations. Historical incidents supplement that foundation; they do not establish generally accepted practice.
For Overmind, read the platform reference before platform actions and use the installed Datasets/Training skills for current contracts. For a restart or process review, read cross-run lessons. Keep dataset IDs and incident-specific recipes in the experiment record, not here.
Establish the claim and scope
- State prediction unit, target meaning, inference-time inputs, intended population, primary task metric, success criterion and comparators. Distinguish predicting a recorded workflow label from making a correct real-world decision. Unknown label quality remains a limitation, even if the target is called gold.
- Review relevant accessible runs, including successful, failed, cancelled and incomplete attempts. Separate observed facts, suspected causes and untested remedies. Record the review's scope; absence from a listing is not proof of no run.
- Preserve the requested model and run scope. Recommend a simpler baseline when informative, but do not silently replace the task. A full run need not have an extra pilot. A hardware profile, tiny fitting check and quality pilot answer different questions and require their own stated scope.
- Keep a durable ledger: source/checksum, transformation, split membership, model revision, runtime, prepared inputs, configuration, job, checkpoint and comparison. Preserve old evidence on restart; resolve which existing work is actually active.
Source, semantics and transformation
Evidence basis: source documentation and preprocessing.
- Inspect record boundaries, types, counts, time range, missingness, class/family coverage, conflicting targets and duplicate inputs. Preserve approved source bytes, license/provenance and any sanitization code/checksum. Do not upload additional sensitive fields simply because they could improve performance.
- Check feature availability at prediction time. Exclude outcomes, future aggregates, same-observation target leakage and identifiers used as shortcuts. If a feature's availability is unresolved, state that instead of inventing a justification.
- Define the population and sampling/label-generation process, including synthetic or teacher-generated data. Record annotation uncertainty, selection bias, delayed labels and relevant subgroup coverage. A public dataset is not automatically representative of deployment or unrestricted for every use.
- Separate raw observation identity, model-input equivalence and entity membership. Common text or a common column value is not automatically the independent unit. Where records connect multiple case/thread IDs, assess the connected family. Missing entity IDs limit claims about unseen-entity performance.
- Retain inspectable transformation code. Preserve stable source identities and parents through filters, branches and joins; report exclusions and label changes. Keep labels/provenance out of prediction-time features. Autoregressive training may feed target tokens through the intended shift/mask; that is not permission to expose the answer at evaluation time. Preserve option order, soft targets, weights, ties and ordinal semantics when present.
- Define handling of missing values, outliers, units, categories and invalid rows. Do not blindly drop duplicates or rebalance labels: repetitions may be legitimate weights and resampling changes the distribution. Fit learned treatments on train; use out-of-fold construction for target-dependent encodings.
- Test every target mapping and representative family, not only the majority prefix. Cover malformed/null/boundary values, contradictory labels, numeric precision, stable identities, and branch membership. Counts alone do not prove correct routing. Do not apply independent batches to global grouping/sorting unless the algorithm explicitly preserves global coordination and correctness.
- Preview first, then audit published output against the source. Report coverage: a sample or schema check is not a full semantic review. Fix retained transformation logic and rebuild from its source rather than stacking opaque repair datasets.
Freeze the evaluation design before fitting
- Choose time, entity/group or random splitting from the deployment question. Split before learning imputation, normalization, vocabulary, encoders, feature selection or resampling. Fit those only on training data and reuse the fitted state unchanged. Preserve natural held-out prevalence unless evaluating an explicitly different population.
- Separate training, development, calibration and locked final testing when applicable. Development selects recipes/checkpoints; calibration fits temperatures/thresholds; final results do not select either. If a test influenced development, disclose that and obtain a fresh holdout for a new generalization claim.
- For small datasets, consider cross-validation that respects the same groups/time constraints rather than fragmenting the data into four undersized sets. Keep model selection inside development folds; use nested evaluation when estimating a tuned procedure without an independent test. Stratification does not resolve dependence.
- Verify actual memberships, chronology, group intersections, exact input overlap, representation and plausible near-duplicate leakage. Preserve legitimate relatedness even when it complicates a split. Zero exact overlap is not proof of independence from near duplicates, pretraining data or unavailable customer identities.
- For rare classes, retain per-class support, precision/recall, confusion counts and suitable probability/ranking/operating-point metrics. Accuracy can reward predicting only the majority class. Specify denominator, threshold and whether measures are sample-level, group-level or population estimates.
- Choose metrics by task: classification support/ranking/probability quality; regression errors in meaningful units; ranking metrics at the relevant cutoff; generative task correctness plus validity/coverage, not language-model loss alone. Document averaging, class order and metric conventions.
- Probability calibration and action-threshold choice are different. Fit them using independent or out-of-fold predictions, never final results. Tie thresholds to error costs or operating constraints; 0.5 is not universally appropriate. Log loss or Brier score alone is not a pure measure of calibration.
Establish learnability and comparison evidence
Evidence basis: baselines and tuning.
- Measure a task-appropriate trivial baseline and, when informative, a simple conventional learner using train/development only. Match the requested unchanged-base comparator to the exact model identity and inference contract. A previously measured baseline is reusable only with verified equivalent inputs, labels, split and method; attribute it rather than calling it freshly measured.
- Inspect whether the available inputs can reasonably determine the targets. Contradictory or weak labels may limit performance; more epochs do not create missing information. Compare task quality, not just training loss.
- Use a bounded fitting sanity check when warranted. Check that representative training examples can be fit. Separately check development behavior against baselines; memorizing a tiny training set does not establish generalization. If fitting fails, inspect target mapping, masks, trainable parameters, head/backbone learning rates, gradients, precision and optimizer behavior before scaling. Static encoding tests are useful but do not prove the selected model can fit.
- If a full run proceeds without measured fitting evidence, disclose that uncertainty; do not fabricate a passed sanity gate. Define task-specific go/no-go rules before a pilot, not after seeing its result.
Choose and tune a defensible recipe
- Start with an established architecture and optimizer suited to the modality and task. Record why classical learning, transfer learning, adapters or full training fits the data, capacity, compute and serving constraints.
- If tuning is authorized, specify its hypothesis, search space, development metric and trial count first. Retune interacting settings when changing batch size or model scale; do not copy a learning rate without its recipe. Keep failed trials and repeat promising configurations when stochastic variability matters.
- Size hardware from model/optimizer/activation memory and representative length tails, not model parameter count alone. Distinguish physical micro-batch from effective batch. In ordinary synchronous data parallelism, effective batch is micro-batch × accumulation × data-parallel replicas; specialized runtimes may differ. Confirm the provider's interpretation and count actual examples/tokens.
- Prefer existing compatible throughput/memory evidence. If none exists, label the estimate uncertain; request a bounded runtime check only when justified/authorized. Gradient accumulation is a memory tradeoff, not a promised throughput improvement.
Freeze one executable training contract
Evidence basis: runtime and reproducibility.
- Pin data/split hashes, model and tokenizer revisions, objective/template, supervised token masks or decision targets, optimizer, effective batch, schedule, learning rates, adapter/full-training mode, precision, context length, epochs/steps and seeds. Record runtime/library versions and hardware. Seeds aid repeatability but do not guarantee bitwise agreement across runtimes or devices.
- Verify actual prepared token lengths, targets and truncation. A context setting alone does not prove useful supervision survived. Chat/tool tasks need the exact template and target-turn policy; native decisions need the matching head/options. For SFT, inspect decoded examples and actual loss masks, EOS/padding, packing boundaries and nonempty supervised tokens. Assistant-only loss needs a compatible template; do not assume a flag makes every template correct. Treat source text and remote model code as untrusted, not instructions to execute.
- Plan initial, periodic and final development checks appropriate to the task, plus a training-reference sample when useful. Freeze representative sample identities. Declare checkpoint selection, required-check failure behavior and any stopping rule. Disclose disabled checks.
- Monitor objective loss and the declared task metric together. Watch for class collapse, divergence, train/development gaps and missing coverage. Lower loss can coexist with worse task behavior. Do not change the metric or disable validation simply to make a run pass.
- Bind the requested final comparison before launch: unchanged base, trained candidate and any alternative, with identical held-out inputs and documented inference differences. Eligibility is not proof of provider identity or hardware fit.
Before dispatch, record pre-launch evidence. A template filled with assertions is not measured evidence.
Dispatch and observe
- Compare requested and effective settings before dispatch. Explicitly reuse the same prepared inputs and configuration so defaults cannot create a second setup. Give each deliberate operation a stable identity; an uncertain reply is a reason to inspect/reconcile, not generate a new launch key.
- Distinguish control-plane records from provider work. A setup row is not necessarily a GPU job, a heartbeat is not an optimizer step, and a collection failure is not proof the provider failed. Preserve provider call IDs and acknowledge uncertainty.
- Verify provider acknowledgement, actual stage and measured progress after launch. Initial evaluation may legitimately precede optimizer steps. Use bounded, supported recovery; do not blindly replay unknown submissions or cancel shared work based on duplicated dashboard labels.
- When validating a platform fix, verify the processes that execute the path use it. Passing tests in a checkout do not establish a reloaded worker. Scope restarts to authorized, idle components; preserve unrelated work and historical artifacts.
Verify the artifact and report the evidence
- Verify saved model/adapter/head/tokenizer identity and reload behavior on retained inputs. Check training-serving parity. Weight reload is not proof of optimizer resume or exact stochastic reproducibility. For resumable training, retain required optimizer, scheduler, scaler, RNG and progress state as supported; test that path before promising interruption recovery. Evaluate in the correct inference mode.
- Evaluate the selected artifact against frozen comparators. Inspect every arm's requested, scored, failed and missing counts. Provider errors are missing evidence, not zero quality. Paired metrics use shared valid examples; discuss coverage bias.
- Report raw and calibrated results separately, including per-class/slice regressions, uncertainty appropriate to the independent unit, and latency as a separate axis. Scores on the data used to fit calibration are in-sample; calibrated final-test scores are distinct. Performance timing and quality benchmarks are different experiments. Never invent unavailable metrics or confidence intervals.
- Hand off the exact ledger, effective configuration, checks and limitations. Distinguish preparation, optimization, artifact verification, final comparison and serving readiness. Process success does not establish model improvement or production safety. Activation, deletion of history and ongoing monitoring require their own scope.
Version History
- e146ecd Current 2026-10-18 15:42


