Repository navigation
Conversation
…target margin - Add 'simpo' loss_type and configurable simpo_gamma margin to DPOEngineConfig - Support SimPO reference-free loss with length-normalized logits in dpo_preference_loss - Integrate SimPO length-normalized implicit reward scoring and stats reporting into compute_dpo_loss - Update bilingual CLI reference documentation (en/zh) - Add comprehensive unit tests in tests/test_simpo_loss.py
There was a problem hiding this comment.
Could we skip reference-model initialization and log-prob computation for SimPO, and add a test without ref_logprobs? The loss is reference-free, but the training and evaluation paths still require the reference model.
There was a problem hiding this comment.
Fixed in 906c59b. For loss_type=simpo, DPOTrainer no longer creates, initializes, runs or destroys the ref engine (train and eval), and compute_dpo_loss doesn't need ref_logprobs. New tests cover the loss without ref_logprobs and the trainer train/eval paths with no ref model. 6e2b011 merges main and keeps the guard in the new eval cleanup.
|
This pull request has been automatically marked as stale because it has not had recent activity within the last 14 days. Please add a comment or push new commits to keep it active. Thank you for your contribution! |
SimPO does not use reference log-probabilities, so the DPO trainer no longer creates, initializes, or runs the ref engine for loss_type=simpo, and compute_dpo_loss no longer requires ref_logprobs for SimPO.
…ce-optimization # Conflicts: # areal/trainer/dpo_trainer.py
Description
Direct Preference Optimization (DPO) and its variants are core alignment techniques in post-training. Standard DPO requires loading a separate reference model alongside the policy model throughout training, substantially increasing GPU memory consumption and inference overhead. Furthermore, DPO without length normalization frequently suffers from length exploitation (favoring longer responses merely due to cumulative token log-probabilities).
SimPO (Simple Preference Optimization with a Reference-Free Objective, Meng et al., NeurIPS 2024, https://arxiv.org/abs/2405.14734) directly solves these issues:
$$\mathcal{L}{\text{SimPO}} = -\mathbb{E}{(x, y_w, y_l)} \left[ \log \sigma \left( \frac{\beta}{|y_w|} \log \pi_\theta(y_w \mid x) - \frac{\beta}{|y_l|} \log \pi_\theta(y_l \mid x) - \gamma \right) \right]$$
This PR introduces SimPO support into AReaL's preference learning engine:
"simpo"toloss_typeinDPOEngineConfig(["sigmoid", "ipo", "simpo"]).simpo_gamma: float = 0.5with non-negative validation (--dpo.actor.simpo_gammaand--dpo.ref.simpo_gamma).dpo_preference_lossinareal.utils.functionalwithloss_type="simpo"andsimpo_gammamargin.compute_dpo_lossinareal.trainer.dpo.dpo_engineto compute length-normalized policy log-probabilities and margin-adjusted logits.stats_tracker.docs/en/cli_reference.mdanddocs/zh/cli_reference.md).tests/test_simpo_loss.pycovering mathematical correctness, margin sensitivity, length normalization, autograd backward pass, and configuration validation.Related Issue
N/A
Type of Change
Checklist
pre-commit run --all-files)./docs/build_all.sh)main/review-prcommand/create-prAdditional Context
uv run pytest -q tests/test_simpo_loss.py(5/5 passed).uv run pytest -q tests/test_dpo.py(26/26 passed).