一键导入
preference-generator
Generate preference pairs (chosen/rejected) for DPO/KTO/ORPO/SimPO training
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Generate preference pairs (chosen/rejected) for DPO/KTO/ORPO/SimPO training
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Generate Datasheet, Model Card, and Data Statement from a dataset manifest
Deterministically rebuild a dataset from its manifest and verify fixity equivalence
Create a versioned training dataset with manifest, fixity, provenance, and archive snapshot
End-to-end training dataset pipeline — acquire sources through publication
Detect training-eval overlap against benchmark sets before dataset publication
Generate SFT training examples from raw sources using Self-Instruct / Evol-Instruct / SQuAD / STaR patterns
| name | preference-generator |
| description | Generate preference pairs (chosen/rejected) for DPO/KTO/ORPO/SimPO training |
| namespace | training-complete |
| category | synthesis |
| platforms | ["claude","copilot","cursor","factory","windsurf","warp","codex","opencode","openclaw","hermes"] |
| commandHint | {"argumentHint":"<candidate-glob> [--mode <llm-judge|rule-based|human>] [--count <n>] [--min-confidence <0-1>]"} |
Generate preference pairs — (chosen, rejected) tuples — from a pool of training example candidates. Output feeds DPO (REF-376), KTO (REF-391), ORPO (REF-392), and SimPO (REF-393) alignment stages. Preferences are stored as graph edges (ADR-022 D5) so the same pair set can be re-exported to any preference format without regeneration.
example-quality-assess(prompt, chosen, rejected) triples<candidate-glob> (required)Example IDs or a glob pointing to candidate examples (e.g., examples/raw/*, ex-550e*, domain=python/*).
--mode <llm-judge|rule-based|human> (optional)Preference elicitation strategy. Default: llm-judge.
--count <n> (optional)Target number of preference pairs to generate. Default: 100.
--min-confidence <0-1> (optional)Discard pairs rated below this confidence. Default: 0.7.
--target-format <dpo|kto|orpo|simpo> (optional)Export format. Default: dpo.
| Mode | Mechanism | When to Use |
|---|---|---|
| llm-judge | Rank model (Opus for ambiguous cases, Sonnet as default) reads both candidates, elicits preference + rationale. Follows RLAIF pattern (REF-396) and UltraFeedback rubric (REF-438). | Default. Scales to thousands of pairs; rationale is auditable. |
| rule-based | Deterministic heuristics: (1) shorter wins when both correct, (2) cites source wins, (3) reasoning-trace present wins over absent, (4) no-hallucination wins over hallucination, (5) HIGH quality-grade wins over LOW. | Fast, reproducible, no API spend. Use when rubric is stable. |
| human | Interactive via AskUserQuestion — presents two candidates side-by-side, user picks chosen and supplies optional rationale. | Gold-standard pairs for calibrating judges or fine-tuning validation sets. |
Preferences persist as graph edges, not flat files:
memory-fortemi) preferred; aiwg index fallback per #848.chosen→rejected edge and the inverse rejected→chosen edge with opposite metadata so either direction is queryable.Edge shape:
{
"type": "preference",
"chosen_id": "ex-abc",
"rejected_id": "ex-def",
"confidence": 0.84,
"rationale_note_id": "note-rat-001",
"task_context": "python-codegen-leetcode"
}
| Format | JSONL Record |
|---|---|
| DPO | {prompt, chosen, rejected} |
| KTO | {prompt, completion, label} where label is boolean (chosen=true, rejected=false) — emits two records per pair |
| ORPO | {prompt, chosen, rejected, odds_ratio_metadata} — DPO plus length/logit-ratio hints |
| SimPO | DPO-compatible (no reference-model alignment needed; SimPO reads same triples) |
IPO (REF-395) also consumes DPO-format triples; select --target-format dpo for IPO training.
memory-ingest consumer interface; load example records.--mode; for llm-judge, select ranker (Opus if any candidate has LOW or ambiguous grade, Sonnet otherwise).(chosen, rejected, confidence, rationale).preference edges in graph store (Fortemi primary, aiwg index fallback).confidence < --min-confidence.--target-format, write to .aiwg/training/preferences/<format>-<timestamp>.jsonl.memory-log-append with op preference-generate including mode, pair count, accepted/rejected counts, median confidence.When mode=llm-judge, the judge's rationale is captured as a separate analysis-type example note via the memory-query-capture pattern and linked from each edge via rationale_note_id. This preserves the "why" for auditing and for downstream IPO-style regularization (REF-395).
chosen candidates; LOW-graded enter as rejected candidates. This is the primary signal for rule-based mode.preference-generate event for provenance.aiwg index; both offline aborts with exit code, never silently drops edges.prompt or completion logged and skipped during export.# Default: llm-judge over all raw examples, 100 DPO pairs
preference-generator "examples/raw/*"
# Rule-based, 500 KTO-format pairs, strict confidence
preference-generator "domain=python/*" --mode rule-based --count 500 --target-format kto --min-confidence 0.85
# Human mode for a gold validation set
preference-generator "examples/gold/*" --mode human --count 50
memory-ingest — load candidate records by globmemory-log-append — emit preference-generate eventsmemory-query-capture — persist llm-judge rationale as analysis notes