\documentclass[english]{jnlp_3.6}
\usepackage{jnlpbbl_2.2}
\usepackage[dvipdfmx]{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{url}
\usepackage{hangcaption_jnlp}
%%%%\usepackage{udline}
%%%%\setulminsep{1.2ex}{0.2ex}
%%%%\let\underline=\ul
\allowdisplaybreaks
\usepackage[dvipdfmx]{xcolor}
\usepackage{array}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% author's definition
%%%%\usepackage{verbatim}
%%%%\usepackage{algorithm}  
%%%%\usepackage{algorithmicx}
%%%%\usepackage{algpseudocode}  
\usepackage{multirow}
%%%%\usepackage{tikz}
%%%%\usepackage{collcell}
%%%%\usepackage{CJKutf8}
\usepackage{booktabs}
\usepackage{arydshln}
%%%%\usepackage{pgfplots}
%%%%% \pgfplotsset{compat=1.18} 
%%%%\usepackage{pgfplotstable}
\usepackage{bbm}
%%%%\usepackage{subcaption}
%%%%\DeclareMathOperator*{\argmax}{arg\,max}
%%%%\usepackage[multiple]{footmisc}
% Add my color here 
% ====================================================
\definecolor{blue(pigment)}{rgb}{0.78, 0.4, 0.8}
\newcommand{\lidy}[1]{\textcolor{blue(pigment)}{#1}}
% % ====================================================
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\Volume{30}
\Number{2}
\Month{June}
\Year{2023}
%%%%\Issuetitle{Special Issue: XXXXXXXX}

\received{2022}{7}{27}
\revised{2022}{11}{29}
\accepted{2023}{1}{18}

\setcounter{page}{401}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\esubject{General Paper}
\etitle{Generic Mechanism for Reducing Repetitions in Encoder-decoder Models}
\eauthor{Ying Zhang\affiref{Author_1} \and  Hidetaka Kamigaito\affiref{Author_2} \and  Tatsuya Aoki\affiref{Author_1}  \and \\  Hiroya Takamura\affiref{Author_3} \and Manabu Okumura\affiref{Author_1}} 
\eabstract{%
Encoder-decoder models have been commonly used; they have achieved state-of-the-art results for many natural language generation tasks. However, according to the reports of previous studies, encoder-decoder models suffer from generating redundant repetitions. Thus, we herein propose a repetition reduction module (RRM) for encoder-decoder models that estimates the semantic difference of a source sentence before and after it is fed into the model to capture the consistency between the two sides. As an autoencoder, the proposed mechanism supervises the training of encoder-decoder models to reduce the number of repeatedly generated tokens. The evaluation results of the publicly available machine translation and response generation datasets demonstrate the effectiveness of our proposal.}
\ekeywords{Encoder-decoder, Repetition Reduction, Autoencoder}

\headauthor{Zhang et al.}
\headtitle{Generic Mechanism for Reducing Repetitions in Encoder-decoder Models}

\affilabel{Author_1}{}{Tokyo Institute of Technology}
\affilabel{Author_2}{}{NARA Institute of Science and Technology (NAIST)}
\affilabel{Author_3}{}{National Institute of Advanced Industrial Science and Technology (AIST)}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\maketitle

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction}
\label{sec:introduction}

Sequence-to-sequence (seq2seq) models (i.e., \emph{encoder}-\emph{decoder} models) are a dominant paradigm in various natural language generation tasks such as machine translation \cite{luong2015effective,tu2016modeling}, text summarization \cite{kiyono-etal-2018-reducing,li2017deep},
and response generation \cite{miller2017parlai,pasunuru2018game}.\footnote{This paper was published in the Proceedings of the International Conference on Recent Advances in Natural Language Processing (RANLP 2021), when the third author was a PhD candidate at Tokyo Institute of Technology.} 
However, \citeA{mi2016coverage} reported that basic seq2seq models \cite{bahdanau2014neural,luong2015effective} sometimes suffer from the repetition problem, which is the generation of duplicate fragments.
Several studies have been conducted to explain the issue of repetition. For instance, \citeA{Holtzman2020The} established different probability distributions between natural-language text and beam-search-decoded text. 
Counter-intuitively, the models would assign a higher probability to generic, repetitive, and awkward texts than to grammatical or natural texts. This causes repetition when a maximization-based decoding method is used.
\citeA{Fu_Lam_So_Shi_2021} claimed that many words predicted the same next word with a high probability, which caused a tendency for the word and formed repetitions.
\citeA{XuLearningtoBreak2022} observed that the model had a strong preference to repeat the previous sentence. This preference is stronger when providing natural text rather than random text.
\citeA{tu2016modeling} and \citeA{mi2016coverage} claimed that the attention mechanism for the seq2seq model did not explicitly consider which source side tokens had already been covered in the past attentions.
Thus, the \emph{decoder} repeatedly attended to the translated source token during the decoding steps, which led to redundant generation. 
Following \citeA{tu2016modeling} and \citeA{mi2016coverage}, this study regarded over-considered attention to source tokens as the main cause of the repetition problem when using the seq2seq model.

Several researchers have proposed variants of the seq2seq model to address redundant repetitions.
The coverage mechanism \cite{tu2016modeling,mi2016coverage} prevents the model from generating redundant outputs by considering the coverage of the attention distribution.
These approaches can be easily incorporated into the seq2seq model with a single attention distribution between the \emph{encoder} and the \emph{decoder}. 
However, for seq2seq models with multiple attentions such as the transformer \cite{vaswani2017attention}, calculating the coverage of attention is intractable because the \emph{encoder} attempts to attend to multiple attentions on each layer in the \emph{decoder}. Thus, incorporating the coverage mechanism into multi-attention-based seq2seq models is challenging.

Additionally, \citeA{suzuki2016cutting} proposed word-frequency estimation (WFE), which predicts the upper-bound frequency for each output token from given input tokens to control redundancy in the output.
Furthermore, \citeA{kiyono-etal-2018-reducing} proposed a source-side prediction module (SPM) that estimates the occurrences of input tokens from the hidden states of the \emph{decoder} in the seq2seq model to reduce repetition. 
The SPM works as an autoencoder \cite{bengio2009learning} to encode and reconstruct the input word frequency to supervise model training.
Although WFE and SPM do not depend on the structure of the seq2seq model, it is difficult to apply them to tasks other than text summarization because they assume that the input sentence contains more tokens than the output.
In addition to the SPM, several studies have proven the effectiveness of using autoencoders to learn semantic representations and supervise model training in natural language generation tasks \cite{ma-etal-2018-autoencoder,luo-etal-2018-auto,10.1609/aaai.v33i01.33016786}.

To address these problems, inspired by previous research \cite{tu2016modeling,kiyono-etal-2018-reducing,ma-etal-2018-autoencoder}, we herein propose a generic approach, RRM, to supervise the attention distribution for the seq2seq model. The RRM shares the model architecture with the seq2seq model and functions as an autoencoder to focus on the differences between the embedding spaces of the source and target sides.
Based on the assumption of distributional semantics, RRM regards the representations of an input sentence on both sides as word vectors and attempts to minimize their differences during training. 
Hence, the seq2seq model explicitly considers the source-side context in the \emph{decoder}. 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% table 1
\begin{table}[t]
\input{05table01.tex}%
\label{table:4} 
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Our experimental results on the IWSLT 2014 German-to-English translation task \cite{cettolo2014report}, WMT 2014 English-to-German translation task \cite{bojar-etal-2014-findings}, and PERSONA-CHAT response generation task \cite{zhang2018personalizing} demonstrate that the proposed method effectively alleviates the nonconsecutive repetition problem for the seq2seq model. Sample translations are listed in Table \ref{table:4}.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Background}

Based on the coverage mechanism, we attributed the redundant repetitions in seq2seq models to the over-considered attention to the source tokens. To solve this problem, the RRM works as an autoencoder to supervise the seq2seq models during training. Here, we describe the seq2seq model \cite{luong2015effective}, coverage mechanism \cite{tu2016modeling}, and autoencoder \cite{bengio2009learning} using their mathematical notations. Additionally, we list the types of repetitions introduced by \citeA{Fu_Lam_So_Shi_2021} and \citeA{XuLearningtoBreak2022}.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Seq2seq Model}
\label{sec:seq2seq_model}

