Tutorials › Statistical Learning (Graduate) › Choosing Among Neural Network Complexity Measures

Neural Estimation and Generalization · Tutorial 935 of 989

Choosing Among Neural Network Complexity Measures

Learn to match a neural-network complexity measure to the question, function class, and assumptions behind a generalization bound.

Advanced 13 min read

What You'll Learn

  • Define pseudo-dimension and use it to assess the richness of real-valued function classes.
  • Interpret covering numbers relative to a specified metric and scale.
  • Distinguish spectral-norm and path-norm controls, including their assumptions and invariances.
  • State the prior, posterior, and bounded-loss conditions in a PAC-Bayesian guarantee.
  • Derive a PAC-Bayesian deviation bound and a spectral-norm perturbation bound.
  • Compare the measures without treating their numerical values as interchangeable.

Why the Complexity Measure Matters

A neural network can have many parameters yet represent a comparatively restricted set of functions, or have a small parameter count while being sensitive to changes in its weights. A complexity measure makes a particular aspect of this distinction quantitative. The central question is not which measure is universally best, but which measure controls the generalization quantity of interest under assumptions that are credible for the problem.

This tutorial compares five common choices: pseudo-dimension, covering numbers, spectral norms, path norms, and PAC-Bayesian divergence. They describe different things. Pseudo-dimension measures combinatorial richness; covering numbers measure metric size at a chosen resolution; spectral and path norms constrain the weights or paths of a network; and PAC-Bayes divergence measures how far a data-dependent distribution over predictors moves from a sample-independent prior. A value from one measure cannot be directly substituted for a value from another.

Definitions and What They Measure

Definition: Let \(\mathcal F\) be a class of real-valued functions on an input space \(\mathcal X\). The class pseudo-shatters points \(x_1,\ldots,x_m\) if there are real thresholds \(r_1,\ldots,r_m\) such that, for every binary vector \((b_1,\ldots,b_m)\in\{0,1\}^m\), some \(f\in\mathcal F\) satisfies \(f(x_i)>r_i\) when \(b_i=1\) and \(f(x_i)\le r_i\) when \(b_i=0\). The pseudo-dimension \(\operatorname{Pdim}(\mathcal F)\) is the largest such \(m\), or infinity if there is no finite largest value.

Pseudo-dimension is a distribution-free, combinatorial measure of how many patterns a function class can produce. For a binary-valued class, it agrees with the VC dimension. It does not describe how far apart two predictions are numerically, nor does it use the particular input distribution. A finite pseudo-dimension can support uniform generalization bounds when the relevant loss class is also controlled; applying a function-class dimension to a loss class requires checking that link rather than assuming it.

Definition: Given a pseudometric \(d\) on a function class \(\mathcal F\), its covering number \(N(\varepsilon,\mathcal F,d)\) is the smallest number of \(d\)-balls of radius \(\varepsilon\) whose union contains \(\mathcal F\). For observations \(X_1,\ldots,X_n\), one common empirical metric is \(d_n(f,g)=\left(n^{-1}\sum_{i=1}^n(f(X_i)-g(X_i))^2\right)^{1/2}\).

A covering number is inseparable from both its metric and its scale \(\varepsilon\). The empirical metric depends on the observed inputs, whereas a population metric depends on an input distribution. Covering numbers can describe approximation at several resolutions, but a generalization result using them needs conditions connecting the chosen metric to the loss and controlling the relevant entropy.

For a network with weight matrices \(W_1,\ldots,W_L\), a common spectral quantity is the product \(\prod_{\ell=1}^L\|W_\ell\|_2\), where \(\|\cdot\|_2\) is the operator norm induced by Euclidean norms. Generalization bounds often use this product together with additional factors, such as input-radius or width-dependent terms. It is not, by itself, a generalization bound. One must check the activation, input, output, and loss assumptions in the particular theorem being used.

