Back to blog
    DPO and Preference Data: Preparing Alignment Datasets On-Premise
    dpoalignmentdata-preparationon-premisepreference-datasegment:enterprise

    DPO and Preference Data: Preparing Alignment Datasets On-Premise

    DPO alignment requires chosen/rejected response pairs. For enterprises with sensitive data, this preparation must happen on-premise. Here's the complete workflow for building preference datasets without data egress.

    EErtas Team·

    Direct Preference Optimization (DPO) is the most practical alignment technique available for enterprise teams today. It steers model behavior — tone, accuracy, policy compliance, safety — without the infrastructure complexity of Reinforcement Learning from Human Feedback (RLHF). No reward model to train. No PPO training loop to stabilize. Just pairs of responses labeled "chosen" and "rejected," and a single fine-tuning pass.

    The problem for enterprises is the data. Preference datasets encode what the organization considers a "good" response versus a "bad" one. This includes compliance-sensitive decisions, proprietary reasoning patterns, and internal quality standards. Sending this data to a third-party service for preparation or augmentation leaks competitive intelligence and violates data governance policies.

    The entire DPO data preparation workflow must run on-premise. Here is how to do it, from raw inputs to export-ready JSONL.

    What DPO Is and Why It Matters for Enterprise Models

    Standard fine-tuning (SFT) teaches a model what to say. DPO teaches a model what to prefer. The distinction matters when you need a model that does not just produce correct answers, but produces answers in the right way — with the right tone, the right level of detail, the right caveats, and the right compliance guardrails.

    An SFT model trained on customer support transcripts will generate responses that look like customer support transcripts. But it might generate overly casual responses, or promise things the company cannot deliver, or skip required disclosures. DPO corrects these behaviors by showing the model paired examples: "this response is acceptable, this nearly identical response is not."

    The results are measurable. Teams that add a DPO alignment pass after SFT typically see a 15-25% improvement in human preference ratings and a 30-50% reduction in policy violations (responses that break internal guidelines). These numbers come from internal benchmarks, not synthetic evals.

    For regulated industries — finance, healthcare, legal — DPO is not optional. It is the mechanism that ensures the model follows sector-specific communication rules, disclosure requirements, and risk language standards.

    The Preference Dataset Format

    A DPO dataset is a collection of triplets:

    {
      "prompt": "A customer asks: 'Can I get a refund on my subscription?'",
      "chosen": "I can help with that. Our refund policy allows full refunds within 30 days of purchase. Could you share your order number so I can check your eligibility?",
      "rejected": "Sure, I'll process your refund right away! You should see the money back in your account within 24 hours."
    }
    

    The "chosen" response follows policy — it references the refund policy, asks for verification, and does not make promises. The "rejected" response skips verification and makes a time commitment the company may not meet.

    Both responses are plausible. Both are fluent. The difference is behavioral alignment — and that difference is what DPO learns.

    The format itself is simple. The difficulty is producing enough high-quality pairs where the distinction between chosen and rejected is meaningful and consistent.

    Where Preference Data Comes From in Enterprise

    You do not need to generate preference data from scratch. Most enterprises are sitting on rich sources of preference signal that have never been formatted for model training.

    Human Feedback Logs

    If your organization uses any AI-assisted tool — a chatbot, a document drafting assistant, a code completion tool — there are likely logs of user reactions. Thumbs up/down, regeneration requests, manual edits to AI outputs, and complaint tickets all encode preference data. A user who edits an AI-generated email is showing you the "rejected" (original) and "chosen" (edited) pair.

    A/B Test Results

    If you have run A/B tests comparing model outputs, prompt variants, or response formats, the winning variant is "chosen" and the losing variant is "rejected." A/B test data is particularly valuable because it comes with statistical significance — you know the preference is real, not noise.

    Quality-Reviewed Model Outputs

    Many enterprises have quality review processes where senior staff reviews and grades AI outputs. A medical institution reviewing AI-generated clinical summaries, a law firm reviewing AI-drafted contract clauses, a bank reviewing AI-generated risk assessments — all produce graded outputs that map directly to preference pairs.

    Expert Corrections

    When a domain expert corrects an AI output, you get a natural preference pair. The original output is "rejected" and the corrected version is "chosen." This is the highest-quality preference data available because the correction is targeted and the expert understands exactly why the original was wrong.

    Internal Style Guides and Compliance Rules

    Your organization's communication guidelines, compliance templates, and brand voice documents define what "good" looks like. Generate response pairs where one follows the guidelines and one violates a specific rule. These are systematic and can be produced at scale.

    The Preparation Pipeline

    Step 1: Collect Prompt-Response Pairs

    Aggregate raw data from the sources above. For each source, extract the prompt (the input or question) and at least two candidate responses. At this stage, do not worry about formatting — focus on completeness.

    Target: 1,000-2,000 raw prompt-response sets. After filtering and formatting, expect to retain 50-70% as usable DPO pairs.

    Step 2: Domain Experts Rank or Select Preferred Responses

    This is the step that requires human judgment and cannot be automated. Present each prompt with its candidate responses to domain experts and ask them to select the preferred response.

    Structure the task carefully:

    • Show the prompt and all candidate responses simultaneously
    • Ask the annotator to select the best response and the worst response (if more than two candidates exist)
    • Require a brief justification for the selection (one sentence)
    • Provide clear guidelines: "Select the response that best follows our internal policies, uses appropriate tone, and provides accurate information"

    A domain expert can evaluate 40-60 pairs per hour when the interface is well-designed. For 1,000 pairs, budget 20-25 hours of expert time — typically spread across 3-5 experts over two weeks.

    Step 3: Format as DPO Pairs

    Convert the ranked outputs into the standard DPO triplet format: prompt, chosen, rejected. If experts ranked more than two responses, create multiple pairs from the same prompt (the top-ranked response vs. each lower-ranked one).

    Validate formatting: ensure no empty fields, no truncated responses, and consistent encoding. Remove any examples where the chosen and rejected responses are nearly identical — the model cannot learn from pairs with negligible differences.

    Step 4: Quality Check with Inter-Annotator Agreement

    If multiple experts annotated the same examples, calculate inter-annotator agreement. For preference data, Cohen's kappa above 0.7 indicates strong agreement. Below 0.5, the guidelines are ambiguous and need revision.

    Disagreements are informative. If two experts disagree on which response is preferred, examine why. Common causes: ambiguous guidelines, edge cases not covered by policy, or genuine differences in expert opinion. Resolve disagreements through discussion, not majority vote — the goal is to clarify the standard, not to paper over inconsistencies.

    Step 5: Export

    Export the validated pairs as JSONL in the format your training framework expects. For most DPO implementations (TRL, Axolotl, LLaMA-Factory), the format is:

    {"prompt": "...", "chosen": "...", "rejected": "..."}
    

    Split into training (85%) and validation (15%) sets. The validation set is used to monitor DPO training loss — if validation loss diverges from training loss, you are overfitting to the preference data.

    Why This Must Be On-Premise

    Preference data is arguably more sensitive than the raw training data it is derived from. Here is why.

    The chosen/rejected pairs reveal what the organization considers "good" — its quality standards, compliance thresholds, risk tolerance, and communication norms. A competitor with access to your preference data knows exactly how your organization makes decisions and what it prioritizes.

    The rejected responses are particularly revealing. They show what the organization considers unacceptable — the failure modes, the compliance violations, the brand-damaging responses. This is a playbook for adversarial attacks against the organization's AI systems.

    In regulated industries, preference data often encodes compliance decisions. A financial institution's preference data shows how it interprets regulatory guidance — which responses pass compliance review and which do not. This is proprietary regulatory interpretation that competitors spend millions developing.

    No cloud service, however strong its security guarantees, should have access to this data. The preparation pipeline runs on local infrastructure, with local LLMs for augmentation, and exports to local storage.

    Using Local LLMs for Candidate Response Generation

    Domain experts should not write responses from scratch. Instead, use a local LLM to generate 3-5 candidate responses per prompt, then have experts select the best and worst.

    Run Ollama with a capable instruction-following model. For each prompt, generate responses with varying temperatures (0.3, 0.7, 1.0) to get a range from conservative to creative. Also generate responses with different system prompts — one that emphasizes brevity, one that emphasizes thoroughness, one that is deliberately flawed (for rejected examples).

    This approach produces 3,000-5,000 candidate responses from 1,000 prompts. Expert review time drops from "write responses" to "select and compare," cutting the effort roughly in half.

    Scale Requirements

    DPO is efficient relative to RLHF, but it still requires a meaningful volume of preference pairs.

    Minimum viable: 500 pairs. Enough to see directional improvement on a specific behavior (e.g., reducing overly casual tone). Not enough for comprehensive alignment.

    Recommended: 2,000-3,000 pairs. Covers the main behavioral dimensions — tone, accuracy, compliance, disclosure, and safety. This is the sweet spot for most enterprise deployments.

    Comprehensive: 5,000+ pairs. Required when the model serves multiple user groups with different requirements (e.g., a model that serves both customer support and internal analyst workflows).

    Below 500 pairs, the DPO training signal is too weak to produce consistent behavioral changes. Above 5,000, you need to verify that the pairs are not contradictory — conflicting preference signals degrade the model.

    Common Mistakes

    Obvious pairs: If the chosen response is clearly better by every metric, the model learns nothing useful. The most effective pairs are ones where both responses are reasonable but one is preferred for a specific reason. Subtle distinctions produce the strongest alignment signal.

    Inconsistent standards: If Expert A prefers concise responses and Expert B prefers detailed ones, the resulting dataset contains contradictory signals. Align on guidelines before annotation begins, not after.

    Ignoring distribution: If 80% of your pairs address tone and 5% address accuracy, the model will align strongly on tone but weakly on accuracy. Balance the pairs across the behavioral dimensions you care about.

    Stale data: Policies change, regulations update, brand voice evolves. A preference dataset from 12 months ago may encode outdated standards. Plan for quarterly refreshes.

    DPO alignment is a data quality problem, not a data quantity problem. A thousand carefully crafted preference pairs will outperform ten thousand sloppy ones. Invest the time in expert review, and the alignment results will follow.

    Your data is the bottleneck — not your models.

    Ertas Data Suite turns unstructured enterprise files into AI-ready datasets — on-premise, air-gapped, with full audit trail. One platform replaces 3–7 tools.

    Further Reading

    Turn unstructured data into AI-ready datasets — without it leaving the building.

    On-premise data preparation with full audit trail. No data egress. No fragmented toolchains. EU AI Act Article 30 compliance built in.

    Keep reading