Given a source sentence $X=(x_1,\ldots,x_I)$, the seq2seq model generates target sentence $Y=(y_1,\ldots,y_J)$, where \(I\) and \(J\) are the numbers of source and target tokens, respectively. 
The seq2seq model consists of two main parts: \emph{encoder} and \emph{decoder}. The \emph{encoder} computes the representation of source sentence $X$ and the \emph{decoder} generates target sentence $Y$. As an autoregressive model, the seq2seq model with parameter $\theta$ decomposes the conditional probability $p(Y|X;\theta)$ as follows:
%========================
\begin{align}
    p(Y|X;\theta) &=  \prod_{j=1}^{J} p(y_j|y_{1}, \ldots, y_{j-1}, X;\theta),
\label{eq:1}\\
p(\cdot|y_{1}, \ldots, y_{j-1}, X;\theta) & = o_{j} \\
& = \textrm{softmax} (W_{o}\tilde{z}_{j}+b_{o}),
\end{align}
%=======================
where $\tilde{z}_{j}$ denotes the final hidden state of the \emph{decoder} during the $j$-th decoding step. $o_j$ denotes the probability distribution over target vocabulary $V_t$ at the $j$-th decoding step. $W_{o}$ is a weight matrix and $b_{o}$ is a bias term.

Model parameter $\theta$ is optimized by minimizing the cross-entropy loss \cite{VERIFICATIONOFFORECASTSEXPRESSEDINTERMSOFPROBABILITY} as follows:
\begin{equation}
    \ell_{CrossEntropy} = -\log p(Y|X;\theta) =-\frac{1}{J} \sum_{j=1}^{J} \sum_{c}^{|V_t|} y_{j,c}\log{o_{j,c}} ,
\end{equation}
where $|V_t|$ denotes the length of $V_t$; $o_{j,c}$ denotes the probability at the $j$-th decoding step for vocab $c \in V_t$, and
\begin{equation}
    y_{j,c}:=\begin{cases}
 1 & \text{ if } y_{j} = c \\ 
 0 & \text{ if } y_{j} \ne c .
\end{cases}
\end{equation}

Let $\textrm{FNN}$ denote the feed-forward layer and $\textrm{Concat}$ be the concatenation layer. When using global attention \cite{luong2015effective}, $\tilde{z}_{j}$ is computed as follows:
\begin{align}
    s_j & =\sum_{i=1}^{I}a_{i,j}h_{i} =\sum_{i=1}^{I} \textrm{softmax}(f(h_{i},z_{j}))h_{i} \label{eq:global_attention}, \\ 
    \tilde{z}_j &= \textrm{FNN}(\textrm{Concat}(s_j, z_j)),
\end{align}
where $h_{i}$ is the $i$-th hidden state of $X$ and $z_j$ is the hidden state at the $j$-th decoding step. Both $h_{i}$ and $z_j$ were computed using long short-term memory networks (LSTM) \cite{10.1162/neco.1997.9.8.1735}. $z_{1}$ is the state of special token $<$sos$>$, which indicates the start of the sequence. $H = (h_1, \ldots, h_I)$ denotes the set of hidden states in $X$. Score function $f$ evaluates the content matching between $h_{i}$ and $z_{j}$.

\citeA{vaswani2017attention} proposed a seq2seq model with multihead self-attention mechanism to compute $\tilde{z}_{j}$, transformer, which outperformed the global attention-based seq2seq model and became the dominant paradigm in the natural language generation tasks. Let $\textrm{Attn}$ denote a self-attention layer. We assume that both the \emph{encoder} and \emph{decoder} of the transformer consist of $L$ layers with $N$ attention heads. The $encoder$ encodes $X$ for representation $\widetilde{H}^L$ using
\begin{align}
& h_{i}^{l} = \mathrm{MultiHeadAttn} (\tilde{h}_{i}^{l-1}, \widetilde{H}^{l-1}, \widetilde{H}^{l-1})= \textrm{Concat}(\mathrm{head}_1,\ldots,\mathrm{head}_N)W_{a}^{l-1} \label{eq:multi_head_attention}, \\
& \mathrm{head}_n = \textrm{Attn}(\tilde{h}_{i}^{l-1}, \widetilde{H}^{l-1}, \widetilde{H}^{l-1}), \quad n \in \{1, \ldots, N \},  \\
&  \tilde{h}_{i}^{l} = \textrm{FNN}(h_{i}^{l}),
\end{align}
where $W_{a}^{l-1}$ is a weight matrix and $\tilde{h}_{i}^{0}$ is the embedding of the $i$-th token in $X$. $\widetilde{H}^{l} = (\tilde{h}_{1}^{l}, \ldots, \tilde{h}_{I}^{l})$ denotes the set of hidden states in the $l$-th layer for $X$.

The \emph{decoder} computes the hidden state $\tilde{z}_{j}^{l}$ of the $l$-th layer using
\begin{align}
  z_{j}^{l} &= \mathrm{MultiHeadAttn}(\tilde{z}_{j}^{l-1}, \widetilde{Z}_{\leq{j}}^{l-1}, \widetilde{Z}_{\leq{j}}^{l-1}), \label{eq:Attns_seq2seq} \\ 
    \hat{z}_{j}^{l} &= \mathrm{MultiHeadAttn}(z_{j}^{l}, \widetilde{H}^{L}, \widetilde{H}^{L}), \label{eq:attnc} \\ 
    \tilde{z}_{j}^{l} &= \textrm{FNN}(\hat{z}_{j}^{l}), \label{eq:FNN}