For a network with nonnegative homogeneous activations such as ReLU, the path norm sums the absolute products of weights along input-to-output paths. In a scalar-input, one-hidden-layer network \(f(x)=\sum_j a_j\sigma(w_jx)\), with no biases, this is \(\sum_j |a_j||w_j|\). Path norms and spectral norms are weight-based controls, but they summarize weights differently. ReLU homogeneity makes the path product invariant to rescaling a hidden unit’s incoming weights by a positive constant and its outgoing weight by the reciprocal constant.

Definition: Let \(P\) be a prior distribution on predictors, chosen independently of the training sample, and let \(Q\) be a posterior distribution on predictors, which may depend on the sample. Their Kullback–Leibler divergence is \(\operatorname{KL}(Q\|P)=\int \log(dQ/dP)\,dQ\) when \(Q\) is absolutely continuous with respect to \(P\), and infinity otherwise. PAC-Bayesian bounds use this divergence to penalize the posterior’s departure from the prior.

Unlike a norm constraint, PAC-Bayes can be applied to a distribution over predictors rather than just one network. Its price depends on the chosen prior, posterior, loss, and sample size. The prior must be fixed independently of the data for the standard guarantee below; a data-dependent choice needs a separate justification.

Worked Examples

Worked Example: Pseudo-Dimension of Thresholds

Consider \(\mathcal F=\{f_t:t\in\mathbb R\}\) on the real line, where \(f_t(x)=\mathbf 1\{x\ge t\}\). A single point \(x_1\) is pseudo-shattered: set \(r_1=1/2\). Choosing \(t\le x_1\) gives \(f_t(x_1)=1\), and choosing \(t>x_1\) gives \(f_t(x_1)=0\). Thus the two required patterns are attained.

No two ordered points \(x_1<x_2\) can be pseudo-shattered. Because the functions are binary-valued, any threshold that produces both labels must lie between 0 and 1; the pattern \((1,0)\) would then require \(x_1\ge t\) and \(x_2<t\), contradicting \(x_1<x_2\). Thresholds outside that interval cannot create additional patterns. Therefore \(\operatorname{Pdim}(\mathcal F)=1\). This describes pattern capacity, not the numerical size of prediction errors.

Worked Example: An Empirical Cover for Linear Predictors

Let \(f_w(x)=wx\), with \(-1\le w\le1\), and suppose every observed input satisfies \(|X_i|\le1\). Then \(d_n(f_w,f_v)=|w-v|\left(n^{-1}\sum_iX_i^2\right)^{1/2}\le |w-v|\). Use the nine centers \(-1,-0.75,-0.5,\ldots,0.75,1\). Each \(w\in[-1,1]\) is within \(0.125\) of at least one center, so its empirical distance to that center is at most \(0.125\), which is less than \(0.25\). Hence these centers form a \(0.25\)-cover and \(N(0.25,\mathcal F,d_n)\le9\). The calculation relies on the stated input bound and metric; it does not claim that nine is the minimum cover.

Worked Example: Spectral and Path Quantities for a ReLU Network

Take \(f(x)=2\sigma(3x)-\sigma(-2x)\), where \(\sigma(u)=\max(u,0)\). With \(W_1=(3,-2)^\mathsf T\) and \(W_2=(2,-1)\), the spectral norms are \(\|W_1\|_2=\sqrt{3^2+(-2)^2}=\sqrt{13}\) and \(\|W_2\|_2=\sqrt{2^2+(-1)^2}=\sqrt5\). Their product is \(\sqrt{65}\), approximately \(8.0623\).

The two input-to-output path products have magnitudes \(|2\cdot3|=6\) and \(|(-1)\cdot(-2)|=2\), so the path norm is \(6+2=8\). These are different summaries, even though their numerical values happen to be close here. If the first neuron’s incoming weight is multiplied by \(c>0\) and its outgoing weight divided by \(c\), its ReLU contribution is unchanged because \(\sigma(cu)=c\sigma(u)\). Its path product is also unchanged. This invariance is useful, but does not make the path norm a complete measure of predictive performance.

