Chuyển đến nội dung
Skillpedia
Agent41k · #6734

preference-optimization

Skill này làm gì

Công cụ này giúp cải thiện mô hình AI bằng dữ liệu sở thích. Nó tinh chỉnh mô hình để phù hợp hơn với sở thích của con người, dùng các phương pháp như DPO, ORPO, KTO hoặc SimPO.

Khi nào nên dùng

  • ✓Khi bạn có các cặp sở thích hoặc phản hồi thích/không thích.
  • ✓Khi bạn chọn giữa các phương pháp tối ưu theo sở thích khác nhau.
  • ✓Khi một lần chạy DPO cần điều chỉnh siêu tham số hoặc gỡ lỗi.

Liên kết skill

https://github.com/wshobson/agents/blob/main/plugins/llm-finetuning/skills/preference-optimization/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/wshobson/agents/blob/main/plugins/llm-finetuning/skills/preference-optimization/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Làm sao để tinh chỉnh mô hình của tôi ưu tiên câu trả lời ngắn gọn và hữu ích hơn bằng dữ liệu phản hồi?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ so sánh các phản hồi khác nhau và dùng phản hồi của bạn để huấn luyện mô hình chọn phương án tốt nhất. Nó chọn phương pháp phù hợp nhất với loại dữ liệu sở thích bạn có.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Preference Optimization

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.

Method Selection

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
  • DPO is the safe default. Use β=0.1 and a learning rate of 5e-7 to 1e-6 for 1–2 epochs. This LR is lower than the SFT LR that produced the checkpoint being aligned — porting an SFT- scale LR into a DPO run is the most common misconfiguration here, not an edge case.
  • ORPO routes in when memory is the constraint, or when there's no separate SFT checkpoint to start from — it's reference-free and fuses the SFT and preference objectives into one loss, skipping the separate SFT pass and the reference-model memory cost DPO carries.
  • KTO routes in when feedback is unpaired binary signal (thumbs-up/down) rather than matched preference pairs — don't force unpaired feedback into synthetic pairs to use DPO instead.
  • SimPO fixes DPO's length bias but only pays off with disciplined sweeping — its published gains are a ceiling reported under a tuned sweep, not a baseline any single config will reproduce. Route here only when there's sweep budget; use DPO instead if there isn't.
  • Classic RLHF (reward model + PPO) is retired outside frontier labs. Don't reach for it in a production pipeline — every method above is cheaper and better-supported for the same data shapes.

Worked Examples

  • "We have an SFT checkpoint and clean paired preference data, no length-bias complaints yet." → default case → DPO at β=0.1.
  • "Reviewers click thumbs-up/down per response; nothing is paired." → unpaired signal → KTO, not DPO — don't synthesize pairs to force DPO onto unpaired data.
  • "GPU budget doesn't cover a separate SFT pass plus a DPO reference model." → memory-bound, no separate checkpoint → ORPO.
  • "DPO output favors longer answers regardless of quality, and there's time to run a sweep." → length bias plus sweep budget → SimPO. Skip it if the sweep budget isn't actually there.

The Low-Leverage Truth

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:

  • Don't spend a routing decision agonizing over DPO-variant bake-offs. The table above is sufficient; deeper variant selection is low-leverage compared to data quality and scale.
  • Validate at deployment scale before trusting a ranking. A method comparison run on a small pilot model doesn't transfer to the production size class — re-check the winner once scale changes.

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.

Production Pattern: Iterative On-Policy DPO

A single offline DPO pass on a static preference dataset is a starting point, not the production

…

Câu hỏi thường gặp

Nên dùng phương pháp nào nếu tôi có phản hồi thích/không thích cho mỗi câu trả lời nhưng chúng không được ghép cặp?

Hãy dùng KTO. Phương pháp này được thiết kế cho phản hồi không ghép cặp, khi mỗi câu trả lời có một đánh giá riêng.

Tại sao DPO là phương pháp mặc định được khuyến nghị?

DPO là lựa chọn an toàn, hoạt động tốt trong hầu hết trường hợp với dữ liệu sở thích được ghép cặp. Nó dùng các thiết lập mặc định được khuyến nghị để bạn bắt đầu.

“Length bias” là gì và khi nào tôi nên lo ngại?

Length bias nghĩa là mô hình có thể ưa thích câu trả lời dài chỉ vì nó dài, chứ không phải vì nó tốt hơn. Nếu đây là vấn đề và bạn có nguồn lực để kiểm thử, SimPO có thể giúp.

Chi tiết

Mô tả gốc của tác giả

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.

repo: wshobson/agents

Độ phổ biến

Sao GitHub
41k
Vị trí xếp hạng
#6734
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự