SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2402.05133 · 2024

Personalized Language Modeling from Personalized Human Feedback

arXiv · PDF · Open in the Atlas

Code that ran

8 of 9 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, 0 violated it and 0 have no contract verdict; 8 failures of our instrument; 1 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/2402.05133.json · badge: /api/ran/2402.05133.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
humainlab/personalized_rlhf canonical (classifier label)
classifier basis: census
8 ran · 1 no recorded run
FunctionStatusWhere it lives
build_tldr_dataset_dpo_synthetic Ran
ran; our contract draft was wrong, not the code
humainlab/personalized_rlhf/prlhf/utils.py
code served (permissive licence) · get_code("961fdf789fac9510")
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 Mock. 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 numpy as np
from unittest.mock import Mock, MagicMock
import tempfile
import os

# Create a temporary user preference file
temp_dir = tempfile.mkdtemp()
user_pref_file = os.path.join(temp_dir, 'users_preference.txt')
with open(user_pref_file, 'w') as f:
    f.write('worker1 0\n')
    f.write('worker2 1\n')
    f.write('worker3 0\n')

# Create a mock dataset object with the map method
mock_dataset = Mock()

def mock_map(preprocess_function, batched=True, num_proc=24, remove_columns=None):
    """Mock map function that processes data and returns a mock dataset"""
    # Create sample batch data
    sample_batch = {
        'info': [
            {'post': 'sample post 1', 'article': None, 'subreddit': 'test', 'title': 'Title 1'},
            {'post': 'sample post 2', 'article': None, 'subreddit': 'test', 'title': 'Title 2'}
        ],
        'summaries': [
            [
                {'text': 'short summary'},
                {'text': 'this is a longer summary'}
            ],
            [
                {'text': 'another short'},
                {'text': 'another longer summary here'}
            ]
        ],
        'choice': [0, 1],
        'worker': ['worker1', 'worker2']
    }
    
    # Call the preprocess function
    result = preprocess_function(sample_batch)
    
    # Return a mock dataset with the processed result
    result_dataset = Mock()
    return result_dataset

mock_dataset.map = mock_map

# Create selected_users mapping
selected_users = {
    'worker1': 1,
    'worker2': 2,
    'worker3': 0
}

