SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2412.12865 · 2024

Preference-Oriented Supervised Fine-Tuning: Favoring Target Model Over Aligned Large Language Models

arXiv · PDF · Open in the Atlas

Code that ran

3 of 3 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 0 have no contract verdict; 2 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/2412.12865.json · badge: /api/ran/2412.12865.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
Savannah120/alignment-handbook-PoFT extension (classifier label)
classifier basis: classifier_2025
3 ran · 0 no recorded run
FunctionStatusWhere it lives
collate_fn Ran
ran; our contract draft was wrong, not the code
Savannah120/alignment-handbook-PoFT/generate_preference_scores.py
code served (permissive licence) · get_code("23bd8e38a433b4b5")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) 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 of examples with varying sequence lengths
# Each example is a dict with 'input_ids' and 'labels' as tensors
example1 = {
    'input_ids': torch.tensor([1, 2, 3]),
    'labels': torch.tensor([10, 20, 30])
}

example2 = {
    'input_ids': torch.tensor([4, 5, 6, 7, 8]),
    'labels': torch.tensor([40, 50, 60, 70, 80])
}

batch = [example1, example2]

ARGS = {'batch': batch}
Setup block drafted by
a language model, Claude Sonnet 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 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
compute_loss Ran
ran; our contract draft was wrong, not the code
Savannah120/alignment-handbook-PoFT/generate_preference_scores.py
code served (permissive licence) · get_code("d1e156f54d1adeec")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) 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.

import torch
import torch.nn as nn

torch.manual_seed(0)

# all_logits: shape (batch_size, seq_len, vocab_size)
# all_labels: shape (batch_size, seq_len)
# The function iterates over batch dimension (all_logits.size(0))
# For each sample j, it computes CE loss between logits[:-1] and labels[1:]
# logits[:-1] has shape (seq_len-1, vocab_size)
# labels[1:] has shape (seq_len-1,)

batch_size = 2
seq_len = 5
vocab_size = 7

all_logits = torch.randn(batch_size, seq_len, vocab_size)
all_labels = torch.randint(0, vocab_size, (batch_size, seq_len))

# start_token_list and end_token_list are optional (default None)
start_token_list = None
end_token_list = None

ARGS = {
    'all_logits': all_logits,
    'all_labels': all_labels,
    'start_token_list': start_token_list,
    'end_token_list': end_token_list
}
Setup block drafted by
a language model, Claude Sonnet 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 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
contain_none_logp Ran
ran, violated the contract we drafted
Savannah120/alignment-handbook-PoFT/merge_prefrence_scores.py
code served (permissive licence) · get_code("dfffa5fd77d4b492")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned bool, 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.

# The function checks if a dictionary row contains any key with 'logp' in it that has a None value
# It returns False if any 'logp' key has None value, True otherwise

# Test case 1: Dictionary with 'logp' keys that have non-None values
row_with_logp_values = {
    'logp_1': 0.5,
    'logp_2': -1.2,
    'other_key': 'value',
    'logp_score': 3.14
}

# Test case 2: Dictionary with a 'logp' key that has None value
row_with_none_logp = {
    'logp_1': 0.5,
    'logp_2': None,
    'other_key': 'value'
}

# Test case 3: Dictionary without any 'logp' keys
row_without_logp = {
    'key1': 'value1',
    'key2': 42,
    'key3': None
}

# Use the first test case as the default argument
ARGS = {
    'row': row_with_logp_values
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
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 bool, 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

Also present in other papers' code

Of 3 samples lifted from this paper's linked repositories, 3 carry a function identity and 0 do not. Of the 3 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 0 later) and 2 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
compute_loss 1 other paper
1 dated earlier
2310.16944 (2023-10)
Zephyr: Direct Distillation of LM 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

Alignment, endowing a pre-trained Large language model (LLM) with the ability to follow instructions, is crucial for its real-world applications. Conventional supervised fine-tuning (SFT) methods formalize it as causal language modeling typically with a cross-entropy objective, requiring a large amount of high-quality instruction-response pairs. However, the quality of widely used SFT datasets can not be guaranteed due to the high cost and intensive labor for the creation and maintenance in practice. To overcome the limitations associated with the quality of SFT datasets, we introduce a novel \textbf{p}reference-\textbf{o}riented supervised \textbf{f}ine-\textbf{t}uning approach, namely PoFT. The intuition is to boost SFT by imposing a particular preference: \textit{favoring the target model over aligned LLMs on the same SFT data.} This preference encourages the target model to predict a higher likelihood than that predicted by the aligned LLMs, incorporating assessment information on data quality (i.e., predicted likelihood by the aligned LLMs) into the training process. Extensive experiments are conducted, and the results validate the effectiveness of the proposed method. PoFT achieves stable and consistent improvements over the SFT baselines across different training datasets and base models. Moreover, we prove that PoFT can be integrated with existing SFT data filtering methods to achieve better performance, and further improved by following preference optimization procedures, such as DPO.

For agents

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

get_harvested_code_for_paper("2412.12865")
get_code_for_paper("2412.12865")
have("2412.12865")

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

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

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

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

Connect an agent — have() is free.