SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.10148 · 2024

AlphaDPO: Adaptive Reward Margin for Direct Preference Optimization

arXiv · PDF · Open in the Atlas

Code that ran

5 of 5 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 1 violated it and 1 has no contract verdict; 3 failures of our instrument; 0 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2410.10148.json · badge: /api/ran/2410.10148.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
junkangwu/alpha-dpo canonical (classifier label)
classifier basis: census
5 ran · 0 no recorded run
FunctionStatusWhere it lives
apply_chat_template Ran
ran; our contract draft was wrong, not the code
junkangwu/alpha-dpo/alignment/data.py
code served (permissive licence) · get_code("9be97bcdb51fd634")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from unittest.mock import Mock

torch.manual_seed(0)

class MockTokenizer:
    def __init__(self):
        self.chat_template = "{% for message in messages %}{{ message['role'] }}: {{ message['content'] }}\n{% endfor %}"
        self.default_chat_template = "{% for message in messages %}{{ message['role'] }}: {{ message['content'] }}\n{% endfor %}"
    
    def apply_chat_template(self, messages, tokenize=False, add_generation_prompt=False):
        text = ""
        for msg in messages:
            text += f"{msg['role']}: {msg['content']}\n"
        if add_generation_prompt:
            text += "assistant: "
        return text

tokenizer = MockTokenizer()

example_sft = {
    'messages': [
        {'role': 'user', 'content': 'Hello'},
        {'role': 'assistant', 'content': 'Hi there'}
    ]
}

example_generation = {
    'messages': [
        {'role': 'user', 'content': 'What is 2+2?'},
        {'role': 'assistant', 'content': '4'}
    ]
}

example_rm = {
    'chosen': [
        {'role': 'user', 'content': 'Tell me a joke'},
        {'role': 'assistant', 'content': 'Why did the chicken cross the road?'}
    ],
    'rejected': [
        {'role': 'user', 'content': 'Tell me a joke'},
        {'role': 'assistant', 'content': 'I do not tell jokes'}
    ]
}

example_dpo = {
    'chosen': [
        {'role': 'user', 'content': 'What is AI?'},
        {'role': 'assistant', 'content': 'AI is artificial intelligence'}
    ],
    'rejected': [
        {'role': 'user', 'content': 'What is AI?'},
        {'role': 'assistant', 'content': 'AI is not real'}
    ]
}

