TL;DR
DReLUs (Dual Rectified Linear Units) are a novel activation function designed to replace tanh in Quasi-Recurrent Neural Networks (QRNNs). By subtracting two ReLUs, they provide the benefits of rectified units—sparsity and resistance to vanishing gradients—while allowing for the negative updates essential for recurrent state management.
What Problem Does This Paper Address?
Recurrent Neural Networks (RNNs) and LSTMs have long relied on the tanh activation function. tanh is popular because it is bounded (preventing values from exploding) and has a negative image, allowing the network to subtract from its internal hidden state. However, tanh suffers from the vanishing gradient problem: as you stack layers, the gradients get squashed, making deep networks difficult to train.
Standard Rectified Linear Units (ReLUs) solved this for feed-forward networks, but they struggle in recurrent settings for two reasons:
- Exploding Gradients: Their unbounded nature can lead to exponential growth when multiplied repeatedly across time steps.
- Lack of Negative Image: ReLUs only output positive values. In a gated recurrent unit, this means you can only add to the hidden state, never subtract, severely limiting the model's expressiveness.
The authors leverage the Quasi-Recurrent Neural Network (QRNN), which replaces slow hidden-to-hidden matrix multiplications with convolutions. This architectural change mitigates the exploding gradient risk, opening the door for a ReLU-like replacement for tanh.
Methods
The authors introduce the Dual Rectified Linear Unit (DReLU). Instead of a single unit, it subtracts the output of two regular ReLUs:
$$f_{DReL}(a, b) = \max(0, a) - \max(0, b)$$
This simple tweak creates an activation function that is:
- Unbounded: Avoiding the gradient squashing of
tanh. - Bi-directional: It can output both positive and negative values, allowing the network to increase or decrease hidden state values.
- Sparse: Like ReLUs, it can be exactly zero, which helps with noise robustness and efficient training.
The authors also propose a smoother variant called DELU (Dual Exponential Linear Unit), based on the ELU activation function.
Datasets
The researchers evaluated DReLUs across three Natural Language Processing (NLP) tasks:
- Sentiment Classification: Using the IMDb movie review dataset (50k reviews).
- Word-level Language Modeling: Using the Penn Treebank (PTB) dataset.
- Character-level Language Modeling: Evaluated on both PTB and the much larger enwik8 (Hutter Prize) dataset (100M characters from Wikipedia).
Key Insights and Ideas
- The Subtraction Solution: The core "aha" moment is that the primary limitation of ReLUs in recurrent gates isn't just their lack of bounds, but their inability to represent "forgetting" or "subtraction" in the state. DReLU solves this elegantly by using two inputs to represent the positive and negative components.
- Sparsity is Feature, Not a Bug: DReLUs induce significant sparsity. In their experiments, ~54% of DReLU activations were nearly zero, compared to only ~10% for
tanh. This sparsity helps the network "disentangle" information and ignore noise. - Deep Stacking Without Skips: Because DReLUs don't suffer from vanishing gradients, the authors were able to stack up to eight QRNN layers without needing residual skip connections, which are usually mandatory for training deep
tanh-based networks.
Key Results
- Superior Language Modeling: On character-level modeling (PTB), an 8-layer DReLU-QRNN achieved a Bits-Per-Character (BPC) of 1.21, outperforming the state-of-the-art HyperLSTM.
- Efficiency: DReLU-based QRNNs were found to be 2.5x faster than standard LSTMs while achieving similar or better accuracy.
- Outperforming Tanh: In word-level modeling, DReLU achieved a test perplexity of 78.4, significantly better than the
tanhbaseline of 80.0.
Limitations and Future Work
The paper focuses exclusively on QRNNs. Because QRNNs lack the hidden-to-hidden matrix multiplications found in standard RNNs/LSTMs, they are uniquely suited for unbounded activations. The authors do not recommend DReLUs as a drop-in for standard LSTMs without further investigation into stability.
Future work could involve exploring DReLUs in other gated architectures or applying them to computer vision tasks where capturing both positive and negative feature responses might be beneficial.
Summary updated