arXiv:2610.13442stat.MLOct 2026

Manuscript Offprint

arXiv:2610.13442

Learning by Compression: Risk Estimates Attain the Law-of-Large-Numbers Rate

Simone Garatti, Marco C. Campi

Abstract

Compression schemes provide a general framework for deriving data-dependent risk bounds for learning algorithms. For learning rules based on preferent compression, existing results upper-bound the risk in terms of a sample-dependent complexity k\mathbf{k}, defined as the cardinality of the compression augmented by the training examples on which the reconstructed hypothesis is inappropriate. These results, however, yield a margin of order O(ln⁡N/N)O(\sqrt{\ln N/N}) above k/N\mathbf{k}/N. In this paper, we establish that the logarithmic factor is not intrinsic. We prove that, for every fixed confidence level 1−δ1 - \delta, the risk is bounded with probability at least 1−δ1 - \delta by

kN+O(1N),\frac{\boldsymbol{k}}{N}+O\left(\frac{1}{\sqrt{N}}\right),

uniformly over all possible values of k\mathbf{k}. Thus, risk estimates for learning algorithms based on preferent compression attain the same law-of-large-numbers rate as the empirical estimate of the probability of a fixed event. We also show that the leading term k/N\mathbf{k}/N is necessary and investigate its relation to the empirical risk. In particular, we identify regimes in which the empirical risk retains the O(1/N)O(1/\sqrt{N}) convergence rate, as well as regimes in which it converges more slowly or ceases to be consistent, while the complexity-based estimator preserves the O(1/N)O(1/\sqrt{N}) rate.

*Dipartimento di Elettronica, Informazione e Bioingegneria - Politecnico di Milano, piazza Leonardo da Vinci 32, 20133 Milano, Italia. E-mail: simone.garatti@polimi.it, web-site: https://garatti.faculty.polimi.it/

†^{\dagger}Dipartimento di Ingegneria dell'Informazione - Università di Brescia, via Branze 38, 25123 Brescia, Italia. E-mail: marco.campi@unibs.it, web-site: https://marco-campi.unibs.it/

1 Introduction

For a given event AA, the empirical mean 1N∑i=1N1(zi∈A)\frac{1}{N} \sum_{i=1}^{N} \mathbb{1}(z_i \in A) computed over an independent and identically distributed (i.i.d.) sequence z1,z2,…z_1, z_2, \ldots yields a consistent estimator of the event's probability p(A)p(A).1^{1} Moreover, adding a margin of εˉ/N\bar{\varepsilon}/\sqrt{N} to the empirical mean, where εˉ\bar{\varepsilon} satisfies relation 2π∫εˉ∞e−2x2dx=δ\sqrt{\frac{2}{\pi}} \int_{\bar{\varepsilon}}^{\infty} \mathrm{e}^{-2x^2} dx = \delta, provides an upper bound to p(A)p(A) with an asymptotic confidence of 1−δ1 - \delta:

P{p(A)≤1N∑i=1N1(zi∈A)+εˉN}→N→∞α≥1−δ.(1)\mathbb{P}\left\{p(A)\leq\frac{1}{N}\sum_{i=1}^{N}\mathbb{1}(z_{i}\in A)+\frac{\bar{\varepsilon}}{\sqrt{N}}\right\}\xrightarrow[N\to\infty]{}\alpha\geq1-\delta. \tag{1}

The rate 1/N1/\sqrt{N} of the margin is not improvable, and indeed any margin that goes to zero faster than 1/N1/\sqrt{N} is invalid for any choice of δ\delta smaller than 1/21/2 whenever p(A)p(A) is not zero or one. This fact can be expressed as “ 1/N1/\sqrt{N} is the correct rate for the margin”. In applications, this result is relevant to estimate the risk of falling in an undesirable event via a Monte-Carlo approach. For instance, the probability of failure in the transmission of strings through a communication channel can be estimated with asymptotic confidence 1−δ1 - \delta using the observed empirical mean of corrupted strings augmented by the margin εˉ/N\bar{\varepsilon}/\sqrt{N}. A justification of these facts, indeed standard in probability theory and statistical learning, can be found in Appendix A.

Estimating the probability of a fixed event A, as discussed above, is a routine task. In Machine Learning (ML), data are used to design classifiers, predictors, and, more generally, hypotheses, and a crucial goal is to estimate the risk associated to these designs, for example the probability of misclassification of a classifier, [20]. This task of simultaneously designing and estimating the risk transcends, and is in fact far more complex than, estimating the probability of a fixed event A. This is because the event in which, for instance, a classifier fails depends on the classifier itself, which is a stochastic object constructed from the data.

