Recipe2Vec: Multi-modal Recipe Representation Learning with Graph Neural Networks

Yijun Tian, Chuxu Zhang, Zhichun Guo, Yihong Ma, Ronald A. Metoyer, Nitesh V. Chawla

Introduction

In food computing, representing a recipe as a mathematical vector—an embedding—is fundamental for tasks ranging from recommendation engines to healthiness estimation. Traditional methods often operate in silos, focusing exclusively on text (NLP), image-text alignment for retrieval, or social relations. However, recipes are inherently multi-modal. A dish's identity is defined by its visual presentation, technical instructions, and its relational context within a broader culinary network. This paper introduces Recipe2Vec, a Graph Neural Network (GNN) framework designed to fuse these disparate data sources into a single, robust representation.

Large-RG: A Heterogeneous Recipe Graph

To support this multi-modal approach, the authors constructed Large-RG, the largest recipe graph to date. This heterogeneous graph contains over half a million nodes, linking Users (U), Recipes (R), and Ingredients (I).

The structure of Large-RG, illustrating the integration of visual, textual, and relational information.

The graph captures four primary relationship types:

  • User-Recipe (U-R): Based on user ratings and interactions.
  • Recipe-Recipe (R-R): Based on content similarity.
  • Recipe-Ingredient (R-I): Defining the composition of a dish.
  • Ingredient-Ingredient (I-I): Capturing co-occurrence patterns.

The Recipe2Vec Model

The Recipe2Vec framework employs a multi-stage GNN architecture to process the complex relationships within Large-RG:

  1. Feature Encoding: Initial embeddings are generated using pre-trained models: ResNet for visual data and a two-stage LSTM for textual instructions.
  2. Multi-view Neighbor Sampler: To capture high-order relationships, the model uses "meta-paths" (e.g., Recipe-User-Recipe), allowing it to learn from neighbors beyond direct connections.
  3. Adaptive & Cross-modal Aggregators: These modules use attention mechanisms to weigh the relevance of different modalities and relation types, ensuring that the visual "vibe" and technical instructions are integrated effectively.
  4. Adversarial Training: To enhance robustness and prevent overfitting on modality-specific quirks, the authors implement a feature-based adversarial attack strategy. Using Projected Gradient Descent (PGD), they inject small perturbations into input features during training, forcing the model to learn more stable and generalized representations.

Dataset and Evaluation

Large-RG was compiled by crawling food.com and integrating data from Recipe1M and the USDA nutritional database. The resulting dataset provides a comprehensive view of culinary diversity.

Statistics of the Large-RG dataset, including node/edge counts and category distributions.

The model was evaluated on two primary downstream tasks:

  • Cuisine Category Classification: Predicting one of 10 categories (e.g., "Main-dish", "Desserts").
  • Region Prediction: Identifying the geographical origin across 8 regions (e.g., "American", "Asian").

Key Results and Insights

Recipe2Vec consistently outperformed ten state-of-the-art baselines, including specialized models like rn2vec and Reciptor.

  • Performance Gains: The model achieved an F1-score of 89.4% in cuisine classification (+3.5% over the best baseline) and 77.5% in region prediction (+4.5% improvement).
  • The Power of Relations: A key finding is that relational context—who cooks a recipe and what it is served with—provides semantic depth that text and images alone cannot reach.
  • Adversarial Regularization: Adversarial training proved to be a powerful regularizer, significantly improving performance on clean test data by stabilizing the multi-modal learning process.

Limitations and Future Work

Despite its success, Recipe2Vec faces challenges regarding computational complexity, as training on a graph with over 6 million edges requires significant resources. Additionally, the "cold-start" problem remains a factor for new recipes without established user ratings. Future research may explore incorporating more modalities, such as cooking videos, or applying the embeddings directly to personalized recommendation systems.

Reference: Tian, Y., et al. (2022). Recipe2Vec: Multi-modal Recipe Representation Learning with Graph Neural Networks. arXiv:2205.12396v1.

Summary updated

BibTeX
@inproceedings{tian2022recipe,
  author = {Yijun Tian and Chuxu Zhang and Zhichun Guo and Yihong Ma and Ronald A. Metoyer and Nitesh V. Chawla},
  title = {{Recipe2Vec: Multi-modal Recipe Representation Learning with Graph Neural Networks}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2022},
  doi = {10.24963/ijcai.2022/482},
}
Figure