Learning When and What to Quote: A Quotation Recommender System with Mutual Promotion of Recommendation and Generation (2022)

Abstract: This work extends the current quotation recommendation task to a more realistic quotation recommender system that learns to predict when to quote and what to quote jointly. The system consists of three modules (tasks), a prediction module to predict whether to quote given conversation contexts, a recommendation module to recommend suitable quotations and a generation module generating quotations or sentences in ordinary language to continue the conversation. We benchmark several competitive models for the two newly introduced tasks (i.e., when-to-quote and what-to-continue). For quotation recommendation, compared with previous work that is either generation-based or ranking-based recommendation, we propose a novel framework with mutual promotion of generation module and ranking-based recommendation module. Experiments show that our framework achieves significantly better performance than baselines on two datasets. Further experiments and analyses validate the effectiveness of the proposed mechanisms and get a better understanding of the quotation recommendation task.

## introduction the rise of social media platforms exposes people to more opportunities to share viewpoints @xcite . people get to know each other by what they post or say, and the art of chatting on the internet has become more and more important. using quotations would be a good way to make one's expression more clear, beautiful, and persuasive @xcite . however, for many individuals, thinking up a suitable quotation that fits the ongoing context is a daunting task. the issue becomes more pressing when quoting in online conversations where quick responses are usually needed on mobile devices. to that end, extensive efforts have been made to quotation recommendation -aiming to recommend suitable quotations given conversation context. nevertheless, previous work @xcite @xcite mostly focuses on what to quote, i.e., ranking the quotation candidates, but ignores the problem of whether or when to quote, which should be an indispensable part of a real-world applicable system as people may not realize that quoting in good time can enhance their persuasiveness because of their insufficient knowledge of quotations. we extend the previous quotation recommendation task to a quotation recommender system that consists of three modules, a when-to-quote module to predict whether to recommend quotations, a recommendation module to recommend quotations given conversation context and a generation module to generate sentences in ordinary language or quotations to continue the conversation. to better illustrate the system, fig. 1 shows an interaction example between user and system. the system can generate sentences in ordinary language (e.g., "well at least it worked") to continue the conversation or recommend proper quotations in more persuasive language, where the when-toquote module decides to recommend or generate ordinary sentences. as we are the first to formulate the quotation recommender system with two new modules (i.e., the when-to-quote prediction module and generation module), we provide benchmarks for the two newly added modules and propose a unified framework with novel quotation recommendation module. for quotation recommendation, the previous work either employs generation-based @xcite or ranking-based @xcite models, where the quotations are regarded as word sequences and labels, respectively. rather than applying either of them, we choose to fully explore the advantages of both types of models and propose a novel framework with a mutual promotion of recommendation and generation. our basic recommendation module is a ranking-based framework, where a pretrained language model is adopted to obtain the context representation. we use the top quotations recommended by the basic recommendation module as pseudo references to enhance the training of generation module. the motivation of using pseudo references comes from the observation that multiple quotations might be acceptable for one context. taking fig. 1 as an example, quotations q 1 to q 3 all can continue the context well. and the multiple references are beneficial for model to learn diverse patterns of generation, fitted in different scenarios @xcite . besides, the pseudo references-enhanced generation module is further adopted to facilitate the recommendation module by re-ranking the recommended quotation list. we expect that the semantic coherence between context and quotations can be emphasized by the cross-attention in the generation decoder. specifically, we get the posterior probabilities of quotations by feeding them to decoder and re-rank the top quotations recommended by the basic recommendation module accordingly, which is denoted as generative ranking. rather than employing searching algorithms like greedy search @xcite or beam search @xcite used in conventional generation due to unlimited search space, we choose to use generative ranking by calculating the language probability @xcite since the search space is limited when generating quotations (the number of quotation candidates is usually fixed). compared to the previous work that relies on beam-search for quotation recommendation @xcite , the generative ranking method does not require any post-processing to match the generated sentences to quotations and shows better performance. for experiments, our recommendation module outperforms the previous work significantly on two datasets (weibo and reddit), and performs well on when-to-quote prediction and what-to-continue generation. extensive experiments show that our mutual promotion mechanism is effective. more interesting experiments such as generative ranking vs. beam search are given to yield a better understanding of the quotation recommendation task. the main contributions of this work are: • we propose a novel quotation recommendation framework with a mutual promotion of recommendation and generation, which outperforms the previous work significantly. ## related work quotation recommendation is in line with contentbased recommendation @xcite or clozestyle reading comprehension @xcite , which learns to put suitable text fragments (e.g., words, phrases, sentences) in the given contexts. the current research on quotation recommendation can be divided into two categories as follows. quotation recommendation for formal writing. studies in this category explore various setting, such as quoting famous sayings in books @xcite , and using idioms in news articles @xcite . @xcite propose a learning to rank framework, where particular features (e.g., frequency, vote, web-popularity, and quote-rank) are employed. then @xcite first apply neural models, which avoids the time-consuming calculation and extraction of the features. as for recommending idioms for news articles, @xcite propose a neural machine translation framework, in which they suppose that the idioms are in pseudo target language and context is the source language to be translated. zheng et al. (2019) formulate the idiom recommendation task as a cloze test task and contributes a new dataset and provides a benchmark to evaluate the ability of understanding idioms. quotation recommendation for online conversation. this line of work faces more challenges in modeling the complex interaction and noisy context of online conversations. lee et al. (2016) combine a recurrent neural network and a convolutional neural network to learn semantic representation and structure representation. wang et al. (2020) contribute two datasets for quotation recommendation on online conversations. they propose a seq-to-seq framework to do the quotation recommendation and employ a neural topic model to get the latent representation of the history and thus assist the recommendation. wang et al. (2021) propose a ranking model where a transformation from queries to quotations is employed to enhance the quotation recommendation performance. 3 our model 3.1 problem formulation input to the system. the input mainly contains the observed conversation context c, and the quotation list q. the conversation c is formalized as a sequence of turns (e.g., posts or comments) {t 1 , t 2 , ..., t nc } where n c represents the length of the conversation (i.e., number of turns). t i (1 ≤ @xmath0. the quotation list q covers all quotations that have appeared in the training corpus. it is represented with {q 1 , q 2 , ..., q nq }, where n q is the number of quotations and q k is the k-th quotation in list q. ## experimental setup datasets and statistics. for the task of what to quote, we employ two datasets, weibo and reddit, released by @xcite . we adopt the same data split as @xcite for a fair comparison. for when to quote, we augment the two datasets by splitting the history contexts in original datasets foot_1 . specifically, we built two different rules for weibo and reddit to detect possible positions in context that might need prediction (please refer to appendix b for details). the statistics of the datasets can be found in appendix c ( evaluation metrics. for recommendation, we adopt popular evaluation metrics, including map (mean average precision), p@1 (precison@1), p@3 (precison@3), and ndcg@5 (normalized discounted cumulative gain@5) for evaluation by following @xcite . for generation, we adopt bleu foot_2 , rouge-1 and rouge-l to evaluate the generated sentences by following @xcite . to evaluate the task of when to quote, we adopt accuracy, f1 and recall scores. parameter setting. for reddit, we use english bart-base model released by @xcite to initialize our model; while for weibo, we use chinese bart-base model released by @xcite . both are with 768 hidden dimension, 12 attention heads and 6 layers of encoder and decoder. the middle dimension of our mlp recommendation layer is also 768. we use adam optimizer (kingma and ba, 2015) with a learning rate of 1e-4 for optimization and the batch size is 64. dropout strategy @xcite with dropout rate of 0.1 and l 2 regularization with 0.0003 effect value, as well as early stopping @xcite , are used to alleviate overfitting. we set γ in eq. ( 10 ) as 0.1 to make the model focus more on the recommendation task. top 5 (i.e., m @xmath1.e., m @xmath2. λ in eq. ( 9 ) is set to 0.6. ## experimental results in this section, we first compare the recommendation results of our model with the previous quotation recommendation models in §5.1. then we report the results of when-to-quote prediction and generation in §5.2 and §5.3, respectively. finally, further experiments are given in §5.4 and §5.5, together with a case study in §5.6, to provide insights on how our method works. ## conclusion this work explores a realistic recommender system that recommends quotations and provides whento-quote prediction and what-to-continue generation. we provide the benchmarks for the two newly added tasks and propose a mutual promotion mechanism for quotation recommendation. experiments show that our method can promote both generation and recommendation and contribute to the best quotation recommendation performance.