SlowGuess/NeurIPS_2023_OCR huggingface dataset:
As explained further in Appendix C.1.3, this fixed-size compressibility framework, which is suitable to upper bound the expectation of the generalization error, can be extended to variable-size compressibility in a way that is similar to [SZ23] in order to upper bound the generalization error with high probability. We notice that, in essence, the core idea of the compressibility framework of Blum-Langford, which we recall in Appendix B.1, can be seen as a one-shot counterpart of our approach. As discussed in [SGRS22, SZ23], in the one-shot case one deals with the "worst case" scenario; and this results in bounds that involve combinatorial terms [BL03]. In contrast, our information-theoretic framework allows us to bound the compression rate  $R$  in terms of a simpler new quantity: the relative entropy of the joint conditional  $P(\hat{Y}^n, \hat{Y}'^n | Y^n, Y'^n)$  and a (symmetric) conditional prior  $\mathbf{Q}$  over  $\hat{y}^{2n}$  given  $Y^{2n}$ .
Our approach to establishing a bound on the compressibility of  $\hat{\mathfrak{V}}^{2mn}$  in terms of information-theoretic measures starting from the combinatorial approach of [BL03] and by using block-coding essentially consists in a suitable combination of the following key proof steps: (i) introduce and use the symmetries of Definition 1 to rearrange  $(S^m,S'^m)$ , (ii) generate the codewords using symmetric priors and (iii) analyze the minimum codebook size needed to "cover" reliably  $\hat{\mathfrak{V}}^{2mn}$ , essentially by use of the covering lemma. As shown in [SGRS22, SZ23] and also our proofs, the last two ingredients can be merged via the Donsker-Varadhan's variational representation lemma. The application of this lemma is reminiscent of information-theoretic works on the generalization error such as [RZ16, XR17, SZ20].
2.2 Generalization bounds using type-I symmetric priors
One way to rearrange indistinguishably  $(S, S')$  as  $\mathfrak{Z}^{2n}$  is as follows: Let  $\mathbf{J} = (J_1, \ldots, J_n)$  be a vector of  $n$  i.i.d. Bernoulli  $(\frac{1}{2})$  random variables  $J_i \in \{i, i + n\}$ ,  $i \in [n]$ . For every  $i \in [n]$ , let the random variable  $J_i^c \in \{i, i + n\}$  be defined such that  $J_i^c = i + n$  if  $J_i = i$  and  $J_i^c = i$  if  $J_i = i + n$ . Also, let the vector  $\mathbf{J}^c = (J_1^c, \ldots, J_n^c)$ . For  $i \in [n]$ , we let the random variables  $\mathfrak{Z}_{J_i}$  and  $\mathfrak{Z}_{J_i^c}$  be defined as  $\mathfrak{Z}_{J_i} = Z_i$  and
$\mathfrak{Z}_{J_i^c} = Z_i'$ . Observe that the vector  $\mathfrak{Z}^{2n} = (\mathfrak{Z}_1, \ldots, \mathfrak{Z}_{2n})$  is a  $\mathbf{J}$ -dependent random re-arrangement of the samples of the training and ghost datasets  $S$  and  $S'$ . Without knowledge of  $\mathbf{J}$  every element of the vector  $\mathfrak{Z}^{2n}$  has equal likelihood to be from  $S$  or  $S'$ . A similar construction was used in the context of the analysis of Rademacher complexity and the CMI of [SZ20]. We use Type-I symmetric priors, block coding and information-theoretic covering arguments in order to analyse the space spanned by the random vector  $\mathfrak{Z}^{2n}$ . This yields the generalization bound stated in the next theorem whose proof is deferred to Appendix E.2.
Theorem 1. i. Let  $\mathcal{Q}_i$  be the set of type-I symmetric conditional priors on  $(\hat{\mathbf{Y}},\hat{\mathbf{Y}}^{\prime})$  given  $(\mathbf{Y},\mathbf{Y}^{\prime})$ . Then,  $\mathbb{E}_{S,W}[\mathrm{gen}(S,W)]\leqslant \sqrt{2R / n}$ , with
$$
R \leqslant \inf  _ {\mathbf {Q} \in \mathcal {Q} _ {i}} \mathbb {E} _ {\mathbf {Y}, \mathbf {Y} ^ {\prime}} \left[ D _ {K L} \left(\mathbb {E} _ {\mathbf {X} ^ {\prime}, \mathbf {X}, W} \left[ P _ {\hat {Y} | X, W} ^ {\otimes 2 n} \left(\hat {\mathbf {Y}}, \hat {\mathbf {Y}} ^ {\prime} | \mathbf {X}, \mathbf {X} ^ {\prime}, W\right) \right] \| \mathbf {Q}\right) \right] = I (\mathbf {J}; \hat {Y} ^ {2 n} | Y ^ {2 n}) \tag {2}
$$
where  $\mathbf{Y},\mathbf{Y}^{\prime}\sim \mu_{Y}^{\otimes 2n}$  and  $\mathbf{X}',\mathbf{X},W\sim P_{\mathbf{X}'|\mathbf{Y}'}P_{\mathbf{X},W|\mathbf{Y}}$ . Also the mutual information is calculated with respect to the joint distribution  $P_{\mathbf{J},\hat{Y}^{2n},Y^{2n}} = \text{Bern}(1/2)^{\otimes n}\mu_{Y}^{\otimes 2n}P_{\hat{Y}_{\mathbf{J}}^{2n},\hat{Y}_{\mathbf{J}^{c}}^{2n}|Y_{\mathbf{J}}^{2n}Y_{\mathbf{J}^{c}}^{2n}}$  and the latter term is defined as  $\mathbb{E}_{\mathbf{X}',\mathbf{X},W}\left[P_{\hat{Y} |X,W}^{\otimes 2n}(\hat{Y}_{\mathbf{J}}^{2n},\hat{Y}_{\mathbf{J}^{c}}^{2n}|\mathbf{X},\mathbf{X}^{\prime},W)\right]$  in which  $\mathbf{X}',\mathbf{X},W\sim P_{\mathbf{X}'|Y_{\mathbf{J}^{c}}^{2n}}P_{\mathbf{X},W|Y_{\mathbf{J}}^{2n}}$ .
ii. For any  $\delta \in \mathbb{R}^{+}$  and any conditional type-I symmetric prior  $\mathbf{Q}$  on  $(\hat{\mathbf{Y}},\hat{\mathbf{Y}}^{\prime})$  given  $(\mathbf{X},\mathbf{Y},\mathbf{X}^{\prime},\mathbf{Y}^{\prime})$ , with probability at least  $(1 - \delta)$  over choices of  $S,S^{\prime},W\sim P_{S^{\prime}}P_{S,W}$ , it holds that
$$
\hat {\mathcal {L}} (S ^ {\prime}, W) - \hat {\mathcal {L}} (S, W) \leqslant \sqrt {\frac {4}{2 n - 1} \left(D _ {K L} \left(P _ {\tilde {Y} | X , W} ^ {\otimes 2 n} (\hat {\mathbf {Y}} , \hat {\mathbf {Y}} ^ {\prime} | \mathbf {X} , \mathbf {X} ^ {\prime} , W) \| \mathbf {Q}\right) + \log (\sqrt {2 n} / \delta)\right)}.
$$
A couple of remarks are in order. The part i of the result of Theorem 1 can be understood as being some form of the f-CMI of [HRVSG21] in which the function  $f$  represents the predicted labels – in fact our result is slightly stronger comparatively, since instead of conditioning on  $Z^{2n}$  as in the f-CMI of [HRVSG21] one here conditions only on  $Y^{2n}$ . Incidentally, the result also unveils an appealing connection between an extension of the compressibility approach of [BL03] (in this extension one needs to consider Type-I symmetric priors) and CMI and f-CMI [SZ20, HRVSG21, HD22]. However, for type-II and type-III symmetries, used in the coming sections, our framework goes beyond the CMI framework. The type-I priors have been also used in [GSZ21] to establish (fast-rate) tail bounds for the CMI framework. Due to the difference in the considered setups, their results are not directly comparable with ours. We also note that the above result (and some of the results in the rest of the paper) is kept for clarity and can be trivially improved, by i) moving  $\mathbb{E}_{\mathbf{Y},\mathbf{Y}'}$  outside the square root, ii) by rewriting  $\mathbb{E}[\mathrm{gen}(s,w)] = \frac{1}{n}\sum_{i\in [n]}\mathbb{E}[\mathrm{gen}(z_i,w)]$ , and applying the bound for each  $\mathbb{E}[\mathrm{gen}(z_i,w)]$ , similar to [BZV20, HRVSG21, RGBTS21], iii) by extending the results in accordance with e-CMI framework [SZ20, HD22], and iv) establishing tail bound on  $\mathrm{gen}(S,W)$ , by noting that with probability at least  $(1 - \delta)$ ,  $\hat{\mathcal{L}}(S',W) \geqslant \mathcal{L}(W) - \sqrt{\log(1 / \delta) / (2n)}$  (similar to Theorem 5).
Next, observe that for any  $\mathbf{Q} \coloneqq \mathbb{E}_{\mathbf{X}, \mathbf{X}'|\mathbf{Y}, \mathbf{Y}'}[\mathbf{Q}_1(\hat{\mathbf{Y}}, \hat{\mathbf{Y}}'| \mathbf{X}, \mathbf{X}', \mathbf{Y}, \mathbf{Y}')]$ , where  $\mathbf{Q}_1(\hat{\mathbf{Y}}, \hat{\mathbf{Y}}'| \mathbf{X}, \mathbf{X}', \mathbf{Y}, \mathbf{Y}')$  is an arbitrary type-I symmetric prior, and by using the Jensen's inequality, we have
$$
\operatorname {R H S} \left(2\right) \leqslant \mathbb {E} _ {S, S ^ {\prime}, W \sim P _ {S, W} P _ {S ^ {\prime}}} \left[ D _ {K L} \left(P _ {\hat {Y} | X, W} ^ {\otimes 2 n} \left(\hat {Y} ^ {n}, \hat {Y} ^ {\prime n} \mid X ^ {n}, X ^ {\prime n}, W\right) \| \mathbf {Q} _ {1}\right) \right]. \tag {3}
$$
Relation to Mutual Information. A particular choice of the conditional prior  $\mathbf{Q}_1$  in the RHS of (3) is  $Q^{\otimes 2n}$  for some prior  $Q$  defined over  $\mathcal{V}$ . For this special choice, the RHS of (3) is given by
$$
n \mathbb {E} _ {S, W} \mathbb {E} _ {X \sim \hat {\mu} _ {X \mid S}} \left[ D _ {K L} \left(P _ {\hat {Y} \mid X, W} (\hat {Y} | X, W) \| Q\right) \right] + n \mathbb {E} _ {X ^ {\prime}, W \sim \mu_ {X} P _ {W}} \left[ D _ {K L} \left(P _ {\hat {Y} \mid X, W} (\hat {Y} ^ {\prime} | X ^ {\prime}, W) \| Q\right) \right], \tag {4}
$$
where  $\hat{\mu}_{X|S}$  is the empirical distribution of  $X$  in the dataset  $S$ . Moreover, by choosing  $Q$  as the marginal distribution of  $\hat{Y}$  under  $P_{\hat{Y} |X,W}P_{S,W}$ , it is easy to see that the first term of the sum of the RHS of (4) coincides with  $n\hat{I}(X; \hat{Y})$  for that choice, where  $\hat{I}(\cdot; \cdot)$  stands for the "empirical mutual information" as computed from the available samples. Thus, the contribution of this term to the bound on generalization error does not necessarily vanish as  $n \to \infty$  (unless the empirical mutual information itself is small). In fact, as already observed in [GK19], there exist models which generalize well but have non-small mutual-information  $\hat{I}(X; \hat{Y})$ . This instantiates that mutual-information type bounds may fall short of explaining true generalization capability, an observation which was already made in [GK19]. The bound on the generalization error of our Theorem 1, which is provably tighter (see (3)), then possibly remedies this issue.
The reader may notice the absence of a "disintegrated bound" here, as opposed to the classical single-draw PAC Bayes bound [Cat07]. This is due to the choice of the loss function, which includes an expectation term.
In what follows we further investigate the relationship of the result of our Theorem 1, which is based on KL-divergence, to VC-dimension and mutual information type bounds on the generalization error.
Relation to VC-dimension Suppose that the VC-dimension of the hypothesis class is  $d$ . Then, using the Sauer-Shelah lemma [Sau72, She72] we get that given any  $\mathbf{X}$  and  $\mathbf{X}'$  one can have at most  $(2en / d)^d$  distinct labels. By letting the conditional prior  $\mathbf{Q}_1$  be a uniform distribution over all such possible predictions, it is easily seen that the KL divergence term of our Theorem 1 is upper bounded by  $d\log (2en / d)$ . This means that the result of our Theorem 1 recovers and possibly improves over the VC-dimension bound.
Structure and "simplicity" of the learning algorithm. Let us consider a simple example. Suppose that  $\mathcal{X} = [0,1] \subset \mathbb{R}$  and let  $\tau \in (0,1)$  be a parameter. Then, consider the set of deterministic classifiers  $w$  as follows:  $P_{\hat{Y} | X, W}(\hat{y} | x, w) = 1$  if  $(\hat{y} = 1$  and  $x \geqslant \tau)$  or  $(\hat{y} = 0$  and  $x < \tau)$ ; and  $P_{\hat{Y} | X, W}(\hat{y} | x, w) = 0$  otherwise. It is well known that the VC-dimension of this learning class is  $d = 1$ . Then, by recalling the aforementioned relation to the VC dimension, we obtain that our Theorem 1 yields a bound on the generalization error which is  $\mathcal{O}(\sqrt{\log(n) / n})$ . In particular, it is easy to see that this bound vanishes as  $n \to \infty$ . This is in sharp contrast with the mutual information term  $\hat{I}(X; \hat{Y})$  which does not necessarily vanish for large  $n$ . For example, if the pair  $(X, Y)$  is such that  $Y = 1$  iff  $X \geqslant \tau^{*}$  for some  $\tau^{*} \in (0,1)$ , then the ratio between RHS of (4) and  $n$  converges (for large  $n$ ) to a value which is at least  $H(Y)$  (because  $\hat{I}(X; \hat{Y}) \to I(X; Y)$  as  $n \to \infty$  and, in this example,  $I(X; Y) = H(Y)$ ).
The above example indicates that using mutual information as a regularizer for learning algorithms (as is the case in IB) may fail to find models that generalize well and have a comparatively simple structure. In fact, using a different approach, it was already observed in [AG19] and [DKSV20] that using the mutual information term as a complexity measure does not reflect the "structure" of the learning algorithm and considering it as a regularizer might not favor "simple" learning algorithms. This suggests that mutual information regularizer in the IB approach may be replaced by the KL divergence term of the RHS of (3) (when the latent variables are considered instead of predictions) which does reflect the complexity of the encoder's structure. As investigated and shown in Section 3, in addition to favoring encoders of simpler structure, our approach provides theoretical guarantees of the generalization error.
2.2.1 Lossy compressibility
The above approach and results can be extended to any bounded loss function and continuous variables  $Y$  and  $\hat{Y}$  (see the next section where continuous latent variables are studied). In the regime of continuous variables, a standard result of rate-distortion theory stipulates that any lossless encoding of  $\hat{Y}^n$  and  $\hat{Y}^{\prime n}$  may require an infinite number of bits, making the generalization bounds vacuous. This is precisely why Shannon's mutual information fails as a regularizer in deterministic learning algorithms with continuous alphabet variables. On the other hand, our approach can be easily extended to include the lossy compression of the labels (see Appendix C.1.2; in the same spirit as done in [SGRS22] for the hypothesis compression. The following result states a lossy in-expectation bound and a lossy tail bound is reported in Appendix A.
Theorem 2. Let  $\mathcal{Q}_i$  be the set of type-I symmetric conditional priors on  $(\hat{\mathbf{Y}},\hat{\mathbf{Y}}^{\prime})$  given  $(\mathbf{Y},\mathbf{Y}^{\prime})$ . Then, for any  $\epsilon \in \mathbb{R}$ ,  $\mathbb{E}_{S,W}[\mathrm{gen}(S,W)]$  is upper bounded by
$$
\inf _ {P _ {\hat {W} | \mathcal {S}}} \inf _ {\mathbf {Q} \in \mathcal {Q} _ {i}} \sqrt {\frac {1}{n} \mathbb {E} _ {\mathbf {Y} , \mathbf {Y} ^ {\prime}} \left[ \right. D _ {K L} \left( \right.\mathbb {E} _ {\mathbf {X} ^ {\prime} , \mathbf {X} , \hat {W}} \left[ P _ {\hat {Y} | X , \hat {W}} ^ {\otimes 2 n} (\hat {\mathbf {Y}}, \hat {\mathbf {Y}} ^ {\prime} | \mathbf {X} , \mathbf {X} ^ {\prime} , \hat {W}) \right]\left\| \right. \mathbf {Q}\left. \right)\left. \right]} + \epsilon ,
$$
where  $\mathbf{Y},\mathbf{Y}^{\prime}\sim \mu_{\mathbf{Y}}^{\otimes 2n}$ $\mathbf{X}',\mathbf{X},\hat{W}\sim P_{\mathbf{X}'|\mathbf{Y}'}P_{\mathbf{X},\hat{W} |\mathbf{Y}}$  and the first infimum is over all  $P_{\hat{W}|S}$  satisfying  $\mathbb{E}_{P_{S,W}P_{\hat{W}|S}}\big[\mathrm{gen}(S,W) - \mathrm{gen}(S,\hat{W})\big]\leqslant \epsilon .$
A proof of this theorem follows by an easy combination of the distortion criterion with the bound on  $\mathbb{E}_{S,\hat{W}}\big[\mathrm{gen}(S,\hat{W})\big]$  obtained by application of Theorem 1 to the compressed model  $\hat{W}$  (not  $W$ ). This simple trick, which is related conceptually to lossy source coding, prevents the KL-divergence term from taking very large (infinite) values for continuous alphabet variables. Moreover, the lossy compressibility also offers an interpretation of the geometrical compressibility concept that was observed to be related to the generalization performance in [GK19].
2.3 Generalization bounds using type-II symmetric priors
In this section, we consider another way to rearrange indistinguishably  $(S,S^{\prime})$  as  $3^{2n}$ , which is inspired by [BL03]. Let  $\mathbf{T} = \{T_1,\dots ,T_n\}$ , be a random set obtained by picking uniformly  $n$  indices from  $\{1,\ldots ,2n\}$  without replacement. Note that in contrast to  $\mathbf{J}$  which had i.i.d. components, here the components of  $\mathbf{T}$
are dependent. let  $\mathbf{T}^c = \{1, \dots, 2n\} \backslash \mathbf{T}$  be the complement of  $\mathbf{T}$ , having the elements  $\mathbf{T}^c = \{T_1^c, \dots, T_n^c\}$ . Now, for each  $i \in [n]$ , let  $(\mathfrak{Z}_{T_i}, \mathfrak{Z}_{T_i}^c) = (Z_i, Z_i')$ . We use type-II symmetric prior to cover such rearranged vectors. To state the result, first we need to define the function  $h_D(x; x') \colon [0, 1] \times [0, 1] \to [0, 2]$  as follows:
$$
h _ {D} \left(x, x ^ {\prime}\right) := 2 h _ {b} \left(\frac {x + x ^ {\prime}}{2}\right) - h _ {b} (x) - h _ {b} \left(x ^ {\prime}\right), \tag {5}
$$
where  $h_b(x) \coloneqq -x\log_2(x) - (1 - x)\log_2(1 - x)$ . Note that  $h_D(x,x') / 2$  is equal to the Jensen-Shannon divergence between two binary Bernoulli distributions with parameters  $x$  and  $x'$ . The reader is referred to Appendix A for the relation of this function with the combinatorial term appeared in [BL03]. The function  $h_D(\cdot ,\cdot)$  has the following interesting properties, proved in Appendix E.3.
Lemma 1.  $\forall (x,x^{\prime})\in [0,1]\times [0,1],$  we have: (i)  $h_D(x,x')\geqslant (x - x')^2$  , (ii)  $h_D(x,0)\geqslant x$  , (iii)  $h_D(x,x')$  is increasing with respect to  $x$  in the range  $[x',1]$  , and (iv)  $h_D(x,x')$  is convex with respect to both inputs.
Now, we state the main result of this section.
Theorem 3. Let  $\mathcal{Q}_{ii}$  be the set of type-II symmetric priors on  $(\hat{\mathbf{Y}},\hat{\mathbf{Y}}^{\prime})$  given  $(\mathbf{Y},\mathbf{Y}^{\prime})$ . Then, for  $n\geqslant 10$
$$
\left. n h _ {D} \left(\mathbb {E} _ {W} [ \mathcal {L} (W) ], \mathbb {E} _ {S, W} \left[ \hat {\mathcal {L}} (S, W) \right]\right)\right) \leqslant
$$
$$
\inf  _ {\mathbf {Q} \in \mathcal {Q} _ {i i}} \mathbb {E} _ {\mathbf {Y}, \mathbf {Y} ^ {\prime}} \left[ D _ {K L} \left(\mathbb {E} _ {\mathbf {X} ^ {\prime}, \mathbf {X}, W} \left[ P _ {\hat {Y} | X, W} ^ {\otimes 2 n} \left(\hat {\mathbf {Y}}, \hat {\mathbf {Y}} ^ {\prime} | \mathbf {X}, \mathbf {X} ^ {\prime}, W\right) \right] \| \mathbf {Q}\right) \right] + \log (n) = I \left(\mathbf {T}; \hat {Y} ^ {2 n} | Y ^ {2 n}\right) + \log (n),
$$
where  $\mathbf{Y},\mathbf{Y}^{\prime}\sim \mu_{Y}^{\otimes 2n}$  and  $\mathbf{X}',\mathbf{X},W\sim P_{\mathbf{X}'|\mathbf{Y}'}P_{\mathbf{X},W|\mathbf{Y}}$  . Also the mutual information is calculated with respect to the joint distribution  $P_{\mathbf{T},\hat{Y}^{2n},Y^{2n}} = P_{\mathbf{T}}\mu_{Y}^{\otimes 2n}P_{\hat{Y}_{\mathbf{T}}^{2n},\hat{Y}_{\mathbf{T}^{c}}^{2n}|Y_{\mathbf{T}}^{2n}Y_{\mathbf{T}^{c}}^{2n}}$  and the latter term is defined as  $\mathbb{E}_{\mathbf{X}',\mathbf{X},W}\Big[P_{\hat{Y} |X,W}^{\otimes 2n}(\hat{Y}_{\mathbf{T}}^{2n},\hat{Y}_{\mathbf{T}^{c}}^{2n}|\mathbf{X},\mathbf{X}^{\prime},W)\Big]$  in which  $\mathbf{X}',\mathbf{X},W\sim P_{\mathbf{X}'|Y_{\mathbf{T}^{c}}^{2n}}P_{\mathbf{X},W|Y_{\mathbf{T}}^{2n}}$
The proof of Theorem 3 is deferred to Appendix E.4. Also, a similar tail bound is provided in Appendix A.
Using the part (i) of Lemma 1, it can be seen that if the value of the KL divergence term is larger than  $\log(n)$  then the bound of Theorem 3 is tighter than that Theorem 1. Also, using part (ii) of Lemma 1 it is seen that if the error on the training set is zero (a setting referred to as "realizable case" in [BL03]), our Theorem 3 yields a bound on the generalization error which is  $\mathcal{O}(1/n)$ .
3 Generalization bounds in terms of latent variable complexity
The generalization bounds of the previous section are particularly useful in the following sense: if the learning algorithm is "simple" enough to produce a low "relative entropy" sequence of labels for training and test sets, then the algorithm generalizes well. However, they have a downside that they cannot be used directly as they are in the optimization, since minimizing those bounds may result in solutions with large empirical risk. In this section, we extend the results of the previous section to settings in which the processing is split into two parts: an encoder part that produces a family of representations that have the property to generalize well (developed according to the guidelines of the previous section) and a decoder part that selects among that family one representation that minimizes the empirical risk. As such the goal of the encoder is to guarantee a small generalization error and that of the decoder is to guarantee a small empirical risk. This procedure, which is similar to the Information Bottleneck method, aims at finding a good balance between generalizing well to unseen data and minimizing the risk of the training data.
Let  $W = (W_{e}, W_{d})$ , where  $W_{e}$  and  $W_{d}$  are the hypotheses (or models) used by the encoder and the decoder, respectively, as illustrated in Fig. 1b. Also, let  $U$  denote the output of the encoder, which will be referred to hereafter interchangeably as "representation" or "latent variable". The encoder produces the representation  $U$  according to the conditional  $P_{U|X,W_{e}}$ . The decoder produces an estimate  $\hat{Y}$  of the true label  $Y$  according to the conditional  $P_{\hat{Y}|U,W_{d}}$ . We consider a stochastic learning algorithm  $\mathcal{A} \colon \mathcal{Z}^n \to \mathcal{W}$  which picks a model  $W = (W_{e}, W_{d}) \in \mathcal{W} \coloneqq \mathcal{W}_{e} \times \mathcal{W}_{d}$  according to  $P_{W|S}$ . Let a loss function  $\ell \colon \mathcal{Z} \times \mathcal{W} \to [0,1]$  be given.
For a model  $w = (w_{e},w_{d})$  the quality of the prediction of  $\hat{Y}$  is evaluated as
$$
\ell (z, w) := \mathbb {E} _ {\hat {Y} \sim P _ {\hat {Y} | X, W} (\hat {Y} | x, w)} \big [ \mathbb {1} _ {\{y \neq \hat {Y} \}} \big ] := \mathbb {E} _ {U \sim P _ {U | X, W _ {e}} (U | x, w _ {e})} \mathbb {E} _ {\hat {Y} \sim P _ {\hat {Y} | U, W _ {d}} (\hat {Y} | U, w _ {d})} \Big [ \mathbb {1} _ {\{y \neq \hat {Y} \}} \Big ].
$$
Empirical risk, population risk, and generalization error are defined similarly to the previous section. According to the above motivation, we are interested in establishing a bound on the generalization error of the algorithm  $\mathcal{A}$  that depends only on the part  $W_{e}$  of the model  $W$ . In accordance with our compressibility
framework of Section 2 such bound would then depend on the complexity of the latent variable  $U$ . However, here, the encoder part  $W_{e}$  and the decoder part  $W_{d}$  are both trained using the dataset  $S$ . Thus, they may be statistically dependent in general and therefore the "rearrangement" ideas using type-I and type-II symmetries do not work here. To elaborate on this a bit more, recall that for example for type-I symmetry, to rearrange  $(\mathbf{Y},\hat{\mathbf{Y}})$  and  $(\mathbf{Y}',\hat{\mathbf{Y}}')$  in an indistinguishable manner, we randomly shuffle the positions of the pairs  $(Y_{i},\hat{Y}_{i})$  and  $(Y_{i}'',\hat{Y}_{i}')$ . If we now consider using the type-I symmetry for the new setup, then shuffling of the pairs  $(Y_{i},U_{i},\hat{Y}_{i})$  and  $(Y_{i}',U_{i}',\hat{Y}_{i}')$ , changes the dataset  $S$  and thus the distributions  $P_{W|S}$  and  $P_{\hat{Y}|W_d,U}$ . Hence, covering the resulting rearranged sequence would unavoidably depend on both encoder and decoder parts. To overcome this issue, we use type-III symmetry, where we leave the train and ghost datasets untouched and randomly "swap" only those latent variables and their corresponding predictions, i.e.,  $(U_{i},\hat{Y}_{i})$  and  $(U_{j}',\hat{Y}_{j}')$ , that are associated with the train and ghost samples with the same label, i.e., if  $Y_{i} = Y_{j}'$ . The following result is the main theorem of this section and the paper derived using the type-III symmetric priors. A formal proof of this result can be found in Appendix E.5.
Theorem 4 (Generalization Bound for Representation Learning Algorithms). Consider a  $K$ -classification learning task. Let  $\mathbf{Q}$  be a type-III symmetric conditional prior over  $U^{2n}$  given  $X^{2n}, Y^{2n}$  and  $\hat{W}_e \in \mathcal{W}_e$ , namely,  $\mathbf{Q}\left((u_{\pi(1)}, \ldots, u_{\pi(2n)})|(x_1, \ldots, x_{2n}),(y_1, \ldots, y_{2n}), \hat{w}_e\right)$  remains the same for all permutations  $\pi: [2n] \mapsto [2n]$  that preserves the label, i.e.,  $y_{\pi(i)} = y_i$  for  $i \in [2n]$ . Then,
$$
\mathbb {E} _ {S, W} [ \mathrm {g e n} (S, W) ] \leqslant \inf  2 \sqrt {\frac {2 \mathbb {E} _ {S , S ^ {\prime} , \hat {W} _ {e}} \left[ D _ {K L} \left(P _ {U | X , \hat {W} _ {e}} ^ {\otimes 2 n} (\mathbf {U} , \mathbf {U} ^ {\prime} | \mathbf {X} , \mathbf {X} ^ {\prime} , \hat {W} _ {e}) \left\| \mathbf {Q}\right)\right) \right] + K + 2}{n}} + \epsilon ,
$$