SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.21662 · 2024

$f$-PO: Generalizing Preference Optimization with $f$-divergence Minimization

arXiv · PDF · Open in the Atlas

Code that ran

12 of 14 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; 2 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 9 failures of our instrument; 2 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.21662.json · badge: /api/ran/2410.21662.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
minkaixu/fpo canonical (classifier label)
classifier basis: census
12 ran · 2 no recorded run
FunctionStatusWhere it lives
calculate_flops Ran
ran, honoured the contract we drafted
minkaixu/fpo/src/utils/perf.py
code served (permissive licence) · get_code("069f56cb00324e10")
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 float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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

class HFConfig:
    def __init__(self, num_hidden_layers, hidden_size, vocab_size):
        self.num_hidden_layers = num_hidden_layers
        self.hidden_size = hidden_size
        self.vocab_size = vocab_size

ARGS = {
    'checkpoint_activations_factor': 1.0,
    'batch_size': 2,
    'seq_length': 8,
    'hf_config': HFConfig(
        num_hidden_layers=4,
        hidden_size=16,
        vocab_size=1000
    )
}
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 float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
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
dpo_loss Ran
ran; our contract draft was wrong, not the code
minkaixu/fpo/src/align_stage/loss.py
code served (permissive licence) · get_code("f87ec21e6cc554fb")
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 Tensor, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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
from torch.nn import LogSoftmax

torch.manual_seed(0)

# Construct tensors with distinct dimensions for probing
# bsz=2 (batch size), seq_len=5, vocab_size=4, prompt_len varies per sample

bsz = 2
seq_len = 5
vocab_size = 4
N = 2

# ref_logits: (bsz, seq_len, vocab_size)
ref_logits = torch.randn(bsz, seq_len, vocab_size)

# model_logits: same shape as ref_logits
model_logits = torch.randn(bsz, seq_len, vocab_size)

# attention_mask: (bsz, seq_len) - binary mask, 1 for valid positions, 0 for padded
attention_mask = torch.ones(bsz, seq_len)

# y_ids: (bsz, seq_len) - token indices for gathering
y_ids = torch.randint(0, vocab_size, (bsz, seq_len))

# prompt_lens: list of lists, each inner list has prompt length per sample
# Function accesses prompt_lens[i][0], so it's a list of lists/tuples
prompt_lens = [[2], [1]]

# energy_labels: (bsz,) - energy/reward labels for DPO loss
# Will be split into groups of N, so needs to be divisible by N or handled gracefully
energy_labels = torch.randn(bsz)

# Parameters for the loss function
N_param = 2
beta = 1.0
beta_model = 1.0
loss_type = 'dpo'

ARGS = {
    'ref_logits': ref_logits,
    'model_logits': model_logits,
    'attention_mask': attention_mask,
    'y_ids': y_ids,
    'prompt_lens': prompt_lens,
    'energy_labels': energy_labels,
    'N': N_param,
    'beta': beta,
    'beta_model': beta_model,
    'loss_type': loss_type
}
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 Tensor, ndim 0, dtype family float, shape () — shape () as a later run recorded it
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
exact_loss Ran
ran; our contract draft was wrong, not the code
minkaixu/fpo/src/align_stage/loss.py
code served (permissive licence) · get_code("ca139c7b291fafb7")
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 Tensor, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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
from torch.nn import CrossEntropyLoss, NLLLoss, LogSoftmax, Softmax, LogSigmoid

torch.manual_seed(0)

# Parameters based on function signature analysis:
# - ref_logits: tensor of shape (bsz, seq_len, vocab_size)
# - model_logits: tensor of shape (bsz, seq_len, vocab_size)
# - attention_mask: tensor of shape (bsz, seq_len)
# - y_ids: tensor of shape (bsz, seq_len)
# - prompt_lens: list/tensor of prompt lengths per batch
# - energy_labels: tensor of shape (bsz, 1) or similar
# - N: group size (default 2)
# - beta: float scaling factor
# - beta_model: float scaling factor
# - loss_type: string indicating loss type

bsz = 2
seq_len = 5
vocab_size = 4

# Create logit tensors
ref_logits = torch.randn(bsz, seq_len, vocab_size)
model_logits = torch.randn(bsz, seq_len, vocab_size)

