Skip to content
← Models
ClosedAlibaba Group/10 trustVerified

BERT4Rec

BERT for recommendations — the bidirectional sequential model that learns user taste by filling in masked items.

Visit official page →

About

BERT4Rec took the BERT playbook and pointed it at shopping histories. Published at CIKM 2019 by an Alibaba team (Fei Sun et al.), it models a user's interaction sequence with deep bidirectional self-attention: every item fuses information from both its past and its future in the sequence. To keep the bidirectional model from trivially "seeing" its target, it trains with a Cloze objective — randomly masking items and predicting them from both sides — which also generates far more training samples than next-item prediction alone.

The paper argued, with experiments on four benchmark datasets, that the old left-to-right assumption in sequential models was needlessly restrictive: user behavior is not always rigidly ordered, and bidirectional context learns stronger representations. The authors released both TensorFlow and PyTorch code, and it became the canonical bidirectional baseline the way SASRec became the unidirectional one.

It is heavier than SASRec and, like all ID-based models, struggles with cold-start items — a limitation the later text-based models (UniSRec, RecFormer) were designed to fix.

Specs

Context window

Not applicable — interaction sequences (bidirectional, Cloze-masked)

Pricing

Free / open research code

Free quota

Fully open — no API

API access

No official API — train it yourself from author code (github.com/FeiSun/BERT4Rec, TensorFlow and PyTorch)

Weights

Closed — API only

Released

Not disclosed

Benchmarks

  • Paper-reported (CIKM 2019, arXiv 1904.06690): consistently outperformed state-of-the-art sequential models across four benchmark datasets on the standard next-item metrics
  • No independent benchmark body re-scores it; its standing rests on wide reproduction as a baseline in later sequential-recommendation work

Provider-reported unless a source says otherwise. Benchmarks are marketing-adjacent by nature — treat them as directional.

Use cases

sequential-recommendationsession-based-recommendationpersonalizationecommerce-recommendationrecsys-research

Trust score — 9/10

/10 trustVerified

Scored 9/10 (TIER verified, metrics-v1). Evidence: peer-reviewed CIKM 2019 paper (arXiv 1904.06690, ACM DOI 10.1145/3357384.3357895) from Alibaba with author-released TF and PyTorch code (github.com/FeiSun/BERT4Rec); reproduced extensively as the bidirectional baseline. Strengths: principled adaptation of BERT to recsys, open code in two frameworks, durable baseline status. Docked for: (1) author-reported numbers only; (2) superseded by time-aware and text-based successors on most leaderboards. License: open research code.

How the trust score is built

Full methodology →
Adoption · stars/downloads, log-scaled vs peers
9.0/10
Maintenance · recency, releases, issue load
6.0/10
Openness · license + docs
9.0/10
Manual review · sanity read + red-flag check
9.0/10
  • · CIKM 2019 paper (arXiv 1904.06690, ACM DOI 10.1145/3357384.3357895) from Alibaba (Fei Sun et al.); bidirectional self-attention with Cloze objective.
  • · Author code in two frameworks at github.com/FeiSun/BERT4Rec; reproduced extensively as the bidirectional baseline.
  • · Author-reported numbers only; superseded by time-aware and text-based successors on most leaderboards.

Sources