SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2604.12479 · 2026

Meet Dynamic Individual Preferences: Resolving Conflicting Human Value with Paired Fine-Tuning

Yongfeng Zhang, Shuhang Lin, Xi Zhu, Yining Zhao, Shanyong Wang

arXiv · PDF · Open in the Atlas

Code that ran

4 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 2 failures of our instrument; 4 no recorded run), measured 2026-11-23; 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/2604.12479.json · badge: /api/ran/2604.12479.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
nrimsky/CAA community
Papers with Code archive
3 ran · 4 no recorded run
SwimmingWang/Pair_fine_tuning community
Papers with Code archive
1 ran · 0 no recorded run
FunctionStatusWhere it lives
PairedSFTDataset Ran
ran on a synthesized input · constructed an object; no result was computed
SwimmingWang/Pair_fine_tuning/train/trainer.py
code served (permissive licence) · get_code("842fea0e6f17ad85")
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 an instance of its own class, PairedSFTDataset: the run constructed the object and did not call it, so no result was computed. 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 json
import tempfile
import os
from pathlib import Path

torch.manual_seed(0)

# Create a minimal tokenizer stand-in
class MinimalTokenizer:
    def __init__(self):
        self.eos_token = "</s>"
        self.pad_token = "<pad>"
        self.vocab_size = 100
    
    def __call__(self, text, truncation=False, max_length=512, padding=None, return_tensors=None, add_special_tokens=False):
        # Simple tokenization: split and convert to token ids
        tokens = text.split()[:max_length]
        input_ids = [hash(t) % self.vocab_size for t in tokens]
        
        if padding == 'max_length':
            pad_len = max_length - len(input_ids)
            input_ids = input_ids + [0] * pad_len
        
        attention_mask = [1 if i < len(tokens) else 0 for i in range(len(input_ids))]
        
        result = {'input_ids': input_ids, 'attention_mask': attention_mask}
        
        if return_tensors == 'pt':
            result['input_ids'] = torch.tensor([result['input_ids']], dtype=torch.long)
            result['attention_mask'] = torch.tensor([result['attention_mask']], dtype=torch.long)
        
        return result
    
    def apply_chat_template(self, messages, tokenize=False, add_generation_prompt=False):
        # Simple chat template formatter
        text = ""
        for msg in messages:
            role = msg['role']
            content = msg['content']
            text += f"<{role}>{content}</{role}>"
        
        if add_generation_prompt:
            text += "<assistant>"
        
        return text

# Create a temporary data file
tokenizer = MinimalTokenizer()

# Create sample data
sample_data = [
    {
        "instruction": "What is AI?",
        "extra_a": "Context A",
        "response_a": "AI is artificial intelligence.",
        "extra_b": "Context B",
        "response_b": "AI stands for artificial intelligence."
    },
    {
        "instruction": "Explain machine learning.",
        "extra_a": "Background A",
        "response_a": "ML is a subset of AI.",
        "extra_b": "Background B",
        "response_b": "Machine learning enables computers to learn from data."
    }
]

# Write to temporary file
with tempfile.NamedTemporaryFile(mode='w', suffix='.json', delete=False, encoding='utf-8') as f:
    json.dump(sample_data, f)
    temp_file = f.name

ARGS = {
    'data_path': temp_file,
    'tokenizer': tokenizer,
    'max_length': 64,
    'prompt_template': '### Human: {instruction}\n### Assistant: {response}',
    'use_chat_template': False,
    'add_eos_to_answer': True
}
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 PairedSFTDataset — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a PairedSFTDataset output the recorded ndim 1 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
eval_model Ran
ran, honoured the contract we drafted
nrimsky/CAA/finetune_llama.py
code served (permissive licence) · get_code("88c6a4e2feade29f")
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 as t
import torch.nn as nn

t.manual_seed(0)

# Build a minimal model that has a .eval() method and returns an object with .logits attribute
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        # Return an object with a .logits attribute
        logits = self.linear(x)
        class LogitsWrapper:
            def __init__(self, logits_tensor):
                self.logits = logits_tensor
        return LogitsWrapper(logits)

model = MinimalModel()

# Build a small dataloader
# Each item is (p_tokens, p_label, n_label)
# p_tokens: shape (batch_size, seq_len, token_dim) - but model expects (batch, features)
# Actually, looking at the code: model(p_tokens).logits[:, -1, :] suggests logits has shape (batch, seq_len, vocab_size)
# So p_tokens likely has shape (batch, seq_len) and model outputs (batch, seq_len, vocab_size)
# Let's make p_tokens shape (2, 5) for batch=2, seq_len=5
# Then linear layer should output vocab_size=3

class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.embedding = nn.Embedding(100, 4)
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        # x shape: (batch, seq_len)
        embedded = self.embedding(x)  # (batch, seq_len, 4)
        logits = self.linear(embedded)  # (batch, seq_len, 3)
        class LogitsWrapper:
            def __init__(self, logits_tensor):
                self.logits = logits_tensor
        return LogitsWrapper(logits)

model = MinimalModel()

# Create dataloader as list of tuples
# p_tokens: (batch=2, seq_len=5), values in range [0, 100)
# p_label: (batch=2,), values in range [0, 3)
# n_label: (batch=2,), values in range [0, 3)
dataloader = [
    (
        t.randint(0, 100, (2, 5)),
        t.randint(0, 3, (2,)),
        t.randint(0, 3, (2,))
    ),
    (
        t.randint(0, 100, (2, 5)),
        t.randint(0, 3, (2,)),
        t.randint(0, 3, (2,))
    )
]