# Create attention mask (1s where we have tokens, 0s elsewhere)
attention_mask = torch.ones(bsz, seq_len)

# Create token IDs
y_ids = torch.randint(0, vocab_size, (bsz, seq_len))

# Create prompt lengths - list of tuples or lists with at least one element
prompt_lens = [[1], [2]]

# Create energy labels - shape should be compatible with N grouping
energy_labels = torch.randn(bsz, 1)

ARGS = {
    'ref_logits': ref_logits,
    'model_logits': model_logits,
    'attention_mask': attention_mask,
    'y_ids': y_ids,
    'prompt_lens': prompt_lens,
    'energy_labels': energy_labels,
    'N': 2,
    'beta': 1.0,
    'beta_model': 1.0,
    'loss_type': 'exo-rw'
}
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 Tensor, ndim 0, dtype family float, shape () — shape () as a later run recorded it
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
fpo_loss Ran
ran on a synthesized input
minkaixu/fpo/src/align_stage/loss.py
code served (permissive licence) · get_code("7ffcd72b9da5e2d2")
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 Tensor, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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
from torch.nn import LogSoftmax

torch.manual_seed(0)

# Construct arguments
bsz = 2  # batch size
seq_len = 5  # sequence length
vocab_size = 4  # vocabulary size
N = 2  # group size

# ref_logits: [bsz, seq_len, vocab_size]
ref_logits = torch.randn(bsz, seq_len, vocab_size)

# model_logits: [bsz, seq_len, vocab_size]
model_logits = torch.randn(bsz, seq_len, vocab_size)

# attention_mask: [bsz, seq_len]
attention_mask = torch.ones(bsz, seq_len)

# y_ids: [bsz, seq_len] - token indices
y_ids = torch.randint(0, vocab_size, (bsz, seq_len))

# prompt_lens: list of tuples, one per batch element
# The function accesses prompt_lens[i][0] to mask the prompt
prompt_lens = [(1,), (2,)]

# energy_labels: [bsz, 1] - scalar rewards/energies for each batch element
energy_labels = torch.randn(bsz, 1)

ARGS = {
    'ref_logits': ref_logits,
    'model_logits': model_logits,
    'attention_mask': attention_mask,
    'y_ids': y_ids,
    'prompt_lens': prompt_lens,
    'energy_labels': energy_labels,
    'N': N,
    'beta': 1.0,
    'beta_model': 1.0,
    'loss_type': 'jspo-rw',
    'alpha': 0.5,
}
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 Tensor, ndim 0, dtype family float, shape () — shape () as a later run recorded it
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
get_data_path Ran
ran; our contract draft was wrong, not the code
minkaixu/fpo/src/align_stage/inference.py
code served (permissive licence) · get_code("af991fecf57a358d")
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

class Args:
    def __init__(self):
        self.data_name_path = "prefix:path/to/data"

ARGS = {
    "args": Args()
}
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
get_eval_ds_config Ran
ran; our contract draft was wrong, not the code
minkaixu/fpo/src/utils/ds_utils.py
code served (permissive licence) · get_code("792e87a1badc5642")
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

torch.manual_seed(0)

ARGS = {
    'offload': False,
    'dtype': 'fp16',
    'stage': 0
}
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 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
get_hf_configs Ran
ran, honoured the contract we drafted
minkaixu/fpo/src/utils/perf.py
code served (permissive licence) · get_code("df20c2f4083d17af")
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 tuple, ndim 1, dtype family int; 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 numpy as np

class MockHFConfig:
    """Mock HuggingFace config object with necessary attributes."""
    def __init__(self, num_layers, hidden_size, vocab_size):
        self.num_hidden_layers = num_layers
        self.hidden_size = hidden_size
        self.vocab_size = vocab_size

# Create a mock config with valid values
mock_config = MockHFConfig(
    num_layers=12,
    hidden_size=768,
    vocab_size=50257
)

ARGS = {
    'hf_config': mock_config
}
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 tuple, ndim 1, dtype family int — 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
load_hf_tokenizer Ran
ran; our contract draft was wrong, not the code
minkaixu/fpo/src/utils/utils.py
code served (permissive licence) · get_code("998ed94665ef9d83")
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 MockTokenizer. 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
from transformers import set_seed

# Set seed for reproducibility
torch.manual_seed(0)