Worked Example: Optimizing a PAC-Bayesian Deviation Bound

Suppose the loss lies in \([0,1]\), \(n=100\), and the desired confidence is \(1-\delta=0.95\). Let the posterior be a point mass on one predictor and let the prior assign that predictor probability \(2^{-1/4}\). Then \(\operatorname{KL}(Q\|P)=-\log(2^{-1/4})=\tfrac14\log2\). Since \(\log(1/\delta)=\log20\), define \(A=\tfrac14\log2+\log20\approx3.1690191\).

The bound derived below gives, for any \(\lambda>0\), a deviation no larger than \(A/\lambda+\lambda/(8n)\). Its minimum occurs at \(\lambda=\sqrt{8nA}\): differentiating gives \(-A/\lambda^2+1/(8n)=0\). At this choice the two terms are both \(\sqrt{A/(8n)}=\sqrt{3.1690191/800}\approx0.0629387\). Their sum is approximately \(0.1258773\), or \(0.1259\) to four decimal places. Thus, on the stated confidence event, the predictor’s population risk is at most its empirical risk plus this deviation. The result is useful only for a bounded loss and the independent-prior setup; it is not a squared-loss bound for unbounded outcomes.

Two Guarantees and Their Assumptions

The following PAC-Bayesian result makes explicit why divergence is one kind of complexity control. Let \(Z_1,\ldots,Z_n\) be independent observations from a common distribution \(D\), and let \(\ell(h,Z)\in[0,1]\) for every predictor \(h\). Write \(L(h)=E_{Z\sim D}[\ell(h,Z)]\) and \(\widehat L(h)=n^{-1}\sum_i\ell(h,Z_i)\). Assume a prior \(P\) is fixed independently of the sample. Then, for each fixed, sample-independent \(\lambda>0\), with probability at least \(1-\delta\) over the sample, simultaneously for every posterior \(Q\),

Theorem: Under the preceding conditions, \(E_{h\sim Q}L(h)\le E_{h\sim Q}\widehat L(h)+\frac{\operatorname{KL}(Q\|P)+\log(1/\delta)}{\lambda}+\frac{\lambda}{8n}\).

Proof. For fixed \(h\), Hoeffding’s lemma applied to the independent bounded losses gives \(E_S\exp\{\lambda(L(h)-\widehat L(h))\}\le\exp\{\lambda^2/(8n)\}\). Integrating with respect to the sample-independent prior and using Tonelli’s theorem for the nonnegative integrand yields \(E_S E_{h\sim P}\exp\{\lambda(L(h)-\widehat L(h))\}\le\exp\{\lambda^2/(8n)\}\). Markov’s inequality therefore implies that, with probability at least \(1-\delta\), \(E_{h\sim P}\exp\{\lambda(L(h)-\widehat L(h))\}\le\exp\{\lambda^2/(8n)+\log(1/\delta)\}\). For any \(Q\ll P\), the change-of-measure inequality \(E_Q g\le\operatorname{KL}(Q\|P)+\log E_P e^g\) applied to \(g(h)=\lambda(L(h)-\widehat L(h))\) gives the claimed bound after division by \(\lambda\). For each fixed, sample-independent \(\lambda>0\), this event is uniform in \(Q\), since it is a single event defined using \(P\). The argument does not establish one event that works simultaneously for all \(\lambda>0\). If \(Q\not\ll P\), the right side is infinite and the inequality is vacuous. \(\square\)

A second guarantee explains what spectral norms can control directly. Consider depth-\(L\) networks without biases, with hidden activations that are 1-Lipschitz and satisfy \(\sigma(0)=0\), and a linear output layer. Let \(f_W\) and \(f_V\) have the same architecture, and assume \(\|x\|_2\le B\). Then

