SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2212.02779 · 2022

PrefRec: Recommender Systems with Human Preferences for Reinforcing Long-term User Engagement

arXiv · PDF · Open in the Atlas

Code that ran

4 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 4 have no contract verdict; 0 failures of our instrument; 5 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/2212.02779.json · badge: /api/ran/2212.02779.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
chongminggao/easyrl4rec community (classifier label)
classifier basis not recorded on the link
4 ran · 5 no recorded run
FunctionStatusWhere it lives
compute_exposure_effect Ran
ran on a synthesized input
chongminggao/easyrl4rec/src/core/envs/BaseData.py
code served (permissive licence) · get_code("47c8d841197bf979")
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 ndarray, ndim 2, dtype family float, shape (8, 1) 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 numpy as np
import pandas as pd
import os
import tempfile

class MockDataset:
    """Mock dataset that provides item similarity matrix"""
    def __init__(self, num_items=5):
        self.num_items = num_items
    
    def get_item_similarity(self):
        # Return a similarity matrix of shape (num_items, num_items)
        similarity = np.random.rand(self.num_items, self.num_items)
        # Make it symmetric
        similarity = (similarity + similarity.T) / 2
        # Ensure diagonal is 1 (similarity with self)
        np.fill_diagonal(similarity, 1.0)
        return similarity

# Create temporary directory for saving exposure scores
temp_dir = tempfile.mkdtemp()
model_save_path = os.path.join(temp_dir, 'model')
os.makedirs(model_save_path, exist_ok=True)

# Create mock dataset
dataset = MockDataset(num_items=5)

# Create a small positive interactions dataframe
num_records = 8
df_pos = pd.DataFrame({
    'user_id': [1, 1, 1, 2, 2, 2, 3, 3],
    'item_id': [0, 1, 2, 1, 3, 4, 0, 2],
})

# Create timestamp array - one for each row in df_pos
timestamp = np.array([100.0, 105.0, 110.0, 200.0, 205.0, 210.0, 300.0, 305.0])

# Create list of features (can be any list structure, just needs to exist)
list_feat = ['feat1', 'feat2', 'feat3']

# Parameters
tau = 1.0
window = 30