Significant advances in the problem of estimating the risk associated to a variety of ML algorithms have been achieved over the past few decades through the use of compression schemes. While we will be more specific with precise definitions and technical results in the next Section 2, some fundamental concepts are briefly recalled here for the purposes of this introduction. According to a definition introduced in [21], given a learning algorithm A that maps training sets S into hypotheses h=A(S)h = \mathcal{A}(S) (for example, classifiers), a compression scheme consists of (i) a compression function c, which maps any training set S into a sub-set c(S)\mathbf{c}(S), and (ii) a reconstruction function ρ\rho that

1^{1}Throughout, boldface indicates random quantities. For example, ziz_{i} indicates a random element while a specific value it takes is indicated by ziz_{i}.

sends the compressed training set c(S)\mathbf{c}(S) into the hypothesis generated by A ⁣:ρ(c(S))=A(S)\mathcal{A}\colon \rho(\mathbf{c}(S)) = \mathcal{A}(S). An important feature of A(S)\mathcal{A}(S) is its risk, which is defined as follows. Given a hypothesis hh (for example, a classifier or a predictor), one first defines a condition under which hh is deemed appropriate for an example zz. For instance, a classifier hh is appropriate for an example z=(x,y)z = (x, y), where xx is an instance and yy the corresponding label, if h(x)=yh(x) = y; that is, if applying hh to xx correctly predicts the label yy. With this premise, the risk of A(S)\mathcal{A}(S) is the probability that A(S)\mathcal{A}(S) is inappropriate for a new example zz.

In loose terms, most results in compression schemes relate the risk of A(S)\mathcal{A}(S) to the cardinality of the compression. In the data-consistent framework (i.e., the hypothesis is appropriate for all data points in the training set) and under the assumption that the maximum cardinality of c(S)\mathbf{c}(S) is bounded by an integer dd (this is called the “size” of the compression scheme), [21] and [11] establish results of the type: with high probability 1−δ1-\delta with respect to the generation of the training set SS, the risk of A(S)\mathcal{A}(S) is below a known bound that depends only on the size of SS, dd and δ\delta. Extensions to a non-consistent framework are provided in [14]. In a series of recent papers, compression schemes have been further investigated under a condition of stability, a concept natural in many learning contexts and that has its roots in [29], yielding tighter bounds than those obtained for general algorithms both in the consistent, [4], and the non-consistent, [15], settings.

The primary reference for this manuscript is [7], which provides the tightest results for bounding the risk under stability. 2^{2} Specifically, in a general, non-consistent framework and without any upper bound on the cardinality of c(S)\mathbf{c}(S), [7] proves that the risk can be upper bounded with probability 1−δ1-\delta by an explicitly defined function that takes as its argument the cardinality of c(S)\mathbf{c}(S) plus the number of remaining examples for which the hypothesis A(S)\mathcal{A}(S) is inappropriate. 3^{3} This sum is a statistic of the data, which will be denoted by symbol k\mathbf{k} in what follows, and referred to as the complexity.

Building on the results of [7], this manuscript establishes the convergence rate of the risk estimates in any learning algorithm based on stable compression. Specifically, letting NN be the cardinality of SS, we show that any valid upper bound to the risk expressed as a function of k\mathbf{k} must contain the term k/N\mathbf{k}/N plus a margin, and prove that this margin tends to zero as O(1/N)O(1/\sqrt{N}), uniformly in the value taken by the statistic k4\mathbf{k}^4. When estimating the probability p(A)p(A) of a fixed

2^{2}In [7], the notion of stability is called preference.

3^{3}For instance, if the compressed training set has cardinality of 8, and the hypothesis is inappropriate for 3 additional examples (excluding the 8 examples in the compressed set to avoid double counting in case some of them correspond to inappropriateness), then the function’s argument is 8+3=118 + 3 = 11.

4^{4}For a positive function g(N)g(N), notation O(g(N))O(g(N)) indicates a positive function f(N)f(N) such that lim sup⁡N→∞f(N)/g(N)<∞\limsup_{N\to\infty}f(N)/g(N)<\infty.

event A, this result reduces to the known convergence rate of the empirical mean estimator in (1). This manuscript proves that the same convergence rate extends to all learning frameworks based on stable compression, a fact that may come as a significant surprise. In simple terms, this means that using the data to learn does not slow down the rate at which the risk can be estimated.

The paper is organized as follows. Section 2 presents relevant facts about stable compression schemes and their use in evaluating the risk in ML applications. The main result on the convergence rate is given in Section 3, where we also provide a detailed discussion of how our findings relate to the empirical risk. The proof of the main result is postponed to Section 4.

References (23)