Abstract
Recurrent Neural Networks (RNNs), specifically Long Short-Term Memory (LSTM) units, are designed to maintain information over time through a persistent cell state. However, standard architectures are limited in their ability to efficiently rearrange or "shuffle" internal representations. We present RotLSTM, an extension of the LSTM that introduces a parameterized rotation gate. This mechanism allows the network to learn explicit rotations of its memory state, facilitating better modeling of semantic shifts in natural language. Our results on the bAbI reasoning benchmark show that RotLSTM achieves higher accuracy and faster convergence while requiring significantly smaller hidden state sizes than traditional LSTMs.
Introduction
The ability to update and reorganize internal memory is crucial for processing natural language, where the meaning of a sequence can be radically altered by word order or late-arriving context. While standard LSTMs use gates to control the flow of information into and out of the cell state, they lack a native mechanism for internal reorganization. To mimic such operations, standard models must rely on complex combinations of existing gates, which is computationally inefficient and often necessitates larger hidden states.
RotLSTM addresses this by incorporating an explicit rotation operation. By rotating the memory vector, the model can re-orient the relationships between different features without changing the vector's norm, ensuring numerical stability and mitigating gradient issues.
Methods: The Rotation Mechanism
The core innovation of RotLSTM is the addition of a rotation gate to the standard LSTM update cycle.
- Rotation Gate ($u_t$): The model learns a vector of angles based on the current input $x_t$ and the previous hidden state $h_{t-1}$.
- Rotation Matrix ($U$): These angles parameterize a block-diagonal matrix $U$. Each block consists of a $2 \times 2$ Givens rotation, which operates on pairs of elements within the cell state.
- Unitary Operation: The rotation matrix $U$ is applied to the memory state after the standard forget and input gates. Because $U$ is unitary, it preserves the length of the memory vector, preventing vanishing or exploding gradients.
This approach was also extended to the Gated Recurrent Unit (GRU) to create the RotGRU, demonstrating the versatility of the rotation mechanism across different recurrent architectures.
Experimental Evaluation
The proposed models were evaluated on the bAbI dataset, a synthetic benchmark comprising 20 tasks designed to test various reasoning capabilities, including factoid question answering, pathfinding, and reasoning about relative sizes.
Key Results
RotLSTM demonstrated substantial performance improvements over the baseline LSTM across several challenging tasks. Notably, in Task 18 (Reasoning about size), accuracy improved by approximately 20%, with the model reaching peak performance in half the training time. Significant gains were also observed in Task 5 (Three argument relations) and Task 7 (Counting), with accuracy increases of 22.1% and 14%, respectively.
Beyond raw accuracy, RotLSTM exhibited remarkable memory efficiency. On several tasks, RotLSTM achieved optimal performance with a hidden state size of only 10, whereas the standard LSTM required a size of 40 to reach comparable results. This suggests that the rotation mechanism allows for more compact and effective internal representations.
Discussion and Conclusion
The success of pairwise 2D rotations indicates that complex semantic shifts can be modeled by re-orienting feature relationships. While the current implementation is limited to adjacent pairs, future work may explore multi-dimensional rotations or rotating larger groups of elements.
Despite its advantages, RotLSTM introduces a slight computational overhead, increasing parameter counts by approximately 12.5% and increasing training time due to the additional matrix operations. Furthermore, while the model excels on synthetic reasoning tasks, its performance on large-scale, real-world datasets remains a subject for future investigation. Nevertheless, RotLSTM provides a promising path toward more efficient and stable recurrent architectures.
Summary updated