KitchenScale: Learning to predict ingredient quantities from recipe contexts

Donghee Choi, Mogan Gim, Samy Badreddine, Hajung Kim, Donghyeon Park, Jaewoo KangExpert Systems with Applications 2023 · DOI

TL;DR

This paper introduces KitchenScale, a novel system that uses pre-trained language models (PLMs) to predict ingredient quantities and units within recipe contexts. By breaking down the problem into measurement type classification, unit classification, and quantity regression, KitchenScale effectively learns from vast recipe data to provide accurate ingredient measurements, addressing a key gap in current recipe understanding systems.

What Problem Does This Paper Address?

Determining the correct quantities of ingredients is crucial for successful cooking, impacting both taste and health. While significant progress has been made in areas like recipe generation and retrieval, accurately predicting ingredient quantities has remained a challenge. Existing methods often treat numerical quantities as mere text or rely on simpler ratio-based predictions, failing to capture the nuances of how quantities are expressed in real-world recipes. This paper tackles the problem of learning precise ingredient quantities and their corresponding units from diverse recipe contexts, a task that requires sophisticated understanding of cooking knowledge and numerical reasoning.

Methods

The core of KitchenScale is a fine-tuned Pre-trained Language Model (PLM), specifically BERT, adapted for the ingredient quantity prediction task. The authors break this complex task into three sub-tasks:

  1. Ingredient Measurement Type Classification: Predicting whether an ingredient is measured by weight or volume.
  2. Ingredient Unit Classification: Determining the specific unit of measurement (e.g., cups, grams, ounces).
  3. Ingredient Quantity Regression: Estimating the numerical value of the quantity.

A key innovation is the use of the Discrete Latent Exponent (DExp) method for the quantity regression task. This approach is designed to handle the high variance and multimodal distributions often found in numerical data within recipe corpora, outperforming traditional regression methods like Mean Squared Error (MSE). The model leverages transfer learning by fine-tuning PLMs on a large collection of recipe texts to acquire cooking-specific knowledge.

Datasets

The authors constructed a new dataset for KitchenScale by merging data from two existing sources: RecipeDB (Batra et al., 2020) and Reciptor (Li and Zaki, 2020). This merged dataset contains 101,573 recipes. For training and evaluation, the dataset was split into training, validation, and testing sets in an 8:1:1 ratio. The preprocessing involved selecting 74 units with occurrences exceeding 100 counts, disambiguating abbreviations, and normalizing plural units.

Key Insights and Ideas

  • Decomposition is Key: Breaking down the complex ingredient quantity prediction into three distinct, yet related, sub-tasks (type, unit, quantity) proved effective.
  • DExp for Numerical Variance: The DExp method is crucial for handling the inherent variability and multi-modal nature of numerical quantities in recipes, a common challenge in this domain.
  • Transfer Learning from Recipes: Fine-tuning PLMs on recipe data allows them to learn domain-specific cooking knowledge, which is essential for accurate quantity prediction.
  • Context Matters: The model's ability to leverage various recipe contextual elements (title, other ingredients, tags) significantly improves prediction accuracy.

Key Results

KitchenScale demonstrated strong performance across all three tasks.

  • Measurement Type Classification: The proposed BERT-based model achieved an accuracy of 0.9233 when using all recipe context elements.
  • Measurement Unit Classification: The model achieved an accuracy of 0.7335 using the descriptive name, measurement type, and all other recipe context elements.
  • Ingredient Quantity Regression: KitchenScale outperformed baseline methods, achieving an E-Acc of 0.7365, LMAE of 0.3333, MAPE of 1.4380, and MAE of 109.9340 on the test set.
  • Qualitative Analysis: The model showed impressive accuracy in predicting quantities for ingredients like chicken, beef, water, and pepper, often with errors less than 6-10%. Notably, it could infer that "pepper" could refer to different types (spice vs. plant-based) and even understand volume-based measurements for dry ingredients in specific contexts like the "Beef Wellington" recipe.

Limitations and Future Work

The authors acknowledge that while their model performs well, there's room for improvement.

  • Personalization: The current model doesn't account for individual user preferences or behaviors. Future work could incorporate personalized computing techniques to adjust recommendations based on user feedback and past interactions.
  • Broader Applications: The authors envision extending KitchenScale to other downstream tasks like recipe generation and retrieval, leveraging its learned numerical food knowledge.
  • Integration: Integrating KitchenScale with other food computing systems for tasks like food pairing and ingredient recommendation is another promising direction.
  • Model Improvement: Further enhancements could involve exploring more advanced PLMs and potentially incorporating more sophisticated methods for handling numerical reasoning.

Summary updated

BibTeX
@article{choi2023kitchenscale,
  author = {Donghee Choi and Mogan Gim and Samy Badreddine and Hajung Kim and Donghyeon Park and Jaewoo Kang},
  title = {{KitchenScale: Learning to predict ingredient quantities from recipe contexts}},
  journal = {Expert Systems with Applications},
  year = {2023},
  doi = {10.1016/j.eswa.2023.120041},
}
Figure