\end{align}
where $\tilde{z}_{j}^{0}$ is the embedding of token $y_{j-1}$ and $\tilde{z}_{1}$ is the state for the special token $<$sos$>$. $\widetilde{Z}_{\leq{j}}^{l-1}$ denotes a set of hidden states $(\tilde{z}_{1}^{l-1},\ldots, \tilde{z}_{j}^{l-1})$.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Coverage Mechanism}
\label{sec:coverage_mechanism}

\citeA{tu2016modeling} suggested that $a_{i,j}$ in Eq.~(\ref{eq:global_attention}) describes the probability of generating target word $y_{j}$ at time step $j$ from source word $x_{i}$. Based on $a_{i,j}$, they proposed coverage value $C_{i,j}$ to denote the translated ratio of $x_i$ at time step $j$ in a machine translation task. $C_{i,j}$ is calculated as follows:
\begin{equation}
    C_{i,j} = C_{i,j-1}+\tfrac{1}{\Phi _{i}}a_{i,j}  =\tfrac{1}{\Phi _{i}}\sum_{k=1}^{j} a_{i,k}  ,
\end{equation}
where $\Phi_i$ is a weight to denote the number of target words expected to be translated from $x_i$. \citeA{tu2016modeling} assumed that some source words might be unnecessarily translated multiple times (over-generation) while some source words might be mistakenly untranslated (under-generation) if a model lacked coverage information.
Based on this assumption, \citeA{tu2016modeling} introduced the last coverage $C_{i,j-1}$ to the global attention to calculate $a_{i,j}$ using score function $f(h_{i}, z_{j}, C_{i,j-1})$ in Eq.~(\ref{eq:global_attention}). Although using this coverage mechanism clearly shows the used ratio of $x_i$ at each decoding step and produces a more accurate alignment to guide target generation, using it for the multihead self-attention mechanism is intractable owing to the concatenation in Eq.~(\ref{eq:multi_head_attention}), and stacked sublayers in both the \emph{encoder} and \emph{decoder}. Owing to this limitation, we propose a generic method for supervising the attention distribution in the seq2seq model.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Autoencoder}
\label{sec:autoencoder}

