Generalization of Hamiltonian algorithms

Authors: andreas  maurer
Venue: NeurIPS_cc_2024_Conference
Published: 2024-05-15 09:58:24

Abstract: A method to prove generalization results for a class of stochastic learning algorithms is presented. It applies whenever the algorithm generates a distribution, which is absolutely continuous distribution relative to some a-priori measure, and the logarithm of its density is exponentially concentrated about its mean. Applications include bounds for the Gibbs algorithm and randomizations of stable deterministic algorithms, combinations thereof and PAC-Bayesian bounds with data-dependent priors.

Main paper: 
 introduction: 
 A stochastic learning algorithm Q takes as input a sample X = (X 1 , ..., X n ) ∈ X n , drawn from a distribution µ on a space X of data, and outputs a probability measure Q X on a loss-class H of functions h : X → [0, ∞). A key problem in the study of these algorithms is to bound the generalization gapEQUATIONbetween the expected and the empirical loss of a hypothesis h drawn from Q X . Here we want to generate h only once and seek guarantees with high probability as X ∼ µ n and h ∼ Q X .Alternatively one might want a bound on the expectation E h∼Q X [∆ (h, X)] with high probability in X ∼ µ n , corresponding to the use of a stochastic hypothesis, where a new h ∼ Q X is generated for every test point. We concentrate on the former question, but many of the techniques presented also apply to the latter, often easier problem.From Markov's inequality it follows that for λ, δ > 0 with probability at least 1 -δ as X ∼ µ n and hEQUATIONwhich suggests to bound the log-moment generating function ln EX [E h∼Q X [exp (λ∆ (h, X))]].With such a bound at hand one can optimize λ to establish generalization of the algorithm Q: X → Q X .Inequality (2) is relevant to stochastic algorithms in general, and in particular to the Gibbs-algorithm, where dQ X (h) ∝ exp (-(β/n) h (X i )) dπ (h) for some inverse temperature parameter β and some nonnegative a priori measure π on H. The Gibbs algorithm has its origins in statistical mechanics (Gibbs [1902] ). In the context of machine learning it can be viewed as a randomized version of empirical risk minimization, to which it converges as β → ∞, whenever π has full support. The distribution, often called Gibbs posterior (Catoni [2007] ), is a minimizer of the PAC-Bayesian bounds (McAllester [1999] ). It is also the limiting distribution of stochastic gradient Langevin dynamics (Raginsky et al. [2017] ) under rather general conditions. Generalization bounds in expectation are given by Raginsky et al. [2017] , Kuzborskij et al. [2019] , most recently by Aminian et al. [2021] .Bounds in probability are given by Lever et al. [2013] , implicitly by Dziugaite and Roy [2018] , and in Rivasplata et al. [2020] following the method of Kuzborskij et al. [2019] . There is also a bound by Aminian et al. [2023] , improving on the one in (Lever et al. [2013] ).Bounding ln E X [E h∼Q X [exp (λ∆ (h, X))]] is also the vehicle (and principal technical obstacle) to prove PAC-Bayesian bounds with data-dependent prior Q X , as pointed out by Rivasplata et al.[2020] (Theorem 1). Such bounds with data-independent prior Q X = Q, have an over twenty year old tradition in learning theory, starting with the seminal work of McAllester (McAllester [1999] ), Langford and Seeger (Langford and Seeger [2001] , Seeger [2002] ), see also Guedj [2019] . If the prior is data-independent, the two expectations in ln E X [E h∼Q [exp (λ∆ (h, X) )]] can be exchanged, which reduces the analysis to classical Chernoff-or Hoeffding-inequalities. But a dominant term in these bounds, the KL-divergence KL (P, Q) := E h∼P [ln (dP/dQ) (h)], will be large unless P is well aligned to Q, so the prior Q should already put more weight on good hypotheses with small loss. This motivates the use of distribution-dependent priors, and as the distribution is unknown, one is led to think about data-dependent priors. Catoni already considers the data-dependent Gibbs distribution as a prior in a derivation departing from the distribution-dependent Gibbs measure ∝ exp (-βE X∼µ [h (X)]) (Lemma 6.2 in Catoni [2003] ). Dziugaite and Roy [2017] used a Gaussian prior with data-dependent width and minimized the PAC-Bayes bound for a Gaussian posterior on a multi-layer neural network, obtaining a good classifier accompanied by a non-vacuous bound. This significant advance raised interest in PAC-Bayes with data-dependent priors. The same authors introduced a method to control data-dependent priors based on differential privacy (Dziugaite and Roy [2018] ). Recently Pérez-Ortiz et al. [2021] used Gaussian and Laplace priors, whose means were trained directly from one part of the sample, the remaining part being used to evaluate the PAC-Bayes bound. These developments further motivate the search for in-sample bounds on the log-moment generating function appearing above in (2).We make the following contributions:• An economical and general method to bound ln E X [E h∼Q X [exp (λ∆ (h, X))]] whenever the logarithm of the density of Q X concentrates exponentially about its mean. In particular, whenever Q X has the Hamiltonian form dQ X (h) ∝ exp (H (h, X)) dπ (h), then it is sufficient that the Hamiltonian H satisfies a bounded difference condition. The method also extends to the case, when H is only sub-Gaussian in its arguments. • Applications to the Gibbs algorithm yielding competitive generalization guarantees, both for bounded and sub-Gaussian losses. Despite its simplicity and generality the method improves over existing results on this well studied problem, removing unnecessary logarithmic factors and various superfluous terms. • Generalization guarantees for hypotheses sampled once from stochastic kernels centered at the output of uniformly stable algorithms, considerably strengthening a previous result of Rivasplata et al. [2018] . 