device = 'cpu'
maximize_positive = True

ARGS = {
    'model': model,
    'dataloader': dataloader,
    'maximize_positive': maximize_positive,
    '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 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_ab_data_path Ran
ran; our contract draft was wrong, not the code
nrimsky/CAA/finetune_llama.py
code served (permissive licence) · get_code("f46b8a54dbbde9a9")
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 os
import tempfile
import json

# Create temporary directory structure for testing
temp_base = tempfile.mkdtemp()

# Create the directory structure that the function expects
generate_dir = os.path.join(temp_base, 'datasets', 'generate', 'test_behavior')
test_dir = os.path.join(temp_base, 'datasets', 'test', 'test_behavior')
os.makedirs(generate_dir, exist_ok=True)
os.makedirs(test_dir, exist_ok=True)

# Create dummy dataset files
generate_file = os.path.join(generate_dir, 'generate_dataset.json')
test_file = os.path.join(test_dir, 'test_dataset_ab.json')

with open(generate_file, 'w') as f:
    json.dump({'data': []}, f)

with open(test_file, 'w') as f:
    json.dump({'data': []}, f)

# Monkey-patch the BASE_DIR, GENERATE_DATA_PATH, and TEST_DATA_PATH in the module
import sys
module_code = """
import os

BASE_DIR = '{base_dir}'
GENERATE_DATA_PATH = os.path.join(BASE_DIR, 'datasets', 'generate')
TEST_DATA_PATH = os.path.join(BASE_DIR, 'datasets', 'test')

def get_ab_data_path(behavior: str, test: bool=False) -> str:
    if test:
        path = os.path.join(TEST_DATA_PATH, behavior, 'test_dataset_ab.json')
    else:
        path = os.path.join(GENERATE_DATA_PATH, behavior, 'generate_dataset.json')
    return path
""".format(base_dir=temp_base)

# Execute the function with the modified paths
exec(module_code, globals())

ARGS = {
    'behavior': 'test_behavior',
    'test': False
}
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
get_finetuned_model_path Ran
ran; our contract draft was wrong, not the code
nrimsky/CAA/finetune_llama.py
code served (permissive licence) · get_code("9030935aaaf5aba7")
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 os
import tempfile

# Create a temporary directory to serve as BASE_DIR
temp_dir = tempfile.mkdtemp()

# Create the finetuned_models subdirectory
finetuned_models_dir = os.path.join(temp_dir, 'finetuned_models')
os.makedirs(finetuned_models_dir, exist_ok=True)

# Monkey-patch BASE_DIR to point to our temp directory
# (In actual execution, this would be set by the module's __file__)
import sys
import types

# Create a mock module
mock_module = types.ModuleType('mock_get_finetuned_model_path')
mock_module.BASE_DIR = temp_dir
mock_module.FINETUNE_PATH = finetuned_models_dir

# Now define ARGS with valid parameters
ARGS = {
    'behavior': 'honesty',
    'pos_or_neg': 'pos',
    'layer': 'layer_5'
}
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
FinetuneDataset Not yet run
unverified (harvested, no recorded run)
nrimsky/CAA/finetune_llama.py
code served (permissive licence) · get_code("b2056a085732cd8a")
How it ran

no invocation recorded.

finetune Not yet run
unverified (harvested, no recorded run)
nrimsky/CAA/finetune_llama.py
code served (permissive licence) · get_code("283eacb9f62af715")
How it ran

no invocation recorded.

get_finetune_dataloader Not yet run
unverified (harvested, no recorded run)
nrimsky/CAA/finetune_llama.py
code served (permissive licence) · get_code("b63b5e89a2dd0ba1")
How it ran

no invocation recorded.

tokenize_llama_chat Not yet run
unverified (harvested, no recorded run)
nrimsky/CAA/finetune_llama.py
code served (permissive licence) · get_code("e8bc5aab47b48a47")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 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 7 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
eval_model
brick of this paper's assembly: helper
1 other paper
1 dated earlier
2312.06681 (2023-12)
Steering Llama 2 via Contrastive Activation Addition

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

Recent advances in large language models (LLMs) have significantly improved the alignment of models with general human preferences. However, a major challenge remains in adapting LLMs to individual preferences, which are not only diverse but also dynamic. In this paper, we introduce a novel framework, Preference-Paired Fine-Tuning (PFT), designed to align models with contradictory and evolving individual preferences. We present a new dataset, Value Conflict Dilemma (VCD), which includes scenarios that involve conflicting human preferences, facilitating the evaluation of our approach. Our experiments demonstrate that PFT outperforms single-preference training methods, achieving up to 96.67% accuracy in multi-choice classification tasks and the highest open-ended generation score of 8.69. PFT also shows significant improvements over DPO, SFT and some traditional training methods, especially when handling conflicting preferences. Additionally, with limited user history data, models can inferring preference vector rapidly, achieving a 44.76% improvement in user-specific preference alignment in comparison to single-preference models. You can find code at https://github.com/SwimmingWang/Pair_fine_tuning.

For agents

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

get_harvested_code_for_paper("2604.12479")
get_code_for_paper("2604.12479")
have("2604.12479")

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

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

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

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

Connect an agent — have() is free.