Abstract
Researchers have long believed that recurrent neural networks (RNNs) are necessary to capture the nested, hierarchical nature of data like search sessions or multi-turn dialogues. This paper introduces Multiresolution Transformer Networks (MTNs), proving that self-attention alone can outperform state-of-the-art hierarchical RNNs by a massive margin—achieving over a 25% improvement in BLEU scores on real-world query suggestion tasks.
Introduction
In sequence modeling, hierarchical structures are ubiquitous. For instance, a search engine session consists of a sequence of queries, each composed of a sequence of words. To suggest the next query effectively, a model must understand both the internal structure of the current query (word-to-word) and the broader context of the session (query-to-query).
Traditionally, Hierarchical RNNs (such as H-LSTMs) were the standard choice for these tasks, based on the assumption that recurrence was essential for linking these temporal scales. While the Transformer architecture revolutionized flat sequence tasks, skepticism remained regarding its ability to handle nested temporal scales. The MTN architecture bridges this gap, challenging the perceived necessity of recurrence for hierarchical modeling.
Architecture
The Multiresolution Transformer Network (MTN) replaces recurrent units with stacked self-attention mechanisms operating at different resolutions:
- Query-Level Encoder: A standard Transformer encoder processes tokens within a single query to capture intra-query dependencies.
- Masked Session Encoder: This novel component takes summarized representations of previous queries and applies self-attention across them. It utilizes masking to ensure the model cannot access future queries during training, maintaining the causal integrity of the session.
- Query Projection & Skip Connections: Linear projection layers facilitate movement between resolutions, while skip connections preserve original query information while integrating session-level context.
Theoretical Analysis
The authors provide a formal mathematical analysis (Propositions 1-3) comparing the dynamics of RNNs and Transformers. They argue that Transformers succeed because they act like an ensemble of many short paths, avoiding the vanishing gradient problems that plague RNNs when attempting to "remember" across long hierarchical chains.
Furthermore, they posit that weight sharing in RNNs is a disadvantage; if weights have singular values outside a narrow range, gradients inevitably explode or vanish. Transformers, by using different weights at each layer, are inherently more robust. By viewing tokens as nodes in a graph, each Transformer layer increases the "path length" of attention, allowing the model to build a refined hierarchical view without recurrent loops.
Experimental Evaluation
The models were evaluated on two massive, real-world search log datasets:
- AOL: A public dataset filtered into sessions of 3 to 5 queries.
- OnlineX: A large-scale, anonymized dataset from a commercial search engine, covering two months of logs from 2018.
Results
The MTN model demonstrated significant performance gains over all baselines:
- Superior Performance: On the AOL dataset, MTN achieved over a 25% improvement in BLEU score compared to the best-performing hierarchical recurrent model (M-NSRF) and at least a 20% improvement in $n$-gram precision.
- Hierarchical Advantage: When compared to a standard "flat" Transformer of similar complexity, the MTN's hierarchical structure provided significantly better performance, validating the multiresolution design.
- Efficiency: MTN maintained a model size (approx. 407-465 MB) comparable to or smaller than recurrent baselines, despite its superior performance.
Conclusion
Multiresolution Transformer Networks prove that recurrence is not essential for modeling hierarchical structures. By leveraging the power of self-attention at multiple scales, MTNs provide a more robust and high-performing alternative to traditional hierarchical RNNs. Future work will explore compressing these networks for mobile deployment and extending the architecture to deeper, $K$-level hierarchies for more complex logical inference tasks.
Summary updated