Abstract
Importance sampling has been successfully used to accelerate stochastic optimization in many convex problems. However, the lack of an efficient way to calculate the importance still hinders its application to Deep Learning. In this paper, we show that the loss value can be used as an alternative importance metric, and propose a way to efficiently approximate it for a deep model, using a small model trained for that purpose in parallel. This method allows in particular to utilize a biased gradient estimate that implicitly optimizes a soft max-loss, and leads to better generalization performance. While such method suffers from a prohibitively high variance of the gradient estimate when using a standard stochastic optimizer, we show that when it is combined with our sampling mechanism, it results in a reliable procedure. We showcase the generality of our method by testing it on both image classification and language modeling tasks using deep convolutional and recurrent neural networks. In particular, our method results in 30% faster training of a CNN for CIFAR10 than when using uniform sampling.
Introduction
In standard Stochastic Gradient Descent (SGD), training examples are typically sampled uniformly. However, as training progresses, many examples become "easy" for the model, contributing very little to the learning process. Prioritizing informative samples—those with large gradient norms—is a well-known technique called importance sampling. Yet, it remains impractical for Deep Learning because calculating the gradient norm for every sample requires an expensive full backward pass. This paper addresses the challenge of identifying important samples efficiently to achieve actual wall-clock speedups.
Methodology
The proposed approach addresses the computational overhead of importance sampling through three key innovations:
- Loss as a Proxy for Importance: The authors theoretically demonstrate that a sample's loss value is a reliable upper bound for its gradient norm. Since the forward pass (calculating loss) is significantly cheaper than the backward pass, this provides a more efficient importance metric.
- Biased Sampling ($k$): A hyperparameter $k$ is introduced to bias the sampling. While $k=1$ corresponds to standard unbiased importance sampling for variance reduction, setting $k < 1$ focuses the optimizer more heavily on high-loss samples. This shifts the objective toward minimizing a "soft max-loss," which can improve generalization by forcing the model to master difficult or rare cases.
- Surrogate Model ("approx"): To further reduce overhead, the authors use a lightweight parallel model to predict a sample's current loss based on its historical values, avoiding the need to compute the full model's loss for every sample in every iteration.
As shown in Figure 3(a), using loss-based importance sampling ($k=0.5$) significantly reduces the variance of the training loss compared to uniform sampling. Figure 3(b) illustrates how different values of $k$ affect the maximum training loss, highlighting the impact of the sampling bias on the optimization trajectory.
Experimental Results
The method was evaluated on MNIST (digits), CIFAR10 (CNN), and Penn Treebank (RNN).
- Convergence and Speed: On MNIST, the scheme accelerated training by 6x in terms of epochs. More importantly, on CIFAR10, the "approx" method achieved a 30% wall-clock speedup compared to uniform sampling.
- Generalization Performance: Biased sampling ($k=0.5$) consistently yielded lower test errors. For instance, on MNIST, test error dropped from 0.79% to 0.56% by the 5th epoch. This suggests that focusing on "hard" samples helps the model learn more robust features.
Figure 5 demonstrates the practical utility of the approach. While many methods show speedups per epoch (Figure 5a), the proposed surrogate model approach maintains this advantage even when accounting for computational overhead, resulting in a clear wall-clock time speedup (Figure 5b).
Discussion and Conclusion
The core insight is that exact gradient norms are unnecessary for speedup; a metric that preserves sample ordering, like loss, is sufficient. Furthermore, "easy" samples may act as noise, and prioritizing "hard" samples can lead to better mastering of the data distribution.
While the surrogate model requires a "warm-up" period and can be affected by noise from Dropout or Batch Normalization, the results clearly show that biased importance sampling via loss approximation offers a practical way to accelerate deep learning training while improving model performance.
Summary updated