# eric-mitchell/direct-preference-optimization

Reference implementation for DPO (Direct Preference Optimization)

Repository: https://github.com/eric-mitchell/direct-preference-optimization
Canonical: https://ross.abutalabs.com/products/direct-preference-optimization
Language: Python
License: Apache-2.0
License Family: permissive
Last push: 2024-08-11T00:24:06+00:00

## Health v2 (maintenance only)
Score: 29/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 35, longevity 83
- inputs: {"age_days": 1168, "days_push": 753, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2907, forks 235 (observed 2026-08-28T04:07:29.104416+00:00)

## What it is
A reference implementation of Direct Preference Optimization (DPO) for training language models from human preference data, built on HuggingFace models. It supports the two-stage pipeline of supervised fine-tuning followed by preference learning, including variants like conservative DPO and IPO.

## Use cases
- train a language model from human preference data
- run DPO fine-tuning on a HuggingFace causal LM
- align an LLM without training a separate reward model
- fine-tune Pythia or Llama on Anthropic-HH preference datasets
- compare DPO, conservative DPO, and IPO training losses
- run supervised fine-tuning before preference optimization

## When to choose
- you want the canonical reference implementation of the DPO paper
- you need to fine-tune any HuggingFace causal LM with preference data
- you want to experiment with DPO variants like cDPO and IPO
- you need multi-GPU FSDP training for preference optimization

## When to avoid
- you need a production training framework with broad ecosystem support like TRL
- you only want to run inference on an already-aligned model
- you need RLHF with an explicit reward model or PPO
- you are not working with language models

## Facets
- artifact type: library
- maturity: stable
- function: llm-training, machine-learning, deep-learning
- domain: large-language-models, machine-learning, reinforcement-learning
- platform: python
- tags: dpo, preference-optimization, rlhf, alignment, fine-tuning, huggingface, reference-implementation, gpu, linux

## Member repositories
- eric-mitchell/direct-preference-optimization (main) score 29

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:29.104416+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T07:34:23.431906+00:00, confidence not recorded.
  - readme: https://github.com/eric-mitchell/direct-preference-optimization (fetched 2026-08-28T04:07:29.104416+00:00, sha 684b4bed41bc)
- Data as of 2026-08-30T08:39:29.467469+00:00.
