Efficiency Evaluation of Character-level RNN Training Schedules

Cedric De Boom, Sam Leroux, Steven Bohez, Pieter Simoens, Thomas Demeester, Bart DhoedtarXiv 2016 · OpenReview

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:

  1. Should the model predict the next character at every step of an input sequence, or only at the very end?
  2. 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.
Figure 1. Four different schedules of training and predicting from a character-level RNN.

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.

Figure 2. Perplexity as a function of number of input train sequences and elapsed training time. Blue: schedule 1; red: schedule 2; green: schedule 3; yellow: schedule 4.
  • 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

Abstract

We present four training and prediction schedules from the same character-level recurrent neural network. The efficiency of these schedules is tested in terms of model effectiveness as a function of training time and amount of training data seen. We show that the choice of training and prediction schedule potentially has a considerable impact on the prediction effectiveness for a given training budget.
BibTeX
@misc{boom2016efficiency,
  author = {Cedric De Boom and Sam Leroux and Steven Bohez and Pieter Simoens and Thomas Demeester and Bart Dhoedt},
  title = {{Efficiency Evaluation of Character-level RNN Training Schedules}},
  year = {2016},
  eprint = {1605.02486},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1605.02486},
}
Figure