Generalization Error Bounds for Noisy, Iterative Algorithms
Ankit Pensia, Varun Jog, Po-Ling Loh
Introduction
Many popular machine learning applications may be cast in the framework of empirical risk minimization (ERM) . This risk is defined as the expected value of an appropriate loss function, where the expectation is taken over a population. Rather than minimizing the risk directly, ERM proceeds by minimizing the empirical average of the loss function evaluated on the finite sample of data points contained in the training set . In addition to obtaining a computationally efficient, near-optimal solution to the ERM problem, it is therefore necessary to quantify how much the empirical risk deviates from the true risk of the loss function, which in turn dictates the closeness of the ERM estimate to the underlying parameter of the data-generating distribution.
In this paper, we focus on a family of iterative ERM algorithms, and derive generalization error bounds for the parameter estimates obtained from such algorithms. A unifying characteristic of the iterative algorithms considered in our paper is that each successive update includes the addition of noise, which prevents the learning algorithm from overfitting to the training data. Furthermore, the iterates of the algorithm are related via a Markov structure, and the difference between successive updates (disregarding the noise term) is assumed to be bounded. One popular learning algorithm of this nature is stochastic gradient Langevin dynamics (SGLD)—which may be viewed as a version of stochastic gradient descent (SGD) that injects Gaussian noise at each iteration—applied to a loss function with bounded gradients. Our approach leverages recent results that bound the generalization error using the mutual information between the input data set and the output parameter estimates . Importantly, this technique allows us to apply the chain rule of mutual information and leads to a simple analysis that extends to estimates that are obtained as an arbitrary function of the iterates of the algorithm. The sampling strategy may also be data-dependent and allowed to vary over time, but should be agnostic to the parameters.
Generalization properties of SGD have recently been derived using a different approach involving algorithmic stability . The main idea is that learning algorithms that change by a small bounded amount with the addition or removal of a single data point must also generalize fairly well . However, the arguments employed to show that SGD is a stable algorithm crucially rely on the fact that the updates are obtained using bounded gradient steps. Mou et al. provide generalization error bounds for SGLD by relating stability to the squared Hellinger distance, and bounding the latter quantity. Although their generalization error bounds are tighter than ours in certain cases, our approach based on a purely information-theoretic notion of stability (i.e., mutual information) allows us to consider much more general classes of updates and final outputs, including averages of iterates; furthermore, the algorithms analyzed in our framework may perform iterative updates with respect to a non-uniform sampling scheme on the training data set.
The remainder of the paper is organized as follows: In Section 2, we introduce the notation and assumptions to be used in our paper. In Section 3, we present the main result bounding the mutual information between inputs and outputs for our class of iterative learning algorithms, and derive generalization error bounds in expectation and with high probability. In Section 4, we provide illustrative examples bounding the generalization error of various noisy algorithms. We conclude with a discussion of related open problems. Detailed proofs of supporting lemmas are contained in the Appendix.
Problem setting
In the framework of ERM, we are interested in the empirical risk, defined to be the empirical average of the loss function computed with respect to the training data:
The excess risk, defined as the difference between the expected loss incurred by the algorithm and the true minimum of the risk, may be decomposed as follows:
denotes the optimization error incurred by the algorithm in minimizing the empirical risk.
2 Generalization error bounds
The idea of bounding generalization error by the mutual information between the input and output of an ERM algorithm was first proposed by Russo and Zou and further investigated by Xu and Raginsky . We now describe their results, which will be instrumental in our work. Recall the following definition:
A random variable is -sub-Gaussian if the following inequality holds:
We will assume that the loss function is uniformly sub-Gaussian in the second argument over the space :
Under Assumption 1, the following bound holds:
In other words, the generalization error is controlled by the mutual information, supporting the intuition that an algorithm without heavy dependence on the data will avoid overfitting.
3 Class of learning algorithms
We now define the types of ERM algorithms to be studied in our paper. We will focus on algorithms that proceed by iteratively updating a parameter estimate based on samples drawn from the data set . Our theory is applicable to algorithms that make noisy, bounded updates on each step, such as the SGLD algorithm applied to a loss function with uniformly bounded gradients.
Our analysis does not actually require the noise vectors to be Gaussian, as long as they are drawn from a continuous distribution. The proofs would continue to hold with minimal modification, but would lead to sub-optimal bounds—indeed, a careful examination of our proofs shows that Gaussian noise produces the tightest bounds, because Gaussian noise has the maximum entropy for a fixed variance. Our results also generalize to settings where may be a collection of data points drawn from and is computed with respect to all the data points (e.g., a mini-batched version of SGD), provided the sampling strategy satisfies the Markov structure imposed by Assumption 3 below.
For , let and . We impose the following assumptions on , , and the dependency structure between the ’s and ’s:
The updates are bounded; i.e., , for some .
The sampling strategy is agnostic to the previous iterates of the parameter vectors:
where denotes the final iterate. We may represent the dependence structure defined by our class of algorithms in the form of a graphical model (see Figure 1 in the Appendix).
Importantly, we do not impose any further restrictions on the form of the updates or the sampling strategy; in particular, need not be drawn uniformly from the data set , and may even depend on past iterates , as in the case of sampling without replacement. Some examples of iterative algorithms where the probability of sampling a data point depends on the value of may be found in Zhao and Zhang or Needell et al. —such sampling strategies are also covered by our theory. However, note that must be independent of the parameter iterates , since if edges exist between and any such that , equation (5) will not hold. Intuitively, if the sampled data point adapts to current iterates of the parameter vector , the algorithm may be prone to over-fitting and may not generalize.
The output of our estimation algorithm is defined to be an arbitrary function of the iterates: . Some common examples appearing in the ERM literature include (i) the mean: ; (ii) the last iterate: ; or (iii) suffix averaging, and variants thereof .
Main results
We now derive an upper bound on for the class of iterative algorithms described in Section 2, from which we obtain bounds on the generalization error.
The mutual information satisfies the bound
where the inequality follows from Lemma 2 and the last equality comes from the chain rule of mutual information.
where equality follows from Lemma 3 and Lemma 4 in the Appendix, whereas inequality follows from Lemma 5.
We may obtain bounds without a log term by using the fact that , . ∎
2 Consequences
We now use this bound on mutual information from Theorem 1 to derive bounds on the generalization error, first in expectation and then with high probability. The first bound follows directly from Theorem 1 and Lemma 1:
The generalization error of our class of iterative algorithms is bounded by
Similarly, Theorem 3 in Xu and Raginsky implies a generalization error bound that holds with high probability:
[High-probability bound] Let . Then by Theorem 1, can be equal to . For any and , if , we have
where the probability is with respect to and .
Examples
We now apply the corollaries in Section 3.2 to obtain generalization error bounds for various algorithms.
the noise variance is set to be ,
the algorithm is run for epochs; i.e., ,
for a constant , the stepsizes are .
For a given choice of , taking ensures inequality (9), provided that we run epochs. For more details, see Lemma 6 in Appendix B.
Bounds in expectation
Using the identity , we obtain the following bound:
Note that Mou et al. achieve a tighter bound on generalization error of the order , but their bound is only applicable to the last iterate of SGLD and a uniform sampling strategy.
Convex risk minimization
where . By inequalities (1), (4.3), and (10), we then have
Setting and , we obtain
2 Perturbed SGD
Due to the requirement that an independent noise term is present in each update, our results on generalization error may not be applied to SGD. On the other hand, our framework does apply to noisy versions of SGD, which have recently drawn interest in the optimization literature due to their ability to escape saddle points efficiently . For a stepsize parameter , updates of the perturbed SGD algorithm take the following form :
where are i.i.d. noise terms sampled uniformly from the unit sphere. Hence, noise is added to each gradient. Unfortunately, our techniques cannot be applied to this exact setting because has a degenerate distribution concentrated on the sphere. For large enough , choosing on the unit sphere is almost equivalent to choosing it inside the unit ball. If is chosen uniformly in the unit ball (cf. the perturbed SGD formulation in Jin et al. ), our methods yield the following bound:
This is because , so we may bound by the entropy of the uniform distribution on the -dimensional ball of radius . Also, is simply the entropy of the uniform distribution on the -dimensional ball of radius . This shows that , so
3 Noisy momentum
In this section, we show how we can develop bounds for momentum-like algorithms in addition to SGLD. We consider an algorithm similar to the SGHMC algorithm . Every iteration involves an extra parameter vector , which represents the “velocity” of . We analyze a modified SGHMC algorithm, where we add the (independent and Gaussian) noise to the velocity, as well. This leads to the update equations
Note that if the gradients are upper-bounded by , we have . Using Theorem 1, we then arrive at the following bound:
Note that it is twice the bound on the mutual information appearing in Theorem 1. We may then apply the results in Section 3.2 to obtain bounds on the generalization error:
4 Accelerated gradient descent
Finally, we consider a noisy version of the accelerated gradient descent method of Nesterov , where we again add independent noise to both the velocity and parameter vectors at each iteration. This leads to the update equations
Conclusion
In this paper, we have demonstrated that mutual information is a very effective tool for bounding the generalization error of a large class of iterative ERM algorithms. The simplicity of our analysis is due to properties such as the data processing inequality and the chain rule of mutual information. However, entropy and mutual information also have certain shortcomings that limit the scope of our analysis, particularly concerning the sensitivity of entropy with respect to degenerate random variables. In some instances, mutual information-based bounds become very weak or even inapplicable. For example, if we were to analyze the SGD algorithm rather than SGLD, or add noise that is degenerate, such as the uniform distribution on a sphere , the mutual information would be , leading to meaningless generalization error bounds. It would be interesting to develop information-theoretic strategies that could bound the generalization error for such algorithms, as well. Finally, note that we have only provided upper bounds for the generalization error—having a large does not necessarily mean that an algorithm is overfitting, since our upper bound might be loose. Deriving lower bounds on the generalization error appears to be a challenging problem that could benefit from an information-theoretic approach, as well.
References
Appendix A Proofs of supporting lemmas to Theorem 1
We now prove the lemmas employed in the proof of Theorem 1.
where . See equality (5). ∎
We now bound each of the terms in the final expression. First, note that conditioned on , we have
since translation does not affect the entropy of a random variable. Also note that the random variables and are independent, so we can upper-bound the expected squared-norm of , as follows:
Since the above bound holds for all values , we may integrate the bound to conclude that
This leads to the following desired bound:
Note that if the noise were non-Gaussian, we would have to replace by the entropy of the noise. ∎
Appendix B Details for the SGLD algorithm
In this Appendix, we include more details for the derivations concerning SGLD in Section 4.
For a given choice of , taking ensures inequality (9), provided that we run epochs.
If we show that for , we have , the proof will follow from Corollary 2. We have
B.2 Optimization error bounds
We now derive the bound on the optimization error of SGLD.
If we run the SGLD algorithm on an -Lipschitz convex loss function for time steps with parameters , we have the following bound on the empirical risk for the average of the iterates:
We follow the same notation as in the rest of the paper.
The first inequality follows from the convexity of the the loss fuction.
Moreover, since the noise is independent and the loss function is convex and -Lipschitz, we have
Combining this bound with inequality (14) yields the desired result. ∎