Given source $X$, the autoencoder encodes $X$ in representation $h(X)$ and reconstructs $X$ from $h(X)$. This reconstruction by the autoencoder with parameter $\theta$ can be written as $p(X|h(X);\theta)$. Let $X^{'}$ be the reconstructed $X$. The autoencoder utilizes loss function $\ell(X, X^{'})$ to measure the reconstruction errors.
$L_2$ norm loss is a widely used loss function as $\ell(X, X^{'})$ and can be computed as follows:
\begin{equation}
   \ell(X, X^{'}) = \left \| X-X' \right \|_{2}^{2}, \label{eq:l2loss}
\end{equation}
where $X$ is a vector.

Owing to its \emph{encoder}-\emph{decoder} architecture, the seq2seq model has been utilized as an autoencoder in several natural language generation tasks \cite{ma-etal-2018-autoencoder,kiyono-etal-2018-reducing,10.1609/aaai.v33i01.33016786}.
\citeA{ma-etal-2018-autoencoder} proposed an autoencoder using an LSTM-based seq2seq architecture to encode and reconstruct target summaries in the text summarization task. During training, the autoencoder was combined with an LSTM-based seq2seq text summarization model by sharing the decoder to supervise the training of the summarization model. 
Their experimental results demonstrated that using the autoencoder assisted the LSTM-based seq2seq summarization model in receiving additional gains for the ROUGE score.
To supervise the training step, \citeA{kiyono-etal-2018-reducing} considered the source word frequency as input $X$ and utilized Eq.~(\ref{eq:l2loss}) to measure the distance between the input and reconstructed word frequencies in the text summarization task. 
Their experimental results demonstrated that the supervised global attention-based seq2seq model generated fewer repetitions than the unsupervised model.
However, their assumption required a source sequence longer than the target, which constrained the application of their proposal to text-generation tasks other than text summarization.
\citeA{10.1609/aaai.v33i01.33016786} also utilized an LSTM-based seq2seq model as the text autoencoder to extract representation from the target text and supervise the table-to-text generation task. Their experimental results demonstrated that the supervised table-to-text model achieved higher BLEU and ROUGE scores than the unsupervised model.
Instead of supervising the training, \citeA{luo-etal-2018-auto} utilized two autoencoders to separately reconstruct the inputs and responses to learn semantic representations in the dialogue generation task. After mapping the semantic representations of the input sentence and response, their proposal generated a fluent and coherent response than the seq2seq model of \citeA{NIPS2014_a14ac55a}.

These studies motivated us to deploy an autoencoder to learn the semantic representations of the source word frequency and supervise model training in natural language generation tasks.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Repetition Types}
\label{section:types_of_repetition}

\citeA{Fu_Lam_So_Shi_2021} defined that the consecutive repetitions required at least two adjacent identical fragments, in which the first fragment was the counterpart and the rest fragments were repetitions, as shown in Figure \ref{figure:repetition_example}. Based on this definition, we define nonconsecutive repetitions as those that require at least two detached identical fragments. \citeA{XuLearningtoBreak2022} mentioned three types of consecutive repetitions: word-, phrase-, and sentence-level, and used the rules below for calculation without considering the word matching between model predictions and gold references.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% fig. 1
\begin{figure}[b] 
\begin{center}
\includegraphics{30-2ia5f1.pdf}
\end{center}
\hangcaption{Examples of repetition types. \textcolor{red}{Red} and \textcolor{blue}{blue} indicate the repetitions and their counterparts, respectively.}
\label{figure:repetition_example} 
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Given sequence $Y$, the probability of word-level consecutive repetitions is calculated according to $\frac{1}{J-1} {\textstyle \sum_{j=2}^{J}}\mathbbm{1}(y_j=y_{j-1})$, where $\mathbbm{1}$ is an indicator function. Assuming a 
$k$-word phrase, the probability of phrase-level consecutive repetitions is computed according to $\frac{1}{J-2k+1} {\textstyle \sum_{j=2k}^{J}}\mathbbm{1}((y_{j-k+1}, \ldots,$ $y_{j})=(y_{j-2k+1},\ldots,y_{j-k}))$. To distinguish sentence-level consecutive repetitions, sequence $Y$ is split into $N+1$ subsentences by ``.!?''. Let $Y = (\mathrm{s}^0, \dots, \mathrm{s}^N)$ denote the set of split subsentences, the probability of sentence-level consecutive repetitions is calculated according to $\frac{1}{N} {\textstyle \sum_{i=1}^{N}} \mathbbm{1}(\mathrm{s}^i=\mathrm{s} ^{i-1})$. We followed \citeA{XuLearningtoBreak2022} to compute word-, phrase-, and sentence-level consecutive repetitions. Considering the usages of ``...'' and ``!!!'' in the natural text, the research limited the length of the subsentence by at least one word (ignoring ``.!?''). For example, the sequence ``I like apple.i.e.e.e.'' would be split into subsentences (``I like apple,'' ``i,'' ``e,'' ``e,'' ``e,'' ``''), and only ``I like apple'' was regarded as an valid subsentence. We renamed the sentence-level consecutive repetition as subsentence-level consecutive repetition to distinguish it from the repeat (sentence-level), which is defined in Section \ref{section:evaluation_metrics}. Additionally, we evaluate the probability of total repetitions according to $1-|\text{unique words}| /J$.

We report the average probability over the entire corpus and compare the probabilities of the predicted texts with gold references for evaluation.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% fig. 2
\begin{figure}[b] 
\begin{center}
\includegraphics{30-2ia5f2.pdf}
\end{center}
\hangcaption{Overview of a transformer-based \emph{encoder}-\emph{decoder} model with the RRM. The part inside a dashed rectangular box represents the RRM.}
\label{figure:1} 
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{RRM}
\label{sec:RRM}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Overview}

An overview of the RRM is presented in Figure~\ref{figure:1}.
Here, we employed the structure of the transformer for both the \emph{encoder} and \emph{decoder}.
Let $\tilde{x}$ denote the source-side sentence representation of source sentence $X$; $\tilde{q}$ denote the reconstructed $\tilde{x}$.
According to the coverage mechanism, supervising the ratio of source tokens used for the seq2seq model could produce an accurate alignment and guide target generation.
Inspired by \citeA{luong2015multi} and \citeA{kiyono-etal-2018-reducing}, the RRM considers $\tilde{x}$ as the correct representation of $X$ and attempts to reconstruct $\tilde{x}$ on the target side as an autoencoder. We assume that $\tilde{x}$ includes the word frequency of $X$ and $\tilde{q}$ includes the used $\tilde{x}$. By sharing the model parameters of the RRM with the seq2seq model, the source tokens used in the seq2seq model are supervised during training without considering the global attention mechanism, as in \citeA{tu2016modeling}.
The seq2seq model with parameter $\theta$ then predicts target-side sequence $Y$ and $\tilde{x}$. 
This prediction can be expressed as follows:
\begin{equation}
    p(Y, \tilde{x}|X;\theta) = p(\tilde{x}|Y, X;\theta) p(Y| X;\theta).
\label{eq:2}
\end{equation}
Conditional probability $p(\tilde{x}|Y, X;\theta)$ prevents either over- or under-generation of $Y$ by reconstructing the representation of the source context until the decoding step ends.
$p(\tilde{x}|Y, X;\theta)$ can be simplified to $p(\tilde{x}|X;\theta)$ if $\tilde{q}$ does not depend on $Y$. 
As $p(Y| X;\theta)$ is predicted by the seq2seq model, as shown in Eq.~(\ref{eq:1}), we provide details of $p(\tilde{x}|Y, X;\theta)$ in the section below.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Prediction of Source Side Context}

The SPM proposed by \citeA{kiyono-etal-2018-reducing} considers the count-based discrete representations of $X$ as the input and reconstructs the representations on the target side to supervise the seq2seq model to reduce the number of repetitions. However, this discrete vector failed to recognize a word by its tokenized subwords and may mislead the reconstruction; for instance, the word ``All'' and its tokenized subwords ``Al l.'' Furthermore, the SPM requires a longer $X$ than $Y$ when calculating Eq.~(\ref{eq:l2loss}), which constrains its application.
Instead of using count-based discrete representations, as in \citeA{kiyono-etal-2018-reducing}, we incorporated continuous representations for both the source and target sides to capture deeper semantic relations \cite{mikolov2013distributed}.
We assume $p(\tilde{x}|Y, X;\theta)$ is proportional to the similarity between the representations of source sentence $X$ before and after being encoded and decoded as follows:
\begin{equation}
    p(\tilde{x}|Y, X;\theta) \propto \exp(\alpha(\cos(\tilde{x}, \tilde{q}))), 
\label{eq:3}
\end{equation}
where $\alpha$ denotes the scaling factor used in the experiments.

Next, we explain the representations of source sentence $X$ in the source and target sides.
Let $V_{s}$ denote the source vocabulary. We define the indicator vector for the presence of source tokens as $x_i \in \{0,1\}^{|V_{s}|}$, where $x_i$ denotes the $i$-th token in $X$. 
The source-side representation $\tilde{x}$ of the source sentence is defined as follows:
\begin{equation}
\tilde{x} = \sum_{i}^{I} E_{src} x_i,
\label{eq:4}
\end{equation}
where $E_{src} \in R^{H \times |V_s|}$ is the word-embedding matrix for the source vocabulary and $H$ is the embedding size. 

To reconstruct $\tilde{x}$, we define the target-side representation $\tilde{q}$ of the source sentence as follows: 
\begin{equation}
\tilde{q} = \sum_{j}^{J} E_{src} q_j,
\label{eq:5}
\end{equation}
where $q_j \in R^{|V_s|}$ represents the probability distribution over source vocabulary $V_s$ at the $j$-th decoding step, which is calculated as follows: 
\begin{equation}
q_j = \textrm{softmax}(W_q \tilde{z}_{j}+b_q),
\label{eq:6}
\end{equation}
where $W_{q}$ is a weight matrix and $b_{q}$ is a bias term.
The softmax layer was used only in the training step.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Objective Function}

Considering the negative log-likelihood of Eq.~(\ref{eq:2})
, we induce objective function $G_t$ as follows:
\begin{equation}
\begin{split}
    &G_t = \sum_{(X,Y)\in \mathcal{D}} \{- \log p(Y|X;\theta) - \alpha(\cos(\tilde{x}, \tilde{q}))\},
\end{split}
\label{eq:7}
\end{equation} 
where $\mathcal{D}$ denotes a parallel training corpus.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Experiments}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Datasets}

To investigate the performance of the RRM, we evaluated the model performance on two natural language generation tasks: machine translation and response generation. As a directed generation task, machine translation constrains the output as a transformation of the input. Conversely, the response generation without such constraints is an open-ended generation task \cite{Holtzman2020The}.

We first used the IWSLT 2014 German-to-English translation dataset \cite{cettolo2014report} to evaluate the proposed method.
The dataset was split into 160k/7k/7k sentences for training, validation, and testing, respectively. 
As \citeA{cho2014properties} reported that seq2seq models tend to produce few unknown tokens and yield high BLEU scores for short sentences in neural machine translation tasks, 
we assumed that longer sentences could contain more repetitions because of the difficulty in aligning the attention between more tokens using the seq2seq model, and our proposal could perform better for longer sentences. 
Therefore, we divided the test data into three parts: \emph{short}, \emph{medium}, and \emph{long}. In \emph{short} with 4927 pairs, the source contained less than 25 byte pair encoding (BPE) \cite{sennrich2015neural} tokens. 
    In \emph{medium} with 1524 pairs, the source contained 26--50 BPE tokens. 
