Assistive Recipe Editing through Critiquing (2023)

Abstract: There has recently been growing interest in the automatic generation of cooking recipes that satisfy some form of dietary restrictions, thanks in part to the availability of online recipe data. Prior studies have used pre-trained language models, or relied on small paired recipe data (e.g., a recipe paired with a similar one that satisfies a dietary constraint). However, pre-trained language models generate inconsistent or incoherent recipes, and paired datasets are not available at scale. We address these deficiencies with RecipeCrit, a hierarchical denoising auto-encoder that edits recipes given ingredient-level critiques. The model is trained for recipe completion to learn semantic relationships within recipes. Our work’s main innovation is our unsupervised critiquing module that allows users to edit recipes by interacting with the predicted ingredients; the system iteratively rewrites recipes to satisfy users’ feedback. Experiments onthe Recipe1M recipe dataset show that our model can more effectively edit recipes compared to strong language-modeling baselines, creating recipes that satisfy user constraints and are more correct, serendipitous, coherent, and relevant as measured by human judges.

## introduction individual preferences and dietary needs shape the types of recipes that home cooks choose to follow. cooks must often accommodate the desire for versions of recipes that do not contain a specific ingredient (substitution-e.g., for food allergies) or do make use of particular ingredients (additione.g., to use up near-expiry items). we thus aim to build a system for recipe editing that accommodates fine-grained ingredient preferences. prior research in recipe editing has focused on substituting individual ingredients in the ingredients list @xcite or recommending new recipes based on similar ingredients @xcite . individual ingredient substitution rules (e.g., tapioca flour and xanthan gum for wheat flour) often necessitate additional changes to the cooking procedure to function properly @xcite . other studies employed recommendationbased approaches. however, they suffer from data sparsity: there is an extremely large set of possible recipes that differ by a single ingredient, and many specific substitutions may not appear in recipe aggregators @xcite . recipe editing can be seen as a combination of recipe generation and controllable natural language generation @xcite , and has been explored to adapt recipes for broad dietary constraints @xcite and cuisines @xcite . pre-trained language models have been used to create recipe directions given a known title and set of ingredients @xcite , but generated recipes suffer from inconsistencies. @xcite instead build a paired recipe dataset, but face challenges scaling due to the large set of possible recipes and dietary restrictions; people often express even more specific ingredient-level preferences (e.g., dislikes of certain ingredients or allergies). in this work, we address the above challenges and propose recipecrit, a denoising-based model trained to complete recipes and learn semantic relationships between ingredients and instructions. the novelty of this work relies on an unsupervised critiquing method that allows users to provide ingredient-focused feedback iteratively; the model substitutes ingredients and also re-writes the recipe text using a generative language model. while existing methods for controllable generation require paired data with specially constructed prompts @xcite or hyperparametersensitive training of individual models for each possible piece of feedback @xcite , our unsupervised critiquing framework enables recipe editing models to be trained with arbitrary un-paired data. this generalizes recipe editing, unlike existing methods for controllable generation that rely on paired data with specially constructed cherry tomato confit title -1 pint red cherry tomatoes -¼ cup extra virgin olive oil -… ingredients -preheat even to 325 degrees -spread tomatoes and garlic on a sheet -… instructions cooking recipe encoder encoder encoder encoder projection encoder ## recipecrit: a hierarchical denoising recipe auto-encoder previous methods to edit recipes focused on broad classes like dietary categories @xcite and cuisines @xcite and require paired corpora (which do not exist for fine-grained edits). we propose recipecrit: a hierarchical denoising recipe auto-encoder that does not require paired corpora to train and accommodates positive and negative user feedback about ingredients (figure 1 ). recipecrit is divided into three submodels: an encoder e(•), which produces the latent representation z from the (potentially noisy) recipe; an ingredient predictor c(•), which predicts the ingredients ŷing , and a decoder d(•), which reconstructs the cooking instructions ŷins from z condi-tioned on the ŷing . ## experiments dataset we assess our model on the recipe1m @xcite dataset of 1m recipe texts. each recipe contains a title, a list of ingredients, and a list of cooking instructions. we filter out recipes with more than 20 ingredients or steps, creating train, val, and test splits with 635k, 136k, and 136k recipes, respectively. the average recipe comprises 9 ingredients and 166 words. we follow @xcite and build a set of 1, 488 ingredients. for critiquing, we select 20 ingredients to be critiqued among the most and the least popular ingredients across the train set. for each critique, we randomly sample 50 recipes that contain the critiqued ingredient and 50 that do not. baselines we compare our proposed recipecrit architecture against large language models trained using our denoising objective. we fine-tune bart @xcite , an encoder-decoder language model trained to denoise documents, as well as recipegpt @xcite , a decoder-only language model pre-trained on recipe1m to predict ingredients and cooking steps. to demonstrate the necessity of our denoising approach, we also compare against pplm @xcite , a recent method for controllable generation from language models that leverages sets of desired and undesired sequences (for ingredient addition and substitution, respectively). all models use greedy decoding. ## conclusion we present recipecrit, a denoising-based model to edit cooking recipes. we first trained the model for recipe completion to learn semantic relationships between the ingredients and the instructions. the novelty of this work relies on the user's ability to provide ingredient-focused feedback. we designed an unsupervised method that substitutes the ingredients and re-writes the recipe text accordingly. experiments show that recipecrit can more effectively edit recipes compared to strong baselines, creating recipes that satisfy user constraints and are more serendipitous, correct, coherent, and relevant as measured by human judges. for future work, we plan to extend our method to large pretrained language models for other generative tasks and to explainable models in the context of ratio-nalization @xcite @xcite @xcite .