Abstract: The Transformer architecture has become increasingly popular over the past two years, owing to its impressive performance on a number of natural language processing (NLP) tasks. However, all Transformer computations occur at the level of word representations and therefore, it may be argued that Transformer models do not explicitly attempt to learn hierarchical structure which is widely assumed to be integral to language. In the present work, we introduce hierarchical processing into the Transformer model, taking inspiration from the U-Net architecture, popular in computer vision for its hierarchical view of natural images. We empirically demonstrate that the proposed architecture outperforms both the vanilla Transformer and some strong baselines in the domain of chit-chat dialogue.
Introduction
While the Transformer architecture has revolutionized NLP, it suffers from a structural "flatness." All computations occur at the level of individual word representations, whereas human language is inherently hierarchical: words form phrases, phrases form sentences, and sentences form high-level topics or "trajectories."
In conversational dialogue, this lack of hierarchy is particularly problematic. An effective chatbot needs to track both low-level word choices and the high-level flow of a conversation. Standard Transformers lack an explicit mechanism to learn these multi-level abstractions, often struggling to maintain a coherent "big picture" over long dialogue histories. Researchers from UMass Lowell have addressed this by developing the U-Net Transformer, an architecture that brings hierarchical processing to the standard Transformer encoder.
Methodology
The U-Net Transformer encoder adopts an "hourglass" structure inspired by computer vision. While the decoder remains a standard vanilla Transformer, the encoder is modified with specialized "Down" and "Up" layers to facilitate multi-scale representation.
Architectural Components
- Down Layers (Compression): These layers use a 1D convolution (kernel size 3) to aggregate local information, followed by a max-pooling operation (stride 2). This effectively halves the number of tokens while increasing the embedding dimension (by a factor of $\sqrt{2}$) to maintain constant computational complexity.
- Up Layers (Expansion): These layers use deconvolution to increase the number of tokens back to the original sequence length while decreasing the embedding size.
- Skip Connections: To prevent the loss of fine-grained information during compression, representations from the "Down" layers are added directly to their corresponding "Up" layers using element-wise addition.
- Hierarchical Attention: The attention mechanism is modified so that the abstract, post-convolution tokens act as queries to look over the original, low-level input tokens (keys and values). This allows the model to use high-level "concepts" to extract relevant details from the raw text.
Evaluation and Results
The model was evaluated on two major dialogue benchmarks: Cornell Movie Dialogues (60,000 script exchanges) and PersonaChat (conversations with specific assigned personas). PersonaChat, with an average of 14 utterances per history, provided a robust test for the model's ability to handle abstract representations over time.
Key Findings
- Performance Gains: The U-Net Transformer consistently outperformed vanilla Transformers and several hierarchical RNN baselines. On Cornell Movie Dialogues, it achieved a test perplexity of 46.87 (vs. 48.30 for vanilla). On PersonaChat, it reached 36.86 (vs. 39.06 for vanilla).
- The Hourglass Benefit: The bottleneck created by the hourglass shape encourages the model to learn phrase-level and topic-level components rather than just word-to-word correlations. Ablation studies confirmed that both the convolutions and the Down/Up structure were necessary for these gains.
- Robustness to Context: The U-Net Transformer showed a lower correlation between sequence length and test loss compared to the vanilla Transformer, suggesting it is more robust when dealing with long, complex conversation histories.
- Efficiency: By halving tokens while doubling embedding dimensions, the authors maintained a parameter count and computational complexity comparable to a standard Transformer.
Discussion and Future Work
While the U-Net Transformer shows significant promise, the current work only modifies the encoder; the decoder still operates on a flat, token-by-token basis. Future work could involve a hierarchical decoder that produces abstract representations of previously generated text. Additionally, applying this U-Net structure to unsupervised tasks like BERT could help models store high-level information for predicting missing tokens. Finally, further research is needed to quantify exactly what the hierarchical layers are learning, such as identifying specific noun phrases or conversational topics.
Summary updated