Introduction:
Cooking is hard work. Creating new recipes is even harder. A good dish combines the contrast of different tastes, textures, and colors. We’re not gonna put anyone through chef school, but we do hope to learn some interesting relationships between ingredients and the subtlety and structure of recipes using a deep learning model. By parsing and training on thousands upon thousands of recipes, we hope to eventually be able to generate a novel recipe of our own.
Related Work:
Stanford master students have previously worked on a paper named Forage: Optimizing Food Use With Machine Learning Generated Recipes. In the paper the researchers attempted to create an LSTM model to generate a recipe given a constrained list of ingredients in order to best make use of left-overs and fridge ingredients.
Forage: Optimizing Food Use With Machine Learning Generated Recipes
Data:
We will be using the meal-master dataset. There are up to 158k+ recipes in the MM database, and we will be selectively training on 100k of those recipes.
Methodology:
We first filter the meal-master dataset by putting a cap on the length of each recipe (ingredients + instructions). We have preliminarily set this value to be 2000 characters. We then pad recipes that have less than 2000 characters with a special character to denote the end of a recipe. For the word embeddings, we are tokenizing by characters to improve the model’s ability to handle unknown words. This way the model will be able to learn not only English grammar of words, but also the structure of words themselves and hopefully understand new words (are they actions or possibly ingredients?) We are using 256 for the embedding dimensions and 1028 for the LSTM hidden dimension. For the LSTM, we are going to be utilizing the keras model LSTM. I think getting the model to learn the lengths, form and format of a recipe will be hard. However, it’ll be even harder for it to remember the ingredients that it itself generated earlier in the paragraphs. If there is too much information to learn we may have to reduce the complexity our embeddings have to encode by increasing the vocabulary size (using words instead of just characters). We could also experiment with generating the recipes and the ingredients independently.
Metrics: What constitutes “success?”
Base goal
- Legible English sentences generated by LSTM (regardless if food looks disgusting)
- For the base goal we will simply eyeball this and present the results on our poster.
Target goal
- Create recipes that are grammatically correct and instructions that can be followed to create a real dish (nothing like fry fish in water etc.)
- We can show our peers recipes and random and blind test them. We want to achieve an rate of “10% is something you can realistically cook”.
Stretch goal
- We can implement K-Means and try to evaluate the distance between centroids using Euclidean and Cosine distance.
Ethics:
Why is Deep Learning a good solution to this problem? Deep learning is a good approach to this problem because originality is a key metric. Normal statistical methods that simply connect ingredients to other ingredients don't work as well here because the resulting recipes would not be original or novel.
What broader societal issues are relevant to your chosen problem space? One potential societal issue of using deep learning for cooking is that the results could be used to benefit a small group of people. Training a really good ingredient algorithm will be really hard. Large NLP models on the scale of GPT-3 require thousands of hours and millions of dollars to train. This could mean that large restaurant chains and conglomerates would have an unfair advantage over mom and pop shops and further consolidate their reign. It would also be a big disaster for the environment.
Division of labor:
The main parts of our project are: data collection and cleaning, word embeddings, and designing and coding the model.
- Laxman worked on data collection and cleaning since he has a lot of experience from past datathons and hackathons
- Anthony worked on word embeddings and designing the model
- Andrew worked on designing the model and making higher level decisions regarding the project such as character vs word embeddings We all collaborated on debugging the code and tuning the models


Log in or sign up for Devpost to join the conversation.