Health-Aware Recipe Generation using LSTMs

A novel machine-learning driven culinary recipe generator that moves beyond simply inputting ingredients. We extend a recurrent long-short term memory model’s input to incorporate a given nutritional profile as well as a sample of ingredients. This would not only generate a relevant and sensible recipe but one created specifically for ones specific dietary needs.

Typically, training a text generation model entails using an off-the-shelf method such as a recurrent neural network (RNN) or a long-short term memory model (LSTM). However, given that we wish to additionally condition the recipe on nutritional requirements, which is more than past textual history of the recipe, we augment this standard approach. Using an adapted LSTM model architecture with a fully-connected head, we propose a recurrent model to generate recipes based on user input of ingredients and nutritional specification: calories, protein, sugars, and fats. We trained the proposed model with 5M parameters on a large corpus of over 50,000 recipes for 100 epochs using the industry-standard Adam optimizer.

Full paper here.

In collaboration with Anirudhan Badrinath and Noah Reiner.

This was a final project for Data 244: Data Mining & Analytics, taught by Professor Zachary Pardos in Fall 2021 at UC Berkeley School of Education.

Back to code