SlowGuess/NeurIPS_2023_OCR huggingface dataset:
The standard upper bound on the Rademacher complexity of linear models is  $\frac{B}{\sqrt{n}}$ . Our bound has a nice interpretation; we shrink our bound by a factor of  $\left(\frac{1 - p}{2} + \sin(\tau)p\right)$ . We remark that  $d$  increases, we observe that  $p \to 1$ , so the term  $\sin(\tau)p$  dominates this factor. As a consequence, we get that our bound is now scaled by  $\sin(\tau) \approx \tau$  and the Rademacher complexity scales down by a factor of  $\tau$ . This implies that given  $n$  labeled data, to achieve a fast rate  $\mathcal{O}\left(\frac{1}{n}\right)$ , we need  $\tau$  to be as good as  $O\left(\frac{1}{\sqrt{n}}\right)$ .
4.2 Gradient Explanations for Two Layer Neural Networks
Theorem 4.2 (Rademacher complexity of two layer neural networks ( $m$  hidden nodes) with a gradient constraint). Let  $\mathcal{X}$  be an instance space and  $\mathcal{D}_{\mathcal{X}}$  be a distribution over  $\mathcal{X}$  with a large enough support. Let  $\mathcal{H} = \{h : x \mapsto \sum_{j=1}^{m} w_j \sigma(u_j^\top x) | w_j \in \mathbb{R}, u_j \in \mathbb{R}^d, \sum_{j=1}^{m} |w_j| \leq B, \|u_j\|_2 = 1\}$  be a class of two layer neural networks with a ReLU activation function and bounded weight. Assume that there exists some constant  $C > 0$  such that  $\mathbb{E}_{x \sim \mathcal{D}_{\mathcal{X}}}[\|x\|_2^2] \leq C^2$ . Consider an explanation loss given by
$$
\phi (h, x) = \| \nabla_ {x} h (x) - \nabla_ {x} h ^ {\prime} (x) \| _ {2} + \infty \cdot 1 \left\{\| \nabla_ {x} h (x) - \nabla_ {x} h ^ {\prime} (x) \| > \tau \right\}
$$
for some  $\tau > 0$ . Then, we have that  $R_{n}(\mathcal{H}_{\phi,\tau}) \leq \frac{3\tau mC}{\sqrt{n}}$ .
Proof. (Sketch) The key ingredient is to identify the impact of the gradient constraint and the form of class  $\mathcal{H}_{\phi, \tau}$ . We provide an idea when we have  $m = 1$  node. We write  $h(x) = w\sigma(u^\top x)$  and  $h'(x) = w'\sigma(u'^\top x)$ . Note that  $\nabla_x h(x) - \nabla_x h'(x) = w u 1\{u^\top x > 0\} - w' u' 1\{(u')^\top x > 0\}$  is
a piecewise constant function (Figure 2). Assume that the probability mass of each region is nonnegative, our gradient constraint implies that the norm of each region cannot be larger than  $\tau$ .
1. If  $u, u'$  have different directions, we have 4 regions in  $\nabla_x h(x) - \nabla_x h'(x)$  and can conclude that  $|w| < \tau$ ,  $|w'| < \tau$ .
2. If  $u = u'$  have the same direction, we only have 2 regions in  $\nabla_x h(x) - \nabla_x h'(x)$  and can conclude that  $\| w u - w' u' \| = |w - w'| < \tau$ .
The gradient constraint enforces a model to have the same node boundary  $(u = u^{\prime})$  with a small weight difference  $|w - w^{\prime}| < \tau$  or that node would have a small weight  $|w| < \tau$ . This finding allows us to determine the restricted class  $\mathcal{H}_{\phi, \tau}$ , and we can use this to bound the Rademacher complexity accordingly. For full details, see Appendix I.
We compare this with the standard Rademacher complexity of a two layer neural network [24],
$$
R _ {n} (\mathcal {H}) \leq \frac {2 B C}{\sqrt {n}}.
$$
We can do better than this standard bound if  $\tau < \frac{2B}{3m}$ . One interpretation for this is that we have a budget at most  $\tau$  to change the weight of each node and for total  $m$  nodes, we can change the weight by at most  $\tau m$ . We compare this to  $B$  which is an upper bound on the total weight  $\sum_{j=1}^{m}|w_j| \leq B$ . Therefore, we can do better than a standard bound when we can change the weight by at most two thirds of the average weight  $\frac{2B}{3m}$  for each node. We would like to point out that our bound does not depend on the distribution  $\mathcal{D}$  because we choose a specific explanation loss that guarantees that the gradient constraint holds almost everywhere. Extending to a weaker loss such as  $\phi(h,x) = \|\nabla_xh(x) - \nabla_xh'(x)\|$  is a future research direction. In contrast, our result for linear models uses a weaker explanation loss and depends on  $\mathcal{D}$  (Theorem H.1). We also assume that there exists  $x$  with a positive probability density at any partition created by  $\nabla_xh(x)$ . This is not a strong assumption, and it holds for any distribution where the support is the  $\mathbb{R}^d$ , e.g., Gaussian distributions.
5 Algorithms for Learning from Explanation Constraints
Although we have analyzed learning with explanation constraints, algorithms to solve this constrained optimization problem are non-trivial. In this setting, we assume that we have access to  $n$  labeled data  $\{(x_{i},y_{i})\}_{i = 1}^{n}$ ,  $m$  unlabeled data  $\{x_{n + i}\}_{i = 1}^{m}$ , and  $k$  data with explanations  $\{(x_{n + m + i},\phi (\cdot ,x_{n + m + i}))\}_{i = 1}^{k}$ . We argue that in many cases,  $n$  labeled data are the most expensive to annotate. The  $k$  data points with explanations also have non-trivial cost; they require an expert to provide the annotated explanation or provide a surrogate loss  $\phi$ . If the surrogate loss is specified then we can evaluate it on any unlabeled data, otherwise these data points with explanations could be expensive. On the other hand, the  $m$  data points can cheaply be obtained as they are completely unlabeled. We now consider existing approaches to incorporate this explanation information.
EPAC-ERM: Recall our EPAC-ERM objective from (2):
$$
\min  _ {h \in \mathcal {H}} \frac {1}{n} \sum_ {i = 1} ^ {n} 1 \{h (x _ {i}) \neq y _ {i} \} \text {s . t .} \frac {1}{k} \sum_ {j = n + m + 1} ^ {n + m + k} \phi (h, x _ {j}) \leq \tau
$$
for some constant  $\tau$ . This constraint in general requires more complex optimization techniques (e.g., running multiple iterations and comparing values of  $\tau$ ) to solve algorithmically. We could also consider the case where  $\tau = 0$ , which would entail the hypotheses satisfy the explanation constraints exactly, which however is in general too strong a constraint with noisy explanations.
Augmented Lagrangian objectives:
$$
\min  _ {h \in \mathcal {H}} \frac {1}{n} \sum_ {i = 1} ^ {n} 1 [ h (x _ {i}) \neq y _ {i} ] + \frac {\lambda}{k} \sum_ {j = n + m + 1} ^ {n + m + k} \phi (h, x _ {j})
$$
As is done in prior work [32], we can consider an augmented Lagrangian objective. A crucial caveat with this approach is that the explanation surrogate loss is in general a much more complicated
functional of the hypothesis than the empirical risk. For instance, it might involve the gradient of the hypothesis when we use gradient-based explanations. Computing the gradients of such a surrogate loss can be more expensive compared to the gradients of the empirical risk. For instance, in our experiments, computing the gradients of the surrogate loss that involves input gradients is 2.5 times slower than that of the empirical risk. With the above objective, however, we need to compute the same number of gradients of both the explanation surrogate loss and the empirical risk. These computational difficulties have arguably made incorporating explanation constraints not as popular as they could be.
5.1 Variational Method
To alleviate these aforementioned computational difficulties, we propose a new variational objective
$$
\min  _ {h \in \mathcal {H}} (1 - \lambda) \underset {(x, y) \sim \mathcal {D}} {\mathbb {E}} [ \ell (h (x), y) ] + \lambda \inf  _ {f \in \mathcal {H} _ {\phi , \tau}} \underset {x \sim \mathcal {D} _ {\chi}} {\mathbb {E}} [ \ell (h (x), f (x)) ],
$$
where  $\ell$  is some loss function and  $t\geq 0$  is some threshold. The first term is the standard expected risk of  $h$  while the second term can be viewed as a projection distance between  $h$  and  $\tau$ -CE models. It can be seen that the optimal solution of EPAC-ERM would also be an optimal solution of our proposed variational objective. The advantage of this formulation however is that it decouples the standard expected risk component from the surrogate risk component. This allows us to solve this objective with the following iterative technique, drawing inspiration from prior work in posterior regularization [9, 14]. More specifically, let  $h_t$  be the learned model at time  $t$  and at each timestep  $t$ ,
1. We project  $h_t$  to the class of  $\tau$ -CE models.
$$
f _ {t + 1, \phi} = \underset {h \in \mathcal {H}} {\operatorname {a r g m i n}} \frac {1}{m} \sum_ {i = n + 1} ^ {n + m} \ell (h (x _ {i}), h _ {t} (x _ {i})) + \lambda \max  \left(0, \frac {1}{k} \sum_ {i = n + m + 1} ^ {n + m + k} \phi (h, x _ {i}) - \tau\right).
$$
The first term is the difference between  $h_t$  and  $f$  on unlabeled data. The second term is the surrogate loss, which we want to be smaller than  $t$ .  $\eta$  is a regularization hyperparameter.
2. We calculate  $h_{t + 1}$  that minimizes the empirical risk of labeled data and matches pseudolabels from  $f_{t + 1,\phi}$
$$
h _ {t + 1, \phi} = \underset {h \in \mathcal {H}} {\operatorname {a r g m i n}} \frac {1}{n} \sum_ {i = 1} ^ {n} \ell (h (x _ {i}), y _ {i}) + \frac {1}{m} \sum_ {i = n + 1} ^ {n + m} \ell (h (x _ {i}), f _ {t + 1, \phi} (x _ {i})).
$$
Here, the discrepancy between  $h$  and  $f_{t + 1,\phi}$  is evaluated on the unlabeled data  $\{x_j\}_{j = n + 1}^{n + m}$ .
The advantage of this decoupling is that we could use a differing number of gradient steps and learning rates for the projection step that involves the complicated surrogate loss when compared to the empirical risk minimization step. Secondly, we can simplify the projection iterate computation by replacing  $\mathcal{H}_{\phi,\tau}$  with a simpler class of teacher models  $\mathcal{F}_{\phi,\tau}$  for greater efficiency. Thus, the decoupled approach to solving the EPAC-ERM objective is in general more computationally convenient.
We initialize this procedure with some model  $h_0$ . We remark that could see this as a constraint regularized self-training where  $h_t$  is a student model and  $f_t$  is a teacher model. At each timestep, we project a student model to the closest teacher model that satisfies the constraint. The next student model then learns from both labeled data and pseudo labels from the teacher model. In the standard self-training, we do not have any constraint and we have  $f_t = h_t$ .
We provide both synthetic and real-world experiments to support our theoretical results and clearly illustrate interesting tradeoffs of incorporating explanations. In our experiments, we compare our method against 3 baselines: (1) a standard supervised learning approach, (2) a simple Lagrangian-regularized method (that directly penalizes the surrogate loss  $\phi$ ), and (3) self-training, which propagates the predictions of (1) and matches them on unlabeled data. We remark that (2) captures the essence of the method in Ross et al. [33], except there is no  $\ell_2$  regularization term.
Our experiments demonstrate that the proposed variational approach is preferable to simple Lagrangian methods and other supervised methods in many cases. In particular, the variational approach leads to a higher accuracy under limited labeled data settings. In addition, our method leads
Figure 3: Comparison of MSE on regressing a linear model. Results are averaged over 5 seeds.  $m = 1000$ .  $k = 20$
Figure 4: Comparison of MSE on regressing a two layer neural network (left) and  $\ell_2$  distance over input gradients as we vary the amount of labeled data  $n$  (right). Left is task performance and right is explanation constraint satisfaction. Results are averaged over 5 seeds.  $m = 1000$ ,  $k = 20$ .
to models that satisfy the explanation constraints much more frequently than other baselines. We also compare to a Lagrangian-regularized + self-training baseline (first, we use the model (2) to generate pseudolabels for unlabeled data and then train a new model on both labeled and unlabeled data) in Appendix L. We remark that this baseline isn't a standard method in practice and does not fit nicely into a theoretical framework, although it seems to be the most natural approach to using unlabeled data in this procedure. More extensive ablations are deferred to Appendix N, and code to replicate our experiments will be released with the full paper.
6.1 Regression Task with Exact Gradient Information
In our synthetic experiments, we focus on a regression task where we try to learn some model contained in our hypothesis class. Our data is given by  $\mathcal{X} = \mathbb{R}^d$ , and we try to learn a target function  $h^*:\mathcal{X}\to \mathbb{R}$ . Our data distribution is given by  $X\sim \mathcal{N}(0,\sigma^2 I)$ , where  $I$  is a  $d\times d$  identity matrix. We generate  $h^*$  by randomly initializing a model in the specific hypothesis class  $\mathcal{H}$ . We assume that we have  $n$  labeled data,  $m$  unlabeled data, and  $k$  data with explanations.
We first present a synthetic experiment for learning with a perfect explanation, meaning that  $\phi(h^{*}, S) = 0$ . We consider the case where we have the exact gradient of  $h^{*}$ . Here, let  $\mathcal{H}$  be a linear classifier and note that the exact gradient gives us the slope of the linear model, and we only need to learn the bias term. Incorporating these explanations indeed helps as both methods that include explanation constraints (Lagrangian and ours) perform much better (Figure 3).
We also demonstrate incorporating this information for two layer neural networks. We observe a clear difference between the simpler Lagrangian approach and our variational objective (Figure 4 - left). Our method is clearly the best in the setting with limited labeled data and matches the performance of the strong self-training baseline with sufficient labeled data. We note that this is somewhat expected, as these constraints primarily help in the setting with limited labeled data; with enough labeled data, standard PAC bounds suffice for strong performance.
We also analyze how strongly the approaches enforce these explanation constraints on new data points that are seen at test time (Figure 4 - right) for two layer NNs. We observe that our variational objective approaches have input gradients that more closely match the ground-truth target network's
Figure 5: Comparison of accuracy on the YouTube (left) and the Yelp (right) datasets. Here, we let  $m = 500$ ,  $k = 150$ ,  $T = 2$ ,  $\tau = 0.0$ . Results are averaged over 40 seeds.
input gradients. This demonstrates that, in the case of two layer NNs with gradient explanations, our approach best achieves both good performance and satisfying the constraints. Standard self-training achieves similar performance in terms of MSE but has no notion of satisfying the explanation constraints. The Lagrangian method does not achieve the same level of satisfying these explanations as it is unable to generalize and satisfy these constraints on new data.
6.2 Tasks with Imperfect Explanations
Assuming access to perfect explanations may be unrealistic in practice, so we present experiments when our explanations are imperfect. We present classification tasks (Figure 5) from a weak supervision benchmark [46]. In this setting, we obtain explanations through the approximate gradients of a single weak labeler, as is done in [?]. More explicitly, weak labelers are heuristics designed by domain experts; one example is functions that check for the presence of particular words in a sentence (e.g., checking for the word "delicious" in a Yelp comment, which would indicate positive sentiment). We can then access gradient information from such weak labelers, which gives us a notion of feature importance about particular features in our data. We note that these examples of gradient information are rather easy to obtain, as we only need domain experts to specify simple heuristic functions for a particular task. Once given these functions, we can apply them easily over unlabeled data without requiring any example-level annotations.
We observe that our variational objective achieves better performance than all other baseline approaches on the majority of settings defined by the number of labeled data. We remark that the explanation in this dataset is a noisy gradient explanation along two feature dimensions, yet this still improves upon methods that do not incorporate this explanation constraint. Indeed, our method outperforms the Lagrangian approach, showing the benefits of iterative rounds of self-training over the unlabeled data. In addition to our real-world experiments, we present synthetic experiments with noisy gradients in Appendix K.1.
Our work proposes a new learning theoretic framework that provides insight into how apriori explanations of desired model behavior can benefit the standard machine learning pipeline. The statistical benefits of explanations arise from constraining the hypothesis class: explanation samples serve to better estimate the population explanation constraint, which constrains the hypothesis class. This is to be contrasted with the statistical benefit of labeled samples, which serve to get a better estimate of the population risk. We provide instantiations of our analysis for the canonical class of gradient explanations, which captures many explanations in terms of feature importance. It would be of interest to provide corollaries for other types of explanations in future work. As mentioned before, the generality of our framework has larger implications towards incorporating constraints that are not considered as "standard" explanations. For example, this work can be leveraged to incorporate more general notions of side information and inductive biases. We also discuss the societal impacts of our approach in Appendix O. As a whole, our paper supports using further information (e.g., explanation constraints) in the standard learning setting.
This work was supported in part by DARPA under cooperative agreement HR00112020003, FA8750-23-2-1015, ONR grant N00014-23-1-2368, NSF grant IIS-1909816, a Bloomberg Data Science PhD fellowship and funding from Bosch Center for Artificial Intelligence and the ARCS Foundation.
[1] M.-F. Balcan and A. Blum. A pac-style model for learning from labeled and unlabeled data. In International Conference on Computational Learning Theory, pages 111-126. Springer, 2005. 2
[2] M.-F. Balcan and A. Blum. A discriminative model for semi-supervised learning. Journal of the ACM (JACM), 57(3):1-46, 2010. 2, 3, 5, 20
[3] B. Bilodeau, N. Jaques, P. W. Koh, and B. Kim. Impossibility theorems for feature attribution. arXiv preprint arXiv:2212.11870, 2022. 3
[4] J. R. Birge and F. Louveaux. Introduction to stochastic programming. Springer Science & Business Media, 2011. 2
[5] O. Chapelle, B. Scholkopf, and A. Zien. Semi-supervised learning (chapelle, o. et al., eds.; 2006)[book reviews]. IEEE Transactions on Neural Networks, 20(3):542-542, 2009. 3
[6] W. M. Czarnecki, S. Osindero, M. Jaderberg, G. Swirszcz, and R. Pascanu. Sobolev training for neural networks. Advances in neural information processing systems, 30, 2017. 3
[7] F. Fioretto, P. Van Hentenryck, T. W. Mak, C. Tran, F. Baldo, and M. Lombardi. Lagrangian duality for constrained deep learning. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pages 118–135. Springer, 2021. 2
[8] S. Frei, D. Zou, Z. Chen, and Q. Gu. Self-training converts weak learners to strong learners in mixture models. In International Conference on Artificial Intelligence and Statistics, pages 8003-8021. PMLR, 2022. 3
[9] K. Ganchev, J. Graça, J. Gillenwater, and B. Taskar. Posterior regularization for structured latent variable models. The Journal of Machine Learning Research, 11:2001-2049, 2010. 2, 8
[10] S. Garg and Y. Liang. Functional regularization for representation learning: A unified theoretical perspective. Advances in Neural Information Processing Systems, 33:17187-17199, 2020. 3
[11] I. Goodfellow, Y. Bengio, and A. Courville. Deep learning. MIT press, 2016. 3
[12] Y. Goyal, Z. Wu, J. Ernst, D. Batra, D. Parikh, and S. Lee. Counterfactual visual explanations. In International Conference on Machine Learning, pages 2376-2384. PMLR, 2019. 3
[13] G. Hinton, O. Vinyals, and J. Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015. 2
[14] Z. Hu, X. Ma, Z. Liu, E. Hovy, and E. Xing. Harnessing deep neural networks with logic rules. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2410–2420, 2016. 2, 8
[15] A. A. Ismail, H. Corrada Bravo, and S. Feizi. Improving deep learning interpretability by saliency guided training. Advances in Neural Information Processing Systems, 34:26726-26739, 2021. 1, 3
[16] P. Kall, S. W. Wallace, and P. Kall. Stochastic programming, volume 6. Springer, 1994. 2
[17] B. Kim, M. Wattenberg, J. Gilmer, C. Cai, J. Wexler, F. Viegas, et al. Interpretability beyond feature attribution: Quantitative testing with concept activation vectors (tcav). In International conference on machine learning, pages 2668-2677. PMLR, 2018. 3
[18] P. W. Koh and P. Liang. Understanding black-box predictions via influence functions. In International conference on machine learning, pages 1885-1894. PMLR, 2017. 1, 3
[38] L. G. Valiant. A theory of the learnable. Communications of the ACM, 27(11):1134-1142, 1984. 2
[39] S. Wachter, B. Mittelstadt, and C. Russell. Counterfactual explanations without opening the black box: Automated decisions and the gdpr. Harv. JL & Tech., 31:841, 2017. 3
[40] C. Wei, K. Shen, Y. Chen, and T. Ma. Theoretical analysis of self-training with deep networks on unlabeled data. In International Conference on Learning Representations, 2020. 3
[41] M. R. Wicker, J. Heo, L. Costabello, and A. Weller. Robust explanation constraints for neural networks. In The Eleventh International Conference on Learning Representations, 2022. 3
[42] Q. Xie, M.-T. Luong, E. Hovy, and Q. V. Le. Self-training with noisy student improves imagenet classification. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 10687-10698, 2020. 3
[43] C.-K. Yeh, J. Kim, I. E.-H. Yen, and P. K. Ravikumar. Representer point selection for explaining deep neural networks. Advances in neural information processing systems, 31, 2018. 1, 3
[44] C.-K. Yeh, B. Kim, S. Arik, C.-L. Li, T. Pfister, and P. Ravikumar. On completeness-aware concept-based explanations in deep neural networks. Advances in Neural Information Processing Systems, 33:20554-20565, 2020. 3
[45] M. E. Zarlenga, P. Barbiero, G. Ciravegna, G. Marra, F. Giannini, M. Diligenti, F. Precioso, S. Melacci, A. Weller, P. Lio, et al. Concept embedding models. In NeurIPS 2022-36th Conference on Neural Information Processing Systems, 2022. 3
[46] J. Zhang, Y. Yu, Y. Li, Y. Wang, Y. Yang, M. Yang, and A. Ratner. Wrench: A comprehensive benchmark for weak supervision. In Thirty-fifth Conference on Neural Information Processing Systems Datasets and Benchmarks Track (Round 2), 2021. 10, 38
A Uniform Convergence via Rademacher Complexity
A standard tool for providing performance guarantees of supervised learning problems is a generalization bound via uniform convergence. We will first define the Rademacher complexity and its corresponding generalization bound.
Definition 5. Let  $\mathcal{F}$  be a family of functions mapping  $\mathcal{X} \to \mathbb{R}$ . Let  $S = \{x_{1},\ldots,x_{m}\}$  be a set of examples drawn i.i.d. from a distribution  $D_{\mathcal{X}}$ . Then, the empirical Rademacher complexity of  $\mathcal{F}$  is defined as
$$
R _ {S} (\mathcal {F}) = \underset {\sigma} {\mathbb {E}} \left[ \sup  _ {f \in \mathcal {F}} \left(\frac {1}{m} \sum_ {i = 1} ^ {m} \sigma_ {i} f (x _ {i})\right) \right]
$$
where  $\sigma_{1},\ldots ,\sigma_{m}$  are independent random variables uniformly chosen from  $\{-1,1\}$ .
Definition 6. Let  $\mathcal{F}$  be a family of functions mapping  $\mathcal{X} \to \mathbb{R}$ . Then, the Rademacher complexity of  $\mathcal{F}$  is defined as
$$
R_{n}(\mathcal{F}) = \underset {S\sim \mathcal{D}_{\mathcal{X}}^{n}}{\mathbb{E}}\left[R_{S}(\mathcal{F})\right].
$$
The Rademacher complexity is the expectation of the empirical Rademacher complexity, over  $n$  samples drawn i.i.d. from the distribution  $\mathcal{D}_{\mathcal{X}}$ .