Accelerate RNN-based Training with Importance Sampling

Fei Wang, Xiaofeng Gao, Guihai Chen, Jun YearXiv 2017

Introduction

Stochastic Gradient Descent (SGD) is the fundamental optimization algorithm for training deep learning models. However, its efficiency is often hampered by the high variance associated with uniform random sampling of training data. Importance Sampling (IS) offers a theoretical solution by sampling "informative" data points more frequently, thereby reducing gradient variance and accelerating convergence.

Despite its potential, applying IS to Recurrent Neural Networks (RNNs) presents a significant challenge. Traditional IS methods rely on well-structured data with fixed feature vectors to pre-calculate importance. In contrast, RNNs typically process unstructured sequential data (e.g., text or music), where features are learned dynamically through embedding matrices. This paper introduces Fast-Importance-Mining (FIM), a novel approach designed to bring the benefits of IS to the domain of unstructured sequential modeling.

Methodology: Fast-Importance-Mining (FIM)

The authors propose a two-stage framework to enable effective importance sampling for RNNs: identifying a representative gradient proxy and efficiently mining importance factors in parallel.

Base-Gradient Selection

A critical step in IS is determining which gradient norm should serve as the proxy for a sample's "importance." Given the multiple weight matrices in modern RNN architectures (input, hidden, output, and embeddings), the authors conducted empirical evaluations to find the most effective signal. They discovered that the weights conditioning the input—such as $W^x$ in standard RNNs or $W^c$ in Long Short-Term Memory (LSTM) networks—provide the most reliable proxy for importance.

Selection of the base-gradient in an LSTM cell.

The FIM Algorithm

The core innovation, Fast-Importance-Mining (FIM), addresses the unstructured nature of sequential data. Rather than attempting to pre-calculate importance from raw sequences, FIM extracts structure by training "private" mini-RNNs for every training sample in parallel. These models are trained until they reach a loose accuracy threshold ($\epsilon$). The norm of the resulting weight matrix for each private model is then utilized as the importance factor for that specific sequence.

Overview of the Fast-Importance-Mining (FIM) process.

By restricting each mini-model to a single sample and utilizing a relaxed convergence threshold, the "mining" process is extremely fast. Furthermore, the process is inherently parallelizable, allowing the computational overhead to be minimized in distributed environments.

Experimental Evaluation

The FIM algorithm was evaluated on two distinct sequential tasks:

  1. Sentiment Analysis (LSTM): Classification of 25,000 movie review sentences.
  2. Polyphonic Music Modeling (RNN-RBM): A complex task involving 147,737 musical sequences across 88 dimensions.

Key Insights and Results

The experimental results highlight several advantages of the FIM approach:

  • Accelerated Convergence: In the sentiment classification task, the IS-accelerated LSTM (IS-LSTM) reached lower error rates significantly faster than standard uniform sampling. This improvement was consistent across various learning rates, with the most pronounced gains observed at higher rates (e.g., $\lambda = 0.5$).
  • Enhanced Stability: Training curves for IS-LSTM exhibited fewer fluctuations and "spikes" in error, indicating that importance sampling effectively stabilizes the gradient updates.
  • Robustness to Local Minima: In the music modeling task, standard RNN-RBM training often suffered from "heavy regression"—sudden jumps in cost after reaching low error levels. The IS-integrated version avoided these pitfalls, maintaining a steady downward trajectory and demonstrating greater robustness to large step sizes.

Conclusion and Future Work

Fast-Importance-Mining successfully bridges the gap between Importance Sampling and unstructured sequential data. By leveraging parallelized mini-training sessions, FIM provides a scalable way to reduce gradient variance in RNNs.

Future research may focus on automating the selection of the "base-gradient" for increasingly complex architectures and optimizing the accuracy threshold ($\epsilon$) to further reduce pre-processing overhead. Additionally, investigating the interaction between IS and adaptive learning rate optimizers (like Adam) could yield further performance improvements for massive-scale sequential datasets.

Summary updated

Abstract

Importance sampling (IS) as an elegant and efficient variance reduction (VR) technique for the acceleration of stochastic optimization problems has attracted many researches recently. Unlike commonly adopted stochastic uniform sampling in stochastic optimizations, IS-integrated algorithms sample training data at each iteration with respect to a weighted sampling probability distribution $P$, which is constructed according to the precomputed importance factors. Previous experimental results show that IS has achieved remarkable progresses in the acceleration of training convergence. Unfortunately, the calculation of the sampling probability distribution $P$ causes a major limitation of IS: it requires the input data to be well-structured, i.e., the feature vector is properly defined. Consequently, recurrent neural networks (RNN) as a popular learning algorithm is not able to enjoy the benefits of IS due to the fact that its raw input data, i.e., the training sequences, are often unstructured which makes calculation of $P$ impossible. In considering of the the popularity of RNN-based learning applications and their relative long training time, we are interested in accelerating them through IS. This paper propose a novel Fast-Importance-Mining algorithm to calculate the importance factor for unstructured data which makes the application of IS in RNN-based applications possible. Our experimental evaluation on popular open-source RNN-based learning applications validate the effectiveness of IS in improving the convergence rate of RNNs.
BibTeX
@misc{wang2017accelerate,
  author = {Fei Wang and Xiaofeng Gao and Guihai Chen and Jun Ye},
  title = {{Accelerate RNN-based Training with Importance Sampling}},
  year = {2017},
  eprint = {1711.00004},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1711.00004},
}
Figure