SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2505.16994 · NeurIPS · 2025

R 2 ec: Towards Large Recommender Models with Reasoning

Wenjie Li, Xin Zhang, Liqiang Nie, Wenjie Wang, Yongqi Li, Xinyu Lin, Runyang You

arXiv · PDF · Open in the Atlas

Code that ran

8 of 10 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 8 have no contract verdict; 0 failures of our instrument; 2 no recorded run), measured 2026-11-24; 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/2505.16994.json · badge: /api/ran/2505.16994.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
YRYangang/RRec canonical (classifier label)
classifier basis not recorded on the link
8 ran · 2 no recorded run
FunctionStatusWhere it lives
calculate_metrics Ran
ran on a synthesized input
YRYangang/RRec/trainers/utils.py
code served (permissive licence) · get_code("0bc8c7e05959c420")
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 3, 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

torch.manual_seed(0)

# Create logits tensor with shape (batch_size=2, num_items=4)
logits = torch.randn(2, 4, dtype=torch.float32)

# Create labels tensor with shape (batch_size=2,) or (batch_size=2, 1)
# Using shape (2, 1) to match one of the valid input formats
labels = torch.randint(0, 4, (2, 1), dtype=torch.int32)

# Cutoff value for top-k calculation
cutoff = 3

ARGS = {
    "logits": logits,
    "labels": labels,
    "cutoff": cutoff,
}
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 tuple, ndim 3, dtype family float — 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
format_timedelta Ran
ran on a synthesized input
YRYangang/RRec/prompters/rrec_prompter.py
code served (permissive licence) · get_code("55f0ea22ac586d34")
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.

from datetime import timedelta

# Create a timedelta object with specific days, hours, minutes, and seconds
delta = timedelta(days=2, hours=3, minutes=45, seconds=30)

ARGS = {
    'delta': delta
}
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
gao Ran
ran on a synthesized input
YRYangang/RRec/preprocess.py
code served (permissive licence) · get_code("4fa33edb27147e32")
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 numpy as np
from datetime import datetime, timedelta

# Create a small reviews DataFrame with the required columns
np.random.seed(0)
dates = pd.date_range(start='2020-01-01', end='2023-12-31', freq='D')
num_records = 500

reviews_data = {
    'user_id': np.random.randint(1, 50, num_records),
    'parent_asin': np.random.randint(1, 100, num_records),
    'time': np.random.choice(dates, num_records),
    'rating': np.random.randint(1, 6, num_records)
}
reviews = pd.DataFrame(reviews_data)
reviews = reviews.sort_values('time').reset_index(drop=True)

# Create minimal metadata (just a dict or small DataFrame)
metadata = {
    'product_1': 'Product One',
    'product_2': 'Product Two'
}

# Set parameters
K = 2
start_time = '2023-01-01'
end_time = '2023-12-31'

