Latent Alignment of Procedural Concepts in Multimodal Recipes (2020)

Abstract: We propose a novel alignment mechanism to deal with procedural reasoning on a newly released multimodal QA dataset, named RecipeQA. Our model is solving the textual cloze task which is a reading comprehension on a recipe containing images and instructions. We exploit the power of attention networks, cross-modal representations, and a latent alignment space between instructions and candidate answers to solve the problem. We introduce constrained max-pooling which refines the max pooling operation on the alignment matrix to impose disjoint constraints among the outputs of the model. Our evaluation result indicates a 19% improvement over the baselines.

## introduction procedural reasoning by following several steps to achieve a goal is an essential part of our daily tasks. however, this is challenging for machines due to the complexity of instructions and commonsense reasoning required for understanding the procedure @xcite @xcite . in this paper, we tackle the task of procedural reasoning in a multimodal setting for understanding cooking recipes. the recipeqa dataset @xcite ) contains recipes from internet users. thus, understanding the text is challenging due to the different language usage and informal nature of user-generated texts. the recipes are along with images provided by users which are taken in an unconstrained environment. this exposes a level of difficulty similar to real-world problems. the tasks proposed with the dataset include textual cloze, visual cloze, visual ordering, and visual coherence. here, we focus on textual cloze. an example of this task is shown in figure 1 . the input to the task is a set of multimodal instructions, three textual items from the question and a placeholder to be filled by the answer. the answer has to be chosen from four options. the three question items and the correct answer make a sequence which correctly describes the steps of the recipe. to design our model, we rely on the intuition that given question items, each answer describes exactly one step of the recipe. hence, we design a model to make explicit alignments between the candidate answers and each step and use those alignment results, given the question information. this alignment space is latent due to not having any direct supervision based on provided annotations. using multimodal information and representations by making a joint space for comparison has been broadly investigated in the recent research @xcite @xcite @xcite @xcite . our work differs from those as we do not have direct supervision on multimodal alignments. moreover, the task we are solving uses the sequential nature of visual and textual modality as a weak source of supervision to build a neural model to compare the textual representation of context and the answers for a given question representation. procedural reasoning has been investigated on different tasks @xcite . while prn (amac et al., 2019) is proposed on recipeqa, their model does not apply to the textual cloze task. @xcite is using procedural reasoning on multimodal information to generate a story from a sequence of images. however, the textual cloze task is about filling a blank in a sequence given a set of textual options. our model exploits the latent alignment space and the positional encoding of questions and answers while applying a novel approach for constraining the output space of the latent alignment. moreover, we exploit cross-modality representations based on cross attention to investigate the benefits from information flow between images and instructions. we compare our results to the provided baselines in (yagcioglu et al., 2018) and achieve the state-of-the-art by improving over 19%. ## proposed model we design a model to solve a structured output prediction on the textual cloze task. the intuition of our model is that the correct answer option should describe precisely one instruction, and this instruction should not be already described with other items in the question. hence, our model assumes the instruction and question as the context and candidate answers as an additional input to the alignment process. moreover, to incorporate the order of the sequence in question items and the placeholder, we utilize a one-hot encoding vector of positions to be concatenated with the candidate answers and question items' representations. we give the instructions to a sentence splitter using stanford core nlp library @xcite . the output is then tokenized by flair data structure @xcite and embedded with bert @xcite . the words' embeddings are passed to an lstm layer and the last layer is used as the instruction representation. we propose two different approaches to include images representations. these proposals are described in section 3.3. an overview of our approach is shown in figure 2 . question representation is the last layer of an lstm on question items. the representation of each question item is the concatenated vector of a one-hot position encoding and word embedding obtained from bert. the candidate answers' representations are computed using the same approach. we concatenate the question representation to each instruction. then, the similarity of each candidate answer and instruction is computed using the cosine similarity and form a similarity matrix. we use s to denote the similarity matrix. the rows of this matrix are candidate answers and the columns represent the recipe steps. the value of s ij indicates the similarity score of candidate i and step j. for training the model, we define two different objectives directly applied to the similarity matrix. the textual cloze task does not have the direct supervision required for the alignment between candidates and steps, and our objective is designed to use the answer of the question to train this latent space of alignments. for imposing the constraint of the alignment to be disjoint between steps and candidates, one way is to simply compute the maximum of each row in the similarity matrix and use that as the aligned step for each candidate answer; however, we introduce constrained maxpooling which is a more sophisticated approach as shown in figure 3 . we compare these two alternatives in the experimental results. we apply an iterative process to select the most related pair of instruction (a column) and answer candidate (a row) while removing the related column and row each time until all candidate answers find their aligned instruction. we denote the final selected maximum scores by @xmath0, s 2i 2 , s 3i 3 , s 4i 4 ), where i @xmath1, number of steps] is the index of the step with maximum alignment score with candidate cand for all pairs of candidates c and d, @xmath2. respectively, we define two following objectives. the first objective maximizes the distance between the maximum score of the correct answer and the maximum score of another random wrong answer candidate. furthermore, by fixing the instruction with the maximum alignment with the correct answer, it decreases the score of the other candidates alignments with that instruction. the second objective, increases the maximum similarity score of the answer to approach to 1 while decreasing the other maximum scores to be lower than 0.1. @xmath3, s rir -s aia + 0.1)+ 4 @xmath4, s cia -s aia + 0.1) (1) @xmath5, s cic -0.1) where @xmath6, 2, 3, 4} is the correct answer number and r is a random index from {1, 2, , 3, 4} -{a}. the main difference in objective 1 and objective 2 is the regularization term on the selected instruction column in the alignment matrix. ## discussion and analysis we did qualitative analysis using some examples and their results to better understand the behaviour of the proposed model. our model is almost able to detect all matched candidates with the instructions (in case that there exist multiple matches) but fails to choose the one that completes the sequence of the question items. this indicates the shortage of procedural hints inside our architecture while the latent alignment is proven to be practical. by analysing the results, we found interesting cases where either multimodal or unimodal architectures could yield more accurate predictions. multimodal -, unimodal +: figure 5 : the image is misleading the multimodal setting to choose apple slices rather than cutting option multimodal + , unimodal -: ## conclusion and future work we proposed a model for recipeqa textual cloze task which exploits the latent alignment of question items with instructions. moreover, we investigated the benefit of using multimodal information in this task by comparing three different architectures and provided qualitative analysis on some examples to justify the results. our model exceeded the baselines and improved the sota by over 19%. as a future direction, we will investigate the usage of the latent alignment in other tasks. we will apply more complex methods on textual abstractions and attention mechanisms to link the candidate answers with the recipe instructions. investigating how to incorporate the question order in the architecture is another direction.