Before You Build
Block No Verify
Brand Landingpage
Business Analytics
Database Design
Documentation Generation
Documentation Standards
File Conversion
Framework Migration
Frontend Mobile Development
Game Development
Hermes Tweet
Hr Legal Compliance
Incident Response
Kubernetes Operations
Machine Learning Ops
NET Contribution
Observability Monitoring
Payment Processing
Plugin Eval
Protect MCP
Python Development · Python…
Quantitative Trading
Review Agent Governance
Ship Mate
Signed Audit Trails
Skill Forge Essentials
Social Publishing
Systems Programming
180 chapters · 328 min
LLM Finetuning
Chapter 106 of 180
Align a fine-tuned model with preference data using DPO, ORPO, KTO, or SimPO.
5 minutes · 1,053 words · 6 sections
This skill assumes finetuning-method-selection
already routed here because the data shape is
preference pairs or unpaired thumbs-up/down
feedback, not demonstrations (that’s
lora-qlora-recipes) or a verifiable reward
signal (that’s grpo-rlvr-training). What
follows is method selection among the DPO family,
the evidence for how much that selection actually
matters, the production training pattern, and how
to build the pairs in the first place.
Input: a routing decision (preference
optimization) plus preference pairs or unpaired
feedback, usually from an SFT checkpoint.
Output format: a validated method choice plus
a config — the kwarg values in
references/method-configs.md, not free-form
advice — that llm-finetuning-training-engineer
consumes directly.
| Data shape | Method | Key parameters |
|---|---|---|
| Preference pairs, default case | DPO | β=0.1, LR 5e-7–1e-6, 1–2 epochs |
| Memory-bound or no SFT checkpoint | ORPO | reference-free, fused SFT+preference in one loss |
| Unpaired thumbs-up/down | KTO | binary label per example, no pairing needed |
| Length bias observed, sweep budget available | SimPO | reference-free; see sweep grid below |
A 2026 240-H100-run study (arXiv 2603.19335) is the load-bearing evidence behind the table above: loss-function choice is worth roughly 1 percentage point of leverage, model scale is worth roughly 50. Zero of 20 DPO variants tested beat vanilla DPO. Rankings also invert with scale — a variant that wins in a small pilot can lose at deployment size.
Two practical consequences:
This is also why the Method Selection table above is deliberately short: it encodes the ~1pp lever, not a ranking of DPO variants that the same study shows doesn’t hold up across scale. Treat any variant-selection advice that isn’t in that table — including advice that claims a specific variant “wins” — as unproven until it’s been validated at the target deployment size.
A single offline DPO pass on a static preference dataset is a starting point, not the production pattern. The policy drifts away from the distribution the pairs were sampled from as training proceeds, and a static dataset goes stale against that drift. Production pipelines run DPO iteratively and on-policy instead:
Repeat. Each round’s reference model is the prior round’s output, not a fixed initial checkpoint — that’s what keeps the preference signal on-policy instead of scoring against an increasingly stale distribution.
A single-pass DPO run is still a reasonable first iteration — it just isn’t the whole pipeline. Plan for at least one more round once the first checkpoint exists, rather than treating pass one as the finished artifact.
Build DPO/ORPO pairs from same-task passing-vs-failing trajectories — two attempts at the same underlying task, not unrelated best-and-worst examples pulled from different tasks. Within that trajectory set, select the rejected member at μ−2σ of the reward distribution, never the minimum. Naive best-vs-worst pair construction (max reward vs. absolute minimum) degrades as scale increases; the μ−2σ selection is more robust to the same scale sensitivity the low-leverage study surfaced above.
sorted_by_reward = sort(trajectories, key=reward)
chosen = sorted_by_reward[-1] # highest reward
mu, sigma = mean(rewards), stdev(rewards)
rejected = closest(sorted_by_reward, mu - 2 * sigma)
# NOT sorted_by_reward[0] — the absolute minimum
# is the naive best-vs-worst construction that
# degrades as scale increases.For the mechanics of turning graded traces into
these pairs — including rejection sampling and
judge-scored delta selection — see
trace-to-training-data.
Complete TRL config blocks per method —
DPOConfig, ORPOConfig, KTOConfig, and the
SimPO sweep grid — plus Unsloth wrappers and a
catastrophic-forgetting note live in
references/method-configs.md. Those configs use
the same current-TRL API conventions established
in lora-qlora-recipes‘s
references/unsloth-trl-mapping.md
(processing_class, not tokenizer=).
references/method-configs.md also carries the
catastrophic-forgetting note: a too-high learning
rate is the usual cause when a preference-tuned
checkpoint loses general capability, and the fix
is almost always to drop the LR toward the low end
of the range in the Method Selection table above
before reaching for any other remediation.
Related skills: finetuning-method-selection
routes here once preference pairs or unpaired
feedback exist; lora-qlora-recipes produces the
SFT checkpoint DPO/KTO/SimPO align (ORPO’s
fused path can skip it); trace-to-training-data
converts passing/failing trajectories into the
pairs this skill’s Pair Construction section
consumes.
Install this repository
npx skills add wshobson/agents/plugin marketplace add wshobson/agentsSkills install per repository, not per chapter — the CLI has no documented per-skill form, so we do not print one.
Align a fine-tuned model with preference data using DPO, ORPO, KTO, or SimPO. Use when preference pairs or thumbs-up/down feedback exist, when choosing between preference-optimization methods, or when a DPO run needs hyperparameters or debugging.
The verbatim description from this skill’s front matter — the string an agent matches on to decide whether to load it.
main, last pushed 5 August 2026.SKILL.md, not by matching a directory convention. 49 distinct layouts observed: plugins/accessibility-compliance/skills/*/SKILL.md, plugins/agent-teams/skills/*/SKILL.md, plugins/api-scaffolding/skills/*/SKILL.md, plugins/backend-development/skills/*/SKILL.md, plugins/before-you-build/skills/*/SKILL.md, plugins/block-no-verify/skills/*/SKILL.md, plugins/blockchain-web3/skills/*/SKILL.md, plugins/brand-landingpage/skills/*/SKILL.md, plugins/business-analytics/skills/*/SKILL.md, plugins/cicd-automation/skills/*/SKILL.md, plugins/cloud-infrastructure/skills/*/SKILL.md, plugins/conductor/skills/*/SKILL.md, plugins/data-engineering/skills/*/SKILL.md, plugins/database-design/skills/*/SKILL.md, plugins/developer-essentials/skills/*/SKILL.md, plugins/dgx-spark-ops/skills/*/SKILL.md, plugins/documentation-generation/skills/*/SKILL.md.plugins/documentation-standards/skills/*/SKILL.mdplugins/dotnet-contribution/skills/*/SKILL.mdplugins/file-conversion/skills/*/SKILL.mdplugins/framework-migration/skills/*/SKILL.mdplugins/frontend-mobile-development/skills/*/SKILL.mdplugins/game-development/skills/*/SKILL.mdplugins/hermes-tweet/skills/*/SKILL.mdplugins/hr-legal-compliance/skills/*/SKILL.mdplugins/incident-response/skills/*/SKILL.mdplugins/javascript-typescript/skills/*/SKILL.mdplugins/kubernetes-operations/skills/*/SKILL.mdplugins/llm-application-dev/skills/*/SKILL.mdplugins/llm-finetuning/skills/*/SKILL.mdplugins/machine-learning-ops/skills/*/SKILL.mdplugins/observability-monitoring/skills/*/SKILL.mdplugins/payment-processing/skills/*/SKILL.mdplugins/plugin-eval/skills/*/SKILL.mdplugins/pptx-deck-creation/skills/*/SKILL.mdplugins/protect-mcp/skills/*/SKILL.mdplugins/python-development/skills/*/SKILL.mdplugins/quantitative-trading/skills/*/SKILL.mdplugins/reverse-engineering/skills/*/SKILL.mdplugins/review-agent-governance/skills/*/SKILL.mdplugins/security-scanning/skills/*/SKILL.mdplugins/shell-scripting/skills/*/SKILL.mdplugins/ship-mate/skills/*/SKILL.mdplugins/signed-audit-trails/skills/*/SKILL.mdplugins/skill-forge-essentials/skills/*/SKILL.mdplugins/social-publishing/skills/*/SKILL.mdplugins/startup-business-analyst/skills/*/SKILL.mdplugins/systems-programming/skills/*/SKILL.mdplugins/ui-design/skills/*/SKILL.mdh1 and no skipped levels:.claude-plugin/marketplace.json by Seth Hobson, declaring 95 plugins. It is read for editorial metadata only — never as the skill index, which is always the repository tree./wshobson/agents.md, and each chapter at its own .md URL.1 file · 6 KB
Everything this skill ships beside its prose. All of it is set here, as a subchapter of chapter 106.
Documentation the agent loads on demand, rather than up front.