# Define all arguments
ARGS = {
    'dataset': mock_dataset,
    'selected_users': selected_users,
    'sep': '||',
    'n_user_tokens': 1,
    'is_train': True,
    'user_preference_file': user_pref_file,
    'original_columns': ['info', 'summaries', 'choice', 'worker'],
    'num_proc': 24
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Mock — a Mock output has no array shape of its own; none is 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_reward_modeling_metrics Ran
ran; our contract draft was wrong, not the code
humainlab/personalized_rlhf/evaluate/alpaca_farm/reward_modeling_trainer.py
code served (permissive licence) · get_code("cca45bb9a111ab77")
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
from transformers.trainer_utils import EvalPrediction

torch.manual_seed(0)

# Create small tensors for predictions and labels
# predictions: shape (2,) - logits for 2 samples
# label_ids: a tuple/list where the last element contains labels of shape (2,)
predictions = torch.randn(2, 1).numpy()  # Shape (2, 1) - will be squeezed to (2,)
label_ids = (torch.tensor([[0], [1]]),)  # Tuple with one element containing labels

# Create EvalPrediction object
eval_prediction = EvalPrediction(
    predictions=predictions,
    label_ids=label_ids
)

ARGS = {
    "eval_prediction": eval_prediction
}
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 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
encode_selected_users Ran
ran; our contract draft was wrong, not the code
humainlab/personalized_rlhf/prlhf/utils.py
code served (permissive licence) · get_code("70d6b8109b3f3478")
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 numpy as np
import tempfile
import os

# Create a temporary file with sample user data
temp_dir = tempfile.gettempdir()
file_name = os.path.join(temp_dir, 'selected_users.txt')

with open(file_name, 'w') as f:
    f.write('user1\n')
    f.write('user2\n')
    f.write('user3\n')

ARGS = {
    'file_name': file_name
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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
flatten_dict Ran
ran; our contract draft was wrong, not the code
humainlab/personalized_rlhf/evaluate/alpaca_farm/common.py
code served (permissive licence) · get_code("f5ff77db7757bc92")
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)

# Construct a nested dictionary with various types of values
nested_dict = {
    'model': {
        'layer1': {
            'weights': torch.randn(2, 4),
            'bias': torch.randn(4)
        },
        'layer2': {
            'weights': torch.randn(3, 4)
        }
    },
    'config': {
        'learning_rate': 0.001,
        'batch_size': 32
    },
    'data': 42
}

# Define a postprocess function that processes values
def my_postprocess(v):
    if isinstance(v, torch.Tensor):
        return v.sum().item()
    return v

ARGS = {
    'nested': nested_dict,
    'sep': '.',
    'postprocess_fn': my_postprocess
}
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
format_output Ran
ran; our contract draft was wrong, not the code
humainlab/personalized_rlhf/evaluate/alpaca_farm/data_preprocessor.py
code served (permissive licence) · get_code("46af3eb303562401")
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

torch.manual_seed(0)

# The function format_output takes:
# - example: dict (must contain the key specified by output_key)
# - eos_token: Optional[str] (defaults to None)
# - output_key: str (defaults to 'output')

# Construct example dict with the output_key
example = {
    'output': 'Hello world',
    'other_field': 'some_value'
}

# eos_token is optional, test with a string value
eos_token = '</s>'

# output_key specifies which key in example dict to use
output_key = 'output'

ARGS = {
    'example': example,
    'eos_token': eos_token,
    'output_key': output_key
}
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
format_prompt Ran
ran; our contract draft was wrong, not the code
humainlab/personalized_rlhf/evaluate/alpaca_farm/data_preprocessor.py
code served (permissive licence) · get_code("a71a4bdc37586fe2")
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

# Define ARGS dict with all required parameters for format_prompt
ARGS = {
    'example': {
        'instruction': 'What is the capital of France?',
        'input': ''
    },
    'prompt_dict': {
        'prompt_noinputs': 'Instruction: {instruction}',
        'prompt_inputs': 'Instruction: {instruction}\nInput: {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
format_prompt_with_data_frame Ran
ran; our contract draft was wrong, not the code
humainlab/personalized_rlhf/evaluate/alpaca_farm/data_preprocessor.py
code served (permissive licence) · get_code("8b1ea4142642d361")
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. 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 pandas as pd
import torch

# Define a small postprocessor function
def small_postprocessor(df):
    return df

# Create a small DataFrame with required columns
df = pd.DataFrame({
    'instruction': ['Write a poem', 'Tell a joke', 'Explain AI'],
    'input': ['about cats', '', 'in simple terms']
})

# Create prompt_dict with format placeholders
prompt_dict = {
    'prompt_noinputs': 'Instruction: {instruction}',
    'prompt_inputs': 'Instruction: {instruction}\nInput: {input}'
}

ARGS = {
    'df': df,
    'prompt_dict': prompt_dict,
    'df_postprocessor': small_postprocessor,
    'return_dict': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is 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
let_model_save_mem_when_zero_grad Ran
ran; our contract draft was wrong, not the code
humainlab/personalized_rlhf/evaluate/alpaca_farm/common.py
code served (permissive licence) · get_code("9a1871dd5c967ac1")
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 SimpleModel. 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 torch import nn
import types

torch.manual_seed(0)

class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 3)
        self.linear2 = nn.Linear(3, 2)
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.linear2(x)
        return x

model = SimpleModel()

# Create some dummy data to trigger gradient computation
x = torch.randn(2, 4, requires_grad=False)
y = torch.randn(2, 2)

# Forward pass and compute gradients
output = model(x)
loss = ((output - y) ** 2).sum()
loss.backward()

# Verify that gradients exist before calling the function
for p in model.parameters():
    if p.grad is not None:
        p.grad = torch.randn_like(p.grad)

ARGS = {
    "model": model
}
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 SimpleModel — a SimpleModel output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a SimpleModel 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
load_openai_comparisons Not yet run
unverified (harvested, no recorded run)
humainlab/personalized_rlhf/prlhf/utils.py
code served (permissive licence) · get_code("625d1b68353ab5c4")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 6 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 0 the same month, 6 later) and 3 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
flatten_dict 4 other papers
2 dated earlier, 2 later
2309.09055 (2023-09)
Exploring the impact of low-rank adaptation on the performance, efficiency, and regularization of RLHF
2310.11564 (2023-10)
Personalized Soups: Personalized Large Language Model Alignment via Post-hoc Parameter Merging
2406.11280 (2024-06)
ISR-DPO: Aligning Large Multimodal Models for Videos by Iterative Self-Retrospective DPO
and 1 more not named here
compute_reward_modeling_metrics 3 other papers
2 dated earlier, 1 later
2309.09055 (2023-09)
Exploring the impact of low-rank adaptation on the performance, efficiency, and regularization of RLHF
2310.11564 (2023-10)
Personalized Soups: Personalized Large Language Model Alignment via Post-hoc Parameter Merging
2501.09620 (2025-01)
Beyond Reward Hacking: Causal Rewards for Large Language Model Alignment
format_output 3 other papers
2 dated earlier, 1 later
2309.09055 (2023-09)
Exploring the impact of low-rank adaptation on the performance, efficiency, and regularization of RLHF
2310.11564 (2023-10)
Personalized Soups: Personalized Large Language Model Alignment via Post-hoc Parameter Merging
2501.09620 (2025-01)
Beyond Reward Hacking: Causal Rewards for Large Language Model Alignment
format_prompt_with_data_frame 3 other papers
2 dated earlier, 1 later
2309.09055 (2023-09)
Exploring the impact of low-rank adaptation on the performance, efficiency, and regularization of RLHF
2310.11564 (2023-10)
Personalized Soups: Personalized Large Language Model Alignment via Post-hoc Parameter Merging
2501.09620 (2025-01)
Beyond Reward Hacking: Causal Rewards for Large Language Model Alignment
let_model_save_mem_when_zero_grad 3 other papers
2 dated earlier, 1 later
2309.09055 (2023-09)
Exploring the impact of low-rank adaptation on the performance, efficiency, and regularization of RLHF
2310.11564 (2023-10)
Personalized Soups: Personalized Large Language Model Alignment via Post-hoc Parameter Merging
2501.09620 (2025-01)
Beyond Reward Hacking: Causal Rewards for Large Language Model Alignment
format_prompt 2 other papers
1 dated earlier, 1 later
2310.11564 (2023-10)
Personalized Soups: Personalized Large Language Model Alignment via Post-hoc Parameter Merging
2501.09620 (2025-01)
Beyond Reward Hacking: Causal Rewards for Large 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-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

Personalized large language models (LLMs) are designed to tailor responses to individual user preferences. While Reinforcement Learning from Human Feedback (RLHF) is a commonly used framework for aligning LLMs with human preferences, vanilla RLHF assumes that all human preferences share the same distribution, preventing fine-tuned LLMs from generating personalized content when user preferences are diverse. In this work, we propose Personalized-RLHF (P-RLHF), an efficient framework that utilizes a lightweight user model to capture individual user preferences and jointly learns the user model and the personalized LLM from human feedback. P-RLHF exhibits the following three characteristics: (1) It enables an LLM to generate personalized content and scale efficiently with growing number of users. (2) It handles both explicit user preferences described as textual input and implicit user preferences encoded in the feedback data. (3) It eliminates the need for users to fully articulate their preferences, which are normally needed for prompting LLMs to generate personalized content yet are often impractical to obtain in real-world scenarios. Our experimental results show that personalized LLMs trained using P-RLHF generate responses that are more closely aligned with individual user preferences, outperforming vanilla, non-personalized RLHF and prompting-based personalization approaches across different tasks. We opensource our code at https://github.com/HumainLab/Personalized_RLHF.

For agents

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

get_harvested_code_for_paper("2402.05133")
get_code_for_paper("2402.05133")
have("2402.05133")

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

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

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

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

Connect an agent — have() is free.