ARGS = {
    'example': example_sft,
    'tokenizer': tokenizer,
    'task': 'sft',
    'auto_insert_empty_system_msg': True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
extract_docstring Ran
ran; our contract draft was wrong, not the code
junkangwu/alpha-dpo/alignment/decontaminate.py
code served (permissive licence) · get_code("0edeacd7a9034f53")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

# This function extracts docstrings from Python code prompts
# It looks for triple-quoted strings and returns the content between them

# Test case 1: docstring with """ delimiters (2 occurrences)
prompt_1 = '''def foo():
    """This is a docstring"""
    pass
'''

# Test case 2: docstring with """ delimiters (4 occurrences - nested or multiple)
prompt_2 = '''def bar():
    """First docstring"""
    x = """some string literal"""
    """Second docstring"""
    pass
'''

# Test case 3: docstring with ''' delimiters
prompt_3 = """def baz():
    '''This is another docstring'''
    pass
"""

# Use the first prompt as the main test case
ARGS = {
    "prompt": prompt_1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
is_openai_format Ran
ran, violated the contract we drafted
junkangwu/alpha-dpo/alignment/data.py
pointer only (licence: MIT); the stored copy get_code serves, from tengxiao1/cal-dpo, is pointer only (licence: NONE) · get_code("4253aac010c4504f")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from tengxiao1/cal-dpo, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

load_dataset_column Ran
ran on a synthesized input
junkangwu/alpha-dpo/alignment/decontaminate.py
code served (permissive licence) · get_code("a3791c5c2185e013")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from typing import Any, Dict, List
from unittest.mock import MagicMock, patch
import torch

# Create a mock dataset object that behaves like a HuggingFace dataset
class MockDataset:
    def __init__(self, data):
        self.data = data
    
    def __iter__(self):
        return iter(self.data)

# Create mock samples
mock_samples = [
    {"text": "  hello world  "},
    {"text": "  foo bar  "},
    {"text": "   "},  # This will be filtered out after strip
    {"text": "  valid text  "},
]

# Create the mock dataset
mock_dataset = MockDataset(mock_samples)

# Mock the load_dataset function
def mock_load_dataset(dataset, split=None, name=None):
    return mock_dataset

ARGS = {
    "dataset": "test_dataset",
    "column": "text",
    "split": "train",
    "name": None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
datasets, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
normalize_whitespace Ran
ran; our contract draft was wrong, not the code
junkangwu/alpha-dpo/alignment/decontaminate.py
code served (permissive licence) · get_code("f43e59d239019e86")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

text_input = "hello    world  \n  foo   bar"

ARGS = {
    "text": text_input
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 4 the same month, 5 later) and 0 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
is_openai_format 12 other papers
5 dated earlier, 1 the same month, 6 later
2405.14734 (2024-05)
SimPO: Simple Preference Optimization with a Reference-Free Reward
2406.08414 (2024-06)
Discovering Preference Optimization Algorithms with and for Large Language Models
2406.19371 (2024-06)
Suri: Multi-constraint Instruction Following for Long-form Text Generation
and 9 more not named here
extract_docstring 10 other papers
5 dated earlier, 2 the same month, 3 later
2405.14734 (2024-05)
SimPO: Simple Preference Optimization with a Reference-Free Reward
2406.08414 (2024-06)
Discovering Preference Optimization Algorithms with and for Large Language Models
2406.19371 (2024-06)
Suri: Multi-constraint Instruction Following for Long-form Text Generation
and 7 more not named here
normalize_whitespace 9 other papers
5 dated earlier, 1 the same month, 3 later
2405.14734 (2024-05)
SimPO: Simple Preference Optimization with a Reference-Free Reward
2406.08414 (2024-06)
Discovering Preference Optimization Algorithms with and for Large Language Models
2406.19371 (2024-06)
Suri: Multi-constraint Instruction Following for Long-form Text Generation
and 6 more not named here
load_dataset_column 8 other papers
5 dated earlier, 1 the same month, 2 later
2405.14734 (2024-05)
SimPO: Simple Preference Optimization with a Reference-Free Reward
2406.08414 (2024-06)
Discovering Preference Optimization Algorithms with and for Large Language Models
2406.19371 (2024-06)
Suri: Multi-constraint Instruction Following for Long-form Text Generation
and 5 more not named here
apply_chat_template 7 other papers
4 dated earlier, 3 later
2405.14734 (2024-05)
SimPO: Simple Preference Optimization with a Reference-Free Reward
2406.08414 (2024-06)
Discovering Preference Optimization Algorithms with and for Large Language Models
2407.09014 (2024-07)
COMPACT: Compressing Retrieved Documents Actively for Question Answering
and 4 more not named here

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Aligning large language models (LLMs) with human values and intentions is crucial for their utility, honesty, and safety. Reinforcement learning from human feedback (RLHF) is a popular approach to achieve this alignment, but it faces challenges in computational efficiency and training stability. Recent methods like Direct Preference Optimization (DPO) and Simple Preference Optimization (SimPO) have proposed offline alternatives to RLHF, simplifying the process by reparameterizing the reward function. However, DPO depends on a potentially suboptimal reference model, and SimPO's assumption of a fixed target reward margin may lead to suboptimal decisions in diverse data settings. In this work, we propose $α$-DPO, an adaptive preference optimization algorithm designed to address these limitations by introducing a dynamic reward margin. Specifically, $α$-DPO employs an adaptive preference distribution, balancing the policy model and the reference model to achieve personalized reward margins. We provide theoretical guarantees for $α$-DPO, demonstrating its effectiveness as a surrogate optimization objective and its ability to balance alignment and diversity through KL divergence control. Empirical evaluations on AlpacaEval 2 and Arena-Hard show that $α$-DPO consistently outperforms DPO and SimPO across various model settings, establishing it as a robust approach for fine-tuning LLMs. Our method achieves significant improvements in win rates, highlighting its potential as a powerful tool for LLM alignment. The code is available at https://github.com/junkangwu/alpha-DPO

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2410.10148")
get_code_for_paper("2410.10148")
have("2410.10148")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2410.10148.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2410.10148.svg)](https://syntology.ai/paper/2410.10148)

Connect an agent — have() is free.