SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2405.14734 · NeurIPS · 2024

SimPO: Simple Preference Optimization with a Reference-Free Reward

Danqi Chen, Yu Meng, Mengzhou Xia

arXiv · PDF · Open in the Atlas

Code that ran

6 of 6 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; 4 failures of our instrument; 0 no recorded run), measured 2026-11-22; 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/2405.14734.json · badge: /api/ran/2405.14734.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
princeton-nlp/SimPO canonical (classifier label)
classifier basis not recorded on the link
5 ran · 0 no recorded run
openpsi-project/realhf community
Papers with Code archive
1 ran · 0 no recorded run
FunctionStatusWhere it lives
apply_chat_template Ran
ran; our contract draft was wrong, not the code
princeton-nlp/SimPO/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
dpo_loss Ran
ran; our contract draft was wrong, not the code
openpsi-project/realhf/realhf/impl/model/utils/dpo_functional.py
code served (permissive licence) · get_code("6b05e6f1ad3cb9b6")
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) and returned tuple, 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.

import torch
import torch.nn.functional as F

torch.manual_seed(0)

# The function expects:
# - pi_logps: 1D tensor with even number of elements (will be reshaped to [-1, 2])
# - ref_logps: 1D tensor with even number of elements (will be reshaped to [-1, 2])
# - beta: float value

# Create small tensors with batch size 2 (4 elements total, reshapes to 2x2)
pi_logps = torch.randn(4)
ref_logps = torch.randn(4)
beta = 0.5

ARGS = {
    "pi_logps": pi_logps,
    "ref_logps": ref_logps,
    "beta": beta,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple 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
extract_docstring Ran
ran; our contract draft was wrong, not the code
princeton-nlp/SimPO/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
princeton-nlp/SimPO/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
princeton-nlp/SimPO/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
princeton-nlp/SimPO/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 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 5 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 5 later) and 1 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
12 later
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
2407.09014 (2024-07)
COMPACT: Compressing Retrieved Documents Actively for Question Answering
and 9 more not named here
extract_docstring 10 other papers
10 later
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
2407.09014 (2024-07)
COMPACT: Compressing Retrieved Documents Actively for Question Answering
and 7 more not named here
normalize_whitespace 9 other papers
9 later
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
2407.09014 (2024-07)
COMPACT: Compressing Retrieved Documents Actively for Question Answering
and 6 more not named here
load_dataset_column 8 other papers
8 later
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
2407.09014 (2024-07)
COMPACT: Compressing Retrieved Documents Actively for Question Answering
and 5 more not named here
apply_chat_template 7 other papers
7 later
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
2409.03444 (2024-09)
Fine-tuning large language models for domain adaptation: Exploration of training strategies, scaling, model merging and synergistic capabilities
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-22.

Repositories linked to this paper

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

Abstract

Direct Preference Optimization (DPO) is a widely used offline preference optimization algorithm that reparameterizes reward functions in reinforcement learning from human feedback (RLHF) to enhance simplicity and training stability. In this work, we propose SimPO, a simpler yet more effective approach. The effectiveness of SimPO is attributed to a key design: using the average log probability of a sequence as the implicit reward. This reward formulation better aligns with model generation and eliminates the need for a reference model, making it more compute and memory efficient. Additionally, we introduce a target reward margin to the Bradley-Terry objective to encourage a larger margin between the winning and losing responses, further improving the algorithm's performance. We compare SimPO to DPO and its recent variants across various state-of-the-art training setups, including both base and instruction-tuned models such as Mistral, Llama 3, and Gemma 2. We evaluate on extensive chat-based evaluation benchmarks, including AlpacaEval 2, MT-Bench, and Arena-Hard. Our results demonstrate that SimPO consistently and significantly outperforms existing approaches without substantially increasing response length. Specifically, SimPO outperforms DPO by up to 6.4 points on AlpacaEval 2 and by up to 7.5 points on Arena-Hard. Our top-performing model, built on Gemma-2-9B-it, achieves a 72.4% length-controlled win rate on AlpacaEval 2, a 59.1% win rate on Arena-Hard, and ranks 1st on Chatbot Arena among <10B models with real user votes. 1 * Equal Contribution. 1 Code and models can be found at https://github.com/princeton-nlp/SimPO. 38th Conference on Neural Information Processing Systems (NeurIPS 2024).

For agents

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

get_harvested_code_for_paper("2405.14734")
get_code_for_paper("2405.14734")
have("2405.14734")

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

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

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

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

Connect an agent — have() is free.