Temporal Convolutional Attention-based Network For Sequence Modeling

Hongyan Hao, Yan Wang, Siqiao Xue, Yudi Xia, Jian Zhao, Furao Shen

TL;DR

The Temporal Convolutional Attention-based Network (TCAN) is a novel architecture that merges the parallel efficiency of Temporal Convolutional Networks (TCNs) with the global dependency-tracking power of self-attention. By introducing a "Temporal Attention" mechanism and a parameter-free "Enhanced Residual" connection, TCAN achieves state-of-the-art results on language modeling benchmarks while remaining significantly smaller and faster than massive models like GPT-2.

What Problem Does This Paper Address?

For years, Recurrent Neural Networks (RNNs) like LSTMs were the "default" for sequence modeling. However, RNNs have two major flaws: they are inherently sequential (making them slow to train on modern GPUs) and they often struggle to capture very long-range dependencies despite their theoretical "infinite memory."

Feed-forward alternatives have emerged, but they come with trade-offs. TCNs are fast and parallelizable but often miss internal correlations within a sequence. Transformers (attention-based) are excellent at capturing global context but can become prohibitively large and computationally expensive. The authors of this paper sought a "middle way": an architecture that satisfies the strict causality of sequence modeling (no looking at the future) while absorbing the best traits of both convolutions and attention.

Methods

TCAN is built on an encoder-decoder structure using dilated causal convolutions. The core innovation lies in two sub-modules integrated into each layer:

  1. Temporal Attention (TA): Inspired by the Transformer's self-attention, TA integrates information from previous time steps into the current one. To maintain causality, the authors apply a mask to the weight matrix (a lower triangular part), ensuring the model never "leaks" information from future time steps into the past.
  2. Enhanced Residual (ER): Standard residual connections (skip connections) simply add the input of a layer to its output. ER goes a step further by using the attention weights already calculated in the TA block to highlight the most important features. Crucially, this "reinforcement" of important information adds zero extra parameters to the model.
Figure 1: Architectural overall and an inter-layer transformation diagram. (a) An overall of whole architecture including Input layer, Hidden layer and Output layer, the green square indicates TCAN; (b) Inter-layer transformation of TCAN, gray squares indicate the intermediate variable of temporal attention and convolution, yellow block indicate the enhanced residual.

Datasets

The authors evaluated TCAN on three standard language modeling benchmarks:

  • Penn Treebank (PTB) - Word-level: A small but classic dataset for testing perplexity.
  • Penn Treebank (PTB) - Character-level: A medium-sized dataset focused on predicting the next character.
  • WikiText-2 (WT2): A larger dataset (2 million words) that retains original capitalization and punctuation, making it more complex than PTB.

Key Insights and Ideas

  • Hybrid Strength: The paper demonstrates that convolutions and attention are not mutually exclusive. Convolutions are great at extracting local features, while Temporal Attention allows the model to "jump" across the sequence to find distant relevant data points.
  • Efficiency via Masking: By refining the weight matrix to be lower-triangular, the authors successfully adapted global attention for auto-regressive tasks without sacrificing the ability to train in parallel.
  • Smart Residuals: The "Enhanced Residual" is a clever "aha moment." Since the model has already spent the computational effort to determine which time steps are important (via the attention weights), using those same weights to scale the residual connection provides a performance boost for "free."

Key Results

TCAN consistently outperformed both traditional RNNs and much larger feed-forward models across all tested datasets.

  • WikiText-2: TCAN achieved a perplexity of 9.20, vastly outperforming GPT-2 (18.34) and AWD-LSTM (44.3) on this specific task.
  • Model Size: On the WikiText-2 task, TCAN achieved these results with only 33M parameters, compared to GPT-2’s massive 1542M parameters.
  • Ablation Studies: The authors proved that the Temporal Attention layer is significantly more effective than simply adding more convolutional layers. Replacing TA with extra convolutions caused the perplexity to jump from 36.85 to 151.98.
Comparison of TCAN against other models on the WikiText-2 dataset, highlighting its superior perplexity (ppl) despite a smaller size.

Limitations and Future Work

While TCAN shows remarkable efficiency, the paper focuses primarily on language modeling. The authors mention that sequence modeling spans domains like audio and music processing, but they do not provide experimental data for these non-textual tasks. Additionally, while the Enhanced Residual adds no parameters, the overall depth of the network (stacking $L$ layers) still requires careful hyperparameter tuning regarding dilation rates and kernel sizes to ensure the receptive field is sufficient for the specific task at hand. Future work could involve testing TCAN on multi-modal sequence tasks or further optimizing the interaction between dilation and attention spans.

Summary updated

BibTeX
@misc{hao2020temporal,
  author = {Hongyan Hao and Yan Wang and Siqiao Xue and Yudi Xia and Jian Zhao and Furao Shen},
  title = {{Temporal Convolutional Attention-based Network For Sequence Modeling}},
  year = {2020},
  eprint = {2002.12530},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2002.12530},
}
Figure