notation and preliminaries: 
 For m ∈ N, we write [m] := {1, ..., m}. Random variables are written in upper case letters, like X, Y, X etc and primes indicate iid copies, like X ′ , X ′′ , X ′ etc. Vectors are bold like x,X, etc. Throughout X is a measurable space of data with a probability measure µ, and X will always be the iid vector X = (X 1 , ..., X n ) ∼ µ n and X ∼ µ. H is a measurable space of measurable functions h : X → [0, ∞), and there is a nonnegative a priori measure π on H. The measure π need not be a probability measure, it could be Lebesgue measure on the space R d of parametrizations of H.Averages over π will be written as integrals. P (H) is the set of probability measures on H. Unless otherwise specified E denotes the expectation in X ∼ µ or X ∼ µ n . All functions on H × X n appearing in this paper are assumed to have exponential moments of all orders, with respect to both arguments.For x ∈ X n , k ∈ {1, ..., n} and y, y ′ ∈ X we define the substitution operator S k y acting on X n and the partial difference operator D k y,y ′ acting on functions f :X n → R by S k y x = (x 1 , ..., x k-1 , y, x k+1 , ..., x n ) and D k y,y ′ f (x) = f S k y x -f S k y ′ x . D ky,y ′ always refers to the second argument for functions on H × X n . The generalization gap ∆ (h, X) is defined as in (1). Sometimes we writeL (h) = E [h (X)] and L (h, X) = (1/n) n i=1 h (X i ), so that ∆ (h, X) = L (h)-L (h, X). A table of notation is provided in Appendix C.A stochastic algorithm Q : x ∈ X n → Q x ∈ P (H) will be called absolutely continuous, if Q x is absolutely continuous with respect to π for every x ∈ X n and vice versa. We will only consider absolutely continuous algorithms in the sequel. A real function H on H × X n is called a Hamiltonian for Q (a term taken from statistical physics), if for all h ∈ H and all x ∈ X n h,x) dπ (h) .dQ x (h) = e H(h,x) dπ (h) Z (x) with Z (x) = H e H(The normalizing function Z is called the partition function. (h, x) = H (h, x) -ln Z (x) in general. If π is a probability measure, then E h∼Qx [H Q (h, x)] is the KL-divergence KL (Q x , π).A Hamiltonian for the Gibbs algorithm at inverse temperature β isH (h, x) = -β L (h, x) = - β n n i=1 h (x i ) ,putting larger weights on hypotheses with small empirical loss. This is the simplest case covered by our proposed method. If there is a computational cost associated with each h, it may be included to promote hypotheses with faster execution. We could also add a negative multiple ofi<j (h (x i ) -h (x j ))2 , so as to encourage hypotheses with small empirical variance. Monte Carlo methods, such as the Metropolis-Hastings algorithm, can be used to sample from such distributions. Often these are slow to converge, which underlines the practical importance of using a single hypothesis generated only once.If H is parametrized by R d one may also first compute a vector A (x) ∈ R d with some algorithm A and then sample from an absolutely continuous stochastic kernel κ centered at A (x), so a Hamiltonian is ln κ (h -A (x)). In one concrete version the kernel is an isotropic gaussian, andH (h, x) = -∥h -A (x)∥ 2 / 2σ 2 .Generalization of these methods is discussed in Section 4.2.If Q (1) and Q (2) are absolutely continuous stochastic algorithms with Hamiltonians H 1 and H 2 respectively, then an elementary calculation shows that H 1 + H 2 is a Hamiltonian for the algorithm Q obtained by sampling from Q (1) with the measure π replaced by Q (2) . In this way Hamiltonian algorithms of different type can be combined. 
main results: 
 Let Q be an absolutely continuous stochastic algorithm, F : H × X n → R some function and defineψ F (h) := ln E e F (h,X)+H Q (h,X)-E[H Q (h,X ′ )] .Our method is based on the following proposition. Proposition 3.1. With Q, F and ψ as above(i) ln E X∼µ n E h∼Q X e F (h,X) ≤ sup h∈H ψ F (h) .(ii) Let δ > 0. Then with probability at least 1 -δ in X ∼ µ n and h ∼ Q X we haveF (h, X) ≤ sup h∈H ψ F (h) + ln (1/δ) . (iii) Let δ > 0.Then with probability at least 1 -δ in X ∼ µ n we haveE h∼Q X [F (h, X)] ≤ sup h∈H ψ F (h) + ln (1/δ) . Proof. (i) With Jensen's inequality ln E X∼µ n E h∼Q X e F (h,X) = ln E X∼µ n H e F (h,X)+H Q (h,X) dπ (h) = ln H E X∼µ n e F (h,X)+H Q (h,X)-E[H Q (h,X ′ )] e E[H Q (h,X ′ )] dπ (h) = ln H e ψ F (h) e E[H Q (h,X ′ )] dπ (h) ≤ ln H E e ψ F (h) e H Q (h,X ′ ) dπ (h) = ln E H e ψ F (h) e H Q (h,X ′ ) dπ (h) = ln E X∼µ n E h∼Q X e ψ F (h) ≤ sup h∈H ψ F (h) .(ii) then follows from Markov's inequality (Section A.1). (iii) follows also by Markov's inequality, since ln X) , by Jensen's inequality.E X∼µ n e E h∼Q X [F (h,X)] ≤ ln E X∼µ n E h∼Q X e F (h,To see the point of this proposition letF (h, X) = λ∆ (h, X). Since ∆ (h, X) is centered, ψ λ∆ is of the form ln E X∼µ n e f (X)-E[f (X ′ )]. Many concentration inequalities in the literature (McDiarmid [1998] , Boucheron et al. [2013] ) follow the classical ideas of Bernstein and Chernoff and are derived from bounds on such moment generating functions. If F (h, X) is not centered, we can use Hölder's or the Cauchy-Schwarz inequality to separate the contributions which F and H Q make to ψ F . The F -contribution can be treated separately and the contribution of H Q can again be treated with the methods of concentration inequalities.The last conclusion of the proposition is to show that we can always get bounds in expectation from bounds on the exponential moment. In the sequel we only state the stronger un-expected or "disintegrated" results.Typically the exponential moment bounds for functions of independent variables depend on the function's stability with respect to changes in its arguments. In Section 4.2 a more advanced concentration inequality will be used, but all other results below depend only on the following classical exponential moment bounds. Most of them can be found in McDiarmid [1998] , but since the results there are formulated as deviation inequalities, a proof is given in the appendix, Section A.2. Proposition 3.2. Let X, X 1 , ..., X n be iid random variables with values in X , X = (X 1 , ..., X n ) and f :X n → R measurable. (i) If f is such that for all k ∈ [n], x ∈ X n we have E X e f (S k X x)-E X ′ [f(S k X ′ x)] ≤ e r 2 , then E e f (X)-E[f (X ′ )] ≤ e nr 2 . (ii) If D k y,y ′ f (x) ≤ c for all k ∈ [n], y, y ′ ∈ X and x ∈ X n , then E e f (X)-E[f (X ′ )] ≤ e nc 2 /8 . (iii) If there is b ∈ (0, 2), such that for all k ∈ [n] and x ∈ X n we have f (x)-E X ′ ∼µ f S k X ′ x ≤ b, then with v k = sup x∈X n E X∼µ f S k X x -E X ′ ∼µ f S k X ′ x 2 E X e f (X)-E[f (X ′ )] ≤ exp 1 2 -b n k=1 v k .Notice that the second conclusion is instrumental in the usual proof of McDiarmid's (or boundeddifference-) inequality (McDiarmid [1998] ).In the simplest case the Hamiltonian satisfies a bounded difference condition as in (ii) above. Then the only minor complication is to show that the logarithm of the partition function inherits this property. This is dealt with in the following lemma. h,x) dπ (h) .Lemma 3.3. Suppose H : H × X n → R and that for all h ∈ H, k ∈ [n], y, y ′ ∈ X and x ∈ X n we have D k y,y ′ H (h, x) ≤ c. Let H Q (h, x) = H (h, x) -ln Z (x) with Z (x) = H e H(Then ∀h ∈ H, k ∈ [n], y, y ′ ∈ X , x ∈ X n we have D k y,y ′ H Q (h, x) ≤ 2c.Proof. This follows from the linearity of the partial difference operator D k y,y ′ andD k y ′ y ln Z (x) = ln Z S k y ′ x Z S k y x = ln H exp D k y ′ ,y H (h, x) exp H h, S k y x dπ (h) H exp H h, S k y x dπ (h) ≤ ln sup h∈H exp D k y ′ ,y H (h, x) ≤ c. Theorem 3.4. Suppose H is a Hamiltonian for Q and that for all k ∈ [n], h ∈ H, y, y ′ ∈ X and x ∈ X n we have D k y,y ′ H (h, x) ≤ c and h (y) ∈ [0, b]. Then (i) For any λ > 0 ln E X∼µ n E h∼Q X e λ∆ ≤ sup h∈H ψ λ∆ (h) ≤ n 8 λb n + 2c 2 .(ii) If δ > 0 then with probability at least 1 -δ as X ∼ µ n and h ∼ Q X we have∆ (h, X) ≤ b c + ln (1/δ) 2n .Proof. Using the previous lemma D k y,y ′ (λ∆ (h, x) + H Q (h, x)) ≤ (λb/n) + 2c. Since E [λ∆ (h, X)] = 0, Proposition 3.2 (ii) gives, for any h ∈ H,ψ λ∆ (h) = ln E e λ∆(h,X)+H Q (h,X)-E[H Q (h,X ′ )] ≤ n 8 λb n + 2c 2 ,and the first conclusion follows from Proposition 3.1 (i) with F (h, x) = λ∆ (h, X).From Proposition 3.1 (ii) we get with probability at least 1 -δ asX ∼ µ n , h ∼ Q X that ∆ (h, X) ≤ λ -1 n 8 λb n + 2c 2 + ln 1 δ = λb 2 8n + bc 2 + nc 2 /2 + ln (1/δ) λ .Substitution of the optimal value λ = (8n/b 2 ) (nc 2 /2 + ln (1/δ)) and subadditivity of t → √ t give the second conclusion.In applications, such as the Gibbs algorithm, we typically have c = O (1/n). The previous result is simple and already gives competitive bounds for several methods, but it does not take into account the properties of the hypothesis chosen from Q X . To make the method more flexible we use the Cauchy-Schwarz inequality to writeEQUATIONand treat the two terms separately. The disadvantage here is an increase of constants in the bounds.The big advantage is that different types of bounds can be combined.The next result is based on this idea. It is similar to Bernstein's inequality for sums of independent variables.Theorem 3.5. Under the conditions of Theorem 3.4 define for each h ∈ H its variance v (h) :=E (h (X) -E [h (X ′ )]) 2 . Then for δ > 0 with probability at least 1 -δ in X ∼ µ n and h ∼ Q X ∆ (h, X) ≤ 2 v (h) c 2 + ln (1/δ) n + b c 2 + ln (1/δ) n .Similar to Bernstein's inequality the above gives a better bound if the chosen hypothesis has a small variance. For the proof we use the following lemma, which is a direct consequence of Proposition 3.2 (iii).Lemma 3.6. Assume that for all h ∈ H and x ∈ X , we have h (x) ∈ [0, b] and v (h) as in Theorem 3.5 above. Let λ be a function λ :H → (0, n/b) and define F λ : H × X n → R by F λ (h, X) = λ (h) ∆ (h, X) - λ (h) 2 1 -bλ (h) /n v (h) n .Then for all h ∈ H we have E e 2F λ (h,X) ≤ 1.Proof. For every h ∈ H we have 2bλ (h) /n ∈ (0, 2). Also ∀x ∈ X n , and ∀h ∈ H∆ (h, x) -E X ′ ∼µ S k X ′ ∆ (h, x) = 1 n (E [h (X ′ )] -h (x k )) ≤ b n .Thus for every h ∈ H we can apply Proposition 3.2 (iii) to f (x) = 2λ (h) ∆ (h, x) and obtainE e 2F (h,X) 1/2 = E [exp (2λ (h) ∆ (h, X))] 1/2 exp -λ (h) 2 1 -bλ (h) /n v (h) n ≤ exp 2λ (h) 2 2 -2bλ (h) /n v (h) n exp -λ (h) 2 1 -bλ (h) /n v (h) n = 1.Proof of Theorem 3.5. Letλ (h) = nc 2 + ln (1/δ) (b/n) nc 2 + ln (1/δ) + v(h) nand let F λ be as in Lemma 3.6. It follows from Lemma 3.3 and Proposition 3.2 (ii) that for all h ∈ H we have lnE e 2(H Q (h,X)-E[H Q (h,X ′ )]) ≤ 2nc 2 . Then (3) and Lemma 3.6 give ψ F (h) ≤ nc 2 .Thus from Proposition 3.1 and division by λ (h) PrX∼µ n ,h∼Q X ∆ (h, X) > λ (h) 1 -bλ (h) /n v (h) n + nc 2 + ln (1/δ) λ (h) < δ.Inserting the definition of λ (h) and simplifying completes the proof.At the expense of larger constants the role of the variance in this result can be replaced by the empirical error, using ) ] and a simple algebraic inversion, which is given in the appendix, Section A.3.v (h) ≤ E [h (X)] 2 ≤ b E [h (XCorollary 3.7. Under the conditions of Theorem 3.5 for δ > 0 with probability at least 1 -δ inX ∼ µ n and h ∼ Q X ∆ (h, X) ≤ 2 L (h, X) b c 2 + ln (1/δ) n + 5b c 2 + ln (1/δ) n .Y is σ-subgaussian for σ > 0, if E [exp (λ (Y -E [Y ′ ]))] ≤ e λ 2 σ 2 /2 for every λ ∈ R . The proof of the following result is given in the appendix (Section A.4) and uses ideas very similar to the proofs above. Theorem 3.8. Let Q have Hamiltonian H and assume that ∀h ∈ H there is ρ (h) > 0 such that∀λ ∈ R, E e λ(h(X)-E[h(X ′ )]) ≤ exp λ 2 ρ (h) 2 2 . Let ρ = sup h∈H ρ (h) and suppose that ∀λ ∈ R, k ∈ [n] , h ∈ H E e λ(H(h,S k X x)-E[H(h,S k X ′ x)]) ≤ exp λ 2 σ 2 2 . (i) Then for any h ∈ H, λ > 0 ln E X∼µ n E h∼Q X e λ∆ ≤ ψ λ∆ (h) ≤ (λρ (h) / √ n + 2 √ nσ) 2 2 ,and with probability at least 1 -δ we have asX ∼ µ n and h ∼ Q X that ∆ (h, X) ≤ ρ 2σ + 2 ln (1/δ) n .(ii) With probability at least 1 -δ we have asX ∼ µ n and h ∼ Q X that ∆ (h, X) ≤ ρ (h) √ 32σ + 4 ln (1/δ) n .The assumptions mean that every hypothesis has its own subgaussian parameter and that the Hamiltonian is subgaussian in every argument if all other arguments are fixed. The first conclusion parallels the bound for Hamiltonians with bounded differences in Theorem 3.4. The second conclusion has larger constants, but scales with the subgaussian parameter of the hypothesis actually chosen from Q X , which can be considerably smaller, similar to the Bernstein-type inequality Theorem 3.5.Question: For each theoretical result, does the paper provide the full set of assumptions and a complete (and correct) Justification: the paper does not include experiments.Guidelines:• The answer NA means that the paper does not include experiments.• The paper should indicate the type of compute workers CPU or GPU, internal cluster, or cloud provider, including relevant memory and storage. • The paper should provide the amount of compute required for each of the individual experimental runs as well as estimate the total compute. • The paper should disclose whether the full research project required more compute than the experiments reported in the paper (e.g., preliminary or failed experiments that didn't make it into the paper). 
the gibbs algorithm: 
 The Gibbs distribution for a samplex is dQ β,x (h) = Z -1 exp (-(β/n) n i=1 h (x i )) dπ (h), so the Hamiltonian is H (h, x) = -(β/n) n i=1 h (x i ).It is the minimizer of the PAC-Bayesian bounds (McAllester [1999] ) as well as the limiting distribution of stochastic gradient Langevin dynamics (Raginsky et al. [2017] ), generalization bounds for the Gibbs distribution translate to guarantees for these algorithms. Let us first assume bounded hypotheses, for simplicity h : X → [0, 1]. Then we can use Theorems 3.4 and 3.5 and Corollary 3.7 with c = β/n. Theorem 3.4 gives with probabilityEQUATIONWe were not able to find this simple bound in the literature. It improves over∆ (h, X) ≤ 4β n + 2 + ln ((1 + √ e) /δ) √ nobtained in (Rivasplata et al. [2020] , Sec. 2.1 and Lemma 3) not only in constants, but, more importantly, in its dependence on the confidence parameter δ. The principal merit of (4), however, lies in the generality and simplicity of its proof (compare the proof of Lemma 3 in Rivasplata et al.[2020]).Upon the substitution c = β/n Theorem 3.5 leads to a variance dependent bound, for which we know of no comparable result.From Corollary 3.7 we get for the Gibbs algorithm with probability at least 1 -δ in X and hEQUATIONFor hypotheses with small empirical error this approximates a "fast convergence rate" of O (1/n).Comparable bounds in the literature involve the so-called "little KL-divergence". For two numbers s, t ∈ [0, 1] the relative entropy of two Bernoulli variables, with means s and t respectively, is kl (s, t) = s ln (s/t) + (1 -s) ln ((1 -s) / (1 -t)). Various authors give bounds onEQUATIONh) with high probability in the sample. Rivasplata et al. [2020] giveE h∼Q β,x kl L (h, X) , L (h) ≤ 2β 2 n 2 + √ 2 ln 3 β n 3/2 + 1 n ln 4 √ n δ ,and there is a similar bound in Dziugaite and Roy [2018] and a slightly weaker one in Lever et al. [2013] . The most useful form of these bounds is obtained using the following inversion rule (Tolstikhin and Seldin [2013] , see also Alquier [2021] ): if kl L (h, x) , L (h) ≤ B then ∆ (h, x) ≤ 2 L (h, x) B + 2B.If this rule is applied to the kl-bound above, it becomes clear, that it is inferior to (5), not only because of the logarithmic dependence on n, but also because of artifact terms, which are difficult to interpret, like the superfluous β/n 3/2 .If every h (X) is ρ (h)-subgaussian and ρ = sup h ρ (h), then by linearity of the subgaussian parameter H (h, X) is ρβ/n-subgaussian in every argument for every h, and Theorem 3.8 gives with probability at least1 -δ in X ∼ µ n and h ∼ Q β,X ∆ (h, X) ≤ ρ (h) 4 √ 2ρβ n + 4 ln (1/δ) n .Recently Aminian et al. [2023] gave a very interesting bound in probability for sub-gaussian hypotheses, which however is not quite comparable to the above, as it bounds the posterior expectation of ∆ and relies on a distribution-dependent prior.Suppose that H is parametrized by R d , with π being Lebesgue measure. To simplify notation we identify a hypothesis h ∈ H with its parametrizing vector, so that h is simultaneously a vector in R d and a function h : x ∈ X → h (x) ∈ R. Following Rivasplata et al. [2018] we define the hypothesis sensitivity coefficient of a vector valued algorithm A :X n → R d as c A = max k∈[n] sup x∈X n ,y,y ′ ∈X D k y,y ′ A (x) .In typical applications c A = O (1/n) (compare the SVM-application in Rivasplata et al. [2018] , as derived originally from Bousquet and Elisseeff [2002] ).Consider first the algorithm arising from the HamiltonianEQUATIONwhere G : R d → [0, ∞) is any function with Lipschitz norm ∥G∥ Lip . One computes A (x) and samples h from the stochastic kernel proportional to exp (-G (h -A (x))). By the triangle inequality H satisfies the bounded difference conditions of Theorems 3.4 and 3.5 with c = ∥G∥ Lip c A . If every h ∈ H (as a function on X ) has range in [0, 1], then, although this algorithm is of a completely different nature, we immediately recover the generalization guarantees as for the Gibbs-algorithm with β/n replaced by ∥G∥ Lip c A . An obvious example is G (h) = ∥h∥ /σ for σ > 0.Another interesting algorithm arises from the HamiltonianH (h, x) = - ∥h -A (x)∥ 2 2σ 2 ,for σ > 0, corresponding to gaussian randomization. For stochastic hypotheses there is an elegant treatment by Rivasplata et al. [2018] using the PAC-Bayesian theorem, and resulting in the bound (with probability at least 1 -δ as X ∼ µ n )E h∼Q X kl L (h, X) , L (h) ≤ nc 2 A 2σ 2 1 + 1 2 ln 1 δ 2 + ln 2 √ n δ n . (7)Since the squared norm is not Lipschitz the previous argument does not work, but with a slight variation of the method we can prove the following result (proof in Section B.1). Theorem 4.1.Let H = R d with Lebesgue measure π. Suppose Q has Hamiltonian H (h, X) = -∥h -A (X)∥ 2 /2σ 2, where A has stability coefficient c A . Let δ > 0 and assume that 12nc 2 A ≤ σ 2 and that every h ∈ H (as a function on X ) has range in [0, 1]. Denote the variance of A byV (A) = E ∥A (X) -E [A (X ′ )]∥ 2 . Then (i) If n > 8 then ln E X E h∼Q X e (n/2)kl( L(h,X),L(h)) ≤ 3 σ 2 V (A) + 1 2 ln (2 √ n) . (ii) If n > 8 then with probability at least 1 -δ as X ∼ µ n E h∼Q X kl L (h, X) , L (h) ≤ 6 σ 2 V (A) + ln (2 √ n) + 2 ln (1/δ) n . (iii) With probability at least 1 -δ as X ∼ µ n and h ∼ Q X ∆ (h, X) ≤ (3/σ 2 ) V (A) + ln (1/δ) n .(iv) Let v (h) be the variance of h, defined as in Theorem 3.5. Then with probability at least 1 -δ asX ∼ µ n and h ∼ Q X ∆ (h, X) ≤ 2 v (h) (3/σ 2 ) V (A) + ln (1/δ) n + 3/σ 2 V (A) + ln (1/δ) n .The expected kl-bound (ii) is given only for direct comparison with (7). (iii) and (vi) are stronger, not only by being disintegrated, but also by avoiding the logarithmic dependence on n.In comparison to (7) (ii) has slightly larger constants and we require that 12nc 2 A ≤ σ 2 . The latter assumption is mild and holds for sufficiently large n if nc 2 A → 0 as n → ∞ (in applications of (7)c A = O (1/n)), but nc 2A may even remain bounded away from zero for 12nc 2 A ≤ σ 2 to hold. On the other handV (A) = E ∥A (X) -E [A (X ′ )]∥2 is always bounded above by nc 2 A (see the proof of Lemma 6 in Rivasplata et al. [2018] ), so we recover (7) from (ii), while our bound can take advantage of benign distributions. In fortunate cases V (A) can be arbitrarily close to zero, while the nc 2 A in ( 7) is a consequence of the use of McDiarmid's inequality in the proof, and (7) remains a worst case bound.The bound (iv) can be inverted as in Corollary 3.7 to give faster rates for small empirical errors, but without the logarithmic dependence in n as in the inverted version of (ii).We quote Theorem 1 (ii) in (Rivasplata et al. [2020] ). For the convenience of the reader we give a proof in the appendix (Section B.2). Theorem 4.2. Let F : H × X n → R be measurable. With probability at least 1 -δ in the draw of X ∼ µ n we have for all P ∈ P (H)E h∼P [F (h, X)] ≤ KL (P, Q X ) + ln E X E h∼Q X e F (h,X) + ln (1/δ) .By substitution of our bounds on ln E X E h∼Q X e F (h,X) we obtain raw forms of PAC-Bayesian bounds with prior Q X for all the Hamiltonian algorithms considered above. But since the final form often involves optimizations, some care is needed. In the simplest case let F (h, X) = (n/2) kl L (h, X) , L (h) , substitute (i) of Theorem 4.1 above and divide by n/2, to prove the following. Theorem 4.3. Under the conditions of Theorem 4.1 we have with probability at least 1-δ in X ∼ µ n for all P ∈ P (H) thatE h∼P kl L (h, X) , L (h) ≤ 2KL (P, Q X ) + 6 σ 2 V (A) + ln (2 √ n) + 2 ln (1/δ) n .It applies to the case, when the prior is an isotropic Gaussian, centered on the output of the algorithm A, a method related to the methods in Dziugaite and Roy [2018] and Pérez-Ortiz et al. [2021] . Section B.2 sketches how PAC-Bayesian bounds analogous to 4.1 (iii) and (iv) are obtained. 
