SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1511.06939 · 2015

Session-based Recommendations with Recurrent Neural Networks

arXiv · PDF · Open in the Atlas

Code that ran

11 of 15 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 9 have no contract verdict; 1 failure of our instrument; 4 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/1511.06939.json · badge: /api/ran/1511.06939.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
maciejkula/spotlight community (classifier label)
classifier basis not recorded on the link
9 ran · 1 no recorded run
paxcema/KerasGRU4Rec reimplementation (classifier label)
classifier basis: classifier_2025
1 ran · 2 no recorded run
yoavnavon/GRU4REC-spotify reimplementation (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
hungpthanh/gru4rec-pytorch reimplementation (classifier label)
classifier basis: classifier_2025
0 ran · 1 no recorded run
FunctionStatusWhere it lives
augment Ran
ran; our contract draft was wrong, not the code
paxcema/KerasGRU4Rec/preprocess/extractDwellTime.py
pointer only (licence: NONE) · get_code("bbfdf27ff0771dd9")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, paxcema/KerasGRU4Rec when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

bpr_loss Ran
ran on a synthesized input
maciejkula/spotlight/spotlight/losses.py
code served (permissive licence) · get_code("1951fae7bf0d9f85")
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

torch.manual_seed(0)

# Create small tensors for positive and negative predictions
# Shape: (batch_size=2, num_items=4) for example
positive_predictions = torch.randn(2, 4)
negative_predictions = torch.randn(2, 4)

# Create an optional mask tensor with same shape
mask = torch.randint(0, 2, (2, 4)).float()

ARGS = {
    "positive_predictions": positive_predictions,
    "negative_predictions": negative_predictions,
    "mask": mask,
}
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
cpu Ran
ran on a synthesized input
maciejkula/spotlight/spotlight/torch_utils.py
code served (permissive licence) · get_code("3a4a700c8335a075")
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 2, dtype family float, shape (2, 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 torch

torch.manual_seed(0)

# The function takes a tensor and checks if it's on CUDA, then moves it to CPU if needed
# We need to provide a tensor argument

# Create a small CPU tensor
tensor = torch.randn(2, 4)

ARGS = {
    "tensor": tensor
}
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 2, dtype family float, shape (2, 4) — shape (2, 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
gpu Ran
ran on a synthesized input
maciejkula/spotlight/spotlight/torch_utils.py
code served (permissive licence) · get_code("017938b06bae3326")
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 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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

torch.manual_seed(0)

# The function takes a tensor and a gpu flag
# If gpu=True, it calls .cuda() on the tensor
# If gpu=False, it returns the tensor as-is
# We'll test with gpu=False to avoid CUDA errors

tensor = torch.randn(2, 4)

ARGS = {
    "tensor": tensor,
    "gpu": False
}
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 2, dtype family float, shape (2, 4) — shape (2, 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
hinge_loss Ran
ran on a synthesized input
maciejkula/spotlight/spotlight/losses.py
code served (permissive licence) · get_code("de44a70b725c8af5")
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

torch.manual_seed(0)

# Create small tensors for positive and negative predictions
# Both should have the same shape for element-wise operations
batch_size = 2
num_items = 4

positive_predictions = torch.randn(batch_size, num_items)
negative_predictions = torch.randn(batch_size, num_items)

# Create a binary mask tensor with the same shape
mask = torch.randint(0, 2, (batch_size, num_items))

ARGS = {
    "positive_predictions": positive_predictions,
    "negative_predictions": negative_predictions,
    "mask": mask,
}
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
item_is_in Ran
ran, violated the contract we drafted
yoavnavon/GRU4REC-spotify/preprocess.py
pointer only (licence: NONE) · get_code("4793120067f5b394")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, yoavnavon/GRU4REC-spotify when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

mrr_score Ran
ran on a synthesized input
maciejkula/spotlight/spotlight/evaluation.py
code served (permissive licence) · get_code("11cb70776f03d1bc")
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 1, dtype family float, shape (3,) 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 scipy.sparse as sp


class MockInteractions:
    """Mock Interactions class that wraps a sparse matrix."""
    def __init__(self, sparse_matrix):
        self._matrix = sparse_matrix
    
    def tocsr(self):
        """Return CSR format of the matrix."""
        return self._matrix.tocsr()


class MockRecommenderModel:
    """Mock recommender model with predict method."""
    def __init__(self, num_users, num_items):
        self.num_users = num_users
        self.num_items = num_items
    
    def predict(self, user_id):
        """Return mock predictions for a user."""
        # Return random predictions of shape (num_items,)
        np.random.seed(user_id)
        return np.random.randn(self.num_items)


# Set up test data
num_users = 3
num_items = 5

# Create test interactions as sparse matrix
# User 0: items [1, 3]
# User 1: items [2, 4]
# User 2: items [0, 1, 4]
test_data = np.array([1.0, 1.0, 1.0, 1.0, 1.0, 1.0])
test_row = np.array([0, 0, 1, 1, 2, 2])
test_col = np.array([1, 3, 2, 4, 0, 1])
test_matrix = sp.csr_matrix((test_data, (test_row, test_col)), shape=(num_users, num_items))
test_interactions = MockInteractions(test_matrix)

# Create train interactions as sparse matrix
# User 0: items [0]
# User 1: items [1]
# User 2: items [2]
train_data = np.array([1.0, 1.0, 1.0])
train_row = np.array([0, 1, 2])
train_col = np.array([0, 1, 2])
train_matrix = sp.csr_matrix((train_data, (train_row, train_col)), shape=(num_users, num_items))
train_interactions = MockInteractions(train_matrix)

# Create model
model = MockRecommenderModel(num_users, num_items)

ARGS = {
    "model": model,
    "test": test_interactions,
    "train": train_interactions,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (3,) — shape (3,) 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
pointwise_loss Ran
ran on a synthesized input
maciejkula/spotlight/spotlight/losses.py
code served (permissive licence) · get_code("09deb08fd3fd83ce")
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

torch.manual_seed(0)

# Create small tensors for positive and negative predictions
# Shape: (2, 4) - batch size 2, 4 predictions each
positive_predictions = torch.randn(2, 4)
negative_predictions = torch.randn(2, 4)

# Create a binary mask tensor with the same shape
# Shape: (2, 4) - same as predictions
mask = torch.randint(0, 2, (2, 4))

ARGS = {
    "positive_predictions": positive_predictions,
    "negative_predictions": negative_predictions,
    "mask": mask
}
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
sample_items Ran
ran on a synthesized input
maciejkula/spotlight/spotlight/sampling.py
code served (permissive licence) · get_code("ce350f99f574d036")
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 int, shape (4, 3) 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

# Set random seed for reproducibility
np.random.seed(42)

# Create a RandomState instance
random_state = np.random.RandomState(seed=42)

# Define arguments for sample_items function
ARGS = {
    "num_items": 100,
    "shape": (4, 3),
    "random_state": random_state
}
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 ndarray, ndim 2, dtype family int, shape (4, 3) — shape (4, 3) 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
sequence_mrr_score Ran
ran on a synthesized input
maciejkula/spotlight/spotlight/evaluation.py
code served (permissive licence) · get_code("db5a21db6d916e28")
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 1, dtype family float, shape (2,) 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 torch
import torch.nn as nn

torch.manual_seed(0)

# Create a minimal stand-in class for SequenceInteractions
class SequenceInteractions:
    def __init__(self, sequences):
        self.sequences = sequences

# Create a minimal recommender model that implements predict
class MinimalRecommenderModel(nn.Module):
    def __init__(self, num_items=10):
        super().__init__()
        self.num_items = num_items
        self.embedding = nn.Embedding(num_items, 4)
    
    def predict(self, sequence):
        """
        Takes a sequence and returns predictions (scores) for all items.
        Returns a numpy array of shape (num_items,) with scores for each item.
        """
        # For each item, return a negative score (will be negated in function)
        # Return shape (num_items,) to match what the function expects
        scores = np.random.randn(self.num_items).astype(np.float32)
        return scores

# Create test data with sequences
# sequences shape: (num_sequences, sequence_length)
# Each sequence has multiple items, last one is the target
num_sequences = 2
sequence_length = 5
num_items = 10

# Create sequences with valid item indices
sequences = np.random.randint(0, num_items, size=(num_sequences, sequence_length)).astype(np.int32)

test_interactions = SequenceInteractions(sequences=sequences)

# Create the model
model = MinimalRecommenderModel(num_items=num_items)

ARGS = {
    "model": model,
    "test": test_interactions,
    "exclude_preceding": False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (2,) — shape (2,) 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
sequence_precision_recall_score Ran
ran on a synthesized input
maciejkula/spotlight/spotlight/evaluation.py
code served (permissive licence) · get_code("fefa69dbc273e191")
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 numpy as np

class MockModel:
    """Minimal recommender model that implements predict method."""
    def predict(self, sequence):
        # Return negative scores for each item
        # sequence is a 1D array of item indices
        # We return scores for all possible items
        num_items = 10
        scores = np.random.randn(num_items).astype(np.float32)
        return scores

class MockSequenceInteractions:
    """Mock SequenceInteractions with sequences attribute."""
    def __init__(self, sequences):
        self.sequences = sequences

# Create test data
# sequences shape: (num_users, sequence_length)
# Each user has a sequence of item indices
num_users = 2
sequence_length = 15
k = 10

# Create sequences with item indices (items are in range 0-9)
sequences = np.array([
    [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4],
    [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5]
], dtype=np.int32)

# Create model and test interactions
model = MockModel()
test = MockSequenceInteractions(sequences)

ARGS = {
    "model": model,
    "test": test,
    "k": k,
    "exclude_preceding": False
}
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 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
compute_dwell_time Not yet run
unverified (harvested, no recorded run)
paxcema/KerasGRU4Rec/preprocess/extractDwellTime.py
pointer only (licence: NONE) · get_code("6d75a51574deff05")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, paxcema/KerasGRU4Rec when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

get_data Not yet run
unverified (harvested, no recorded run)
maciejkula/spotlight/spotlight/datasets/_transport.py
code served (permissive licence) · get_code("ddf26eef64dce756")
How it ran

no invocation recorded.

preprocess_df Not yet run
unverified (harvested, no recorded run)
paxcema/KerasGRU4Rec/preprocess/extractDwellTime.py
pointer only (licence: NONE) · get_code("600da17c8e8aa6c4")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, paxcema/KerasGRU4Rec when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

removeShortSessions Not yet run
unverified (harvested, no recorded run)
hungpthanh/gru4rec-pytorch/preprocessing.py
code served (permissive licence) · get_code("46ec454eb67dc4f9")
How it ran

no invocation recorded.

Also present in other papers' code

Of 15 samples lifted from this paper's linked repositories, 15 carry a function identity and 0 do not. Of the 15 distinct functions with an identity, 3 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 3 later) and 12 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
cpu 1 other paper
1 later
2010.03159 (2020-10)
Where Are the Facts? Searching for Fact-checked Information to Alleviate the Spread of Fake News
gpu 1 other paper
1 later
2010.03159 (2020-10)
Where Are the Facts? Searching for Fact-checked Information to Alleviate the Spread of Fake News
removeShortSessions 1 other paper
1 later
1706.03847 (2017-06)
Recurrent Neural Networks with Top-k Gains for Session-based Recommendations

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

We apply recurrent neural networks (RNN) on a new domain, namely recommender systems. Real-life recommender systems often face the problem of having to base recommendations only on short session-based data (e.g. a small sportsware website) instead of long user histories (as in the case of Netflix). In this situation the frequently praised matrix factorization approaches are not accurate. This problem is usually overcome in practice by resorting to item-to-item recommendations, i.e. recommending similar items. We argue that by modeling the whole session, more accurate recommendations can be provided. We therefore propose an RNN-based approach for session-based recommendations. Our approach also considers practical aspects of the task and introduces several modifications to classic RNNs such as a ranking loss function that make it more viable for this specific problem. Experimental results on two data-sets show marked improvements over widely used approaches.

For agents

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

get_harvested_code_for_paper("1511.06939")
get_code_for_paper("1511.06939")
have("1511.06939")

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

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

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

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

Connect an agent — have() is free.