TL;DR
When training character-level recurrent neural networks (RNNs), engineering choices like how you slice text sequences and handle hidden states heavily impact performance. This paper evaluates four distinct training and prediction schedules, revealing that calculating losses at every time step over short sequences with frequent updates yields the highest training efficiency and most consistent convergence.
What Problem Does This Paper Address?
Character-level language models are foundational to text mining, speech-to-text translation, and sequence generation. However, when training these models using Truncated Backpropagation Through Time (TBPTT), practitioners face several subtle implementation choices:
- Should the model predict the next character at every step of an input sequence, or only at the very end?
- Should the RNN's hidden states be reset between data chunks, or carried over continuously?
While these choices might seem like minor implementation details, they define the network's "training schedule." This paper addresses how these schedules impact a model's efficiency—specifically, how quickly and consistently a network can achieve low perplexity given a fixed training time or data budget.
Methods
The authors design a controlled experiment using a standard character-level LSTM architecture: a 65-dimensional input layer (representing one-hot encoded characters), a 50-dimensional LSTM layer, and a 65-dimensional dense output layer with a softmax activation.
To isolate the impact of data handling, they formalize four distinct training and prediction schedules:
- Schedule 1: The model processes a sequence, calculates a loss at every character step, and resets the LSTM hidden states for each new sequence. At test time, it predicts a single next character from a fixed-length input.
- Schedule 2: Similar to Schedule 1, but the model only calculates a single loss at the final character of the sequence during training.
- Schedule 3: Training is identical to Schedule 1 (multi-loss, state resets). At test time, however, it predicts continuously, updating and carrying forward its hidden state indefinitely.
- Schedule 4: During training, the hidden state is never reset; instead, the final state of one sequence is carried over as the initial state for the next. Testing uses the same continuous prediction as Schedule 3.
The authors ran each schedule 100 times, randomly varying the sequence length ($k_2$) and update frequency ($k_1$) parameters between 5 and 50 steps to ensure robust results.
Datasets
The models were trained and evaluated on a corpus consisting of excerpts from Shakespearean plays.
- Training set: ~1,100,000 characters
- Test set: ~11,000 characters
- Vocabulary size: 65 unique characters
Key Insights and Ideas
- More Losses Mean Better Gradients: Schedule 1 significantly outperforms Schedule 2. Computing losses at every single character step provides a much richer gradient signal than waiting until the end of a sequence, leading to faster learning.
- State Resets Stabilize Early Learning: Schedules 3 and 4, which rely on continuous hidden states during testing or training, exhibit highly volatile and noisy behavior early in the training cycle. Resetting the hidden states (Schedule 1) acts as a stabilizing force.
- Keep It Short and Frequent: Across all configurations, the absolute fastest paths to low perplexity occurred when the sequence length parameter was small ($k_2 < 10$). Frequent model updates over short sequences are vastly superior for character-level tasks.
Key Results
The efficiency of each schedule was measured by tracking perplexity against both the number of training sequences and total elapsed time.
- Schedules 1 & 2 converged smoothly toward an optimum, but Schedule 1 was substantially more data- and time-efficient.
- Schedules 3 & 4 suffered from erratic performance early on. While Schedule 4 eventually stabilized to a competitive optimum, certain parameter choices for Schedule 3 remained noisy throughout.
- Ultimately, Schedule 1 emerged as the most efficient and consistently reliable framework for training.
Limitations and Future Work
The primary limitation acknowledged by the authors is the scope of the evaluation. The experiments were conducted on a single, relatively small dataset (Shakespeare) using a compact, single-layer LSTM. The authors note that further research is required to verify if these training schedule dynamics hold true for massive datasets or more complex, deep recurrent neural network architectures.
Summary updated