conclusion and future directions: 
 The paper presented a method to bound the generalization gap for randomly generated and deterministically executed hypotheses.By using Marton's coupling method as for example in Paulin [2015] , one can probably prove an analogue to Theorem 3.4 for non-iid data generated by a uniformly ergodic Markov chain.It also appears possible to apply the method to iterated stochastic algorithms, where the randomization of a stable "microalgorithm" is repeated, as with stochastic gradient Langevin dynamics (SGLD). Under appropriate conditions this might give bounds of the generalization gap along the entire optimization path.An obvious challenge is to give bounds for the Gibbs algorithm in the limit β → ∞, or, more generally, in the regime β > n. It is unlikely that the methods of this paper can be successfully applied to this problem without very strong and unnatural assumptions. [X] = 0 and X ≤ b for b > 0, then E e X ≤ e φ(b)E[X 2 ] . (ii) φ (t) ≤ 1/ (2 -t) for 0 ≤ t < 2.Proof. Part (i) is Lemma 2.8 in McDiarmid [1998] . (ii) follows from a term by term comparison of the power seriesφ (t) = ∞ k=0 t k (k + 2)! and 1 2 -t = ∞ k=0 t k 2 k+1 .Proposition A.3 (Restatement of Proposition 3.2). Let X, X 1 , ..., X n be iid random variables with values in X , X = (X 1 , ..., X n ) and f :X n → R measurable. (i) If f is such that for all k ∈ [n], x ∈ X n we have E X e f (S k X x)-E X ′ [f(S k X ′ x)] ≤ e r 2 , then E e f (X)-E[f (X ′ )] ≤ e nr 2 . (ii) If D k y,y ′ f (x) ≤ c for all k ∈ [n], y, y ′ ∈ X and x ∈ X n , then E e f (X)-E[f (X ′ )] ≤ e nc 2 /8 . (iii) If there is b ∈ (0, 2), such that for all k ∈ [n] and x ∈ X n we have f (x)-E X ′ ∼µ f S k X ′ x ≤ b, then with v k = sup x∈X n E X∼µ f S k X x -E X ′ ∼µ f S k X ′ x 2 E X e f (X)-E[f (X ′ )] ≤ exp 1 2 -b n k=1 v k . Proof. (i) For S ⊆ [n] we write E S [.] = E .| {X i } i / ∈S , so E S [.]is integration over all variables in S.By independence {E S [.] : S ⊆ [n]} is a set of commuting projections and E S1 [E S2 [.]] = E S1∪S2 [.]. E [k]is expectation in all variables up to X k , and E {k} is expectation only in X k . The assumption therefore readsE {k} e f (X)-E {k} [f (X)] ≤ e r 2.UsingE [k-1] E [k] [f (X)] = E [k-1] E {k} [f (X)] .We have the telescopic expansion f (X) -E [f (X ′ )] = n k=1 E [k-1] [f (X)] -E [k] [f (X)] = n k=1 E [k-1] f (X) -E {k} [f (X)] ,We claim that for all m, 0 ≤ m ≤ nE e f (X)-E[f (X ′ )] ≤ e mr 2 E exp n k=m+1 E [k-1] f (X) -E {k} [f (X)]from which the proposition follows with m = n. Because of above telescopic expansion the claim is true for m = 0, and we assume it to hold for m -1. ThenE e f (X)-E[f (X ′ )] ≤ e (m-1)r 2 E exp n k=m E [k-1] f (X) -E {k} [f (X)] = e (m-1)r 2 E exp E [m-1] f (X) -E {m} [f (X)] + n k=m+1 E [k-1] f (X) -E {k} [f (X)]because the later terms depend only on the variables X m+1 , ..., X n . By Jensen's inequality the last expression is bounded bye (m-1)r 2 E exp f (X) -E {m} [f (X)] + n k=m+1 E [k-1] f (X) -E {k} [f (X)] = e (m-1)r 2 E e f (X)-E {m} [f (X)] exp n k=m+1 E [k-1] f (X) -E {k} [f (X)] = e (m-1)r 2 E E {m} e f (X)-E {m} [f (X)] exp n k=m+1 E [k-1] f (X) -E {k} [f (X)] ,again because the later terms do not depend on X m , and by assumption the last expression is bounded bye mr 2 E exp n k=m+1 E [k-1] f (X) -E {k} [f (X)] ,which completes the induction and the proof of (i).(ii) follows from (i) and Hoeffding's lemma (Lemma 2.2 in Boucheron et al. [2013] ) which says thatE X∼µ e f (S k X x)-E X ′ ∼µ [f(S k X ′ x)] ≤ e c 2 8 ,if f S k y x as a function of y has range in a set of diameter c. (iii) Follows from (i) and Lemma A.2 sinceE X∼µ e f (S k X x)-E X ′ ∼µ [f(S k X ′ x)] ≤ e φ(b)v k .A.3 Proof of Corollary 3.7Lemma A.4. Let L, L, A ≥ 0 and assume thatL ≤ L + 2 √ L √ A + A Then L ≤ L + 2 LA + 5A Proof. L ≤ L + 2 √ L √ A + A ⇐⇒ L -2 √ L √ A + A ≤ L + 2A ⇐⇒ √ L - √ A 2 ≤ L + 2A =⇒ √ L ≤ L + 2A + √ A ⇐⇒ L ≤ L + 2A + √ A 2 ≤ L + 2 LA + 3 + √ 2 A.The lemma follows from 3 + √ 2 ≤ 5.To get Corollary 3.7 apply this to Theorem 3.5.A.4 Subgaussian hypotheses and proof of Theorem 3.8Lemma A.5. (From Buldygin and Kozachenko [1980] ) (i) if Y is σ-subgaussian then E (Y -E [Y ]) 2 ≤ σ 2 . (ii) if Y 1 and Y 2 are σ 1 -and σ 2 -subgaussian respectively, the Y 1 + Y 2 is σ 1 + σ 2 -subgaussian.The next lemma shows that the log-partition function ln Z (X) is exponentially concentrated, whenever the Hamiltonian H (h, X) is subgaussian uniformly in h. Lemma A.6. Let p ≥ 1 and H (h, X) be σ-subgaussian for every h ∈ H andZ (x) = H e H(h,x) dπ (h) . (i) Then ln E e p(-ln Z(X)+E[ln Z(X ′ )]) ≤ p 2 σ 2 . (ii) If f : X n → R is ρ-subgaussian then ln E e p(f (X)-E[f (X ′ )]-ln Z(X)+E[ln Z(X ′ )]) ≤ p 2 (ρ + σ) 2 .Since the inequalities are given only for p ≥ 1 they do not quite imply that ln Z itself is subgaussian.Proof. We only need to prove (ii), which implies (i) by setting f ≡ 0. By Jensen's inequalityE X e p(f (X)-E[f (X ′ )]-ln Z(X)+E[ln Z(X ′ )]) ≤ E XX ′ e p(f (X)-f (X ′ )-ln Z(X)+ln Z(X ′ )) = E X e pf (X) Z (X) -p E X e -pf (X) Z (X) p .Define a probability measure ν on H by ν(A) = Z -1 ν A e E[H(h,X)] dπ (h) for A ⊆ H measurable.with Z ν = H e E[H(h,X)] dπ (h). Then Z (X) -p = E h∼ν e H(h,X)-E[H(h,X ′ )] -p Z p ν ≤ E h∼ν e p(E[H(h,X ′ )]-H(h,X)) Z p ν , by Jensen's inequality, since t → t -1 is convex. Similarly Z (X) p ≤ E h∼ν e p(H(h,X)-E[H(h,X ′ )]) Z -p ν .Thus the above inequality can be writtenE X e p(f (X)-E[f (X ′ )]-ln Z(X)+E[ln Z(X ′ )]) ≤ E X E h∼ν e p(f (X)+E[H(h,X ′ )]-H(h,X)) ×E X E h∼ν e p(-f (X)+H(h,X)-E[H(h,X ′ )]) .The first factor can be bounded byE h∼ν E X e p(f (X)+E[H(h,X ′ )]-H(h,X)) ≤ e pE[f (X ′ )] e p 2 (ρ+σ) 2 2by the subgaussian assumptions for f and H and Lemma A.5 (ii), and similarly the second factor is bounded bye -pE[f (X ′ )] e p 2 (ρ+σ) 2 2.Putting the two bounds together completes the proof.Theorem A.7 (Restatement of Theorem 3.8). Let Q have Hamiltonian H and assume that ∀h ∈ H there is ρ (h) > 0 such that∀λ ∈ R, E e λ(h(X)-E[h(X ′ )]) ≤ e λ 2 ρ(h) 2 2 , Let ρ = sup h∈H ρ (h) and suppose that ∀λ ∈ R, k ∈ [n] , h ∈ H E e λ(H(h,S k X x)-E[H(h,S k X ′ x)]) ≤ e λ 2 σ 2 2 . (i) Then for any h ∈ H, λ > 0 ln E X∼µ n E h∼Q X e λ∆ ≤ ψ λ∆ (h) ≤ (λρ (h) / √ n + 2 √ nσ) 2 2 ,and with probability at least 1 -δ we have asX ∼ µ n and h ∼ Q X that ∆ (h, X) ≤ ρ 2σ + 2 ln (1/δ) n .(ii) With probability at least 1 -δ we have asX ∼ µ n and h ∼ Q X that ∆ (h, X) ≤ ρ (h) √ 32σ + 4 ln (1/δ) n .Proof. Let h ∈ H be any fixed hypothesis. By assumption and Proposition 3.2 (i) H (h, X) is √ nσ-subgaussian and λ∆ (h, X) is λρ (h) / √ n-subgaussian.Using the previous lemma (ii) with p = 1 and f(X) = λ∆ (h, X) + H (h, X) -E [H (h, X ′ )],which is centered and λρ (h) / √ n + √ nσ-subgaussian, we get thatψ λ∆ (h) = ln E X e λ∆(h,X)+H Q (h,X)-E[H Q (h,X ′ )] = ln E e f (X)-ln Z(X)+E[ln Z(X ′ )] ≤ (λρ (h) / √ n + 2 √ nσ) 2 2 .With ρ (g) ≤ ρ we get from Proposition 3.1 that with probability at least 1 -δ∆ (h, X) ≤ (λρ/ √ n + 2 √ nσ) 2 2λ + ln (1/δ) λ = λρ 2 2n + 2nσ 2 + ln (1/δ) λ + 2ρσThe optimal choice of λ and subadditivity of t → √ t give∆ (h, X) ≤ ρ 2σ + 2 ln (1/δ) n .(ii) We proceed as in the proof of Theorem 3.5. For HQ (h, X) = H (h, X) -ln Z (X) the previous lemma yields with f (X) = H (g, X) -E [H (g, X ′ )] and p = 2 that E X e 2(H Q (h,X)-E[H Q (h,X ′ )]) ≤ e 8nσ 2 .Also E X e 2λ∆(h,X) ≤ e 2λ 2 ρ(h) 2 /n . 
