S2SRec2: Set-to-Set Recommendation for Basket Completion with Recipe

Yanan Cao, Omid Memarrast, Shiqin Cai, Sinduja Subramaniam, Evren Korpeoglu, Kannan Achan

This blog-style summary provides an overview of the research paper "S2SRec2: Set-to-Set Recommendation for Basket Completion with Recipe," authored by researchers at Walmart Global Tech.

TL;DR

S2SRec2 moves beyond traditional "predict-the-next-item" recommendations by treating recipe completion as a set-to-set problem. Using a Set Transformer and multi-task learning, the model recommends a coherent group of missing ingredients and—crucially—dynamically predicts when a basket is "complete" for a specific meal.

What Problem Does This Paper Address?

In grocery e-commerce, customers often have a few ingredients in their cart but lack the culinary expertise to know what else is needed to make a full meal. Traditional recommendation systems tackle this using a "leave-one-out" strategy: they hide one ingredient and try to predict it.

However, this fails in two major ways:

  1. Complexity: Real-world users often need to add multiple ingredients, not just one.
  2. Coherence: Existing methods focus on the relationship between what’s in the cart and the missing item, but they ignore how the missing items relate to each other.

The authors argue that recipe completion should be a "set-to-set" (S2S) task, where the system understands the synergy of an entire ingredient set and knows exactly when to stop suggesting more items.

Methods

The researchers introduced S2SRec2, which utilizes two primary architectural choices:

  • Set Transformer: Unlike standard Transformers or RNNs, Set Transformers are "permutation invariant." This is perfect for recipes because the order in which you put ingredients in a digital basket doesn't change the final dish. It excels at capturing complex inter-dependencies between items.
  • Multi-task Learning (MTL): The model is trained to solve two problems simultaneously:
  • Missing Ingredient Query: A learnable query vector "interrogates" the current basket to predict the most likely next ingredient.
  • Completeness Prediction: A binary classifier that acts as a "stop signal," determining if the current set of ingredients (original + predicted) forms a complete recipe.

The Inference Loop: During use, the model doesn't just dump a list of items. It suggests an item, adds it to the virtual basket, checks if the basket is "complete," and repeats the process until the completeness probability exceeds 50%.

Datasets

The study used a large-scale culinary dataset from food.com.

  • Scale: 141,782 recipes and 3,804 unique ingredients.
  • Preprocessing: The authors filtered for recipes with 5–15 ingredients to ensure enough complexity for analysis while focusing on common cooking patterns.
  • Embeddings: Ingredients were projected into 768-dimensional vectors using a pretrained BERT model to capture semantic meaning (e.g., knowing that "scallion" and "green onion" are related).

Key Insights and Ideas

  • Order is a Distraction: One of the most interesting findings was that the Bi-LSTM baseline performed the worst. This suggests that forcing a sequential order on an unordered set of ingredients actually introduces noise that confuses the model.
  • The "Stop Signal" is Essential: Most recommenders provide a ranked list of N items. S2SRec2’s ability to say "you have enough now" prevents over-recommending and ensures the suggested set is a coherent culinary unit rather than just a collection of likely-looking items.
  • Synergy over Similarity: By using a query-based attention mechanism, the model learns which ingredients complement each other (synergy) rather than just which ingredients are similar to each other.

Key Results

S2SRec2 significantly outperformed baselines like Logistic Regression, Vanilla Neural Networks, and specialized models like Reciptor and Kitchenette.

  • Accuracy: It achieved the highest Precision, Recall, and F1 scores across the board.
  • Cardinality Prediction: The model was much better at estimating the correct number of missing items. It achieved a Mean Squared Error (MSE) of 1.0331 for set size prediction at k=3, compared to ~1.7 for most baselines.
  • Qualitative Success: In tests (like completing a "Layered Taco Dip"), S2SRec2 correctly identified specific missing staples like refried beans, while baselines often suggested generic or unrelated items like mayonnaise or celery.

Limitations and Future Work

  • The "Ground Truth" Hurdle: The authors noted that absolute precision numbers (around 3%) look low. This is a common issue in recipe AI: there are thousands of ingredients, and a model might suggest a perfectly valid completion (like "lime juice") that simply wasn't in the specific ground-truth recipe used for training.
  • Personalization: The current model treats all users the same. Future work aims to integrate user-specific signals, such as past purchase history and dietary restrictions (e.g., vegan or gluten-free), into the set representation.
  • Recipe Discovery: The authors plan to evolve the system from a "complement recommender" into a full-blown interactive recipe discovery engine that can surface entire recipe cards based on the completed basket.

Summary updated

Abstract

In grocery e-commerce, customers often build ingredient baskets guided by dietary preferences but lack the expertise to create complete meals. Leveraging recipe knowledge to recommend complementary ingredients based on a partial basket is essential for improving the culinary experience. Traditional recipe completion methods typically predict a single missing ingredient using a leave-one-out strategy. However, they fall short in two key aspects: (i) they do not reflect real-world scenarios where multiple ingredients are often needed, and (ii) they overlook relationships among the missing ingredients themselves. To address these limitations, we reformulate basket completion as a set-to-set (S2S) recommendation problem, where an incomplete basket is input into a system that predicts a set of complementary ingredients. We introduce S2SRec2, a set-to-set ingredient recommendation framework based on a Set Transformer and trained in a multitask learning paradigm. S2SRec2 jointly learns to (i) retrieve missing ingredients from the representation of existing ones and (ii) assess basket completeness after prediction. These tasks are optimized together, enforcing accurate retrieval and coherent basket completion. Experiments on large-scale recipe datasets and qualitative analyses show that S2SRec2 significantly outperforms single-target baselines, offering a promising approach to enhance grocery shopping and inspire culinary creativity.
BibTeX
@misc{cao2025s,
  author = {Yanan Cao and Omid Memarrast and Shiqin Cai and Sinduja Subramaniam and Evren Korpeoglu and Kannan Achan},
  title = {{S2SRec2: Set-to-Set Recommendation for Basket Completion with Recipe}},
  year = {2025},
  eprint = {2507.09101},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2507.09101},
}

Loading related content...

Figure