Introduction
Sequence-to-sequence models that use an attention mechanism to align the input and output sequences BIBREF0, BIBREF1 are currently the predominant paradigm in end-to-end TTS. Approaches based on the seminal Tacotron system BIBREF2 have demonstrated naturalness that rivals that of human speech for certain domains BIBREF3. Despite these successes, there are sometimes complaints of a lack of robustness in the alignment procedure that leads to missing or repeating words, incomplete synthesis, or an inability to generalize to longer utterances BIBREF4, BIBREF5, BIBREF6.
The original Tacotron system BIBREF2 used the content-based attention mechanism introduced in BIBREF1 to align the target text with the output spectrogram. This mechanism is purely content-based and does not exploit the monotonicity and locality properties of TTS alignment, making it one of the least stable choices. The Tacotron 2 system BIBREF3 used the improved hybrid location-sensitive mechanism from BIBREF7 that combines content-based and location-based features, allowing generalization to utterances longer than those seen during training.
The hybrid mechanism still has occasional alignment issues which led a number of authors to develop attention mechanisms that directly exploit monotonicity BIBREF8, BIBREF4, BIBREF5. These monotonic alignment mechanisms have demonstrated properties like increased alignment speed during training, improved stability, enhanced naturalness, and a virtual elimination of synthesis errors. Downsides of these methods include decreased efficiency due to a reliance on recursion to marginalize over possible alignments, the necessity of training hacks to ensure learning doesn't stall or become unstable, and decreased quality when operating in a more efficient hard alignment mode during inference.
Separately, some authors BIBREF9 have moved back toward the purely location-based GMM attention introduced by Graves in BIBREF0, and some have proposed stabilizing GMM attention by using softplus nonlinearities in place of the exponential function BIBREF10, BIBREF11. However, there has been no systematic comparison of these design choices.
In this paper, we compare the content-based and location-sensitive mechanisms used in Tacotron 1 and 2 with a variety of simple location-relative mechanisms in terms of alignment speed and consistency, naturalness of the synthesized speech, and ability to generalize to long utterances. We show that GMM-based mechanisms are able to generalize to very long (potentially infinite-length) utterances, and we introduce simple modifications that result in improved speed and consistency of alignment during training. We also introduce a new location-relative mechanism called Dynamic Convolution Attention that modifies the hybrid location-sensitive mechanism from Tacotron 2 to be purely location-based, allowing it to generalize to very long utterances as well.
Two Families of Attention Mechanisms ::: Basic Setup
The system that we use in this paper is based on the original Tacotron system BIBREF2 with architectural modifications from the baseline model detailed in the appendix of BIBREF11. We use the CBHG encoder from BIBREF2 to produce a sequence of encoder outputs, $\lbrace j\rbrace _{j=1}^L$, from a length-$L$ input sequence of target phonemes, $\lbrace \mathbf {x}_j\rbrace _{j=1}^L$. Then an attention RNN, (DISPLAY_FORM2), produces a sequence of states, $\lbrace \mathbf {s}_i\rbrace _{i=1}^T$, that the attention mechanism uses to compute $\mathbf {\alpha }_i$, the alignment at decoder step $i$. Additional arguments to the attention function in () depend on the specific attention mechanism (e.g., whether it is content-based, location-based, or both). The context vector, $\mathbf {c}_i$, that is fed to the decoder RNN is computed using the alignment, $\mathbf {\alpha }_i$, to produce a weighted average of encoder states. The decoder is fed both the context vector and the current attention RNN state, and an output function produces the decoder output, $\mathbf {y}_i$, from the decoder RNN state, $\mathbf {d}_i$.
Two Families of Attention Mechanisms ::: GMM-Based Mechanisms
An early sequence-to-sequence attention mechanism was proposed by Graves in BIBREF0. This approach is a purely location-based mechanism that uses an unnormalized mixture of $K$ Gaussians to produce the attention weights, $\mathbf {\alpha }_i$, for each encoder state. The general form of this type of attention is shown in (DISPLAY_FORM4), where $\mathbf {w}_i$, $\mathbf {Z}_i$, $\mathbf {\Delta }_i$, and $\mathbf {\sigma }_i$ are computed from the attention RNN state. The mean of each Gaussian component is computed using the recurrence relation in (), which makes the mechanism location-relative and potentially monotonic if $\mathbf {\Delta }_i$ is constrained to be positive.
In order to compute the mixture parameters, intermediate parameters ($\hat{\mathbf {w}}_i,\hat{\mathbf {\Delta }}_i,\hat{\mathbf {\sigma }}_i$) are first computed using the MLP in (DISPLAY_FORM5) and then converted to the final parameters using the expressions in Table TABREF6.
The version 0 (V0) row in Table TABREF6 corresponds to the original mechanism proposed in BIBREF0. V1 adds normalization of the mixture weights and components and uses the exponential function to compute the mean offset and variance. V2 uses the softplus function to compute the mean offset and standard deviation.
Another modification we test is the addition of initial biases to the intermediate parameters $\hat{\mathbf {\Delta }}_i$ and $\hat{\mathbf {\sigma }}_i$ in order to encourage the final parameters $\mathbf {\Delta }_i$ and $\mathbf {\sigma }_i$ to take on useful values at initialization. In our experiments, we test versions of V1 and V2 GMM attention that use biases that target a value of $\mathbf {\Delta }_i=1$ for the initial forward movement and $\mathbf {\sigma }_i=10$ for the initial standard deviation (taking into account the different nonlinearities used to compute the parameters).
Two Families of Attention Mechanisms ::: Additive Energy-Based Mechanisms
A separate family of attention mechanisms use an MLP to compute attention energies, $\mathbf {e}_i$, that are converted to attention weights, $\mathbf {\alpha }_i$ using the softmax function. This family includes the content-based mechanism introduced in BIBREF1 and the hybrid location-sensitive mechanism from BIBREF7. A generalized formulation of this family is shown in (DISPLAY_FORM8).
Here we see the content-based terms, $W\mathbf {s}_i$ and $Vj$, that represent query/key comparisons and the location-sensitive term, $U{i,j}$, that uses convolutional features computed from the previous attention weights as in () BIBREF7. Also present are two new terms, $T\mathbf {g}_{i,j}$ and $p_{i,j}$, that are unique to our proposed Dynamic Convolution Attention. The $T\mathbf {g}_{i,j}$ term is very similar to $U{i,j}$ except that it uses dynamic filters that are computed from the current attention RNN state as in (). The $p_{i,j}$ term is the output of a fixed prior filter that biases the mechanism to favor certain types of alignment. Table TABREF9 shows which of the terms are present in the three energy-based mechanisms we compare in this paper.
Two Families of Attention Mechanisms ::: Dynamic Convolution Attention
In designing Dynamic Convolution Attention (DCA), we were motivated by location-relative mechanisms like GMM attention, but desired fully normalized attention weights. Despite the fact that GMM attention V1 and V2 use normalized mixture weights and components, the attention weights still end up unnormalized because they are sampled from a continuous probability density function. This can lead to occasional spikes or dropouts in the alignment, and attempting to directly normalize GMM attention weights results in unstable training. Attention normalization isn't a significant problem in fine-grained output-to-text alignment, but becomes more of an issue for coarser-grained alignment tasks where the attention window needs to gradually move to the next index (for example in variable-length prosody transfer applications BIBREF12). Because DCA is in the energy-based attention family, it is normalized by default and should work well for a variety of monotonic alignment tasks.
Another issue with GMM attention is that because it uses a mixture of distributions with infinite support, it isn't necessarily monotonic. At any time, the mechanism could choose to emphasize a component whose mean is at an earlier point in the sequence, or it could expand the variance of a component to look backward in time, potentially hurting alignment stability.
To address monotonicity issues, we make modifications to the hybrid location-sensitive mechanism. First we remove the content-based terms, $W\mathbf {s}_i$ and $Wi$, which prevents the alignment from moving backward due to a query/key match at a past timestep. Doing this prevents the mechanism from adjusting its alignment trajectory as it is only left with a set of static filters, $U{i,j}$, that learn to bias the alignment to move forward by a certain fixed amount. To remedy this, we add a set of learned dynamic filters, $T\mathbf {g}_{i,j}$, that are computed from the attention RNN state as in (). These filters serve to dynamically adjust the alignment relative to the alignment at the previous step.
In order to prevent the dynamic filters from moving things backward, we use a single fixed prior filter to bias the alignment toward short forward steps. Unlike the static and dynamic filters, the prior filter is a causal filter that only allows forward progression of the alignment. In order to enforce the monotonicity constraint, the output of the filter is converted to the logit domain via the log function before being added to the energy function in (DISPLAY_FORM8) (we also floor the prior logits at $-10^6$ to prevent underflow).
We set the taps of the prior filter using values from the beta-binomial distribution, which is a two-parameter discrete distribution with finite support.
where $\textrm {B}(\cdot )$ is the beta function. For our experiments we use the parameters $\alpha =0.1$ and $\beta =0.9$ to set the taps on a length-11 prior filter ($n=10$), Repeated application of the prior filter encourages an average forward movement of 1 encoder step per decoder step ($\mathbb {E}[k] = \alpha n/(\alpha +\beta )$) with the uncertainty in the prior alignment increasing after each step. The prior parameters could be tailored to reflect the phonemic rate of each dataset in order to optimize alignment speed during training, but for simplicity we use the same values for all experiments. Figure FIGREF12 shows the prior filter along with the alignment weights every 20 decoder steps when ignoring the contribution from other terms in (DISPLAY_FORM8).
Experiments ::: Experiment Setup
In our experiments we compare the GMM and additive energy-based families of attention mechanisms enumerated in Tables TABREF6 and TABREF9. We use the Tacotron architecture described in Section SECREF1 and only vary the attention function used to compute the attention weights, $\mathbf {\alpha }_i$. The decoder produces two 128-bin, 12.5ms-hop mel spectrogram frames per step. We train each model using the Adam optimizer for 300,000 steps with a gradient clipping threshold of 5 and a batch size of 256, spread across 32 Google Cloud TPU cores. We use an initial learning rate of $10^{-3}$ that is reduced to $5\times 10^{-4}$, $3\times 10^{-4}$, $10^{-4}$, and $5\times 10^{-5}$ at 50k, 100k, 150k, and 200k steps, respectively. To convert the mel spectrograms produced by the models into audio samples, we use a separately-trained WaveRNN BIBREF13 for each speaker.
For all attention mechanisms, we use a size of 128 for all tanh hidden layers. For the GMM mechanisms, we use $K=5$ mixture components. For location-sensitive attention (LSA), we use 32 static filters, each of length 31. For DCA, we use 8 static filters and 8 dynamic filters (all of length 21), and a length-11 causal prior filter as described in Section SECREF10.
We run experiments using two different single-speaker datasets. The first (which we refer to as the Lessac dataset) comprises audiobook recordings from Catherine Byers, the speaker from the 2013 Blizzard Challenge. For this dataset, we train on a 49,852-utterance (37-hour) subset, consisting of utterances up to 5 seconds long, and evaluate on a separate 935-utterance subset. The second is the LJ Speech dataset BIBREF14, a public dataset consisting of audiobook recordings that are segmented into utterances of up to 10 seconds. We train on a 12,764-utterance subset (23 hours) and evaluate on a separate 130-utterance subset.
Experiments ::: Alignment Speed and Consistency
To test the alignment speed and consistency of the various mechanisms, we run 10 identical trials of 10,000 training steps and plot the MCD-DTW between a ground truth holdout set and the output of the model during training. The MCD-DTW is an objective similarity metric that uses dynamic time warping (DTW) to find the minimum mel cepstral distortion (MCD) BIBREF15 between two sequences. The faster a model is able to align with the text, the faster it will start producing reasonable spectrograms that produce a lower MCD-DTW.
Figure FIGREF15 shows these trials for 8 different mechanisms for both the Lessac and LJ datasets. Content-based (CBA), location-sensitive (LSA), and DCA are the three energy-based mechanisms from Table TABREF9, and the 3 GMM varieties are shown in Table TABREF6. We also test the V1 and V2 GMM mechanisms with an initial parameter bias as described in Section SECREF3 (abbreviated as GMMv1b and GMMv2b).
Looking at the plots for the Lessac dataset (top of Figure FIGREF15), we see that the mechanisms on the top row (the energy-based family and GMMv2b) all align consistently with DCA and GMMv2b aligning the fastest. The GMM mechanisms on the bottom row don't fare as well, and while they typically align more often than not, there are a significant number failures or cases of delayed alignment. It's interesting to note that adding a bias to the GMMv1 mechanism actually hurts its consistency while adding a bias to GMMv2 helps it.
Looking at the plots for the LJ dataset at bottom of Figure FIGREF15, we first see that the dataset is more difficult in terms of alignment. This is likely due to the higher maximum and average length of the utterances in the training data (most utterances in the LJ dataset are longer than 5 seconds) but could also be caused by an increased presence of intra-utterance pauses and overall lower audio quality. Here, the top row doesn't fare as well: CBA has trouble aligning within the first 10k steps, while DCA and GMMv2b both fail to align once. LSA succeeds on all 10 trials but tends to align more slowly than DCA and GMMv2b when they succeed. With these consistency results in mind, we will only be testing the top row of mechanisms in subsequent evaluations.
Experiments ::: In-Domain Naturalness
We evaluate CBA, LSA, DCA, and GMMv2b using mean opinion score (MOS) naturalness judgments produced by a crowd-sourced pool of raters. Scores range from 1 to 5, with 5 representing “completely natural speech”. The Lessac and LJ models are evaluated on their respective test sets (hence in-domain), and the results are shown in Table TABREF17. We see that for these utterances, the LSA, DCA, and GMMV2b mechanisms all produce equivalent scores around 4.3, while the content-based mechanism is a bit lower due to occasional catastrophic attention failures.
Experiments ::: Generalization to Long Utterances
Now we evaluate our models on long utterances taken from two chapters of the Harry Potter novels. We use 1034 utterances that vary between 58 and 1648 characters (10 and 299 words). Google Cloud Speech-To-Text is used to produce transcripts of the resulting audio output, and we compute the character errors rate (CER) between the produced transcripts and the target transcripts.
Figure FIGREF20 shows the CER results as the utterance length is varied for the Lessac models (trained on up to 5 second utterances) and LJ models (trained on up to 10 second utterances). The plots show that CBA fares the worst with the CER shooting up when the test length exceeds the max training length. LSA shoots up soon after at around 3x the max training length, while the two location-relative mechanisms, DCA and GMMv2b, are both able to generalize to the whole range of utterance lengths tested.
Discussion
We have shown that Dynamic Convolution Attention (DCA) and our V2 GMM attention with initial bias (GMMv2b) are able to generalize to utterances much longer than those seen during training, while preserving naturalness on shorter utterances. This opens the door for synthesis of entire paragraph or long sentences (e.g., for book or news reading applications), which can improve naturalness and continuity compared to synthesizing each sentence or clause separately and then stitching them together.
These two location-relative mechanisms are simple to implement and do not rely on dynamic programming to marginalize over alignments. They also tend to align very quickly during training, which makes the occasional alignment failure easy to detect so training can be restarted. In our alignment trials, despite being slower to align on average, LSA attention seemed to have an edge in terms of alignment consistency; however, we have noticed that slower alignment can sometimes lead to worse quality models, probably because the other model components are being optimized in an unaligned state for longer.
Compared to GMMv2b, DCA can more easily bound its receptive field (because its prior filter numerically disallows excessive forward movement), which makes it easier to incorporate hard windowing optimizations in production. Another advantage of DCA over GMM attention is that its attention weights are normalized, which helps to stabilize the alignment, especially for coarse-grained alignment tasks.
For monotonic alignment tasks like TTS and speech recognition, location-relative attention mechanisms have many advantages and warrant increased consideration and further study. Supplemental materials, including audio examples, are available on the web.

Question: Does DCA or GMM-based attention perform better in experiments?
Answer: About the same performance

Question: How they compare varioius mechanisms in terms of naturalness?
Answer: using mean opinion score (MOS) naturalness judgments produced by a crowd-sourced pool of raters