code of ethics: 
 Question: Does the research conducted in the paper conform, in every respect, with the NeurIPS Code of Ethics https://neurips.cc/public/EthicsGuidelines?Answer: [Yes] Justification:Guidelines:• The answer NA means that the authors have not reviewed the NeurIPS Code of Ethics.• If the authors answer No, they should explain the special circumstances that require a deviation from the Code of Ethics. • The authors should make sure to preserve anonymity (e.g., if there is a special consideration due to laws or regulations in their jurisdiction). 
broader impacts: 
 Question: Does the paper discuss both potential positive societal impacts and negative societal impacts of the work performed?Answer: [No] Justification: It is a theoretical paper whose societal impact depends on the application of the presented resultsGuidelines:• The answer NA means that there is no societal impact of the work performed.• If the authors answer NA or No, they should explain why their work has no societal impact or why the paper does not address societal impact. • Examples of negative societal impacts include potential malicious or unintended uses (e.g., disinformation, generating fake profiles, surveillance), fairness considerations (e.g., deployment of technologies that could make decisions that unfairly impact specific groups), privacy considerations, and security considerations.• The conference expects that many papers will be foundational research and not tied to particular applications, let alone deployments. However, if there is a direct path to any negative applications, the authors should point it out. For example, it is legitimate to point out that an improvement in the quality of generative models could be used to generate deepfakes for disinformation. On the other hand, it is not needed to point out that a generic algorithm for optimizing neural networks could enable people to train models that generate Deepfakes faster. • The authors should consider possible harms that could arise when the technology is being used as intended and functioning correctly, harms that could arise when the technology is being used as intended but gives incorrect results, and harms following from (intentional or unintentional) misuse of the technology. • If there are negative societal impacts, the authors could also discuss possible mitigation strategies (e.g., gated release of models, providing defenses in addition to attacks, mechanisms for monitoring misuse, mechanisms to monitor how a system learns from feedback over time, improving the efficiency and accessibility of ML). 
