BasketFormer: Contrastive Masked Language Modeling with Temporal Encoding and Repeat-Explore Gating for Next-Basket Recommendation

Next-basket recommendation (NBR) in online grocery is a challenging task due to the dual nature of shopping behavior: customers repeat staple items while also exploring novel products. Existing approaches either treat baskets as flat item sets, losing inter-basket temporal structure, or employ sequential models that lack explicit repeat-explore decomposition. We propose BasketFormer, a Transformer-encoder architecture that unifies three complementary innovations: (1) an InfoNCE-based contrastive loss that replaces the full-vocabulary softmax with in-batch contrastive scoring, yielding stronger item representations; (2) a bucketed inter-basket gap encoding that captures purchase cadence through compact learnable embeddings without increasing sequence length; and (3) a repeat-explore gate supervised by the soft repeat ratio that learns to decompose the next-basket representation into repeat and general components. We evaluate BasketFormer on two public benchmarks (Ta-Feng, Instacart) and a large-scale proprietary grocery dataset (71K customers, 3.8M transactions). BasketFormer achieves +9.5% and +7.1% relative Recall@10 improvement over the strongest baseline on Ta-Feng and Instacart, respectively, and +28.0% over TIFU-KNN on the proprietary dataset, while boosting explore-item recall by 17×.

Link
https://www.semanticscholar.org/paper/d821308925fb5f63ceb0d4ecf633890d916a4754
Found by
Semantic Scholar
Authors
Akshay Verma, Sambit Das, S. Pillai, Deepak Gupta
Categories
benchmark, evaluation, dataset
Published
2026-11-06
Last seen by the radar
2026-11-08
Citations
0
Influential citations
0
Radar score
44.25 / 100 (how it is scored)
Why it scored so
Matched: benchmark, dataset, evaluat; Primary record: Semantic Scholar
Related links
https://doi.org/10.1145/3799682.3840147
Is this record right? If you made this work and something here is wrong or missing, tell us what to fix.

More records found by Semantic Scholar