Routing Enforced Generative Model for Recipe Generation (2020)

Abstract: One of the most challenging part of recipe generation is to deal with the complex restrictions among the input ingredients. Previous researches simplify the problem by treating the inputs independently and generating recipes containing as much information as possible. In this work, we propose a routing method to dive into the content selection under the internal restrictions. The routing enforced generative model (RGM) can generate appropriate recipes according to the given ingredients and user preferences. Our model yields new state-of-the-art results on the recipe generation task with significant improvements on BLEU, F1 and human evaluation.

## introduction food is a critical contributor to physical well being, a major source of pleasure, worry and stress, a major occupant of waking time, and across the world, the single greatest category of expenditures for human beings @xcite . recipes are a specific genre of instructional language to teach people how to prepare delicious food. they have been gaining interests in recent researches as recipes contain immensely rich information about the real world @xcite . among previous efforts towards computational recipe studies, there are two lines in obtaining cooking recipes for users: recipe retrieval and recipe generation. recipe retrieval @xcite matches the entities from the given dish pictures or text inputs to find the corresponding recipes. provided with ingredients @xcite , recipe titles @xcite , or dish photos @xcite , recipe generation models introduce additional mechanisms to assure the generated recipes containing as much given ingredients as possible. in previous studies, the target recipes are exactly composed of the given ingredients. however, in practice, people usually have a number of ingredients at hand and do not know what to cook. they have difficulty in choosing appropriate set of ingredients. and it can be hard for them to input an accurate recipe title for the models @xcite . what's more, users may have preferences on some ingredients (e.g. "olive oil") or categories (e.g. "low sugar"). as figure 1 shows, given the same ingredient list, there can be different sets of ingredients contributing to recipes with different user demands. previous researches have not discussed this common scene of life. there is a clear need in finding suitable cooking recipes that match user demands. as increasing the variety and creativity of daily dishes can promote our happiness, in this work, we manage to obtain the desired recipes in a generation manner. our task is generally defined as follows: given the input of objective background information i and subjective semantic constraints c, our model is to help the machine automatically grounding the inputs to the text output y . such application contexts is common for many specific tasks. for recipe generation, we define i as a set of ingredients (e.g. "beef", "olive oil") the user has. and @xmath0, cd} denotes user preferences on some ingredients (ci ⊆ i) and category demands (cd ⊆ d, d represents the set of dish categories. e.g. "low fat", "low sugar"). the generated y is the text of the recipe which satisfies the user preferences with the given ingredients. there are two significant challenges: how to select appropriate set of ingredients to satisfy user demands; and how to generate recipes accordingly. we propose a novel approach to solve these problems. inspired by @xcite , we propose a selective routing algorithm to cluster the given ingredients into five categories (low sugar, high fiber, low fat, grilling and frying) and get the category vectors. length of the category vector represents the probability of generated y belonging to a specific category. we augment attention mechanism to capture ingredient information according to the routing weights between ingredients and categories. then decoder generates words in sequence. we introduce both manual ways and automatic metrics to evaluate the generated recipes. experimental results demonstrate the efficacy of our approach. to summarize, the contributions of our work are as follows 1 : ## related work recipes have been gaining interest in recent researches, including recipe processing @xcite @xcite , recipe parsing @xcite , recipe retrieval @xcite , regional cuisine style transformation @xcite , recipe qa @xcite and recipe generation @xcite . among previous efforts towards recipes researches, our study is closer to recipe generation. @xcite define the task as given a goal (recipe title) and an agenda (ingredient list) to generate a complete recipe. they present the neural checklist model to improve the semantic coverage of the agenda in the generated texts. @xcite develop a language model that treats reference as an explicit stochastic latent variable and create mentions of entities together with their attributes by accessing external databases. @xcite take the historical user preference records into consideration. they generate personalized recipes from incomplete input specifications (name and incomplete ingredient details). different from the existing methods on recipe generation which focus on covering all of the given ingredients, we extend the previous generation task with a selection of given items. selective generation is a task to produce the natural language description for a salient subset of a rich records @xcite . a lot of attention has been paid to individual content selection and selective realization sub-problems @xcite @xcite . recent works @xcite @xcite explore full selective generation and learn alignments between generated texts and input data using a translation model. we find appropriate set of ingredients by selective routing algorithm. and our model can generate texts according to the user constraints on both ingredients and categories. the core inspiration for our routing module comes from following works. @xcite propose transformation matrices that learn to encode the intrinsic spatial relationship between a part and a whole constitute viewpoint. later, @xcite propose an iterative routing-by-agreement mechanism to learn the intrinsic relationship between two layers. @xcite propose a new iterative routing procedure based on the em algorithm. inspired by the previous work, @xcite firstly investigate the performance of dynamic routing on text classification. they propose three strategies (orphan category, leaky-softmax, coefficient amendment) to stabilize the dynamic routing process and alleviate the disturbance of some noises. ## our approach the basic structure of our model is shown in figure 2 . generally speaking, we take two steps to achieve the recipe generation: select with routing: in this part, our task is to select an appropriate set (soft selection as weight distribution) of ingredients to support a dish for each category with the given constraints. the procedure can be defined as ## conclusion and future work in this paper, we make an effort on introducing routing algorithm to enforce the recipe generation model. we model the internal relationships between ingredients by selective routing algorithm. given ingredients with noises, our model selects reasonable ingredient collocations and generates recipes based on user demands. extensive experiments shows that the generated recipes are not only fluent and feasible, but also creative. there are several directions to explore in the future. for example, the clustering ability of routing algorithm can be used to control the style of generated texts.