Organizations: Department of Computational Biology, Indraprastha Institute of Information Technology Delhi (IIIT-Delhi), New Delhi, 110020, India · Infosys Centre for Artificial Intelligence, Indraprastha Institute of Information Technology Delhi (IIIT-Delhi), New Delhi, 110020, India · Center of Excellence in Healthcare, Indraprastha Institute of Information Technology Delhi (IIIT-Delhi), New Delhi, 110020, India · Department of Computer Science, Indraprastha Institute of Information Technology Delhi (IIIT-Delhi), New Delhi, 110020, India · Department of Social Sciences and Humanities, Indraprastha Institute of Information Technology Delhi (IIIT-Delhi), New Delhi, 110020, India
Cooking is a complex process that transforms raw ingredients into delicious and nutritious dishes, yet the recipes that encode this process remain largely free text; readable by people but not directly computable. Existing recipe collections capture fragments of this information, but no shared representation links a recipe's structured ingredient composition, its geo-cultural provenance, and its nutritional profile within a single queryable schema. We address this representation gap by formalizing a framework for recipe data structure that decomposes each recipe into typed ingredient entities, grounds those entities in a reference nutritional database, and annotates them with geo-cultural and dietary context. We present RecipeDB2, a structured compilation of 128,942 recipes with 35,474 ingredients from 32 regions and 99 countries. Ingredient phrases are parsed into seven culinary attributes using a transformer-based named-entity model; ingredients are linked to the USDA reference tables through a BERT embedding strategy (F1 = 87.90 on a manually adjudicated set of the 200 most frequent ingredients), yielding 148 nutritional parameters per mapped ingredient; a Random Forest classifier propagates 34 ingredient categories across the full vocabulary; and a deterministic, conservative rule set assigns each recipe a dietary style. Through RecipeDB2 (https://cosylab.iiitd.edu.in/recipedb2/), we demonstrate a scalable framework for making recipes computable, turning culinary heritage (long treated as an artistic rather than a quantitative object) into a data-driven analysis.
Figures & tables
Figure 1: The flow diagram depicting the framework for recipe data structure involving data compilation, curation, annotations, mapping, and estimation of the nutritional profiles. Building this framework involved the application of multiple machine-learning models. A deep-learning based named entity recognition model was used for extracting relevant culinary elements from the ingredient phrases. BERT was implemented to map ingredients from the recipes to those in the USDA nutrition table. A Random Forest model was used to predict the ingredient category. This framework for recipe data structure is generic and scalable.
Table 1: 20 most popular ingredients, their frequency, popularly used units, and unit counts.
Figure 2: Frequency rank distribution of units. The data indicates a presence of a thick-tailed (scale-free) distribution suggesting that few units are present in disproportionately high frequency.
Figure 3: A list of 50 most popular ingredient-unit pairs. An ingredient may have one or more units with which it occurs in the recipe’s text. For a longer list, please see Supplementary Figure S1.
Figure 4: Recipe size distribution before and after mapping to USDA suggesting no significant difference between the two. (inset) Frequency rank distribution before and after mapping to USDA.
Top X Ingredients
Model
Accuracy
Precision
Recall
F1 Score
10
BERT
80.00
80.00
100
88.88
RoBERTa
60.00
60.00
100
75.00
Jaccard
20.00
40.00
28.57
33.33
20
BERT
70.00
70.00
100
82.35
RoBERTa
50.00
50.00
100
66.67
Jaccard
25.00
57.14
25.00
34.78
Table 2: Comparison of performance of models in accurately mapping RecipeDB2 to USDA ingredient using metrics accuracy, precision, recall, and F1 score. The word embeddings were generated for the BERT, RoBERTa, and Jaccard models.
Model
Accuracy
Precision
Recall
F1 Score
RF
89.12
89.38
89.11
89.16
DT
87.19
87.44
87.18
87.25
SVM
85.31
86.06
85.31
85.48
LR
82.04
83.17
82.04
82.16
GB
80.74
83.05
80.74
81.09
NB
70.20
71.86
70.19
67.72
Table 3: Performance of machine learning models in predicting the category of each ingredient in terms of accuracy, precision, recall, and F1 score.
Continent
Region
Recipe Count
African
Middle Eastern
325
African
Northern Africa
1610
African
Rest Africa
2774
Asian
Chinese
5954
Asian
Indian Subcontinent
13780
Asian
Japanese
2063
Table S1: Mapping of cuisines from their (32) Regions to (7) Continents and (region-wise) number of recipes.
Figure S1: Visualization of the 100 most popular ingredient-unit pairs derived from the dataset. This figure illustrates the frequency of each ingredient along with its corresponding measurement unit, providing insights into common culinary practices. For example, ingredients such as ‘sugar’ are frequently measured in cups, while ‘spices’ are often measured in teaspoons or grams.
Figure S2: Statistics of 43 recipes that were left out of the BERT mapping protocol. The distribution of the recipe sizes has an average of 2.5, indicating that most of the recipes for which no ingredient was mapped to USDA consisted of a small number of ingredients. Christmas Truffle was an outlier, exhibiting a significantly larger recipe size of 8, suggesting it may involve ingredients that are difficult to find a corresponding USDA match.
Figure S3: Macro-nutrient analysis of recipes illustrating the distribution of key nutritional components. a. Protein distribution (grams), b. Carbohydrates (grams), c. Total lipids (fats) (grams), and d. Energy (calories). The data highlights variations in macro-nutrient composition across the recipes along with their mean and standard deviation, thus providing insights into the scatter of these macro-nutrients.
Figure S4: Frequency of ingredients in each of the 34 categories after implementing the Random Forest-based strategy. A total of 35,474 ingredients were mapped, of which 10,659 ( ∼ 30%) most frequently occurring were mapped manually, and the rest 24,815 ( ∼ 70%) were done using the automated, machine learning-based protocol.
Figure S5: Ingredient category composition of recipes for different cuisines (Region). For each cuisine, the heatmap represents the fraction of ingredients belonging to each ingredient category, highlighting the dominant and less prevalent ingredient categories in each cuisine. Additives, Spices, and Vegetables are among the most dominant ingredient categories, with a very heavy representation in the recipes, in general.