safeguards: 
 Question: Does the paper describe safeguards that have been put in place for responsible release of data or models that have a high risk for misuse (e.g., pretrained language models, image generators, or scraped datasets)?Answer: [NA] Justification:Guidelines:• The answer NA means that the paper poses no such risks.• Released models that have a high risk for misuse or dual-use should be released with necessary safeguards to allow for controlled use of the model, for example by requiring that users adhere to usage guidelines or restrictions to access the model or implementing safety filters. • Datasets that have been scraped from the Internet could pose safety risks. The authors should describe how they avoided releasing unsafe images. • We recognize that providing effective safeguards is challenging, and many papers do not require this, but we encourage authors to take this into account and make a best faith effort.12. Licenses for existing assets Question: Are the creators or original owners of assets (e.g., code, data, models), used in the paper, properly credited and are the license and terms of use explicitly mentioned and properly respected?Answer: [NA] Justification:Guidelines:• The answer NA means that the paper does not use existing assets.• The authors should cite the original paper that produced the code package or dataset.• The authors should state which version of the asset is used and, if possible, include a URL. • The name of the license (e.g., CC-BY 4.0) should be included for each asset.• For scraped data from a particular source (e.g., website), the copyright and terms of service of that source should be provided. • If assets are released, the license, copyright information, and terms of use in the package should be provided. For popular datasets, paperswithcode.com/datasets has curated licenses for some datasets. Their licensing guide can help determine the license of a dataset. • For existing datasets that are re-packaged, both the original license and the license of the derived asset (if it has changed) should be provided. 
 
 Appendix: λ (h) = n ρ (h) 2 (8nσ 2 + ln (1/δ)) and F (h, X) = λ (h) ∆ (h, X) -λ (h) 2 ρ (h) 2 /n. Then with Cauchy-Schwarz ψ F (h) = ln E e F (h,X)+H Q (h,X)-E[H Q (h,X ′ )] ≤ ln E X e 2λ∆(h,X) 1/2 e -λ(h) 2 ρ(h) 2 /n E X e 2(H Q (h,X)-E[H Q (h,X ′ )]) 1/2 ≤ 8nσ 2 .Proposition 3.1, substitution of λ (h) and subadditivity of t → √ t then give∆ (h, X) ≤ λ (h) ρ (h) 2 n + 8nσ 2 + ln (1/δ) λ (h) = ρ (h) 2 n (32nσ 2 + 4 ln (1/δ)) = ρ (h) √ 32σ + 4 ln (1/δ) n .B Remaining proofs for Section 4B.1 Proof of Theorem 4.1We need the following Lemma.Lemma B.1. Let w, v ∈ R d and λ ∈ [1, ∞) then E x∼N (w,σ 2 I) e ( -λ 2σ 2 )(∥x-v∥ 2 -∥x-w∥ 2 ) = e 2λ 2 -λ 2σ 2∥v-w∥ 2 .Proof. We can absorb √ 2σ in the definition of the norm. Then by translationE x∼N (w,I) e -λ(∥x-v∥ 2 -∥x-w∥ 2 ) = E x∼N (0,I) e -λ(∥x-(v-w)∥ 2 -∥x∥ 2 ) = e -λ∥v-w∥ 2 E x∼N (0,I) e 2λ⟨x,v-w⟩ .Rotating v -w to ∥v -w∥ e 1 , where e 1 is the first basis vector, and using independence of the components givesE x∼N (0,I) e 2λ⟨x,v-w⟩ = E x∼N (0,I) e 2λ∥v-w∥⟨x,e1⟩ = 1 √ 2π ∞ -∞ e 2λ∥v-w∥t-t 2 /2 dt = e 2λ 2 ∥v-w∥ 2 √ 2π ∞ -∞ e - 2λ∥v-w∥-t √ 2 2 dt = e 2λ 2 ∥v-w∥ 2 .Combination with the previous identity and taking √ 2σ back out of the norm completes the proof.Our proof of Theorem 4.1 uses the following exponential concentration inequality, implicit in the proof of Theorem 13 in (Maurer [2006] ) and in the proof of Theorem 6.19 in (Boucheron et al. [2013] ) Theorem B.2. Let f : X n → R and define an operator D 2 byD 2 f (x) = n k=1 f (x) -inf y∈X f S k y x 2 .If for some a > 0 and all x ∈ X n , D 2 f (x) ≤ af (x), then for λ ∈ (0, 2/a)ln E e λ(f (X)-E[f (X ′ )]) ≤ λ 2 aE [f (X)] 2 -aλ or equivalently ln E e λf (X) ≤ 2λE [f (X)] 2 -aλ . Theorem B.3 (Restatement of Theorem 4.1). Let H = R d with Lebesgue measure π. Suppose Q has Hamiltonian H (h, X) = -∥h -A (X)∥ 2 /2σ 2, where A has stability coefficient c A . Let δ > 0 and assume that 12nc 2 A ≤ σ 2 and that every h ∈ H (as a function on X ) has range in[0, 1]. Denote the variance of A by V (A) = E ∥A (X) -E [A (X ′ )]∥ 2 . Then (i) If n > 8 then ln E X E h∼Q X e (n/2)kl( L(h,X),L(h)) ≤ 3 σ 2 V (A) + 1 2 ln (2 √ n) . (ii) If n > 8 then with probability at least 1 -δ as X ∼ µ n E h∼Q X kl L (h, X) , L (h) ≤ 6 σ 2 V (A) + ln (2 √ n) + 2 ln (1/δ) n . (iii) With probability at least 1 -δ as X ∼ µ n and h ∼ Q X ∆ (h, X) ≤ (3/σ 2 ) V (A) + ln (1/δ) n .(iv) Let v (h) be the variance of h, defined as in Theorem 3.5. Then with probability at least 1 -δ asX ∼ µ n and h ∼ Q X ∆ (h, X) ≤ 2 v (h) (3/σ 2 ) V (A) + ln (1/δ) n + 3/σ 2 V (A) + ln (1/δ) n .Proof of Theorem 4.1. All Gaussians with covariance σ 2 I have the same normalizing factors, so the partition function for H (h, x) = -∥h -A (x)∥ 2 / 2σ 2 is also the normalizing factor of N E [A (X)] , σ 2 I , whence, using Cauchy-Schwarz,ln E X E h∼Q X e F (h,X) = ln E X H e F (h,X)+H Q (h,X) dπ (h) = ln E X E h∼N (E[A(X)],σ 2 I) e F (h,X)-∥h-A(X)∥ 2σ 2 2 + ∥h-E[A(X)]∥ 2σ 2 2 ≤ 1 2 sup h∈H ln E X e 2F (h,X) + 1 2 ln E X E h∼N (E[A(X)],σ 2 I) e -2 ∥h-A(X)∥ 2σ 2 2 - ∥h-E[A(X)]∥ 2σ 2 2 =: C + B.The bound on C depends on the respective choice of F and will be treated below. Using Lemma B.1 the second term is equal toB = 1 2 ln E X e 3 σ 2 ∥A(X)-E[A(X)]∥ 2 . To apply Theorem B.2 to f (x) = ∥A (x) -E [A (X)]∥ 2 we fix x ∈ X n and k ∈ [n], and let y ∈ X be a minimizer of A S k y x -E [A (X)] 2 . Then f (x) -inf y∈X f S k y x 2 = ∥A (x) -E [A (X)]∥ 2 -A S k y x -E [A (X)] 2 2 = A (x) -A S k y x , A (x) -E [A (X)] + A S k y x -E [A (X)] 2 ≤ A (x) -A S k y x 2 ∥A (x) -E [A (X)]∥ + A S k y x -E [A (X)] 2 ≤ 4c 2 A f (x) .Summing over k we getD 2 f (x) ≤ 4nc 2 A f (x). Since 12nc 2 A /σ 2 ≤ 1 < 2 we can apply Theorem B.2 a = 4nc 2 A and λ = 3/σ 2 to obtain B = 1 2 ln E e (3/σ 2 )∥A(X)-E[A(X ′ )]∥ 2 ≤ 3/σ 2 E ∥A (X) -E [A (X ′ )]∥ 2 2 -12nc 2 A /σ 2 ≤ 3 σ 2 E ∥A (X) -E [A (X ′ )]∥ 2 = 3 σ 2 V (A) . (i) Let F (h, X) = (n/2) kl L (h, X) , L (h) .Then using (Maurer [2004] )C = sup h ln E X e 2F (h,X) /2 ≤ (1/2) ln (2 √ n), so from the above ln E X E h∼Q X e (n/2)kl( L(h,X),L(h)) ≤ 3 σ 2 V (A) + 1 2 ln 2 √ n ,which is (i). By Jensen's inequalityln E X e (n/2)E h∼Q X [kl( L(h,X),L(h))] ≤ ln E X E h∼Q X e (n/2)kl( L(h,X),L(h)) ,so part (ii) then follows from Markov's inequality and division by n/2.EQUATIONMarkov's inequality gives with probability at least 1 -δ asX ∼ µ n and h ∼ Q X that ∆ (h, X) ≤ λ 4n + 3 σ 2 V (A) + ln (1/δ) λ .Optimization of λ gives (iii).(iv) We proceed as in the proof of Theorem 3.5. Letλ (h) = 3 σ 2 V (A) + ln (1/δ) (1/n) 3 σ 2 V (A) + ln (1/δ) + v(h) n and set F λ (h, X) = λ (h) ∆ (h, X) - λ (h) 2 1 -λ (h) /n v (h) n . By Lemma 3.6 2C = ln E X e 2F λ (h,X) ≤ 0, so ln E X E h∼Q X e F λ (h,X) ≤ 3 σ 2 V (A), and with probability at least 1 -δ as asX ∼ µ n and h ∼ Q X Pr ∆ (h, X) > λ (h) 1 -λ (h) /n v (h) n + 3 σ 2 V (A) + ln (1/δ) λ (h) < δ.Inserting the definition of λ (h) completes the proof.Theorem B.4 (Restatement of Theorem 4.2). Let F : H × X n → R be measurable. With probability at least 1 -δ in the draw of X ∼ µ n we have for all P ∈ P (H)E h∼P [F (h, X)] ≤ KL (P, Q X ) + ln E X E h∼Q X e F (h,X) + ln (1/δ) .Proof. Let P ∈ P 1 (H) be arbitrary. Then ,X) .E h∼P [F (h, X)] -KL (P, Q X ) = ln exp (E h∼P [F (h, X) -ln (dP/dQ X (h))]) ≤ ln E h∼P [exp (F (h, X) -ln (dP/dQ X (h)))] = ln E h∼P e F (h,X) (dP/dQ X (h)) -1 = ln E h∼Q X e F (hSo we only need to bound the last expression, which is independent of P . But by Markov's inequality (Lemma A.1) with probability at least1 -δ in X ∼ µ n ln E h∼Q X e F (h,X) ≤ ln E X exp ln E h∼Q X e F (h,X) + ln (1/δ) = ln E X E h∼Q X e F (h,X) + ln (1/δ) .We close with a method to deal with the problem of parameter optimization in the derivation of PAC-Bayesian bounds from our results. We apply it to the case of Gaussian priors centered on the output of stable algorithms, but analogous results can be equally derived for Hamiltonians with bounded differences or sub-gaussian Hamiltonians. Our first result is a PAC-Bayesian bound analogous to part (iii) of Theorem 4.1. Theorem B.5. Under the conditions of Theorem 4.1 we have with probability at least 1 -δ in X ∼ µ n for all P ∈ P (H) thatE h∼P [∆ (h, X)] > 3 σ 2 V (A) + 2KL (P, Q X ) + ln (2KL (P, Q X ) /δ) n .To prove this we first establish the following intermediate result.Proposition B.6. Under the conditions of Theorem 4.1 let K > 0 and δ > 0. Then with probability at least 1 -δ as X ∼ µ n we have for anyP ∈ P (H) with KL (P, Q X ) ≤ K that E h∼P [∆ (h, X)] ≤ 3 σ 2 V (A) + K + ln (1/δ) nProof. If KL (P, Q X ) ≤ K we get from Theorem 4.2 and inequality (8) with probability at least1 -δ in X ∼ µ n E h∼P [λ∆ (h, X)] -K ≤ E h∼P [λ∆ (h, X)] -KL (P, Q X ) ≤ ln E X E h∼Q X e λ∆(h,X) + ln (1/δ) ≤ λ 2 4n + 3 σ 2 V (A) + ln (1/δ) .Bring K to the other side, divide by λ and and optimize λ to complete the proof.To get rid of K we use a model-selection lemma from Anthony and Bartlett [1999] . Lemma B.7. (Lemma 15.6 in Anthony and Bartlett [1999] ) Suppose Pr is a probability distribution and{E (α 1 , α 2 , δ) : 0 < α 1 , α 2 , δ ≤ 1}is a set of events, such that (i) For all 0 < α ≤ 1 and 0 < δ ≤ 1,Pr {E (α, α, δ)} ≤ δ. (ii) For all 0 < α 1 ≤ α ≤ α 2 ≤ 1 and 0 < δ 1 ≤ δ ≤ 1 E (α 1 , α 2 , δ 1 ) ⊆ E (α, α, δ) .Then for 0 < a, δ < 1,Pr α∈(0,1] E (αa, α, δα (1 -a)) ≤ δ.Proof. Define the eventsE (α 1 , α 2 , δ) :=    ∃P, KL (P, Q X ) ≤ α -1 2 , E h∼P [∆ (h, X)] > 3 σ 2 V (A) + α -1 1 + ln (1/δ) n    .By Proposition B.6 they satisfy (i) of Lemma B.7 and it is easy to see, that (ii) also holds. If we set a = 1/2 the conclusion of Lemma B.7 becomesE h∼P [∆ (h, X)] > 3 σ 2 V (A) + 2KL (P, Q X ) + ln (2KL (P, Q X ) /δ) n .To get a PAC-Bayesian bound analogous to Theorem 4.1 (iv) we proceed similarly and obtain the intermediate bound that for δ > 0 with probability at least 1 -δ in X ∼ µ n for all P such thatE h∼P [v (h)] ≤ V and KL (P, Q X ) ≤ K E h∼P [∆ (h, X)] ≤ 2 V c 2 + 3 σ 2 V (A) + K + ln (1/δ) n +b c 2 + 3 σ 2 V (A) + K + ln (1/δ) n .Then we proceed as above, except that we have to use Lemma B.7 twice, once with K and once with nV . The result of this mechanical procedure is Theorem B.8. For δ > 0 with probability at least 1 -δ in X ∼ µ n for all PE h∼P [∆ (h, X)] ≤ 2 (2E h∼P [v (h)] + 1/n) 3 σ 2 V (A) + C n + 3 σ 2 V (A) + C n ,where C = 2KL (P, Q X ) + 1 + ln (2 (KL (P, Q X ) + 1) (2 (nE h∼P [v (h)] + 1)) /δ) .L (h) = E x∼µ [h (x)], expected loss of h ∈ H L (h, X) L (h, X) = (1/n) n i=1 h (X i ), empirical loss of h ∈ H ∆ (h, X) L (h) -L (h, X), generalization gap Q Q : x ∈ X n → Q x ∈ P (H), stochastic algorithm Q x (h) density w.r.t. π of Q x evaluated at h ∈ H, Q x (h) = exp (H Q (h, x)) H H : H × X n → R, Hamiltonian Z Z : X n → R, Z (x) = H exp (H (h, x)) dπ (h), partition function H Q H Q (h, x) = H (h, x) -ln Z (x) = ln Q x (h) S k y S k y x = (x 1 , ..., x k-1 , y, x k+1 , ..., x n ), substitution operator D k y,y ′ D k y,y ′ f (x) = f S k y x -f S k y ′ x , partial difference operator kl (p, q)kl (p, q) = p ln p q + (1 -p) ln Justification: The limitations are implicit in the assumptions stated to derive the results in the paper, but there is no separate "limitations" section. Guidelines:• The answer NA means that the paper has no limitation while the answer No means that the paper has limitations, but those are not discussed in the paper. • The authors are encouraged to create a separate "Limitations" section in their paper.• The paper should point out any strong assumptions and how robust the results are to violations of these assumptions (e.g., independence assumptions, noiseless settings, model well-specification, asymptotic approximations only holding locally). The authors should reflect on how these assumptions might be violated in practice and what the implications would be. • The authors should reflect on the scope of the claims made, e.g., if the approach was only tested on a few datasets or with a few runs. In general, empirical results often depend on implicit assumptions, which should be articulated. • The authors should reflect on the factors that influence the performance of the approach.For example, a facial recognition algorithm may perform poorly when image resolution is low or images are taken in low lighting. Or a speech-to-text system might not be used reliably to provide closed captions for online lectures because it fails to handle technical jargon. • The authors should discuss the computational efficiency of the proposed algorithms and how they scale with dataset size. • If applicable, the authors should discuss possible limitations of their approach to address problems of privacy and fairness. • While the authors might fear that complete honesty about limitations might be used by reviewers as grounds for rejection, a worse outcome might be that reviewers discover limitations that aren't acknowledged in the paper. The authors should use their best judgment and recognize that individual actions in favor of transparency play an important role in developing norms that preserve the integrity of the community. Reviewers will be specifically instructed to not penalize honesty concerning limitations. 


