Skip to content
Back to skills

Dpo Preference Data Contract

ASecurity

Normalize pairwise preference records into prompt, chosen, rejected, and metadata fields for Direct Preference Optimization training.

  • 247 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 9, 2026
ai-agentspythonbash

Security analysis

A100/100

Scanned September 9, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill dpo_preference_data_contract --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Dpo Preference Data Contract?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Dpo Preference Data Contract
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-dpo-preference-data-contract/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-dpo-preference-data-contract)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
---
name: dpo_preference_data_contract
description: Normalize pairwise preference records into prompt, chosen, rejected, and metadata fields for Direct Preference Optimization training.
---

# DPO Preference Data Contract

Use this skill when preparing preference data for Direct Preference Optimization (DPO) or when validating a reduced DPO recovery experiment. Do not use it for unpaired reward-model data or ranking tasks that cannot identify a preferred and dispreferred response for the same prompt.

## Inputs

- Explicit records with `prompt`, `chosen`, and `rejected` strings.
- HH-style records with full conversation strings under `chosen` and `rejected`, sharing a prompt prefix ending in `\n\nAssistant:`.
- Optional metadata: `source`, `pair_id`, or split names.

## Outputs

A list of dictionaries with this contract:

```json
{"prompt": "...", "chosen": "...", "rejected": "...", "pair_id": "...", "source": "..."}
```

The output preserves chosen/rejected direction. It does not tokenize, score, or train a model.

## Workflow

1. Inspect each raw item and determine whether it is explicit or HH-style.
2. Validate non-empty prompt, chosen response, and rejected response.
3. For HH-style strings, split at the last `\n\nAssistant:` marker and require the chosen and rejected strings to share the same prompt prefix.
4. Reject identical chosen and rejected responses.
5. Emit normalized examples with stable pair ids and source metadata.

## Validation

Run:

```bash
python scripts/preference_data.py --self-test
python tests/test_preference_data.py
```

## Limitations

This skill only defines the data contract. It intentionally does not infer preferences from scores unless the caller has already converted scores into chosen/rejected pairs. It must not read the original DPO repository during recovery.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…