Result: The output difference is bounded by \(\|f_W(x)-f_V(x)\|_2\le B\sum_{j=1}^L\left(\prod_{k=j+1}^L\|W_k\|_2\right)\|W_j-V_j\|_2\left(\prod_{k=1}^{j-1}\|V_k\|_2\right)\), where an empty product is 1.

Derivation. Replace the layers of \(V\) by those of \(W\), one at a time, starting at the output end. The difference between the two final outputs is the sum of the \(L\) successive output changes, so the triangle inequality bounds its norm by the sum of their norms. For the change at layer \(j\), the preceding layers are \(V_1,\ldots,V_{j-1}\), and their output norm is at most \(B\prod_{k<j}\|V_k\|_2\), because each activation is 1-Lipschitz and vanishes at zero. The change at layer \(j\) has norm at most \(\|W_j-V_j\|_2\) times this quantity. The following layers use \(W_{j+1},\ldots,W_L\); their activations are 1-Lipschitz and their linear maps have operator norms \(\|W_k\|_2\), so they multiply the change by at most \(\prod_{k>j}\|W_k\|_2\). Summing these \(L\) bounds gives the result. \(\square\)

This perturbation inequality is a stability statement for outputs, not a stand-alone generalization theorem. Turning it into a statistical bound requires additional arguments, such as covering the admissible networks at an appropriate resolution and linking output changes to changes in loss. It clarifies why spectral norms can matter: they control how weight perturbations propagate, given the stated architectural and input conditions.

How to Choose Among the Measures

MeasureWhat it summarizesUseful setting and checks
Pseudo-dimensionNumber of threshold patterns a real-valued class can realizeUniform, distribution-free capacity arguments; verify the relevant loss class and sample-size conditions
Covering numberNumber of metric balls needed at resolution \(\varepsilon\)Metric-entropy arguments; specify the metric, scale, and input distribution or sample
Spectral normsLayerwise operator-norm control and propagation of perturbationsNorm-based network bounds; check activation, input-radius, architecture, and loss assumptions
Path normsSum of absolute products along input-output pathsHomogeneous networks where rescaling invariance is relevant; check the exact path definition and theorem
PAC-Bayesian divergenceDeparture of a posterior over predictors from a fixed priorData-dependent or randomized predictors with a suitable independent prior; check loss range and divergence finiteness

These choices answer different questions. Pseudo-dimension asks how many label-like patterns are possible. A covering number asks how many distinguishable functions remain at a specified resolution. Spectral and path norms impose different geometric restrictions on network weights. PAC-Bayes asks whether a posterior concentrated on useful predictors can be supported by a prior without paying too large a divergence penalty. A good analysis selects the measure whose theorem matches the predictor, data, and loss, rather than choosing a measure merely because it is easy to calculate.

Common Pitfall

Wrong reasoning: “This network has a small spectral-norm product, so its generalization error must be small.” The product alone does not imply that conclusion. A bound may also depend on input magnitude, depth, a covering scale, the loss, sample size, or other quantities; its assumptions may fail for the model at hand.

Correction: Identify the precise theorem and verify each hypothesis before interpreting its complexity term. Likewise, do not compare a pseudo-dimension, a covering number, a norm, and a KL divergence as though they shared units or a common scale. They can each support generalization control, but only through their own assumptions and bound.

Key takeaway: Choose a complexity measure by matching its meaning and assumptions to the generalization argument. A complexity value is informative only together with the theorem that uses it.

Check Your Understanding

Answer these by naming both the measure and the assumptions that make it relevant.

  1. What pattern-counting feature does pseudo-dimension measure, and why does it not record prediction distances?
  2. Why must a covering-number statement specify its metric and resolution?
  3. In the spectral perturbation result, where do the input bound and 1-Lipschitz activation assumption enter?
  4. What rescaling leaves a ReLU path product unchanged, and why does that not make path norm equivalent to spectral norm?
  5. For the PAC-Bayesian bound, which distribution must be independent of the sample, and what role does \(\operatorname{KL}(Q\|P)\) play?
Clinical Biostats