In this paper, we introduce a transformer-based model for the Next Basket Recommendation (NBR) task in the grocery retail sector, specifically aimed at predicting a set of new, previously unpurchased products that a customer is likely to buy, based on their historical shopping behaviour. Our approach builds on the T5 (Text-to-Text Transfer Transformer) architecture, modified to enhance item-to-item correlations across sequential shopping baskets for recommendation purposes. Unlike traditional recommendation methods, which tend to focus on predicting repeat purchases, our model addresses the more challenging task of recommending novel products, even in the absence of direct customer-product interaction history. We formulate the NBR task as a sequence-to-sequence problem, where a customer’s historical sequence of shopping baskets serves as the input, and the target output is a prediction of new products the customer may purchase over the next four weeks. By framing the task as a sequence-to-sequence problem, our approach models customer behaviour as sequences of past purchases and predicts potential new products the customer might buy in the upcoming transactions.
To evaluate our model, we conduct extensive experiments using the public Dunnhumby dataset, containing transaction data for approximately 400,000 customers and 4,000 unique products. Our model produces probability scores for each product in the catalogue, enabling rank-ordered recommendations for unseen items. Performance metrics, including precision@k and decile gains, demonstrate that our model surpasses traditional collaborative filtering-based recommendation systems, highlighting the effectiveness of transformer architectures in addressing the problem for novel product recommendations.