All models

GRU4Rec

GRU recurrent network that predicts the next item in a browsing session from the clicks so far.

Tabular and recommender · 11 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (15 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
189.7K
Operations
11
Framework
PyTorch
Recurrent
No
Published
ICLR 2016
Cited by
1,604 (as of 19 October 2026)
Authors
Balázs Hidasi, Alexandros Karatzoglou, Linas Baltrunas, Domonkos Tikk
License
MIT
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m1165
Graph hash
3405716ec89815b8314fd726d7f6dc26b079922459e145ce30ec4d8b2f91fcc7
Skeleton hash
e44ed725693f1035ebe86ca2ab4c6d148b585cfd3eb85c3f828ff9a22e84067f
Architecture hash
db5d9b93708bf32b620ba9f635ce6191d39574df1fcccf0f555eb7512d84b11a
Diagram SHA-256
c2323bda9095e475542a1c193784b840fdefddeb3417f0a4a04187b9aa44a06f
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

GRU4Rec applies recurrent neural networks to a new domain, recommender systems, and specifically to session-based recommendation: predicting the next item a visitor will click from the clicks so far in the current session. The paper argues that in this setting the usual matrix factorization approaches are not accurate. Its claim is that modeling the whole session, rather than only the last click, gives more accurate recommendations.

The network uses Gated Recurrent Units. The output is a predicted preference for every item, read as its likelihood of being the next in the session. Session-parallel mini-batches run many sessions side by side. When a session ends, the next one takes its slot and the hidden state is reset. Scoring every item at every step would not scale, so only the desired item and sampled negatives are scored, using the items from the other examples of the mini-batch as the negatives. The pairwise BPR loss and a new TOP1 loss performed best.

The paper reports a 20 to 30 percent accuracy gain over the best baseline on its two datasets. The network on this page is RecBole's GRU4Rec, which cites the improved recurrent networks of Tan and colleagues rather than the original paper. It places an item embedding with dropout before the GRU and a dense layer after it. It directly outputs the embedding of the predicted item rather than scores over the catalog. The authors' original code is free for research and education, while commercial use requires a license.

Key idea. GRU4Rec applies a GRU recurrent network to session-based recommendation, adding session-parallel mini-batches, mini-batch output sampling and a ranking loss to fit the task.

  • gru4rec
  • session-based recommendation
  • recurrent neural network
  • gru
  • next item prediction
  • recbole gru4rec
  • click sequence
  • sequential recommendation
  • top1 loss

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{hidasi2016sessionbasedrecommendationsrecurrentneural,
      title={Session-based Recommendations with Recurrent Neural Networks}, 
      author={Balázs Hidasi and Alexandros Karatzoglou and Linas Baltrunas and Domonkos Tikk},
      year={2016},
      eprint={1511.06939},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/1511.06939}, 
}