Decision: This paper introduces a method for bounding the generalization gap of stochastic learning algorithms by focusing on the exponential concentration of the algorithm's distribution around its mean. The approach is applicable to various scenarios, including Gibbs sampling and randomizations of stable algorithms, enhancing the understanding and existing bounds on generalization properties. The reviewers unanimously praised the paper for its clarity, theoretical rigor, and mathematical correctness, with concerns adequately addressed in the rebuttal. Given its strong theoretical contributions, I recommend acceptance, in agreement with all four reviewers.

Reviews: review: paper_summary: paper_summary: This paper introduces a general method to bound the logarithm of the expecattion of the exponential of the generalization gap for stochastic learning algorithms. This method is applicable when the distribution of the algorithm concentrates exponentially around its mean, extending to cases where the Hamiltonian form satisfies a bounded difference condition or is sub-Gaussian. Further, the paper discuss applications to the gibbs algorithm, improving existing bounds, Lastly the paper extends generalization guarantees to hypotheses sampled once from stochastic kernels centered at the output of uniformly stable algorithms. This advancement strengthens previous results and improves the understanding of generalization properties for algorithms based on stochastic kernels.
strength_weakness: strength_weakness: The paper is very notation-heavy, and likely not accessible to everyone. This is not really a critique of the paper tbh, but more of the nature of the result/paper and the short conference format. The authors have done a fair job of explaining the notations. But It is easy to get lost in keeping track. For example, the notion of canonical Hamiltonian H_Q and its usefulness (for example in the simple proof of Prop 3.1) is easy to overlook unless one really gets into the weeds. I would suggest adding a couple of sentences cementing the importance of H_Q in the analysis. Beyond helping through and simplifying some results, is there additional importance of H_Q ?

