SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1904.06690 · 2019

BERT4Rec: Sequential Recommendation with Bidirectional Encoder Representations from Transformer

arXiv · PDF · Open in the Atlas

Code that ran

4 of 6 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 0 have no contract verdict; 3 failures of our instrument; 2 no recorded run), measured 2026-11-23; 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/1904.06690.json · badge: /api/ran/1904.06690.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
FeiSun/BERT4Rec canonical (classifier label)
classifier basis: census
3 ran · 2 no recorded run
jinweiluo/BERT4Rec_AC reimplementation (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
FunctionStatusWhere it lives
convert_by_vocab Ran
ran; our contract draft was wrong, not the code
FeiSun/BERT4Rec/vocab.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from huawei-noah/Pretrained-Language-Model, is pointer only (licence: NONE) · get_code("bf6088a6a68ef09c")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from huawei-noah/Pretrained-Language-Model, and GitHub detected no licence in that repository 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.

data_partition Ran
ran; our contract draft was wrong, not the code
FeiSun/BERT4Rec/util.py
code served (permissive licence) · get_code("c6bb4fb1768a7890")
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 tempfile
import os

# Create a temporary file with sample data in the format expected by data_partition
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt')

# Write sample user-item interaction data
# Format: user_id item_id (space-separated)
sample_data = """1 10
1 20
1 30
2 15
2 25
3 5
3 6
3 7
4 100
5 50
5 60
5 70
5 80
"""

temp_file.write(sample_data)
temp_file.close()

fname = temp_file.name

ARGS = {
    'fname': fname
}
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_activation Ran
ran; our contract draft was wrong, not the code
FeiSun/BERT4Rec/modeling.py
code served (permissive licence) · get_code("3daeda6c430de0b5")
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 function. 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 six
import tensorflow as tf

def gelu(input_tensor):
    """Gaussian Error Linear Unit.

    This is a smoother version of the RELU.
    Original paper: https://arxiv.org/abs/1606.08415

    Args:
        input_tensor: float Tensor to perform activation.

    Returns:
        `input_tensor` with the GELU activation applied.
    """
    cdf = 0.5 * (1.0 + tf.erf(input_tensor / tf.sqrt(2.0)))
    return input_tensor * cdf

def get_activation(activation_string):
    """Maps a string to a Python function, e.g., "relu" => `tf.nn.relu`.

    Args:
        activation_string: String name of the activation function.

    Returns:
        A Python function corresponding to the activation function. If
        `activation_string` is None, empty, or "linear", this will return None.
        If `activation_string` is not a string, it will return `activation_string`.

    Raises:
        ValueError: The `activation_string` does not correspond to a known
        activation.
    """
    if not isinstance(activation_string, six.string_types):
        return activation_string
    if not activation_string:
        return None
    act = activation_string.lower()
    if act == 'linear':
        return None
    elif act == 'relu':
        return tf.nn.relu
    elif act == 'gelu':
        return gelu
    elif act == 'tanh':
        return tf.tanh
    else:
        raise ValueError('Unsupported activation: %s' % act)


# Test with various activation strings
ARGS = {
    "activation_string": "relu"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
six, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
str2bool Ran
ran, violated the contract we drafted
jinweiluo/BERT4Rec_AC/ml1m.py
pointer only (licence: NONE) · get_code("7373b3408ee13c1c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, jinweiluo/BERT4Rec_AC 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.

gelu Not yet run
unverified (harvested, no recorded run)
FeiSun/BERT4Rec/modeling.py
code served (permissive licence) · get_code("50fd1894a0a439a6")
How it ran

no invocation recorded.

get_assignment_map_from_checkpoint Not yet run
unverified (harvested, no recorded run)
FeiSun/BERT4Rec/modeling.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from toggle1995/RIS-DMMI, is pointer only (licence: NONE) · get_code("50958618b65e514e")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from toggle1995/RIS-DMMI, and GitHub detected no licence in that repository 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.

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 6 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 6 later) and 0 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_activation 32 other papers
6 dated earlier, 26 later · 1 only as an assembly brick
1804.05392 (2018-04)
Higher-order Coreference Resolution with Coarse-to-fine Inference
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1901.04085 (2019-01)
Passage Re-ranking with BERT
and 29 more not named here
get_assignment_map_from_checkpoint 26 other papers
6 dated earlier, 20 later
1804.05392 (2018-04)
Higher-order Coreference Resolution with Coarse-to-fine Inference
1808.09781 (2018-08)
Self-Attentive Sequential Recommendation
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
and 23 more not named here
gelu 16 other papers
5 dated earlier, 11 later · 2 only as an assembly brick
1706.03762 (2017-06)
Attention Is All You Need
1804.05392 (2018-04)
Higher-order Coreference Resolution with Coarse-to-fine Inference
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
and 13 more not named here
convert_by_vocab 4 other papers
1 dated earlier, 3 later · 1 only as an assembly brick
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
2003.11235 (2020-03)
AutoFIS: Automatic Feature Interaction Selection in Factorization Models for Click-Through Rate Prediction
2004.11579 (2020-04)
Probabilistically Masked Language Model Capable of Autoregressive Generation in Arbitrary Word Order
and 1 more not named here
str2bool 3 other papers
3 later
2007.07542 (2020-07)
RobustScanner: Dynamically Enhancing Positional Clues for Robust Text Recognition
2104.10442 (2021-04)
Fourier Contour Embedding for Arbitrary-Shaped Text Detection
2608.05167 (2026-08)
CNM-BERT: A Drop-In Structural Embedding for Chinese Characters via Ideographic Description Sequences
data_partition 2 other papers
2 later
2003.11235 (2020-03)
AutoFIS: Automatic Feature Interaction Selection in Factorization Models for Click-Through Rate Prediction
2204.05125 (2022-04)
ESCM$^2$: Entire Space Counterfactual Multi-Task Model for Post-Click Conversion Rate Estimation

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

Modeling users' dynamic and evolving preferences from their historical behaviors is challenging and crucial for recommendation systems. Previous methods employ sequential neural networks (e.g., Recurrent Neural Network) to encode users' historical interactions from left to right into hidden representations for making recommendations. Although these methods achieve satisfactory results, they often assume a rigidly ordered sequence which is not always practical. We argue that such left-to-right unidirectional architectures restrict the power of the historical sequence representations. For this purpose, we introduce a Bidirectional Encoder Representations from Transformers for sequential Recommendation (BERT4Rec). However, jointly conditioning on both left and right context in deep bidirectional model would make the training become trivial since each item can indirectly "see the target item". To address this problem, we train the bidirectional model using the Cloze task, predicting the masked items in the sequence by jointly conditioning on their left and right context. Comparing with predicting the next item at each position in a sequence, the Cloze task can produce more samples to train a more powerful bidirectional model. Extensive experiments on four benchmark datasets show that our model outperforms various state-of-the-art sequential models consistently.

For agents

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

get_harvested_code_for_paper("1904.06690")
get_code_for_paper("1904.06690")
have("1904.06690")

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

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

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

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

Connect an agent — have() is free.