Relevance-Promoting Language Model for Short-Text Conversation

  • 2019-11-26 12:17:59
  • Xin Li, Piji Li, Wei Bi, Xiaojiang Liu, Wai Lam
  • 2

Abstract

Despite the effectiveness of sequence-to-sequence framework on the task ofShort-Text Conversation (STC), the issue of under-exploitation of training data(i.e., the supervision signals from query text is \textit{ignored}) stillremains unresolved. Also, the adopted \textit{maximization}-based decodingstrategies, inclined to generating the generic responses or responses withrepetition, are unsuited to the STC task. In this paper, we propose toformulate the STC task as a language modeling problem and tailor-make atraining strategy to adapt a language model for response generation. To enhancegeneration performance, we design a relevance-promoting transformer languagemodel, which performs additional supervised source attention after theself-attention to increase the importance of informative query tokens incalculating the token-level representation. The model further refines the queryrepresentation with relevance clues inferred from its multiple referencesduring training. In testing, we adopt a\textit{randomization-over-maximization} strategy to reduce the generation ofgeneric responses. Experimental results on a large Chinese STC datasetdemonstrate the superiority of the proposed model on relevance metrics anddiversity metrics.\footnote{Code available athttps://ai.tencent.com/ailab/nlp/dialogue/.

 

Quick Read (beta)

Relevance-Promoting Language Model for Short-Text Conversationthanks: The work described in this paper is substantially supported by a grant from the Research Grant Council of the Hong Kong Special Administrative Region, China (Project Code: 14204418). It was mainly done when Xin Li was an intern at Tencent AI Lab.

Xin Li,1 Piji Li,2 Wei Bi,2 Xiaojiang Liu,2 Wai Lam1
1Department of Systems Engineering and Engineering Management,
The Chinese University of Hong Kong
2Tencent AI Lab, Shenzhen, China
{lixin, wlam}@se.cuhk.edu.hk, {pijili, victoriabi, kieranliu}@tencent.com
Abstract

Despite the effectiveness of sequence-to-sequence framework on the task of Short-Text Conversation (STC), the issue of under-exploitation of training data (i.e., the supervision signals from query text is ignored) still remains unresolved. Also, the adopted maximization-based decoding strategies, inclined to generating the generic responses or responses with repetition, are unsuited to the STC task. In this paper, we propose to formulate the STC task as a language modeling problem and tailor-make a training strategy to adapt a language model for response generation. To enhance generation performance, we design a relevance-promoting transformer language model, which performs additional supervised source attention after the self-attention to increase the importance of informative query tokens in calculating the token-level representation. The model further refines the query representation with relevance clues inferred from its multiple references during training. In testing, we adopt a randomization-over-maximization strategy to reduce the generation of generic responses. Experimental results on a large Chinese STC dataset demonstrate the superiority of the proposed model on relevance metrics and diversity metrics.11 1 Code available at https://ai.tencent.com/ailab/nlp/dialogue/.

\newcolumntype

L[1]¿\arraybackslashm#1

Relevance-Promoting Language Model for Short-Text Conversationthanks: The work described in this paper is substantially supported by a grant from the Research Grant Council of the Hong Kong Special Administrative Region, China (Project Code: 14204418). It was mainly done when Xin Li was an intern at Tencent AI Lab.


Xin Li,1 Piji Li,2 Wei Bi,2 Xiaojiang Liu,2 Wai Lam1 1Department of Systems Engineering and Engineering Management, The Chinese University of Hong Kong 2Tencent AI Lab, Shenzhen, China {lixin, wlam}@se.cuhk.edu.hk, {pijili, victoriabi, kieranliu}@tencent.com

Copyright © 2020, Association for the Advancement of Artificial Intelligence (www.aaai.org). All rights reserved.

Introduction

Short Text Conversation (STC) (?), also known as single-turn chit-chat conversation, is a popular research topic in the field of natural language processing. It is usually formulated as a sequence translation problem (??) and the sequence-to-sequence encoder-decoder (Seq2Seq) framework (???) is applied for solving this problem. The decoder generates the responses token-by-token, conditioned on the compressed query representations from the encoder. Following this paradigm, many attempts have been conducted to refine the quality of the generated responses (????).

Despite the effectiveness of these efforts, some intrinsic issues of Seq2Seq-based models still hinder further improvement of generation performance. Under the Seq2Seq formulation, the auto-regressive decoder is only trained on the gold-standard response text while the query text is ignored, leading to under-exploitation of the training data. Besides, the maximization-based decoding strategies adopted in existing models, such as beam search and greedy search, restrict the search space to the most frequent phrases and thus they have the tendency to generate the generic responses or repetitive responses with unnaturally high likelihood, degrading the conversational experience.

GPT-2 (?), a recently proposed Transformer-based language model, provides an alternative solution for language generation. One advantage of GPT-2 is that the transformer language model can not only capture the context of arbitrary length but also make full use of the textual supervision signals because the generator is actually the language model itself. Moreover, GPT-2 adopts top-k sampling (?) to diversify the generated texts while preserving the relevance. Obviously, these characteristics are attractive and meaningful for solving the STC task, whose aim is to generate informative and diverse human-like responses given the user queries.

However, due to the essence of language modeling, directly applying GPT-2 on the STC task, a conditional language generation task, may be insufficient because the language model is unable to discriminate the source (query) sentence and the target (response) sentence. The original experimental results of GPT-2 on the abstractive summarization task (?) also verify this claim. Another potential issue of adapting language model for the STC task comes from recency bias (?) and explanation-away effects (??), where the language model has the tendency to rely overly on the immediate context and explain away from the long-term context22 2 Long-term context in language model is roughly equivalent to the source information in Seq2Seq framework., yielding fluent but topically irrelevant responses.

Figure 1: Representations of the example input with n=7 and m=4.

With the motivation of inheriting the merits of transformer language model while alleviating the potential issues under the language model formulation, we carefully design a training strategy to adapt the auto-regressive transformer-based language model33 3 Without explicit specification, the language model in our paper refers to the “auto-regressive” language model, which is different from those “auto-encoding” language models (??). for the conditional response generation. First of all, it is observed that the dialog conversation is actually a process of text continuation, in other words, giving the response right after the query. Based on this observation, we can regard the STC task as a language modeling problem on the concatenated sequence of query and response. To discriminate the generation of query tokens and that of response tokens, we inject a special token between query and response, acting as the trigger of response generation. With this formulation, the language model based training objective can make use of the textual data from query, alleviating the under-exploitation issue mentioned above.

Since the transformer-based language model tends to focus on the short-term context and ignore the long-term context, namely, the explanation away issue, we propose to empower the self-attention with encoder-decoder attention, which enforces the model to pay additional attention to the query, especially the query tokens of user interest, and guides the model to rely on informative query tokens to make good predictions. It is also observed that some response tokens not mentioned in the query are still closely related to the discussed topic in the conversation. In order to exploit such kind of relevance clues hidden behind the responses, we propose a topic inference component to learn a compact source (query) representation encoding the information relevant to the query and feed the query representation into each generation step, encouraging the language model to consider the generation of the topic words potentially related to the query.

As with the decoding strategy, different from the existing STC models, we propose to decode with randomization-over-maximization method, namely, the top-k sampling, from the transformer language model to generate the relevant response with high originality.

In summary, our contributions are as follows:

We tailor-make a training strategy to adapt the transformer-based language model for the Short Text Conversation (STC) task.
We propose two components, namely, Supervised Source Attention (SSA) component and Topic Inference (TI) component to promote the relevance modeling in the language model based response generator.
To the best of our knowledge, we are the first to introduce top-k sampling, a randomization-over-maximization strategy, for diverse response generation.44 4 We notice that some concurrent works (???) also adopt the strategy similar to ours after the submission.

Figure 2: Overall architecture. The Topic Inference (TI) component on top of the transformer layers and the Supervised Source Attention (SSA) component inside the transformer layers are the proposed relevance-promoting components. Training losses are calculated on top of the obtained representation vectors 𝐬t’s.

Model

Overview

In our language model formulation, each training query-response pair and the special tokens are concatenated as a single sequence 𝐱={x1,,xm,xm+1,,xn} of length n. 𝐱1:m corresponds to the query token sequence of length m and xm is the special token [EOQ], denoting the end of query. 𝐱m+1:n corresponds to the response and xn is [EOS], the end symbol of the whole sequence. The training objective of our model is to maximize the unconditional likelihood p(𝐱1:n), similar to the existing language models (??).

The architecture of our model is depicted in Fig 2, where L decoder-only transformer layers (?)55 5 For the technical details of transformer, we recommend the reader to read the paper (?). are involved. Different from the original transformer layer solely containing the self-attention component, the transformer layer in our model is further empowered with the proposed supervised source attention (SSA) component. The outputs of the l-th transformer layer are the contextualized token representations of size dimh, denoted as 𝐇ln×dimh. When predicting the tokens, a Topic Inference (TI) component is introduced to provide the refined query representations encoding the topic information inferred from the reference.

Language Model as Response Generator

To achieve the goal of adapting language model for the STC task, we should carefully design a training strategy different from that in the Seq2Seq framework. Based on the observation that the human conversations can be regarded as a process of text continuation (i.e., giving the response/answer right after the query/question), we concatenate the query token sequence and the response token sequence into a single sequence and formulate the STC task as a contextual text continuation problem. One input example of our model is illustrated in Fig 1. The training goal of the model is to minimize the joint negative log likelihood over the whole sequence:

mle=-logP(𝐱1:n)=-t=1nlogP(𝐱t|𝐱<t) (1)

Obviously, it is easy to bridge the gap between the task-specific training and the auto-regressive pre-training (???) because the formulations of their objectives are almost the same. Another advantage of this language model formulation is that it takes the likelihood of query tokens into consideration, which is ignored in the existing works (??). Intuitively, the text generated by the language model is more fluent than those generated by Seq2Seq framework because the generator of the language model (the language model itself) is not only trained on the response sentence but also the query sentence.

Relevance Modeling Component

The vanilla transformer decoder is equipped with self-attention (??) and can theoretically capture the context of arbitrary length. Given the input 𝐇l-1n×dimh, the contextualized representations 𝐡tl (l[1,L], t[1,n]) at the t-th time step is built as follows:

𝐡tl,𝜶tl=Slf-Att(𝐪tl-1,𝐊tl-1,𝐕tl-1)𝐐l-1=𝐇l-1𝐖Q𝐊l-1,𝐕l-1=𝐇l-1𝐖K,𝐇l-1𝐖V (2)

where Slf-Att is the self-attention layer66 6 The symbols for the feed-forward layer and residual connections are not shown. and 𝜶tlt is the calculated attention vector. 𝐐, 𝐊, 𝐕n×dimh respectively denote the query77 7 Here, the “query” refers to a real-valued vector while the “query” in the STC task is a sentence., key and value in the self-attention layer. 𝐊tl-1={𝐤1l-1,,𝐤tl-1} indicate the leftward elements and the same to 𝐕tl-1. Despite its capability of learning global dependency, the transformer-based language model still has the tendency to overly rely on the short-term context and ignore the long-term context when predicting the next word, dubbed as explanation away problem (?). This problem is catastrophic for the STC task because the query acts as the long-term context in our language model formulation and not involving the query information is prone to generating the content irrelevant to the query. Therefore, explicitly modeling the relevance and emphasizing the importance of the query are essential. In this paper, we propose two components, namely, Supervised Source Attention (SSA) and Topic Inference (TI), to handle the explanation away problem.

Supervised Source Attention

In the existing Seq2Seq-based frameworks, incorporating the query/source information is achieved by applying encoder-decoder attention solely on the encoder hidden representations. Similarly, attending only on the long-term context of language model is presumably beneficial for improving the relevance. Therefore, we propose to introduce another source attention layer on top of the self-attention layer. The computational formula of the t-th (tm) query-enhanced hidden representation 𝐡^tl is below:

𝐡^tl,𝜷tl=Src-Att(𝐪^tl,𝐊^l,𝐕^l)𝐐^l=𝐇l𝐖Q𝐊^l,𝐕^l=𝐇1:ml𝐖K,𝐇1:ml𝐖V (3)

Src-Att refers to our source attention layer on top of the self-attention layer. 𝜷tlm is the attention scores for the corresponding hidden representations of the query tokens. 𝐇l is the output of Slf-Att layer and 𝐐^ln×dimh, 𝐊^l, 𝐕^lm×dimh are the corresponding query, key, value in the source attention. Note that we only additionally apply source attention when the current token is not query token, i.e., tm, and do nothing in the preceding steps. Learning word alignment from data is possible but may be inaccurate without any supervision or external knowledge (??), therefore, we employ the keywords as the knowledge and enforce the source attention component to be concentrated on the important query tokens. First of all, we perform max-over-time pooling over the attention vectors 𝜷tlm (t[m+1,n]) and induce the vector 𝐲^srcm reflecting the salience scores of the query/source tokens:

𝐲^isrc=max{𝜷m+1,iL,,𝜷n,iL},i[1,m] (4)

Then, given the query keyword indicator vector 𝐲src{0,1}m, we introduce additional source attention loss src into Eq (1):

src=1m||𝐲^isrc-𝐲src||22 (5)

Ideally, the generation process will rely on more important query tokens if the salience score 𝐲^src is more close to the keyword vector 𝐲src.

Topic Inference

The SSA component attempts to improve the relevance by highlighting the importance of the important query tokens/words in the attention process. However, the range of the words topically related to the query is far more than that of the keywords explicitly mentioned in the query. Considering the query “what is your favorite fruit?” and two valid responses “I like the watermelon very much” and “My favorite fruit is pineapple”, “fruit” should be emphasized during the generation but the words used to discuss fruit such as “watermelon” and “pineapple” are also very meaningful for building a response. Inspired by this, we collect the multiple references of each query in the training set and gather all of the keywords extracted from such responses88 8 (?) extend the keyword set using external corpus. Here, we focus on improving the relevance rather than enriching the topical words in the response, thus, we only utilize the training data to explore more keywords.. To exploit the latent topic information, we introduce Topic Inference (KI) component to estimate the global topical word distribution based on the query representation 𝐡q as follows:

𝐡q=f(𝐱1:m),P(z|𝐱1:m)=Softmax(𝐖o𝐡q) (6)

where f:mdimh denotes the function mapping the input query tokens to a low-dimensional query representation. Specifically, we feed the last query hidden representation in the transformer, namely, 𝐡mL, into a linear layer with tanh activation and regard the output as the query representation 𝐡q for simplifying the modeling part. To encode the topic information into the query representation, we employ the global keyword indicator vector 𝐲kwd{0,1}|𝒱| as supervision signals and enforce the components corresponding to keywords/important tokens in the query-based global topic distribution to be up-weighted. The computational formula is as follows:

kwd=-1|𝒱|i=1|𝒱|𝐲ikwdlogPi(z|𝐱1:m) (7)

where the subscript i denotes the i-th component of a vector and |𝒱| is the vocabulary size. Note that we attempt to replace the Softmax in Eq 6 with the component-wise Sigmoid, typically used in multi-label classification problem, but the empirical results become worse. Thus, we keep the Softmax probability function unchanged in the experiment. Similar to Eq 5, the kwd will be added in the training loss.

Different from (?) and (?) regarding the concrete topic/keyword as the trigger of generation, we introduce the query representation encoding the global topic information as the supplementation for each token-level representation to encourage the generation of the relevant topical words. The representation vector 𝐬t for predicting the output is calculated below:

𝐬t={(1-gt)*𝐡tL+gt*𝐡q, if t>m𝐡tL, Otherwisegt=σ(𝐖g𝐡q+𝐖l𝐡tL+𝐛), (8)

where gtdimh is the gate value and 𝐖g,𝐖ldimh×dimh are parameter matrices in the TI component.

Model Training

The proposed SSA component and the TI component are jointly trained with the transformer-based language model. Based on Eq 1, Eq 5 and Eq 7, the overall training objective (θ) of the proposed model is as follow:

(θ)=1|𝔻|(𝐱,𝐲src,𝐲kwd)𝔻(𝐱,𝐲src,𝐲kwd)(𝐱,𝐲src,𝐲kwd)=mle+γ1src+γ2kwd (9)

Here, γ1 and γ2 are the coefficients controlling the proportion of src and kwd involved in the training respectively.

Decoding

Due to the limited search space, it is difficult for the beam search or greedy search to find the interesting and diverse responses. Therefore, we do not adopt them but a “randomization-over-maximization” strategy (also know as ‘top-k sampling”) to perform the decoding, as done in (??). (?) and (?) explore the usage of other advanced decoding strategies in the language generation task. Since our aim in this paper is not to compare the performances across the different decoding strategies, we consistently use the top-k sampling.

Experiment

Experiment Setup

We utilize the benchmark STC dataset (?) to evaluate the effectiveness of the proposed relevance-promoting transformer language model. This dataset is built based on the real conversations from Weibo99 9 https://www.weibo.com/ and contains about 7M high-quality query-response pairs. We split the dataset such that #train:#dev:#test is 7,024,156:2,000:800. Training details are provided in the appendix.

To avoid word segmentation errors and out-of-vocabulary issue, the tokens in our model and the baseline models are Chinese characters and the vocabulary size is about 12,000.

Evaluation Metrics

We introduce the following metrics to evaluate the model’s capability of generating relevant and diverse responses:

Relevance Metrics We employ Bleu-2, Bleu-3 & Bleu-4 (?) to estimate the relevance of the generated responses. Moreover, we also design two more metrics, namely, Hit-q and Hit-r to calculate the hit rates of the topical words in the query and the response respectively. Firstly, we build a high-precision-low-recall keyword set for each query/response sentence based on keyword extraction toolkit1010 10 https://github.com/fxsjy/jieba and filter some noisy words based on additional hand-crafted rules. Then, we calculate the Hit-Qi and Hit-Ri for the i-th predictions as follows:

Hit-qi=|𝕂ri𝕂qi||𝕂ri|,Hit-ri=|𝕂ri𝕂rig||𝕂ri| (10)

where 𝕂qi, 𝕂ri and 𝕂rig respectively denote the topical word set for the i-th query, predicted response and gold standard response. Then we obtain the Hit-q and Hit-r by performing the corpus-level average:

Hit-q=1NiNHit-qi,Hit-r=1NiNHit-ri (11)

Diversity Metrics Following (?), we employ Dist-1 and Dist-2 to calculate the ratios of the distinct uni-grams and bi-grams in the generated responses.

Human Evaluations We also conduct human evaluations. Specifically, we randomly sampled 100 queries and recruit five helpers to judge Relevance (4-scale rating, 0-3), Fluency (3-scale rating, 0-2) and Acceptance (0 or 1) of the generated responses from our model and the baselines. Details of the rating criteria are stated in the appendix.

Comparison Models

  • LSTM-LM (?): LSTM-based auto-regressive language model armed with incremental self-attention. We train LSTM-LM using the same strategy mentioned in this paper.

  • LSTM-S2S: Attention-based LSTM Sequence-to-Sequence model.

  • TFM-S2S: Transformer Sequence-to-Sequence model where the network components are identical to those in (?).

  • TFM-LM: Transformer-based auto-regressive language model. We train TFM-LM using the same strategy mentioned in this paper.

  • MMI (?): LSTM-S2S with Maximum Mutual Information objective in decoding. In this paper, we set the number of responses for re-ranking as 50.

  • CVAE (?)1111 11 https://github.com/snakeztc/NeuralDialog-CVAE: Conditional Variational Auto-Encoder for response generation. We replace the dialogue acts used in the original model with the keywords extracted from the references.

  • MMPMS (?): The model with the state-of-the-art performance on the STC task. We re-run the officially released code1212 12 https://github.com/PaddlePaddle/models to obtain the results on our dataset.

\Xhline3 Model Relevance Diversity
Bleu-2 Bleu-3 Bleu-4 Hit-Q Hit-R Dist-1 Dist-2
LSTM-LM 3.8 0.9 0.3 0.084 0.066 0.028 0.094
LSTM-S2S 5.6 2.8 1.8 0.293 0.145 0.039 0.137
TFM-LM 6.9 3.2 2.1 0.295 0.144 0.058 0.259
TFM-S2S 7.3 3.5 2.3 0.369 0.172 0.078 0.290
MMI 7.9 2.5 1.0 0.197 0.145 0.093 0.349
CVAE 5.8 1.5 0.4 0.211 0.135 0.060 0.211
MMPMS 6.7 3.0 1.8 0.151 0.102 0.057 0.220
OURS-tk w/o SSA & TI 4.9 1.0 0.3 0.119 0.076 0.086 0.441
OURS-tk w/o SSA 5.5 2.1 1.5 0.150 0.146 0.102 0.521
OURS-tk w/o TI 5.1 2.1 1.4 0.171 0.132 0.090 0.445
OURS-bm 10.3 5.3 3.4 0.510 0.193 0.102 0.398
OURS-tk 6.0 3.6 2.5 0.191 0.152 0.107 0.544
\Xhline3
Table 1: Experimental results on the automatic metrics. The best results are in bold.
\Xhline3 Model Evaluation Metrics
Relevance Fluency Acceptance
LSTM-LM 1.206 1.297 0.26
LSTM-S2S 1.386 1.285 0.37
TFM-LM 1.412 1.328 0.39
TFM-S2S 1.475 1.306 0.43
MMI 1.432 1.301 0.34
CVAE 1.316 1.274 0.33
MMPMS 1.528 1.396 0.42
OURS-tk w/o SSA & TI 1.273 1.368 0.28
OURS-tk w/o SSA 1.485 1.407 0.39
OURS-tk w/o TI 1.503 1.303 0.36
OURS-bm 1.515 1.359 0.38
OURS-tk 1.606 1.346 0.44
\Xhline3
Table 2: Human evaluation results with the best ones in bold.

Main Results

Table 1 and 2 list the automatic evaluation results and the human evaluation results respectively. In terms of Bleu, the proposed model with beam search decoding, namely, OURS-bm, consistently achieve the best scores. Besides, OURS-bm outperforms all compared models on the keyword-overlapping-based Hit metrics, suggesting that our model, armed with Supervised Source Attention component (SSA) and Topic Inference (TI) component, is beneficial for the generation of informative topical words related to the query. Surprisingly, OURS-bm also obtains better Dist metrics than the baseline models. After replacing the beam search with top-k sampling, our model (OURS-tk) is further enhanced in diversity modeling, reaching 0.107 and 0.544 on Dist-1 and Dist-2 respectively.

Regarding the more reliable human evaluations, both of OURS-bm and OURS-tk are the top-ranked models. Specifically, despite its unsatisfactory results on the automatic Bleu and Hit metrics, OURS-tk performs the best on the manually annotated Relevance metric with 5% improvement over the current state-of-the-art MMPMS model. Instead, OURS-bm, the best model on the automatic relevance metrics, still yields competitive results on the Relevance. It is reasonable because some words not appearing in the query/references, especially those not being frequently used, are still related to the discussed topic in the conversations. At the same time, such inconsistency between automatic and human evaluations demonstrates the effectiveness of top-k sampling, a randomization-over-maximization decoding strategy, in discovering infrequent but meaningful patterns for the STC task.

We now turn to discuss the performance of the other compared methods. Inheriting the powerful modeling capability of Transformer, TFM-S2S obtains the best automatic relevance scores as well as the second best Relevance among the baselines. TFM-LM, another Transformer-based baseline following the language model formulation in our paper, performs not as good as TFM-S2S on all of the metrics except Fluency, verifying the postulation that the explanation away issue of language model has the tendency to produce fluent but topically irrelevant responses. Despite of this, the TFM-LM outperforms LSTM-LM and LSTM-S2S, proving the superiority of Transformer to LSTM in response generation. Owing to the re-ranking mechanism, the MMI model is the strongest baseline on diversity modeling but OURS-bm/OURS-tk still achieves approximately 14%/55% improvement on Dist-2.

Ablation Study

In order to track the source of the performance gains, we also conduct the ablation study on the OURS-tk. The corresponding automatic and human evaluation results are shown in the second group of Table 1 and Table 2. As expected, the model without relevance-promoting design, i.e., OURS-tk w/o SSA & TI, is the worst one on the relevance metrics. OURS-k w/o SSA and OURS-tk w/o TI, the variants incorporating either TI or SSA for relevance modeling, boost the Relevance score by 17% and 18% respectively. Although they are comparable on the relevance metrics but the former achieves higher diversity scores (Dist-2: 0.521 v.s. 0.441). We attribute this phenomenon to the TI component, which exploits the usage of more related topical words mentioned in the multiple references. With the help of both SSA component and TI component, OURS-tk becomes the best model on Relevance and Dist metrics, demonstrating the necessity of the relevance modeling for the transformer language model. Another interesting finding is that the SSA component decreases the Fluency score (see the results of OURS-tk w/o TI), which indicates that fighting against explanation-away issue by incorporating additional query context may be coupled with corrupting the language model.

Figure 3: Examples of response generation. We translate Chinese samples to English.

Case Study

Figure 3 shows example responses generated by our model and the most competitive baseline models. OURS-tk, which explicitly incorporates the query context and exploits the tokens potentially related to the query, always produces meaningful and informative responses. Taking the Query #1 & #2 as examples, the generated responses accurately respond to the query because they mention “flower ladder”/“matcha” and “cream”, which are exactly the topics discussed in the conversations. The response for the Query #3 can easily engage user in the conversation and thus it is also a meaningful prediction. The outputs of TFM-LM are generally fluent. However, due to the explanation away issue, TFM-LM tends to generate the irrelevant response (Case #1) or response with phrase repetition (Case #2). Under the sequence-to-sequence formulation, TFM-S2S obtains the responses moderately related to the corresponding queries although the third output, directly copying part of the source text (i.e., query), is still unsatisfactory. MMPMS and MMI, the models aiming for promoting diversity, have chances to yield irrelevant responses.

Further Discussions on Top-k Sampling

We further investigate the impact of top-k sampling on the STC models. Firstly, we conduct additional automatic and human evaluations on the baseline models with results shown in Table 3. As can be seen, the top-k sampling consistently improves the Dist-2 score by a large margin on all models but the Relevance scores of LSTM-S2S, TFM-LM and TFM-S2S decrease after top-k sampling is applied. The variation trends of Fluency across the evaluated models are also inconsistent. These observations suggest that top-k sampling is simple yet effective to achieve diverse response generation but it should be carefully utilized in the model because of its uncertainty on relevance and fluency.

As discussed in Case Study, the transformer-based models adopting beam search have the tendency to generate the responses with repetition and those directly copying the query. We here investigate whether top-k sampling can help solve these issues. Figure 4 depicts the ratios of responses in the test set falling into the phrase repetition and query copy. The top-k sampling greatly reduces the query copy rate (about 72% on average) and almost eliminates the phrase repetition phenomenon in the Transformer-based models. However, note that Table 3 shows both TFM-LM and TFM-S2S perform worse on Relevance after using top-k sampling. We consider these results are consistent with human perception because enriching the morphology via sampling-based decoding strategy will inevitably introduce irrelevant information, leading to the degradation of relevance score. It is noticeable that the proposed model (i.e., OURS) is not affected on relevance modeling due to its capability of filtering some topically irrelevant candidates for the sampling process.

Models Relevance (Δ) Fluency (Δ) Dist-2 (Δ)
LSTM-LM-tk 1.111 (-0.09) 1.270 (-0.03) 0.383 (+0.29)
LSTM-S2S-tk 1.439 (+0.05) 1.265 (-0.20) 0.490 (+0.35)
TFM-LM-tk 1.273 (-0.14) 1.368 (+0.04) 0.441 (+0.18)
TFM-S2S-tk 1.270 (-0.15) 1.321 (+0.15) 0.507 (+0.22)
OURS-tk 1.606 (+0.10) 1.346 (-0.13) 0.544 (+0.20)
Table 3: Experimental results on the models adopting top-k sampling. Δ refers to the improvement over the original model adopting beam search. The best results are in bold.
Figure 4: Comparison results on beam search and top-k sampling. Specifically, if the length of the longest common sub-string between response and query is larger than 4, then the response is regarded as a “copy” of query. If a response contains the word/phrase loop over 3 times, it is regarded as a response with repetition.

Related Work

Short Text Conversation Short Text Conversation (STC) is usually formulated as a conditional text generation task (??). The sequence-to-sequence (Seq2Seq) encoder-decoder framework (???) and its variants have been studied extensively for solving this task. ? ? introduce diversity-promoting decoding strategies into the Seq2Seq model. Some (?????) attempt to guide the Seq2Seq model to generate keyword/topic-aware responses while others (???) try to control the response generation with additional retrieved data. The advanced techniques such as RL, GAN and VAE are also considered for improving conversational experience (????).

Transformer-based Language Model Deep transformer-based architecture (?) has led to significant performance gains on the language modeling task (???), compared to the existing CNN/RNN-based architectures (???). Meanwhile, GPT-2 (?) and UniLM (?) are the pioneer works adapting the transformer language model for the conditional text generation tasks.

Conclusion

In this paper, we present a language model based solution instead of traditional Seq2Seq paradigm for handling Short-Text Conversation (STC). We firstly tailor-make a training strategy to adapt the language model for the STC task. Then, we propose a relevance-promoting transformer language model to distill the relevance clues from the query as well as the topics inferred from the references, and incorporate them into the generation. Moreover, we explore the usage of top-k sampling for the STC task to further improve the response diversity. Experimental results on a large-scale STC dataset validate that our model is superior to the compared models on both relevance and diversity from automatic and human evaluations.

References

Appendices

Training Details

Our model consists of 6 decoder-only transformer layers with masked self-attention (i.e., L=6), where the hidden size dimh, number of heads and feed-forward size are 512, 8, 1024 respectively. The weights γ1,γ2 for src and kwd are set as 1.0 and 0.2. We do not introduce the pre-trained word/character embeddings but randomly initialize the parameters of the token embedding layer. We employ Adam (?) as optimizer and the initial learning rate is 1e-4. We apply linear warm-up at the first 10,000 training steps. The batch size is 32 and we train the model up to 20 epoch. We evaluate the model every 30,000 steps and select the model performs best on the validation set for producing the final results.

Human Evaluations

Apart from automatic evaluations, we also conduct human evaluations. Specifically, we randomly sampled 100 queries and recruit five helpers to judge Relevance, Fluency and Acceptance of the generated responses from our model and the baselines. The rating criteria, identical to those in (?), are as follows:

Relevance: +3: relevant as well as interesting; +2: relevant, including the generic responses; +1: relevant at a distant level; 0: not relevant at all.
Fluency: +2: fluent; +1: readable but with some grammar mistakes; 0: unreadable.
Acceptance: the ratio of acceptable responses. Specifically, acceptable response refers to the response with Relevance 2 and Fluency 1.

Obtaining Informative Query Words

Building the supervision signals 𝐲src in Eq 5 is based on the informative words of each query. The basic idea is that a query word having strong semantic relation with the corresponding response should be regarded as an informative word. The procedure is as follows:

  1. 1.

    Use keyword extractor1313 13 Here, we use jieba keyword extraction toolkit available at https://github.com/fxsjy/jieba. to obtain the keywords for each response in the training set.

  2. 2.

    Define the semantic relation score between a query word and the response as the maximal point-wise mutual information (PMI) between a query word and the response keywords.

  3. 3.

    Select the top-ranking query words in terms of the calculated semantic relation scores as the informative words.

Obtaining Response Keywords

The proposed Topic Inference (TI) component aims to refine the query representation with the knowledge inferred from response keywords. First of all, we employ jieba keyword extraction toolkit to collect the response keywords. Since one query may correspond to multiple references (i.e., one-to-many phenomenon), we aggregate the keyword sets for multiple responses corresponding to the same query. Then, we randomly sample 80% keywords in the aggregated set and regard them as the relevant response keywords 𝐲kwd (in Eq 7) associated with each training instance.

Obtaining Keywords for Evaluation

As mentioned in the Experiment part, calculating the Hit-Q and Hit-R metrics need to build a high-precision-low-recall keyword set for each query/response sentence. We firstly employ jieba keyword extraction toolkit to obtain an initial keyword set for each query/response. Then, we design the following rules to guarantee the precision of the obtained query/response keywords:

Remove the stop words in the initial keyword set.
Filter the keyword if the Part-of-Speech tag of this keyword does not belong to {N, NS, VN, V, F}.

Additional Details of Experiment

For the automatic evaluation results in Table 1, Bleu and Dist are character-level metrics while Hit scores are calculated using the word-based overlapping statistics.