The conclusion and future directions/discussions/limitations section is severely lacking. Can the authors talk about limitations of the proposed method, and any further possible open problems that the reader might be interested in. 

There is no empirical verification, even with toy setups. Can the authors comment on how the presented theory can be empirically demonstrated/verified?
questions: questions: In addition to the weaknesses: 

In context of the paper, and the definition of \Delta(h,X), which we know is centered, I am not sure how Prop 3.1 is useful or applied in this paper. I understand it could be potentially useful where F and H_Q can be handled separately (assuming F being non-centered is still somehow amenable to this). But for this paper, this is not the case. 

The notation S^k_X f(\mathbf{x}) used in prop 3.2 onwards is clunky at best, and badly overloaded at worst. May I suggest using f(S^k_X \mathbf{x}) ? 

theorem 3.4 needs h(y’) \in [0,b] ? I think you mean \forall t \in \mathcal{X} h(t) \in [0,b] ?

“In practice Q is often defined by specifying some Hamiltonian H , so HQ (h, x) = H (h, x) − ln Z (x) in general” – I am not sure what this sentence means. Please expand. Are you saying the canonical H_Q can be trivially written like that? How is Q being defined through that? 
L186 “generalization guarantee of rapid convergence” .. could you expand on this please? What order is considered as “rapid”?