ARGS = {
    'dataset': dataset,
    'df_pos': df_pos,
    'timestamp': timestamp,
    'list_feat': list_feat,
    'tau': tau,
    'MODEL_SAVE_PATH': model_save_path,
    'DATAPATH': temp_dir,
    'window': window,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numba, numpy, pandas, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (8, 1) — shape (8, 1) 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_distance_mat Ran
ran on a synthesized input
chongminggao/easyrl4rec/src/core/envs/BaseData.py
code served (permissive licence) · get_code("79a03988c89913ac")
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 ndarray, ndim 2, dtype family float, shape (4, 4) 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 numpy as np
from numba import njit

# Set up small test data
# mat: a 2D array where rows are features and columns are items
# The function transposes it, so after transpose we have items as rows
mat = np.array([
    [1.0, 2.0, 3.0, 4.0],
    [5.0, 6.0, 7.0, 8.0]
], dtype=np.float64)

# distance: a square matrix to store pairwise distances
# Number of items is the second dimension of mat
n_items = mat.shape[1]
distance = np.zeros((n_items, n_items), dtype=np.float64)

ARGS = {
    "mat": mat,
    "distance": distance
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numba, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (4, 4) — shape (4, 4) 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
loaddata Ran
ran on a synthesized input
chongminggao/easyrl4rec/visual_results/results_utils.py
code served (permissive licence) · get_code("a9be072f14f5e318")
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 OrderedDict. 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 json
import tempfile
from collections import OrderedDict
import pandas as pd

# Create temporary directory with test log files
temp_dir = tempfile.mkdtemp()

# Create a sample log file with epoch and info data
log_content_1 = """Some header line
Epoch: [0] Info: [{'loss': 0.5, 'accuracy': 0.9}]
Epoch: [1] Info: [{'loss': 0.3, 'accuracy': 0.95}]
Epoch: [2] Info: [{'loss': 0.2, 'accuracy': 0.97}]
"""

log_content_2 = """Another log file
Epoch: [0] Info: [{'metric1': 1.2, 'metric2': 2.3}]
Epoch: [1] Info: [{'metric1': 1.1, 'metric2': 2.1}]
"message": "custom_message_here"
"""

log_content_3 = """Short log
Epoch: [0] Info: [{'value': 42.0}]
"""

# Write test files
with open(os.path.join(temp_dir, 'log_a.txt'), 'w') as f:
    f.write(log_content_1)

with open(os.path.join(temp_dir, 'log_b.txt'), 'w') as f:
    f.write(log_content_2)

with open(os.path.join(temp_dir, 'log_c.txt'), 'w') as f:
    f.write(log_content_3)

# Also create a file that should be skipped
with open(os.path.join(temp_dir, '.hidden.txt'), 'w') as f:
    f.write('This should be skipped')

# Get list of filenames
filenames = ['log_a.txt', 'log_b.txt', 'log_c.txt', '.hidden.txt']

ARGS = {
    'dirpath': temp_dir,
    'filenames': filenames,
    'use_filename': True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type OrderedDict — a OrderedDict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a OrderedDict 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
walk_paths Ran
ran on a synthesized input
chongminggao/easyrl4rec/visual_results/results_utils.py
code served (permissive licence) · get_code("5bec6bc8fc3f8282")
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.

import os
import tempfile
import shutil

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

# Create some test files and directories
os.makedirs(os.path.join(temp_dir, "subdir1"), exist_ok=True)
os.makedirs(os.path.join(temp_dir, "subdir2"), exist_ok=True)

# Create some regular files
with open(os.path.join(temp_dir, "file1.txt"), "w") as f:
    f.write("test")
with open(os.path.join(temp_dir, "file2.txt"), "w") as f:
    f.write("test")
with open(os.path.join(temp_dir, "subdir1", "file3.txt"), "w") as f:
    f.write("test")

# Create hidden/private files that should be skipped
with open(os.path.join(temp_dir, ".hidden_file"), "w") as f:
    f.write("test")
with open(os.path.join(temp_dir, "_private_file"), "w") as f:
    f.write("test")

ARGS = {
    "result_dir": temp_dir,
    "sort": True,
}
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 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
build_input_features Not yet run
unverified (harvested, no recorded run)
chongminggao/easyrl4rec/src/DeepCTR-Torch/deepctr_torch/inputs.py
code served (permissive licence) · get_code("2fb349ac030ba393")
How it ran

no invocation recorded.

combined_dnn_input Not yet run
unverified (harvested, no recorded run)
chongminggao/easyrl4rec/src/DeepCTR-Torch/deepctr_torch/inputs.py
code served (permissive licence) · get_code("2aea84481b6e2f65")
How it ran

no invocation recorded.

get_feature_names Not yet run
unverified (harvested, no recorded run)
chongminggao/easyrl4rec/src/DeepCTR-Torch/deepctr_torch/inputs.py
code served (permissive licence) · get_code("ba1c9d87dd13207a")
How it ran

no invocation recorded.

load_dfs Not yet run
unverified (harvested, no recorded run)
chongminggao/easyrl4rec/visual_results/results_utils.py
code served (permissive licence) · get_code("f307d3ef6b470b82")
How it ran

no invocation recorded.

test_taobao Not yet run
unverified (harvested, no recorded run)
chongminggao/easyrl4rec/src/core/evaluation/evaluator_static.py
code served (permissive licence) · get_code("4ccf05078d13f3e3")
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, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 1 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
get_feature_names 4 other papers
3 dated earlier, 1 later
1703.04247 (2017-03)
DeepFM: A Factorization-Machine based Neural Network for CTR Prediction
1905.06482 (2019-05)
Deep Session Interest Network for Click-Through Rate Prediction
2008.13535 (2020-08)
DCN V2: Improved Deep & Cross Network and Practical Lessons for Web-scale Learning to Rank Systems
and 1 more not named here
build_input_features 3 other papers
3 dated earlier
1703.04247 (2017-03)
DeepFM: A Factorization-Machine based Neural Network for CTR Prediction
1905.06482 (2019-05)
Deep Session Interest Network for Click-Through Rate Prediction
2008.13535 (2020-08)
DCN V2: Improved Deep & Cross Network and Practical Lessons for Web-scale Learning to Rank Systems
combined_dnn_input 2 other papers
2 dated earlier
1905.06482 (2019-05)
Deep Session Interest Network for Click-Through Rate Prediction
2008.13535 (2020-08)
DCN V2: Improved Deep & Cross Network and Practical Lessons for Web-scale Learning to Rank Systems

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

Current advances in recommender systems have been remarkably successful in optimizing immediate engagement. However, long-term user engagement, a more desirable performance metric, remains difficult to improve. Meanwhile, recent reinforcement learning (RL) algorithms have shown their effectiveness in a variety of long-term goal optimization tasks. For this reason, RL is widely considered as a promising framework for optimizing long-term user engagement in recommendation. Though promising, the application of RL heavily relies on well-designed rewards, but designing rewards related to long-term user engagement is quite difficult. To mitigate the problem, we propose a novel paradigm, recommender systems with human preferences (or Preference-based Recommender systems), which allows RL recommender systems to learn from preferences about users historical behaviors rather than explicitly defined rewards. Such preferences are easily accessible through techniques such as crowdsourcing, as they do not require any expert knowledge. With PrefRec, we can fully exploit the advantages of RL in optimizing long-term goals, while avoiding complex reward engineering. PrefRec uses the preferences to automatically train a reward function in an end-to-end manner. The reward function is then used to generate learning signals to train the recommendation policy. Furthermore, we design an effective optimization method for PrefRec, which uses an additional value function, expectile regression and reward model pre-training to improve the performance. We conduct experiments on a variety of long-term user engagement optimization tasks. The results show that PrefRec significantly outperforms previous state-of-the-art methods in all the tasks.

For agents

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

get_harvested_code_for_paper("2212.02779")
get_code_for_paper("2212.02779")
have("2212.02779")

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

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

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

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

Connect an agent — have() is free.