Write the task and data contract
Create a clean prompt-completion dataset with explicit licensing, provenance, splits, and acceptance tests.
Fine-tuning changes behavior by continuing training on examples, so the examples are the specification. Define one narrow task, such as rewriting technical error messages into concise user-facing explanations. Create 120 to 300 original prompt-completion pairs yourself; synthetic examples may be used only if you can inspect and license them. Store fields for prompt, completion, source, license, and split. Remove secrets, personal data, copied proprietary text, duplicates, and near-duplicates across splits. Hold out adversarial cases before training: empty inputs, ambiguous messages, long strings, and requests outside scope. TRL accepts standard or conversational language-modeling and prompt-completion formats, but format consistency matters because tokenization turns the text into the actual training sequence. Inspect ten rendered examples after the chat template is applied. Calculate input and output token-length distributions and set a truncation limit that preserves nearly all examples. Finally, write five behavioral acceptance tests in plain language. These tests should express what success means before optimization makes a score tempting.
Try it yourself
- Author a small, original dataset and record provenance plus license for every row.
- Deduplicate before splitting and reserve adversarial test cases.
- Render tokenized examples, inspect boundaries, and chart token lengths.
You’re ready to move on when…
- No duplicate or near-duplicate pair crosses splits.
- Every row has provenance and license metadata.
- Five acceptance tests exist before training and ten rendered examples are manually checked.