TL;DR
Most next-basket recommendation systems treat a user's shopping history as a simple sequence of visits, completely ignoring the actual calendar time between trips. This paper introduces CASE (Cadence-Aware Set Encoding), a production-scalable model that captures item-specific repurchase rhythms (like weekly milk or monthly detergent) using multi-scale temporal convolutions and efficient set attention. CASE delivers significant accuracy gains across public benchmarks and achieves up to a 9.9% recall lift in production deployment at Walmart scale.
What Problem Does This Paper Address?
In retail and grocery recommendation, a huge portion of a user's next basket consists of repeat purchases. These items usually follow stable, predictable cadences—think of buying milk every week or trash bags every month.
However, standard Next Basket Recommendation (NBR) models suffer from a structural limitation: they represent history as an ordered sequence of baskets (Basket 1, Basket 2, Basket 3) rather than tracking actual calendar dates. Under this formulation, a gap of 1 day and a gap of 30 days look identical to the model. Consequently, these systems cannot refresh or update item rankings as days tick by between shopping trips, often recommending items too early (making them irrelevant) or too late (missing the purchase window).
While some neighborhood-based methods (like KNNs) can handle temporal decay, they require computing user-to-user similarities at inference time. At a production scale of tens of millions of users, this per-query retrieval becomes computationally impossible.
Methods
CASE solves this by decoupling item-level cadence learning from cross-item interaction, keeping the architecture highly scalable.
- Calendar-Time History Representation: For each item a user has previously bought, the model constructs a binary purchase indicator vector over a rolling $T$-day calendar window (where $1$ indicates a purchase on that day, and $0$ indicates no purchase).
- Multi-Scale Temporal CNN: The model passes this binary vector through shared 1D convolutional filters with five predefined kernel sizes: weekly (7 days), biweekly (14 days), monthly (28 days), seasonal (91 days), and trend (182 days). This allows the model to extract population-wide recurring rhythms without needing per-user parameters.
- Induced Set Attention Encoding (ISAB): Because a user's candidate items form an unordered set rather than a strict sequence, CASE uses a Set Transformer encoder. To avoid the expensive $O(n^2)$ quadratic complexity of standard self-attention, it uses Induced Set Attention Blocks (ISAB), reducing the complexity to $O(nK)$ via a small number of learnable "induced points" ($K=32$).
- Scoring: Enriched representations are fed into a final multilayer perceptron (MLP) to output a scalar repurchase score for each item.
Datasets
The authors evaluated CASE on four distinct grocery datasets:
- Instacart: A public online grocery dataset containing 18,739 users and 37,522 products.
- TaFeng: A Chinese grocery dataset with 7,227 users and 18,703 items, characterized by shorter histories and smaller baskets (a sparse data challenge).
- DC: Derived from the Dunnhumby "Carbo-Loading" database, featuring 123,935 users and a small catalog of 852 products.
- Proprietary Dataset: A large-scale, randomly sampled internal grocery dataset from Walmart consisting of 10,308 users across 88,812 items with rich purchase histories.
Key Insights and Ideas
- Cadence is the Dominant Signal: Ablation studies revealed that removing the multi-scale CNN led to the largest performance drop across all metrics. Tracking when things are bought matters more than complex graph or sequential architectures.
- Timing Trumps Identity: Surprisingly, removing item embeddings entirely only caused a modest drop in performance. The model can predict what you want next remarkably well just by looking at the rhythm of your past purchases, without even knowing the semantic identity of the items. In production, this drastically reduces reliance on massive, frequently refreshed embedding tables.
- Set Attention Sharpens Boundaries: As visualized via PCA, the temporal CNN does the heavy lifting of separating positive and negative items based on their cadence phase, while the Set Encoder (ISAB) refines these boundaries by capturing cross-item co-purchase dependencies.
Key Results
- Superior Accuracy in Sparse Settings: CASE consistently outperformed strong baselines (including TIFUKNN, DNNTSP, and BERT4NBR) across all datasets, showing its largest gains in sparse data environments like TaFeng and DC.
- Massive Inference Speedups: On the Instacart test set, CASE achieved a dramatic reduction in inference time compared to the strongest offline baseline, TIFUKNN (19 seconds vs. 318 seconds), proving its viability for real-time production serving.
- Production Impact: When evaluated against an active production learning-to-rank model with heavily engineered features, CASE achieved substantial relative lifts at top-5 recommendations: +8.63% in Precision, +9.90% in Recall, and +10.46% in NDCG.
Limitations and Future Work
- Stationarity Assumption: CASE assumes that a user's historical shopping cadences are relatively stable. It is not yet optimized to handle sudden disruptions, such as out-of-channel purchases or major lifestyle changes (e.g., moving or changing diets).
- Fixed Horizons: The current architecture relies on fixed multi-scale kernels and a rigid $T$-day window. The authors suggest that exploring adaptive temporal parameterizations could be a fruitful next step.
- Extreme Boundary Regimes: More work is needed to understand how CASE handles items with exceptionally long repurchase cycles, newly introduced items, or "cold-start" users with minimal history.
Summary updated