# Create a minimal stand-in tokenizer class that mimics AutoTokenizer behavior
class MockTokenizer:
    def __init__(self):
        self.eos_token = "</s>"
        self.pad_token = None
        self.padding_side = "right"
        self.truncation_side = "right"
    
    @classmethod
    def from_pretrained(cls, model_name_or_path, use_fast=False):
        return cls()

# Patch AutoTokenizer.from_pretrained to use our mock
from transformers import AutoTokenizer
original_from_pretrained = AutoTokenizer.from_pretrained

def mock_from_pretrained(model_name_or_path, **kwargs):
    tokenizer = MockTokenizer()
    tokenizer.use_fast = kwargs.get('use_fast', False)
    return tokenizer

AutoTokenizer.from_pretrained = classmethod(lambda cls, *args, **kwargs: mock_from_pretrained(*args, **kwargs))

# Define arguments for load_hf_tokenizer
ARGS = {
    'model_name_or_path': 'gpt2',
    'fast_tokenizer': False,
    'add_special_tokens': None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MockTokenizer — a MockTokenizer output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MockTokenizer 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
only_optimize_lora_parameters Ran
ran; our contract draft was wrong, not the code
minkaixu/fpo/src/utils/module/lora.py
code served (permissive licence) · get_code("7d082cd1b7edc2aa")
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 SimpleLoRAModel. 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

torch.manual_seed(0)

class SimpleLoRAModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.lora_left_weight = nn.Parameter(torch.randn(4, 3))
        self.lora_right_weight = nn.Parameter(torch.randn(3, 2))
        self.regular_weight = nn.Parameter(torch.randn(2, 4))
        self.other_param = nn.Parameter(torch.randn(4))
    
    def forward(self, x):
        return x

model = SimpleLoRAModel()

ARGS = {
    "model": model,
    "force_optimize_params": ["other_param"]
}
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 SimpleLoRAModel — a SimpleLoRAModel output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a SimpleLoRAModel 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
read_json Ran
ran; our contract draft was wrong, not the code
minkaixu/fpo/src/api.py
code served (permissive licence) · get_code("f2912713a5377070")
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 json
import tempfile
import os

# Create a temporary directory and a test JSON file
temp_dir = tempfile.mkdtemp()
test_json_file = os.path.join(temp_dir, "test_data.json")

# Write sample JSON data to the file
sample_data = {
    "key1": "value1",
    "key2": [1, 2, 3],
    "key3": {"nested": "data"}
}

with open(test_json_file, 'w') as f:
    json.dump(sample_data, f)

# Define ARGS with the filename parameter
ARGS = {
    "filename": test_json_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — 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
read_text Ran
ran; our contract draft was wrong, not the code
minkaixu/fpo/src/api.py
code served (permissive licence) · get_code("c97333aaf3e9d25f")
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 tempfile
import os

# Create a temporary file with some text content
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt')
temp_file.write("Hello, this is a test file.\nIt contains multiple lines.\n")
temp_file.close()

# Define the arguments dictionary
ARGS = {
    'filename': temp_file.name
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — 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
to_device Ran
ran; our contract draft was wrong, not the code
minkaixu/fpo/src/utils/utils.py
code served (permissive licence) · get_code("387b9e6c4f21dd62")
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 torch.nn as nn

torch.manual_seed(0)

# Create a batch dictionary with various tensor types and non-tensor values
batch = {
    'input_ids': torch.randint(0, 100, (2, 4)),  # 2D tensor
    'attention_mask': torch.ones((2, 4), dtype=torch.long),  # 2D tensor
    'logits': torch.randn(2, 3),  # 2D tensor with different shape
    'label': torch.tensor([0, 1]),  # 1D tensor
    'metadata': 'some_string',  # Non-tensor value
    'count': 42,  # Non-tensor value
}

device = 'cpu'

ARGS = {
    'batch': batch,
    'device': device,
}
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 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
causal_lm_model_to_fp32_loss Not yet run
unverified (harvested, no recorded run)
minkaixu/fpo/src/utils/model/model_utils.py
code served (permissive licence) · get_code("c0e274d4f6e1c499")
How it ran

no invocation recorded.

get_tokenizer Not yet run
unverified (harvested, no recorded run)
minkaixu/fpo/src/utils/utils.py
code served (permissive licence) · get_code("018e3a683c8bc191")
How it ran

no invocation recorded.

Also present in other papers' code

Of 14 samples lifted from this paper's linked repositories, 14 carry a function identity and 0 do not. Of the 14 distinct functions with an identity, 8 are also present in other papers whose code we hold (8 with at least one paper dated earlier, 3 the same month, 0 later) and 6 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
calculate_flops 6 other papers
5 dated earlier, 1 the same month
2310.10505 (2023-10)
ReMax: A Simple, Effective, and Efficient Reinforcement Learning Method for Aligning Large Language Models
2402.05808 (2024-02)
Training Large Language Models for Reasoning through Reverse Curriculum Reinforcement Learning
2403.14112 (2024-03)
Benchmarking Chinese Commonsense Reasoning of LLMs: From Chinese-Specifics to Reasoning-Memorization Correlations
and 3 more not named here
get_hf_configs 6 other papers
5 dated earlier, 1 the same month
2310.10505 (2023-10)
ReMax: A Simple, Effective, and Efficient Reinforcement Learning Method for Aligning Large Language Models
2402.05808 (2024-02)
Training Large Language Models for Reasoning through Reverse Curriculum Reinforcement Learning
2403.14112 (2024-03)
Benchmarking Chinese Commonsense Reasoning of LLMs: From Chinese-Specifics to Reasoning-Memorization Correlations
and 3 more not named here
to_device 6 other papers
5 dated earlier, 1 same year, order not determinable
2310.20246 (2023-10)
Breaking Language Barriers in Multilingual Mathematical Reasoning: Insights and Observations
2024.naacl-long.326 (2024 (year only))
LSTDial: Enhancing Dialogue Generation via Long-and Short-Term Measurement Feedback
2402.05808 (2024-02)
Training Large Language Models for Reasoning through Reverse Curriculum Reinforcement Learning
and 3 more not named here
get_eval_ds_config 3 other papers
2 dated earlier, 1 the same month
2402.05808 (2024-02)
Training Large Language Models for Reasoning through Reverse Curriculum Reinforcement Learning
2405.16455 (2024-05)
On the Algorithmic Bias of Aligning Large Language Models with RLHF: Preference Collapse and Matching Regularization
2410.16843 (2024-10)
Trustworthy Alignment of Retrieval-Augmented Large Language Models via Reinforcement Learning
only_optimize_lora_parameters 2 other papers
2 dated earlier
2402.05808 (2024-02)
Training Large Language Models for Reasoning through Reverse Curriculum Reinforcement Learning
2405.16455 (2024-05)
On the Algorithmic Bias of Aligning Large Language Models with RLHF: Preference Collapse and Matching Regularization
dpo_loss 1 other paper
1 dated earlier
2402.00856 (2024-02)
Towards Efficient Exact Optimization of Language Model Alignment
exact_loss 1 other paper
1 dated earlier
2402.00856 (2024-02)
Towards Efficient Exact Optimization of Language Model Alignment
get_data_path 1 other paper
1 dated earlier
2402.00856 (2024-02)
Towards Efficient Exact Optimization of Language Model Alignment

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

Preference optimization has made significant progress recently, with numerous methods developed to align language models with human preferences. This paper introduces $f$-divergence Preference Optimization ($f$-PO), a novel framework that generalizes and extends existing approaches. $f$-PO minimizes $f$-divergences between the optimized policy and the optimal policy, encompassing a broad family of alignment methods using various divergences. Our approach unifies previous algorithms like DPO and EXO, while offering new variants through different choices of $f$-divergences. We provide theoretical analysis of $f$-PO's properties and conduct extensive experiments on state-of-the-art language models using benchmark datasets. Results demonstrate $f$-PO's effectiveness across various tasks, achieving superior performance compared to existing methods on popular benchmarks such as AlpacaEval 2, Arena-Hard, MT-Bench, and Open LLM Leaderboard v2. Additionally, we present ablation studies exploring the impact of different $f$-divergences, offering insights into the trade-offs between regularization and performance in offline preference optimization. Our work contributes both practical algorithms and theoretical understanding to the field of language model alignment. Code is available at https://github.com/MinkaiXu/fPO.

For agents

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

get_harvested_code_for_paper("2410.21662")
get_code_for_paper("2410.21662")
have("2410.21662")

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

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

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

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

Connect an agent — have() is free.