← all repositories
pmixer/SASRec.pytorch

PyTorch port of a classic recommender fixes its embedding overfit habit

A lean PyTorch reimplementation of SASRec that tightens positional embeddings and recently absorbed a community LayerNorm upgrade for better ranking metrics.

615 stars TeX ML FrameworksDomain Apps
SASRec.pytorch
Collecting fresh signals — velocity needs a few days of history.
star history

What it does

SASRec.pytorch is a PyTorch 1.6+ reimplementation of the Self-Attentive Sequential Recommendation model from the 2018 ICDM paper. It takes the original author’s TensorFlow code and translates it into PyTorch, with a few deliberate corrections—most notably to positional embeddings that were making the original too eager to memorize. The result is a standard transformer-based sequential recommender that predicts your next click based on past behavior.

The interesting bit

The author treats overfitting as a feature, not just a bug: they note that in recommendation systems, “personalization = overfitting sometimes,” yet still tightened the positional embedding logic to curb it. A May 2025 community contribution also added a LayerNorm update that bumped NDCG and HR scores.

Key highlights

  • Direct PyTorch port of the official TensorFlow SASRec implementation
  • Fixes positional embedding usage to reduce overfitting compared to the original
  • Recent LayerNorm update (May 2025) from community contributors improved ranking metrics
  • Evaluation uses random negative sampling, so NDCG/HR numbers vary slightly across runs
  • Includes citation boilerplate; the author notes a dozen existing citations of the repo

Caveats

  • The README is sparse; it explicitly redirects readers to the original TensorFlow repo for detailed documentation
  • Output metrics fluctuate run-to-run because negative sampling is non-deterministic
  • Code lives in a python folder, suggesting the repo structure is minimal

Verdict

Worth a look if you need a working PyTorch baseline for sequential recommendation research, but skip it if you want a fully documented, production-ready framework—this is a lean academic port with a few thoughtful tweaks.

Frequently asked

What is pmixer/SASRec.pytorch?
A lean PyTorch reimplementation of SASRec that tightens positional embeddings and recently absorbed a community LayerNorm upgrade for better ranking metrics.
Is SASRec.pytorch open source?
Yes — pmixer/SASRec.pytorch is open source, released under the Apache-2.0 license.
What language is SASRec.pytorch written in?
pmixer/SASRec.pytorch is primarily written in TeX.
How popular is SASRec.pytorch?
pmixer/SASRec.pytorch has 615 stars on GitHub.
Where can I find SASRec.pytorch?
pmixer/SASRec.pytorch is on GitHub at https://github.com/pmixer/SASRec.pytorch.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.