ARGS = {
    'metadata': metadata,
    'reviews': reviews,
    'K': K,
    'start_time': start_time,
    'end_time': end_time
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas — 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
get_item_info_str Ran
ran on a synthesized input
YRYangang/RRec/prompters/rrec_prompter.py
code served (permissive licence) · get_code("f3f3b1b89e4f7eca")
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 numpy as np

torch.manual_seed(0)

# Create a minimal item_dset that behaves like a list/indexable object
class ItemDataset:
    def __init__(self):
        self.items = [
            {
                'title': 'Test Item',
                'average_rating': 4.5,
                'rating_number': 100,
                'description': ['word1', 'word2', 'word3', 'word4', 'word5']
            }
        ]
    
    def __getitem__(self, idx):
        return self.items[idx]

item_dset = ItemDataset()

# Case 1: Sequence with 'title' key (simpler path)
sequence_with_title = {
    'title': 'Product Title',
    'average_rating': 4.2,
    'rating_number': 50,
    'description': ['great', 'product', 'quality', 'amazing']
}

# Case 2: Sequence with 'seq_labels' and 'item_title' (uses item_dset lookup)
sequence_with_labels = {
    'seq_labels': 1,
    'item_title': 'Test Item'
}

ARGS = {
    'sequence': sequence_with_title,
    'item_dset': item_dset,
    'just_title': False
}
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 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
item_info_to_df Ran
ran on a synthesized input
YRYangang/RRec/preprocess.py
code served (permissive licence) · get_code("770265a388d4b61e")
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 DataFrame. 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 pandas as pd
import warnings

# Define the arguments for item_info_to_df
metadata = [
    {
        'asin': 'B001',
        'parent_asin': 'PARENT001',
        'main_category': 'Electronics',
        'title': 'Product 1',
        'subtitle': 'Subtitle 1',
        'average_rating': 4.5,
        'rating_number': 100,
        'features': ['Feature A', 'Feature B'],
        'description': ['Description text 1', 'Description text 2'],
        'price': 29.99,
        'store': 'Store A',
        'categories': ['Category 1', 'Category 2'],
        'details': {'color': 'blue', 'size': 'large'},
        'videos': [],
        'author': 'Author Name',
        'bought_together': [],
        'images': []
    },
    {
        'asin': 'B002',
        'parent_asin': 'PARENT002',
        'main_category': 'Books',
        'title': 'Product 2',
        'subtitle': None,
        'average_rating': 3.8,
        'rating_number': 250,
        'features': ['Feature C'],
        'description': ['Description text 3'],
        'price': 15.99,
        'store': 'Store B',
        'categories': ['Category 3'],
        'details': {'pages': 300},
        'videos': [],
        'author': 'Another Author',
        'bought_together': [],
        'images': []
    }
]

new_items = ['PARENT001', 'PARENT002']

asin2id = {
    'PARENT001': 1,
    'PARENT002': 2
}

add_pad_item = True

ARGS = {
    'metadata': metadata,
    'new_items': new_items,
    'asin2id': asin2id,
    'add_pad_item': add_pad_item
}
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 DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 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_items Ran
ran on a synthesized input
YRYangang/RRec/preprocess.py
code served (permissive licence) · get_code("5e7e71e747850f1b")
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 2, 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 gzip
import json
import tempfile
import os

# Create a temporary gzip file with test data
temp_dir = tempfile.mkdtemp()
test_gz_path = os.path.join(temp_dir, "test_items.gz")

# Create sample item data
sample_items = [
    {
        "title": "Great Product Title",
        "price": "29.99",
        "parent_asin": "B001",
        "description": "This is a <b>great</b> product",
        "category": "Electronics"
    },
    {
        "title": "Another Good Item",
        "price": "15.50",
        "parent_asin": "B002",
        "description": "High quality &amp; durable",
        "features": "Long lasting &quot;product&quot;"
    },
    {
        "title": "Valid Item with Number",
        "price": "99.99",
        "parent_asin": "B003",
        "description": "Product with\nnewlines\tand\ttabs"
    }
]

# Write to gzip file
with gzip.open(test_gz_path, 'wt') as f:
    for item in sample_items:
        f.write(json.dumps(item) + '\n')

ARGS = {
    "path": test_gz_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, dtype family float — 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
obtain_prompts Ran
ran on a synthesized input
YRYangang/RRec/prompters/prompts.py
code served (permissive licence) · get_code("8ea180f9e40cb5fb")
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 numpy as np

user_prompt = 'Analyze in depth and finally recommend next {category_singular} I might purchase inside {{emb_token}} and {{emb_end_token}}.\nFor example, {{emb_token}}a product{{emb_end_token}}.\n\nBelow is my historical {category} purchases and ratings (out of 5):'

item_prompt = 'Summarize key attributes of the following {category_singular} inside {{emb_token}} and {{emb_end_token}}.'

cat_dict = {'Video_Games': ('video games', 'video game'), 'CDs_and_Vinyl': ('CDs and vinyl', 'CD or vinyl'), 'Musical_Instruments': ('musical instruments', 'musical instrument')}

def obtain_prompts(category):
    """Obtain prompts for a specific category."""
    assert category in cat_dict, f'Category {category} not found in the dictionary.'
    category, category_singular = cat_dict[category]
    return {'user_prompt': user_prompt.format(category=category, category_singular=category_singular), 'item_prompt': item_prompt.format(category_singular=category_singular)}

ARGS = {
    'category': 'Video_Games'
}
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 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
timestamp2str Ran
ran on a synthesized input
YRYangang/RRec/prompters/rrec_prompter.py
code served (permissive licence) · get_code("6de9d9e61296e1a1")
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.

from datetime import datetime
import time

def format_timedelta(delta):
    days = delta.days
    hours, remainder = divmod(delta.seconds, 3600)
    minutes, seconds = divmod(remainder, 60)
    minutes += seconds / 60
    if days > 0:
        hours += minutes / 60
        _str = f'{days}d {hours:.1f}h'
    elif hours > 0:
        _str = f'{hours}h {minutes:.1f}min'
    else:
        _str = f'{minutes:.1f}min'
    _str += ' ago'
    return _str

def timestamp2str(example):
    history_timestamp = example['history_timestamp']
    timestamp = example['timestamp']
    history_timestamp = [datetime.fromtimestamp(t / 1000) for t in history_timestamp]
    timestamp = datetime.fromtimestamp(timestamp / 1000)
    delta_times = [timestamp - t for t in history_timestamp]
    human_readable = [format_timedelta(delta) for delta in delta_times]
    return human_readable

# Create timestamps in milliseconds
current_time_ms = int(time.time() * 1000)
one_hour_ago_ms = current_time_ms - (3600 * 1000)
two_hours_ago_ms = current_time_ms - (7200 * 1000)
one_day_ago_ms = current_time_ms - (86400 * 1000)

example = {
    'timestamp': current_time_ms,
    'history_timestamp': [one_hour_ago_ms, two_hours_ago_ms, one_day_ago_ms]
}

ARGS = {
    'example': example
}
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
get_compute_metrics Not yet run
unverified (harvested, no recorded run)
YRYangang/RRec/trainers/utils.py
code served (permissive licence) · get_code("97229b1b0e10f86d")
How it ran

no invocation recorded.

get_tokenizer Not yet run
unverified (harvested, no recorded run)
YRYangang/RRec/trainers/utils.py
code served (permissive licence) · get_code("94b32126f25204d7")
How it ran

no invocation recorded.

Also present in other papers' code

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

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-24.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Large recommender models have extended LLMs as powerful recommenders via encoding or item generation, and recent breakthroughs in LLM reasoning synchronously motivate the exploration of reasoning in recommendation. In this work, we propose R 2 ec, a unified large recommender model with intrinsic reasoning capability. R 2 ec introduces a dual-head architecture that supports both reasoning chain generation and efficient item prediction in a single model, significantly reducing inference latency. To overcome the lack of annotated reasoning data, we design RecPO, a reinforcement learning framework that optimizes reasoning and recommendation jointly with a novel fused reward mechanism. Extensive experiments on three datasets demonstrate that R 2 ec outperforms traditional, LLMbased, and reasoning-augmented recommender baselines, while further analyses validate its competitive efficiency among conventional LLM-based recommender baselines and strong adaptability to diverse recommendation scenarios. Code and checkpoints available at https://github.com/YRYangang/RRec.

For agents

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

get_harvested_code_for_paper("2505.16994")
get_code_for_paper("2505.16994")
have("2505.16994")

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

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

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

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

Connect an agent — have() is free.