Context. A uniform convergence bound is no smaller than what the class can fit, and Zhang et al. showed that networks which generalize on real labels also fit random ones. PAC-Bayes avoids this by depending on the solution found: it certifies a distribution over weights, and the bound depends on only through its KL divergence from a prior fixed before the data. Dziugaite and Roy (2017) made this nonvacuous by optimizing a Gaussian distribution of weights around the SGD solution to minimize the bound itself; Lotfi et al. (2022) put a point mass on a compressed model under a prior that weights each model by its code length. The generalization gap is controlled by how many nats the trained model takes to describe, per training example. A flat minimum near initialization is a short Gaussian description (about one bit per seven examples), a network trained in a random low-dimensional subspace and quantized is a code of a few thousand bits, and what helps in practice (convolutions, pretraining) shows up as shorter codes.
Setting and the bound. Classification with 0-1 loss and examples. A randomized classifier has empirical error and true error . With the Bernoulli KL and , Langford and Seeger's form of McAllester's bound says that for every prior chosen without the sample, with probability at least , simultaneously for all , Because the event does not depend on , the posterior may be chosen after seeing the data, which licenses optimizing it; only must be fixed in advance. The exact inverse matters near zero error: , whereas Pinsker's relaxation adds a term of order . Lotfi et al. plug their KL into Catoni's bound for the risk and empirical risk of one model : for fixed , with probability at least , where and the last logarithm account for a union bound over a grid of ; like the kl form it is of order at small training error. My check (zero training error, KL 2,000 nats, , since the paper does not state its ) gives 3.6% against 3.3% for the kl form.
Main results. Dziugaite and Roy train fully connected networks (0.33M to 2.4M parameters) on MNIST with digits 0-4 against 5-9, . With optimized from the SGD solution, the bound on the stochastic network's error, valid with probability 0.965, is 16.1% for one hidden layer of 600 units (471k parameters, KL 5,144 nats) and at most 22.3% across six architectures. The stochastic networks have test error 3.2% to 3.5% (the SGD networks 1.3% to 1.8%), so the bound is about five times the truth but far from vacuous. On random labels the optimized posterior gives up training accuracy (11.2% error) and still needs about 40 times the KL, so the bound is vacuous, as it should be. Lotfi et al., at with priors fixed before the sample, get 11.6% on MNIST (LeNet-5 compressed to 0.38 KB), 32.8% on FashionMNIST, 58.2% on CIFAR-10 (1.2 KB), 94.6% on CIFAR-100 and 93.5% on ImageNet.
A Gaussian prior centered at the random initialization turns the KL into a penalty on precision and on distance traveled. Take and , where the initialization is drawn before the data and so is a legal prior mean. The Gaussian KL penalizes every weight that must be stated precisely (), for spread wider than the prior and for how far training moved. Centering at matters: initialization breaks the permutation symmetry of hidden units, the authors expect SGD not to undo it, and the bounds are much better than with a zero mean. No single suits every architecture and may not depend on , so the prior variance is picked from a grid by a union bound: the -th prior gets confidence , these sum to , and the cost, about nats added to the KL, is negligible next to 5,000.
Minimizing the bound maps out a large axis-aligned ellipsoid of low loss around the SGD solution. The objective, a logistic surrogate plus Pinsker's square root of the complexity term, has the flat-minimum trade-off built in: raising lowers the KL through the term until the injected noise starts to raise the training loss, so the optimizer learns, weight by weight, how imprecisely each can be stated. The mean is free to move, but the SGD solution stays deep inside the posterior: in the norm it is closer to the posterior mean than every one of 10,000 draws from . The reported number chains a Monte Carlo bound into the exact inverse: cannot be computed, so the mean training error of draws from is turned into an upper bound by a kl-form Chernoff bound, and since is increasing it can be fed in, with the complexity term including the cost of the prior grid, valid with probability . My recomputation from the table (whose training error is already the Monte Carlo upper bound, so only the outer inverse is applied) matches all six bounds within 0.005, and Pinsker's form would have given 0.245 for the 600-unit network, so the exact inversion is worth about eight percentage points.
With a point mass and a universal prior, the KL is the code length of the model. Lotfi et al. put a point mass on one compressed model and use the prior , with the prefix Kolmogorov complexity given the architecture and the random seed and by Kraft's inequality. Then where is the length in bits of any program that reproduces . Against a continuous prior a point mass has infinite KL, which is why Dziugaite and Roy needed a Gaussian; against this discrete prior PAC-Bayes is the Occam bound, a union bound over codes at confidence each.
Training in a random subspace and quantizing makes the code scale with the task instead of the network. Write with a fixed random and train only ; given the seed, and cost nothing, so the code carries only : the selected is 1,000 for MNIST, 3,500 for CIFAR-10 and 10,000 for CIFAR-100, and it grows with the difficulty of the task, which lets the bound adapt. Each is rounded to one of learned levels, trained jointly with straight-through gradients so the network adapts to its own rounding, and arithmetic coding with the empirical level frequencies gives for the symbols, a half-precision codebook and the frequencies. For MNIST with and this is at most 2,992 bits (about 0.37 KB at the paper's 8,192 bits per KB), about 0.04 nats per training example. Standard pruning with the same quantization and coding gives 47.9% on MNIST at 6.5 KB. Every choice made after seeing the data adds to the code length, bits for a grid of values fixed in advance, so the whole hyperparameter search costs under 10 bits.
A prior trained on part of the sample turns the bound into a validation estimate, while a prior pretrained on independent data keeps it explanatory. If the prior is a checkpoint trained on part of the sample and the bound is evaluated on the rest, the optimal subspace dimension is 0 in every dataset: the posterior is the checkpoint itself, and the bound is a validation estimate. All the learning sits in the prior, which the bound does not constrain, so only data-independent bounds speak to why a network generalized. A checkpoint pretrained on an independent dataset avoids the objection: the bound constrains everything learned downstream and nothing learned upstream. CIFAR-10 goes from 58.2% to 35.1% even though the fine-tuned EfficientNet-B0 is much larger than the from-scratch ConvNet, since its difference from the checkpoint compresses to about 1 KB.
Breaking structure in the data or the model lengthens the code. At matched size a CNN gets lower bounds than an MLP on CIFAR-10 and loses that advantage when the pixels are shuffled. With shuffled labels every bound is 100%, and this is forced: at most a fraction of random label strings compress by bits, and a fitted model is itself a compressor of the labels, so with probability a model that fits random labels well must be about as long as the labels. Full-batch training gives about the same bounds as SGD, so SGD's implicit bias is not needed for the certificate.
What the certified numbers mean. Neither certificate is for the network one would deploy. Dziugaite and Roy's is for the stochastic network , about twice as bad as the SGD network it came from, and Nagarajan and Kolter argue that the standard ways of derandomizing it reduce to two-sided uniform convergence. Lotfi et al.'s is for the compressed, quantized subspace model: by my kl-form back-of-envelope (an estimate, not a number the paper reports), a 58.2% bound at about 1.2 KB on 50,000 examples requires that model's training error to be near 32%, or somewhat less under Catoni's form (31% at , 22% at ), much worse than the full network, and relating the two is open. Dziugaite and Roy show that SGD's solutions have this structure but not why SGD finds them, and the compression bounds do not explain why bigger networks generalize better, since the compressed size still increases with width. Compressibility implies generalization here, with no claim of the converse, and ImageNet stays essentially vacuous.
Terms
- the PAC-Bayes-kl bound; holds for all at once, fixed before the data
- largest with ; about when , computed by Newton steps
- Stochastic neural network
- weights redrawn from at each prediction; the object the bound certifies
- prior centered at the random initialization, which breaks hidden-unit symmetries
- prior-variance grid; confidence each, costing about nats
- point-mass KL is the code length of the model, plus a delimiter cost
- Occam bound
- PAC-Bayes with a point mass: a union bound over codes at confidence
- training in a random -dimensional subspace; seed makes free to describe
- Hyperparameter bits
- a grid of values fixed in advance costs bits; the whole search under 10
- Data-dependent prior
- optimal : the bound becomes a held-out estimate for the prior's checkpoint
Quiz
- The posterior is optimized on the same training set that the bound is evaluated on. Why does the guarantee survive?PAC-Bayes bounds are uniform over posteriors: the failure event depends on and only. Data-dependent choices of the prior are a different matter, which is why the prior variance needs its own union bound.
- At evaluation Dziugaite and Roy invert the kl bound exactly instead of using Pinsker's . Why does this matter so much when the training error is small?The Bernoulli kl is very steep near (), so a small error forces the true error to within about . Pinsker uses only the quadratic lower bound , which is loose there.
- Which statement about the 16.1% certificate for the 600-unit network is correct?The PAC-Bayes theorem controls , a population quantity for the randomized classifier. Passing to a single deterministic network needs a further argument, and that derandomization step is where Nagarajan and Kolter's objection applies.
- What does the 58.2% CIFAR-10 bound certify?The posterior is a point mass on the decoded model, so the bound concerns that model only. By a kl-form estimate (the paper does not report it) its training error must be around 30% to give 58.2% at about 1.2 KB, somewhat less under Catoni's form, so it is much worse than the network one would deploy.
Sources
- Gintare Karolina Dziugaite and Daniel M. Roy. Computing Nonvacuous Generalization Bounds for Deep (Stochastic) Neural Networks with Many More Parameters than Training Data. UAI, 2017.
- Sanae Lotfi, Marc Finzi, Sanyam Kapoor, Andres Potapczynski, Micah Goldblum, and Andrew Gordon Wilson. PAC-Bayes Compression Bounds So Tight That They Can Explain Generalization. NeurIPS, 2022.
- Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. ICLR, 2017.