Minor: In a couple of places some of the references seem to be hard-coded ? e.g. references to A.1 because those are not clickable links.
limitations: limitations: Partially.
paper_summary: paper_summary: This submission is a purely theoretical work, whose main goal is to bound $\Delta(h,\mathbf{X})=\mathbb{E}[h(X)]-\frac{1}{n}\sum^n_{i=1}h(X_i)$, i.e. equation (1). After some preliminary results, the results that show this bound under different conditions are Theorem 3.4, Theorem 3.5 and Theorem 3.8. Some possible (theoretical) applications are also shown, in the form of the Gibbs algorithm, randomisation of stable algorithms and PAC-Bayes bounds with data-dependent priors.
strength_weakness: strength_weakness: I think the authors made a deliberate choice to be concise with the proofs so that the proof can be included in the main body of the paper. I really like this, but in some places, the proof is too short, so that the readers are asked to do a significant amount of algebra by themselves. If possible, it would be great if the authors could use the extra page to flesh out the proofs a little bit.
questions: questions: Displayed equation after L89: This seems to be a pointwise statement for both $h$ and $\mathbf{x}$, so should it be “for all $h\in\mathcal{H}$ and for all $\mathbf{x}\in\mathcal{X}^n$? Unless the statement should be “… is called a Hamiltonian for $Q_\mathbf{x}$” instead of “Hamiltonian for $Q$”?

Displayed equation after L162: Shouldn’t $2bc$ be $\frac{bc}{2}$, taking into account the factor of $\frac{1}{8}$? The $2nc^2$ in the numerator of the fraction should also be $\frac{nc^2}{2}$. It looks like this is corrected on L163, and working through the maths, I indeed got the claimed inequality in Theorem 3.4(ii). 

L183: I think you are missing a $\ln$ in front of the exponential?
limitations: limitations: L88: "A function $H:\mathcal{H}\times\mathcal{X}^n$" perhaps it is better to write “A function $H$ on $\mathcal{H}\times\mathcal{X}^n$? I leave this up to the authors. 

Displayed equation after L153: The spacing is a bit strange on the left?

L185: an -> and

Displayed equation after L195: The comma should be a full stop. 

L178, L389: “Assume that all” -> “Assume that for all”

L391: everz -> every
paper_summary: paper_summary: Summary
-------

The papers presents a method to bound the `generalization gap', i.e the difference between
the expected and empirical losses for a hypothesis h drawn from a probability class 
returned by the stochastic learning algorithm. The authors present a general-purpose 
method to bound the exponentiated difference, and apply this technique to Gibbs sampling 
(and other applications). 

As someone who is not an expert on the topic, but still theoretically inclined, I was
unable to appreciate the contributions of this paper. It didn't help that the paper's
presentation was not up to scratch either (see comments below). I have given a
middle-of-the-line score to reflect this but will wait to hear from expert reviewers.



Detailed comments
=================

Questions 
- Is h a hypothesis or a loss function? In 9, 10 and equation (1), it is written as a loss
  but in line 12 it is treated as a hypothesis?
- What is the motivation for bounding the difference between the expected loss of a 
  a *learned* hypothesis, and the error on the training set? In typical use cases, one is 
  interested in the test/generalization error after training. 
- From what I could gather from the Gibbs sampling use case in 4.1, this can be used to 
  bound the rate of convergence of Gibbs sampling. Is this correct? 


The presentation of the paper could improve significantly.
- It is customary (at least in CS venues), to include an outline of the results, describe 
  their significance of each result, and outline the key challenges and
  techniques used in the paper.
- The paper would also benefit from a dedicated related work section, where the authors 
  explicitly state the most relevant work and how their results compare to them. The most
  interesting comparison I saw was in section 4.1 where they compare their bound to 
  Rivasplata et al, and the improvement in the \sqrt{\log(1/\delta)} term. Even here, the 
  authors have not explained why this gap \Delta is significant. Does it lead to fast
  convergence rates for Gibbs sampling?
  Perhaps the authors could state this result up front to prime the reader for what they
  can expect from this paper.
- On the same note, the authors should do a better job of highlihgting the key results in 
  this paper. Currently, there are several lemmas/theorems presented one after the other 
  and it is hard to appreciate which ones are the most significant, and why they are 
  significant. My recommendation would be to identify the ~2 main theorems of the paper
strength_weakness: strength_weakness: See above
questions: questions: See above
limitations: limitations: See above
paper_summary: paper_summary: This work provides a novel approach to bound the generalization error (high probability bounds) of the Gibbs algorithm as an important example of Hamiltonian algorithms. The authors also applied their method to a different example of the Hamiltonian algorithm.
strength_weakness: strength_weakness: 1- In the case of the Gibbs algorithm, the contribution of this work is incremental. In particular, the authors should elaborate on why their results for the Gibbs algorithm are novel.

2- For the Gibbs algorithm, the main challenge is studying the asymptotic regime, where $\beta$ ---> \infty. It would be useful to study this regime or mention it as limitation of this analysis.
questions: questions: Sea weaknesses.
limitations: limitations: Sea weaknesses.

Comments: title: Feedback
Increasing score
Thank you for your response
comment: Dear authors,

Thank you for your response. I have read them, also the other reviews, and I retain my positive evaluation of this submission.
I want to thank the authors for their response.
I hope that the asymptotic discussion will be included in the final version.
Thanks for your response. Based on the rebuttal and the other reviews, I have increased my score.
The authors have clarified my minor doubts and I confirm my opinion that this is a solid theoretical contribution. Some experiments, even simulated ones, to validate the results will improve the quality of the paper even further.