Abstract
This paper proposes a novel architectural modification for Transformers by replacing standard residual connections and feed-forward sub-layers with "depth-wise LSTMs." By treating the stack of layers as a vertical sequence, the model employs LSTM gating to selectively aggregate information across the network's depth. This mechanism leads to improved performance on machine translation tasks and more stable convergence in deep architectures.
Introduction
In standard Transformer architectures, layers are typically stacked using simple residual connections. While effective for gradient flow, these additions are mathematically basic and may cause the model to "forget" information from earlier layers, failing to fuse linguistic features across different levels of representation. Furthermore, training very deep Transformers (e.g., 24+ layers) remains challenging due to optimization hurdles. This research explores a more sophisticated method for managing information flow from the bottom of the stack to the top.
Methods: The Depth-Wise LSTM
The core innovation is the Depth-Wise LSTM. Unlike traditional LSTMs that process token sequences horizontally, this unit processes the output of Transformer sub-layers vertically.
Key Technical Features
- FFN Absorption: The standard position-wise Feed-Forward Network (FFN) and Layer Normalization are integrated into the depth-wise LSTM unit. The internal hidden state computation effectively replaces the standalone FFN.
- Gating Mechanism: Standard LSTM gates (input, forget, and output) decide which information to retain from previous layers and which to discard, allowing for "surgical" information management.
- Integration: In the Encoder, the LSTM follows the self-attention layer. In the Decoder, it merges outputs from masked self-attention and cross-attention before processing.
- Parameter Efficiency: To maintain efficiency, gate parameters can be shared across all layers in the stack.
Experimental Evaluation
The approach was evaluated on several Neural Machine Translation (NMT) benchmarks, including WMT 14 English-German (En-De), WMT 14 English-French (En-Fr), and the multilingual OPUS-100 dataset.
Key Results
The depth-wise LSTM architecture consistently outperformed vanilla Transformers across various scales and datasets.
- BLEU Gains: On WMT 14 En-De, the Transformer Base with depth-wise LSTM improved BLEU scores by nearly 1.0 point (27.55 to 28.53). The Transformer Big variant saw an even larger gain of +1.19 BLEU on the En-Fr task.
- Multilingual Performance: On the OPUS-100 task, the model outperformed the baseline by an average of +2.52 BLEU across 94 language pairs.
- Stability and Efficiency: The architecture successfully trained 24-layer models without convergence issues. Notably, a 12-layer depth-wise LSTM model often matched or exceeded the performance of a 24-layer vanilla Transformer while maintaining faster inference speeds.
- The Importance of Gating: Ablation studies confirmed that a simple "depth-wise RNN" without gates performed worse than the baseline, highlighting that selective aggregation is the primary driver of success.
Conclusion
Viewing network depth as a vertical sequence allows for the application of recurrent mechanisms like LSTMs to manage long-range dependencies across layers. By replacing simple residual additions with selective gating, the Depth-Wise LSTM provides a more robust and performant framework for deep Transformer models. Future work may explore other recurrent units or even more complex routing mechanisms to further optimize vertical information flow.
Summary updated