In \emph{long} with 299 pairs, the source contained more than 50 BPE tokens.
Additionally, we evaluated our method on the WMT 2014 English-to-German translation dataset \cite{bojar-etal-2014-findings}. We used the script\footnote{\url{https://github.com/facebookresearch/fairseq/blob/main/examples/translation/prepare-wmt14en2de.sh}} from fairseq \cite{ott2019fairseq} to follow the setup of \citeA{Gehring_conv_seq2seq_2017} to preprocess the dataset. The preprocessed dataset was split into 3.9M/3.9k sentences for training and validation, respectively. The newstest2014 dataset\footnote{\url{https://nlp.stanford.edu/projects/nmt/}} with 3k sentences was used for the test. We split the newstest2014 set into 1661, 1173, and 169 pairs for the \emph{short}, \emph{medium}, and \emph{long} parts, respectively.

We used the PERSONA-CHAT \cite{zhang2018personalizing} dataset for response generation task.
This is the official dataset of the conversational intelligence challenge 2 (ConvAI2)\footnote{\url{http://convai.io/}} used for testing chatbots. It contains 164k/15k/15k utterances (corresponding to 10k/1k/1k dialogs) for training, validation, and testing, respectively. It also contained the corresponding persona information for each dialog. An example is presented in Table \ref{table:10}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% table 2
\begin{table}[t]
\input{05table02.tex}%
\hangcaption{Sample responses generated by various models. {\color{red} \underline{Underline}} indicates repetitions that contain more than two words and {\color{blue} \textbf{bold}} indicates their counterparts. A turn is a pair of a query (an utterance) and its response (either a reference or a generation). In this example, a sequence of the three turns consist of a part of a dialog. When a model tries to output a response to the third query, the first and second turns are the historical utterances, and it receives the concatenation of the persona information, the historical utterances and the third query as an input. $\alpha$ was fixed to 0.3, which yielded the least repeat (sentence-level) under 1-gram on the validation dataset.}
\label{table:10} 
\end{table} 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Compared Methods}

To investigate the effectiveness of the proposed module, we compared the experimental results between models with and without the RRM on top of the baseline models. 

The vanilla transformer architecture \cite{vaswani2017attention} with different hyperparameter settings was utilized as the baseline for machine translation tasks.
We used the model of \citeA{fonollosa2019joint} as the baseline for the German-to-English task.
In contrast to the transformer structure, the neural network in \citeA{fonollosa2019joint} discards the independent \emph{encoder} to directly calculate the cross attention between the source and target tokens to predict the target sentence, which was similar to the autoregressive language model, generative pre-trained transformer (GPT) \cite{radford2018improving}. Hereafter, we denote this model as LocalJoint.

We considered the most effective model \cite{thomas2019transfertransfo} in ConvAI2 as the baseline for the response generation task. \citeA{thomas2019transfertransfo} adopted a GPT-based \emph{encoder} and a 12-layer transformer \emph{decoder}, and concatenated the persona information, up to two turns of historical utterances, and the query (the utterance) together as an input sequence. We denote this model as TransferTransfo. 
We also utilized a pre-trained transformer model, BART \cite{lewis-etal-2020-bart}, as the baseline for the response generation task. Previously concatenated sequences were used as the input sequences for the BART.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Evaluation Metrics}
\label{section:evaluation_metrics}

We used tokenized BLEU \cite{papineni2002BLEU}, Meteor \cite{denkowski:lavie:meteor-wmt:2014}, and repeat \cite{kiyono-etal-2018-reducing} for the machine translation tasks. The repetition is defined as follows: following the definitions in \citeA{kiyono-etal-2018-reducing} and \citeA{Fu_Lam_So_Shi_2021}, we believe that a model causes repetition if it outputs the same token more than once. For each pair of generated translations and their corresponding references in the dataset, because we considered that some tokens might occur more than once in the reference, the repeat was computed by subtracting the frequency of tokens in the reference from the frequency of tokens that occur more than once in the generated translation \cite{kiyono-etal-2018-reducing}. Additionally, we calculate the probability of each type of repetition, as described in Section \ref{section:types_of_repetition}.

For the response generation task, we used official evaluation metrics, F1 and Perplexity. The official method offered by ParlAI \cite{miller2017parlai} ignores words \{a, an, the\} and punctuations when computing F1. 
To compute perplexity, we followed \citeA{thomas2019transfertransfo} to indirectly predict word probability based on the ratio of probabilities of subwords because the official method requires a BPE vocabulary of 19304 tokens.
Unlike the machine translation task, the response generation task has no fixed answers. Therefore, in this task, we ignored the reference sequence when computing the repeats.
For each generated sequence, the repeat was computed by subtracting one from the frequency of tokens that occurred more than once in the generated sequence.
We calculated repeat scores under an n-gram setting at sentence- and dialog-level while ignoring the words \{a, an, the\} and punctuations.
We calculated the repeats only for each generated response at the sentence-level.
We calculated the repeat with the concatenation of a sequence of the generated responses in a dialog at the dialog-level. We also calculated the probability of word-, phrase-level consecutive, and total repetitions with each generated response while ignoring the words \{a, an, the\} and punctuations.\footnote{The probability of subsentence-level consecutive repetitions was not calculated because we ignored punctuations.}

We used a paired $t$-test to evaluate whether the differences in the repeat score and probability of each type of repetition were significant. $\dagger$, $\ddagger$, and $\S$ indicate that the difference between the baseline model and the baseline+RRM is significant, with \emph{p}-values of $<0.01$, $<0.05$, and $<0.1$, respectively.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Hyperparameters}
\label{sec:appendix_Hyperparmeters}

The hyperparameters used in each model are listed in Table \ref{table:hyperparameters}. We followed the experimental settings of \citeA{fonollosa2019joint} and utilized their public code\footnote{\url{https://github.com/jarfo/joint}} to reproduce and train the LocalJoint and LocalJoint+RRM models.
We used transformer architectures ``transformer\_iwslt\_de\_en'' and ``transformer\_wmt\_en\_de'' published by fairseq\footnote{\url{https://github.com/facebookresearch/fairseq/blob/main/fairseq/models/transformer/transformer_legacy.py}} for the German-to-English and English-to-German translation tasks, respectively.
Following previous studies,\footnote{\url{https://github.com/facebookresearch/fairseq/tree/main/examples/translation}}$^{,}$\footnote{\url{https://github.com/facebookresearch/fairseq/issues/346}} in the decoding steps, we used beam search \cite{wu2016google} with beam sizes of 5 and 4 for the German-to-English and English-to-German translation tasks, respectively.
To tune scaling factor $\alpha$ for LocalJoint+RRM and transformer+RRM, we set $\alpha$ to \{1, 0.3, 0.2, 0.05, 0.01\} and selected $\alpha$ with repeats as the evaluation metric for the validation dataset.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% table 3
\begin{table}[t]
\input{05table03.tex}%
\caption{List of hyperparameters used for each model.}
\label{table:hyperparameters}
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

For the response generation task, we used the experimental settings of \citeA{thomas2019transfertransfo} and utilized their public code\footnote{\url{https://github.com/huggingface/transfer-learning-conv-ai}} to reproduce and train the TransferTransfo and TransferTransfo+RRM models.
We used the HuggingFace\footnote{\url{https://github.com/huggingface/transformers}} \cite{wolf-etal-2020-transformers} to reproduce BART.
In the decoding step, we utilized the top 20 samplings \cite{fan-etal-2018-hierarchical} before selecting four beams via a beam search. 
To tune scaling factor $\alpha$ for TransferTransfo+RRM and BART+RRM, we set $\alpha$ to \{1, 0.3, 0.2, 0.05, 0.01\}. Because the RRM was designed to reduce repetitions at the sentence-level, we selected $\alpha$ with repeat (sentence-level) under 1-gram as the evaluation metric for the validation dataset.

The results of all baseline and baseline+RRM models were averaged over three runs using random seeds.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% table 4
\begin{table}[t]
\input{05table04.tex}%
\hangcaption{Experimental results on the IWSLT 2014 De-En test dataset. $\alpha$ was fixed to 0.3 and 0.01 for LocalJoint and transformer, respectively, which yielded the least repeat on the validation dataset. \textbf{Bold} indicates the least repeat, highest BLEU and Meteor scores with respect to different length settings.}
\label{table:2} 
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{German-to-English Results}
\label{sec:german_to_english_results}

The experimental results for the German-to-English translation task are presented in Table \ref{table:2}. The results indicate that combining RRM ($\alpha = 0.3$) with LocalJoint improves the repeat, BLEU, and Meteor scores. 
Utilizing the RRM ($\alpha = 0.01$) for the transformer also mitigated the repeat score and increased the BLEU score; however, it decreased the Meteor score.
We then compared the experimental results for \emph{short}, \emph{medium}, and \emph{long} to investigate the effectiveness of the RRM at different source sentence lengths. 
Similar to the results from \citeA{cho2014properties}, compared with the \emph{short} sentences, all models tended to have lower BLEU scores and more repetitions for \emph{long} sentences.
Conversely, the RRM performed relatively well for longer sentences. This reduces the number of repetitions and improves more BLEU on top of the baselines for longer sentences.
Although the RRM showed limited effect in reducing the number of repetitions for \emph{short} sentences, it assisted LocalJoint in reducing the repeat score by 0.335 points and improved the BLEU score by 0.25 points for \emph{long} sentences. Additionally, the RRM assisted the transformer in reducing the repeat score by 0.24 points and improving the BLEU score by 0.68 points for \emph{long} sentences.
These results indicate the effectiveness of the RRM for long sentences.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% table 5
\begin{table}[t]
\input{05table05.tex}%
\hangcaption{Probability (\%) of word-, phrase (number of words)-, subsentence-level consecutive, and total repetitions on the IWSLT 2014 De-En test dataset. $\alpha$ was fixed to 0.3 and 0.01 for LocalJoint and transformer, respectively, which yielded the least repeat on the validation dataset. \textbf{Bold} indicates the numbers closest to the reference scores with respect to different length settings.}
\label{table:iwslt_repetition}
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The statistics for different repetitions on the IWSLT 2014 De-En test dataset are summarized in Table \ref{table:iwslt_repetition}. By comparing the probability of total and consecutive repetitions, we suggest that in natural text (referring to source and reference texts), the most common type of repetition is nonconsecutive. The RRM exhibited no effect on the consecutive fragments, which could be because of the limited number of consecutive repetitions generated by the seq2seq model or in the natural text.
For the total repetitions, the LocalJoint and transformer with RRM obtained probabilities closer to the reference for \emph{medium} and \emph{long} sentences than those without RRM. 
These results also indicate the effectiveness of the RRM for longer sentences.
Additionally, the table illustrates a small gap ($<1$\%) in the probability of total repetition between the reference and predicted texts over the entire corpus. However, when considering word matching, the neural models achieved a high repeat score ($>6$ for \emph{long} sentences), as summarized in Table \ref{table:2}. We established that the neural models could correctly predict word frequency in most cases but misspelled the word. Thus, these models achieved a closer probability of repetitions to the reference; however, they had a high repeat score. An example of predicted sentences containing misspelled words for ``mmm'' is presented in Table \ref{tab:iw_example_repetition}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% table 6
\begin{table}[t]
\input{05table06.tex}%
\hangcaption{Sample translations on the IWSLT 2014 De-En test dataset. Words ``mhmm'' and ``hmm'' are misspelled ``mmm'' and could be calculated in the repeat score.}
\label{tab:iw_example_repetition}
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The top and bottom 20 words based on the degree of repeat reduction using the LocalJoint + RRM ($\alpha = 0.3$) are listed in Table \ref{table:5}. These results indicate that the LocalJoint+RRM reduced repetitions for high frequency words, whereas it exhibited no effect of reducing repetitions for ``.'' and ``\&apos;s.'' 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% table 7
\begin{table}[p]
\input{05table07.tex}%
\hangcaption{Top and bottom 20 words based on the degree of repeat reduction. They are listed in descending order of the repeat reduction by +RRM ($\alpha = 0.3$) on top of LocalJoint for the IWSLT 2014 De-En test dataset at \emph{long} length. Frequency denotes the word frequency in the training dataset, and its rank is denoted as frequency rank.}
\label{table:5} 
\end{table} 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{English-to-German Results}
\label{sec:english_to_german_results}

The experimental results for the English-to-German translation task are presented in Table \ref{table:wmt_14_ende}. 
Similar to the results in Table \ref{table:2}, using the RRM ($\alpha=0.3$) for the transformer reduced the repeat score by 0.115 points and increased the BLEU score by 0.45 points over the entire corpus. However, the transformer+RRM achieved a lower Meteor score than the transformer only. Compared with the \emph{short} and \emph{medium} sentences, using RRM could reduce more repeat scores by 0.308 points and improve more BLEU scores by 0.67 points for \emph{long} sentences.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% table 8
\begin{table}[t]
\input{05table08.tex}%
\hangcaption{Experimental results on the WMT 2014 En-De test dataset. $\alpha$ was fixed to 0.3, which yielded the least repeat on the validation dataset. \textbf{Bold} indicates the least repeat, and highest BLEU and Meteor scores with respect to different length settings.}
\label{table:wmt_14_ende}
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% fig. 3
\begin{figure}[t] 
\begin{center}
\includegraphics{30-2ia5f3.pdf}
\end{center}
\hangcaption{Distribution of baselines with and without RRM on the IWSLT 2014 De-En (left) and WMT 2014 En-De (right) test datasets.}
\label{fig:distribution_with_repeat}
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Figure \ref{fig:distribution_with_repeat} shows a positive slope between the repeat score and the length of the source sentence. In the WMT 2014 German-to-English test dataset, the slope of the transformer is steeper when the source sentence is longer, indicating a higher probability of generating repetitions for longer sentences. Furthermore, on the two machine translation datasets, using RRM to supervise the baseline relieved the steep slope.

The statistics for different repetitions on the WMT 2014 En-De test dataset are summarized in Table \ref{table:wmt_repetition}. The table shows a low probability ($<0.1$\%) of consecutive repetitions in both natural and predicted texts. In particular, the natural text contained no phrase- and subsentence-level consecutive repetitions. The probability gap of word-level consecutive repetitions between reference and transfomer was only 0.01\% over the entire corpus, indicating a limited number of redundant consecutive repetitions generated by the transformer. For the total repetitions, the transformer supervised by the RRM could generate fewer repetitions than the unsupervised transformer. 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% table 9
\begin{table}[t]
\input{05table09.tex}%
\hangcaption{Probability (\%) of word-, phrase (number of words)-, subsentence-level consecutive, and total repetitions on the WMT 2014 En-De test dataset. $\alpha$ was fixed to 0.3, which yielded the least repeat on the validation dataset. \textbf{Bold} indicates the numbers closest to the reference scores with respect to different length settings.}
\label{table:wmt_repetition}
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Response Generation Results}
\label{sec:response_generation_results}

The experimental results of the response generation task are presented in Table \ref{table:7}. The RRM for TransferTransfo reduced the repeat scores by 0.056 (sentence-level) (1-gram) and 0.471 (dialog-level) (1-gram) points. The results indicate that combining the RRM with TransferTransfo improves F1 and repeat, whereas the performance of the RRM in reducing perplexity is limited. We suppose that there are two reasons for the performance of the RRM on perplexity. First, the probability calculation method proposed in \citeA{thomas2019transfertransfo} is indirect. 
Second, the responses were not fixed for a given source. 
The pre-trained seq2seq model, BART, generated fewer sentence-level repetitions and achieved a higher F1 score of 21.14 but a higher perplexity of 85.48 than TransferTransfo. This high perplexity may have also been caused by indirect probability calculations. Using the RRM for BART mitigates repeats by 0.013 (sentence-level) (1-gram) and 0.361 (dialog-level) (1-gram) points. These results indicate the effectiveness of the RRM for the TransferTransfo model to reduce the number of sentence-level repetitions than BART.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% table 10
\begin{table}[t]
\input{05table10.tex}%
\hangcaption{Experimental results on the PERSONA-CHAT test dataset. $\alpha$ was fixed to 0.3 for both baselines, which yielded the least repeat (sentence-level) under 1-gram on the validation dataset. \textbf{Bold} indicates the least repeat, perplexity, and highest F1 scores for different levels.}
\label{table:7} 
\end{table} 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

We conducted extensive experiments to investigate whether the RRM has the potential to reduce the number of repetitions by considering the following conditions:
First, beam search is an optimized decoding method that generates fewer repetitions than greedy decoding, which may limit the performance of the RRM. We investigated whether decoding methods influenced the performance of the RRM by comparing beam search with greedy decoding. 

Second, \citeA{thomas2019transfertransfo} used persona information and historical utterances as input sequences for their model to generate a response that differed from the history and contained part of the persona information.
However, in the task, our model shares its vocabulary between the source and target sides; in Eq.~(\ref{eq:3}), we utilize the cosine similarity to force $\tilde{q}$ to be similar to $\tilde{x}$, which may make the generated response similar to the input sequence. 
Therefore, we investigated whether using historical utterances in the input sequence during inference could affect the performance of the RRM. ``w/o history'' indicates the case where the historical utterances were not used for an input sequence during inference. 

Third, historical utterances may contain part of the persona information, which can cause additional repetitions in Eq.~(\ref{eq:4}). The RRM could be misled into producing more repetitions at the sentence-level and hence more repetitions at the dialog-level.
Therefore, we investigated whether using the persona information and historical utterances in Eq.~(\ref{eq:4}) during training affects the performance of the RRM. The \emph{full} setting indicates the usage of the persona information, historical utterances, and query as a source in Eq.~(\ref{eq:4}) during training, whereas the \emph{part} setting indicates the usage of only the query. We also set \emph{divide} to divide the input sequence in Eq.~(\ref{eq:4}) into three parts: $\tilde{x}_p$, $\tilde{x}_h$, and $\tilde{x}_l$, depending on the personal information, historical utterances, and query, and uses the corresponding $W_{q_p}$, $W_{q_h}$, and $W_{q_l}$ in Eq.~(\ref{eq:6}) to compute $\tilde{q}_p$, $\tilde{q}_h$, and $\tilde{q}_l$, respectively. Subsequently, the average cosine similarity was calculated between each divided $\tilde{x}$ and $\tilde{q}$.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% table 11
\begin{table}[b]
\input{05table11.tex}%
\hangcaption{Results of the extensive experiments on the PERSONA-CHAT test dataset. \textbf{Bold} indicates the least repeat, perplexity, and highest F1 scores for each setting. Because perplexity does not depend on the decoding method, we report it only once in the table. For each setting, we fixed $\alpha$ to the value that yielded the least repeat (sentence-level) under 1-gram on the validation dataset.}
\label{table:11} 
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% table 12
\begin{table}[b]
\input{05table12.tex}%
\hangcaption{Experimental results for BART and BART+RRM on the PERSONA-CHAT test dataset with greedy decoding. $\alpha$ was fixed to 0.2, which yielded the least repeat (sentence-level) under 1-gram on the validation dataset. \textbf{Bold} indicates the least repeat and highest F1 scores for different levels.}
\label{table:bart_greedy} 
\end{table} 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The results of the extensive experiments are presented in Table \ref{table:11}. 
Clearly, when using beam search, the RRM reduced the number of repetitions at both the sentence- and dialog-level (1-gram) and improved the F1 scores of the TransferTransfo model more than for greedy decoding. 
Compared to that excluding historical utterances, the RRM utilizing historical utterances during inference could improve F1 scores more but reduce fewer repetitions for the TransferTransfo model.
In addition, when the input sequence excluded the history during the inference, the RRM trained with \emph{part} setting in Eq.~(\ref{eq:4}) is more effective in reducing sentence-level repetitions (1-gram) than when using \emph{full} setting. This indicates that our third supposition is incorrect and the \emph{part} setting is unstable. 
We believe that the cause for the unstable performance is that when using the \emph{part} setting, $\tilde{q}$ and $\tilde{x}$ in Eq.~(\ref{eq:3}) are generated from the full input sequence and only a part of the input sequence, which makes the information unbalanced.
The \emph{divide} setting performed the worst among the \emph{full}, \emph{divide}, and \emph{part} settings. 
The results of BART and BART+RRM when greedy decoding is used on the PERSONA-CHAT test dataset are presented in Table \ref{table:bart_greedy}. Using RRM for BART reduced repeats by 0.027 (sentence-level) (1-gram) and 0.09 (dialog-level) (1-gram) points. Compared with beam search, when using greedy decoding, the RRM reduced more sentence-level repetitions (1-gram) and fewer dialog-level repetitions (1-gram) for BART.
The statistics for different repetitions of the PERSONA-CHAT test dataset are summarized in Table \ref{table:response_repetition}. Distinct from the two machine translation datasets, TransferTransfo and transformer started to generate phrases \#3- and \#4-level consecutive repetitions. This could be because the PERSONA-CHAT was an open-ended dataset with a high probability of the popular phrases, e.g., ``I do not.'' When using greedy decoding, the generated phrases \#3- and \#4-level consecutive, and total repetitions would be approximately twice as long as when using beam search. This result indicates the effectiveness of beam search in mitigating the number of repetitions. 
Compared with beam search, both baselines, TransferTransfo and BART, with RRM can reduce phrases \#3- and \#4-level consecutive repetitions when using greedy decoding. Meanwhile, the two baselines with RRM still achieved a closer probability of total repetitions to natural texts compared to those without RRM.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% table 13
\begin{table}[t]
\input{05table13.tex}%
\hangcaption{Probability (\%) of word-, phrase (number of words)-level consecutive, and total repetitions on the PERSONA-CHAT test dataset. {\bf Bold} indicates the numbers closest to the reference scores for each setting.}
\label{table:response_repetition}
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

These results indicate that when the RRM is utilized, the method for combining multiple pieces of information for the input sequence is important. Furthermore, the decoding method affects the performance of the RRM.
A sample dialog is presented in Table \ref{table:10}. Similar to the machine translation task, the TransferTransfo model generated repeated phrases, which was alleviated by the proposed model. In particular, ``i 'm a real estate agent'' in the second turn is a 5-gram nonconsecutive repetition of the one in the first turn at the dialog-level when the word ``a'' is ignored. 
``they are twins'' in the third turn is a 3-gram consecutive repetition at both the sentence- and dialog-level because it is generated twice in a response. 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Related Work}

To overcome the problem of repetition in neural machine translation, 
\citeA{tu2016modeling} and \citeA{mi2016coverage} introduced the coverage mechanism into a seq2seq model; thus, the \emph{decoder} can pay attention to the \emph{encoder} information without duplication.
\citeA{see2017get} extended the coverage model by incorporating a pointer-generator network based on \citeA{tu2016modeling}.
However, it is difficult to utilize these coverage methods %these methods 
for multihead attention-based models because multihead attention is a stack of several attention layers, and each layer is trained to capture its own distribution. 
Furthermore, \citeA{tu2016modeling} and \citeA{mi2016coverage} are based on one-to-one correspondence generation, which cannot be applied to ``lossy'' compression tasks such as summarization.

\citeA{suzuki2016cutting} proposed WFE, which 
used several linear transformations to map the hidden states of the \emph{encoder} to the upper-bound occurrence of each target vocabulary and controlled the generation using the estimated occurrence. However, we could not apply WFE % to their methods
for certain generation tasks, such as the response generation task, in which the frequency of the target tokens is irrelevant to the source sentence. 
\citeA{kiyono-etal-2018-reducing} proposed an SPM and assumed that the output sentences are shorter than the input sentences (i.e., a summary or a headline of the input). 
To ensure that the lengths of the input and output sentences were equal, special $<$pad$>$ tokens were added at the end of the target sentence. 
Although this method helps SPM estimate over- or under-generation using the Euclidean distance, it limits the application of the SPM. %their model.
Because our approach does not rely on the above assumptions, the RRM is more scalable for other downstream tasks, including machine translation and response generation.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Conclusion}

In this study, we propose a novel mechanism to suppress repetitions in machine translation and response generation.
Our model attempts to estimate the %average 
semantic vectors from a source sentence on both sides of an \emph{encoder}-\emph{decoder} model that considers semantic repetitions and does not rely on attention features.
Therefore, our proposed method can be applied to other seq2seq models, which is an advantage over previous methods.

The experimental results of the IWSLT 2014 German-to-English, WMT 2014 English-to-German machine translation tasks, and PERSONA-CHAT response generation task demonstrated the effectiveness of our proposal.
The results of extensive experiments on the response generation task demonstrated that the RRM can handle a concatenated input sequence.

Because our proposal considers semantic repetitions, we believe that it can reduce the number of repetitions among semantically similar words. This will be verified in a future study.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\acknowledgment

This paper is an extended and revised version of \citeA{zhang-etal-2021-generic} accepted for publication at the 13th Conference on Recent Advances in Natural Language Processing (RANLP 2021). This version has revised the grammar and introduced more details about the seq2seq model, autoencoder model, coverage mechanism, types of repetition, and our proposed RRM in the Abstract, Sections 1, 2, 3, and 4. This version also added experiments to evaluate the performances of models concerning diverse repetitions and on the WMT 2014 English-to-German dataset and added the vanilla transformer model as a baseline for comparison.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\bibliographystyle{jnlpbbl_1.7}
\bibliography{05refs}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{biography}

\bioauthor[:]{Ying Zhang}{%
Ying Zhang is currently a Ph.D. candidate in the Department of Information and Communications Engineering, Tokyo Institute of Technology. Before that, she received a B.S. in Management from Chongqing University in 2017 and her M.E. from the Tokyo Institute of Technology in 2019. Her current research interests include natural language processing and machine learning.
}

\bioauthor[:]{Hidetaka Kamigaito}{%
Hidetaka Kamigaito received his Ph.D. from the Tokyo Institute of Technology and is currently an associate professor at the Nara Institute of Science and Technology. His current research interests include natural language processing with an emphasis on document-level text processing and knowledge graph completion.
}

\bioauthor[:]{Tatsuya Aoki}{%
Tatsuya Aoki is a machine-learning engineer at Apple Inc., where he works on natural language processing for Eastern Asian languages.
He received an M.S. in Engineering from the Tokyo Institute of Technology and B.S. in Information and Media from the University of Tsukuba.
}

\bioauthor[:]{Hiroya Takamura}{%
Hiroya Takamura received his Ph.D. from the Nara Institute of Science and
Technology. He has worked as a professor at the Tokyo Institute of Technology and is currently a research team leader at the AI Research Center of the National Institute of Advanced Industrial Science and Technology. His current research interests include natural language processing. 
}

\bioauthor[:]{Manabu Okumura}{%
Manabu Okumura was born in 1962. He received B.E., M.E., and Dr. Eng. from Tokyo Institute of Technology in 1984, 1986, and 1989, respectively. He was an assistant in the Department of Computer Science, Tokyo Institute of Technology, from 1989 to 1992, and an associate professor at the School of Information Science, Japan Advanced Institute of Science and Technology, from 1992 to 2000. He is currently a professor at the Institute of Innovative Research at Tokyo Institute of Technology, Japan. His current research interests include natural language processing, particularly text summarization, computer-assisted language learning, sentiment analysis, and text data mining.
}

\end{biography}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\biodate



\end{document}

