diff --git a/informationtheoreticsafeexplorationwithgaussianprocesses/d712a0ab-276c-442f-a9d9-22a7fb8862e2_content_list.json b/informationtheoreticsafeexplorationwithgaussianprocesses/d712a0ab-276c-442f-a9d9-22a7fb8862e2_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..024851807a9d4004b613bc9a81778ecb9cd0910e --- /dev/null +++ b/informationtheoreticsafeexplorationwithgaussianprocesses/d712a0ab-276c-442f-a9d9-22a7fb8862e2_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9c4301667c7f471f5aafec1b2451c7e3cf65ad2d51adba5dcd581dc09149ff26 +size 75638 diff --git a/informationtheoreticsafeexplorationwithgaussianprocesses/d712a0ab-276c-442f-a9d9-22a7fb8862e2_model.json b/informationtheoreticsafeexplorationwithgaussianprocesses/d712a0ab-276c-442f-a9d9-22a7fb8862e2_model.json new file mode 100644 index 0000000000000000000000000000000000000000..3f6eafcba8161ed92d58b3d8c137d3aa98598783 --- /dev/null +++ b/informationtheoreticsafeexplorationwithgaussianprocesses/d712a0ab-276c-442f-a9d9-22a7fb8862e2_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2119306ae5ca76dc158b3e35489ab54db078cefb54e7927f41f9531651a54f4d +size 95005 diff --git a/informationtheoreticsafeexplorationwithgaussianprocesses/d712a0ab-276c-442f-a9d9-22a7fb8862e2_origin.pdf b/informationtheoreticsafeexplorationwithgaussianprocesses/d712a0ab-276c-442f-a9d9-22a7fb8862e2_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..56cc8ba4d1eaf9c1da5cc5310a0e3cd2b060b56a --- /dev/null +++ b/informationtheoreticsafeexplorationwithgaussianprocesses/d712a0ab-276c-442f-a9d9-22a7fb8862e2_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a7e81a0e313fe10dbb4fc9e31f81aeced57c56a8ce15c2a2112e328b40d41da3 +size 6664894 diff --git a/informationtheoreticsafeexplorationwithgaussianprocesses/full.md b/informationtheoreticsafeexplorationwithgaussianprocesses/full.md new file mode 100644 index 0000000000000000000000000000000000000000..2f1d7f1a45f4c124275860c19a80862be77640d6 --- /dev/null +++ b/informationtheoreticsafeexplorationwithgaussianprocesses/full.md @@ -0,0 +1,282 @@ +# Information-Theoretic Safe Exploration with Gaussian Processes + +Alessandro G. Bottero $^{1,2}$ , Carlos E. Luis $^{1,2}$ , Julia Vinogradska $^{1}$ , Felix Berkenkamp $^{1}$ , Jan Peters $^{2}$ $^{1}$ Bosch Center for Artificial Intelligence, Germany + $^{2}$ Technische Universität Darmstadt, Germany +Alessandro Giacomo. Bottero@de.bosch.com + +# Abstract + +We consider a sequential decision making task where we are not allowed to evaluate parameters that violate an a priori unknown (safety) constraint. A common approach is to place a Gaussian process prior on the unknown constraint and allow evaluations only in regions that are safe with high probability. Most current methods rely on a discretization of the domain and cannot be directly extended to the continuous case. Moreover, the way in which they exploit regularity assumptions about the constraint introduces an additional critical hyperparameter. In this paper, we propose an information-theoretic safe exploration criterion that directly exploits the GP posterior to identify the most informative safe parameters to evaluate. Our approach is naturally applicable to continuous domains and does not require additional hyperparameters. We theoretically analyze the method and show that we do not violate the safety constraint with high probability and that we explore by learning about the constraint up to arbitrary precision. Empirical evaluations demonstrate improved data-efficiency and scalability. + +# 1 Introduction + +In sequential decision making problems, we iteratively select parameters in order to optimize a given performance criterion. However, real-world applications such as robotics (Berkenkamp et al., 2021), mechanical systems (Schillinger et al., 2017) or medicine (Sui et al., 2015) are often subject to additional safety constraints that we cannot violate during the exploration process (Dulac-Arnold et al., 2019). Since it is a priori unknown which parameters lead to constraint violations, we need to actively and carefully learn about the constraints without violating them. That is, we need to learn about the safety of parameters by only evaluating parameters that are currently known to be safe. + +Existing methods by Schreiter et al. (2015); Sui et al. (2015) tackle this problem by placing a Gaussian process (GP) prior over the constraint and only evaluate parameters that do not violate the constraint with high probability. To learn about the safety of parameters, they evaluate the parameter with the largest posterior variance. This process is made more efficient by SAFEOPT, which restricts its safe set expansion exploration component to parameters that are close to the boundary of the current set of safe parameters (Sui et al., 2015) at the cost of an additional tuning hyperparameter (Lipschitz constant). However, uncertainty about the constraint is only a proxy objective that only indirectly learns about the safety of parameters. Consequently, data-efficiency could be improved with an exploration criterion that directly maximizes the information gained about the safety of parameters. + +Our contribution In this paper, we propose Information-Theoretic Safe Exploration (ISE), a safe exploration algorithm that directly exploits the information gain about the safety of parameters in order to expand the region of the parameter space that we can classify as safe with high confidence. By directly optimizing for safe information gain, ISE is more data-efficient than existing approaches without manually restricting evaluated parameters to be on the boundary of the safe set, particularly + +in scenarios where the posterior variance alone is not enough to identify good evaluation candidates, as in the case of heteroskedastic observation noise. This exploration criterion also means that we do not require additional hyperparameters beyond the GP posterior and that ISE is directly applicable to continuous domains. We theoretically analyze our method and prove that it learns about the safety of reachable parameters to arbitrary precision. + +Related work Information-based selection criteria with Gaussian processes models are successfully used in the context of unconstrained Bayesian optimization (BO, Shahriari et al. (2016); Bubeck and Cesa-Bianchi (2012)), where the goal is to find the parameters that maximize an a priori unknown function. Hennig and Schuler (2012); Henrández-Lobato et al. (2014); Wang and Jegelka (2017) select parameters that provide the most information about the optimal parameters, while Fröhlich et al. (2020) consider the information under noisy parameters. The success of these information-based approaches also relies on the superior data efficiency that they demonstrated. We draw inspiration from these methods when defining an information-based criterion w.r.t. the safety of parameters to guide safe exploration. + +In the presence of constraints that the final solution needs to satisfy, but which we can violate during exploration, Gelbart et al. (2014) propose to combine typical BO acquisition functions with the probability of satisfying the constraint. Instead, Gotovos et al. (2013) propose an uncertainty-based criterion that learns about the feasible region of parameters. When we are not allowed to ever evaluate unsafe parameters, safe exploration is a necessary sub-routine of BO algorithms to learn about the safety of parameters. To safely explore, Schreiter et al. (2015) globally learn about the constraint by evaluating the most uncertain parameters. SAFEOPT by Sui et al. (2015) extends this to joint exploration and optimization and makes it more efficient by explicitly restricting safe exploration to the boundary of the safe set. Sui et al. (2018) proposes STAGEOPT, which additionally separates the exploration and optimization phases. Both of these algorithms assume access to a Lipschitz constant to define parameters close to the boundary of the safe set, which is a difficult tuning parameter in practice. These methods have been extended to multiple constraints by Berkenkamp et al. (2021), while Kirschner et al. (2019) scale them to higher dimensions with LINEBO, which explores in low-dimensional sub-spaces. To improve computational costs, Duivenvoorden et al. (2017) suggest a continuous approximation to SAFEOPT without providing exploration guarantees. All of these methods rely on function uncertainty to drive exploration, while we directly maximize the information gained about the safety of parameters. + +Safe exploration also arises in the context of Markov decision processes (MDP), (Moldovan and Abbeel, 2012; Hans et al., 2008). In particular, Turchetta et al. (2016, 2019) traverse the MDP to learn about the safety of parameters using methods that, at their core, explore using the same ideas as SAFEOPT and STAGEOPT to select parameters to evaluate. Consequently, our proposed method for safe exploration is also directly applicable to their setting. + +# 2 Problem Statement + +In this section, we introduce the problem and notation that we use throughout the paper. We are given an unknown and expensive to evaluate safety constraint $f: \mathcal{X} \to \mathbb{R}$ s.t. parameters that satisfy $f(\boldsymbol{x}) \geq 0$ are classified as safe, while others are unsafe. To start exploring safely, we also have access to an initial safe parameter $\boldsymbol{x}_0$ that satisfies the safety constraint, $f(\boldsymbol{x}_0) \geq 0$ . We sequentially select safe parameters $\boldsymbol{x}_n \in \mathcal{X}$ where to evaluate $f$ in order to learn about the safety of parameters beyond $\boldsymbol{x}_0$ . At each iteration $n$ , we obtain a noisy observation of $y_n := f(\boldsymbol{x}_n) + \nu_n$ that is corrupted by additive homoscedastic Gaussian noise $\nu_n \sim \mathcal{N}(0, \sigma_\nu^2)$ . We illustrate the task in Figure 1a, where starting from $\boldsymbol{x}_0$ we aim to safely explore the domain so that we ultimately classify as safe all the safe parameters that are reachable from $\boldsymbol{x}_0$ . + +As $f$ is unknown and the evaluations $y_{n}$ are noisy, it is not feasible to select parameters that are safe with certainty and we provide high-probability safety guarantees instead. To this end, we assume that the safety constraint $f$ has bounded norm in the Reproducing Kernel Hilbert Space (RKHS) (Schölkopf and Smola, 2002) $\mathcal{H}_k$ associated to some kernel $k: \mathcal{X} \times \mathcal{X} \to \mathbb{R}$ with $k(\boldsymbol{x},\boldsymbol{x}^{\prime}) \leq 1$ . This assumption allows us to model $f$ as a Gaussian process (GP) (Srinivas et al., 2010). + +Gaussian Processes A GP is a stochastic process specified by a mean function $\mu : \mathcal{X} \to \mathbb{R}$ and a kernel $k$ (Rasmussen and Williams, 2006). It defines a probability distribution over real-valued functions on $\mathcal{X}$ , such that any finite collection of function values at parameters $[\pmb{x}_1, \dots, \pmb{x}_n]$ is + +![](images/af155e23aa5ccdd62391251bc4ff2eb96d1073b6ad08e917cd6a85cb4f8c92f5.jpg) +(a) Problem components. + +![](images/bbffb2487fa72ce03817f662715b55e267c781116199ad3bbab55f110da20f79.jpg) +(b) ISE mutual information. +Figure 1: In (a) we illustrate the safe exploration task. Based on the unknown safety constraint $f$ , we are only allowed to evaluate safe parameters $x$ with values $f(x) \geq 0$ above the safety threshold (dashed line). Starting from a safe seed $x_0$ a safe exploration strategy needs to discover the largest reachable safe region of the parameter space containing $x_0$ . In (b) we show the mutual information $I_n(\{x, y\}; \Psi(z))$ in green for different $x$ inside the safe set and for a fixed $z$ outside (red dashed line). ISE maximizes this mutual information jointly over $x$ and $z$ . + +distributed as a multivariate normal distribution. The GP prior can then be conditioned on (noisy) function evaluations $\mathcal{D}_n = \{(x_i, y_i)\}_{i=1}^n$ . If the noise is Gaussian, then the resulting posterior is also a GP and with posterior mean and variance + +$$ +\mu_ {n} (\boldsymbol {x}) = \mu (\boldsymbol {x}) + \boldsymbol {k} (\boldsymbol {x}) ^ {\top} (\boldsymbol {K} + \boldsymbol {I} \sigma_ {\nu} ^ {2}) ^ {- 1} (\boldsymbol {y} - \boldsymbol {\mu}), +$$ + +$$ +\sigma_ {n} ^ {2} (\boldsymbol {x}) = k (\boldsymbol {x}, \boldsymbol {x}) - \boldsymbol {k} (\boldsymbol {x}) ^ {\top} \left(\boldsymbol {K} + \boldsymbol {I} \sigma_ {\nu} ^ {2}\right) ^ {- 1} \boldsymbol {k} (\boldsymbol {x}), \tag {1} +$$ + +where $\pmb{\mu} \coloneqq [\mu(\pmb{x}_1), \dots, \mu(\pmb{x}_n)]$ is the mean vector at parameters $\pmb{x}_i \in \mathcal{D}_n$ and $[\pmb{y}]_i \coloneqq y(\pmb{x}_i)$ the corresponding vector of observations. We have $\left[\pmb{k}(\pmb{x})\right]_i \coloneqq k(\pmb{x}, \pmb{x}_i)$ , the kernel matrix has entries $[K]_{ij} \coloneqq k(\pmb{x}_i, \pmb{x}_j)$ , and $\pmb{I}$ is the identity matrix. In the following, we assume without loss of generality that the prior mean is identically zero: $\mu(\pmb{x}) \equiv 0$ . + +Safe set Using the previous assumptions, we can construct high-probability confidence intervals on the function values $f(\pmb{x})$ . Concretely, for any $\delta > 0$ it is possible to find a sequence of positive numbers $\{\beta_n\}$ such that $f(\pmb{x}) \in [\mu_n(\pmb{x}) \pm \beta_n \sigma_n(\pmb{x})]$ with probability at least $1 - \delta$ , jointly for all $\pmb{x} \in \mathcal{X}$ and $n \geq 1$ . For a proof and more details see (Chowdhury and Gopalan, 2017). We use these confidence intervals to define a safe set + +$$ +S _ {n} := \left\{\boldsymbol {x} \in \mathcal {X}: \mu_ {n} (\boldsymbol {x}) - \beta_ {n} \sigma_ {n} (\boldsymbol {x}) \geq 0 \right\} \cup \left\{\boldsymbol {x} _ {0} \right\}, \tag {2} +$$ + +which contains all parameters whose $\beta_{n}$ -lower confidence bound is above the safety threshold and the initial safe parameter $\pmb{x}_0$ . Consequently, we know that all parameters in $S_{n}$ are safe, $f(\pmb{x}) \geq 0$ for all $\pmb{x} \in S_{n}$ , with probability at least $1 - \delta$ jointly over all iterations $n$ . + +Safe exploration Given the safe set $S_{n}$ , the next question is which parameters in $S_{n}$ to evaluate in order to efficiently expand it. Most existing safe exploration methods rely on uncertainty sampling over subsets of $S_{n}$ . SAFEOPT-like approaches, for example, use the Lipschitz assumption on $f$ to identify parameters in $S_{n}$ that could expand the safe set and then select the parameter that has the biggest uncertainty among those. In the next sections, we present and analyze our safe exploration strategy, ISE, that instead uses an information gain measure to identify the parameters that allow us to efficiently learn about the safety of parameters outside of $S_{n}$ . + +# 3 Information-Theoretic Safe Exploration + +We present Information-Theoretic Safe Exploration (ISE), which guides the safe exploration by using an information-theoretic criterion. Our goal is to design an exploration strategy that directly exploits the properties of GPs to learn about the safety of parameters outside of $S_{n}$ . We draw inspiration from Hennig and Schuler (2012); Wang and Jegelka (2017) who exploit information-theoretic insights to design data-efficient BO acquisition functions for their respective optimization objectives. + +Information gain measure In our case, we want to evaluate $f$ at safe parameters that are maximally informative about the safety of other parameters, in particular of those where we are uncertain + +Algorithm 1 Information-Theoretic Safe Exploration + +1: Input: GP prior $(\mu_0, k, \sigma_\nu)$ , Safe seed $x_0$ +2: for $n = 0, \dots, N$ do +3: $x_{n + 1}\gets \arg \max_{\pmb {x}\in S_n}\max_{\pmb {z}\in \mathcal{X}}\hat{I}_n(\{\pmb {x},\pmb {y}\};\Psi (\pmb {z}))$ +4: $y_{n + 1}\gets f(\pmb{x}_{n + 1}) + \nu$ +5: Update GP posterior with $(\pmb{x}_{n + 1},y_{n + 1})$ + +about whether they are safe or not. To this end, we need a corresponding measure of information gain. We define such a measure using the binary variable $\Psi(x) = \mathbb{I}_{f(x) \geq 0}$ , which is equal to one iff $f(x) \geq 0$ . Its entropy is given by + +$$ +H _ {n} [ \Psi (\boldsymbol {z}) ] = - p _ {n} ^ {-} (\boldsymbol {z}) \ln \left(p _ {n} ^ {-} (\boldsymbol {z})\right) - (1 - p _ {n} ^ {-} (\boldsymbol {z})) \ln (1 - p _ {n} ^ {-} (\boldsymbol {z})) \tag {3} +$$ + +where $p_n^- (z)$ is the probability of $z$ being unsafe: $p_n^- (z) = \frac{1}{2} +\frac{1}{2}\mathrm{erf}\left(-\frac{1}{\sqrt{2}}\frac{\mu_n(z)}{\sigma_n(z)}\right)$ . The random variable $\Psi (z)$ has high-entropy when we are uncertain whether a parameter is safe or not; that is, its entropy decreases monotonically as $|\mu_n(z)|$ increases and the GP posterior moves away from the safety threshold. It also decreases monotonically as $\sigma_{n}(z)$ decreases and we become more certain about the constraint. This behavior also implies that the entropy goes to zero as the confidence about the safety of $z$ increases, as desired. + +Given our definition of $\Psi$ , we consider the mutual information $I\big(\{\pmb{x},y\} ;\Psi (\pmb {z})\big)$ between an observation $y$ at a parameter $\pmb{x}$ and the value of $\Psi$ at another parameter $\pmb{z}$ . Since $\Psi$ is the indicator function of the safe regions of the parameter space, the quantity $I_{n}\big(\{\pmb {x},y\} ;\Psi (\pmb {z})\big)$ measures how much information about the safety of $\pmb{z}$ we gain by evaluating the safety constraint $f$ at $\pmb{x}$ at iteration $n$ , averaged over all possible observed values $y$ . This interpretation follows directly from the definition of mutual information: $I_{n}\big(\{\pmb {x},y\} ;\Psi (\pmb {z})\big) = H_{n}\big[\Psi (\pmb {z})\big] - \mathbb{E}_{y}\Big[H_{n + 1}\big[\Psi (\pmb {z})\big|\{\pmb {x},y\} \Big]\Big]$ , where $H_{n}[\Psi (z)]$ is the entropy of $\Psi (z)$ according to the GP posterior at iteration $n$ , while $H_{n + 1}\big[\Psi (z)\big|\{\pmb {x},y\} \big]$ is its entropy at iteration $n + 1$ , conditioned on a measurement $y$ at $\pmb{x}$ at iteration $n$ . Intuitively, $I_{n}\big(\{\pmb {x},y\} ;\Psi (\pmb {z})\big)$ is negligible whenever the confidence about the safety of $\pmb{z}$ is high or, more generally, whenever an evaluation at $\pmb{x}$ does not have the potential to substantially change our belief about the safety of $\pmb{z}$ . The mutual information is large whenever an evaluation at $\pmb{x}$ on average causes the confidence about the safety of $\pmb{z}$ to increase significantly. As an example, in Figure 1 we plot $I_{n}\big(\{\pmb {x},y\} ;\Psi (\pmb {z})\big)$ as a function of $\pmb {x}\in S_n$ for a specific choice of $\pmb{z}$ and for an RBF kernel. As one would expect, we see that the closer it gets to $\pmb{z}$ , the bigger the mutual information becomes, and that it vanishes in the neighborhood of previously evaluated parameters, where the posterior variance is negligible. + +To compute $I_{n}\big(\{\pmb {x},\pmb {y}\} ;\Psi (\pmb {z})\big)$ , we need to average (3) conditioned on an evaluation $y$ over all possible values of $y$ . However, the resulting integral is intractable given the expression of $H_{n}[\Psi (\pmb {z})]$ in (3). In order to get a tractable result, we derive a close approximation of (3), + +$$ +H _ {n} \left[ \Psi (z) \right] \approx \hat {H} _ {n} \left[ \Psi (z) \right] \doteq \ln (2) \exp \left\{- \frac {1}{\pi \ln (2)} \left(\frac {\mu_ {n} (z)}{\sigma_ {n} (z)}\right) ^ {2} \right\}. \tag {4} +$$ + +The approximation in (4) is obtained by truncating the Taylor expansion of $H_{n}[\Psi(z)]$ at the second order, and it recovers almost exactly its true behavior (see Appendix B for details). Since the posterior mean at $z$ after an evaluation at $x$ depends linearly on $\mu_{n}(x)$ , and since the probability density of $y$ depends exponentially on $-\mu_{n}^{2}(x)$ , using (4) reduces the conditional entropy $\mathbb{E}_{y}\left[\hat{H}_{n+1}\left[\Psi(z)\right|\{x,y\}\right]$ to a Gaussian integral with the exact solution + +$$ +\begin{array}{l} \mathbb {E} _ {y} \left[ \hat {H} _ {n + 1} [ \Psi (z) | \{x, y \} ] \right] = \\ \ln (2) \sqrt {\frac {\sigma_ {\nu} ^ {2} + \sigma_ {n} ^ {2} (\boldsymbol {x}) \left(1 - \rho_ {n} ^ {2} (\boldsymbol {x} , \boldsymbol {z})\right)}{\sigma_ {\nu} ^ {2} + \sigma_ {n} ^ {2} (\boldsymbol {x}) \left(1 + c _ {2} \rho_ {n} ^ {2} (\boldsymbol {x} , \boldsymbol {z})\right)}} \exp \left\{- c _ {1} \frac {\mu_ {n} ^ {2} (\boldsymbol {z})}{\sigma_ {n} ^ {2} (\boldsymbol {z})} \frac {\sigma_ {\nu} ^ {2} + \sigma_ {n} ^ {2} (\boldsymbol {x})}{\sigma_ {\nu} ^ {2} + \sigma_ {n} ^ {2} (\boldsymbol {x}) \left(1 + c _ {2} \rho_ {n} ^ {2} (\boldsymbol {x} , \boldsymbol {z})\right)} \right\}, \tag {5} \\ \end{array} +$$ + +where $\rho_{n}(\pmb{x},\pmb{z})$ is the linear correlation coefficient between $f(\pmb{x})$ and $f(z)$ , and with $c_{1}$ and $c_{2}$ given by $c_{1} := 1 / \ln(2)\pi$ and $c_{2} := 2c_{1} - 1$ . This result allows us to analytically calculate the approximated + +![](images/c354268bec093c3e8b7fb9b383ae8417d2492c90f82ab6fce56400e54572b145.jpg) +(a) Iteration 1 + +![](images/17336e677470549662f0d4f064b2df0e7ff235a357ac1c2a27fdae4974ed7be1.jpg) +(b) Iteration 3 +Figure 2: Example run of ISE at different iterations. The GP's posterior mean (blue line) and confidence interval $\mu_{n} \pm \beta_{n}\sigma_{n}$ (blue shaded) approximate the true safety constraint $f$ (red line) based on selected data points (green crosses) and, together with the safety threshold at zero (orange line), identify the current safe set $S_{n}$ (light blue bar, bottom). The vertical green line indicates the location of the next parameter $x_{n+1}$ selected by (6). Initially, ISE evaluates parameters on the boundary of the safe set, but eventually also evaluates inside the safe set if that provides the most information. ISE quickly discover the largest reachable safe set (dark blue bar, bottom). + +![](images/ef604546033b14a53bd864b037d70814a29a95e8e3d966d4c442c798a7a9e755.jpg) +(c) Iteration 8 + +mutual information $\hat{I}_n\big(\{\pmb {x},y\} ;\Psi (\pmb {z})\big)\doteq \hat{H}_n\big[\Psi (\pmb {z})\big] - \mathbb{E}_y\Big[\hat{H}_{n + 1}\big[\Psi (\pmb {z})\big|\{\pmb {x},y\} \Big]\Big],$ which we use to define the ISE acquisition function, and which we analyze theoretically in Section 4. + +ISE acquisition function Now that we have defined a way to measure and compute the information gain about the safety of parameters, we can use it to design an exploration strategy that selects the next parameters to evaluate. The natural choice for such selection criterion is to select the parameter that maximizes the information gain; that is, we select $\pmb{x}_{n + 1}$ according to + +$$ +\boldsymbol {x} _ {n + 1} \in \underset {\boldsymbol {x} \in S _ {n}} {\arg \max } \underset {\boldsymbol {z} \in \mathcal {X}} {\max } \hat {I} _ {n} \left(\left\{\boldsymbol {x}, y \right\}; \Psi (\boldsymbol {z})\right), \tag {6} +$$ + +where we jointly optimize over $\mathbf{x}$ in the safe set $S_{n}$ and an unconstrained second parameter $\mathbf{z}$ . Evaluating $f$ at $\mathbf{x}_{n + 1}$ according to (6) maximizes the information gained about the safety of some parameter $\mathbf{z} \in \mathcal{X}$ , so that it allows us to efficiently learn about parameters that are not yet known to be safe. While $\mathbf{z}$ can lie in the whole domain, the parameters where we are the most uncertain about the safety constraint lie outside the safe set. By leaving $\mathbf{z}$ unconstrained, we show in our theoretical analysis in Section 4 that, once we have learned about the safety of parameters outside the safe set, (6) resorts to learning about the constraint function also inside $S_{n}$ . An overview of ISE can be found in Algorithm 1 and we show an example run of a one-dimensional illustration of the algorithm in Figure 2. + +# 4 Theoretical Results + +In this section, we study the expression for $\hat{I}_n(\{\pmb{x},y\};\Psi (\pmb {z}))$ obtained using (4) and (5) and analyze the properties of the ISE exploration criterion (6). By construction of $S_{n}$ in (2) and the assumptions on $f$ in Section 2, we know that any parameter selected according to (6) is safe with high probability, see Appendix A for details. To show that we also learn about the safe set, we first need to define what it means to successfully explore starting from $\pmb{x}_0$ . The main challenge is that it is difficult to analyze how a GP generalizes based on noisy observations, so that it is difficult to define a notion of convergence that is not dependent on the specific run. SAFEOPT avoids this issue by expanding the safe set not based on the GP, but only using the Lipschitz constant $L$ . Contrary to their approach, we depend on the GP to generalize from the safe set. In this case, the natural notion of convergence is provided by the posterior variance. In particular, we say that at iteration $n$ we have explored the safe set up to $\varepsilon$ -accuracy if $\sigma_n^2 (\pmb {x})\leq \varepsilon$ for all parameters $\pmb{x}$ in $S_{n}$ . In the following, we show that ISE asymptotically leads either to $\varepsilon$ -accurate exploration of the safe set or to indefinite expansion of the safe set. In future work it will be interesting to further investigate the notion of generalization and to derive a similar convergence result as those obtained by Sui et al. (2015). + +Theorem 1. Assume that $\pmb{x}_{n+1}$ is chosen according to (6), and that there exists $\hat{n}$ such that for all $n \geq \hat{n}$ $S_{n+1} \subseteq S_n$ . Moreover, assume that for all $n \geq \hat{n}$ , $|\mu_n(\pmb{x})| \leq M$ for some $M > 0$ for all $\pmb{x} \in S_n$ . Then, for all $\varepsilon > 0$ there exists $N_\varepsilon$ such that $\sigma_n^2(\pmb{x}) \leq \varepsilon$ for every $\pmb{x} \in S_n$ if $n \geq \hat{n} + N_\varepsilon$ . + +The smallest of such $N_{\varepsilon}$ is given by + +$$ +N _ {\varepsilon} = \min \left\{N \in \mathbb {N}: b ^ {- 1} \left(\frac {C \gamma_ {N}}{N}\right) \leq \varepsilon \right\}, \tag {7} +$$ + +where $b(\eta) \coloneqq \ln(2)\exp\left\{-c_1\frac{M^2}{\eta}\right\}\left[1 - \sqrt{\frac{\sigma_\nu^2}{2c_1\eta + \sigma_\nu^2}}\right]$ , $\gamma_N = \max_{D \subset \mathcal{X}; |D| = N} I\big(\pmb{f}(D); \pmb{y}(D)\big)$ is the maximum information capacity of the chosen kernel (Srinivas et al., 2010; Contal et al., 2014), and $C = \ln(2)/\sigma_\nu^2\ln\big(1 + \sigma_\nu^{-2}\big)$ . + +Proof. See Appendix A. + +![](images/78ebb40a185f27fd50951d16779d989b314b5cedde566c04c41863f2c498b616.jpg) + +Theorem 1 tells us that if at some point the set of safe parameters $S_{n}$ stops expanding, then the posterior variance over the safe set vanishes eventually. The intuition behind Theorem 1 is that if there were a parameter $x$ in the safe set whose posterior mean remained finite and whose posterior variance remained bounded from below, then an evaluation of $f$ at such $x$ would yield a non-negligible average information gain about the safety of $x$ , so that, since $x$ is in the safe set, at some point ISE will be forced to choose to evaluate $x$ , reducing its posterior variance. This result guarantees that, should the safe set stop expanding, ISE will asymptotically explore the safe set up to an arbitrary $\varepsilon$ -accuracy. In practice, we observe that ISE first focuses on reducing the uncertainty in areas of the safe set that are most informative about parameters whose classification is still uncertain (e.g. the boundary of the safe set), and only eventually turns to learning about the inside of the safe set. This behavior is what ultimately leads to the posterior variance to decay over the whole $S_{n}$ . Therefore, even if in general it is not always possible to say whether or not the safe set will ever stop expanding, we can read Theorem 1 as an exploration guarantee for ISE, as it rules out the possibility that the proposed acquisition function forever leaves the uncertainty high in areas of the safe set that, if better understood, could lead to an expansion of the safe set. + +Theorem 1 requires a bound on the GP posterior mean function, which is always satisfied with high probability based on our assumptions about $f$ . Specifically, we have that $|\mu_n(\pmb{x})| \leq 2\beta_n$ with probability of at least $1 - \delta$ for all $n$ (see Appendix A for details). Therefore, it does not represent an additional restrictive assumption for $f$ . Finally, we also note that the constant $N_{\varepsilon}$ defined by (7) always exists since the function $b$ is monotonically increasing, as long as $\gamma_N$ grows sublinearly in $N$ . Srinivas et al. (2010) prove that this is the case for commonly-used kernel and, more generally, it is a prerequisite for data-efficient learning with GP models. + +# 5 Discussion and Limitations + +ISE drives exploration of the parameter space by selecting the parameters to evaluate according to (6). An alternative but conceptually similar approach to this criterion would be to consider the parameter that yields the biggest information gain on average over the domain, i.e., substituting the inner max in (6) with an average over $\mathcal{X}$ . The resulting integral, however, is intractable and would require further approximations. Moreover, the parameter found by solving (6) will also yield a high average information gain over the domain, due to the regularity of all involved objects. + +Being able to work in a continuous domain, ISE can deal with higher dimensional domains better than algorithms requiring a discrete parameter space. However, as noted in Section 4, finding $x_{n+1}$ as in (6) means to solve a non-convex optimization problem with twice the dimension of the the parameter space, which can also become a computationally challenging problem as the dimension grows. In a high-dimensional setting, we follow LINEBO by Kirschner et al. (2019), which at each iteration selects a random one-dimensional subspace to which it restricts the optimization of the acquisition function. + +In Sections 2 and 3, we assumed the observation process to be homoskedastic. However, it needs not to be the case, and the results can be extended to the case of heteroskedastic Gaussian noise. The observation noise at a parameter $x$ explicitly appears in the ISE acquisition function, since it crucially affects the amount of information that we can gain by evaluating the constraint $f$ at $x$ . On the contrary, STAGEOPT-like methods do not consider the observation noise in their acquisition functions. As a consequence, ISE can perform significantly better in an heteroskedastic setting, as we also show in Section 6. + +Lastly, we reiterate that the theoretical safety guarantees offered by ISE are derived under the assumption that $f$ is a bounded norm element of the RKHS space associated with the GP's kernel. In applications, therefore, the choice of the kernel function becomes even more crucial when safety is an issue. For details on how to construct and choose kernels see (Garnett, 2022). The safety guarantees also depend on the choice of $\beta_{n}$ . Typical expressions for $\beta_{n}$ include the RKHS norm of the constraint $f$ (Chowdhury and Gopalan, 2017; Fiedler et al., 2021), which is in general difficult to estimate in practice. Because of this, usually in practice a constant value of $\beta_{n}$ is used instead. + +# 6 Experiments + +In this section we empirically evaluate ISE. Additional details about the experiments and setup can be found in Appendix C. As commonly done in the literature (see Section 5), we set $\beta_{n} = 2$ for all experiments. This choice guarantees safety per iteration, rather than jointly for all $n$ and it allows for a less conservative bound than the one needed for the joint guarantees. + +GP samples For the first part of the experiments, we evaluate ISE on constraint functions $f$ that we obtain by sampling a GP prior at a finite number of points. This allows us to test ISE under the assumptions of the theory and we compare its performance to that of the exploration part of STAGEOPT (Sui et al., 2018). STAGEOPT is a modified version of SAFEOPT, in which the exploration and optimization parts are performed separately: first the SAFEOPT exploration strategy is used to expand the safe set as much as possible, then the objective function is optimized within the discovered safe set. We further modify the version of STAGEOPT that we use in the experiment by defining the safe set in the same way ISE does, i.e., by means of the GP posterior, as done, for example, also by Berkenkamp et al. (2016). We select 100 samples from a two-dimensional GP with RBF kernel, defined in $[-2.5, 2.5] \times [-2.5, 2.5]$ and run ISE and STAGEOPT for 100 iterations for each sample. As STAGEOPT requires a discretization of the domain, we use this discretization to compare the sample efficiency of the two methods, by computing, at each iteration, what percentage of the discretized domain is classified as safe. Moreover, we also compare with the heuristic acquisition inspired by SAFEOPT proposed by Berkenkamp et al. (2016). This method works exactly as STAGEOPT, with the difference that the set of expanders is computed using directly the GP posterior, rather than the Lipschitz constant. More precisely, a parameter $x$ is considered an expander if observing a value of $\mu_n(x) + \beta_n\sigma_n(x)$ at $x$ would enlarge the safe set. For the STAGEOPT run, we use the kernel metric to compute the set of potential expanders, for different values of the Lipschitz constant $L$ . From the results shown in Figure 3a, we see not only that ISE performs as well or better than all tested instances of STAGEOPT, but also how the choice of $L$ affects the performance of the latter. This plot makes it also evident how crucial the choice of the Lipschitz constant is for STAGEOPT and SAFEOPT-like algorithms in general. In Table 1, in Appendix C, we report the average percentage of safety violations per run achieved by ISE and STAGEOPT. As expected, we see that the percentage of safety violations is comparable among all algorithms. + +To show that for STAGEOPT exploration not only overestimating the Lipschitz constant, but also underestimating it can negatively impact performance, we consider the simple one-dimensional constraint function $f(x) = e^{-x} + 0.05$ and run the safe exploration for multiple values of the Lipschitz constant. This function gets increasingly away from the safety threshold for $x \to -\infty$ , while it asymptotically approaches the threshold for $x \to \infty$ , so that a good exploration algorithm would, ideally, quickly classify as safe the domain region for $x < 0$ and then keep exploring the boundary of the safe set for $x > 0$ . The results plotted in Figure 3b show how both a too high and a too low Lipschitz constant can lead to sub-optimal exploration. In the case of a too small constant, this is because STAGEOPT considers expanders almost all parameters in the domain, leading to additional evaluations in the region for $x < 0$ that are unlikely to cause expansion of the safe set. On the other hand, a too high value of the Lipschitz constant can lead to the set of expanders to be empty as soon as the posterior mean gets close to the safety threshold for $x > 0$ . + +OpenAI Gym Control After investigating the performance of ISE under the hypothesis of the theory, we apply it to two classic control tasks from the OpenAI Gym framework (Brockman et al., 2016), with the goal of finding the set of parameters of a controller that satisfy some safety constraint. In particular we consider linear controllers for the inverted pendulum and cart pole tasks. + +For the inverted pendulum task, the linear controller is given by $u_{t} = \alpha_{1}\theta_{t} + \alpha_{2}\dot{\theta}_{t}$ , where $u_{t}$ is the control signal at time $t$ , while $\theta_t$ and $\dot{\theta}_t$ are, respectively, the angular position and the angular velocity + +![](images/2af728a224d8192a79b7ddfec1098c5b51f4ff8cb86a74c380b8d75cb45299a7.jpg) +(a) Comparison with STAGEOPT for GP samples. + +![](images/410368a2913a0612fae726ed076797e338a5857a98677c1cb14760967b35db98.jpg) +(b) Comparison in 1D exponential example. +Figure 3: (a) Average expansion of safe set over 100 two-dimensional GP samples. The average percentage of the domain classified as safe is plotted as a function of $n$ with its standard error. The lines for $L = 0$ and $L = 1$ overlap. We can see that ISE obtains an higher sample efficiency than the best instance of STAGEOPT and a comparable one with the heuristic acquisition function proposed by Berkenkamp et al. (2016). The plot also shows that STAGEOPT performance is heavily affected by the choice of $L$ . In (b) the average percentage of the domain classified as safe in the one dimensional example for $f(x) = e^{-x} + 0.05$ is plotted as function of the iteration $n$ with its standard error, and it shows the detrimental effect of over- and underestimating $L$ . + +of the pendulum. Starting from a position close to the upright equilibrium, the controller's task is the stabilization of the pendulum, subject to a safety constraint on the maximum velocity reached within one episode. For some given initial controller configuration $\alpha_0 \coloneqq (\alpha_1^0, \alpha_2^0)$ , we want to explore the controller's parameter space avoiding configurations that lead the pendulum to swing with a too high velocity. We apply ISE to explore the $\alpha$ -space with $x_0 = \alpha_0$ and the safety constraint being the maximum angular velocity reached by the pendulum in an episode of fixed length. In this case, the safety threshold is not at zero, but rather at some finite value $\dot{\theta}_M$ , and the safe parameters are those for which the maximum velocity is below $\dot{\theta}_M$ . The formalism developed in the previous sections can be easily applied to this scenario if we consider $f(\alpha) = -\left(\max_t \dot{\theta}_t(\alpha) - \dot{\theta}_M\right)$ . In Figure 4a we show the true safe set for this problem, while in Figures 4b-4d one can see how ISE safely explores the true safe set. These plots show how the ISE acquisition function (6) selects parameters that are close to the current safe set boundary and, hence, most informative about the safety of parameters outside of the safe set. This behavior eventually leads to the full true safe set to be classified as safe by the GP posterior, as Figure 4d shows. + +The cart pole task is similar to the inverted pendulum one, but the parameter space has three dimensions. The controller we consider is given by $u_{t} = \alpha_{1}\theta_{t} + \alpha_{2}\dot{\theta}_{t} + \alpha_{3}\dot{s}_{t}$ , where $\theta_{t}$ and $\dot{\theta}_t$ are, respectively, the angular position and angular velocity of the pole at time $t$ , while $\dot{s}_t$ is the cart's velocity. We set the initial state to zero angular and linear velocity and with the pole close to the vertical position, with the controller's goal being to keep the pole stable in the upright position. A combination of the three parameters $\alpha_{1},\alpha_{2}$ and $\alpha_{3}$ is considered safe if the angle of the pole does not exceed a given threshold within the episode. Again, we can easily cast this safety constraint in terms of the formalism developed in the paper: $f(\pmb {\alpha}) = -(\max_t\theta_t(\pmb {\alpha}) - \theta_M)$ , where $\theta_{M}$ is the maximum allowed angle. Figure 5a shows the expansion of the cart pole $\pmb{\alpha}$ space promoted by ISE, compared with STAGEOPT for different values of the Lipschitz constant. Both methods achieve a comparable sample efficiency and both lead to the classification as safe of the full true safe set. + +High dimensional domains Many interesting applications have a high dimensional parameter space. While SAFEOPT-like methods are difficult to apply already with dimension $>3$ due to the discretization of the domain, ISE can perform well also in four or five dimensions. To see this, we apply ISE to the constraint function $f(\pmb{x}) = e^{-\pmb{x}^2} + 2e^{-(\pmb{x} - \pmb{x}_1)^2} + 5e^{-(\pmb{x} - \pmb{x}_2)^2} - 0.2$ . Figure 5b shows the ISE performance in dimension 5. We see that ISE is able to promote the expansion of the safe set, leading to an increasingly bigger portion of the true safe set to be classified as safe. + +Heteroskedastic noise domains For even higher dimensions, we can follow a similar approach to LINEBO, limiting the optimization of the acquisition function to a randomly selected one-dimensional subspace of the domain. Moreover, as discussed in Section 5, it is also interesting to test ISE in the case of heteroskedastic observation noise, since the noise is a critical quantity for the ISE acquisition function, while it does not affect the selection criterion of STAGEOPT-like methods. Therefore, in + +![](images/87755448234fa7108d66e4f0b34aef8955c7726b6c29d25b578bb1b5fca3267a.jpg) + +![](images/e527b3326620714aae2891570521352dfd0dc6a940df149f996a3a67f0f7056d.jpg) + +![](images/8c3fefd837daa1c8b134ea5fd7aa6b3c4ec2009bd0c5f6edb29e344713047a75.jpg) +(a) True safe set +(c) Iteration 30 + +![](images/92efe77b502d553384cb5e1bb9d52b4af7d8ee2013fdf1c13fd77edf4b3f9161.jpg) +(b) Iteration 10 +(d) Iteration 50 + +![](images/610500a54fdfe6f49d79a97fac0779eab81af83d16450e599453e4926c88ea53.jpg) +Figure 4: Safe exploration of the linear controller's parameter space in the inverted pendulum experiment. In (a) we see the true safe set, while in (b-d) we see the safe set (blue region) as identified by ISE at various iterations. The point marked by the green dot is $\alpha_{n+1}$ as selected by (6), while the black cross is the initial safe seed $\alpha_0$ . +(a) Exploration of the safe set for the cart pole task. +Figure 5: In (a) we plot the percentage of the true safe set of the cart pole task classified as safe by ISE and STAGEOPT, while in (b) we see the expansion of the five-dimensional safe set promoted by ISE, for the safety constraint $f$ used in the high dimensional experiments. + +![](images/d9125405c58a8fc52d092df2d78040b0dde42764b32bb2b51aaefb9ddf2c42ac.jpg) +(b) Expansion of the safe set in dimension five. + +this experiment we combine a high dimensional problem with heteroskedastic noise. In particular, we apply a LINEBO version of ISE to the constraint function $f(\pmb{x}) = \frac{1}{2} e^{-\pmb{x}^2} + e^{-(\pmb{x} \pm \pmb{x}_1)^2} + 3e^{-(\pmb{x} \pm \pmb{x}_2)^2} + 0.2$ in dimension nine and ten, with the safe seed being the origin. This function has two symmetric global optima at $\pm x_2$ and we set two different noise levels in the two symmetric domain halves containing the optima. To assess the exploration performance, we use the simple regret, defined as the difference between the current safe optimum and the true safe optimum. As the results in Figure 6 show, ISE achieve a greater sample efficiency than the other STAGEOPT-like methods. Namely, for a given number of iterations, by explicitly exploiting knowledge about the observation noise, ISE is able to classify as safe regions of the domain further away from the origin, in which the constraint function assumes its largest values, resulting in a smaller regret. On the other hand, SAFEOPT-like methods only focus on the posterior variance, so that the higher observation noise causes them to remain stuck in a smaller neighborhood of the origin, resulting in bigger regret. + +![](images/480d746d6d2e837f717860d699081b0aa932c5653c0043126f45a5fd016ac773.jpg) +(a) Dimension 9. + +![](images/fe15de9b4abccd4b75c5c9c47c3338a42e66cadd1d3250a64a476d47e1b981c4.jpg) +(b) Dimension 10. +Figure 6: Example of high dimensional exploration, for $d = 9$ and $d = 10$ . After every ten iterations, we perform safe optimization with UCB acquisition within the current safe set and plot the simple regret $r_n$ with respect to the safe optimum. (a) and (a) show, respectively, the average regret over 70 runs in dimension nine and ten, as a function of the number of iterations. We can see that this adapted version of ISE promotes expansion of the safe set, leading to classifying as safe regions where the latent function attains its largest value. The plots also show that ISE achieves a better sample efficiency than both STAGEOPT-like exploration and the STAGEOPT inspired heuristic acquisition. + +# 7 Conclusion and Societal Impact + +We have introduced Information-Theoretic Safe Exploration (ISE), a novel approach to safely explore a space in a sequential decision task where the safety constraint is a priori unknown. ISE efficiently and safely explores by evaluating only parameters that are safe with high probability and by choosing those parameters that yield the greatest information gain about the safety of other parameters. We theoretically analyzed ISE and showed that it leads to arbitrary reduction of the uncertainty in the largest reachable safe set containing the starting parameter. Our experiments support these theoretical results and demonstrate an increased sample efficiency and scalability of ISE compared to SAFEOPT-based approaches. + +In many safety sensitive applications the shape of the safety constraints is unknown, so that an important prerequisite for any kind of process is to identify what parameters are safe to evaluate. By providing a principled way to do this, the contributions of this paper allow to deal with safety in a broad range of applications, which can favor the usage of ML approaches also in safety sensitive settings. On the other hand, misuse of the proposed method cannot be prevented in general. + +# References + +Felix Berkenkamp, Angela P. Schoellig, and Andreas Krause. Safe controller optimization for quadrators with gaussian processes. In IEEE International Conference on Robotics and Automation (ICRA), 2016. +Felix Berkenkamp, Andreas Krause, and Angela P Schoellig. Bayesian optimization with safety constraints: safe and automatic parameter tuning in robotics. *Machine Learning Journal*, Special Issue on Robust Machine Learning, 2021. +Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym. arXiv preprint arXiv:1606.01540, 2016. +Sébastien Bubeck and Nicolò Cesa-Bianchi. Regret analysis of stochastic and nonstochastic multiarmed bandit problems. Foundations and Trends® in Machine Learning, 5(1):1-112, 2012. +Sayak Ray Chowdhury and Aditya Gopalan. On kernelized multi-armed bandits. In International Conference on Machine Learning (ICML), 2017. +Emile Contal, Vianney Perchet, and Nicolas Vayatis. Gaussian process optimization with mutual information. In International Conference on International Conference on Machine Learning (ICML), 2014. +Rikky R.P.R. Duivenvoorden, Felix Berkenkamp, Nicolas Carion, Andreas Krause, and Angela P. Schoellig. Constrained Bayesian optimization with particle swarms for safe adaptive controller tuning. In Proc. of the IFAC (International Federation of Automatic Control) World Congress, pages 12306-12313, 2017. +Gabriel Dulac-Arnold, Daniel J. Mankowitz, and Todd Hester. Challenges of real-world reinforcement learning. In International Conference on International Conference on Machine Learning (ICML), 2019. +Christian Fiedler, Carsten W. Scherer, and Sebastian Trimpe. Practical and rigorous uncertainty bounds for gaussian process regression. In AAAI Conference on Artificial Intelligence, 2021. +Lukas Fröhlich, Edgar Klenske, Julia Vinogradska, Christian Daniel, and Melanie Zeilinger. Noisy-input entropy search for efficient robust bayesian optimization. In International Conference on Artificial Intelligence and Statistics (AISTATS), 2020. +Roman Garnett. Bayesian Optimization. Cambridge University Press, 2022. in preparation. +Michael A. Gelbart, Jasper Snoek, and Ryan P. Adams. Bayesian optimization with unknown constraints. In Conference on Uncertainty in Artificial Intelligence (UAI), 2014. +Alkis Gotovos, Nathalie Casati, Gregory Hitz, and Andreas Krause. Active learning for level set estimation. In International Joint Conference on Artificial Intelligence (IJCAI), 2013. +Alexander Hans, Daniel Schneegass, Anton Schäfer, and Steffen Udluft. Safe exploration for reinforcement learning. In European Symposium on Artificial Neural Networks (ESANN), 2008. +Philipp Hennig and Christian J. Schuler. Entropy search for information-efficient global optimization. Journal of Machine Learning Research, 13:1809-1837, 2012. +Jose Miguel Henrández-Lobato, Matthew W. Hoffman, and Zoubin Ghahramani. Predictive entropy search for efficient global optimization of black-box functions. In International Conference on Neural Information Processing Systems (NIPS), 2014. +Johannes Kirschner, Mojmir Mutny, Nicole Hiller, Rasmus Ischebeck, and Andreas Krause. Adaptive and safe bayesian optimization in high dimensions via one-dimensional subspaces. In International Conference for Machine Learning (ICML), 2019. +Teodor Mihai Moldovan and Pieter Abbeel. Safe exploration in markov decision processes. In International Coference on International Conference on Machine Learning (ICML), 2012. + +Carl Edward Rasmussen and Christopher K. I. Williams. Gaussian processes for machine learning. MIT Press, Cambridge, MA, USA, 2006. +Mark Schillinger, Benjamin Hartmann, Patric Skalecki, Mona Meister, Duy Nguyen-Tuong, and Oliver Nelles. Safe active learning and safe bayesian optimization for tuning a pi-controller. IFAC-PapersOnLine, 50(1):5967-5972, 2017. +Bernhard Schölkopf and Alexander J. Smola. Learning with kernels: support vector machines, regularization, optimization, and beyond. MIT Press, Cambridge, MA, USA, 2002. +Jens Schreiter, Duy Nguyen-Tuong, Mona Eberts, Bastian Bischoff, Heiner Markert, and Marc Toussaint. Safe exploration for active learning with gaussian processes. In European Conference on Machine Learning and Knowledge Discovery in Databases (ECMLPKDD), 2015. +Bobak Shahriari, Kevin Swersky, Ziyu Wang, Ryan P. Adams, and Nando de Freitas. Taking the Human Out of the Loop: A Review of Bayesian Optimization. Proceedings of the IEEE, 104: 148-175, 2016. +Niranjan Srinivas, Andreas Krause, Sham Kakade, and Matthias Seeger. Gaussian process optimization in the bandit setting: No regret and experimental design. In International Conference on Machine Learning (ICML), 2010. +Yanan Sui, Alkis Gotovos, Joel W. Burdick, and Andreas Krause. Safe exploration for optimization with Gaussian processes. In International Conference on Machine Learning (ICML), 2015. +Yanan Sui, Vincent Zhuang, Joel Burdick, and Yisong Yue. Stagewise safe Bayesian optimization with Gaussian processes. In International Conference on Machine Learning (ICML), 2018. +Matteo Turchetta, Felix Berkenkamp, and Andreas Krause. Safe exploration in finite markov decision processes with gaussian processes. In Advances in Neural Information Processing Systems (NeurIPS), 2016. +Matteo Turchetta, Felix Berkenkamp, and Andreas Krause. Safe exploration for interactive machine learning. In Advances in Neural Information Processing Systems (NeurIPS), 2019. +Zi Wang and Stefanie Jegelka. Max-value entropy search for efficient bayesian optimization. In International Conference on Machine Learning (ICML), 2017. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] Limitations are discussed in Section 5 +(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Section 7 +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] See Section 4. +(b) Did you include complete proofs of all theoretical results? [Yes] See Appendix A. + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] The code is available at https://github.com/boschresearch/information-theoretic-safe-exploration. Experiment details to reproduce our results can be found in Appendix C. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Appendix C. +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] They are in the respective plots. +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Appendix C. + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] See Section 6 and Appendix C +(b) Did you mention the license of the assets? [Yes] See Appendix C +(c) Did you include any new assets either in the supplemental material or as a URL? [No] No new assets have been used nor introduced. +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/informationtheoreticsafeexplorationwithgaussianprocesses/images.zip b/informationtheoreticsafeexplorationwithgaussianprocesses/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..a96ca859249303fce294f424353acc6667254814 --- /dev/null +++ b/informationtheoreticsafeexplorationwithgaussianprocesses/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07774042451f432a5aa1ccb0d9802375a20c567fce37770ae0c9718547510665 +size 351171 diff --git a/informationtheoreticsafeexplorationwithgaussianprocesses/layout.json b/informationtheoreticsafeexplorationwithgaussianprocesses/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..383914d65450ba5e18ac08719c6c109cd798cdd3 --- /dev/null +++ b/informationtheoreticsafeexplorationwithgaussianprocesses/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:29c168379417082c096cb3d50529f5413ce961f86a824d92729b8e5fe79fb1e4 +size 520276 diff --git a/inherentlyexplainablereinforcementlearninginnaturallanguage/4847c59b-24ec-495c-938b-41211ec1f9ea_content_list.json b/inherentlyexplainablereinforcementlearninginnaturallanguage/4847c59b-24ec-495c-938b-41211ec1f9ea_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..81aec8b1925a1fc641750f0135bf15fe064a782e --- /dev/null +++ b/inherentlyexplainablereinforcementlearninginnaturallanguage/4847c59b-24ec-495c-938b-41211ec1f9ea_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:070386621e79a0b910bea841ec054f64341e625436db245fda422f5e4f32f113 +size 81797 diff --git a/inherentlyexplainablereinforcementlearninginnaturallanguage/4847c59b-24ec-495c-938b-41211ec1f9ea_model.json b/inherentlyexplainablereinforcementlearninginnaturallanguage/4847c59b-24ec-495c-938b-41211ec1f9ea_model.json new file mode 100644 index 0000000000000000000000000000000000000000..d622afd8a5e0967837f0379ff0221ab19eec4588 --- /dev/null +++ b/inherentlyexplainablereinforcementlearninginnaturallanguage/4847c59b-24ec-495c-938b-41211ec1f9ea_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e72a2f8c713125a619db99418a31f408017a9a64a42b4ace6e38a1124d6babe0 +size 103131 diff --git a/inherentlyexplainablereinforcementlearninginnaturallanguage/4847c59b-24ec-495c-938b-41211ec1f9ea_origin.pdf b/inherentlyexplainablereinforcementlearninginnaturallanguage/4847c59b-24ec-495c-938b-41211ec1f9ea_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..1d70a898b6ef80794a49e151e4cee133c6133f39 --- /dev/null +++ b/inherentlyexplainablereinforcementlearninginnaturallanguage/4847c59b-24ec-495c-938b-41211ec1f9ea_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:88ab70dde48f8a952aa009fe751497551f898baadb2958801ac8aea21455b5e9 +size 4918681 diff --git a/inherentlyexplainablereinforcementlearninginnaturallanguage/full.md b/inherentlyexplainablereinforcementlearninginnaturallanguage/full.md new file mode 100644 index 0000000000000000000000000000000000000000..34161d910148f2e4833a544713f180c6d4d9613b --- /dev/null +++ b/inherentlyexplainablereinforcementlearninginnaturallanguage/full.md @@ -0,0 +1,333 @@ +# Inherently Explainable Reinforcement Learning in Natural Language + +Xiangyu Peng† + +Chen Xing† + +Prafulla Kumar Choubey† Chien-Sheng Wu, Caiming Xiong + +$^{\dagger}$ Georgia Institute of Technology + +$\ddagger$ Allen Institute for AI + +{xpeng62,riedl} $@$ gatech.edu,raja@allenai.org + +# Abstract + +We focus on the task of creating a reinforcement learning agent that is inherently explainable—with the ability to produce immediate local explanations by thinking out loud while performing a task and analyzing entire trajectories post-hoc to produce temporally extended explanations. This Hierarchically Explainable Reinforcement Learning agent (HEX-RL), operates in Interactive Fictions, text-based game environments in which an agent perceives and acts upon the world using textual natural language. These games are usually structured as puzzles or quests with long-term dependencies in which an agent must complete a sequence of actions to succeed—providing ideal environments in which to test an agent's ability to explain its actions. Our agent is designed to treat explainability as a first-class citizen, using an extracted symbolic knowledge graph-based (KG) state representation coupled with a Hierarchical Graph Attention mechanism that points to the facts in the internal graph representation that most influenced the choice of actions. Experiments show that this agent provides significantly improved explanations over strong baselines, as rated by human participants generally unfamiliar with the environment, while also matching state-of-the-art task performance. + +# 1 Introduction + +Explainable AI refers to artificial intelligence methods and techniques that provide human-understandable insights into how and why an AI system chooses actions or makes predictions. Such explanations are critical for ensuring reliability and improving trustworthiness by increasing user understanding of the underlying model. In this work we specifically focus on creating deep reinforcement learning (RL) agents that can explain their actions in sequential decision making environments through natural language. + +In contrast to the majority of contemporary work in the area which focuses on supervised machine learning problems which require singular instance level local explanations (You et al., 2016; Xu et al., 2015; Wang et al., 2017; Wegreffe and Marasovic, 2021), such environments—in which agents need to reason causally about actions over a long series + +Observation: Forest Path + +The path heads northsouth here. + +One particularly large tree with some low branches stands at the edge of the path... + +Action: go up + +Game Score: 0 + +![](images/8e7681a63d848a057481286b433fab4410e6bace21ebc147394c6a615497d361.jpg) + +\* Explanation: + +I am in the Forest Path now. trees are interreactable + +Agent needs this action to: take egg at Up a tree + +Observation: Up a tree + +Beside you on the branch is a small birds nest In the birds nest is a large egg encrusted with precious jewels, scavenged by a childless son + +Action: take egg + +Game Score: 5 + +![](images/643b8fcfe8e2d7336b39f4f217a95fcdaa4a034ef3a3dd37aaf93fd501390218.jpg) + +\* Explanation: egg is interactable + +Observation: Up a tree Taken. + +Figure 1: Excerpt from zork1 with immediate step-by-step explanations constructed from the KG represented by $\hat{x}$ and temporally extended explanations by $\hat{z}$ . Colors represent different categories of KG facts seen in Fig.2 + +of steps—require an agent to take into account both environmentally grounded context as well as goals when producing explanations. Agents implicitly contain beliefs regarding the downstream effects—the changes to the world—that actions taken at the current timestep will have. This requires explanations in these environments to contain an additional temporally extended component taking the full trajectory's context into account—complementary to the immediate step-by-step explanations. + +Interactive Fiction (IF) games (Fig. 1) are partially observable environments where an agent perceives and acts upon a world using potentially incomplete textual natural language descriptions. They are structured as long puzzles and quests that require agents to reason about thousands of locations, characters, and objects over hundreds of steps, creating chains of dependencies that an agent must fulfill to complete the overall task. They provide ideal experimental test-beds for creating agents that can both reason in text and explain it. + +We introduce an approach to game playing agents—Hierarchically Explainable Reinforcement Learning (HEX-RL)—that is designed to be inherently explainable, in the sense that its internal state representation—i.e. belief state about the world—takes the form of a symbolic, human-interpretable knowledge graph (KG) that is built as the agent explores the world. The graph is encoded by a Graph Attention network (GAT) (Veličković et al., 2017) extended to contain a hierarchical graph attention mechanism that focuses on different sub-graphs in the overall KG representation. Each of these sub-graphs contains different information such as attributes of objects, objects the player has, objects in the room, current location, etc. Using these encoding networks in conjunction with the underlying world KG, the agent is able to create immediate explanations akin to a running commentary that points to the facts within this knowledge graph that most influence its current choice of actions when attempting to achieve the tasks in the game on a step-by-step basis. + +While graph attention can tell us which elements in the KG are attended to when maximizing expected reward from the current state, it cannot explain the intermediate, unrewarded dependencies that need to be satisfied to meet the long term task goals. For example, in the game zork1, the agent needs to pick up a lamp early on in the game—an unrewarded action—but the lamp is only used much later on to progress through a location without light. Thus, our agent additionally analyzes an overall episode trajectory—a sequence of knowledge graph states and actions from when the agent first starts in a world to either task completion or agent death—to find the intermediate set of states that are most important for completing the overall task. This information is used to generate a temporally extended explanation that condenses the immediate step-by-step explanations to only the most important steps required to fulfill dependencies for the task. + +Our contributions are as twofold: (1) we create an inherently explainable agent that uses an ever-updating knowledge-graph based state representation to generate step-by-step immediate explanations for executed actions as well as performing a post-hoc analysis to create temporal explanations; and (2) a thorough experimental study against strong baselines that shows that our agent generates significantly improved explanations for its actions when rated by human participants unfamiliar with the domain while not losing any task performance compared to the current state-of-the-art knowledge graph-based agents. + +# 2 Background and Related Work + +Interactive Fiction (IF) games are simulations featuring language-based state and action spaces. It provides a platform for exploring lifelong open-domain dialogue learning (Shuster et al., 2020) and action elimination with deep reinforcement learning (Zahavy et al., 2018). In this paper, we use IF games as our test-bed because they provide an ideal platform for collecting data, linking game states and actions to the corresponding natural language explanations. We use the definition of text-adventure games as seen in Côté et al. (2018) and Hausknecht et al. (2020). We take Jericho (Hausknecht et al., 2020), a framework for interacting with text games, as the interface connecting learning agents with interactive fiction games. A text game can be defined as a partially-observable Markov Decision Process: $G = \langle S, P, A, O, \Omega, R, \gamma \rangle$ , representing the set of environment states, conditional transition probabilities between states, the vocabulary or words used to compose text + +![](images/a79987f02327c2ebc40f02461326689c316b2438470e6590f1c84e3b0b3acdf8.jpg) +Figure 2: Knowledge graph extraction and the (HEX-RL) agent's architecture at step $t$ . + +commands, observations, observation conditional probabilities, reward function, and discount factor, respectively. The reinforcement learning agent is trained to learned a policy $\pi_G(o) \to a$ . + +Knowledge Graphs for Text Games. Ammanabrolu et al. (2020) proposed Q*BERT, a reinforcement learning agent that learns a KG of the world by answering questions. Xu et al. (2020) introduce the SHA-KG, a stacked Hierarchical Graph Attention mechanism to construct an explicit representation of the reasoning process by exploiting the structure of the KG. Adhikari et al. (2020) present the Graph-Aided Transformer Agent (GATA) which learns to construct a KG during game play and improves zero-shot generalization on procedurally generated TextWorld games. Other works such as Murugesan et al. (2020) explore how to use KGs to endow agents with commonsense. While these works showcase the effectiveness of KGs on task performance and do not focus on how explainable their architectures are. We further note that these architectures do now allow for as fine-grained attention-based attribution as HEX-RL's architecture does—e.g. Q*BERT does not use relationship information in their policy and SHA-KG averages attention across large portions of the graph and is unable to point to specific triples in its KG representation to explain an action. + +Explainable Deep RL. Contemporary work on explaining deep reinforcement learning policies can be broadly categorized based on: (1) how the information is extracted, either via intrinsic motivation during training (Shu et al., 2017; Hein et al., 2017; Verma et al., 2018) or through post-hoc analysis (Rusu et al., 2015; Hayes and Shah, 2017; Juozapaitis et al., 2019; Madumal et al., 2020); and (2) the scope—either global (Zahavy et al., 2016; Hein et al., 2017; Verma et al., 2018; Liu et al., 2018) or local (Shu et al., 2017; Liu et al., 2018; Madumal et al., 2020; Guo et al., 2021). In our work, we create an agent that spans more than one of these categories providing immediately local explanations through extracted knowledge graph representations and post-hoc temporal explanations. Inspired by Madumal et al. (2020), we learn a graphical causal model which focuses on using relations between steps in a puzzle to generate temporal explanations instead of generating counterfactuals. + +# 3 Hierarchically Explainable RL + +Our work aims to generate (1) immediate step-by-step explanations of an agent's policy by capturing the importance of the current game state observation and (2) temporally extended explanations that take into context an entire trajectory via a post-hoc analysis. Formally, let $\mathbf{X} = \{\mathbf{s}_t, \mathbf{a}_t\}_{t=1:T}$ be the set of game steps that compose a trajectory. Each game state $s_t$ consists of a knowledge graph $G_t$ representing all the information learned since the start of the game. This graph is further split into four sub-knowledge graphs each containing different, semantically related relationship types. This section first describes a graph attention based architecture that uses these sub-graphs to produce immediate explanations. We then describe how to filter the game states in a trajectory into a condensed set of the most important ones $\mathbf{X}' \subset \mathbf{X}$ that best capture the underlying dependencies that need to be fulfilled to complete the task—enabling us to produce temporal explanations. + +Knowledge Graph State Representation. Building on Ammanabrolu et al. (2020), constructing the knowledge graph is treated as a question-answering task. KGs in these games take the form of RDF triples (Klyne 2004) of —extracted from text observations and update as the agent explores the world. The agent answers questions about the environment such as, "What am I carrying?" or "What objects are around me?" A specially constructed dataset for question answering in text games—JerichoQA—is used to fine-tune ALBERT (Lan et al., 2019) to answer these questions (See Appendix A.3). The answers form a set of candidate graph vertices $V_{t}$ for the current step and questions form the set of relations $R_{t}$ . Both $V_{t}$ and $R_{t}$ are then combined with the graph at the previous step $G_{t - 1}$ to update the agent's belief about the world state into $G_{t}$ . The left side of Figure 2 showcases this. + +In an attempt to enable more fine grained explanation generation and inspired by Xu et al. (2020), we divide the knowledge graph $G$ into multiple sub-graphs $G^{atr}$ , $G^{inv}$ , $G^{obj}$ , $G^{loc}$ , each representing (1) attributes of objects, (2) objects the player has, (3) objects in the room, and (4) other information such as location (right side of Fig. 2) based on the corresponding relationship types extracted by the ALBERT-QA module. The union of all sub-graphs is equivalent of $V_{t}$ and $R_{t}$ extracted from the current game state. The full knowledge graph $G_{t}$ captures the overall game state since the start of the game. The sub-graphs easily reflect different relationships of the current game state. + +Template Action Space. Agents output a language string into the game to describe the actions that they want to perform. To ensure tractability, this action space can be simplified down into templates. Templates consist of interchangeable verbs phrases (VP), optionally followed by prepositional phrases (VP PP), e.g. ([carry/take]_) and ([throw/discard/put] _ [against/on/down ] _), where the verbs and prepositions within [. are aliases. Actions are constructed from templates by filling in the template's blanks using words in the game's vocabulary. Size of action space is shown in Appendix A.1. + +# 3.1 Immediate Explanations + +Our immediate explanations consist of finding the subset of triplets in sub-graphs $G^{atr}, G^{inv}, G^{obj}, G^{loc}$ c the action decision made at the current step—is capable of explaining the action. We introduce a deep RL architecture capable of this. + +Hierarchical Knowledge Graph Attention Architecture. At each step, a total score $R_{t}$ and an observation $o_{t}$ is received—consisting of $\left(o_{t_{\mathrm{desc}}}, o_{t_{\mathrm{game}}}, o_{t_{\mathrm{inv}}}, a_{t-1}\right)$ corresponding to the room description, game feedback, inventory, and previous action and are processed using a GRU based encoder using the hidden state from the previous step, combining them into a single observation embedding $\mathbf{o}_{t} \in \mathbb{R}^{d_{text} \times c}$ (bottom of Fig. 2). + +The full knowledge graph $G_{t}$ is processed via Graph Attention Networks (GATs) (Veličković et al. 2017) followed by a linear layer to get the graph representation $\mathbf{g}_{\mathbf{t}} \in \mathbb{R}^{d_{text}}$ (middle of Fig. 2). We compute LSTM attention between $\mathbf{o}_{t}$ and $\mathbf{g}_{\mathbf{t}}$ as: + +$$ +\boldsymbol {\alpha} _ {\mathrm {L S T M}} = \operatorname {s o f t m a x} \left(\boldsymbol {W} _ {1} \boldsymbol {h} _ {\mathrm {L S T M}} + \boldsymbol {b} _ {1}\right) \tag {1} +$$ + +$$ +\boldsymbol {h} _ {\mathrm {L S T M}} = \tanh \left(\boldsymbol {W} _ {\mathrm {o}} \boldsymbol {o} _ {\mathrm {t}} \oplus \left(\boldsymbol {W} _ {\mathrm {g}} \mathbf {g} _ {\mathrm {t}} + \boldsymbol {b} _ {\mathrm {g}}\right)\right) \tag {2} +$$ + +where $\oplus$ denotes the addition of a matrix and a vector. $W_{1}\in \mathbb{R}^{d_{text}\times d_{text}}$ , $W_{\mathrm{g}}\in \mathbb{R}^{d_{text}\times d_{text}}$ , $W_{0}\in \mathbb{R}^{d_{text}\times d_{text}}$ are weights and $b_{1}\in \mathbb{R}^{d_{text}}$ , $b_{0}\in \mathbb{R}^{d_{text}}$ are biases. The overall representation vector is updated as: + +$$ +\mathbf {q} _ {\mathrm {t}} = \mathbf {g} _ {\mathrm {t}} + \sum_ {i} ^ {c} \boldsymbol {\alpha} _ {\text {L S T M}, i} \odot \boldsymbol {o} _ {\mathrm {t}, i} \tag {3} +$$ + +where $\odot$ denotes dot-product and $c$ is the number of $\pmb{o}_{\mathrm{t}}$ 's components. + +Sub-graphs are also encoded by GATs to get the graph representation $\mathbf{g}_{\mathbf{t}}^{\prime} \in \mathbb{R}^{d_{G_t,sub} \times m}$ (no. of subgraphs). The Hierarchical Graph Attention between $\mathbf{q}_t \in \mathbb{R}^{d_{G_t,sub}2}$ and $\mathbf{g}_{\mathbf{t}}^{\prime}$ is calculated by: + +$$ +\boldsymbol {\alpha} _ {\text {H i e r a r c h i c a l}} = \operatorname {s o f t m a x} \left(\boldsymbol {W} _ {\mathrm {H}} \boldsymbol {h} _ {\mathrm {H}} + \boldsymbol {b} _ {\mathrm {H}}\right) \tag {4} +$$ + +$$ +\boldsymbol {h} _ {\mathrm {H}} = \tanh \left(\boldsymbol {W} _ {\mathrm {g} ^ {\prime}} \boldsymbol {g} _ {\mathrm {t}} ^ {\prime} \oplus \left(\boldsymbol {W} _ {\mathrm {q}} \boldsymbol {q} _ {\mathrm {t}} + \boldsymbol {b} _ {\mathrm {q}}\right)\right) \tag {5} +$$ + +where $W_{\mathrm{H}} \in \mathbb{R}^{d_{G_t,sub} \times d_{G_t,sub}}$ , $W_{\mathrm{g'}} \in \mathbb{R}^{d_{G_t,sub} \times d_{G_t,sub}}$ , $W_{\mathrm{q}} \in \mathbb{R}^{d_{G_t,sub} \times d_{G_t,sub}}$ are weights and $b_{\mathrm{H}} \in \mathbb{R}^{d_{G_t,sub}}$ , $b_{\mathrm{q}} \in \mathbb{R}^{d_{G_t,sub}}$ are biases. Then we get state representation, consisting of the textual observations full knowledge graph and sub-knowledge graph. + +$$ +\mathbf {v} _ {\mathbf {t}} = \mathbf {q} _ {\mathbf {t}} + \sum_ {i} ^ {s} \boldsymbol {\alpha} _ {\text {H i e r a c h i c a l}, i} \odot \mathbf {g} _ {\mathbf {t}, i} ^ {\prime} \tag {6} +$$ + +where $s$ is the number of sub-graphs (4 in our paper). The full architecture can be found in Figure 2. + +The agent is trained via the Advantage Actor Critic (A2C) (Mnih et al., 2016) method to maximize long term expected reward in the game in a manner otherwise unchanged from Ammanabrolu et al. (2020) (See Appendix A.2). These attention values thus reflect the portions of the knowledge graphs that the agent must focus on to best achieve this goal of maximizing reward. + +Hierarchical Graph Attention Explanation. The graph attention $\alpha_{\text{Hierarchical}}$ is used to capture the relative importance of game state observations and KG entities in influencing action choice. For each sub-graph, the graph attention, $\alpha_{\text{Hierarchical},i} \in \mathbb{R}^{n_{\text{nodes}} \times m}$ is summed over all the channels $m$ to obtain $\alpha_{\text{Hierarchical},i}' \in \mathbb{R}^{n_{\text{nodes}} \times 1}$ , showing the importance of the KG nodes in the $i$ th sub-graph. The top- $k$ valid entities (and corresponding edges) with highest absolute value of its attention form the set of knowledge graph triplets that best locally explain the action $a_t$ . + +In order to make the explanation more readable for a human reader, we further transform knowledge graph triplets to natural language by template filling. + +We create templates for each type of sub-graphs $G^{atr}$ , $G^{inv}$ , $G^{obj}$ , $G^{loc}$ . + +- $\rightarrow$ "Object is attribute" +- $\rightarrow$ "I have object" +- →“Object is in location” +- $\langle location1, direction, location2 \rangle \rightarrow$ "location 1 is in the direction of location 2", e.g. $\langle forest, north, house \rangle$ is converted to "Forest is in the north of house" + +More examples can be found in Appendix A.4. + +# 3.2 Temporally Extended Explanations + +Graph attention tells us which entities in the KG are attended to when making a decision, but is not enough alone for explaining "why" actions are the right ones in the context of fulfilling dependencies that may potentially be unrewarded by the game—especially given the fact that there are potentially multiple ways of achieving the overall task. HEX-RL thus saves trajectories for hundreds of test time rollouts of the games, performed once a policy has been trained (Table1 and Appendix A.5). The game trajectories consist of all the game states, actions taken, predicted critic values, game scores, the knowledge graphs, and the immediate step level explanations generated as previously described. HEX-RL produces a temporal explanation by performing a post-hoc analysis on these game trajectories. The agent then analyzes and filters these trajectories in an attempt to find the subset of states that are most crucial to achieving the task as summarized in Figure3—then using that subset of states to generate temporal trajectory level explanations. + +Bayesian State Filter. We first train a Bayesian model to predict the conditional probability $\mathbb{P}(A\mid B_i)$ of a game step $(A)$ given any other possible game step $(B_{i})$ in the game trajectories. More specifically, each game step is composed of 3 elements, game state $o_t$ , action $a_{t}$ and the current knowledge graph $G_{t}$ . The key intuition here being that state, action pairs that appear in a certain ordering in multiple trajectories are more likely to dependant on each other. + +The set of game steps with the highest $\mathbb{P}(A\mid B_i)$ is used to explain taking the action associated with game state $A$ . For example, "take egg" ( $A$ ) is required to "open egg" ( $B$ ), and $\mathbb{P}(A\mid B) = 1$ , hence "open egg" is used as a reason why action "take egg" must be taken first. The initial set of game states $\mathbf{X}$ is filtered into $\mathbf{X}_1$ by working backwards from the final goal state by finding the set of states that form the most likely chain of causal dependencies that lead to it. Details can be found in Appendix A.5 and A.6. + +Language Model Action Filter. Following this, we apply a GPT-2 (Radford et al., 2019) language model trained to generate actions based on transcripts of text games from human play-throughs to further filter out important states—known as the Contextual Action Language Model (CALM) (Yao et al., 2020). As this language model is trained on human transcripts, we hypothesize that it is able to further filter down the set of important states by finding the states that have corresponding actions that a human player would be more likely to perform—thus potentially leading to more natural explanations. CALM takes into observation $o_{t}$ , action $a_{t}$ and the following observation $o_{t+1}$ , and predicts next valid actions $a_{t+1}$ . In our work, we use CALM as a filter to look for the relations between a game step $A$ and the explanation candidates $B_{i} \in \mathbf{X}_{1}$ . We feed CALM with the prompt $o_{A}, a_{A}, o_{B_{i}}$ to get an action candidate set. When the two game steps $A$ and $B_{i}$ are highly correlated, given $o_{A}, a_{A}$ and $o_{B_{i}}$ , CALM should successfully predict $a_{B_{i}}$ + +with high probability. The game steps $B_{i}$ , whose associated action $a_{B_i}$ is in this generated action candidates set, are saved as the next set of filtered important candidate game states $(\mathbf{X}_2)$ . + +![](images/2c8578e3fb09b22fdc022e959aa60daaf3549bc71c27b6b78e0dc456a7124aad.jpg) +Figure 3: Temporal explanation pipeline for why the agent chose the action—"go north" at "Behind House". + +Semantic State-Action Filter. To better account for the irregularities of the puzzle like environment, we adopt a semantic filter to obtain the final important state set $\mathbf{X}_3$ . Here, given $A, B_i \in \mathbf{X}_2$ , states are further filtered on the basis of whether one of these scenarios occurs: (1) $a_A$ and $a_{B_i}$ contain the same entities, e.g. "take egg" and "open egg". (2) $G_A$ and $G_{B_i}$ share the same entities, e.g. "lamp" occurs in both observations. (3) $A$ and $B_i$ occur in the same location, e.g. after taking action $a_A$ , the player enters "kitchen" and $B$ occurs in "kitchen". (4) The state has a non-zero reward or a high absolute critic value, indicating that + +it is either a state important for achieving the goals of the game or it is a state to be avoided. The final set of important game states $\mathbf{X}_3$ is used to synthesize post-hoc temporal explanations for why an action was performed in a particular state—as seen in Figure1—taking into account the overall context of the dependencies required to be satisfied and building on the immediate step level explanations for each given state in $\mathbf{X}_3$ . Ablation studies pin-pointing the relative contributions of the different filters are found in Section4.4. We concluded that all three steps of the filtering process to identify important states are necessary for creating coherent temporal explanations that effectively take into account the context of the agent's goals. + +Table 1: Example state saved during game play. + +
STEP: 16
Text Observation:
Up a Tree
Beside you on the branch is a small birds nest.
In the birds nest is a large egg encrusted with jewels...
Knowledge graph:
-tree, in, forest), <egg, is, interactable>...
Action: take egg
Immediate explanation: egg is interactable
Game Score:5
Critic Value: 5.7457
+ +Goals of the game or it is a state to be avoided. The synthesize post-hoc temporal explanations for why has seen in Figure1—taking into account the overall satisfied and building on the immediate step level on studies pin-pointing the relative contributions to $\mathbf{S}$ . We concluded that all three steps of the filtering strategy for creating coherent temporal explanations of the agent's goals. + +Table 2: Asymptotic scores on games by different methods across 5 independent runs. Eps. indicates normalized scores averaged across 100 episodes of testing which occurs at the end of the training period and Max indicates the maximum score seen by the agent over the same period. We present results on two training rewards for HEX-RL, game only and game and IM. + +
ExperimentLSTM-A2CKG-A2CSHA-KGQ*BERTHEX-RLHEX-RLMax
Game OnlyGame and IM
MetricEps.MaxEps.MaxEps.MaxEps.MaxEps.MaxEps.Max-
zork12731.2343533.634.5353529.84030.240350
library8.21014.31910.015.8181816.01913.82130
detective141188207.9214246.1308274310276.7330276.9330360
balances101010109.810101010.01010.01051
pentari50.45550.75648.251.3505634.65544.76070
ztuu5555525555.055.19100
ludicorp14.41817.81917.617.8181914.01817.618150
deephome111111111.011.01300
temple887.687.96.9888.087.6835
% compl.22.625.927.330.827.233.130.834.927.233.928.235.8100
std dev0.020.010.060.01--0.030.000.030.010.030.02-
+ +# 4 Evaluation + +Our evaluation consists of three phases: (1) We show that HEX-RL has the comparable performance to state-of-art reinforcement learning agents on text games in Section 4.1. (2) Then in Section 4.2 we evaluate our immediate attention explanation model by comparing the explanations generated by HEX-RL and agents that do not use knowledge graphs (See Fig. 2 and Section 3.1). (3) In Section 4.3 we compare immediate to temporal explanations, focusing on the effects that including trajectory level context when evaluating explanations in the context of agent goals. (4) In Section 4.4 we conduct human participant ablation study evaluating the individual contributions of the filtration pipeline for generating temporal explanations seen in Figure 3. + +# 4.1 Task Performance Evaluation + +We compare HEX-RL with four strong state-of-art reinforcement learning agents—focusing on contemporary agents that use knowledge graphs—on an established test set of 9 games from the Jericho benchmark (Hausknecht et al. 2020). + +- LSTM-A2C is a baseline that only uses natural language observations as state representation that is encoded with an LSTM-based policy network. +- KG-A2C. Instead of training a question-answering system like Q*BERT to build knowledge graph state representation, KG-A2C (Ammanabrolu and Hausknecht, 2020) extracts knowledge graph triplets from the text observations using a rules based approach built on OpenIE (Angeli et al., 2015). +- SHA-KG is adapted from Xu et al. (2020) and uses a rules-based approach to construct a knowledge graph for the agent which is then fed into a Hierarchical Graph Attention network as in HEX-RL. This agent separates the sub-graphs out using a rules-based approach and makes no use of any graph edge relationship information. +- Q*BERT. [Ammanabrolu et al. (2020)] uses a similar method of creating the knowledge graph through question answering but does not use the hierarchical graph attention architecture combined with the sub-graphs. + +These baselines are all trained via the Advantage Actor Critic (A2C) (Mnih et al., 2016) method—further comparisons to other contemporary agents can be found in Appendix A.7. It is also worth noting that most contemporary state of the art deep RL agents for text games use recurrent neural policy networks as opposed to transformer networks due to their improved performance in this domain. + +HEX-RL Training. We trained HEX-RL on two reward types: (a) game only, which indicates that we only use score obtained from the game as reward. (2) game with intrinsic motivation (game + +and $IM$ ), which contains an additional intrinsic motivation reward based on knowledge graph expansion as seen in Ammanabrolu et al. (2020)—where the agent is additionally rewarded for learning more about the world by finding new facts for knowledge graph (see Appendix A.8, A.9 and A.10). + +Table2 shows the performance of HEX-RL and the other four baselines. We can see that designing the HEX-RL agent to be inherently explainable through the use of Hierarchical Graph Attention and the sub-graphs improves the overall maximum score seen during training when compared to any of the other agents. In terms of the average score seen during the final 100 episodes, HEX-RL with intrinsic motivation outperforms all baselines with the exception of Q*BERT—there HEX-RL significantly outperforms Q*BERT on one game, is outperformed on two games, and comparable on the remaining six games. HEX-RL thus performs comparably to other state-of-the-art baselines in terms of overall task performance while also boasting the additional ability to explain its actions. + +# 4.2 Immediate Explanation Evaluation + +Having established that HEX-RL's performance while playing text games is comparable to other state-of-the-art agents, we attempt to answer the question of exactly how useful the knowledge graph based architecture is when generating immediate step-by-step explanations by comparing HEX-RL to a baseline that doesn't use knowledge graphs in a human participant study. Two models for step-by-step explanations are compared: + +- LSTM Attention explanations. Extracts the most important substring in the observations through LSTM attention $\alpha_{LSTM}$ and then uses those words to create an explanation. +- Hierarchical Graph Attention explanations. Extracts KG triplets most influenced the choice of actions by Hierarchical Attention $\alpha_{\text{Hierarchical}}$ and then transforming them into readable language explanations through templates. + +We recruited 40 participants—generally unfamiliar with the environment at hand—on a crowd sourcing platform. Each participant reads a randomly selected subset of 10 explanation pairs (drawn randomly from a pool totaling 60 explanation pairs), generated by Hierarchical Graph Attention and LSTM attention explanation on three games in the Jericho benchmark: zorkl, library, and balances. We choose three games with very different structures and genres as defined in Hausknecht et al. (2020). They each require a diverse set of action types and solutions to complete and thus provide a wide area of coverage when used as test beds for human evaluation of explanations. Then they are given the following metrics and asked to choose which explanation they prefer for that metric: + +- Confidence: This explanation makes you more confident that the agent made the right choice. +- Human-likeness: This explanation expresses more human-like thinking on the action choice. +- Understandability: This explanation makes you understand why the agent made the choice. + +Variations of these questions have been used to evaluate other explainable AI systems (eg. Ehsan et al. (2019)). At least 5 participants give their preference for each explanation pair. We take the majority preference from humans participants as the result. More details are shown in Appendix B.1 + +Figure 4 shows the result of the human evaluation of attention explanations. Hierarchical graph attention explanation is preferred over LSTM attention explanation in all three dimensions. These results are statistically significant $(p < 0.05)$ with fair inter-rater reliabilities. We also observe that these three dimensions are highly, positively correlated using Spearman's Rank Order Correlation. + +A slightly higher proportion of participants preferred the LSTM Attention explanations in the human-likeness dimension compared to the other two. The participants preferring LSTM Attention explanation stated that they found it intuitive but often incoherent and found the Hierarchical Graph Attention explanations to be more robotic. LSTM attention explanations are substrings of the human-written observation and thus have the potential to be more natural sounding than + +the templated Hierarchical Graph Attention explanations when they are coherent enough to be understood. The KG sacrifices a small amount of human-likeness in return for much greater overall coherence and accuracy. KGs with Hierarchical Graph Attention give us explanations that are more easily understood and inspire greater confidence in the agent's decisions. + +Example qualitative LSTM Attention and Hierarchical Graph Attention explanations can be found in Appendix C.2. As our system relies on graph hierarchical graph attention to generate immediate explanations, a well-trained knowledge graph representation module of the world knowledge is required. Most cases where the agent fails to provide satisfactory immediate explanations are either when: (1) the explanation is not directly linked to the one of the facts we choose to extract from the knowledge graph, such as object/location information; and (2) due to the error of knowledge graph extraction models themselves. + +# 4.3 Immediate vs. Temporal Explanations + +Having proved the effectiveness of the knowledge graph at the immediate step-by-step explanation level, we evaluate our method of producing temporal explanations and how they + +compare to the immediate explanations along two dimensions: (1) coherence; and (2) explanation accuracy when taken in the context of the agent's goals. + +Participants first read a trajectory of the game combined with step-by-step immediate explanations and the game goal, then indicate how much they agree with the statements on a Likert scale of 1 (strong disagree) to 5 (strong agree). Here, we add two metrics from the previous study: + +- Goal context: You are able to understand why the agent takes this particular sequence of actions given what you know about the goal. +- Readability: This explanation is easy to read. + +Figure 5 shows the average scores for each question for the immediate and temporal explanations. The temporal explanations achieve comparable performance to the immediate explanations on all metrics except for the the metric relating to goal context where they significantly out-perform the immediate explanations. A majority of participants stated that a condensed trajectory level explanation made the goals of the agent easier to understand than reading through each step level explanation. These results indicate that HEX-RL can generally successfully identify the most important states in a trajectory and use them to create temporal explanations that are on par with immediate explanations in terms of coherence but provide significantly more context + +in terms of explaining an agent's actions with respect to its task-based goals. + +![](images/548ac0053db855d234522bfda15210b80c00cabc8559697d94afddde45663ab1.jpg) +Figure 4: Human evaluation results showing the proportion of participants that prefer Hierarchical Graph Attention vs. LSTM Attention explanations, $\ast \ast$ indicates $p < 0.01$ , $\dagger$ indicates $\kappa >0.2$ or fair agreement. $\ddagger$ indicates $\kappa >0.4$ or moderate agreement. Evaluation results on each game are shown in AppendixA.11 + +![](images/5a51dee19003e9ed145b1909635188a507a7f8ea8c80f1e202c6580f7d482fe3.jpg) +Figure 5: Human judgment results on immediate and temporal explanation, * indicates $p < 0.05$ . Error bars indicate a confidence level of $95\%$ . + +Cases where the agent does not provide a temporally coherent and goal-driven explanation revolve around failures—particularly by the Bayesian State Filter—in detecting the most important states in the trajectory. A qualitative analysis (as seen in Appendix C.3) suggests that this occurs in cases where there are a large number of branching paths that lead to the same end state. Thus, the quality of the generated temporal explanations appears to be inversely proportional to the relative complexity of the game as measured by its branching factor. + +# 4.4 Temporal Explanation Ablation Study + +Having established the overall effectiveness of the filters in HEX-RL that create the temporal explanations, we perform pair-wise ablation studies to pinpoint the relative contributions of the different filters seen in Fig.3 We first compare explanations generated using a set of important states filtered from the trajectory using the Bayes model compared to Bayes+CALM explanation. This how applying the language model action filter affects the quality of the temporal explanations. As before, we recruited 30 participants on a crowd sourcing platform. Each participant reads a randomly selected subset of explanation pairs, comprised of temporal explanations filtered by Bayes and Bayes+CALM models. Figure 6a shows that after applying the CALM model to filter explanation candidates, generated explanations are significantly preferred on the "Confidence" and "Understandability" dimensions. + +Similarly, we then conducted another ablation study to validate the contribution of semantic filter by comparing the Bayes+CALM filtering method to the full HEX-RL using Bayes+CALM+Semantic filters. The experiment setup is the same as the previous ablation study. Figure $\boxed{6b}$ shows that Bayes+CALM+Semantic performs significantly better than Bayes+CALM on all three dimensions. + +We additionally observe that these three metrics are highly, positively correlated using Spearman's Rank Order Correlation in both of these ablation studies. When asked to justify their choices, participants indicated that the full HEX-RL system with Bayes+CALM+Semantic filters provided temporal explanations that they felt was more understandable than alternatives. These results indicate that all three steps of the filtering process to identify important states are necessary for creating coherent temporal explanations that effectively take into account the context of the agent's goals. + +![](images/b8eff92813be5efc899820ccf6d7d8488a64439b70ab15ff5f606adb83fa3316.jpg) +(a) Bayes vs. Bayes + CALM explanation + +![](images/e2ec370abef699e7274678cfdb7ad97d88a89a3ecb70aab981a1a35011e9ab4a.jpg) +(b) Bayes + CALM vs. Bayes + CALM + Semantic explanation +Figure 6: Human evaluation results on ablation study, * indicates $p < 0.05$ , † indicates $\kappa > 0.2$ or fair agreement. + +# 5 Conclusions + +Explaining deep RL policies for sequential decision making problems in natural language is a sparsely studied problem despite a steadily growing need. An oft given reason for this phenomenon is that deep RL methods perform better without the additional burden of being explainable. In an attempt to encourage work in this area, we create the Hierarchically Explainable Reinforcement Learning (HEX-RL) agent which treats explainability as a first-class citizen in its design by using a readily interpretable knowledge graph state representation coupled with a Hierarchical Graph Attention network. This agent is able to produce step-by-step commentary-like immediate explanations and also a condensed temporal trajectory level explanation via a post-hoc analysis. We show that with careful design, it is possible to create inherently explainable RL agents that do not lose performance when compared to contemporary state-of-the-art agents and simultaneously are able to generate significantly higher quality explanations of actions. + +# References + +Ashutosh Adhikari, Xingdi Yuan, Marc-Alexandre Côté, Mikuláš Zelinka, Marc-Antoine Rondeau, Romain Laroche, Pascal Poupart, Jian Tang, Adam Trischler, and William L. Hamilton. 2020. Learning dynamic belief graphs to generalize on text-based games. CoRR, abs/2002.09127. +Prithviraj Ammanabrolu and Matthew Hausknecht. 2020. Graph constrained reinforcement learning for natural language action spaces. In International Conference on Learning Representations. +Prithviraj Ammanabrolu, Ethan Tien, Matthew Hausknecht, and Mark O Riedl. 2020. How to avoid being eaten by a grue: Structured exploration strategies for textual worlds. arXiv preprint arXiv:2006.07409. +Gabor Angeli, Melvin Jose Johnson Premkumar, and Christopher D Manning. 2015. Leveraging linguistic structure for open domain information extraction. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 344-354. +Marc-Alexandre Côté, Akos Kádár, Xingdi Yuan, Ben Kybartas, Tavian Barnes, Emery Fine, James Moore, Matthew Hausknecht, Layla El Asri, Mahmoud Adada, et al. 2018. Textworld: A learning environment for text-based games. In Workshop on Computer Games, pages 41-75. Springer. +Upol Ehsan, Pradyumna Tambwekar, Larry Chan, Brent Harrison, and Mark O Riedl. 2019. Automated rationale generation: a technique for explainable ai and its effects on human perceptions. In Proceedings of the 24th International Conference on Intelligent User Interfaces, pages 263-274. +Wenbo Guo, Xian Wu, Usmann Khan, and Xinyu Xing. 2021. Edge: Explaining deep reinforcement learning policies. In Thirty-Fifth Conference on Neural Information Processing Systems. +Matthew Hausknecht, Prithviraj Ammanabrolu, Marc-Alexandre Côté, and Xingdi Yuan. 2020. Interactive fiction games: A colossal adventure. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 7903-7910. +Bradley Hayes and Julie A Shah. 2017. Improving robot controller transparency through autonomous policy explanation. In 2017 12th ACM/IEEE International Conference on Human-Robot Interaction (HRI, pages 303-312. IEEE. +Daniel Hein, Alexander Hentschel, Thomas Runkler, and Steffen Udluft. 2017. Particle swarm optimization for generating interpretable fuzzy reinforcement learning policies. Engineering Applications of Artificial Intelligence, 65:87-98. +Zoe Juozapaitis, Anurag Koul, Alan Fern, Martin Erwig, and Finale Doshi-Velez. 2019. Explainable reinforcement learning via reward decomposition. In *IJCAI/ECAI Workshop on Explainable Artificial Intelligence*. +Graham Klyne. 2004. Resource description framework (pdf): Concepts and abstract syntax. http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/. +Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. 2019. Albert: A lite bert for self-supervised learning of language representations. arXiv preprint arXiv:1909.11942. +Guiliang Liu, Oliver Schulte, Wang Zhu, and Qingcan Li. 2018. Toward interpretable deep reinforcement learning with linear model u-trees. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pages 414-429. Springer. +Prashan Madumal, Tim Miller, Liz Sonenberg, and Frank Vetere. 2020. Explainable reinforcement learning through a causal lens. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 2493-2500. +Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. 2016. Asynchronous methods for deep reinforcement learning. In International conference on machine learning, pages 1928-1937. PMLR. + +Keerthiram Murugesan, Mattia Atzeni, Pushkar Shukla, Mrinmaya Sachan, Pavan Kapanipathi, and Kartik Talamadupula. 2020. Enhancing text-based reinforcement learning agents with commonsense knowledge. CoRR, abs/2005.00811. +Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language models are unsupervised multitask learners. +Pranav Rajpurkar, Robin Jia, and Percy Liang. 2018. Know what you don't know: Unanswerable questions for SQuAD. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 784-789, Melbourne, Australia. Association for Computational Linguistics. +Andrei A Rusu, Sergio Gomez Colmenarejo, Caglar Gulcehre, Guillaume Desjardins, James Kirkpatrick, Razvan Pascanu, Volodymyr Mnih, Koray Kavukcuoglu, and Raia Hadsell. 2015. Policy distillation. arXiv preprint arXiv:1511.06295. +Tianmin Shu, Caiming Xiong, and Richard Socher. 2017. Hierarchical and interpretable skill acquisition in multi-task reinforcement learning. arXiv preprint arXiv:1712.07294. +Kurt Shuster, Jack Urbanek, Emily Dinan, Arthur Szlam, and Jason Weston. 2020. Deploying lifelong open-domain dialogue learning. arXiv preprint arXiv:2008.08076. +Petar Velicković, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua Bengio. 2017. Graph attention networks. arXiv preprint arXiv:1710.10903. +Abhinav Verma, Vijayaraghavan Murali, Rishabh Singh, Pushmeet Kohli, and Swarat Chaudhuri. 2018. Programmatically interpretable reinforcement learning. In International Conference on Machine Learning, pages 5045-5054. PMLR. +Fei Wang, Mengqing Jiang, Chen Qian, Shuo Yang, Cheng Li, Honggang Zhang, Xiaogang Wang, and Xiaou Tang. 2017. Residual attention network for image classification. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 3156-3164. +Sarah Wiegrefe and Ana Marasovic. 2021. Teach me to explain: A review of datasets for explainable natural language processing. In Thirty-fifth Conference on Neural Information Processing Systems Datasets and Benchmarks Track (Round 1). +Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron Courville, Ruslan Salakhudinov, Rich Zemel, and Yoshua Bengio. 2015. Show, attend and tell: Neural image caption generation with visual attention. In International conference on machine learning, pages 2048-2057. PMLR. +Yunqiu Xu, Meng Fang, Ling Chen, Yali Du, Joey Tianyi Zhou, and Chengqi Zhang. 2020. Deep reinforcement learning with stacked hierarchical attention for text-based games. Advances in Neural Information Processing Systems, 33. +Shunyu Yao, Rohan Rao, Matthew Hausknecht, and Karthik Narasimhan. 2020. Keep CALM and explore: Language models for action generation in text-based games. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 8736-8754, Online. Association for Computational Linguistics. +Quanzeng You, Hailin Jin, Zhaowen Wang, Chen Fang, and Jiebo Luo. 2016. Image captioning with semantic attention. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 4651-4659. +Tom Zahavy, Nir Ben-Zrihem, and Shie Mannor. 2016. Graying the black box: Understanding dqns. In International Conference on Machine Learning, pages 1899-1908. PMLR. +Tom Zahavy, Matan Haroush, Nadav Merlis, Daniel J Mankowitz, and Shie Mannor. 2018. Learn what not to learn: Action elimination with deep reinforcement learning. Advances in neural information processing systems, 31. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] +(c) Did you discuss any potential negative societal impacts of your work? [Yes] +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [N/A] +(b) Did you include complete proofs of all theoretical results? [N/A] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] +(b) Did you mention the license of the assets? [Yes] +(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [Yes] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [Yes] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [Yes] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [Yes] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [Yes] \ No newline at end of file diff --git a/inherentlyexplainablereinforcementlearninginnaturallanguage/images.zip b/inherentlyexplainablereinforcementlearninginnaturallanguage/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..5fe433801230799681864352826b8eadc2f20f65 --- /dev/null +++ b/inherentlyexplainablereinforcementlearninginnaturallanguage/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f76e0e12903b7768f3a3599d0ce4a4d87e84a0ddd7e751bd2675f86cca4e669e +size 353016 diff --git a/inherentlyexplainablereinforcementlearninginnaturallanguage/layout.json b/inherentlyexplainablereinforcementlearninginnaturallanguage/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..5b96abd447ef21723d52c79e0e0f589ff93f8d8f --- /dev/null +++ b/inherentlyexplainablereinforcementlearninginnaturallanguage/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:31b0bd6325c8b4bf22288f2ff0af890d4df2d84c00afe9f55637e47ef85b21c4 +size 437848 diff --git a/injectingdomainknowledgefromempiricalinteratomicpotentialstoneuralnetworksforpredictingmaterialproperties/abf5a418-17c1-4780-a22e-92a46b007bd5_content_list.json b/injectingdomainknowledgefromempiricalinteratomicpotentialstoneuralnetworksforpredictingmaterialproperties/abf5a418-17c1-4780-a22e-92a46b007bd5_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..19c363878cc4c6e1d00c0f3b5c9cde874b170113 --- /dev/null +++ b/injectingdomainknowledgefromempiricalinteratomicpotentialstoneuralnetworksforpredictingmaterialproperties/abf5a418-17c1-4780-a22e-92a46b007bd5_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0a9ae02bd3d18c5deaf7acf6861d73985ba7c8409b6018d298fca550a0c6530 +size 76125 diff --git a/injectingdomainknowledgefromempiricalinteratomicpotentialstoneuralnetworksforpredictingmaterialproperties/abf5a418-17c1-4780-a22e-92a46b007bd5_model.json b/injectingdomainknowledgefromempiricalinteratomicpotentialstoneuralnetworksforpredictingmaterialproperties/abf5a418-17c1-4780-a22e-92a46b007bd5_model.json new file mode 100644 index 0000000000000000000000000000000000000000..cb4beaf0e4d5ea486c6c2915a63ad8a7ef55cc20 --- /dev/null +++ b/injectingdomainknowledgefromempiricalinteratomicpotentialstoneuralnetworksforpredictingmaterialproperties/abf5a418-17c1-4780-a22e-92a46b007bd5_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:51d9362baaaff860d62b5543aed023c3c45708eca078afa74fd21b4d9c838ce1 +size 93630 diff --git a/injectingdomainknowledgefromempiricalinteratomicpotentialstoneuralnetworksforpredictingmaterialproperties/abf5a418-17c1-4780-a22e-92a46b007bd5_origin.pdf b/injectingdomainknowledgefromempiricalinteratomicpotentialstoneuralnetworksforpredictingmaterialproperties/abf5a418-17c1-4780-a22e-92a46b007bd5_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..483c908afa9f43578d9aa8591329d31a96226fc5 --- /dev/null +++ b/injectingdomainknowledgefromempiricalinteratomicpotentialstoneuralnetworksforpredictingmaterialproperties/abf5a418-17c1-4780-a22e-92a46b007bd5_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e083358aa3e021cc19709c189468310e19a1692d24a9fa15925878a6657fa6d +size 588941 diff --git a/injectingdomainknowledgefromempiricalinteratomicpotentialstoneuralnetworksforpredictingmaterialproperties/full.md b/injectingdomainknowledgefromempiricalinteratomicpotentialstoneuralnetworksforpredictingmaterialproperties/full.md new file mode 100644 index 0000000000000000000000000000000000000000..ff821632e74bb594ec50f2bd62e5743ffc2c6f56 --- /dev/null +++ b/injectingdomainknowledgefromempiricalinteratomicpotentialstoneuralnetworksforpredictingmaterialproperties/full.md @@ -0,0 +1,278 @@ +# Injecting Domain Knowledge from Empirical Interatomic Potentials to Neural Networks for Predicting Material Properties + +Zeren Shui + +University of Minnesota shuix007@umn.edu + +Daniel S. Karls* + +University of Minnesota karl0100@umn.edu + +Mingjian Wen* + +University of Houston +mjwen@uh.edu + +IIia A. Nikiforov + +University of Minnesota nikif002@umn.edu + +Ellad B. Tadmor + +University of Minnesota tadmor@umn.edu + +George Karypis + +University of Minnesota / AWS karypis@umn.edu + +# Abstract + +For decades, atomistic modeling has played a crucial role in predicting the behavior of materials in numerous fields ranging from nanotechnology to drug discovery. The most accurate methods in this domain are rooted in first-principles quantum mechanical calculations such as density functional theory (DFT). Because these methods have remained computationally prohibitive, practitioners have traditionally focused on defining physically motivated closed-form expressions known as empirical interatomic potentials (EIPs) that approximately model the interactions between atoms in materials. In recent years, neural network (NN)-based potentials trained on quantum mechanical (DFT-labeled) data have emerged as a more accurate alternative to conventional EIPs. However, the generalizability of these models relies heavily on the amount of labeled training data, which is often still insufficient to generate models suitable for general-purpose applications. In this paper, we propose two generic strategies that take advantage of unlabeled training instances to inject domain knowledge from conventional EIPs to NNs in order to increase their generalizability. The first strategy, based on weakly supervised learning, trains an auxiliary classifier on EIPs and selects the best-performing EIP to generate energies to supplement the ground-truth DFT energies in training the NN. The second strategy, based on transfer learning, first pretrains the NN on a large set of easily obtainable EIP energies, and then fine-tunes it on ground-truth DFT energies. Experimental results on three benchmark datasets demonstrate that the first strategy improves baseline NN performance by $5\%$ to $51\%$ while the second improves baseline performance by up to $55\%$ . Combining them further boosts performance. + +# 1 Introduction + +Predictive modeling of materials is a field with manifold applications that has been the subject of many cross-disciplinary studies. While modeling is conducted at different length scales, all material behavior ultimately has its origins at the nano scale, where the interactions between individual atoms must be understood. The most accurate methods at this scale are based on quantum mechanics theory, requiring explicit consideration of the electronic degrees of freedom described by the Schrödinger equation. However, these methods are presently limited to systems containing at most several + +thousand atoms, precluding their use in investigation of important microstructural phenomena such as crack propagation. To overcome this limitation, practitioners have long relied upon heuristic models known as empirical interatomic potentials (EIPs), which consist of physically motivated analytical functional forms that strive to model the complex electronic interactions between atoms using only the nuclear coordinates of the atoms and their elemental species as input [34]. In the past several years, there has been a surge of interest in the development of machine learning EIPs, particularly those based on neural networks (NNs), as a more accurate alternative to traditional EIPs [4]. In contrast to traditional EIPs, NN potentials contain little inductive bias and, accordingly, require large volumes of training data labeled using first-principles quantum mechanical methods. The first-principles method most commonly used is density functional theory (DFT), which scales as $\mathcal{O}(n_{\mathrm{e}}^{3})$ with the number of valence electrons $n_{\mathrm{e}}$ in a given configuration of atoms [23]. As a result of this high computational cost, it is difficult to acquire a sufficient number of labeled training instances to create an NN potential that performs accurately over a wide range of applications. + +One potential solution to this problem is to seek additional supervision signals. Traditional EIPs are attractive sources of such additional supervision for two reasons. First, their functional forms incorporate prior physical information that allows them to correlate with DFT, and, in regions of relevance to common applications, are often quite accurate. That is, they contain domain knowledge that could benefit the training of NN potentials. Second, EIPs scale linearly with the number of atoms and are thus orders of magnitude faster than DFT, permitting the labeling of massive datasets. Despite the advantages, no research has focused on using EIP supervision signals in training NN potentials. + +In this paper, we leverage physically motivated EIPs and unlabeled configurations to tackle the label scarcity challenge for training NN potentials. We propose two generic strategies, weakly supervised learning and transfer learning, for exploiting this additional source of information. In the first strategy, we expand the DFT-labeled training set with unlabeled configurations and their EIP energies. To achieve this goal, we train an auxiliary classifier on the original DFT-labeled training configurations that predicts which one of a selected set of EIPs is likely to produce the most accurate estimate of the DFT energy for each of a large set of unlabeled configurations. The unlabeled configurations are then labeled by their corresponding predicted best-performing EIPs and appended to the training set. We train NN potentials on the expanded training set by optimizing a robust regression loss to mitigate the influence of noise and outliers introduced by the EIP energies. In the second strategy, we adopt a transfer learning approach by way of multi-task pretraining. We first pretrain the representation module of an NN potential to reproduce the energies predicted by the EIPs. During the subsequent fine-tuning stage, the representation module of the NN is paired with a prediction head and trained on the DFT-labeled configurations. These two strategies can be flexibly used and coupled to train any NN potential. + +The contributions of this work are three-fold: 1) We demonstrate that EIPs are capable of providing high quality supervision signals for training NN potentials, which opens a new direction for future development of NN potentials; 2) We propose two effective and generic strategies that take advantage of EIPs and unlabeled configurations to tackle the label scarcity challenge for training NN potentials; 3) We conduct comprehensive experiments on three benchmark datasets and four representative NN potentials that cover most of the NN potential forms currently in use. Experimental results show that the proposed strategies successfully inject domain knowledge from EIPs to NN potentials and improve the performance of the NN potentials by up to $55\%$ . + +# 2 Preliminaries + +# 2.1 Atomic Configurations + +The fundamental input in atomistic modeling is an atomic configuration. An atomic configuration is a spatial arrangement of atoms $C = \{(Z_i, \mathbf{r}_i)\}_{i=1}^N$ where $Z_i$ and $\mathbf{r}_i$ are the atomic number and the three-dimensional Euclidean coordinates of atom $i$ , respectively. In the simplest scenario, an atomic configuration corresponds to an isolated cluster of atoms that comprise a molecule. However, it may more generally describe a bulk system such as a crystal, which contains an infinite number of atoms distributed over space. These systems are modeled using a small collection of atoms in a finite simulation cell that is effectively repeated across all of space with the aid of periodic boundary conditions (PBCs) [34] (see Appendix A.1). + +# 2.2 Physics-based Potentials + +Mathematically, an EIP is a function, $E = \mathcal{V}(C;\theta)$ , that takes an atomic configuration $C$ as input and returns its total potential energy $E$ ; here, $\theta$ denotes a set of fitting parameters to be determined. The functional form $\mathcal{V}$ of a physics-based EIP is made up of carefully designed analytic expressions that strive to capture the underlying physics in the material it models [43, 44]. Because the functional form itself is intended to capture most of the relevant physics, such models need relatively few parameters (typically on the order of ten) and are usually fitted to a set of material properties deemed most relevant to real-world applications. It is expected that physics-based EIPs will approximate the first-principles energy surface well in the vicinity of atomic configurations corresponding to the material properties to which they were fit. However, their generalizability can be inconsistent, as shown in Fig. 1. + +# 2.3 Machine Learning Potentials + +In contrast to physics-based EIPs, machine learning EIPs employ general-purpose regression algorithms as the functional form $\mathcal{V}$ that do not encode any knowledge of the material it models. Therefore, machine learning EIPs are almost exclusively trained on large sets of DFT data so as to include as much physical knowledge as possible. + +One important class of machine learning EIPs are neural network (NN)-based potentials. In this paper, we define an NN potential $\mathcal{M}:\mathcal{C}\mapsto \mathcal{E}$ as + +$$ +\mathcal {M} (C) = f _ {\text {p r e d}} \circ f _ {\text {r e p}} (C), +$$ + +where $f_{\mathrm{rep}}: \mathcal{C} \mapsto \mathcal{R}^{n \times d}$ is the representation learning module that maps each of the $n$ atoms of $C$ to a feature vector of length $d$ based on its local environment, and $f_{\mathrm{pred}}: \mathcal{R}^{n \times d} \mapsto \mathcal{E}$ is the prediction module that maps the feature vectors of the atoms to the total potential energy. + +A concrete instance of this type of model are those that use a graph neural network + +(GNN) [24, 16, 40, 31, 21] as the representation learning module and a multilayer perceptron (MLP) as the prediction module. Before being passed to the representation learning module $f_{\mathrm{rep}}$ , an atomic configuration $C$ is first converted to a graph $\mathcal{G} = (V,E)$ with nodes $V$ and edges $E$ . One node is defined for each atom in the simulation cell, as well as for additional padding atoms representing PBCs if present. An edge is created between any two nodes with a distance smaller than a prescribed cutoff radius. Next, for each atom $i$ , its atomic number $Z_{i}$ is one-hot encoded into an initial feature vector $h_{i}^{(0)}$ of the node corresponding to the atom. The GNN representation learning module $f_{\mathrm{rep}}$ then updates the feature vectors using a message passing paradigm [15], i.e., the nodes iteratively aggregate information from their neighbors. Formally, the feature vector of node $i$ at the $l + 1$ -th layer $\mathbf{h}_{i}^{(l + 1)}$ is updated as a function of the feature vectors of its neighbors $\mathcal{N}(i)$ and itself at the previous layer, + +$$ +\mathbf {m} _ {i} ^ {(l)} = \operatorname {A g g} ^ {(l)} \left(\left\{f ^ {(l)} \left(\mathbf {h} _ {i} ^ {(l)}, \mathbf {h} _ {j} ^ {(l)}, \mathbf {e} _ {i j} ^ {(l)}\right) \mid j \in \mathcal {N} (i) \right\}\right), \tag {1} +$$ + +$$ +\mathbf {h} _ {i} ^ {(l + 1)} = \operatorname {U p d a t e} ^ {(l)} \left(\mathbf {h} _ {i} ^ {(l)}, \mathbf {m} _ {i} ^ {(l)}\right), \tag {2} +$$ + +where $f^{(l)}$ and $\mathrm{Update}^{(l)}$ are learnable functions, $\mathrm{Agg}^{(l)}$ is a permutation-invariant function that operates on sets of feature vectors, and $\mathbf{e}_{ij}^{(l)}$ denotes the feature vector associated with the edge connecting node $i$ and node $j$ at the $l$ -th layer. Finally, the prediction module $f_{\mathrm{pred}}$ maps the feature vector of each atom at the last layer $\mathbf{h}_i$ to a corresponding energy contribution and sums them to arrive at the total energy of the configuration, i.e., $E = \sum_{i}\mathrm{MLP}(\mathbf{h}_{i})$ . + +![](images/0e57f64ff96a6bd5292f458c73c9f51e0f0e2164285faab87d11ec0925f909fb.jpg) +Figure 1: Schematic illustration of the energy landscape defined over atomic configuration space by two physics-based EIPs and by DFT. Both EIPs are fitted to reproduce properties of the DFT energy landscape near atomic configuration A. Away from configuration A, the relative accuracy of the EIPs compared to DFT varies: at point B, EIP 1 is a fair approximation while EIP 2 is less accurate; at point C, neither EIP is accurate. + +$$ +\left. \left. ^ {l)} \mathbf {h} _ {j} ^ {(l)}, \mathbf {e} _ {i j} ^ {(l)}\right) | j \in \mathcal {N} (i) \right\}, \tag {1} +$$ + +# 3 Related Works + +# 3.1 Neural Network Potentials + +The first modern NN potential was proposed by Behler and Parrinello [3]. In their formulation, an atomic descriptor (i.e., basis functions that transform an atomic configuration into a fixed-length fingerprint vector) based on the bond lengths and bond angles is passed to an MLP. On top of this formulation, a Monte Carlo dropout technique can be applied to the MLP to equip the potential with the ability to quantify its predictive uncertainty [42]. The DeePMD method is a similar approach to that of Behler and Parrinello, except that a novel atomic environment descriptor is used [48]. More recently, researchers have developed GNN potentials based on a message passing paradigm [30, 46]. Another class of GNN potentials such as NequIP [2] and GemNet [14] pass equivariant messages rather than invariant ones based on the formulation of tensor field networks [37] and achieve state-of-the-art performance. All of these models are trained with supervised learning, without exploring the possibilities of leveraging weakly supervised learning or transfer learning to take advantage of unlabeled data. + +# 3.2 Weakly Supervised Learning + +Weakly supervised learning refers to techniques that attempt to train machine learning models from incomplete (only a portion of training instances are labeled) or inaccurate (noisy labels) supervision signals [50]. Solutions for incomplete supervision usually fall into the category of semi-supervised learning, which assumes that nearby instances have similar labels [25, 33, 29]. For inaccurate supervision, a model either learns directly from noisy labels with noise-robust algorithms [12, 49, 13] or resorts to a small portion of clean labeled data to reduce the noise [39, 45]. + +# 3.3 Transfer Learning + +Transfer learning [51] refers to a machine learning paradigm that transfers knowledge to a model learns from one or more relevant tasks to benefit a target task. Transfer learning has enjoyed great success, especially in the low-data regime, as demonstrated by the rise of pretrained neural networks. This recent trend began with natural language processing when BERT [9] and successive large pretrained language models [26, 7] were released and quickly gained popularity in other domains such as computer vision [17, 8, 10] and graph learning [47, 19, 28]. These methods pretrain large neural networks on self-supervised tasks in order to encode common contextual knowledge in the structured input. Another approach imparts domain-specific knowledge by pretraining models on tasks related to the target task but for which abundant labeled data is available [18, 27]. The pretrained model is then fine-tuned on the limited training data of the target task. + +# 4 Methods + +# 4.1 Problem Definition + +Let $\mathcal{P}$ be a set of physics-based EIPs, $\mathcal{C}$ be the space of all possible atomic configurations, $\mathcal{C}_{\mathrm{DFT}} = \{C_i,\{E_i^p\}_{p\in \mathcal{P}},E_i^{\mathrm{DFT}}\}_{i = 1}^m$ be a set of $m$ configurations with corresponding DFT and EIP energies, and $\mathcal{C}_{\mathrm{EIP}} = \{C_i,\{E_i^p\}_{p\in \mathcal{P}}\}_{i = m + 1}^{m + n}$ be a set of $n$ configurations with only physics-based EIP energies. Here, $E_{i}^{\mathrm{DFT}}$ and $E_{i}^{p}$ denote the energies predicted for configuration $C_i$ by DFT and the $p$ -th physics-based EIP, respectively. In practice, physics-based EIPs are much less expensive than DFT, and so the size of $\mathcal{C}_{\mathrm{EIP}}$ is much larger than $\mathcal{C}_{\mathrm{DFT}}$ , i.e., $n\gg m$ . Our goal is to use this data from physics-based EIPs to train an NN-based EIP $\mathcal{M}$ to closely approximate the DFT energy surface over the space of all atomic configurations, i.e., + +$$ +\mathcal {M} (C) \approx E ^ {\mathrm {D F T}}, \forall C \in \mathcal {C}. +$$ + +# 4.2 Label Augmentation + +Because physics-based EIPs are developed as approximations to DFT, it is intuitive to use their predictions as surrogate labels for configurations without DFT energies in order to resolve the label scarcity issue of training neural networks. However, there are two fundamental challenges. First, as + +discussed in Sec. 2.2, while physics-based EIPs are designed to be accurate in specific regions of the configuration space and generalize better than those based on machine learning, they may still be inaccurate in other regions. Given an arbitrary configuration for which no DFT energy is available, it is unknown which EIP from a given set will yield the most accurate prediction and how large its error will be. Second, surrogating DFT energies with EIP energies inevitably introduces noise, and potentially outliers, into the training set that may have pathological effects. + +EIP prediction using an auxiliary classification model. In order to augment training sets with unlabeled configurations and their corresponding EIP-approximated energies, we use an auxiliary classification model to predict the best-performing EIP for a given configuration. For a configuration $C$ , the classification model predicts a discrete distribution over the EIP set $\mathcal{P}' = \mathcal{P} \bigcup \{p_{\emptyset}\}$ that indicates their probability of being the most accurate EIP for $C$ , i.e., $\mathbb{P}(\mathcal{P}' \mid C)$ . We introduce a dummy EIP, $p_{\emptyset}$ , to represent the case where none of the physics-based EIPs in $\mathcal{P}$ is predicted to approximate DFT to an accuracy level $c$ , i.e., $\frac{1}{N_i} ||E_i^p - E_i^{\mathrm{DFT}}||_1 > c, \forall p \in \mathcal{P}$ , where $N_i$ is the number of atoms in configuration $i$ ; throughout this work, $c$ is set to 0.1. By excluding configurations that are labeled with the dummy class from the training set, $c$ acts as a confidence threshold to control the noise and outliers introduced by using the surrogate EIP energies. + +The classification model consists of a representation learning module that converts an atomic configuration to fixed-length feature vectors (one for each atom in the configuration), a permutation-invariant readout function that aggregates them to form a feature vector describing the entire configuration, and a prediction module that maps the configuration representation to a set of probabilities. We train the classification model on $\mathcal{C}_{\mathrm{DFT}}$ by optimizing a cross-entropy loss and apply it to $\mathcal{C}_{\mathrm{EIP}}$ . Configurations with a predicted EIP other than $p_{\emptyset}$ are assigned the corresponding EIP energy and are merged with the configurations that have DFT energies to arrive at the final training set. We denote the set of EIP-labeled configurations as $\hat{\mathcal{C}}_{\mathrm{EIP}} = \{C_i, \{E_i^p\}_{p \in \mathcal{P}}, E_i^{\hat{p}_i}\}_{i=m+1}^{m+s}$ where $1 \leq s \leq n$ is the number of selected configurations not labelled by DFT, and $\hat{p}_i$ and $E_i^{\hat{p}_i}$ are the predicted best-performing EIP and its prediction on $C_i$ . + +Regression with robust loss functions. We train the NN potential using configurations with ground-truth DFT energies and configurations with EIP energies selected by the classification model. In regression problems, models are usually trained by optimizing the mean square error (MSE) loss. The MSE loss is sensitive to outliers, as the magnitude of its gradient is linearly proportional to the difference between the predicted value and the ground truth value. To lessen the impact of outliers, we optimize the MSE loss on DFT-labeled configurations, while on EIP labeled-configurations, we optimize the Tukey biweight (bisquare) loss [6, 11, 5], i.e., + +$$ +\mathcal {L} = \frac {1}{m} \sum_ {i = 1} ^ {m} \left(E _ {i} ^ {\mathrm {D F T}} - \hat {E} _ {i}\right) ^ {2} + \frac {\alpha}{s} \sum_ {i = m + 1} ^ {m + s} l _ {\text {T u k e y}} \left(E _ {i} ^ {\hat {p} _ {i}} - \hat {E} _ {i}\right) \tag {3} +$$ + +where $\hat{E}_i$ is the model prediction of the energy for configuration $C_i$ , and $\alpha > 0$ is a hyper-parameter that controls the contribution of EIP-labeled configurations to the loss and its gradient. + +The Tukey biweight loss falls under the M-estimation method [20] and is intended to screen outliers using robust statistics of the regression residuals such as median absolute residuals (MAR) and suppress their influence on the gradient. The Tukey loss function is computed as + +$$ +l _ {\text {T u k e y}} \left(r _ {i}\right) = \left\{ \begin{array}{l l} \frac {k ^ {2}}{6} \left[ 1 - \left(1 - \left(\frac {r _ {i}}{k}\right) ^ {2}\right) ^ {3} \right], & \left| r _ {i} \right| \leq k \\ \frac {k ^ {2}}{6}, & \left| r _ {i} \right| > k \end{array} \right. \tag {4} +$$ + +where $r_i = E_i^{\hat{p}i} - \hat{E}_i$ is the residual and $k$ is a tuning constant that is commonly set to $4.685\sigma$ to produce $95\%$ efficiency when the errors are normally distributed with standard deviation $\sigma$ . To set the value of $k$ , we estimate the standard deviation as $\hat{\sigma} = \mathrm{MAR} / 0.6745$ . From Eq. 4, residuals with absolute values greater than $k$ are considered outliers and are rejected for gradient computation. In each gradient step, we sample from both DFT- and EIP-labeled configurations to form a batch for gradient back-propagation, and the MAR is estimated on residuals of both DFT- and EIP-labeled configurations in the batch. Since the MAR and $\hat{\sigma}$ are dynamically estimated during training, the Tukey loss does not introduce additional hyperparameters. + +# 4.3 Multi-task Pretraining + +We propose a multi-task pretraining strategy to encode the domain knowledge in physics-based EIPs to the parameters of the representation learning module by jointly predicting the set of EIP calculations for configurations with only EIP predictions, $C_{\mathrm{EIP}}$ , and optimizing the following multi-task regression loss: + +$$ +\mathcal {L} = \frac {1}{n | \mathcal {P} |} \sum_ {p \in \mathcal {P}} \sum_ {i = m + 1} ^ {m + n} (\hat {E} _ {i} ^ {p} - E _ {i} ^ {p}) ^ {2}. +$$ + +During pretraining, we couple the representation learning module with $|\mathcal{P}|$ prediction modules (MLPs) to generate predictions corresponding to different physics-based EIPs, i.e., $\hat{E}_i^p = f_{\mathrm{pred}}^p \circ f_{\mathrm{rep}}(C_i)$ . The pretrained representation module is then fine-tuned with a randomly initialized prediction module for the downstream DFT prediction task. Note that the representation module could either be naively fine-tuned on configurations with DFT energies by optimizing an MSE loss, or on the training set generated by our proposed label augmentation method by optimizing Eq. 3. + +Although transfer learning has been successful in various application domains, it could easily hinder model performance on the target task if the pretraining tasks are unrelated to the target task (negative transfer). We argue that predicting the output of physics-based EIPs is relevant and beneficial to the target task of predicting DFT energies. Although physics-based EIPs are not perfectly accurate across the space of all possible spatial arrangements of atoms, their functional forms incorporate prior physical information that allow them to correlate with DFT over this space. In Sec. 5, we empirically demonstrate that the multi-task pretraining strategy successfully encodes domain knowledge into configuration representations and creates a smoother DFT energy surface. + +# 4.4 Combining Label Augmentation and Multi-task Pretraining + +The label augmentation and multi-task pretraining methods outlined above can be combined with relative ease. The procedure is similar to the ordinary label augmentation strategy, but rather than using a randomly initialized representation module $f_{\mathrm{rep}}$ for the final NN training, the representation module produced by the multi-task pretraining method is used during fine-tuning. Fig. 2 provides a schematic overview of both strategies, how they relate to one another, and how they can be combined. + +# 5 Experiments + +To test our methodology, we experiment with three datasets: the ANI-A1 [32] dataset and the KIM-Si [22] dataset each with a single species, as well as a multispecies AgAu dataset [41]. Detailed descriptions of the three datasets are provided in Appendix A.2. For each dataset, we generate three splits by randomly assigning $20\%$ of the DFT-labeled configurations as test sets and the other $80\%$ as training sets. During training, we use $20\%$ of the training set as a validation set for model selection. All of the reported experimental results are averaged over three different splits to avoid over-fitting to a specific split. We release our code ${}^{2}$ and the KIM-Si dataset ${}^{3}$ for reproducing our experimental results and continuous works. + +# 5.1 Experimental Setting + +# 5.1.1 Neural Network-based Potentials + +We evaluate our proposed strategies on two classes of neural network potentials that reflect the majority of machine learning potentials currently in use. The first represents atomic environments using pre-computed descriptors and learns non-linear transformations (MLPs) to map the descriptors to atomic embeddings, while the second uses GNNs to learn atomic representations from configuration graphs. We select one representative potential from each class. For our MLP-based potential, we use the Smooth Overlap of Atomic Positions (SOAP) [1] atomic environment descriptor together with a representation module and prediction module consisting of MLPs; we term this potential SOAPNet in later discussions. For our GNN-based potential, we select SchNet [30], CGCNN [46], + +![](images/fc19d84238e9d11ee42804f370b64aed03347238e18c6a06a3dba6c1a45e9363.jpg) +Figure 2: Illustration of the Label Augmentation (LA) and Multi-task Pretraining (MP) strategies and their usage in the training of NN-based potentials for the case of two physics-based EIPs, $p_1$ and $p_2$ . In LA, a classifier is trained to predict the most accurate EIP energies $\hat{\mathcal{C}}_{\mathrm{EIP}}$ for the unlabeled training instances, which are combined with the DFT energies from $\mathcal{C}_{\mathrm{DFT}}$ in the loss function when training the final NN (blue arrow + green arrow). In MP, the representation module $f_{\mathrm{rep}}$ is pretrained by simultaneously fitting the energies of each physics-based EIP before it is inherited as the initial state for the representation module in the final NN training, where the DFT-labeled instances are again used (purple arrow + green arrow). The two strategies can be combined by incorporating $\hat{\mathcal{C}}_{\mathrm{EIP}}$ into the loss while also using multi-task pretraining to initialize $f_{\mathrm{rep}}$ (blue arrow + purple arrow + green arrow). + +and GemNet [14]. In our label augmentation experiments, we set the representation module of the auxiliary classification model to be the same kind as the corresponding NN potential, e.g., the classification model used for training the SchNet potential has a SchNet GNN as its representation module. Details about the model and training hyper-parameters can be found in Appendix A.4. + +# 5.1.2 Selection of Physics-based EIPs + +The physics-based EIPs used in our experiments were selected to encompass differing levels of functional complexity. Because physics-based EIPs are designed for specific elemental species (in this case, aluminum, silicon, and gold and silver systems), a different set of physics-based EIPs had to be chosen for each dataset. A total of ten physics-based EIPs were used for aluminum, eight for silicon, and two for the gold-silver system (see Tab. 2 in Appendix). They were taken mainly from the Open Knowledgebase of Interatomic Models (OpenKIM) repository. [35, 36]. For detailed information, see Appendix A.3. + +# 5.2 Experimental Results + +# 5.2.1 Performance of Label Augmentation and Multi-task Pretraining + +As shown in Tab. 1, our proposed strategies improve the performance of the four baseline NNs on the three benchmark datasets. In particular, the label augmentation strategy improves the baseline NNs by $5\%$ to $51\%$ , while the multi-task pretraining strategy improves the baselines by $2\%$ to $55\%$ . Combining the two strategies gives further improvement. + +Table 1: Performance of the two proposed strategies on DFT energy prediction tasks. We report the configuration-level and atom-level mean absolute error (MAE, lower is better) in eV and eV/atom, respectively. We denote the label augmentation strategy by LA and the multi-task pretraining strategy by MP. Best performance is shown in bold. Cases where the training procedure failed due to running out of memory are marked OOM. + +
ConfigKIM-Si AtomImprov.ConfigANI-Al AtomImprov.ConfigAgAu AtomImprov.
Best EIP1.63260.2524-46.48690.3561-4.45870.2063-
SOAPNet0.77060.0975-0.21530.0017-0.54220.0226-
+LA0.55950.070427.58%0.17860.001418.14%0.50670.020507.92%
+MP0.57170.073325.28%0.17440.001419.12%0.39620.015429.34%
+MP+LA0.53070.065731.88%0.16970.001322.13%0.38580.015430.23%
SchNet0.48050.0718-0.16930.0014-0.72900.0290-
+LA0.40150.054919.99%0.08450.000751.24%0.68150.026607.33%
+MP0.40340.056918.40%0.12960.001026.00%0.33530.013054.65%
+MP+LA0.37190.049027.17%0.08160.000653.27%0.34960.013552.80%
CGCNN0.93140.1410-0.24100.0019-1.66830.0625-
+LA0.74760.105022.61%0.17860.001425.44%1.60650.058904.71%
+MP0.84570.125310.16%0.22060.001707.80%1.43770.053214.38%
+MP+LA0.74350.100524.44%0.13920.001141.65%1.38570.049918.55%
GemNet0.51380.0546-OOMOOMOOM0.92570.0342-
+LA0.46910.051107.55%OOMOOMOOM0.83810.030010.87%
+MP0.50240.053102.48%OOMOOMOOM0.50570.018545.71%
+MP+LA0.46510.047611.12%OOMOOMOOM0.60740.021835.30%
+ +# 5.2.2 EIP Energies as High-Quality Supervision Signals for Training NN Potentials + +Recall that in the label augmentation strategy, an auxiliary classification model selects unlabeled configurations and predicts their corresponding best-performing physics-based EIPs, which are subsequently used to label them for the training of the NN potential. These configurations are then labeled by the predicted best-performing physics-based EIPs for NN potential training. We investigate the quality of EIP labels and the auxiliary classification model by training NN potentials on three augmented training sets in which the selected unlabeled configurations are labeled by three different sources: DFT-based energies, ground-truth best-performing-EIP energies, and predicted best-performing EIP energies. The DFT-labeled configurations (0.8K) are the same for the three training sets. We only conduct this experiment on the ANI-Al dataset, as all of its configurations have DFT energies available. The number of selected unlabeled configurations is shown in Tab. 6 (in Appendix). + +Fig. 3a shows the performance of the NN potentials trained on the three augmented training sets and the original training set (where only DFT-labeled configurations are used). As shown in the figure, expanding the training set with ground truth DFT calculations (blue) greatly improves the baseline MAE (yellow bar, model trained on the original training set). Labeling configurations with the ground-truth best-performing physics-based EIPs (red bar) performs slightly worse than with DFT energies (blue bar) but still much better than the baseline (yellow bar). This demonstrates that physics-based EIPs are valuable sources of supervision signals for training NN-based potentials. Using the predicted best-performing physics-based EIPs for labeling (green bar) performs on par with the ground-truth best-performing physics-based EIP labeling (red), revealing the utility of the auxiliary classification model. + +# 5.2.3 Importance of the Robust Tukey Loss + +We next conduct experiments to investigate the importance of the Tukey loss and its ability to reject outliers during training. As before, we only conduct this experiment on the ANI-Al dataset, using DFT energies for unlabeled configurations to determine noise and outliers introduced by the predicted best-performing physics-based EIPs. We define an unlabeled configuration with a predicted best-performing physics-based EIP to be an outlier if the absolute difference between its physics-based + +![](images/371fcb6f866f1cf90d0ed6af5495a16199ce5eab03ea74bf560b365ed0a7e95c.jpg) +(a) + +![](images/eaed78c0aa3dd169f4cd9961f089aab4f8639f5c0d3190c565ad44517b18e280.jpg) +(b) +Figure 3: (a) Performance of NN potentials trained on the original training sets (yellow bar, DFT-labeled configurations only) and three augmented training sets whose unlabeled configurations are labeled by DFT energies (blue bar), ground-truth best-performing physics-based EIP energies (red bar), and predicted best-performing physics-based EIP energies (green bar). (b) Percentage of outliers used for computing gradient during training. (c) Standard deviation of residuals during training. + +![](images/134cd42335c5444eb607bf5c1d3123418a935aa302ae945fb7c1dd9ebfcb4b1f.jpg) +(c) + +EIP energy and its DFT energy is larger than a threshold, i.e., $|r_i| = \frac{1}{N_i} |E_i^{\mathrm{DFT}} - E_i^{\hat{p}_i}| > c$ where $N_{i}$ is the number of atoms in configuration $i$ . We categorize the outliers as mild, normal, and severe by setting $c$ to $\{0.1, 0.2, 0.3\}$ . The initial number of outliers introduced by the unlabeled configurations can be found in Tab. 6 (in Appendix). Figs. 3b and 3c show that the number of outliers of all kinds included for computing gradients decreases as the training proceeds, demonstrating that as the NN potential gets progressively more accurate, the Tukey loss can effectively eliminate outliers from the training set. We also conduct an ablation study by replacing the Tukey loss in Eq. 3 with the MSE loss. The results in Tab. 4 (in Appendix) show that the models' performance degrades without the Tukey loss. + +# 5.2.4 Visualization of Pretrained Configuration Representations + +Fig. 4 plots the t-SNE [38] 2D projections of the training silicon configuration representations colored by their per-atom DFT energies. The left-hand figure plots representations generated by a SchNet with random weights and the right-hand figure plots representations generated by a SchNet pretrained by the multi-task strategy. The representations generated by the randomly initialized SchNet do not exhibit any clear patterns and the energy surface is rough. In the right-hand figure, representations of the atomic cluster configurations (i.e., isolated groups of atoms) and the bulk configurations (crystals) are clearly separated and form clusters in the t-SNE 2D space. The per-atom DFT energy surface of the right-hand figure is much smoother, i.e., configurations with similar energies are close to one another after pretraining. This verifies our previous statement that, although physics-based EIPs lack complete generalizability, they nonetheless correlate reasonably well with DFT over atomic configuration space, and demonstrates that our proposed multi-task pretraining strategy successfully encodes domain knowledge into the NN-based potentials. T-SNE plots for SOAPNet on both datasets and SchNet on the ANI-Al dataset show similar patterns. These figures may be found in Appendix. + +# 6 Conclusion + +In this paper, we show that physics-based EIPs can be used to incorporate domain knowledge into machine learning EIPs by providing additional supervision signals on a large body of unlabeled training instances. Two generic strategies are formulated. The first, label augmentation, is based on weakly supervised learning and uses a classifier to select unlabeled training instances to supplement the original labeled training set. The second, multi-task pretraining, is based on transfer learning and uses the predictions of a set of physics-based EIPs on unlabeled training instances to pretrain a machine learning EIP that is subsequently fine-tuned on the original training set. Our methodology is proven using several experiments, including a cross-validation study that demonstrates significant performance gains for either strategy individually and further improvement when they are combined, a label augmentation study that shows that using EIP energies as surrogate labels provides nearly as much robustness as using additional DFT-labeled training instances, and a statistical experiment that illustrates the utility of the Tukey loss in diminishing noise and excluding outliers. Finally, we present + +![](images/1e73640a06016d2e833da74642d7e490ca2a1826b0d8ecfc5d43a75df1efb65f.jpg) +Figure 4: T-SNE plots of silicon configuration representations generated by a randomly initialized SchNet (left) and a SchNet pretrained with our proposed multi-task pretraining strategy (right). Configurations are colored by their per-atom DFT energies. Representations generated by the pretrained SchNet naturally form two clusters that correspond to the atomic cluster configurations (i.e., isolated groups of atoms) and the bulk configurations (i.e., crystals). + +reduced-dimension visualizations that indicate the multi-task pretraining strategy yields training set feature vectors over which the energy varies smoothly. + +One direction for future work is to replace the heuristic EIPs by more accurate but still computationally cheap methods, such as the semi-empirical tight binding method. These methods better approximate DFT and thus can lead to further improvement when combined with our proposed approaches. + +# 7 Acknowledgement + +This work was supported in part by NSF (1447788, 1704074, 1757916, 1834251, 1834332), Army Research Office (W911NF1810344), the startup funds from the Presidential Frontier Faculty Program at the University of Houston, Intel Corp, and Amazon Web Services. Access to research and computing facilities was provided by the Minnesota Supercomputing Institute. We thank the anonymous reviewers for their feedback during NeurIPS 2022 review process. We are grateful to Sijie He and Yingxue Zhou for their insightful discussion and inspiration. + +# References + +[1] Albert P. Bartók, Risi Kondor, and Gábor Csányi. On representing chemical environments. Phys. Rev. B, 87:184115, May 2013. doi: 10.1103/PhysRevB.87.184115. URL https://link.aps.org/doi/10.1103/PhysRevB.87.184115. +[2] Simon Batzner, Albert Musaelian, Lixin Sun, Mario Geiger, Jonathan P Mailoa, Mordechai Kornbluth, Nicola Molinari, Tess E Smidt, and Boris Kozinsky. E (3)-equivariant graph neural networks for data-efficient and accurate interatomic potentials. Nature Communications, 13(1): 1-11, 2022. +[3] Jörg Behler and Michele Parrinello. Generalized neural-network representation of high-dimensional potential-energy surfaces. Physical review letters, 98(14):146401, 2007. +[4] Jörg Behler. Four generations of high-dimensional neural network potentials. Chemical Reviews, 121(16):10037-10072, 2021. + +[5] Vasileios Belagiannis, Christian Rupprecht, Gustavo Carneiro, and Nassir Navab. Robust optimization for deep regression. In Proceedings of the IEEE international conference on computer vision, pages 2830-2838, 2015. +[6] Michael J Black and Anand Rangarajan. On the unification of line processes, outlier rejection, and robust statistics with applications in early vision. International journal of computer vision, 19(1):57-91, 1996. +[7] Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877-1901, 2020. +[8] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In International conference on machine learning, pages 1597-1607. PMLR, 2020. +[9] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171–4186, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1423. URL https://aclanthology.org/N19-1423. +[10] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations, 2020. +[11] John Fox and Sanford Weisberg. Robust regression. An R and S-Plus companion to applied regression, 91, 2002. +[12] Benoit Frénay and Michel Verleysen. Classification in the presence of label noise: a survey. IEEE transactions on neural networks and learning systems, 25(5):845-869, 2013. +[13] Wei Gao, Lu Wang, Zhi-Hua Zhou, et al. Risk minimization in the presence of label noise. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 30, 2016. +[14] Johannes Gasteiger, Florian Becker, and Stephan Gunnemann. Gemnet: Universal directional graph neural networks for molecules. In M. Ranzato, A. Beygelzimer, Y. Dauphin, P.S. Liang, and J. Wortman Vaughan, editors, Advances in Neural Information Processing Systems, volume 34, pages 6790-6802. Curran Associates, Inc., 2021. URL https://proceedings.neurips.cc/paper/2021/file/35cf8659cfcb13224cbd47863a34fc58-Paper.pdf. +[15] Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. In International conference on machine learning, pages 1263-1272. PMLR, 2017. +[16] Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. Advances in neural information processing systems, 30, 2017. +[17] Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dólár, and Ross Girshick. Masked autoencoders are scalable vision learners. arXiv preprint arXiv:2111.06377, 2021. +[18] Weihua Hu, Bowen Liu, Joseph Gomes, Marinka Zitnik, Percy Liang, Vijay Pande, and Jure Leskovec. Strategies for pre-training graph neural networks. In International Conference on Learning Representations, 2019. +[19] Ziniu Hu, Yuxiao Dong, Kuansan Wang, Kai-Wei Chang, and Yizhou Sun. Gpt-gnn: Generative pre-training of graph neural networks. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 1857–1867, 2020. +[20] Peter J Huber. Robust statistics. In International encyclopedia of statistical science, pages 1248-1251. Springer, 2011. + +[21] Maria Kalantzi and George Karypis. Position-based hash embeddings for scaling graph neural networks. In 2021 IEEE International Conference on Big Data (Big Data), pages 779-789. IEEE, 2021. +[22] Daniel S Karls. Transferability of empirical potentials and the Knowledgebase of Interatomic Models (KIM). PhD thesis, University of Minnesota, 2016. +[23] Efthimios Kaxiras. Atomic and Electronic Structure of Solids. Cambridge University Press, 2003. doi: 10.1017/CBO9780511755545. +[24] Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016. +[25] Dong-Hyun Lee et al. Pseudo-label: The simple and efficient semi-supervised learning method for deep neural networks. In Workshop on challenges in representation learning, ICML, volume 3, page 896, 2013. +[26] Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019. +[27] Saurav Manchanda, Mohit Sharma, and George Karypis. Distant-supervised slot-filling for e-commerce queries. In 2021 IEEE International Conference on Big Data (Big Data), pages 677-686, 2021. doi: 10.1109/BigData52589.2021.9671825. +[28] Costas Mavromatis and George Karypis. Graph infoclust: Maximizing coarse-grain mutual information in graphs. In Pacific-Asia Conference on Knowledge Discovery and Data Mining, pages 541–553. Springer, 2021. +[29] Mamshad Nayeem Rizve, Kevin Duarte, Yogesh S Rawat, and Mubarak Shah. In defense of pseudo-labeling: An uncertainty-aware pseudo-label selection framework for semi-supervised learning. In International Conference on Learning Representations, 2020. +[30] Kristof Schütt, Pieter-Jan Kindermans, Huziel Enoc Sauceda Felix, Stefan Chmiela, Alexandre Tkatchenko, and Klaus-Robert Müller. Schnet: A continuous-filter convolutional neural network for modeling quantum interactions. Advances in neural information processing systems, 30, 2017. +[31] Zeren Shui and George Karypis. Heterogeneous molecular graph neural networks for predicting molecule properties. In 2020 IEEE International Conference on Data Mining (ICDM), pages 492-500. IEEE, 2020. +[32] Justin S Smith, Benjamin Nebgen, Nithin Mathew, Jie Chen, Nicholas Lubbers, Leonid Burakovsky, Sergei Tretiak, Hai Ah Nam, Timothy Germann, Saryu Fensin, et al. Automated discovery of a robust interatomic potential for aluminum. Nature communications, 12(1):1-13, 2021. doi: 10.1038/s41467-021-21376-0. +[33] Kihyuk Sohn, David Berthelot, Nicholas Carlini, Zizhao Zhang, Han Zhang, Colin A Raffel, Ekin Dogus Cubuk, Alexey Kurakin, and Chun-Liang Li. Fixmatch: Simplifying semi-supervised learning with consistency and confidence. Advances in Neural Information Processing Systems, 33:596-608, 2020. +[34] Ellad B Tadmor and Ronald E Miller. Modeling materials: continuum, atomistic and multiscale techniques. Cambridge University Press, 2011. +[35] Ellad B. Tadmor, Ryan S. Elliott, James P. Sethna, Ronald E. Miller, and Chandler A. Becker. The potential of atomistic simulations and the Knowledgebase of Interatomic Models. JOM, 63 (7):17, July 2011. doi: 10.1007/s11837-011-0102-6. URL http://dx.doi.org/10.1007/s11837-011-0102-6. +[36] Ellad B. Tadmor, Ryan S. Elliott, Simon R. Phillipot, and Susan B. Sinnott. NSF cyberinfrastructures: A new paradigm for advancing materials simulation. COSSMS, 17(6):298-304, December 2013. doi: 10.1016/j.cossms.2013.10.004. URL http://dx.doi.org/10.1016/j.cossms.2013.10.004. + +[37] Nathaniel Thomas, Tess Smidt, Steven Kearnes, Lusann Yang, Li Li, Kai Kohlhoff, and Patrick Riley. Tensor field networks: Rotation-and translation-equivariant neural networks for 3d point clouds. arXiv preprint arXiv:1802.08219, 2018. +[38] Laurens Van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, 9(11), 2008. +[39] Andreas Veit, Neil Alldrin, Gal Chechik, Ivan Krasin, Abhinav Gupta, and Serge Belongie. Learning from noisy large-scale datasets with minimal supervision. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 839-847, 2017. +[40] Petar Velickovic, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua Bengio. Graph attention networks. arXiv preprint arXiv:1710.10903, 2017. +[41] YiNan Wang, LinFeng Zhang, Ben Xu, XiaoYang Wang, and Han Wang. A generalizable machine learning potential of ag-au nanoalloys and its application to surface reconstruction, segregation and diffusion. Modelling and Simulation in Materials Science and Engineering, 30 (2):025003, 2021. +[42] Mingjian Wen and Ellad B Tadmor. Uncertainty quantification in molecular simulations with dropout neural network potentials. npj Comput. Mater., 6(1):124, 2020. doi: 10.1038/s41524-020-00390-8. +[43] Mingjian Wen, Stephen Carr, Shiang Fang, Efthimios Kaxiras, and Ellad B. Tadmor. Dihedral-angle-corrected registry-dependent interlayer potential for multilayer graphene structures. Phys. Rev. B, 98(23):235404, dec 2018. doi: 10.1103/physrevb.98.235404. +[44] Mingjian Wen, Yaser Afshar, Ryan S Elliott, and Ellad B Tadmor. KLIFF: A framework to develop physics-based and machine learning interatomic potentials. Computer Physics Communications, 272:108218, 2022. +[45] Tong Xiao, Tian Xia, Yi Yang, Chang Huang, and Xiaogang Wang. Learning from massive noisy labeled data for image classification. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2691-2699, 2015. +[46] Tian Xie and Jeffrey C. Grossman. Crystal graph convolutional neural networks for an accurate and interpretable prediction of material properties. Phys. Rev. Lett., 120:145301, Apr 2018. doi: 10.1103/PhysRevLett.120.145301. URL https://link.aps.org/doi/10.1103/PhysRevLett.120.145301. +[47] Yuning You, Tianlong Chen, Yongduo Sui, Ting Chen, Zhangyang Wang, and Yang Shen. Graph contrastive learning with augmentations. Advances in Neural Information Processing Systems, 33:5812-5823, 2020. +[48] Linfeng Zhang, Jiequn Han, Han Wang, Roberto Car, and Weinan E. Deep potential molecular dynamics: a scalable model with the accuracy of quantum mechanics. Physical review letters, 120(14):143001, 2018. +[49] Zhilu Zhang and Mert Sabuncu. Generalized cross entropy loss for training deep neural networks with noisy labels. Advances in neural information processing systems, 31, 2018. +[50] Zhi-Hua Zhou. A brief introduction to weakly supervised learning. National science review, 5 (1):44-53, 2018. +[51] Fuzhen Zhuang, Zhiyuan Qi, Keyu Duan, Dongbo Xi, Yongchun Zhu, Hengshu Zhu, Hui Xiong, and Qing He. A comprehensive survey on transfer learning. Proceedings of the IEEE, 109(1): 43-76, 2020. \ No newline at end of file diff --git a/injectingdomainknowledgefromempiricalinteratomicpotentialstoneuralnetworksforpredictingmaterialproperties/images.zip b/injectingdomainknowledgefromempiricalinteratomicpotentialstoneuralnetworksforpredictingmaterialproperties/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..c90a7428fe45933ec792c8fb5abc65ca03690da5 --- /dev/null +++ b/injectingdomainknowledgefromempiricalinteratomicpotentialstoneuralnetworksforpredictingmaterialproperties/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a62facfaac4f66f0e6427b1d33263f9bfa431d5f2faca92e364ef38bf06df49f +size 371894 diff --git a/injectingdomainknowledgefromempiricalinteratomicpotentialstoneuralnetworksforpredictingmaterialproperties/layout.json b/injectingdomainknowledgefromempiricalinteratomicpotentialstoneuralnetworksforpredictingmaterialproperties/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..7c521732f0d7c070128584446aaabf9aac0fe507 --- /dev/null +++ b/injectingdomainknowledgefromempiricalinteratomicpotentialstoneuralnetworksforpredictingmaterialproperties/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1ab2370cd7336a25ff36129080a26cae7b7cb214a18d8f11dd11fe215978bcdd +size 379080 diff --git a/insightsintopretrainingviasimplersynthetictasks/fae16592-c4b9-4e40-96d5-b38eb15107f6_content_list.json b/insightsintopretrainingviasimplersynthetictasks/fae16592-c4b9-4e40-96d5-b38eb15107f6_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..9b4aac218667429769b30d19eca0322a9fe3fa45 --- /dev/null +++ b/insightsintopretrainingviasimplersynthetictasks/fae16592-c4b9-4e40-96d5-b38eb15107f6_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f4a5eb914edac221948b44767b4d49d5d3e9983823e8ca046b2c3e36e980a2e4 +size 77712 diff --git a/insightsintopretrainingviasimplersynthetictasks/fae16592-c4b9-4e40-96d5-b38eb15107f6_model.json b/insightsintopretrainingviasimplersynthetictasks/fae16592-c4b9-4e40-96d5-b38eb15107f6_model.json new file mode 100644 index 0000000000000000000000000000000000000000..535e31fa784d0a15744b393629c936e201027d68 --- /dev/null +++ b/insightsintopretrainingviasimplersynthetictasks/fae16592-c4b9-4e40-96d5-b38eb15107f6_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:acb1b8be50b331bce3e651d79e546fc34c7380bcb657023b50667fced95abdc5 +size 94756 diff --git a/insightsintopretrainingviasimplersynthetictasks/fae16592-c4b9-4e40-96d5-b38eb15107f6_origin.pdf b/insightsintopretrainingviasimplersynthetictasks/fae16592-c4b9-4e40-96d5-b38eb15107f6_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..4e6621d4bda582ea1c2168b5f3a4a1238911b9a3 --- /dev/null +++ b/insightsintopretrainingviasimplersynthetictasks/fae16592-c4b9-4e40-96d5-b38eb15107f6_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e4cd77c2918ea5c812a72d29d59955aeecd070a9408f647d9f9bf7fcf62813df +size 792699 diff --git a/insightsintopretrainingviasimplersynthetictasks/full.md b/insightsintopretrainingviasimplersynthetictasks/full.md new file mode 100644 index 0000000000000000000000000000000000000000..bf4dc4324653643e8e85738076c8f29c7fa69081 --- /dev/null +++ b/insightsintopretrainingviasimplersynthetictasks/full.md @@ -0,0 +1,266 @@ +# Insights into Pre-training via Simpler Synthetic Tasks + +Yuhuai $\mathbf{W}\mathbf{u}^{12*}$ + +yuhuai@cs.stanford.edu + +Felix Li\* + +fzli@berkeley.edu + +Percy Liang + +pliang@cs.stanford.edu + +$^{1}$ Stanford University + +2Google Research + +$^{3}$ UC Berkeley + +# Abstract + +Pre-training produces representations that are effective for a wide range of downstream tasks, but it is still unclear what properties of pre-training are necessary for effective gains. Notably, recent work shows that even pre-training on synthetic tasks can achieve significant gains in downstream tasks. In this work, we perform three experiments that iteratively simplify pre-training and show that the simplifications still retain much of its gains. First, building on prior work, we perform a systematic evaluation of three existing synthetic pre-training methods on six downstream tasks. We find the best synthetic pre-training method, LIME, attains an average of $67\%$ of the benefits of natural pre-training. Second, to our surprise, we find that pre-training on a simple and generic synthetic task defined by the Set function achieves $65\%$ of the benefits, almost matching LIME. Third, we find that $39\%$ of the benefits can be attained by using merely the parameter statistics of synthetic pre-training. We release the source code at https://github.com/felixzli/synthetic_pretraining. + +# 1 Introduction + +Pre-training on a large amount of data from sources such as text from the web—natural pre-training—is effective for a wide range of downstream tasks (Devlin et al., 2019; Brown et al., 2020; Chen et al., 2021; Lu et al., 2021). More surprisingly, recent works (Wu et al., 2021; Krishna et al., 2021; Ri & Tsuruoka, 2022; Anderson & Farrell, 2022) show that pre-training on data that is fully synthetically generated—synthetic pre-training—can also provide substantial gains, partially closing the gap between training from a randomly initialized model and a naturally pre-trained model. + +What properties of pre-training are necessary for effective gains? In this paper, we conduct a careful empirical study to help understand this question. We perform three experiments that iteratively simplify natural pre-training, while still retaining much of the benefits of natural pre-training. See Figure 1 for an overview of the results obtained in our three experiments. + +First, we perform a systematic evaluation of three previously proposed synthetic pre-training methods over six downstream tasks. Prior works only evaluated each synthetic pre-training method on a single downstream domain: Wu et al. (2021) on mathematical reasoning benchmarks, Chiang & Lee (2021) on GLUE, Krishna et al. (2021) on summarization, and Ri & Tsuruoka (2022) on language modeling and dependency parsing. We instead show how general these methods are as well as how different synthetic pre-training methods compare against each other. We find that the best performing synthetic task, LIME (Wu et al., 2021), closes a significant fraction of the gap between random initialization and natural pre-training for summarization (85%), semantic parsing (83%), reading comprehension (55%), code translation (43%), and retrosynthesis (49%). + +![](images/5a226e7e5df3cb03350b5b3626ceb1653c29f2538c11a0cf1c2c9a879a280e60.jpg) +Figure 1: We compare downstream task performance between natural language pre-training (Pre-trained_T5), synthetic pre-training (LIME), simpler synthetic pre-training (Set), initializing from the statistics of Set pre-training (Set Statistics), and initializing just the pre-attention layer norms to a lower value (Pre-attention Layer Norm Init). The average percent improvement is computed by taking the average over our six downstream tasks of $\frac{\text{Performance(Initialization)} - \text{Performance(Random_Initial)}}{\text{Performance(Pre-trained_T5)} - \text{Performance(Random_Initial)}}$ . + +Second, we discover a surprisingly simple and generic synthetic task that captured nearly the same effectiveness provided by the existing best synthetic task LIME, closing an average of $65\%$ of the gap to natural pre-training (compared to $67\%$ for LIME). This simple task, which we call Set, consists of outputting the input sequence without duplicate tokens in its original order, for example: + +Input: a a c b a b $\Rightarrow$ Output: a c b. + +Third, to simplify the initialization even more, we ask whether only the statistics of the pre-trained weights can explain the effectiveness of synthetic pre-training. We find that initializing parameters with statistics of a synthetic pre-trained model provides large benefits for some downstream tasks, closing $39\%$ of the gap to natural pre-training. Simplifying further allows us to see that by initializing all pre-attention layer norm parameters to a lower value (just one number!), we close more than $40\%$ of the gap to natural pre-training performance for summarization and semantic parsing, and an average of $21\%$ over all six tasks. + +# 2 Experimental Setup + +Architecture We trained a T5-Small model, which is a 60 million parameter encoder-decoder transformer model with 6 encoder layers, 6 decoder layers, 8 heads, head dimension 64, and MLP dimension 2048 (Raffel et al., 2020). + +Training Details For synthetic pre-training, we use the same hyperparameters that the off-the-shelf language pre-trained T5-small was trained with: AdaFactor optimizer, batch size 128, sequence length 512, and inverse square root learning rate $1 / \sqrt{\max(n,10000)}$ where $n$ is the current training step. We evaluate token validation accuracy every 5000 training steps. For all synthetic tasks besides Dyck, we fine-tuned with the first checkpoint that the model reaches above $99\%$ token validation accuracy. For Dyck, the model's validation accuracy plateaued without reaching above $99\%$ , so we chose to fine-tune using the checkpoint with max validation accuracy of $77.7\%$ . We provide further pre-training details in Appendix A and fine-tuning details in Appendix B. + +Downstream Tasks We fine-tuned synthetically pre-trained models on a diverse suite of downstream tasks: 1) Java to C# code translation (10K training examples) (Lu et al., 2021); 2) two semantic parsing benchmarks, MTOP (17K training examples) (Li et al., 2021) and WebQSP (2.7K training + +Table 1: Evaluation of three previously proposed synthetic pre-training tasks and two simpler synthetic pre-training tasks. For tasks where we report both Exact Match (EM) and F1, the Average column is computed using EM. + +
CNNDM-10K ROUGE1MTOP EM/F1WebQSP EM/F1SQuAD EM/F1Code Trans. EMRetrosyn. EMAverage
Baselines
Pre-trained_T535.8181.0/95.283.1/91.977.5/86.061.643.163.7100%
Random_Init18.938.6/83.028.2/72.917.2/25.257.039.233.20%
Section 3: Benchmarking Existing Synthetic Pre-training
LIME33.273.7/94.075.2/88.750.4/62.159.041.155.467%
Dyck27.165.9/91.958.5/83.550.3/62.458.840.450.249%
Nons_Summary232.068.0/92.765.2/85.248.4/60.157.339.651.847%
Section 4: Simpler Synthetic Pre-Training
Set32.871.7/93.772.2/88.248.3/60.059.440.954.265%
Identity30.268.6/93.069.8/86.826.1/35.457.840.548.846%
+ +examples) (Yih et al., 2016), consisting of converting a natural language query to a logical form; 3) USPTO-50K retrosynthesis (40K training examples) (Liu et al., 2017), a task that consists of predicting possible reactants when given a product as input; 4) the reading comprehension benchmark SQuAD 1.1 (87K training examples) (Rajpurkar et al., 2016); and 5) the summarization benchmark CNNDM-10K3 which is 10K training examples from the CNNDM (Krishna et al., 2021). See full descriptions and input-output examples for every downstream task in Appendix D. + +Baselines We compared against randomly initialized (Random_Init) and off-the-shelf natural language pre-trained T5-Small (Pre-trained_T5). Pre-trained_T5 was trained for 524K steps on the C4 dataset with the span-corruption objective (Raffel et al., 2020). We also compared against T5-Small trained on Wikipedia (Guo et al., 2020) for 10K steps (Wiki_10K) with the same pre-training objective as Pre-trained_T5. + +Source code We release the source code to reproduce the experiments at https://github.com/felixzli/synthetic_pretraining. + +# 3 Benchmarking Existing Synthetic Pre-training + +We benchmark three previously proposed synthetic pre-training tasks across six downstream tasks. We compute how much of the benefits using natural pre-training are gained by each synthetic pre-training method by taking the average over six downstream tasks of Performance(Initialization) - Performance(Random_Init) / Performance(Pre-trained_T5) - Performance(Random_Init). We show these numbers in the right-most column of Table 1. We find that LIME achieves the best performance, gaining $67\%$ of the benefits using natural pre-training. + +# 3.1 Synthetic Tasks + +For each synthetic task, we generated one million examples. To generate synthetic task data, we sampled tokens a vocabulary of size 32K, matching the vocabulary size of Pre-trained_T5. Details about data generation can be found in the original papers. We provide an example of each task in Figure 2. + +![](images/1f63b7acc4dbcce341dbe553ea6e411967dc376c07ed7ba00b06df818a7c1af3.jpg) + +![](images/347a676b013a3239148e3cd043448b9b85f254efe2c21e15f27ccb7299c6b989.jpg) + +![](images/02479d1c57cd093bf62020bf5e767f42203eda9e5d5ed22992c9906725abbd20.jpg) + +![](images/f02faf98ae620f1581fa9bf99c0502eb7a503f6506099918e85fc4731de09a52.jpg) +Figure 2: We show examples of Section 3 previously proposed synthetic tasks in the top row and Section 4 simpler synthetic tasks in the bottom row. Top Left: LIME deduct task, whose input consists of a "rule string" and "substitution dictionary" and output is a "result string." The "rule symbols" and "math symbols" are written as actual letters and math operations for reader clarity. In real generated data, each example's rule and math symbols are randomly sampled tokens. Top Middle: T5 style masked language modelling with Dyck language. In the input, the grey boxes indicate masked out spans. The model is trained to predict the masked spans, each separated by a special token $\langle s \rangle$ . In this example, the "noise_density" is 0.33 (so 5 out of 15 input brackets are corrupted) and the "span-corruption_length" is 1 (so each masked span is of length 1). In actual generated data, the "span-corruption_length" is 3 and the "noise_density" is 0.15, which are the same parameter values used for natural language Pre-trained_T5. Top Right: Nonsense_Summary task. In this example, two operations to create the summary are "copy sentence containing a keyword" and "identify keyword sentiment." Bottom Left: Set task. Bottom Right: Identity task. + +![](images/030dd1034cee02880c0770645a57fda89d89582f7f5589c029b4c93a0ad46cbf.jpg) + +LIME LIME is a set of three tasks—Deduct, Induct, and Abduct—inspired by Charles Peirce's three reasoning primitives (Wu et al., 2021). Each task consists of three elements: a rule string, a dictionary that represents substitutions, and a result string that is the result of applying those substitutions to the rule string. The three tasks are then constructed by using two of the three elements as inputs to predict the remaining element. + +Dyck Artificial Language We consider a Dyck language with multiple bracket types (taken from Ri & Tsuruoka (2022)), which we refer as Dyck. We turn generated text into a sequence-to-sequence task by using the T5 span-corruption pre-training objective (Raffel et al., 2020). The motivation behind the design of Dyck is how "sentences of natural language often have dependency relations where the existence of a certain word can be predictive of another word" (Ri & Tsuruoka, 2022). + +Nonsense Summary Krishna et al. (2021) developed the nonsense summarization task, which we refer to as Nonsense_Summary, by conducting a qualitative analysis of summarization data and identifying 21 elementary operations used to create summaries such as "CopyFirstSentence" and "CopyQuoted." Each synthetic task example consists of an input that is a nonsense document made of randomly sampled tokens and an output that is the corresponding nonsense summary consisting of applying a random subset of the 21 operations to the document. + +# 3.2 Results + +Table 1 shows results of evaluating the synthetic tasks across six downstream tasks, and Appendix Table 4 shows results of ablating the dataset size for retrosynthesis, CNNDM, and SQuAD. + +Synthetic pre-training provides large gains over random initialization. We observed large gains from all three synthetic tasks we evaluated. Out of these, LIME provided the most benefits across all six downstream tasks. We computed how much of the natural pre-training benefit is captured by LIME as $\frac{\text{Performance(LIME) - Performance(Random_ Init)}}{\text{Performance(Pre-trained_T5) - Performance(Random_ Init)}}$ . LIME closed $84.6\%$ , $82.8\%$ , $85.6\%$ , $55.1\%$ , $43.5\%$ , and $48.7\%$ of the gap for CNNDM-10K, MTOP, WebQSP, SQuAD, Code Translation, and Retrosynthesis respectively. + +Task or domain prior is not required for pre-training benefits. For example, LIME benefits tasks including summarization (CNNDM-10K) and reading comprehension (SQuAD) despite LIME pre-training data involving no natural language like Pre-trained_T5, representing no structure of natural language like Dyck, and not being explicitly designed to reflect the operations used in summarization like Nonsense_Summary. + +Varying degrees of benefits. Comparing Nonsense_Summary and Dyck, we see that the two synthetic tasks benefit MTOP, WebQSP, and SQuAD similarly, yet their benefits for the three other tasks are very different. The difference between Nonsense_Summary and Dyck as well as the superiority of LIME are examples of how different synthetic pre-training can have significantly different effectiveness. + +Synthetic pre-training is not more efficient. One of the advantages argued for synthetic pretraining is its computational efficiency (Wu et al., 2021; Krishna et al., 2021). To explore this potential advantage, we pre-trained our model using the T5 span-corruption pre-training objective on Wikipedia (Guo et al., 2020) for 10K steps, and the result is shown in Table 1 labelled Wiki_10K. Wikipedia pre-training for 10K steps provided more significant gains than LIME pre-training for 30K steps and Set pre-training for 10K steps. Based on this result, we see no evidence that the evaluated synthetic pre-training tasks provide computational efficiency benefits over natural language pre-training, unlike what Wu et al. (2021) suggested. + +Natural language pre-training benefits non-natural language tasks. Natural language pretraining, including Wiki_10K, outperforms synthetic pre-training on the non-natural language tasks of Code Translation and Retrosynthesis. + +# 4 Simpler Synthetic Pre-training + +Encouraged by the results in the previous section, we want to explore what is necessary for synthetic pre-training benefits. We evaluate pre-training with simpler and more generic synthetic tasks similar to basic Python API functions. Surprisingly, a simple and generic task defined by the Set function provides significant benefits (65%), almost matching the previous best synthetic task LIME (67%). Furthermore, another simple task defined by the Identity function also provided significant benefits (46%). + +# 4.1 Simpler Synthetic Tasks + +We constructed 18 simpler synthetic tasks similar to basic Python API functions. As we did for the three existing synthetic tasks, for each simpler synthetic task we generated one million data points with a vocabulary of 32K tokens, matching the vocabulary size of Pre-trained_T5. In Appendix G.1, we define each task, explain how examples are randomly generated, and provide input-output examples. We first evaluated all tasks on CNNDM-10K. We then evaluated Set, one of the best performing tasks on CNNDM-10K, and Identity, one of the simplest tasks, on all six downstream tasks. + +![](images/5871bdad095882eaa0c965111c116d0b2f36585156dd39bfe2dc35624c2f51dd.jpg) +Figure 3: For each simple synthetic task, we pre-train on it and then fine-tune on CNNDM-10K. Set performed the best and Identity, one of the simplest tasks, provided significant benefit. The Set and Identity tasks are defined in 4.1, and the other tasks are defined in G. + +Set The Set task consists of outputting the input sequence in its original order except without tokens appearing more than once. An example input is [a b b a a c d c], and the corresponding output is [a b c d]. The Set task data generation is explained in Appendix G. + +Identity The Identity task consists of copying the input tokens to the output. An example input is [a d e a a], and the corresponding output is [a d e a a]. To generate one example, we uniformly sample a sequence of tokens between length 10 and length 220 to be the input and output. + +# 4.2 Results: simpler synthetic tasks provide similar benefits as existing synthetic tasks + +Figure 3 shows results on CNNDM-10K for models pre-trained on each of 18 simpler synthetic tasks. Table 1 shows results on all six downstream tasks for Set and Identity pre-trained models. Averaged across the six downstream tasks, Set and Identity gain $65\%$ and $46\%$ of the natural pretraining benefits compared to $67\%$ for LIME, the best previously proposed synthetic task evaluated in Section 3. Identity provides at least as much benefit as Nested Language and Nonsense Summary for all tasks besides Code Translation, for which Nested Language benefits more. + +The significant benefits of Set and Identity pre-training suggest that the complexities of the three previously proposed synthetic tasks we evaluated—representing three fundamental logical operations, having a structural property that mimics natural language, and reflecting operations used for summarization—may not be the necessary factors for why pre-training on those tasks provides benefits. Also, due to their simplicity, Set and Identity may be useful for future work towards understanding pre-training and how to design better synthetic tasks. + +# 5 Even Simpler Synthetic Pre-training with Statistics + +Inspired by the previous section, we tried to find even simpler initializations that achieve the benefits of pre-training. We explored how benefits of synthetic pre-training can be attained by initialization based only on statistics of pre-trained weights. We found: (1) Initialization using the mean and standard deviation (SD) of synthetic pre-trained parameters can gain more than $70\%$ of the benefit from synthetic pre-training for CNNDM-10K and MTOP (or an average of $39\%$ of natural pre-training benefits). (2) Initialization using simpler schemes involving less statistics can still provide benefits. (3) Specifically the pre-attention layer norm plays an important role for initialization benefits. + +![](images/5d5b94cd2a56de50947c849d9e0237f8b04929136698658a1f57d9a041e57988.jpg) +Figure 4: Illustration of Section 5.1 Per_Param_Mean_SD init scheme. We use this init scheme with LIME, Set, or Identity pre-trained models before fine-tuning on the downstream tasks. As an example, if we were to use this init scheme with an Identity pre-trained model, we would initialize the encoder layer 2 query matrix weights by sampling from a Gaussian with the mean and SD of the encoder layer 2 query matrix from an Identity pre-trained model, and we would initialize every other parameter in the same manner. The Per_Param_Mean_SD init scheme recovered more than $70\%$ of the benefit of normally fine-tuning a synthetic pre-trained model (or an average of $39\%$ of natural pre-training benefits). + +# 5.1 How much of synthetic pre-training benefit can be attributed to better statistics for initialization? + +We compare normal fine-tuning, which we call Full1_Ini t, with fine-tuning a model that is initialized with the mean and standard deviation (SD) of each synthetic pre-trained model's parameter. We call this initialization scheme Per_Param_Mean_SD and illustrate it in Figure 4. Specifically, for each parameter $p$ (e.g. an attention query matrix) in the synthetic pre-trained model, we compute the the mean $\mu_p$ and the standard deviation $\sigma_p$ of all entries in $p$ . We then randomly initialize the model with the same $\mu_p$ and $\sigma_p$ for each parameter $p$ . For example, if a pre-trained model had a $2 \times 2$ parameter matrix $p = [[-1,2],[2,5]]$ , then $\mu_p = 2$ and $\sigma_p = 2.4$ , and we would initialize $p$ by sampling the each entry of this $2 \times 2$ matrix from a normal distribution $\mathcal{N}(2,2.4^2)$ . We list all the parameters we initialize for T5-Small in this manner in Appendix K. + +As shown in Table 2, using the Per_Param_Mean_SD initialization scheme achieves a large proportion of the benefit from normally fine-tuning a synthetic pre-trained model. For example, for LIME Identity and Set, the Per_Param_Mean_SD initialization recovered $78\%$ , $85\%$ , and $97\%^2$ of MTOP Full_Init performance (or $65\%$ , $66\%$ , $69\%$ of the benefits by natural pre-training). The remaining gap between Per_Param_Mean_SD and Full_Init supports the possibility that other factors besides better initialization statistics may cause the benefits of synthetic pre-training. We note that it does not preclude the possibility that better initialization statistics is the sole cause of benefits: there may exist other initialization schemes such that the statistics of the pre-trained model are a subset of the statistics from the initialization scheme. + +# 5.2 Can simpler initialization schemes still produce benefits? + +Next we explore if simpler initialization schemes that use a smaller number of statistics than Per_Param_Mean_SD can still provide benefits. We present three initialization schemes: Per_Param_Scale, Whole_model_Scale, and Subset_Per_Param_Scale, with results shown in Table 2. We also tried two other initialization schemes, Across_Layers_Scale and Per Layers_Scale, discussed in Appendix H. + +Table 2: Evaluating different initialization schemes with statistics of LIME, Set, and Identity pre-trained models. Results for Per_Param_Mean_SD for the four other tasks as well as five seeds for CNNDM-10K, MTOP, and SQuAD are in Appendix Table 7. Results for two other initialization ablations and three other Subset_Per_Param_Scale subset choices we tried are in Appendix Table 5. + +
CNNDM-10KMTOP
LIMESetIdentityLIMESetIdentity
Section 5.1
Full_Init33.232.830.273.7/94.071.7/93.768.6/93.0
Per_Param_Mean_SD29.329.828.866.1/92.366.6/92.367.8/92.6
Section 5.2
Per_Param_Scale29.029.529.067.3/92.566.5/92.466.3/92.3
Whole_Mode_Scale15.526.120.534.3/81.438.7/83.159.8/91.0
Pre-attn_LN_Per_Param_Scale27.825.127.359.9/90.358.9/89.046.7/86.3
BaselineCNNDM-10KMTOP
Random_Init18.938.6/83.0
Pre-trained_T535.881.0/95.2
+ +Per Param Scale We use the term "scale statistic" to denote the mean of layer norm parameters or the SD of non layer norm parameters. Unlike the Per_Param_Mean_SD init scheme in the previous subsection, where we initialize each parameter with two statistics (mean and SD), Per_Param_Scale initializes each parameter with only the scale statistic: initialize layer norm parameters by setting their value to the mean of the corresponding pre-trained parameter weights, and initialize non layer norm parameters by sampling from a Gaussian with mean 0 and the SD of the corresponding pre-trained parameter weights. + +Whole Model Scale We initialize the whole model with only two statistics: the SD over all non layer norm weights $\sigma_{m}$ and the mean over all layer norm weights $\mu_{m}$ . Initialize each non layer norm weight by sampling from $\mathcal{N}(0, \sigma_m^2)$ and Initialize each layer norm weight as the value $\mu_{m}$ . + +Per Param Scale: Subset The motivation for this init scheme is to find a smaller set of parameters whose initialization can provide significant benefit. We initialize a subset of the parameters (e.g., attention parameters) with the Per_Param_Scale initialization and initialize the rest of the parameters with the default Random_Init. With this initialization scheme, we tried four different subsets: attention parameters, MLP parameters, pre-attention layer norms, and pre-MLP layer norms. + +Results Per_Param_Scale provided almost identical benefits as the Per_Param_Mean_SD initialization, suggesting that just the scale statistics, rather than both the mean and SD, are sufficient to provide benefits of initialization. + +Whole_Connection_Scale initialization was much worse than Per_Param_Mean_SD, yielding almost no improvements. A finer scale initialization rather than simply increasing the scale of weights across the whole model as Whole_Connection_Scale does may be necessary for benefits. + +For the Subset_Per_Param_Scale init scheme, pre-attention layer norms was the only subset we tried that provided significant initialization benefits, covering $46\%$ and $39\%$ of the gap between From Scratch and Pre-trained_T5 for CNNDM-10K and MTOP. See results in Table 2 (labeled Pre-attn_LN_Per_Param_Scale) and results for all four subsets tried in Appendix Table 5. + +# 5.3 A Better Pre-attention Layer Norm Initialization + +Synthetic pre-training results in lower pre-attention layer norm means. Motivated by benefits from the Subset_Per_Param_Scale initialization scheme—initializing pre-attention layer norms using their synthetic pre-trained means and all other parameters with the default initialization—we wanted to see if the pre-attention layer norm mean values in synthetic pre-trained models have a + +Table 3: Results from initializing pre-attention layer norm parameters to a particular value. They are initialized to the value of 1.0 in the Random_Init baseline which is the default T5 initialization. + +
Pre-attn LN Init ValueCNNDM-10KMTOPWebQSPSQuADCode Trans.Retrosyn.
0.0528.225.7/73.330.5/71.222.8/31.257.939.3
0.128.332.5/77.528.9/70.623.5/31.757.639.9
0.228.256.4/89.330.6/72.328.2/37.357.039.4
0.424.456.9/89.930.0/72.836.3/46.957.339.6
0.818.650.7/88.528.0/71.634.2/44.657.239.9
BaselineCNNDM-10KMTOPWebQSPSQuADCode Trans.Retrosyn.
Random_Init18.9 (0.5)38.6/83.0 (2.1/1.2)25.8/71.5 (0.7/0.5)16.0/24.2 (2.1/2.0)57.6 (0.3)39.0 (0.5)
Pre-trained_T535.8 (0.1)81.0/95.2 (0.3/2.2)82.3/91.7 (0.8/0.4)77.4/86.1 (0.2/0.2)61.2 (0.7)43.5 (0.3)
+ +pattern. In Appendix Figure 6, we plotted pre-attention layer norm parameter means of each layer for LIME, Set, and Identity pre-trained models. We noticed that the pre-attention layer norm means from the synthetic pre-trained models are much smaller values (below 0.4 for most layers) compared to the default initialization of 1.0. + +Lower value pre-attention layer norm initialization provides benefits. Inspired by the above observation, we tried an initialization scheme where all the pre-attention layer norm parameters are initialized to a specific value, and all other parameters are initialized with the default initialization. We tried five different values ranging from 0.05 to 0.8. Results in Table 3 show that initializing the pre-attention layer norm parameters to a lower value than the default initialization of 1.0 provided significant benefits: initializing them to 0.2 improved CNNDM-10K from 18.9 to 28.2 ROUGE1, MTOP from $38.6\%$ to $56.4\%$ EM, and SQuAD from 16.0 to 22.8 EM. + +# 6 Related Work + +Synthetic Pre-training Past work has shown that synthetic pre-training can benefit a wide range of downstream tasks. For example, it has been shown that pre-training on artificial languages that intuitively mimic properties of natural language can benefit language modeling, dependency parsing, and GLUE (Ri & Tsuruoka, 2022; Papadimitriou & Jurafsky, 2020; Chiang & Lee, 2021). Pretraining on LIME, a mixture of three synthetic tasks motivated from reasoning primitives, benefits mathematical reasoning benchmarks (Wu et al., 2021). For summarization, Krishna et al. (2021) designed a suite of synthetic summarization tasks on a corpus of random tokens, and they show such pre-training can almost match up with natural pre-training. Synthetic pre-training also has been applied outside of text-based domains: Anderson & Farrell (2022) shows pre-training on synthetically generated fractal images nearly matches the benefits of pre-training with ImageNet. + +Cross-domain Transfer Learning Synthetic pre-training benefiting downstream tasks across a wide range of domains is an instance of cross-domain transfer learning, which past work has demonstrated the efficacy of. Pre-training language models with many languages benefits downstream tasks in a new unseen language (Liu et al., 2020). More surprisingly, pre-training on music, code, and amino acid sequences benefits natural language downstream tasks (Papadimitriou & Jurafsky, 2020; Chiang & Lee, 2020). It was also shown recently that pre-training on natural language benefits offline RL (Reid et al., 2022). + +Understanding Pre-training Past work has explored what properties of the pre-training data are important for benefits. Ri & Tsuruoka (2022) and Papadimitriou & Jurafsky (2020) use synthetic pretraining to identify general properties of pre-training data that correlate with improved downstream language task performance by leveraging how synthetic data is easy to modify in a controlled manner. Papadimitriou & Jurafsky (2020) found that changing the distribution of tokens in an artificial language can affect downstream performance, and Ri & Tsuruoka (2022) found that for an artificial brackets language using a nesting structure as well as different tokens for bracket pairs results in better performance than using a flat structure and the same token for bracket pairs. K et al. (2020), Conneau et al. (2020), and Dufter & Schütze (2020) explore data properties related to cross-language transfer learning. Sinha et al. (2021) shows that word order within sentences is not essential for natural language pre-training benefits. + +Other past work has used probing methods to explore what potentially transferable knowledge is gained from pre-training. Ri & Tsuruoka (2022) explored how much knowledge of "position-aware context dependence" was gained from artificial language and natural language pre-training. Chi et al. (2020) and Papadimitriou et al. (2021) explored potentially transferable knowledge gained from multi-lingual language pre-training. + +Initialization Our work tried to understand pre-training through the lens of initialization statistics that benefit optimization. There has been past work on improving transformer initialization to achieve more stable training and benefits with deeper models (Zhang et al., 2019; Huang et al., 2020; Zhang et al., 2020; Wang et al., 2022). These papers do not explore benefits from initializing with pre-trained model statistics. + +# 7 Discussion + +Limitations of current synthetic tasks In this work, we show that synthetic pre-training can provide significant benefits across many different tasks. However, synthetic pre-training still lags behind natural pre-training by an average of $33\%$ for the six downstream tasks we fine-tuned on. This is expected for natural language downstream tasks, but it is important to note that even on non-natural language tasks, natural language pre-training still outperforms synthetic pre-training. This result suggests that natural language pre-training produces effects that are missing from the evaluated synthetic pre-training. Exploring the differences between different pre-training may be an interesting direction for future work. + +We emphasize that this paper does not support any claims regarding the practical efficacy of synthetic pre-training. The metric of "percentage of natural pre-training gap closed" measures relative performance along a meaningless linear scale, and for downstream tasks retrosynthesis and code translation, the magnitude of the improvement over from scratch for natural pre-training is low to begin with. This paper's goal is not to communicate that synthetic pre-training is practically effective, but rather to communicate that synthetic pre-training produces nontrivial differences in model behavior compared to a randomly initialized model, and also that there is nontrivial variation in model behavior from differing synthetic pre-training and initialization schemes involving pre-trained weight statistics. + +Synthetic pre-training requires deeper understanding Our results show that initialization using the statistics from synthetic pre-trained models can recover more than $70\%$ of the benefit from synthetic pre-training. The remaining gap leaves open the possibility that the benefits of synthetic pretraining are due to other factors besides better statistics for initialization. Due to their simplicity, Set and Identity may be useful for future work towards deeper understanding of synthetic pre-training. + +In the long term, as we learn more about synthetic pre-training and pre-training in general, we believe that for some downstream tasks it may be possible to develop synthetic pre-training that outperforms natural pre-training: the complexity of existing natural data is fixed, while in some sense the complexity of fully synthetically generated data is infinite. + +Privacy and Ethics This work focuses on the understanding of synthetic pre-training. But synthetic pre-training can also have practical implications for privacy and ethics. Standard pre-training data, even when its public, can contain private user information. Large pre-trained models are capable of memorizing training examples, which makes them vulnerable to privacy attacks (Carlini et al., 2020). Synthetic data on the other hand is divorced from the real world, which can help mitigate privacy issues. Large pre-trained corpora can contain harmful text (e.g., hate speech). With synthetic pre-training, since we have complete control over what goes into the data, we can potentially mitigate some of the harmful behavior of existing models. Unfortunately, synthetic pre-training is currently not as performant as natural pre-training, so real-world data would still have to be used to close the performance gap. + +# Acknowledgements + +We thank Google TPU Research Cloud for the experimental support. We thank Christian Szegedy, Eric Zelikman, Tri Dao, Dan Fu, Sidd Karamcheti and Rishi Bommasani, for their useful feedbacks on the draft. + +# References + +Connor Anderson and Ryan Farrell. Improving fractal pre-training. In IEEE/CVF Winter Conference on Applications of Computer Vision, WACV 2022, Waikoloa, HI, USA, January 3-8, 2022, pp. 2412-2421. IEEE, 2022. doi: 10.1109/WACV51458.2022.00247. URL https://doi.org/10.1109/WACV51458.2022.00247. +Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In NeurIPS, 2020. +Nicholas Carlini, Florian Tramér, Eric Wallace, Matthew Jagielski, Ariel Herbert-Voss, Katherine Lee, Adam Roberts, Tom B. Brown, Dawn Song, Ülfar Erlingsson, Alina Oprea, and Colin Raffel. Extracting training data from large language models. CoRR, abs/2012.07805, 2020. URL https://arxiv.org/abs/2012.07805. +Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harrison Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, Alex Ray, Raul Puri, Gretchen Krueger, Michael Petrov, Heidy Khlaaf, Girish Sastry, Pamela Mishkin, Brooke Chan, Scott Gray, Nick Ryder, Mikhail Pavlov, Alethea Power, Lukasz Kaiser, Mohammad Bavarian, Clemens Winter, Philippe Tillet, Felipe Petroski Such, Dave Cummings, Matthias Plappert, Fotios Chantzis, Elizabeth Barnes, Ariel Herbert-Voss, William Hebgen Guss, Alex Nichol, Alex Paino, Nikolas Tezak, Jie Tang, Igor Babuschkin, Suchir Balaji, Shantanu Jain, William Saunders, Christopher Hesse, Andrew N. Carr, Jan Leike, Joshua Achiam, Vedant Misra, Evan Morikawa, Alec Radford, Matthew Knight, Miles Brundage, Mira Murati, Katie Mayer, Peter Welinder, Bob McGrew, Dario Amodei, Sam McCandlish, Ilya Sutskever, and Wojciech Zaremba. Evaluating large language models trained on code. CoRR, abs/2107.03374, 2021. URL https://arxiv.org/abs/2107.03374. +Ethan A. Chi, John Hewitt, and Christopher D. Manning. Finding universal grammatical relations in multilingual BERT. In Dan Jurafsky, Joyce Chai, Natalie Schluter, and Joel R. Tetreault (eds.), Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, ACL 2020, Online, July 5-10, 2020, pp. 5564-5577. Association for Computational Linguistics, 2020. doi: 10.18653/v1/2020.acl-main.493. URL https://doi.org/10.18653/v1/2020.acl-main.493. +David Cheng-Han Chiang and Hung-yi Lee. Pre-training a language model without human language. CoRR, abs/2012.11995, 2020. URL https://arxiv.org/abs/2012.11995. +David Cheng-Han Chiang and Hung-yi Lee. On the transferability of pre-trained language models: A study from artificial datasets. CoRR, abs/2109.03537, 2021. URL https://arxiv.org/abs/2109.03537. +Alexis Conneau, Kartikay Khandelwal, Naman Goyal, Vishrav Chaudhary, Guillaume Wenzek, Francisco Guzmán, Edouard Grave, Myle Ott, Luke Zettlemoyer, and Veselin Stoyanov. Unsupervised cross-lingual representation learning at scale. In Dan Jurafsky, Joyce Chai, Natalie Schluter, and Joel R. Tetreault (eds.), Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, ACL 2020, Online, July 5-10, 2020, pp. 8440-8451. Association for Computational Linguistics, 2020. doi: 10.18653/v1/2020.acl-main.747. URL https://doi.org/10.18653/v1/2020.acl-main.747. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: pre-training of deep bidirectional transformers for language understanding. In ACL, 2019. +Philipp Dufter and Hinrich Schütze. Identifying elements essential for bert's multilinguality. In Bonnie Webber, Trevor Cohn, Yulan He, and Yang Liu (eds.), Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, EMNLP 2020, Online, November 16-20, 2020, pp. 4423-4437. Association for Computational Linguistics, 2020. doi: 10.18653/v1/2020.emnlp-main.358. URL https://doi.org/10.18653/v1/2020.emnlp-main.358. + +Mandy Guo, Zihang Dai, Denny Vrandecic, and Rami Al-Rfou. Wiki-40B: Multilingual language model dataset. In Proceedings of the 12th Language Resources and Evaluation Conference, pp. 2440-2452, Marseille, France, May 2020. European Language Resources Association. ISBN 979-10-95546-34-4. URL https://aclanthology.org/2020.lrec-1.297. +Xiao Shi Huang, Felipe Pérez, Jimmy Ba, and Maksims Volkovs. Improving transformer optimization through better initialization. In Proceedings of the 37th International Conference on Machine Learning, ICML 2020, 13-18 July 2020, Virtual Event, volume 119 of Proceedings of Machine Learning Research, pp. 4475-4483. PMLR, 2020. URL http://proceedings.mlr.press/v119/huang20f.html. +Karthikeyan K, Zihan Wang, Stephen Mayhew, and Dan Roth. Cross-lingual ability of multilingual BERT: an empirical study. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020. URL https://openreview.net/forum?id=HJeT3yrtDr. +Kundan Krishna, Jeffrey P. Bigham, and Zachary C. Lipton. Does pretraining for summarization require knowledge transfer? In EMNLP (Findings), pp. 3178-3189, 2021. URL https://aclanthology.org/2021.findings-emnlp.273. +Haoran Li, Abhinav Arora, Shuhui Chen, Anchit Gupta, Sonal Gupta, and Yashar Mehdad. MTOP: A comprehensive multilingual task-oriented semantic parsing benchmark. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, pp. 2950-2962, Online, April 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.eacl-main.257. URL https://aclanthology.org/2021.eacl-main.257. +Bowen Liu, Bharath Ramsundar, Prasad Kawthekar, Jade Shi, Joseph Gomes, Quang Luu Nguyen, Stephen Ho, Jack Sloane, Paul Wender, and Vijay Pande. Retrosynthetic reaction prediction using neural sequence-to-sequence models. ACS Central Science, 3(10):1103-1113, 2017. doi: 10. 1021/acscentsci.7b00303. URL https://doi.org/10.1021/acscentsci.7b00303. PMID: 29104927. +Yinhan Liu, Jiatao Gu, Naman Goyal, Xian Li, Sergey Edunov, Marjan Ghazvininejad, Mike Lewis, and Luke Zettlemoyer. Multilingual denoising pre-training for neural machine translation. Trans. Assoc. Comput. Linguistics, 8:726-742, 2020. URL https://transacl.org/ojs/index.php/tacl/article/view/2107. +Jieyu Lu and Yingkai Zhang. Unified deep learning model for multitask reaction predictions with explanation. Journal of Chemical Information and Modeling, 62(6):1376-1387, 2022. doi: 10.1021/acs.jcim.1c01467. URL https://doi.org/10.1021/acs.jcim.1c01467. PMID: 35266390. +Shuai Lu, Daya Guo, Shuo Ren, Junjie Huang, Alexey Svyatkovskiy, Ambrosio Blanco, Colin B. Clement, Dawn Drain, Daxin Jiang, Duyu Tang, Ge Li, Lidong Zhou, Linjun Shou, Long Zhou, Michele Tufano, Ming Gong, Ming Zhou, Nan Duan, Neel Sundaresan, Shao Kun Deng, Shengyu Fu, and Shujie Liu. Codexglue: A machine learning benchmark dataset for code understanding and generation. In Joaquin Vanschoren and Sai-Kit Yeung (eds.), Proceedings of the Neural Information Processing Systems Track on Datasets and Benchmarks 1, NeurIPS Datasets and Benchmarks 2021, December 2021, virtual, 2021. URL https://datasets-benchmarks-proceedings.neurips.cc/paper/2021/biticalc/c16a5320fa475530d9583c34fd356ef5-Abstraction-round1.html. +Isabel Papadimitriou and Dan Jurafsky. Learning music helps you read: Using transfer to study linguistic structure in language models. In Bonnie Webber, Trevor Cohn, Yulan He, and Yang Liu (eds.), Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, EMNLP 2020, Online, November 16-20, 2020, pp. 6829-6839. Association for Computational Linguistics, 2020. doi: 10.18653/v1/2020.emnlp-main.554. URL https://doi.org/10.18653/v1/2020.emnlp-main.554. +Isabel Papadimitriou, Ethan A. Chi, Richard Futrell, and Kyle Mahowald. Deep subjecthood: Higher-order grammatical features in multilingual BERT. In Paola Merlo, Jorg Tiedemann, and Reut Tsarfaty (eds.), Proceedings of the 16th Conference of the European Chapter of the Association for + +Computational Linguistics: Main Volume, EACL 2021, Online, April 19 - 23, 2021, pp. 2522-2532. Association for Computational Linguistics, 2021. doi: 10.18653/v1/2021.eacl-main.215. URL https://doi.org/10.18653/v1/2021.eacl-main.215. +Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. J. Mach. Learn. Res., 21:140:1-140:67, 2020. URL http://jmlr.org/papers/v21/20-074.html. +Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: 100, $000+$ questions for machine comprehension of text. CoRR, abs/1606.05250, 2016. URL http://arxiv.org/abs/1606.05250. +Machel Reid, Yutaro Yamada, and Shixiang Shane Gu. Can wikipedia help offline reinforcement learning? CoRR, abs/2201.12122, 2022. URL https://arxiv.org/abs/2201.12122. +Ryokan Ri and Yoshimasa Tsuruoka. Pretraining with artificial language: Studying transferable knowledge in language models. CoRR, abs/2203.10326, 2022. doi: 10.48550/arXiv.2203.10326. URL https://doi.org/10.48550/arXiv.2203.10326. +Abigail See, Peter J. Liu, and Christopher D. Manning. Get to the point: Summarization with pointer-generator networks. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1073-1083, Vancouver, Canada, July 2017. Association for Computational Linguistics. doi: 10.18653/v1/P17-1099. URL https://aclanthology.org/P17-1099. +Koustuv Sinha, Robin Jia, Dieuwke Hupkes, Joelle Pineau, Adina Williams, and Douwe Kiela. Masked language modeling and the distributional hypothesis: Order word matters pre-training for little. In Marie-Francine Moens, Xuanjing Huang, Lucia Specia, and Scott Wen-tau Yih (eds.), Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, EMNLP 2021, Virtual Event / Punta Cana, Dominican Republic, 7-11 November; 2021, pp. 2888-2913. Association for Computational Linguistics, 2021. doi: 10.18653/v1/2021.emnlp-main.230. URL https://doi.org/10.18653/v1/2021.emnlp-main.230. +Hongyu Wang, Shuming Ma, Li Dong, Shaohan Huang, Dongdong Zhang, and Furu Wei. Deepnet: Scaling transformers to 1,000 layers. CoRR, abs/2203.00555, 2022. doi: 10.48550/arXiv.2203.00555. URL https://doi.org/10.48550/arXiv.2203.00555. +Yuhuai Wu, Markus N Rabe, Wenda Li, Jimmy Ba, Roger B Grosse, and Christian Szegedy. Lime: Learning inductive bias for primitives of mathematical reasoning. In International Conference on Machine Learning, pp. 11251-11262. PMLR, 2021. +Tianbao Xie, Chen Henry Wu, Peng Shi, Ruiqi Zhong, Torsten Scholak, Michihiro Yasunaga, Chien-Sheng Wu, Ming Zhong, Pengcheng Yin, Sida I. Wang, Victor Zhong, Bailin Wang, Chengzu Li, Connor Boyle, Ansong Ni, Ziyu Yao, Dragomir R. Radev, Caiming Xiong, Lingpeng Kong, Rui Zhang, Noah A. Smith, Luke Zettlemoyer, and Tao Yu. Unifiedsgk: Unifying and multi-tasking structured knowledge grounding with text-to-text language models. CoRR, abs/2201.05966, 2022. URL https://arxiv.org/abs/2201.05966. +Wen-tau Yih, Matthew Richardson, Chris Meek, Ming-Wei Chang, and Jina Suh. The value of semantic parse labeling for knowledge base question answering. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pp. 201–206, Berlin, Germany, August 2016. Association for Computational Linguistics. doi: 10.18653/v1/P16-2033. URL https://aclanthology.org/P16-2033. +Biao Zhang, Ivan Titov, and Rico Sennrich. Improving deep transformer with depth-scaled initialization and merged attention. In Kentaro Inui, Jing Jiang, Vincent Ng, and Xiaojun Wan (eds.), Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, EMNLP-IJCNLP 2019, Hong Kong, China, November 3-7, 2019, pp. 898-909. Association for Computational Linguistics, 2019. doi: 10.18653/v1/D19-1083. URL https://doi.org/10.18653/v1/D19-1083. + +Biao Zhang, Philip Williams, Ivan Titov, and Rico Sennrich. Improving massively multilingual neural machine translation and zero-shot translation. In Dan Jurafsky, Joyce Chai, Natalie Schluter, and Joel R. Tetreault (eds.), Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, ACL 2020, Online, July 5-10, 2020, pp. 1628-1639. Association for Computational Linguistics, 2020. doi: 10.18653/v1/2020.acl-main.148. URL https://doi.org/10.18653/v1/2020.acl-main.148. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] +(c) Did you discuss any potential negative societal impacts of your work? [N/A] +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [N/A] +(b) Did you include complete proofs of all theoretical results? [N/A] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] Sections 2,3.1,4.1,G,D +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A] +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] Appendix Section I + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] +(b) Did you mention the license of the assets? [Yes] +(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] We release the source code at https://github.com/felixzli/synthetic_pretraining. +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/insightsintopretrainingviasimplersynthetictasks/images.zip b/insightsintopretrainingviasimplersynthetictasks/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..0232408b46f44469180552c23d5c0fe254c0a1bd --- /dev/null +++ b/insightsintopretrainingviasimplersynthetictasks/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5902538fbea8eb7a0afe7f08053f720b8177d27a2d3adc8989bd857f3dfce9e1 +size 339097 diff --git a/insightsintopretrainingviasimplersynthetictasks/layout.json b/insightsintopretrainingviasimplersynthetictasks/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..658ab8cadf8dae60827a43d882ad1ce8b867cbe3 --- /dev/null +++ b/insightsintopretrainingviasimplersynthetictasks/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b863eea8c2cd1a523b172ebc76998184caf5fea6de7e7eca369eca3a99d06845 +size 336840 diff --git a/insnetanefficientflexibleandperformantinsertionbasedtextgenerationmodel/4e3e89d9-97b2-4e88-9485-2d2dea3f5ab3_content_list.json b/insnetanefficientflexibleandperformantinsertionbasedtextgenerationmodel/4e3e89d9-97b2-4e88-9485-2d2dea3f5ab3_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..5c0ead3efaeda20949ae241eee5740e7791118d2 --- /dev/null +++ b/insnetanefficientflexibleandperformantinsertionbasedtextgenerationmodel/4e3e89d9-97b2-4e88-9485-2d2dea3f5ab3_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fc74fa49780e8e0060510fd320e76e3defd771c3fdddc7720e0df3076ae31b46 +size 79306 diff --git a/insnetanefficientflexibleandperformantinsertionbasedtextgenerationmodel/4e3e89d9-97b2-4e88-9485-2d2dea3f5ab3_model.json b/insnetanefficientflexibleandperformantinsertionbasedtextgenerationmodel/4e3e89d9-97b2-4e88-9485-2d2dea3f5ab3_model.json new file mode 100644 index 0000000000000000000000000000000000000000..5f38b8f480c9f5ad6a235c3b7c57fdf7beada5ef --- /dev/null +++ b/insnetanefficientflexibleandperformantinsertionbasedtextgenerationmodel/4e3e89d9-97b2-4e88-9485-2d2dea3f5ab3_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a1c09cdfe34889c1d10c3ecb0c275c0dc3e864af9b8eba74b3808883b71f9d5f +size 96347 diff --git a/insnetanefficientflexibleandperformantinsertionbasedtextgenerationmodel/4e3e89d9-97b2-4e88-9485-2d2dea3f5ab3_origin.pdf b/insnetanefficientflexibleandperformantinsertionbasedtextgenerationmodel/4e3e89d9-97b2-4e88-9485-2d2dea3f5ab3_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..27c842c4916797810f6e89150d9a40171efcde8b --- /dev/null +++ b/insnetanefficientflexibleandperformantinsertionbasedtextgenerationmodel/4e3e89d9-97b2-4e88-9485-2d2dea3f5ab3_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:64530d42414b961d7923e0a24c584eefe5e49641edfc29475e24f2912f5d417a +size 976947 diff --git a/insnetanefficientflexibleandperformantinsertionbasedtextgenerationmodel/full.md b/insnetanefficientflexibleandperformantinsertionbasedtextgenerationmodel/full.md new file mode 100644 index 0000000000000000000000000000000000000000..8814d4351403c14ed08070945126c9e22f3e7547 --- /dev/null +++ b/insnetanefficientflexibleandperformantinsertionbasedtextgenerationmodel/full.md @@ -0,0 +1,311 @@ +# INSNET: An Efficient, Flexible, and Performant Insertion-based Text Generation Model + +Sidi Lu, Tao Meng, Nanyun Peng + +University of California, Los Angeles + +{sidilu, tmeng, violetpeng}@cs.ucla.edu + +# Abstract + +We propose INSNET, an expressive insertion-based text generator with efficient training and flexible decoding (parallel or sequential). Unlike most existing insertion-based text generation works that require re-encoding of the context after each insertion operation and thus are inefficient to train, INSNET only requires one pass of context encoding for the entire sequence during training by introducing a novel insertion-oriented position encoding and a light-weighted slot representation strategy to enable computation sharing. Furthermore, we propose an algorithm INSNET-Dinic to better determine the parallelization of insertion operations that provides a controllable switch between parallel and sequential decoding, making it flexible to handle more parallelizable tasks such as machine translation with efficient decoding, or less parallelizable tasks such as open-domain text generation to guarantee high-quality outputs. Experiments on two lexically constrained text generation datasets and three machine translation datasets demonstrate INSNET's advantages over previous insertion-based methods in terms of training speed, inference efficiency, and generation quality. + +# 1 Introduction + +Insertion-based text generation that formulates the generation process as a sequence of token insertion operations has received increasing attention in recent years. There are two major advantages of insertion-based generation over the prevalent left-to-right auto-regressive paradigm: 1) It reduces the decoding cost to sub-linear w.r.t. the sequence length with parallel decoding (Stern et al., 2019; Gu et al., 2019b), and 2) the flexible insertion orders may better recover/utilize the underlying linguistic structures of languages (Welleck et al., 2019; Gu et al., 2019a). + +However, this new paradigm of text generation brings unique challenges, mostly in the training efficiency. Unlike left-to-right auto-regressive decoders which monotonically expand the context, the insertion operations complicate the position information of each token as the context expands. Concretely, as is shown in Figure 1, the absolute position of a token in a sequence constantly changes along with the insertion operations. As a result, a naive implementation of insertion-based models (e.g., Stern et al. (2019); Gu et al. (2019b)) needs to re-encode the context with updated positional information for each token as the insertions proceed, yielding inefficient training with $O(n)$ times of context re-encoding (with $n$ indicating the sequence length). + +To tackle this problem, previous insertion-based generation models such as Insertion Transformer (InsT) (Stern et al., 2019) and Levenshtein Transformer (LevT) (Gu et al., 2019b) propose parallel token insertion to reduce the insertion/re-encoding steps from $O(n)$ to $\Theta (\log n)$ for both training and inference. However, while it works well for machine translation, such parallel insertion falls short on high-entropy generation tasks such as open-domain dialogue systems(Li et al., 2017a), creative generation such as stories (Yao et al., 2019; Goldfarb-Tarrant et al., 2020; Han et al., 2022), poetry (Manurung et al., 2000; Tian and Peng, 2022), and humor generation (Hempelmann, 2008; He et al., + +![](images/15d18f2094236a26374044b43eb101df65b2dc76d9a12d96a78c613ac5185e2a.jpg) +Step t + +![](images/bfb56c2da2b2487208892994e6c6c2334539cbd1d533f0801e0e6d4db91cc7a2.jpg) + +![](images/4105da85378e2a17c9a4c9c8bd45feb3dfd054d4df4874a96c76acb599a1be21.jpg) + +![](images/633065abef626b0fed7da33b927b033eb1445217b1d6699769f86bdbbf54e6ad.jpg) +Step t+1 + +![](images/b1af9547bdc6f47c9a3ec4a31590d5625ebc4f8210b5a4dfa41fbc81604949a2.jpg) + +![](images/1884e1536ea37a9d5b814d00d3c64cbcd6d7e3ceab13bc932c143140d155e3e6.jpg) +Figure 1: The absolute position information of each token is volatile for insertion-based models. Thus, naive models with absolute position encoding have to re-encode the sequence after each insertion operation during training. + +![](images/e5a6160988017b5460868f7882468a1b50eff7037f8b158cefba88ac435dc7eb.jpg) + +![](images/2eafabe618263c46606c1f7a886848d8ab132865c989f25c776105c1a7f965c7.jpg) + +![](images/6b8099ac6611d2edd236c8d3f05b19d5d64b0befb1b4344a5ea3488154ab07d3.jpg) + +
Model#Re-Enc. w/ ParaDec#Re-Enc. w/ SeqDecPosInfo
Ins. Trans.Θ(log n)O(n)Absolute
Lev. Trans.Θ(log n)Ω(n)Absolute
NMSTGO(n)O(n)Markovian/Absolute
InDIGON/AO(1)Direction-only
INSNET (Ours)O(1)O(1)Relative
+ +Table 1: Comparisons between INSNET and existing insertion-based models regarding training-time re-encoding steps (#Re-Enc. columns) and how the models encode positional information (the PosInfo column). + +2019; Mittal et al., 2022; Tian et al., 2022; Sun et al., 2022), where the output is open-ended and the tokens are usually highly dependent on each other, thus cannot be inserted in parallel. Another thread of work seeks to maintain sequential insertions but simplify the position encoding for the tokens so that they do not change as the insertion operations proceed (Gu et al., 2019a) to save computation. However, this sacrifices model capability and limits its applications to complex sequences. + +In this paper, we propose INSNET, which addresses the training efficiency issue of insertion-based text generators by enabling computation sharing similar as that in vanilla decoder transformers. Our first contribution is an insertion-oriented, relative positional encoding coined offset that allows INSNET to achieve computation sharing without compromising model capacity. At each insertion step, previously computed position encodings of the existing tokens remain unchanged, while the position encodings of newly inserted tokens accurately recording the updated pairwise token spatial relations of all the inserted tokens. A corresponding offset can be efficiently computed for any given insertion order with a novel process named offset compression. In this way, we avoid expensive re-encoding of the context, and based on the encoded context, our second contribution is the design of an effective aggregation strategy that allows us to parallelly generate expressive slot representations for every slot in the partially generated sequence, flexibly support both sequential and parallel decoding. Finally, inspired by the layerization idea of Dinic's algorithm(Dinitz, 2006), we propose an algorithm for INSNET to better determine the parallelization of insertion operations in order to reduce the likelihood discrepancy before and after the parallelization. With all the components, INSNET is a novel framework that enables efficient training, flexible decoding, and expressive positional encoding. Table 1 shows a comparison between INSNET and all prior insertion-based models. + +# 2 Related Works and Background + +Auto-regressive Language Models minimize the negative-log-likelihood of a sequence of n tokens $s_{$ , but the resulting slot representation changes in response to a new step due to the introduction of the global vector. + +The slot representation can then be converted into a probabilistic distribution over the vocabulary to predict the log-likelihood of inserted tokens using a log-linear transformation i.e. $\log p(x_{i\downarrow j}^{(t)}|e_{i\downarrow j}^{(t)}) =$ log-softmax $(\mathbf{W}_p\pmb {e}_{i\downarrow j}^{(t)} + \pmb {b})_{x_{i\downarrow j}^{(t)}}$ . To decide which slot to insert next, a position logit $\alpha_{k}^{(t)} = w_{o}^{\top}e_{i_{k}\downarrow j_{k}}^{(t)}$ is computed for each slot $k$ with a linear layer. Then a (log-)soft-max operation is applied on top of the position logits to obtain the log-probability to insert to each candidate slot. i.e. $\log o(x_{i_k\downarrow j_k}^{(t)}|\{e_\downarrow^{(t)}\}) =$ log-softmax $([\alpha_0^{(t)},\alpha_1^{(t)},\dots ])_k$ + +We apply a binary classification $q(0/1|\cdot)$ on the last inserted token's representation $e_t$ to decide the termination of the generation at each step. During training, only the final step $q(0/1|e_{n-1})$ is trained to predict 1; all intermediate steps are trained to predict 0. In the following section, we will continue to discuss how to formulate the final objective function of INsNET using these step-wise distributions. + +# 3.3 Adaptive Parallelization of Insertions + +In addition to our efforts for better training efficiency, we also propose an algorithm to adaptively parallelize the generation process of INSNET to speed up the decoding while preserving the generation quality. The idea mimics the graph layerization process in the Dinic's algorithm (Dinitz, 2006). Specifically, assume that we partition the tokens into different layers, such that the tokens within the + +![](images/25be12e658b764e776147923266066ff22e42c6af2e41fbd469937abdad1ae24.jpg) +(a) Initial Layerization + +![](images/8d6469eed0e9f26fe6bca3bd4b7987c0e86672607d798af4e2c49d2e67114e81.jpg) +(b) Merged Layerization +Figure 5: (a) Initialized layerization of tokens after the pre-training stage. It assumes a fully sequential decoding process for now. (b) As the parallelization fine-tuning proceeds, the algorithm gradually merges different layers. Tokens within the same layer are safely parallelizable in decoding without sacrificing log-likelihood over the tolerance threshold $\tau$ . + +same layer are safe to insert in parallel without affecting the coherence of context. The algorithm aims to determine the partition such that the log-likelihood estimation of the resulting parallel insertion-based model is as close to the sequential insertion-based models as possible. The intuition is that the sequential insertion process maximally captures the inter-dependencies between the output tokens. By staying close to the sequential insertion-based model regarding likelihood prediction ability, we speed up the inference without severely sacrificing the likelihood estimation quality. + +We initialize the layerization with a sequential insertion order, which is equivalent to single-node layerization, as is illustrated in Figure 5(a). Starting from this initialization, we perform INsNET-Dinic to gradually evolve this fully-sequential layerization into a non-autoregressive, parallelized layerization, as shown in Figure 5(b). We promote a token $x \gets$ from its respective slot $(i^l, j^l)$ in layer $l$ to $(i^{l - 1}, j^{l - 1})$ in the previous layer $l - 1$ if two conditions are satisfied: 1) In layer $l - 1$ , slot $(i^{l - 1}, j^{l - 1})$ does not yet have an assigned insertion; 2) log $p(x \gets |e_{i^l \downarrow j^l}^{(l)}) - \log p(x \gets |e_{i^{l - 1} \downarrow j^{l - 1}}^{(l - 1)}) \leq \tau$ . + +Here $\tau$ is a hyper-parameter that controls how much to parallel. Intuitively, larger $\tau$ usually indicates more tolerance for token likelihood loss caused by parallel decoding, i.e. more parallelization with tradeoff on likelihood estimation accuracy. The choice of $\tau$ is highly task/data-dependent as it is a value associated with the likelihood. Note that the promotion of tokens only affects the slot representation computation and the insertion likelihood calculation of the respective insertion. When encoding the context (as is discussed in Section 3.1), we always treat it as if these insertion operations are performed sequentially. + +For a target sequence $s_{ModelBLEU-2/4Yelp ReviewBLEU-2/4NewsNIST-2/4# Dec. StepsNIST-2/4# Dec. StepsAuto-regressive Transformer (Plan-And-Write-static, Yao et al. (2019))16.68/5.462.79/2.8639.248.79/2.401.65/1.6736.74NMSTG (Welleck et al., 2019)10.06/1.921.11/1.1227.9210.67/1.582.70/2.7027.85InDIGO* (Gu et al., 2019a) (w/ Searched Adaptive Order)16.14/4.633.08/3.1045.6313.89/3.623.08/3.1026.78Levenshtein Transformer (Parallel Decoding, (Gu et al., 2019b))14.84/3.962.84/2.8914.2811.76/1.892.64/2.7116.13InsT-POINTER-Base (BERT init)11.48/2.162.15/2.156.0012.13/1.632.90/2.806.00InsT-POINTER-Base (BERT init+Wiki)15.63/3.323.27/3.306.0013.01/2.513.04/3.066.00InsT-POINTER-Large (BERT init+Wiki)16.78/3.793.49/3.536.0014.04/3.043.28/3.306.00INSNET (Ours, Fully-Sequential)19.36/5.783.51/3.5448.7316.31/4.963.10/3.1332.69INSNET-uniform (Ours)12.31/2.302.19/2.177.0012.89/2.012.99/2.907.00INSNET-Dinic (Ours, τ = 10.0)16.73/4.353.19/3.2011.8314.13/3.752.97/3.008.13 + +with parallel decoding on three classical datasets: WMT Ro-En, WMT En-De and WAT En-Ja. The general setup about how hyper-parameters are determined can be found in appendix?? + +# 4.1 Lexically Constrained Generation + +Experimental Setup Yelp Review dataset consists of 160K training sequences, 10K sequences for validation and 1k test sequences. News dataset consists of 268586 sentences in total, of which 10k are randomly selected as validation set, 1k for testing. YAKE1 is performed to the test split of each dataset to extract lexical constraints. + +We vary the hyperparameter $\tau$ in the range of $\{10.0, 3.0, 1.0, 0.3, -\infty$ (fully-sequential) and collect the results on both datasets. For position prediction, we are inserting into slots with positions lying in the top $70\%$ of the position distribution mass. For token prediction, we are doing top- $\{1, 1, 3, 3, 5\}$ sampling over the vocabulary distribution. The results are shown in Table 2, Figure 6(a) and 6(b). + +![](images/e36cb66c09e84a719621294fb43ca7786307e37c91e327107e1ee9a7eaac3b8c.jpg) +(a) Yelp Review + +![](images/56d64823aad6d10cdcbd056bb592c3358a16dc49ff8b7aeebb8af7e8c0effd31.jpg) +(b) News +Figure 6: Illustration of the spectral study results in terms of BLEU-4/Sequential Ratio in decoding on Yelp Review and News dataset. Sequential Ratio is computed by $\frac{Avg.\#Dec.\text{Steps}}{Avg.\text{Length}}$ +Discussion 1) INSNET is able to significantly outperform most previous works on the quality-latency trade-off spectrum. With more sequential flavor (i.e. smaller $\tau$ ), it is generally to achieve the new state-of-the-art in generation quality. Compared to a Plan-And-Write style autoregressive baseline, + +Table 3: Generation examples with insertion steps. Every row shows 3 consecutive steps with orange, green, blue represents the first, second, and third insertion, respectively. + +
Inputday decided started focus onlocal group hurt rule out
Step 3the day decided to started focus on .the local group hurt rule out of .
Step 6the day , he decided to get started focus on .the local group hurt the rule out of the of .
Step 9on the day , he decided to get started focus on the court .the local group hurt the government rule out of the of the year .
Step 12but on the next day , he decided to get started to focus on the court .the local group has hurt the government to rule out of the of the last year .
Step 15but , on the next day , he decided to get started to focus on the court for the .the local group has been hurt the government to rule out of for the rest of the last year .
Step 17but , on the next day , he decided to get started to focus on the court for the first time .the local group has been hurt by the government to rule out of support for the rest of the last year .
+ +INSNET guarantees the perfect incorporation of keywords due to its insertion-based nature. Also, its improved performance is consistent on both datasets. 2) When setting $\tau$ larger to encourage more parallelization of decoding, INSNET is mostly able to parallelize the insertions with good preservation of the generative quality. Compared to the vanilla uniformly-parallel setup (INSNET-uniform), INSNET-Dinic significantly improved the effectiveness of parallel decoding. + +Generation sample We also show two samples of the generation process in Table 3. It is interesting to observe that the model tends to insert punctuation and function words (e.g., Articles and Prepositions) first, and then more concrete content words. + +# 4.2 Non-autoregressive Machine Translation + +We train INsNET-Dinic models with $\tau = 2.00$ for extended investigation of the performance on machine learning problems. The results in Table 4 show that, INsNET-Dinic is able to achieve comparable or even better performance compared to previous state-of-the-art non-autoregressive (insertion-based) machine translation models in terms of generation quality and latency. + +# 4.3 Training Time Analysis + +To show the training efficiency of the proposed model, we hereby do an empirical and theoretical analysis on the candidate models' training procedure. See Table 5. For empirical results, the statistics are collected on the Yelp Review unsupervised lexically constrained text generation problem. All results are collected on a single NVIDIA RTX3090 GPU. The transformer Seq2seq baseline is trained + +Table 4: Machine translation evaluation. Each generation iteration of Levenshtein Transformer requires at least two full executions of the transformer model. Results with a star mark * are collected from our re-implementation. Other baseline results are directly taken from the original papers. The results for a vanilla transformer is taken from the LevT paper (Gu et al., 2019b). + +
ModelRo-EnEn-DeEn-Ja#Dec Step.Latency
InDIGO-SAO (w/o KD) (Gu et al., 2019a)32.4726.14*40.87*n516ms
InDIGO-random (w/o KD) (Gu et al., 2019a)20.2017.48*23.91*n502ms
InsT-uniform (+KD) (Stern et al., 2019)28.5226.7241.89*Θ(log n) ≤ 10107ms
InsT-binary (τ = 0.5, +KD) (Stern et al., 2019)30.6627.4142.17*Θ(log n) ≤ 1092ms
LevT (+KD)(Gu et al., 2019b)33.2627.2742.36Θ(log n) ≤ 2 × 10116ms
Vanilla Transformer (w/o KD)32.3027.1743.68n389ms
INSNET-uniform29.1326.4541.67Θ(log n) ≤ 1092ms
INSNET-Dinic (Ours, τ = 2.00)33.4127.3643.71Θ(log n) ≈ 15.8105ms
+ KD33.9128.0544.10Θ(log n) ≈ 16.1103ms
+ +Table 5: Empirical & theoretical comparative study of different algorithms' training efficiency. # of Steps/Seq means during training how many time the transformer needs to be executed per sequence. + +
ModelTtrain/Epoch# of Steps/Seq
Auto-regressive Decoder Transformer35min48s1
InDIGO-SAO58min36s + 2h12min(SAO)1 + O(n)
Insertion Transformer-Sequential26h31minO(n)
Levenshtein Transformer-Sequential37h24minO(n)
Insertion Transformer8h24minΘ(log n)
Levenshtein Transformer16h33minΘ(log n)
InsT- POINTER9h36minΘ(log n)
INSNET/INSNET-Dinic1h12min1
+ +as a Plan-And-Write model. POINTER's training time per epoch is calculated with the official implementation with mixed precision supported by the NVIDIA APEX library $^{2}$ . + +Discussion The results in Table 5 confirm the significant improvement in training efficiency of INSNET over most previous baselines. In addition, this concretely shows that it is not practically affordable to obtain a sequential insertion-based generator directly with InsT/LevT. Note that SAO of InDIGO is an offline, inference-only algorithm that does not require any computation of gradients. Thus its constant factor is significantly smaller than other $O(n)$ gradient-propagating procedures. According to its original paper and our previous experiments, InDIGO practically needs this process to achieve reasonable performance. + +# 4.4 Ablation Study on the Effectiveness of Components + +Since the model components of InsNet are closely entangled, it is nontrivial to do ablation study. We design experiments to show that 1). The proposed offset matrix is a powerful insertion-oriented position encoding with significantly better capacity. We show that this particularly helps the model learn to terminate the sequence in correct timings. To study this, we truncate the offset matrix to range $[-1.0, 1.0]$ (InsNet-truncated) so that it is similar to InDIGO's position encoding, and 2) the global representation is necessary for computing the slot representation in INSNET. It in general helps to improve the sequence termination performance, and leads to convergence to better local optimum. We report the results of an ablated version of InsNet without global representation (InsNet-noglobal). + +The termination NLL (see Sec 3.3 for its definition) and BLEU scores for each model can be found in appendix Table ??. We also show some random samples from the ablated variants and the failure cases can be find in appendix Table ?? + +# 5 Conclusion & Future Work + +We propose INSNET, an efficient and performant insertion-based generator that supports sequential and parallel decoding. Experiments on two unsupervised lexically constrained text generation datasets and three machine translation datasets show the advantages of INSNET over previous methods. + +Future work can explore obtaining a large-scale pre-trained version of INsNET for further fine-tuning under different downstream scenarios. We anticipate such insertion-based models to have better compositional generalizability and controllability. + +# Acknowledgement + +We thank I-Hung Hsu, Dr. Rujun "RJ" Han, Te-Lin Wu, Kai-Wei Chang, Sarik Ghazarian, Alexander Spangher, Yining Hong, Mingyu Derek Ma and all other members from PlusLabNLP/UCLANLP group for their participation in initial discussions and comments on paper writing. We would like to thank Huggingface for their great work of the Transformers project. The work is partially supported by a Meta SRA and an Amazon research gift. + +# References + +Dzmitry Bahdanau, Kyung Hyun Cho, and Yoshua Bengio. 2015. Neural machine translation by jointly learning to align and translate. 3rd International Conference on Learning Representations, ICLR 2015; Conference date: 07-05-2015 Through 09-05-2015. +Tom B Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. 2020. Language models are few-shot learners. arXiv preprint arXiv:2005.14165. +Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc Le, and Ruslan Salakhutdinov. 2019. Transformer-XL: Attentive language models beyond a fixed-length context. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 2978-2988, Florence, Italy. Association for Computational Linguistics. +Yefim Dinitz. 2006. Dinitz'algorithm: The original version and even's version. In Theoretical computer science, pages 218-240. Springer. +Seraphina Goldfarb-Tarrant, Tuhin Chakrabarty, Ralph Weischedel, and Nanyun Peng. 2020. Content planning for neural story generation with aristotelian rescoring. In the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 4319-4338. +Jiatao Gu, Qi Liu, and Kyunghyun Cho. 2019a. Insertion-based decoding with automatically inferred generation order. Transactions of the Association for Computational Linguistics, 7:661-676. +Jiatao Gu, Changhan Wang, and Jake Zhao. 2019b. Levenshtein transformer. arXiv preprint arXiv:1905.11006. +Rujun Han, Hong Chen, Yufei Tian, and Nanyun Peng. 2022. Go back in time: Generating flashbacks in stories with event temporal prompts. In 2022 Annual Conference of the North American Chapter of the Association for Computational Linguistics (NAACL). +He He, Nanyun Peng, and Percy Liang. 2019. Pun generation with surprise. In 2019 Annual Conference of the North American Chapter of the Association for Computational Linguistics (NAACL-HLT 2019), volume 1. +Christian F Hempelmann. 2008. Computational humor: Beyond the pun? The Primer of Humor Research. Humor Research, 8:333-360. +Jiwei Li, Will Monroe, Tianlin Shi, Sebastien Jean, Alan Ritter, and Dan Jurafsky. 2017a. Adversarial learning for neural dialogue generation. arXiv preprint arXiv:1701.06547. +Xiujun Li, Yun-Nung Chen, Lihong Li, Jianfeng Gao, and Asli Celikyilmaz. 2017b. End-to-end task-completion neural dialogue systems. arXiv preprint arXiv:1703.01008. +Yinhan Liu, Jiatao Gu, Naman Goyal, Xian Li, Sergey Edunov, Marjan Ghazvininejad, Mike Lewis, and Luke Zettlemoyer. 2020. Multilingual denoising pre-training for neural machine translation. Transactions of the Association for Computational Linguistics, 8:726-742. +Hisar Manurung, Graeme Ritchie, and Henry Thompson. 2000. Towards a computational model of poetry generation. Technical report, The University of Edinburgh. +Anirudh Mittal, Yufei Tian, and Nanyun Peng. 2022. Ambipun: Generating humorous puns with ambiguous context. In 2022 Annual Conference of the North American Chapter of the Association for Computational Linguistics (NAACL), short. +Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. 2018. Improving language understanding by generative pre-training. +Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9. +Peter Shaw, Jakob Uszkoreit, and Ashish Vaswani. 2018. Self-attention with relative position representations. arXiv preprint arXiv:1803.02155. + +Yong-Siang Shih, Wei-Cheng Chang, and Yiming Yang. 2019. Xl-editor: Post-editing sentences with xlnet. arXiv preprint arXiv:1910.10479. +Mitchell Stern, William Chan, Jamie Kiros, and Jakob Uszkoreit. 2019. Insertion transformer: Flexible sequence generation via insertion operations. In International Conference on Machine Learning, pages 5976-5985. PMLR. +Jiao Sun, Anjali Narayan-Chen, Shereen Oraby, Shuyang Gao, Tagyoung Chung, Jing Huang, Yang Liu, and Nanyun Peng. 2022. Context-situated pun generation. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing (EMNLP). +Bowen Tan, Zichao Yang, Maruan Al-Shedivat, Eric P Xing, and Zhiting Hu. 2020. Progressive generation of long text. arXiv preprint arXiv:2006.15720. +Yufei Tian, Divyanshu Arun Sheth, and Nanyun Peng. 2022. A unified framework for pun generation with humor principles. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing (EMNLP). +Yufei Tian and Nanyun Peng. 2022. Zero-shot sonnet generation with discourse-level planning and aesthetics features. In 2022 Annual Conference of the North American Chapter of the Association for Computational Linguistics (NAACL). +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In NIPS. +Oriol Vinyals, Alexander Toshev, Samy Bengio, and Dumitru Erhan. 2015. Show and tell: A neural image caption generator. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 3156-3164. +Sean Welleck, Kianté Brantley, Hal Daumé Iii, and Kyunghyun Cho. 2019. Non-monotonic sequential text generation. In International Conference on Machine Learning, pages 6716-6726. PMLR. +Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron Courville, Ruslan Salakhudinov, Rich Zemel, and Yoshua Bengio. 2015. Show, attend and tell: Neural image caption generation with visual attention. In Proceedings of the 32nd International Conference on Machine Learning, volume 37 of Proceedings of Machine Learning Research, pages 2048-2057, Lille, France. PMLR. +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, and Quoc V Le. 2019. XLnet: Generalized autoregressive pretraining for language understanding. arXiv preprint arXiv:1906.08237. +Lili Yao, Nanyun Peng, Ralph Weischedel, Kevin Knight, Dongyan Zhao, and Rui Yan. 2019. Plan-and-write: Towards better automatic storytelling. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 7378-7385. +Yizhe Zhang, Guoyin Wang, Chunyuan Li, Zhe Gan, Chris Brockett, and Bill Dolan. 2020. Pointer: Constrained text generation via insertion-based generative pre-training. arXiv preprint arXiv:2005.00558. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] +(c) Did you discuss any potential negative societal impacts of your work? [No] +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] + +(b) Did you include complete proofs of all theoretical results? [Yes] Most theoretical results are self-explanatory. + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [No] They will be released upon camera ready. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] +(b) Did you mention the license of the assets? [Yes] +(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [Yes] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/insnetanefficientflexibleandperformantinsertionbasedtextgenerationmodel/images.zip b/insnetanefficientflexibleandperformantinsertionbasedtextgenerationmodel/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..d72c8c061fc4e10fdf8ba61abb49b719ff7f4edb --- /dev/null +++ b/insnetanefficientflexibleandperformantinsertionbasedtextgenerationmodel/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5d81dcb9782cd5e8e9090e2f5af37e4da5082175b1bba1b47617b9edd5a505bf +size 647898 diff --git a/insnetanefficientflexibleandperformantinsertionbasedtextgenerationmodel/layout.json b/insnetanefficientflexibleandperformantinsertionbasedtextgenerationmodel/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..76450774283cb3a14b3282b59acb7be3c2eaeaa0 --- /dev/null +++ b/insnetanefficientflexibleandperformantinsertionbasedtextgenerationmodel/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b53b32694c594a5d9fbd5549805af6a7a19c36f148c07cece688bf77c230cef5 +size 382718 diff --git a/inspropropagatinginstancequeryandproposalforonlinevideoinstancesegmentation/7385cca1-8f9e-408a-9801-863b89429793_content_list.json b/inspropropagatinginstancequeryandproposalforonlinevideoinstancesegmentation/7385cca1-8f9e-408a-9801-863b89429793_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..41aaf7f0bf29691a88428f6ab7433e12abc07fcf --- /dev/null +++ b/inspropropagatinginstancequeryandproposalforonlinevideoinstancesegmentation/7385cca1-8f9e-408a-9801-863b89429793_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7426a48357734c824f49c56163a7fe6a0154b23609f9d6b268f2e5464ddc5873 +size 86063 diff --git a/inspropropagatinginstancequeryandproposalforonlinevideoinstancesegmentation/7385cca1-8f9e-408a-9801-863b89429793_model.json b/inspropropagatinginstancequeryandproposalforonlinevideoinstancesegmentation/7385cca1-8f9e-408a-9801-863b89429793_model.json new file mode 100644 index 0000000000000000000000000000000000000000..ab3c06d436de783c1de712e00113a1d38fee0246 --- /dev/null +++ b/inspropropagatinginstancequeryandproposalforonlinevideoinstancesegmentation/7385cca1-8f9e-408a-9801-863b89429793_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e630b6a738803c6bdd696cb93944f06c32907434deab74cbf669f9235db2e79c +size 109835 diff --git a/inspropropagatinginstancequeryandproposalforonlinevideoinstancesegmentation/7385cca1-8f9e-408a-9801-863b89429793_origin.pdf b/inspropropagatinginstancequeryandproposalforonlinevideoinstancesegmentation/7385cca1-8f9e-408a-9801-863b89429793_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..78a96d69abb4e3b19da83a59eb5e5599094d07c5 --- /dev/null +++ b/inspropropagatinginstancequeryandproposalforonlinevideoinstancesegmentation/7385cca1-8f9e-408a-9801-863b89429793_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5eb01f6c571b909faab50d8ed52a1ab0ecfce48686a6ce35bd58d3442fc4da43 +size 2071261 diff --git a/inspropropagatinginstancequeryandproposalforonlinevideoinstancesegmentation/full.md b/inspropropagatinginstancequeryandproposalforonlinevideoinstancesegmentation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..6762d348c2bcef6d0212a5b8c7d27216237ef900 --- /dev/null +++ b/inspropropagatinginstancequeryandproposalforonlinevideoinstancesegmentation/full.md @@ -0,0 +1,327 @@ +# InsPro: Propagating Instance Query and Proposal for Online Video Instance Segmentation + +Fei He $^{1,2}$ , Haoyang Zhang $^{4}$ , Naiyu Gao $^{4}$ , Jian Jia $^{1,2}$ , Yanhu Shan $^{4}$ , Xin Zhao $^{1,2*}$ , Kaiqi Huang $^{1,2,3}$ + +$^{1}$ CRISE, Institute of Automation, Chinese Academy of Sciences + +$^{2}$ School of Artificial Intelligence, University of Chinese Academy of Sciences + +3 CAS Center for Excellence in Brain Science and Intelligence Technology 4 Horizon Robotics + +{hefei2018, jiajian2018}@ia.ac.cn, {haoyang.zhang, naiyu01.gao, yanhu.shan}@horizon.ai{xzhao, kaiqi.huang}@nlpr.ia.ac.cn + +# Abstract + +Video instance segmentation (VIS) aims at segmenting and tracking objects in videos. Prior methods typically generate frame-level or clip-level object instances first and then associate them by either additional tracking heads or complex instance matching algorithms. This explicit instance association approach increases system complexity and fails to fully exploit temporal cues in videos. In this paper, we design a simple, fast and yet effective query-based framework for online VIS. Relying on an instance query and proposal propagation mechanism with several specially developed components, this framework can perform accurate instance association implicitly. Specifically, we generate frame-level object instances based on a set of instance query-proposal pairs propagated from previous frames. This instance query-proposal pair is learned to bind with one specific object across frames through conscientiously developed strategies. When using such a pair to predict an object instance on the current frame, not only the generated instance is automatically associated with its precursors on previous frames, but the model gets a good prior for predicting the same object. In this way, we naturally achieve implicit instance association in parallel with segmentation and elegantly take advantage of temporal clues in videos. To show the effectiveness of our method InsPro, we evaluate it on two popular VIS benchmarks, i.e., YouTube-VIS 2019 and YouTube-VIS 2021. Without bells-and-whistles, our InsPro with ResNet-50 backbone achieves 43.2 AP and 37.6 AP on these two benchmarks respectively, outperforming all other online VIS methods. + +# 1 Introduction + +Video instance segmentation (VIS) [1] is a challenging but important computer vision task. It requires not only segmenting object instances on each video frame but also associating them across all frames. Due to its fine-grained object representation form, it has got a wide range of applications in various areas such as autonomous driving and video editing. + +Existing VIS methods can be categorized into two groups: frame-level methods and clip-level methods. Frame-level methods [1, 2, 3, 4] generally follow a 'tracking-by-detection' paradigm, which first generate per-frame object instances by existing instance segmentation models [5, 6], and then associate them across frames via additional tracking heads (as shown in Figure 1 (a)). In comparison, clip-level methods [7, 8, 9, 10] take a 'clip-matching' paradigm, which divide a video + +![](images/268cb16941d2bb54403386cb983994bdd816d729754b51097e8aaf8d9f197b20.jpg) +(a) Previous VIS paradigm + +![](images/34520a48fc27e9fe333f2adc847a0ed5371f6c9ce15a08660a69b452a5c9bd10.jpg) +(b) Our InsPro +Figure 1: (a) Previous methods take a two-step approach to VIS. They first generate object instances and then perform explicit instance association to link them across frames. (b) Our InsPro implements implicit instance association through a temporal propagation mechanism, achieving object instance segmentation and tracking in one shot. It generates frame-level object instances based on a set of instance query and proposal pairs propagated from previous frames. Since the instance query-proposal pair is learned to represent one specific object across frames, the instance association is naturally achieved in parallel with segmentation and video temporal clues are elegantly exploited meanwhile. + +into multiple overlapped clips, generate instance predictions for each clip, and then associate these clip-level predictions by some hand-crafted instance matching algorithms. Whether frame-level or clip-level methods, both of them inevitably need an explicit instance association step to fulfill object tracking. This generally requires to design a complicated association strategy to achieve good tracking performance, which is not trivial. More importantly, the explicit association step increases model complexity and slows inference speed. Furthermore, this extra step also indicates that the temporal clues intrinsic in videos are not well utilized, as the instance prediction is performed separately on each frame or each clip. + +In this work, inspired by the recent success of query-based object detectors [11, 12], we propose a simple, fast and yet effective query-based framework for online VIS. Our system, dubbed as InsPro, segments and tracks objects in one shot through an instance query and proposal propagation strategy with carefully designed modules (Figure 1 (b)), which eliminates the explicit instance association step. Specifically, our approach generates frame-level object instances based on a set of instance query-proposal pairs propagated from previous frames. In the learning process, we develop several techniques to make sure that the generated instance query-proposal pair corresponds to one specific object across frames. Thus, when an object instance is generated using such a query-proposal pair on the current frame, it is automatically associated with its precursors on all previous frames. In this way, we achieve implicit object association without a linking step. Meanwhile, this instance query-proposal propagation mechanism also enables our VIS system to achieve a better prediction accuracy (see Table 1). This benefits from the instance query-proposal pair's encoding one object's temporal and spatial information across all previous frames, which provides a very good prior for the model to infer the same object on the current frame. In this sense, our query-based VIS method actually implements an efficient way to exploit the intrinsic temporal clues in videos. + +To fulfill the advantages of our VIS system, learning exclusive and expressive instance query-proposal pairs is the key. In this work, we develop several strategies to ensure the learning effectiveness. First, we design a temporally consistent matching mechanism to enforce the one-to-one correspondence between the instance query-proposal pair and a specific ground truth object across frames during training. Second, we propose a box dedduplication loss to enlarge the distance between instance proposals. This helps suppress duplicate proposals on the same object and increase the exclusivity of the generated instance query-proposal pair. At the same time, the sparsely distributed unoccupied query-proposal pairs can serve as candidates in the next frame to detect new objects, allowing our system to achieve new object detection and tracking effortlessly. Third, we propose an intra-query attention module that enhances instance query with its predecessors encoding the same object. This explicitly aggregates long-range object information into the query, augmenting its representation capacity, which helps handle occlusion and motion blur. + +To validate the effectiveness and efficiency of our InsPro, we conduct extensive experiments on two popular VIS benchmarks [1], i.e., YouTube-VIS 2019 and YouTube-VIS 2021. Without bells-and-whistles, our InsPro with ResNet-50 [13] backbone achieves 43.2 AP on YouTube-VIS 2019 and 37.6 AP on YouTube-VIS 2021 respectively, outperforming all other online VIS models. Moreover, our + +lite variant, InsPro-lite, reaches 38.7 AP on YouTube-VIS 2019 at impressive 45.7 FPS on a Nvidia RTX2080Ti GPU. + +In summary, we make the following contributions in this paper. 1) We propose a simple, fast and yet effective query-based framework for online VIS. 2) We develop several techniques to make the query-proposal pair propagation mechanism work smoothly. These techniques distinguish our work from other query propagation-based object association methods [14, 15, 16], and make our work simpler, more elegant and more effective than them. 3) Our VIS system achieves the state-of-the-art performances on two popular VIS benchmarks. + +# 2 Related Work + +Frame-level VIS Methods mainly adopt a 'tracking-by-detection' paradigm and can run in an online fashion. They first generate instance predictions frame by frame and then perform explicit instance association. MaskTrack R-CNN [1] first proposes the VIS task and simply adds an additional tracking head to Mask R-CNN [5] for instance association. Follow-up works [2, 3, 4, 17] improve either the segmentation or the tracking algorithm to achieve better performance. On the other hand, some works [8, 18, 19, 20, 21, 22] attempt to perform temporal feature fusion to improve instance segmentation and association. For example, PCAN [22] proposes frame- and instance-level prototypical cross-attention modules to leverage rich spatio-temporal information to facilitate better segmentation. All these methods require additional modules to achieve explicit instance association, which expands model complexity and reduces inference speed. By contrast, our method performs instance association implicitly through an instance query and proposal propagation mechanism, which is simpler and naturally exploits the temporal and spatial consistency in videos. + +Clip-level VIS Methods take a 'clip-matching' paradigm, which process multiple frames within a clip simultaneously and then perform instance matching between clips to complete VIS. While some methods [7, 23, 9] propagate instance information within a clip with well-designed propagation modules to model temporal context, recent works [8, 10] utilize transformer [24] to model temporal context in an end-to-end manner. These methods normally need hand-crafted matching algorithms to complete instance association between clips. Although they usually achieve high performance, they can only run in an offline mode, which restricts their application to limited areas. In contrast, our method achieves comparable performance but can run online. + +Query-based Methods have attracted increasing attention in recent years due to their flexibility and simplicity. DETR [11] first uses a set of learned queries interacting with image features to encode objects, and then directly outputs detections by decoding the transformed queries. Following works [25, 26, 27, 28, 29] improve DETR in terms of either training efficiency or detection performance. Sparse R-CNN [12] builds a query-based detector on top of R-CNN architecture [30, 31]. Its follow-up works [3, 32] extend it to instance segmentation and video object detection. Besides, Max-DeepLab [33] proposes a box-free panoptic segmentation method with external query. DAFL [34] uses a set of queries to encode pedestrian information for pedestrian attribute recognition. + +The success of DETR has also inspired query-based VIS methods. VisTR [8] adapts DETR to the VIS task. It takes a video clip as input and directly outputs the sequence of masks for each instance orderly. IFC [10] proposes inter-frame communication transformers to reduce the heavy computation and memory usage of VisTR-like VIS methods. Similar to VisTR, Mask2Former [35] applies masked attention to a video clip and directly predicts a 3D instance volume. To learn a powerful video-level instance query, SeqFormer [36] aggregates temporal information from each frame to the instance query. These methods work on clips rather than frames, and achieve object association through sharing of the queries within a clip rather than query propagation. Thus, they still need instance matching between clips. Instead, our method applies to frames, and can propagate query-proposal pairs through the entire video and thereby can associate object instances over any frame length. + +Query Propagation-based Object Association Methods have been recently explored in several works, such as TransTrack [14], TrackFormer [15], MOTR [16] and EfficientVIS [37], which are also inspired by query-based methods [11, 12]. This shows the effectiveness and potential of such a new object linking approach. The differences between our InsPro and them are as follows. + +![](images/aaa4b3f75fe54aa6955135d3e5722d77eb9b619056439fb3cae9ac2bdf08d23f.jpg) +(a) Overview of InsPro + +![](images/54846e9511fda037d5f7b25ef9558159a3b3bf866b1a26c4799a430da0ec0372.jpg) +(b) Details of SegHead +Figure 2: (a) Overview of our InsPro. It performs VIS by propagating instance query-proposal pairs across frames. $\pmb{q}_{init} \in \mathbb{R}^{N \times C}$ and $\pmb{p}_{init} \in \mathbb{R}^{N \times 4}$ are initial instance queries and proposals on the first video frame, respectively. They are used in SegHead to predict instance results $\pmb{r}_0$ on frame $I_0$ , and to produce updated $\pmb{q}_0$ and $\pmb{p}_0$ which are propagated to the next frame. By repeating this process, we complete the VIS task. (b) Details of SegHead. It is a multi-stage network, consisting of a dynamic instance interaction module (DIIM) and an instance segmentation module. The former transforms instance queries with RoI features of corresponding proposals and produces object features, while the latter predicts object instances based on the object features and conditional convolution [39]. + +First, our InsPro is different from them in the way of either tracking seen objects or detecting new objects. TransTrack is basically a 'tracking-by-detection' method, because it still needs to explicitly match detection boxes to tracked boxes in each frame, while our InsPro performs implicit association. More importantly, TransTrack, TrackFormer and MOTR adopt a track query subset to track seen objects and an extra object query subset to detect new objects. This requires additional heuristic rules to combine two type queries, and may miss occluded or blurred objects with low scores, which can result in object trajectory break [38]. Our InsPro simply propagates all object queries produced in the previous frame to the current frame, and keeps using this set to track seen objects and detect new objects, which is much simpler and more elegant. As for EfficientVIS, our concurrent work, it does not consider this new object detection problem, and its performance will probably be impacted greatly if there are new objects in the next clip. + +Furthermore, we design a more intelligent strategy to suppress duplicates. TransTrack and TrackFormer employ score filtering or NMS to reduce duplicate predictions. MOTR builds a temporal aggregation network to learn more discriminative features to address this problem, while EfficientVIS does not discuss this problem. By contrast, we design a Box Dedduplication Loss to suppress duplicates and an Inter-query attention module to enhance queries with their predecessors. Our solution avoids heuristic rules and post-processing steps, and is more effective according to the experimental results (see Table 2 (e)). + +# 3 InsPro + +We aim to design a simple and fast VIS system that performs instance association implicitly and exploits video temporal clues elegantly. To this end, we take a query-based VIS approach that predicts object instances on each frame based on a set of instance query-proposal pairs propagated from previous frames. In this section, we introduce our VIS system, InsPro, including an instance query and proposal propagation mechanism and an instance segmentation head. Meanwhile, we also describe those proposed techniques that make our propagation mechanism work well. + +# 3.1 Instance Query and Proposal Propagation + +The instance query and proposal propagation mechanism enables our VIS system to perform object instance association implicitly in parallel with instance segmentation. Since it is inspired by the recent query-based object detector Sparse R-CNN [12], we first briefly review Sparse R-CNN. + +Sparse R-CNN [12] formulates object detection as a set prediction problem and achieves state-of-the-art performance. It simplifies the detection pipeline and removes heuristic components like NMS. Specifically, it first initializes a fixed set of learnable instance queries $(N\times C,N$ denotes the number of queries and $C$ the query dimension) paired with learnable instance proposals $(N\times 4)$ to describe objects in an image. As illustrated in Figure 2 (b), each instance query is convolved with the RoI feature of the corresponding proposal to output a more discriminate feature $o_{t}$ [12]. After multi-stage iterative updating, the instance query encodes more accurate object appearance information while the proposal captures more precise location. Finally, decoding the object feature $o_{t}$ produced using the instance query-proposal pairs, we get the detection results. + +Inspired by this instance query-proposal representation of an object, we design a query-proposal temporal propagation mechanism (as shown in Figure 2 (a)) to achieve implicit object instance association and temporal cue utilization in VIS. Our key insight is that there is a one-to-one correspondence between the learned instance query-proposal pair and a specific object. If we manage to preserve this correspondence from the first frame to the one where the object finally disappears, then we realize object tracking and object information propagation spontaneously. + +To this end, we first initialize a set of instance queries $\pmb{q}_{init} \in \mathbb{R}^{N \times C}$ and proposals $\pmb{p}_{init} \in \mathbb{R}^{N \times 4}$ on the first video frame $I_0$ , where $\pmb{q}_{init}$ and $\pmb{p}_{init}$ are learnable parameters and arranged in pairs. After learning, they are able to encode objects on the first frame. Decoding them with the first frame image feature inside the SegHead, we obtain instance results $\pmb{r}_0$ as well as a new set of updated pairs $(\pmb{q}_0, \pmb{p}_0)$ . Then we propagate this pair set $(\pmb{q}_0, \pmb{p}_0)$ to the next frame as input to the SegHead. Similarly, we get the instance results $r_1$ and another new set of $(\pmb{q}_1, \pmb{p}_1)$ on this frame. Among them, the object instance produced on this frame shares the same ID with the one on the previous frame if they are both decoded by the same slice of the instance queries. In this way, we automatically link object instances belonging to an identical object across frames and elegantly make use of object priors from the past. Repeating the above process until the last video frame, we then accomplish the VIS task on this video. + +Please note that our InsPro simply propagates all object queries produced in the previous frame to the current frame, and keeps using this set to track seen objects and detect new objects. Instead, recent works [14, 15, 16] that take a similar query-propagation mechanism use a track query set to track seen objects and a new object query set to detect new objects respectively, which requires additional heuristic rules to combine these two type queries. Moreover, they rely on hand-crafted rules like a score threshold to select a subset of track queries, and occluded objects with low prediction scores are probably filtered out, which results in non-negligible true object missing and fragmented trajectories [38]. In comparison, our method is obviously simpler, more elegant and more effective (see Table 2 (e)). + +Intra-query Attention Since frame-by-frame temporal propagation encodes only short-range temporal cues, the instance query from just the last frame shows limitations in dealing with tough scenarios, e.g., occlusion and motion blur. To boost the representation capacity of instance query, we augment it in practice with instance features from previous $T$ frames [40, 41]. Specifically, we build a feature bank that caches instance features from previous $T$ frames and perform intra-query attention inside this bank to aggregate long-range temporal cues into the current instance query, as shown in the upper part of Figure 2 (b). Formally, at frame $I_{t}$ , instance features $\mathbf{o}$ from previous $T$ frames are put together to form a feature bank $fb = \{o_{t - T + 1},\dots,o_t\}$ . Then, the enhanced instance query is computed as: + +$$ +\boldsymbol {q} _ {t} ^ {i} = \frac {\sum_ {n = 0} ^ {T - 1} \boldsymbol {o} _ {t - n} ^ {i} \exp (\varepsilon \left(\boldsymbol {o} _ {t - n} ^ {i}\right))}{\sum_ {m = 0} ^ {T - 1} \exp (\varepsilon \left(\boldsymbol {o} _ {t - m} ^ {i}\right))} + \boldsymbol {o} _ {t} ^ {i}, \tag {1} +$$ + +where $i$ denotes the $i$ -th query and $\varepsilon(\cdot)$ is a linear transformation function. The enhanced $\mathbf{q}_t$ is basically a weighted sum of instance features inside the feature bank, and the weights are learned upon the quality of the queries. Experiments (Table 6 (c)) show that this augmentation improves the query representation capacity greatly. + +# 3.2 Segmentation Head + +The segmentation head transforms the instance query and performs instance segmentation on each frame. As illustrated in Figure 2 (b), it is a multi-stage network and has two main parts: a dynamic instance interaction module and an instance segmentation module. + +Dynamic Instance Interaction Module transforms the instance query with the proposal RoI feature and yields object features. It has $M$ stages and forms an iterative structure. At the first stage, given a pair of instance queries $\pmb{q}_{t-1} \in \mathbb{R}^{N \times C}$ and proposals $\pmb{p}_{t-1} \in \mathbb{R}^{N \times 4}$ that propagated from the previous frame $I_{t-1}$ , it first augments the instance queries by a self-attention module [24], which models the inter-query relations. At the same time, it extracts the RoI feature of each proposal on the feature map by RoIAAlign [5]. Then, each enhanced instance query convolves with its corresponding RoI feature through dynamic convolution [42] to get the object feature $\pmb{o}_t \in \mathbb{R}^{N \times C}$ . Since the object feature absorbs temporal cues encoded in instance queries, it has better representation ability than the single-frame RoI feature (see Table 2 (d)). The object feature is used to predict object instances in the following instance segmentation module, and the newly generated object boxes together with the object features proceed as input to the next stage in the iterative process. At the final stage, the object feature is processed together with its precursors from previous frames through the aforementioned intra-query attention module, to produce instance queries for the next frame. + +Instance Segmentation Module decodes the object feature $\pmb{o}_t$ and produces VIS predictions. It has three main heads. While the classification head predicts object classes, the regression one generates object boxes. Another mask head is responsible for producing instance masks through a conditional convolution [39] approach. Specifically, it first uses $\pmb{o}_t$ to generate conditional convolution weights in weight generator. As shown in Figure 2 (b), it inputs $\pmb{o}_t^i$ that represents the $i$ -th object instance feature to the weight generator and outputs a set of convolution parameters $\omega_i$ . Meanwhile, it produces mask feature maps by transforming FPN [43] feature maps through a mask branch. Note that the output mask feature maps have 8 channels and a $\frac{1}{8}$ resolution of the input image, and are boosted by concatenating a 2-channel relative coordinates map to it. This relative coordinates map is computed using the center of predicted object boxes and provides strong location cues for predicting instance masks. Finally, we feed the combined feature maps $f_t^{mask} \in \mathbb{R}^{10 \times \frac{H}{8} \times \frac{W}{8}}$ and convolution parameters $\omega_i$ to a mask FCN head, predicting the $i$ -th object instance mask via a conditional convolution: + +$$ +\boldsymbol {m} _ {t} ^ {i} = \operatorname {C o n d C o n v} \left(\boldsymbol {f} _ {t} ^ {\text {m a s k}}, \boldsymbol {\omega} _ {i}\right). \tag {2} +$$ + +For more details about the instance segmentation module, please refer to [39]. + +# 3.3 Temporally Consistent Matching + +The key to the success of our InsPro is to make sure that the evolving instance query-proposal pair corresponds to the same object across frames in a video. To ensure this, one technique we propose is temporally consistent matching. This technique matches predictions and ground truth during training, assigns each ground truth object a proper prediction, and propagates the matching made on previous frames to subsequent frames. + +Specifically, given a training batch consisting of multiple consecutive frames, we first compute the matching cost $L_{match}$ between predictions and ground truth objects on the first frame: + +$$ +\mathcal {L} _ {\text {m a t c h}} = \lambda_ {c l s} \cdot \mathcal {L} _ {c l s} + \lambda_ {L 1} \cdot \mathcal {L} _ {L 1} + \lambda_ {\text {g i o u}} \cdot \mathcal {L} _ {\text {g i o u}}, \tag {3} +$$ + +where $\mathcal{L}_{cls}$ is the focal loss [44] between predicted classifications and ground-truth labels, $\mathcal{L}_{L1}$ and $\mathcal{L}_{\mathrm{giou}}$ are L1 loss and the generalized IoU loss [45] between predicted boxes and ground-truth boxes, respectively. $\lambda_{cls}$ , $\lambda_{L1}$ and $\lambda_{\mathrm{giou}}$ are loss weights and set as 2, 5, and 2, respectively. + +We search for the best bipartite matching that minimizes the matching cost $L_{match}$ with the Hungarian algorithm [46]. After finding the best matching on the first frame, we propagate this matching to other frames. Concretely, if one ground truth object still exists on subsequent frames, it will be matched to the prediction that is generated by the same instance query on the first frame. If there are new objects emerging, new matching will be made between the new objects and yet unmatched predictions. If a ground truth object disappears, its corresponding predictions will not participate in a new matching process. Through this temporally consistent matching mechanism, we bind one ground truth object to a single instance query during training. + +# 3.4 Loss Function + +Box Dedduplication Loss Although the self-attention mechanism between queries has driven the model to generate fewer duplication predictions [11], we still observe multiple overlapped proposal + +![](images/d766ed51bf8c31808a23f63d8b28a6839b3f16986c5d10fd33c8193c31896c0f.jpg) +Figure 3: (a) Multiple duplicate boxes exist on the same object across frames. (b) After applying the proposed box dedduplication loss (BDL) in training, the duplicate predictions are significantly suppressed along with temporal propagation. + +boxes on the same object across many frames, as displayed in Figure 3 (a). We conjecture this is caused by those unmatched queries which cannot be pushed away from those matched queries due to lack of supervision. To address this problem, we propose a box dedduplication loss to push away prediction boxes in terms of the center-to-center distance between them. As a result, not only the duplication problem is alleviated, but the sparsely distributed unmatched query-proposal pairs can serve as candidates in the next frame to detect and track new objects (see Figure 7 in Appendix). The loss is defined as: + +$$ +\mathcal {L} _ {\text {d e d u p}} = \frac {1}{k} \sum_ {i = 1} ^ {k} \max (\beta - \frac {\mathcal {C} ^ {2} (\boldsymbol {b} , \hat {\boldsymbol {b}} _ {\text {n e g}} ^ {i})}{\mathcal {D} ^ {2} (\boldsymbol {b})}, 0), \tag {4} +$$ + +where $\pmb{b}$ is a ground truth box, $\hat{\pmb{b}}_{\text{neg}}^i$ is a negative box that has the $i$ -th largest IoU with $\pmb{b}$ among those unmatched predicted boxes, $\mathcal{C}(\cdot)$ is the center distance calculation function, and $\mathcal{D}(\cdot)$ is the diagonal length calculation function. $\beta$ is set as 0.1 and $k$ as 5. This loss penalizes the short distance between $\pmb{b}$ and $\hat{\pmb{b}}_{\text{neg}}^i$ , and drags all other duplicate boxes away from $\pmb{b}$ [47]. With this new loss, our final box loss function is formed as: + +$$ +\mathcal {L} _ {b o x} = \lambda_ {L 1} \cdot \mathcal {L} _ {L 1} + \lambda_ {\text {g i o u}} \cdot \mathcal {L} _ {\text {g i o u}} + \lambda_ {d e d u p} \cdot \mathcal {L} _ {d e d u p}, \tag {5} +$$ + +where $\lambda_{L1}$ and $\lambda_{\mathrm{giou}}$ have the same values as in Equation 3, and $\lambda_{dedup}$ is set as 1. + +Overall Loss Given the one-to-one matching results, the final loss on each training frame is a sum of classification, box and mask losses: + +$$ +\mathcal {L} = \lambda_ {c l s} \cdot \mathcal {L} _ {c l s} + \lambda_ {b o x} \cdot \mathcal {L} _ {b o x} + \lambda_ {d i c e} \cdot \mathcal {L} _ {d i c e} + \lambda_ {f o c a l} \cdot \mathcal {L} _ {f o c a l}, \tag {6} +$$ + +where $\mathcal{L}_{\text{dice}}$ and $\mathcal{L}_{\text{focal}}$ are dice loss [48] and focal loss [44] for foreground mask prediction, respectively. We set $\lambda_{box} = 1$ , $\lambda_{dice} = 5$ and $\lambda_{focal} = 5$ . Finally, the losses of all training frames inside a batch are summed together and normalized by the number of frames. + +# 4 Experiments + +# 4.1 Datasets and Evaluation Metrics + +We evaluate our method on YouTube-VIS 2019 and 2021 benchmarks [1]. YouTube-VIS 2019 consists of 2,238 training videos and 302 validation videos, and labels 40 object categories. YouTube-VIS 2021 is an extended version, which comprises 2,985 training videos and 421 validation videos, and labels improved 40 categories. All videos in these two datasets are annotated every 5 frames with object bounding box, object category, instance mask and instance ID. Following [1], we report the video-level average precision (AP) and average recall (AR) on the validation sets as the evaluation metrics, where both accurate instance segmentation and instance association are necessary to achieve high performance. + +Table 1: Comparison of our InsPro to state-of-the-art methods. All methods use ResNet-50 as backbone. C: additionally using COCO train2017 images that contain YouTube-VIS categories for training. The inference speed is tested on a Nvidia RTX2080Ti GPU. * indicates using deformable convolution [52] in backbone. ‡ indicates that the FPS is measured by parallel processing of images in one clip rather than sequential processing. + +
YouTube-VIS 2019 Val.YouTube-VIS 2021 Val.
MethodOnlineAP\( AP_{50} \)\( AP_{75} \)\( AR_1 \)\( AR_{10} \)AP\( AP_{50} \)\( AP_{75} \)\( AR_1 \)\( AR_{10} \)
STEm-Seg [7] (C)✘30.650.733.531.637.1----4.4
VisTR [8]✘35.656.837.035.240.2----\( 30.0^‡ \)
Propose-Reduce [9] (C)✘40.463.043.841.149.7----< 20
MaskProp* [23]✘40.0-42.9------< 10
IFC [10]✘39.060.442.741.751.635.257.237.5-\( 46.5^‡ \)
EfficientVIS [37]✘37.959.743.040.346.634.057.537.333.8\( 42.5 \)
MaskTrack R-CNN [1]✓30.351.132.631.035.528.648.929.626.533.8
SipMask [4]✓33.754.135.835.440.131.752.534.030.837.8
STMask* [20]✓33.552.136.931.139.2----28.6
SG-Net [2]✓34.856.136.835.840.8----23.0
PCAN [22]✓36.154.939.436.341.6-----
CrossVIS [18]✓36.356.838.935.640.734.254.437.930.438.2
HybridVIS [21] (C)✓41.361.543.542.747.835.856.339.133.640.3
InsPro-lite✓38.760.941.736.943.6----45.7
InsPro✓40.262.943.137.644.536.157.639.630.940.4
InsPro (C)✓43.265.348.038.849.037.658.740.932.741.4
+ +# 4.2 Implementation Details + +We implement our InsPro with Detector2 [49], and most hyperparameters are set following Sparse R-CNN [12] and CondInst [39] unless otherwise specified. More implementation details can be found in Appendix A.1. + +Training Details We employ AdamW [50] with an initial learning rate of $2.5 \times 10^{-5}$ and weight decay 0.0001 as our model optimizer. We initialize our model with parameters pre-trained on COCO [51], and train it for 32k iterations where the learning rate is divided by 10 at iterations 24k and 28k, respectively. The training is performed end-to-end on 8 Nvidia RTX2080Ti GPUs and each GPU holds one mini-batch which contains three frame images randomly sampled from the same video. Data augmentation includes only random horizontal flip and multi-scale training where the training image is resized so that the length of its shortest side is at least 288 and at most 512. Unless otherwise noted, our InsPro adopts ResNet-50 [13] as backbone and uses 100 instance queries in our experiments. + +Inference Details In inference, we resize the frame image size to $640 \times 360$ , which follows MaskTrack R-CNN [1]. The size of the feature bank is set to 18 by default. If the generated proposal box exceeds the frame's boundaries, it will be clipped to corresponding boundaries. No multi-scale testing is adopted in our experiments. + +InsPro-lite We also build a lite version of our method, named InsPro-lite. In this variant, inspired by [32], we divide video frames into key frames and non-key frames, i.e., we select one key frame per $K$ frames in a video and treat other frames as non-key ones. $K$ is 10 by default. On key frames, we conduct the dynamic instance interaction 6 times while only once on non-key frames. This takes advantage of the redundancy of videos and helps reduce inference computation time. Our InsPro-lite reaches a high inference speed of 45.7 FPS at a small accuracy loss (Table 1). + +# 4.3 Main Results + +We perform a thorough comparison of our InsPro to state-of-the-art VIS methods on YouTube-VIS 2019 and 2021. Existing VIS methods can be divided into two categories according to whether they run online or offline [53]. Since some methods [7, 9] use $80\mathrm{k}$ transformed COCO images [51] as extra training data to prevent overfitting to YouTube-VIS, for a fair comparison, we also report our + +(a) Effectiveness of instance query and proposal propagation, and temporally consistent matching (TCM). + +Table 2: Ablation studies on YouTube-VIS 2019. + +
queryproposalTCMAP\( AP_{50} \)\( AP_{75} \)
(A)24.041.324.2
(B)✓✓36.356.338.9
(C)✓✓✓37.457.641.1
(D)✓✓36.757.339.9
(E)✓✓36.655.540.3
+ +(b) Effectiveness of the proposed box dedduplication loss (BDL). + +
AP\( AP_{50} \)\( AP_{75} \)FPS
w/o BDL37.457.641.126.3
w/ BDL38.457.741.626.3
+ +(c) Intra-query attention. $T$ is the length of the feature bank. + +
APAP50AP75FPS
T=138.457.741.626.3
T=939.761.642.126.3
T=1840.262.943.126.3
T=2740.162.642.226.3
T=3640.162.542.226.3
+ +(d) Comparison between our temporal propagation paradigm and 'tracking-by-detection' paradigm. + +
AP\( AP_{50} \)\( AP_{75} \)Param (M)FLOPs (G)FPS
Tracking-by-detection31.549.334.1119.948.325.4
Ours37.457.641.1106.145.526.3
+ +(e) Comparison between our united query and 'track-and-detect query'. + +
AP\( AP_{50} \)\( AP_{75} \)
Track-and-detect query37.456.940.3
Ours38.457.741.6
+ +results with and without extra COCO training data. Table 1 presents all the results obtained with a ResNet-50 backbone on a Nvidia RTX2080Ti GPU. + +YouTube-VIS 2019 Table 1 (left) shows the comparison between our InsPro and other state-of-the-art methods on YouTube-VIS 2019 validation set. We can see that, in the online group, our InsPro outperforms all other popular methods under the same data setting. Specifically, our InsPro achieves 40.2 AP without COCO data and 43.2 AP with COCO data respectively, surpassing other online VIS methods by a large margin. Even our lite version, InsPro-lite, performs better than all other online methods trained without COCO data, reaching 38.7 AP at an impressive speed of 45.7 FPS. + +YouTube-VIS 2021 Table 1 (right) displays results on YouTube-VIS 2021 validation set. It shows a similar comparison pattern to YouTube-VIS 2019 and our InsPro achieves the state-of-the-art performance once again. + +# 4.4 Ablation Study + +We conduct extensive experiments on YouTube-VIS 2019 to study the effectiveness and individual performance contribution of our proposed modules. + +Temporal Propagation and Matching Our InsPro is built on the proposed instance query and proposal temporal propagation mechanism. Table 2 (a) shows how this mechanism contributes to our high performance. In this table, method A represents the video instance segmentation baseline, where each frame is processed individually without any temporal propagation, and object instances generated on each frame are linked if they are produced from the same instance query slice. Since this method lacks the mechanism to ensure the instance query-proposal pair corresponds to the same object across frames, it only achieves 24.0 AP due to inaccurate instance association. By contrast, when we add the temporal propagation (method B), we can easily improve the performance significantly to 36.3 AP. This evidences the importance and effectiveness of the proposed temporal propagation technique in a query-based VIS framework. If we further adopt the temporally consistent matching strategy during training (method C), we achieve an even better performance of 37.4 AP. + +We also analyze the separate performance of propagating only instance query (method D) or instance proposal (method E). The results show that these two settings achieve a similar performance boost (36.7 AP vs 36.6 AP). Applying them together yields 37.4 AP, bringing further performance gain. + +Box Dedduplication Loss We propose a box dedduplication loss to suppress the duplicate proposal boxes on the same object across frames. With the qualitative results shown in Figure 3, we show the quantitative comparison in Table 2 (b). We can see that supervising the learning with this loss during training can lead 1.0 AP improvement (38.4 AP vs 37.4 AP). This performance gain is brought by fewer duplicate boxes and fewer missed detections. + +Intra-query Attention We perform intra-query attention inside a feature bank to augment the instance query so that it can capture long-range temporal cues. As we can see in Table 2 (c), this simple method works well and improves the performance considerably. In particular, $T = 1$ indicates no intra-query attention is used and 38.4 AP is achieved. When we increase the volume $T$ of the feature bank, the performance rises and saturates at 40.2 AP with $T = 18$ . It is worthwhile to note that this lightweight yet effective intra-query attention module brings almost no speed drop. + +Temporal Propagation vs. Tracking-by-Detection Despite the fact that our InsPro does not perform explicit instance association, it still outperforms all other online methods implementing explicit tracking or matching. To verify that our superior performance comes from the temporal propagation mechanism rather than the instance segmentation model design, we compare our temporal propagation VIS approach to the typical 'tracking-by-detection' paradigm with the same instance segmentation baseline. We implement a 'tracking-by-detection' VIS system by replacing the Mask R-CNN part in MaskTrack R-CNN [1] with our instance segmentation model. In this case, the only independent variable is the object tracking method. + +As shown in Table 2 (d), our InsPro surpasses the 'tracking-by-detection' model by a large margin even if our design is simpler and faster, which soundly proves the effectiveness of our method. We argue again that this is because the evolving instance query-proposal pair in propagation encodes object temporal and spatial cues intrinsic in videos, whereas 'tracking-by-detection' methods are generally incapable of exploiting this advantage. + +Our United Query vs. Track-and-Detect Query We further compare our method to those MOT methods that adopt a similar query-propagation method for object tracking. These methods rely on two different query sets, i.e., a track query set and an object query set, to track seen objects and detect new objects respectively, while we only maintain one united query set. They need heuristic rules to combine these two type queries. Meanwhile, they manually select track queries with high scores from the previous frame to build the track query set. This makes them complex and less effective in tracking since occluded objects with low scores probably have broken trajectories because of the filtering. + +To show the superiority of our method, we compare the 'track-and-detect query' paradigm adopted in the most recent MOTR [16] to ours using the same instance segmentation baseline. We follow MOTR [16] exactly to set up the model and experiment settings. To exclude the influence of other factors, we do not use temporal feature aggregation in both methods. Table 2 (e) shows the comparisons on YouTube-VIS 2019. It can be seen that our InsPro achieves a higher performance even using a simpler query design. We attribute this advantage to our conscientiously designed modules described in Sec 3. + +# 5 Conclusion + +In this paper, we propose a simple, fast and yet effective query-based framework for online VIS. In this framework, we rely on a novel instance query and proposal propagation mechanism to undertake VIS, where we generate object instances based on a set of evolving instance query-proposal pairs propagated from previous frames. This mechanism enables our model not only to associate object instances implicitly, but to utilize video temporal cues elegantly. To make this propagation mechanism work well, we develop several modules to ensure that the learned instance query-proposal pair keeps being bound to one object. These modules include an intra-query attention unit, a temporally consistent matching mechanism and a box dedduplication loss. Extensive experiments on YouTube-VIS 2019 and 2021 verify the effectiveness of our designs, and show that our InsPro achieves superior VIS performance, outperforming all other online VIS methods. + +# Acknowledgments + +This work is supported in part by the National Natural Science Foundation of China (Grant No. 61721004), the Projects of Chinese Academy of Science (Grant No. QYZDB-SSW-JSC006), the Strategic Priority Research Program of Chinese Academy of Sciences (Grant No. XDA27000000), and the Youth Innovation Promotion Association CAS. + +# References + +[1] Yang, L., Y. Fan, N. Xu. Video instance segmentation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 5188-5197. 2019. +[2] Liu, D., Y. Cui, W. Tan, et al. Sg-net: Spatial granularity network for one-stage video instance segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9816-9825. 2021. +[3] Fang, Y., S. Yang, X. Wang, et al. Instances as queries. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 6910-6919. 2021. +[4] Cao, J., R. M. Anwer, H. Cholakkal, et al. Sipmask: Spatial information preservation for fast image and video instance segmentation. In European Conference on Computer Vision, pages 1-18. 2020. +[5] He, K., G. Gkioxari, P. Dollár, et al. Mask r-cnn. In Proceedings of the IEEE international conference on computer vision, pages 2961-2969. 2017. +[6] Bolya, D., C. Zhou, F. Xiao, et al. Yolact: Real-time instance segmentation. In Proceedings of the IEEE/CVF international conference on computer vision, pages 9157-9166. 2019. +[7] Athar, A., S. Mahadevan, A. Osep, et al. Stem-seg: Spatio-temporal embeddings for instance segmentation in videos. In European Conference on Computer Vision, pages 158-177. 2020. +[8] Wang, Y., Z. Xu, X. Wang, et al. End-to-end video instance segmentation with transformers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8741-8750. 2021. +[9] Lin, H., R. Wu, S. Liu, et al. Video instance segmentation with a propose-reduce paradigm. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 1739-1748. 2021. +[10] Hwang, S., M. Heo, S. W. Oh, et al. Video instance segmentation using inter-frame communication transformers. Advances in Neural Information Processing Systems, 34, 2021. +[11] Carion, N., F. Massa, G. Synnaeve, et al. End-to-end object detection with transformers. In European Conference on Computer Vision, pages 213-229. 2020. +[12] Sun, P., R. Zhang, Y. Jiang, et al. Sparse r-cnn: End-to-end object detection with learnable proposals. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 14454-14463. 2021. +[13] He, K., X. Zhang, S. Ren, et al. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 770-778. 2016. +[14] Sun, P., J. Cao, Y. Jiang, et al. Transtrack: Multiple object tracking with transformer. arXiv preprint arXiv:2012.15460, 2020. +[15] Meinhardt, T., A. Kirillov, L. Leal-Taixe, et al. Trackformer: Multi-object tracking with transformers. arXiv preprint arXiv:2101.02702, 2021. +[16] Zeng, F., B. Dong, T. Wang, et al. Motr: End-to-end multiple-object tracking with transformer. arXiv preprint arXiv:2105.03247, 2021. +[17] Zhu, F., Z. Yang, X. Yu, et al. Instance as identity: A generic online paradigm for video instance segmentation. In ECCV. 2022. +[18] Yang, S., Y. Fang, X. Wang, et al. Crossover learning for fast online video instance segmentation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 8043-8052. 2021. +[19] Fu, Y., L. Yang, D. Liu, et al. Compfeat: Comprehensive feature aggregation for video instance segmentation. In Proceedings of the AAAI Conference on Artificial Intelligence, vol. 35, pages 1361-1369. 2021. +[20] Li, M., S. Li, L. Li, et al. Spatial feature calibration and temporal fusion for effective one-stage video instance segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 11215-11224. 2021. +[21] Li, X., J. Wang, X. Li, et al. Hybrid instance-aware temporal fusion for online video instance segmentation. In Proceedings of the AAAI Conference on Artificial Intelligence. 2022. + +[22] Ke, L., X. Li, M. Danelljan, et al. Prototypical cross-attention networks for multiple object tracking and segmentation. Advances in Neural Information Processing Systems, 34:1192–1203, 2021. +[23] Bertasius, G., L. Torresani. Classifying, segmenting, and tracking object instances in video with mask propagation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9739-9748. 2020. +[24] Vaswani, A., N. Shazeer, N. Parmar, et al. Attention is all you need. Advances in Neural Information Processing Systems, 30, 2017. +[25] Zhu, X., W. Su, L. Lu, et al. Deformable detr: Deformable transformers for end-to-end object detection. In International Conference on Learning Representations. 2020. +[26] Meng, D., X. Chen, Z. Fan, et al. Conditional detr for fast training convergence. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 3651-3660. 2021. +[27] Dai, Z., B. Cai, Y. Lin, et al. Up-detr: Unsupervised pre-training for object detection with transformers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1601-1610. 2021. +[28] Dai, X., Y. Chen, J. Yang, et al. Dynamic detr: End-to-end object detection with dynamic attention. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 2988-2997. 2021. +[29] Liu, S., F. Li, H. Zhang, et al. Dab-detr: Dynamic anchor boxes are better queries for detr. In International Conference on Learning Representations. 2021. +[30] Girshick, R., J. Donahue, T. Darrell, et al. Rich feature hierarchies for accurate object detection and semantic segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 580-587. 2014. +[31] Ren, S., K. He, R. Girshick, et al. Faster r-cnn: Towards real-time object detection with region proposal networks. Advances in Neural Information Processing Systems, 28, 2015. +[32] He, F., N. Gao, J. Jia, et al. QueryProp: Object query propagation for high-performance video object detection. In Proceedings of the AAAI Conference on Artificial Intelligence. 2022. +[33] Wang, H., Y. Zhu, H. Adam, et al. Max-deeplab: End-to-end panoptic segmentation with mask transformers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 5463-5474. 2021. +[34] Jia, J., N. Gao, F. He, et al. Learning disentangled attribute representations for robust pedestrian attribute recognition. In Proceedings of the AAAI Conference on Artificial Intelligence. 2022. +[35] Cheng, B., A. Choudhuri, I. Misra, et al. Mask2former for video instance segmentation. arXiv preprint arXiv:2112.10764, 2021. +[36] Wu, J., Y. Jiang, S. Bai, et al. Seqformer: Sequential transformer for video instance segmentation. In ECCV. 2022. +[37] Wu, J., S. Yarram, H. Liang, et al. Efficient video instance segmentation via tracklet query and proposal. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. 2022. +[38] Zhang, Y., P. Sun, Y. Jiang, et al. Bytetrack: Multi-object tracking by associating every detection box. In European Conference on Computer Vision. 2022. +[39] Tian, Z., C. Shen, H. Chen. Conditional convolutions for instance segmentation. In European Conference on Computer Vision, pages 282-298. 2020. +[40] He, F., N. Gao, Q. Li, et al. Temporal context enhanced feature aggregation for video object detection. In Proceedings of the AAAI Conference on Artificial Intelligence, vol. 34, pages 10941-10948. 2020. +[41] He, F., Q. Li, X. Zhao, et al. Temporal-adaptive sparse feature aggregation for video object detection. Pattern Recognition, 127:108587, 2022. +[42] Jia, X., B. De Brabandere, T. Tuytelaars, et al. Dynamic filter networks. Advances in Neural Information Processing Systems, 29, 2016. + +[43] Lin, T.-Y., P. Dollar, R. Girshick, et al. Feature pyramid networks for object detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 2117-2125. 2017. +[44] Lin, T.-Y., P. Goyal, R. Girshick, et al. Focal loss for dense object detection. In Proceedings of the IEEE international conference on computer vision, pages 2980-2988. 2017. +[45] Rezatofighi, H., N. Tsoi, J. Gwak, et al. Generalized intersection over union: A metric and a loss for bounding box regression. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 658-666. 2019. +[46] Kuhn, H. W. The hungarian method for the assignment problem. Naval research logistics quarterly, 2(1-2):83-97, 1955. +[47] Hermans, A., L. Beyer, B. Leibe. In defense of the triplet loss for person re-identification. arXiv preprint arXiv:1703.07737, 2017. +[48] Milletari, F., N. Navab, S.-A. Ahmadi. V-net: Fully convolutional neural networks for volumetric medical image segmentation. In 2016 fourth international conference on 3D vision (3DV), pages 565-571. 2016. +[49] Wu, Y., A. Kirillov, F. Massa, et al. Detectron2. https://github.com/facebookresearch/detectron2, 2019. +[50] Loshchilov, I., F. Hutter. Decoupled weight decay regularization. In International Conference on Learning Representations. 2018. +[51] Lin, T.-Y., M. Maire, S. Belongie, et al. Microsoft coco: Common objects in context. In European Conference on Computer Vision, pages 740-755. 2014. +[52] Dai, J., H. Qi, Y. Xiong, et al. Deformable convolutional networks. In Proceedings of the IEEE international conference on computer vision, pages 764-773. 2017. +[53] Luo, W., J. Xing, A. Milan, et al. Multiple object tracking: A literature review. Artificial Intelligence, 293:103448, 2021. +[54] Qi, J., Y. Gao, Y. Hu, et al. Occluded video instance segmentation: A benchmark. International Journal of Computer Vision, 2022. +[55] Deng, J., W. Dong, R. Socher, et al. Imagenet: A large-scale hierarchical image database. In 2009 IEEE Conference on Computer Vision and Pattern Recognition, pages 248-255. IEEE, 2009. +[56] Gkioxari, G., J. Malik. Finding action tubes. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 759-768. 2015. +[57] Feichtenhofer, C., A. Pinz, A. Zisserman. Detect to track and track to detect. In Proceedings of the IEEE international conference on computer vision, pages 3038-3046. 2017. +[58] Xiao, F., Y. J. Lee. Video object detection with an aligned spatial-temporal memory. In European Conference on Computer Vision, pages 485-501. 2018. +[59] Cheng, B., A. Schwing, A. Kirillov. Per-pixel classification is not all you need for semantic segmentation. Advances in Neural Information Processing Systems, 34, 2021. +[60] Milan, A., L. Leal-Taixe, I. Reid, et al. Mot16: A benchmark for multi-object tracking. arXiv preprint arXiv:1603.00831, 2016. +[61] Kim, D., S. Woo, J.-Y. Lee, et al. Video panoptic segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9859-9868. 2020. +[62] Gao, N., F. He, J. Jia, et al. Panopticdepth: A unified framework for depth-aware panoptic segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1632-1642. 2022. +[63] Avinash Ramakanth, S., R. Venkatesh Babu. Seamseg: Video object segmentation using patch seams. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 376-383. 2014. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] We discuss limitations and future work in Appendix. +(c) Did you discuss any potential negative societal impacts of your work? [Yes] We discuss the potential negative societal impacts in Appendix. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [N/A] +(b) Did you include complete proofs of all theoretical results? [N/A] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] We list the data and instructions in Sec. 4 and Appendix, and the code will be released upon publication. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] All training details are listed in Sec. 4 and Appendix. +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] +(b) Did you mention the license of the assets? [No] +(c) Did you include any new assets either in the supplemental material or as a URL? [No] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [Yes] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [Yes] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/inspropropagatinginstancequeryandproposalforonlinevideoinstancesegmentation/images.zip b/inspropropagatinginstancequeryandproposalforonlinevideoinstancesegmentation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..fd46e4ffda34763fab70744aea2402c682cacaf3 --- /dev/null +++ b/inspropropagatinginstancequeryandproposalforonlinevideoinstancesegmentation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2f968050f3a49b6b7037efbb681c5959fca2a899f3cd681e760d30ecb9a40881 +size 407270 diff --git a/inspropropagatinginstancequeryandproposalforonlinevideoinstancesegmentation/layout.json b/inspropropagatinginstancequeryandproposalforonlinevideoinstancesegmentation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..7a0341a2cf80935016d64d19bddfe99c26bf7580 --- /dev/null +++ b/inspropropagatinginstancequeryandproposalforonlinevideoinstancesegmentation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb94b391b6ae19b8c7db5530398c78e69f163fec7eda5e23414cb47017f60de3 +size 416987 diff --git a/instabilityandlocalminimaingantrainingwithkerneldiscriminators/d10154ea-a818-4770-885a-c2a623d11bb8_content_list.json b/instabilityandlocalminimaingantrainingwithkerneldiscriminators/d10154ea-a818-4770-885a-c2a623d11bb8_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..6d5679ae5da10e5c0fc5e8fb2b25d13f8f6d692c --- /dev/null +++ b/instabilityandlocalminimaingantrainingwithkerneldiscriminators/d10154ea-a818-4770-885a-c2a623d11bb8_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e0e844a7f0aced3706b5cd9c77932111a2b6698902fa830cfaae7b6867b5fac +size 86421 diff --git a/instabilityandlocalminimaingantrainingwithkerneldiscriminators/d10154ea-a818-4770-885a-c2a623d11bb8_model.json b/instabilityandlocalminimaingantrainingwithkerneldiscriminators/d10154ea-a818-4770-885a-c2a623d11bb8_model.json new file mode 100644 index 0000000000000000000000000000000000000000..0162f6be6034dde9114da90347d94eb268b11fe0 --- /dev/null +++ b/instabilityandlocalminimaingantrainingwithkerneldiscriminators/d10154ea-a818-4770-885a-c2a623d11bb8_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75188965945854b8bdbb2ba4dd4f8938c2b61f8821fec354715618f3387abbd2 +size 106213 diff --git a/instabilityandlocalminimaingantrainingwithkerneldiscriminators/d10154ea-a818-4770-885a-c2a623d11bb8_origin.pdf b/instabilityandlocalminimaingantrainingwithkerneldiscriminators/d10154ea-a818-4770-885a-c2a623d11bb8_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..d40fd282026f31f2cd5d8c85525c0aef299d43c5 --- /dev/null +++ b/instabilityandlocalminimaingantrainingwithkerneldiscriminators/d10154ea-a818-4770-885a-c2a623d11bb8_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a752b751e68460adf9deb4ed78986d400dbc2f45fa595bb8faa4edc5a323051b +size 632132 diff --git a/instabilityandlocalminimaingantrainingwithkerneldiscriminators/full.md b/instabilityandlocalminimaingantrainingwithkerneldiscriminators/full.md new file mode 100644 index 0000000000000000000000000000000000000000..2166939b38c7c4e9d05c84f56c42d952ac549847 --- /dev/null +++ b/instabilityandlocalminimaingantrainingwithkerneldiscriminators/full.md @@ -0,0 +1,467 @@ +# Instability and Local Minima in GAN Training with Kernel Discriminators + +Evan Becker + +Dept. CS + +UCLA + +evbecker@cs.ucla.edu + +Parthe Pandit + +HDSI + +UC, San Diego + +parthepandit@ucsd.edu + +Sundep Rangan + +Dept. ECE + +NYU + +srangan@nyu.edu + +Alyson K. Fletcher + +Dept. Statistics + +UCLA + +akfletcher@ucla.edu + +# Abstract + +Generative Adversarial Networks (GANs) are a widely-used tool for generative modeling of complex data. Despite their empirical success, the training of GANs is not fully understood due to the min-max optimization of the generator and discriminator. This paper analyzes these joint dynamics when the true samples as well as the generated samples are discrete, finite sets, and the discriminator is kernel-based. A simple yet expressive framework for analyzing training called the Isolated Points Model is introduced. In the proposed model, the distance between true samples greatly exceeds the kernel width, so each generated point is influenced by at most one true point. Our model enables precise characterization of the conditions for convergence, both to good and bad minima. In particular, the analysis explains two common failure modes: (i) an approximate mode collapse and (ii) divergence. Numerical simulations are provided that predictably replicate these behaviors. + +# 1 Introduction + +Generative Adversarial Networks (GANs) are the most widely-used method for learning generative models of complex and structured data in an unsupervised manner. Indeed, GANs have seen incredible empirical success in a wide variety of domains ranging from image generation, speech generation, text generation, and many more. Models trained in this manner have also become critical in downstream applications. See [1, 29] for an overview. + +In the GAN methodology, a generator model is trained to output samples that emulate a target dataset, which we call true samples. A critic model, called the discriminator, is trained to tell apart (discriminate) the true and generated samples. The generator is trained in parallel to fool the discriminator. + +Correctly tuning the joint training of the discriminator and generator is one of the key challenges in GANs and is the source of several empirically observed problematic phenomena. For example, it is well-known that the resulting distributions can suffer from mode collapse and catastrophic forgetting. The optimization can also lead to divergence or slow convergence of min-max optimization algorithms. See [10, 19] for more details. Practical GANs methods overcome these issues with a combination of careful hyper-parameter optimization and heuristics. Significant effort has strived to develop theoretical frameworks that can better analyze and optimize GAN training. + +![](images/190ffa361715efd7af721bb6d8d9cf6a86ee27106129b75155a59f62ab3a57bb.jpg) +Figure 1: (Isolated Points Model) An illustration of our results. Each isolated region (blue circle) has a single true point (green disk) with point mass $p_i$ . There are eight generated points with fixed point mass $\widetilde{p}_j = 1/8$ starting at the locations shown in the orange squares. In $V_1$ and $V_3$ , the excess point mass is non-negative $(\Delta_i \geq 0)$ and the generated points converge to the true point. In $V_2$ , the excess point mass $\Delta_4 < 0$ and the generated points converge to a stable equilibrium around the true point analogous of mode collapse. Finally, a point outside all four isolated regions may diverge to $\infty$ in a linear velocity. + +In this work, we propose a simple theoretical model, called the Isolated Points Model, that is analytically tractable and allows us to rigorously study the stability and convergence properties of training a GAN. In the proposed model, the true and generated points are discrete distributions over finite sets, and the discriminator is kernel-based meaning that it is linearly parametrized. We make an additional critical assumption that the true points are sufficiently separated such that the kernel interaction between points near two distinct true points is negligible. For distance-based kernels, this assumption essentially requires that the true points are separated much greater than the kernel width. A simple example of this model with four true points is illustrated in Fig. 1. + +Main Contributions We show that this simple isolated points model provides sufficient richness to exhibit several interesting phenomena and insights: + +(1) Local stability and instability: We provide necessary and sufficient conditions for local convergence of generated points to a true point within each isolated region (Theorem 1). The results show that the stability is determined by the excess point mass, meaning the difference between the true and generated mass in the region. A consequence of these results, Corollary 1, is that exact mode collapse where an excess of generated points concentrate in a single true point, is provably not possible. +(2) Approximate mode collapse: Although an excess of generated point mass cannot exactly concentrate on a single true point, we prove (see Theorem 2) the existence of locally stable equilibria where an arbitrarily large excess point mass concentrates near the true point. We call this phenomena approximate mode collapse. +(3) Divergence: We also demonstrate that given a initial perturbation, an isolated generated point can lock into an trajectory moving away from any true point in an arbitrary direction. Interestingly, this trajectory is driven solely by the generated point's own kernel history. +(4) Role of the kernel width: The results provide insights into the role of the kernel width in training - See Section 6. In particular, wider kernel widths reduce the likelihood of different modes of the distribution being isolated, which is the critical for the approximate mode collapse and divergence that we observe. At the same time, discriminators with wide kernels make are unable to distinguish points that are close, resulting in slow convergence near the true distribution. + +Prior work Convergence problems for GANs have been widely-recognized and studied since their inception [1, 29]. Indeed, many of the developments in GANs, notably the popular Wasserstein GAN and its variants, were motivated to overcome these issues [2, 3, 13, 17]. + +For analytic tractability, we focus on a relatively simple GAN with a kernel discriminator and maximum mean discrepancy loss. This methodology has been applied in other works such as [6,9,12,27]. Our focus is on joint optimization of a kernel discriminator and a generator with multiple discrete points. An important avenue of future work would be to extend our results to more complex losses such as the Wasserstein loss [2,3,13]. + +The early Dirac-GAN [19], and its extension [26], considered a linear discriminator and a single Dirac-distribution for the generator and true data. Our model extends this work by considering multiple points and a general kernel discriminator. Importantly our model allows for a new parameter called the excess point mass which enables modeling complex behaviours in the isolated regions. + +Our results also heavily rely on linearization methods derived from control theory, which have been studied in the GAN context in [21, 22, 30]. See, also general functional descriptions in [9, 16, 20, 23]. These prior works demonstrated the local stability of the generated distribution close to the true distribution. Stability results with a single-layer NN generator and linear discriminator has been studied in [4]. Due to the isolated points model, our results also prove the existence of locally stable bad local minima. + +Metrics for understanding the performance of generative models remains an open challenge. Some efforts in this direction were presented in [8, 25], and we take advantage of this progress to report our numerical simulations. + +# 2 Isolated Points Model + +We propose the following model for studying the training of GANs. + +Discrete true and generated distributions: We assume that the true and generated distributions, $\mathbb{P}_r$ and $\mathbb{P}_g$ , are over discrete sets in $\mathbb{R}^d$ : + +$$ +\mathbb {P} _ {r} (\boldsymbol {x}) = \sum_ {i = 1} ^ {N _ {r}} p _ {i} \delta (\boldsymbol {x} - \boldsymbol {x} _ {i}), \quad \mathbb {P} _ {g} (\boldsymbol {x}) = \sum_ {j = 1} ^ {N _ {g}} \widetilde {p} _ {j} \delta (\boldsymbol {x} - \widetilde {\boldsymbol {x}} _ {j}), \tag {1} +$$ + +where $N_{r}$ and $N_{g}$ are the number of true and generated points, $\pmb{X} = \{\pmb{x}_i\}_{i=1}^{N_r}$ and $\widetilde{\pmb{X}} = \{\widetilde{\pmb{x}}_j\}_{j=1}^{N_g}$ are the true and generated points, respectively, and $\{p_i\}$ and $\{\widetilde{p_j}\}$ are their probabilities. For the generator, we assume that the probabilities $\widetilde{p_j}$ are fixed. The problem is to learn the point mass locations $\widetilde{\pmb{X}}$ so that the generated and true distributions match. + +Kernel discriminator: We consider a GAN where the discriminator has a linear parametrization of the form: + +$$ +f (\boldsymbol {x}, \boldsymbol {\theta}) = a (\boldsymbol {x}) ^ {\top} \boldsymbol {\theta}, \tag {2} +$$ + +for some vector of basis functions $a(\pmb{x})$ and parameter vector $\theta$ . The discriminator is trained to maximize a maximum mean discrepancy (MMD) metric [6,9,12,27] + +$$ +\mathcal {L} _ {d} \left(\boldsymbol {\theta}, \left\{\widetilde {\boldsymbol {x}} _ {j} \right\} _ {j = 1} ^ {N _ {g}}\right) := \sum_ {i} p _ {i} f \left(\boldsymbol {x} _ {i}, \boldsymbol {\theta}\right) - \sum_ {j} \widetilde {p} _ {j} f \left(\widetilde {\boldsymbol {x}} _ {j}, \boldsymbol {\theta}\right) - \frac {\lambda}{2} \| \boldsymbol {\theta} \| ^ {2}, \tag {3} +$$ + +for some regularization parameter $\lambda > 0$ . + +Discriminator updates: We assume simple gradient ascent of the MMD metric (3): + +$$ +\boldsymbol {\theta} ^ {k + 1} = \boldsymbol {\theta} ^ {k} + \eta_ {d} \left(\sum_ {i} p _ {i} a \left(\boldsymbol {x} _ {i}\right) - \sum_ {j} \widetilde {p} _ {j} a \left(\widetilde {\boldsymbol {x}} _ {j}\right) - \lambda \boldsymbol {\theta} ^ {k}\right), \tag {4} +$$ + +where $\eta_d > 0$ is the discriminator step-size. If we let $f^k(\boldsymbol{x}) \coloneqq f(\boldsymbol{x}, \theta^k)$ , then for any fixed $\boldsymbol{x}$ , we have + +$$ +f ^ {k + 1} (\boldsymbol {x}) = f ^ {k} (\boldsymbol {x}) + \eta_ {d} \left(\sum_ {i = 1} ^ {N _ {r}} p _ {i} K (\boldsymbol {x}, \boldsymbol {x} _ {i}) - \sum_ {j = 1} ^ {N _ {g}} \widetilde {p} _ {j} K (\boldsymbol {x}, \widetilde {\boldsymbol {x}} _ {j}) - \lambda f ^ {k} (\boldsymbol {x})\right), \tag {5} +$$ + +where $K(\pmb {x},\pmb{x}^{\prime})$ is the kernel: + +$$ +K \left(\boldsymbol {x}, \boldsymbol {x} ^ {\prime}\right) := a (\boldsymbol {x}) ^ {\intercal} a \left(\boldsymbol {x} ^ {\prime}\right). \tag {6} +$$ + +To make the analysis concrete, some of our results will apply to the radial basis function (RBF) kernel + +$$ +K \left(\boldsymbol {x}, \boldsymbol {x} ^ {\prime}\right) = e ^ {- \frac {1}{2 \sigma^ {2}} \left\| \boldsymbol {x} - \boldsymbol {x} ^ {\prime} \right\| ^ {2}}, \tag {7} +$$ + +where $\sigma > 0$ is the kernel width. + +Generator updates: We will assume the generator distribution $\mathbb{P}_g$ in (1) is directly parameterized by the point mass locations, $\widetilde{\pmb{X}} = \{\widetilde{\pmb{x}}_j\}_{j=1}^{N_g}$ , that are updated to minimize the loss: + +$$ +\mathcal {L} _ {g} \left(\boldsymbol {\theta}, \left\{\widetilde {\boldsymbol {x}} _ {j} \right\} _ {j = 1} ^ {N _ {g}}\right) := - \sum_ {j} \widetilde {p} _ {j} f \left(\widetilde {\boldsymbol {x}} _ {j}, \boldsymbol {\theta}\right). \tag {8} +$$ + +We consider a simple gradient descent update for this loss + +$$ +\widetilde {\boldsymbol {x}} _ {j} ^ {k + 1} = \widetilde {\boldsymbol {x}} _ {j} ^ {k} + \eta_ {g} \widetilde {p} _ {j} \nabla f ^ {k} \left(\widetilde {\boldsymbol {x}} _ {j} ^ {k}\right). \tag {9} +$$ + +Together, (5) and (9) define the joint dynamics of the GAN. + +Isolated Points: Our final key assumption is that the true samples are separated far enough so that there exists a non-empty isolated neighborhood $V_{i}$ around each sample $\pmb{x}_i$ such that, + +$$ +K \left(\boldsymbol {x}, \boldsymbol {x} ^ {\prime}\right) = 0 \text {f o r a l l} \boldsymbol {x} \in V _ {i} \text {a n d} \boldsymbol {x} ^ {\prime} \in V _ {j} \text {f o r a l l} i \neq j \tag {10} +$$ + +In other words, the samples are separated sufficiently far apart such that they are outside the width of the kernel evaluated at another sample. See Figure 1 for an illustration. + +The assumption (10) is obviously strict and is an idealization of what occurs in practice. The supplementary material discusses modifications of the results to the case where $|K(\pmb{x},\pmb{x}^{\prime})| \leq \epsilon$ for some small $\epsilon$ and all $\pmb{x} \in V_{i}$ and $\pmb{x}^{\prime} \in V_{j}$ . + +Now consider an isolated region $V_{i}$ around a true point $\pmb{x}_i$ . At each training step $k$ , let $N_i^k$ be the set of indices $j$ such that the generated points $\widetilde{\pmb{x}}_j^k \in V_i$ . We further suppose that $N_i^k$ is constant over time, so the points $\widetilde{\pmb{x}}_j^k$ do not enter or exit this region. Then, their dynamics within the region are given by: + +$$ +f ^ {k + 1} (\boldsymbol {x}) = f ^ {k} (\boldsymbol {x}) + \eta_ {d} \left(p _ {i} K (\boldsymbol {x}, \boldsymbol {x} _ {i}) - \sum_ {j \in N _ {i}} \widetilde {p} _ {j} K (\boldsymbol {x}, \widetilde {\boldsymbol {x}} _ {j} ^ {k}) - \lambda f ^ {k} (\boldsymbol {x})\right) \quad \forall \boldsymbol {x} \in V _ {i}, \tag {11a} +$$ + +$$ +\widetilde {\boldsymbol {x}} _ {j} ^ {k + 1} = \widetilde {\boldsymbol {x}} _ {j} ^ {k} + \eta_ {g} \widetilde {p} _ {j} \nabla f ^ {k + 1} \left(\widetilde {\boldsymbol {x}} _ {j} ^ {k}\right) \quad \forall j \in N _ {i} \tag {11b} +$$ + +We will call the updates (11) the dynamical system in the region $V_{i}$ . + +We may also choose to write the updates (11) in terms of the components of $\pmb{\theta}$ . Let $\pmb{\theta}_i \coloneqq \pmb{P}_i\pmb{\theta}$ where $\pmb{P}_i$ is the projection onto the range space of $a(\pmb{x})$ for $\pmb{x} \in V_i$ . Then, it can be verified that the updates in (11) can be written as: + +$$ +\boldsymbol {\theta} _ {i} ^ {k + 1} = \boldsymbol {\theta} _ {i} ^ {k} + \eta_ {d} \left(p _ {i} a (\boldsymbol {x} _ {i}) - \sum_ {j \in N _ {i}} \widetilde {p} _ {j} a \left(\widetilde {\boldsymbol {x}} _ {j} ^ {k}\right) - \lambda \boldsymbol {\theta} _ {i} ^ {k} (\boldsymbol {x})\right) \tag {12a} +$$ + +$$ +\widetilde {\boldsymbol {x}} _ {j} ^ {k + 1} = \widetilde {\boldsymbol {x}} _ {j} ^ {k} + \eta_ {g} \widetilde {p} _ {j} \nabla f \left(\widetilde {\boldsymbol {x}} _ {j} ^ {k}, \boldsymbol {\theta} _ {i}\right), \quad \forall j \in N _ {i}. \tag {12b} +$$ + +We will use the notation + +$$ +\widetilde {\boldsymbol {X}} _ {i} = \left\{\widetilde {\boldsymbol {x}} _ {j}, j \in N _ {i} \right\}, \tag {13} +$$ + +to denote the set of generated points $\widetilde{\boldsymbol{x}}_j$ in the isolated region. The state variables for the dynamics (12) can be represented by the pair $(\theta_i, \widetilde{\boldsymbol{X}}_i)$ . Note that we allow separate learning rates for the two update equations. Our convergence result in Theorem 1 relies on the ratio of these learning rates. + +# 3 Behavior Near the True Point + +Consider an isolated region $V_{i}$ around some true point $\pmb{x}_i$ . We first analyze the dynamics where + +$$ +\widetilde {\boldsymbol {x}} _ {j} ^ {k} \approx \boldsymbol {x} _ {i} \forall j \in N _ {i}. \tag {14} +$$ + +That is, all the generated points in $V_{i}$ are close to the true point. We follow a standard linearization analysis used in several other GAN works such as [6, 12, 18]. However, a critical difference in our model is that the generated mass may not equal the true mass in a particular isolated region. We thus define the probability mass difference + +$$ +\Delta_ {i} := p _ {i} - \sum_ {j \in N _ {i}} \widetilde {p} _ {j}, \tag {15} +$$ + +which represents the difference the true probability mass in the region, $p_i$ , and total probability mass of the generated points in that region. Note that this parameter is missing from the analysis of Dirac-GAN [20] since $\Delta_i = 0$ trivially when only one true point exists. Several numerical behaviors of GANs emerge due to $\Delta_i \neq 0$ . + +Assumption 1. The kernel $K(\pmb{x}, \pmb{x}^{\prime})$ is smooth and, at each true point $\pmb{x}_i$ : + +$$ +\left. \frac {\partial K (\boldsymbol {x} , \boldsymbol {x} _ {i})}{\partial \boldsymbol {x}} \right| _ {\boldsymbol {x} = \boldsymbol {x} _ {i}} = \mathbf {0}, \tag {16} +$$ + +and + +$$ +\left. - \frac {\partial^ {2} K (\boldsymbol {x} , \boldsymbol {x} _ {i})}{\partial \boldsymbol {x} ^ {2}} \right| _ {\boldsymbol {x} = \boldsymbol {x} _ {i}} \in [ k _ {1}, k _ {2} ] \boldsymbol {I}, \quad \left. \frac {\partial^ {2} K (\boldsymbol {x} , \boldsymbol {x} ^ {\prime})}{\partial \boldsymbol {x} \partial \boldsymbol {x} ^ {\prime}} \right| _ {\boldsymbol {x} = \boldsymbol {x} ^ {\prime} = \boldsymbol {x} _ {i}} \in [ k _ {3}, k _ {4} ] \boldsymbol {I}, \tag {17} +$$ + +for some $k_{1}, k_{2}, k_{3}, k_{4} > 0$ where we use the notation that $\pmb{Q} \in [q_{1}, q_{2}] \pmb{I}$ to mean $q_{1} \pmb{I} \preceq \pmb{Q} \preceq q_{2} \pmb{I}$ . + +The condition is mild and simply requires that the kernel $K(\pmb{x}, \pmb{x}_i)$ has a local maxima at $\pmb{x} = \pmb{x}_i$ with negative curvature, and also satisfies a strict positivity condition. The assumption, for example, is satisfied by the RBF kernel (7) with $k_1 = k_2 = k_3 = k_4 = 1 / \sigma^2$ . + +Theorem 1. Fix any isolated region $V_{i}$ , suppose the kernel satisfies Assumption 1 and let + +$$ +\widetilde {\boldsymbol {X}} _ {i} ^ {*} = \left\{\widetilde {\boldsymbol {x}} _ {j} ^ {*}, j \in N _ {i} \right\}, \quad \widetilde {\boldsymbol {x}} _ {j} ^ {*} = \boldsymbol {x} _ {i}. \tag {18} +$$ + +Then, there is a unique $\pmb{\theta}_i^*$ such that $(\pmb{\theta}_i^*, \overline{\pmb{X}}_i^*)$ is an equilibrium point of the GAN dynamics (12) in the region $V_i$ . In addition, if the parameters $k_i$ , $\lambda$ and $\mu = \eta_g / \eta_d$ are fixed, then, for sufficiently small step size $\eta_d$ : + +(a) If $\Delta_i > 0$ , the equilibrium point is locally stable. +(b) If $\Delta_{i} < 0$ and $|N_{i}| \geq 1$ , the equilibrium point is locally unstable. +(c) If $|N_{i}| = 1$ and + +$$ +\mu \Delta_ {i} k _ {1} \widetilde {p} _ {1} + \min \left\{\lambda^ {2}, \mu \widetilde {p} _ {1} ^ {2} k _ {3} \right\} > 0, \tag {19} +$$ + +the equilibrium point is locally stable. + +(d) If $|N_{i}| = 1$ and + +$$ +\mu \Delta_ {i} k _ {2} \widetilde {p} _ {1} + \min \left\{\lambda^ {2}, \mu \widetilde {p} _ {1} ^ {2} k _ {4} \right\} < 0, \tag {20} +$$ + +the equilibrium point is locally unstable. + +In cases (c) and (d), $\widetilde{p}_1$ denotes the point mass of the single generated point in region. + +The theorem provides simple necessary and sufficient conditions on the stability of equilibrium points at the true point. In case (a), we see that when the probability mass difference, $\Delta_i > 0$ , the generated points will converge locally to the true point. That is, the generated points will converge to the true point as long as the true point mass exceeds the total generated mass. Also, (19) will always be satisfied when $\Delta_i = 0$ . So, when $|N_i| = 1$ (i.e., there is a single generated point), the generated point will converge to the true point when the generated and true point have the same mass. Examples of these convergence situations are shown in Figure 1, in $V_1$ (where $\Delta_1 = 0$ ) and $V_3$ (where $\Delta_3 > 0$ ). + +Conversely, case (b) shows that when $\Delta_{i} < 0$ (i.e. the generated probability exceeds the true probability), the generated mass can no longer stably settle in the true point. This case is shown in $V_{2}$ in Fig. 1 where the generated points are repelled from the true points. + +Single vs. multiple points: Note there is a slight difference between the cases when $|N_i| = 1$ (i.e., there is a single generated point in the region), and $|N_i| > 1$ , when there is more than one generated point. As the proof of the theorem shows, when $|N_i| > 1$ , the mean of the generated points may converge to the true point, but the system may have other modes that are unstable in other directions. + +Boundary cases: Our theorem does not discuss certain boundary cases. For example, when $\Delta_i = 0$ and $|N_i| > 1$ , the theorem does not state whether the equilibrium point is stable or unstable. These boundary cases are standard in linearization analyses when the eigenvalues of the linearized system are only critically stable. Critically stable linear systems will have limit cycles [28]. The stability of general nonlinear systems will be determined by the higher order dynamics, which, in our case, would be determined by the higher order terms of the kernel. However, standard non-linear systems theory results such as [28] show that any such points cannot be exponentially stable. Hence, if the points locally converge, the convergence rate may be slow. + +Relation to Dirac-GAN: Note that our theorem recovers the stability result [20, Theorem 4.1] as a special case: When there is a single true and generated point (whereby $|N_i| = 1$ and $\Delta_i = 0$ ), and regularization is used $(\lambda > 0)$ , the theorem shows the true point is locally stable. When there is no regularization $(\lambda = 0)$ , the criteria in both (19) and (20) are both exactly zero, meaning the equilibrium point is not exponentially stable or unstable. In this case, [20] shows that the system has a limit cycle. + +Non-existence of exact mode collapse: An important corollary of these results is provided by the following result. + +Corollary 1. Suppose the kernel satisfies Assumption 1, and the number of true and generated points are equal so that $N_r = N_g = N$ for some $N$ . Also, suppose that $p_j = \widetilde{p}_j = 1 / N$ for all $j$ . Then, the only stable equilibrium of the generated distribution $\mathbb{P}_g$ with + +$$ +\operatorname {s u p p} \left(\mathbb {P} _ {g}\right) \subseteq \operatorname {s u p p} \left(\mathbb {P} _ {r}\right) \tag {21} +$$ + +$$ +i s \mathbb {P} _ {g} = \mathbb {P} _ {r}. +$$ + +In Corollary 1, $\mathrm{supp}(\cdot)$ denotes the support of the distributions. So, $\mathrm{supp}(\mathbb{P}_r)$ denotes the set of non-unique values of true points $\boldsymbol{x}_i$ and $\mathrm{supp}(\mathbb{P}_g)$ denotes the set of non-unique values of generated points $\widetilde{\boldsymbol{x}}_j$ . Thus, the result rules out the possibility that the generated distribution can find a locally stable equilibrium where multiple generated points converge to a single true point. + +# 4 Bad Local Minima and Approximate Mode Collapse + +Mode collapse is one of the most widely-known failure mechanisms of GANs, especially for the simple GANs considered in this work [2, 11, 19, 26]. Corollary 1 appears to rule out mode collapse in the sense that there are no locally stable equilibria where multiple generated point arrive in a single true point. Indeed, Theorem 1 suggests that the generated points will be "repelled" from the true point when the generated mass exceeds the true mass, i.e., $\Delta_{i} < 0$ . This repulsive force offers the possibility that the excess generated mass can move towards other true points. + +However, in this section, we will show that even when $\Delta_{i} < 0$ , the generated points may get stuck close to the true point. This phenomena is what we call approximate mode collapse. + +Theorem 2. Fix a region $V_{i}$ and consider the dynamical system (12) with the RBF kernel (7). Assume $|N_i| > 1$ so there is more than one generated point in the region. Then, there exists a constant $c > 0$ , independent of the kernel width $\sigma$ , and $N_{\mathrm{max}}$ , which is only a function of $d$ , such that, if $|N_{i}| \leq N_{\mathrm{max}}$ , the system has a locally stable equilibrium with $\widetilde{\mathbf{X}}_i^* = \{\widetilde{\mathbf{x}}_j^*, j \in N_i\}$ and + +$$ +\left\| \widetilde {\boldsymbol {x}} _ {j} ^ {*} - \boldsymbol {x} _ {i} \right\| \leq c \sigma , \tag {22} +$$ + +for all $j\in N_{i}$ + +The theorem states that, under certain conditions, the generated points can get stuck in a local minima, even when the generated mass exceeds the true mass. An example of this situation is illustrated in Figure 1 in the region $V_{2}$ . The true mass (the green disk at the center of $V_{2}$ ) is itself an unstable location for the generated points since $\Delta_{i} < 0$ . But, the points may find a stable local minima around + +the true point. Moreover, the distance of the local minima to the $x_{i}$ scales with the kernel width $\sigma$ . Hence, for very small $\sigma$ , the generated points with arbitrarily high mass may accumulate near a single true point. This phenomena can thus be seen as a type of approximate mode collapse. + +The proof of Theorem 2 shows that the bad minima holds for kernels other than the RBF as well. + +Prior work in mode collapse have identified at least two failure mechanisms: The first is that the discriminator may have zero gradient on the generated data when it comes from a low dimensional manifold [2]. The above result provides a constructive proof for the existence of such modes, and additionally shows that the local minima is stable, meaning the gradients push the generated data locally to the bad minima. + +A second failure mechanism is catastrophic forgetting [26], that past generated values are not remembered by the discriminator. Since we use a regularized discriminator $(\lambda > 0)$ , our discriminator also "forgets" past values, and thus, the existence of the bad minima would be consistent with catastrophic forgetting. + +# 5 Divergence + +What happens to generated points isolated from all the true points $\{\pmb{x}_i\}$ ? Consider a single generated point $\widetilde{\pmb{x}}_0$ whose trajectory $\{\widetilde{\pmb{x}}_0^k\}_{k\geq 0}$ satisfies + +$$ +K \left(\tilde {\boldsymbol {x}} _ {0} ^ {k}, \tilde {\boldsymbol {x}} _ {j} ^ {k}\right) = 0 \quad \forall j \neq 0, \quad K \left(\tilde {\boldsymbol {x}} _ {0} ^ {k}, \boldsymbol {x} _ {i}\right) = 0 \quad \forall i \quad \text {f o r a l l} k. \tag {23} +$$ + +That is, $\widetilde{x}_0^k$ is sufficiently far from all the other generated points and true points so that the kernel can be treated as zero. In this case, the dynamics (5) and (9) reduce to + +$$ +f ^ {k + 1} (\boldsymbol {x}) = (1 - \eta_ {d} \lambda) f ^ {k} (\boldsymbol {x}) - K (\boldsymbol {x}, \widetilde {\boldsymbol {x}} _ {0} ^ {k}) \tag {24a} +$$ + +$$ +\widetilde {\boldsymbol {x}} _ {0} ^ {k + 1} = \widetilde {\boldsymbol {x}} _ {0} ^ {k} + \eta_ {g} \nabla f ^ {k} \left(\widetilde {\boldsymbol {x}} _ {0} ^ {k + 1}\right). \tag {24b} +$$ + +Theorem 3. Consider the dynamical system (24) with a translation-invariant kernel of the form $K(\pmb{x},\pmb{x}^{\prime}) = \phi (\| \pmb {x} - \pmb{x}^{\prime}\|)$ for some smooth, integrable function $\phi (\cdot)$ with $\phi (0) > 0$ . Then, for any initial condition, $\widetilde{\pmb{x}}_0^0$ , and unit vector $\pmb {u}\in \mathbb{R}^{d}$ , and $\lambda$ sufficiently small, there exists an initial discriminator function $f^0 (\pmb {x})$ and velocity $v_{0} > 0$ such that the solution to the system in equation (24) is + +$$ +\widetilde {\boldsymbol {x}} _ {0} ^ {k} = \widetilde {\boldsymbol {x}} _ {0} ^ {0} + k v _ {0} \boldsymbol {u}. \tag {25} +$$ + +Remarkably, the theorem shows that an isolated generated point can enter a trajectory where it continues to move linearly in a direction simply propelled by its own kernel history $K(\pmb{x}, \widetilde{\pmb{x}}_0^k)$ . This situation is illustrated in Figure 1, where the generated point in the top right moves to the right in a straight line. We will see several examples of divergence in the numerical results as well. + +# 6 Role of the Kernel Width + +A key parameter of any distance based kernels, such as the RBF (7), is its kernel width, meaning the approximate distance at which the kernel begins to decay significantly. Our results, combined with previous analyses, provide useful insights into the role of the kernel width in GAN training. + +For example, consider the simple case of the Dirac-GAN where there is a single true point $x_0$ , and single generated point $\widetilde{x}_0$ . If we fix the generated point, $\widetilde{x}_0$ , and let an RBF discriminator run to the convergence, it is known from results in [6, 12, 18] that the discriminator parameters $\theta^k$ will converge to some values $\theta^k \rightarrow \theta^*$ , and the resulting generator loss in (8) is given by + +$$ +\mathcal {L} _ {g} \left(\boldsymbol {\theta} ^ {*}, \widetilde {\boldsymbol {x}} _ {0}\right) = \frac {1}{\lambda} \left(1 - e ^ {- \left\| \boldsymbol {x} _ {0} - \widetilde {\boldsymbol {x}} _ {0} \right\| ^ {2} / 2 \sigma^ {2}}\right). \tag {26} +$$ + +The supplementary material reviews these results in a more general setting. + +Now, if the kernel width $\sigma$ is very large, the loss will have a small gradient when $\widetilde{x}_0$ is close to $x_0$ , i.e., the generated point is close to the true value. On the other hand, if $\sigma$ is very small, the loss will have a small gradient when $\widetilde{x}_0$ is far from $x_0$ . The selection of the appropriate $\sigma$ must balance the convergence rates in these two regimes. In addition, when $\sigma$ is large, the discriminator is approximately linear and therefore cannot distinguish nonlinear regions. + +![](images/98d102f5963531f2664f246f556f8d43f14f934b7c12530427dd64fa0229a97a.jpg) + +![](images/a89855921d5598fb01bf514597fce92cd5171bf2f9b6931f205cbfe21c4c0bb4.jpg) + +![](images/cfd9799ca62eb10f9bf2e737de1b75f7842091c85d03bd8c02bb28d139026748.jpg) + +![](images/64e8bc02fbf3a558edacce5b3bb3cd71e467ad660c9771d7bddaab7f8bdaa0be.jpg) + +![](images/7fef5016cec12ecb0f533b638fd25ae3f36b78c903393a5c58b1dfa952e0cd57.jpg) + +![](images/e13279885a2248393892d798a732f4eaaa2eb1a7c90c262c8f17f4284508d8fb.jpg) + +![](images/acc9cc51648bee86b184cbc6eb98e688a67e14dfb479ad6f2a0d0c259156f4c4.jpg) + +![](images/bdc899a2e8898fd19854d6ceae866591bd66752ef14a57d9f62345b11e89f7cf.jpg) +Figure 2: Behavior of joint GAN training with kernel width: Example trajectories of generated points over the course of training (red lines with final point marked as a cross), true distribution (green), final discriminator (blue and yellow colormap). + +![](images/e0cb7b741f28675c2b0bce8f763f51cc3432d6228a0f4a7976f1a0d2d3e783e2.jpg) + +![](images/e03f04fc593cf5558c3df3872c1513dc3c7a5c1336b773b87a7bc68a47dd6b3a.jpg) + +The results for the isolated points model provide additional insight. The isolated points assumption arises when the true points become separated at a distance much greater than $\sigma$ . In such cases, we have seen that at least two failure modes become possible: (1) approximate mode collapse, as described in Theorem 2; and (2) divergence, as described in Theorem 3, where generated points isolated from all true points diverge in arbitrary directions. These two failure mechanisms may be prevented with a wider kernel width to preclude the isolated points assumption. However, wide kernel widths come at the price of poor discriminator power and slow convergence near the true point. + +# 7 Numerical Examples + +We conduct a simple experiment on low-dimensional, synthetic data to illustrate the behavior that the theory predicts. We also look at the frequency of GAN failure modes as a function of kernel width of the discriminator. Our main observation is that failure most often occurs when the model is in an isolated points regime at small kernel width. + +Two simple datasets for the true data are used: A set of $N_r = 4$ points arranged on uniformly on the unit circle in dimension $d = 2$ ; and a set of $N_r = 10$ points randomly distributed on the unit sphere in dimension $d = 10$ . In both cases, we initialize $N_g = N_r$ generated point as Gaussians with zero mean and $\mathbb{E} \| \widetilde{\boldsymbol{x}}_j \|^2 = 1$ . We approximate the RBF discriminator using a random Fourier feature map as in [24]. We set $\lambda = 0.01$ and $\eta_d = \eta_g = 10^{-3}$ and use 40000 training steps. Other details are in the Supplementary material. + +Figure 2 show example trajectories for the $d = 2$ case for different kernel widths $\sigma$ . For the two dimensional setting we visualize the trajectories of generated points over the course of training in Figure 2. We see a diverging behavior at very small kernel widths, as these generated points are not influenced by the kernels of the true points. Instead they "wander" off. Although Theorem 3 shows linear diverging trajectories, other diverging trajectories may be possible due to the randomness + +![](images/9a8a33c484c0e3a86d15a6b0d189879719612cdfbe43cdaeaa22e90437479810.jpg) +(a) Normalized Wasserstein distance + +![](images/bf8f6de80f856f8c1fa61d23f8f2bc936d1f81dc39ad15d998f903ac1a334a44.jpg) +(b) Frequency of divergence +Figure 3: Frequency of different GAN failure modes in a four point, two dimensional setting and a 10 point, 10 dimensional setting. (a) The median change in Wasserstein distance between true and generated distributions after 40k iterations. Different kernel widths of an RBF kernel discriminator are tested. (b) The average percentage of diverging generated points after training a GAN with RBF kernel discriminator. A generated point is considered diverging if $\| \widetilde{\boldsymbol{x}}\| _2 > 2$ + +in Fourier feature map. Also, in the example at $\sigma = 0.6$ , we see an approximate mode collapse where two generated points converge to a single true point. Finally, at very large kernel widths the discriminator is not able to properly distinguish between distributions, and as a result we see large oscillations. The discriminator gradients are much smoother, meaning they are closer to the linear discriminator regime from the original Dirac-GAN analysis [19, 26]. + +To measure how these failure mechanisms affect the overall performance, for each kernel width $\sigma$ , we run 100 trials of the true and generated points. Figure 3 plots the median performance of the GAN along two metrics. In Figure 3(a), we measure the Wasserstein-2 distance [14] between true and generated distributions before and after training period for a fixed number of iterations. The Wasserstein-2 distance is estimated by [7] and provides a error due to diverging points and mode collapse. We see that at very low kernel widths, the normalized error can be even greater than one, meaning that the generated points are further from the true points than their initial value. This behavior is a result of the divergence. At very high kernel widths, there is also significant error due to the slow convergence and lack of power of the discriminator. + +As a simple measure of frequency of divergence, Figure 3b measures the average fraction of generated points, $\widetilde{\boldsymbol{x}}_j$ , where $\| \widetilde{\boldsymbol{x}} \|_2 > 2$ at the end of the iterations. Since the true points are on the unit sphere $(\| \boldsymbol{x}_i \| = 1)$ , this condition can be considered as a case where the generated points have move significantly from all the true points. As expected, we see that the frequency of divergence increases with small kernel width. However, for dimension $d = 10$ , the frequency of divergence is small for very low kernel widths. This phenomena is a result of the fact that we are approximating the RBF with random features. As shown in [24], the number of features required for a good approximation to the RBF grows with $d^2$ . + +# 8 Potential Solutions via Multi-Scale Kernels + +The above discussion and simulations show that there is a fundamental trade-off with respect to the kernel width. On the one hand, very wide kernels tend to provide slow rates of convergence. In addition, they are not able to accurately discriminate between true points that are close. On the other hand, very narrow width kernels can result in true points being isolated from one another. The results in this paper show that isolated points can lead to both approximate mode collapse and divergence of generated points far away from the true distribution. Fortunately, the analysis in the paper suggests a way to avoid both of these conditions. Specifically, suppose we consider a kernel where the discriminator is of the form: + +$$ +f (x, \theta_ {1}, \theta_ {2}) := a _ {1} (x) ^ {\mathsf {T}} \theta_ {1} + a _ {2} (x) ^ {\mathsf {T}} \theta_ {2}, \tag {27} +$$ + +where $a_1(x)$ and $a_2(x)$ are two basis functions and $\theta = (\theta_1, \theta_2)$ are the parameters. The kernel for this discriminator is: + +$$ +K (x, x ^ {\prime}) = K _ {1} \left(x, x ^ {\prime}\right) + K _ {2} \left(x, x ^ {\prime}\right), \tag {28} +$$ + +![](images/b7ddc58c590622f5b7fc2e5d3f15b98fc9fea158ed91b9ec9154c859835e0416.jpg) +Figure 4: GAN training dynamics using fixed-width kernel discriminators (blue, yellow, and green dashed lines) compared to the GAN training dynamics using a feature map constructed by concatenation of fixed-width feature maps (illustrated by solid line). A concatenated feature map produces a kernel that is a linear combination of its component kernels + +where $K_{i}(x,x^{\prime}) = a_{i}(x)^{\top}a_{i}(x^{\prime})$ are the kernels for each of the bases. + +Now, suppose that $a_1(x)$ and $a_2(x)$ are selected so that $K_{1}(x)$ has a wide width and $K_{2}(x)$ has a small width. We call such a kernel multi-scale. The overall kernel (28) will have a heavy tail component due to the "wide" kernel $K_{1}(x)$ . Hence, it can avoid the isolated points problem. On the other hand, since $K_{2}(x)$ has a small width, the kernel will have a "sharp" component. This may enable fast convergence near the true distribution. + +To illustrate the potential use of such a multi-scale kernel, Fig. 4 compares the performance of kernels with three fixed widths of $\sigma \in \{0.1, 1, 10\}$ with a single kernel concatenated with all three widths. The true and generated data are single point masses with an initial distance of 10. As expected, the very low width kernel ( $\sigma = 0.1$ ) fails to converge while the wide width kernels ( $\sigma = 1, 10$ ) converge slowly. In contrast, the concatenated kernel is able to get fast convergence in both the initial and later stages. Of course, further work will be needed to find out the best architectures for networks with multiple widths for complex practical data. In the context of neural network discriminators, such multi-scale kernel behavior may be achieved using parallel networks with varying depths, or the use of skip connections. However, designing such a discriminator requires further investigation. + +# 9 Conclusion + +In this paper we propose a new framework for understanding behaviors exhibited by training GANs. By assuming isolated neighborhoods around each true point, we can decouple the kernel GAN training dynamics that occur when jointly updating a generator and discriminator. Using this model we theoretically derive conditions that explain well-known training behavior in GANs. While a stable local equilibrium exists when true and generated distributions match exactly, bad local minima exist as well. Specifically a true point can "greedily" hold onto multiple generated points in a region determined by the discriminator kernel width, leading to the phenomenon of approximate mode collapse. We provide theoretical and empirical evidence of a diverging failure mode as well, where one or more generated points completely escape the influence of the true distribution and travel along arbitrary trajectories. Through this analysis, it becomes clear that kernel width in particular plays an important role in this behavior. + +There are several possible lines of future work. Most importantly, we have studied a simple GAN without gradient penalties, as is commonly used in methods such as [2, 3, 13, 17]. Future work can also consider the convergence. Our linearized analysis provides the eigenvalues which can be used for rates close to the equilibrium as performed in [21, 22, 30]. Finally, there is a large body of literature connecting kernels to the neural networks via the so-called neural tangent kernel (NTK) [15] and may be useful to study here as well. + +# Acknowledgments and Disclosure of Funding + +S. Rangan was supported in part by NSF grants 1952180, 1925079, 1564142, 1547332, the SRC, and the industrial affiliates of NYU WIRELESS. + +# References + +[1] Hamed Alqahtani, Manolya Kavakli-Thorne, and Gulshan Kumar. Applications of Generative Adversarial Networks (GANs): An Updated Review. Archives of Computational Methods in Engineering, 28(2):525-552, March 2021. +[2] Martin Arjovsky and Léon Bottou. Towards principled methods for training generative adversarial networks, 2017. +[3] Martin Arjovsky, Soumith Chintala, and Léon Bottou. Wasserstein generative adversarial networks. In International conference on machine learning, pages 214-223. PMLR, 2017. +[4] Yogesh Balaji, Mohammadmahdi Sajedi, Neha Mukund Kalibhat, Mucong Ding, Dominik Stöger, Mahdi Soltanolkotabi, and Soheil Feizi. Understanding overparameterization in generative adversarial networks, 2021. +[5] Alberto Bietti and Julien Mairal. On the Inductive Bias of Neural Tangent Kernels. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d' Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. +[6] Mikołaj Binkowski, Danica J Sutherland, Michael Arbel, and Arthur Gretton. Demystifying MMD GANs. arXiv preprint arXiv:1801.01401, 2018. +[7] Nicolas Bonneel, Michiel Van De Panne, Sylvain Paris, and Wolfgang Heidrich. Displacement interpolation using lagrangian mass transport. In Proceedings of the 2011 SIGGRAPH Asia conference, pages 1-12, 2011. +[8] Ali Borji. Pros and cons of GAN evaluation measures: New developments. CoRR, abs/2103.09396, 2021. +[9] Jean-Yves Franceschi, Emmanuel de Bezenac, Ibrahim Ayed, Mickaël Chen, Sylvain Lamprier, and Patrick Gallinari. A neural tangent kernel perspective of gans, 2021. +[10] Ian Goodfellow. Nips 2016 tutorial: Generative adversarial networks. arXiv preprint arXiv:1701.00160, 2016. +[11] Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial networks, 2014. +[12] Arthur Gretton, Karsten M Borgwardt, Malte J Rasch, Bernhard Schölkopf, and Alexander Smola. A kernel two-sample test. The Journal of Machine Learning Research, 13(1):723-773, 2012. +[13] Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron Courville. Improved training of wasserstein gans. arXiv preprint arXiv:1704.00028, 2017. +[14] Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. Advances in neural information processing systems, 30, 2017. +[15] Arthur Jacot, Franck Gabriel, and Clément Hongler. Neural tangent kernel: Convergence and generalization in neural networks. In Advances in neural information processing systems, pages 8571-8580, 2018. +[16] Valentin Khrulkov, Artem Babenko, and Ivan Oseledets. Functional space analysis of local gan convergence. In International Conference on Machine Learning, pages 5432-5442. PMLR, 2021. +[17] Naveen Kodali, Jacob D. Abernethy, James Hays, and Zsolt Kira. How to train your DRAGAN. CoRR, abs/1705.07215, 2017. +[18] Chun-Liang Li, Wei-Cheng Chang, Yu Cheng, Yiming Yang, and Barnabás Póczos. MMD GAN: Towards deeper understanding of moment matching network. Advances in neural information processing systems, 30, 2017. +[19] Lars Mescheder, Andreas Geiger, and Sebastian Nowozin. Which training methods for gans do actually converge?, 2018. +[20] Lars Mescheder, Sebastian Nowozin, and Andreas Geiger. The numerics of gans. Advances in neural information processing systems, 30, 2017. + +[21] Youssef Mroueh and Truyen Nguyen. On the convergence of gradient descent in gans: Mmd gan as a gradient flow. In International Conference on Artificial Intelligence and Statistics, pages 1720-1728. PMLR, 2021. +[22] Vaishnavh Nagarajan and J. Zico Kolter. Gradient descent gan optimization is locally stable, 2018. +[23] Weili Nie and Ankit B Patel. Towards a better understanding and regularization of gan training dynamics. In Uncertainty in Artificial Intelligence, pages 281-291. PMLR, 2020. +[24] Ali Rahimi and Benjamin Recht. Random features for large-scale kernel machines. In J. Platt, D. Koller, Y. Singer, and S. Roweis, editors, Advances in Neural Information Processing Systems, volume 20. Curran Associates, Inc., 2007. +[25] Eitan Richardson and Yair Weiss. On gans and gmms. CoRR, abs/1805.12462, 2018. +[26] Hoang Thanh-Tung, Truyen Tran, and Svetha Venkatesh. On catastrophic forgetting and mode collapse in generative adversarial networks. CoRR, abs/1807.04015, 2018. +[27] Thomas Unterthiner, Bernhard Nessler, Calvin Seward, Günter Klambauer, Martin Heusel, Hubert Ramsauer, and Sepp Hochreiter. Coulomb GANs: Provably optimal Nash equilibria via potential fields. arXiv preprint arXiv:1708.08819, 2017. +[28] Mathukumalli Vidyasagar. Nonlinear systems analysis, volume 42. Siam, 2002. +[29] Zhengwei Wang, Qi She, and Tomás Ward. Generative adversarial networks in computer vision: A survey and taxonomy. ACM Computing Surveys, 54:1-38, 02 2021. +[30] Kun Xu, Chongxuan Li, Jun Zhu, and Bo Zhang. Understanding and stabilizing gans' training dynamics with control theory. arXiv preprint arXiv:1909.13188, 2019. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] The Introduction has a section on main contributions to highlight the key items. +(b) Did you describe the limitations of your work? [Yes] The introduction and model clearly define the specific model we are considering. The conclusions describes avenues of future work not considered here. +(c) Did you discuss any potential negative societal impacts of your work? [No] As a theoretical result, we did not see any negative societal impacts. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] The guidelines are reviewed. + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] All assumptions are stated in the Model section and theorem statements +(b) Did you include complete proofs of all theoretical results? [Yes] They are included in the supplementary material. + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] Code is added as supplementary material +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] Main hyperparameters are discussed in the main results, details included in the supplementary +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] We considered a large number of trials and took the median. +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [No] Due to the simplicity of the experiments, this was not necessary + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [N/A] We only used standard existing code packages such as pytorch. +(b) Did you mention the license of the assets? [N/A] +(c) Did you include any new assets either in the supplemental material or as a URL? [No] No new assets were needed. +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] No subjects were tested. +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] No personally identifiable was used. + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/instabilityandlocalminimaingantrainingwithkerneldiscriminators/images.zip b/instabilityandlocalminimaingantrainingwithkerneldiscriminators/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..5b7caa5cafce479d128b59b6b0f7871204e9d2c5 --- /dev/null +++ b/instabilityandlocalminimaingantrainingwithkerneldiscriminators/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af5bb16e03a80f0d020ef4ac27e172564ef2adb4eee1537d1ffc10cb055c0538 +size 340331 diff --git a/instabilityandlocalminimaingantrainingwithkerneldiscriminators/layout.json b/instabilityandlocalminimaingantrainingwithkerneldiscriminators/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..8ec91009fa7ab83543ec149e060a89e70f42055f --- /dev/null +++ b/instabilityandlocalminimaingantrainingwithkerneldiscriminators/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:50ecc282fe374a1c10aba54b6f3060cc17d53b23775a9f81fccfabb6106b8afe +size 518869 diff --git a/instancebasedlearningforknowledgebasecompletion/bd5a584b-44f3-4c13-964f-d64862c16415_content_list.json b/instancebasedlearningforknowledgebasecompletion/bd5a584b-44f3-4c13-964f-d64862c16415_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..e9175ea6242748c59210e84ebccd53f082618f47 --- /dev/null +++ b/instancebasedlearningforknowledgebasecompletion/bd5a584b-44f3-4c13-964f-d64862c16415_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2718fca3544bdfc861a2320100016e251454b77baa7dec13c3c3092087f4e1b1 +size 75650 diff --git a/instancebasedlearningforknowledgebasecompletion/bd5a584b-44f3-4c13-964f-d64862c16415_model.json b/instancebasedlearningforknowledgebasecompletion/bd5a584b-44f3-4c13-964f-d64862c16415_model.json new file mode 100644 index 0000000000000000000000000000000000000000..a02092fb099ce45bd533e2599375807796f4112c --- /dev/null +++ b/instancebasedlearningforknowledgebasecompletion/bd5a584b-44f3-4c13-964f-d64862c16415_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:972b7ebad3f3606671684bcda0501ce8843a2b8615bf78ebbd5246390cb6d101 +size 91386 diff --git a/instancebasedlearningforknowledgebasecompletion/bd5a584b-44f3-4c13-964f-d64862c16415_origin.pdf b/instancebasedlearningforknowledgebasecompletion/bd5a584b-44f3-4c13-964f-d64862c16415_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..82250528eb7fde53483a211c2e1a2c0ba3ca5712 --- /dev/null +++ b/instancebasedlearningforknowledgebasecompletion/bd5a584b-44f3-4c13-964f-d64862c16415_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3cc2ac055ebb454a72b279b61dd894d865d2f7343e6feabd9e21d003ae05c71e +size 390453 diff --git a/instancebasedlearningforknowledgebasecompletion/full.md b/instancebasedlearningforknowledgebasecompletion/full.md new file mode 100644 index 0000000000000000000000000000000000000000..cff708f47aeb593824ee4da387edb2537fea0414 --- /dev/null +++ b/instancebasedlearningforknowledgebasecompletion/full.md @@ -0,0 +1,340 @@ +# Instance-based Learning for Knowledge Base Completion + +Wanyun Cui $^{1}$ , Xingran Chen $^{2}$ + +Shanghai University of Finance and Economics1 + +University of Michigan + +cui.wanyun@sufe.edu.cn, chenxran@umich.edu + +# Abstract + +In this paper, we propose a new method for knowledge base completion (KBC): instance-based learning (IBL). For example, to answer (Jill Biden, lived city,?) instead of going directly to Washington D.C., our goal is to find Joe Biden, who has the same lived city as Jill Biden. Through prototype entities, IBL provides interpretability. We develop theories for modeling prototypes and combining IBL with translational models. Experiments on various tasks confirmed the IBL model's effectiveness and interpretability. + +In addition, IBL shed light on the mechanism of rule-based KBC models. Previous research has generally agreed that rule-based models provide rules with semantically compatible premises and hypotheses. We challenge this view. We begin by demonstrating that some logical rules represent instance-based equivalence (i.e. prototypes) rather than semantic compatibility. These are denoted as IBL rules. Surprisingly, despite occupying only a small portion of the rule space, IBL rules outperform non-IBL rules in all four benchmarks. We use a variety of experiments to demonstrate that rule-based models work because they have the ability to represent instance-based equivalence via IBL rules. The findings provide new insights of how rule-based models work and how to interpret their rules. + +# 1 Introduction + +In knowledge base completion (KBC), the learner attempts to infer new facts about the world from given training facts (head, relation, tail). This problem has intrigued many researchers' interest as it's both a fundamental task of relational data representation learning [16, 33] and a benefit for downstream KB-based applications [34, 39]. + +One typical way of KBC is to answer (head, relation, ?) or (?, relation, tail). Knowledge graph embedding [4, 10] and rule-based reasoning [17, 38] are two typical KBC methods. Knowledge graph embedding learns low-dimensional vectors for entities and relations. One disadvantage of knowledge graph embedding is its lack of interpretability. Rule-based reasoning provides interpretability by transforming queries into human-readable logical rules. However, the predictions are constrained by the rule length $k$ . As $k$ increases, the rule-based search space expands exponentially, increasing the difficulty of mining high-quality rules. + +In this paper, we explore an alternative method: instance-based learning (IBL) [15, 26]. Instead of performing explicit generalization, IBL generates predictions by comparing query instances with instances seen in training. Despite its rich history in machine learning, IBL has not seen applied in KBC. In terms of KBC, instead of directly finding the target entity to the query, we ask which alternative entities share the same value with the query entity and relation? For example, for the query (Jill Biden, lived city, ?), instead of directly finding Washington D.C. from the vector space or by rules, we first identify the entity Joe Biden, who has the same lived city as Jill Biden. In this + +paper, Joe Biden is referred to the prototype for that query. To answer the query, we will use the prototype's known fact (i.e., (Joe Biden, lived city, Washington D.C.)). + +The main motivation behind IBL is the low-rank assumption, which holds that real-world knowledge is interdependent. Such assumption has been popularized with the Netflix challenge [9] and now frequently employed in knowledge graph embedding [10, 30, 37]. In the instance-based setting, we found that the low-rank assumption is significant and clear. For example, Joe Biden and Jill Biden share the same lived city because they have the same marriage event and the same children. + +IBL has several advantages over traditional KBC methods: first, it enables interpretability through prototypes. For example, inferring Jill Biden's lived city from Joe Biden rather than Barack Obama makes more sense. Second, in contrast to rule-based reasoning, IBL is not constrained by the $k$ -step neighborhood. In addition, the search space is always $O(n\_ entity)$ . Third, it helps KB curation by ensuring high-quality reasoning as the KB grows dynamically [35]. For example, we can still use Joe Biden to infer Jill Biden's lived city if she moves to another city in the future. + +Due to the complexity of the knowledge graph, it is still challenging to find correct prototypes among the massive number of entities. Fortunately, although IBL is a new KBC method, we theoretically show that prototypes have closed-form expressions with the well-studied translational models [4, 12, 27] in Sec 3. The derived IBL model has competitive performance with cutting-edge KBC methods. In addition, we establish a joint optimization theory of the IBL model and the translational model in Sec 4, revealing the concordance in terms of their optimization objectives. The combined model inspired by this theory outperforms existing methods in two out of four benchmarks. + +Although IBL appears to be irrelevant to rule-based KBC models, we found IBL shed light on its mechanism (Sec 5). Previous literature has commonly agreed that logical rules provide semantically compatible premises and hypotheses. We show that, some rules need to be interpreted through instance-based equivalence, rather than the semantic compatibility. We call them IBL rules. Surprisingly, although IBL rules only occupy a small fraction of the entire rules space, they play a significant role in rule-based reasoning. In Sec 7, we show that IBL rules are more critical than all other rules in all four benchmarks, and can even replace all other rules completely with no effect degradation in two of four benchmarks. This phenomenon challenges the previously common understanding of how logical rules work and provide interpretability. Rule-based models rely much on their ability to represent instance-based equivalence to infer new knowledge. The interpretability of logical rules should be revisited from the perspective of instance-based equivalence. And the IBL method proposed in this paper is a more effective alternative to rule-based methods when modeling the equivalency. + +Our contributions are outlined as follows: (1) we explore instance-based learning for KBC. IBL provides interpretability while not being constrained by local neighborhoods. (2) Using translational models, we prove that prototypes have closed-form expressions. (3) We developed a joint optimization theory for IBL and translational models as a foundation for combing different KBC models. Experimental results show that the combined model outperforms existing methods on two out of four benchmarks. (4) We found that rule-based reasoning relies heavily on IBL rules to represent the instance-based equivalence. The results suggest that the mechanism and interpretability of rule-based reasoning should be reassessed in terms of instance-based equivalence. + +# 2 Related Work + +For a comprehensive survey of knowledge graph completion, we refer readers to [33]. + +Learning representations for knowledge via prototypes Another theory that provides support to our work is the prototype theory. The term prototypes, as initially defined in psychologist Eleanor Rosch's study "Natural Categories" [20], has been widely studied in psychology [19] and cognitive linguistics [28]. Bobrow and Winograd [3] used the prototype theory to the general knowledge representation. The general consensus is that knowledge reasoning is dominated by a recognition process in which new objects and events are compared to stored sets of expected prototypes. Although the prototype theory is widely studied in a variety of domains, our study is the first to apply the prototype theory for KBC to our knowledge. We concretize the theory as the equivalence of query entities to prototypes on specific relations, thus allowing knowledge reasoning. + +Instance-based learning There is a large body of literature on IBL. The k-nearest neighbors algorithm (kNN), which uses the k-nearest examples as prototypes, is the most representative work. Besides, [18] proposed to use model-based methods to calibrate the prototypes in the instance-based method. In recent years, IBL has also shown its great potentials to few-shot learning [1, 25] and self-supervised learning [32]. One trend of IBL is to leverage metric learning for prototype selection [8, 36], in particular, using neural networks for instance embedding [13, 22]. In this paper, similar to [13, 22], we use trainable entity embeddings to represent prototypes. + +# 3 Models + +In this section, we first formalize the KBC problem (Sec 3.1). Then we demonstrate how translational models allow prototype modeling with closed-form expressions (Sec 3.2 3.3). We also investigate the relation-awareness property for specific translational representations (Sec 3.4). + +# 3.1 Problem: Link Prediction for Knowledge Base Completion + +KBs are collections of triplet facts that represent world knowledge (head, relation, tail). We denote the fact in the KB as $\mathcal{D} = \{(h_1,r_1,t_1)\dots (h_n,r_n,t_n)\}$ . As it is impossible to collect all facts, a fundamental problem is to predict the missing facts. In this paper, we formalize the completion task as link prediction. The query format in the test set is $(h,r,\ref{eq:2})$ or $(?r,t)$ . + +# 3.2 Translational Models + +Translational models are one of the mainstream methods of KBC. The main idea behind translational models is to model relations between entities as a translation from head to tail over the vector space. For a new fact, its plausibility can be calculated by the distance between the translated head entity and the tail entity. We formulate the plausibility of $(h,r,t)$ as below: + +$$ +\mathcal {T} (\mathrm {h}, \mathrm {r}, \mathrm {t}) = \| \operatorname {t r a n s} _ {\mathrm {r}} (\operatorname {e m b} (\mathrm {h})) - \operatorname {e m b} (\mathrm {t}) \| \tag {1} +$$ + +where $emb(\cdot)$ denotes the entity embedding, and $trans_{r}(\cdot)$ denotes the translation w.r.t. $r$ . + +There are numerous variants under the translational framework. Here we present some typical models. The feasibility of exploiting these models for IBL are investigated in Sec 3.4. + +TransE [4] stores the embeddings $emb(\cdot)$ in an embedding matrix. It uses the simplest vector addition as the translation $trans_r(\cdot)$ . Its scoring function is: + +$$ +\operatorname {T r a n s E} (\mathrm {h}, \mathrm {r}, \mathrm {t}) = \| \mathbf {e} _ {\mathrm {h}} + \mathrm {r} - \mathbf {e} _ {\mathrm {t}} \| \tag {2} +$$ + +TransR [12] extends TransE by adding a relationship matrix $\mathbf{W}_{\mathrm{r}}$ , which maps embeddings of entities from the entity space to the relational space: + +$$ +\operatorname {T r a n s R} (\mathrm {h}, \mathrm {r}, \mathrm {t}) = \| \mathbf {W} _ {\mathrm {r}} \mathbf {e} _ {\mathrm {h}} + \mathrm {r} - \mathbf {W} _ {\mathrm {r}} \mathbf {e} _ {\mathrm {t}} \| \tag {3} +$$ + +RotatE [27] is a cutting-edge translational model. It represents the translation via rotations in the complex space (denoted as $\circ$ ). It has the following scoring function: + +$$ +\operatorname {R o t a t E} (\mathrm {h}, \mathrm {r}, \mathrm {t}) = \| \mathbf {e} _ {\mathrm {h}} \circ \mathrm {r} - \mathbf {e} _ {\mathrm {t}} \| \tag {4} +$$ + +# 3.3 Modeling Prototypes in IBL + +In IBL, given the query entity and relation, our primary goal is to locate the prototype whose value is the same as the query and is present in the training data. We say $p$ is the prototype of $(h,r,?)$ if $(p,r,?) = (h,r,?)$ . For example, Joe Biden is a prototype of the query (Jill Biden, lived city,?), since (Jill Biden, lived city,?) = (Joe Biden, lived city,?) = Washington D.C. The prototype of $(? , r , t )$ is defined similarly. + +We show that the prototype computation is tractable using translational models. We take advantage of a translational model property: $\text{trans}_r(\cdot)$ is a mapping from the head and relation to the tail in the vector space. Thus, given the query, the prototype can be determined by Lemma 1. + +Lemma 1. For an optimal translational model $\mathcal{T}$ , the prototypes $P$ of $(h,r,?)$ are: + +$$ +P = \left\{p \mid \operatorname {t r a n s} _ {r} (\mathrm {e m b} (h)) = \operatorname {t r a n s} _ {r} (\mathrm {e m b} (p)) \right\} \tag {5} +$$ + +Lemma 1 employs the absolute equality of vectors for the ideal case. In practice, we relax this restriction by using the differentiable vector distance instead. In particular, we model the plausibility of a candidate prototype $p$ by: + +$$ +\mathrm {f} _ {\mathrm {h r}} (\mathrm {p}) = \max (\gamma - \| \operatorname {t r a n s} _ {\mathrm {r}} (\mathrm {e m b} (\mathrm {h})) - \operatorname {t r a n s} _ {\mathrm {r}} (\mathrm {e m b} (\mathrm {p})) \|, 0) \tag {6} +$$ + +where we use marginal distance because closer distance means higher plausibility. Symmetrically, we model the prototype for the query $(?,r,t)$ by: + +$$ +\mathrm {f} _ {\mathrm {r t}} (\mathrm {p}) = \max (\gamma - \| \operatorname {t r a n s} _ {\mathrm {r}} ^ {- 1} (\mathrm {e m b} (\mathrm {t})) - \operatorname {t r a n s} _ {\mathrm {r}} ^ {- 1} (\mathrm {e m b} (\mathrm {p})) \|, 0) \tag {7} +$$ + +where $trans_{r}^{-1}$ is the inverse of $trans_{r}$ . For example, TransE [4] uses vector subtraction as $trans_{r}^{-1}$ . + +For a given query $(h,r,?)$ , we consider all candidate prototype entities whose relation $r$ is known in the training data. We aggregate these prototypes based on their scores in Eq. (6). The score of a tail entity $t$ is the sum of scores of its corresponding prototypes: + +$$ +\mathcal {I} _ {\mathrm {h r}} (\mathrm {t}) = 1 / \left(\gamma \mid \{\mathrm {p} \mid (\mathrm {p}, \mathrm {r}, \mathrm {t}) \in \mathcal {D} \} \mid\right) \sum_ {(\mathrm {p}, \mathrm {r}, \mathrm {t}) \in \mathcal {D}} \mathrm {f} _ {\mathrm {h r}} (\mathrm {p}) \tag {8} +$$ + +where $1 / (\gamma |\{p|(p,r,t)\in \mathcal{D}\})$ is used to normalize the score. The score of a head entity $h$ for $(?,r,t)$ is computed symmetrically. We denote the above model $\mathcal{I}$ as IBLE (instance-based learning). We use the cross-entropy between $\mathcal{I}_{hr}(t)$ and the ground-truth entity as the training objective. + +We highlight that IBLE's aggregating strategy in Eq. (8) differs from GNNs [23]. For query $(\mathrm{h},\mathrm{r},?)$ , regardless of whether the instance is a neighbor of $\mathrm{h}$ , we aggregate the instance $\mathfrak{p}$ throughout the full instance space whose relation $\mathbf{r}$ is known (i.e. $\{\mathfrak{p}|\left(\mathfrak{p},\mathbf{r},\mathfrak{t}\right)\in \mathcal{D}\}$ ). + +# 3.4 Relation-awareness for Prototype Modeling + +Next, using Eq. (6), we analyze the property of relation-awareness for prototype modeling. It is obvious that whether an entity is the prototype depends on the query relation. Joe Biden, for example, is a prototype of Jill Biden for lived_city, but not for profession. We summarize the relation-awareness of TransE, TransR and RotatE by substituting them into Eq. (6) in Table 1. + +Table 1: Prototype modeling by translational models + +
ModelPrototype modelingRelation-aware
TransE||eh - ep|| (10)No
TransR||Wr e_h - Wr e_p|| (11)Yes
RotatE||eh - e_p|| (12)No
R-RotatE||Wr e_h - Wr e_p|| (13)Yes
+ +Prototypes by TransE and RotatE are not relation-aware because Eq. (9) and Eq. (10) consider only entity embeddings and is agnostic to the relation $r$ . The relational matrix $\mathbf{W}_r$ , on the other hand, allows TransR to distinguish different relations. + +Since RotatE is the cutting-edge translational model, we propose to optimize its representations. We integrate the relational matrix from TransR into RotatE, denoted as relational-RotatE (R-RotatE): + +$$ +\operatorname {R - R o t a t E} (\mathrm {h}, \mathrm {r}, \mathrm {t}) = \| \mathbf {W} _ {\mathrm {r}} \mathbf {e} _ {\mathrm {h}} \circ \mathrm {r} - \mathbf {W} _ {\mathrm {r}} \mathbf {e} _ {\mathrm {t}} \| \tag {14} +$$ + +We show the prototype modeling of R-RotatE in Table 1. + +Remark 1. TransR and R-RotatE are relation-aware for prototype modeling, whereas TransE and RotatE are not. + +An interesting phenomenon is, TransE and RotatE actually have the same prototype model, as do TransR and R-RotatE. In this paper, we use the prototype modeling of TransR and R-RotatE by default. + +# 4 Combine IBL and Translational Models + +Embeddings of entities and relations of IBL can be directly reused in the translational model. In this section, we develop the theory of the joint optimization for IBL and the translational model. We show that their objectives are compatible. The theory motivates us to combine IBL with the translational model. + +We denote the IBL model and the translational model with shared entity and relation embeddings $\theta$ as $\mathcal{I}_{\theta}$ and $\mathcal{T}_{\theta}$ , respectively. We show that the optimization objectives of $\mathcal{I}^{\theta}$ and $\mathcal{T}^{\theta}$ are compatible in Lemma 2. + +Lemma 2. If we use margin loss for the translational model, and cross-entropy loss for the IBL model, and negative sampling to train both models, then the global minimum of the training criterion of $\mathcal{T}^{\theta}$ can be obtained only if $\mathcal{T}^{\theta}$ also reaches its optimum. + +This inspires us to propose CIBLE (combined instance-based learning) model, which combines $I_{\theta}$ and $T_{\theta}$ with the following scoring function: + +$$ +\mathcal {C} _ {\mathrm {h r}} ^ {\theta} (\mathrm {t}) = (1 - \alpha) \mathcal {I} _ {\mathrm {h r}} ^ {\theta} (\mathrm {t}) + \frac {\alpha}{\gamma} \max (\gamma - \mathcal {T} ^ {\theta} (\mathrm {h}, \mathrm {r}, \mathrm {t}), 0) \tag {15} +$$ + +where $\alpha \in (0,1)$ is a hyper-parameter. We use cross-entropy as the training objective for CIBLE. The optimization objectives of $\mathcal{T}^{\theta},\mathcal{I}^{\theta}$ and $\mathcal{C}^{\theta}$ are compatible. We show this in Theorem 1 + +Theorem 1. If we use cross-entropy loss for the combined model and the IBL model, the margin loss for the translational model, and train all three models with negative sampling, then the $\theta$ values for the global minimum training criteria of $C_{\theta}$ and $\mathcal{T}_{\theta}$ are consistent. At that $\theta$ , the training criterion of $\mathcal{I}_{\theta}$ is also minimized, and: + +$$ +\mathcal {C} _ {\mathrm {h r}} ^ {\theta} (t) = \left\{ \begin{array}{l l} 1 & (h, r, t) \text {i s a v a l i d f a c t}, \\ 0 & \text {o t h e r w i s e}. \end{array} \right. \tag {16} +$$ + +# 5 Logical Rules as Prototype-based Inference + +In this section, we show that, under the low-rank assumption, the instance-based equivalence and prototypes in IBL can be represented by a particular class of logical rules. We discovered that the interpretability of these rules differs from typical rules in previous papers. More numerical analysis will be presented in Sec 7. + +Rule-based KBC models induct rules in the form of Horn clauses: $\mathrm{rel}_1\wedge \dots \mathrm{rel}_k\Rightarrow \mathrm{rel}_0$ Table 2 shows examples from the body of previous publications [17, 38]. According to these examples, it is commonly believed that the semantic compatibility between the premise and the hypothesis provides the interpretability for humans. For example, the semantics of nationality is equal to the semantics of the path born_in $\land$ place_in_country, making the rule born_in $\land$ place_in_country $\Rightarrow$ nationality human-readable. + +However, we found a special class of rules that challenge the understanding. Table 2 shows top-3 rules inducted by RNNLogic [17] for profession in FB15k-237. Clearly, these rules are in one of the following forms: + +$$ +\operatorname {r e l} _ {1} \wedge \operatorname {r e l} _ {1} ^ {- 1} \wedge \operatorname {r e l} _ {0} \Rightarrow \operatorname {r e l} _ {0} \tag {17} +$$ + +$$ +\mathrm {r e l} _ {0} \wedge \mathrm {r e l} _ {1} \wedge \mathrm {r e l} _ {1} ^ {- 1} \Rightarrow \mathrm {r e l} _ {0} +$$ + +The premises of both forms contain the composition of symmetric relations $\mathrm{rel}_1\wedge \mathrm{rel}_1^{-1}$ , whose meanings are in opposition to each other. The semantics of the premise alone cannot be understood by humans, making the connection between the premise and hypothesis unclear. + +![](images/8049353e5472a8309db61e1325d6114083a9a382e1ff355050193fbc791241b6.jpg) +Figure 1: An IBL rule indicates the instance-based relational equivalence. + +Table 2: Examples of rules. + +
Top 3 rules for profession by RNNLogic [17]. +profession←award-winning-1 ∧ award-winning ∧ profession +profession←nationality ∧ nationality-1 ∧ profession +profession←webpage_category ∧ webpage_category-1 ∧ profession
Examples from the RNNLogic paper [17]. +nationality←born_in ∧ place_in_country +organization_in_state←organization_in_city ∧ city_location_in_state
Examples from the Neural LP paper [38]. +partially.contains←contains ∧ contains +marriage_location←nationality ∧ contains
+ +However, after transforming such rules into the form of Fig. 1, their meanings become clearer. The semantics of such rules are consistent with IBL's low-rank assumption. The rule in Fig. 1 states that, conditional on the fact that $x$ and $x'$ are both the winners of award $y'$ , they also tend to have the same profession $y$ . As a result, the rule's true purpose is to find the prototype $x'$ to deduce the profession of $x$ . + +We employ translational models to provide a theoretical view of IBL rules. We take TransE as an example. In Theorem 2, we show that IBL rules always hold true under the assumption of translational models. + +Theorem 2 (The effectiveness of IBL rules). For a KB with an optimal TransE model such that $|\mathrm{e_h} + \mathrm{r} - \mathrm{e_t}| = 0$ iff $(\mathrm{h},\mathrm{r},\mathrm{t})\in \mathrm{KB}, \forall \mathrm{r}_0,\mathrm{r}_1,$ the IBL rules $\mathrm{rel}_1\wedge \mathrm{rel}_1^{-1}\wedge \mathrm{rel}_0\Rightarrow \mathrm{rel}_0$ and $\mathrm{rel}_0\wedge \mathrm{rel}_1\wedge \mathrm{rel}_1^{-1}\Rightarrow \mathrm{rel}_0$ always hold. + +We highlight the difference in interpretability between the claims in previous papers and the rules in Eq. (17). We denote rules in Eq. (17) as IBL rules. IBL rules provide interpretability by establishing instance-based equivalence relations, whereas previous papers claimed that rules typically provide interpretability by semantic relevance between the premise and hypothesis. Experimental results show that the effect and interpretability of instance-based equivalence cannot be ignored. This is elaborated in Sec 7. + +# 6 Experiments + +# 6.1 Experimental Setup + +Datasets: We select four typical KBC datasets for evaluation, including FB15k-237, WN18RR, Kinship, and UMLS $^{2}$ . For Kinship and UMLS, we use the training/validation/test division in [17]. Their statistics are shown in the Appendix. + +Baselines We compared with the following types of KBC methods. Knowledge graph embedding: TransE [4], TransR [12], DistMult [37], ComplEx [30], ConvE [6], TuckER [2], and RotatE [27]. Rule-based: RNNLogic [17], NeuralLP [38], DRUM [21], PathRank [11], MINERVA [5], CTP [14] and M-Walk [24]. Graph neural networks: NBFNet [40], GraIL [29], and RGCN [23]. + +Evaluation metrics For each test triplet $(h,r,t)$ , we construct two queries: $(h,r,?)$ and $(?,r,t)$ with the answers $t$ and $h$ . We choose Mean Rank (MR), Mean Reciprocal Rank (MRR), and hit@k under the filtered setting [27], which is consistent with most existing work. + +Implementation details We follow [27] and employ negative sampling for training. All experiments can be run on a single Nvidia Tesla V100 GPU. We illustrate the hyper-parameter search process in the Appendix. + +# 6.2 Main Results + +We present the main results in Table 3 and Table 4. IBLE is competitive with most existing KBC methods. This verifies the effect and potential of IBL, as the proposed IBLE is still primitive. In + +Table 3: Knowledge base completion results on FB15k-237 and WN18RR. $\ddagger$ means the results are from [17], and $\dagger$ means the results are from [40]. + +
CategoryModelFB15k-237WN18RR
MRMRRH@1H@3H@10MRMRRH@1H@3H@10
KG EmbeddingTransE‡3570.294--46.533840.226--50.1
DistMult‡2540.24115.526.341.951100.43039.044.049.0
ComplEx‡3390.24715.827.542.852610.44041.046.051.0
ConvE‡2440.32523.735.650.141870.43040.044.052.0
TuckER‡-0.35826.639.454.4-0.47044.348.252.6
RotatE‡1770.33824.137.553.333400.47642.849.257.1
Rule-based LearningPathRank‡-0.0877.49.211.2-0.18917.120.022.5
M-Walk‡-0.23216.524.3--0.43741.444.5-
NeuralLP‡-0.23717.325.936.1-0.38136.838.640.8
DRUM‡-0.23817.426.136.4-0.38236.938.841.0
RNNLogic‡2320.34425.238.053.046150.48344.649.755.8
RNNLogic+‡1780.34925.838.553.346240.51347.153.259.7
GNN-based LearningRGCN†2210.27318.230.345.627190.40234.543.749.4
GraIL†2053----2539----
NBFNet†1140.41532.145.459.96360.55149.757.366.6
IBL-basedIBLE2630.28420.031.045.272050.39437.740.042.7
CIBLE1700.34124.637.853.234000.49044.650.757.5
+ +Table 4: Knowledge base completion results on Kinship and UMLS. + +
CategoryAlgorithmKinshipUMLS
MRMRRH@1H@3H@10MRMRRH@1H@3H@10
KG EmbeddingDistMult‡8.50.35418.940.075.514.60.39125.644.566.9
ComplEx‡7.80.41824.249.981.213.60.41127.346.870.0
ComplEx-N3‡-0.60543.771.092.1-0.79168.987.395.7
TuckER‡6.20.60346.269.886.35.70.73262.581.290.9
RotatE‡3.70.65150.475.593.24.00.74463.682.293.9
Rule LearningMLN‡10.00.35118.940.870.77.60.68858.775.586.9
Boosted RDN‡25.20.46939.552.056.754.80.22714.725.637.6
PathRank†-0.36927.241.667.3-0.19714.821.425.2
NeuralLP‡16.90.30216.733.959.610.30.48333.256.377.5
DRUM‡11.60.33418.337.867.58.40.54835.869.985.4
MINERVA‡-0.40123.546.776.6-0.56442.665.881.4
CTP‡-0.33517.737.670.3-0.40428.843.067.4
RNNLogic‡3.10.72259.881.494.93.10.84277.289.196.5
GNN-basedNBFNet3.70.60643.572.593.73.80.77868.884.093.8
IBL-basedIBLE3.70.65051.375.593.73.20.81671.790.096.1
CIBLE3.00.72860.382.095.62.60.85678.791.697.0
+ +FB15k-237 and WN18RR, CIBLE outperforms previous state-of-the-art methods except the NBFNet. In Kinship and UMLS, CIBLE outperforms all existing methods. This verifies the effectiveness of CIBLE. + +# 6.3 Instance-based Interpretations + +Understanding model behavior via prototypes Table 5 shows the top 10 prototypes for predicting Taylor Swift and Barack Obama's nationalities in FB15k-237 according to Eq. (6). Despite the fact that they are both Americans, they have different prototypes. Taylor Swift prefers to use American singers and actors as prototypes, while Barack Obama prefers to use American politicians. These selections of prototypes are comprehensible to humans. In addition, we believe that prototypes are more transparent than logical rules, as many logical rules are semantically unclear to humans (see Table 2 for some examples). Sec 7 will delve deeper into this. + +Visualization of global model behavior In CIBLE, the distance between entity embeddings (i.e. $\text{trans}_r(emb)$ ) measures the plausibility of a candidate prototype. Here we visualize + +Table 5: Top prototypes. For the same relation (i.e. nationality), Taylor Swift and Barack Obama choose different prototypes. This illustrates the rationality of how the model infers. + +
Entity & RelationPrototypes
Taylor Swift /nationalityCarrie Underwood, Miley Cyrus, Selena Gomez, Taylor Lautner, Demi Lovato, Joe Jonas, Randy Travis, Garth Brooks, Brad Paisley, Trisha Yearwood
Barack Obama /nationalityHillary Rodham Clinton, Al Gore, Jimmy Carter, Ossie Davis, James Madison, Martin Luther King, Jr., Paul Rudd, Daniel Inouye, Colin Powell, Herbert Hoover
+ +the entity embeddings (i.e. $\mathbf{W}_r\mathbf{e}$ ) for relation official language in FB15k-237 using t-SNE [31]. The visualization provides global interpretation, since it explains the prediction for all entities, rather than for one prediction. + +The visualization provides rich information about how CIBLE makes predictions: (1) entities with the same value exhibit distinct clustering patterns, and (2) the distance between entities reflects knowledge relatedness beyond the target value. For example, Argentina (Spanish) and Brazil (Portuguese) are close to each other, since they share other relations. (3) The location interprets 1-to-N relations. For example, English, Mandarin, and Tamil are all official languages of Singapore. As a result, Singapore is close to China (Mandarin), India (English) and Sri Lanka (Tamil). + +![](images/426a56564eebc70d20bef87c5cc7c34d538504093e6a7ac0b0472c4d313793d1.jpg) +Figure 2: t-SNE visualization of entities on " /country/official_language" in FB15k-237. + +# 6.4 Analysis + +![](images/45cfdb35ab8a59989c464a086e5adf3b6b24fab1c74267c7d37751d198c6d70f.jpg) +Figure 3: Training loss on UMLS. + +Table 6: Effect of relation-awareness. + +
ModelRelation -awareFB15k-237WN18RR
MRRH@10MRRH@10
CIBLE-TransENo0.28644.70.23653.8
CIBLE-TransRYes0.34152.20.25049.7
CIBLE-RotatENo0.31550.60.43054.2
CIBLE-R-RotatEYes0.34153.20.49057.5
+ +Consistency of model optimization In Theorem 1, we show the consistency of the optimization objectives for the three models. To verify this theory, we show their training losses when optimizing CIBLE in Fig. 3. IBLE-baseline and RotatE-baseline denote the convergence of the training loss when we optimize them separately. Overall, as we optimizing CIBLE, the training loss of IBLE and RotatE both decreases. In addition, optimizing CIBLE helps IBLE converge to its minimum training loss. This verifies the consistency of the three optimization objectives. + +Effect of relation-awareness We show in Sec 3.4 that prototypes modeled by TransR and R-RotatE are relation-aware while TransE and RotatE are not. To validate the effect of relation-awareness, we compare their effect when adapting to CIBLE. Table 6 shows the results. Models with relation-awareness perform better on most metrics. This is in line with our intuition about prototypes. + +# 7 Rule-based Reasoners: Semantic Relevance or Instance-based Equivalence? + +In Sec 5, we defined a special class of logical rules, namely IBL rules. In this section, we reassess the mechanism and interpretability of logical rules by validating the effect of IBL rules. + +Table 7: Effect of IBL rules for FB15k-237 and WN18RR. + +
ModelFB15k-237WN18RR
MRMRRH@1H@3H@10MRMRRH@1H@3H@10
all rules1780.34925.838.553.3462451.347.153.259.7
non-IBL rules only12410.31723.235.148.6984944.141.945.348.5
IBL-rules only10110.32624.036.149.9894644.040.646.349.9
+ +Table 8: Effect of IBL rules for Kinship and UMLS. + +
ModelKinshipUMLS
MRMRRH@1H@3H@10MRMRRH@1H@3H@10
all rules3.10.84277.289.196.53.10.72259.881.494.9
non-IBL rules only9.90.66753.776.986.24.00.68155.077.393.2
IBL-rules only3.00.84075.191.396.63.372.159.581.494.7
+ +Earlier rule-based models learn logical rules in a differential way [21, 38]. However, their search space is exponentially large, which results in limited rule length. The recently proposed method, RNNLogic [17], was a breakthrough in its capacity to generate rules with maximum length of 5. With these longer rules, RNNLogic achieves 53.3 hit@10 in FB15k-237, compared to the previous highest hit@10 of only 36.4 for rule-based models [21]. Therefore, we use RNNLogic to investigate the effect of IBL rules. + +To demonstrate the effect of IBL rules, we control the candidate rule space of RNNLogic by modifying its rule collection module. We carried out the following ablations: (1) collecting rules from the entire rule space; (2) collecting only non-IBL rules; (3) collecting only IBL rules. Table 7 and Table 8 show the effects of these ablations. + +The results are surprising. Despite the fact that IBL rules only cover a small portion of the entire rule space, learning IBL rules outperforms learning non-IBL rules in all four benchmarks. In Kinship and UMLS, learning only IBL rules has almost no performance degradation when compared to learning from the entire rule space. The results indicate that, the small number of IBL rules are even more critical than non-IBL rules. + +These findings challenge the widely-held belief that rule-based reasoning use rules whose premises and hypotheses are semantically compatible. The results imply that rule-based KBC models work largely because its capability to represent instance-based equivalence (i.e. prototypes) via IBL rules. The interpretability from instance-based equivalency should not be overlooked in rule-based models. + +To understand why IBL rules outperform other semantic non-IBL rules, we investigate the quality of each rule. More concretely, we show the average precision and support [7] of each collected rule for different rule types in Table 9. The results show that both the average precision and support of IBL rules are substantially higher than those of non-IBL rules. The high quality of IBL rules explains why they outperform non-IBL rules despite occupying only a small fraction of the entire rule space. + +IBL-based vs rule-based models When representing the instance-based equivalence relationship, CIBLE is more flexible and theoretically sound than rule-based models using IBL rules. In Table 3 4, despite the fact that RNNLogic employs a complex EM algorithm for learning, CIBLE outperforms RNNLogic in three of the four benchmark. Therefore, we consider CIBLE to be a more effective alternative to the rule-based models in instance-based equivalency modeling. + +Table 9: Average support and precision of IBL and non-IBLE rules. + +
FB15k237WN18RRUMLSKinships
IBL Rule708.3 / 3.7%2374.3 / 12.7%3.0 / 11.6%8.7 / 11.6%
Non-IBL Rule281.4 / 1.7%188.3 / 5.0%3.0 / 9.5%6.7 / 5.1%
+ +# 8 Conclusion + +In this paper, we explore a novel IBL-based method for KBC. We validate its effectiveness in two aspects. First, we show that the prototypes can be expressed in a closed-form with the well-studied translational models, and IBL-based models can be cotypecombined with translational models. Second, we found that rule-based reasoning relies heavily on IBL rules. This challenges previous common understanding of how logical rules work and provide interpretability. + +Broader impact Our proposed IBL method provides a new paradigm for learning representations for knowledge bases. Based on the results of the experiments, the IBL paradigm can be combined with translational models and rule-based reasoners and enhance the effectiveness. Our theory has provided the foundation for combing IBL models and translational models. We expect to better exploit the theory to combine different KBC models in the future. + +# Acknowledgments and Disclosure of Funding + +This paper was supported by National Natural Science Foundation of China (No. 61906116), by Shanghai Sailing Program (No. 19YF1414700). We thank Wenting Ba for her valuable plotting assistance. + +# References + +[1] Kelsey Allen, Evan Shelhamer, Hanul Shin, and Joshua Tenenbaum. Infinite mixture prototypes for few-shot learning. In ICML, pages 232-241. PMLR, 2019. +[2] Ivana Balazevic, Carl Allen, and Timothy Hospedales. TuckER: Tensor factorization for knowledge graph completion. In EMNLP-IJCNLP, 2019. +[3] Daniel G Bobrow and Terry Winograd. An overview of krl, a knowledge representation language. Cognitive science, 1(1):3-46, 1977. +[4] Antoine Bordes, Nicolas Usunier, Alberto Garcia-Duran, Jason Weston, and Oksana Yakhnenko. Translating embeddings for modeling multi-relational data. In NeurIPS, 2013. +[5] Rajarshi Das, Shehzaad Dhuliawala, Manzil Zaheer, Luke Vilnis, Ishan Durugkar, Akshay Krishnamurthy, Alex Smola, and Andrew McCallum. Go for a walk and arrive at the answer: Reasoning over paths in knowledge bases using reinforcement learning. In ICLR, 2018. +[6] Tim Dettmers, Pasquale Minervini, Pontus Stenetorp, and Sebastian Riedel. Convolutional 2d knowledge graph embeddings. In Proceedings of the AAAI conference on artificial intelligence, volume 32, 2018. +[7] Luis Galárraga, Christina Teflioudi, Katja Hose, and Fabian M Suchanek. Fast rule mining in ontological knowledge bases with amie++. The VLDB Journal, 2015. +[8] Jacob Goldberger, Geoffrey E Hinton, Sam Roweis, and Russ R Salakhutdinov. Neighbourhood components analysis. NeurIPS, 2004. +[9] Yehuda Koren, Robert Bell, and Chris Volinsky. Matrix factorization techniques for recommender systems. Computer, 42(8):30-37, 2009. +[10] Timothee Lacroix, Nicolas Usunier, and Guillaume Obozinski. Canonical tensor decomposition for knowledge base completion. In ICML, 2018. +[11] Sangkeun Lee, Sungchan Park, Minsuk Kahng, and Sang-goo Lee. Pathrank: Ranking nodes on a heterogeneous graph for flexible hybrid recommender systems. Expert Systems with Applications, 40(2):684-697, 2013. +[12] Yankai Lin, Zhiyuan Liu, Maosong Sun, Yang Liu, and Xuan Zhu. Learning entity and relation embeddings for knowledge graph completion. In AAAI, 2015. +[13] Renqiang Min, David A Stanley, Zineng Yuan, Anthony Bonner, and Zhaolei Zhang. A deep non-linear feature mapping for large-margin knn classification. In ICDM, pages 357-366, 2009. + +[14] Pasquale Minervini, Sebastian Riedel, Pontus Stenetorp, Edward Grefenstette, and Tim Rocktäschel. Learning reasoning strategies in end-to-end differentiable proving. In ICML, 2020. +[15] Tom M Mitchell et al. Machine learning, 1997. +[16] Maximilian Nickel, Volker Tresp, and Hans-Peter Kriegel. A three-way model for collective learning on multi-relational data. In ICML, 2011. +[17] Meng Qu, Junkun Chen, Louis-Pascal Xhonneux, Yoshua Bengio, and Jian Tang. Rnnlogic: Learning logic rules for reasoning on knowledge graphs. In ICLR, 2020. +[18] J Ross Quinlan. Combining instance-based and model-based learning. In ICML, pages 236-243, 1993. +[19] Eleanor Rosch, Carolyn B Mervis, Wayne D Gray, David M Johnson, and Penny Boyes-Braem. Basic objects in natural categories. Cognitive psychology, 8(3):382-439, 1976. +[20] Eleanor H Rosch. Natural categories. Cognitive psychology, 4(3):328-350, 1973. +[21] Ali Sadeghian, Mohammadreza Armandpour, Patrick Ding, and Daisy Zhe Wang. Drum: End-to-end differentiable rule mining on knowledge graphs. NeurIPS, 2019. +[22] Ruslan Salakhutdinov and Geoff Hinton. Learning a nonlinear embedding by preserving class neighbourhood structure. In AISTAT, pages 412-419, 2007. +[23] Michael Schlichtkrull, Thomas N Kipf, Peter Bloem, Rianne Van Den Berg, Ivan Titov, and Max Welling. Modeling relational data with graph convolutional networks. In ESWC, 2018. +[24] Yelong Shen, Jianshu Chen, Po-Sen Huang, Yuqing Guo, and Jianfeng Gao. M-walk: Learning to walk over graphs using monte carlo tree search. In NeurIPS, 2018. +[25] Jake Snell, Kevin Swersky, and Richard Zemel. Prototypical networks for few-shot learning. NeurIPS, 2017. +[26] Craig Stanfill and David Waltz. Toward memory-based reasoning. CACM, 29(12):1213-1228, 1986. +[27] Zhiqing Sun, Zhi-Hong Deng, Jian-Yun Nie, and Jian Tang. Rotate: Knowledge graph embedding by relational rotation in complex space. In ICLR, 2019. +[28] John R Taylor. Linguistic categorization. OUP Oxford, 2003. +[29] Komal Teru, Etienne Denis, and Will Hamilton. Inductive relation prediction by subgraph reasoning. In ICML, pages 9448-9457. PMLR, 2020. +[30] Théo Trouillon, Johannes Welbl, Sebastian Riedel, Éric Gaussier, and Guillaume Bouchard. Complex embeddings for simple link prediction. In ICML, pages 2071–2080. PMLR, 2016. +[31] Laurens Van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. JMLR, 9(11), 2008. +[32] Carl Vondrick, Abhinav Shrivastava, Alireza Fathi, Sergio Guadarrama, and Kevin Murphy. Tracking emerges by colorizing videos. In ECCV, pages 391-408, 2018. +[33] Quan Wang, Zhendong Mao, Bin Wang, and Li Guo. Knowledge graph embedding: A survey of approaches and applications. TKDE, 29(12):2724-2743, 2017. +[34] Xiaozhi Wang, Tianyu Gao, Zhaocheng Zhu, Zhengyan Zhang, Zhiyuan Liu, Juanzi Li, and Jian Tang. Kepler: A unified model for knowledge embedding and pre-trained language representation. TACL, 9:176-194, 2021. +[35] Gerhard Weikum, Luna Dong, Simon Razniewski, and Fabian Suchanek. Machine knowledge: Creation and curation of comprehensive knowledge bases. Foundations and Trends in Databases, 10(2-4):108-490, 2021. +[36] Kilian Q Weinberger and Lawrence K Saul. Distance metric learning for large margin nearest neighbor classification. JMLR, 10(2), 2009. + +[37] Bishan Yang, Wen-tau Yih, Xiaodong He, Jianfeng Gao, and Li Deng. Embedding entities and relations for learning and inference in knowledge bases. In ICLR, 2015. +[38] Fan Yang, Zhilin Yang, and William W Cohen. Differentiable learning of logical rules for knowledge base reasoning. In NeurIPS, 2017. +[39] Fuzheng Zhang, Nicholas Jing Yuan, Defu Lian, Xing Xie, and Wei-Ying Ma. Collaborative knowledge base embedding for recommender systems. In SIGKDD, pages 353-362, 2016. +[40] Zhaocheng Zhu, Zuobai Zhang, Louis-Pascal Xhonneux, and Jian Tang. Neural bellman-ford networks: A general graph neural network framework for link prediction. NeurIPS, 2021. \ No newline at end of file diff --git a/instancebasedlearningforknowledgebasecompletion/images.zip b/instancebasedlearningforknowledgebasecompletion/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..36a0d56d3efab0586fc60329649e570f0f07f790 --- /dev/null +++ b/instancebasedlearningforknowledgebasecompletion/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eadeaac76f482daacefd8b48e8127cafc33141afd717901ca6d68ff8b637e1f5 +size 544078 diff --git a/instancebasedlearningforknowledgebasecompletion/layout.json b/instancebasedlearningforknowledgebasecompletion/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..85b2ab6fbfb9c92ccc9e31db8d827519081c6629 --- /dev/null +++ b/instancebasedlearningforknowledgebasecompletion/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6bae982c68e0aa5e01e4e37361a58fc041b9d59a7ea7c0a5ec61250cb17fe532 +size 364081 diff --git a/instancebaseduncertaintyestimationforgradientboostedregressiontrees/9e581de0-4151-489c-a82b-4a0718f3a63f_content_list.json b/instancebaseduncertaintyestimationforgradientboostedregressiontrees/9e581de0-4151-489c-a82b-4a0718f3a63f_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..910734f315218c3329421e2a81874ea7bc0432d2 --- /dev/null +++ b/instancebaseduncertaintyestimationforgradientboostedregressiontrees/9e581de0-4151-489c-a82b-4a0718f3a63f_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ed4d1937329eb3b77533315ba57bc946923f5daf7cc2748e635ab55740ffa4d6 +size 92167 diff --git a/instancebaseduncertaintyestimationforgradientboostedregressiontrees/9e581de0-4151-489c-a82b-4a0718f3a63f_model.json b/instancebaseduncertaintyestimationforgradientboostedregressiontrees/9e581de0-4151-489c-a82b-4a0718f3a63f_model.json new file mode 100644 index 0000000000000000000000000000000000000000..00acb1c049a57f0997583b786134c632b1c1ab9c --- /dev/null +++ b/instancebaseduncertaintyestimationforgradientboostedregressiontrees/9e581de0-4151-489c-a82b-4a0718f3a63f_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f32ab0afb2e61c6e289d02495bfe9246232ef7de318e391429f9e661ee8504fe +size 118575 diff --git a/instancebaseduncertaintyestimationforgradientboostedregressiontrees/9e581de0-4151-489c-a82b-4a0718f3a63f_origin.pdf b/instancebaseduncertaintyestimationforgradientboostedregressiontrees/9e581de0-4151-489c-a82b-4a0718f3a63f_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..d65050cf9e12bf5a4215e58758278696ece32be1 --- /dev/null +++ b/instancebaseduncertaintyestimationforgradientboostedregressiontrees/9e581de0-4151-489c-a82b-4a0718f3a63f_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bbe8c42dfaadaead3b16f01650fae08df4812346551d37ddfe835e3fc3205343 +size 485887 diff --git a/instancebaseduncertaintyestimationforgradientboostedregressiontrees/full.md b/instancebaseduncertaintyestimationforgradientboostedregressiontrees/full.md new file mode 100644 index 0000000000000000000000000000000000000000..817df7644e5b591932bcb87bc876554cfdf1d751 --- /dev/null +++ b/instancebaseduncertaintyestimationforgradientboostedregressiontrees/full.md @@ -0,0 +1,393 @@ +# Instance-Based Uncertainty Estimation for Gradient-Boosted Regression Trees + +Jonathan Brophy* + +University of Oregon + +jbrophy@cs.uoregon.edu + +Daniel Lowd + +University of Oregon + +lowd@cs.uoregon.edu + +# Abstract + +Gradient-boosted regression trees (GBRTs) are hugely popular for solving tabular regression problems, but provide no estimate of uncertainty. We propose Instance-Based Uncertainty estimation for Gradient-boosted regression trees (IBUG), a simple method for extending any GBRT point predictor to produce probabilistic predictions. IBUG computes a non-parametric distribution around a prediction using the $k$ -nearest training instances, where distance is measured with a tree-ensemble kernel. The runtime of IBUG depends on the number of training examples at each leaf in the ensemble, and can be improved by sampling trees or training instances. Empirically, we find that IBUG achieves similar or better performance than the previous state-of-the-art across 22 benchmark regression datasets. We also find that IBUG can achieve improved probabilistic performance by using different base GBRT models, and can more flexibly model the posterior distribution of a prediction than competing methods. We also find that previous methods suffer from poor probabilistic calibration on some datasets, which can be mitigated using a scalar factor tuned on the validation data. Source code is available at https://github.com/jjbrophy47/ibug. + +# 1 Introduction + +Despite the impressive success of deep learning models on unstructured data (e.g., images, audio, text), gradient-boosted trees [26] remain the preferred choice for tabular or structured data [52]. In fact, Kaggle CEO Anthony Goldbloom recently described gradient-boosted trees as the most "glaring difference" between what is used on Kaggle and what is "fashionable in academia" [34]. + +Our focus is on tabular data for regression tasks, which vary widely from financial [1] and retail-product forecasting [43] to weather [29, 28] and clinic-mortality prediction [6]. Gradient-boosted regression trees (GBRTs) are known to make accurate point predictions [42] but provide no estimate of the prediction uncertainty, which is desirable for both forecasting practitioners [9, 68] and the explainable AI (XAI) community [25, 69, 2] in general. Recently, Duan et al. [22], Sprangers et al. [64], and Malinin et al. [44] introduced NGBost, PGBM, and CBU (CatBoost [52] with uncertainty), respectively, new gradient boosting algorithms that provide state-of-the-art probabilistic predictions. However, NGBost tends to underperform as a point-predictor, and PGBM and CBU are limited in the types of distributions they can use to model the output. + +We introduce a simple yet effective method for enabling any GBRT point-prediction model to produce probabilistic predictions. Our proposed approach, Instance-Based Uncertainty estimation for Gradient-boosted regression trees (IBUG), has two key components: 1) We leverage the fact that GBRTs accurately model the conditional mean and use this point prediction as the mean in a probabilistic forecast; and 2) We identify the $k$ training examples with the greatest affinity to the + +target instance and use these examples to estimate the uncertainty of the target prediction. We define the affinity between two instances as the number of times both instances appear in the same leaf throughout the ensemble. Thus, our method acts as a wrapper around any given GBRT model. + +In experiments on 21 regression benchmark datasets and one synthetic dataset, we demonstrate the effectiveness of IBUG to deliver on par or improved probabilistic performance as compared to existing state-of-the-art methods while maintaining state-of-the-art point-prediction performance. We also show that probabilistic predictions can be improved by applying IBUG to different GBRT models, something that NGBost and PGBM cannot do. Additionally, IBUG can use the training instances closest to the target example to directly model the output distribution using any parametric or non-parametric distribution, something NGBost, PGBM, and CBU cannot do. Finally, we show that sampling trees dramatically improves runtime efficiency for computing training-example affinities without having a significant detrimental impact on the resulting probabilistic predictions, allowing IBUG to scale to larger datasets. + +# 2 Notation & Background + +We assume an instance space $\mathcal{X} \subseteq \mathbb{R}^p$ and target space $\mathcal{Y} \subset \mathbb{R}$ . Let $\mathcal{D} := \{(x_i, y_i)\}_{i=1}^n$ be a training dataset in which each instance $x_i \in \mathcal{X}$ is a $p$ -dimensional vector $(x_i^j)_{j=1}^p$ and $y_i \in \mathcal{Y}$ . + +# 2.1 Gradient-Boosted Regression Trees + +Gradient-boosting [26] is a powerful machine-learning algorithm that iteratively adds weak learners to construct a model $f: \mathcal{X} \to \mathbb{R}$ that minimizes some empirical risk $\mathcal{L}: \mathbb{R} \times \mathbb{R} \to \mathbb{R}$ . The model is defined by a recursive relationship: $f_0(x) = \gamma, \dots, f_t(x) = f_{t-1}(x) + \eta m_t(x)$ in which $f_0$ is the base learner, $\gamma$ is an initial estimate, $f_t$ is the model at iteration $t$ , $m_t$ is the weak learner added during iteration $t$ to improve the model, and $\eta$ is the learning rate. + +Gradient-boosted regression trees (GBRTs) typically choose $\ell$ to be the mean squared error (MSE), $\gamma$ as $\frac{1}{n}\sum_{i=1}^{n}y_i$ (mean output of the training instances), and regression trees as weak learners. Each weak learner is typically chosen to approximate the negative gradient [44]: $m_t = \arg\min_m\frac{1}{n}\sum_{i=1}^n(-g_t^i - m(x_i))^2$ in which $g_t^i = \frac{\partial\ell(y_i,\hat{y}_i)}{\partial\hat{y}_i}$ is the functional gradient of the $i$ th training instance at iteration $t$ with respect to $\hat{y}_i = f_{t-1}(x_i)$ . + +The weak learner at iteration $t$ recursively partitions the instance space into $M_t$ disjoint regions $\{r_t^j\}_{j=1}^{M_t}$ . Each region is called a leaf, and the parameter value for leaf $j$ at tree $^2$ $t$ is typically determined (given a fixed structure) using a one-step Newton-estimation method [36]: $\theta_t^j = -\sum_{i \in I_t^j} g_t^i / (\sum_{i \in I_t^j} h_t^i + \lambda)$ in which $I_t^j = \{(x_i, y_i) \mid x_i \in r_t^j\}_{i=1}^n$ is the instance set of leaf $j$ for tree $t$ , $h_t^i$ is the second derivative of the $i$ th training instance w.r.t. $\hat{y}_i$ , and $\lambda$ is a regularization constant. Thus, the output of $m_t$ can be written as follows: $m_t(x) = \sum_{j=1}^{M_t} \theta_t^j \mathbb{1}[x \in r_t^j]$ in which $\mathbb{1}$ is the indicator function. The final GBRT model generates a prediction for a target example $x_{te}$ by summing the values of the leaves $x_{te}$ traverses to across all $T$ iterations: $\hat{y}_{te} = \sum_{t=1}^{T} m_t(x_{te})$ . + +# 2.2 Probabilistic Regression + +Our focus is on probabilistic regression—estimating the conditional probability distribution $P(y|x)$ for some target variable $y$ given some input vector $x \in \mathcal{X}$ . Unfortunately, traditional GBRT models only output scalar values. Under a squared-error loss function, these scalar values can be interpreted as the conditional mean in a Gaussian distribution with some (unknown) constant variance. However, homoscedasticity is a strong assumption and unknown constant variance has little value in a probabilistic prediction; thus, in order to allow heteroscedasticity, the predicted distribution needs at least two parameters to convey both the magnitude and uncertainty of the prediction [22]. + +Natural Gradient Boosting (NGBoost) is a recent method by Duan et al. [22] that tackles the aforementioned problems by estimating the parameters of a desired distribution using a multiparameter boosting approach that trains a separate ensemble for each parameter of the distribution. NGBoost employs the natural gradient to be invariant to parameterization, but requires the inversion + +of many small matrices (each the size of the number of parameters) to do so. Empirically, NGBost generates state-of-the-art probabilistic predictions, but tends to underperform as a point predictor. + +More recently, Sprangers et al. [64] introduced Probabilistic Gradient Boosting Machines (PGBM), a single model that optimizes for point performance, but can also generate accurate probabilistic predictions. PGBM treats leaf values as stochastic random variables, using sample statistics to model the mean and variance of each leaf value. PGBM estimates the output mean and variance of a target example using the estimated parameters of each leaf it is assigned to. The predicted mean and variance are then used as parameters in a specified distribution to generate a probabilistic prediction. PGBM has been shown to produce state-of-the-art probabilistic predictions; however, computing the necessary leaf statistics during training can be computationally expensive, especially as the number of leaves in the ensemble increases (see §5.6). Also, since only the mean and variance are predicted for a given target example, PGBM is limited to distributions using only location and scale to model the output. + +Finally, Malinin et al. [44] introduce CatBoost with uncertainty (CBU), a method that estimates uncertainty using ensembles of GBRT models. Similar to NGBoost, multiple ensembles are learned to output the mean and variance. However, CBU also constructs a virtual ensemble—a set of overlapping partitions of the learned GBRT trees—to estimate the uncertainty of a prediction by taking the mean of the variances output from the virtual ensemble. Their approach uses a recently proposed stochastic gradient Langevin boosting algorithm [72] to sample from the true posterior via the virtual ensemble (in the limit); however, their formulation of uncertainty is limited only to the first and second moments, similar to PGBM. + +To address the shortcomings of existing approaches, we introduce a simple method that performs well on both point and probabilistic performance, and can more flexibly model the output than previous approaches. Our method can also be applied to any GBRT model, adding additional flexibility. + +# 3 Instance-Based Uncertainty + +Instance-based methods such as $k$ -nearest neighbors have been around for decades and have been useful for many different machine learning tasks [50]. However, defining neighbors based on a fixed metric like Euclidean distance may lead to suboptimal performance, especially as the dimensionality of the dataset increases. More recently, it has been shown that random forests can be used as an adaptive nearest neighbors method [18, 40] which identifies the most similar examples to a given instance using the learned model structure. This supervised tree kernel can more effectively measure the similarity between examples, and has been used for clustering [46] and local linear modeling [8] as well as instance-[11] and feature-based attribution explanations [51], for example. + +In this work, we apply the idea of a supervised tree kernel to help model the uncertainty of a given GBRT prediction. Our approach, Instance-Based Uncertainty estimation for Gradient-boosted regression trees (IBUG), identifies the neighborhood of similar training examples to a target example using the structure of the GBRT, and then uses those instances to generate a probabilistic prediction. IBUG works for any GBRT, and can more flexibly model the output than competing methods. + +# 3.1 Identification of High-Affinity Neighbors + +At its core, IBUG uses the $k$ training examples with the largest affinity to the target example to model the conditional output distribution. Given a GBRT model $f$ , we define the affinity between two examples simply as the number of times each instance appears in the same leaf across all trees in $f$ . Thus, the affinity of the $i$ th training example $x_{i}$ to a target example $x_{te}$ can be written as: + +$$ +A \left(x _ {i}, x _ {t e}\right) = \sum_ {i = 1} ^ {T} \mathbb {1} \left[ R _ {t} \left(x _ {i}\right) = R _ {t} \left(x _ {t e}\right) \right], \tag {1} +$$ + +in which $R_{t}(x_{i})$ is the leaf $x_{i}$ is assigned to for tree $t$ . Alg. 1 summarizes the procedure for computing affinity scores for all training examples. This metric clusters similar examples together based on the learned model representation (i.e., the tree structures). Intuitively, if two examples appear in the same leaf in every tree throughout the ensemble, then both examples are predicted in an identical manner. One may also view Eq. (1) as an indication of which training examples most often affect the leaf values $x_{te}$ is assigned to and thus implicitly which examples are likely to have a big effect on the + +prediction $\hat{y}_{te}$ . This similarity metric is similar to the random forest kernel [18], however, unlike random forests, GBRTs are typically constructed to a shallower depth, resulting in more training examples assigned to the same leaf (see §C.5 for additional details about leaf density in GBRTs). + +Algorithm 1 IBUG affinity computation. +Input: Input instance $x\in \mathcal{X}$ , GBRT model $f$ +1: procedure COMPUTEAFFINITIES(x, f) +2: $A\gets 0$ ▷ Init. train affinities +3: for $t = 1\dots T$ do ▷ Visit each tree +4: Get instance set $I_t^l$ for leaf $l = R_{t}(x)$ +5: for $i\in I_t^l$ do ▷ Increment affinities +6: $A_{i}\leftarrow A_{i} + 1$ +7: return A + +Algorithm 2 IBUG probabilistic prediction. +Input: Input $x\in \mathcal{X}$ , GBRT model $f,k$ highest-affinity neighbors $A^{(k)}$ , min. variance $\rho$ , variance calibration parameters $\gamma$ and $\delta$ , target distribution $D$ +1: procedure PROB PREDICT(x, $f,A^{(k)},\rho ,\gamma ,\delta ,D)$ +2: $\mu_{\hat{y}}\gets f(x)$ $\triangleright$ GBRT scalar output +3: $\sigma_{\hat{y}}^{2}\gets \max (\sigma^{2}(A^{(k)}),\rho)\quad \triangleright$ Ensure $\sigma^2 >0$ +4: $\sigma_{\hat{y}}^{2}\gets \gamma \sigma_{\hat{y}}^{2} + \delta$ $\triangleright$ Var. calibration, Eq. (2) +5: return $D(A^{(k)}|\mu_{\hat{y}},\sigma_{\hat{y}}^{2})$ $\triangleright$ Eq. (3) + +# 3.2 Modeling the Output Distribution + +IBUG has a multitude of choices when modeling the conditional output distribution. The simplest and most common approach is to model the output assuming a Gaussian distribution [22, 64]. We use the scalar output of $f$ : $\mu_{\hat{y}_{te}} = f(x_{te})$ to model the conditional mean since GBRTs already produce accurate point predictions. Then, we use the $k$ training instances with the largest affinity to $x_{te}$ we denote this set $A^{(k)}$ —to compute the variance $\sigma_{\hat{y}_{te}}^2$ . + +Calibrating prediction variance. The $k$ -nearest neighbors generally do a good job of determining the relative uncertainty of different predictions, but on some datasets, the resulting variance is systematically too large or too small. To correct for this, we apply an additional affine transformation before making the prediction: + +$$ +\sigma_ {\hat {y} _ {t e}} ^ {2} \leftarrow \gamma \sigma_ {\hat {y} _ {t e}} ^ {2} + \delta , \tag {2} +$$ + +where $\gamma$ and $\delta$ are tuned on validation data after $k$ has been selected. Instead of exhaustively searching over all values of $\gamma$ or $\delta$ , we use either the multiplicative factor (tuning $\gamma$ with $\delta = 0$ ) or the additive factor (tuning $\delta$ with $\gamma = 1$ ), and choose between them using their performance on validation data. + +We find this simple calibration step consistently improves probabilistic performance for not only IBUG, but competing methods as well, and at a relatively small cost compared to training the model. + +Flexible posterior modeling. In general, we can generate a probabilistic prediction using $\mu_{\hat{y}te}$ and $\sigma_{\hat{y}te}^2$ for any distribution that uses location and scale (note PGBM and CBU can only model these types of distributions). However, IBUG can additionally use $A^{(k)}$ to directly fit any continuous distribution $D$ , including those with high-order moments: + +$$ +\hat {D} _ {t e} = D \left(A ^ {(k)} \mid \mu_ {\hat {y} _ {t e}}, \sigma_ {\hat {y} _ {t e}} ^ {2}\right). \tag {3} +$$ + +Eq. (3) is defined such that $D$ can be fit directly with $A^{(k)}$ using MLE (maximum likelihood estimation) [47], or may be fit using $\mu_{\hat{y}_{te}}$ or $\sigma_{\hat{y}_{te}}^2$ as fixed parameter values with $A^{(k)}$ fitting any other parameters of the distribution. Overall, directly fitting all or some additional parameters in $D$ — for example, the shape parameter in a Weibull distribution—is a benefit over PGBM and CBU, which can only optimize for a global shape value using a gridsearch-like approach with extra validation data. + +Note that NGBoost can model any parameterized distribution, but must specify this choice before training; in contrast, IBUG can optimize this choice after training. Additionally, IBUG may choose $D$ to be a non-parametric density estimator such as KDE (kernel density estimation) [62], which PGBM, CBU, and NGBoost cannot do. + +# 3.3 Summary + +In summary, Alg. 2 provides pseudocode for generating a probabilistic prediction with IBUG. Note Algs. 1 and 2 work for any GBRT model, allowing practitioners to employ IBUG to adapt multiple different point predictors into probabilistic estimators and select the model with the best performance. + +Empirically, we show using different base models for IBUG can result in improved probabilistic performance than using just one (§5.3). + +IBUG is a nearest neighbors approach and thus seems well-suited to estimating aleatoric uncertainty—remaining uncertainty due to irreducible error or the inherent stochasticity in the system [33]—since it can quantify the range of outcomes to be expected given the observed features. However, we use predictions on held-out data to tune the number of nearest neighbors and the variance calibration hyperparameters; thus, we effectively optimize prediction uncertainty encompassing both aleatoric uncertainty and epistemic uncertainty—error due to the imperfections of the model and the training data [20, 44]. The evaluation measures in our experiments thus also focus on predictive uncertainty. + +# 4 Computational Efficiency + +Training efficiency. Since IBUG works with standard GBRT models, it inherits the training efficiency of modern GBRT implementations such as XGBoost [12], LightGBM [36], and CatBoost [52]. + +Prediction efficiency. If there are $T$ trees in the ensemble and each leaf has at most $n_l$ training instances assigned to it, then IBUG's prediction time is $O(Tn_l)$ , since it considers each instance in each leaf. Note training instances that do not appear in a leaf with the target instance do not increase prediction time; what matters most is thus the number of instances at each leaf. We find LightGBM often induces regression trees with large leaves—in some cases, over half the dataset is assigned to a single leaf (see §C.5 for details). Thus, prediction time still grows with the size of the dataset, as is typical for instance-based methods. This higher prediction time is the price IBUG pays for greater flexibility. + +Prediction efficiency can be increased at training time by using deeper GBRTs with fewer instances in each leaf, after training by subsampling the instances considered for predictions, or at prediction time by sampling the trees used to compute affinities. We explore this last option in the next subsection. + +# 4.1 Sampling Trees + +The most expensive operation when generating a probabilistic prediction with IBUG is computing the affinity vector (Eq. 1). In order to increase prediction efficiency, we can instead work with a subset of the trees $\tau < T$ in the ensemble. We can build this subset by sampling trees uniformly at random, taking the first trees learned (representing the largest gradient steps), or the last trees learned (representing the fine-tuning steps). + +By sampling trees, the runtime complexity reduces to $O(\tau n_l)$ , which provides significant speedups when $\tau \ll T$ . In our empirical evaluation, we find that taking a subset of the first trees learned generally works best, significantly increasing prediction efficiency while maintaining accurate probabilistic predictions (§5.6). + +# 4.2 Accelerated $k$ Tuning + +Choosing an appropriate value of $k$ is critical for generating accurate probabilistic predictions in IBUG. Thus, we aim to tune $k$ using a held-out validation dataset $\mathcal{D}_{val} \subset \mathcal{D}$ and an appropriate probabilistic scoring metric such as negative log likelihood (NLL). Unfortunately, typical tuning procedures would result in the same affinity vectors being computed—an expensive operation—for each candidate value of $k$ . To mitigate this issue, we perform a custom tuning procedure that reuses computed affinity vectors for all values of $k$ . More specifically, IBUG computes an affinity vector $A$ for a given validation example $x_{val}$ , and then sorts $A$ in descending order (i.e., largest affinity first). Then, IBUG takes the top $k$ training instances, and generates and scores the resulting probabilistic prediction. For each subsequent value of $k$ , the same sorted affinity list can be used, avoiding duplicate computation. We summarize this procedure in Alg. 3. + +Once $k$ is chosen, we may encounter a new unseen target instance in which the variance of the $k$ -highest affinity training examples for that target example is zero or extremely small. In this case, we set the predicted target variance to $\rho$ , which is set during tuning to the minimum (nonzero) variance computed over all predictions in the validation set for the chosen $k$ . In practice, we find instances of abnormally low variance to be rare with appropriately chosen values of $k$ . + +Algorithm 3 IBUG accelerated tuning of $k$ . +Input: Validation dataset $\mathcal{D}_{val} \subset \mathcal{D}$ , GBRT model $f$ , list of candidates $K$ , target distribution $D$ , probabilistic scoring metric $V$ , minimum variance $\rho = 1e - 15$ . +1: procedure FASTTUNEK( $\mathcal{D}_{val}$ , $f$ , $K$ , $D$ , $V$ , $\rho$ ) +2: for $(x_j, y_j) \in \mathcal{D}_{val}$ do +3: $A \leftarrow \text{COMPUTER AFFINITIES}(x_j, f)$ +4: $A \leftarrow \text{Argsort } A$ in descending order +5: for $k \in K$ do +6: $A^{(k)} \leftarrow \text{Take first } k$ training instances $(A, k)$ +7: $\hat{D}_{y_j}^k \leftarrow \text{PROB-PREDICT}(x_j, f, A^{(k)}, \rho, 1, 0, D)$ +8: $S_j^k \leftarrow V(y_j, \hat{D}_{y_j}^k)$ +9: $k \leftarrow \text{Select best } k$ from $S$ +10: $\rho \leftarrow \text{Select minimum } \sigma^2$ from $\hat{D}^k$ +11: return $k$ , $\rho$ + +# 5 Experiments + +In this section, we demonstrate IBUG's ability to produce competitive probabilistic and point predictions as compared to current state-of-the-art methods on a large set of regression datasets ( $\S 5.1$ , $\S 5.2$ ). Then, we show that IBUG can use different base models to improve probabilistic performance ( $\S 5.3$ ), flexibly model the posterior distribution ( $\S 5.4$ ), and use approximations to speed up probabilistic predictions while maintaining competitive performance ( $\S 5.6$ ). + +Implementation and Reproducibility. We implement IBUG in Python, using Cython—a Python package allowing the development of C extensions—to store a unified representation of the model structure. IBUG supports all modern gradient boosting frameworks including XGBoost [12], LightGBM [36], and CatBoost [52]. Experiments are run on publicly available datasets using an Intel(R) Xeon(R) CPU E5-2690 v4 @ 2.6GHz with 60GB of RAM @ 2.4GHz. Links to all data sources as well as the code for IBUG and all experiments is available at https://github.com/jjbrophy47/ibug. + +# 5.1 Methodology + +We now compare IBUG's probabilistic and point predictions to NGBoost [22], PGBM [64], and CBU [44] on 21 benchmark regression datasets and one synthetic dataset. Additional dataset details are in §B.1. + +Metrics. We compute the average continuous ranked probability score (CRPS $\downarrow$ ) and negative log likelihood (NLL $\downarrow$ ) [29, 76] over the test set to evaluate probabilistic performance. To evaluate point performance, we use root mean squared error (RMSE $\downarrow$ ). For all metrics, lower is better. See §B for detailed descriptions. + +Protocol. We follow a similar protocol to Sprangers et al. [64] and Duan et al. [22]. We use 10-fold cross-validation to create 10 90/10 train/test folds for each dataset. For each fold, the $90\%$ training set is randomly split into an 80/20 train/validation set to tune any hyperparameters. Once the hyperparameters are tuned, the model is retrained using the entire $90\%$ training set. For probabilistic predictions, a normal distribution is used to model the output. + +Significance Testing. We report counts of the number of datasets in which a given method performed better ("Win"), worse ("Loss"), or not statistically different ("Tie") relative to a comparator using a two-sided paired t-test over the 10 random folds with a significance level of 0.05. + +Hyperparameters. We tune NGBoost the same way as in Duan et al. [22]. Since PGBM, CBU, and IBUG optimize a point prediction metric, we tune their hyperparameters similarly. We also tune variance calibration parameters $\gamma$ and $\delta$ for each method (§3.2). Exact hyperparameter values evaluated and selected are in §B.2. Unless specified otherwise, we use CatBoost [52] as the base model for IBUG. + +Table 1: Probabilistic (CRPS) performance for each method on each dataset. Lower is better. Normal distributions are used for all probabilistic predictions. Results are averaged over 10 folds, and standard errors are shown in subscripted parentheses. The best method for each dataset is bolded, as well as those with standard errors that overlap the best method. Bottom row: Head-to-head comparison between IBUG/IBUG+CBU and each method showing the number of wins, ties, and losses (W-T-L) across all datasets. On average, IBUG+CBU provides the most accurate probabilistic predictions. + +
DatasetNGBoostPGBMCBUIBUGIBUG+CBU
Ames38346(547)10872(355)11008(330)10434(367)10194(368)
Bike12.4(0.955)1.183(0.041)0.833(0.036)0.974(0.048)0.766(0.032)
California1e11(1e11)0.222(0.001)0.217(0.001)0.213(0.001)0.207(0.001)
Communities0.068(0.002)0.068(0.002)0.067(0.002)0.065(0.002)0.065(0.002)
Concrete3.410(0.182)1.927(0.086)1.788(0.077)1.849(0.098)1.741(0.082)
Energy0.519(0.043)0.147(0.006)0.196(0.009)0.143(0.009)0.157(0.008)
Facebook4.022(0.099)3.554(0.095)3.211(0.059)3.073(0.066)2.977(0.070)
Kin8nm0.095(0.001)0.061(0.001)0.057(0.001)0.051(0.001)0.051(0.001)
Life2.897(1.465)0.815(0.027)0.772(0.024)0.794(0.023)0.731(0.022)
MEPS5.527(0.196)6.448(0.092)6.050(0.109)6.150(0.114)6.016(0.113)
MSD4.524(0.005)4.576(0.005)4.363(0.004)4.410(0.005)4.347(0.004)
Naval0.003(0.000)0.000(0.000)0.000(0.000)0.000(0.000)0.000(0.000)
News2191(47.5)2361(52.6)2346(52.6)2545(41.0)2380(52.1)
Obesity3.208(0.028)1.860(0.022)1.740(0.017)1.866(0.021)1.771(0.019)
Power2.105(0.023)1.531(0.019)1.473(0.022)1.542(0.020)1.471(0.021)
Protein5427(5409)1.823(0.011)1.788(0.009)1.784(0.008)1.742(0.009)
STAR132(1.589)131(1.380)130(1.283)130(1.214)129(1.198)
Superconductor2.405(0.028)0.126(0.004)0.150(0.004)0.153(0.006)0.128(0.004)
Synthetic5.779(0.042)5.737(0.039)5.739(0.040)5.731(0.040)5.730(0.040)
Wave571020(883)3891(73.9)2349(10.3)2679(16.0)2026(9.538)
Wine0.385(0.005)0.323(0.005)0.337(0.006)0.322(0.006)0.321(0.006)
Yacht1.177(0.158)0.292(0.042)0.281(0.048)0.276(0.048)0.255(0.046)
IBUG W-T-L17-3-211-9-29-5-8-1-6-15
IBUG+CBU W-T-L17-3-215-6-118-2-215-6-1-
+ +# 5.2 Probabilistic and Point Performance + +We first compare IBUG's probabilistic and point predictions to each baseline on each dataset. See Table 1 for detailed CRPS results; due to space constraints, results for additional probabilistic metrics (e.g., NLL) as well as point performance results are in §B.3. Our main findings are as follows: + +- On probabilistic performance, IBUG performs equally well or better than NGBoost and PGBM, winning on 17 and 11 (out of 22) datasets respectively, while losing on only 2 and 2 (respectively). Since CBU and IBUG performance is similar, we combine the two approaches, averaging their outputs; we denote this simple ensemble $IBUG + CBU$ . Surprisingly, IBUG+CBU works very well, losing on only a maximum of 2 datasets when faced head-to-head against any other method; these results suggest IBUG and CBU are complimentary approaches. +- On point performance, PGBM, CBU, and IBUG performed significantly better than NGBoost; this is consistent with previous work and is perhaps unsurprising since NGBoot is optimized for probabilistic performance, not point performance. However, IBUG generally performed better than PGBM, winning on 13 datasets and losing on only 1 dataset; and performed slightly better than CBU, winning on 6 datasets with no losses. + +We also compare IBUG with two additional baselines— $k\mathrm{NN}$ and BART [13]—shown in $\S C.2 - C.3$ due to space constraints. We find IBUG generally outperforms these methods in both probabilistic and point performance. Overall, the results in this section suggest IBUG generates both competitive probabilistic and point predictions compared to existing methods. + +Table 2: Probabilistic (CRPS, NLL) performance on the test set for IBUG using different base models. Results are averaged over 10 folds, and standard errors are shown in subscripted parentheses; lower is better. On 6 and 5 datasets, respectively, either IBUG-LightGBM or IBUG-XGBoost significantly outperforms IBUG-CatBoost on the validation set and subsequently on the test set, demonstrating the potential for improved probabilistic performance by using IBUG with different base models. + +
DatasetTest CRPS (↓)DatasetTest NLL (↓)
CatBoostLightGBMXGBoostCatBoostLightGBMXGBoost
Bike0.974(0.048)0.819(0.024)0.849(0.012)Bike1.886(0.056)1.292(0.048)1.662(0.024)
MSD4.410(0.005)4.372(0.005)4.418(0.005)MSD3.415(0.002)3.409(0.002)3.402(0.002)
News2545(41.0)2436(50.8)2551(56.0)Naval-6.208(0.010)-6.281(0.007)-5.853(0.014)
Power1.542(0.020)1.536(0.022)1.518(0.018)Obesity2.646(0.009)2.593(0.016)2.624(0.010)
Protein1.784(0.008)1.683(0.009)1.788(0.008)Supercon.0.783(0.181)-0.496(0.169)20.4(23.2)
Supercon.0.153(0.006)0.090(0.005)0.010(0.003)
+ +![](images/272546747a1803f912c0c7b2beef7e8b319756d2fd955d160dd1b14df933c527.jpg) + +![](images/0df7bf2ac2d1b5ff08fc6408776be69de9b2a7ba61d22dc2963b8fbeaa649cdc.jpg) + +![](images/2a44d7e1ee7f9c4b5ad77bb48f8f45c517839efe11b035429464b57eaadabc69.jpg) + +![](images/2ca1fd3bb03f16997e8593adfe4378098759f5a1b96d373dfd28901c95859d42.jpg) + +![](images/83c2408a0ff9fab51bdad3b7675ad91895e978b4158b0322d5c307b69cffba89.jpg) + +![](images/c21f1ed08dd53b8cb2a6f99be2b74a815e3d0a400938542382d98d2dd79c2265.jpg) + +![](images/5a3be8f3d7b5277966767867d8f320dfc2c4f3fb6e5456affaa40917d97876e0.jpg) +Figure 1: Left: Distribution of the $k$ -nearest training examples for 5 randomly-selected test instances from the MEPS (top) and Wine (bottom) datasets. Right: Test NLL (with standard error) when modeling the posterior using two different distributions (lower is better). IBUG can model parametric and non-parametric distributions that better fit the underlying data than assuming normality. + +![](images/1cd26757f6b1b854a915e8a716bc394c3317ebba52dfba140b3a8f638a1a1492.jpg) + +![](images/f58f94c53a34817dca140a370798a321e41d42cc33703745f330c1ea4cbafa06.jpg) + +![](images/c13f34aa37c478624998c81c9420b9dc992a13c71f69f315dce3fec6c014352e.jpg) + +![](images/59f9ef49730c23fe8253172feae1164a799e417683c049b3c2f585949190c2d4.jpg) + +![](images/fcf6a79380373988bd4de3e1912abf67f79764c6b86e750cb52755ce43464382.jpg) + +# 5.3 Different Base Models + +Here we experiment using different base models for IBUG besides CatBoost [52]; specifically, we use LightGBM [36] and XGBoost [12], two popular gradient boosting frameworks. Table 2 shows that using a different base model can result in improved probabilistic performance. This highlights IBUG's agnosticism to GBRT type, enabling practitioners to apply IBUG to future models with improved point prediction performance. + +# 5.4 Posterior Modeling + +One of the unique benefits of IBUG is the ability to directly model the output using empirical samples (Figure 1), giving practitioners a better sense of the output distribution for specific predictions. IBUG can optimize a distribution after training, and has more flexibility in the types of distributions it can model—from distributions using just location and scale to those with high-order moments as well as non-parametric density estimators. To test this flexibility, we model each probabilistic prediction using the following distributions: normal, skewnormal, lognormal, Laplace, student t, logistic, Gumbel, Weibull, and KDE; we then select the distribution with the best average NLL on the validation set, and evaluate its probabilistic performance on the test set. + +Figure 1 demonstrates that the selected distributions for the MEPS and Wine datasets achieve better probabilistic performance than assuming normality. Qualitatively, the empirical densities of $A^{(k)}$ for a randomly sampled set of test instances reaffirms the selected distributions. As an additional comparison, we report CBU achieves a test NLL of $3.699_{\pm 0.038}$ and $1.025_{\pm 0.028}$ for the MEPS and wine datasets (respectively) using a normal distribution, while IBUG achieves $-6.887_{\pm 0.260}$ and $0.785_{\pm 0.025}$ using Weibull and KDE estimation (respectively). For the MEPS dataset, the selected Weibull distribution takes a shape parameter, which IBUG estimates directly on a per prediction basis using $A^{(k)}$ and MLE. In contrast, PGBM or CBU would need to optimize a global shape value using a validation set, which is likely to be suboptimal for individual predictions. + +Table 3: Probabilistic performance comparison of each method with vs. without variance calibration. In all cases, calibration maintains or improves performance; it is especially helpful for CBU. + +
MethodCRPSNLL
WinstiesLossesWinsTiesLosses
NGBoost91301210
PGBM139011110
CBU175011110
IBUG13905170
+ +![](images/de747c7e385950898ead7cd32c2d13b2e942419afc3a715ad6da0b1b83b25818.jpg) +Figure 2: Runtime comparison. Left: Total train time (including tuning). Right: Average prediction time per test example. Results are shown for all datasets, averaged over 10 folds (exact values are in §B.4, Tables 12 and 13). On average, IBUG has comparable training times to PGBM and CBU, but is relatively slow for prediction. + +![](images/540a2eba0e8e3a4dbbc310e0d8e71510849b88735e6db9581d8fa4f71075330f.jpg) + +# 5.5 Variance Calibration + +Table 3 shows probabilistic performance comparisons of each method against itself with and without variance calibration. In all cases, variance calibration (§3.2) either maintains or improves performance for all methods, especially CBU. Overall, these results suggest that variance calibration should be a standard procedure for probabilistic prediction, unless using a method that has particularly well-calibrated predictions to begin with. We therefore use variance calibration in all of our results. + +Additionally, §C.1 shows performance results for all methods without variance calibration. Overall, we observe similar relative performance trends as when applying calibration (Table 1). + +![](images/af0b5982e17e87edaec7e3dfa5fec43d6bae6bdcc894916c5bcbb25601fa6b7c.jpg) +Figure 3: Change in probabilistic (NLL) performance (top) and average prediction time (in seconds) per test example (bottom) as a function of $\tau$ for six datasets with trees sampled first-to-last; lower is better. NGBost, PGBM, and CBU are added for additional context. The shaded regions represent the standard error. Overall, average prediction time decreases significantly as $\tau$ decreases while test NLL often remains relatively stable, enabling IBUG to generate probabilistic predictions with significant increased efficiency. + +![](images/bd9b13dc3b55d4de9c65ecb9f97f72b34c96d12e2f6dcd25423e588204b43b1a.jpg) + +![](images/62c8d457f74e92631626c25215c6ae01b40885d1632587ac830c21526bf68ab9.jpg) + +![](images/fd5b957b4001d5d2a800e56a9c0217f7c25256753400e230cd72f515861b5e0f.jpg) + +![](images/d8b952d76dc09bc7301dab9312305ecdfcce302f655bc264aa8209bdb8d04d14.jpg) + +![](images/5b4db8de1059080b39736c0c046da1ec350e184ada72fba81b5ae7f01c2e7faa.jpg) + +# 5.6 Sampling Trees + +Figure 2 shows the runtime for each method broken down into total training time (including tuning) and prediction time per test example. On average, IBUG has similar training times to PGBM and CBU, but on some datasets, IBUG is roughly an order of magnitude faster than PGBM. For predictions, IBUG is similar to PGBM but relatively slow compared to NGBoost and CBU. + +However, by sampling $\tau < T$ trees when computing the affinity vector, IBUG can significantly reduce prediction time. Figure 3 shows results when sampling trees first-to-last, which typically works best over all tree-sampling strategies (alternate sampling strategies are evaluated in §C.4). As $\tau$ decreases, we observe average prediction time decreases roughly 1-2 orders of magnitude while probabilistic performance remains relatively stable until $\tau / T$ reaches roughly $1 - 5\%$ , at which point probabilistic performance sometimes starts to decrease more rapidly. Note for the Ames and Life datasets, IBUG can reach the same average prediction time as NGBost while maintaining the same or better probabilistic performance than NGBost, PGBM, and CBU. These results demonstrate that if speed is a concern, IBUG can approximate the affinity computation to speed up prediction times while maintaining competitive probabilistic performance. + +# 6 Additional Related Work + +Traditional approaches to probabilistic regression include generalized additive models for location, scale, and shape (GAMLSS), which allow for a flexible choice of distribution for the target variable but are restricted to pre-specified model forms [56]. Prophet [68] also produces probabilistic estimates for generalized additive models, but has been shown to underperform as compared to more recent approaches [60, 3]. Bayesian methods [48, 30] naturally generate uncertainty estimates by integrating over the posterior; however, exact solutions are limited to simple models, and more complex models such as Bayesian Additive Regression Trees (BART) [13, 41] require computationally expensive sampling techniques (e.g., MCMC [4]) to provide approximate solutions. + +Other approaches to probabilistic regression tasks include conformal predictions [61, 67, 5] which produce confidence intervals via empirical errors obtained in the past, and quantile regression [32, 37, 45, 57]. Similar to PGBM, distributional forests (DFs) [59] estimate distributional parameters in each leaf, and average these estimates over all trees in the forest. Deep learning approaches for probabilistic regression [54, 74, 3] have increased recently, with notable approaches such as DeepAR [58] and methods based on transformer architectures [38, 39]. + +# 7 Conclusion + +IBUG uses ideas from instance-based learning to enable probabilistic predictions for any GBRT point predictor. IBUG generates probabilistic predictions by using the $k$ -nearest training instances to the test instance found using the structure of the trees in the ensemble. Our results on 22 regression datasets demonstrate this simple wrapper produces competitive probabilistic and point predictions to current state-of-the-art methods, most notably NGBost [22], PGBM [64], and CBU [44]. We also show that IBUG can more flexibly model the posterior distribution of a prediction using any parametric or non-parametric density estimator. IBUG's one limitation is relatively slow prediction time. However, we show that approximations in the search for the $k$ -nearest training instances can significantly speed up prediction time; predictions are also easily parallelizable in IBUG. For future work, we plan to investigate other approximations to the affinity vector such as subsampling or even reweighting training instances, which may lead to significant speed ups of IBUG. + +# Acknowledgments and Disclosure of Funding + +We would like to thank Zayd Hammoudeh for useful discussions and feedback and the reviewers for their constructive comments that improved this paper. This work was supported by a grant from the Air Force Research Laboratory and the Defense Advanced Research Projects Agency (DARPA)—agreement number FA8750-16-C-0166, subcontract K001892-00-S05, as well as a second grant from DARPA, agreement number HR00112090135. This work benefited from access to the University of Oregon high-performance computer, Talapas. + +# References + +[1] Yaser S Abu-Mostafa and Amir F Atiya. Introduction to financial forecasting. Applied Intelligence, 6(3):205-213, 1996. +[2] Amina Adadi and Mohammed Berrada. Peeking inside the black-box: A survey on explainable artificial intelligence (XAI). IEEE Access, 6:52138-52160, 2018. +[3] Alexander Alexandrov, Konstantinos Benidis, Michael Bohlke-Schneider, Valentin Flunkert, Jan Gasthaus, Tim Januschowski, Danielle C Maddix, Syama Sundar Rangapuram, David Salinas, Jasper Schulz, et al. GluonTS: Probabilistic and neural time series modeling in python. Journal of Machine Learning Research, 21(116):1-6, 2020. +[4] Christophe Andrieu, Nando De Freitas, Arnaud Doucet, and Michael I Jordan. An introduction to MCMC for machine learning. Machine Learning, 50(1):5-43, 2003. +[5] Anastasios N Angelopoulos and Stephen Bates. A gentle introduction to conformal prediction and distribution-free uncertainty quantification. arXiv preprint arXiv:2107.07511, 2021. +[6] Anand Avati, Kenneth Jung, Stephanie Harman, Lance Downing, Andrew Ng, and Nigam H Shah. Improving palliative care with deep learning. BMC Medical Informatics and Decision Making, 18(4):55-64, 2018. +[7] Thierry Bertin-Mahieux, Daniel P.W. Ellis, Brian Whitman, and Paul Lamere. The million song dataset. In Proceedings of the 12th International Conference on Music Information Retrieval (ISMIR 2011), 2011. +[8] Adam Bloniarz, Ameet Talwalkar, Bin Yu, and Christopher Wu. Supervised neighborhoods for distributed nonparametric regression. In Proceedings of the 18th International Conference on Artificial Intelligence and Statistics, pages 1450-1459, 2016. +[9] Joos-Hendrik Böse, Valentin Flunkert, Jan Gasthaus, Tim Januschowski, Dustin Lange, David Salinas, Sebastian Schelter, Matthias Seeger, and Yuyang Wang. Probabilistic demand forecasting at scale. In Proceedings of the VLDB Endowment, volume 10, pages 1694–1705. VLDB Endowment, 2017. +[10] Leo Breiman. Bagging predictors. Machine Learning, 24(2):123-140, 1996. +[11] Jonathan Brophy and Daniel Lowd. Trex: Tree-ensemble representative point explanations. In ICML Workshop on Extending Explainable AI, 2020. +[12] Tianqi Chen and Carlos Guestrin. XGBoost: A scalable tree boosting system. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 2016. +[13] Hugh A Chipman, Edward I George, and Robert E McCulloch. BART: Bayesian additive regression trees. The Annals of Applied Statistics, 4(1):266-298, 2010. +[14] Youngseog Chung, Ian Char, Han Guo, Jeff Schneider, and Willie Neiswanger. Uncertainty toolbox: An open-source library for assessing, visualizing, and improving uncertainty quantification. arXiv preprint arXiv:2109.10254, 2021. +[15] Joel W Cohen, Steven B Cohen, and Jessica S Banthin. The medical expenditure panel survey: A national information resource to support healthcare cost research and inform policy and practice. Medical Care, pages S44-S50, 2009. +[16] Andrea Coraddu, Luca Oneto, Alessandro Ghio, Stefano Savio, Davide Anguita, and Massimo Figari. Machine learning approaches for improving condition-based maintenance of naval propulsion plants. Journal of Engineering for the Maritime Environment, Part M, 230(1): 136-153, 2016. +[17] Paulo Cortez, António Cerdeira, Fernando Almeida, Telmo Matos, and José Reis. Modeling wine preferences by data mining from physicochemical properties. Decision Support Systems, 47(4):547-553, 2009. + +[18] Alex Davies and Zoubin Ghahramani. The random forest kernel and other kernels for big data from random partitions. arXiv preprint arXiv:1402.4293, 2014. +[19] Dean De Cock. Ames, Iowa: Alternative to the Boston housing data as an end of semester regression project. Journal of Statistics Education, 19(3), 2011. +[20] Daniel D'souza, Zach Nussbaum, Chirag Agarwal, and Sara Hooker. A tale of two long tails. arXiv preprint arXiv:2107.13098, 2021. +[21] Dheeru Dua and Casey Graff. UCI machine learning repository. http://archive.ics.uci.edu/ml, 2019. [Online; accessed 12-September-2021]. +[22] Tony Duan, Avati Anand, Daisy Yi Ding, Khanh K Thai, Sanjay Basu, Andrew Ng, and Alejandro Schuler. Ngboost: Natural gradient boosting for probabilistic prediction. In Proceedings of the 37th International Conference on Machine Learning, pages 2690-2700. PMLR, 2020. +[23] Hadi Fanaee-T and Joao Gama. Event labeling combining ensemble detectors and background knowledge. Progress in Artificial Intelligence, pages 1-15, 2013. +[24] Kelwin Fernandes, Pedro Vinagre, and Paulo Cortez. A proactive intelligent decision support system for predicting the popularity of online news. In Proceedings of the 17th Portuguese Conference on Artificial Intelligence, pages 535-546. Springer, 2015. +[25] Juliana J Ferreira and Mateus S Monteiro. What are people doing about XAI user experience? A survey on AI explainability research and practice. In Proceedings of the 22nd International Conference on Human-Computer Interaction, pages 56–73. Springer, 2020. +[26] Jerome Friedman, Trevor Hastie, and Robert Tibshirani. Additive logistic regression: A statistical view of boosting. The Annals of Statistics, 28(2):337-407, 2000. +[27] Jerome H Friedman. Multivariate adaptive regression splines. The Annals of Statistics, pages 1-67, 1991. +[28] Tilmann Gneiting and Matthias Katzfuss. Probabilistic forecasting. Annual Review of Statistics and Its Application, 1:125-151, 2014. +[29] Tilmann Gneiting and Adrian E Raftery. Strictly proper scoring rules, prediction, and estimation. Journal of the American Statistical Association, 102(477):359-378, 2007. +[30] Alex Graves. Practical variational inference for neural networks. In Proceedings of the 25th International Conference on Neural Information Processing Systems, volume 24, 2011. +[31] Kam Hamidieh. A data-driven statistical model for predicting the critical temperature of a superconductor. Computational Materials Science, 154:346-354, 2018. +[32] Hilaf Hasson, Bernie Wang, Tim Januschowski, and Jan Gasthaus. Probabilistic forecasting: A level-set approach. In Proceedings of the 35th International Conference on Neural Information Processing Systems, volume 34, 2021. +[33] Eyke Hüllermeier and Willem Waegeman. Aleatoric and epistemic uncertainty in machine learning: An introduction to concepts and methods. Machine Learning, 110(3):457-506, 2021. +[34] Tim Januschowski, Yuyang Wang, Kari Torkkola, Timo Erkkila, Hilaf Hasson, and Jan Gasthaus. Forecasting with trees. International Journal of Forecasting, 2021. +[35] Heysem Kaya, Pmar Tufekci, and Fikret S Gurgen. Local and global learning methods for predicting power of a combined gas & steam turbine. In Proceedings of the 2nd International Conference on Emerging Trends in Computer and Electronics Engineering (ICETCEE), pages 13-18, 2012. +[36] Guolin Ke, Qi Meng, et al. LightGBM: A highly efficient gradient boosting decision tree. In Proceedings of the 31st International Conference on Neural Information Processing Systems, 2017. + +[37] Roger Koenker and Kevin F Hallock. Quantile regression. Journal of Economic Perspectives, 15(4):143-156, 2001. +[38] Shiyang Li, Xiaoyong Jin, Yao Xuan, Xiyou Zhou, Wenhu Chen, Yu-Xiang Wang, and Xifeng Yan. Enhancing the locality and breaking the memory bottleneck of transformer on time series forecasting. In Proceedings of the 33rd International Conference on Neural Information Processing Systems, volume 32, pages 5243-5253, 2019. +[39] Bryan Lim, Sercan Ö Arık, Nicolas Loeff, and Tomas Pfister. Temporal fusion transformers for interpretable multi-horizon time series forecasting. International Journal of Forecasting, 2021. +[40] Yi Lin and Yongho Jeon. Random forests and adaptive nearest neighbors. Journal of the American Statistical Association, 101(474):578-590, 2006. +[41] Zhao Tang Luo, Huiyan Sang, and Bani Mallick. BAST: Bayesian additive regression spanning trees for complex constrained domain. In Proceedings of the 35th International Conference on Neural Information Processing Systems, volume 34, 2021. +[42] Spyros Makridakis, Evangelos Spiliotis, Vassilios Assimakopoulos, Zhi Chen, Anil Gaba, Ilia Tsetlin, and Robert L Winkler. The M5 uncertainty competition: Results, findings and conclusions. International Journal of Forecasting, 2021. +[43] Spyros Makridakis, Evangelos Spiliotis, and Vassilios Assimakopoulos. M5 accuracy competition: Results, findings, and conclusions. International Journal of Forecasting, 2022. +[44] Andrey Malinin, Liudmila Prokhorenkova, and Aleksei Ustimenko. Uncertainty in gradient boosting via ensembles. In Proceedings of the 9th International Conference on Learning Representations, 2021. +[45] Nicolai Meinshausen and Greg Ridgeway. Quantile regression forests. Journal of Machine Learning Research, 7(6), 2006. +[46] Frank Moosmann, Bill Triggs, and Frederic Jurie. Fast discriminative visual codebooks using randomized clustering forests. In Proceedings of the 20th International Conference on Neural Information Processing Systems, pages 985-992, 2006. +[47] In Jae Myung. Tutorial on maximum likelihood estimation. Journal of Mathematical Psychology, 47(1):90-100, 2003. +[48] Radford M Neal. Bayesian Learning for Neural Networks. Springer-Verlag, 1996. +[49] R Kelley Pace and Ronald Barry. Sparse spatial autoregressions. Statistics & Probability Letters, 33(3):291-297, 1997. +[50] Leif E Peterson. K-nearest neighbor. Scholarpedia, 4(2):1883, 2009. +[51] Gregory Plumb, Denali Molitor, and Ameet S Talwalkar. Model agnostic supervised local explanations. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, pages 2515-2524, 2018. +[52] Liudmila Prokhorenkova, Gleb Gusev, et al. CatBoost: Unbiased boosting with categorical features. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, 2018. +[53] Kumar Rajarshi. Life expectancy (WHO). https://www.kaggle.com/kumarajarshi/ life-expectancy-who?ref=hackernoon.com&select=Life+Expectancy+Data.csv, 2017. [Online; accessed 12-September-2021]. +[54] Syama Sundar Rangapuram, Matthias W Seeger, Jan Gasthaus, Lorenzo Stella, Yuyang Wang, and Tim Januschowski. Deep state space models for time series forecasting. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, volume 31, pages 7785-7794, 2018. + +[55] Michael Redmond and Alok Baveja. A data-driven software tool for enabling cooperative information sharing among police departments. European Journal of Operational Research, 141(3):660-678, 2002. +[56] Robert A Rigby and D Mikis Stasinopoulos. Generalized additive models for location, scale and shape. Journal of the Royal Statistical Society: Series C (Applied Statistics), 54(3):507-554, 2005. +[57] Yaniv Romano, Evan Patterson, and Emmanuel Candes. Conformalized quantile regression. In Proceedings of the 33rd International Conference on Neural Information Processing Systems, volume 32, pages 3543-3553, 2019. +[58] David Salinas, Valentin Flunkert, Jan Gasthaus, and Tim Januschowski. Deeper: Probabilistic forecasting with autoregressive recurrent networks. International Journal of Forecasting, 36(3): 1181-1191, 2020. +[59] Lisa Schlosser, Torsten Hothorn, Reto Stauffer, and Achim Zeileis. Distributional regression forests for probabilistic precipitation forecasting in complex terrain. The Annals of Applied Statistics, 13(3):1564-1589, 2019. +[60] Rajat Sen, Hsiang-Fu Yu, and Inderjit Dhillon. Think globally, act locally: A deep neural network approach to high-dimensional time series forecasting. In Proceedings of the 33rd International Conference on Neural Information Processing Systems, pages 4837-4846, 2019. +[61] Glenn Shafer and Vladimir Vovk. A tutorial on conformal prediction. Journal of Machine Learning Research, 9(3), 2008. +[62] Simon J Sheather and Michael C Jones. A reliable data-based bandwidth selection method for kernel density estimation. Journal of the Royal Statistical Society: Series B (Methodological), 53(3):683-690, 1991. +[63] Kamaljot Singh, Ranjeet Kaur Sandhu, and Dinesh Kumar. Comment volume prediction using neural networks and decision trees. In IEEE UKSim-AMSS 17th International Conference on Computational Modeling and Simulation, UKSim2015, March 2015. +[64] Olivier Sprangers, Sebastian Schelter, and Maarten de Rijke. Probabilistic gradient boosting machines for large-scale probabilistic regression. In Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining, 2021. +[65] James H Stock, Mark W Watson, et al. Introduction to Econometrics, volume 3. Pearson New York, 2012. +[66] Suzanne. CDC data: Nutrition, physical activity, & obesity. https://www.kaggle.com/spittman1248/cdc-data-nutrition-physical-activity-obesity, 2018. [Online; accessed 12-September-2021]. +[67] Souhaib Ben Taieb, Raphael Huser, Rob Hyndman, Marc Genton, et al. Probabilistic time series forecasting with boosted additive models: An application to smart meter data. Department of Economics and Business Statistics, Monash University, 2015. +[68] Sean J Taylor and Benjamin Letham. Forecasting at scale. The American Statistician, 72(1): 37-45, 2018. +[69] Erico Tjoa and Cuntai Guan. A survey on explainable artificial intelligence (XAI): Toward medical XAI. IEEE Transactions on Neural Networks and Learning Systems, 2020. +[70] Athanasios Tsanas and Angeliki Xifara. Accurate quantitative estimation of energy performance of residential buildings using statistical machine learning tools. Energy and Buildings, 49: 560-567, 2012. +[71] Pinar Tüfekci. Prediction of full load electrical power output of a base load operated combined cycle power plant using machine learning methods. International Journal of Electrical Power & Energy Systems, 60:126-140, 2014. + +[72] Aleksei Ustimenko and Liudmila Prokhorenkova. SGLB: Stochastic gradient Langevin boosting. In International Conference on Machine Learning, pages 10487-10496. PMLR, 2021. +[73] Jan van Rijn. Kin8nm. https://www.openml.org/d/189, 2014. [Online; accessed 20-January-2022]. +[74] Yuyang Wang, Alex Smola, Danielle Maddix, Jan Gasthaus, Dean Foster, and Tim Januschowski. Deep factors for forecasting. In Proceedings of the 36th International Conference on Machine Learning, pages 6607-6617. PMLR, 2019. +[75] I-C Yeh. Modeling of strength of high-performance concrete using artificial neural networks. Cement and Concrete Research, 28(12):1797-1808, 1998. +[76] Michael Zamo and Philippe Naveau. Estimation of the continuous ranked probability score with limited information and applications to ensemble weather forecasts. Mathematical Geosciences, 50(2):209-234, 2018. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] See §7. +(c) Did you discuss any potential negative societal impacts of your work? [Yes] See §A.1. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [N/A] +(b) Did you include complete proofs of all theoretical results? [N/A] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] See §5. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See §5.1. +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See §5. + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] See §B.1. +(b) Did you mention the license of the assets? [No] The license of each asset can be found by following its corresponding citation. +(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] See §5. +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/instancebaseduncertaintyestimationforgradientboostedregressiontrees/images.zip b/instancebaseduncertaintyestimationforgradientboostedregressiontrees/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..d8d42589ee81aa55e316a4d44baa77ea81ebc0ab --- /dev/null +++ b/instancebaseduncertaintyestimationforgradientboostedregressiontrees/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:619de59e6638a02f62d1e858628a81672d5a34f79abbb566372547d4efb1dfb5 +size 401628 diff --git a/instancebaseduncertaintyestimationforgradientboostedregressiontrees/layout.json b/instancebaseduncertaintyestimationforgradientboostedregressiontrees/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..0bd17852bbe0b6f084ded700a0e0210f41807720 --- /dev/null +++ b/instancebaseduncertaintyestimationforgradientboostedregressiontrees/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c55f9fabddf1b2edb53b9bbec780cd22aab7a20618207f14f92d7dc2ab9c0d4d +size 565248 diff --git a/instancedependentnearoptimalpolicyidentificationinlinearmdpsviaonlineexperimentdesign/73a6b6b0-8e0b-4aa6-ab13-a4a20c95e7e1_content_list.json b/instancedependentnearoptimalpolicyidentificationinlinearmdpsviaonlineexperimentdesign/73a6b6b0-8e0b-4aa6-ab13-a4a20c95e7e1_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..949299b55dd84ab2ff2bebf3e5835f0b6e1c4d2b --- /dev/null +++ b/instancedependentnearoptimalpolicyidentificationinlinearmdpsviaonlineexperimentdesign/73a6b6b0-8e0b-4aa6-ab13-a4a20c95e7e1_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d9deb7eec7fd13bc676a555ac6ff23582eec8757859f5ed01ed9469106f2023b +size 97195 diff --git a/instancedependentnearoptimalpolicyidentificationinlinearmdpsviaonlineexperimentdesign/73a6b6b0-8e0b-4aa6-ab13-a4a20c95e7e1_model.json b/instancedependentnearoptimalpolicyidentificationinlinearmdpsviaonlineexperimentdesign/73a6b6b0-8e0b-4aa6-ab13-a4a20c95e7e1_model.json new file mode 100644 index 0000000000000000000000000000000000000000..50549e13ae3340bad8fb42a780853e7b17cf8920 --- /dev/null +++ b/instancedependentnearoptimalpolicyidentificationinlinearmdpsviaonlineexperimentdesign/73a6b6b0-8e0b-4aa6-ab13-a4a20c95e7e1_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:531d0b3f7e8e6c5146b2d897caa7499f1b27fa8afac8ac6aec2bfb226337b158 +size 122905 diff --git a/instancedependentnearoptimalpolicyidentificationinlinearmdpsviaonlineexperimentdesign/73a6b6b0-8e0b-4aa6-ab13-a4a20c95e7e1_origin.pdf b/instancedependentnearoptimalpolicyidentificationinlinearmdpsviaonlineexperimentdesign/73a6b6b0-8e0b-4aa6-ab13-a4a20c95e7e1_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..96582dacccfd5fa000b28f41ba24c7cc0f30adc0 --- /dev/null +++ b/instancedependentnearoptimalpolicyidentificationinlinearmdpsviaonlineexperimentdesign/73a6b6b0-8e0b-4aa6-ab13-a4a20c95e7e1_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:26786e327411aadcfbbd8ef751b8ecda9f00d391516561b52e48eed1508decc4 +size 807168 diff --git a/instancedependentnearoptimalpolicyidentificationinlinearmdpsviaonlineexperimentdesign/full.md b/instancedependentnearoptimalpolicyidentificationinlinearmdpsviaonlineexperimentdesign/full.md new file mode 100644 index 0000000000000000000000000000000000000000..20b09a8f5b44d86152f97b3fe064cb5a7bce872e --- /dev/null +++ b/instancedependentnearoptimalpolicyidentificationinlinearmdpsviaonlineexperimentdesign/full.md @@ -0,0 +1,411 @@ +# Instance-Dependent Near-Optimal Policy Identification in Linear MDPs via Online Experiment Design + +Andrew Wagenvaker* & Kevin Jamieson† +Paul G. Allen School of Computer Science & Engineering +University of Washington +Seattle, WA 98195 + +# Abstract + +While much progress has been made in understanding the minimax sample complexity of reinforcement learning (RL)—the complexity of learning on the "worst-case" instance—such measures of complexity often do not capture the true difficulty of learning. In practice, on an "easy" instance, we might hope to achieve a complexity far better than that achievable on the worst-case instance. In this work we seek to understand the "instance-dependent" complexity of learning near-optimal policies (PAC RL) in the setting of RL with linear function approximation. We propose an algorithm, PEDEL, which achieves a fine-grained instance-dependent measure of complexity, the first of its kind in the RL with function approximation setting, thereby capturing the difficulty of learning on each particular problem instance. Through an explicit example, we show that PEDEL yields provable gains over low-regret, minimax-optimal algorithms and that such algorithms are unable to hit the instance-optimal rate. Our approach relies on a novel online experiment design-based procedure which focuses the exploration budget on the "directions" most relevant to learning a near-optimal policy, and may be of independent interest. + +# 1 Introduction + +In the PAC (Probably Approximately Correct) reinforcement learning (RL) setting, an agent is tasked with exploring an unknown environment in order to learn a policy which maximizes the amount of reward collected. In general, we are interested in learning such a policy using as few interactions with the environment (as small sample complexity) as possible. We might hope that the number of samples needed would scale with the difficulty of identifying a near-optimal policy in our particular environment. For example, in a "hard" environment, we would expect that more samples might be required, while in an "easy" environment, fewer samples may be needed. + +The RL community has tended to focus on developing algorithms which have near-optimal worst-case sample complexity—sample complexities that are only guaranteed to be optimal on "hard" instances. Such algorithms typically have complexities which scale, for example, as $\mathcal{O}(\mathrm{poly}(d,H) / \epsilon^2)$ , for $d$ the dimensionality of the environment, $H$ the horizon, and $\epsilon$ the desired level of optimality. While we may be able to show this complexity is optimal on a hard instance, it is unable to distinguish between "hard" and "easy" problems. The scaling is identical for two environments as long as the dimensionality and horizon of each are the same—no consideration is given to the actual difficulty of the problem—and we therefore have no guarantee that our algorithm is solving the problem with complexity scaling as the actual difficulty. Indeed, as recent work has shown (Wagenmaker et al., + +2021b), this is not simply an analysis issue: worst-case optimal algorithms can be very suboptimal on "easy" instances. + +Towards developing algorithms which overcome this, we might instead consider the instance-dependent difficulty—the hardness of solving a particular problem instance—and hope to obtain a sample complexity scaling with this instance-dependent difficulty, thereby guaranteeing that we solve "easy" problems using only a small number of samples, but still obtain the worst-case optimal rate on "hard" problems. While progress has been made in understanding the instance-dependent complexity of learning in RL, the results are largely limited to environments with a finite number of states and actions. In practice, real-world RL problems often involve large (even infinite) state-spaces and, in order to solve such problems, we must generalize across states. To handle such settings, the RL community has turned to function approximation-based methods, which allow for provable learning in large state-space environments. However, while worst-case optimal results have been shown, little is understood on the instance-dependent complexity of learning in these settings. + +In this work we aim to bridge this gap. We consider, in particular, the linear MDP setting, and develop an algorithm which provably learns a near-optimal policy with sample complexity scaling as the difficulty of each individual instance. Furthermore, by comparing to our instance-dependent measure of complexity, we show that low-regret algorithms are provably suboptimal for PAC RL in function approximation settings. Our algorithm relies on a novel online experiment design-based procedure—adapting classical techniques from linear experiment design to settings where navigation is required to measure a particular covariate—which may be of independent interest. + +# 1.1 Contributions + +Our contributions are as follows: + +- We propose an algorithm, PEDEL, which learns an $\epsilon$ -optimal policy with instance-dependent sample complexity scaling as (up to $H$ factors): + +$$ +\sum_ {h = 1} ^ {H} \inf _ {\pi_ {\exp}} \max _ {\pi \in \Pi} \frac {\left\| \phi_ {\pi , h} \right\| _ {\Lambda_ {\pi_ {\exp} , h} ^ {- 1}} ^ {2}}{\left(V _ {0} ^ {\star} - V _ {0} ^ {\pi}\right) ^ {2} \vee \epsilon^ {2}} \cdot \left(d + \log \frac {1}{\delta}\right) +$$ + +for $\phi_{\pi,h}$ the "average feature vector" of policy $\pi$ , $\Lambda_{\pi_{\mathrm{exp}},h}$ the expected covariance of the policy $\pi_{\mathrm{exp}}$ , and $V_0^\star - V_0^\pi$ the "policy gap". We show that PEDEL also has worst-case optimal dimension-dependence—its sample complexity never exceeds $\widetilde{\mathcal{O}}(d^2 H^7 / \epsilon^2)$ —but that on "easy" instances it achieves complexity much smaller than the worst-case optimal rate. + +- It is well-known that low-regret algorithms achieve the worst-case optimal rate for PAC RL. We construct an explicit example, however, where the instance-dependent complexity of PEDEL improves on the complexity of any low-regret algorithm by a factor of the dimensionality, providing the first evidence that low-regret algorithms are provably suboptimal on "easy" instances for PAC RL in function approximation settings. +- We develop a general experiment design-based approach to exploration in MDPs, which allows us to focus our exploration in the directions most relevant to learning near-optimal policies. Our approach is based on the key observation that, while solving an experiment design in an MDP would require knowledge of the MDP dynamics, we can approximately solve one without knowledge of the dynamics by running a regret minimization algorithm on a carefully chosen reward function, inducing the correct exploration. + +# 2 Related Work + +The sample complexity of RL has been studied for decades (Kearns & Singh, 1998; Brafman & Tennenholtz, 2002; Kakade, 2003). The two primary problems considered are the regret minimization problem (where the goal is to obtain large online reward) and the PAC policy identification problem (where the goal is to find a near-optimal policy using as few samples as possible), which is the focus of this work. In the tabular RL setting, the question of obtaining worst-case optimal algorithms is nearly closed (Dann & Brunskill, 2015; Dann et al., 2019; Menard et al., 2020; Zhang et al., 2020). As such, in this section we focus primarily on results in the RL with function approximation literature, as well as results on instance-dependent RL. + +Sample-Efficient RL with Linear Function Approximation. To generalize beyond MDPs with a finite number of states and acions, the RL community has considered function approximation, replacing the tabular model with more powerful settings that allow for generalization across states. Such settings have been considered in classical works (Baird, 1995; Bradtke & Barto, 1996; Sutton et al., 1999; Melo & Ribeiro, 2007), yet these works do not provide polynomial sample complexities. More recently, there has been intense interest in obtaining polynomial complexities for general function classes (Jiang et al., 2017; Du et al., 2021; Jin et al., 2021; Foster et al., 2021), and, in particular, linear function classes (Yang & Wang, 2019; Jin et al., 2020; Wang et al., 2019; Du et al., 2019; Zanette et al., 2020a,b; Ayoub et al., 2020; Jia et al., 2020; Weisz et al., 2021; Zhou et al., 2020, 2021; Zhang et al., 2021; Wang et al., 2021). + +In the linear MDP setting, the state-of-the-art in PAC RL is the work of Wagenmaker et al. (2022), which proposes a computationally efficient algorithm achieving a complexity of $\mathcal{O}(d^2 H^5 /\epsilon^2)$ for the more general reward-free RL problem, and shows a matching lower bound of $\Omega (d^{2}H^{2} / \epsilon^{2})$ for the PAC RL problem. While this result obtains tight dimension-dependence, it is still worst-case, and offers no insight on the instance-dependent complexity. Other works of note in this category are (Jin et al., 2020; Zanette et al., 2020b; Zhou et al., 2020), which establish regret guarantees in the setting of linear MDPs and the related setting of linear mixture MDPs. Jin et al. (2020) and Zanette et al. (2020b) obtain regret guarantees of $\mathcal{O}(\sqrt{d^3H^4K})$ and $\mathcal{O}(\sqrt{d^2H^4K})$ , respectively, though the approach of Zanette et al. (2020b) is computationally inefficient. Via an online-to-batch conversion (Jin et al., 2018), these algorithms achieve PAC complexities of $\mathcal{O}(d^3 H^4 /\epsilon^2)$ and $\mathcal{O}(d^2 H^4 /\epsilon^2)$ . In the setting of linear mixture MDPs, Zhou et al. (2020) show a regret bound of $\mathcal{O}(\sqrt{d^2H^3K})$ and a matching lower bound, yielding the first provably tight and computationally efficient algorithms for RL with function approximation. + +Instance-Dependent RL. Much of the recent work on instance-dependent RL has focused on the tabular setting. Ok et al. (2018) provide an algorithm which achieves asymptotically optimal instance-dependent regret, yet it is computationally inefficient. Simchowitz & Jamieson (2019) show that standard optimistic algorithms achieve regret bounded as $\mathcal{O}(\sum_{s,a,h}\frac{\log K}{\Delta_h(s,a)})$ , for $\Delta_h(s,a)$ the value-function gap, a result later refined by (Xu et al., 2021; Dann et al., 2021). Obtaining instance-dependent guarantees for policy identification has proved more difficult, yet a variety of results do exist (Zanette et al., 2019; Jonsson et al., 2020; Marjani & Proutiere, 2020; Marjani et al., 2021). In the tabular setting, the most comparable work to ours is that of Wagenmaker et al. (2021b), which propose a refined instance-dependent measure of complexity, the gap-visitation complexity, and show that it is possible to learn an $\epsilon$ -optimal policy with complexity scaling as the gap-visitation complexity. While the gap-visitation complexity is shown to be tight in certain settings, no general lower-bounds exist. Towards obtaining sharp guarantees, Tirinzoni et al. (2022) show that in the simpler setting of deterministic MDPs, a quantity similar in spirit to the gap-visitation complexity is tight, providing matching upper and lower bounds. + +In the setting of RL with function approximation, to our knowledge, only two existing works obtain guarantees that would be considered "instance-dependent". Wagenmaker et al. (2021a) show a "first-order" regret bound of $\mathcal{O}(\sqrt{d^3H^3V_0^\star K})$ , where $V_{0}^{\star}$ is the value of the optimal policy on the particular MDP under consideration. He et al. (2020) show that standard optimistic algorithms achieve regret guarantees of $\mathcal{O}(\frac{d^3H^5\log K}{\Delta_{\min}})$ and $\mathcal{O}(\frac{d^2H^5\log^3K}{\Delta_{\min}})$ in the settings of linear MDPs and linear mixture MDPs, respectively, for $\Delta_{\mathrm{min}}$ the minimum value-function gap. While both these works do obtain instance-dependent results, the instance-dependence is rather coarse, depending on only a single parameter ( $V_{0}^{\star}$ or $\Delta_{\mathrm{min}}$ )—our goal will instead be to obtain more refined instance-dependent guarantees. + +Experiment Design in Sequential Environments. Experiment design is a well-developed subfield of statistics, and a full survey is beyond the scope of this work (see Pukelsheim (2006) for an overview). We highlight several works on experiment design in sequential environments that are particularly relevant. First, the work of Fiez et al. (2019) achieves the instance-optimal rate for best-arm identification in linear bandits and relies on an adaptive experiment design-based. The approach of Fiez et al. (2019), as well as the related work of Soare et al. (2014), provides inspiration for our algorithm—in some sense PEDEL can be seen as a generalization of the RAGE algorithm to problems with horizon greater than 1. Concurrent to our work, the RAGE algorithm was extended to the setting of contextual bandits in Li et al. (2022), achieving the instance-optimal rate. Second, the work of Wagenmaker et al. (2021c) provides an experiment design-based algorithm in the setting + +of linear dynamical systems, and show that it hits the optimal instance-dependent rate for learning in such systems. While their results are somewhat more general, they specialize to the problem of identifying a near-optimal controller for the LQR problem—thereby solving the PAC RL problem optimally in the special case of quadratic losses and linear dynamical systems. It is not clear, however, if their approach generalizes beyond linear dynamical systems. Finally, while the current work was in preparation, Mutny et al. (2022) proposed an approach to solving experiment design problems in MDPs. To our knowledge, this is the only existing work that directly considers the problem of experiment design in MDPs. However, they make the simplifying assumption that the transition dynamics are known, which essentially reduces their problem to a computational one—in contrast, our approach handles the much more difficult setting of unknown dynamics, and shows that efficient experiment design is possible even in this more difficult setting. We remark as well that our online experiment design approach is somewhat related to several existing algorithms (Hazan et al., 2019; Zahavy et al., 2021). + +# 3 Preliminaries + +We let $\| \phi \|_{\mathbf{A}}^2 = \phi^\top \mathbf{A}\phi, \| \cdot \|_{\mathrm{op}}$ denote the matrix operator norm (matrix 2-norm), and $\| \cdot \|_{\mathrm{F}}$ denote the Frobenius norm. $\tilde{\mathcal{O}} (\cdot)$ hides absolute constants and log factors of the arguments. $\lesssim$ denotes inequality up to constants. $\mathbb{E}_{\pi}$ and $\mathbb{P}_{\pi}$ denote the expectation and probability measure induced by playing some policy $\pi$ in our MDP. We let $\phi_{h,\tau} \coloneqq \phi(s_{h,\tau}, a_{h,\tau})$ denote the feature vector encountered at step $h$ of episode $\tau$ (and similarly define $r_{h,\tau}$ ). + +Markov Decision Processes. In this work, we study episodic, finite-horizon, time inhomogeneous Markov Decision Processes (MDPs), denoted by a tuple, $\mathcal{M} = (\mathcal{S},\mathcal{A},H,\{P_h\}_{h = 1}^H,\{\nu_h\}_{h = 1}^H)$ . We let $\mathcal{S}$ denote the state space, $\mathcal{A}$ the action space, $H$ the horizon, $\{P_h\}_{h = 1}^H$ the transition kernel, and $\{\nu_h\}_{h = 1}^H$ the reward distribution, where $P_{h}(\cdot |s,a)\in \triangle_{\mathcal{S}}$ denotes the distribution over the next state when playing action $a$ in state $s$ at step $h$ , and $\nu_{h}(s,a)\in \triangle_{[0,1]}$ denotes the corresponding distribution over reward. We overload notation and let $\nu_{h}(s,a)$ also refer to the expected reward. We assume that every episode starts in state $s_1$ , and that $\{P_h\}_{h = 1}^H$ and $\{\nu_h\}_{h = 1}^H$ are initially unknown. + +Let $\pi = \{\pi_h\}_{h=1}^H$ denote a policy mapping states to distributions over actions, $\pi_h: S \to \triangle_{\mathcal{A}}$ . When $\pi$ is deterministic, we let $\pi_h(s)$ denote the action policy $\pi$ takes at $(s, h)$ . An episode begins at state $s_1$ . The agent takes action $a_1 \sim \pi_1(s_1)$ , transitions to state $s_2 \sim P_1(\cdot | s_1, a_1)$ , and receives reward $r_1(s_1, a_1) \sim \nu_1(s_1, a_1)$ . In $s_2$ , the agent chooses a new action $a_2 \sim \pi_2(s_2)$ , and the process repeats. After $H$ steps, the episode terminates, and the agent restarts at $s_1$ . + +In general, we are interested in learning policies that collect a large amount of reward. We can quantify the performance of a policy in terms of the value function. In particular, the $Q$ -value function, $Q_h^\pi(s, a)$ , denotes the expected reward that will be obtained if we are in state $s$ at step $h$ , play action $a$ , and then play policy $\pi$ for the remainder of the episode. Formally, $Q_h^\pi(s, a) := \mathbb{E}_\pi[\sum_{h' = h}^H r_{h'}(s_{h'}, a_{h'}) | s_h = s, a_h = a]$ . The value function is similarly defined as $V_h^\pi(s) := \mathbb{E}_\pi[\sum_{h' = h}^H r_{h'}(s_{h'}, a_{h'}) | s_h = s]$ . For deterministic policies, $V_h^\pi(s) = Q_h^\pi(s, \pi_h(s))$ . We denote the optimal $Q$ -value function by $Q_h^\star(s, a) = \sup_\pi Q_h^\pi(s, a)$ and the optimal value function by $V_h^\star(s) = \sup_\pi V_h^\pi(s)$ , where the suprema is taken over all policies, both deterministic and stochastic. We define the value of a policy as $V_0^\pi = V_1^\pi(s_1)$ —the expected reward policy $\pi$ achieves over an entire episode—and say a policy $\pi$ is optimal if $V_0^\pi = V_0^\star$ . For some set of policies $\Pi$ (which may not contain an optimal policy), we let $V_0^\star(\Pi) := \sup_{\pi \in \Pi} V_0^\pi$ . + +PAC Reinforcement Learning. In PAC RL, the goal is to identify some policy $\widehat{\pi}$ using as few episodes as possible, such that, with probability at least $1 - \delta$ , + +$$ +V _ {0} ^ {\star} - V _ {0} ^ {\widehat {\pi}} \leq \epsilon . +$$ + +We say that such a policy is $\epsilon$ -optimal, and an algorithm with such a guarantee on every environment and reward function is $(\epsilon, \delta)$ -PAC. We will also refer to this problem as "policy identification". + +# 3.1 Linear MDPs + +In this work, we are interested in the setting where the state space could be infinite, and the learner must generalize across states. In particular, we consider the linear MDP model defined as follows. + +Definition 3.1 (Linear MDPs (Jin et al., 2020)). We say that an MDP is a $d$ -dimensional linear MDP, if there exists some (known) feature map $\phi(s, a): \mathcal{S} \times \mathcal{A} \to \mathbb{R}^d$ , $H$ (unknown) signed vector-valued measures $\pmb{\mu}_h \in \mathbb{R}^d$ over $\mathcal{S}$ , and $H$ (unknown) reward vectors $\pmb{\theta}_h \in \mathbb{R}^d$ , such that: + +$$ +P _ {h} (\cdot | s, a) = \left\langle \phi (s, a), \boldsymbol {\mu} _ {h} (\cdot) \right\rangle , \quad \mathbb {E} [ \nu_ {h} (s, a) ] = \left\langle \phi (s, a), \boldsymbol {\theta} _ {h} \right\rangle . +$$ + +We will assume $\| \phi (s,a)\| _2\leq 1$ for all $s,a$ ; and for all $h$ , $\| |\pmb {\mu}_h|(\mathcal{S})\| _2 = \| \int_{s\in \mathcal{S}}|\mathrm{d}\pmb {\mu}_h(s)|\| _2\leq \sqrt{d}$ and $\| \pmb {\theta}_h\| _2\leq \sqrt{d}$ . + +Linear MDPs encompass, for example, tabular MDPs, but can also model more complex settings, such as feature spaces corresponding to the simplex (Jin et al., 2020), or the linear bandit problem. Critically, linear MDPs allow for infinite state-spaces, as well as generalization across states—rather than learning the behavior in particular states, we can learn in the $d$ -dimensional ambient space. Note that the standard definition of linear MDPs, for example as given in Jin et al. (2020), assumes the rewards are deterministic, while we assume the rewards are random but that their means are linear. We still assume, however, that the random rewards, $r_h(s,a)$ , are contained in $[0,1]$ almost surely. + +For a given policy $\pi$ , we define the feature-visitation at step $h$ , the expected feature vector policy $\pi$ encounters at step $h$ , as $\phi_{\pi,h} \coloneqq \mathbb{E}_{\pi}[\phi(s_h, a_h)]$ . Note that this is a direct generalization of state-visitions in tabular RL—if our MDP is in fact tabular, $[\phi_{\pi,h}]_{s,a} = \mathbb{P}_{\pi}[s_h = s, a_h = a]$ , so the feature visitation vector corresponds directly to the state visitions. Note also that we can write the value of a policy as $V_0^\pi = \sum_{h=1}^{H} \langle \phi_{\pi,h}, \pmb{\theta}_h \rangle$ . Denote the average feature vector induced by $\pi$ in a particular state $s$ as $\phi_{\pi,h}(s) = \mathbb{E}_{a \sim \pi_h(\cdot|s)}[\phi(s,a)]$ . We also define $\Lambda_{\pi,h} \coloneqq \mathbb{E}_{\pi}[\phi(s_h, a_h) \phi(s_h, a_h)^\top]$ , the expected covariance of policy $\pi$ at step $h$ , $\lambda_{\min,h}^* = \sup_{\pi} \lambda_{\min}(\Lambda_{\pi,h})$ the largest achievable minimum eigenvalue at step $h$ , and $\lambda_{\min}^* = \min_{h} \lambda_{\min,h}^*$ . We will make the following assumption. + +Assumption 1 (Full Rank Covariates). In our MDP, $\lambda_{\mathrm{min}}^{\star} > 0$ + +We remark that Assumption 1 is analogous to other explorability assumptions found in the RL with function approximation literature (Zanette et al., 2020c; Hao et al., 2021; Agarwal et al., 2021). + +To reduce uncertainty in directions of interest, we will be interested in optimizing over the set of all realizable covariance matrices on our particular MDP. To this end, define $\Omega_h \coloneqq \{\mathbb{E}_{\pi \sim \omega}[\Lambda_{\pi,h}]: \omega \in \Omega_{\pi}\}$ for $\Omega_{\pi}$ the set of all valid distributions over Markovian policies (both deterministic and stochastic). We can think of $\Omega_h$ , then, as the set of covariance matrices realizable by distributions over policies at step $h$ . + +# 4 Near-Optimal Policy Identification in Linear MDPs + +We are now ready to state our algorithm, PEDEL. + +PEDEL Description. PEDEL is a policy-elimination-style algorithm. It takes as input some set of policies, $\Pi$ , and proceeds in epochs, maintaining a set of active policies, $\Pi_{\ell}$ , such that all $\pi \in \Pi_{\ell}$ are guaranteed to satisfy $V_0^\pi \geq V_0^\star (\Pi) - 4\epsilon_\ell$ , for $\epsilon_{\ell} = 2^{-\ell}$ . After running for $\lceil \log \frac{4}{\epsilon} \rceil$ epochs, it returns any of the remaining active policies, which will be guaranteed to have value at least $V_0^\star (\Pi) - \epsilon$ . + +In order to ensure $\Pi_{\ell}$ only contains $4\epsilon_{\ell}$ -optimal policies, sufficient exploration must be performed at every epoch to refine the estimate of each policy's value. While works such as Wagenmaker et al. (2022) have demonstrated how to efficiently traverse a linear MDP and collect the necessary observations, existing exploration procedures are unable to obtain the instance-dependent complexity we desire. To overcome this, PEDEL relies on a novel online experiment design procedure to ensure exploration is focused only on the directions necessary to evaluate the current set of active policies. + +In particular, one can show that, if we have collected some covariates $\Lambda_{h,\ell}$ , the uncertainty in our estimate of the value of policy $\pi$ at step $h$ scales as $\| \widehat{\phi}_{\pi,h}^{\ell}\|_{\Lambda_{h,\ell}^{-1}}$ , for $\widehat{\phi}_{\pi,h}^{\ell}$ the estimated feature-visitation for policy $\pi$ at epoch $\ell$ . To reduce our uncertainty at each round, we would therefore like to collect covariates such that $\| \widehat{\phi}_{\pi,h}^{\ell}\|_{\Lambda_{h,\ell}^{-1}} \lesssim \epsilon_{\ell}$ . Collecting covariates which satisfy this using the minimum number of episodes of exploration possible involves solving the experiment design: + +$$ +\inf _ {\Lambda_ {\exp} \in \Omega_ {h}} \max _ {\pi \in \Pi_ {\ell}} \| \widehat {\phi} _ {\pi , h} ^ {\ell} \| _ {\Lambda_ {\exp} ^ {- 1}} ^ {2}. \tag {4.1} +$$ + +Algorithm 1 Policy Learning via Experiment Design in Linear MDPs (PEDEL) +1: input: tolerance $\epsilon$ , confidence $\delta$ , policy set $\Pi$ +2: $\ell_0 \gets [\log_2 \frac{d^{3/2}}{H}]$ , $\Pi_{\ell_0} \gets \Pi$ , $\widehat{\phi}_{\pi,1}^1 \gets \mathbb{E}_{a \sim \pi_1(\cdot|s_1)}[\phi(s_1,a)], \forall \pi \in \Pi$ +3: for $\ell = \ell_0, \ell_0 + 1, \ldots, [\log \frac{4}{\epsilon}]$ do +4: $\epsilon_{\ell} \gets 2^{-\ell}, \beta_{\ell} \gets 64H^4 \log \frac{4H^2|\Pi_{\ell}| \ell^2}{\delta}$ +5: for $h = 1, 2, \ldots, H$ do +6: Solve (4.1) by running Algorithm 2, collect data $^1\{(\phi_{h,\tau}, r_{h,\tau}, s_{h+1,\tau})\}_{\tau=1}^{K_{h,\ell}}$ such that: +max $\| \widehat{\phi}_{\pi,h}^{\ell} \|_{\Lambda_{h,\ell}^{-1}}^2 \leq \epsilon_{\ell}^2 / \beta_{\ell}$ for $\Lambda_{h,\ell} \gets \sum_{\tau=1}^{K_{h,\ell}} \phi_{h,\tau} \phi_{h,\tau}^{\top} + 1/d \cdot I$ +7: for $\pi \in \Pi_{\ell}$ do // Estimate feature-visitions for active policies +8: $\widehat{\phi}_{\pi,h+1}^{\ell} \gets (\sum_{\tau=1}^{K_{h,\ell}} \phi_{\pi,h+1}(s_{h+1,\tau}) \phi_{h,\tau}^{\top} \Lambda_{h,\ell}^{-1}) \widehat{\phi}_{\pi,h}^{\ell}$ +9: $\widehat{\theta}_{h}^{\ell} \gets \Lambda_{h,\ell}^{-1} \sum_{\tau=1}^{K_{h,\ell}} \phi_{h,\tau} r_{h,\tau}$ // Estimate reward vectors +10: // Remove provably suboptimal policies from active policy set + $\Pi_{\ell+1} \gets \Pi_{\ell} \backslash \left\{ \pi \in \Pi_{\ell}: \widehat{V}_0^{\pi} < \sup_{\pi' \in \Pi_{\ell}} \widehat{V}_0^{\pi'} - 2\epsilon_{\ell} \right\}$ for $\widehat{V}_0^{\pi} := \sum_{h=1}^{H} \langle \widehat{\phi}_{\pi,h}', \widehat{\theta}_{h}^{\ell} \rangle$ +11: if $|\Pi_{\ell+1}| = 1$ then return $\pi \in \Pi_{\ell+1}$ +12: return any $\pi \in \Pi_{\ell+1}$ + +Note that this design has the form of an XY-experiment design (Soare et al., 2014). Solving (4.1) will produce covariance $\Lambda_{\mathrm{exp}}$ which reduces uncertainty in relevant feature directions. However, to solve this design we require knowledge of which covariance matrices are realizable on our particular MDP. In general we do not know the MDP's dynamics, and therefore do not have access to this knowledge. To overcome this and solve (4.1), in Section 5 we provide an algorithm, Algorithm 2, that is able to solve (4.1) in an online manner without knowledge of the MDP dynamics by running a low-regret algorithm on a carefully chosen reward function. + +Estimating Feature-Visitations. We remark briefly on the estimation of the feature-visitations on Line 8. If we assume that $\{\phi_{h,\tau}\}_{\tau = 1}^{K_{h,\ell}}$ is fixed and that all randomness is due to $s_{h + 1,\tau}$ , then it is easy to see that, using the structure present in linear MDPs as given in Definition 3.1, + +$$ +\begin{array}{l} \mathbb {E} \left[ \sum_ {\tau = 1} ^ {K _ {h, \ell}} \phi_ {\pi , h + 1} \left(s _ {h + 1, \tau}\right) \phi_ {h, \tau} ^ {\top} \boldsymbol {\Lambda} _ {h, \ell} ^ {- 1} \right] = \sum_ {\tau = 1} ^ {K _ {h, \ell}} \left(\int \phi_ {\pi , h + 1} (s) d \boldsymbol {\mu} _ {h} (s) ^ {\top} \phi_ {h, \tau}\right) \phi_ {h, \tau} ^ {\top} \boldsymbol {\Lambda} _ {h, \ell} ^ {- 1} \\ = \int \phi_ {\pi , h + 1} (s) \mathrm {d} \mu_ {h} (s) ^ {\top}. \\ \end{array} +$$ + +By Definition 3.1, we have $\phi_{\pi ,h + 1} = \left(\int \phi_{\pi ,h + 1}(s)\mathrm{d}\pmb {\mu}_h(s)^\top\right)\phi_{\pi ,h}$ . Comparing these, we see that our estimator of $\phi_{\pi ,h + 1}$ on Line 8 is (conditioned on $\{\phi_{h,\tau}\}_{\tau = 1}^{K_{h,\ell}}$ ) unbiased, assuming $\widehat{\phi}_{\pi ,h}^{\ell}\approx \phi_{\pi ,h}$ . + +# 4.1 Main Results + +We have the following result on the performance of PEDEL. + +Theorem 1. Consider running PEDEL with some set of Markovian policies $\Pi$ on any linear MDP satisfying Definition 3.1 and Assumption 1. Then with probability at least $1 - \delta$ , PEDEL outputs a policy $\widehat{\pi} \in \Pi$ such that $V_0^{\widehat{\pi}} \geq V_0^\star(\Pi) - \epsilon$ , and runs for at most + +$$ +C _ {0} H ^ {4} \cdot \sum_ {h = 1} ^ {H} \inf _ {\Lambda_ {\exp} \in \Omega_ {h}} \max _ {\pi \in \Pi} \frac {\| \phi_ {\pi , h} \| _ {\Lambda_ {\exp} ^ {- 1}} ^ {2}}{\max \left\{V _ {0} ^ {\star} (\Pi) - V _ {0} ^ {\pi} , \Delta_ {\min } ^ {\Pi} , \epsilon \right\} ^ {2}} \cdot \left(\log | \Pi | + \log \frac {1}{\delta}\right) + C _ {1} +$$ + +episodes, with $C_0 = \log \frac{1}{\epsilon} \cdot \mathrm{poly}\log (H,\log \frac{1}{\epsilon})$ , $C_1 = \mathrm{poly}\big(d,H,\frac{1}{\lambda_{\mathrm{min}}^{\star}},\log \frac{1}{\delta},\log \frac{1}{\epsilon},\log |\Pi |\big)$ , $\Delta_{\mathrm{min}}^{\Pi} := V_0^\star (\Pi) - \max_{\pi \in \Pi :V_0^\pi < V_0^\star (\Pi)}V_0^\pi$ , and $\Omega_h$ the set of covariance matrices realizable on our MDP. + +The proof of Theorem 1 is given in Appendix B. Theorem 1 quantifies, in a precise instance-dependent way, the complexity of identifying a policy $\widehat{\pi}$ with value at most a factor of $\epsilon$ from the + +value of the optimal policy in $\Pi$ . At a high level, the complexity measure can be thought of as quantifying the difficulty of exploring the MDP so as to eliminate suboptimal policies. $\| \phi_{\pi ,h}\|_{\Lambda_{\mathrm{exp}}^{-1}}$ quantifies the difficulty of collecting data necessary to eliminate policy $\pi$ (in particular, $\phi_{\pi ,h}$ is the direction we need to explore to learn about the performance of policy $\pi$ , and $\Lambda_{\mathrm{exp}}^{-1}$ quantifies how easily we can reach directions in the MDP to do this), while $V_0^\star (\Pi) - V_0^\pi$ quantifies how suboptimal policy $\pi$ is, and therefore how many samples are needed to distinguish it from the optimal policy in the class. Thus, rather than scaling only with factors such as $d$ and $\epsilon$ , our complexity scales with instance-dependent quantities—the covariance matrices we can obtain and the feature vectors we expect to observe on our particular MDP, and the policy gaps on our MDP. Our complexity measure has a close resemblance to the complexity measure for best-arm identification in linear bandits found in Fiez et al. (2019), but generalizes it to problems with long horizon where navigation is required. + +Theorem 1 holds for an arbitrary set of policies, yet, in general, we are interested in learning a policy which has value within a factor of $\epsilon$ of the value of the optimal policy on the MDP, $V_0^\star$ . Such a guarantee is immediately attainable by applying Theorem 1 with a policy set $\Pi$ such that $\sup_{\pi \in \Pi} V_0^\pi \geq V_0^\star - \epsilon$ . The following result shows that it is possible to construct such a set of policies, and therefore learn a globally near-optimal policy. + +Corollary 1. There exists a set of policies $\Pi_{\epsilon}$ such that $\log |\Pi_{\epsilon}| \leq \widetilde{\mathcal{O}}(dH^2 \cdot \log 1 / \epsilon)$ and, for any linear MDP satisfying Definition 3.1, $\sup_{\pi \in \Pi_{\epsilon}} V_0^\pi \geq V_0^{\star} - \epsilon$ . If we run PEDEL with $\Pi \gets \Pi_{\epsilon}$ , then with probability at least $1 - \delta$ , it returns a policy $\widehat{\pi}$ such that $V_0^{\widehat{\pi}} \geq V_0^{\star} - 2\epsilon$ , and runs for at most + +$$ +C _ {0} H ^ {4} \cdot \sum_ {h = 1} ^ {H} \inf _ {\Lambda_ {\exp} \in \Omega_ {h}} \max _ {\pi \in \Pi_ {\epsilon}} \frac {\| \phi_ {\pi , h} \| _ {\Lambda_ {\exp} ^ {- 1}} ^ {2}}{\max \left\{V _ {0} ^ {\star} - V _ {0} ^ {\pi} , \epsilon \right\} ^ {2}} \cdot \left(d H ^ {2} + \log \frac {1}{\delta}\right) + C _ {1} +$$ + +episodes, for $C_0 = \mathrm{poly}\log (d,H,\frac{1}{\epsilon})$ + +Note that the policy set constructed in Corollary 1, $\Pi_{\epsilon}$ , is guaranteed to contain an $\epsilon$ -optimal policy for any linear MDP. Thus, this result states that without any prior knowledge of our MDP, PEDEL can be applied to find an $\epsilon$ -optimal policy. While Theorem 1 and Corollary 1 quantify the instance-dependent complexity of learning, it is natural to ask what the worst-case complexity of PEDEL is. The following result provides such a bound. + +Corollary 2. For any linear MDP satisfying Definition 3.1, $\inf_{\Lambda_{\mathrm{exp}} \in \Omega_h} \max_{\pi \in \Pi_\epsilon} \| \phi_{\pi,h} \|_{\Lambda_{\mathrm{exp}}^{-1}}^2 \leq d$ , so the sample complexity of Algorithm 1 when run with $\Pi \gets \Pi_\epsilon$ is no larger than + +$$ +\widetilde {\mathcal {O}} \left(\frac {d H ^ {5} (d H ^ {2} + \log 1 / \delta)}{\epsilon^ {2}} + C _ {1}\right). +$$ + +Corollary 2 shows that PEDEL has worst-case optimal dimension dependence, matching the lower bound of $\Omega(d^2 H^2 / \epsilon^2)$ given in Wagenmaker et al. (2022), up to $H$ and log factors2. + +Remark 4.1 (Performance on Linear Contextual Bandits). Corollary 1 applies directly to linear contextual bandits by setting $H = 1^3$ . To our knowledge, this is the first instance-dependent result on PAC policy identification in linear contextual bandits. Furthermore, Corollary 2 shows that we also obtain a worst-case complexity of $\widetilde{\mathcal{O}}(d^2/\epsilon^2)$ on linear contextual bandits, which is the optimal rate (Wagenmaker et al., 2022). + +# 4.2 Low-Regret Algorithms are Suboptimal for PAC RL in Large State-Spaces + +We next show that there are problems on which the instance-dependent complexity of PEDEL improves on the worst-case lower bound shown in Wagenmaker et al. (2022), thereby demonstrating that we do indeed obtain favorable complexities on "easy" instances. + +Proposition 2. For any $d > 2$ , there exists a $d$ -dimensional linear MDP with $H = 2$ such that with probability $1 - \delta$ , PEDEL identifies an $\epsilon$ -optimal policy on this MDP after running for only $\widetilde{\mathcal{O}}\left(\frac{\log d / \delta}{\epsilon^2} + \mathrm{poly}(d, \log \frac{1}{\delta}, \log \frac{1}{\epsilon})\right)$ episodes. + +The complexity given in Proposition 2 is a factor of $d^2$ better than the worst-case lower bound of $\Omega(d^2/\epsilon^2)$ . While this shows that PeDEL yields a significant improvement over existing worst-case + +lower bounds on favorable instances, it is natural to ask whether the same complexity is attainable with existing algorithms, perhaps by applying a tighter analysis. Towards answering this, we will consider a class of low-regret algorithms and an online-to-batch learning protocol. + +Definition 4.1 (Low-Regret Algorithm). We say that an algorithm is a low-regret algorithm if its expected regret is bounded as, for all $K$ : + +$$ +\mathbb {E} [ \mathcal {R} _ {K} ] = \sum_ {k = 1} ^ {K} \mathbb {E} [ V _ {0} ^ {\star} - V _ {0} ^ {\pi_ {k}} ] \leq \mathcal {C} _ {1} K ^ {\alpha} + \mathcal {C} _ {2} +$$ + +for some constants $\mathcal{C}_1,\mathcal{C}_2$ , and $\alpha \in (0,1)$ + +Protocol 4.1 (Online-to-Batch Learning). The online-to-batch protocol proceeds as follows: + +1. The learner plays a low-regret algorithm satisfying Definition 4.1 for $K$ episodes. +2. The learner stops at a (possibly random) time $K$ , and, using the observations it has collected in any way it wishes, outputs a policy $\widehat{\pi}$ it believes is $\epsilon$ -optimal. + +In general, by applying online-to-batch learning, one can convert a regret guarantee of $\mathcal{C}_1K^\alpha +\mathcal{C}_2$ to a PAC complexity of $\mathcal{O}((\frac{\mathcal{C}_1}{\epsilon})^{\frac{1}{1 - \alpha}} + \frac{\mathcal{C}_2}{\epsilon})$ (Jin et al., 2018), allowing low-regret algorithms such as that of Zanette et al. (2020b) to obtain the minimax-optimal PAC complexity of $\mathcal{O}(d^{2}H^{4} / \epsilon^{2})$ . The following result shows, however, that this protocol is unable to obtain the instance-optimal rate. + +Proposition 3. On the instance of Proposition 2, for small enough $\epsilon$ , any learner that is $(\epsilon, \delta)$ -PAC and follows Protocol 4.1 with stopping time $K$ must have $\mathbb{E}[K] \geq \Omega\left(\frac{d \cdot \log 1 / \delta}{\epsilon^2}\right)$ . + +Together, Proposition 2 and Proposition 3 show that running a low-regret algorithm to learn a near-optimal policy in a linear MDP is provably suboptimal—at least a factor of $d$ worse than the instance-dependent rate obtained by PeDEL. While a similar observation was recently made in the setting of tabular MDPs (Wagenmaker et al., 2021b), to our knowledge, this is the first such result in the RL with function approximation setting, implying that, in this setting, low-regret algorithms are insufficient for obtaining optimal PAC sample complexity. As standard optimistic algorithms are also low-regret, this result implies that all such optimistic algorithms are also suboptimal. + +# 4.3 Tabular and Deterministic MDPs + +To relate our results to existing results on instance-dependent RL, we next turn to the setting of tabular MDPs, where it is assumed that $S \coloneqq |\mathcal{S}| < \infty$ , $A \coloneqq |\mathcal{A}| < \infty$ . Define: + +$$ +\Delta_ {h} (s, a) = V _ {h} ^ {\star} (s) - Q _ {h} ^ {\star} (s, a), \quad w _ {h} ^ {\pi} (s, a) = \mathbb {P} _ {\pi} [ s _ {h} = s, a _ {h} = a ]. +$$ + +$\Delta_h(s, a)$ denotes the value-function gap, and quantifies the suboptimality of playing action $a$ in state $s$ at step $h$ and then playing the optimal policy, as compared to taking the optimal action in $(s, h)$ . $w_h^\pi(s, a)$ denotes the state-action visitation distribution for policy $\pi$ , and quantifies how likely policy $\pi$ is to reach $(s, a)$ at step $h$ . Note that $[\phi_{\pi, h}]_{(s, a)} = w_h^\pi(s, a)$ . We obtain the following corollary. + +Corollary 3. In the setting of tabular MDPs, PEDEL outputs an $\epsilon$ -optimal policy with probability at least $1 - \delta$ , and has sample complexity bounded as + +$$ +\widetilde {\mathcal {O}} \Big (\sum_ {h = 1} ^ {H} \inf _ {\pi_ {\exp}} \max _ {\pi \in \Pi} \max _ {s, a} \frac {H ^ {4}}{w _ {h} ^ {\pi_ {\exp}} (s , a)} \min \left\{\frac {1}{w _ {h} ^ {\pi} (s , a) \Delta_ {h} (s , a) ^ {2}}, \frac {w _ {h} ^ {\pi} (s , a)}{\Delta_ {\min} (\Pi) ^ {2}}, \frac {w _ {h} ^ {\pi} (s , a)}{\epsilon^ {2}} \right\} (S H + \log \frac {1}{\delta}) + C _ {1} \Big), +$$ + +for $C_1 = \mathrm{poly}\big(S,A,H,\frac{1}{\min_h\min_s\sup_\pi w_h^\pi(s)},\log \frac{1}{\delta},\log \frac{1}{\epsilon}\big)$ and $\Pi$ the set of all deterministic policies. + +For tabular MDPs, the primary comparable result on instance-dependent policy identification is that obtained by Wagenmaker et al. (2021b), which introduces a different measure of complexity, the gap-visitation complexity, and an algorithm, MOCA, with sample complexity scaling as the gap-visitation complexity. The following result shows that the complexity PEDEL obtains on tabular MDPs and the gap-visitation complexity do not have a clear ordering. + +Proposition 4. Fix any $\epsilon \in (0,1 / 2)$ and $S\geq \log_2(1 / \epsilon)$ . Then there exist tabular MDPs $\mathcal{M}_1$ and $\mathcal{M}_2$ , each with $H = 2$ , $S$ states, and $\mathcal{O}(S)$ actions, such that: + +- On $\mathcal{M}_1$ , the complexity bound of PEDEL given in Corollary 3 scales as $\mathrm{poly}(S, \log 1 / \delta)$ , while the gap-visitation complexity scales as $\Omega(1 / \epsilon^2)$ . +- On $\mathcal{M}_2$ , the complexity bound of PeDEL given in Corollary 3 scales as $\Omega(1/\epsilon^2)$ , while the gap-visitation complexity scales as $\mathrm{poly}(S, \log 1/\delta)$ . + +The lack of ordering between the two complexity measures arises because, on some problem instances, it is easier to learn in policy-space (as PeDEL does), while on other instances, it is easier to learn near-optimal actions on individual states directly, and then synthesize these actions into a near-optimal policy (the approach MOCA takes). This difference arises because, in the former instance, the minimum policy gap is large $(V_0^\star - V_0^\pi = \Omega(1)$ for every deterministic policy $\pi \neq \pi^\star$ ), while in the latter instance, the minimum policy gap is small, but all value-function gaps are large, satisfying $\Delta_h(s, a) = \Omega(1)$ for all $a \neq \arg \max_{a \in \mathcal{A}} Q_h^\star(s, a)$ and all $s$ and $h$ . Thus, on the former instance, it is much easier to learn over the space of policies, while on the latter it is much easier to learn optimal actions in individual states. Resolving this discrepancy with an algorithm able to achieve the "best-of-both-worlds" is an interesting direction for future work. + +Deterministic MDPs. Finally, we turn to the simplified setting of tabular, deterministic MDPs. Here, for each $(s,a,h)$ , there exists some $s'$ such that $P_{h}(s'|s,a) = 1$ . We still allow the rewards to be random, however, so the agent must still learn in order to find a near-optimal policy. Following the same notation as the recent work of Tirinzoni et al. (2022), let $\Pi_{sah} = \{\pi$ deterministic: $s_h^\pi = s, a_h^\pi = a\}$ , where $s_h^\pi$ and $a_h^\pi$ are the state and action policy $\pi$ will be in at step $h$ (note that these quantities are well-defined quantities for deterministic policies). Also define the deterministic return gap as $\bar{\Delta}_h(s,a) := V_0^\star - \max_{\pi \in \Pi_{sah}} V_0^\pi$ , and let $\bar{\Delta}_{\min} := \min_{s,a,h:\bar{\Delta}_h(s,a) > 0} \bar{\Delta}_h(s,a)$ in the case when there exists a unique optimal deterministic policy, and $\bar{\Delta}_{\min} := 0$ otherwise. We obtain the following. + +Corollary 4. In the setting of tabular, deterministic MDPs, PEDEL outputs an $\epsilon$ -optimal policy with probability at least $1 - \delta$ , and has sample complexity bounded as + +$$ +\widetilde {\mathcal {O}} \left(H ^ {4} \cdot \sum_ {h = 1} ^ {H} \sum_ {s, a} \frac {1}{\max \{\bar {\Delta} _ {h} (s , a) , \bar {\Delta} _ {\min} , \epsilon \} ^ {2}} \cdot (H + \log \frac {1}{\delta}) + \mathrm {p o l y} \left(S, A, H, \log \frac {1}{\delta}, \log \frac {1}{\epsilon}\right)\right). +$$ + +Up to $H$ and log factors and lower-order terms, the rate given in Corollary 4 matches the instance-dependent lower bound given in Tirinzoni et al. (2022) $^{4}$ . Thus, we conclude that, in the setting of tabular, deterministic MDPs, PEDEL is (nearly) instance-optimal. While Tirinzoni et al. (2022) also obtain instance-optimality in this setting, their algorithm and analysis are specialized to tabular, deterministic MDPs—in contrast, PEDEL requires no modification from its standard operation. + +# 5 Online Experiment Design in Linear MDPs + +As described in Section 4, to reduce our uncertainty and explore in a way that only targets the relevant feature directions, we must solve an XY-experiment design problem of the form: + +$$ +\inf _ {\Lambda_ {\exp} \in \Omega_ {h}} \max _ {\phi \in \Phi} \| \phi \| _ {\Lambda_ {\exp} ^ {- 1}} ^ {2}. \tag {5.1} +$$ + +This is not, in general, possible to solve without knowledge of the MDP dynamics. In this section we describe our approach to solving (5.1) without knowledge of the MDP dynamics by relying on a low-regret algorithm as an optimization primitive. + +Approximating Frank-Wolfe via Regret Minimization. Given knowledge of the MDP dynamics, we could compute $\Omega_h$ directly, and apply the celebrated Frank-Wolfe coordinate-descent algorithm (Frank & Wolfe, 1956) to solve (5.1). In this setting the Frank-Wolfe update for (5.1) is: + +$$ +\boldsymbol {\Gamma} _ {t} = \arg \min _ {\boldsymbol {\Gamma} \in \boldsymbol {\Omega} _ {h}} \left\langle \nabla_ {\boldsymbol {\Lambda}} \left(\max _ {\phi \in \Phi} \| \phi \| _ {\boldsymbol {\Lambda} ^ {- 1}} ^ {2}\right) \right| _ {\boldsymbol {\Lambda} = \boldsymbol {\Lambda} _ {t}}, \boldsymbol {\Gamma} \rangle , \quad \boldsymbol {\Lambda} _ {t + 1} = (1 - \gamma_ {t}) \boldsymbol {\Lambda} _ {t} + \gamma_ {t} \boldsymbol {\Gamma} _ {t} \tag {5.2} +$$ + +for step size $\gamma_{t}$ . Standard Frank-Wolfe analysis shows that this update converges to a near-optimal solution to (5.1) at a polynomial rate. However, without knowledge of $\Omega_h$ , we are unable to solve for $\Gamma_t$ and run the Frank-Wolfe update. + +Our critical observation is that the minimization over $\Omega_h$ in (5.2) can be approximated without knowledge of $\Omega_h$ by running a low-regret algorithm on a particular objective. Some calculation shows that (except on a measure-zero set, assuming $\Phi$ is finite) $\nabla_{\Lambda}(\max_{\phi \in \Phi}\| \phi \|_{\Lambda^{-1}}^2)|_{\Lambda = \Lambda_t} = -\Lambda_t^{-1}\widetilde{\phi}_t\widetilde{\phi}_t^\top \Lambda_t^{-1}$ for $\widetilde{\phi}_{t} = \arg \max_{\phi \in \Phi}\| \phi \|_{\Lambda_{t}^{-1}}^{2}$ . If $\Gamma = \Lambda_{\pi ,h} = \mathbb{E}_{\pi}[\phi_h\phi_h^\top ]$ for some $\pi$ , we have + +$$ +\langle \nabla_ {\boldsymbol {\Lambda}} (\max _ {\phi \in \Phi} \| \phi \| _ {\boldsymbol {\Lambda} ^ {- 1}} ^ {2}) | _ {\boldsymbol {\Lambda} = \boldsymbol {\Lambda} _ {t}}, \boldsymbol {\Gamma} \rangle = - \operatorname {t r} \left(\boldsymbol {\Lambda} _ {t} ^ {- 1} \widetilde {\phi} _ {t} \widetilde {\phi} _ {t} ^ {\top} \boldsymbol {\Lambda} _ {t} ^ {- 1} \boldsymbol {\Lambda} _ {\pi , h}\right) = - \mathbb {E} _ {\pi} \left[ \left(\phi_ {h} ^ {\top} \boldsymbol {\Lambda} _ {t} ^ {- 1} \widetilde {\phi} _ {t}\right) ^ {2} \right]. +$$ + +Now, if we run a low-regret algorithm on the (deterministic) reward $\nu_h^t (s,a) = (\phi (s,a)^\top \Lambda_t^{-1}\widetilde{\phi}_t)^2$ for a sufficiently large number of episodes $K$ , we will be guaranteed to collect reward at a rate close to that of the optimal policy, which implies we will collect some data $\{\phi_{h,\tau}\}_{\tau = 1}^{K}$ such that + +$$ +K ^ {- 1} \cdot \widetilde {\phi} _ {t} ^ {\top} \widehat {\Gamma} _ {K} \widetilde {\phi} _ {t} := K ^ {- 1} \sum_ {\tau = 1} ^ {K} \left(\phi_ {h, \tau} ^ {\top} \boldsymbol {\Lambda} _ {t} ^ {- 1} \widetilde {\phi} _ {t}\right) ^ {2} \approx \sup _ {\pi} \mathbb {E} _ {\pi} \left[ \left(\phi_ {h} ^ {\top} \boldsymbol {\Lambda} _ {t} ^ {- 1} \widetilde {\phi} _ {t}\right) ^ {2} \right]. \tag {5.3} +$$ + +However, this implies the covariates we have collected, $\widehat{\Gamma}_K$ , approximately minimize (5.2). In other words, running a low-regret algorithm on $\nu_h^t$ allows us to obtain covariates which approximate the Frank-Wolfe update—without knowledge of $\Omega_h$ , we can solve the Frank-Wolfe update by running a low-regret algorithm, and therefore solve (5.1). This motivates Algorithm 2. + +Algorithm 2 Online Frank-Wolfe via Regret Minimization (informal) +1: input: uncertain feature directions $\Phi$ , step $h$ , regularization $\Lambda_0\succ 0$ +2: $K_{0}\gets$ sufficiently large number of episodes to guarantee (5.3) holds +3: Run any policy for $K_{0}$ episodes, collect data $\{\phi_{h,\tau}\}_{\tau = 1}^{K_0}$ , set $\Lambda_{1}\leftarrow K_{0}^{-1}\sum_{\tau = 1}^{K_{0}}\phi_{h,\tau}\phi_{h,\tau}^{\top}$ +4: for $t = 1,\ldots ,T - 1$ do +5: $\widetilde{\phi}_t\gets \arg \max_{\phi \in \Phi}\| \phi \| _{(\Lambda_t + \Lambda_0)^{-1}}^2,\nu_h^t (s,a)\gets (\phi (s,a)^\top (\Lambda_t + \Lambda_0)^{-1}\widetilde{\phi}_t)^2$ +6: Run low-regret algorithm on $\nu_h^t$ for $K_{0}$ episodes, collect covariates $\widehat{\Gamma}_{K_0}^t$ +7: Set $\Lambda_{t + 1}\gets (1 - \gamma_t)\Lambda_t + \gamma_tK_0^{-1}\widehat{\Gamma}_{K_0}^t$ for $\gamma_t = \frac{1}{t + 1}$ +8: return: covariates $TK_{0}\Lambda_{T} = \sum_{t = 1}^{T - 1}\widehat{\Gamma}_{K_{0}}^{t} + \Lambda_{1}$ + +Theorem 5 (informal). Consider running Algorithm 2 with some $\Lambda_0\succ 0$ . Then with properly chosen settings of $K_{0}$ and $T$ , we can guarantee that, with probability at least $1 - \delta$ , we will run for at most + +$$ +N \leq 2 0 \cdot \frac {\inf _ {\boldsymbol {\Lambda} _ {\mathrm {e x p}} \in \Omega_ {h}} \max _ {\phi \in \Phi} \| \boldsymbol {\phi} \| _ {(\boldsymbol {\Lambda} _ {\mathrm {e x p}} + \boldsymbol {\Lambda} _ {0}) ^ {- 1}} ^ {2}}{\epsilon_ {\mathrm {e x p}}} + \mathrm {p o l y} \left(d, H, \| \boldsymbol {\Lambda} _ {0} ^ {- 1} \| _ {\mathrm {o p}}, \log | \Phi |, \log 1 / \delta\right) +$$ + +episodes, and return covariance $\widehat{\Lambda}_N$ satisfying $\max_{\phi \in \Phi} \| \phi \|_{(\widehat{\Lambda}_N + N\Lambda_0)^{-1}}^2 \leq \epsilon_{\mathrm{exp}}$ . + +Note that this rate is essentially optimal, up to constants and lower-order terms. If we let $\omega_{\mathrm{exp}}^{\star}$ denote the distribution over policies which minimize (5.1), then to collect covariance $\widehat{\Lambda}_N$ such that $\max_{\phi \in \Phi} \| \phi \|_{(\widehat{\Lambda}_N + N\Lambda_0)^{-1}}^2 \leq \epsilon_{\mathrm{exp}}$ , in expectation, we would need to play $\pi \sim \omega_{\mathrm{exp}}^{\star}$ for at least + +$$ +\inf _ {\boldsymbol {\Lambda} _ {\exp} \in \Omega_ {h}} \max _ {\phi \in \Phi} \| \phi \| _ {(\boldsymbol {\Lambda} _ {\exp} + \boldsymbol {\Lambda} _ {0}) ^ {- 1}} ^ {2} \cdot \epsilon_ {\exp} ^ {- 1} +$$ + +episodes, which is the same scaling as obtained in Theorem 5. + +In practice, we instead run Algorithm 2 on a smoothed version of the objective in (5.1). We provide a full definition of Algorithm 2 with exact setting of $T$ and $K_{0}$ in Appendix C. Theorem 5 is itself a corollary of a more general result, Theorem 8, given in Appendix C, which shows our Frank-Wolfe procedure can be applied to minimize any smooth experiment-design objective—for example, collecting covariates which optimally maximize the minimum eigenvalue, E-optimal design. + +# 6 Conclusion + +In this work, we have shown that it is possible to obtain instance-dependent guarantees in RL with function approximation, and that our algorithm, PEDEL, yields provable gains over low-regret algorithms. As the first result of its kind in this setting, it opens several directions for future work. + +The computational complexity of PEDEL scales as $\mathrm{poly}(d,H,\frac{1}{\epsilon},|\Pi |,|\mathcal{A}|,\log \frac{1}{\delta})$ . In general, to ensure $\Pi$ contains an $\epsilon$ -optimal policy, $|\Pi|$ must be exponential in problem parameters, rendering PEDEL computationally inefficient. Furthermore, the sample complexity of PEDEL scales with $\lambda_{\mathrm{min}}^{\star}$ , the "hardest-to-reach" direction. While this is not uncommon in the literature, we might hope that if a direction is very difficult to reach, learning in that direction should not be necessary, as we are unlikely to ever encounter it. Obtaining an algorithm with a similar instance-dependence but that is computationally efficient and does not depend on $\lambda_{\mathrm{min}}^{\star}$ is an interesting direction for future work. + +Extending our results to the setting of general function approximation is also an exciting direction. While our results do rely on the linear structure of the MDP, we believe the online experiment-design approach we propose could be generally applicable in more complex settings. As a first step, it could be interesting to extend our approach to the setting of Bilinear classes (Du et al., 2021), which also exhibits a certain linear structure. + +# Acknowledgements + +The work of AW was supported by an NSF GFRP Fellowship DGE-1762114. The work of KJ was funded in part by the AFRL and NSF TRIPODS 2023166. + +# References + +Agarwal, N., Chaudhuri, S., Jain, P., Nagaraj, D., and Netrapalli, P. Online target q-learning with reverse experience replay: Efficiently finding the optimal policy for linear mdps. arXiv preprint arXiv:2110.08440, 2021. +Ayoub, A., Jia, Z., Szepesvari, C., Wang, M., and Yang, L. Model-based reinforcement learning with value-targeted regression. In International Conference on Machine Learning, pp. 463-474. PMLR, 2020. +Baird, L. Residual algorithms: Reinforcement learning with function approximation. In Machine Learning Proceedings 1995, pp. 30-37. Elsevier, 1995. +Bradtke, S. J. and Barto, A. G. Linear least-squares algorithms for temporal difference learning. Machine learning, 22(1):33-57, 1996. +Brafman, R. I. and Tennenholtz, M. R-max-a general polynomial time algorithm for near-optimal reinforcement learning. Journal of Machine Learning Research, 3(Oct):213-231, 2002. +Dann, C. and Brunskill, E. Sample complexity of episodic fixed-horizon reinforcement learning. arXiv preprint arXiv:1510.08906, 2015. +Dann, C., Li, L., Wei, W., and Brunskill, E. Policy certificates: Towards accountable reinforcement learning. In International Conference on Machine Learning, pp. 1507-1516. PMLR, 2019. +Dann, C., Marinov, T. V., Mohri, M., and Zimmert, J. Beyond value-function gaps: Improved instance-dependent regret bounds for episodic reinforcement learning. Advances in Neural Information Processing Systems, 34, 2021. +Du, S. S., Kakade, S. M., Wang, R., and Yang, L. F. Is a good representation sufficient for sample efficient reinforcement learning? arXiv preprint arXiv:1910.03016, 2019. +Du, S. S., Kakade, S. M., Lee, J. D., Lovett, S., Mahajan, G., Sun, W., and Wang, R. Bilinear classes: A structural framework for provable generalization in rl. arXiv preprint arXiv:2103.10897, 2021. +Epasto, A., Mahdian, M., Mirrokni, V., and Zampetakis, E. Optimal approximation-smoothness tradeoffs for soft-max functions. Advances in Neural Information Processing Systems, 33:2651-2660, 2020. +Fiez, T., Jain, L., Jamieson, K. G., and Ratliff, L. Sequential experimental design for transductive linear bandits. Advances in neural information processing systems, 32, 2019. +Foster, D. J., Kakade, S. M., Qian, J., and Rakhlin, A. The statistical complexity of interactive decision making. arXiv preprint arXiv:2112.13487, 2021. +Frank, M. and Wolfe, P. An algorithm for quadratic programming. Naval research logistics quarterly, 3(1-2):95-110, 1956. +Freedman, D. A. On tail probabilities for martingales. the Annals of Probability, pp. 100-118, 1975. +Hao, B., Lattimore, T., Szepesvári, C., and Wang, M. Online sparse reinforcement learning. In International Conference on Artificial Intelligence and Statistics, pp. 316-324. PMLR, 2021. +Hazan, E., Kakade, S., Singh, K., and Van Soest, A. Provably efficient maximum entropy exploration. In International Conference on Machine Learning, pp. 2681-2691. PMLR, 2019. +He, J., Zhou, D., and Gu, Q. Logarithmic regret for reinforcement learning with linear function approximation. arXiv preprint arXiv:2011.11566, 2020. + +Jia, Z., Yang, L., Szepesvari, C., and Wang, M. Model-based reinforcement learning with value-targeted regression. In Learning for Dynamics and Control, pp. 666-686. PMLR, 2020. +Jiang, N., Krishnamurthy, A., Agarwal, A., Langford, J., and Schapire, R. E. Contextual decision processes with low bellman rank are pac-learnable. In International Conference on Machine Learning, pp. 1704–1713. PMLR, 2017. +Jin, C., Allen-Zhu, Z., Bubeck, S., and Jordan, M. I. Is q-learning provably efficient? In Proceedings of the 32nd International Conference on Neural Information Processing Systems, pp. 4868-4878, 2018. +Jin, C., Yang, Z., Wang, Z., and Jordan, M. I. Provably efficient reinforcement learning with linear function approximation. In Conference on Learning Theory, pp. 2137-2143. PMLR, 2020. +Jin, C., Liu, Q., and Miryoosefi, S. Bellman eluder dimension: New rich classes of rl problems, and sample-efficient algorithms. arXiv preprint arXiv:2102.00815, 2021. +Jonsson, A., Kaufmann, E., Menard, P., Domingues, O. D., Leurent, E., and Valko, M. Planning in markov decision processes with gap-dependent sample complexity. arXiv preprint arXiv:2006.05879, 2020. +Kakade, S. M. On the sample complexity of reinforcement learning. PhD thesis, UCL (University College London), 2003. +Kaufmann, E., Cappé, O., and Garivier, A. On the complexity of best-arm identification in multi-armed bandit models. The Journal of Machine Learning Research, 17(1):1-42, 2016. +Kearns, M. and Singh, S. Finite-sample convergence rates for q-learning and indirect algorithms. Advances in neural information processing systems, 11, 1998. +Lattimore, T. and Szepesvári, C. Bandit algorithms. Cambridge University Press, 2020. +Li, Z., Ratliff, L., Nassif, H., Jamieson, K., and Jain, L. Instance-optimal pac algorithms for contextual bandits. arXiv preprint arXiv:2207.02357, 2022. +Marjani, A. A. and Proutiere, A. Best policy identification in discounted mdps: Problem-specific sample complexity. arXiv preprint arXiv:2009.13405, 2020. +Marjani, A. A., Garivier, A., and Proutiere, A. Navigating to the best policy in markov decision processes. arXiv preprint arXiv:2106.02847, 2021. +McSherry, F. and Talwar, K. Mechanism design via differential privacy. In 48th Annual IEEE Symposium on Foundations of Computer Science (FOCS'07), pp. 94-103. IEEE, 2007. +Melo, F. S. and Ribeiro, M. I. Q-learning with linear function approximation. In International Conference on Computational Learning Theory, pp. 308-322. Springer, 2007. +Ménard, P., Domingues, O. D., Jonsson, A., Kaufmann, E., Leurent, E., and Valko, M. Fast active learning for pure exploration in reinforcement learning. arXiv preprint arXiv:2007.13442, 2020. +Mutny, M., Janik, T., and Krause, A. Active exploration via experiment design in markov chains. arXiv preprint arXiv:2206.14332, 2022. +Ok, J., Proutiere, A., and Tranos, D. Exploration in structured reinforcement learning. arXiv preprint arXiv:1806.00775, 2018. +Pukelsheim, F. Optimal design of experiments. SIAM, 2006. +Simchowitz, M. and Jamieson, K. Non-asymptotic gap-dependent regret bounds for tabular mdps. arXiv preprint arXiv:1905.03814, 2019. +Soare, M., Lazaric, A., and Munos, R. Best-arm identification in linear bandits. Advances in Neural Information Processing Systems, 27, 2014. + +Sutton, R. S., McAllester, D., Singh, S., and Mansour, Y. Policy gradient methods for reinforcement learning with function approximation. Advances in neural information processing systems, 12, 1999. +Tirinzoni, A., Al-Marjani, A., and Kaufmann, E. Near instance-optimal pac reinforcement learning for deterministic mdps. arXiv preprint arXiv:2203.09251, 2022. +Vershynin, R. Introduction to the non-asymptotic analysis of random matrices. arXiv preprint arXiv:1011.3027, 2010. +Wagenmaker, A., Chen, Y., Simchowitz, M., Du, S. S., and Jamieson, K. First-order regret in reinforcement learning with linear function approximation: A robust estimation approach. arXiv preprint arXiv:2112.03432, 2021a. +Wagenmaker, A., Simchowitz, M., and Jamieson, K. Beyond no regret: Instance-dependent pac reinforcement learning. arXiv preprint arXiv:2108.02717, 2021b. +Wagenmaker, A., Chen, Y., Simchowitz, M., Du, S. S., and Jamieson, K. Reward-free rl is no harder than reward-aware rl in linear markov decision processes. arXiv preprint arXiv:2201.11206, 2022. +Wagenmaker, A. J., Simchowitz, M., and Jamieson, K. Task-optimal exploration in linear dynamical systems. In International Conference on Machine Learning, pp. 10641-10652. PMLR, 2021c. +Wang, Y., Wang, R., Du, S. S., and Krishnamurthy, A. Optimism in reinforcement learning with generalized linear function approximation. arXiv preprint arXiv:1912.04136, 2019. +Wang, Y., Wang, R., and Kakade, S. M. An exponential lower bound for linearly-realizable mdps with constant suboptimality gap. arXiv preprint arXiv:2103.12690, 2021. +Weisz, G., Amortila, P., and Szepesvári, C. Exponential lower bounds for planning in mdps with linearly-realizable optimal action-value functions. In Algorithmic Learning Theory, pp. 1237-1264. PMLR, 2021. +Xu, H., Ma, T., and Du, S. S. Fine-grained gap-dependent bounds for tabular mdps via adaptive multi-step bootstrap. arXiv preprint arXiv:2102.04692, 2021. +Yang, L. and Wang, M. Sample-optimal parametric q-learning using linearly additive features. In International Conference on Machine Learning, pp. 6995-7004. PMLR, 2019. +Zahavy, T., O'Donoghue, B., Desjardins, G., and Singh, S. Reward is enough for convex mdps. Advances in Neural Information Processing Systems, 34:25746-25759, 2021. +Zanette, A., Kochenderfer, M. J., and Brunskill, E. Almost horizon-free structure-aware best policy identification with a generative model. In Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. +Zanette, A., Brandfonbrener, D., Brunskill, E., Pirotta, M., and Lazaric, A. Frequentist regret bounds for randomized least-squares value iteration. In International Conference on Artificial Intelligence and Statistics, pp. 1954-1964. PMLR, 2020a. +Zanette, A., Lazaric, A., Kochenderfer, M., and Brunskill, E. Learning near optimal policies with low inherent bellman error. In International Conference on Machine Learning, pp. 10978-10989. PMLR, 2020b. +Zanette, A., Lazaric, A., Kochenderfer, M. J., and Brunskill, E. Provably efficient reward-agnostic navigation with linear value iteration. Advances in Neural Information Processing Systems, 33: 11756-11766, 2020c. +Zhang, Z., Ji, X., and Du, S. S. Is reinforcement learning more difficult than bandits? a near-optimal algorithm escaping the curse of horizon. arXiv preprint arXiv:2009.13503, 2020. +Zhang, Z., Yang, J., Ji, X., and Du, S. S. Variance-aware confidence set: Variance-dependent bound for linear bandits and horizon-free bound for linear mixture mdp. arXiv preprint arXiv:2101.12745, 2021. + +Zhou, D., Gu, Q., and Szepesvari, C. Nearly minimax optimal reinforcement learning for linear mixture markov decision processes. arXiv preprint arXiv:2012.08507, 2020. + +Zhou, D., He, J., and Gu, Q. Provably efficient reinforcement learning for discounted mdps with feature mapping. In International Conference on Machine Learning, pp. 12793-12802. PMLR, 2021. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] +(c) Did you discuss any potential negative societal impacts of your work? [Yes] +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] +(b) Did you include complete proofs of all theoretical results? [Yes] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [N/A] +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [N/A] +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A] +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [N/A] + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [N/A] +(b) Did you mention the license of the assets? [N/A] +(c) Did you include any new assets either in the supplemental material or as a URL? [N/A] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/instancedependentnearoptimalpolicyidentificationinlinearmdpsviaonlineexperimentdesign/images.zip b/instancedependentnearoptimalpolicyidentificationinlinearmdpsviaonlineexperimentdesign/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..35bee724493390727278a2ec9d1ab38a973e9803 --- /dev/null +++ b/instancedependentnearoptimalpolicyidentificationinlinearmdpsviaonlineexperimentdesign/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a77d5324251a7cf612195e45686b7b5107421513b7f033f16fe1e7ea93a97d0 +size 153563 diff --git a/instancedependentnearoptimalpolicyidentificationinlinearmdpsviaonlineexperimentdesign/layout.json b/instancedependentnearoptimalpolicyidentificationinlinearmdpsviaonlineexperimentdesign/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..d7bb9f4f7133381906f4a0b12398d48a45885ccb --- /dev/null +++ b/instancedependentnearoptimalpolicyidentificationinlinearmdpsviaonlineexperimentdesign/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0eec785ff0e61e56fb9360b47f1f7375d9d79562f3f1b57e7569b7c32e90fcb0 +size 667680 diff --git a/instanceoptimalpacalgorithmsforcontextualbandits/76325e4c-1ac9-465a-9047-4383e260a256_content_list.json b/instanceoptimalpacalgorithmsforcontextualbandits/76325e4c-1ac9-465a-9047-4383e260a256_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..5dac5c28e56089accc8254054829e0f34f629111 --- /dev/null +++ b/instanceoptimalpacalgorithmsforcontextualbandits/76325e4c-1ac9-465a-9047-4383e260a256_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fafc531fd35c410ddbb025f6c980f4d8cbefd59182b2e23ad11662c341f55242 +size 104810 diff --git a/instanceoptimalpacalgorithmsforcontextualbandits/76325e4c-1ac9-465a-9047-4383e260a256_model.json b/instanceoptimalpacalgorithmsforcontextualbandits/76325e4c-1ac9-465a-9047-4383e260a256_model.json new file mode 100644 index 0000000000000000000000000000000000000000..083fdf40f03658ef07615b4411e11d78f97a4cb6 --- /dev/null +++ b/instanceoptimalpacalgorithmsforcontextualbandits/76325e4c-1ac9-465a-9047-4383e260a256_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fbc44dc314060081c55dcc550accf01ceedb9f890c6aaebacd5d15f2072c13f6 +size 132518 diff --git a/instanceoptimalpacalgorithmsforcontextualbandits/76325e4c-1ac9-465a-9047-4383e260a256_origin.pdf b/instanceoptimalpacalgorithmsforcontextualbandits/76325e4c-1ac9-465a-9047-4383e260a256_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..d969536278f13cf43f94bebc337652a386c9ebec --- /dev/null +++ b/instanceoptimalpacalgorithmsforcontextualbandits/76325e4c-1ac9-465a-9047-4383e260a256_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:13e5a2a644beefaf896a841d67a679197c87cbdd9f04d2b2d2bc1f8655594eb2 +size 829518 diff --git a/instanceoptimalpacalgorithmsforcontextualbandits/full.md b/instanceoptimalpacalgorithmsforcontextualbandits/full.md new file mode 100644 index 0000000000000000000000000000000000000000..25fb0b23f0879dc626c338ef7633fc77b0731509 --- /dev/null +++ b/instanceoptimalpacalgorithmsforcontextualbandits/full.md @@ -0,0 +1,469 @@ +# Instance-optimal PAC Algorithms for Contextual Bandits + +Zhaoqi Li + +Department of Statistics +University of Washington +zli9@uw.edu + +Houssam Nassif + +Amazon +houssamn@amazon.com + +Lillian Ratliff + +Department of Electrical and Computer Engineering +University of Washington +ratliff1@uw.edu + +Kevin Jamieson + +Allen School of Computer Science & Engineering University of Washington jamieson@cs.washington.edu + +Lalit Jain + +Foster School of Business University of Washington 1alitj@uw.edu + +# Abstract + +In the stochastic contextual bandit setting, regret-minimizing algorithms have been extensively researched, but their instance-minimizing best-arm identification counterparts remain seldom studied. In this work, we focus on the stochastic bandit problem in the $(\epsilon, \delta)$ -PAC setting: given a policy class $\Pi$ the goal of the learner is to return a policy $\pi \in \Pi$ whose expected reward is within $\epsilon$ of the optimal policy with probability greater than $1 - \delta$ . We characterize the first instance-dependent PAC sample complexity of contextual bandits through a quantity $\rho_{\Pi}$ , and provide matching upper and lower bounds in terms of $\rho_{\Pi}$ for the agnostic and linear contextual best-arm identification settings. We show that no algorithm can be simultaneously minimax-optimal for regret minimization and instance-dependent PAC for best-arm identification. Our main result is a new instance-optimal and computationally efficient algorithm that relies on a polynomial number of calls to an argmax oracle. + +# 1 Introduction + +We consider the stochastic contextual bandit problem in the PAC setting. Fix a distribution $\nu$ over a potentially countable set of contexts $\mathcal{C}$ . The action space is $\mathcal{A}$ , and for computational tractability, we assume $|\mathcal{A}|$ is finite. We have a set of policies $\Pi$ of interest where each policy $\pi \in \Pi$ is a map from contexts to an action space $\pi : \mathcal{C} \to \mathcal{A}$ . The reward function is $r: \mathcal{C} \times \mathcal{A} \to \mathbb{R}$ . At each time $t = 1,2,\ldots$ a context $c_t \sim \nu$ arrives, the learner chooses an action $a_t \in \mathcal{A}$ , and receives reward $r_t := r_t(c_t, a_t) \in \mathbb{R}$ with $\mathbb{E}[r_t|c_t, a_t] = r(c_t, a_t) \in \mathbb{R}$ . The value of a policy $V(\pi)$ is the expected reward from playing action $\pi(c)$ in context $c$ : $V(\pi) = \mathbb{E}_{c \sim \nu}[r(c, \pi(c))]$ . Given a collection of policies $\Pi$ , the objective is to identify the optimal policy $\pi_* := \arg \max_{\pi \in \Pi} V(\pi)$ , with high probability. Formally, for any $\epsilon > 0$ and $\delta \in (0,1)$ , we seek to characterize the sample complexity of + +identifying a policy $\pi \in \Pi$ such that $V(\pi) \geq V(\pi_{*}) - \epsilon$ , with probability at least $1 - \delta$ . That is, we wish to minimize the total amount of interactions with the environment to learn an $\epsilon$ -optimal policy. + +We study both the agnostic setting, where $\Pi$ is an arbitrary set of policies with no assumed relationship with the reward function $r(c,a)$ ; and the realizable setting, where the policy class and the reward function follow a linear structure, known as the linear contextual bandit problem. In both cases, we are interested in instance-dependent sample complexity bounds. That is, the upper and lower bounds we seek do not simply depend on coarse quantities like $|\Pi|$ , $|\mathcal{A}|$ , and $1/\epsilon^2$ , but more fine-grained relationships between the context distribution $\nu$ , geometry of policies $\Pi$ , and the reward function $r: \mathcal{C} \times \mathcal{A} \to \mathbb{R}$ . Our motivation is that instance-dependent bounds describe the difficulty of a particular problem instance, allowing optimal algorithms to adapt to the true difficulty of the problem, whether easy or hard. We seek algorithms that take advantage of "easy" instances instead of optimizing for the worst-case [23]. + +# 1.1 Related work + +Minimax regret bounds for general policy classes The vast majority of research in contextual bandits focuses on regret minimization. That is, for a time horizon $T$ , the goal of the player is to minimize $\mathbb{E}\left[\sum_{t=1}^{T} r(c_t, \pi_*(c_t)) - r(c_t, a_t)\right]$ . The landmark algorithm EXP4 for non-stochastic multi-armed bandits achieves a regret bound of $\sqrt{|\mathcal{A}|T\log(|\Pi|)}$ . Unfortunately, the running time of EXP4 is linear in $|\Pi|$ which is prohibitive for many problems of interest. The algorithms proposed in [3][11] achieve the same regret bound with a computational complexity that is only polynomial in $T$ and $\log(|\Pi|)$ . Both approaches can be used to obtain an $\epsilon$ -optimal policy with probability at least $1 - \delta$ using a sample complexity no more than $\frac{|\mathcal{A}| \log(|\Pi| / \delta)}{\epsilon^2}$ . None of these works made any assumption on the connection between the reward function $r$ and the policy class $\Pi$ (i.e. the agnostic setting). + +Instance-dependent regret bounds for general policy classes The epoch-greedy algorithm of [26] achieved the first instance-dependent bounds on regret with a coarse guarantee depending only on the minimum policy gap $\Delta_{\mathrm{pol}} := V(\pi_*) - \max_{\pi \neq \pi_*} V(\pi)$ . In the pursuit of more fine-grained regret bounds achievable by computationally efficient algorithms, many authors resort to the realizability assumption [14, 16, 34]. The learner knows a hypothesis class $\mathcal{H}$ where each $f \in \mathcal{H}$ is a map $f: \mathcal{C} \times \mathcal{A} \to \mathbb{R}$ , and there exists an $f^* \in \mathcal{H}$ such that $r(c, a) = f^*(c, a)$ for all $(c, a) \in \mathcal{C} \times \mathcal{A}$ . Under this assumption, [16] proves lower and upper bounds on the instance-dependent regret. Their bounds are in terms of the uniform gap $\Delta_{\mathrm{uniform}} := \min_{c \in \mathcal{C}} \min_{a \in \mathcal{A}} r(c, \pi_*(c)) - r(c, a)$ . In general, for any policy class, they establish matching minimax lower and upper regret bounds of the form $\min\{\sqrt{|\mathcal{A}|T\log(|\mathcal{H}|)}, \frac{|A| \log(|\mathcal{H}|)}{\Delta_{\mathrm{uniform}}} \mathfrak{C}_{\mathcal{H}}^{\mathrm{pol}}\}$ , where $\mathfrak{C}_{\mathcal{H}}^{\mathrm{pol}}$ is the policy disagreement coefficient, a parameter depending on the geometry of $\mathcal{H}$ and the context distribution $\nu$ . That is, these bounds hold with respect to a worst-case family of instances parameterized by $\Delta_{\mathrm{uniform}}$ and $\mathfrak{C}_{\mathcal{H}}^{\mathrm{pol}}$ . Using the standard online-to-batch conversion, this translates to a sample complexity (i.e., the time required to find an $\epsilon$ -good policy with constant probability) of roughly $\frac{|A| \log(|\mathcal{H}|)}{\epsilon \Delta_{\mathrm{uniform}}} \mathfrak{C}_{\mathcal{H}}^{\mathrm{pol}}$ . We show in Corollary 2.16 that this sample complexity is at least as large as our bounds. Further, unlike our bounds below, this sample complexity is unbounded as $\epsilon$ goes to 0. Recent work refines these kinds of regret bounds further, and provides minimax regret bounds in terms of the decision-estimation coefficient [17]. + +Regret bounds for linear contextual bandits A special case of the realizable case assumes a linear structure for $\mathcal{H}$ . Assume there exists a known feature map $\phi: \mathcal{C} \times \mathcal{A} \to \mathbb{R}^d$ and an unknown $\theta_* \in \mathbb{R}^d$ such that the true reward function is given as $r(c, a) = \langle \phi(c, a), \theta_* \rangle$ . For this setting, popular optimism-based algorithms like LinUCB [27] and Thompson sampling [31, 33] achieve a regret bound of $\min \{d\sqrt{T}, \frac{d^2}{\Delta_{\text{uniform}}}\}$ [1]. Appealing to the online-to-batch conversion, this translates to a PAC guarantee of $\frac{d^2}{\epsilon \Delta_{\text{uniform}}}$ . More precise instance-dependent upper bounds on regret match instance-dependent lower bounds asymptotically as $T \to \infty$ [19, 36]. These works are most similar to our setting and have qualitatively similar style algorithms. However, both approaches rely on asymptotics with large problem-dependent terms that may dominate the bounds in finite time. Our work is focused on upper bounds that nearly match lower bounds for all finite times. + +Recently, instance-dependent sample complexity results for reinforcement learning in the tabular and linear function approximation settings have appeared [4, 39, 40]. As contextual bandits is a special case of finite-horizon reinforcement learning with a horizon length of 1, their results immediately can + +be applied here. However, the cost of this generality is that these algorithms have very large lower order terms (i.e., problem-dependent factors that multiply a $1 / \epsilon$ term) making them far from optimal in our setting. Moreover, the leading order term of [39] cannot be related to our lower bounds. + +PAC sample complexity for contextual bandits As we will describe, all contextual bandits with an arbitrary policy class can be reduced to PAC learning for linear bandits. Once we made this reduction, our sample complexity analysis draws inspiration from the nearly instance-optimal algorithm for linear best-arm identification [13]. The work in [10] provides a simple regret bound assuming a kernel structure on the reward function, while their bound is minimax and they assume a lower bound on eigenvalues of the covariance matrix of the context distribution. PAC sample complexity of linear contextual bandits was also studied in [41], who shows a minimax guarantee sample complexity that scales with $\frac{d^2}{\epsilon^2}\log (1 / \delta)$ . Similar to our work, [3] define their action sampling distribution as a convex combination over policies. Our sampling distribution, as well as the optimal sampling distribution, cannot be represented this way and is actually derived from the dual of the optimal experimental design objective. + +Contributions. In this work, our contributions include: + +1. In the agnostic setting, we introduce a quantity $\rho_{\Pi}$ that characterizes the instance-dependent sample complexity of PAC learning for contextual bandits (see Equation 1). We show that $\rho_{\Pi}$ appears in information theoretic lower bound on the sample complexity of any PAC algorithm as $\epsilon \to 0$ in Theorem 2.2. To ground this, we describe it carefully in the setting of the trivial policy class (Section 2.2) and linear policy classes (Section 2.3). +2. We construct an instance on which any regret minimax-optimal algorithm necessarily has a sample complexity that scales quadratically with the optimal sample complexity (Theorem 2.6). This shows that no algorithm can be both regret minimax-optimal and instance-optimal PAC. +3. Finally, we propose Algorithm whose sample complexity nearly matches the lower bound based on $\rho_{\Pi}$ . By appealing to an argmax oracle, this algorithm has a runtime polynomial in $\rho_{\Pi}$ , $1 / \epsilon$ , $\log(1 / \delta)$ , $|\mathcal{A}|$ , and $\log(|\Pi|)$ , assuming a unit cost of invoking the oracle. + +# 2 Problem statement and main results + +More formally, define $\mathcal{F}_t = \sigma(c_1, a_1, r_1, \ldots, c_t, a_t, r_t)$ as the natural $\sigma$ -algebra filtration capturing all observed random variables up to time $t$ . For simplicity, we assume Gaussian noise in some of our analysis. At each time $t$ an algorithm defines a sampling rule $\mathcal{F}_t \mapsto \mathcal{A}$ which defines $a_{t+1}$ , an $\{\mathcal{F}_t\}_{t \geq 1}$ -adapted stopping time $\tau \in \mathbb{N}$ , and a selection rule $\mathcal{F}_t \mapsto \Pi$ that is only called once at the stopping time $t = \tau$ . + +Definition 2.1. Fix $\epsilon \geq 0$ and $\delta \in (0,1)$ . We say an algorithm is $(\epsilon, \delta)$ -PAC for contextual bandits with policy class $\Pi$ , if for every instance, at the stopping time $\tau \in \mathbb{N}$ with $\tau < \infty$ almost surely, the algorithm outputs $\widehat{\pi} \in \Pi$ satisfying $\mathbb{P}(V(\widehat{\pi}) \geq \max_{\pi \in \Pi} V(\pi) - \epsilon) \geq 1 - \delta$ . + +The sample complexity of an $(\epsilon, \delta)$ -PAC algorithm for contextual bandits is the time at which the algorithm stops and outputs $\widehat{\pi}$ . As we will discuss, the following quantity governs the sample complexity: + +$$ +\rho_ {\Pi , \epsilon} := \min _ {p _ {c} \in \triangle_ {\mathcal {A}}, \forall c \in \mathcal {C}} \max _ {\pi \in \Pi \backslash \pi_ {*}} \frac {\mathbb {E} _ {c \sim \nu} \left[ \left(\frac {1}{p _ {c , \pi (c)}} + \frac {1}{p _ {c , \pi_ {*} (c)}}\right) \mathbf {1} \{\pi_ {*} (c) \neq \pi (c) \} \right]}{(\mathbb {E} _ {c \sim \nu} [ r (c , \pi_ {*} (c)) - r (c , \pi (c)) ] \vee \epsilon) ^ {2}}. \tag {1} +$$ + +Here, for any countable set $\mathcal{X}$ we have that $\triangle_{\mathcal{X}} = \{p \in \mathbb{R}^{|\mathcal{X}|} : \sum_{x \in \mathcal{X}} p_x = 1, p_x \geq 0 \, \forall x \in \mathcal{X}\}$ so that $p_c$ for every $c \in \mathcal{C}$ defines a probability distribution over actions $\mathcal{A}$ . In addition we use the notation $a \lor b := \max\{a, b\}$ . We begin with a necessary condition on the sample complexity for the particular case of exact policy identification ( $\epsilon = 0$ ). + +Theorem 2.2 (Lower bound). Fix $\epsilon = 0$ and $\delta \in (0,1)$ . Moreover, fix a contextual bandit instance $\mu = (\nu, r)$ and a collection of policies $\Pi$ . Then any $(0, \delta)$ -PAC algorithm for contextual bandits satisfies $\mathbb{E}_{\mu}[\tau] \geq \rho_{\Pi,0} \log(1/2.4\delta)$ . + +The proof of the lower bound follows from standard information theoretic arguments [24]. The lower bound implicitly applies to learners that know the distribution $\nu$ precisely. In practice, such knowledge would never be available however the learner may have a large dataset of offline data. + +Assumption 1. Prior to starting the game, the learning algorithm is given a large dataset of contexts $\mathcal{D} = \{c_t\}_{t=1}^T$ , where each $c_t$ is drawn IID from $\nu$ for all $t \in [T]$ , and $T = O(\text{poly}(1/\epsilon, |\mathcal{A}|, \log(1/\delta), \log(|\Pi|)))$ . + +The above only assumes access to samples from the context distribution, not rewards or the value function. Importantly, since $\mathcal{C}$ could be uncountable, we do not assume $\mathcal{D}$ covers the support of $\nu$ . Assumption $\square$ is satisfied, for example, in an e-commerce setting where the context is the demographic information about visitors to the site for which massive troves of historical data may be available. Other works in PAC learning have made similar assumptions [20]. We would like our algorithm to be computationally efficient in the sense that it makes a polynomial number of calls to what we refer to as argmax oracle. Such an assumption is common in the contextual bandits literature [3, 11, 25]. + +Definition 2.3 (Argmax oracle (AMO)). The oracle $\mathsf{AMO}(\Pi, \{(c_t, s_t)\}_{t=1}^n)$ is an algorithm that given contexts and cost vectors $(c_1, s_1), \dots, (c_n, s_n) \in \mathcal{C} \times \mathbb{R}^{|\mathcal{A}|}$ , returns $\underset{\pi \in \Pi}{\arg \max} \sum_{t=1}^n s_t(\pi(c_t))$ . + +The constrained argmax oracle C-AMO, given an upper bound $l$ on the loss, returns $\arg \max_{\pi \in \Pi}\sum_{t = 1}^{n}s_{t}\left(\pi \left(c_{t}\right)\right)$ subject to $\sum_{t = 1}^{n}s_{t}\left(\pi \left(c_{t}\right)\right)\leq l.$ + +In general we can implement AMO by calling to cost-sensitive classification [6,11] and C-AMO through a Lagrangian relaxation and a cost-sensitive classification oracle [2,8]. Our algorithm uses an argmax oracle as a subroutine at most polynomially in $\epsilon^{-1}$ , $\log(1/\delta)$ , $|\mathcal{A}|$ and $\log(|\Pi|)$ . In this sense, it is computationally efficient. The following sufficiency result holds for general $\epsilon \geq 0$ . + +Theorem 2.4 (Upper bound). Fix $\epsilon \geq 0$ and $\delta \in (0,1)$ . Under Assumption I there exists a computationally efficient $(\epsilon, \delta)$ -PAC algorithm for contextual bandits that satisfies $\tau \leq \rho_{\Pi, \epsilon} \log(|\Pi| \log_2(1/\epsilon)/\delta) \log(1/\Delta_\epsilon)$ , where $\Delta_\epsilon = \max\{\epsilon, \min_{\pi \in \Pi \setminus \pi_*} V(\pi_*) - V(\pi)\}$ . Furthermore, this sample complexity never exceeds $\frac{|A| (\log(|\Pi|) + \log(1/\delta)) \log(1/\epsilon)}{\epsilon^2}$ . + +The second part of the theorem follows from the first, since $\rho_{\Pi,\epsilon} \leq 2|\mathcal{A}|/\epsilon^2$ by taking $p_{c,a} = 1/|\mathcal{A}|$ for all $(c,a) \in \mathcal{C} \times \mathcal{A}$ . + +# 2.1 Inefficiency of low-regret algorithms + +Computationally efficient algorithms are known to exist, such as ILOVETOCONBANDITS [3], which achieve a minimax-optimal cumulative regret of $\sqrt{T|\mathcal{A}|\log(|\Pi| / \delta)}$ . Inspecting the proof in [3], one can extract a sample complexity of $\epsilon^{-2}|\mathcal{A}|\log (|\Pi | / \delta)$ from such results (which is also minimax optimal for PAC). The previous section showed that the sample complexity of our algorithm, Theorem 2.4, nearly matches the instance-dependent lower bound of Theorem 2.2. In other words, our algorithm achieves a nearly optimal instance-dependent PAC sample complexity. However, it is natural to wonder if perhaps with a tighter analysis, the minimax regret optimal algorithm in [3] also obtains the instance-optimal PAC sample complexity. In this section, we show that this is not the case. Indeed, we show that any algorithm that is minimax regret optimal must have a sample complexity that is at least quadratic in the optimal PAC sample complexity of some instance. + +Definition 2.5 (Hard instance). Fix $m \in \mathbb{N}$ , $\Delta \in (0,1]$ and let $\mathcal{C} = [m]$ with uniform distribution, $\mathcal{A} = \{0,1\}$ . For $i = 1,\dots,m$ , let $\pi_i(j) = \mathbf{1}\{i = j\}$ and define $r(i,j) = \Delta \mathbf{1}\{j = \pi_1(i)\}$ . Then $V(\pi_1) = \Delta$ and $V(\pi_i) = \Delta (1 - 2 / m)$ for all $i \in \mathcal{C} \setminus \{1\}$ . + +Note that for the hard instance, $m = |\Pi|$ . If observations are corrupted by $\mathcal{N}(0,1)$ additive noise, then a straightforward calculation shows that $\rho_{\Pi,0} = \frac{4/m}{(2\Delta/m)^2} = m\Delta^{-2}$ for the hard instance. + +Theorem 2.6. Fix $\delta \in (0,1)$ and $\Delta \in (0,1]$ . We say an algorithm is an $\alpha$ -minimax regret algorithm if for some $\alpha > 0$ and all $T \in \mathbb{N}$ : + +$$ +\max _ {\mu^ {\prime}} \mathbb {E} _ {\mu^ {\prime}} \left[ \sum_ {t = 1} ^ {T} \left(r _ {t} \left(c _ {t}, \pi_ {*} (c _ {t})\right) - r _ {t} \left(c _ {t}, a _ {t}\right)\right) \right] = \max _ {\mu^ {\prime}} \sum_ {c, a} \mathbb {E} _ {\mu^ {\prime}} \left[ T _ {c, a} (T) \right] \left(r (c, \pi_ {*} (c)) - r (c, a)\right) \leq \sqrt {\alpha | \mathcal {A} | T} +$$ + +where the maximum is taken over all contextual bandit instances $\mu' = (\nu', r')$ and $T_{c,a}(T) = \sum_{t=1}^{T} \mathbf{1}\{c_t = c, a_t = a\}$ . For any $\alpha$ -minimax regret algorithm, it is $(0, \delta)$ -PAC if at a stopping time $\tau$ it outputs the optimal policy $\pi_*$ w.p. at least $1 - \delta$ . Any $\alpha$ -minimax regret algorithm that is $(0, \delta)$ -PAC satisfies $\mathbb{E}_{\mu}[\tau] \geq m^2 \Delta^{-2} \log^2(1/2.4\delta)/4\alpha$ for the instance $\mu = (\nu, r)$ defined in [2.5]. + +We point out that the minimax regret optimal rate takes $\alpha = \log(m) = \log(|\Pi|)$ . Thus, taking $\Delta = 1$ and $\delta = 0.1$ , the minimax regret optimal algorithm has a PAC sample complexity of $m^2 / \log(m)$ ; whereas the PAC sample complexity of our algorithm, Theorem 2.4, is just $m \log(m)$ . That is, algorithms with optimal minimax regret have a sample complexity that is at least nearly the optimal PAC sample complexity squared. This demonstrates that no algorithm can simultaneously be minimax regret optimal and obtain the optimal PAC sample complexity. + +# 2.2 Trivial policy class + +As a warm-up to discussing linear policy classes, let us consider the simplest policy class. + +Definition 2.7 (Trivial policy class). Assume $|\mathcal{C}| < \infty$ and let $\Pi = \{\pi(c) = a : (c, a) \in \mathcal{C} \times \mathcal{A}\}$ so that $|\Pi| = |\mathcal{A}|^{|\mathcal{C}|}$ . + +The trivial policy class has the flexibility to predict any action $a \in \mathcal{A}$ individually for each $c \in \mathcal{C}$ . This allows us to show that $\rho_{\Pi,0} \leq \max_c \frac{2}{\nu_c} \sum_{a'} \Delta_{c,a'}^{-2}$ (see Appendix A.3). An immediate corollary of Theorem 2.4 is obtained by simply noting that $|\Pi| = |\mathcal{A}|^{|\mathcal{C}|}$ . + +Corollary 2.8 (Trivial class, upper). Fix $\epsilon >0$ and $\delta \in (0,1)$ . Let $\Pi$ be the trivial policy class applied to some fixed $\mathcal{C}$ , $\mathcal{A}$ spaces. Then under Assumption there exists a computationally efficient $(\epsilon ,\delta)$ -PAC algorithm for contextual bandits that satisfies $\tau \leq \min \{A\epsilon^{-2},\max_c\frac{1}{\nu_c}\sum_{a'}\Delta_{c,a'}^{-2}\}(|\mathcal{C}|\log (|\mathcal{A}|) + \log (1 / \delta))\log (1 / \Delta_\epsilon)$ , where $\Delta_{\epsilon} = \max \{\epsilon ,\min_{\pi \in \Pi \setminus \pi_*}V(\pi_*) - V(\pi)\}$ . Furthermore, this sample complexity never exceeds $\frac{|\mathcal{A}|(|\mathcal{C}|\log(|\mathcal{A}|) + \log(1 / \delta))}{\epsilon^2}\log (1 / \epsilon)$ . + +Ignoring log factors, the minimax sample complexity of the trivial class is just $\epsilon^{-2}|\mathcal{A}|(|\mathcal{C}| + \log(1/\delta))$ . This is actually a somewhat surprising result, because it says $\lim_{\delta \to 0} \frac{\mathbb{E}[\tau]}{\log(1/\delta)} \to \epsilon^{-2}|\mathcal{A}|$ which is independent of $|\mathcal{C}|$ . To see why this result is somewhat remarkable, if we played a best-arm identification algorithm for each of the $|\mathcal{C}|$ contexts, then this would lead to a sample complexity of $\epsilon^{-2}|\mathcal{C}| \cdot |\mathcal{A}| \log(1/\delta)$ . It is somewhat of a surprise that such a natural strategy is not optimal. For intuition for why we can avoid the multiplicative $|\mathcal{C}|$ , note that to identify an $\epsilon$ -good policy among just two policies $(\pi, \pi_*)$ using uniform exploration requires just $\epsilon^{-2}|\mathcal{A}| \log(1/\delta)$ samples. When we have more than two policies, a union bound achieves the claimed result. + +The minimax sample complexity of Corollary 2.8 (i.e., the second statement) is nearly tight: + +Theorem 2.9 (Trivial class, lower). Fix $\epsilon > 0$ and $\delta \in (0,1/6)$ . Let $\Pi$ be the trivial policy class applied to some fixed $\mathcal{C},\mathcal{A}$ spaces. Moreover, fix a contextual bandit instance $\mu = (\nu,r)$ and a collection of policies $\Pi$ . Then any $(0,\delta)$ -PAC algorithm for contextual bandits satisfies $\mathbb{E}_{\mu}[\tau] \geq \max_c \frac{1}{\nu_c} \sum_a \Delta_{c,a}^{-2} \log(1/2.4\delta)$ . Furthermore, $\sup_{\mu} \mathbb{E}_{\mu}[\tau] \geq \epsilon^{-2} |\mathcal{A}|(|\mathcal{C}| + \log(1/\delta))$ . + +# 2.3 Linear policy class + +A particularly compelling model-class of policies is the set of linear policies. + +Definition 2.10 (Linear policy class). Fix a feature map $\phi : \mathcal{C} \times \mathcal{A} \to \mathbb{R}^d$ and assume it is known to the learner. Let $\Pi = \{\pi(c) = \arg \max_{a \in \mathcal{A}} \langle \phi(c, a), \theta \rangle, \forall \theta \in \mathbb{R}^d\}$ . + +We can consider two settings: the agnostic setting and the realizable setting. In the agnostic setting, there is no assumed relationship between the true reward function $r(c,a)$ and $\phi :\mathcal{C}\times \mathcal{A}\to \mathbb{R}^d$ . In this case, Theorem 2.4 applies directly by taking a cover of $\Pi$ . + +Corollary 2.11 (Agnostic, upper bound). Fix $\epsilon \geq 0$ and $\delta \in (0,1)$ . Let $\Pi$ be the linear policy class in $\mathbb{R}^d$ . Under Assumption [1] there exists a computationally efficient $(\epsilon, \delta)$ -PAC algorithm for contextual bandits that satisfies $\tau \leq \rho_{\Pi, \epsilon} \cdot (d\log(1/\epsilon) + \log(1/\delta))\log(1/\Delta_\epsilon)$ where $\Delta_\epsilon = \max\{\epsilon, \min_{\pi \in \Pi \setminus \pi_*} V(\pi_*) - V(\pi)\}$ . Furthermore, this sample complexity never exceeds $\frac{|A|(d\log(1/\epsilon) + \log(1/\delta))}{\epsilon^2}\log(1/\epsilon)$ . + +Comparing to the lower bound of Theorem 2.2, the instance dependent upper bound of Corollary 2.11 matches up to a factor of the dimension and negligible log factors. In contrast to the "model-free" feel of the agnostic case, we can also consider a "model-based" type setting, i.e. the realizable setting. + +Definition 2.12 (Realizable). We say the linear policy class is realizable if there exists a $\theta_{*} \in \mathbb{R}^{d}$ such that $r(c, a) = \langle \phi(c, a), \theta_{*} \rangle$ for all $c \in \mathcal{C}$ and $a \in \mathcal{A}$ . Thus, for any $\pi \in \Pi$ we have $V(\pi) = \mathbb{E}_{c \sim \nu}[r(c, \pi(c))] = \mathbb{E}_{c \sim \nu}[\langle \phi(c, \pi(c)), \theta_{*} \rangle] = \langle \phi_{\pi}, \theta_{*} \rangle$ with $\phi_{\pi} := \mathbb{E}_{c \sim \nu}[\phi(c, \pi(c))]$ . Finally, at the start of the game the learner knows this model. + +The setting in Definition 2.12 is commonly referred to as the linear contextual bandit problem [1]. Clearly, we have that $\pi_{*}(c) = \arg \max_{a\in \mathcal{A}}\langle \phi (c,a),\theta_{*}\rangle$ . We begin by defining a quantity fundamental to our sample complexity results: + +$$ +\rho_ {\mathrm {l i n}, \epsilon} := \min _ {p _ {c} \in \triangle_ {\mathcal {A}}, \forall c \in \mathcal {C}} \max _ {\pi \in \Pi \backslash \pi_ {*}} \frac {\left\| \phi_ {\pi} - \phi_ {\pi_ {*}} \right\| _ {\mathbb {E} _ {c \sim \nu} [ \sum_ {a \in \mathcal {A}} p _ {c , a} \phi (c , a) \phi (c , a) ^ {\top} ] ^ {- 1}}}{\left\langle \phi_ {\pi_ {*}} - \phi_ {\pi}, \theta_ {*} \right\rangle^ {2} \vee \epsilon^ {2}}. +$$ + +Theorem 2.13 (Realizable, lower bound). Fix $\epsilon = 0$ and $\delta \in (0,1)$ . Let $\Pi$ be the linear policy class in $\mathbb{R}^d$ and assume it is realizable (see Definitions 2.10 and 2.12). Any $(0,\delta)$ -PAC algorithm in this setting satisfies $\mathbb{E}[\tau] \geq \rho_{\mathrm{lin},0} \cdot \log(1/2.4\delta)$ . + +We now state our nearly matching upper bound. However, in this case we note that the algorithm is not computationally efficient. + +Theorem 2.14 (Realizable, upper bound). Fix $\epsilon \geq 0$ and $\delta \in (0,1)$ . Let $\Pi$ be the linear policy class in $\mathbb{R}^d$ and assume it is realizable (see Definitions 2.10 and 2.12). Under Assumption 1 there exists an $(\epsilon, \delta)$ -PAC algorithm (see Algorithm 1) for this setting satisfying + +$$ +\tau \leq \rho_ {\mathrm {l i n}, \epsilon} \cdot \left(\min \left\{d \log (1 / \epsilon), \log (| \Pi |) \right\} + \log (1 / \delta)\right) \log (1 / \Delta_ {\epsilon}) +$$ + +where $\Delta_{\epsilon} = \max \{\epsilon, \min_{\pi \in \Pi \backslash \pi_{*}} \langle \phi_{\pi_{*}} - \phi_{\pi}, \theta_{*} \rangle\} = \max \{\epsilon, \min_{(c,a) \in \mathcal{C} \times \mathcal{A}: \pi_{*}(c) \neq a} \langle \phi(c, \pi_{*}(c)) - \phi(c,a), \theta_{*} \rangle\}$ . + +Furthermore, this sample complexity never exceeds $\frac{d(d\log(1 / \epsilon) + \log(1 / \delta))\log(1 / \epsilon)}{\epsilon^2}$ . + +We remark that the algorithm that achieves this upper bound is very different than popular optimism-based algorithms for linear contextual bandits e.g., UCB or Thompson sampling [1]. Indeed, our algorithm computes an experimental design and is related to instance-dependent linear bandit algorithms developed for best-arm identification [9, 12, 13, 35] and regret minimization [19, 36]. To our knowledge, Theorem 2.14 provides the first instance-dependent sample complexity for the PAC setting of linear contextual bandits. The most relevant work to Theorem 2.14 is the work of [41] which demonstrated a minimax sample complexity of $d^2/\epsilon^2 \log(1/\delta)$ . Also, we remark that the lower and upper bounds in this section require an additive Gaussian noise. + +Remark 2.15 (Agnostic vs. Realizable). Contrasting the above results, we note that the sample complexity of the agnostic case is always bounded by $|\mathcal{A}|d / \epsilon^2$ , whereas it never exceeds $d^{2} / \epsilon^{2}$ for the realizable case. This matches the intuition that when the number of actions is much larger than the dimension, assuming realizability can significantly reduce the sample complexity. + +# 2.4 Comparison to the Disagreement Coefficient + +The work of [16] provides regret bounds in terms of instance-dependent quantities inspired by the disagreement coefficient, a notion of complexity common in the active learning literature [18]. The following corollary relates our sample complexity to these notions of disagreement coefficients. + +Define the policy disagreement coefficient as + +$$ +\mathfrak {C} _ {\Pi} ^ {\text {p o l}} (\epsilon_ {0}) = \sup _ {\epsilon \geq \epsilon_ {0}} \frac {\mathbb {E} _ {c \sim \nu} [ \mathbf {1} \{\exists \pi \in \Pi_ {\epsilon} : \pi (c) \neq \pi_ {*} (c) \} ]}{\epsilon} +$$ + +where $\Pi_{\epsilon} := \{\pi \in \Pi : \mathbb{P}_{\nu}(\pi(c) \neq \pi_*(c)) \leq \epsilon\}$ and the cost-sensitive disagreement coefficient as + +$$ +\mathfrak{C}_{\Pi}^{\text{csc}}(\epsilon_{0}) = \sup_{\epsilon \geq \epsilon_{0}}\frac{\mathbb{E}_{c\sim\nu}[\mathbf{1}\{\exists\pi\in\Pi:\pi(c)\neq\pi_{*}(c),\mathbb{E}_{c\sim\nu}[r(c,\pi_{*}(c)) - r(c,\pi(c))]\leq\epsilon\}]}{\epsilon}. +$$ + +The AdaCB algorithm of [16] achieves a regret of roughly $R_{T} = O\left(\min_{\delta}\left\{\delta \Delta_{\text{uniform}} T, \frac{|\mathcal{A}| \log(|\Pi|) \mathfrak{C}_{\Pi}^{\text{pol}}(\delta)}{\Delta_{\text{uniform}}}\right\}\right)$ or $R_{T} = O\left(\min_{\delta}\left\{\delta T, |\mathcal{A}| \log(|\Pi|) \mathfrak{C}_{\Pi}^{\text{csc}}(\delta)\right\}\right)$ . Observe that at time $T$ , given the outputs $\pi_{1}, \pi_{2}, \dots, \pi_{T}$ from AdaCB algorithm, one could return a (randomized) policy $\tilde{\pi}$ which on observing a context, samples from the empirical distribution over + +the outputs. By Markov's inequality we have $\tilde{\pi}$ , $V(\pi_{*}) - V(\tilde{\pi}) \leq O(\epsilon)$ with constant probability for $\epsilon = \frac{R_T}{T}$ . Therefore, an upper bound on the regret translates to a PAC sample complexity of $\frac{|A| \log(|\Pi|)}{\epsilon \Delta_{\text{uniform}}} \mathfrak{C}_{\Pi}^{\text{pol}}(\epsilon / \Delta_{\text{uniform}})$ or $\frac{|A| \log(|\Pi|)}{\epsilon} \mathfrak{C}_{\Pi}^{\text{csc}}(\epsilon)$ . + +Finally, Corollary 2.16 shows that this sample complexity bound is at least as large as our upper bound, see Appendix A.5 for the proof. + +Corollary 2.16. Recall that $\Delta_{\mathrm{uniform}} := \min_{c \in \mathcal{C}} \min_{a \in \mathcal{A}} r(c, \pi_*(c)) - r(c, a)$ . For any $\epsilon_0 > 0$ we have that + +1. $\rho_{\Pi ,\epsilon_0}\leq \frac{2|\mathcal{A}|}{\epsilon_0\Delta_{\mathrm{uniform}}}\mathfrak{C}_{\Pi}^{\mathrm{pol}}(\epsilon_0 / \Delta_{\mathrm{uniform}})$ +2. $\rho_{\Pi ,\epsilon_0}\leq \frac{2|\mathcal{A}|}{\epsilon_0}\mathfrak{C}_{\Pi}^{\csc}(\epsilon_0).$ + +Moreover, for all $\epsilon_0\geq 0$ we have that $\rho_{\Pi ,\epsilon_0} < \infty$ whenever $\Delta_{\mathrm{pol}}\coloneqq V(\pi_{*}) - \max_{\pi \neq \pi_{*}}V(\pi) > 0.$ + +# 3 Optimal Algorithms for Contextual Bandits + +# 3.1 Reduction to linear realizability and a simple elimination scheme + +The astute reader may have noticed that if we ignore computation, Theorem 2.4 is actually an immediate corollary of Theorem 2.14 by taking $\phi(c, a) = \mathrm{vec}(\mathbf{e}_c \mathbf{e}_a^\top) \in \mathbb{R}^{|\mathcal{C}| \cdot |\mathcal{A}|}$ where $\mathbf{e}_i$ is a one-hot encoded vector so that $r(c, a) = \langle \phi(c, a), \theta_* \rangle$ with $\theta_* \in \mathbb{R}^{|\mathcal{C}| \cdot |\mathcal{A}|}$ . This observation is key to our sample complexity results. Recalling $\phi_\pi := \mathbb{E}_{c \sim \nu}[\phi(c, \pi(c))]$ (from Definition 2.12), we have that $V(\pi) = \mathbb{E}_{c \sim \nu}[r(c, \pi(c))] = \mathbb{E}_{c \sim \nu}[\langle \phi(c, \pi(c)), \theta_* \rangle] = \langle \phi_\pi, \theta_* \rangle$ . We stress that $\mathcal{C}$ can be uncountable, and thus we would never actually instantiate any of the vectors $\phi(c, a)$ . + +For notational convenience, define the feasible set of (context, action) probability distributions as $\Omega = \left\{w \in \Delta_{\mathcal{C} \times \mathcal{A}} : \nu_c = \sum_{a \in \mathcal{A}} w_{a,c}\right\}$ . Note that for each context, $p_c := \{w_{c,a} / \nu_c\}_{a \in \mathcal{A}} \in \Delta_{\mathcal{A}}$ defines a probability distribution over actions. Also define $A(w) := \sum_{c,a} w_{c,a} \phi(c,a) \phi(c,a)^{\top}$ for any $w \in \Omega$ . Under this notation, recalling the right hand side from Theorems 2.13 and 2.14 we have + +$$ +\min _ {w \in \Omega} \max _ {\pi \in \Pi \backslash \pi_ {*}} \frac {\| \phi_ {\pi} - \phi_ {\pi_ {*}} \| _ {A (w) ^ {- 1}} ^ {2}}{\langle \phi_ {\pi_ {*}} - \phi_ {\pi} , \theta_ {*} \rangle^ {2} \vee \epsilon^ {2}} = \min _ {p _ {c} \in \triangle_ {\mathcal {A}}, \forall c \in \mathcal {C}} \max _ {\pi \in \Pi \backslash \pi_ {*}} \frac {\| \phi_ {\pi} - \phi_ {\pi_ {*}} \| _ {\mathbb {E} _ {c \sim \nu} [ \sum_ {a \in \mathcal {A}} p _ {c , a} \phi (c , a) \phi (c , a) ^ {\top} ] ^ {- 1}} ^ {2}}{\langle \phi_ {\pi_ {*}} - \phi_ {\pi} , \theta_ {*} \rangle^ {2} \vee \epsilon^ {2}} +$$ + +To show that the sample complexity of Theorem 2.4 is a corollary of Theorem 2.14, it suffices to show that equation (1) and the above display are equal. To see this, observe + +$$ +\begin{array}{l} \left\| \phi_ {\pi} - \phi_ {\pi_ {*}} \right\| _ {A (w) ^ {- 1}} ^ {2} = \| \mathbb {E} _ {c \sim \nu} [ \operatorname {v e c} (\mathbf {e} _ {c} \mathbf {e} _ {\pi (c)} ^ {\top}) - \operatorname {v e c} (\mathbf {e} _ {c} \mathbf {e} _ {\pi_ {*} (c)} ^ {\top}) ] \| _ {A (w) ^ {- 1}} ^ {2} \\ = \sum_ {c, a} \frac {\nu_ {c} ^ {2}}{w _ {c , a}} \left(\mathbf {1} \{\pi (c) = a \} + \mathbf {1} \{\pi_ {*} (c) = a \} - 2 \mathbf {1} \{\pi (c) = \pi^ {\prime} (c) \}\right) \\ = \mathbb {E} _ {c \sim \nu} \left[ \left(\frac {1}{p _ {c , \pi (c)}} + \frac {1}{p _ {c , \pi_ {*} (c)}}\right) \mathbf {1} \{\pi_ {*} (c) \neq \pi (c) \} \right]. \\ \end{array} +$$ + +Due to this equivalence, the lower bound of Theorem 2.2 is also a corollary of Theorem 2.13. The lower bound of Theorem 2.13 follows almost immediately from the lower bound argument in [13]. + +The conclusion of this section is that from a sample complexity analysis alone, all that is left is to prove Theorem 2.14. In the next section we propose an algorithm that achieves this sample complexity but assumes precise knowledge of the context distribution $\nu$ (this is relaxed in following sections). While the algorithm is highly impractical for a number of reasons, its analysis provides a great deal of intuition and motivation for our final algorithm. + +# 3.2 A simple, impractical, elimination-style algorithm + +Algorithm $\mathbb{I}$ provides an initial elimination based method for the PAC-contextual bandit problem. The algorithm runs in stages. Before the start of each stage $\ell \in \mathbb{N}$ , the algorithm defines a distribution $p_c^{(\ell)} \in \triangle_{\mathcal{A}}$ for each $c \in \mathcal{C}$ . At each successive time $t \in [n_\ell]$ , it plays random action $a_t \sim p_{c_t}^{(\ell)}$ in response to context $c_t \sim \nu$ , and receives random reward $r_t$ with $\mathbb{E}[r_t | c_t, a_t] = \langle \phi(c_t, a_t), \theta_* \rangle$ . Observe that + +$$ +\mathbb {E} \left[ \phi (c _ {t}, a _ {t}) r _ {t} \right] = \mathbb {E} \left[ \phi (c _ {t}, a _ {t}) \phi (c _ {t}, a _ {t}) ^ {\top} \theta_ {*} \right] = \sum_ {c \in \mathcal {C}, a \in \mathcal {A}} w _ {c, a} ^ {(\ell)} \phi (c, a) \phi (c, a) ^ {\top} \theta_ {*} = A (w ^ {(\ell)}) \theta_ {*} +$$ + +using the identity $w_{c,a}^{(\ell)} \coloneqq \nu_c p_{c,a}^{(\ell)}$ . Thus, if we set $O_t = A(w^{(\ell)})^{-1}\phi(c_t, a_t)r_t$ then $\mathbb{E}[O_t] = \theta_*$ . A straightforward calculation also shows that $\mathrm{Cov}(O_t) = A(w^{(\ell)})^{-1}$ if $r_t$ is perturbed with additive unit variance noise. Thus, an unbiased estimator of $\Delta(\pi, \pi_*) \coloneqq V(\pi_*) - V(\pi) = \langle \phi_{\pi_*} - \phi_{\pi}, \theta_* \rangle$ is simply $\langle \phi_{\pi_*} - \phi_{\pi}, \frac{1}{n_\ell}\sum_t O_t \rangle$ which has variance $\frac{1}{n_\ell}\| \phi_{\pi_*} - \phi_\pi \|_{A(w^{(\ell)})^{-1}}^2$ . Intuitively, $\langle \phi_{\pi_*} - \phi_\pi, \frac{1}{n_\ell}\sum_t O_t \rangle = \langle \phi_{\pi_*} - \phi_\pi, \theta_* \rangle \pm \sqrt{\frac{1}{n_\ell}\|\phi_{\pi_*} - \phi_\pi\|_{A(w^{(\ell)})^{-1}}^2}$ so we can safely conclude that a policy $\pi$ is sub-optimal (i.e., $\pi \neq \pi_*$ ) if there exists any policy $\pi'$ such that $\langle \phi_{\pi'} - \phi_\pi, \frac{1}{n_\ell}\sum_t O_t \rangle \gg \sqrt{\frac{1}{n_\ell}\|\phi_{\pi'} - \phi_\pi\|_{A(w^{(\ell)})^{-1}}^2}$ . This is the intuition behind Contextual RAGE (Algorithm 1), which inherits its name from the best-arm identification algorithm of [13] that inspired its strategy. + +However, while $\langle \phi_{\pi_*} - \phi_\pi, \frac{1}{n_\ell} \sum_t O_t \rangle$ is unbiased and has controlled variance, it is potentially heavy-tailed because $w_{c,a}^{(\ell)}$ can be arbitrarily small. Instead of trying to control $w_{c,a}^{(\ell)}$ and appealing to Bernstein's inequality, in line 7 we use the robust mean estimator of Catoni [28]. We can then show: + +Lemma 3.1. $\pi_{*}\in \Pi_{\ell}$ and $\max_{\pi \in \Pi_{\ell}}\langle \phi_{\pi_{*}} - \phi_{\pi},\theta^{*}\rangle \leq 4\epsilon_{\ell}$ for all $\ell >1$ w.p.at least $1 - \delta$ + +The lemma states that if $\Pi_{\ell}$ is the active set of policies still under consideration, the optimal policy $\pi_*$ is never discarded from $\Pi_{\ell}$ , and moreover, the quality of all policies remaining in $\Pi_{\ell}$ is getting better and better. We are now ready to state the main sample complexity result, with proof in Appendix B. + +Theorem 3.2. Fix any policy class $\Pi = \{\pi : \mathcal{C} \to \mathcal{A}\}_{\pi}$ , distribution over contexts $\nu, \delta \in (0,1)$ , $\epsilon \geq 0$ , and feature map $\phi : \mathcal{C} \times \mathcal{A} \to \mathbb{R}^d$ such that $r(c,a) = \langle \phi(c,a), \theta_* \rangle$ (w.l.o.g. one can always take $\phi(c,a) = \text{vec}(\mathbf{e}_c \mathbf{e}_a^\top)$ ). With probability at least $1 - \delta$ , if $\phi_{\pi} = \mathbb{E}_{c \sim \nu}[\phi(c,\pi(c))]$ and $\pi_* = \arg \max_{\pi} \langle \phi_{\pi}, \theta_* \rangle$ then Contextual-RAGE returns a policy $\widehat{\pi} \in \Pi$ such that $V(\widehat{\pi}) \geq V(\pi_*) - \epsilon$ after taking at most + +$$ +c \min _ {w \in \Omega} \max _ {\pi \in \Pi} \frac {\left\| \phi_ {\pi} - \phi_ {\pi_ {*}} \right\| _ {A (w) ^ {- 1}} ^ {2}}{\left(\left\langle \phi_ {\pi_ {*}} - \phi_ {\pi}, \theta^ {*} \right\rangle \vee \epsilon\right) ^ {2}} \log (\log ((\Delta \vee \epsilon) ^ {- 1}) | \Pi | / \delta) \log ((\Delta \vee \epsilon) ^ {- 1}) +$$ + +samples, where $c$ is an absolute constant and $\Delta = \min_{\pi \in \Pi \backslash \pi_*} V(\pi_*) - V(\pi)$ . + +# 3.3 Towards a more efficient algorithm + +One major issue with Algorithm $\boxed{1}$ is that it explicitly maintains a set of policies $\Pi_{\ell}$ from round to round. Since $\Pi$ could be exponential in $|\mathcal{A}|$ , this is a non-starter for any implementation. As a motivation for our approach, we consider a non-elimination algorithm, Algorithm $\boxed{2}$ as an intermediate step. It does not maintain $\Pi_{\ell}$ and instead just solves the optimization problem $\boxed{2}$ over $\Pi$ . The design computed in $\boxed{2}$ is chosen to ensure that for all $\pi \in \Pi$ , $|\widehat{\Delta}_{\ell - 1}(\pi, \widehat{\pi}_{\ell - 1}) - \Delta(\pi, \pi_*)| \leq 2\epsilon_{\ell - 1} + \frac{1}{4}\Delta(\pi, \pi_*)$ with high probability (Lemma C.3). Equivalently, we estimate gaps up to a constant factor for policies with $\Delta(\pi, \pi_*) > \epsilon_{\ell}$ , while our gap estimates are bounded by $\epsilon_{\ell}$ for those policies satisfying $\Delta(\pi, \pi_*) \leq \epsilon_{\ell}$ . This ensures that our choice of $\widehat{\pi}_{\ell}$ is good enough, i.e. satisfies $V(\pi_*) - V(\widehat{\pi}_{\ell}) \leq \epsilon_{\ell}$ with high probability. The full proof is in Appendix C. + +Unfortunately, Algorithm 2 introduces additional problems. It is not clear whether solving (2) is computationally efficient. Also, we need to find an estimator $\widehat{\Delta}_l$ that is computationally efficient even if the policy space $\Pi$ is infinite. In addition, it requires precise knowledge of $\nu$ to even define the domain of distributions $\Omega$ optimized over, and store the solution $w\in \mathcal{C}\times \mathcal{A}$ explicitly. But in general, such precise knowledge will not be available and is only estimable using past data (Assumption 1). + +# 3.4 An instance-optimal and computationally efficient algorithm. + +In this section we provide Algorithm 3, which witnesses the guarantees of Theorem 2.14 for the general agnostic contextual bandit problem. We now address the caveats of the previous approaches. + +Access to Offline Data. By Assumption [1], we have access to a large amount of sampled offline contexts $\mathcal{D}$ , where each $c_{t} \in \mathcal{D}$ is drawn IID from $\nu$ . Having access to $\mathcal{D}$ allows us to approximate $\mathbb{E}_{c \sim \nu}[\cdot]$ with expectations over the empirical distribution $\mathbb{E}_{c \sim \nu_{\mathcal{D}}}[\cdot]$ , where $\nu_{\mathcal{D}}$ is the uniform distribution over historical data $\mathcal{D}$ . The number of offline contexts we need only scales logarithmically over the size of the policy set $\Pi$ , more specifically, $\mathrm{poly}(|\mathcal{A}|, \epsilon^{-1}, \log (|\Pi|), \log (1 / \delta))$ . We quantify the precise number of samples needed in Appendix D.2 + +# Algorithm 1 Elimination Contextual RAGE + +Input: $\Pi, \phi: \mathcal{C} \times \mathcal{A} \to \mathbb{R}^d$ , $\delta \in (0,1)$ + +1: Initialize $\Pi_1 = \Pi$ +2: for $\ell = 1,2,\dots ,\lceil \log_2(1 / \epsilon)\rceil$ do +3: $\epsilon_{\ell} := 2^{-\ell}, \delta_{\ell} := \delta / (2\ell^{2}|\Pi|)$ +4: Let $n_{\ell}$ be the minimum value s.t.: + +$$ +\min _ {w \in \Omega} \max _ {\pi , \pi^ {\prime} \in \Pi_ {\ell}} \frac {\| \phi_ {\pi} - \phi_ {\pi^ {\prime}} \| _ {A (w) ^ {- 1}} ^ {2} \log (1 / \delta_ {\ell})}{n _ {\ell}} \leq e _ {\ell} ^ {2} +$$ + +with solution $w^{(\ell)}$ + +5: For each $t \in [n_{\ell}]$ , get $c_{t} \sim \nu$ , pull $a_{t} \sim p_{c_{t}}^{(\ell)}$ , observe reward $r_{t}$ +6: Compute $O_{t} = A(w^{(\ell)})^{-1}\phi (c_{t},a_{t})r_{t}$ +7: For $\pi, \pi' \in \Pi_{\ell}$ + +$$ +\widehat {\Delta} _ {\ell} \left(\pi , \pi^ {\prime}\right) = \operatorname {C a t} \left(\left\{\left\langle \phi_ {\pi} - \phi_ {\pi^ {\prime}}, O _ {i} \right\rangle \right\} _ {i = 1} ^ {n _ {\ell}}\right) +$$ + +8: Update + +$$ +\Pi_ {\ell + 1} = \Pi_ {\ell} \backslash \left\{\pi^ {\prime} \in \Pi_ {l} \mid \max _ {\pi \in \Pi_ {\ell}}: \widehat {\Delta} _ {\ell} \left(\pi , \pi^ {\prime}\right) > \epsilon_ {\ell} \right\} +$$ + +9: end for + +Output: $\Pi_{\ell +1}$ + +# Algorithm 2 Non-elimination Contextual RAGE + +Input: $\Pi, \phi: \mathcal{C} \times \mathcal{A} \to \mathbb{R}^d$ , $\delta \in (0,1)$ + +1: Initialize: $\widehat{\pi}_0\in \Pi$ arbitrarily +2: for $\ell = 1,2,\dots ,\left[\log_2(1 / \epsilon)\right]$ do +3: $\epsilon_{\ell} := 2^{-\ell}$ , $\delta_{\ell} := \delta / (2\ell^{2}|\Pi|)$ +4: Let $n_{\ell}$ be the minimum value s.t.: + +$$ +\begin{array}{l} \min _ {w \in \Omega} \max _ {\pi \in \Pi} - \frac {1}{4} \widehat {\Delta} _ {l - 1} (\pi , \widehat {\pi} _ {l - 1}) \\ + \sqrt {\frac {2 \| \phi_ {\pi} - \phi_ {\bar {\pi} _ {l - 1}} \| _ {A (w) - 1} ^ {2} \log (1 / \delta_ {l})}{n _ {\ell}}} \leq \epsilon_ {\ell}. \tag {2} \\ \end{array} +$$ + +with solution $w^{(\ell)}$ + +5: For each $t \in [n_{\ell}]$ , get $c_t \sim \nu$ , pull $a_t \sim p_{c_t}^{(\ell)}$ , observe reward $r_t$ +6: Compute $O_{t} = A(w^{(\ell)})^{-1}\phi (c_{t},a_{t})r_{t}$ +7: For each $\pi \in \Pi$ , let + +$$ +\widehat {\Delta} _ {\ell} (\pi , \widehat {\pi} _ {\ell - 1}) = \operatorname {C a t} \left(\left\{\left\langle \phi_ {\pi} - \phi_ {\bar {\pi} _ {\ell - 1}}, O _ {i} \right\rangle \right\} _ {i = 1} ^ {n _ {\ell}}\right) +$$ + +8: Set $\widehat{\pi}_{\ell} \coloneqq \arg \min_{\pi \in \Pi} \widehat{\Delta}_{\ell}(\pi, \widehat{\pi}_{\ell-1})$ (3) + +9: end for + +Output: $\widehat{\pi}_l$ + +Computing the design efficiently. As described, the context space $\mathcal{C}$ may be infinite so maintaining a distribution $\omega \in \Omega \subset \Delta_{\mathcal{C} \times \mathcal{A}}$ is not possible. To overcome this issue, we consider the dual problem of equation (2). We can remove the square root by noticing that $2\sqrt{xy} = \min_{\gamma > 0} \gamma x + \frac{y}{\gamma}$ , and introducing an additional minimization over the variable $\gamma_{\pi}$ , $\pi \in \Pi$ . Then, the dual problem becomes $\max_{\lambda \in \Delta_{\Pi}} \min_{w \in \Omega} \min_{\gamma_{\pi} \geq 0} \sum_{\pi \in \Pi} \lambda_{\pi} \left(-\widehat{\Delta}_{l-1}(\pi, \widehat{\pi}_{l-1}) + \gamma_{\pi} \left\| \phi_{\pi} - \phi_{\widehat{\pi}_{l-1}} \right\|_{A(w)^{-1}}^2 + \frac{\log(1 / \delta_l)}{2\gamma_{\pi} n_l}\right)$ . + +Exchanging the order of the minimums on $\omega$ and $\gamma$ , somewhat surprisingly we have the close-form expression (Lemma E.6) + +$$ +\min _ {\omega \in \Omega} \sum_ {\pi \in \Pi} \lambda_ {\pi} \gamma_ {\pi} \| \phi_ {\pi} - \phi_ {\widehat {\pi} _ {\ell - 1}} \| _ {A (w) ^ {- 1}} ^ {2} = \mathbb {E} _ {c \sim \nu} \left[ \left(\sum_ {a \in \mathcal {A}} \sqrt {(\lambda \odot \gamma) ^ {\top} t _ {a} ^ {(c)} (\widehat {\pi} _ {l - 1})}\right) ^ {2} \right], +$$ + +where for $\pi' \in \Pi$ , $t_a^{(c)}(\pi') \in \{0,1\}^{\Pi}$ with $[t_a^{(c)}(\pi')]_{\pi} := \mathbf{1}\{\pi(c) = a, \pi'(c) \neq a\} + \mathbf{1}\{\pi(c) \neq a, \pi'(c) = a\}$ and $[\lambda \odot \gamma]_{\pi} := \lambda_{\pi} \gamma_{\pi}$ . Interestingly, this value is achieved at a sampling distribution $\omega$ , which is a non-linear function of $\lambda$ rather than a convex combination over policies (as in [3]). Because we have an expectation over contexts, this expectation can be replaced by an empirical estimate using historical data, thus avoiding any issues with an infinite context space. The final algorithm utilizing these observations found is in Algorithm 3. + +The main challenge is finding a solution to the design (5). First, we can reduce it to a saddle point problem over $(\lambda ,\gamma)$ by considering only a dyadic sequence of $n\in \{2^k:k\in \mathbb{N}\}$ . We use an alternating ascent/descent method, with the caveat that $\lambda$ lives in a simplex, and $\gamma$ in a box. Both spaces are defined over a potentially infinite set of policies $\Pi$ (in the worst case exponential in $|\mathcal{C}|$ ). + +To handle this, we use the Frank-Wolfe (FW) method on $\lambda$ . Referring to the iterates of FW as $\lambda^t$ , FW guarantees that the size of the support of $\lambda^t$ in each iterate grows by at most 1. Thus, if initialized as a 1-sparse vector, we only need to maintain a sparse $\lambda^t$ in each iteration. Each iterate of FW computes + +$$ +\arg \max _ {\pi \in \Pi} [ \nabla_ {\lambda} h _ {\ell} (\lambda , \gamma , n) ] _ {\pi}. +$$ + +To do so, we show that we can appeal to a constrained argmax oracle (AMO) to run the Frank-Wolfe algorithm, a similar approach to [3]. To optimize over $\gamma$ we use a gradient descent procedure. We show that in each iterate, the support of $\gamma$ is contained in that of $\lambda$ , and we can quantify the number of steps of gradient descent needed to find an $\epsilon$ -good solution. Though $h_l(\lambda, \gamma, n)$ might not be convex in $\gamma$ , we nevertheless are able to argue that it has a unique minima and that gradient descent converges to this minima. We introduce our subroutine and further discuss the above claims in Appendix D. + +Regularized Estimator. While Algorithms 1 and 2 use a robust mean estimator as in equation 3, this estimator is impractical with a very large number of policies II. Instead, we use a regularized IPS estimator that can be computed using historical data and an argmax oracle. + +# Algorithm 3 Contextual Oracle-efficient Dualized Algorithm (CODA) + +Input: policies $\Pi = \{\pi : \mathcal{C} \to \mathcal{A}\}_{\pi}$ , feature map $\phi : \mathcal{C} \times \mathcal{A} \to \mathbb{R}^d$ , $\delta \in (0,1)$ , historical data $\mathcal{D} = \{\nu_s\}_s$ + +1: initiate $\widehat{\pi}_0\in \Pi$ arbitrarily, $\lambda_0 = \mathbf{e}_{\widehat{\pi}_0},\widehat{\Delta}_0(\pi),\gamma_0,\gamma_{\min},\gamma_{\max}$ appropriately +2: for $l = 1, 2, \dots$ do +3: $\epsilon_{l} = 2^{-l^{\prime}},\delta_{l} = \delta /(l^{2}|\Pi |^{2})$ +4: Define + +$$ +h _ {l} (\lambda , \gamma , n) = \sum_ {\pi \in \Pi} \lambda_ {\pi} \left(- \widehat {\Delta} _ {l - 1} ^ {\gamma_ {l - 1}} (\pi , \widehat {\pi} _ {l - 1}) + \frac {\log (1 / \delta_ {l})}{\gamma_ {\pi} n}\right) + \mathbb {E} _ {c \sim \nu_ {\mathcal {D}}} \left[ \left(\sum_ {a \in \mathcal {A}} \sqrt {(\lambda \odot \gamma) ^ {\top} t _ {a} ^ {(c)} (\widehat {\pi} _ {l - 1})}\right) ^ {2} \right]. +$$ + +5: Let $\lambda^l, \gamma^l, n_l = \mathsf{FW - GD}(\Pi, |\mathcal{A}|, \widehat{\pi}_{l-1}, \epsilon_l)$ . These are the solutions to + +$$ +n _ {\ell} := \min \left\{n \in \mathbb {N}: \max _ {\lambda \in \Delta_ {\Pi}} \min _ {\gamma \in \left[ \gamma_ {\min }, \gamma_ {\max } \right] ^ {| \Pi |}} h _ {l} (\lambda , \gamma , n) \leq \epsilon_ {\ell} \right\} \tag {5} +$$ + +6: For $i \in [n_{\ell}]$ get $c_{i} \sim \nu$ , pull $a_{i} \sim p_{c_{i}}^{(\ell)}$ where $p_{c_{s}, a_{s}}^{(\ell)} \propto \sqrt{(\lambda_{l} \odot \gamma_{l})^{\top} t_{a_{s}}^{(c_{s})} (\widehat{\pi}_{l-1})}$ , observe rewards $r_{s}$ +7: For each $\pi \in \Pi$ , define the IPS estimator + +$$ +\widehat {\Delta} _ {l} ^ {\gamma_ {l}} (\pi , \widehat {\pi} _ {l - 1}) = \sum_ {s = 1} ^ {n _ {l}} \frac {r _ {s}}{p _ {c _ {s} , a _ {s}} ^ {(\ell)} + [ \gamma_ {l} ] _ {\pi}} \left(\mathbf {1} \{\widehat {\pi} _ {l - 1} (c _ {s}) = a _ {s} \} - \mathbf {1} \{\pi (c _ {s}) = a _ {s} \}\right) +$$ + +8: set + +$$ +\widehat {\pi} _ {l} = \arg \min _ {\pi \in \Pi} \widehat {\Delta} _ {l} ^ {\gamma_ {l}} (\pi , \widehat {\pi} _ {l - 1}) + \mathbb {E} _ {c \sim \nu_ {\mathcal {D}}} \left[ \left(\frac {[ \gamma_ {l} ] _ {\pi}}{p _ {c , a} ^ {(\ell)}} + \frac {[ \gamma_ {l} ] _ {\pi}}{p _ {c , a ^ {\prime}} ^ {(\ell)}}\right) \mathbf {1} \{\widehat {\pi} _ {l - 1} (c) \neq \pi (c) \} \right] + \frac {\log (1 / \delta_ {l})}{[ \gamma_ {l} ] _ {\pi} n _ {l}} \tag {6} +$$ + +9: end for + +Output: $\widehat{\pi}_l$ + +Algorithm 3 puts all the pieces together and Theorem 3.3 shows our main result. Note that for exposition purposes, we have omitted some additional regularization terms in the optimization problems that have no effect on the sample complexity, but ensure finite-time convergence. Appendix E shows the full algorithm and the proof. In what follows, $\mathrm{poly}_1(|\mathcal{A}|,\epsilon^{-1},\log (1 / \delta))\cdot \log (|\Pi |)$ and $\mathrm{poly}_2(|\mathcal{A}|,\epsilon^{-1},\log (1 / \delta),\log (|\Pi |))$ are polynomials in their arguments. + +Theorem 3.3. Fix set of policies $\Pi$ , context distribution $\nu$ and reward function $r(c, a) \in [0,1]$ . With probability at least $1 - \delta$ , provided a history $\mathcal{D}$ whose size exceeds $\mathrm{poly}_1(|\mathcal{A}|, \epsilon^{-1}, \log(1/\delta)) \cdot \log(|\Pi|)$ , Algorithm $\boxed{3}$ returns a policy $\widehat{\pi}$ satisfying $V(\pi_*) - V(\widehat{\pi}) \leq \epsilon$ in a number of samples not exceeding $O(\rho_{*,\epsilon} \log(|\Pi| \log_2(1/\Delta_\epsilon)/\delta) \log_2(1/\Delta_\epsilon)$ where $\Delta_\epsilon := \max\{\epsilon, \min_{\pi \in \Pi} V(\pi_*) - V(\pi)\}$ . + +In addition, Algorithm 3 is computationally efficient and requires at most $\mathrm{poly}_2(|\mathcal{A}|,\epsilon^{-1},\log (1 / \delta),\log (|\Pi |))$ calls to a constrained argmax oracle. + +Conclusion. This work provides the first instance-dependent lower bounds for the $(\epsilon, \delta)$ -PAC contextual bandit problem. One limitation of this work is that our analysis of Algorithm 3 does not immediately extend to the realizable linear setting. That is, a computationally efficient algorithm that achieves the same bound is not known to exist. In the general agnostic settings discussed in this work, we proposed a computationally efficient algorithm. A second limitation is the assumption that we have access to a large pool of offline data. Because it seems necessary to plan with some information about the context distribution, it is not clear how one would completely remove such an assumption and achieve the same sample complexity bounds. As with any recommender system, there is the potential for unintended consequences from optimizing just a single metric. Moreover, other potential pitfalls can arise, such as negative feedback loops, if our assumptions fail to hold in real-world environments. Such consequences can be mitigated by tracking a diverse set of metrics. + +Acknowledgement and Disclosure of Funding This work was supported, in part, by NSF award 1907907. + +# References + +[1] Yasin Abbasi-Yadkori, David Pál, and Csaba Szepesvári. Improved algorithms for linear stochastic bandits. Advances in neural information processing systems, 24, 2011. +[2] Alekh Agarwal, Alina Beygelzimer, Miroslav Dudík, John Langford, and Hanna Wallach. A reductions approach to fair classification. In International Conference on Machine Learning, pages 60–69. PMLR, 2018. +[3] Alekh Agarwal, Daniel Hsu, Satyen Kale, John Langford, Lihong Li, and Robert Schapire. Taming the monster: A fast and simple algorithm for contextual bandits. In International Conference on Machine Learning, pages 1638-1646. PMLR, 2014. +[4] Aymen Al Marjani and Alexandre Proutiere. Adaptive sampling for best policy identification in markov decision processes. In International Conference on Machine Learning, pages 7459-7468. PMLR, 2021. +[5] Peter Auer, Nicolo Cesa-Bianchi, Yoav Freund, and Robert E Schapire. The nonstochastic multiarmed bandit problem. SIAM journal on computing, 32(1):48-77, 2002. +[6] Alina Beygelzimer, Varsha Dani, Tom Hayes, John Langford, and Bianca Zadrozny. Error limiting reductions between classification tasks. In Proceedings of the 22nd international conference on Machine learning, pages 49-56, 2005. +[7] Sébastien Bubeck et al. Convex optimization: Algorithms and complexity. Foundations and Trends® in Machine Learning, 8(3-4):231-357, 2015. +[8] Andrew Cotter, Maya Gupta, Heinrich Jiang, Nathan Srebro, Karthik Sridharan, Serena Wang, Blake Woodworth, and Seungil You. Training well-generalizing classifiers for fairness metrics and other data-dependent constraints. In International Conference on Machine Learning, pages 1397-1405. PMLR, 2019. +[9] Rémy Degenne, Pierre Ménard, Xuedong Shang, and Michal Valko. Gamification of pure exploration for linear bandits. In International Conference on Machine Learning, pages 2432-2442. PMLR, 2020. +[10] Aniket Anand Deshmukh, Srinagesh Sharma, James W Cutler, Mark Moldwin, and Clayton Scott. Simple regret minimization for contextual bandits. arXiv preprint arXiv:1810.07371, 2018. +[11] Miroslav Dudik, Daniel Hsu, Satyen Kale, Nikos Karampatziakis, John Langford, Lev Reyzin, and Tong Zhang. Efficient optimal learning for contextual bandits. In Proceedings of the Twenty-Seventh Conference on Uncertainty in Artificial Intelligence, pages 169-178, 2011. +[12] Tanner Fiez, Sergio Gamez, Arick Chen, Houssam Nassif, and Lalit Jain. Adaptive experimental design and counterfactual inference. In *Workshops of Conference on Recommender Systems (RecSys)*, 2022. +[13] Tanner Fiez, Lalit Jain, Kevin Jamieson, and Lillian Ratliff. Sequential experimental design for transductive linear bandits. In Advances in Neural Information Processing Systems, 2019. +[14] Dylan Foster, Alekh Agarwal, Miroslav Dudik, Haipeng Luo, and Robert Schapire. Practical contextual bandits with regression oracles. In International Conference on Machine Learning, pages 1539–1548. PMLR, 2018. +[15] Dylan Foster and Alexander Rakhlin. Beyond ucb: Optimal and efficient contextual bandits with regression oracles. In International Conference on Machine Learning, pages 3199-3210. PMLR, 2020. +[16] Dylan Foster, Alexander Rakhlin, David Simchi-Levi, and Yunzong Xu. Instance-dependent complexity of contextual bandits and reinforcement learning: A disagreement-based perspective. In Conference on Learning Theory, pages 2059-2059. PMLR, 2021. +[17] Dylan J Foster, Sham M Kakade, Jian Qian, and Alexander Rakhlin. The statistical complexity of interactive decision making. arXiv preprint arXiv:2112.13487, 2021. + +[18] Steve Hanneke et al. Theory of disagreement-based active learning. Foundations and Trends® in Machine Learning, 7(2-3):131-309, 2014. +[19] Botao Hao, Tor Lattimore, and Csaba Szepesvari. Adaptive exploration in linear contextual bandit. In International Conference on Artificial Intelligence and Statistics, pages 3536-3545. PMLR, 2020. +[20] Tzu-Kuo Huang, Alekh Agarwal, Daniel J Hsu, John Langford, and Robert E Schapire. Efficient and parsimonious agnostic active learning. Advances in Neural Information Processing Systems, 28, 2015. +[21] Martin Jaggi. Revisiting frank-wolfe: Projection-free sparse convex optimization. In International Conference on Machine Learning, pages 427-435. PMLR, 2013. +[22] Chi Jin, Praneeth Netrapalli, Rong Ge, Sham M Kakade, and Michael I Jordan. On nonconvex optimization for machine learning: Gradients, stochasticity, and saddle points. Journal of the ACM (JACM), 68(2):1-29, 2021. +[23] Kwang-Sung Jun, Lalit Jain, Blake Mason, and Houssam Nassif. Improved confidence bounds for the linear logistic model and applications to bandits. In International Conference on Machine Learning (ICML), pages 5148-5157, 2021. +[24] Emilie Kaufmann, Olivier Cappé, and Aurélien Garivier. On the complexity of best-arm identification in multi-armed bandit models. The Journal of Machine Learning Research, 17(1):1-42, 2016. +[25] Akshay Krishnamurthy, Alekh Agarwal, Tzu-Kuo Huang, Hal Daumé III, and John Langford. Active learning for cost-sensitive classification. In International Conference on Machine Learning, pages 1915–1924. PMLR, 2017. +[26] John Langford and Tong Zhang. The epoch-greedy algorithm for multi-armed bandits with side information. Advances in neural information processing systems, 20, 2007. +[27] Lihong Li, Wei Chu, John Langford, and Robert E Schapire. A contextual-bandit approach to personalized news article recommendation. In Proceedings of the 19th international conference on World wide web, pages 661-670, 2010. +[28] Gábor Lugosi and Shahar Mendelson. Mean estimation and regression under heavy-tailed distributions: A survey. Foundations of Computational Mathematics, 19(5):1145-1190, 2019. +[29] Shie Mannor and John N Tsitsiklis. Lower bounds on the sample complexity of exploration in the multi-armed bandit problem. In Learning Theory and Kernel Machines, pages 418-432. Springer, 2003. +[30] John Milnor and David W Weaver. Topology from the differentiable viewpoint, volume 21. Princeton university press, 1997. +[31] Sareh Nabi, Houssam Nassif, Joseph Hong, Hamed Mamani, and Guido Imbens. Bayesian meta-prior learning using Empirical Bayes. Management Science, 68(3):1737-1755, 2022. +[32] Fabian Pedregosa, Geoffrey Negiar, Armin Askari, and Martin Jaggi. Linearly convergent frank-wolfe with backtracking line-search. In Proceedings of the 23rd International Conference on Artificial Intelligence and Statistics, 2020. +[33] Daniel Russo. Simple bayesian algorithms for best arm identification. In Conference on Learning Theory, pages 1417-1418, 2016. +[34] David Simchi-Levi and Yunzong Xu. Bypassing the monster: A faster and simpler optimal algorithm for contextual bandits under realizability. Mathematics of Operations Research, 2021. +[35] Marta Soare, Alessandro Lazaric, and Rémi Munos. Best-arm identification in linear bandits. Advances in Neural Information Processing Systems, 27, 2014. + +[36] Andrea Tirinzoni, Matteo Pirotta, Marcello Restelli, and Alessandro Lazaric. An asymptotically optimal primal-dual incremental algorithm for contextual linear bandits. Advances in Neural Information Processing Systems, 33:1417-1427, 2020. +[37] Aad W Van der Vaart. Asymptotic statistics, volume 3. Cambridge university press, 2000. +[38] Roman Vershynin. High-dimensional probability: An introduction with applications in data science, volume 47. Cambridge university press, 2018. +[39] Andrew Wagenmaker and Kevin Jamieson. Instance-dependent near-optimal policy identification in linear mdps via online experiment design. arXiv preprint arXiv:2207.02575, 2022. +[40] Andrew J. Wagenmaker, Max Simchowitz, and Kevin Jamieson. Beyond no regret: Instance-dependent pac reinforcement learning. In Conference on Learning Theory, pages 358-418. PMLR, 2022. +[41] Andrea Zanette, Kefan Dong, Jonathan Lee, and Emma Brunskill. Design of experiments for stochastic contextual linear bandits. Advances in Neural Information Processing Systems, 34, 2021. + +# Checklist + +The checklist follows the references. Please read the checklist guidelines carefully for information on how to answer these questions. For each question, change the default [TODO] to [Yes], [No], or [N/A]. You are strongly encouraged to include a justification to your answer, either by referencing the appropriate section of your paper or providing a brief inline description. For example: + +- Did you include the license to the code and datasets? [Yes] See Section. +- Did you include the license to the code and datasets? [No] The code and the data are proprietary. +- Did you include the license to the code and datasets? [N/A] + +Please do not modify the questions and only use the provided macros for your answers. Note that the Checklist section does not count towards the page limit. In your paper, please delete this instructions block and only keep the Checklist section heading above along with the questions/answers below. + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] Please see our conclusion. +(c) Did you discuss any potential negative societal impacts of your work? [Yes] Please see our conclusion. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] +(b) Did you include complete proofs of all theoretical results? [Yes] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [N/A] +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [N/A] +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A] +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [N/A] + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [N/A] +(b) Did you mention the license of the assets? [N/A] +(c) Did you include any new assets either in the supplemental material or as a URL? [N/A] + +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/instanceoptimalpacalgorithmsforcontextualbandits/images.zip b/instanceoptimalpacalgorithmsforcontextualbandits/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..fdab914f17865ad5f3d3db4f4a9a60e261f453ff --- /dev/null +++ b/instanceoptimalpacalgorithmsforcontextualbandits/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d413f2b81086d1d1822a6dd82c49afcb405a528b30319b453234a72e812b3b24 +size 202518 diff --git a/instanceoptimalpacalgorithmsforcontextualbandits/layout.json b/instanceoptimalpacalgorithmsforcontextualbandits/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..4e8b64fa307aa61ecca864f1513146d2e28f9f87 --- /dev/null +++ b/instanceoptimalpacalgorithmsforcontextualbandits/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:619d93208a456eb3301d55e0b258a6eb462c228f4de917af44cd312da9eed6c8 +size 795427 diff --git a/integralprobabilitymetricspacbayesbounds/a6e10319-6886-4c19-91bc-7df3004c910a_content_list.json b/integralprobabilitymetricspacbayesbounds/a6e10319-6886-4c19-91bc-7df3004c910a_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..0943f5a52ab3a51108571d2d85ca6094f001e8fe --- /dev/null +++ b/integralprobabilitymetricspacbayesbounds/a6e10319-6886-4c19-91bc-7df3004c910a_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0a1d22dd0dfe5d6baefb4b5442ca116bf7323dbd1343c91f6fef34cc3dba8128 +size 90479 diff --git a/integralprobabilitymetricspacbayesbounds/a6e10319-6886-4c19-91bc-7df3004c910a_model.json b/integralprobabilitymetricspacbayesbounds/a6e10319-6886-4c19-91bc-7df3004c910a_model.json new file mode 100644 index 0000000000000000000000000000000000000000..7b3ecfa4d976ee51fccec368a6bbd54b7202a579 --- /dev/null +++ b/integralprobabilitymetricspacbayesbounds/a6e10319-6886-4c19-91bc-7df3004c910a_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e891034592705e319529436733b88bb81425dc022ad0793851d942c5447757b +size 117632 diff --git a/integralprobabilitymetricspacbayesbounds/a6e10319-6886-4c19-91bc-7df3004c910a_origin.pdf b/integralprobabilitymetricspacbayesbounds/a6e10319-6886-4c19-91bc-7df3004c910a_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..38175becee460c9243239e797642ad131e3dec63 --- /dev/null +++ b/integralprobabilitymetricspacbayesbounds/a6e10319-6886-4c19-91bc-7df3004c910a_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6b1c36c3e7e9c624f62c5d365c553144e80ea2086a01c973d73a793454b28bc3 +size 18279545 diff --git a/integralprobabilitymetricspacbayesbounds/full.md b/integralprobabilitymetricspacbayesbounds/full.md new file mode 100644 index 0000000000000000000000000000000000000000..763bf4a4e6895ddb4b976f34abe28956efe79a53 --- /dev/null +++ b/integralprobabilitymetricspacbayesbounds/full.md @@ -0,0 +1,429 @@ +# Integral Probability Metrics PAC-Bayes Bounds + +# Ron Amit + +Technion - Israel Institute of Technology +The Viterbi Faculty of Electrical Engineering +ronamit@campus.technion.ac.il + +# Baruch Epstein + +Technion - Israel Institute of Technology +The Viterbi Faculty of Electrical Engineering +baruch.epstein@gmail.com + +# Shay Moran + +Technion - Israel Institute of Technology +Faculty of Mathematics +The Taub Faculty of Computer Science +Google Research, Israel +smoran@technion.ac.il + +# Ron Meir + +Technion - Israel Institute of Technology +The Viterbi Faculty of Electrical Engineering +rmeir@ee.technion.ac.il + +# Abstract + +We present a PAC-Bayes-style generalization bound which enables the replacement of the KL-divergence with a variety of Integral Probability Metrics (IPM). We provide instances of this bound with the IPM being the total variation metric and the Wasserstein distance. A notable feature of the obtained bounds is that they naturally interpolate between classical uniform convergence bounds in the worst case (when the prior and posterior are far away from each other), and improved bounds in favorable cases (when the posterior and prior are close). This illustrates the possibility of reinforcing classical generalization bounds with algorithm- and data-dependent components, thus making them more suitable to analyze algorithms that use a large hypothesis space. + +# 1 Introduction and Related Work + +Classical statistical learning theory is based on a worst-case perspective which can be too pessimistic to model practical machine learning. In reality, data is rarely worst-case, and experiments demonstrate learning tasks that are solved with much less data than predicted by traditional theory. A primary manifestation of the traditional worst-case perspective is demonstrated by uniform convergence (UC); a genre of generalization bounds which form the backbone of the classical theory (Vapnik, 1999). These bounds guarantee that the generalization gap of all hypotheses in the output-space of the algorithm simultaneously vanish as the training-set size grows. The key algorithmic insight these bounds provide is summarized by the Empirical Risk Minimization principle (ERM), which asserts that it suffices to output any hypothesis in the class which minimizes the empirical risk. + +Consequently, UC arguments provide non-trivial guarantees only if the hypothesis class used by the algorithm is restricted (e.g. has low Rademacher complexity or bounded VC dimension). In contrast, practical learning approaches such as deep learning algorithms use huge hypothesis classes whose VC dimensions rapidly increase with the size and depth of the underlying network. Hence, the rate guaranteed by UC arguments is often much slower than the rate observed in practice (Bachmann, Moosavi-Dezfooli, & Hofmann, 2021; Nagarajan & Kolter, 2019b; Neyshabur, Bhojanapalli, McAllester, & Srebro, 2017; C. Zhang, Bengio, Hardt, Recht, & Vinyals, 2017). + +A further shortcoming of UC bounds, and the associated ERM principle, is that they are algorithm- and data-independent; that is, they do not utilize beneficial properties of the data and/or the algorithm. For + +example, in practice, regularized algorithms often perform better than Empirical Risk Minimization, but this cannot be expressed by UC bounds and the ERM principle. + +The PAC-Bayes (PB) framework is a prominent example of a theoretical framework that does not require the UC property. This framework was pioneered by Shawe-Taylor and Williamson (1997) and McAllester (1998) and developed in later papers, e.g. (Catoni, 2007; Lever, Laviolette, & Shawe-Taylor, 2013; Maurer, 2004; McAllester, 2003; Seeger, 2002); see Guedj (2019) and Alquier (2021) for extensive surveys. Begin, Germain, Laviolette, and Roy (2016) introduced a general strategy that produces PB bounds from change-of-measure inequalities leading to bounds based on the Rényi's $\alpha$ -divergence, and Alquier and Guedj (2018); Ohnishi and Honorio (2021); Picard-Weibel and Guedj (2022) further extended PB bounds to other Csiszár's $f$ -divergences. + +PB theorems consider the generalization performance of stochastic predictors. These bounds are nonuniform $^2$ by nature, and are algorithm and data-dependent. They are usually based on a complexity term that depends on the Kullback-Leibler (KL) divergence between a data-dependent posterior distribution and a data-independent prior distribution. $^3$ + +There are additional notable works on data and algorithm-dependent guarantees. The classical work of Bousquet and Elisseeff (2002) and Xu and Mannor (2012) studied generalization guarantees that depend on data and algorithm-dependent stability measures. A further line of recent papers tries to incorporate noise robustness/resilience. In Miyaguchi (2019), a PAC-Bayes transportation bound is used to measure the contribution of randomization to PB. This is done via optimal transport and Lipschitzness, based on the usual KL-PB bound. The work of Wei and Ma (2019) uses data-dependent Lipschitz smoothness to improve margin bounds, and Nagarajan and Kolter (2019a) passes from standard PB to a deterministic bound by assuming noise-resilience on the training data. This property translates to the test data, implying that good training smoothness leads to good test smoothness. Finally, Yang, Sun, and Roy (2019) measure data-dependent smoothness around each hypothesis (for each sample) and merge Catoni's bound (Catoni, 2007) with Rademacher theory, to obtain fast rates. + +Recent work by Aminian, Bu, Wornell, and Rodrigues (2022); Lopez and Jog (2018); Rodríguez Gálvez, Bassi, Thobaben, and Skoglund (2021); Wang, Diaz, Santos Filho, and Calmon (2019); J. Zhang, Liu, and Tao (2021) and Neu and Lugosi (2022) proved information-theoretic bounds on the expected generalization gap using the Wasserstein and the total-variation (TV) distances. Our work is within the PB framework, and therefore enjoys the following advantages: (i) The bounds are "in high probability" over the sample rather than in expectation. (ii) PB bounds are sample dependent, i.e., bound the generalization gap for a specific sample-dependent posterior, while information-theoretic bounds are formulated as expectation over all sample sets, thereby providing a basis for empirical algorithms, e.g., Alquier (2021); Dziugaite and Roy (2017). (iii) The reference measure in PB can be any sample-independent distribution, while information-theoretic bounds consider a specific reference. Our work introduces uniform convergence assumptions, while the above-mentioned papers each used different assumptions. Recently, Chee and Loustau (2021) proposed PB bounds with the entropy regularized optimal transport distance for an online-learning setting with a finite class. + +The optimal transport interpretation of the Wasserstein distance has been used recently in other contexts to derive generalization bounds. Chuang, Mroueh, Greenewald, Torralba, and Jegelka (2021) proposed a bound that uses a data-dependent complexity measure, evaluated via the Wasserstein distance of independently sampled subsets of the training data in the feature space. Hou, Kassraie, Kratsios, Rothfuss, and Krause (2022) used the principles of optimal transport to derive an instance-based bound based on the local Lipschitz regularity of the learned prediction function in the data space. + +In the modern deep learning regime, measures of the hypothesis class complexity used in UC bounds, such as the VC dimension or Rademacher complexity, are enormous, making the bounds extremely loose for any reasonable number of samples, as opposed to PB bounds (Dziugaite & Roy, 2017; Jiang, Neyshabur, Mobahi, Krishnan, & Bengio, 2019). However, these complexity measures often have closed-form formulas for models such as neural networks, which show explicitly the effect of the model architecture (number of layer, activation functions etc.). This in contrast to PB bounds, in which the dependence on the hypothesis class is less explicit (but see Anthony and Bartlett + +(1999); Neyshabur, Tomioka, and Srebro (2015) for exceptions for neural networks). Therefore, we believe that extension of UC bounds to incorporate data- and algorithm-dependence can facilitate the design of better performing architectures. A further advantage of PB bounds is their non-uniformity (the generalization gap bound depends on the learning output), hence we can use the bound as a minimization objective for a structural minimization algorithm, where the complexity term acts as a regularizer. In cases where the hypothesis class is very large, but we have some prior knowledge on which hypotheses are more likely to have low population loss (e.g. prefer simpler hypothesis as suggested by Occam's Razor), then in PB one can inject this knowledge as the prior distribution, effectively lowering the generalization bound. + +Can the rich theory of UC bounds be extended to help explain generalization with modern large scale models? Can this theory be used to prove data and algorithm dependent guarantees? In this paper, we take a step in the direction of answering these questions positively. To achieve this goal, we show a new technique to incorporate UC bounds within the PAC-Bayes framework. We prove new PB bounds with Integral Probability Metric (IPM) (Müller, 1997) to measure distances between distributions, rather than the standard KL or $f$ -divergences used so far. Specifically, we focus on utilizing two specific IPMs: the total variation and Wasserstein metrics This IPM framework allows greater flexibility, as it does not require the support of the posterior to be a subset of the prior's support (absolute continuity) as in standard KL-PB bounds, and it applies to deterministic as well as stochastic prior and posterior distributions. In fact, the IPM-based PB bounds we introduce match, at worst, the rate of the UC bound used. Recently, Livni and Moran (2020) showed that the classical KL-PB theorem cannot imply meaningful distribution-free generalization bounds for 1-dimensional linear classification. In contrast, our derived IPM-PB bounds do imply such bounds, because linear classifiers satisfy uniform convergence. + +We note that the work of Audibert and Bousquet (2003, 2007) showed a different approach to utilizing the UC assumption to derive PAC-Bayes bounds. Their work assumed a UC property to utilize the generic chaining technique, resulting in more refined, variance-sensitive, bounds. In contrast to our work, their bound is not fully empirical, and the assumed UC bound is not used by the resulting bound. + +The Total Variation PAC-Bayes (TVPB) bound (Thm. 6) applies in any setting where uniform convergence (UC) (Def. 1) holds, an assumption that is satisfied by many natural learning problems. For example, in binary problems, UC holds with a rate of $O\left(\sqrt{\mathrm{VC}(\mathcal{H}) / m}\right)$ , where $\mathrm{VC}(\mathcal{H})$ is the VC dimension (Vapnik, 1999). As observed in practice, for large models of deep neural networks with very large VC dimensions the learning rate on natural datasets is often much faster than predicted UC bounds. To explain this gap, we must turn to data and algorithm-dependent bounds. The TVPB improves the gap bound to be $O\left(\sqrt{\mathrm{VC}(\mathcal{H})D_{\mathrm{TV}}(Q,P) / m}\right)$ , effectively multiplying the VC dimension by the total variation distance of the posterior from the prior. Intuitively, simpler posteriors (closer to the prior assumed before observing the data) lead to a better generalization gap. Compared to the vanilla KL-PB, the TV distance can be small even in cases where the KL distance can be very large, and in any case, the bound only improves over the original UC bound. In addition, the TV-PB bounds incorporate properties of $\mathcal{H}$ via the VC dim. We also explore settings where the generalization gap function exhibits a certain smoothness property, and show a PB bound with the Wasserstein metric (Thm. 11). We analyze this smoothness property and show an explicit Wasserstein-based bound in the finite hypothesis class setting and in a linear regression setting. In the latter setting, we show that a standard UC bound can be improved by a factor of $O\left(\sqrt{W_1(Q,P)}\right)$ , where $W_1(Q,P)$ is the $1^{\mathrm{st}}$ order Wasserstein distance between posterior and prior over the unit-sphere. We conduct a numerical simulation to demonstrate the improvement of the Wasserstein PB bound over the UC bound, and, in cases of narrow prior distributions, over the KL-PB bound. The experiment also investigates the case of non-randomized predictors by setting the prior and posterior as Dirac delta measures, which $f$ -divergence based PB bounds are unable to use. + +Figure 1 illustrates graphically the organization of the claims in the paper. + +![](images/94188008e0753cdf119fe6973edee74e3d22ac09c0bee3c613fd15dd93db84e4.jpg) +Figure 1: Claims tree diagram. $A \to B$ means that claim $B$ is a special case of claim $A$ , under additional assumptions on the learning problem. For full description of the assumptions, see the corresponding claims. + +# 2 Preliminaries + +# 2.1 The Learning Problem + +We begin with a short description a standard supervised learning task. Consider a domain $\mathcal{Z}$ , a distribution $\mathcal{D}$ over $\mathcal{Z}$ , a hypothesis set $\mathcal{H}$ , and finally, a loss function $\ell: \mathcal{H} \times \mathcal{Z} \to [0,1]$ . The tuple $(\mathcal{D}, \mathcal{H}, \ell)$ defines a learning problem: The learning algorithm receives as input a training set $S = \{z_i\}_{i=1}^m \in \mathcal{Z}^m$ sampled i.i.d from $\mathcal{D}$ and selects an hypothesis $h \in \mathcal{H}$ . The performance of $h$ is measured by the expected risk, $L_{\mathcal{D}}(h) \stackrel{\mathrm{def}}{=} \mathbb{E}_{z \sim \mathcal{D}} \ell(h,z)$ . While the expected risk is unavailable to algorithm, the empirical risk, $\hat{L}_S(h) \stackrel{\mathrm{def}}{=} \frac{1}{m} \sum_{i=1}^{m} \ell(h,z_i)$ , can be evaluated using the training data. The generalization gap is defined by $\Delta_S(h) \stackrel{\mathrm{def}}{=} L_{\mathcal{D}}(h) - \hat{L}_S(h)$ . + +Several of our results will assume that the learning problem $(\mathcal{D},\mathcal{H},\ell)$ satisfies the uniform convergence property; i.e. the existence of a uniform upper bound on the generalization gap which applies simultaneously to all hypotheses in $\mathcal{H}$ . + +Definition 1 (Uniform convergence, (Vapnik & Chervonenkis, 2015)). The learning problem $(\mathcal{D},\mathcal{H},\ell)$ satisfies the uniform convergence property, if there exists a bound function $u(m,\delta^{\prime}) > 0$ s.t. for any $m\in \mathbb{N}^{+}$ , $\delta \in (0,1)$ we have + +$$ +\mathbb {P} \left\{\left| \Delta_ {S} (h) \right| \leq u (m, \delta), \forall h \in \mathcal {H} \right\} \geq 1 - \delta \quad a n d \quad u (m, \delta) \underset {m \rightarrow \infty} {\rightarrow} 0. \tag {1} +$$ + +UC type bounds are a major part of the foundations of theoretical machine learning. Unfortunately, they suffers from a few drawbacks. First, currently known bounds tend to be extremely loose in many cases, most notably for deep networks. Second, the setup does not provide a natural way to encode prior knowledge into the bounds, particularly when dealing with deep networks - the hypothesis set is usually rich enough to express all relevant functions, and the training algorithms that might utilize some prior knowledge are not themselves a part of UC based bounds. Finally, UC bounds are usually not data-dependent, a property which is critical to explain the generalization of DNNs on real-world data (Nagarajan & Kolter, 2019b; C. Zhang et al., 2017). + +# 2.2 PAC-Bayes Bounds + +Let $\mathcal{M}(\mathcal{H})$ denote the set of all probability measures over $\mathcal{H}$ . For any probability measure $Q \in \mathcal{M}(\mathcal{H})$ , we define the expected loss, empirical loss and generalization gap by + +$$ +L _ {\mathcal {D}} (Q) \stackrel {\mathrm {d e f}} {=} \underset {h \sim Q} {\mathbb {E}} L _ {\mathcal {D}} (h); \hat {L} _ {S} (Q) \stackrel {\mathrm {d e f}} {=} \underset {h \sim Q} {\mathbb {E}} \hat {L} _ {S} (h); \Delta_ {S} (Q) \stackrel {\mathrm {d e f}} {=} L _ {\mathcal {D}} (Q) - \hat {L} _ {S} (Q). \tag {2} +$$ + +PAC-Bayes theory bounds the expected loss, simultaneously for all "posterior" (sample-dependent) probability measures $Q \in \mathcal{M}(\mathcal{H})$ , with high probability over the samples $S \sim \mathcal{D}^m$ , given any "prior" (sample-independent) probability measure $P \in \mathcal{M}(\mathcal{H})$ . A key feature of most PAC-Bayes bounds is their dependence on the KL divergence between the two distributions $P, Q, \mathrm{KL}(Q \parallel P) \stackrel{\mathrm{def}}{=} \int_{\mathcal{H}} \ln \left( \frac{\mathrm{d}Q}{\mathrm{d}P} \right) \mathrm{d}Q$ , where $\frac{\mathrm{d}Q}{\mathrm{d}P}$ is the Radon-Nikodym derivative of $Q$ w.r.t. $P$ . While KL is a natural measure of divergence between probability distributions, it restricts the applicability of the resulting bounds to cases where the support of $Q$ is contained in the support of $P$ . The following bound was introduced by McAllester (1998). + +Proposition 2 (Classical KL-PB Bound). For any prior $P \in \mathcal{M}(\mathcal{H})$ and $\delta \in (0,1)$ , with probability at least $1 - \delta$ over the samples $S \sim \mathcal{D}^m$ , for all $Q \in \mathcal{M}(\mathcal{H})$ , we have + +$$ +\Delta_ {S} (Q) \leq \sqrt {\frac {\operatorname {K L} (Q \| P) + \ln \left(m / \delta\right)}{2 (m - 1)}}. \tag {3} +$$ + +# 3 A Template for IPM PAC-Bayes Bounds + +# 3.1 General IPM-PB Bound + +Definition 3 (Integral Probability Metric). (Müller, 1997; Striperumbudur, Fukumizu, Gretton, Schölkopf, & Lanckriet, 2009, 2012) The Integral Probability Metric (IPM) between two probability measures $P$ and $Q$ over $\mathcal{H}$ is defined as + +$$ +\gamma_ {\mathcal {F}} (Q, P) \stackrel {{d e f}} {{=}} \sup _ {f \in \mathcal {F}} \left| \int_ {\mathcal {H}} f \mathrm {d} P - \int_ {\mathcal {H}} f \mathrm {d} Q \right| = \sup _ {f \in \mathcal {F}} \left| \underset {h \sim P} {\mathbb {E}} [ f (h) ] - \underset {h \sim Q} {\mathbb {E}} [ f (h) ] \right|, \tag {4} +$$ + +where $\mathcal{F}$ is a set of real-valued bounded functions $\mathcal{H} \to \mathbb{R}$ . + +By definition, IPM distance measures are symmetric and non-negative. Note that the KL-divergence is not a special case of IPM, rather it belongs to the family of $f$ -divergences, that intersect with IPM only at the Total-Variation (Sriperumbudur et al., 2009, 2012). + +The following proposition assumes that for any fixed sample $S' \in \mathcal{Z}^m$ , the function $f_{S'}(h) \stackrel{\mathrm{def}}{=} 2(m - 1)\Delta_{S'}^2(h)$ is a member of a family of functions that depend on the sample, denoted $\mathcal{F}_{S'}$ . Thus, the IPM-PB bound allows us to 'convert' some knowledge we have about the properties of the generalization gap function $\Delta_S(h)$ to a generalization bound. + +Since we do not specify yet the collection of function families $\{\mathcal{F}_S\}_{S\in \mathcal{Z}^m}$ , the bound does not convey an explicit rate, and it should rather be seen as a template. In the next sections, we will derive explicit bounds with specific IPMs divergences. Namely, we will derive a total-variation distance based bound by selecting a collection of bounded function sets, and a Wasserstein distance based bound, by selecting a collection of Lipschitz function sets. + +Proposition 4 (Template for IPM PB Bound). For any fixed dataset $S' \in \mathcal{Z}^m$ , $m \in \mathbb{N}^+$ , let $\mathcal{F}_{S'}$ be a family of bounded and measurable functions $\mathcal{H} \to \mathbb{R}$ . Assume that for any number of samples, $m$ and sample $S' \in \mathcal{Z}^m$ , the function $2(m - 1)\Delta_{S'}^2(\cdot)$ is in $\mathcal{F}_{S'}$ . Then for any prior $P \in \mathcal{M}(\mathcal{H})$ and $\delta \in (0,1)$ , with probability at least $1 - \delta$ over the samples $S \sim \mathcal{D}^m$ , for all $Q \in \mathcal{M}(\mathcal{H})$ , we have + +$$ +\Delta_ {S} (Q) \leq \sqrt {\frac {\gamma_ {\mathcal {F} _ {S}} (Q , P) + \ln (m / \delta)}{2 (m - 1)}}. \tag {5} +$$ + +The proof is in Appendix A.1. The main idea is to use the IPM definition and the assumption as a change-of-measure inequality, instead of the variational formula by Donsker and Varadhan (1975), which is used in the classical KL-PB bound proof. The rest of the proof is similar to the classical derivation (McAllester, 2003; Shalev-Shwartz & Ben-David, 2014). + +Note that, similarly to the classical KL-PB bound, Proposition 4 does not require the UC property to hold. However, in the next sections we will see that assuming an existence of a UC bound $u(m,\delta)$ , and selecting a particular collection of function families $\{\mathcal{F}_S\}_{S\in \mathcal{Z}^m}$ , will result in explicit bounds that can improve upon the worst-case nature of the original $u(m,\delta)$ bound. + +# 3.2 Template for Seeger Type IPM PAC-Bayes Bound + +The work of Seeger (2002) and Maurer (2004) presented a different form of the PAC-Bayes theorem with fast $O(1 / m)$ rate as the dominant term, if the empirical risk is low. + +We denote by $\mathfrak{k1}(p\parallel q)$ the KL divergence between two Bernoulli distributions $\mathcal{B}(p)$ and $\mathcal{B}(q)$ , $p,q\in [0,1]$ , that is, + +$$ +\mathrm {k l} (p \parallel q) \stackrel {\text {d e f}} {=} \left\{ \begin{array}{l l} p \ln \left(\frac {p}{q}\right) + (1 - p) \ln \left(\frac {1 - p}{1 - q}\right), & \text {i f} q \notin \{0, 1 \} \\ 0, & \text {e l s e i f} p = q \\ \text {u n d e f i n e d}, & \text {e l s e .} \end{array} \right. \tag {6} +$$ + +For any $h \in \mathcal{H}$ , define the relative entropy of the empirical risk with respect to the expected one as $\Delta_S^{\mathrm{k1}}(h) \stackrel{\mathrm{def}}{=} \mathfrak{k1}(\hat{L}_S(h) \parallel L_D(h))$ . Similarly, and overloading notations, we define for any distribution $Q \in \mathcal{M}(\mathcal{H})$ , $\Delta_S^{\mathrm{k1}}(Q) \stackrel{\mathrm{def}}{=} \mathfrak{k1}(\hat{L}_S(Q) \parallel L_D(Q))$ . + +By replacing the KL-based change-of-measure inequality step in the proof of (Maurer, 2004, Thm. 5) with the IPM property (Def. 3) we get a similar bound for IPM measures (see a detailed proof in Appendix A.2). + +Proposition 5 (Template for Seeger Type IPM PAC-Bayes Bound). Assume $f_{S}(h) \stackrel{\text{def}}{=} m \cdot \Delta_{S}^{\mathbf{k1}}(h) \in \mathcal{F}_{S}$ . Then for any prior $P \in \mathcal{M}(\mathcal{H})$ and $\delta \in (0,1)$ , with probability at least $1 - \delta$ over the samples $S \sim \mathcal{D}^{m}$ , for all $Q \in \mathcal{M}(\mathcal{H})$ , we have + +$$ +\Delta_ {S} ^ {\mathrm {k l}} (Q) \leq \frac {\gamma_ {\mathcal {F} _ {S}} (Q , P) + \ln \left(2 \sqrt {m} / \delta\right)}{m}. \tag {7} +$$ + +By applying the Refined Pinsker's relaxation (McAllester (2003), Eq. 6) we can immediately derive the following, looser, but easier to interpret bound + +$$ +\Delta_ {S} (Q) \leq \sqrt {2 \hat {L} _ {S} (Q) \frac {\gamma_ {\mathcal {F} _ {S}} (Q , P) + \ln \left(2 \sqrt {m} / \delta\right)}{m}} + 2 \frac {\gamma_ {\mathcal {F} _ {S}} (Q , P) + \ln \left(2 \sqrt {m} / \delta\right)}{m}. \tag {8} +$$ + +When $\hat{L}_S(Q)$ is small (as is typical with modern deep networks), the final term determines the convergence rate. We defer the investigation of PB bounds derived from Prop. 5 to Appendix B. In the following sections we focus on investigating the implication of the Template IPM PB Bound of Prop. 4. + +# 4 Total-Variation PAC-Bayes Bounds + +In this section, we investigate a PB bound with the total-variation (TV) distance, $D_{\mathrm{TV}}(Q,P) \stackrel{\mathrm{def}}{=} \sup_{A \in \Sigma_{\mathcal{H}}} |P(A) - Q(A)|$ , where $\Sigma_{\mathcal{H}}$ is the standard Borel sigma-algebra associated with $\mathcal{H}$ . The TV distance can be described as an IPM with the family of functions + +$$ +\mathcal {F} _ {M} ^ {\infty} \stackrel {\text {d e f}} {=} \left\{f: \mathcal {H} \rightarrow [ 0, \infty), \| f \| _ {\infty} \leq M \right\}, \tag {9} +$$ + +for any $M\geq 0$ . To see this, note that + +$$ +\gamma_ {\mathcal {F} _ {M} ^ {\infty}} (Q, P) = \sup _ {f \in \mathcal {F} _ {M} ^ {\infty}} \left| \int_ {\mathcal {H}} f \mathrm {d} P - \int_ {\mathcal {H}} f \mathrm {d} Q \right| \stackrel {(i)} {=} M \cdot \sup _ {A \in \Sigma_ {\mathcal {H}}} | P (A) - Q (A) | = M D _ {\mathrm {T V}} (Q, P), \tag {10} +$$ + +where equality $(i)$ holds since in the supremum it suffices to take the class of indicator functions $\{M\cdot \mathbb{1}_A(h),A\in \Sigma_{\mathcal{H}}\}$ , since the functions in $\mathcal{F}_M^\infty$ are bounded in $[0,M]$ . + +Theorem 6 (Template for Total-Variation PB Bound). Assume that there exists some uniform convergence bound $u(m, \delta')$ (Definition 1), then, for any prior $P \in \mathcal{M}(\mathcal{H})$ and $\delta \in (0,1)$ , with probability of at least $1 - \delta$ over samples $S \sim \mathcal{D}^m$ , for all $Q \in \mathcal{M}(\mathcal{H})$ , we have + +$$ +\Delta_ {S} (Q) \leq \sqrt {u ^ {2} (m , \delta / 2) D _ {\mathrm {T V}} (Q , P) + \frac {\ln \left(2 m / \delta\right)}{2 (m - 1)}}. \tag {11} +$$ + +The proof (Appendix A.3) follows directly from the general IPM PB bound (Prop. 4) and the uniform convergence assumption, using a union bound argument. This bound can be seen as a template to be used to derive explicit PB bounds, by plugging in existing UC bounds. Note that while we require the existence of UC bound, the resulting bound is nonuniform (since it depends on the data-dependent posterior). + +Compared to the original UC bound, $u(m, \delta)$ , the bound in (11) is roughly multiplied by a factor of $\sqrt{D_{\mathrm{TV}}(Q, P)} \in [0, 1]$ , ensuring tighter guarantees, especially if the posterior is close to the prior. + +For example, consider a binary classification case, with the zero-one loss function and $\mathrm{VC}(\mathcal{H})$ class $\mathcal{H}$ . The well-known UC theorem states that the generalization gap converges uniformly at a rate $O\left(\sqrt{\frac{\mathrm{VC}(\mathcal{H})}{m}}\right)$ . + +Proposition 7 (VC Bound, Boucheron, Bousquet, and Lugosi (2005)). There exists some universal constant $c > 0$ s.t. for any $\delta \in (0,1)$ we have + +$$ +\mathbb {P} \left\{\Delta_ {S} (h) \leq c \sqrt {\frac {\operatorname {V C} (\mathcal {H}) + \ln \left(1 / \delta\right)}{m}}, \forall h \in \mathcal {H} \right\} \geq 1 - \delta . \tag {12} +$$ + +Using Thm. 6, we derive the following algorithm and data-dependent bound. + +Corollary 8 (Total-Variation PB Bound for VC Classes). Consider a binary classification problem, with the zero-one loss, and hypothesis class $\mathcal{H}$ , with finite VC dimension, $\mathrm{VC}(\mathcal{H})$ . There exists some universal constant $c > 0$ s.t. for any prior $P \in \mathcal{M}(\mathcal{H})$ and $\delta \in (0,1)$ , with probability of at least $1 - \delta$ over samples $S \sim \mathcal{D}^m$ , for all $Q \in \mathcal{M}(\mathcal{H})$ , we have + +$$ +\Delta_ {S} (Q) \leq \sqrt {c \frac {\operatorname {V C} (\mathcal {H}) + \ln \left(1 / \delta\right)}{m} D _ {\mathrm {T V}} (Q , P) + \frac {\ln \left(m / \delta\right)}{2 (m - 1)}}. \tag {13} +$$ + +Compared to the UC bound of Prop. 7, Cor. 8 multiplies the dominant term of the bound by a nonuniform (data and algorithm-dependent) factor of $\sqrt{D_{\mathrm{TV}}(Q,P)}$ , which is guaranteed to tighten the bound. + +Note that the total-variation based bound of Aminian et al. (2022) and Rodríguez Gálvez et al. (2021) assume Lipschitz loss function, while our TV bound allows non continuous loss functions such as the zero-one loss. The TV based bound of Wang et al. (2019) (Thm. 1) is not directly comparable, since the empirical risk term is multiplied by a factor that goes to infinity for TV distance that goes to 1. + +# 5 Wasserstein PAC-Bayes Bounds + +# 5.1 Template for Wasserstein-PB Bound + +In this section, we provide a PAC-Bayes generalization bound with the Wasserstein metric between posterior and prior and a certain smoothness parameter of the generalization gap function. We explore learning settings for which $\mathcal{H}$ can be paired with a distance metric $\rho : \mathcal{H} \times \mathcal{H} \to \mathbb{R}_{\geq 0}$ s.t. $(\mathcal{H}, \rho)$ is a Polish metric space (complete, separable metric space). Given the distance metric $\rho$ , we can define the Wasserstein distance between any two probability measures on $\mathcal{H}$ . + +Definition 9 (Wasserstein Distance). For any two probability measures $P, Q$ on $\mathcal{H}$ with finite first moment, the $1^{st}$ order Wasserstein distance is + +$$ +W _ {1} (Q, P) \stackrel {\text {d e f}} {=} \inf _ {\gamma \in \Gamma (Q, P)} \int_ {\mathcal {H} \times \mathcal {H}} \rho \left(h, h ^ {\prime}\right) \mathrm {d} \gamma \left(h, h ^ {\prime}\right), \tag {14} +$$ + +where $\Gamma(Q, P)$ denotes the set of all couplings of $Q$ and $P$ , that is, the set of all joint measure on $\mathcal{H} \times \mathcal{H}$ whose marginals are $Q$ and $P$ . + +The following proposition gives a dual representation for the first-order Wasserstein distance. + +Proposition 10 (Kantorovich-Rubinstein Duality (Villani, 2006)). For any $0 \leq K$ , and any two probability measures $P, Q \in \mathcal{M}(\mathcal{H})$ , + +$$ +K \cdot W _ {1} (Q, P) = \sup _ {f \in \mathcal {F} _ {K} ^ {L i p}} \left| \underset {h \sim P} {\mathbb {E}} [ f (h) ] - \underset {h \sim Q} {\mathbb {E}} [ f (h) ] \right|, \tag {15} +$$ + +where $\mathcal{F}_K^{Lip}$ is the set of $K$ -Lipschitz functions w.r.t. $\rho(h, h')$ , i.e. functions that satisfy + +$$ +\sup _ {(h, h ^ {\prime}) \in \mathcal {H} ^ {2}} \frac {| f (h) - f \left(h ^ {\prime}\right) |}{\rho \left(h , h ^ {\prime}\right)} \leq K. \tag {16} +$$ + +We can write the Kantorovich-Rubinstein duality (15) using IPM formulation (Def. 3), + +$$ +K \cdot W _ {1} (Q, P) = \gamma_ {\mathcal {F} _ {K} ^ {\mathrm {L i p}}} (P, Q). \tag {17} +$$ + +Using this duality we will prove the following bound. + +Theorem 11 (Template for Wasserstein-PB Bound). Assume that for any $\delta' \in (0,1]$ , w.p. at least $1 - \delta'$ over the sampling $S \sim \mathcal{D}^m$ , the squared generalization gap function, $\Delta_S^2(\cdot)$ , is $K$ -Lipschitz w.r.t. the metric $\rho$ with some $K = K(m,\delta')$ . Then, for any prior $P \in \mathcal{M}(\mathcal{H})$ and $\delta \in (0,1)$ , with probability of at least $1 - \delta$ over samples $S \sim \mathcal{D}^m$ , for all $Q \in \mathcal{M}(\mathcal{H})$ , we have + +$$ +\Delta_ {S} (Q) \leq \sqrt {K (m , \delta / 2) W _ {1} (Q , P) + \frac {\ln \left(2 m / \delta\right)}{2 (m - 1)}}. \tag {18} +$$ + +The proof (Appendix A.4) follows directly from Proposition 4 and the assumption, via the union bound. Theorem 11 can be seen as a template to be used for deriving Wasserstein-PB bounds in various learning settings where the $\Delta_S^2 (\cdot)$ is $K$ -Lipschitz with high probability (over samples), where the rate of $K = K(m,\delta /2)$ should be $O(1 / m)$ to ensure a factor $O(1 / \sqrt{m})$ multiplying the divergence between posterior and prior, as in the KL-PB bound. + +Such a result can be challenging to prove since it requires uniform convergence of the slope between any two hypotheses in $\mathcal{H}$ . Next, we will show specific learning settings where this property holds and the resulting generalization bounds. + +We note that recent work Neu and Lugosi (2022) also establishes a Wasserstein-based information-theoretic generalization bound. This work assumed infinitely smooth loss functions and established bounds on the expected generalization gap, rather than high-probability bounds. In fact, Neu and Lugosi (2022) noted that obtaining such bounds is an open problem. Observe, though, that our bound depends on the Lipschitz constant $K = K(m,\delta)$ which needs to be assessed; see sections 5.2 and 5.3 for specific examples. The general problem remains open. + +At a more pragmatic level, we note that learning algorithms derived from minimizing Wasserstein based PB bounds have an added benefit of more stable optimization compared to KL based approaches, due to lower gradient variance, as noted in Arjovsky, Chintala, and Bottou (2017), and this distance measure can be approximated efficiently from finite samples (Cuturi, 2013; Weed & Bach, 2017) + +# 5.2 Wasserstein-PB Bound for Finite Classes + +We first investigate the simple case of a finite hypothesis class with a loss function $\ell$ which is $G$ -Lipschitz w.r.t. the metric $\rho$ . Note that for finite classes, UC always holds. We derive the following bound from Thm. 11. + +Theorem 12 (Wasserstein-PB Bound for Finite Classes). Let $\mathcal{H}$ be a finite hypothesis class. Assume that for any fixed $z\in \mathcal{Z}$ , $\ell (h,z)$ is a $G$ -Lipschitz function in $h$ w.r.t the metric $\rho$ . Then for any prior $P\in \mathcal{M}(\mathcal{H})$ and $\delta \in (0,1)$ , with probability of at least $1 - \delta$ over samples $S\sim \mathcal{D}^m$ , for all $Q\in \mathcal{M}(\mathcal{H})$ , we have + +$$ +\Delta_ {S} (Q) \leq \sqrt {\frac {8 G \log (4 | \mathcal {H} | / \delta)}{m} W _ {1} (Q , P) + \frac {\ln (2 ^ {m} / \delta)}{2 (m - 1)}}. \tag {19} +$$ + +The proof (Appendix A.5) makes use of standard union bound arguments, Hoeffding's concentration inequality and the template Wasserstein-PB bound (Thm. 11). Notice that compared to the standard UC bound for finite classes, Thm. 12 multiplies the bound by a nonuniform factor of $\sqrt{GW_1(Q,P)}$ . + +# 5.3 Wasserstein-PB Bound for Loss-Gradient UC Classes + +In this section we show a Wasserstein-PB bound for learning problems $(\mathcal{D},\mathcal{H},\ell)$ , with $\mathcal{H}\subset \mathbb{R}^d$ , for some dimension $d\in \mathbb{N}^{+}$ , that satisfy the standard UC property, and, additionally, satisfy UC property for the loss gradient, as defined below. + +Definition 13 (Loss-Gradient UC Property). A learning problem $(\mathcal{D},\mathcal{H},\ell)$ , with $\mathcal{H}\subset \mathbb{R}^d$ , is said to satisfy the loss-gradient UC property, if: (i) the loss function $\ell (h,z)$ is differentiable w.r.t. $h$ on $\operatorname {Int}(\mathcal{H})\times \mathcal{Z}$ and continuous w.r.t. $h$ on $\mathcal{H}\times \mathcal{Z}$ . (ii) The problem satisfies the uniform convergence property (Def. 1). (iii) The empirical average of the loss gradient converges uniformly in $L_{2}$ norm sense to its mean. I.e., there exists a bound function $u^{\mathrm{grad}}(m,\delta) > 0$ , s.t. for any $\delta \in (0,1)$ we have $u^{\mathrm{grad}}(m,\delta)\underset {m\to \infty}{\rightarrow}0$ and for any $m\in \mathbb{N}^{+}$ , + +$$ +\mathbb {P} \left(\left\| \mathbb {E} _ {z \sim \mathcal {D}} \nabla_ {h} \ell (h, z) - \frac {1}{m} \sum_ {i = 1} ^ {m} \nabla_ {h} \ell (h, z _ {i}) \right\| _ {2} \leq u ^ {\text {g r a d}} (m, \delta), \forall h \in I n t (\mathcal {H})\right) \geq 1 - \delta , \tag {20} +$$ + +where $\nabla_h\ell (h,z)$ denotes the gradient of $\nabla_h\ell (h,z)$ w.r.t. $h$ for a fixed $z\in \mathcal{Z}$ , and Int $(\mathcal{H})$ is the interior of $\mathcal{H}$ . We call $u^{\mathrm{grad}}$ , the UC bound of the loss gradient. + +Theorem 14 (Wasserstein-PB Bound for Loss-Gradient UC Classes). Let $(\mathcal{H},\rho)$ be a metric space such that $\mathcal{H}\subset \mathbb{R}^d$ is a closed and convex set, and $\rho$ is the $L_{2}$ distance. Assume the learning problem satisfies the loss-gradient UC property (Def. 13), with UC bound $u$ , and a UC bound of the loss gradient, $u^{\mathrm{grad}}$ . Then for any prior $P\in \mathcal{M}(\mathcal{H})$ and $\delta \in (0,1)$ , with probability of at least $1 - \delta$ over samples $S\sim \mathcal{D}^m$ , for all $Q\in \mathcal{M}(\mathcal{H})$ , we have + +$$ +\Delta_ {S} (Q) \leq \sqrt {2 \cdot u (m , \delta / 4) \cdot u ^ {\text {g r a d}} (m , \delta / 4) \cdot W _ {1} (Q , P) + \frac {\ln (2 m / \delta)}{2 (m - 1)}}. \tag {21} +$$ + +The proof (Appendix A.6) is derived from the assumptions and the template Wasserstein-PB bound (Thm. 11). In learning problems that satisfy the loss-gradient UC property, we often have $u(m,\delta /4),u^{\mathrm{grad}}(m,\delta /4)\in O(1 / \sqrt{m})$ , and then the resulting bound is $O(1 / \sqrt{m})$ . We provide full analysis that shows such a rate for the following linear regression example. + +# 5.4 Linear Regression Example + +Based on the Wasserstein-PB Bound for Loss-Gradient UC Classes (Thm. 14), we derive the following corollary. + +Corollary 15 (Wasserstein-PB Bound for Linear Regression). Consider a data distribution of pairs $z = (x, y)$ , where $x$ is sampled from an unknown distribution supported on a $d$ -dimensional ball of radius $r > 0$ , $\mathbb{B}_r^d \stackrel{\text{def}}{=} \{x \in \mathbb{R}^d : \|x\|_2 \leq r\}$ , and the target, $y = f(x)$ , is set by an unknown, possibly random, target function $f: \mathbb{B}_r^d \to [-1, 1]$ . The hypothesis space $\mathcal{H}$ is $\mathbb{B}_{1/r}^d$ , and the loss function is $\ell(x, y, h) = \frac{1}{4} (h^\top x - y)^2$ . Then, for any prior $P \in \mathcal{M}(\mathcal{H})$ and $\delta \in (0, 1)$ , with probability at least $1 - \delta$ over samples $S \sim \mathcal{D}^m$ , for all $Q \in \mathcal{M}(\mathcal{H})$ , + +$$ +\Delta_ {S} (Q) \leq \sqrt {2 u (m , \delta / 4) \cdot u ^ {\text {g r a d}} (m , \delta / 4) \cdot W _ {1} (Q , P) + \frac {\ln (2 m / \delta)}{2 (m - 1)}}, \tag {22} +$$ + +where $W_{1}(Q,P)$ denotes the $1^{st}$ order Wasserstein distance with the $L_{2}$ metric, + +$$ +u (m, \delta) \in O \left(\sqrt {\frac {d \left(1 + \ln \left(1 / \delta\right)\right)}{m}}\right), a n d u ^ {g r a d} (m, \delta) \in O \left(r \sqrt {\frac {d \left(1 + \ln \left(1 / \delta\right)\right)}{m}}\right). \tag {23} +$$ + +The full expression of the bound appears in the theorem's proof (Appendix A.7). Ignoring logarithmic factors we obtained a UC bound of $\tilde{O}\left(\sqrt{\frac{d}{m}}\right)$ , and a Wasserstein-PB bound of $\tilde{O}\left(\sqrt{rW_1(Q,P)\frac{d}{m}}\right)$ . Note that from Thm. 6 we can also deduce a TV-PB bound of order $\tilde{O}\left(\sqrt{D_{\mathrm{TV}}(Q,P)\frac{d}{m}}\right)$ . In + +comparison, the standard KL-PB bound is of order $\tilde{O}\left(\sqrt{\frac{\mathrm{KL}(Q\parallel P)}{m}}\right)$ . The TV-PB bound is, at worst, roughly the same as the UC bound, since $D_{\mathrm{TV}}(Q,P)\leq 1$ . Note that since $Q$ and $P$ are distributions over a sphere of radius $1 / r$ , then $rW_{1}(Q,P)\leq 2$ . Hence, the Wasserstein-PB is also, at worst, roughly the same as the UC bound. However, the KL-PB bound can be either tighter or looser, depending on $P$ and $Q$ . In cases where the mass of the posterior $Q$ is concentrated in a region of the hypothesis set where the prior $P$ is arbitrarily small, then the KL divergence can be arbitrarily large, making the KL-PB bound extremely loose compared to the UC, TV-PB, and Wasserstein-PB bounds. The numerical experiment described in Appendix C demonstrates this by investigating different prior distributions with different widths. In particular, for posteriors and priors that are Dirac delta distributions (i.e., deterministic predictors), we show that the Wasserstein-PB considerably improves over the UC bound, while the KL-PB bound is undefined. We therefore demonstrated non-vacuous guarantees for deterministic models within the PB framework without requiring additional derandomization steps. + +We can compare the bound of Thm. 14 to the bound of Corollary 8, in Neu and Lugosi (2022), which is also dependent on the Wasserstein distance between a data-dependent output (posterior) and a base measure (prior). The bound of Thm. 14 is different in the sense that $(i)$ It holds with high probability instead of in expectation. $(ii)$ Instead of assuming infinitely-smooth loss function with $\beta$ -bounded directional derivatives, Thm. 14 assumes a loss-gradient UC class. $(iii)$ The bound scales as $\tilde{O}\left(\sqrt{W_1 \cdot u \cdot u^{\mathrm{grad}}}\right)$ instead of $\tilde{O}\left(\sqrt{W_2 \cdot \frac{d\beta}{m}}\right)$ . + +In our linear regression example, Cor. 15 scales as $\tilde{O}\left(\sqrt{W_1\cdot u\cdot u^{\mathrm{grad}}}\right) = \tilde{O}\left(\sqrt{r\sqrt{\frac{d}{m}}r\sqrt{\frac{d}{m}}}\right) = \tilde{O}\left(r\sqrt{\frac{d}{m}}\right)$ . The loss is infinitely-smooth with $\beta \in O(1 + r + r^2)$ , and therefore Cor. 8 of Neu and Lugosi (2022) scales as $\tilde{O}\left(\sqrt{W_2\cdot\frac{d\beta}{m}}\right) = \tilde{O}\left(r\sqrt{\frac{d}{m}(1 + r + r^2)}\right)$ , i.e., looser by a factor of $\tilde{O}\left(\sqrt{1 + r + r^2}\right)$ compared to Cor. 15. + +# 6 Discussion + +We have presented high-probability PB bounds based on integral probability metrics, that extend standard PB bounds based on KL divergence and more recent $f$ -divergence and $\alpha$ -divergence based bounds, to a new class of distances. Our bounds interpolate between classic UC bounds and PB bounds, by allowing data- and algorithm-dependent complexity terms. As in all PB results, our bounds suggest improved rates when the PB posterior is close to the prior. While we have extended high-probability PB bounds for IPMs to novel distance measures, it is still an open question to do so without the UC assumption. + +Possible directions for future research include: (i) Deriving high probability IPM-PB bounds (e.g. Wasserstein or TV based), without global UC assumptions (possibly using localization based approaches, e.g., Local Rademacher complexities (Bartlett, Bousquet, & Mendelson, 2005; Koltchinskii & Panchenko, 2004) are computed only on a subset of hypotheses with small empirical risk). This may allow non-vacuous bounds for large-scale models where global UC-based bounds are extremely vacuous. (ii) Derivation of algorithms that utilize the bounds as minimization objectives. Based on the optimization advantages of Wasserstein based costs mentioned in Sec. 5.1, these could lead to enhanced practical utility. Such an advantage could play an important role in meta-learning schemes where PB methods have been widely used in recent years (Amit & Meir, 2018). + +# Acknowledgments + +We thank Nadav Merlis and Daniel Soudry for helpful discussions of this work, and the anonymous reviewers for their helpful comments. Shay Moran is a Robert J. Shillman Fellow; he acknowledges support by ISF grant 1225/20, by BSF grant 2018385, by an Azrieli Faculty Fellowship, by Israel PBC-VATAT, by the Technion Center for Machine Learning and Intelligent Systems (MLIS), and by the European Union (ERC, GENERALIZATION, 101039692). Views and opinions expressed + +are however those of the author(s) only and do not necessarily reflect those of the European Union or the European Research Council Executive Agency. Neither the European Union nor the granting authority can be held responsible for them. The work of Ron Meir is partially supported by ISF grant 1693/22, by the Ollendorff Center of the Viterbi ECE Faculty at the Technion, and by the Skillman chair in biomedical sciences. + +# References + +Alquier, P. (2021). User-friendly introduction to PAC-Bayes bounds. arXiv preprint arXiv:2110.11216. +Alquier, P., & Guedj, B. (2018). Simpler PAC-Bayesian bounds for hostile data. *Machine Learning*, 107(5), 887-902. +Aminian, G., Bu, Y., Wornell, G., & Rodrigues, M. (2022). Tighter expected generalization error bounds via convexity of information measures. arXiv preprint arXiv:2202.12150. +Amit, R., & Meir, R. (2018). Meta-learning by adjusting priors based on extended PAC-Bayes theory. In International conference on machine learning (ICML) (pp. 205-214). +Anthony, M., & Bartlett, P. L. (1999). Neural network learning: Theoretical foundations (Vol. 9). Cambridge university press Cambridge. +Arjovsky, M., Chintala, S., & Bottou, L. (2017). Wasserstein generative adversarial networks. In International conference on machine learning (ICML) (pp. 214-223). +Audibert, J.-Y., & Bousquet, O. (2003). PAC-Bayesian generic chaining. In S. Thrun, L. Saul, & B. Schölkopf (Eds.), Advances in neural information processing systems (NeurIPS) (Vol. 16). MIT Press. +Audibert, J.-Y., & Bousquet, O. (2007). Combining PAC-Bayesian and generic chaining bounds. Journal of Machine Learning Research, 8(4). +Bachmann, G., Moosavi-Dezfooli, S.-M., & Hofmann, T. (2021). Uniform convergence, adversarial spheres and a simple remedy. In International conference on machine learning (ICML) (pp. 490-499). +Bartlett, P. L., Bousquet, O., & Mendelson, S. (2005). Local Rademacher complexities. The Annals of Statistics, 33(4), 1497-1537. +Bastani, H., Simchi-Levi, D., & Zhu, R. (2021). Meta dynamic pricing: Transfer learning across experiments. Management Science. +Begin, L., Germain, P., Laviolette, F., & Roy, J.-F. (2016). PAC-Bayesian bounds based on the rényi divergence. Proceedings of the 19th International Conference on Artificial Intelligence and Statistics (AISTATS). +Boucheron, S., Bousquet, O., & Lugosi, G. (2005). Theory of classification: A survey of some recent advances. *ESAIM: probability and statistics*, 9, 323-375. +Bousquet, O., & Elisseeff, A. (2002). Stability and generalization. The Journal of Machine Learning Research, 2, 499-526. +Catoni, O. (2007). PAC-Bayesian supervised classification: the thermodynamics of statistical learning. arXiv preprint arXiv:0712.0248. +Chee, A., & Loustau, S. (2021). Learning with BOT - Bregman and Optimal Transport divergences. hal-03262687v2. +Chuang, C.-Y., Mroueh, Y., Greenewald, K., Torralba, A., & Jegelka, S. (2021). Measuring generalization with optimal transport. Advances in Neural Information Processing Systems, 34, 8294-8306. +Clement, P., & Desch, W. (2008). An elementary proof of the triangle inequality for the Wasserstein metric. Proceedings of the American Mathematical Society, 136(1), 333-339. +Cuturi, M. (2013). Sinkhorn distances: Lightspeed computation of optimal transport. Advances in neural information processing systems (NeurIPS, 26. +Dembo, A., & Zeitouni, O. (2009). Ldp for finite dimensional spaces. In Large deviations techniques and applications (pp. 11-70). Springer. +Donsker, M. D., & Varadhan, S. R. S. (1975). Asymptotic evaluation of certain markov process expectations for large time. Comm. Pure Appl. Math.. +Dziugaite, G. K., & Roy, D. M. (2017). Computing nonvacuous generalization bounds for deep (stochastic) neural networks with many more parameters than training data. In Conference on uncertainty in artificial intelligence, (UAI). +Givens, C. R., & Shortt, R. M. (1984). A class of Wasserstein metrics for probability distributions. + +Michigan Mathematical Journal, 31(2), 231-240. +Guedj, B. (2019). A primer on PAC-Bayesian learning. arXiv preprint arXiv:1901.05353. +Hou, S., Kassraie, P., Kratsios, A., Rothfuss, J., & Krause, A. (2022). Instance-dependent generalization bounds via optimal transport. arXiv preprint arXiv:2211.01258. +Hsu, D., Kakade, S., & Zhang, T. (2012). A tail inequality for quadratic forms of subgaussian random vectors. Electronic Communications in Probability, 17, 1-6. +Jiang, Y., Neyshabur, B., Mobahi, H., Krishnan, D., & Bengio, S. (2019). Fantastic generalization measures and where to find them. arXiv preprint arXiv:1912.02178. +Kingma, D., & Ba, J. (2015). Adam: A method for stochastic optimization. In International conference on learning representations (ICLR). +Kingma, D. P., & Welling, M. (2013). Auto-encoding variational Bayes. In International conference on learning representations (ICLR). +Koltchinskii, V., & Panchenko, D. (2004). Rademacher processes and bounding the risk of function learning. arXiv preprint math/0405338. +Lever, G., Laviolette, F., & Shawe-Taylor, J. (2013). Tighter PAC-Bayes bounds through distribution-dependent priors. Theor. Comput. Sci., 473(Feb), 4-28. +Livni, R., & Moran, S. (2020). A limitation of the PAC-Bayes framework. Advances in Neural Information Processing Systems (NeurIPS), 33, 20543-20553. +Lopez, A. T., & Jog, V. (2018). Generalization error bounds using wasserstein distances. In 2018 IEEE information theory workshop (ITW) (pp. 1-5). +Lugosi, G. (2002). Pattern classification and learning theory. In *Principles of nonparametric learning* (pp. 1-56). Springer. +Mardia, J., Jiao, J., Tanczos, E., Nowak, R. D., & Weissman, T. (2019, 11). Concentration inequalities for the empirical distribution of discrete distributions: beyond the method of types. Information and Inference: A Journal of the IMA, 9(4), 813-850. +Maurer, A. (2004). A note on the PAC Bayesian theorem. CoRR abs/cs/0411099. +McAllester, D. (1998). Some PAC-Bayesian theorems. Conference on Learning Theory (COLT). +McAllester, D. (2003). Simplified PAC-Bayesian margin bounds. Conference on Learning Theory (COLT). +Miyaguchi, K. (2019). PAC-Bayesian transportation bound. arXiv preprint arXiv:1905.13435. +Müller, A. (1997). Stochastic orders generated by integrals: a unified study. Advances in Applied probability, 29(2), 414-428. +Nagarajan, V., & Kolter, J. Z. (2019a). Deterministic PAC-Bayesian generalization bounds for deep networks via generalizing noise-resilience. arXiv preprint arXiv:1905.13344. +Nagarajan, V., & Kolter, J. Z. (2019b). Uniform convergence may be unable to explain generalization in deep learning. Advances in Neural Information Processing Systems (NeurIPS), 32. +Neu, G., & Lugosi, G. (2022). Generalization bounds via convex analysis. arXiv preprint arXiv:2202.04985. +Neyshabur, B., Bhojanapalli, S., McAllester, D., & Srebro, N. (2017). Exploring generalization in deep learning. Advances in Neural Information Processing Systems (NeurIPS), 30. +Neyshabur, B., Tomioka, R., & Srebro, N. (2015). Norm-based capacity control in neural networks. In Conference on learning theory (pp. 1376-1401). +Ohnishi, Y., & Honorio, J. (2021). Novel change of measure inequalities with applications to PAC-Bayesian bounds and monte carlo estimation. In International conference on artificial intelligence and statistics (pp. 1711-1719). +Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., ... others (2019). Pytorch: An imperative style, high-performance deep learning library. Advances in Neural Information Processing Systems (NeurIPS), 32. +Picard-Weibel, A., & Guedj, B. (2022). On change of measure inequalities for $f$ -divergences. arXiv preprint arXiv:2202.05568. +Rivasplata, O., Kuzborskij, I., Szepesvari, C., & Shawe-Taylor, J. (2020). PAC-Bayes analysis beyond the usual bounds. Advances in Neural Information Processing Systems (NeurIPS), 33, 16833-16845. +Rodriguez Galvez, B., Bassi, G., Thobaben, R., & Skoglund, M. (2021). Tighter expected generalization error bounds via Wasserstein distance. Advances in Neural Information Processing Systems (NeurIPS), 34. +Seeger, M. (2002). PAC-Bayesian generalisation bounds for gaussian processes. Journal of Machine Learning Research, 3:233-269. +Seldin, Y., & Tishby, N. (2010). PAC-Bayesian analysis of co-clustering and beyond. JMLR 2010. + +Shalev-Shwartz, S., & Ben-David, S. (2014). Understanding machine learning: From theory to algorithms. Cambridge University Press. +Shawe-Taylor, J., & Williamson, R. C. (1997). A PAC analysis of a Bayesian estimator. Proceedings of the International Conference on Computational Learning Theory (COLT). +Sriperumbudur, B. K., Fukumizu, K., Gretton, A., Scholkopf, B., & Lanckriet, G. R. (2009). On integral probability metrics, $\phi$ -divergences and binary classification. arXiv preprint arXiv:0901.2698. +Sriperumbudur, B. K., Fukumizu, K., Gretton, A., Scholkopf, B., & Lanckriet, G. R. (2012). On the empirical estimation of integral probability metrics. *Electronic Journal of Statistics*, 6, 1550–1599. +Talagrand, M. (1994). Sharper bounds for gaussian and empirical processes. The Annals of Probability, 28-76. +Thorpe, M. (2018). Introduction to optimal transport. Notes of Course at University of Cambridge.. +Vapnik, V. (1999). The nature of statistical learning theory. Springer science & business media. +Vapnik, V., & Chervonenkis, A. Y. (2015). On the uniform convergence of relative frequencies of events to their probabilities. In *Measures of complexity* (pp. 11-30). Springer. +Villani, C. (2006). Optimal transport: old and new. Springer Science and Business Media. +Wainwright, M. J. (2019). High-dimensional statistics: A non-asymptotic viewpoint (Vol. 48). Cambridge University Press. +Wang, H., Diaz, M., Santos Filho, J. C. S., & Calmon, F. P. (2019). An information-theoretic view of generalization via Wasserstein distance. In 2019 IEEE international symposium on information theory (ISIT) (pp. 577-581). +Weed, J., & Bach, F. (2017). Sharp asymptotic and finite-sample rates of convergence of empirical measures in Wasserstein distance. Bernoulli 25 (4A), 2620-2648. +Wei, C., & Ma, T. (2019). Data-dependent sample complexity of deep neural networks via lipschitz augmentation. arXiv preprint arXiv:1905.03684. +Xu, H., & Mannor, S. (2012). Robustness and generalization. Machine learning, 86(3), 391-423. +Yang, J., Sun, S., & Roy, D. M. (2019). Fast-rate PAC-Bayes generalization bounds via shifted Rademacher processes. arXiv preprint arXiv:1908.07585. +Zhang, C., Bengio, S., Hardt, M., Recht, B., & Vinyals, O. (2017). Understanding deep learning requires rethinking generalization. International Conference on Learning Representations (ICLR). +Zhang, J., Liu, T., & Tao, D. (2021). An optimal transport analysis on generalization in deep learning. IEEE Transactions on Neural Networks and Learning Systems. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] +(c) Did you discuss any potential negative societal impacts of your work? [N/A] +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] +(b) Did you include complete proofs of all theoretical results? [Yes] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [N/A] + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [N/A] +(b) Did you mention the license of the assets? [N/A] +(c) Did you include any new assets either in the supplemental material or as a URL? [N/A] + +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/integralprobabilitymetricspacbayesbounds/images.zip b/integralprobabilitymetricspacbayesbounds/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..e1875ee459c30779f42712d3b9c6a920d66823c7 --- /dev/null +++ b/integralprobabilitymetricspacbayesbounds/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ae540d789f517ce23ebde8d8ba3ded8c31cc2dbc36e6ad5cccfe3f73d0dd68ad +size 250463 diff --git a/integralprobabilitymetricspacbayesbounds/layout.json b/integralprobabilitymetricspacbayesbounds/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..31920da5064b947858d560233cf8ec1f8436c69d --- /dev/null +++ b/integralprobabilitymetricspacbayesbounds/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:80d12cb9032b334f3ed8bb149e1ceb300d429485caf9b20a23912bf1b98c937c +size 599529 diff --git a/interactiongroundedlearningwithactioninclusivefeedback/787653b4-a663-446f-9fe0-af76b1a9afaf_content_list.json b/interactiongroundedlearningwithactioninclusivefeedback/787653b4-a663-446f-9fe0-af76b1a9afaf_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..373aff1afabe4799f53333eff6cb01a0909f4b76 --- /dev/null +++ b/interactiongroundedlearningwithactioninclusivefeedback/787653b4-a663-446f-9fe0-af76b1a9afaf_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:387aed4269a981a673ce82021f81f07de08aa959633ddb88ec4d6f018f497b36 +size 89857 diff --git a/interactiongroundedlearningwithactioninclusivefeedback/787653b4-a663-446f-9fe0-af76b1a9afaf_model.json b/interactiongroundedlearningwithactioninclusivefeedback/787653b4-a663-446f-9fe0-af76b1a9afaf_model.json new file mode 100644 index 0000000000000000000000000000000000000000..216e84fe0eb7deba6a9d3e4b422dbc5447541b66 --- /dev/null +++ b/interactiongroundedlearningwithactioninclusivefeedback/787653b4-a663-446f-9fe0-af76b1a9afaf_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:99e92432537b4881834445faacf0cd1d755b659b795ad25be714f55d2138d89e +size 111675 diff --git a/interactiongroundedlearningwithactioninclusivefeedback/787653b4-a663-446f-9fe0-af76b1a9afaf_origin.pdf b/interactiongroundedlearningwithactioninclusivefeedback/787653b4-a663-446f-9fe0-af76b1a9afaf_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..8b9b0b88ffaf5a069871639b37a5ab86c89456fe --- /dev/null +++ b/interactiongroundedlearningwithactioninclusivefeedback/787653b4-a663-446f-9fe0-af76b1a9afaf_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:532afda4949d8b93bbe3e36354cd861a4e19ee33a904934099124f8870a8a1d4 +size 3114679 diff --git a/interactiongroundedlearningwithactioninclusivefeedback/full.md b/interactiongroundedlearningwithactioninclusivefeedback/full.md new file mode 100644 index 0000000000000000000000000000000000000000..342f1752bc7d8290ef31e31b2af962965d4efcd8 --- /dev/null +++ b/interactiongroundedlearningwithactioninclusivefeedback/full.md @@ -0,0 +1,375 @@ +# Interaction-Grounded Learning with Action-Inclusive Feedback + +Tengyang Xie* + +UIUC + +tx10@illinois.edu + +Akanksha Saran* + +Microsoft Research, NYC + +akanksha.saran@microsoft.com + +Dylan J. Foster + +Microsoft Research, New England + +dylanfoster@microsoft.com + +Lekan Molu + +Microsoft Research, NYC + +lekanmolu@microsoft.com + +Ida Momennejad + +Microsoft Research, NYC + +idamo@microsoft.com + +Nan Jiang + +UIUC + +nanjiang@illinois.edu + +Paul Mineiro + +Microsoft Research, NYC + +pmineiro@microsoft.com + +John Langford + +Microsoft Research, NYC + +jcl@microsoft.com + +# Abstract + +Consider the problem setting of Interaction-Grounded Learning (IGL), in which a learner's goal is to optimally interact with the environment with no explicit reward to ground its policies. The agent observes a context vector, takes an action, and receives a feedback vector—using this information to effectively optimize a policy with respect to a latent reward function. Prior analyzed approaches fail when the feedback vector contains the action, which significantly limits IGL's success in many potential scenarios such as Brain-computer interface (BCI) or Human-computer interface (HCI) applications. We address this by creating an algorithm and analysis which allows IGL to work even when the feedback vector contains the action, encoded in any fashion. We provide theoretical guarantees and large-scale experiments based on supervised datasets to demonstrate the effectiveness of the new approach. + +# 1 Introduction + +Most real-world learning problems, such as BCI and HCI problems, are not tagged with rewards. Consequently, (biological and artificial) learners must infer rewards based on interactions with the environment, which reacts to the learner's actions by generating feedback, but does not provide any explicit reward signal. This paradigm has been previously studied by researchers [e.g., Grizou et al., 2014; Nguyen et al., 2021], including a recent formalization [Xie et al., 2021b] that proposed the term Interaction-Grounded Learning (IGL). + +In IGL, the learning algorithm discovers a grounding for the feedback which implicitly discovers a reward function. An information-theoretic impossibility argument indicates additional assumptions are necessary to succeed. Xie et al. [2021b] proceed by assuming the action is conditionally independent of the feedback given the reward. However, this is unnatural in many settings such as neurofeedback in BCI [Katyal et al., 2014; Mishra and Gazzaley, 2015; Debettencourt et al., 2015; Muñoz-Moldes and Cleeremans, 2020; Akinola et al., 2020; Poole and Lee, 2021; Xu et al., 2021] and multimodal interactive feedback in HCI [Pantic and Rothkrantz, 2003; Vitense et al., 2003; Freeman et al., 2017; Mott et al., 2017; Duchowski, 2018; Saran et al., 2018, 2020; Zhang et al., + +![](images/b88df504fb819840aedde5f0025a6662bd71b5ae441a9115fcfea5a0194680fd.jpg) +Figure 1: A simulated BCI interaction experiment for a number-guessing task. The human imagines a number, which the agent has to identify through their fMRI signals. The agent displays the number it identifies. The human perceives this number (action) and judges whether it is a match or not (reward)—the mixing of these two activities creates a complex feedback signal, which the learning agent has to decode through the interaction. + +2020; Cui et al., 2021; Gao et al., 2021] where the action proceeds and thus influences the feedback. For example, if the feedback is an fMRI recording from a human brain implant in the parietal cortex, and the action of the algorithm is to display a number being imagined by the human (Fig. 1), the parietal cortex feedback will contain information about both perceiving the number being displayed (action) and human's reaction to it for match or mismatch (reward). Another example is determining if a patient in a coma is happy or not, and using their brain signals (feedback) to dissociate the fact that they were asked about being happy (action) and the actual thought that they are happy (reward). An HCI example is a self-calibrating eye tracker used for typing on a screen by an ALS patient [Mott et al., 2017; Gao et al., 2021], where the automated agent calibrates the eye gaze to a certain point on a screen (action) and the human's gaze patterns (feedback) convey a response to the tracker's offset (action) as well as their satisfaction for being able to type a certain key (reward). If you apply the prior IGL approach to such settings, it will fail catastrophically because the requirement of conditional independence is essential to its function. This motivates the question: + +# Is it possible to do interaction-ground learning when the feedback has the full information of the action embedded in it? + +We propose a new approach to solve IGL, which we call action-inclusive IGL (AI-IGL), that allows the action to be incorporated into the feedback in arbitrary ways. We consider latent reward as playing the role of latent states, which can be further separated via a contrastive learning method (Section 3.1). Different from the typical latent state discovery in rich-observation reinforcement learning [e.g., Dann et al., 2018; Du et al., 2019; Misra et al., 2020], the IGL setting also requires identifying the semantic meaning of the latent reward states, which is addressed by a symmetry breaking procedure (Section 3.2). We analyze the theoretical properties of the proposed approach, and we prove that it is guaranteed to learn a near-optimal policy as long as the feedback satisfies a weaker context conditional independence assumption. We also empirically evaluate the proposed AI-IGL approach using large-scale experiments on Open-ML's supervised classification datasets [Bischl et al., 2021], as well as a simulated BCI experiment using real human fMRI data [Ellis et al., 2020], demonstrating the effectiveness of the proposed approach (Section 5). Thus, our findings broaden the scope of applicability for IGL. + +The paper proceeds as follows. In Section 2, we present the mathematical formulation for IGL. In Section 3, we present a contrastive learning perspective for grounding latent reward which helps to expand the applicability of IGL. In Section 4, we state the resulting algorithm AI-IGL. We provide experimental support for the technique in Section 5 using a diverse set of supervised learning datasets and a simulated BCI dataset. We conclude with discussion in Section 6. + +# 2 Background + +Interaction-Grounded Learning This paper studies the Interaction-Grounded Learning (IGL) setting [Xie et al., 2021b], where the learner optimizes for a latent reward by interacting with the + +environment and associating ("grounding") observed feedback with the latent reward. At each time step, the learner receives an i.i.d. context $x$ from context set $\mathcal{X}$ and distribution $d_0$ . The learner then selects an action $a \in \mathcal{A}$ from a finite action set $|\mathcal{A}| = K$ . The environment generates a latent binary reward $r \in \{0,1\}$ (can be either deterministic or stochastic) and a feedback vector $y \in \mathcal{Y}$ conditional on $(x,a)$ , but only the feedback vector $y$ is revealed to the learner. In this paper, we use $R(x,a) \coloneqq \mathbb{E}_{x,a}[r]$ to denote the expected (latent) reward after executing action $a$ on context $x$ . The space of context $\mathcal{X}$ and feedback vector $\mathcal{Y}$ can be arbitrarily large. + +Throughout this paper, we use $\pi \in \Pi : \mathcal{X} \to \Delta(\mathcal{A})$ to denote a (stochastic) policy. The expected return of policy $\pi$ is defined by $V(\pi) = \mathbb{E}_{(x,a) \sim d_0 \times \pi}[r]$ . The learning goal of IGL is to find the optimal policy in the policy class, $\pi^{\star} = \operatorname{argmax}_{\pi \in \Pi} V(\pi)$ , only from the observations of context-action-feedback tuples, $(x,a,y)$ . This paper mainly considers the batch setting, and we use $\mu$ to denote the behavior policy. In this paper, we also introduce value function classes and decoder classes. We assume the learner has access to a value function class $\mathcal{F}$ where $f \in \mathcal{F}: \mathcal{X} \times \mathcal{A} \to [0,1]$ and reward decoder class $\psi \in \Psi: \mathcal{Y} \times \mathcal{A} \to [0,1]$ . We defer the assumptions we made on these classes to Section 3 for clarity. + +We may hope to solve IGL without any additional assumptions. However, it is information-theoretically impossible without additional assumptions, even if the latent reward is decodable from $(x,a,y)$ , as demonstrated by the following example. + +Example 1 (Hardness of assumption-free IGL). Suppose $y = (x, a)$ and suppose the reward is deterministic in $(x, a)$ . In this case, the latent reward $r$ can be perfectly decoded from $y$ . However, the learner receives no more information than $(x, a)$ from the $(x, a, y)$ tuple. Thus if $\Pi$ contains at least 2 policies, for any environment where any IGL algorithm succeeds, we can construct another environment with the same observable statistics where that algorithm must fail. + +IGL with full conditional independence Example 1 demonstrates the need for further assumptions to succeed at IGL. Xie et al. [2021b] proposed an algorithm that leverages the following conditional independence assumption to facilitate grounding the feedback in the latent reward. + +Assumption 1 (Full conditional independence). For arbitrary $(x, a, r, y)$ tuples where $r$ and $y$ are generated conditional on the context $x$ and action $a$ , we assume the feedback vector $y$ is conditionally independent of context $x$ and action $a$ given the latent reward $r$ , i.e. $x, a \perp y|r$ . + +Xie et al. [2021b] introduce a reward decoder class $\psi \in \Psi : \mathcal{Y} \to [0, 1]$ for estimating $\mathbb{E}[r|y]$ , which leads to the decoded return $V(\pi, \psi) \coloneqq \mathbb{E}_{(x,a) \sim d_0 \times \pi}[\psi(y)]$ . They proved that it is possible to learn the best $\pi$ and $\psi$ jointly by optimizing the following proxy learning objective: + +$$ +\underset {(\pi , \psi) \in \Pi \times \Psi} {\operatorname {a r g m a x}} \mathcal {J} (\pi , \psi) := V (\pi , \psi) - V \left(\pi_ {\text {b a s e}}, \psi\right), \tag {1} +$$ + +where $\pi_{\mathrm{base}}$ is a policy known to have low expected return. Over this paper, we use IGL (full CI) to denote the proposed algorithm of Xie et al. [2021b]. + +# 3 A Contrastive-learning Perspective for Grounding Latent Reward + +The existing work of interaction-grounded learning leverages the assumption of full conditional independence (Assumption 1), where the feedback vector only contains information from the latent reward. The goal of this paper is to relax these constraining assumptions and broaden the scope of applicability for IGL. This paper focuses on the scenario where the action information is possibly embedded in the feedback vector, which is formalized by the following assumption. + +Assumption 2 (Context Conditional Independence). For arbitrary $(x, a, r, y)$ tuple where $r$ and $y$ are generated conditional on the context $x$ and action $a$ , we assume the feedback vector $y$ is conditionally independent of context $x$ given the latent reward $r$ and action $a$ . That is, $x \perp y | a, r$ . + +Assumption 2 allows the feedback vector $y$ to be generated from both latent reward $r$ and action $a$ , differing from Assumption 1 which constrains the feedback vector $y$ to be generated based only on the latent reward $r$ . We discuss the implications at the end of this section. + +# 3.1 Grounding Latent Reward via Contrastive Learning + +In this section, we propose a contrastive learning objective for interaction-grounded learning, which further guides the design of our algorithm. We perform derivations with exact expectations for clarity and intuitions and provide finite-sample guarantees in Section 4. + +Assumption 3 (Separability). For each $\bar{a} \in \mathcal{A}$ , there exists an $(f_{\bar{a}}^{\star}, \psi_{\bar{a}}^{\star}) \in \mathcal{F} \times \Psi$ such that: 1) $\mathbb{E}[\psi_{\bar{a}}^{\star}(y, \bar{a}) | \bar{a}, r = 1] - \mathbb{E}[\psi_{\bar{a}}^{\star}(y, \bar{a}) | \bar{a}, r = 0] = 1$ ; 2) $|\mathbb{E}_{\mu}[f_{\bar{a}}^{\star}(x, \bar{a}) | \bar{a}, r = 1] - \mathbb{E}_{\mu}[f_{\bar{a}}^{\star}(x, \bar{a}) | \bar{a}, r = 0] | \geq \Delta_{\mathcal{F}}$ . We also assume $1 - \Psi \subseteq \Psi$ , where $1 - \Psi := \{1 - \psi(\cdot, \cdot): \psi \in \Psi\}$ . + +Assumption 3 consists of two components. For $\Psi$ , it is a realizability assumption that ensures that a perfect reward decoder is included in the function classes. Although this superficially appears unreasonably strong, note $y$ is generated based upon $a$ and the realization of $r$ ; therefore this is compatible with stochastic rewards. For $\mathcal{F}$ , it ensures the expected predicted reward conditioned on the latent reward, having value $r \in \{0,1\}$ and the action being $a$ , is separable. When $\mu = \pi_{\mathrm{unif}}$ , $\Delta_{\mathcal{F}}$ can be lower bounded by $\max_{f \in \mathcal{F}} 4|\operatorname{Cov}_{\pi_{\bar{a}}} (f,R)|$ ( $\pi_{\bar{a}}$ denotes the constant policy with action $\bar{a}$ ). Detailed proof of this argument can be found in Appendix A. One sufficient condition is that the expected latent reward $R(\cdot,\bar{a})$ has enough variance and $R \in \mathcal{F}$ . The condition of $1 - \Psi \subseteq \Psi$ can be constructed easily via standard realizable classes. That is, if $\psi_{\bar{a}}^{\star} \in \Psi'$ for some classes $\Psi'$ , simply setting $\Psi \gets \Psi' \bigcup (1 - \Psi')$ satisfies Assumption 3. Note that, this construction of $\Psi$ only amplifies the size of $\Psi'$ by a factor of 2. + +Reward Prediction via Contrastive Learning We now formulate the following contrastive-learning objective for solving IGL. Suppose $\mu(a|x)$ is the behavior policy. We also abuse $\mu(x,a,y)$ to denote the data distribution, and $\mu_a(x,y), \mu_a(x), \mu_a(y)$ to denote the marginal distribution under action $a \in \mathcal{A}$ . We construct an augmented data distribution for each $a \in \mathcal{A}$ : $\widetilde{\mu}_a(x,y) \coloneqq \mu_a(x) \cdot \mu_a(y)$ (i.e., sampling $x$ and $y$ independently from $\mu_a$ ). + +Conceptually, for each action $a \in \mathcal{A}$ , we consider tuples $(x,y) \sim \mu_a(x,y)$ and $(\widetilde{x},\widetilde{y}) \sim \widetilde{\mu}_a(x,y)$ . From Assumption 3, conditioned on $(x,a)$ the optimal feedback decoder $\psi^*(y,a)$ has mean equal to the optimal reward predictor $f^*(x,a)$ . Therefore we might seek an $(f,\psi)$ pair which minimizes any consistent loss function, e.g., squared loss. However this is trivially achievable, e.g., by having both always predict 0. Therefore we formulate a contrastive-learning objective, where we maximize the loss between the predictor and decoder on the augmented data distribution. For each $a \in \mathcal{A}$ , we solve the following objective + +$$ +\underset {\left(f _ {a}, \psi_ {a}\right) \in \mathcal {F} \times \Psi} {\operatorname {a r g m i n}} \mathcal {L} _ {a} \left(f _ {a}, \psi_ {a}\right) := \mathbb {E} _ {\mu_ {a}} \left[ \left(f _ {a} (x, a) - \psi_ {a} (y, a)\right) ^ {2} \right] - \mathbb {E} _ {\widetilde {\mu} _ {a}} \left[ \left(f _ {a} (\widetilde {x}, a) - \psi_ {a} (\widetilde {y}, a)\right) ^ {2} \right]. \tag {2} +$$ + +In the notation of equation (2), the $a$ subscript indicates the $(f_a, \psi_a)$ pair are optimal for action $a$ . Note they are always evaluated at $a$ , which we retain as an input for compatibility with the original function classes. + +Note that $\mathcal{L}$ is also similar to many popular contrastive losses [e.g., Wu et al., 2018; Chen et al., 2020] especially for the spectral contrastive loss [HaoChen et al., 2021]. + +$$ +\begin{array}{l} \mathcal {L} _ {a} \left(f _ {a}, \psi_ {a}\right) = \mathbb {E} _ {\mu_ {a}} \left[ f _ {a} (x, a) ^ {2} - 2 f _ {a} (x, a) \psi_ {a} (y, a) + \psi_ {a} (y, a) ^ {2} \right] \\ - \mathbb {E} _ {\widetilde {\mu} _ {a}} \left[ f _ {a} (x, a) ^ {2} - 2 f _ {a} (x, a) \psi_ {a} (y, a) + \psi_ {a} (y, a) ^ {2} \right] \\ = - 2 \left(\mathbb {E} _ {\mu_ {a}} [ f _ {a} (x, a) \psi_ {a} (y, a) ] - \mathbb {E} _ {\tilde {\mu} _ {a}} [ f _ {a} (x, a) \psi_ {a} (y, a) ]\right) (\text {s p e c t r a l c o n t r a s t i v e l o s s}) \\ = - 2 \left(\mathbb {E} _ {\mu_ {a}} [ f _ {a} (x, a) \psi_ {a} (y, a) ] - \mathbb {E} _ {\mu_ {a}} [ f _ {a} (x, a) ] \mathbb {E} _ {\mu_ {a}} [ \psi_ {a} (y, a) ]\right). \\ \left(\tilde {\mu} _ {a} (x, y) = \mu_ {a} (x) \cdot \mu_ {a} (y)\right) \\ \end{array} +$$ + +Below we show that minimizing $\mathcal{L}_a(f_a,\psi_a)$ decodes the latent reward under Assumptions 2 and 3 up to a sign ambiguity. For simplicity, we introduce the notation of $f_{a,r}$ and $\psi_{a,r}$ for any $(f,\psi)\in \mathcal{F}\times \Psi$ + +$$ +f _ {a, r} := \sum_ {x} \Pr (x | a, r) f (x, a), \quad \psi_ {a, r} := \sum_ {y} \Pr (y | a, r) \psi (y, a). \tag {3} +$$ + +$f_{a,r}$ and $\psi_{a,r}$ are the expected predicted reward of $f(x,a)$ and decoded reward $\psi (y,a)$ (under the behavior policy $\mu$ for $f_{a,r}$ ) conditioned on the latent reward having value $r$ and the action being $a$ . + +Proposition 1. For any action $a \in \mathcal{A}$ , if $\mu(a|x) > 0$ for all $x \in \mathcal{X}$ and Assumption 2 and 3 hold, and let $(\widehat{f}_a, \widehat{\psi}_a)$ be the solution of Eq.(2). Then, $|\widehat{f}_{a,1} - \widehat{f}_{a,0}| = \max_{f \in \mathcal{F}} |f_{a,1} - f_{a,0}|$ and $|\widehat{\psi}_{a,1} - \widehat{\psi}_{a,0}| = \max_{\psi \in \Psi} |\psi_{a,1} - \psi_{a,0}|$ . + +Proof Sketch. For any policy $\pi$ , we use $d_a^\pi \coloneqq \sum_x d_0(x)\pi(a|x)$ to denote the visitation occupancy of action $a$ under policy $\pi$ , and $\rho_a^\pi \coloneqq 1 / d_a^\pi \sum_x d_0(x)\pi(a|x)R(x,a)$ to denote the average reward received under executing action $a$ . Then, by the context conditional independent assumption $x \perp y|r$ , $a$ (Assumption 2), we know + +$$ +\begin{array}{l} \mathbb {E} _ {\mu_ {a}} [ f (x) \psi (y) ] = (1 - \rho_ {a} ^ {\mu}) f _ {a, 0} \psi_ {a, 0} + \rho_ {a} ^ {\mu} f _ {a, 1} \psi_ {a, 1} \\ \mathbb {E} _ {\mu_ {a}} [ f (x) ] \mathbb {E} _ {\mu_ {a}} [ \psi (y) ] = (1 - \rho_ {a} ^ {\mu}) ^ {2} f _ {a, 0} \psi_ {a, 0} + (\rho_ {a} ^ {\mu}) ^ {2} f _ {a, 1} \psi_ {a, 1} + (1 - \rho_ {a} ^ {\mu}) \rho_ {a} ^ {\mu} (f _ {a, 0} \psi_ {a, 1} + f _ {a, 1} \psi_ {a, 0}) \\ \Longrightarrow \mathcal {L} _ {a} \left(f _ {a}, \psi_ {a}\right) \propto - \left(f _ {a, 1} - f _ {a, 0}\right) \left(\psi_ {a, 1} - \psi_ {a, 0}\right). \\ \end{array} +$$ + +Therefore, separately maximizing $|f_{a,1} - f_{a,0}|$ and $|\psi_{a,1} - \psi_{a,0}|$ maximizes $\mathcal{L}_a(f_a,\psi_a)$ . + +![](images/d0ce4cd78e8778565207d63435b58679eba37701204c88c5806a53d763cd8bb0.jpg) + +# 3.2 Symmetry Breaking + +In the last section, we demonstrated that the latent reward could be decoded in a contrastive-learning manner up to a sign ambiguity. The following example demonstrates the ambiguity. + +Example 2 (Why do we need extra information to identify the latent reward?). In the optimal solution of objective Eq.(2), both $\widehat{\psi}_a$ and $\widehat{\psi}_a^\prime \coloneqq 1 - \widehat{\psi}_a$ yield the same value. It is information-theoretically difficult to distinguish which one of them is the correct solution without extra information. That is because, for any environment ENV1, there always exists a "symmetric" environment ENV2, where: 1) $R(x,a)$ of ENV1 is identical to $(1 - R(x,a))$ of ENV2 for all $(x,a)\in \mathcal{X}\times \mathcal{A}$ ; 2) the conditional distribution of $y|r$ , $a$ in ENV1 is identical to the conditional distribution of $y|1 - r$ , $a$ in the ENV2 for all $a\in \mathcal{A}$ . In this example, ENV1 and ENV2 will always generate the identical distribution of feedback vector $y$ after any $(x,a)\in \mathcal{X}\times \mathcal{A}$ . However, ENV1 and ENV2 have the exactly opposite latent reward information. + +As we demonstrate in Example 2, the learned decoder from Eq.(2) could be corresponding to a symmetric pair of semantic meanings, and identifying them without extra information is information-theoretically impossible. The symmetry breaking procedure is one of the key challenges of interaction-grounded learning. To achieve symmetry breaking, we make the following assumption to ensure the identifiability of the latent reward. + +Assumption 4 (Baseline Policies). For each $a \in \mathcal{A}$ , there exists a baseline policy $\pi_{\mathrm{base}}^a$ , such that, + +(a) $\pi_{\mathrm{base}}^a$ satisfies $\sum_x d_0(x)\pi (a|x)\geq c_m > 0.$ +(b) $\left| \frac{1}{2} - \rho_{a}^{\pi_{\mathrm{base}}^{a}} \right| \geq \eta$ , where $\rho_{a}^{\pi_{\mathrm{base}}^{a}} = \frac{\sum_{x} d_{0}(x)\pi_{\mathrm{base}}^{a}(a|x)R(x,a)}{\sum_{x} d_{0}(x)\pi_{\mathrm{base}}^{a}(a|x)}$ . + +To instantiate Assumption 4 in practice, we provide the following simple example of $\pi_{\mathrm{base}}$ that satisfies Assumption 4. Suppose $\pi_{\mathrm{base}} = \pi_{\mathrm{unif}}$ (uniformly random policy), and we have "all constant policies are bad", i.e., $V(\pi_{\bar{a}} = \mathbb{1}(a = \bar{a})) < 1/2 - \eta$ for all $\bar{a} \in \mathcal{A}$ . Then it is easy to verify that $c_m = 1/K$ and $\rho_{\bar{a}}^{\pi_{\mathrm{base}}} \leq 1/2 - \eta$ for all $\bar{a} \in \mathcal{A}$ . + +Note that $\pi_{\mathrm{base}}^a$ can be different over actions. Intuitively, Assumption 4(a) is saying that the total probability of $\pi_{\mathrm{base}}^a$ selecting action $a$ (over all context $x \in \mathcal{X}$ ) is at least $c_m$ . This condition ensures that $\pi_{\mathrm{base}}^a$ has enough visitation to action $a$ and makes symmetry breaking possible. Assumption 4(b) states that if we only consider the reward obtained from taking action $a$ , $\pi_{\mathrm{base}}^a$ is known to be either "sufficiently bad" or "sufficiently good". Note the directionality of the extremeness of $\pi_{\mathrm{base}}^a$ must be known, e.g., a policy which has a unknown reward of either 0 or 1 is not usable. This condition follows a similar intuition as the identifiability assumption of Xie et al. [2021b, Assumption 2] and breaks the symmetry. For example, consider the ENV1 and ENV2 introduced in Example 2, $\rho_{a,\mathrm{ENV1}}^\pi = 1 - \rho_{a,\mathrm{ENV2}}^\pi$ for any policy $\pi$ . To separating ENV1 and ENV2 using some policy $\pi$ , $\rho_{a,\mathrm{ENV1}}^\pi$ and $\rho_{a,\mathrm{ENV2}}^\pi$ require to have a non-zero gap, which leads to Assumption 4(b). + +The effectiveness of symmetry breaking under Assumption 4 can be summarized as below: we conduct the following estimation of $\rho_{a}^{\pi_{\mathrm{base}}}$ , using the learned $\widehat{\psi}_{a}$ , $\widehat{\rho}_{a}^{\pi_{\mathrm{base}}^{a}} = \frac{\sum_{x}d_{0}(x)\pi_{\mathrm{base}}^{a}(a|x)\widehat{\psi}_{a}(x,a)}{\sum_{x}d_{0}(x)\pi_{\mathrm{base}}^{a}(a|x)}$ . If $\widehat{\psi}_{a}$ can efficiently decode the latent reward, then $\widehat{\rho}_{a}^{\pi_{\mathrm{base}}^{a}}$ converges to either $\rho_{a}^{\pi_{\mathrm{base}}} \text{ or } 1 - \rho_{a}^{\pi_{\mathrm{base}}}$ . Therefore, applying Assumption 4(b) breaks the symmetry. + +Figure 2: Causal graphs of interaction-grounded learning under different assumptions as well as rich-observation reinforcement Learning. +![](images/c9a46b87ae2d429d309d7744d4e9db14f561b08b63e668dd08e1015a410dd757.jpg) +(a) Latent State in Rich-Observation RL [Misra et al., 2020] + +![](images/c6696d2977342a619348ae51694d17df126ce4d8090a2233cbc809cfac47e5d0.jpg) +(b) Latent Reward in IGL under Assumption 2 (this paper) + +![](images/1ff0d07e6a40e9ba0a447ae16c94f7bfa5ca65aef20d106a89494ea3c08bee3e.jpg) +(c) Latent Reward in IGL under Assumption 1 [Xie et al., 2021b] + +# 3.3 Comparison to Full CI + +When we have the context conditional independence, it is easy to verify the failure of optimizing the original IGL objective Eq.(1) by the following example. + +Example 3 (Failure of the original IGL objective under Assumption 2). Let $\mathcal{X} = \mathcal{A} = \{1,2,\dots ,10\}$ and feedback vector is generated by $y = (a + R(x,a))$ mod 10 (we use $\%$ to denote mod in the following part). We also assume $d_0(x) = \pi_{\mathrm{base}}(a|x) = 1 / 10$ for any $(x,a)\in \mathcal{X}\times \mathcal{A}$ and $R(x,a) = \pi^{\star}(a|x):= \mathbb{1}(x = a)$ . Then, we have, for any $\psi :\mathcal{V}\to [0,1]$ (approach proposed by Xie et al. [2021b] assumes the reward decoder only takes feedback vector $y$ as the input), + +$$ +\begin{array}{l} \mathcal {L} \left(\pi^ {\star}, \psi\right) = \frac {1}{1 0} \sum_ {x = 1} ^ {1 0} \sum_ {a = 1} ^ {1 0} \mathbb {1} (x = a) \psi ((a + 1) \% 1 0) - \frac {1}{1 0 0} \sum_ {x = 1} ^ {1 0} \sum_ {a = 1} ^ {1 0} \psi \left((a + \mathbb {1} (x = a)) \% 1 0\right) \\ = \frac {1}{1 0} \sum_ {a = 1} ^ {1 0} \psi (a) - \frac {1}{1 0} \sum_ {a = 1} ^ {1 0} \psi (a) = 0. \\ \end{array} +$$ + +On the other hand, consider the constant policy $\pi_1(a|x) \coloneqq \mathbb{1}(a = 1)$ for all $x \in \mathcal{X}$ and decoder $\psi_2(y) \coloneqq \mathbb{1}(y = 2)$ for all $y \in \mathcal{Y}$ , then, + +$$ +\begin{array}{l} \mathcal {L} \left(\pi_ {1}, \psi_ {2}\right) = \frac {1}{1 0} \sum_ {x = 1} ^ {1 0} \sum_ {a = 1} ^ {1 0} \mathbb {1} (a = 1) \psi_ {2} ((a + 1) \% 1 0) - \frac {1}{1 0 0} \sum_ {x = 1} ^ {1 0} \sum_ {a = 1} ^ {1 0} \psi_ {2} \left((a + \mathbb {1} (x = a)) \% 1 0\right) \\ = \psi_ {2} (2) - \frac {1}{1 0} \sum_ {a = 1} ^ {1 0} \psi_ {2} (a) = 0. 9 > \mathcal {L} (\pi^ {\star}, \psi), \forall \psi \in \Psi . \\ \end{array} +$$ + +This implies that maximizing the original IGL objective Eq.(1) could not always converge to $\pi^{\star}$ when we only have the context conditional independence. + +This example indicates optimizing a combined contrastive objective with a single symmetry-breaking policy is insufficient to succeed in our $x \perp y|r$ , $a$ case. Our current approach corresponds to optimizing a contrastive objective and breaking symmetry for each action separately rather than simultaneously. + +# 3.4 Viewing Latent Reward as a Latent State + +Our approach is motivated by latent state discovery in Rich-Observation RL [Misra et al., 2020]. Figure 2 compares the causal graphs of Rich-Observation RL, IGL with context conditional independence, and IGL with full conditional independence. In Rich-Observation RL, a contrastive learning objective is used to discover latent states; whereas in IGL a contrastive learning objective is used to discover latent rewards. In this manner we view latent rewards analogously to latent states. + +Identifying latent states up to a permutation is completely acceptable in Rich-Observations RL, as the resulting imputed MDP orders policies identically to the true MDP. However in IGL the latent states have scalar values associated with them (rewards), and identifying up to a permutation is not sufficient to order policies correctly. Thus, we require the additional step of symmetry breaking. + +# 4 Main Algorithm + +This section instantiates the algorithm for IGL with action-inclusive feedback, following the concept we introduced in Section 3. For simplicity, we select the uniformly random policy $\pi_{\mathrm{unif}}$ as behavior policy $\mu$ in this section. That choice of $\mu$ can be further relaxed using an appropriate importance weight. We first introduce the empirical estimation of $\mathcal{L}_a$ as follows ( $\mathcal{L}_a$ is defined in Eq.(2). $\mathcal{I}_{\bar{a},\mathcal{D}}$ + +estimates the spectral contrastive loss, which corresponds to $-\mathcal{L}_a)$ . For any $\bar{a} \in \mathcal{A}$ , we define the following empirical estimation of the spectral contrastive loss: + +$$ +\mathcal {J} _ {\bar {a}, \mathcal {D}} (f, \psi) = \mathbb {E} _ {\mathcal {D}} [ f (x, a) \psi (y, a) \mathbb {1} (a = \bar {a}) ] - \mathbb {E} _ {\mathcal {D}} [ f (x, a) \mathbb {1} (a = \bar {a}) ] \mathbb {E} _ {\mathcal {D}} [ \psi (y, a) \mathbb {1} (a = \bar {a}) ]. \tag {4} +$$ + +Using this definition, Algorithm 1 instantiates a version of the IGL algorithm with action-inclusive feedback. Without loss of generality, we also assume $\rho_{a}^{\pi_{\mathrm{base}}^{a}} \leq 1/2$ for Assumption 4(b) for all $a \in \mathcal{A}$ in this section. The case of $\rho_{a}^{\pi_{\mathrm{base}}^{a}} > 1/2$ for some action $a$ can be addressed by modifying the symmetry-breaking step properly in Algorithm 1. + +# Algorithm 1 Action-inclusive IGL (AI-IGL) + +Input: Batch data $\mathcal{D}$ generated by $\mu = \pi_{\mathrm{unif}}$ . baseline policy $\pi_{\mathrm{base}}^{a\in \mathcal{A}}$ . + +1: Initialize policy $\pi_1$ as the uniform policy. +2: for $\bar{a} \in \mathcal{A}$ do +3: Obtain $(f_{\bar{a}},\psi_{\bar{a}})$ by + +$\triangleright$ Latent State (Reward) Discovery + +$$ +\left(f _ {\bar {a}}, \psi_ {\bar {a}}\right) \leftarrow \underset {(f, \psi) \in \mathcal {F} \times \Psi} {\operatorname {a r g m a x}} \mathcal {J} _ {\bar {a}, \mathcal {D}} (f, \psi), \tag {5} +$$ + +where $\mathcal{J}_{\bar{a},D}(f,\psi)$ is defined in Eq.(4) + +4: Compute $\widehat{\varrho}_{\bar{a}}^{\pi_{\mathrm{base}}^{\bar{a}}}$ by $\widehat{\varrho}_{\bar{a}}^{\pi_{\mathrm{base}}^{\bar{a}}} = \frac{\sum_{(x,a,y)\in\mathcal{D}}\pi_{\mathrm{base}}^{\bar{a}}(a|x)\psi_{\bar{a}}(x,\bar{a})\mathbb{1}(a = \bar{a})}{\sum_{(x,a,y)\in\mathcal{D}}\pi_{\mathrm{base}}^{\bar{a}}(a|x)\mathbb{1}(a = \bar{a})}.$ ▷ Symmetry Breaking +5: if $\widehat{\varrho_{\bar{a}}^{\pi_{\mathrm{base}}}} > \frac{1}{2}$ then $\psi_{\bar{a}}^{\prime} \gets (1 - \psi_{\bar{a}})$ . +6: else $\psi_{\bar{a}}^{\prime}\gets \psi_{\bar{a}}$ +7: end if +8: end for +9: Generate decoded contextual bandits dataset $\mathcal{D}_{\mathrm{CB}} \gets \{(x, a, \psi_a'(y, a), \mu(a|x)): (x, a, y) \in \mathcal{D}\}$ . +0: Output policy $\widehat{\pi} (x)\gets \mathrm{CB}(\mathcal{D}_{\mathrm{CB}})$ , where CB denotes an offline contextual bandit oracle. + +At a high level, Algorithm 1 has two separate components, latent state (reward) discovery (line 3) and symmetry breaking (line 4-7), for each action in $\mathcal{A}$ . + +Theoretical guarantees In Algorithm 1, the output policy $\widehat{\pi}$ is obtained by calling an offline contextual bandits oracle (CB). We now formally define this oracle and its expected property. + +Definition 1 (Offline contextual bandits oracle). An algorithm CB is called an offline contextual bandit oracle if for any dataset $\mathcal{D} = \{(x_i, a_i, r_i, \mu(a_i | x_i))\}_{i=1}^{|\mathcal{D}|}$ ( $x_i \sim d_0, a_i \sim \mu$ , and $r_i$ is the reward determined by $(x_i, a_i)$ ) and any policy class $\Pi$ , the policy $\widehat{\pi}$ produced by CB( $\mathcal{D}$ ) satisfies $\varepsilon_{CB} := \max_{\pi \in \Pi} \mathbb{E}_{d_0 \times \pi}[r] - \mathbb{E}_{d_0 \times \widehat{\pi}}[r] \leq o(1)$ . + +The notion in Definition 1 corresponds to the standard policy learning approaches in the contextual bandits literature [e.g., Langford and Zhang, 2007; Dudik et al., 2011; Agarwal et al., 2014], and typically leads to $\varepsilon_{\mathsf{CB}} = \sqrt{K^{\log|\Pi| / \delta} / |\mathcal{D}|}$ . We now provide the theoretical analysis of Algorithm 1. In this paper, we use $d_{\mathcal{F},\Psi}$ to denote the joint statistical complexity of the class of $\mathcal{F}$ and $\Psi$ . For example, if the function classes are finite, we have $d_{\mathcal{F},\Psi} = \mathcal{O}(\log |F||\Psi| / \delta)$ , and $\delta$ is the failure probability. The infinite function classes can be addressed by some advanced methods such as covering number or Rademacher complexity [see, e.g., Mohri et al., 2018]. The following theorem provides the performance guarantee of the output policy of Algorithm 1. + +Theorem 2. Suppose Assumptions 2, 3 and 4 hold, $\Delta_{\mathcal{F}}$ is defined in Assumption 3, and $\widehat{\pi}$ be the output policy of Algorithm 1. If we have $|\mathcal{D}|\geq \mathcal{O}\left(\frac{K^3d_{\mathcal{F},\Psi}}{(\min\{\eta\Delta_{\mathcal{F}},Kc_m\})^2}\right)$ , then, with high probability, + +$$ +V (\pi^ {\star}) - V (\pi) \leq \mathcal {O} \left(\frac {1}{\Delta_ {\mathcal {F}}} \sqrt {\frac {K ^ {3} d _ {\mathcal {F} , \Psi}}{| \mathcal {D} |}}\right) + \varepsilon_ {\mathrm {C B}}. +$$ + +Similar to the performance of Xie et al. [2021b], the learner is guaranteed to converge in the right direction only after we have sufficient data for symmetry breaking. The dependence on $K$ in Theorem 2 can be improved as different action has a separate learning procedure. For example, if we consider $\mathcal{F} = \mathcal{F}_1 \times \mathcal{F}_2 \times \dots \times \mathcal{F}_K$ and $\Psi = \Psi_1 \times \Psi_2 \times \dots \times \Psi_K$ , where $\mathcal{F}_a$ and $\Psi_a$ are independent components that is only corresponding to action $a$ (this is a common setup for linear approximated + +reinforcement learning approaches with discrete action space). If $\mathcal{F}_a$ and $\Psi_{a}$ are identical copies of $K$ separate classes, we know $\log |\mathcal{F}| = K\log |\mathcal{F}_a|$ and $\log |\Psi | = K\log |\Psi_a|$ , which leads a $\sqrt{K}$ improvement. + +We now provide the proof sketch of Theorem 2 and we defer the detailed proof to Appendix A. + +Proof Sketch. The proof of Theorem 2 consists of two different components—discovering latent reward and breaking the symmetry, which are formalized by the following lemma. + +Lemma 3 (Discovering latent reward). Suppose Assumptions 2 and 3 hold, and let $(f_{\bar{a}},\psi_{\bar{a}})$ be obtained by Eq.(5). Then, with high probability, we have $|\psi_{\bar{a},1} - \psi_{\bar{a},0}|\geq \left(1 - \mathcal{O}\left(\frac{1}{\Delta_{\mathcal{F}}}\sqrt{\frac{K^3d_{\mathcal{F},\Psi}}{|\mathcal{D}|}}\right)\right)$ . + +Lemma 3 ensures that the learned decoder on Eq.(5) correctly separates the latent reward. In particular, since $\psi$ ranges over $[0,1]$ , Lemma 3 ensures $\max (\operatorname*{Pr}(\psi (y,a) = r),\operatorname*{Pr}(\psi (y,a) = 1 - r)) > 1 - o(1)$ under the behaviour policy. Thus, if we can break symmetry, we can use $\psi$ to generate a reward signal and reduce to ordinary contextual bandit learning. The following lemma guarantees the correctness of the symmetry-breaking step. + +Lemma 4 (Breaking symmetry). Suppose Assumption 4 holds. For any $\bar{a} \in \mathcal{A}$ , if we have $|\mathcal{D}| \geq \mathcal{O}\left(\frac{K^3d_{\mathcal{F},\Psi}}{\left(\min\{\eta\Delta_{\mathcal{F}},Kc_m\}\right)^2}\right)$ , then, with high probability, $\psi_{\bar{a},1}' \geq \psi_{\bar{a},0}'$ . + +Combining these two lemmas above as well as the CB oracle establishes the proof of Theorem 2, and the detailed proof can be found in Appendix A. + +# 5 Empirical Evaluations + +In this section, we provide empirical evaluations in simulated environments created using supervised classification datasets (Sec. 5.1) and an open source fMRI simulator (Sec. 5.2). We evaluate our approach by comparing: (1) CB: Contextual Bandits with exact reward, (2) IGL (full CI): The method proposed by Xie et al. [2021b] which assumes the feedback vector contains no information about the context and action, and (3) AI-IGL: The proposed method which assumes that the feedback vector could contain information about the action but is conditionally independent of the context given the reward. Note that contextual bandits (CB) is a skyline compared to both IGL (full CI) and AI-IGL, since it need not disambiguate the latent reward. All methods use logistic regression with a linear representation. At test time, each method takes the argmax of the policy. Following the practical instantiation of Assumption 4 (Section 3.2), we know if the dataset has a balanced action distribution (no action belongs to more than $50\%$ of the samples), selecting uniformly random policy $\pi_{\mathrm{unif}}$ as $\pi_{\mathrm{base}}^a$ for all $a \in \mathcal{A}$ satisfies Assumption 4. Therefore, in this section, our experiments are all based on the dataset with a balanced action distribution, and we select $\pi_{\mathrm{base}}^a = \pi_{\mathrm{unif}}$ for all $a \in \mathcal{A}$ . + +# 5.1 Large-scale Experiments with OpenML CC-18 Datasets + +To verify that our proposed algorithm scales to a variety of tasks, we evaluate performance on more than 200 datasets from the publicly available OpenML Curated Classification Benchmarking Suite [Vanschoren et al., 2015; Casalicchio et al., 2019; Feurer et al., 2021; Bischl et al., 2021]. OpenML CC-18 datasets are licensed under CC-BY license $^2$ and the platform and library are licensed under the BSD (3-Clause) license $^3$ . At each time step, the context $x_{t}$ is generated uniformly at random. The learner selects an action $a_{t} \in \{0, \dots, K - 1\}$ as the predicted label of $x_{t}$ (where $K$ is the total number of actions available in the environment). The binary reward $r_{t}$ is the correctness of the prediction label $a_{t}$ . The feedback $y_{t}$ is a two-dimensional vector $(a_{t}, r_{t})$ . Each dataset has a different sample size $(N)$ and a different set of available actions $(K)$ . We sample datasets with 3 or more actions, and with a balanced action distribution (no action belongs to more than $50\%$ of the samples) to satisfy Assumption 4. We use $90\%$ of the data for training and the remaining $10\%$ for evaluation. Additional details of setting up the experiment are in Appendix C. The results are averaged over 20 trials and shown in Table 1. + +
Dataset +CriteriaDataset +CountConstant +ActionCB Policy +Accuracy (%)IGL (full CI) +Policy Accuracy (%)Performance +w.r.t CBAI-IGL +Policy Accuracy (%)Performance +w.r.t CB
K ≥ 327125.28 ± 2.9657.98 ± 5.6515.65 ± 2.300.30 ± 0.0435.74 ± 1.450.59 ± 0.02
K ≥, N ≥ 700008322.57 ± 3.1458.41 ± 5.0411.91 ± 1.800.22 ± 0.0450.11 ± 2.980.79 ± 0.03
+ +Table 1: Results in the OpenML environments with two-dimensional action-inclusive feedback. Average and standard error reported over 20 trials for each algorithm. 'Performance w.r.t. CB' reports the ratio of an IGL method's policy accuracy over CB policy accuracy. + +# 5.2 Experiments on Realistic fMRI Simulation + +We also evaluate our approach on a simulated BCI experiment, where a human imagines a number and the agent faces a number-decoding task (Fig. 1). We simulate an fMRI based BCI setup, recording the fMRI BOLD (Blood Oxygenation Level Dependent) response in the parietal cortex of a human brain. We have selected the parietal cortex since both numerical processing [Santens et al., 2010] and match-mismatch processing are reported to involve this region [Male et al., 2020], and in principle it could feasibly be recorded by fNIRS (with similar spatial resolution to fMRI) [Naseer and Hong, 2015]. The task requires an intelligent agent to decode the numbers the human imagines. This task is motivated by real-world examples where an implant could assist a person, user, or patient by communicating their mental states to the outside world, whether for therapeutic purposes or to control hardware or software. + +The task setup consists of the following steps—(1) Human Imagination: A human participant imagines a number from a set of digits (i.e., 7, 8, 9), (2) Agent Decoding: an agent (Full CI IGL or AI-IGL) decodes the number being imagined using only the fMRI signals of the human participant, with no labels and no supervised pretraining, (3) Human Perception: the agent visually displays the number it decoded to the human, which the human brain perceives, and hence the fMRI signals would contain patterns related to the perception of the agent's guess, (4) Human Judgment: Once the human judges whether the agent-guessed number yields a match or a mismatch to the number they imagined, fMRI signals reflect the participant's judgment. This simple setup mimics many relevant applications of BCI with a realistic simulation of fMRI signals (generalizable to the more cost-efficient fNIRS). We used a third party simulation software, offering a strong test bed for the algorithms compared here. + +We use an open source simulator [Ellis et al., 2020] to simulate BCI-like, interactive fMRI signals for the imagination, perception, and judgment phases described above. This simulator leverages real human fMRI data [Bejjanki et al., 2017] to simulate signals for different regions of the brain. Prior neuroscience studies have shown that the parietal cortices in the human brain (in particular the posterior parietal cortex) process numbers [Santens et al., 2010], while the frontoparietal cortices process visual attention as well as match-mismatch judgments [Male et al., 2020]. These studies, together with the low temporal resolution of fMRI/fNIRS [Glover, 2011], warrant the assumption we make here: that number perception and judgments signals can both be decoded from the same region, i.e., the parietal cortex. Therefore, per AI-IGL's theoretical assumptions, the two signals can be mixed in the brain's implicit feedback signal, here simulated as an fMRI or fNIRS signal, in arbitrary ways. Thus, we selected a region of interest (ROI) in the parietal cortex to cover the mixed feedback of perceiving the numbers and making a match-mismatch judgments. This simulated BCI setting is precisely the sort of realistic condition that our proposed AI-IGL solution is designed to handle well. Moreover, it is quite possible to conduct this experiment in principle using fMRI, or more realistically using fNIRS—which is portable, noninvasive, easy to use, and can be focused on a specific patch on the surface of the brain. + +Each event (perception, imagination, judgment) evokes different activity in the human brain, within the same set of $4 \times 4 \times 4$ voxels, generating a 64-dimensional activity vector. We generate a time course of 666 trials, each of them including a sequence of events where an imagination event is followed by a response from the agent, then a perception event, and a judgment event. Thus, the 666 trials include 1998 simulated brain events total. Each event is 2 seconds long, with an inter-stimulus (ISI) of 7 seconds, and a temporal resolution of 10 seconds. For each event, the simulator combines spatiotemporal noise (trial noise) and voxel activation patterns to simulate activity signals. We use the imagination signal as context (Fig. 1, Context) and a weighted average of the perception and judgement signals to simulate the brain's mixed feedback signal (Fig. 1, Feedback). + +We evaluate the performance of both full CI IGL and AI-IGL on this simulated and interactive number-decoding task, under varying levels of feedback noise. The results are shown in Table 2. We + +found that full CI IGL failed at the task, remaining at chance level guessing. However, the novel algorithm proposed here, AI-IGL, was capable of learning to dissociate the human judgment from a mixed feedback signal. The significance of these findings are two-fold. First, they offer a realistic approach to simulating BCI experiments in order to test theoretical advances before conducting real world experiments. Second, our results further validate the theoretical advances of AI-IGL compared to the previous IGL approach for a realistic interactive brain-computer interface. + +
Algorithm1% noise5% noise10% noise
IGL (full CI)32.60 ± 0.2433.75 ± 0.2933.33 ± 0.29
AI-IGL89.10 ± 3.5876.60 ± 4.0964.25 ± 4.16
+ +Table 2: Policy accuracy for the simulated BCI experiments with action-inclusive feedback. Average and standard error reported over 20 trials for each algorithm. + +# 6 Discussion + +We have presented a new approach to solving Interaction-Grounded Learning, in which an agent learns to interact with the environment in the absence of any explicit reward signals. Compared to a prior solution [Xie et al., 2021b], the proposed AI-IGL approach removes the assumption of conditional independence of actions and the feedback vector by treating the latent reward as a latent state. It thereby provably solves IGL for action-inclusive feedback vectors. + +By viewing the feedback as containing an action-(latent) reward pair which is an unobserved latent space, we propose latent reward learning using a contrastive learning approach. This solution concept naturally connects to latent state discovery in rich-observation reinforcement learning [e.g., Dann et al., 2018; Du et al., 2019; Misra et al., 2020]. On the other hand, different from rich-observation RL, the problem of IGL also contains a unique challenge in identifying the semantic meaning of the decoded class, which is addressed by a symmetry-breaking procedure. In this work, we focus on binary latent rewards, for which symmetry breaking is possible using one policy (per action). Breaking symmetry in more general latent reward spaces is a topic for future work. A possible negative societal impact of this work can be performance instability, especially with inappropriate use of the techniques in risk-sensitive applications. + +Barring intentional misuse, we envision several potential benefits of the proposed approach. The proposed algorithm broadens the scope of IGL's feasibility for real-world applications. Imagine an agent being trained to interpret the brain signals of a user to control a prosthetic arm. The brain's response (feedback vector) to an action is a neural signal that may contain information about the action itself. This is so prevalent in neuroimaging that fMRI studies routinely use specialized techniques to orthogonalize different information (e.g. action and reward) within the same signal [Momennejad and Haynes, 2012, 2013; Belghazi et al., 2018; Shah and Peters, 2020]. Another example is a continually self-calibrating eye tracker, used by people with motor disabilities such as ALS [Hansen et al., 2004; Liu et al., 2010; Mott et al., 2017; Gao et al., 2021]. A learning agent adapting to the ability of such users can encounter feedback directly influenced by the calibration correction action. The proposed approach is a stepping stone on the path to solving IGL for complex interactive settings, overcoming the need for explicit rewards as well as explicit separation of action and feedback information. + +# Acknowledgments + +The authors would like to thank Mark Rucker for sharing methods and code for computing and comparing diagnostic features of OpenML datasets. NJ acknowledges funding support from ARL Cooperative Agreement W911NF-17-2-0196, NSF IIS-2112471, NSF CAREER award, and Adobe Data Science Research Award. + +# References + +Sarah Daniel Abdelmessih, Faisal Shafait, Matthias Reif, and Markus Goldstein. Landmarking for meta-learning using rapidminer. In RapidMiner community meeting and conference. CiteSeer, 2010. + +Alekh Agarwal, Daniel Hsu, Satyen Kale, John Langford, Lihong Li, and Robert Schapire. Taming the monster: A fast and simple algorithm for contextual bandits. In International Conference on Machine Learning, pages 1638-1646. PMLR, 2014. +Iretiayo Akinola, Zizhao Wang, Junyao Shi, Xiaomin He, Pawan Lapborisuth, Jingxi Xu, David Watkins-Valls, Paul Sajda, and Peter Allen. Accelerated robot learning via human brain signals. In 2020 IEEE international conference on robotics and automation (ICRA), pages 3799-3805. IEEE, 2020. +Vikranth R Bejjanki, Rava Azeredo Da Silveira, Jonathan D Cohen, and Nicholas B Turk-Browne. Noise correlations in the human brain and their impact on pattern classification. PLoS computational biology, 13(8):e1005674, 2017. +Mohamed Ishmael Belghazi, Aristide Baratin, Sai Rajeswar, Sherjil Ozair, Yoshua Bengio, R. Devon Hjelm, and Aaron C. Courville. Mutual information neural estimation. In Proceedings of the 35th International Conference on Machine Learning, ICML 2018, Stockholm, Sweden, July 10-15, 2018, volume 80 of Proceedings of Machine Learning Research, pages 530-539. PMLR, 2018. +Bernd Bischl, Giuseppe Casalicchio, Matthias Feurer, Pieter Gijsbers, Frank Hutter, Michel Lang, Rafael Gomes Mantovani, Jan N. van Rijn, and Joaquin Vanschoren. Openml benchmarking suites. In Proceedings of the Neural Information Processing Systems Track on Datasets and Benchmarks 1, NeurIPS Datasets and Benchmarks, 2021. +Giuseppe Casalicchio, Jakob Bossek, Michel Lang, Dominik Kirchhoff, Pascal Kerschke, Benjamin Hofner, Heidi Seibold, Joaquin Vanschoren, and Bernd Bischl. Openml: An r package to connect to the machine learning platform openml. Computational Statistics, 34(3):977-991, 2019. +Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In International conference on machine learning, pages 1597-1607. PMLR, 2020. +Yuchen Cui, Qiping Zhang, Brad Knox, Alessandro Allievi, Peter Stone, and Scott Niekum. The empathic framework for task learning from implicit human feedback. In Conference on Robot Learning, pages 604-626. PMLR, 2021. +Christoph Dann, Nan Jiang, Akshay Krishnamurthy, Alekh Agarwal, John Langford, and Robert E Schapire. On oracle-efficient pacrl with rich observations. Advances in neural information processing systems, 31, 2018. +Megan T Debettencourt, Jonathan D Cohen, Ray F Lee, Kenneth A Norman, and Nicholas B Turk-Browne. Closed-loop training of attention with real-time brain imaging. Nature neuroscience, 18 (3):470-475, 2015. +Simon Du, Akshay Krishnamurthy, Nan Jiang, Alekh Agarwal, Miroslav Dudik, and John Langford. Provably efficient rl with rich observations via latent state decoding. In International Conference on Machine Learning, pages 1665-1674. PMLR, 2019. +Andrew T Duchowski. Gaze-based interaction: A 30 year retrospective. Computers & Graphics, 73: 59-69, 2018. +Miroslav Dudik, Daniel Hsu, Satyen Kale, Nikos Karampatziakis, John Langford, Lev Reyzin, and Tong Zhang. Efficient optimal learning for contextual bandits. In Proceedings of the Twenty-Seventh Conference on Uncertainty in Artificial Intelligence, pages 169-178, 2011. +Cameron T Ellis, Christopher Baldassano, Anna C Schapiro, Ming Bo Cai, and Jonathan D Cohen. Facilitating open-science with realistic fmri simulation: validation and application. *PeerJ*, 8:e8564, 2020. +Matthias Feurer, Jan N van Rijn, Arlind Kadra, Pieter Gijsbers, Neeratyoy Mallik, Sahithya Ravi, Andreas Müller, Joaquin Vanschoren, and Frank Hutter. Openml-python: an extensible python api for openml. Journal of Machine Learning Research, 22:1-5, 2021. + +Euan Freeman, Graham Wilson, Dong-Bach Vo, Alex Ng, Ioannis Politis, and Stephen Brewster. Multimodal feedback in hci: haptics, non-speech audio, and their applications. In *The Handbook of Multimodal-Multisensor Interfaces: Foundations*, User Modeling, and Common Modality Combinations-Volume 1, pages 277-317. ACM, 2017. +Jensen Gao, Siddharth Reddy, Glen Berseth, Nicholas Hardy, Nikhilesh Natraj, Karunesh Ganguly, Anca D. Dragan, and Sergey Levine. X2T: training an x-to-text typing interface with online learning from user feedback. In 9th International Conference on Learning Representations, ICLR, 2021. +Gary H Glover. Overview of functional magnetic resonance imaging. Neurosurgery Clinics, 22(2): 133-139, 2011. +Jonathan Grizou, Inaki Iturrate, Luis Montesano, Pierre-Yves Oudeyer, and Manuel Lopes. Calibration-free bci based control. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 28, 2014. +John Paulin Hansen, Kristian Tørning, Anders Sewerin Johansen, Kenji Itoh, and Hirotaka Aoki. Gaze typing compared with input by head and hand. In Proceedings of the 2004 symposium on Eye tracking research & applications, pages 131-138, 2004. +Jeff Z HaoChen, Colin Wei, Adrien Gaidon, and Tengyu Ma. Provable guarantees for self-supervised deep learning with spectral contrastive loss. Advances in Neural Information Processing Systems, 34, 2021. +Kapil D Katyal, Matthew S Johannes, Spencer Kellis, Tyson Aflalo, Christian Klaes, Timothy G McGee, Matthew P Para, Ying Shi, Brian Lee, Kelsie Pejsa, et al. A collaborative bci approach to autonomous control of a prosthetic limb system. In 2014 IEEE International Conference on Systems, Man, and Cybernetics (SMC), pages 1479-1482. IEEE, 2014. +John Langford and Tong Zhang. The epoch-greedy algorithm for contextual multi-armed bandits. Advances in neural information processing systems, 20(1):96-1, 2007. +Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278-2324, 1998. +Shuo Samuel Liu, Andrew Rawicz, Teng Ma, Cheng Zhang, Kyle Lin, Siavash Rezaei, and Eion Wu. An eye-gaze tracking and human computer interface system for people with als and other locked-in diseases. CMBES Proceedings, 33, 2010. +Ana C Lorena, Luis PF Garcia, Jens Lehmann, Marcilio CP Souto, and Tin Kam Ho. How complex is your classification problem? a survey on measuring classification complexity. ACM Computing Surveys (CSUR), 52(5):1-34, 2019. +Alie G Male, Robert P O'Shea, Erich Schröger, Dagmar Müller, Urte Roeber, and Andreas Widmann. The quest for the genuine visual mismatch negativity (vmmn): Event-related potential indications of deviance detection for low-level visual features. Psychophysiology, 57(6):e13576, 2020. +Jyoti Mishra and Adam Gazzaley. Closed-loop cognition: the next frontier arrives. Trends in cognitive sciences, 19(5):242-243, 2015. +Dipendra Misra, Mikael Henaff, Akshay Krishnamurthy, and John Langford. Kinematic state abstraction and provably efficient rich-observation reinforcement learning. In International conference on machine learning, pages 6961-6971. PMLR, 2020. +Mehryar Mohri, Afshin Rostamizadeh, and Ameet Talwalkar. Foundations of machine learning. MIT press, 2018. +Ida Momennejad and John-Dylan Haynes. Human anterior prefrontal cortex encodes the 'what' and 'when' of future intentions. Neuroimage, 61(1):139-148, 2012. +Ida Momennejad and John-Dylan Haynes. Encoding of prospective tasks in the human prefrontal cortex under varying task loads. Journal of Neuroscience, 33(44):17342-17349, 2013. + +Martez E Mott, Shane Williams, Jacob O Wobbrock, and Meredith Ringel Morris. Improving dwell-based gaze typing with dynamic, cascading dwell times. In Proceedings of the 2017 CHI Conference on Human Factors in Computing Systems, pages 2558-2570, 2017. +Santiago Muñoz-Moldes and Axel Cleeremans. Delineating implicit and explicit processes in neurofeedback learning. *Neuroscience & Biobehavioral Reviews*, 118:681-688, 2020. +Noman Naseer and Keum-Shik Hong. fnirs-based brain-computer interfaces: a review. Frontiers in human neuroscience, 9:3, 2015. +Khanh X Nguyen, Dipendra Misra, Robert Schapire, Miroslav Dudík, and Patrick Shafto. Interactive learning from activity description. In International Conference on Machine Learning, pages 8096-8108. PMLR, 2021. +Maja Pantic and Leon JM Rothkrantz. Toward an affect-sensitive multimodal human-computer interaction. Proceedings of the IEEE, 91(9):1370-1390, 2003. +Benjamin Poole and Minwoo Lee. Towards intrinsic interactive reinforcement learning. arXiv preprint arXiv:2112.01575, 2021. +Matthias Reif, Faisal Shafait, Markus Goldstein, Thomas Breuel, and Andreas Dengel. Automatic classifier selection for non-experts. Pattern Analysis and Applications, 17(1):83-96, 2014. +Seppe Santens, Chantal Roggeman, Wim Fias, and Tom Verguts. Number processing pathways in human parietal cortex. Cerebral cortex, 20(1):77-88, 2010. +Akanksha Saran, Srinjoy Majumdar, Elaine Schaertl Short, Andrea Thomaz, and Scott Niekum. Human gaze following for human-robot interaction. In 2018 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pages 8615-8621. IEEE, 2018. +Akanksha Saran, Elaine Schaertl Short, Andrea Thomaz, and Scott Niekum. Understanding teacher gaze patterns for robot learning. In Conference on Robot Learning, pages 1247-1258. PMLR, 2020. +Rajen D Shah and Jonas Peters. The hardness of conditional independence testing and the generalised covariance measure. The Annals of Statistics, 48(3):1514-1538, 2020. +Vicenç Torra, Yasuo Narukawa, and Toho Gakuen. Modeling decisions for artificial intelligence. International Journal of Intelligent Systems, 23(2):113, 2008. +Joaquin Vanschoren, Jan N van Rijn, B Bischl, G Casalicchio, M Lang, and M Feurer. Openml: a networked science platform for machine learning. In ICML 2015 MLOSS Workshop, volume 3, 2015. +Holly S Vitense, Julie A Jacko, and V Kathlene Emery. Multimodal feedback: an assessment of performance and mental workload. Ergonomics, 46(1-3):68-87, 2003. +Zhirong Wu, Yuanjun Xiong, Stella X Yu, and Dahua Lin. Unsupervised feature learning via nonparametric instance discrimination. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 3733-3742, 2018. +Tengyang Xie, Nan Jiang, Huan Wang, Caiming Xiong, and Yu Bai. Policy finetuning: Bridging sample-efficient offline and online reinforcement learning. Advances in neural information processing systems, 34, 2021a. +Tengyang Xie, John Langford, Paul Mineiro, and Ida Momennejad. Interaction-grounded learning. In International Conference on Machine Learning, pages 11414-11423. PMLR, 2021b. +Duo Xu, Mohit Agarwal, Ekansh Gupta, Faramarz Fekri, and Raghupathy Sivakumar. Accelerating reinforcement learning using eeg-based implicit human feedback. Neurocomputing, 460:139-153, 2021. +Ruohan Zhang, Akanksha Saran, Bo Liu, Yifeng Zhu, Sihang Guo, Scott Niekum, Dana Ballard, and Mary Hayhoe. Human gaze assisted artificial intelligence: A review. In *IJCAI: Proceedings of the Conference*, volume 2020, page 4951. NIH Public Access, 2020. \ No newline at end of file diff --git a/interactiongroundedlearningwithactioninclusivefeedback/images.zip b/interactiongroundedlearningwithactioninclusivefeedback/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..d01150f8d2f22077ab9615678c2201fb7d55a8db --- /dev/null +++ b/interactiongroundedlearningwithactioninclusivefeedback/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:907f0679d2855e94480f39774930d62948c96bbedb067be2749a5b53e2e61082 +size 252154 diff --git a/interactiongroundedlearningwithactioninclusivefeedback/layout.json b/interactiongroundedlearningwithactioninclusivefeedback/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..7e0929f081601635196ae7d5ed365d710eddfe56 --- /dev/null +++ b/interactiongroundedlearningwithactioninclusivefeedback/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:28fcdc67226346fd129e4cc35a6d46a3315094fb36c4e8c791a92a33708485fe +size 590974 diff --git a/interactionmodelingwithmultiplexattention/b336f06a-58c9-4535-a395-82490004d42d_content_list.json b/interactionmodelingwithmultiplexattention/b336f06a-58c9-4535-a395-82490004d42d_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..6c60cf10bbd8da130797909912133b78817bef20 --- /dev/null +++ b/interactionmodelingwithmultiplexattention/b336f06a-58c9-4535-a395-82490004d42d_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9da13caef9f31d43cd72c6aa0dec625e7750e49e9d717d78d7c7d388f67eaf2b +size 72243 diff --git a/interactionmodelingwithmultiplexattention/b336f06a-58c9-4535-a395-82490004d42d_model.json b/interactionmodelingwithmultiplexattention/b336f06a-58c9-4535-a395-82490004d42d_model.json new file mode 100644 index 0000000000000000000000000000000000000000..80e272703256ebed2bd50e44d68caa77c55588e3 --- /dev/null +++ b/interactionmodelingwithmultiplexattention/b336f06a-58c9-4535-a395-82490004d42d_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bf250660f4875461e577f648d28e90c8ee8671f8c0ea0d1aaaef33d585398de6 +size 91835 diff --git a/interactionmodelingwithmultiplexattention/b336f06a-58c9-4535-a395-82490004d42d_origin.pdf b/interactionmodelingwithmultiplexattention/b336f06a-58c9-4535-a395-82490004d42d_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7698a50af968b9d137f8f7d4df155a1407e08823 --- /dev/null +++ b/interactionmodelingwithmultiplexattention/b336f06a-58c9-4535-a395-82490004d42d_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:595d4246926cfcf1ff103fdcf842298fb4403836611346f4494439c2cf5d51b9 +size 4424711 diff --git a/interactionmodelingwithmultiplexattention/full.md b/interactionmodelingwithmultiplexattention/full.md new file mode 100644 index 0000000000000000000000000000000000000000..946027c7492b0db934b5eee7005d5acb17eac850 --- /dev/null +++ b/interactionmodelingwithmultiplexattention/full.md @@ -0,0 +1,265 @@ +# Interaction Modeling with Multiplex Attention + +Fan-Yun Sun + +Stanford University + +Isaac Kauvar + +Stanford University + +Ruohan Zhang + +Stanford University + +Jiachen Li + +Stanford University + +Mykel Kochenderfer + +Stanford University + +Jiajun Wu + +Stanford University + +Nick Haber + +Stanford University + +# Abstract + +Modeling multi-agent systems requires understanding how agents interact. Such systems are often difficult to model because they can involve a variety of types of interactions that layer together to drive rich social behavioral dynamics. Here we introduce a method for accurately modeling multi-agent systems. We present Interaction Modeling with Multiplex Attention (IMMA)1, a forward prediction model that uses a multiplex latent graph to represent multiple independent types of interactions and attention to account for relations of different strengths. We also introduce Progressive Layer Training, a training strategy for this architecture. We show that our approach outperforms state-of-the-art models in trajectory forecasting and relation inference, spanning three multi-agent scenarios: social navigation, cooperative task achievement, and team sports. We further demonstrate that our approach can improve zero-shot generalization and allows us to probe how different interactions impact agent behavior. + +# 1 Introduction + +Modeling multi-agent systems is important for a wide variety of applications, including self-driving cars, crowd navigation, and human-machine collaboration. The dynamics of multi-agent systems can be challenging to model as they are usually governed by various independent types of interactions. Consider modeling crowd navigation at a social gathering, where agents' behaviors might be governed by at least two types of interactions: target destinations (e.g. a person trying to meet up with a friend) and collision avoidance (e.g. navigating a busy sidewalk). In social scenarios like this, humans often appear to navigate and make predictions based on estimated high-level intentions and relations among the other people [16, 45, 46]. Motivated by this observation, we aim to build a forecasting model for multi-agent systems that infers high-level abstractions in the form of graphs, entirely through the task of predicting agent trajectories. + +Leading approaches in modeling multi-agent systems, such as Neural Relational Inference (NRI) [22], Relational Forward Model (RFM) [8], and their extensions [12, 27], use graph neural networks (GNNs) to infer edge types for every pair of entities in the interacting systems. However, this inductive bias does not explicitly handle the multiple layers of interactions present in social multi-agent systems and, as shown empirically in Section 4, has led to at least two shortcomings: reduced performance on long-term predictions and decreased interpretability. Our approach, Interaction Modeling with Multiplex Attention (IMMA), overcomes these issues by using a multiplex graph² latent structure to model multiple interaction types, with attention graph layers that can capture the strength of relations. + +![](images/01e6de916a9a3b9029b40e8e854f4cd3d0404b42184a3dc0ff97ab3791c03615.jpg) +Figure 1: Multi-agent systems are often guided by a variety of interactions, such as target destinations (e.g. a person trying to meet up with a friend) and collision avoidance (e.g. navigating a busy sidewalk). Our model uses a multiplex attentional graph to infer multiple, independent types of relations among agents and yield improved performance in predicting the dynamics of the system. In this figure, strength of interaction is indicated by graph line thickness. + +Furthermore, we propose a training approach for IMMA that we call Progressive Layer Training (PLT). Learning in high-dimensional space often leads to highly-entangled representations that are uninterpretable [44], but adding explicit disentanglement objectives often leads to decreased model performance [10, 18]. Inspired by the concept of "starting easy" and curriculum learning [5], we train our model to learn progressively, one latent layer at a time. In addition to improving performance, training IMMA with PLT also improves interpretability—offering the potential to answer questions such as: "Who causes an agent to behave this way?" + +Using our method, we conduct experiments in a range of social multi-agent environments inspired by real-world scenarios: social navigation, cooperative task achievement, and team sports. We evaluate models on trajectory prediction, we analyze the relations inferred by our model, and we explore the important role these inferred relations play in making accurate predictions. Additionally, we show that IMMA is effective at zero-shot generalization and conditional generation. To summarize, + +- We propose Interaction Modeling with Multiplex Attention (IMMA), a model that uses a new latent space structure which we call Multiplex Attentional Graph. It models relations and utilizes these relations to make forecasting predictions. +- We propose a training technique that is enabled by the multiplexed latent structure: Progressive Layer Training (PLT). PLT enables our model to learn types of interactions one at a time and furthers the performance and interpretability of IMMA. +- Empirically, we show that our method (IMMA w/ PLT) outperforms the state-of-the-art models on three different social multi-agent environments. To understand the interpretability of our approach, we evaluate our method on relational inference and conduct a conditional generation experiment. We also compare various ablated and modified versions of our method, including incorporation of a well-established approach for learning disentangled representations, to understand the contribution of each components. Furthermore, we showcase the superior sample efficiency and generalization ability of our model. + +# 2 Related Work + +Many approaches have been proposed to model multi-agent interactions, especially as a crucial step toward achieving better performance in tasks such as model-based reinforcement learning [37, 48], trajectory prediction [34], and motion planning [40]. In particular, social dynamics modeling has been studied in domains such as human crowds [34], team sports [12, 22, 27], and traffic participants [35] where the interactions between entities lead to highly complicated motion or behavior patterns. Many earlier works, such as Social Forces [17], are deterministic regression models that model humans as objects affected by forces. The rise of deep learning ushered in various neural network based models such as Social-LSTM [1]—an LSTM model with a social pooling layer, social-GAN [13]—a GAN combined with sequence-to-sequence model, Social-Attention [42]—a recurrent neural network that makes use of attention mechanism, and others [11, 25]. Researchers also proposed to model + +interactions with networks that were inspired by a Theory of Mind framework [32, 33]. Our work is different as we explicitly infer an interpretable discrete structure and perform inference over it. + +In recent years, graph representation learning has been investigated for relational reasoning in multiagent systems, where nodes represent interacting entities and edges represent their relations [4]. Most existing graph-based methods infer interactions implicitly [3, 7, 19, 26, 29, 35, 36], meaning that little to no interpretable abstractions can be extracted from the models. Other works take pre-defined graph topology based on heuristics as input [1, 23]. NRI [22], DNRI [12], RFM [39], and EvolveGraph [27] takes a step forward to reason about relations by inferring the topology of the underlying interaction graphs. NRI [22] takes the form of a variational auto-encoder while RFM[39], having near-identical architecture as NRI, simply uses a forward prediction framework. All these methods model interactions as latent interaction graphs and leverage them to make future predictions. Our work falls into this line of research with significant improvements to performance in terms of both relational inference and trajectory prediction because of (1) the novel multiplexed latent structure, (2) the incorporation of an attention mechanism, and (3) a progressive training strategy. + +# 3 Methods + +In this section, we define our problem and introduce our proposed model (IMMA) and training strategy (PLT). Our input consists of trajectories of $N$ agents. We denote by $\mathbf{x}_i^t$ the feature vector of agent $i$ at time $t$ , e.g. location. We denote by $\mathbf{x}^t = \{\mathbf{x}_1^t,\dots,\mathbf{x}_N^t\}$ the set of features of all $N$ agents at time $t$ and by $\mathbf{X}^{T_1:T_2} = \{\mathbf{x}_i^{T_1:T_2},i = 1,\dots,N\}$ the set of features covering time steps from $T_{1}$ to $T_{2}$ . The task is to take trajectory observations as input and learn to predict successive trajectories of all agents. We aim to estimate $p(\mathbf{X}^{T_h + 1:T_h + T_f}|\mathbf{X}^{1:T_h})$ , where $T_{h}$ is the historical horizon and $T_{f}$ is the forecasting horizon. Note that even though agents can have relations and goals that vary in different instances, these must be inferred entirely through the supervision signals of the trajectory prediction task (with no supervision of the relations themselves). + +# 3.1 Interaction Modeling with Multiplex Attention + +We propose Interaction Modeling with Multiplex Attention (IMMA) - a model that consists of an encoder and a decoder trained jointly. The encoder takes a sequence of observations (i.e. trajectories) as input and outputs a latent interaction graph. Subsequently, the decoder predicts future trajectories by performing message passing among agents (nodes) with the inferred latent interaction graph. IMMA assumes that the dynamics of multi-agent systems can be abstracted to a latent graph structure (i.e. a vector of categorical latent variables) $\mathbf{z} = \{z_{ij}\}$ , where $z_{ij}$ represents relations between agents $i$ and $j$ . We optimize the variational lower bound, as in the conditional variational autoencoder (CVAE) [38, 21]: + +$$ +\mathcal {L} (\theta , \phi) = \mathbb {E} _ {q _ {\phi} (\mathbf {z} | \mathbf {X} ^ {1: T _ {h} + T _ {f}})} [ \log p _ {\theta} (\mathbf {X} ^ {T _ {h} + 1: T _ {h} + T _ {f}} | \mathbf {X} ^ {1: T _ {h}}, \mathbf {z}) ] - D _ {K L} (q _ {\phi} (\mathbf {z} | \mathbf {X} ^ {1: T _ {h} + T _ {f}}) \| p (\mathbf {z})). \tag {1} +$$ + +The encoder (approximated posterior) $q_{\phi}(\mathbf{z}|\mathbf{X}^{1:T_h + T_f})$ is a neural network with parameters $\phi$ , the decoder (likelihood) $p_{\theta}(\mathbf{X}^{T_h + 1:T_h + T_f}|\mathbf{X}^{1:T_h},\mathbf{z})$ is a neural network with parameters $\theta$ , and $p(\mathbf{z})$ denotes the prior3. + +In previous works [22, 27, 39, 12], the latent graph $\mathbf{z}$ is inferred by performing edge-type classification. That is, $\mathbf{z}$ represents the likelihoods of edges in the latent graph belonging to a set of classes. However, in social dynamical systems multiple types of independent interactions can coexist, with different strengths of relations within an interaction type. In this case, representing the interactions with a single graph with many edge types requires many more edge types to accommodate all possible combinations of interactions. More concretely, consider a navigational environment consisting of two independent types of relations: friendship (i.e. target-seeking interaction) and proximity (i.e. collision-avoidance interaction). To model this environment with a single graph with many edge types, intuitively we might expect to need at least four edge classes to represent the interactions (none, only friendship, only proximity, and friendship + proximity) and many more if we want to model the interactions with higher fidelity (e.g. treating strong friendship differently from weak friendship). Furthermore, since $\mathbf{z}$ is learned to encode likelihood of an edge belonging to a particular class, it may struggle to capture relative strengths of interactions between agents. + +![](images/c01e66c8c37b5b138cf27d8f6891b2461c55c904246213d7a0cf01a728febe3e.jpg) +Figure 2: Architecture of IMMA. Each agent's trajectory (e.g. past position across time) is independently embedded into a latent node state. A multiplex graph latent representation is inferred from all agents' trajectories. IMMA is trained using Progressive Layer Training, where the GNN to compute layer one is first learned and then a second GNN is introduced to compute layer two (while the GNN weights for layer one is frozen). The decoder is a GraphGRU that uses the same multiplex graph at each prediction step, while updating the latent node state. Note that the input node representations to the decoder are agent-centric. A readout network predicts $\hat{x}$ from $\tilde{h}$ at each time step. + +In the following, we describe how IMMA (depicted in Fig. 2) tackles these limitations, as we introduce the encoder and decoder in more detail. + +Encoder with Multiplex Attentional Latent Graphs The goal of the encoder is to infer a latent interaction graph. To achieve this, we use a GNN on a fully-connected directed graph without self-loops, where each vertex represents an agent. Let $\mathbf{x}_j$ denote the feature vector of agent $j$ across all input frames $(\mathbf{x}_j^1,\dots,\mathbf{x}_j^{T_h})$ . The GNN embeds agent trajectories (e.g. $\mathbf{x}_j$ ) into edge embeddings, which are then passed through a MLP to derive unnormalized edge weights (e.g. $\mathbf{e}_{(i,j)}$ ). $\mathbf{e}_{(i,j)}$ is a vector with dimensionality $K$ , a hyperparameter that determines the number of layers in the latent graph. Details of the GNN can be found in the Appendix. + +Previous approaches attempt to classify edges into one out of the $K$ possible edge types. They derive $\mathbf{z}_{ij}$ by applying a softmax on $\mathbf{e}_{(i,j)}$ such that $\sum_{k=1}^{K} \mathbf{z}_{ij}^k = 1$ with $\mathbf{z}^k$ the $k$ -th layer of the latent graph. We propose a novel way to construct the latent space using a multiplex attentional graph. Instead of performing edge-type classification, we perform multi-class prediction on edge embeddings, yielding multiplexed layers, and introduce an attention mechanism between agents within each of these layers. That is, + +$$ +q _ {\phi} \left(\mathbf {z} _ {i j} ^ {k} \mid \mathbf {X} _ {1: T _ {h}}\right) = \operatorname {s o f t m a x} _ {j} \left(\mathbf {e} _ {(i, j)} ^ {k}\right) = \frac {\exp \left(\mathbf {e} _ {(i , j)} ^ {k}\right)}{\sum_ {j \in N _ {j}} \exp \left(\mathbf {e} _ {(i , j)} ^ {k}\right)}, \quad \forall k = 1 \dots K, \tag {2} +$$ + +where $N_{j}$ denotes the neighbors of agent $j$ (we assume a fully connected graph; thus, $N_{j}$ includes all other agents except $j$ itself). Note that $\mathbf{z}_{ij}$ is different than $\mathbf{z}_{ji}$ . With Eq. 2, layers of the latent graph are separable by construction. By separable, we mean that individual layers of the latent graph (e.g. $z^{1}$ and $z^{2}$ ) can be inferred by separate encoders that does not share any parameters. Intuitively, a multiplex latent space allows us to model independent interactions naturally, and the attention mechanism captures strengths of relations. + +Decoder The task of the decoder is to predict the dynamics of the system using the latent interaction graph $\mathbf{z}$ and the past dynamics. That is, we want to model $p_{\theta}(\mathbf{X}^{T_h + 1:T_h + T_f}|\mathbf{X}^{1:T_h},\mathbf{z})$ . One common issue when training such a decoder is that it might learn to ignore the latent variables while achieving only a marginally worse prediction loss. To avoid this problem, our decoder first learns agent-centric representations $\tilde{\mathbf{h}}_j^t = \tilde{f}_{\mathrm{emb}}(\mathbf{x}_j)$ (i.e. representations are embedded individually for each agent), and then uses these as node embeddings to perform message passing. The decoder thus has to rely on the inferred latent graph to exchange information between agents. After learning agent-centric representations, we use GraphGRU [39] and a readout function to decode future trajectories: + +$$ +\tilde {\mathbf {h}} _ {j} ^ {t + 1} = \operatorname {G r a p h G R U} \left(\tilde {\mathbf {h}} _ {j} ^ {t}, \tilde {\mathbf {h}} ^ {t}, \mathbf {z}\right), \hat {\mathbf {x}} _ {j} ^ {t + 1} = \mathbf {x} _ {j} ^ {t} + f _ {\text {o u t}} \left(\tilde {\mathbf {h}} _ {j} ^ {t + 1}\right) \tag {3} +$$ + +$$ +\tilde {\mathbf {h}} _ {j} ^ {t + 2} = \operatorname {G r a p h G R U} \left(\tilde {\mathbf {h}} _ {j} ^ {t + 1}, \tilde {\mathbf {h}} ^ {t + 1}, \mathbf {z}\right), \hat {\mathbf {x}} _ {j} ^ {t + 2} = \hat {\mathbf {x}} _ {j} ^ {t + 1} + f _ {\text {o u t}} \left(\tilde {\mathbf {h}} _ {j} ^ {t + 2}\right) \tag {4} +$$ + +The details of a GraphGRU block are elaborated in the Appendix. Unlike a typical Graph Attention Network [41] where the graph at every message passing layer is inferred, the same (multiplex) graph + +![](images/d0fe0eb2733c87ad20875026473a942a55373a8c71decd7f0129394fcb9f751b.jpg) +Figure 3: Visualization of the latent graph and agent trajectories of the Social Navigation Environment. (top) Predicted trajectories. The smaller the circle, the further it is into the future. The leftmost column shows ground truth trajectories and the ground truth graph used to simulate those trajectories. (bottom) Inferred latent graphs. Edge strength between agent $i$ and $j$ is represented by darkness of the cell at row $i$ and column $j$ . The red agent's relational prediction is inaccurate with RFM—in the row highlighted by the arrow, the green agent is incorrectly given higher weight than the blue agent—and thus the predicted trajectories deviate from the ground truth, especially on long-horizon predictions. + +is used across all decoding steps. We can re-evaluate the encoder for every time step to obtain a dynamically changing latent graph, however we leave this to future work. + +# 3.2 Progressive Layer Training + +The role of the encoder is to infer a set of graph bases $(\mathbf{z}^1, \mathbf{z}^2 \ldots)$ that reflect the underlying dynamics of the environment. Since the messages are first passed within layers before summing up at the end, it would be useful for the latent graph layers to represent different types of interactions between agents. + +However, it is difficult for the model to learn all the interactions, let alone have them be disentangled. Disentanglement is typically achieved by imposing additional loss, yet these approaches tend to come with the trade-off of decreased reconstruction quality [10, 18, 24]. Motivated by curriculum learning [5] and progressive learning [28] (or more broadly the concept of "starting easy"), we propose to overcome this trade-off with Progressive Layer Training (PLT) — a strategy of learning a set of good graph bases by learning the high-level and most consequential interactions first and then progressively growing the network to model lower-level and more intricate interactions. We first train a IMMA with a single-layered latent graph $\mathbf{z}^1$ , then add a second layer $\mathbf{z}^2$ by training a second encoder while freezing the weights of the first. This process can be repeated until no further improvement is observed. The fact that we can choose to have a separable latent space and do not have to share any parameters between these encoders is a result of our latent space being multiplexed. Directly adding new components to a trained network can introduce a sudden shock to the gradient. To stabilize training, we adopt "fade-in" [20] to smoothly blend the new and existing network components. Refer to the Appendix for more details. + +# 4 Experiments + +We design our experiments to answer the following questions: + +Q1: Does our approach (IMMA w/ PLT) consistently outperform prior methods across a diverse set of social multi-agent environments and benchmarks? +Q2: Does the use of multiplex attentional latent graph give more interpretable abstractions? +Q3: How much does each component contribute to the final performance? +Q4: Is our approach sample efficient? Can it generalize well to novel environments? + +To answer Q1, we test our approach in three multi-agent environments that each exhibited multiple types of social interaction: our simulated Social Navigation Environment, PHASE [30], and the NBA dataset (used in [22, 27, 49, 47, 15]). We develop the first benchmark ourselves, while the latter two are established benchmarks. For each environment, the model receives multi-agent trajectories of length 24 as observation and predicts 10 future time steps. For Social Navigation we use 100k multi-agent trajectories (in total for training, validation, and testing), for NBA dataset we use 300k multi-agent trajectories, and for PHASE we use 836 multi-agent trajectories. We also perform data augmentation, as described in the Appendix. To answer Q2, we evaluate the inferred interaction graphs for the Social Navigation Environment and PHASE, since we have the ground truth interaction graph. Note that we are not supervising on any explicit relations of agents. We further conduct qualitative experiments to understand the abstractions provided by the latent graph. To answer Q3, we conduct an ablation study. For Q4, we perform a sample efficiency experiment and an experiment of zero-shot generalization. Experiments for Q3 and Q4 are conducted on the Social Navigation Environment as we have full control over it. + +# 4.1 Experiment Setup + +Here we describe the environments and baselines. More details are in the Appendix. + +Social Navigation Environment The Social Navigation Environment simulates a socially interactive crowd where agents seek to meet up with other agents while simultaneously navigating to avoid collisions within the crowd (as schematized in Fig. 1). This environment allows fine-grained control by simulating lower-level interaction dynamics using Optimal Reciprocal Collision Avoidance (ORCA, [6]) like many other crowd navigation works [8, 9]. With this environment, we can easily vary environmental parameters to generate diverse trajectories for our generalization experiment. We experiment primarily with an environment consisting of five agents. For each simulated episode, a social interaction graph of the agents is randomly generated: each agent is assigned to be the follower of another agent. Agents are initialized to positions along the edge of a circle. Dynamics is simulated using ORCA by assigning the position of each agent's leader (at each time step) as the target destination of that agent. These environment settings yield reasonably complex trajectories that were clearly influenced by the social interaction graph and collision avoidance, as seen in example trajectories of Fig. 3. + +PHASE dataset PHASE [30] is a simulator for physically-grounded abstract social events, in which social recognition and social prediction algorithms can be benchmarked. In PHASE, two animated agents move in a continuous 2D space and interact with each other and other objects (2 balls). Their actions are generated using a physics engine and a hierarchical planner [30]. We choose the "collaboration" task for our experiment, in which two agents collaborate to move one of the balls to a pre-specified landmark location. Diverse trials are generated by randomizing the agents' and balls' starting locations as well as orientations, target ball, and target landmark. Note that this dataset is substantially smaller than the two other datasets. + +NBA dataset The National Basketball Association (NBA) dataset consists of position trajectories for ten interacting basketball players and the ball and uses real-world player tracking data. The task + +![](images/722a3555a7880e31255e7222d0c54800b635a6e06aabb0fba705112ce9725c61.jpg) +Figure 4: Qualitative analysis of our approach on PHASE data (left) and the NBA dataset (right). For the NBA visualization, the orange agent is the basketball, and colors represent teams. + +Table 1: Trajectory prediction results (mean ± std, over 3 runs) on all three datasets. + +
MetricsBaseline MethodsIMMA (ours)
MLPGAT_LSTM [41]NRI [22]EvolveGraph [27]RFM (skip 1)RFM [39]fNRI [43]SGMGMG + PLT
Social Navigation environment
ADE ↓0.241 ± 0.0060.306 ± 0.0080.217 ± 0.0050.160 ± 0.0030.160 ± 0.0020.156 ± 0.0030.151 ± 0.0010.164 ± 0.0020.148 ± 0.0040.139 ± 0.001
FDE ↓0.513 ± 0.0120.527 ± 0.0090.386 ± 0.0090.321 ± 0.0060.325 ± 0.0040.317 ± 0.0050.308 ± 0.0030.327 ± 0.0030.294 ± 0.0060.279 ± 0.002
PHASE
ADE ↓1.024 ± 0.0051.545 ± 0.0400.986 ± 0.0110.848 ± 0.0120.870 ± 0.0080.892 ± 0.0080.883 ± 0.0150.875 ± 0.0200.883 ± 0.0240.801 ± 0.009
FDE ↓1.763 ± 0.0242.527 ± 0.0631.772 ± 0.0241.522 ± 0.0191.581 ± 0.0301.630 ± 0.0421.607 ± 0.0441.585 ± 0.0441.593 ± 0.0481.484 ± 0.014
NBA dataset
ADE ↓1.113 ± 0.0020.978 ± 0.0050.946 ± 0.0050.896 ± 0.0090.938 ± 0.0030.839 ± 0.0200.804 ± 0.0040.860 ± 0.0080.833 ± 0.0170.769 ± 0.009
FDE ↓1.990 ± 0.0021.733 ± 0.0101.818 ± 0.0171.695 ± 0.0161.756 ± 0.0051.572 ± 0.0341.517 ± 0.0121.612 ± 0.0151.562 ± 0.0271.438 ± 0.019
+ +Table 2: Relational inference accuracy on the Social Navigation environment and PHASE. + +
MetricsBaseline MethodsIMMA
MLPGAT_LSTM [41]NRI [22]EvolveGraph [27]RFM (skip 1)RFM [39]fNRI [43]SGMGMG + PLT
(Social Navigation) Graph Acc. (%) ↑-21.83 ± 0.6757.18 ± 0.1470.23 ± 0.3670.05 ± 0.5571.53 ± 0.5633.97 ± 4.8980.15 ± 1.4877.98 ± 0.1681.38 ± 0.29
(PHASE) Graph Acc. (%) ↑-52.94 ± 1.6655.30 ± 2.0958.96 ± 1.3155.30 ± 2.0954.71 ± 0.8355.49 ± 6.0378.82 ± 3.5479.02 ± 4.0479.21 ± 1.42
+ +is to predict 10 future time steps (4s) based on a history of 24 time steps (10s). Team information is an additional input feature. The unit reported is meters. + +Baselines We consider the following baselines and ablations. + +- MLP: a large MLP network that takes the concatenated features of all agents across all timesteps as input and output trajectory predictions of all agents at the same time. +- GAT_LSTM: a network with Graph Attention layers [41] followed by LSTMs. +- NRI [22]: a VAE model with recurrent GNN modules. +- EvolveGraph [19]: a model that expands upon the framework of NRI and introduces a double-stage training pipeline to account for an evolving interaction graph. +- RFM [39]: a recurrent GNN model of similar architecture to NRI, but with a supervised loss instead of a variational lower bound loss. +- RFM (skip 1): a RFM model with the first edge type is "hard-coded" as "non-edge" (i.e. no messages are passed along edges of the first layer). +- fNRI [43]: a NRI model that uses a multiplex latent graph structure (i.e., sigmoid activation). +- IMMA (SG): IMMA with a single layer of attentional latent graph. +- IMMA (MG): IMMA with multiple layers of attentional latent graphs (a multiplex graph) trained simultaneously, without PLT. + +We are aware that there are other relevant baselines such as Social-LSTM [1], Social-GAN [13], and Trajectory++ [35] etc. We choose to compare with EvolveGraph, because it consistently outperforms these models across datasets [27]. + +# 4.2 Trajectory Prediction + +To answer Q1, we evaluate all models on their prediction performance of agent position on future trajectories with two metrics: average displacement error (ADE) and final displacement error (FDE). Both of these are metrics widely used in trajectory prediction literature: ADE is defined as the average deviated distance of all entities within the prediction horizon, and FDE is defined as the deviated distance of all entities at the last predicted time step. + +The results on the Social Navigation Environment, PHASE, and the NBA dataset are shown in table 1. We found that using multiplex attentional latent graph with progressive layer training (MG w/ PLT) yields the best performance on all three datasets, outperforming previous state-of-the-art models. On the Social Navigation Environment and the NBA dataset, IMMA without progressive layer training (MG) still performs better than all baselines, showing the effectiveness of using multiplex attentional graph as latent structure. We visualize the prediction results of our method and the best performing baseline (RFM) in Fig. 3 on the Social Navigation Environment. Visualizations of PHASE and the NBA dataset are shown in Fig. 4 (more can be found in the Appendix). + +# 4.3 Relational Analysis and Interpretability + +To answer Q2, we conduct experiments to understand what abstractions can be extracted from the inferred multiplex attentional graph. We first compare the performance of our approach to the same set of baselines used in the previous experiment on relational inference. Intuitively, this is to evaluate how well models can answer the question "What causes an agent to behave this way?" Refer to the Appendix for details on how we calculate the graph accuracy. We conduct this experiment in the Social Navigation Environment and PHASE, since we have access to the ground-truth social interaction graph for these two environments. + +IMMA more accurately estimates the underlying social interaction graph (Table 2). The results can also explain the benefits of training IMMA with PLT: by leveraging the graph accuracy prediction that arises from using a single graph layer, but with the expressive power of a full multiplex graph. + +To further understand how IMMA uses the inferred social graph, we assess how the trajectory predictions are altered if we manually manipulate the latent graph. More formally, we ask our decoder to generate new trajectories conditioned on the new latent graph $p_{\theta}(\mathbf{X}^{T_h + 1:T_h + T_f}|\mathbf{X}^{1:T_h},\mathbf{z}^{\mathrm{new}})$ . In Fig. 5, we see that with IMMA, changing the leader of an agent clearly alters the predicted trajectory to target that new leader while keeping the predictions for other agents intact, whereas the generated trajectories of the baseline consist of unrealistic turns (red agent 0) and the predicted trajectories of other agents deteriorates at the same time. Using the trajectories shown in Fig. 5, we ran a human study and our model's prediction is judged as more reasonable than the RFM model's in $76.67\%$ of the trials. Find more details of the human study in Appendix section C. + +# 4.4 Ablation Study + +To answer Q3, we experiment with three ablated versions of our model. We ensure that all ablated versions have around the same amount of total parameters and have two layers of latent graphs. Additionally, we measure the information dependency between the two layers of latent graph with Normalized Mutual Information (NMI) score (details in the Appendix). Results are shown in Table 3. The first column in the table shows the performance of a model where the latent graph structure are edge types between all pairs of agents. It has an NMI score of 1.0 (complete dependency) because the second layer of latent graph is simply one minus the first layer of latent graph. We observe that the biggest gain arose from using a multiplex attention graph and Progressive Layer Training furthers the performance. We also see that both components contribute to decreased information dependency + +![](images/155deb43ed94f8b91ed9911b52587a42f433c021dcc1685e575880aff224ee77.jpg) +Figure 5: Conditional generation results of the RFM model and our method (IMMA w/ PLT). + +Table 3: Ablation study results. + +
Ablated versions of IMMAOurs (IMMA w/ PLT)
Multiplex Attention Graph✗✓✓✓
Disentanglement Loss [10]✗✗✓✗
Progressive Layered Training✗✗✗✓
ADE ↓0.156 ± 0.0030.148 ± 0.0040.197 ± 0.0030.139 ± 0.001
FDE ↓0.317 ± 0.0050.294 ± 0.0060.386 ± 0.0060.279 ± 0.002
Graph Acc. (%) ↑71.53 ± 0.5677.98 ± 0.1669.47 ± 0.7281.38 ± 0.29
NMI score ↓1.00.460.0420.13
+ +Table 4: Zero-shot generalization results on the Social Navigation Environment. + +
Baseline MethodsIMMA (Ours)
MetricsMLPGAT_LSTM [41]NRI [22]EvolveGraph [27]RFM (skip 1)RFM [39]fNRI [43]SGMGMG + PLT
2x speed
ADE0.303 ± 0.0060.361 ± 0.0090.269 ± 0.0050.219 ± 0.0030.209 ± 0.0020.205 ± 0.0010.206 ± 0.0030.213 ± 0.0020.197 ± 0.0030.192 ± 0.001
FDE0.632 ± 0.0110.635 ± 0.0110.485 ± 0.0090.421 ± 0.0060.418 ± 0.0050.411 ± 0.0050.410 ± 0.0010.419 ± 0.0040.389 ± 0.0060.383 ± 0.002
Graph Acc (%)-22.04 ± 0.6155.10 ± 0.1167.30 ± 0.2968.03 ± 0.4369.54 ± 0.4133.48 ± 4.5577.95 ± 0.9976.07 ± 0.2078.84 ± 0.08
2x smaller environment
ADE0.240 ± 0.0060.305 ± 0.0100.217 ± 0.0050.153 ± 0.0030.155 ± 0.0010.150 ± 0.0030.151 ± 0.0030.158 ± 0.0020.139 ± 0.0030.139 ± 0.001
FDE0.509 ± 0.0100.526 ± 0.0120.386 ± 0.0090.314 ± 0.0050.312 ± 0.0030.303 ± 0.0050.308 ± 0.0030.312 ± 0.0040.275 ± 0.0060.279 ± 0.002
Graph Acc (%)-21.94 ± 0.6257.18 ± 0.1472.08 ± 0.3969.99 ± 0.4971.66 ± 0.6433.97 ± 4.8980.60 ± 1.4478.35 ± 0.0581.38 ± 0.29
2x more agents
ADE-1.486 ± 0.2030.527 ± 0.0300.354 ± 0.0210.441 ± 0.0160.333 ± 0.0130.310 ± 0.0130.211 ± 0.0010.205 ± 0.0010.195 ± 0.001
FDE-2.538 ± 0.3131.096 ± 0.0730.988 ± 0.0380.792 ± 0.0340.762 ± 0.0380.659 ± 0.0070.435 ± 0.0020.424 ± 0.0020.406 ± 0.002
Graph Acc (%)-19.84 ± 0.3034.57 ± 0.0950.56 ± 0.1649.41 ± 0.4051.37 ± 0.6119.71 ± 3.0662.05 ± 1.3062.45 ± 0.5364.25 ± 0.34
+ +between two latent graph layers without explicitly encouraging disentanglement. Although imposing an additional loss to disentangle between two latent graph layers does yield the smallest NMI score, it comes with the trade-off of decreased forecasting accuracy as observed in other works [10, 18, 24]. + +# 4.5 Sample Efficiency and Generalization + +To answer Q4, we investigate sample efficiency and observe that our method consistently outperforms the strongest baseline (RFM) on smaller sample complexity regimes (Fig. 6). We test zero-shot generalization performance in response to three environment modifications: agents moving twice as fast (2x speed), crowding the agents into half as much space (2x smaller environment), and doubling the number of agents (2x more agents). As shown in Table 4, MG and $\mathrm{MG + PLT}$ versions of IMMA outperform the baselines in all metrics. Additionally, as shown in Appendix Table 5, the change in performance on the generalization scenarios relative to the original environment was similar to or better than the baselines in all metrics + +![](images/c4166d0c6ec3da86643679f9f5e4f4889027e056b907e3ac3a9f020e2f543f25.jpg) +Figure 6: Sample efficiency of RFM and Ours. Lower ADEs and FDEs and higher graph accuracies are better. + +![](images/1ed407a62a1b9378a45c1bde1cfabc4ad978d52dddf0d6caab287467575dfd3c.jpg) + +![](images/ce506249d3a011a40cc8f77c30a6a1aec173b87f7a87ebdd40803ea22debab90.jpg) + +# 5 Conclusion + +Multi-agent dynamics can often be complex as a result of many layers of underlying social interactions. Agents can be influenced by multiple independent types of relationships with each agent, leading to properties (such as intentionality or cooperation) that are often absent in simpler physical systems. We developed a method that uses multiplex attentional graphs as latent representations to model the dynamics that can arise from such multi-layered multi-agent interactions. Addressing key aspects of social interaction, our method consistently outperforms other state-of-the-art methods in modeling the dynamics of social multi-agent systems. We foresee minimal direct negative societal impact — please see Appendix for further discussion. Future work will extend this approach to active learning settings and investigate using our method to guide model-based reinforcement learning agents. + +# 6 Acknowledgements + +I.K. is a Merck Awardee of the Life Sciences Research Foundation, and a Wu Tsai Stanford Neurosciences Institute Interdisciplinary Scholar. This work is also in part funded by the Toyota Research Institute (TRI), the Stanford Institute for Human-Centered AI (HAI), ONR MURI N00014-22-1-2740, Meta, Salesforce, and Samsung. N.H. is further funded by the GSE Transforming Learning Accelerator. + +# References + +[1] Alexandre Alahi, Kratarth Goel, Vignesh Ramanathan, Alexandre Robicquet, Li Fei-Fei, and Silvio Savarese. Social lstm: Human trajectory prediction in crowded spaces. In IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR), pages 961–971, 2016. +[2] Mohammad Babaeizadeh, Chelsea Finn, Dumitru Erhan, Roy H Campbell, and Sergey Levine. Stochastic variational video prediction. arXiv preprint arXiv:1710.11252, 2017. +[3] Peter Battaglia, Razvan Pascanu, Matthew Lai, Danilo Jimenez Rezende, et al. Interaction networks for learning about objects, relations and physics. In Advances in Neural Information Processing Systems (NeurIPS), volume 29, 2016. +[4] Peter W Battaglia, Jessica B Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, et al. Relational inductive biases, deep learning, and graph networks. arXiv preprint arXiv:1806.01261, 2018. +[5] Yoshua Bengio, Jérôme Louradour, Ronan Collobert, and Jason Weston. Curriculum learning. In International Conference on Machine Learning (ICML), pages 41-48, 2009. +[6] Jur van den Berg, Stephen J Guy, Ming Lin, and Dinesh Manocha. Reciprocal n-body collision avoidance. In Robotics Research, pages 3-19. Springer, 2011. +[7] Defu Cao, Yujing Wang, Juanyong Duan, Ce Zhang, Xia Zhu, Congrui Huang, Yunhai Tong, Bixiong Xu, Jing Bai, Jie Tong, et al. Spectral temporal graph neural network for multivariate time-series forecasting. Advances in Neural Information Processing Systems, 33:17766-17778, 2020. +[8] Changan Chen, Sha Hu, Payam Nikdel, Greg Mori, and Manolis Savva. Relational graph learning for crowd navigation. IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pages 10007-10013, 2020. +[9] Changan Chen, Yuejiang Liu, Sven Kreiss, and Alexandre Alahi. Crowd-robot interaction: Crowd-aware robot navigation with attention-based deep reinforcement learning. In 2019 International Conference on Robotics and Automation (ICRA), pages 6015–6022. IEEE, 2019. +[10] Ricky TQ Chen, Xuechen Li, Roger B Grosse, and David K Duvenaud. Isolating sources of disentanglement in variational autoencoders. In Advances in Neural Information Processing Systems (NeurIPS), volume 31, 2018. + +[11] Nachiket Deo and Mohan M Trivedi. Convolutional social pooling for vehicle trajectory prediction. In IEEE Conference on Computer Vision and Pattern Recognition Workshops, pages 1468-1476, 2018. +[12] Colin Graber and Alexander Schwing. Dynamic neural relational inference for forecasting trajectories. In IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops, pages 1018-1019, 2020. +[13] Agrim Gupta, Justin Johnson, Li Fei-Fei, Silvio Savarese, and Alexandre Alahi. Social gan: Socially acceptable trajectories with generative adversarial networks. In IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR), pages 2255–2264, 2018. +[14] Zaynab Hammoud and Frank Kramer. Multilayer networks: aspects, implementations, and application in biomedicine. Big Data Analytics, 5(1):1-18, 2020. +[15] Sandro Hauri, Nemanja Djuric, Vladan Radosavljevic, and Slobodan Vucetic. Multi-modal trajectory prediction of nba players. In IEEE/CVF Winter Conference on Applications of Computer Vision, pages 1640-1649, 2021. +[16] Fritz Heider and Marianne Simmel. An experimental study of apparent behavior. The American Journal of Psychology, 57(2):243-259, 1944. +[17] Dirk Helbing and Peter Molnar. Social force model for pedestrian dynamics. Physical review E, 51(5):4282, 1995. +[18] Irina Higgins, Loic Matthew, Arka Pal, Christopher Burgess, Xavier Glorot, Matthew Botvinick, Shakir Mohamed, and Alexander Lerchner. beta-VAE: Learning basic visual concepts with a constrained variational framework. In International Conference on Learning Representations (ICLR), 2017. +[19] Yingfan Huang, Huikun Bi, Zhaoxin Li, Tianlu Mao, and Zhaoqi Wang. Stgat: Modeling spatial-temporal interactions for human trajectory prediction. In IEEE/CVF International Conference on Computer Vision (ICCV), pages 6272-6281, 2019. +[20] Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of GANs for improved quality, stability, and variation. arXiv preprint arXiv:1710.10196, 2017. +[21] Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013. +[22] Thomas N. Kipf, Ethan Fetaya, Kuan-Chieh Wang, Max Welling, and Richard S. Zemel. Neural relational inference for interacting systems. In International Conference on Machine Learning (ICML), pages 2693-2702, 2018. +[23] Hoang M Le, Yisong Yue, Peter Carr, and Patrick Lucey. Coordinated multi-agent imitation learning. In International Conference on Machine Learning, pages 1995-2003. PMLR, 2017. +[24] José Lezama. Overcoming the disentanglement vs reconstruction trade-off via jacobian supervision. In International Conference on Learning Representations, 2018. +[25] Jiachen Li, Hengbo Ma, and Masayoshi Tomizuka. Conditional generative neural system for probabilistic trajectory prediction. In IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pages 6150-6156. IEEE, 2019. +[26] Jiachen Li, Hengbo Ma, Zhihao Zhang, Jinning Li, and Masayoshi Tomizuka. Spatio-temporal graph dual-attention network for multi-agent prediction and tracking. IEEE Transactions on Intelligent Transportation Systems, 2021. +[27] Jiachen Li, Fan Yang, Masayoshi Tomizuka, and Chiho Choi. Evolvegraph: Multi-agent trajectory prediction with dynamic relational reasoning. Advances in Neural Information Processing Systems (NeurIPS), 33:19783-19794, 2020. +[28] Zhiyuan Li, Jaideep Vitthal Murkute, Prashnna Kumar Gyawali, and Linwei Wang. Progressive learning and disentanglement of hierarchical representations. arXiv preprint arXiv:2002.10549, 2020. + +[29] Abduallah Mohamed, Kun Qian, Mohamed Elhoseiny, and Christian Claudel. Social-stgcnn: A social spatio-temporal graph convolutional neural network for human trajectory prediction. In IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR), pages 14424-14432, 2020. +[30] Aviv Netanyahu, Tianmin Shu, Boris Katz, Andrei Barbu, and Joshua B Tenenbaum. Phase: Physically-grounded abstract social events for machine social perception. In AAAI Conference on Artificial Intelligence (AAAI), pages 845-853, 2021. +[31] Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in pytorch. In Advances in Neural Information Processing Systems (NeurIPS) Workshop, 2017. +[32] David Premack and Guy Woodruff. Does the chimpanzee have a theory of mind? Behavioral and Brain Sciences, 1(4):515-526, 1978. +[33] Neil Rabinowitz, Frank Perbet, Francis Song, Chiyuan Zhang, SM Ali Eslami, and Matthew Botvinick. Machine theory of mind. In International Conference on Machine Learning (ICML), pages 4218-4227. PMLR, 2018. +[34] Andrey Rudenko, Luigi Palmieri, Michael Herman, Kris M Kitani, Dariu M Gavrila, and Kai O Arras. Human motion trajectory prediction: A survey. International Journal of Robotics Research, 39(8):895-935, 2020. +[35] Tim Salzmann, Boris Ivanovic, Punarjay Chakravarty, and Marco Pavone. Trajectory++: Dynamically-feasible trajectory forecasting with heterogeneous data. In European Conference on Computer Vision, pages 683-700, 2020. +[36] Alvaro Sanchez-Gonzalez, Jonathan Godwin, Tobias Pfaff, Rex Ying, Jure Leskovec, and Peter Battaglia. Learning to simulate complex physics with graph networks. In International Conference on Machine Learning (ICML), pages 8459-8468. PMLR, 2020. +[37] Wenling Shang, Alex Trott, Stephan Zheng, Caiming Xiong, and Richard Socher. Learning world graphs to accelerate hierarchical reinforcement learning. arXiv preprint arXiv:1907.00664, 2019. +[38] Kihyuk Sohn, Honglak Lee, and Xinchen Yan. Learning structured output representation using deep conditional generative models. In Advances in Neural Information Processing Systems (NeurIPS), 2015. +[39] Andrea Tacchetti, H. Francis Song, Pedro A. M. Mediano, Vinicius Zambaldi, János Kramár, Neil C. Rabinowitz, Thore Graepel, Matthew Botvinick, and Peter W. Battaglia. Relational forward models for multi-agent learning. In International Conference on Learning Representations (ICLR), 2019. +[40] Annemarie Turnwald and Dirk Wollherr. Human-like motion planning based on game theoretic decision making. International Journal of Social Robotics, 11(1):151-170, 2019. +[41] Petar Velickovic, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua Bengio. Graph attention networks. arXiv preprint arXiv:1710.10903, 2017. +[42] Anirudh Vemula, Katharina Muelling, and Jean Oh. Social attention: Modeling attention in human crowds. In IEEE International Conference on Robotics and Automation (ICRA), pages 4601-4607. IEEE, 2018. +[43] Ezra Webb, Ben Day, Helena Andres-Terre, and Pietro Lió. Factorised neural relational inference for multi-interaction systems. arXiv preprint arXiv:1905.08721, 2019. +[44] William Whitney. Disentangled representations in neural models. arXiv preprint arXiv:1602.02383, 2016. +[45] Amanda L Woodward, Jessica A Sommerville, Sarah Gerson, Annette ME Henderson, and Jennifer Buresh. The emergence of intention attribution in infancy. Psychology of Learning and Motivation, 51:187-222, 2009. + +[46] Eiling Yee. Abstraction and concepts: when, how, where, what and why? Language, Cognition and Neuroscience, 34(10):1257-1265, 2019. +[47] Eric Zhan, Stephan Zheng, Yisong Yue, Long Sha, and Patrick Lucey. Generating multi-agent trajectories using programmatic weak supervision. arXiv preprint arXiv:1803.07612, 2018. +[48] Lunjun Zhang, Ge Yang, and Bradly C Stadie. World model as a graph: Learning latent landmarks for planning. In International Conference on Machine Learning (ICML), pages 12611-12620, 2021. +[49] Stephan Zheng, Yisong Yue, and Jennifer Hobbs. Generating long-term trajectories using deep hierarchical networks. In Advances in Neural Information Processing Systems (NeurIPS), volume 29, 2016. \ No newline at end of file diff --git a/interactionmodelingwithmultiplexattention/images.zip b/interactionmodelingwithmultiplexattention/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..b7d73241a589376d1416a2799036264f5b328814 --- /dev/null +++ b/interactionmodelingwithmultiplexattention/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5fa0c8d70e8c86752693faa1e146bf11afa35cd261695327c0c518b130b74026 +size 505811 diff --git a/interactionmodelingwithmultiplexattention/layout.json b/interactionmodelingwithmultiplexattention/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..fa02765db9368fcde0734b5f8421c7156f9926d2 --- /dev/null +++ b/interactionmodelingwithmultiplexattention/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bb0ed5fe7c5acd20ea5b52d75fe9163ef556152361845c72bec0fc17ec262149 +size 338200 diff --git a/intermediateprototypeminingtransformerforfewshotsemanticsegmentation/7ff6dd83-d2ca-4835-98d9-349716cb91ed_content_list.json b/intermediateprototypeminingtransformerforfewshotsemanticsegmentation/7ff6dd83-d2ca-4835-98d9-349716cb91ed_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..4effd340db7f9b03cc607de589ab5be68cbb822b --- /dev/null +++ b/intermediateprototypeminingtransformerforfewshotsemanticsegmentation/7ff6dd83-d2ca-4835-98d9-349716cb91ed_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3040cfdca2456535951a8a39a41d2881c9ac8246bd16740b5d257ea20db598c1 +size 82761 diff --git a/intermediateprototypeminingtransformerforfewshotsemanticsegmentation/7ff6dd83-d2ca-4835-98d9-349716cb91ed_model.json b/intermediateprototypeminingtransformerforfewshotsemanticsegmentation/7ff6dd83-d2ca-4835-98d9-349716cb91ed_model.json new file mode 100644 index 0000000000000000000000000000000000000000..3c7d44d6ab7d2ec63d9898a486217a274b099144 --- /dev/null +++ b/intermediateprototypeminingtransformerforfewshotsemanticsegmentation/7ff6dd83-d2ca-4835-98d9-349716cb91ed_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fe2e5e447f1d106a9607e196535a2692397f4deb878693e20d79ede74997f7ff +size 102381 diff --git a/intermediateprototypeminingtransformerforfewshotsemanticsegmentation/7ff6dd83-d2ca-4835-98d9-349716cb91ed_origin.pdf b/intermediateprototypeminingtransformerforfewshotsemanticsegmentation/7ff6dd83-d2ca-4835-98d9-349716cb91ed_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..4eacba0327ac3e8099fa9be6c78f5b28d570c367 --- /dev/null +++ b/intermediateprototypeminingtransformerforfewshotsemanticsegmentation/7ff6dd83-d2ca-4835-98d9-349716cb91ed_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:db6b38df88fd83d4c37418b9c5bc15215cf14309c032736ea1ec9e0e63d6d141 +size 14789022 diff --git a/intermediateprototypeminingtransformerforfewshotsemanticsegmentation/full.md b/intermediateprototypeminingtransformerforfewshotsemanticsegmentation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..0a8d10559186064ae86739abc75533411dda7194 --- /dev/null +++ b/intermediateprototypeminingtransformerforfewshotsemanticsegmentation/full.md @@ -0,0 +1,336 @@ +# Intermediate Prototype Mining Transformer for Few-Shot Semantic Segmentation + +Yuanwei Liu $^{1*}$ Nian Liu $^{2*}$ Xiwen Yao $^{1}$ Junwei Han $^{1\dagger}$ + +1Northwestern Polytechnical University + +$^{2}$ Mohamed bin Zayed University of Artificial Intelligence + +{liuyuanwei9809, liunian228, yaoxiwen517, junweihan2010}@gmail.com + +# Abstract + +Few-shot semantic segmentation aims to segment the target objects in query under the condition of a few annotated support images. Most previous works strive to mine more effective category information from the support to match with the corresponding objects in query. However, they all ignored the category information gap between query and support images. If the objects in them show large intraclass diversity, forcibly migrating the category information from the support to the query is ineffective. To solve this problem, we are the first to introduce an intermediate prototype for mining both deterministic category information from the support and adaptive category knowledge from the query. Specifically, we design an Intermediate Prototype Mining Transformer (IPMT) to learn the prototype in an iterative way. In each IPMT layer, we propagate the object information in both support and query features to the prototype and then use it to activate the query feature map. By conducting this process iteratively, both the intermediate prototype and the query feature can be progressively improved. At last, the final query feature is used to yield precise segmentation prediction. Extensive experiments on both PASCAL-5 $^i$ and COCO-20 $^i$ datasets clearly verify the effectiveness of our IPMT and show that it outperforms previous state-of-the-art methods by a large margin. Code is available at https://github.com/LIUYUANWEI98/IPMT + +# 1 Introduction + +Recent great progress on computer vision rely heavily on a large amount of annotated data, the collecting of which is a time-consuming and labor-intensive work. To solve this problem, few-shot learning is proposed to learn a model that can be generalized to novel categories with only a few annotated images. This setting is also closer to human learning habits which can learn knowledge from scarce annotated examples and identify new categories quickly. + +In this paper, we focus on the few-shot semantic segmentation (FSS) task which aims to segment novel objects in the query image with a few annotated support samples. Currently, a lot of works have been proposed for FSS and many of them are based on prototype learning. These methods [39, 28, 12] extract prototypes from the support set to represent the category information and then match them with the query features in a matching network to perform segmentation. Other graph-based methods [38, 30, 35] and transformer-based methods [19, 40] share the similar high-level idea to convey the category information from the support set to the query image. + +However, these methods all rely heavily on the category information extracted from the support set. Although it provides deterministic category information guidance, there may exist inherent + +![](images/43a9ddd6389dfa7e65e8faef00bcb3ce2af7c4aa7f73c89c99960508002e4e9c.jpg) +Figure 1: t-SNE visualization of the prototype distribution. (a): The distribution of support and query prototypes. (b): The distribution of intermediate and query prototypes. Our proposed intermediate prototypes are closer to the query than the support prototypes. + +intra-class diversity between query and support samples, which is collectively ignore by existing works. In Figure 1 (a), we show the distribution of some support prototypes (in orange) and the prototype generated from a query image (in magenta) of the airplane class. We observe that for the support images that are similar with the query image (marked as "Similar support" on the right), their prototypes are close to the query prototype in the feature space, in which case the matching network can work well. However, for the support images that have large diversity in pose and appearance compared with the query (marked as "Diverse support" on the left), the distance between the support and query prototypes will be faraway. In such a case, if we forcibly migrate the category information in the support prototype to the query, a large category information bias is inevitably introduced. + +Therefore, our work aims to relieve this problem by introducing an intermediate prototype that could bridge the category information gap between query and support images through our proposed Intermediate Prototype Mining Transformer (IPMT). Each IPMT layer consists of two steps, i.e., Intermediate Prototype Mining (IPM) and Query Activation (QA). In IPM we learn the intermediate prototype via combing both the deterministic category information from the support images and the adaptive category knowledge from the query image. Then, we use the learned prototype to activate the query feature map in QA. Furthermore, our IPMT is used in an iterative way to progressively improve the quality of the learned prototype and the activated query feature. As such, the intermediate prototype can successfully reduce the category information gap with the query set, which is verified by the distribution in Figure 1 (b). + +In summary, our main contributions can be concluded as: 1) To the best of our knowledge, this is the first time to focus on the intra-class diversity between support and query in FSS, and we propose the idea of intermediate prototype to relieve the existing category information gap issue. 2) We propose a novel IPMT to explicitly mine the intermediate prototype which contains both the deterministic information from the support set and the adaptive category knowledge from the query. 3) We present an iterative learning scheme to fully explore the intermediate category information hidden in both support and query and update the query feature. 4) Extensive experiments on PASCAL-5 $^i$ and COCO-20 $^i$ show that our proposed IPMT brings a significant improvement over state-of-the-art methods. + +# 2 Related Work + +# 2.1 Visual Transformer + +Recently, transformer is introduced into the field of artificial intelligence and has attracted significant attention from many researchers. [29] first proposes the transformer architecture composed of self-attention and feed-forward layers, and also achieves remarkable performance in natural language processing. Very recently, transformer has been found to be able to obtain excellent results in computer vision. Specifically, [5] firstly introduces transformer into vision tasks and proposes vision transformer (ViT) by treating non-overlapped image patches as a series of tokens. Subsequently, a lot of works are devoted to tailoring the transformer structure to be more suitable for computing vision tasks. [18] utilizes shifted window self-attention and patch merging to reduce the computational cost and aggregate features, respectively. [33] imitates the feature pyramid structure in CNNs and proposes the pyramid vision transformer, which reduces the computational cost of self-attention. + +Other transformer-based methods are proposed for various tasks, such as object detection[42, 3], semantic segmentation[41], panoptic segmentation[31], multiple object tracking[27] and so on. [3] proposes an transformer-based end-to-end object detection framework and utilizes object queries to locate the objects. [7] replaces the multi-head attention with twin attention to interact with the context both on row and column features for instance segmentation. In the above works, learnable $\text{Queries}^*$ are utilized to aggregate the context-information from feature maps for further regression or segmentation. [4] introduces the masked attention to extract relevant features instead of global features by limiting the cross-attention regions within predicted masks. Motivated by these works, we use a learnable prototype as the intermediate prototype to dig out adaptive category information from both query and support images. + +# 2.2 Few-shot Semantic Segmentation + +FSS is a natural extension of semantic segmentation in the condition of a few annotated samples. The typical paradigm proposed by SG-one [25] is using two-branch networks. A conditioning branch extracts the category context from the support images and another segmentation branch segments the query image under the guidance of the former. Following this paradigm, many approaches [36, 12, 37, 14, 28, 34] are proposed to explore how to fully excavate the category information from the support images. For mining more abundant category information from the support images, ASGNet[36] and PMM[12] construct multiple prototypes using parameter-free methods, i.e. superpixel-guided clustering and the expectation-maximum algorithm, to cluster the support foreground features into multiple prototypes and then activate different areas in the query image. SCL[37] utilizes the missing parts in the initial segmentation result of the support images to form auxiliary support vectors and then merge them in a cross-guidance module to obtain a better prediction. In PFENet[28], a prior mask is generated by calculating the cosine-similarity between support and query features in high-level. Then, a feature enrichment module is applied to perform dense comparison on different feature scales obtained by adaptive pooling. Furthermore, MMNet[34] introduces meta-class memory to store the meta-information during training and applies it into novel classes during the inference stage. However, all above methods ignore the inherent intra-class differences between query and support images and transfer the support information to the query image forcibly. Our work aims to relieve this problem and propose the intermediate prototype to bridge the category information gap between query and support images. + +# 2.3 Transformer-based Few-shot Semantic Segmentation + +[19] introduces the multi-head attention as an attention module to transfer the classifier weights from support to query. However, it does not take full advantage of the transformer on incorporating long-range dependencies. [40] proposes a Cycle-Consistent TRansformer (CyCTR) module to select relevant pixel-level support features to perform cross-attention with the query feature. In our work, instead of performing cross-attention between support and query features, we leverage a learnable Query as the intermediate prototype to aggregate the category information from both support and query images and refine the query feature using this prototype. + +# 3 Problem Definition + +In FSS, the whole dataset is divided into two disjoint subsets $\mathcal{D}_{train}$ and $\mathcal{D}_{test}$ based on the object categories they contain. An FSS model is expected to learn the meta knowledge on $\mathcal{D}_{train}$ with sufficient labeled images and generalize to unseen categories on $\mathcal{D}_{test}$ with scarce labeled images. Following the previous meta-learning paradigm, we execute the episodic training strategy to train our model. Specifically, these two subsets are both partitioned into numerous episodes, each of which randomly samples $K + 1$ image-mask pairs. For one episode, $K$ pairs compose the support set $S = \{(\mathbf{I}_{\mathbf{i}}^{\mathbf{s}},\mathbf{M}_{\mathbf{i}}^{\mathbf{s}})\}_{i = 1}^{K}$ and the rest one pair composes the query set $\mathcal{Q} = \{(\mathbf{I}^{\mathbf{q}},\mathbf{M}^{\mathbf{q}})\}$ , where $\mathbf{I}^{*}\in \mathbb{R}^{H\times W\times 3}$ and $\mathbf{M}^{*}\in \mathbb{R}^{H\times W}$ denote the RGB images and their corresponding binary masks, respectively. In each episode sampled from $\mathcal{D}_{train}$ , the model is trained to predict the query mask supervised by $\mathbf{M}^{\mathbf{q}}$ under the guidance of the support set. Then, the trained model is evaluated on $\mathcal{D}_{test}$ to segment unseen categories straightly without any further optimization. + +# 4 A Review of Transformer + +We first review the typical transformer model here. As the form in [29], a transformer layer mainly consists of an attention block and a multi-layer perception (MLP) block. The former is used to aggregate global contexts and the latter performs embedding updating. + +Attention Block. Given an input token sequence $\mathbf{X} \in \mathbb{R}^{L_1 \times C}$ and a context token sequence $\mathbf{Y} \in \mathbb{R}^{L_2 \times C}$ , where $L_1, L_2$ are the length of the two sequences and $C$ is the channel dimension of their embeddings, respectively, the attention block first computes the attention weight matrix: + +$$ +\mathbf {A} (\mathbf {X}, \mathbf {Y}) = \frac {\mathbf {X W} _ {\mathbf {q}} (\mathbf {Y W} _ {\mathbf {k}}) ^ {\top}}{\sqrt {d}}, \tag {1} +$$ + +where $\mathbf{W}_{\mathbf{q}}$ and $\mathbf{W}_{\mathbf{k}} \in \mathbb{R}^{C \times d}$ are linear transformation weight matrices and $\sqrt{d}$ is the scale factor. Then, $\mathbf{A}(\mathbf{X}, \mathbf{Y})$ is normalized and then used to aggregate the global context from $\mathbf{Y}$ : + +$$ +\mathbf {A} \operatorname {t t n} (\mathbf {X}, \mathbf {Y}) = \operatorname {S o f t m a x} (\mathbf {A} (\mathbf {X}, \mathbf {Y})) \mathbf {Y} \mathbf {W} _ {\mathbf {v}}, \tag {2} +$$ + +where $\mathbf{W}_v\in \mathbb{R}^{C\times C}$ is another linear transformation weight matrix. + +If $\mathbf{X}$ , $\mathbf{Y}$ are the same feature, the attention operation is called self-attention which propagates contexts among different tokens. If they are not the same, it is named cross-attention which conveys relevant information from $\mathbf{Y}$ to $\mathbf{X}$ . Usually multi-head attention [29] is used to boost the model performance. + +Multi-layer Perception Block. After the attention block, a MLP block is applied to each token separately and identically to further transform the token embeddings. Specifically, MLP is implemented using two linear projection layers with a ReLU activation in between. Given a token sequence $\mathbf{X} \in \mathbb{R}^{L_1 \times C}$ as the input, it is formulated as: + +$$ +\mathbf {M L P} (\mathbf {X}) = \operatorname {R e L U} \left(\mathbf {X} \mathbf {W} _ {1} + \mathbf {b} _ {1}\right) \mathbf {W} _ {2} + \mathbf {b} _ {2}, \tag {3} +$$ + +where $\mathbf{W}_{*}$ and $\mathbf{b}_{*}$ denote the linear transformation weight matrixes and biases, respectively. We follow [29] and set the channel dimensions of the first and the second layer to be $4C$ and $C$ , respectively. Note that layer normalization [1] and residual connections are omitted here for simplicity. + +# 5 Intermediate Prototype Mining Transformer + +We now present our proposed Intermediate Prototype Mining Transformer (IPMT), as Figure 2 shown, for few-shot semantic segmentation. Each IPMT layer consists of two steps, i.e., Intermediate Prototype Mining (IPM) and Query Activation (QA). IPM is used to mine the intermediate prototype from both support and query features while QA is designed to activate the query feature map using the learned prototype. We adopt a duplex segmentation loss (DSL) to supervise the learning of the intermediate prototype in each IPMT layer. Furthermore, we propose to perform the intermediate prototype mining in an iterative way, thus boosting the quality of the learned prototype and the segmentation results progressively. Next, we will describe them in details. + +# 5.1 Intermediate Prototype Mining + +Our IPM has a learnable prototype $\mathbf{G}$ to extract adaptive category information from both query and support images using Masked Attention (MA). The prototype $\mathbf{G} \in \mathbb{R}^{1 \times C}$ is initially a category- and image-agnostic vector that encodes general segmentation prior and will be updated by MA in each episode, encoding adaptive category information for the target category in that episode. + +Masked Attention. We leverage cross-attention to update $\mathbf{G}$ by using both support and query features as the context. Furthermore, to make $\mathbf{G}$ only focus on the target regions and extract the category information without noises, we follow [4] and use support and query masks to limit the attended region in the attention matrix. Specifically, given a flattened support or query feature $\mathbf{F} \in \mathbb{R}^{hw \times C}$ and a corresponding binary segmentation mask $\mathbf{P} \in \mathbb{R}^{h \times w}$ , we first compute the attention weight matrix $\mathbf{A}(\mathbf{G}, \mathbf{F}) \in \mathbb{R}^{1 \times hw}$ . Then, an attention mask is computed by following [4]: + +$$ +\hat {\mathbf {P}} (i) = \left\{ \begin{array}{c c} 0 & \text {i f} \mathbf {P} (i) = 1 \\ - \infty & \text {o t h e r w i s e} \end{array} , \right. \tag {4} +$$ + +where $i$ denotes the location index. Next, we use $\hat{\mathbf{P}}$ to modulate the attention weights, leading to the masked attention: + +$$ +\mathbf {M a s k A t t n} (\mathbf {G}, \mathbf {F}, \mathbf {P}) = S o f t m a x (\mathbf {A} (\mathbf {G}, \mathbf {F}) + \mathbf {V e c} (\hat {\mathbf {P}})) \mathbf {F W} _ {\mathbf {v}}, \tag {5} +$$ + +![](images/1a03f7c12e781436f8e5a01d5673c543dbbf4cdce19523c65c47ed89dfaf994c.jpg) +Figure 2: Overall architecture of our proposed IPMT. Support and query images are first fed into two pre-trained backbone encoders to extract features. Then, we follow previous works [28, 40] and conduct prototype activation (PA) to obtain the support and initial query features $\mathbf{F}^{\mathrm{s}}$ and $\mathbf{F}_0^{\mathbf{q}}$ , respectively. Meanwhile, the initial query segmentation mask $\mathbf{P}_0^{\mathbf{q}}$ is obtained from $\mathbf{F}_0^{\mathbf{q}}$ . Next, we feed $\mathbf{F}^{\mathrm{s}}$ , $\mathbf{F}_0^{\mathbf{q}}$ , $\mathbf{P}_0^{\mathbf{q}}$ , and the support mask $\mathbf{M}^s$ , the initial intermediate prototype $\mathbf{G}_0$ into our IPMT layers to iteratively update the prototype, the query mask, and the query feature. After $L$ iterations, the final query feature $\mathbf{F}_L^{\mathbf{q}}$ is used to obtain the final query segmentation result. + +where $\mathbf{Vec}(\cdot)$ is the vectorization operation. As such, the normalized attention weights on the background regions are close to zero, making sure the prototype only be updated by relevant contexts of the desired category. + +In our IPM, on one hand, we use the support feature $\mathbf{F}^{\mathrm{s}}$ and the ground-truth support mask $\mathbf{M}^{\mathrm{s}}$ to update $\mathbf{G}$ , providing deterministic category information since $\mathbf{M}^{\mathrm{s}}$ is definitely accurate. On the other hand, we also leverage the query feature $\mathbf{F}^{\mathrm{q}}$ and a query prediction mask $\mathbf{P}^{\mathrm{q}}$ to provide query-adaptive category knowledge for $\mathbf{G}$ , thus reducing the category information gap between support and query images. After that, an MLP block is further used on the learned prototype. The whole process can be formulated as: + +$$ +\mathbf {I P M} (\mathbf {G}, \mathbf {F} ^ {\mathrm {s}}, \mathbf {F} ^ {\mathrm {q}}, \mathbf {M} ^ {\mathrm {s}}, \mathbf {P} ^ {\mathrm {q}}) = \mathbf {M L P} (\mathbf {M a s k A t t n} (\mathbf {G}, \mathbf {F} ^ {\mathrm {s}}, \mathbf {M} ^ {\mathrm {s}}) + \mathbf {M a s k A t t n} (\mathbf {G}, \mathbf {F} ^ {\mathrm {q}}, \mathbf {P} ^ {\mathrm {q}}) + \mathbf {G}). \tag {6} +$$ + +Please note that the two masked attention operations do not share weights since the two segmentation masks have different uncertainty. For the $K$ -shot setting, we simply average the outputs of MaskAttn on support. + +# 5.2 Query Activation + +In this step, QA is used to activate the target regions in the query feature map $\mathbf{F}^{\mathbf{q}}$ under the guidance of the learned prototype $\mathbf{G}$ . Previous works [28, 39] have demonstrated that it is an essential operation for FSS to pass the category information to the query feature map and provide specific segmentation cues. Specifically, $\mathbf{G}$ is expanded and concatenated with $\mathbf{F}^{\mathbf{q}} \in \mathbb{R}^{h \times w \times C}$ to activate the target regions: + +$$ +\mathbf {Q A} (\mathbf {G}, \mathbf {F} ^ {\mathbf {q}}) = \mathcal {F} _ {a c t v} (\mathbf {G} \odot \mathbf {F} ^ {\mathbf {q}}), \tag {7} +$$ + +where $\odot$ represents the concatenation operation, and $\mathcal{F}_{actv}$ is a simple activation network which consists of a $1\times 1$ convolutional layer, a ReLU layer, and a $3\times 3$ convolutional layer. Additionally, we also follow [40] to use a multi-head deformable self-attention layer [42] for further aggregating context information in the query feature. + +# 5.3 Duplex Segmentation Loss + +To facilitate the learning of the adaptive category information in $\mathbf{G}$ , we use it to generate two segmentation masks on both support and query images and calculate two segmentation losses. Specifically, motivated by [4], we use $\mathbf{G}$ to generate a mask embedding and then conduct multiplication with the image feature maps for obtaining segmentation masks. The mask generation (MG) process is formulated as: + +$$ +\mathbf {M G} (\mathbf {G}, \mathbf {F} ^ {\mathbf {q}}) = \operatorname {S i g m o i d} \left(\mathbf {G W} _ {\mathbf {m}} \left(\mathbf {F} ^ {\mathbf {q}}\right) ^ {\top}\right), \tag {8} +$$ + +$$ +\mathbf {M G} (\mathbf {G}, \mathbf {F} ^ {\mathbf {s}}) = \operatorname {S i g m o i d} \left(\mathbf {G} \mathbf {W} _ {\mathbf {m}} \left(\mathbf {F} ^ {\mathbf {s}}\right) ^ {\top}\right), \tag {9} +$$ + +where $\mathbf{W}_{\mathbf{m}}\in \mathbb{R}^{C\times C}$ is a linear projection weight matrix for generating the mask embedding. + +Next, the standard binary cross-entropy (BCE) loss is calculated between the generated masks and the ground truth, i.e., $\mathbf{M}^{\mathbf{q}}$ and $\mathbf{M}^{\mathbf{s}}$ , as our duplex segmentation loss to optimize the prototype learning process: + +$$ +\mathcal {L} ^ {d s l} = \alpha B C E (\mathbf {M G} (\mathbf {G}, \mathbf {F} ^ {\mathbf {q}}), \mathbf {M} ^ {\mathbf {q}}) + (1 - \alpha) B C E (\mathbf {M G} (\mathbf {G}, \mathbf {F} ^ {\mathbf {s}}), \mathbf {M} ^ {\mathbf {s}}). \tag {10} +$$ + +Here, $\alpha$ is a hyperparameter to balance the losses between query and support predictions. + +# 5.4 Iterative Prototype Mining + +Since one IPMT layer can update the intermediate prototype $\mathbf{G}$ , the query feature map $\mathbf{F}^{\mathbf{q}}$ , and the query segmentation mask $\mathbf{P}^{\mathbf{q}}$ , we can iteratively perform this process and obtain better and better $\mathbf{G}$ and $\mathbf{F}^{\mathbf{q}}$ , finally making the segmentation results effectively boosted. Suppose we have $L$ iterative IPMT layers, then for each layer $l$ we have: + +$$ +\mathbf {G} _ {l}, \mathbf {F} _ {l} ^ {\mathbf {q}}, \mathbf {P} _ {l} ^ {\mathbf {q}} = \operatorname {I P M T} \left(\mathbf {G} _ {l - 1}, \mathbf {F} ^ {\mathbf {s}}, \mathbf {F} _ {l - 1} ^ {\mathbf {q}}, \mathbf {M} ^ {\mathbf {s}}, \mathbf {P} _ {l - 1} ^ {\mathbf {q}}\right), \tag {11} +$$ + +which can be broken down into the following steps: + +$$ +\mathbf {G} _ {l} = \mathbf {I P M} \left(\mathbf {G} _ {l - 1}, \mathbf {F} ^ {\mathbf {s}}, \mathbf {F} _ {l - 1} ^ {\mathbf {q}}, \mathbf {M} ^ {\mathbf {s}}, \mathbf {P} _ {l - 1} ^ {\mathbf {q}}\right), \tag {12} +$$ + +$$ +\mathbf {F} _ {l} ^ {\mathbf {q}} = \mathbf {Q} \mathbf {A} \left(\mathbf {G} _ {l}, \mathbf {F} _ {l - 1} ^ {\mathbf {q}}\right), \tag {13} +$$ + +$$ +\mathbf {P} _ {l} ^ {\mathbf {q}} = \mathbf {M G} \left(\mathbf {G} _ {l}, \mathbf {F} _ {l - 1} ^ {\mathbf {q}}\right) \geq 0. 5. \tag {14} +$$ + +Here, since the masked attention requires a binary mask as the input, we use 0.5 as the threshold to generate $\mathbf{P}_l^{\mathbf{q}}$ . + +# 6 Few-shot Semantic Segmentation Model + +Following previous works [28, 40], we input query and support images into a fixed and shared encoder backbone such as the ResNet family [9] to obtain multi-level features. Then, we concatenate the outputs of the third and fourth encoder blocks together and then adopt a $1 \times 1$ convolutional layer to generate middle-level query and support features, respectively. We also calculate the similarity between the high-level query and support features at the fifth encoder block to produce a prior mask and use masked average pooling on the support feature map to obtain a support prototype. Next, the query feature map, prior mask, and the expanded prototype are concatenated and transformed using a $1 \times 1$ convolutional layer to obtain the initial query feature $\mathbf{F}_0^{\mathbf{q}}$ . We also concatenate the middle-level support feature with the expanded prototype to generate the support feature $\mathbf{F}^{\mathbf{s}}$ . All the above processes are common methods in FSS and termed prototype activation (PA) in Figure 2. For more details please refer to [28]. + +As for the iterative learning, we feed $\mathbf{F}_0^{\mathbf{q}}$ into two convolutional layers to obtain the initial query segmentation prediction $\mathbf{P}_0^{\mathbf{q}}$ . The initial intermediate prototype $\mathbf{G}_0$ is randomly initialized at the beginning of the training and then optimized on the training set. Next, we feed $\mathbf{G}_0, \mathbf{F}^{\mathbf{s}}, \mathbf{F}_0^{\mathbf{q}}, \mathbf{M}^{\mathbf{s}}$ , and $\mathbf{P}_0^{\mathbf{q}}$ into our iterative IPMT layers to perform intermediate prototype mining. After $L$ iterations, the final activated query feature $\mathbf{F}_L^{\mathbf{q}}$ is used to predict the final segmentation result via two convolutional layers. The dice loss [20] is used here to optimize the training of the whole model. + +Table 1: Class mIoU results of four folds on PASCAL-5 $^i$ . The results of 'Mean' are the averaged class mIoU scores of all four folds. Red/Blue indicates the best/2 $^{nd}$ results. + +
BackboneMethods1-shot5-shot
Fold-0Fold-1Fold-2Fold-3MeanFold-0Fold-1Fold-2Fold-3Mean
ResNet-50RPMMs(ECCV'20)[36]55.266.952.650.756.356.367.354.551.057.3
PFENet(TPAMI'20)61.769.555.456.360.863.170.755.857.961.9
RePRI(CVPR'21)[2]59.868.362.148.559.764.671.471.159.366.6
HSNet(ICCV'21)[21]64.370.760.360.564.070.373.267.467.169.5
CWT(ICCV'21)[19]56.362.059.947.256.461.368.568.556.663.7
CyCTR(NeurIPS'21)[40]65.771.059.559.764.069.373.563.863.567.5
NERTNet(CVPR'22)[16]65.472.359.459.864.266.272.861.762.265.7
DCP(IJCAI'22)[11]63.870.561.255.762.867.273.166.464.567.8
IPMT(ours)72.873.759.261.666.873.174.761.663.468.2
ResNet-101DAN(ECCV'20)[30]54.768.657.851.658.257.969.060.154.960.5
PFENet(TPAMI'20)[28]60.569.454.455.960.162.870.454.957.661.4
CWT(ICCV'21)[19]56.965.261.248.858.062.670.268.857.264.7
NERTNet(CVPR'22)[16]65.571.859.158.363.767.973.260.166.867.0
CyCTR(NeurIPS'21)[40]69.372.756.558.664.373.574.058.660.266.6
IPMT(ours)71.673.558.061.266.175.376.959.665.169.2
+ +# 7 Experiments + +# 7.1 Datasets and Evaluation Metrics + +Datasets. To make a fair comparison with previous works, our model is evaluated on two few-shot semantic segmentation benchmark datasets, i.e., the PASCAL- $5^{i}$ dataset[25] and the COCO- $20^{i}$ dataset [22]. PASCAL- $5^{i}$ is constructed based on the PASCAL VOC 2012 dataset [6] and additional annotations from SDS [8]. It contains 20 categories in total and these categories are partitioned into four folds as in [32] for cross validation, where each fold contains five categories. COCO- $20^{i}$ is a larger datasets based on the MSCOCO [13] dataset. Similar to the division in PASCAL- $5^{i}$ , the 80 categories in MSCOCO are also partitioned into four folds for cross validation, where each fold includes 20 categories. For both datasets, we train our model on three folds and evaluate it on the remaining one fold and perform cross validation. + +Evaluation Metrics. Following previous methods [25, 26, 15, 17], we adopt the class mean intersection over union (mIoU) as a primary evaluation metric. In addition, we also report the results of foreground-background IoU (FB-IoU) for comparison. + +# 7.2 Implementation Details + +Following previous works, we adopt ResNet-50 and ResNet-101 [9] as our encoder backbone. Note that they are initialized by the weights pre-trained on ImageNet [24] and froze during training. + +Our proposed IPMT is implemented using PyTorch [23] and all the experiments are conducted on one NVIDIA RTX 3090 GPU. We use the same data augmentation setting as [28] for fair comparisons. Our model is trained for 200 epochs on PASCAL-5 $^i$ while 50 epochs on COCO-20 $^i$ , respectively, with the batchsize set to 4. Two optimizers (i.e., SGD and AdamW) are used to train our model. The former is used to optimize the convolutional layers with the initial learning rate, weight decay, and momentum set to $2.5 \times 10^{-3}$ , 0.0001, and 0.9, respectively. The latter is used to optimize the transformer layers by setting the learning rate to $1 \times 10^{-4}$ and the weight decay to $1 \times 10^{-2}$ . We also use the polynomial annealing policy with the power set to 0.9 to decay the learning rate. For hyper-parameters in our IPMT, the number of multi-heads and the channel dimension of the image features are set to 8 and 256, respectively. The weight $\alpha$ in DSL is set to 0.3 since a larger weight should be given for the more reliable category knowledge from the support images. During the evaluation, we follow [28] to randomly sample 1000 support-query pairs on PASCAL-5 $^i$ and 4000 pairs on COCO-20 $^i$ , respectively. + +# 7.3 Comparison with State-of-the-art Methods + +Quantitative comparison. As shown in Table 1 and 2, we compare our method with previous works on both PASCAL- $5^{i}$ and COCO- $20^{i}$ , respectively. It can be found that our IPMT surpasses all other approaches by a large margin and achieves new state-of-the-art results. On PASCAL- $5^{i}$ , when using ResNet-50 as the backbone, our proposed IPMT improves the mIoU score by 2.6 under the + +![](images/4ad4555a1e82beb42f0cf491b007c96a0a63031fc2634e8c531ebc844c51e6aa.jpg) +Support +Figure 3: Qualitative comparison between our proposed IPMT and CyCTR [40]. From top to bottom: support images, prediction of CyCTR, prediction of IPMT, query images. + +Table 2: Class mIoU results of four folds on COCO- ${20}^{i}$ . The results of 'Mean' are the averaged class mIoU scores of all the four folds. Red/Blue indicates the best/2nd results. + +
BackboneMethods1-shot5-shot
Fold-0Fold-1Fold-2Fold-3MeanFold-0Fold-1Fold-2Fold-3Mean
ResNet-50RPMMs(ECCV'20)[36]29.536.829.027.030.633.842.033.033.335.5
RePRI(CVPR'21)[2]31.238.133.333.034.038.546.240.043.642.1
HSNet(ICCV'21)[21]36.343.138.738.739.243.351.348.245.046.9
CWT(ICCV'21)[19]32.236.031.631.632.940.143.839.042.441.3
CyCTR(NeurIPS'21)[40]38.943.039.639.840.341.148.945.247.045.6
DCP(IJCAI'22)[11]40.943.842.638.341.445.849.643.746.646.5
NERTNet(CVPR'22) [16]36.842.639.937.939.338.244.140.438.440.3
IPMT(ours)41.445.145.640.043.043.549.748.747.947.5
ResNet-101PFENet(TPAMI'20)[28]34.333.032.330.132.438.538.638.234.337.4
CWT(ICCV'21)[19]30.336.630.532.232.438.546.739.443.242.0
SCL(CVPR'21)[37]36.438.637.535.437.038.940.541.538.739.9
SAGNN(CVPR'21) [35]36.141.038.233.537.240.948.342.638.942.7
NERTNet(CVPR'22) [16]38.340.439.538.139.142.344.444.241.743.2
IPMT(ours)40.545.744.839.342.645.150.349.346.847.9
+ +1-shot setting compared with the previous best result. Additionally, we also achieve 1.8 mIoU (under the 1-shot setting) and 2.2 mIoU (5-shot setting) improvements using the ResNet-101 backbone. As for COCO- $20^{i}$ , our method with the ResNet-50 backbone outperforms the previous best results by 1.6 and 0.6 mIoU under the two settings, respectively. When using the ResNet-101 backbone, our IPMT improves the mIoU score by 3.5 and 4.7 over the previous best results. These improvements demonstrate the competitiveness of our model on complex data. In addition, we report the comparison with some advanced approaches in terms of the FB-IoU score in Table 3, which also shows our superiority. + +Quantitative Result. We visualize some prediction results of our method and a support-only FSS method (i.e., CyCTR [40]) in Figure 3. It can be observed that our results (the 3 row) could effectively relieve the segmentation error caused by the inherent intra-class diversity compared with the results of only using the support information (the 2th row). + +# 7.4 Ablation Study + +In this section, we report ablation study results on PASCAL- $5^{i}$ with the ResNet-50 backbone under the 1-shot setting. + +Effectiveness of IPM. To demonstrate the necessity of bridging the category information gap between query and support images using the proposed IPM, we conduct ablation study by learning the category information only from support or query images. Furthermore, we report the performance comparison both with and without iteration. All the ablation studies are conducted with both DSL and + +Table 3: Comparison with state-of-the-arts on PASCAL- $5^{i}$ in terms of FB-IoU under the 1-shot and 5-shot settings. + +
BackboneMethodsFB-IoU
1-shot5-shot
ResNet-50PPNet(ECCV'20)[17]69.275.7
PFENET(TPAMI'20)[28]73.373.9
HSNet(ICCV'21)[21]76.780.6
SCL(CVPR'21)[37]71.972.8
DCP(IJCAI'22)[11]75.679.7
IPMT(ours)77.181.4
ResNet-101A-MCG(AAAI'19)[10]61.262.2
DAN(ECCV'20)[30]71.972.3
PFENET(TPAMI'20)[28]72.973.5
CyclCTR(NeurIPS'21)[40]73.075.4
IPMT(ours)78.580.3
+ +Table 6: Ablation study on the effectiveness of DSL and QA. + +
IPMDSLQAmIoU
60.2
✓54.9
✓✓64.3
✓✓✓66.8
+ +Table 4: Ablation study on the effectiveness of IPM. + +
Support onlyQuery onlyIntermediateIterationmIoU
✓62.5
✓59.8
✓64.1
✓✓63.4
✓✓60.1
✓✓66.8
+ +Table 5: Performance comparison of varying the number of IPMT layers. + +
Layers12345
mIoU64.164.765.265.666.8
+ +Table 7: Intra-class diversity measured by Euclidean distances among the query, support, and intermediate prototypes of four folds on PASCAL-5 $^i$ . + +
fold-0fold-1fold-2fold-3Mean
Dqs7.6247.7846.8759.4307.928
Dqi6.9056.7755.9418.2496.968
Dis3.6163.9943.5206.2024.333
+ +QA for a fair comparison. As shown in Table 4, 'Support only' and 'Query only' mean the learnable prototype is only updated by the support feature and the query feature, respectively. 'Intermediate' means using both support and query information in our IPM. We observe that our method surpasses other schemes by $1.6\mathrm{mIoU}$ when not using iteration. This improvement even increases to 3.4 when using iteration. These results clearly demonstrate the effectiveness of our IPM and also indicate that using iteration is an effective booster for our IPM. + +Ablation on Different Numbers of IPMT Layers. We vary the number of IPMT layers from 1 to 5 and report the results in Table 5. It shows that using more layers can gradually improve the model performance and using five layers achieves as much as $2.7\mathrm{mIoU}$ improvement. We did not try more layers considering the accuracy-efficiency trade-off. + +Effectiveness of DSL and QA. Since the effectiveness of the IPM has been proved in Table 4, here we conduct an ablation study to validate the effectiveness of QA and DSL. We remove all the three components from our model as the baseline model (only with PA), which only uses the support prototype to directly segment the target object like [28]. As Table 6 shows, compared to the baseline, solely using IPM leads to $5.3\mathrm{mIoU}$ drop. However, when DSL is added, our model achieves $4.1\mathrm{mIoU}$ improvement over the baseline. This phenomenon is reasonable because there is no guarantee that the learnable prototype in IPM will learn intermediate category knowledge without DSL. Meanwhile, using the QA to activate the query feature map leads to further $2.5\mathrm{mIoU}$ improvement. These results clearly verify the effectiveness of our proposed QA and DSL. + +Prototype Comparison. We first visualize the overall distribution of the support (orange points) and intermediate (blue points) prototypes given two query (magenta points) images in Figure 4 (a) and (c). It is clearly observed that our intermediate prototypes are closer to the query prototypes than the support ones are in the feature space, hence verifying that our method effectively relieves the intra-class diversity issue and bridges the category information gap between query and support images. We also show the support images for some specific points and the query images in Figure 4 (b) and (d). Please note that the support and intermediate prototypes of the same support image are shown as two points with the same shape. We find that for these support images which have clear intra-class differences from the query image, our generated intermediate prototypes are successfully pulled to a closer feature space with the query prototype. + +Additionally, for evaluating the intra-class diversity objectively, we adopt the Euclidean distance as a metric to measure the distance between the query prototype and the support prototype $(D_{qs})$ in each episode. Then, to further demonstrate the effectiveness of our method, we also measure the distance between the query prototype and the intermediate prototype $(D_{qi})$ and the distance between the intermediate prototype and the support prototype $(D_{is})$ . The average distances of each fold and the mean of all the categories on the PASCAL- $5^{i}$ are shown in Table 7. From the table, we can clearly see that $D_{qi}$ is smaller than $D_{qs}$ on all folds, which means that our mined intermediate prototype is more similar to the query than the support is. This also demonstrates that our method effectively reduces the distance between the mined prototype and the query and mitigates the intra-class diversity problem. + +![](images/0feb05ed9a8597c4afb749416f911d3fd5ce0ec2cc77fb8ebdde176dff482f37.jpg) +Figure 4: Comparison of the distribution of support and intermediate prototypes. (a) & (c): The overall distribution of support prototypes and intermediate prototypes. The latter are closer to the query than the former. (b) & (d): The visualization of the query images and the support images of some points. Different marks indicate different support prototypes and their corresponding intermediate prototypes. + +# 8 Conclusion + +In this paper, we focus on the intra-class diversity between query and support and introduce an intermediate prototype to bridge the category information gap between them. The core idea is to use the intermediate prototype to aggregate the support-deterministic and query-adaptive category information by our designed Intermediate Prototype Mining Transformer (IPMT) in an iterative way. Surprisingly, despite its simplicity, our method outperforms previous state-of-the-art results by a large margin on two FSS benchmark datasets. We hope our work could inspire future research to concentrate more on the intra-class diversity in FSS. + +# Acknowledgments + +This work was supported in part by the National Key RD Program of China under Grant 2020AAA0105701, the National Natural Science Foundation of China under Grant 62136007, 62071388, 62036011 and U20B2065, the Key Research and Development Program of Shaanxi Province under Grant 2021ZDLGY01-08. + +# References + +[1] Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016. +[2] Malik Boudiaf, Hoel Kervadec, Ziko Imtiaz Masud, Pablo Piantanida, Ismail Ben Ayed, and Jose Dolz. Few-shot segmentation without meta-learning: A good transductive inference is all you need? In CVPR, pages 13979-13988, 2021. +[3] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In ECCV, pages 213-229, 2020. +[4] Bowen Cheng, Ishan Misra, Alexander G Schwing, Alexander Kirillov, and Rohit Girdhar. Masked-attention mask transformer for universal image segmentation. In CVPR, pages 1290–1299, 2022. +[5] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021. +[6] Mark Everingham, Luc Van Gool, Christopher KI Williams, John Winn, and Andrew Zisserman. The pascal visual object classes (voc) challenge. IJCV, 88(2):303-338, 2010. + +[7] Ruohao Guo, Dantong Niu, Liao Qu, and Zhenbo Li. Sotr: Segmenting objects with transformers. In ICCV, pages 7157-7166, 2021. +[8] Bharath Hariharan, Pablo Arbeláez, Lubomir Bourdev, Subhransu Maji, and Jitendra Malik. Semantic contours from inverse detectors. In ICCV, pages 991–998, 2011. +[9] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, pages 770-778, 2016. +[10] Tao Hu, Pengwan Yang, Chiliang Zhang, Gang Yu, Yadong Mu, and Cees GM Snoek. Attention-based multi-context guiding for few-shot semantic segmentation. In AAAI, volume 33, pages 8441-8448, 2019. +[11] Chunbo Lang, Binfei Tu, Gong Cheng, and Junwei Han. Beyond the prototype: Divide-and-conquer proxies for few-shot segmentation. In *IJCAI*, pages 1024–1030, 2022. +[12] Gen Li, Varun Jampani, Laura Sevilla-Lara, Deqing Sun, Jonghyun Kim, and Joongkyu Kim. Adaptive prototype learning and allocation for few-shot segmentation. In CVPR, pages 8334-8343, 2021. +[13] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dólar, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ECCV, pages 740-755, 2014. +[14] Binghao Liu, Yao Ding, Jianbin Jiao, Xiangyang Ji, and Qixiang Ye. Anti-aliasing semantic reconstruction for few-shot semantic segmentation. In CVPR, pages 9747–9756, 2021. +[15] Weide Liu, Chi Zhang, Guosheng Lin, and Fayao Liu. Crnet: Cross-reference networks for few-shot segmentation. In CVPR, pages 4165-4173, 2020. +[16] Yuanwei Liu, Nian Liu, Qinglong Cao, Xiwen Yao, Junwei Han, and Ling Shao. Learning non-target knowledge for few-shot semantic segmentation. In CVPR, pages 11573-11582, 2022. +[17] Yongfei Liu, Xiangyi Zhang, Songyang Zhang, and Xuming He. Part-aware prototype network for few-shot semantic segmentation. In ECCV, pages 142-158, 2020. +[18] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. In ICCV, pages 10012-10022, 2021. +[19] Zhihe Lu, Sen He, Xiatian Zhu, Li Zhang, Yi-Zhe Song, and Tao Xiang. Simpler is better: Few-shot semantic segmentation with classifier weight transformer. In ICCV, pages 8741-8750, 2021. +[20] Fausto Milletari, Nassir Navab, and Seyed-Ahmad Ahmadi. V-net: Fully convolutional neural networks for volumetric medical image segmentation. In 3DV, pages 565-571, 2016. +[21] Juhong Min, Dahiyun Kang, and Minsu Cho. Hypercorrelation squeeze for few-shot segmentation. In CVPR, pages 6941-6952, 2021. +[22] Khoi Nguyen and Sinisa Todorovic. Feature weighting and boosting for few-shot segmentation. In ICCV, pages 622-631, 2019. +[23] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. In NeurIPS, volume 32, pages 8026-8037, 2019. +[24] Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al. Imagenet large scale visual recognition challenge. IJCV, 115(3):211-252, 2015. +[25] Amirreza Shaban, Shray Bansal, Zhen Liu, Irfan Essa, and Byron Boots. One-shot learning for semantic segmentation. In BMVC, 2017. +[26] Mennatullah Siam, Boris N Oreshkin, and Martin Jagersand. Amp: Adaptive masked proxies for few-shot segmentation. In ICCV, pages 5249-5258, 2019. +[27] Peize Sun, Yi Jiang, Rufeng Zhang, Enze Xie, Jinkun Cao, Xinting Hu, Tao Kong, Zehuan Yuan, Changhu Wang, and Ping Luo. Transtrack: Multiple-object tracking with transformer. arXiv preprint arXiv:2012.15460, 2020. +[28] Zhuotao Tian, Hengshuang Zhao, Michelle Shu, Zhicheng Yang, Ruiyu Li, and Jiaya Jia. Prior guided feature enrichment network for few-shot segmentation. IEEE TPAMI, (01):1-1, 2020. +[29] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NeurlPS, volume 30, pages 5998-6008, 2017. +[30] Haochen Wang, Xudong Zhang, Yutao Hu, Yandan Yang, Xianbin Cao, and Xiantong Zhen. Few-shot semantic segmentation with democratic attention networks. In ECCV, pages 730-746, 2020. +[31] Huiyu Wang, Yukun Zhu, Hartwig Adam, Alan Yuille, and Liang-Chieh Chen. Max-deeplab: End-to-end panoptic segmentation with mask transformers. In CVPR, pages 5463-5474, 2021. +[32] Kaixin Wang, Jun Hao Liew, Yingtian Zou, Daquan Zhou, and Jiashi Feng. Panet: Few-shot image semantic segmentation with prototype alignment. In ICCV, pages 9197-9206, 2019. +[33] Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. In ICCV, pages 568-578, 2021. +[34] Zhonghua Wu, Xiangxi Shi, Guosheng Lin, and Jianfei Cai. Learning meta-class memory for few-shot semantic segmentation. In ICCV, pages 517-526, 2021. +[35] Guo-Sen Xie, Jie Liu, Huan Xiong, and Ling Shao. Scale-aware graph neural network for few-shot semantic segmentation. In CVPR, pages 5475-5484, 2021. + +[36] Boyu Yang, Chang Liu, Bohao Li, Jianbin Jiao, and Qixiang Ye. Prototype mixture models for few-shot semantic segmentation. In ECCV, pages 763-778, 2020. +[37] Bingfeng Zhang, Jimin Xiao, and Terry Qin. Self-guided and cross-guided learning for few-shot segmentation. In CVPR, pages 8312-8321, 2021. +[38] Chi Zhang, Guosheng Lin, Fayao Liu, Jiushuang Guo, Qingyao Wu, and Rui Yao. Pyramid graph networks with connection attentions for region-based one-shot semantic segmentation. In ICCV, pages 9587-9595, 2019. +[39] Chi Zhang, Guosheng Lin, Fayao Liu, Rui Yao, and Chunhua Shen. Canet: Class-agnostic segmentation networks with iterative refinement and attentive few-shot learning. In CVPR, pages 5217-5226, 2019. +[40] Gengwei Zhang, Guoliang Kang, Yi Yang, and Yunchao Wei. Few-shot segmentation via cycle-consistent transformer. In NeurIPS, volume 34, pages 21984-21996, 2021. +[41] Sixiao Zheng, Jiachen Lu, Hengshuang Zhao, Xiatian Zhu, Zekun Luo, Yabiao Wang, Yanwei Fu, Jianfeng Feng, Tao Xiang, Philip HS Torr, et al. Rethinking semantic segmentation from a sequence-to-sequence perspective with transformers. In CVPR, pages 6881-6890, 2021. +[42] Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, and Jifeng Dai. Deformable detr: Deformable transformers for end-to-end object detection. In ICLR, 2020. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] See Section 1. +(b) Did you describe the limitations of your work? [Yes] See Appendix. +(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Appendix. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [N/A] +(b) Did you include complete proofs of all theoretical results? [N/A] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] The code will be provided in the supplemental material. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 7.1 and 7.2. +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] We followed previous FSS works and reported the averaged results over 5 independent runs but did not report error bars. +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Section 7.2. + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] See Section 7.1. +(b) Did you mention the license of the assets? [N/A] +(c) Did you include any new assets either in the supplemental material or as a URL? [No] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [No] The data is open source. +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/intermediateprototypeminingtransformerforfewshotsemanticsegmentation/images.zip b/intermediateprototypeminingtransformerforfewshotsemanticsegmentation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..35080b1247e4d2e40a9a17863cb693cef3bb7357 --- /dev/null +++ b/intermediateprototypeminingtransformerforfewshotsemanticsegmentation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:20e2040072eb7cdc4079da2eedae10af9bf5d2485348981c4cfe139d534e27d2 +size 631889 diff --git a/intermediateprototypeminingtransformerforfewshotsemanticsegmentation/layout.json b/intermediateprototypeminingtransformerforfewshotsemanticsegmentation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..94ed9aa61c6ec5d49349e0f63fe0ad3a3ae770ca --- /dev/null +++ b/intermediateprototypeminingtransformerforfewshotsemanticsegmentation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:51e40dfa5c7cec7540392bd86274076dd29f7c6b3fc28a6d7213b861eeb7fb96 +size 436051 diff --git a/interpolationandregularizationforcausallearning/2023c76e-b04e-4688-a145-332b717aa048_content_list.json b/interpolationandregularizationforcausallearning/2023c76e-b04e-4688-a145-332b717aa048_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..2b2cd0689f5dcda769b734dc3cac79400d8f2324 --- /dev/null +++ b/interpolationandregularizationforcausallearning/2023c76e-b04e-4688-a145-332b717aa048_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:71ecb0b0203144534f3f13c4b020abb1b9d04b8f28d18a8b1cd757bfa80c953b +size 85594 diff --git a/interpolationandregularizationforcausallearning/2023c76e-b04e-4688-a145-332b717aa048_model.json b/interpolationandregularizationforcausallearning/2023c76e-b04e-4688-a145-332b717aa048_model.json new file mode 100644 index 0000000000000000000000000000000000000000..e51f80ee98be0723dcca8dd645fe6b87cd099c35 --- /dev/null +++ b/interpolationandregularizationforcausallearning/2023c76e-b04e-4688-a145-332b717aa048_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4f986fe13643693df6e3197a6f625b365f1d82c41c79de58e819ba14dbaf88a5 +size 107730 diff --git a/interpolationandregularizationforcausallearning/2023c76e-b04e-4688-a145-332b717aa048_origin.pdf b/interpolationandregularizationforcausallearning/2023c76e-b04e-4688-a145-332b717aa048_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b7f1b487b90105f6869e15b99d9c4a5e7582a541 --- /dev/null +++ b/interpolationandregularizationforcausallearning/2023c76e-b04e-4688-a145-332b717aa048_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce106b520d39674924db0cc4114c29231e49e8f4ba380b309414c6b649b91568 +size 800130 diff --git a/interpolationandregularizationforcausallearning/full.md b/interpolationandregularizationforcausallearning/full.md new file mode 100644 index 0000000000000000000000000000000000000000..711db6e819064d2ff773c007c0ac0c29b9338ef0 --- /dev/null +++ b/interpolationandregularizationforcausallearning/full.md @@ -0,0 +1,331 @@ +# Interpolation and Regularization for Causal Learning + +Leena Chennuru Vankadara* + +University of Tübingen, Tübingen AI Center + +Luca Rendsburg* + +University of Tübingen, Tübingen AI Center + +Ulrike von Luxburg + +University of Tübingen, Tübingen AI Center + +Debarghya Ghoshdastidar + +Technical University of Munich + +# Abstract + +Recent work shows that in complex model classes, interpolators can achieve statistical generalization and even be optimal for statistical learning. However, despite increasing interest in learning models with good causal properties, there is no understanding of whether such interpolators can also achieve causal generalization. To address this gap, we study causal learning from observational data through the lens of interpolation and its counterpart—regularization. Under a simple linear causal model, we derive precise asymptotics for the causal risk of the min-norm interpolator and ridge regressors in the high-dimensional regime. We find a large range of behavior that can be precisely characterized by a new measure of confounding strength. When confounding strength is positive, which holds under independent causal mechanisms—a standard assumption in causal learning—we find that interpolators cannot be optimal. Indeed, causal learning requires stronger regularization than statistical learning. Beyond this assumption, when confounding is negative, we observe a phenomenon of self-induced regularization due to positive alignment between statistical and causal signals. Here, causal learning requires weaker regularization than statistical learning, interpolators can be optimal, and optimal regularization can even be negative. + +# 1 Introduction + +We consider the problem of learning the causal influence of multivariate covariates $x \in \mathbb{R}^d$ on a scalar target variable $y \in \mathbb{R}$ purely from observational data and under the presence of hidden confounders. Formally, given finite samples $\{(x_i, y_i)\}_{i=1}^n$ drawn independently and identically (i.i.d) from the joint observational distribution $p(x, y) = p(x)p(y|x)$ , the goal of causal learning is to predict the effects on the target variable $y$ under interventions on the covariates $x$ . In other words, the goal is to learn a predictive model that minimizes the expected loss on a random draw from the interventional distribution $p_{do}(x, y) = p(x)p(y|do(x))$ , which can be different from the observational distribution. + +Recently, Janzing (2019) established a close analogy between statistical and causal learning (albeit under a highly constructed confounded model). As a consequence, Janzing (2019) suggested that standard statistical learning-theoretic techniques (such as norm-based regularization) may also help learn good causal models. However, the classical statistical principles of bias-variance trade-off have been challenged in recent years by highly complex classes of models that are trained to interpolate the data and yet achieve remarkable generalization properties across a broad range of problem domains (Zhang et al., 2021). A large volume of recent work suggests that interpolation can be compatible with and may even be necessary to achieve optimal statistical generalization in the high-dimensional regime (Belkin et al., 2018; Belkin et al., 2019a; Liang et al., 2020; Feldman, 2020). Despite the surge in interest, causal properties of such interpolators have not yet been explored. In this work, we + +consider a simple linear causal model in the high-dimensional regime $(n,d\to \infty ,d / n\in \mathcal{O}(1))$ and ask: can interpolators achieve good causal generalization? + +# 1.1 Motivation and Related Work + +Resemblance between statistical and causal generalization Causal learning can be regarded as an instance of the general problem of learning under distribution shifts, where the training (observational) distribution is shifted from the test (interventional) distribution. In the framework of out-of-distribution generalization, an interesting proposition for causal learning arises from the following high-level idea. Observing small sample sizes may induce a similar bias as distribution shifts. Therefore, techniques for learning models with good out-of-sample generalization (such as regularization) may also help to learn models with good out-of-distribution generalization and vice-versa. The literature provides plentiful evidence to support this general principle for different classes of distribution shifts. For instance, under a broad class of distribution shifts, distributionally robust optimization is equivalent to norm-based regularization (Xu et al., 2009; Shafieezadeh Abadeh et al., 2015; Gao et al., 2017; Shafieezadeh-Abadeh et al., 2019; Blanchet et al., 2019; Kuhn et al., 2019). Analogously, distributionally robust optimization techniques are also employed for statistical learning under limited samples (Zhu et al., 2020). Particularly relevant to our work is Janzing (2019), which formally establishes a close analogy between "generalizing from empirical to observational distributions" and "generalizing from observational to interventional distributions" under a highly constructed confounding model. This analogy suggests that standard norm-based regularization such as lasso or ridge, typically used for statistical learning, may also help learn better causal models. + +Interpolation can be compatible with statistical learning Explicit norm-based regularization techniques were initially motivated by the classical learning theory principle of bias-variance tradeoff, which is characterized by a U-shaped generalization curve. This principle recommends to avoid interpolation and instead suggests to balance data fitting with the complexity of the hypothesis class. Recently, however, these classical principles have been challenged by deep learning models. Despite being highly complex with the ability to fit even random labels and often trained to interpolate the training data, they achieve state-of-the-art out-of-sample generalization across many domains (Zhang et al., 2021). A partial explanation is provided by the double-descent phenomenon (Belkin et al., 2019b; Belkin, 2021). Extending the generalization curve beyond the interpolation threshold reveals two regimes: the classical U-curve in the underparameterized regime and a decreasing curve in the overparameterized regime. This behaviour is not limited to deep neural networks, but extends to other settings such as random feature models and random forests (Belkin et al., 2019b; Hastie et al., 2022; Mei et al., 2021). Follow-up work suggests that in the overparameterized regime, interpolators can indeed achieve low statistical risk (Belkin et al., 2019a; Liang et al., 2020; Bartlett et al., 2020; Tsigler et al., 2020; Muthukumar et al., 2020). + +Is interpolation compatible with causal learning? On account of the parallels between statistical (out-of-sample) and causal (out-of-distribution) learning, it is therefore natural to ask: can interpolators also learn good causal models? One line of empirical work suggests that naively applying distributionally robust learning techniques such as importance reweighting or distributionally robust optimization approaches (which are equivalent to certain forms of regularization) offers vanishing benefits over empirical risk minimization in overparameterized model classes (Byrd et al., 2019; Sagawa et al., 2020; Gulrajani et al., 2021). However, there is also empirical evidence that suggests that augmenting such techniques with additional explicit norm-based regularization may help to learn distributionally robust models in the overparameterized regime (Sagawa et al., 2020; Donhauser et al., 2021). In the context of causal learning, it has been suggested that explicit regularization can be beneficial and might even need to be stronger than for statistical learning (Janzing, 2019; Vankadara et al., 2021). Existing work, therefore, remains unclear about the role of explicit regularization in causal learning, or correspondingly, whether interpolation is compatible with causal learning. In this work, we take a theoretical approach to systematically address these questions. + +# 1.2 Our Contributions + +We provide a first analysis of causal generalization from observational data in the modern, overparameterized and interpolating regime under a simple linear causal model. Specifically, we consider the interpolating minimum $l_{2}$ norm least-squares estimator and the family of regularized ridge regression + +estimators in the proportional asymptotic regime. We seek answers to the following questions: is there a regime where the optimal causal regularization parameter is 0, that is, can we observe benign causal overfitting? Furthermore, if the optimal causal regularization parameter is positive, how strongly do we need to regularize? How does the optimal causal regularization compare to the optimal statistical regularization? While our analysis is exhaustive, we emphasize the results under the assumption of independent causal mechanisms (Janzing et al., 2010), a standard assumption in causal learning. + +- Precise asymptotics of the causal risk (Section 3). We provide precise asymptotics of the causal risk of the ridge regression estimator as well as the minimum $l_{2}$ norm interpolator in the high-dimensional setting: $n, d \to \infty, d / n \to \gamma \in (0, \infty)$ . Our results confirm that, similar to the statistical setting, the causal generalization curve of the min-norm estimator exhibits the double-descent phenomenon. This is because the variance term diverges at the interpolation threshold and is decreasing in the overparameterized regime ( $\gamma > 1$ ). +- A measure of confounding strength $\zeta$ (Section 2.1). We introduce a new measure of confounding strength $\zeta$ that quantifies the relative contribution of the "confounding signal" to the "causal signal". It can be interpreted as the strength of the distribution shift between the observational and interventional distributions. While $\zeta$ can take any real value in general, it is restricted to [0, 1] under the assumption of independent causal mechanisms. There, it induces a strict, model-independent ordering of all causal models that entail the same observational distribution. +- Benign causal overfitting (Section 4). When the causal signal dominates the statistical signal $(\zeta < 0)$ , we observe a phenomenon of self-induced regularization due to the confounding signal. As a consequence, the optimal causal regularization can be 0 or negative even if the optimal statistical regularization is strictly positive. Under the assumption of independent causal mechanisms, however, we show that there is no benign causal overfitting. This is in contrast to benign statistical overfitting, which can occur in the highly underparameterized regime $(\gamma \rightarrow 0)$ . +- Optimal causal vs. statistical regularization (Section 5). We show that causal learning requires weaker regularization than statistical learning when the confounding strength $\zeta$ is negative. However, when $\zeta > 0$ and in particular under the principle of independent causal mechanisms, we show that causal learning requires stronger regularization than statistical learning. More specifically, the optimal causal regularization is strictly increasing in confounding strength. + +# 2 Problem Setup + +![](images/39e00916c7818e7f142a855cf35756a3158eb154f8a7d3adcb224a0737bcbf64.jpg) +(a) + +![](images/7dba28ec92434f5d015fb38dc3d82d064b5fd1b376032c8a7634d6fa386bece7.jpg) +(b) +Figure 1: (a) Graphical model of the causal model defined in (1). (b) The usual statistical model. In both figures, observed random variables are shaded and unobserved variables are white. + +We consider a linear causal model with parameters $M \in \mathbb{R}^{d \times l}$ , $\alpha \in \mathbb{R}^l$ , $\beta \in \mathbb{R}^d$ with $l \geq d$ and $\sigma^2 > 0$ described via the structural equations + +$$ +z \sim \mathcal {N} (0, I _ {l}), \quad \varepsilon \sim \mathcal {N} (0, \sigma^ {2}), \quad x = M z, \quad y = x ^ {T} \beta + z ^ {T} \alpha + \varepsilon . \tag {1} +$$ + +The covariates $x \in \mathbb{R}^d$ and the target $y \in \mathbb{R}$ are confounded through $z \in \mathbb{R}^l$ , which follows a standard normal distribution. This structure implies that $\mathbb{E}x = 0$ and the covariance of $x$ is $\Sigma := \operatorname{Cov} x = MM^T$ . A graphical representation of this causal model is given in Figure 1a. The observational joint distribution of this causal model is given by $p(x,y) = p(x)p(y|x)$ , where $x \sim \mathcal{N}(0,\Sigma)$ and $y|x \sim \mathcal{N}(x^T\tilde{\beta},\tilde{\sigma}^2)$ . Here, the statistical parameter $\tilde{\beta} := \beta + \Gamma$ consists of the causal parameter $\beta$ and a confounding parameter $\Gamma := M^{+T}\alpha$ , where $M^{+T}$ is shorthand for $(M^{+})^{T}$ and $M^{+}$ denotes the Moore-Penrose inverse of $M$ . The statistical noise is given by $\tilde{\sigma}^2 := \sigma^2 + \| \alpha \|_2^2 - \| \Gamma \|_{\Sigma}^2$ , where $\| x\|_{\Sigma}^2 := x^T\Sigma x$ denotes the generalized norm. Note that the observational distribution alone cannot distinguish the causal model from the one in Figure 1b. The + +goal of statistical learning is to predict $y$ after observing $x$ , which is captured by the conditional distribution $p(y|x)$ . In contrast, the goal of causal learning is to predict $y$ after manipulating or intervening on $x$ . This is formally captured by Pearl's do-calculus (Pearl, 2009), which describes interventions on random variables as a shift in the joint distribution. Intervening on $x$ with the value $x_0$ , denoted as $do(x = x_0)$ , removes all arrows to $x$ and sets $x = x_0$ . In our causal model (1), the intervention $do(x = x_0)$ removes the arrow $z \to x$ and yields the updated structural causal equations + +$$ +z \sim \mathcal {N} (0, I _ {l}), \quad \varepsilon \sim \mathcal {N} (0, \sigma^ {2}), \quad x = x _ {0}, \quad y = x _ {0} ^ {T} \beta + z ^ {T} \alpha + \varepsilon . +$$ + +The corresponding distribution of $y$ after intervening on $x$ is therefore given by $y|do(x = x_0) \sim \mathcal{N}(x_0^T\beta, \tilde{\sigma}^2 + \|\Gamma\|_{\Sigma}^2)$ . Since arbitrary interventions can introduce arbitrary distribution shifts, we consider the natural class of interventions drawn from the observational marginal distribution on $x$ . This yields the interventional joint distribution $p_{do}(x,y) = p(x)p(y|do(x))$ with the slight abuse of notation $do(x)$ in which the random variable $x$ and its value coincide. + +Causal learning from observational data Assume we are given i.i.d. samples $\{(x_i, y_i)\}_{i=1}^n$ from the observational joint distribution $p(x, y)$ , which we collect in $X \in \mathbb{R}^{n \times d}$ and $Y \in \mathbb{R}^n$ . The usual statistical learning aims for the observational conditional $p(y|x)$ , which means that train and test distributions coincide. Causal learning aims for the interventional conditional $p(y|do(x))$ , a distribution shift problem for which train and test distributions differ. We define the corresponding causal risk $R^C$ and statistical risk $R^S$ of any linear regressor $\hat{\beta} \in \mathbb{R}^d$ under the squared loss as + +$$ +R ^ {C} (\hat {\beta}) := \mathbb {E} _ {x} \mathbb {E} _ {y | d o (x)} \left(x ^ {T} \hat {\beta} - y\right) ^ {2} \quad \text {a n d} \quad R ^ {S} (\hat {\beta}) := \mathbb {E} _ {x} \mathbb {E} _ {y | x} \left(x ^ {T} \hat {\beta} - y\right) ^ {2}. \tag {2} +$$ + +The following proposition (proven in Appendix A) characterizes the risks under the model (1). + +Proposition 2.1 (Causal and Statistical Risk). For any $\hat{\beta} \in \mathbb{R}^d$ , the risks defined in Eq. (2) satisfy + +$$ +R ^ {C} (\hat {\beta}) = \| \hat {\beta} - \beta \| _ {\Sigma} ^ {2} + \tilde {\sigma} ^ {2} + \| \Gamma \| _ {\Sigma} ^ {2} \quad a n d \quad R ^ {S} (\hat {\beta}) = \| \hat {\beta} - \tilde {\beta} \| _ {\Sigma} ^ {2} + \tilde {\sigma} ^ {2}. +$$ + +Therefore, $\beta$ is the optimal causal parameter and $\tilde{\beta}$ is the optimal statistical parameter. In the following, we simply refer to them as causal and statistical parameters. + +# 2.1 A New Measure of Confounding Strength + +Since the interventional distribution generally differs from the observational distribution, we require a measure that quantifies how this shift influences causal learning from observational data. + +Signal-to-noise ratios (SNRs) Before we define our measure of confounding strength, we first define the statistical and causal signal-to-noise ratios, which help to intuitively understand our confounding strength measure. Recall that every causal model entails a statistical model since the causal parameter $\beta$ and the confounding parameter $\Gamma$ jointly specify the statistical parameter $\tilde{\beta} = \beta + \Gamma$ . The statistical SNR is defined as usual by $\mathrm{SNR}_{\mathrm{S}} := \|\tilde{\beta}\|^{2} / \tilde{\sigma}^{2}$ . For the causal SNR, a natural notion would be $\|\beta\|^{2} / (\tilde{\sigma}^{2} + \|\Gamma\|_{\Sigma}^{2})$ if the learning algorithm had access to data from the interventional distribution $y|do(x) \sim \mathcal{N}(x^{T}\beta, \tilde{\sigma}^{2} + \|\Gamma\|_{\Sigma}^{2})$ ; but since we are constrained to data from the observational conditional $y|x \sim \mathcal{N}(x^{T}\tilde{\beta}, \tilde{\sigma}^{2})$ , the corresponding causal SNR, which quantifies the hardness of the learning problem, needs to take this into consideration. Accordingly, we consider the causal SNR as the ratio of the alignment between the statistical and causal parameters and the variance of the observational conditional. Formally, we define it as $\mathrm{SNR}_{\mathrm{C}} := \langle \beta, \tilde{\beta} \rangle / \tilde{\sigma}^{2}$ . In what follows, we therefore often refer to $\langle \beta, \tilde{\beta} \rangle$ as the causal signal and $\|\tilde{\beta}\|^{2}$ as the statistical signal. Correspondingly, we refer to $\langle \tilde{\beta} - \beta, \tilde{\beta} \rangle = \langle \Gamma, \tilde{\beta} \rangle$ as the confounding signal, which is the alignment between the confounding parameter $\Gamma$ and the statistical parameter $\tilde{\beta}$ . + +Confounding strength Regression on observational data implicitly assumes that the interventional distribution coincides with the observational distribution, while it can be shifted in general. To quantify the impact of this distribution shift on the corresponding causal risk, we introduce a new confounding strength measure $\zeta$ . It measures the relative contribution of the confounding signal to the statistical signal and is defined by + +$$ +\zeta := \frac {\langle \Gamma , \tilde {\beta} \rangle}{\langle \Gamma , \tilde {\beta} \rangle + \langle \beta , \tilde {\beta} \rangle} = \frac {\langle \Gamma , \tilde {\beta} \rangle}{\| \tilde {\beta} \| ^ {2}}. \tag {3} +$$ + +Other notions of confounding strength are possible, but we will see later that this definition is well-suited to capture the shift strength for causal learning from observational data. Without further restrictions, $\zeta$ can take any value in $\mathbb{R}$ . This measure divides the causal models into the following three regimes, depending on the relationship between causal and statistical signal: + +- $\zeta \geq 1$ : the causal signal $\langle \beta, \tilde{\beta} \rangle$ is non-positive, which implies that causal and statistical parameters are orthogonal or negatively aligned. Statistical learning is adversarial to causal learning. +- $0 < \zeta < 1$ : causal and statistical parameters are positively aligned but the causal signal is weaker than the statistical signal $\|\tilde{\beta}\|^2$ , for example $\beta = \tilde{\beta}/2$ . +- $\zeta \leq 0$ : the causal signal dominates the statistical signal, for example $\beta = 2\tilde{\beta}$ . + +The SNRs are related to the confounding strength measure via $\mathrm{SNR}_{\mathrm{C}} = (1 - \zeta)\mathrm{SNR}_{\mathrm{S}}$ . In particular, the causal signal decreases as the confounding strength increases. + +The regime $0 \leq \zeta \leq 1$ is practically most relevant. Causal learning often requires strong assumptions because causal models cannot be uniquely identified by their observational distribution. A standard assumption is the principle of independent causal mechanisms (ICM) (Janzing et al., 2010; Lemeire et al., 2013; Peters et al., 2017), which informally asserts that causal mechanisms share no information. In our causal model (1), a corresponding assumption could be that the causal mechanisms $\alpha$ and $\beta$ are drawn from rotationally invariant distributions. This implies that $\langle \beta, \Gamma \rangle \to 0$ as $d \to \infty$ , which in turn falls in the regime $0 \leq \zeta \leq 1$ . While our following analysis covers all possible causal models, we pay special attention to this regime because it might be of highest practical relevance. Note that for $\langle \beta, \Gamma \rangle = 0$ , our measure of confounding strength coincides with the measure $\zeta' = \| \Gamma \|^2 / (\| \Gamma \|^2 + \| \beta \|^2)$ introduced by Janzing et al. (2017). It measures the relative contribution of causal and confounding signal in terms of lengths rather than inner products. + +# 3 Causal and Statistical Risk of High-Dimensional Regression Models + +Causal learning is extremely challenging, because it requires scarcely available interventional data or has to rely on other information such as exogenous (Rothenhausler et al., 2021) or instrumental variables (Angrist et al., 1991). In our setting where only observational data are available, causal learning requires additional model assumptions. One such approach has been followed by the Concorr method (Janzing, 2019) which leverages the ICM assumption to make an improved choice of regularization parameter under a linear regression model. To fully characterize the effect of regularization on causal generalization, we consider two estimators for learning causal models from observational data $(X,Y)\in \mathbb{R}^{n\times d}\times \mathbb{R}^n$ : the min-norm interpolator and ridge regressors. The min-norm interpolator is the minimum $l_{2}$ norm solution to the least squares regression problem + +$$ +\hat {\beta} _ {0} (X, Y) := \arg \min \left\{\| \hat {\beta} \| _ {2}: \hat {\beta} \in \underset {\hat {\beta} \in \mathbb {R} ^ {d}} {\arg \min } \| Y - X \hat {\beta} \| ^ {2} \right\}. \tag {4} +$$ + +A closed form is given by $\hat{\beta}_0(X,Y) = (X^T X)^+ X^T Y$ . For $\lambda > 0$ , the ridge regressor solves + +$$ +\hat {\beta} _ {\lambda} (X, Y) := \underset {\hat {\beta} \in \mathbb {R} ^ {d}} {\arg \min } \frac {1}{n} \| Y - X \hat {\beta} \| ^ {2} + \lambda \| \hat {\beta} \| ^ {2}, \tag {5} +$$ + +which has the explicit solution $\hat{\beta}_{\lambda}(X,Y) = (X^T X + n\lambda I_d)^{-1}X^T Y$ . The min-norm interpolator can be obtained as a limiting case from the ridge regression solution via $\hat{\beta}_0(X,Y) = \lim_{\lambda \to 0^+}\hat{\beta}_{\lambda}(X,Y)$ . Whenever it is clear from the context, we drop the dependence of the predictors on $X$ and $Y$ . + +Before proceeding with the analysis, we motivate the idea that appropriate regularization can help to learn causal models from purely observational data. To this end, we compare regularization chosen by statistical cross validation to regularization based on an interventional validation set in Figure 2. Since cross validation implicitly assumes that there is no confounding, it is close to Bayes optimal for $\zeta = 0$ when $n \gg d$ . However, as confounding increases, it falls behind regularization based on the interventional validation set. The latter even yields Bayes optimal risk again in the purely confounded setting $\zeta = 1$ , where the lack of causal signal $(\beta = 0)$ is encoded by infinite regularization. While we might not have access to an interventional validation set in practice, our theory will show that knowledge of confounding strength is sufficient for choosing appropriate regularization. Finally, we want to caution that even though regularization can help, it does not remove the hardness of causal learning. Reliable causal inference still requires stronger assumptions or additional data. + +![](images/46b01831cf6a03d919e6ce967a35303aeffa3b003ec1f08de074bc43f0e8adde.jpg) +Figure 2: Causal excess risk of ridge predictors based on $n = 30,000$ samples from the observational distribution. Regularization is chosen either by cross validation or based on a validation set from the interventional distribution of same size. Each model has fixed dimensions $d = 300, l = 350$ and $\mathrm{SNR}_{\mathrm{S}} = 5$ , but different underlying confounding strengths under the constraint $\langle \beta, \Gamma \rangle = 0$ . The benefits of optimal regularization over cross validation increase with confounding strength. + +# 3.1 Precise Asymptotics of the Causal and Statistical Risks + +In this section, we provide precise asymptotics for the causal and statistical risks of the min-norm interpolator and ridge regression solutions in the high-dimensional regime. This regime is characterized by both $n, d \to \infty$ such that $d / n \to \gamma \in (0, \infty)$ , where $\gamma$ is called the overparameterization ratio. We distinguish between the underparameterized regime ( $\gamma < 1$ ) and the overparameterized regime ( $\gamma > 1$ ). All proofs for this section are deferred to Appendix B. Since the predictors $\hat{\beta} = \hat{\beta}(X, Y)$ are random variables in the training data $X$ and $Y$ , so is their corresponding causal risk. We consider the expectation of this risk under $Y$ conditioned on $X$ . According to Proposition 2.1, it is given by $R_X^C(\hat{\beta}) \coloneqq \mathbb{E}_{Y|X} R^C(\hat{\beta}) = \mathbb{E}_{Y|X} \| \hat{\beta} - \beta \|_{\Sigma}^2 + \tilde{\sigma}^2 + \| \Gamma \|_{\Sigma}^2$ . Due to its simple form, similar to the usual statistical risk, the causal excess risk can be decomposed into bias and variance: + +$$ +\mathbb {E} _ {Y \mid X} \| \hat {\beta} - \beta \| _ {\Sigma} ^ {2} = \underbrace {\| \mathbb {E} _ {Y \mid X} \hat {\beta} _ {\lambda} - \beta \| _ {\Sigma} ^ {2}} _ {=: B _ {X} ^ {C} (\hat {\beta} _ {\lambda})} + \underbrace {\mathbb {E} _ {Y \mid X} \| \hat {\beta} _ {\lambda} - \mathbb {E} _ {Y \mid X} \hat {\beta} _ {\lambda} \| _ {\Sigma} ^ {2}} _ {=: V _ {X} ^ {C} (\hat {\beta} _ {\lambda})}. \tag {6} +$$ + +The next theorem is one of our main results. It gives a closed-form expression for the limiting causal bias and variance of the min-norm interpolator and ridge regression estimators. We make the simplifying assumption of isotropic covariance $\Sigma = I_{d}$ . The proof relies on recent techniques from random matrix theory. It employs arguments similar to Dicker (2016), Dobriban et al. (2018), and Hastie et al. (2022) and can correspondingly be extended to arbitrary covariances under boundedness assumptions on the spectrum. We leave such extensions for future work and focus on thoroughly understanding the isotropic causal model, because it already exhibits rather rich behavior. + +Theorem 3.1 (Limiting Causal Bias-Variance Decomposition for the Ridge Estimator). Let $\| \beta \| ^2 = r^2$ , $\| \Gamma \| ^2 = \omega^2$ , $\langle \Gamma, \beta \rangle = \eta$ , and fix $\tilde{\sigma}^2$ . Then as $n, d \to \infty$ such that $d / n \to \gamma \in (0, \infty)$ , it holds almost surely in $X$ for every $\lambda > 0$ that + +$$ +B _ {X} ^ {C} \left(\hat {\beta} _ {\lambda}\right)\rightarrow \mathcal {B} _ {\lambda} ^ {C} = \omega^ {2} + \tilde {r} ^ {2} \lambda^ {2} m ^ {\prime} (- \lambda) - 2 \left(\omega^ {2} + \eta\right) \lambda m (- \lambda) a n d \tag {7} +$$ + +$$ +V _ {X} ^ {C} \left(\hat {\beta} _ {\lambda}\right)\rightarrow \mathcal {V} _ {\lambda} ^ {C} = \tilde {\sigma} ^ {2} \gamma (m (- \lambda) - \lambda m ^ {\prime} (- \lambda)), \tag {8} +$$ + +where $m(\lambda) = ((1 - \gamma -\lambda) - \sqrt{(1 - \gamma - \lambda)^2 - 4\gamma\lambda}) / (2\gamma \lambda)$ and $\tilde{r}^2 = r^2 +\omega^2 +2\eta$ . Therefore $R_X^C (\hat{\beta}_\lambda)\to \mathcal{R}_\lambda^C = \mathcal{B}_\lambda^C +\mathcal{V}_\lambda^C +\tilde{\sigma}^2 +\omega^2$ . The corresponding limiting quantities for the min-norm interpolator can be obtained by taking the limit $\lambda \rightarrow 0^{+}$ in (7) and (8). + +From these limiting expressions we can see that the causal risk curve of the min-norm interpolator exhibits the double descent phenomenon: it diverges at the interpolation threshold $\gamma = 1$ due to the variance term and decreases again for $\gamma > 1$ . A corresponding visualization is given in Figure 4. Explicit regularization dampens the divergence of the variance term. While we are primarily interested in the causal risk, the corresponding statistical risk serves as a natural baseline. An analogue set of results for the statistical risk is given in Appendix C. These results have already been derived by Hastie et al. (2022) and can also be recovered as a special case of our causal results: for fixed statistical parameters $\tilde{\beta}$ and $\tilde{\sigma}^2$ , the statistical risk coincides with the causal risk of an unconfounded causal model defined with $\beta = \tilde{\beta}$ , $\sigma^2 = \tilde{\sigma}^2$ , and $\alpha = 0$ . In particular, the corresponding statistical limiting expressions are the same as in Theorem 3.1 after setting $\eta = \omega^2 = 0$ . + +Optimal statistical and causal regularization By directly optimizing the closed form expressions for limiting causal and statistical risks we can find the optimal causal and statistical regularization. + +![](images/fb265554ef9309d2d70ff1f0d09a78c5adae5f777d05e416d3793a0d3814601a.jpg) +Figure 3: Limiting causal excess risk $\mathcal{R}_0^C$ (without the constant $\tilde{\sigma}^2 +\omega^2$ ) of the min-norm interpolator for different causal signal strengths $S$ . Dashed lines are the corresponding null-risks $\omega^2$ , which are outperformed more often as $S$ increases. For $\gamma < 1$ , all three curves coincide. + +![](images/2e8ae9b5f7ce36826938dc06c0e31366cc0f62b4db19e8a71850e4a5833b3e9d.jpg) +Figure 4: Limiting bias-variance decomposition and causal excess risk of the min-norm interpolator (black) and optimally regularized ridge regression (red). Crosses indicate finite-sample risks of $n = d / \gamma$ samples with $d = 300$ . The finite risks are well-predicted by their theoretical limit. + +For any $\gamma \in (0,\infty)$ , the optimal statistical regularization $\lambda_S^*(\gamma) \coloneqq \arg \inf_{\lambda \in (0,\infty)} \mathcal{R}_\lambda^S$ can be expressed in closed-form as $\lambda_S^*(\gamma) = \mathrm{SNR}_S^{-1}\gamma$ . The closed-form expression for the optimal causal regularization parameter $\lambda_C^*(\gamma) \coloneqq \arg \inf_{\lambda \in (0,\infty)} \mathcal{R}_\lambda^C$ is a root of a 4th order polynomial and as such considerably intricate. For readability, we do not include it here. We investigate the behavior of the optimal causal and statistical regularization in Section 4 and 5. + +# 3.2 Basic Behavior of the Limiting Risk + +We start to analyze the results by assessing the basic behavior of the limiting causal risk. The causal risk of the null estimator $\hat{\beta} = 0$ serves as a natural baseline to evaluate the performance of the the min-norm interpolator and the ridge regression estimators. + +Regimes of the min-norm interpolator Theorem 3.1 characterizes the limiting causal risk of the min-norm interpolator. Its behavior is controlled by the causal signal-to-noise ratio, which we defined as $\mathrm{SNR_C} = (1 - \zeta)\mathrm{SNR_S}$ . However, as we will later see, the causal risk of the min-norm interpolator can be lower than null risk when $\zeta < 0.5$ . To distinguish the regimes of the min-norm interpolator, it is therefore convenient to consider the closely related quantity $S = (1 - 2\zeta)\mathrm{SNR_S}$ . It distinguishes between three different regimes (visualized in Figure 3). + +- For $S > 1$ , the causal signal dominates the noise and the min-norm interpolator can perform better than null risk in both under- and overparameterized regime. +- For $0 \leq S \leq 1$ , the causal signal is weaker than the noise. Only the underparameterized regime can beat the null risk, whereas the overparameterized regime is always worse. +- The previous two cases resemble the behavior of the statistical risk in the corresponding regimes of the statistical SNR. Contrary to the statistical risk, however, the causal risk admits a third regime $S < 0$ . In this case, the min-norm interpolator always performs worse than null risk. Here, the causal signal $\langle \beta, \tilde{\beta} \rangle$ is dominated by the confounding signal $\langle \Gamma, \tilde{\beta} \rangle$ , and interpolating the observational data overfits to the confounding. + +Bias and variance The bias-variance decomposition of the causal risk given in Theorem 3.1 is visualized in Figure 4 for the min-norm interpolator and the optimally ridge-regularized regressor. The figure also shows the causal risk based on finite samples from the model, which is in high agreement with our asymptotic results. We compare the causal risk to the corresponding statistical risk. First note that the causal and statistical variance terms coincide exactly for both the min-norm interpolator and ridge regressors. This is because the variance term of the squared loss depends only on the variance in the training data, but not on the target parameter $\beta$ or $\tilde{\beta}$ . Since the training data are the same for both causal and statistical learning, the variance terms trivially coincide. + +For the min-norm interpolator, as in the statistical case, the variance term is responsible for the double-descent behavior of the causal risk curve because it explodes at the interpolation threshold $\gamma = 1$ and decreases in the overparameterized regime $\gamma > 1$ . In the statistical setting, the bias strictly increases in the overparameterized regime and, as a consequence, the best risk is always achieved in the underparameterized setting. In contrast, the causal bias of the min-norm interpolator can be decreasing in the overparameterized regime and therefore the optimal causal risk can be achieved in the highly overparameterized regime $\gamma \rightarrow \infty$ . However, this only happens in the regime $S < 0$ where the risk of the min-norm interpolator is always worse than null risk. + +Figure 4 shows the causal risk of the optimally regularized ridge regression estimator which trivially is always below that of the min-norm risk. Similar to the statistical setting, the corresponding generalization curve does not exhibit the double descent phenomenon. There are qualitatively different reasons for why regularization helps in statistical and causal learning. For both statistical and causal learning, regularization decreases the shared variance, which corresponds to the finite-sample error. However, while the statistical bias always increases with regularization, the causal bias can actually decrease. This implies that regularization not only helps with the finite-sample error, but can also reduce the error due to confounding. + +Higher confounding implies higher causal risk for all $\lambda$ So far, we have investigated the causal risk under a single causal model. Now we can compare different causal models using the confounding strength measure $\zeta$ introduced in Section 2.1. The next proposition shows that $\zeta$ governs the hardness of causal learning from observational data. Specifically, the causal risk of the ridge regression for any $\lambda \in (0,\infty)$ increases as the causal model becomes more confounded. A proof is given in Appendix D. + +Proposition 3.2 (Causal Risk Increases with Confounding Strength). Consider the family of causal models parameterized as in (1) that entail the same observational distribution. Let $C_1$ and $C_2$ be two such causal models with confounding strengths $\zeta_1$ and $\zeta_2$ and alignments $\eta_1$ and $\eta_2$ (defined in Theorem 3.1), respectively. Then for all $\lambda, \gamma \in (0,\infty)$ , + +$$ +\zeta_ {1} > \zeta_ {2}, \eta_ {1} \leq \eta_ {2} \Rightarrow \mathcal {R} _ {\lambda} ^ {C _ {1}} > \mathcal {R} _ {\lambda} ^ {C _ {2}}. +$$ + +In particular, for any fixed $\eta$ , the measure of confounding strength $\zeta$ establishes a strict ordering of causal models. This includes the ICM under which $\eta = 0$ . + +# 4 Benign Causal Overfitting + +A large number of recent works suggest that minimum-norm interpolators can be optimal for statistical generalization (Belkin et al., 2018; Belkin et al., 2019a; Muthukumar et al., 2020). This phenomenon is often referred to as benign overfitting. Moreover, the optimal statistical generalization may even be achieved for negative regularization $\lambda < 0$ (Kobak et al., 2020; Bartlett et al., 2020; Tsigler et al., 2020). It is unclear, however, if such interpolators, which have implicit small-norm biases, can also be optimal when there is a shift between the training and test distributions. In particular, we ask: can the optimal causal regularization be 0 or even negative, that is, do we observe benign causal overfitting? To show that the optimal regularization can be negative, we simply show that the derivative of the causal risk at 0 is positive. We summarize our key findings in Theorem 4.1. + +Theorem 4.1 (Optimal Regularization can be Negative). For any causal model parameterized as in (1), the following cases distinguish between whether the min-norm interpolator is optimal or not. + +1. For negative confounding strength $\zeta < 0$ the optimal causal regularization $\lambda_C^*$ can be 0 or even negative. A necessary and sufficient condition for $\lambda_C^* \leq 0$ depends on the difference in causal and statistical signal-to-noise ratios and is given by + +$$ +\mathrm {S N R} _ {\mathrm {C}} - \mathrm {S N R} _ {\mathrm {S}} \geq \frac {\gamma \max \{1 , \gamma \}}{(1 - \gamma) ^ {2}}. +$$ + +2. For positive confounding strength $\zeta > 0$ the optimal causal regularization is positive $\lambda_C^* > 0$ and $\mathcal{R}_0^C > \mathcal{R}_{\lambda_C^*}^C$ , hence regularization is beneficial. This includes the ICM. + +In the highly overparameterized regime $(\gamma \rightarrow \infty)$ , the benefit of explicit regularization vanishes and both the causal and statistical risks of the ridge regression estimator converge to their corresponding + +null risks, independently of the regularization. We do not refer to this as benign overfitting. However, we can observe benign causal overfitting when the causal SNR is larger than the statistical SNR $(\zeta < 0)$ , which happens when causal and statistical parameter are strongly aligned. This implies that the norm of the statistical parameter is smaller than the norm of the causal parameter. Consequently, statistical regressors are implicitly biased towards solutions of smaller norm and causal learning exhibits self-induced regularization. Compare this to benign statistical overfitting, which happens for certain alignments between the regression parameter $\tilde{\beta}$ and the covariance matrix $\Sigma$ . In our isotropic setting $\Sigma = I_d$ , we can therefore never observe benign statistical overfitting, but we can observe benign causal overfitting. This phenomenon occurs in both the underparameterized as well as the overparameterized regime. The range of $\gamma$ for which the optimal causal regularization is negative increases with the dominance of the causal signal over the statistical signal. As $\gamma$ approaches the interpolation threshold, it becomes harder for the optimal causal regularization to be negative. When the causal SNR is smaller than the statistical SNR $(\zeta > 0)$ and in particular under the ICM $(0 < \zeta \leq 1)$ , the optimal causal regularization is strictly positive and the benefit of explicit regularization does not vanish. This can be the case even when the optimal statistical regularization vanishes. To see this consider the statistical risk in the highly underparameterized regime $\gamma \rightarrow 0$ . In this regime, the benefit of explicit regularization vanishes and the min-norm interpolator indeed achieves the optimal statistical risk. The optimal causal regularization is given explicitly by $\lambda_C^* = \zeta / (1 - \zeta)$ for $0 \leq \zeta \leq 1$ and $\lambda_C^* = \infty$ for $\zeta > 1$ . This is strictly positive and increasing in the confounding strength $\zeta$ , and in fact diverges as $\zeta$ approaches 1 (see Theorem 5.2). + +# 5 On Optimal Regularization + +In this section, we investigate two key questions which are natural in the context of our work. How does the optimal causal regularization $\lambda_C^*$ compare to the optimal statistical regularization $\lambda_S^*$ ? What is the dependence of the optimal causal regularization $\lambda_C^*$ on the confounding strength $\zeta$ ? + +Optimal statistical vs. causal regularization When the training and test distributions coincide, approaches such as cross-validation or information criteria (for example AIC or BIC) can be used to estimate the regularization parameter for optimal out-of-sample generalization. However, choosing the correct regularization parameter for causal learning can be challenging without interventional data. To understand the optimal causal regularization, it is natural to compare it to the optimal statistical regularization, which can usually be estimated from data. Interestingly, our analysis reveals that when confounding strength is positive $\zeta > 0$ and in particular under the ICM one needs to regularize more strongly for causal generalization than for statistical generalization. However, when the confounding strength is negative, that is, when the causal signal dominates the statistical signal, the optimal causal regularization $\lambda_{C}^{*}$ can actually be smaller than the optimal statistical regularization $\lambda_{S}^{*}$ . We formally present this result in Theorem 5.1. + +Theorem 5.1 (Optimal Statistical vs. Causal Regularization). For any causal model parameterized as in (1), the condition $\zeta = 0$ defines a phase transition for the optimal regularization via + +$$ +\zeta < 0 \iff \lambda_ {C} ^ {*} < \lambda_ {S} ^ {*}, \qquad \zeta = 0 \iff \lambda_ {C} ^ {*} = \lambda_ {S} ^ {*}, \quad a n d \quad \zeta > 0 \iff \lambda_ {C} ^ {*} > \lambda_ {S} ^ {*}. +$$ + +In particular under the ICM, the optimal causal regularization $\lambda_C^*$ is always strictly larger than the optimal statistical regularization $\lambda_S^*$ , unless $\zeta = 0$ , in which case they coincide. + +Dependence on confounding strength $\zeta$ The problem of causal learning from observational data is a distribution shift problem where the distribution of the training data is shifted from that of the test distribution. As discussed earlier in Proposition 3.2, the confounding strength measure $\zeta$ quantifies the strength of this distribution shift. Therefore, we expect the optimal causal regularization to increase with confounding strength. Theorem 5.2 indeed confirms this intuition. + +Theorem 5.2 (Increasing Confounding Strength Requires Stronger Regularization). Consider the family of causal models parameterized as in (1) that entail the same observational distribution. The optimal causal regularization $\lambda_C^*$ only depends on the confounding strength $\zeta$ and $\lambda_C^*$ is an increasing function in $\zeta$ . More specifically, using $\varrho = -\mathrm{SNR}_S^{-1}\gamma \max \left\{1,\gamma \right\} /(1 - \gamma)^2$ : + +$$ +\varrho < \zeta < 1 \Longrightarrow \lambda_ {C} ^ {*} \in (0, \infty) w i t h \partial_ {\zeta} \lambda_ {C} ^ {*} > 0, +$$ + +$\lambda_C^* = 0$ if $\zeta \leq \varrho$ and $\lambda_C^* = \infty$ for $\zeta \geq 1$ . + +# 6 Summary and Extensions + +We characterize the role of explicit regularization for causal learning from observational data by computing the asymptotic risk of ridge-regularized regressors and the min-norm interpolator (Theorem 3.1). Under the principle of independent causal mechanisms (ICM), we find that causal learning requires stronger regularization than statistical learning (Theorem 5.1). A practical implication is that the regularization parameter for causal learning should be chosen larger than what is suggested by cross-validation. We can precisely state how much larger based on an estimate of confounding strength (Janzing et al., 2017; Janzing et al., 2018). Beyond ICM, we show that strong alignments between causal and statistical parameters can cause self-induced regularization and lead to benign causal overfitting (Theorem 4.1). One could consider generalizing our assumptions: arbitrary covariances, shifts in the marginal distributions of covariates, soft interventions, more complex hypothesis classes, or non-linear causal relationships. Since the linear model already exhibits rich behavior, we focus in this paper on understanding the simple setting. Below, we briefly discuss extensions of our analysis to causal learning under soft interventions, non-linearity, and non-Gaussianity. + +Soft interventions It is not always appropriate to consider causal learning under hard interventions. Instead, it is often of interest to consider soft interventions. In these settings, the qualitative statements derived from our analysis still hold. To illustrate this, we consider the class of shift interventions where the structural dependence of the covariates $x$ is not destroyed as in the case of hard interventions but the observed covariates are merely perturbed (i.e., interventions of the form $do(x := x + \nu)$ ). Then it turns out that Causal risk $_{\text{soft}} =$ Causal risk $_{\text{hard}} +$ Statistical risk. From our results, it then follows that under ICM, $\lambda^{\text{statistical}} \leq \lambda_{\text{soft}}^{\text{causal}} \leq \lambda_{\text{hard}}^{\text{causal}}$ . This also supports our intuition since under soft interventions, we typically aim to achieve a tradeoff between statistical and causal predictability. We include a complete analysis under shift interventions in Appendix F. + +Extensions to non-linear models It is feasible to extend the analysis to structural causal models that arise in a reproducing kernel Hilbert space corresponding to a positive definite kernel (i.e., where the best statistical model $\tilde{f}$ and the best causal model $f$ are functions in some RKHS). There are two major technical challenges to deriving the theoretical analysis in such non-linear settings. Both are beyond what can be done in this paper and are left for future work, but we briefly outline them below. + +1. Extend the definition of confounding strength $\zeta$ beyond the linear setting. Since such a definition is non-trivial already in the linear setting, it is challenging to meaningfully generalize this to the non-linear setting. However, under non-linear causal models in the RKHS, we can naturally extend this definition by replacing the Euclidean norms with functional norms in the RKHS. Generalizing the analysis beyond this setting would require further careful consideration. +2. Derive limiting expressions for causal risk of regularized regressors in a non-linear hypothesis class. In the case of kernel regression, this would still be feasible via recent random matrix theory results [27]. By optimizing the limiting expressions with respect to the regularization parameter, one can obtain the parameter that achieves the optimal causal risk and subsequently identify the relationship between optimal causal regularization and confounding strength. + +Beyond Gaussianity The analysis can be extended beyond the Gaussian setting by considering random variables generated by finite mixtures of Gaussians. Due to the universality phenomenon in the high-dimensional limit, we believe that our limiting expressions (and the qualitative messages derived henceforth) would be rather robust to shifts in the marginal distribution as long as moments of order $(4 + \delta)$ for some $\delta > 0$ are bounded. We conducted experiments to verify this claim and the corresponding results can be found in Appendix G. They show that for distributions with finite 4th moments, the finite-sample risks of the min-norm interpolator and causally optimally regularized ridge regressor closely match the theoretically derived asymptotic risks. + +# Acknowledgments and Disclosure of Funding + +This work has been supported by the German Research Foundation through the Cluster of Excellence "Machine Learning - New Perspectives for Science" (EXC 2064/1:390727645) and the BMBF Tübingen AI Center (FKZ: 01IS18039A). The authors thank the International Max Planck Research School for Intelligent Systems (IMPRS-IS) for supporting Leena C Vankadara and Luca Rendsburg. + +# References + +Angrist, Joshua D and Alan B Keueger (1991). "Does compulsory school attendance affect schooling and earnings?" The Quarterly Journal of Economics. +Bai, Zhidong and Jack W Silverstein (2010). Spectral analysis of large dimensional random matrices. Springer. +Bartlett, Peter L et al. (2020). "Benign overfitting in linear regression". Proceedings of the National Academy of Sciences. +Belkin, Mikhail (2021). "Fit without fear: remarkable mathematical phenomena of deep learning through the prism of interpolation". Acta Numerica. +Belkin, Mikhail, Siyuan Ma, and Soumik Mandal (2018). "To understand deep learning we need to understand kernel learning". International Conference on Machine Learning (ICML). +Belkin, Mikhail, Alexander Rakhlin, and Alexandre B Tsybakov (2019a). "Does data interpolation contradict statistical optimality?" International Conference on Artificial Intelligence and Statistics (AISTATS). +Belkin, Mikhail et al. (2019b). "Reconciling modern machine-learning practice and the classical bias-variance trade-off". Proceedings of the National Academy of Sciences. +Blanchet, Jose, Yang Kang, and Karthyek Murthy (2019). "Robust Wasserstein profile inference and applications to machine learning". Journal of Applied Probability. +Byrd, Jonathon and Zachary Lipton (2019). "What is the effect of importance weighting in deep learning?" International Conference on Machine Learning (ICML). +Dicker, Lee H (2016). "Ridge regression and asymptotic minimax estimation over spheres of growing dimension". Bernoulli. +Dobrian, Edgar and Stefan Wager (2018). "High-dimensional asymptotics of prediction: Ridge regression and classification". The Annals of Statistics. +Donhauser, Konstantin et al. (2021). "Interpolation can hurt robust generalization even when there is no noise". Advances in Neural Information Processing Systems (NeurIPS). +Feldman, Vitaly (2020). "Does learning require memorization? a short tale about a long tail". Symposium on Theory of Computing (STOC). +Gao, Rui, Xi Chen, and Anton J Kleywegt (2017). "Distributional robustness and regularization in statistical learning". arXiv preprint arXiv:1712.06050. +Gulrajani, Ishaan and David Lopez-Paz (2021). "In Search of Lost Domain Generalization". International Conference on Learning Representations (ICLR). +Hachem, Walid, Philippe Loubaton, and Jamal Najim (2007). "Deterministic equivalents for certain functionals of large random matrices". The Annals of Applied Probability. +Hastie, Trevor et al. (2022). "Surprises in high-dimensional ridgeless least squares interpolation". The Annals of Statistics. +Janzing, Dominik (2019). "Causal Regularization". Advances in Neural Information Processing Systems (NeurIPS). +Janzing, Dominik and Bernhard Scholkopf (2010). "Causal Inference Using the Algorithmic Markov Condition". IEEE Transactions on Information Theory. +- (2017). "Detecting Confounding in Multivariate Linear Models via Spectral Analysis". Journal of Causal Inference. +- (2018). "Detecting non-causal artifacts in multivariate linear regression models". International Conference on Machine Learning (ICML). +Kobak, Dmitry, Jonathan Lomond, and Benoit Sanchez (2020). "The Optimal Ridge Penalty for Real-world High-dimensional Data Can Be Zero or Negative due to the Implicit Ridge Regularization." Journal of Machine Learning Research (JMLR). +Kuhn, Daniel et al. (2019). "Wasserstein distributionally robust optimization: Theory and applications in machine learning". Operations research & management science in the age of analytics. +Lemeire, Jan and Dominik Janzing (2013). "Replacing Causal Faithfulness with Algorithmic Independence of Conditionals". Minds and Machines. +Liang, Tengyuan and Alexander Rakhlin (2020). "Just interpolate: Kernel "ridgeless" regression can generalize". The Annals of Statistics. +Marčenko, Vladimir A and Leonid Andreevich Pastur (1967). "Distribution of eigenvalues for some sets of random matrices". Mathematics of the USSR-Sbornik. +Mei, Song and Andrea Montanari (2021). "The Generalization Error of Random Features Regression: Precise Asymptotics and the Double Descent Curve". Communications on Pure and Applied Mathematics. + +Muthukumar, Vidya et al. (2020). "Harmless interpolation of noisy data in regression". IEEE Journal on Selected Areas in Information Theory. +Pearl, Judea (2009). "Causal inference in statistics: An overview". Statistics surveys. +Peters, Jonas, Dominik Janzing, and Bernhard Scholkopf (2017). Elements of causal inference: foundations and learning algorithms. The MIT Press. +Rothenhausler, Dominik et al. (2021). "Anchor regression: Heterogeneous data meet causality". Journal of the Royal Statistical Society: Series B (Statistical Methodology). +Rubio, Francisco and Xavier Mestre (2011). "Spectral convergence for a general class of random matrices". Statistics & probability letters. +Sagawa, Shiori et al. (2020). "An investigation of why overparameterization exacerbates spurious correlations". International Conference on Machine Learning (ICML). +Shafieezadeh Abadeh, Soroosh, Peyman M Mohajerin Esfahani, and Daniel Kuhn (2015). "Distributionally robust logistic regression". Advances in Neural Information Processing Systems (NeurIPS). +Shafieezadeh-Abadeh, Soroosh, Daniel Kuhn, and Peyman Mohajerin Esfahani (2019). "Regularization via mass transportation". Journal of Machine Learning Research (JMLR). +Silverstein, Jack W (1995). "Strong convergence of the empirical distribution of eigenvalues of large dimensional random matrices". Journal of Multivariate Analysis. +Tsigler, Alexander and Peter L Bartlett (2020). "Benign overfitting in ridge regression". arXiv preprint arXiv:2009.14286. +Vankadara, Leena Chennuru et al. (2021). "Causal Forecasting: Generalization Bounds for Autoregressive Models". arXiv preprint arXiv:2111.09831. +Xu, Huan, Constantine Caramanis, and Shie Mannor (2009). "Robustness and Regularization of Support Vector Machines." Journal of Machine Learning Research (JMLR). +Zhang, Chiyuan et al. (2021). "Understanding deep learning (still) requires rethinking generalization". Communications of the ACM. +Zhu, Shixiang et al. (2020). "Distributionally Robust Weighted $k$ -Nearest Neighbors". arXiv preprint arXiv:2006.04004. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] While our analysis is exhaustive, we paid special attention to the additional ICM assumption described at the end of Section 2. Further possible generalizations of our model are discussed in Section 6. +(c) Did you discuss any potential negative societal impacts of your work? [Yes] Right before Section 3.1, we cautioned against using our results on optimal causal regularization as an excuse to dismiss the hardness of causal learning. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] +(b) Did you include complete proofs of all theoretical results? [Yes] All proofs are deferred to the appendix and referenced correspondingly in the main paper. + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [N/A] +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [N/A] +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A] +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [N/A] + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [N/A] +(b) Did you mention the license of the assets? [N/A] +(c) Did you include any new assets either in the supplemental material or as a URL? [N/A] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/interpolationandregularizationforcausallearning/images.zip b/interpolationandregularizationforcausallearning/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..78b2b82820877db74882b51f9d27c21394fd3974 --- /dev/null +++ b/interpolationandregularizationforcausallearning/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ef0feaa0309562604b9c88a15ee8c8b73df9f695b4876be343ca46197e874ded +size 182061 diff --git a/interpolationandregularizationforcausallearning/layout.json b/interpolationandregularizationforcausallearning/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..5d00d653d931ae9a29173379dda4fc6e91b97ee0 --- /dev/null +++ b/interpolationandregularizationforcausallearning/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8581948c01845a37a390b3c5128d5c8a5c4c07b79635a276706fa856a5f88c3b +size 544905 diff --git a/interpretingoperationselectionindifferentiablearchitecturesearchaperspectivefrominfluencedirectedexplanations/475e36d0-3de3-497f-969c-4dfd36c7bd31_content_list.json b/interpretingoperationselectionindifferentiablearchitecturesearchaperspectivefrominfluencedirectedexplanations/475e36d0-3de3-497f-969c-4dfd36c7bd31_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..f226dfa743503a45ed5d47d2ba05616792bca409 --- /dev/null +++ b/interpretingoperationselectionindifferentiablearchitecturesearchaperspectivefrominfluencedirectedexplanations/475e36d0-3de3-497f-969c-4dfd36c7bd31_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1703c2c5f5c6316c58d526f5d0102d1b5a04bb8dc4d78ff65a1e118fc3212b5f +size 83371 diff --git a/interpretingoperationselectionindifferentiablearchitecturesearchaperspectivefrominfluencedirectedexplanations/475e36d0-3de3-497f-969c-4dfd36c7bd31_model.json b/interpretingoperationselectionindifferentiablearchitecturesearchaperspectivefrominfluencedirectedexplanations/475e36d0-3de3-497f-969c-4dfd36c7bd31_model.json new file mode 100644 index 0000000000000000000000000000000000000000..6f89d07e44ed130bbf50e0efe1d22ceeb80c799c --- /dev/null +++ b/interpretingoperationselectionindifferentiablearchitecturesearchaperspectivefrominfluencedirectedexplanations/475e36d0-3de3-497f-969c-4dfd36c7bd31_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:534d86311863d5475a1857c76a24481f554c4ed5f5d600dc20c0b2c3758e8749 +size 106888 diff --git a/interpretingoperationselectionindifferentiablearchitecturesearchaperspectivefrominfluencedirectedexplanations/475e36d0-3de3-497f-969c-4dfd36c7bd31_origin.pdf b/interpretingoperationselectionindifferentiablearchitecturesearchaperspectivefrominfluencedirectedexplanations/475e36d0-3de3-497f-969c-4dfd36c7bd31_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b9300c83b0b108a379062226c87fa2f12f075793 --- /dev/null +++ b/interpretingoperationselectionindifferentiablearchitecturesearchaperspectivefrominfluencedirectedexplanations/475e36d0-3de3-497f-969c-4dfd36c7bd31_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c3a9a526ff1661737b7a12d57c4272c3fcda65f3b77e6c52ed1d5324d3091605 +size 570594 diff --git a/interpretingoperationselectionindifferentiablearchitecturesearchaperspectivefrominfluencedirectedexplanations/full.md b/interpretingoperationselectionindifferentiablearchitecturesearchaperspectivefrominfluencedirectedexplanations/full.md new file mode 100644 index 0000000000000000000000000000000000000000..14fe2332ecdd2a3a1e35b3a185eda7f74b7dee26 --- /dev/null +++ b/interpretingoperationselectionindifferentiablearchitecturesearchaperspectivefrominfluencedirectedexplanations/full.md @@ -0,0 +1,333 @@ +# Interpreting Operation Selection in Differentiable Architecture Search: A Perspective from Influence-Directed Explanations + +Miao Zhang $^{1,2}$ , Wei Huang $^{3}$ , Bin Yang $^{4*}$ $^{1}$ Harbin Institute of Technology (Shenzhen) $^{2}$ Aalborg University + $^{3}$ RIKEN AIP $^{4}$ East China Normal University +zhangmiao@hit.edu.cn; wei.huang.vr@riken.jp; byang@dase.ecnu.edu.cn + +# Abstract + +The Differentiable ARchiTecture Search (DARTS) has dominated the neural architecture search community due to its search efficiency and simplicity. DARTS leverages continuous relaxation to convert the intractable operation selection problem into a continuous magnitude optimization problem which can be easily handled with gradient-descent, while it poses an additional challenge in measuring the operation importance or selecting an architecture from the optimized magnitudes. The vanilla DARTS assumes the optimized magnitudes reflect the importance of operations, while more recent works find this naive assumption leads to poor generalization and is without any theoretical guarantees. In this work, we leverage influence functions, the functional derivatives of the loss function, to theoretically reveal the operation selection part in DARTS and estimate the candidate operation importance by approximating its influence on the supernet with Taylor expansions. We show the operation strength is not only related to the magnitude but also second-order information, leading to a fundamentally new criterion for operation selection in DARTS, named Influent Magnitude. Empirical studies across different tasks on several spaces show that vanilla DARTS and its variants can avoid most failures by leveraging the proposed theory-driven operation selection criterion. + +# 1 Introduction + +Neural Architecture Search (NAS) has been successfully applied to automating the process of neural network design for a broad of deep learning fields [35, 41, 48, 50]. However, the early NAS methods are often heavily computational-expensive and require hundreds or even thousands GPU days [34]. To improve the efficiency for more practical applications, a lot of recent works are proposed based on one-shot (also known as weight-sharing) paradigm [33] to improve the search efficiency significantly. Differentiable ARchiTecture Search (DARTS) [27], as the most popular one-shot NAS method, has dominated this area since its appearance. DARTS leverages continuous relaxation to convert the intractable operation selection problem into a continuous magnitude optimization problem, which can be gracefully solved by gradient-descent based on the bi-level optimization [8]. A discrete architecture is then derived based on the optimized magnitudes through operation selection. + +Although the continuous relaxation makes DARTS able to optimize the magnitudes with rigorous theoretical formulation and guarantees [51] in the supernet training part, it poses an additional challenge in selecting a discrete architecture from the optimized magnitudes that there is no existing work can give a theoretical explanation. DARTS is based on the weight-sharing paradigm [33], which + +![](images/40815844e1e5e74253f0ff60ddf7eaf70c073917b52b81ce7662ade154af884b.jpg) +Figure 1: Pictorial depiction of discretization part in DARTS. There is a gap between the train-from-the-scratch (or fine-tuned) weights $\hat{\theta}^*$ based on $\hat{\alpha}$ after discretization and the trained supernet weights $\theta^*$ . This paper leverages influence functions to quantify the disparity between $\mathcal{L}(\hat{\theta}^*,\hat{\alpha})$ and $\mathcal{L}(\theta^{*},\hat{\alpha})$ and show how weights $\theta$ changes with $\alpha$ . The discretization process can be the argmax adopted by DARTS [27], the perturbation-based DARTS-PT [40], and so on. + +assumes that the derived discrete architecture with the trained supernet weights can predict its trainfrom-scratch performance. However, there is a gap between the two groups of weights, as depicted in Figure 1. The vanilla DARTS assumes the optimized magnitudes can reflect the importance of the candidate operations, while Wang et al. [40] empirically show that the operation magnitude does not necessarily indicate how important the operation is in a trained supernet. For example, DARTS prefers skip-connection [45] as its magnitude always dominates the remaining operations, while an architecture with intensive skip-connections generally leads to poor performance. Accordingly, Wang et al. [40] proposed a heuristic perturbation-based method, DARTS-PT, to measure each candidate operation's influence on the supernet by alternatively removing each one to calculate the supernet performance drop. Despite DARTS-PT can partially relieve the failure of DARTS, we empirically found that DARTS-PT still prefers skip-connection than other operations. One potential reason is that skip-connection's magnitude is much higher than other candidate operations, and directly removing skip-connections usually greatly deteriorates the supernet performance. In addition, DARTS-PT lacks theoretical explanations and guarantees. For example, the intuitive way to show the importance of a candidate operation importance is the leave-one-out retraining [22], while which should fine-tune the supernet to get the performance drop after removing every operation rather than directly measuring the performance drop as DARTS-PT, since there also exists a gap between the two groups of weights, as visualized in Figure 1. Section 3 also give an analysis on why perturbation-based method fails. + +This paper focuses on filling the gap of theoretical explanations for the discrete operation selection part in DARTS. Instead of considering a heuristic approach to measure the operation importance [27, 40], this paper first rigorously shows how the architecture parameters discretization poses an influence on the supernet weights in DARTS, and estimates the supernet performance drop accordingly. Our method is motivated by influence function [22], which is originally designed to understand the effect of removing an individual training point, while we leverage Taylor's approximation to interpret the supernet performance drop when removing a candidate operation. In this way, we show the operation strength is not only related to the magnitude but also second-order information, and we accordingly design a new criterion for the operation selection in DARTS, called Influential Magnitude $(\mathcal{I}_{\mathcal{M}})$ . Then, to avoid calculating the inverse of the Hessian matrix with respect to the model weights, we further utilize the Neumann series [29] and Sherman-Morrison formula [37] to approximate the Inverse-Hessian-Vector Products (IHVPs), making the proposed method applicable to DARTS. Finally, we verify the effectiveness of our method on several NAS benchmark datasets and the common DARTS search space. To summarize, we make the following contributions: + +- This paper deepens our understanding of the operation selection in DARTS. We reformulate the operation selection in DARTS by approximating its influence on the supernet with Taylor expansions, which can thus gracefully interpret how the validation performance changes when selecting different operations without any additional fine-tuning. + +- We theoretically reveal the operation strength is not only related to the magnitude but also the second-order information, and accordingly derive a fundamentally new criterion to measure the operation sensitivity, which we call Influential Magnitude $(\mathcal{I}_{\mathcal{M}})$ , for architecture selection in DARTS. Further, to make the proposed criterion practical, we devise several methods to estimate the Inverse-Hessian-Vector Products (IHVPs) in calculating the second-order information. +- Extensive experiments verify the effectiveness of the proposed criterion, which significantly improves the performance of vanilla DARTS and other baselines on the NAS benchmark datasets and the common DARTS search space. We show DARTS is still a strong NAS baseline when considering a more reasonable and theory-driven operation strength metric. + +# 2 Preliminaries: DARTS and Influence Function + +Typically, NAS focuses on finding a cell structure that is represented as a directed acyclic graph (DAG) with $N$ nodes and $E$ edges affiliated with operations, which is a discrete and hard-to-optimize problem. To enable the gradient-descent for architecture search, DARTS [27] leverages softmax as the continuous relaxation function to transform the architecture search into a continuous magnitude optimization problem: + +$$ +\alpha_ {o} = \frac {\exp (\bar {\alpha} _ {o})}{\sum_ {o ^ {\prime} \in \mathcal {O}} \exp (\bar {\alpha} _ {o ^ {\prime}})}, +$$ + +where $\mathcal{O}$ contains all candidate operations and DARTS is to optimize the magnitude $\alpha_{o}$ , which can be formulated as a bi-level optimization problem [8]: + +$$ +\min _ {\alpha} \mathcal {L} _ {v a l} \left(\theta^ {*} (\alpha), \alpha\right) \tag {1} +$$ + +$$ +\begin{array}{l} \text {s . t .} \quad \theta^ {*} (\alpha) = \operatorname {a r g m i n} _ {\theta} \mathcal {L} _ {\text {t r a i n}} (\theta , \alpha), \end{array} +$$ + +where $\alpha$ is the continuous architecture representation and $\theta$ is the supernet weights. The nested formulation in DARTS is the same as the gradient-based hyperparameter optimization with bi-level optimization, which has been validated in a broad applications [13, 31, 32]. After the bi-level optimization, DARTS usually considers heuristic methods to derive the final architecture, where the most popular one is to select the operations with the highest magnitudes, $\hat{\alpha} = \arg\max(\alpha)$ . Despite its simplicity, more recent works [7, 40, 45, 47-49, 52] found that DARTS could hardly find satisfactory architectures. + +Different from the majority of existing works that attribute the failure of DARTS to its magnitude optimization part, which is under a rigorous theoretical formulation [51], we revisit DARTS from the perspective of the architecture selection and try to reveal this part with theoretical explanations, where we aim to identify the operation that will contribute most to the supernet performance, through the lens of influence functions [22] to mathematically model the architecture selection process instead of heuristics. + +The influence function [18] is a classic technique from robust statistics that reveals how model parameters change as we upweight or perturb a specific training sample, which has been applied in explaining a lot of modern machine learning applications [2, 22, 30, 53]. More specifically, given a model with parameters $\theta^{*}$ after trained on a full training set $\mathcal{D}$ , influence function aims to study the change of parameters $\hat{\theta}^{*} - \theta^{*}$ when retraining the model parameters to $\hat{\theta}^{*}$ after deleting a specific training point $z$ , that $\hat{\mathcal{D}} = \mathcal{D} - z$ . Rather than retraining the model for every removed point, Koh and Liang [22] estimated the influence by upweighting the data point with some small $\epsilon$ . With leveraging the Taylor expansions, the influence on the model parameters can be estimated as: + +$$ +\mathcal {I} (z, \theta) = \frac {d \hat {\theta} ^ {*}}{d \epsilon} = - H _ {\theta^ {*}} ^ {- 1} \nabla_ {\theta} \mathcal {L} (z, \theta^ {*}), \tag {2} +$$ + +and its influence on the loss function of a test point $z_{\mathrm{test}}$ is accordingly calculated as: + +$$ +\mathcal {I} (z, \mathcal {L}) = \frac {d \mathcal {L} \left(z _ {\text {t e s t}} , \hat {\theta} ^ {*}\right)}{d \epsilon} = - \nabla_ {\theta} \mathcal {L} \left(z _ {\text {t e s t}}, \theta^ {*}\right) ^ {\top} H _ {\theta^ {*}} ^ {- 1} \nabla_ {\theta} \mathcal {L} (z, \theta^ {*}). \tag {3} +$$ + +The detailed derivation of the two influence functions can be found in [22]. Based on Eq.(2) and (3), we can now approximate the validation performance drop when removing a training point $z$ from the training set without conducting the time-consuming retraining. + +The original work of influence functions for modern machine learning [22], which is also called as first-order influence functions, only considers a very small change on $\theta^{*}$ as it only changes one training point, so the first-order Taylor expansion is satisfied to calculate the influence. However, weighting a group of data points may lead to a large change on $\theta^{*}$ [4, 5], which violates the small perturbation assumption of the first-order influence functions. To make the influence function capture the model parameter change more precisely, Basu et al. [4] extended influence functions using second-order approximations under the assumption that the third-order derivatives of the loss function at optimum is small. For the quadratic loss, the third-order derivatives of the loss are zero or very small, and Basu et al. [4] empirically verified that the this assumption also approximately held for the classification problem with cross-entropy loss function. + +Different from existing works that analyze the effects on model parameters of removing data points, this paper creatively adapts influence functions to estimate the importance of candidate operations on a trained supernet in differentiable architecture search. We also follow the assumption in [4] that neglect the third-order and higher derivatives of the loss, and analyze the operation selection part, which is an additional process after bi-level supernet training in DARTS, through the lens of influence function in the following sections. + +# 3 Interpret Operation Selection through Influence Functions + +This section aims to understand how the model parameters $\theta$ (a.k.a. the supernet weights in DARTS) would change when we derive the discrete architecture from the optimized continuous operation magnitudes, a.k.a. architecture selection. In this paper, our analysis only focuses on this architecture selection part after the bi-level supernet training process is finished. To be more clearly, we first define the optimized operation magnitudes by DARTS as $\alpha$ with the optimized supernet weights $\theta^{*}$ , and the validation loss is $\mathcal{L}(\theta^{*},\alpha)$ for simplicity. Then, we define the architecture parameters change to $\hat{\alpha}$ after discretization, and the corresponding ground-truth supernet weights and validation loss are defined as $\hat{\theta}^{*}$ and $\mathcal{L}(\hat{\theta}^{*},\hat{\alpha})$ , respectively. Rather than deleting a single data point that only brings small changes on the model parameters [22], the change of architecture parameters can lead to a considerable change on $\theta$ , so we leverage the second-order approximation [4] to reveal the supernet weights change. With second-order Taylor expansion on $\hat{\theta}^{*}$ for $\mathcal{L}(\hat{\theta}^{*},\hat{\alpha})$ , we have: + +$$ +\Delta \mathcal {L} = \mathcal {L} \left(\hat {\theta} ^ {*}, \hat {\alpha}\right) - \mathcal {L} \left(\theta^ {*}, \alpha\right) \approx \mathcal {L} \left(\theta^ {*}, \hat {\alpha}\right) + \Delta \theta^ {T} \frac {\partial \mathcal {L} \left(\theta^ {*} , \hat {\alpha}\right)}{\partial \theta} + 1 / 2 \Delta \theta^ {T} \frac {\partial^ {2} \mathcal {L} \left(\theta^ {*} , \hat {\alpha}\right)}{\partial \theta \partial \theta} \Delta \theta - \mathcal {L} \left(\theta^ {*}, \alpha\right), \tag {4} +$$ + +where $\Delta \theta = \hat{\theta}^{*} - \theta^{*}$ , and $\mathcal{L}$ is the validation loss function in Eq.(1). For example, when we only remove one candidate operation as DARTS-PT [40] to measure the operation importance, the influence of this discretization brings to $\theta$ is $\Delta \theta$ , and the true validation loss change should be $\mathcal{L}(\hat{\theta}^{*},\hat{\alpha}) - \mathcal{L}(\theta^{*},\alpha)$ as stated in Eq.(4) rather than $\mathcal{L}(\theta^{*},\hat{\alpha}) - \mathcal{L}(\theta^{*},\alpha)$ used by DARTS-PT. As shown in Eq.(4), we need to calculate $\Delta \theta$ to get $\Delta \mathcal{L}$ after we change the $\alpha$ to $\hat{\alpha}$ , while we try to avoid the time-consuming retraining process through leveraging influence functions [22] to estimating $\hat{\theta}^{*}$ . Based on the implicit function theorem [29, 51], the validation loss change after discretizing $\alpha$ to $\hat{\alpha}$ can be approximated as the following theorem. + +Theorem 1 Suppose that DARTS obtains the optimized architecture parameter $\alpha$ with supernet weights $\theta^{*}$ after supernet training, $\alpha$ changes to $\hat{\alpha}$ when conducting architecture discretization, and the train-from-scratch validation loss for $\hat{\alpha}$ is $\mathcal{L}(\hat{\theta}^{*},\hat{\alpha})$ . If the third and higher derivatives of the loss function $\mathcal{L}$ at optimum is zero or sufficiently small [4], and with $\frac{\partial\mathcal{L}(\hat{\theta}^{*},\hat{\alpha})}{\partial\theta} = 0$ , we have + +$$ +\Delta \mathcal {L} = \mathcal {L} (\hat {\theta} ^ {*}, \hat {\alpha}) - \mathcal {L} (\theta^ {*}, \alpha) \approx \mathcal {L} (\theta^ {*}, \hat {\alpha}) - \mathcal {L} (\theta^ {*}, \alpha) - 1 / 2 \frac {\partial \mathcal {L} (\theta^ {*} , \hat {\alpha})}{\partial \theta} ^ {T} \frac {\partial^ {2} \mathcal {L} (\theta^ {*} , \hat {\alpha})}{\partial \theta \partial \theta} ^ {- 1} \frac {\partial \mathcal {L} (\theta^ {*} , \hat {\alpha})}{\partial \theta}. \tag {5} +$$ + +Theorem 1 states that we can estimate the train-from-scratch validation performance of $\hat{\alpha}$ without any retraining. During the discretization process, we can apply the $\arg\max$ on all edges by one-shot that $\hat{\alpha} = \arg\max(\alpha)$ , or only discretize one edge in each step, or remove one candidate operation from one edge as DARTS-PT [40] which can be formulated as the first part of Eq.(5), $\mathcal{L}(\theta^{*}, \hat{\alpha}) - \mathcal{L}(\theta^{*}, \alpha)$ . We prefer an iterative discretization process that only applies a small change on $\alpha$ as DARTS-PT, since our theoretical analysis in the next corollary will show that the error bound of our approximation is related to $\Delta \alpha = \hat{\alpha} - \alpha$ . Before our analysis, we give the following common assumptions, which are also considered in several recent bi-level optimization problems [9, 15-17, 51]. + +Assumption 1 For any $\theta$ and $\alpha$ , $\mathcal{L}(\cdot, \alpha)$ and $\mathcal{L}(\theta, \cdot)$ are Lipschitz continuous with $C_f > 0$ and $C_L > 0$ , respectively. + +Assumption 2 $\mathcal{L}(\theta, \alpha)$ is twice differentiable with constant $C_H$ and is $\lambda$ -strongly convex with $\theta$ around $\theta^*(\alpha)$ . + +Assumption 3 $\| \nabla_{\theta_{\alpha}}^{2}\mathcal{L}\|$ is bounded with constant $C_a > 0$ + +Corollary 1 Based on the Assumption 1-3, we could bound the error between the approximated validation loss $\mathcal{L}(\hat{\theta}^*,\hat{\alpha}) = \Delta \mathcal{L} + \mathcal{L}(\theta^*,\alpha)$ and the ground-truth $\tilde{\mathcal{L}} (\hat{\theta}^{*},\hat{\alpha})$ in DARTS with $E = \left\| \mathcal{L}(\hat{\theta}^{*},\hat{\alpha}) - \tilde{\mathcal{L}} (\hat{\theta}^{*},\hat{\alpha})\right\| \leqslant \frac{K^3}{6}\max \left|\frac{\partial\mathcal{L}^3}{\partial\theta^3}\right|$ , where $K = \frac{C_L}{\lambda}\| \Delta \alpha \| +\frac{C_H C_a^2}{2\sigma_{min}^2\lambda}\| \Delta \alpha \| ^2 +o(\| \Delta \alpha \| ^2)$ . + +Compared with the argmax used in DARTS, we prefer the perturbation-based discretization method [40] as which only remove one operation at each step, since the above Corollary 1 show that error bound of the approximated validation loss $\mathcal{L}(\hat{\theta}^*, \hat{\alpha})$ increase with the magnitude of the change of $\alpha$ . + +# 4 Influential Magnitude for Operation Selection in DARTS + +Section 3 provides an iterative solution to measure the operation importance based Eq. (5) through individually removing each operation, while which needs to repeat $n$ times (the number of all candidate operations for all edges in the supernet work). More important, since removing one operation poses a considerable change on $\alpha (\alpha_{i}\rightarrow 0)$ , the approximation error produced by Eq.(5) is non-negligible which may affects the accuracy as stated by Corollary 1. So, a more practical solution to illustrate the importance of each operation is to estimate how the validation performance will change after posing an infinitesimal change on $\alpha$ , a.k.a. operation sensitivity. In this section, we aim to investigate the operation importance through the lens of sensitivity [24]. Different from Section 3 that removes one operation $(\alpha_{i}\rightarrow 0)$ , this section only changes the $\alpha_{i}$ with an infinitesimal $\varepsilon_{i}$ , which means that we can now conduct first-order Taylor expansion on $\alpha$ for $\mathcal{L}(\hat{\theta}^{*},\hat{\alpha})$ . Further with second-order Taylor expansion on $\theta$ and assuming the local optimal $\frac{\partial\mathcal{L}(\theta^{*},\alpha)}{\partial\theta} = 0$ , we have: + +$$ +\Delta \mathcal {L} = \mathcal {L} \left(\hat {\theta} ^ {*}, \hat {\alpha}\right) - \mathcal {L} \left(\theta^ {*}, \alpha\right) \approx 1 / 2 \Delta \theta^ {T} \frac {\partial^ {2} \mathcal {L} \left(\theta^ {*} , \alpha\right)}{\partial \theta \partial \theta} \Delta \theta + \Delta \alpha^ {T} \frac {\partial \mathcal {L} \left(\hat {\theta} ^ {*} , \alpha\right)}{\partial \alpha}. \tag {6} +$$ + +Similar to Eq.(4), it is intractable to directly calculate $\Delta \theta$ , while we can leverage implicit function theorem to approximate it. Theorem 2 presents how the validation performance changes after we pose an infinitesimal change on $\alpha$ . + +Theorem 2 Suppose that DARTS obtains the optimized architecture parameter $\alpha$ with supernet weights $\theta^{*}$ after supernet training, and we pose an infinitesimal change on $\alpha$ . Based on implicit function theorem and under the assumption that the third and higher derivatives of the loss function at optimum is zero or sufficiently small [4], the change of validation loss can be estimated as: + +$$ +\Delta \mathcal {L} = \mathcal {L} (\hat {\theta} ^ {*}, \hat {\alpha}) - \mathcal {L} (\theta^ {*}, \alpha) \approx - 1 / 2 \Delta \alpha^ {T} \frac {\partial^ {2} \mathcal {L} \left(\theta^ {*} , \alpha\right)}{\partial \alpha \partial \theta} H ^ {- 1} \frac {\partial^ {2} \mathcal {L} \left(\theta^ {*} , \alpha\right)}{\partial \theta \partial \alpha} * \Delta \alpha , \tag {7} +$$ + +where $H = \frac{\partial^2\mathcal{L}(\theta^*,\alpha)}{\partial\theta\partial\theta}$ is the Hessian matrix. + +From Theorem 2, we can observe the relationship between $\Delta \mathcal{L}$ and $\Delta \alpha$ . To be more specifically, when we only consider an infinitesimal change on $\alpha$ , that $\Delta \alpha = \varepsilon \cdot \mathbf{1}$ where $\mathbf{1}$ is a column vector with all ones and $\varepsilon$ is an infinitesimal scalar, the sensitivity of $\alpha$ can be defined as: + +$$ +\frac {\Delta \mathcal {L}}{\Delta \alpha} = - 1 / 2 \cdot \varepsilon \cdot \mathbf {1} ^ {T} \frac {\partial^ {2} \mathcal {L} \left(\theta^ {*} , \alpha\right)}{\partial \alpha \partial \theta} H ^ {- 1} \frac {\partial^ {2} \mathcal {L} \left(\theta^ {*} , \alpha\right)}{\partial \theta \partial \alpha}. \tag {8} +$$ + +Accordingly, we propose an *Influential Magnitude* to quantify the operation importance through the lens of sensitivity: + +Definition 1 Influential Magnitude $(\mathcal{I}_{\mathcal{M}})$ : Suppose DARTS obtains the optimized magnitude $\alpha$ with supernet weights $\theta^{*}$ after supernet training, the operation sensitivity can be defined as $\mathcal{I}_{\mathcal{M}} = -I^T\frac{\partial^2\mathcal{L}(\theta^{*},\alpha)}{\partial\alpha\partial\theta} H^{-1}\frac{\partial^2\mathcal{L}(\theta^{*},\alpha)}{\partial\theta\partial\alpha}$ . + +Definition 1 shows we can replace the magnitude $\alpha$ with the operation sensitivity $\mathcal{I}_{\mathcal{M}}$ in the operation selection for DARTS, whose $i$ -th value represents the importance of $i$ -th candidate operation. + +# 5 Practical Calculation on Operation Influence + +For a large neural network, it is impractical to calculate the second-order information, e.g., the Hessian matrix $H$ , let alone the inverse of Hessian. Generally, the core challenge in calculation of Eq.(5) and Eq.(7) is the Inverse-Hessian Vector Products (IHVPs), $H^{-1}v$ [14, 22, 37]. As to the term of $\frac{\partial^2\mathcal{L}(\theta^*,\alpha)}{\partial\theta\partial\alpha}$ , we follow DARTS [27] to utilize the finite difference approximation for the practical calculation. The first technique for IHVPs is the conjugate gradient (CG) which converts the matrix inverse problem into an optimization problem with $\delta$ -optimal solution. However, the standard CG can be slow with a large dataset as it needs to go through the whole training points in each step [1]. The original paper [22] using influence function for modern machine learning problem leverages the Neumann series to approximate the inverse, that $H^{-1} = \sum_{k=0}^{\infty}(I - H)^{k}$ , with only consider the first $t$ terms to approximate $H^{-1}$ . However, there is a strict condition in the Neumann series approximation that $\|I - H\| \leq 1$ , which can not be guaranteed in the practical implementation. Differently, we consider that $H^{-1} = \gamma (\gamma H)^{-1} = \gamma \sum_{k=0}^{\infty}(I - \gamma H)^{k}$ , where $\gamma$ is a small enough value. The following lemma gives our Neumann series based implementation for IHVPs. + +Lemma 1 With small enough $\gamma$ , and assuming $\mathcal{L}$ is $\lambda$ -strongly convex at optimum, $H^{-1}v$ can be formulated as: $H^{-1}v = \gamma \sum_{k=0}^{K}[I - \gamma H]^{k}V_{0} = V_{0} + V_{1} + \ldots + V_{K}$ , where $H = \frac{\partial^2\mathcal{L}(\theta^*,\alpha)}{\partial\theta\partial\theta}$ , $V_{0} = \gamma v$ , and $V_{1} = \gamma (I - \gamma H)V_{0}, \ldots, V_{K} = \gamma (I - \gamma H)V_{K-1}$ . + +In the practical implementation, it is still hard to make sure $\mathcal{L}$ is $\lambda$ -strongly convex and not easy to select an appropriate $\gamma$ . The work [5] empirically showed that the stochastic Neumann series estimation for IHVP is somehow erroneous, especially when the network is deep. As we know, the true Fisher information matrix converges to the Hessian matrix with the training loss approaches to zero. However, it is usually infeasible to calculate the exact Hessian or Fisher matrix in a large neural network. A practical approximation is called as empirical Fisher, which has been verified to be effective in variety of applications [3, 19]. In addition, an important advantage from empirical Fisher is that it allows to approximate the inverse of the Hessian based on the Sherman-Morrison formula. Although the empirical Fisher can not exactly match the true Fisher and there are several active researches on its applicability [23, 38], empirical Fisher is significantly more computationally-efficient, which obtains a good trade-off between the approximation and practical efficiency [37]. Apart from Neumann series, we also consider Sherman-Morrison formula [14, 37] $(A + \mathrm{uv}^T)^{-1} = A^{-1} - \frac{A^{-1}\mathrm{uv}^TA^{-1}}{1 + \mathrm{v}^TA^{-1}\mathrm{u}}$ to calculate IHVPs. With empirical Fisher $F = \frac{1}{n}\sum_{j = 1}^{n}\nabla_{\theta}\mathcal{L}_{j}(\nabla_{\theta}\mathcal{L}_{j})^{T}$ replacing true Fisher $\hat{F} = \nabla_{\theta}f(\nabla_{\theta}f)^{T}$ , IHVPs can be calculated as following. + +Lemma 2 When assume the empirical Fisher can approximate the Fisher matrix, and $H$ is the Hessian matrix $\frac{\partial^2\mathcal{L}(\theta^*,\alpha)}{\partial\theta\partial\theta}$ in the optimal point, the IHVPs $H^{-1}v$ can be formulated as: $H^{-1}v = F_{n}^{-1}v = F_{n - 1}^{-1}v - \mathrm{r}_{n}\frac{\mathrm{r}_{n}^{T}v}{N + \nabla_{\theta}\mathcal{L}_{n}^{T}\mathrm{r}_{n}} = \eta^{-1}v - \sum_{j = 1}^{n}\mathrm{r}_{j}\frac{\mathrm{r}_{j}^{T}v}{N + \nabla_{\theta}\mathcal{L}_{j}^{T}\mathrm{r}_{j}}$ , where $\mathcal{L} = \ell +\eta \mathcal{R}(\theta)$ that $\ell$ is a cross-entropy loss and $\mathcal{R}$ is the regularization term, $F_{n} = \frac{1}{n}\sum_{j = 1}^{n}\nabla_{\theta}\mathcal{L}_{j}\nabla_{\theta}\mathcal{L}_{j}^{T}$ is the empirical Fisher, and $\mathrm{r}_j = F_{j - 1}^{-1}\nabla_\theta \mathcal{L}_j$ which can be recurrently calculated through $\mathrm{r}_j = \eta^{-1}\nabla_\theta \mathcal{L}_j - \sum_{i = 1}^{j - 1}\mathrm{r}_i\frac{\mathrm{r}_i^T\nabla_\theta\mathcal{L}_j}{N + \nabla_\theta\mathcal{L}_i^T\mathrm{r}_i}$ . + +# 6 Experiments + +In Section 3 and 4, we have theoretically interpreted the operation selection through individually measuring each operation's influence on supernet, and accordingly devised an Influental Magnitude $(\mathcal{I}_{\mathcal{M}})$ to replace the commonly-used magnitude $\alpha$ for architecture selection. In this section, we conduct a series of experiments to analyze whether our proposed method leads to better and more stable results in differentiable architecture search settings. We consider two NAS benchmark dataset search space, NAS-Bench-201 [12] and + +Table 1: Test accuracy $(\%)$ on NAS-Bench-201. + +
MethodCIFAR-10CIFAR-100ImageNet-16-120
Random86.61±13.4660.83±12.5833.13±9.66
DARTS54.30±0.0015.61±0.0016.32±0.00
DARTS-PT89.63±0.1962.35±2.1436.51±2.13
DARTS-IF91.84±0.8467.94±1.2342.50±3.30
DARTS-IM93.61±0.2371.31±0.4044.98±0.36
+ +Full comparison with SOTAs is in Appendix D. We default use Sherman-Morrison for DARTS-IM in this experiment. + +NAS-Bench-1shot1 [46], and the most popular DARTS search space [27]. We verified the effectiveness of the proposed theory-driven method compared with two heuristic methods, argmax and + +perturbation-based selection, and show that the proposed Influential Magnitude can be applied to DARTS and its variants with greatly enhancing the performance. + +# 6.1 Reproducible Comparison on Benchmark Datasets + +To empirically verify the effectiveness of our method, we first run a series of experiments on the two NAS benchmark datasets, NAS-Bench-201 and NAS-Bench-1shot1. To make our results reproducible, we only replace the selection part in DARTS with $\mathcal{I}_{\mathcal{M}}$ and keep the remaining part identical. + +Table 1 summarizes the statistical comparison results on NAS-Bench-201 with different random seeds, where DARTS-IF, as described in Section 3, follows DARTS-PT that individually removes operation to measure the supernet performance drop, while DARTS-IM, as described in Section 4, calculates the operation sensitivity (influential magnitude) to replace the original magnitude. The Random baseline is to randomly select architectures without considering $\alpha$ or $\theta$ , and DARTS and DARTS-PT leverage the $\argmax$ and perturbation-based heuristic selection, respectively. As shown, our DARTS-IF and DARTS-IM both significantly outperform the random baseline and the two heuristic baselines, where DARTS-IM achieves near-optimal results, a $94.29\%$ , $72.67\%$ , and $45.93\%$ test accuracy on CIFAR-10, CIFAR-100, and ImageNet, respectively, in a single run (DARTS-IM with Sherman-Morrison approximation and $N = 20$ under random seed 0). + +From the searched architectures in NAS-Bench-201, we found that DARTS selects skip-connection for all edges as its magnitude usually outweighs other candidate operations. The results of DARTS in NAS-Bench-201, which are even poorer than the random baseline, also suggest that the magnitudes could hardly reflect the operation importance. Although DARTS-PT can partially relieve this issue by selecting one or two more convolutional operations, it still prefers skip-connections (selects 3 skip-connections for 6 edges) where directly removing them still significantly affects the performance. + +![](images/b37ed14513234e7b959ef44428f98929b81be4a93487889481f0be3b2f3edf5b.jpg) +(a) Neumann series. +(b) Sherman-Morrison formula. + +![](images/4902e27fb6d4cdfe37f96bb2b2d89387201df33fb8e4bfff678aef6f21ecf000.jpg) +Figure 2: Ablation study on $N$ under two approximation methods, where x-axis is $N$ and y-axis represents test accuracy on CIFAR-10. The computational complexity increases with the square of $N$ for Sherman-Morrison formula, and we set the maximal $N = 40$ . + +On the contrary, our DARTS-IF and DARTS-IM can find valid architectures with more convolutional operations (with only one skip-connection). Results in Table 1 verified the effectiveness of our influence functions based selection methods, which outperform baselines by large margins. DARTS-IF is similar to DARTS-PT while with an additional term to approximate the fine-tuned performance and the results that DARTS-IF outperforms DARTS-PT verified the effectiveness of the influence function explanation. + +As discussed in Section 5, we can leverage different methods to approximate the IHVPs in our $\mathcal{I}_{\mathcal{M}}$ , and Figure 2 also analyzes different approximation methods along with the number of batches $N$ . As demonstrated, increasing $N$ can help the Sherman-Morrison approximation to more accurately catch the operation importance and we empirically find that $N = 30$ is enough in the NAS-Bench-201 dataset. However, we also observe Neumann approximation is not stable which even obtains worse results + +Table 2: Best test error (%) on NAS-Bench-1shot1. + +
MethodSpace1Space2Space3
DARTS6.17±0.096.30±0.006.80±0.00
DARTS-PT6.25±0.056.28±0.066.69±0.21
DARTS-IM6.10±0.246.53±0.056.20±0.00
PC-DARTS6.37±0.056.30±0.006.50±0.00
PC-DARTS-PT6.14±0.086.37±0.126.38±0.09
PC-DARTS-IM5.90±0.246.20±0.226.10±0.08
+ +with increasing number of batches, showing it is somehow erroneous in estimating IHVPs. + +The NAS-Bench-1shot1 is another popular NAS benchmark dataset to analyze differentiable NAS methods, which is built based on the NAS-Bench-101 [44], through dividing all architectures in NAS-Bench-101 into three different unified cell-based search spaces to enable differentiable NAS methods to be directly applied. NAS-Bench-1shot1 contains 6240, 29160, and 363648 architectures in three spaces, respectively, where Space3 is much more complicated than the remaining two spaces. + +In NAS-Bench-1shot1, we tracked the searched architecture in every epoch under different operation selection paradigms. We considered two popular supernet training baselines, DARTS and PC-DARTS, and Table 2 summarised the best-searched architectures during the supernet training in different sub-search spaces in NAS-Bench-1shot1. As demonstrated, our $\mathcal{I}_{\mathcal{M}}$ can enhance the performance of DARTS and its variant PC-DARTS in different search spaces of NAS-Bench-1shot1, showing that our influence magnitude (IM) can find more competitive architectures than the default argmax, especially in the more complicated space. Compared with the perturbation strategy (PT), our IM is more effective to measure the operation sensitivity with obtaining 5 better results in 6 cases. + +# 6.2 Reproducible Comparison on DARTS Search Space + +The DARTS search space is the most commonly-used space to evaluate the NAS methods, while most SOTAs only report the performance of their best searched architectures without analyzing the search statistics. To encourage reproducibility, we train the supernet with the same random seeds, and the trained supernet is utilized to derive the architecture under different operation selection strategies. The comparison results are provided in Table 3, from which we can see that, compared with the argmax baseline, the architectures searched by our Influential + +Magnitude obtain better performance on CIFAR-10 and ImageNet than DARTS and its variant PC-DARTS, and DARTS-PT on ImageNet, implying our method is more stable to find valid and competitive architectures. We also plot the searched architecture examples with different selection methods in the DARTS space in the supplemental material. Although DARTS, PC-DARTS and DARTS-PT can find satisfying architecture after multiple runs, we found the argmax is hard to consistently obtain stable results. In addition, different from the perturbation-based operation selection which needs to fine-tune the supernet after the discretization of each edge that costs 0.4 additional GPU day for DARTS, our influential magnitude is calculated by one time which only costs hundred seconds, making our method is much more efficient. + +Table 3: Search results on DARTS space. + +
MethodCIFAR-10 Test Error (%)ImageNet Best
SingleMulti*
DARTS2.76±0.093.02±0.4526.9 / 8.7
PC-DARTS2.57±0.072.92±0.2625.1 / 7.8
DARTS-PT2.61±0.082.89±0.3126.1 / 8.2
DARTS-IM2.50±0.102.70±0.1825.0 / 7.6
+ +* We run the architecture search with multiple times, and average the different derived architecture's test error. + +# 6.3 Discussion on the Robustness of Search + +The robustness has been a critical concern in the differentiable architecture search community since Zela et al. [45] observed a performance collapse that DARTS tends to yield degenerate architectures, which especially prefers the skip-connections with the search progressing. Similar to DARTS-PT, we also focus on the operation selection part to explain the failure of DARTS. Figure 3 presents several architectures by DARTS with our $\mathcal{I}_{\mathcal{M}}$ on different search spaces. Apart from NAS-Bench-201, we also consider several tool search spaces (S1-S4) proposed by [45], which are specifically designed to verify the robustness of differentiable NAS meth + +![](images/5710d907fa9f1939ae14a187ce0caf92ebddb49937b2931e9c11b182d43ab31b.jpg) +(a) NAS-BENCH-201 + +![](images/8c8748dd7c49a225f202606feafbe634ec5e3748bdb42797072609fb5817f3c5.jpg) +(b) S1 + +![](images/232bfd48114c15b04a9e3e822963f8b7442f349846c2216a971634aa3d23630d.jpg) +(c) DARTS + +![](images/86c12157baefa2f20f3481d5ae40d2c71ffda479fec9cbecc07759ebedbad49f.jpg) +(d) S2 +Figure 3: Searched architectures on different search spaces. + +ods. As shown in Figure 3, DARTS-IM can find more meaningful architectures in different spaces. For example, DARTS fails dramatically in most spaces that only selects skip-connection for all edges, while DARTS-IM can find architecture with 5 convolutions in NAS-Bench-201, and 6 and 8 convolutions in S1 and S2. + +# 6.4 Discussion at Non-Convergence + +As discussed in Section 4, our influential magnitude is derived when $\theta$ is in the optimum, with leveraging different methods to approximate the IHVPs. In this subsection, we analyze whether the proposed influential magnitude is still effective to find important operations when $\theta$ is not in the optimum. Figure 4 tracked the performance of searched architecture in each epoch during the search with Sherman-Morrison formula. As shown, our influential magnitude $\mathcal{I}_{\mathcal{M}}$ is still effective when $\theta$ is not in the optimum, while which is getting + +![](images/e81d99b5d8a8667f41e91a9d936dab1a174fe1fc42d241cb6e9395708b51e950.jpg) +(a) $N = 1$ + +![](images/47479fda2d2126e01c6a6d20e2a8134ac5e43b0ccc949effc93ab5bfb95878a1.jpg) +(b) $N = 30$ +Figure 4: Track the architectures during search on NAS-Bench-201 with Sherman-Morrison under different $N$ . + +more stable with the supernet training. Specifically, as shown in Figure 4 (a) and (b), our $\mathcal{I}_{\mathcal{M}}$ with the different $N$ are both effective, implying that our method is sufficiently informative for the operation selection even under different approximation noises. + +More interesting, our DARTS-IM under Sherman-Morrison formula with $N = 1$ in Figure 4 means that we simply approximate the inverse $H^{-1} = \eta^{-1}\left(I - \eta^{-1}\frac{\nabla_{\theta}\mathcal{L}\nabla_{\theta}\mathcal{L}^{\top}}{1 + \eta^{-1}\nabla_{\theta}\mathcal{L}^{\top}\nabla_{\theta}\mathcal{L}}\right)\propto \hat{H}^{-1}$ , that $\hat{H}^{-1}$ is a diagonal matrix that $\hat{H}_{ii} = (\nabla_{\theta_i}\mathcal{L}\nabla_{\theta_i}\mathcal{L})$ , which is also called the diagonal approximation of the inverse Hessian. As shown, with roughly approximated second-order information, Eq. (7) also help DARTS-IM to find more important operations compared with existing heuristic methods. + +# 6.5 Discussion on the Limitations in Practice + +Although our influential magnitude provides a theory-driven and concise solution for the operation selection in DARTS, we consider several assumptions and approximations for the practical implementation. For example, Basu et al. [4, 5] pointed out that the second-order influence values still underestimated the true group influence values in the deep neural networks, while they also observed the correlation marginally improves with the number of parameters in a group and the second-order influence function generally outperforms the first-order. Fortunately, this paper considers the whole parameters in the supernet, which helps the second-order influence function reach its potential. + +The approximation of IHVPs requires the conditions that the Hessian matrix is positive definite [29] or the empirical Fisher can replace the true Fisher matrix [14], and the supernet weight $\theta^{*}$ is a global minimum of the empirical risk, while which in practice, are hard to hold. In the calculation of $v*\frac{\partial^2\mathcal{L}}{\partial\alpha\partial\theta}$ this paper also follows DARTS that considers the finite difference approximation for practical calculation. These approximations and assumptions may bring errors for the practical calculation, while empirical results verified that our influential magnitude is sufficiently informative for the operation selection in DARTS. + +# 7 Conclusion and Future Work + +This paper focuses on the operation selection, which is an essential part while with less attention in the differentiable architecture search. Rather than considering heuristics, this paper introduces the influence functions to theoretically reveal the candidate operation's importance through approximating its influence on the supernet. By leveraging the Taylor's approximation, we gracefully interpret how the validation performance changes during the discretization in DARTS and show that the operation strength is not only related to the magnitude but also the second-order information, where an influential magnitude is accordingly devised for the architecture selection. We based our framework on DARTS and extensive experimental results verified the proposed influential magnitude can be practically used in operation selection to avoid failures in differentiable architecture search. Developing more accurate influential magnitude for architecture search or leveraging the training dynamics [20] to reveal the operation influence in the early of training and also extending influential magnitude to other bi-level optimization problems[21, 28, 29], e.g., network pruning [28], are among directions for future work. + +# Acknowledgments and Disclosure of Funding + +This work was partially supported by Independent Research Fund Denmark under agreements 8022-00246B and 8048-00038B, the VILLUM FONDEN under agreement 34328, and the Innovation Fund Denmark centre, DIREC. + +# References + +[1] N. Agarwal, B. Bullins, and E. Hazan. Second-order stochastic optimization in linear time. stat, 1050:15, 2016. +[2] A. Alaa and M. Van Der Schaar. Validating causal inference models via influence functions. In International Conference on Machine Learning, pages 191-201. PMLR, 2019. +[3] S.-I. Amari. Natural gradient works efficiently in learning. Neural computation, 10(2):251-276, 1998. +[4] S. Basu, X. You, and S. Feizi. On second-order group influence functions for black-box predictions. In International Conference on Machine Learning, pages 715-724. PMLR, 2020. +[5] S. Basu, P. Pope, and S. Feizi. Influence functions in deep learning are fragile. In International Conference on Learning Representations, 2021. +[6] F. P. Casale, J. Gordon, and N. Fusi. Probabilistic neural architecture search. arXiv preprint arXiv:1902.05116, 2019. +[7] X. Chen and C.-J. Hsieh. Stabilizing differentiable architecture search via perturbation-based regularization. In International conference on machine learning, pages 1554-1565. PMLR, 2020. +[8] B. Colson, P. Marcotte, and G. Savard. An overview of bilevel optimization. Annals of operations research, 153(1):235-256, 2007. +[9] N. Couellan and W. Wang. On the convergence of stochastic bi-level gradient methods. Optimization, 2016. +[10] X. Dong and Y. Yang. Searching for a robust neural architecture in fourgpu hours. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1761-1770, 2019. +[11] X. Dong and Y. Yang. One-shot neural architecture search via self-evaluated template network. In Proceedings of the IEEE International Conference on Computer Vision, pages 3681-3690, 2019. +[12] X. Dong and Y. Yang. Nas-bench-201: Extending the scope of reproducible neural architecture search. International Conference on Learning Representations, 2020. +[13] L. Franceschi, P. Frasconi, S. Salzo, R. Grazzi, and M. Pontil. Bilevel programming for hyperparameter optimization and meta-learning. In International Conference on Machine Learning, pages 1568-1577. PMLR, 2018. +[14] E. Frantar, E. Kurtic, and D. Alistarh. M-fac: Efficient matrix-free approximations of second-order information. Advances in Neural Information Processing Systems, 34, 2021. +[15] S. Ghadimi and M. Wang. Approximation methods for bilevel programming. arXiv preprint arXiv:1802.02246, 2018. +[16] R. Grazzi, L. Franceschi, M. Pontil, and S. Salzo. On the iteration complexity of hypergradient computation. In International Conference on Machine Learning, pages 3748-3758. PMLR, 2020. +[17] R. Grazzi, M. Pontil, and S. Salzo. Convergence properties of stochastic hypergradients. In International Conference on Artificial Intelligence and Statistics, pages 3826-3834. PMLR, 2021. +[18] F. R. Hampel. The influence curve and its role in robust estimation. Journal of the american statistical association, 69(346):383-393, 1974. +[19] B. Hassibi and D. Stork. Second order derivatives for network pruning: Optimal brain surgeon. Advances in neural information processing systems, 5, 1992. +[20] H. He and W. J. Su. The local elasticity of neural networks. In International Conference on Learning Representations, 2020. + +[21] W. Jin, Y. Ma, X. Liu, X. Tang, S. Wang, and J. Tang. Graph structure learning for robust graph neural networks. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 66-74, 2020. +[22] P. W. Koh and P. Liang. Understanding black-box predictions via influence functions. In International Conference on Machine Learning, pages 1885-1894. PMLR, 2017. +[23] F. Kunstner, P. Hennig, and L. Balles. Limitations of the empirical fisher approximation for natural gradient descent. Advances in neural information processing systems, 32, 2019. +[24] N. Lee, T. Ajanthan, and P. Torr. Snip: Single-shot network pruning based on connection sensitivity. In International Conference on Learning Representations, 2019. +[25] N. Lee, T. Ajanthan, S. Gould, and P. H. Torr. A signal propagation perspective for pruning neural networks at initialization. In International Conference on Learning Representations, 2020. +[26] L. Li and A. Talwalkar. Random search and reproducibility for neural architecture search. arXiv preprint arXiv:1902.07638, 2019. +[27] H. Liu, K. Simonyan, and Y. Yang. Darts: Differentiable architecture search. In International Conference on Learning Representations, 2019. +[28] L. Liu, S. Zhang, Z. Kuang, A. Zhou, J.-H. Xue, X. Wang, Y. Chen, W. Yang, Q. Liao, and W. Zhang. Group fisher pruning for practical network compression. In International Conference on Machine Learning, pages 7021-7032. PMLR, 2021. +[29] J. Lorraine, P. Vicol, and D. Duvenaud. Optimizing millions of hyperparameters by implicit differentiation. In International Conference on Artificial Intelligence and Statistics, pages 1540-1552. PMLR, 2020. +[30] K. Lu, Z. Wang, P. Mardziel, and A. Datta. Influence patterns for explaining information flow in bert. Advances in Neural Information Processing Systems, 34, 2021. +[31] D. Maclaurin, D. Duvenaud, and R. Adams. Gradient-based hyperparameter optimization through reversible learning. In International conference on machine learning, pages 2113-2122. PMLR, 2015. +[32] F. Pedregosa. Hyperparameter optimization with approximate gradient. In Proceedings of the 33rd International Conference on International Conference on Machine Learning-Volume 48, pages 737-746, 2016. +[33] H. Pham, M. Guan, B. Zoph, Q. Le, and J. Dean. Efficient neural architecture search via parameter sharing. In International Conference on Machine Learning, pages 4092-4101, 2018. +[34] E. Real, A. Aggarwal, Y. Huang, and Q. V. Le. Regularized evolution for image classifier architecture search. In Proceedings of the aai conference on artificial intelligence, volume 33, pages 4780-4789, 2019. +[35] P. Ren, Y. Xiao, X. Chang, P.-Y. Huang, Z. Li, X. Chen, and X. Wang. A comprehensive survey of neural architecture search: Challenges and solutions. arXiv preprint arXiv:2006.02903, 2020. +[36] A. Shaban, C.-A. Cheng, N. Hatch, and B. Boots. Truncated back-propagation for bilevel optimization. In The 22nd International Conference on Artificial Intelligence and Statistics, pages 1723-1732. PMLR, 2019. +[37] S. P. Singh and D. Alistarh. Woodfisher: Efficient second-order approximation for neural network compression. Advances in Neural Information Processing Systems, 33:18098-18109, 2020. +[38] V. Thomas, F. Pedregosa, B. Merrienboer, P.-A. Manzagol, Y. Bengio, and N. Le Roux. On the interplay between noise and curvature and its effect on optimization and generalization. In International Conference on Artificial Intelligence and Statistics, pages 3503-3513. PMLR, 2020. +[39] C. Wang, G. Zhang, and R. Grosse. Picking winning tickets before training by preserving gradient flow. In International Conference on Learning Representations, 2020. +[40] R. Wang, M. Cheng, X. Chen, X. Tang, and C.-J. Hsieh. Rethinking architecture selection in differentiable nas. In International Conference on Learning Representations, 2021. +[41] X. Wu, D. Zhang, C. Guo, C. He, B. Yang, and C. S. Jensen. Autocts: Automated correlated time series forecasting. Proc. VLDB Endow., 15(4):971-983, 2021. + +[42] S. Xie, H. Zheng, C. Liu, and L. Lin. Snas: stochastic neural architecture search. In International Conference on Learning Representations, 2019. +[43] Y. Xu, L. Xie, X. Zhang, X. Chen, G.-J. Qi, Q. Tian, and H. Xiong. Pc-darts: Partial channel connections for memory-efficient architecture search. In International Conference on Learning Representations, 2020. +[44] C. Ying, A. Klein, E. Christiansen, E. Real, K. Murphy, and F. Hutter. Nas-bench-101: Towards reproducible neural architecture search. In International Conference on Machine Learning, pages 7105–7114. PMLR, 2019. +[45] A. Zela, T. Elsken, T. Saikia, Y. Marrakchi, T. Brox, and F. Hutter. Understanding and robustifying differentiable architecture search. In International Conference on Learning Representations, 2020. +[46] A. Zela, J. Siems, and F. Hutter. Nas-bench-1shot1: Benchmarking and dissecting one-shot neural architecture search. In International Conference on Learning Representations, 2020. +[47] M. Zhang, H. Li, S. Pan, X. Chang, Z. Ge, and S. Su. Differentiable neural architecture search in equivalent space with exploration enhancement. Advances in Neural Information Processing Systems, 33: 13341-13351, 2020. +[48] M. Zhang, H. Li, S. Pan, X. Chang, and S. Su. Overcoming multi-model forgetting in one-shot nas with diversity maximization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 7809-7818, 2020. +[49] M. Zhang, H. Li, S. Pan, X. Chang, C. Zhou, Z. Ge, and S. W. Su. One-shot neural architecture search: Maximising diversity to overcome catastrophic forgetting. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2020. +[50] M. Zhang, H. Li, S. Pan, T. Liu, and S. Su. One-shot neural architecture search via novelty driven sampling. In Proceedings of the Twenty-Ninth International Joint Conference on Artificial Intelligence, IJCAI-20. International Joint Conferences on Artificial Intelligence Organization, 2020. +[51] M. Zhang, S. Su, S. Pan, X. Chang, E. Abbasnejad, and R. Haffari. idarts: Differentiable architecture search with stochastic implicit gradients. In International Conference on Machine Learning. PMLR, 2021. +[52] M. Zhang, S. Pan, X. Chang, S. Su, J. Hu, G. R. Haffari, and B. Yang. Balenas: Differentiable architecture search via the bayesian learning rule. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 11871-11880, 2022. +[53] W. Zhang, Y. Wang, Z. You, M. Cao, P. Huang, J. Shan, Z. Yang, and B. Cui. Rim: Reliable influence-based active learning on graphs. Advances in Neural Information Processing Systems, 34, 2021. +[54] X. Zheng, R. Ji, L. Tang, B. Zhang, J. Liu, and Q. Tian. Multinomial distribution learning for effective neural architecture search. In International Conference on Computer Vision (ICCV), 2019. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] +(c) Did you discuss any potential negative societal impacts of your work? [Yes] +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] +(b) Did you include complete proofs of all theoretical results? [Yes] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] + +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] +(b) Did you mention the license of the assets? [Yes] +(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/interpretingoperationselectionindifferentiablearchitecturesearchaperspectivefrominfluencedirectedexplanations/images.zip b/interpretingoperationselectionindifferentiablearchitecturesearchaperspectivefrominfluencedirectedexplanations/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..8073771fc24420607d9afa0b96f8ff5dccf87426 --- /dev/null +++ b/interpretingoperationselectionindifferentiablearchitecturesearchaperspectivefrominfluencedirectedexplanations/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b9c2667c77ac2927a1994c5854cdabaf5bbc99f7cdba8ab1df8f6158a2f704df +size 268181 diff --git a/interpretingoperationselectionindifferentiablearchitecturesearchaperspectivefrominfluencedirectedexplanations/layout.json b/interpretingoperationselectionindifferentiablearchitecturesearchaperspectivefrominfluencedirectedexplanations/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..ce954cae096d8758a0f3fd876ebcc334416e047f --- /dev/null +++ b/interpretingoperationselectionindifferentiablearchitecturesearchaperspectivefrominfluencedirectedexplanations/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c17c60d69441182c91fd48e64cf10f44d07ed80dc3502026c3b2b142ffa83d7 +size 499902 diff --git a/interventionswhereandhowexperimentaldesignforcausalmodelsatscale/62f7c970-8375-4212-987b-436bed9cbda8_content_list.json b/interventionswhereandhowexperimentaldesignforcausalmodelsatscale/62f7c970-8375-4212-987b-436bed9cbda8_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..6f0b5f3069c9856d2c49e60802cf163de3d5f039 --- /dev/null +++ b/interventionswhereandhowexperimentaldesignforcausalmodelsatscale/62f7c970-8375-4212-987b-436bed9cbda8_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e39e86550470f24bcb2d2ddea8a867cc09150ba3250e3869eef063e309a07bd +size 85992 diff --git a/interventionswhereandhowexperimentaldesignforcausalmodelsatscale/62f7c970-8375-4212-987b-436bed9cbda8_model.json b/interventionswhereandhowexperimentaldesignforcausalmodelsatscale/62f7c970-8375-4212-987b-436bed9cbda8_model.json new file mode 100644 index 0000000000000000000000000000000000000000..6c01eaf280d1e50b0a2358831dbfe83f2dbe95d4 --- /dev/null +++ b/interventionswhereandhowexperimentaldesignforcausalmodelsatscale/62f7c970-8375-4212-987b-436bed9cbda8_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:600a4af0246e95c89a6f523140d4460c89cbf1618c1426279c61c2ad8fc5beb6 +size 109608 diff --git a/interventionswhereandhowexperimentaldesignforcausalmodelsatscale/62f7c970-8375-4212-987b-436bed9cbda8_origin.pdf b/interventionswhereandhowexperimentaldesignforcausalmodelsatscale/62f7c970-8375-4212-987b-436bed9cbda8_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..0c634e4f8b14c0bbe3b81d0484d444d872343f00 --- /dev/null +++ b/interventionswhereandhowexperimentaldesignforcausalmodelsatscale/62f7c970-8375-4212-987b-436bed9cbda8_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:96318a064c5e4172a4b2afad56a295bf2d29d983de70e4a9e7313d85e6558ccb +size 1854731 diff --git a/interventionswhereandhowexperimentaldesignforcausalmodelsatscale/full.md b/interventionswhereandhowexperimentaldesignforcausalmodelsatscale/full.md new file mode 100644 index 0000000000000000000000000000000000000000..6a059180bea835f2348bb6012f6f21cbb91e985d --- /dev/null +++ b/interventionswhereandhowexperimentaldesignforcausalmodelsatscale/full.md @@ -0,0 +1,347 @@ +# Interventions, Where and How? Experimental Design for Causal Models at Scale + +Panagiotis Tigas $^{1}$ Yashas Annadani $^{2,3}$ Andrew Jesson $^{1}$ Bernhard Schölkopf $^{3}$ Yarin Gal $^{1}$ Stefan Bauer $^{2,4}$ + +$^{1}$ OATML, University of Oxford $^{2}$ KTH Royal Institute of Technology, Stockholm $^{3}$ Max Planck Institute for Intelligent Systems $^{4}$ CIFAR Azrieli Global Scholar + +# Abstract + +Causal discovery from observational and interventional data is challenging due to limited data and non-identifiability: factors that introduce uncertainty in estimating the underlying structural causal model (SCM). Selecting experiments (interventions) based on the uncertainty arising from both factors can expedite the identification of the SCM. Existing methods in experimental design for causal discovery from limited data either rely on linear assumptions for the SCM or select only the intervention target. This work incorporates recent advances in Bayesian causal discovery into the Bayesian optimal experimental design framework, allowing for active causal discovery of large, nonlinear SCMs while selecting both the interventional target and the value. We demonstrate the performance of the proposed method on synthetic graphs (Erdos-Renyi, Scale Free) for both linear and nonlinear SCMs as well as on the in-silico single-cell gene regulatory network dataset, DREAM. + +# 1 Introduction + +What is the structure of the protein-signaling network derived from a single cell? How do different habits influence the presence of disease? Such questions refer to causal effects in complex systems governed by nonlinear, noisy processes. On most occasions, passive observation of such systems is insufficient to uncover the real cause-effect relationship and costly experimentation is required to disambiguate between competing hypotheses. As such, the design of experiments is of significant interest; an efficient experimentation protocol helps reduce the costs involved in experimentation while aiding the process of producing knowledge through the (closed-loop / policy-driven) scientific method (Fig. 1). + +In the language of causality (Pearl, 2009), the causal relationships are represented qualitatively by a directed acyclic graph (DAG), where the nodes correspond to different variables of the system of study and the edges represent the flow of information between the variables. The abstraction of possible explanations (hypotheses) for the observations Bayesian probabilities (beliefs) allows us to formalize the + +![](images/a6c028a5daf4832f1e3558f3db428cfea8318830d9fbebc8e7219551ec65720e.jpg) +Figure 1: Intervention-Inference-Design loop of Bayesian Optimal Experimental Design for Causal Discovery framework. + +Bayesian inference, where the goal is to estimate the posterior distribution $p(\mathrm{DAGs} \mid \mathrm{Observations})$ . A posterior distribution over the DAGs allows us to employ information-theoretic acquisition functions that guide experimentation towards the most informative variables for disambiguating between competing hypotheses. Such design procedures belong to the field of Bayesian Optimal Experimental Design (Lindley, 1956) for Causal Discovery (BOECD) (Tong and Koller, 2001, Murphy, 2001). + +In the Bayesian Optimal Experimental Design (BOED) (Lindley, 1956) framework, one seeks the experiment that maximizes the expected information gain about some parameter(s) of interest. In causal discovery, an experiment takes the form of a causal intervention, and the parameters of interest are the Structural Causal Model (SCM) and its associated DAG. + +An intervention in a causal model refers to the variable (or target) we manipulate and the value (or strength) at which we set the variable. Hence, the design space in the case of learning causal models is the set of all subsets of the intervention targets and the possibly countably infinite set of intervention values of the chosen targets. The intervention value encapsulates important semantics in many causal inference applications. For instance, in medical applications, an intervention can correspond to the administration of different drugs and the intervention value takes the form of a dosage level for each drug. Even though the appropriate choice of this value is crucial for identifying the underlying causal model, existing work on active causal discovery focuses exclusively on selecting the intervention target (Agrawal et al., 2019, Cho et al., 2016). There, the intervention value is generally some arbitrary fixed value (like 0) which is suboptimal (see Fig. 2a). Hence, a holistic treatment of selecting the intervention value and the target in the general case of nonlinear causal models has been missing. We present a Bayesian experimental design method (CBED - pronounced "seabed") to acquire optimal intervention targets and values by performing Bayesian optimization. + +Additionally, some settings call for the selection of a batch of interventions. The problem of batched interventions is computationally expensive as it requires evaluating all possible combinations of interventions. We extend CBED to the batch setting and propose two different batching strategies for tractable, Bayes optimal acquisition of both intervention targets and values. The first strategy — Greedy-CBED — builds up the intervention set greedily. A greedy heuristic is still near-optimal due to submodularity properties of mutual information (Krause and Guestrin, 2012, Agrawal et al., 2019, Kirsch et al., 2019). The second strategy — Soft-CBED — constructs a set of interventions by stochastic sampling from a finite set of candidates, thereby significantly increasing computational efficiency while recovering the DAG structure and the parameters of the SCM as fast as the greedy strategy. This strategy is well suited for resource-constrained settings. + +Throughout this work, we make the following standard assumptions for causal discovery (Peters et al., 2017): + +Assumption 1 (Causal Sufficiency). There are no hidden confounders, and all the random variables of interest are observable. + +Assumption 2 (Finite Samples). There is a finite number of observational/ interventional samples available. + +Assumption 3 (Nonlinear SCM with Additive Noise). The structural causal model has nonlinear conditional expectations with additive Gaussian noise. + +Assumption 4 (Single Target). Each intervention is atomic and applied to a single target of the SCM. + +Additionally, we assume that interventions are planned and executed in batches of size $\mathcal{B}$ , with a fixed budget of total interventions given by Number of Batches $\times \mathcal{B}$ . We also assume that the underlying graph is sparse, as is the case in all the real-world settings (Bengio et al., 2019, Schmidt et al., 2007). Experimental design is preferable in sparse graph settings as the number of informative intervention targets and values would be significantly less compared to dense graphs. Many nodes corresponding to a sparse graph would have very less probability of having parent sets, and hence preforming experiments with a random policy is not maximally informative. Finally, we are interested in recovering the full graph $\mathbf{G}$ with a small number of batches. As with all causal inference tasks, the assumptions that we make above have to be carefully verified for the application of interest. + +We show that our methods, Greedy-CBED and Soft-CBED, perform better than the state-of-the-art active causal discovery baselines in linear and nonlinear SCM settings. In addition, our approach achieves superior results in the real-world inspired nonlinear dataset, DREAM (Greenfield et al., 2010). + +# 2 Background + +Notation. Let $\mathbf{V} = \{1, \ldots, d\}$ be the vertex set of any DAG $\mathbf{g} = (\mathbf{V}, E)$ and $\mathbf{X}_{\mathbf{V}} = \{\mathrm{X}_1, \ldots, \mathrm{X}_d\} \subseteq \mathcal{X}$ be the random variables of interest indexed by $\mathbf{V}$ . We have an initial observational dataset $\mathcal{D} = \{\mathbf{x}_{\mathbf{V}}^{(i)}\}_{i=1}^n$ comprised of instances $\mathbf{x}_{\mathbf{V}} \sim P(\mathrm{X}_1 = \mathrm{x}_1, \ldots, \mathrm{X}_d = \mathrm{x}_d) = p(\mathrm{x}_1, \ldots, \mathrm{x}_d)$ . + +Causal Bayesian Network. A causal Bayesian network (CBN) is the pair $(\mathbf{g}, P)$ such that for any $\mathbf{W} \subset \mathbf{V}$ , + +$$ +P (\mathbf {X _ {V}} | \mathrm {d o} (\mathbf {X _ {W}} = \mathbf {x _ {W} ^ {\prime}})) = \prod_ {i \in \mathbf {V} \backslash \mathbf {W}} P (X _ {i} \mid X _ {\mathrm {p a _ {g} (i)}}) \mathbb {1} (\mathbf {X _ {W}} = \mathbf {x _ {W} ^ {\prime}}) +$$ + +where $\mathrm{do}(X_{\mathbf{W}})$ represents a hypothetical intervention on the variables $X_{\mathbf{W}}$ , $\mathbb{1}(\cdot)$ is an indicator function and $\mathrm{pa}_{\mathbf{g}}(i)$ denotes parents of variable $X_{i}$ in DAG $\mathbf{g}$ . A perfect intervention on any variable $X_{j}$ completely removes all dependencies with its parents, i.e. $P(X_{j} \mid X_{\mathrm{pa}_{\mathbf{g}}(j)}) = P(X_{j})$ thereby resulting in a mutilated DAG $\mathbf{g}' = (\mathbf{V}, E \backslash (p a_{\mathbf{g}}(j), j))$ . + +Structural Causal Model. From the data generative mechanism point of view, the DAG $\mathbf{g}$ on $\mathbf{X}_{\mathbf{V}}$ matches a set of structural equations: + +$$ +X _ {i} := f _ {i} \left(X _ {\operatorname {p a} _ {\mathbf {g}} (i)}, \epsilon_ {i}\right) \forall i \in \mathbf {V} \tag {1} +$$ + +where $f_{i}$ 's are (potentially nonlinear) causal mechanisms that remain invariant when intervening on any variable $X_{j} \neq X_{i}$ . $\epsilon_{i}$ 's are exogenous noise variables with arbitrary distribution that are mutually independent, i.e. $\epsilon_{i} \perp \epsilon_{j} \forall i \neq j$ . (1) represents the conditional distributions in a Causal Bayesian Network and can additionally reveal the effect of interventions if the mechanisms are known (Peters et al., 2017, Pearl, 2009). These equations together form the structural causal model (SCM), with an associated DAG $\mathbf{g}$ . Though the mechanisms $f$ can be nonparametric in the general case, we assume that there exists a parametric approximation to these mechanisms with parameters $\gamma \in \Gamma$ . In the case of linear SCMs, $\gamma$ corresponds to the weights of the edges in $E$ . In the nonlinear case, they could represent the parameters of a nonlinear function that parameterizes the mean of a Gaussian distribution. + +A common form of (1) corresponds to Gaussian additive noise models $(\mathrm{ANM})^2$ : + +$$ +X _ {i} := f _ {i} \left(X _ {\operatorname {p a} _ {\mathbf {g}} (i)}; \boldsymbol {\gamma} _ {i}\right) + \epsilon_ {i}, \quad \epsilon_ {i} \sim \mathcal {N} \left(0, \sigma_ {i} ^ {2}\right) \tag {2} +$$ + +An ANM is fully specified by a DAG $\mathbf{g}$ , mechanisms, $f(\cdot ;\gamma) = [f_{1}(\cdot ;\gamma_{1}),\dots ,f_{d}(\cdot ;\gamma_{d})]$ , parameterized by $\gamma = [\gamma_1,\ldots ,\gamma_d]$ , and variances, $\sigma^2 = [\sigma_1^2,\dots ,\sigma_d^2 ]$ . For notational brevity, henceforth we denote $\pmb {\theta} = (\pmb {\gamma},\pmb{\sigma}^{2})$ and all the parameters of interest with $\phi = (\mathbf{g},\pmb {\theta})$ . + +Bayesian Causal Discovery. A common assumption in causal inference is that causal relations are known qualitatively and can be represented by a DAG. While this qualitative information can be obtained from domain knowledge in some scenarios, it's infeasible in most applications. The goal of causal discovery is to recover the SCM and the associated DAG, given a dataset $\mathcal{D}$ . In general, without further assumptions about the nature of mechanisms $f$ (e.g., linear vs. nonlinear), the true SCM may not be identifiable (Peters et al., 2012) from observational data alone. This non-identifiability is because there could be multiple DAGs (and hence multiple factorizations of $P(\mathbf{X}_{\mathbf{V}})$ ) which explain the data equally well. Such DAGs are said to be Markov Equivalent. Interventions can improve identifiability. In addition to identifiability issues, estimating the functional relationships between nodes using finite data is another source of uncertainty. Bayesian parameter estimation over the unknown SCM provides a principled way to quantify these uncertainties and obtain a posterior distribution over the SCM given observational data. An experimenter can then use the knowledge encoded by the posterior to design informative experiments that efficiently acquire interventional data to resolve unknown edge orientations and functional uncertainty. + +Bayesian Inference of SCMs and DAGs. The key challenge in performing Bayesian inference jointly over SCMs and DAGs is that the space of DAGs is discrete and superexponential in the number of variables (Peters et al., 2017). However, recent techniques based on variational inference (Annadani et al., 2021, Lorch et al., 2021, Cundy et al., 2021) provide a tractable and scalable way of performing posterior inference of these parameters. Given a tractable distribution $q_{\psi}(\phi)$ which approximates the posterior $p(\phi \mid \mathcal{D})$ , variational inference maximizes a lower bound on the (log-) evidence: + +$$ +\log p (\mathcal {D}) \geq \mathcal {L} (\psi \in \Psi) = \underset {q _ {\psi} (\phi)} {\mathbb {E}} [ \log p (\mathcal {D} | \phi) ] - \mathrm {D} _ {\mathrm {K L}} (q _ {\psi} (\phi) | | p (\phi)) +$$ + +The key idea in these techniques is the way the variational family $\Psi$ for DAGs is parameterized. The variational family for the Variational Causal Network (VCN) method (Annadani et al., 2021) is an autoregressive Bernoulli distribution over the adjacency matrix. They further enforce the acyclicity constraint (Zheng et al., 2018) through the prior. BCD-Nets (Cundy et al., 2021) consider a distribution over node orderings through a Boltzmann distribution and perform inference with Gumbel-Sinkhorn (Mena et al., 2018) operator. DiBS (Lorch et al., 2021) consider latent variables over entries of adjacency matrix and perform inference over these latent variables using SVGD (Liu and Wang, 2016). We demonstrate empirical results in BOECD using the DiBS model in this work because it is easily extendable to nonlinear SCMs. + +Bayesian Optimal Experimental Design. Bayesian Optimal Experimental Design (BOED) (Lindley, 1956, Chaloner and Verdinelli, 1995) is an information theoretic approach to the problem of selecting the optimal experiment to estimate any parameter $\theta$ . For BOED, the utility of the experiment $\xi$ is the mutual information (MI) between the observation $\mathbf{y}$ and $\theta$ : + +$$ +\mathrm {U} _ {\mathrm {B O E D}} (\xi) \triangleq \mathrm {I} (\mathbf {Y}; \theta \mid \xi , \mathcal {D}) = \underset {p (\mathbf {y} | \theta , \xi) p (\theta | \mathcal {D})} {\mathbb {E}} [ \log p (\mathbf {y} \mid \xi , \mathcal {D}) - \log p (\mathbf {y} \mid \theta , \xi , \mathcal {D}) ] +$$ + +The goal of BOED is to select the experiment that maximizes this objective $\xi^{*} = \arg \max_{\xi}\mathrm{U}_{\mathrm{BOED}}(\xi)$ . Unfortunately, evaluating and optimizing this objective is challenging because of the nested expectations (Rainforth et al., 2018) and several estimators have been introduced (Foster et al., 2019, Kleinegesse and Gutmann, 2019) that lower bound the BOED objective which then can be combined with various optimization methods to select the designs (Foster et al., 2020, Ivanova et al., 2021, Foster et al., 2021, Lim et al., 2022). + +A common setting, called static, fixed or batch design, is to optimize $\mathcal{B}$ designs $\{\xi_1,\dots ,\xi_{\mathcal{B}}\}$ at the same time. The designs are then executed and the experimental outcomes are collected to update the model parameters in a Bayesian fashion. + +# 3 Method + +The true SCM and the associated DAG $\tilde{\phi} = (\tilde{\mathbf{g}},\tilde{\theta})$ over random variables $\mathbf{X}_{\mathbf{V}}$ is a matter of fact, but our belief in $\tilde{\phi}$ is uncertain for many reasons. Primarily, it is only possible to learn the DAG $\tilde{\mathbf{g}}$ up to a Markov equivalence class (MEC) from observational data $\mathcal{D}$ . Uncertainty also arises from $\mathcal{D}$ from being a finite sample, which we model by introducing the random variable $\Phi$ , of which $\phi$ is an outcome. Let $\phi \sim p(\phi|\mathcal{D}) \propto p(\mathcal{D} \mid \phi)p(\phi)$ be an instance of the random variable $\Phi$ that is sampled from our posterior over SCMs after observing the dataset $\mathcal{D}$ . + +We would like to design an experiment to identify an intervention $\xi := \{(j, v)\} := \mathrm{do}(\mathrm{X}_j = v)$ that maximizes the information gain about $\Phi$ after observing the outcome of the intervention $\mathbf{y} \sim P(\mathrm{X}_1 = \mathrm{x}_1, \dots, \mathrm{X}_d = \mathrm{x}_d \mid \mathrm{do}(\mathrm{X}_j = v) = p(\mathbf{y} \mid \xi)$ . Here, $\mathbf{y}$ is an instance of the random variable $\mathbf{Y} \subseteq \mathcal{X}$ distributed according to the distribution specified by the mutilated true graph $\tilde{\mathbf{g}}'$ under intervention. Looking at one intervention at a time, one can formalize BOECD as gain in information about $\Phi$ after observing the outcome of an experiment $\mathbf{y}$ . The experiment $\xi := \{(j, v)\}$ that maximizes the information gain is the experiment that maximizes the mutual information between $\Phi$ and $\mathbf{Y}$ : + +$$ +\left\{\left(j ^ {*}, v ^ {*}\right) \right\} = \underset {j, v} {\arg \max } \left\{\mathrm {I} (\mathbf {Y}; \boldsymbol {\Phi} \mid \{(j, v) \}, \mathcal {D}) \right\} \tag {3} +$$ + +The above objective considers taking $\arg \max$ over not just the discrete set of intervention targets $j\in \mathbf{V}$ , but also over the uncountable set of intervention values $v\subset \mathcal{X}_j$ . While the existing works in BOECD consider only the design of intervention targets to limit the complexity (Tong and Koller, 2001, Murphy, 2001, Agrawal et al., 2019), our approach tackles both the problems. We first outline the methodology for a single design and in Section 3.2 demonstrate how to extend this single design to a batch setting. + +![](images/7dc5ded29af675e2806c26a4009abda5d249d8fc71e817bc97a9566dc9fe71d5.jpg) +(a) +Figure 2: (a) Each graph shows how the mutual information (MI) (y-axis) changes for intervening on that node (plot color matching the node color) with different values (x-axis). The SCM in this example is a nonlinear SCM with Additive Gaussian noise. We can see that by intervening on node $X_{2}$ with the value $v^{*}$ , the mutual information gets maximized. (b) The posterior distribution of a GP on the Mutual Information function as a response to different intervention values after four Bayesian Optimization (BO) steps. (c) For each $t$ iteration of the BO algorithm and each node $j$ , we get a utility function evaluation $\hat{U}_j^t$ (the utility being the MI in our case). Then we sample without replacement proportionally to the scores to prepare a batch (3.2). + +![](images/5a29091b1d6feff0b7f64dca0cda14a002d10ca99f79183558200f93ad640231.jpg) +(b) + +![](images/26998b31ea25919ff1493038789e3c66d8d338db68f4bf4bb660d38798ba53f3.jpg) +(c) + +# 3.1 Single Design + +To maximize the objective in Equation 3, we need to (1) estimate MI for candidate interventions and (2) maximize the estimated MI by optimizing over the domain of intervention value for every candidate interventional target. + +Estimating the MI. As mutual information is intractable, there are various ways to estimate it depending on whether we can sample from the posterior and whether the likelihood can be evaluated (Foster et al., 2020, Poole et al., 2019, Houlsby et al., 2011). Since the models we consider allow both posterior sampling and likelihood evaluation, it suffices to obtain an estimator which requires only likelihood evaluation and Monte Carlo approximations of the expectations. To do so, we derive an estimator similar to Bayesian Active Learning by Disagreement (BALD) (Houlsby et al., 2011), which considers MI as a difference of conditional entropies over the outcomes $\mathbf{Y}$ : + +$$ +\begin{array}{l} \mathrm {I} (\mathbf {Y}; \boldsymbol {\Phi} | \{(j, v) \}, \mathcal {D}) = \mathrm {H} (\mathbf {Y} | \{(j, v) \}, \mathcal {D}) - \mathrm {H} (\mathbf {Y} | \boldsymbol {\Phi}, \{(j, v) \}, \mathcal {D}) \\ = - \underset {p (\mathbf {y} | \{(j, v) \}, \mathcal {D})} {\mathbb {E}} \left[ \log \left(\underset {p (\phi | \mathcal {D})} {\mathbb {E}} [ p (\mathbf {y} \mid \phi , \{(j, v) \}) ]\right) \right] + \underset {p (\phi | \mathcal {D})} {\mathbb {E}} \left[ \underset {p (\mathbf {y} | \phi , \{(j, v) \})} {\mathbb {E}} [ \log (p (\mathbf {y} \mid \phi , \{(j, v) \})) ] \right] (4) \\ \end{array} +$$ + +where $\mathrm{H}(\cdot)$ is the entropy. See Appendix B.1 for the derivation. A Monte Carlo estimator of the above equation can be used as an approximation (Appendix B.2). Equation (4) has an intuitive interpretation. It assigns high mutual information to interventions that the model disagrees the most regarding the outcome. We denote the MI for a single design as $\mathcal{I}(\{(j,v)\})\coloneqq \operatorname {I}(\mathbf{Y};\boldsymbol {\Phi}\mid \{(j,v)\} ,\mathcal{D})$ + +Selecting the Intervention Value. As shown in (3), maximizing the objective is achieved not only by selecting the intervention target but also by setting the appropriate intervention value. Although optimizing the intervention target is tractable (discrete and finite number of nodes to select from), selecting the value to intervene is usually intractable since they are continuous. For any given target node $j$ , MI is a nonlinear function over $v \in \mathcal{X}_j$ (See Fig 2) and hence solving with gradient ascent techniques only yields a local maximum. Given that MI is expensive to evaluate, we treat MI for a given target node $j$ as a black-box function and obtain its maximum using Bayesian Optimization (BO) (Kushner, 1964, Zhilinskas, 1975, Mockus, 1975). BO seeks to find the maximum of this function $\max_{v \in \mathcal{X}_j} \mathcal{I}(\{(j,v)\})$ over the entire set $\mathcal{X}_j$ with as few evaluations as possible. See appendix E for details. + +BO typically proceeds by placing a Gaussian Process (GP) (Rasmussen, 2003) prior on the function $\mathcal{I}(\{j,\cdot \})$ and obtain the posterior of this function with the queried points $\mathbf{v}^{*} = \{v^{(1)*},\dots ,v^{(T)*}\}$ . Let the value of the mutual information queried at each optimization step $t$ be $\hat{\mathrm{U}}_j^t = \mathcal{I}(\{(j,v^{(t)*}\})$ . The posterior predictive of a point $v^{(t + 1)}$ can be obtained in closed form as a Gaussian with mean $\mu_j^{(t + 1)}(v)$ and variance $\sigma_j^{(t + 1)}(v)$ . Subscript $j$ signifies the fact that we maintain different $\mu$ and $\sigma$ per intervention target and superscript $t$ represents the BO step. Querying proceeds by having an acquisition function defined on this posterior, which suggests the next point to query. For BO, we use + +an acquisition function called as the Upper Confidence Bound (UCB) (Srinivas et al., 2010) which suggests the next point to query by trading-off exploration and exploitation with a hyperparameter $\beta_j^t$ : $v_j^{(t + 1)*} = \arg \max_v\pmb {\mu}_j^{\pmb{t}}(v) + \sqrt{\beta_j^{t + 1}}\pmb {\sigma}_j^{\pmb{t}}(v)$ . + +We run GP-UCB independently on every candidate intervention target $j = \{1, \dots, d\}$ by querying points within a fixed domain $[-k, k] \subset \mathbb{R}$ . Note that the domain can be chosen based on the application, for example, if we must constrain dosage levels within a fixed range. Each GP is one-dimensional in our setup; hence a few evaluations of UCB are sufficient to get a good value maxima candidate. Further, GP-UCB for each candidate target is parallelizable, making it efficient. We finally select the design with the highest MI across the candidate intervention targets. + +# 3.2 Batch Design + +In many applications, it is desirable to select the most informative set of interventions instead of a single intervention at a time. Take, for example, a biologist entering a wet lab with a script of experiments to execute. Batching experiments removes the bottleneck of waiting for an experiment to finish and get analyzed until executing the next one. Given a budget per batch $\mathcal{B}$ which denotes the number of experiments in a batch, the problem of selecting the batch then becomes $\arg \max_{\Xi} \mathrm{I}(\mathbf{Y}; \Phi \mid \Xi, \mathcal{D})$ , such that cardinality $(\Xi) = \mathcal{B}$ , where $\Xi$ is a set of interventions $\bigcup_{i=1}^{\mathcal{B}} (j_i, v_i)$ and $\mathbf{Y}$ denotes the random variable for the outcomes of the interventions of the batch. We denote the MI for a batch design as $\mathcal{I}(\Xi) := \mathrm{I}(\mathbf{Y}; \Phi \mid \Xi, \mathcal{D})$ . + +Greedy Algorithm. Computing the optimal solution $\mathcal{I}(\Xi^{*})$ is computationally infeasible. However, as the conditional mutual information is submodular and non-decreasing (see Appendix B.4 for proof), we can derive a simple greedy algorithm (Algorithm 1) that can achieve at least a $(1 - 1 / e)\approx 0.64$ approximation of the optimal solution (Krause and Guestrin, 2012, Nemhauser et al., 1978). We denote this strategy as Greedy-CBED. + +Soft Top-K. Although the greedy algorithm is tractable, it requires $O(\mathcal{B}d)$ instances of GP-UCB. Kirsch et al. (2021) show that a soft top-k selection strategy performs similarly to the greedy algorithm, reducing the computation requirements to $O(d)$ runs of GP-UCB. To achieve this, we construct a finite set of candidate intervention target-value pairs by keeping all the $T$ evaluations of GP-UCB for each node $j = \{1,\dots ,d\}$ . Therefore, for $d$ nodes, our candidate set is comprised of $d\times T$ experiments. We score each experiment in this candidate set using the MI estimate. We then sample without replacement $\mathcal{B}$ times proportionally to the softmax of the MI scores (Algorithm 2). We denote this strategy as Soft-CBED. + +# 3.3 Comparison with existing active causal discovery methods + +We outline how our approach compares with two main existing active causal discovery methods. + +ABCD (Agrawal et al., 2019). The estimator of MI used in ABCD is based on weighted importance sampling. However, for the specific choice of the importance sampling weights used in ABCD, their MI estimator ends up with the same approximation as in our method (see Appendix B.5). Nevertheless, ABCD does not select intervention values but suboptimally sets them to a fixed value. In addition, our proposed Soft-CBED is a faster and more efficient batch strategy, especially when values also have to be acquired. From this perspective, our approach is an extension of ABCD with nonlinear assumptions, value acquisition, and a soft top-k batching strategy. + +AIT (Scherrer et al., 2021). AIT is an F-score-based intervention target acquisition strategy. Although it is not a BOECD method, we prove here that it can be viewed as a Monte Carlo estimate of the approximation to MI when the outcomes $\mathbf{Y}$ are Gaussian. Nevertheless, AIT does not select intervention values like ABCD and does not have a batch strategy. + +Theorem 3.1. Let $\mathbf{Y}$ be a Gaussian random variable. Then the discrepancy score of Scherrer et al. (2021) is a Monte Carlo estimate of an approximation to mutual information (Eq. (4)). See Appendix B.6 for proof. + +
Algorithm 1: Greedy-CBEDAlgorithm 2: Soft-CBED
Input :E environment, N initial observational samples, B batch Size, d number of nodesInput :E environment, N initial observational samples, B batch Size, d number of nodes, ζ softmax temperature
▷ Initialize set of experiments Ε to empty1 for j = 1...d do
1 Ε ←∅▷ Select candidate intervention values per node j using GP-UCB
2 for n = 1...B do2Initialize μ0j and σ0j
3for j = 1...d do3for t = 1...T do
▷ Select optimal intervention value per node j using GP-UCB4Vtj← arg maxv μt-1j(v) + √βtσt-1j(v)
4Vj← arg maxv I(Ξ∪{(j,v)})5Uj← I{((j,Vj)t)}
5Uj← I(Ξ∪{(j,Vj})6Update the GP to obtain μtj and σtj
6j*← arg maxj Uj7{ (ti,ji)ni∈{1,...,B}← B samples without replacement ∝ exp (Ujt/ζ)
7v*← Vj*
8Ξ← Ε ∪ {(j*,v*)}
9return Ε
8 Ε← { (ji,Vti-j)ni∈{1,...,B}
9 return Ε
+ +# 4 Related Work + +Early efforts of using Bayesian Optimal Experimental Design for Causal Discovery (BOECD) can be found in the works of Murphy (2001) and Tong and Koller (2001). However, these approaches deal with simple settings like limiting the graphs to topologically ordered structures, intervening sequentially, linear models, and discrete variables. + +In Cho et al. (2016) and Ness et al. (2017), BOECD was applied for learning biological networks structure. BOECD was also explored in Greenewald et al. (2019) under the assumption that undirected edges of the graph always forms a tree. More recently, ABCD framework (Agrawal et al., 2019) extended the work of Murphy (2001) and Tong and Koller (2001) in the setting where interventions can be applied in batches with continuous variables. To achieve this, they (approximately) solve the submodular problem of maximizing the batched mutual information between interventions (experiments), outcomes, and observational data, given a DAG. DAG hypotheses are sampled using DAG-bootstrap (Friedman et al., 2013). Our work differs from ABCD in a few ways: we work with both linear and nonlinear SCMs by using state-of-the-art posterior models over DAGs (Lorch et al., 2021), we apply BO to select the value to intervene with, but we also prepare the batch using softBALD (Kirsch et al., 2021) which is significantly faster than the greedy approximation of ABCD method. + +In von Kugelgen et al. (2019) the authors proposed the use of Gaussian Processes to model the posterior over DAGs and then use BO to identify the value to intervene with, however, this method was not shown to be scalable for larger than bivariate graphs since they rely on multi-dimensional Gaussian Processes for modeling the conditional distributions. + +A new body of work has emerged in the field of differentiable causal discovery, where the problem of finding the structure, usually from observational data, is solved with gradient ascent and functional approximators, like neural networks (Zheng et al., 2018, Ke et al., 2019, Brouillard et al., 2020, Bengio et al., 2019). In recent works (Cundy et al., 2021, Lorch et al., 2021, Annadani et al., 2021), the authors proposed a variational approximation of the posterior over the DAGs which allowed for modeling a distribution rather than a point estimate of the DAG that best explains the observational data $\mathcal{D}$ . Such work can be used to replace DAG-bootstrap (Friedman et al., 2013), allowing for the modeling of posterior distributions with greater support. + +Besides the BOECD-based approaches, a few active causal learning works have been proposed (He and Geng, 2008, Gamella and Heinze-Deml, 2020, Scherrer et al., 2021, Shanmugam et al., 2015, Squires et al., 2020, Kocaoglu et al., 2017). Active ICP (Gamella and Heinze-Deml, 2020) uses ICP (Peters et al., 2016) for causal learning while using an active policy to select the target, however, + +![](images/bacb7390da89be28cda39225da85357d58f797637ef5b811abe02acf146d8ee5.jpg) + +![](images/4170f513b9713bb71234ceb4f49c069266ded7c1af052c928947863b78e36236.jpg) + +![](images/675c9781b6297d61aad23b65604c6783d91259f560361b2af435156b3d36455c.jpg) + +Figure 3: Results on the E-SID $\downarrow$ metric (100 seeds, with standard error of the mean shaded) for 50 variables involving nonlinear functional relationships and additive Gaussian noise. (a) We show that Soft-CBED with GP-UCB value selection strategy significantly outperforms the baselines. (b) We isolate the effect of the value selection strategy. We show that intervening with a fixed value and sampling from the support of data both perform worse than having an optimizer like GP-UCB. (c) we compare non-batch (CBED) vs batch-based acquisition functions (Greedy-CBED, Soft-CBED). As we can see, Soft-CBED performs as well as Greedy-CBED. For all experiments, we use the DiBS (Lorch et al., 2021) posterior model. +![](images/ae267486be52d715ff6ebdb086c82c67565d112716e08066bf79453940484b1d.jpg) +AIT GP-UCB SoftAIT GP-UCB Random Fixed CEBD GP-UCB SoftCBed GP-UCB +SoftCBED GP-UCB + +![](images/39db709f1bde9923588e4a67e38d1960a63daba756f0686af1236d25e53a9ccf.jpg) +SoftCBED Fixed SoftCBED Sample Dist + +![](images/8e7aa6c811d8b7af30ae088f95fb33452b4e06c9b58ace42a77b41e381d604fb.jpg) +CBED GP-UCB Greedy CBED GP-UCB +SoftCBED GP-UCB + +this work is not applicable in the setting where the full graph needs to be recovered. In Zhang et al. (2021), the authors propose an active learning method to the problem of identifying the interventions that push a dynamical causal network towards a desired state. A few approaches tackle the problem of actively acquiring interventional data to orient edges of a skeletal graph (Shanmugam et al., 2015, Squires et al., 2020, Kocaoglu et al., 2017). Closer to our proposal belongs AIT (Scherrer et al., 2021), which uses a neural network-based posterior model over the graphs but evaluates the F-score to select the interventions. + +# 5 Experiments + +We evaluate the performance of our method on synthetic and real-world causal experimental design problems and a range of baselines. We aim to investigate the following aspects empirically: (1) competitiveness of the overall proposed strategies of Greedy-CBED and Soft-CBED at scale (50 nodes) on synthetic datasets; (2) performance of the value acquisition strategy based on GP-UCB; and (3) performance of the proposed approach on a real-world inspired dataset. + +# 5.1 Acquisition Functions + +Random. Random baseline acquires interventional targets at random. + +AIT / softAIT. Active intervention targeting (AIT) (Scherrer et al., 2021) uses an f-score based acquisition strategy to select the intervention targets. See appendix B.6 for more details. Since the original proposed approach does not consider a batch setting, we introduce a variant that augments AIT with the proposed soft batching, as described in section 3.2. + +CBED / GreedyCBED / SoftCBED. These are the Monte Carlo estimates of MI, as described in section 3. CBED selects a single intervention (target and value) that maximizes the MI and this intervention is applied for the whole batch. In Greedy-CBED, the batch is built up in a greedy fashion selecting the target, value pairs one at a time (Algorithm 1). Soft-CBED is sampling (target, value) pairs proportionally to the MI scores to select a batch, as described in section 3.2 and Algorithm 2. + +# 5.2 Value Selection Strategies + +Fixed: This value selection strategy assumes setting the value of the intervention to a fixed value. In the experiments, we fixed the value to 0. Sample-Dist: This value selection strategy samples from the support of the observational data. GP-UCB: This strategy uses the proposed GP-UCB Bayesian optimization strategy to select the value that maximizes MI. + +# 5.3 Tasks + +Synthetic Graphs. In this setting, we generate Erdős–Rényi (Erdős and Rényi, 1959) (ER) and Scale-Free (SF) graphs (Barabási and Albert, 1999) of size 20 and 50. For linear SCMs, we sample the edge weights $\gamma$ uniformly at random. For the nonlinear SCM, we parameterize each variable to be a Gaussian whose mean is a nonlinear function of its parents. We model the nonlinear function with a neural network. In all settings, we set noise variance $\sigma^2 = 0.1$ . For both types of graphs, we set the expected number of edges per vertex to 1. We provide more details about the experiments in appendix D.1. + +Single-Cell Protein-Signalling Network. The DREAM family of benchmarks (Greenfield et al., 2010) are designed to evaluate causal discovery algorithms of the regulatory networks of a single cell. A set of ODEs and SDEs generates the dataset, simulating the reverse-engineered networks of single cells. We use GeneNetWeaver (Schaffter et al., 2011) to simulate the steady-state wind-type expression and single-gene knockouts. Refer to appendix D.2 for the exact settings. + +# 5.4 Metrics + +$\mathbb{E}$ -SHD: Defined as the expected structural hamming distance between samples from the posterior model over graphs and the true graph $\mathbb{E}$ -SHD := $\mathbb{E}_{\mathbf{g} \sim p(\mathcal{G}|\mathcal{D})}[\mathrm{SHD}(\mathbf{g}, \tilde{\mathbf{g}})]$ + +$\mathbb{E}$ -SID: As the SHD is agnostic to the notion of intervention, (Peters and Buhlmann, 2015) proposed the expected structural interventional distance (E-SID) which quantifies the differences between graphs with respect to the causal inference statements and interventional distributions. + +AUROC: The area under the receiver operating characteristic curve of the binary classification task of predicting the presence/absence of all edges. + +AUPRC: The area under the precision-recall curve of the binary classification task of predicting the presence/absence of all edges. + +# 6 Results + +For each of the acquisition objectives and datasets, we present the mean and standard error of the expected structural hamming distance E-SHD, expected structural interventional distance E-SID (Peters and Buhlmann, 2015), area under the receiver operating characteristic curve AUROC and area under the precision-recall curve AUPRC. We evaluate these metrics as a function of the number of acquired interventional samples (or experiments), which helps quantitatively compare different acquisition strategies. Apart from E-SID, we relegate results with other metrics to the appendix I. + +On the synthetic graphs (Figure 3(a)), we can see that for ER and SF graphs with $50D$ variables and nonlinear functional relationships, the proposed approach based on soft top-k to + +Table 1: Performance comparison between different value selection and batch strategies for CBED. Experiments are performed using an AMD EPYC 7662 64-Core CPU and Tesla V100 GPU. + +
Strategy
ValueBatchRuntime(s)
FixedGreedy32.56
Soft6.42
GP-UCBGreedy284.98
Soft24.17
+ +select a batch with GP-UCB outperforms all the baselines in terms of the E-SID metric. On the other hand, AIT alone does not converge to the ground truth graph fast even after combining with the proposed value acquisition, but when further augmented with the proposed soft strategy, the softAIT recovers the ground truth causal graph upto 4 times faster and performs competitively to Soft-CBED. We observe similar performance across other metrics as well. In addition, we found this trend to hold for $20D$ variables and linear models. Full results are presented in the appendix I. + +![](images/e50433e0e5ae3cdd594680a0de0c786f1ee750652547b99dc4120cf0dd907176.jpg) +Figure 4: Comparison of acquisition functions on DREAM dataset, for 50 dimensions and batch size 10 on $\mathbb{E}$ -SID $\downarrow$ metric (6 seeds, with standard error of the mean). + +![](images/0ea632bb330fc3b1569b950ccca5b28f8bae03c4f56b45b461701f7c0be020a6.jpg) + +![](images/f6bef1276489a3f4e4db7d4643081c97851eae8b974d68e71aa4cdf084c9f3d9.jpg) + +![](images/beb4e77e195662e2059cd1350738978580add12ad675e559ead41b92e7791071.jpg) + +Next, we examine the importance of having a value selection strategy for active causal discovery. We use the MI estimator in Equation 4; moreover, we test the proposed GP-UCB with two heuristics - the fixed value strategy and sampling values from the support. As we can see in Figure 3(b), selecting the value using GP-UCB clearly benefits the causal discovery process. We expect this finding as the mutual information is not constant with respect to the intervened value. To make this point clear, we demonstrate in the appendix G the influence of the value in a simple two variables graph. In addition, we note that naively sampling from the support of the observed dataset performs worse than fixing the value to 0. We hypothesize that this is due to lower epistemic uncertainty in the high density regions of the support, hinting that these regions might be less informative. + +In order to further understand how the soft batch strategy compares with other batch selection strategies, we compare the results of Soft-CBED with Greedy-CBED and CBED. We observe (Figure 3(c)) that Greedy-CBED and Soft-CBED give very similar results overall. While Greedy-CBED is optimal under certain conditions (Kirsch et al., 2019), Soft-CBED remains competitive and has the advantage that the batch can be selected in a one-shot manner. This is also evident from the runtime performance of both these batching strategies in Table 1. Both these batch selection strategies perform significantly better than selecting one intervention target/value pair, and executing them $\mathcal{B}$ times (CBED). + +Finally, on the DREAM task, we see that our method outperforms softAIT and random baselines on the E-SID metric (see Figure 4). In these experiments, since the intervention is emulating the gene knockout setting, we only use the fixed value strategy, with a value of 0.0. Although random baseline still remains a competitive choice, in certain settings, Soft-CBED objective is significantly better (Ecoli1, Ecoli2 datasets). + +# 7 Summary and Conclusions + +This paper studies the problem of efficiently selecting the Bayes optimal experiments to discover causal models. Our proposed framework simultaneously answers the questions of where and how to intervene in a batched setting. We present a Bayesian optimization strategy to acquire interventional targets and values. Further, we propose two different batching strategies: one based on greedy selection and the other based on soft top-k selection. The proposed methodology for selecting intervention target-value pairs in a batched setting provides superior performance over the state-of-the-art for causal models up to $50D$ variables. We validate this using synthetic datasets and using real-world inspired datasets of single-cell regulatory networks, showing the potential impact on areas like biology and other experimental sciences. + +# Acknowledgments and Disclosure of Funding + +We would like to thank Nino Scherrer, Tom Rainforth, Desi R. Ivanova and all anonymous reviewers for sharing their valuable feedback and insights. Panagiotis Tugas is supported by the UK EPSRC CDT in Autonomous Intelligent Machines and Systems (grant reference EP/L015897/1). We are grateful for compute from the Berzelius Cluster and the Swedish National Supercomputer Centre. + +# References + +Raj Agrawal, Chandler Squires, Karren Yang, Karthikeyan Shanmugam, and Caroline Uhler. Abcdstrategy: Budgeted experimental design for targeted causal structure discovery. In The 22nd International Conference on Artificial Intelligence and Statistics, pages 3400-3409. PMLR, 2019. +Yashas Annadani, Jonas Rothfuss, Alexandre Lacoste, Nino Scherrer, Anirudh Goyal, Yoshua Bengio, and Stefan Bauer. Variational causal networks: Approximate bayesian inference over causal structures. arXiv preprint arXiv:2106.07635, 2021. +Albert-László Barabási and Réka Albert. Emergence of scaling in random networks. science, 286 (5439):509-512, 1999. +Vladimir Batagelj and Ulrik Brandes. Efficient generation of large random networks. Physical Review E, 71(3):036113, 2005. +Yoshua Bengio, Tristan Deleu, Nasim Rahaman, Rosemary Ke, Sébastien Lachapelle, Olexa Bilaniuk, Anirudh Goyal, and Christopher Pal. A meta-transfer objective for learning to disentangle causal mechanisms. arXiv preprint arXiv:1901.10912, 2019. +Philippe Brouillard, Sébastien Lachapelle, Alexandre Lacoste, Simon Lacoste-Julien, and Alexandre Drouin. Differentiable causal discovery from interventional data. arXiv preprint arXiv:2007.01754, 2020. +Kathryn Chaloner and Isabella Verdinelli. Bayesian experimental design: A review. Statistical Science, pages 273-304, 1995. +Hyunghoon Cho, Bonnie Berger, and Jian Peng. Reconstructing causal biological networks through active learning. *PloS one*, 11(3):e0150611, 2016. +Chris Cundy, Aditya Grover, and Stefano Ermon. Bcd nets: Scalable variational approaches for bayesian causal discovery. Advances in Neural Information Processing Systems, 34, 2021. +P Erdős and A Rényi. On random graphs i. publicationes mathematicae (debrecen). 1959. +Adam Foster, Martin Jankowiak, Eli Bingham, Paul Horsfall, Yee Whye Teh, Tom Rainforth, and Noah Goodman. Variational bayesian optimal experimental design. arXiv preprint arXiv:1903.05480, 2019. +Adam Foster, Martin Jankowiak, Matthew O'Meara, Yee Whye Teh, and Tom Rainforth. A unified stochastic gradient approach to designing bayesian-optimal experiments. In International Conference on Artificial Intelligence and Statistics, pages 2959-2969. PMLR, 2020. +Adam Foster, Desi R Ivanova, Ilyas Malik, and Tom Rainforth. Deep adaptive design: Amortizing sequential bayesian experimental design. arXiv preprint arXiv:2103.02438, 2021. +Nir Friedman, Moises Goldszmidt, and Abraham Wyner. Data analysis with bayesian networks: A bootstrap approach. arXiv preprint arXiv:1301.6695, 2013. +Juan L Gamella and Christina Heinze-Deml. Active invariant causal prediction: Experiment selection through stability. arXiv preprint arXiv:2006.05690, 2020. +Kristjan Greenewald, Dmitriy Katz, Karthikeyan Shanmugam, Sara Magliacane, Murat Kocaoglu, Enric Boix Adsera, and Guy Bresler. Sample efficient active learning of causal trees. Advances in Neural Information Processing Systems, 32, 2019. +Alex Greenfield, Aviv Madar, Harry Ostrer, and Richard Bonneau. Dream4: Combining genetic and dynamic information to identify biological networks and dynamical models. *PloS one*, 5(10): e13397, 2010. +Yang-Bo He and Zhi Geng. Active learning of causal networks with intervention experiments and optimal designs. Journal of Machine Learning Research, 9(Nov):2523-2547, 2008. +Neil Houlsby, Ferenc Huszár, Zoubin Ghahramani, and Mate Lengyel. Bayesian active learning for classification and preference learning. arXiv preprint arXiv:1112.5745, 2011. + +Desi R Ivanova, Adam Foster, Steven Kleinegesse, Michael U Gutmann, and Thomas Rainforth. Implicit deep adaptive design: policy-based experimental design without likelihoods. Advances in Neural Information Processing Systems, 34:25785-25798, 2021. +Nan Rosemary Ke, Olexa Bilaniuk, Anirudh Goyal, Stefan Bauer, Hugo Larochelle, Bernhard Schölkopf, Michael C Mozer, Chris Pal, and Yoshua Bengio. Learning neural causal models from unknown interventions. arXiv preprint arXiv:1910.01075, 2019. +Andreas Kirsch, Joost Van Amersfoort, and Yarin Gal. Batchbald: Efficient and diverse batch acquisition for deep bayesian active learning. Advances in neural information processing systems, 32:7026-7037, 2019. +Andreas Kirsch, Sebastian Farquhar, and Yarin Gal. A simple baseline for batch active learning with stochastic acquisition functions. arXiv preprint arXiv:2106.12059, 2021. +Steven Kleinegesse and Michael U Gutmann. Efficient bayesian experimental design for implicit models. In The 22nd International Conference on Artificial Intelligence and Statistics, pages 476-485. PMLR, 2019. +Murat Kocaoglu, Alex Dimakis, and Sriram Vishwanath. Cost-optimal learning of causal graphs. In International Conference on Machine Learning, pages 1875-1884. PMLR, 2017. +Andreas Krause and Carlos E Guestrin. Near-optimal nonmyopic value of information in graphical models. arXiv preprint arXiv:1207.1394, 2012. +Harold J Kushner. A new method of locating the maximum point of an arbitrary multipeak curve in the presence of noise. 1964. +Vincent Lim, Ellen Novoseller, Jeffrey Ichnowski, Huang Huang, and Ken Goldberg. Policy-based bayesian experimental design for non-differentiable implicit models. arXiv preprint arXiv:2203.04272, 2022. +Dennis V Lindley. On a measure of the information provided by an experiment. The Annals of Mathematical Statistics, pages 986-1005, 1956. +Qiang Liu and Dilin Wang. Stein variational gradient descent: A general purpose bayesian inference algorithm. arXiv preprint arXiv:1608.04471, 2016. +Lars Lorch, Jonas Rothfuss, Bernhard Scholkopf, and Andreas Krause. Dibs: Differentiable bayesian structure learning. arXiv preprint arXiv:2105.11839, 2021. +Gonzalo Mena, David Belanger, Scott Linderman, and Jasper Snoek. Learning latent permutations with gumbel-sinkhorn networks. arXiv preprint arXiv:1802.08665, 2018. +Jonas Močkus. On bayesian methods for seeking the extremum. In *Optimization techniques IFIP technical conference*, pages 400-404. Springer, 1975. +Kevin P Murphy. Active learning of causal bayes net structure. 2001. +George L Nemhauser, Laurence A Wolsey, and Marshall L Fisher. An analysis of approximations for maximizing submodular set functions—i. Mathematical programming, 14(1):265–294, 1978. +Robert Osazuwa Ness, Karen Sachs, Parag Mallick, and Olga Vitek. A bayesian active learning experimental design for inferring signaling networks. In International Conference on Research in Computational Molecular Biology, pages 134-156. Springer, 2017. +Judea Pearl. Causality. Cambridge university press, 2009. +Jonas Peters and Peter Buhlmann. Structural intervention distance for evaluating causal graphs. Neural computation, 27(3):771-799, 2015. +Jonas Peters, Joris Mooij, Dominik Janzing, and Bernhard Scholkopf. Identifiability of causal graphs using functional models. arXiv preprint arXiv:1202.3757, 2012. + +Jonas Peters, Peter Buhlmann, and Nicolai Meinshausen. Causal inference by using invariant prediction: identification and confidence intervals. Journal of the Royal Statistical Society. Series B (Statistical Methodology), pages 947-1012, 2016. +Jonas Peters, Dominik Janzing, and Bernhard Schölkopf. Elements of causal inference: foundations and learning algorithms. The MIT Press, 2017. +Ben Poole, Sherjil Ozair, Aaron Van Den Oord, Alex Alemi, and George Tucker. On variational bounds of mutual information. In International Conference on Machine Learning, pages 5171-5180. PMLR, 2019. +Tom Rainforth, Rob Cornish, Hongseok Yang, Andrew Warrington, and Frank Wood. On nesting monte carlo estimators. In International Conference on Machine Learning, pages 4267-4276. PMLR, 2018. +Carl Edward Rasmussen. Gaussian processes in machine learning. In Summer school on machine learning, pages 63-71. Springer, 2003. +Karen Sachs, Omar Perez, Dana Pe'er, Douglas A Lauffenburger, and Garry P Nolan. Causal protein-signaling networks derived from multiparameter single-cell data. Science, 308(5721):523-529, 2005. +Thomas Schaffter, Daniel Marbach, and Dario Floreano. Genenetweaver: in silico benchmark generation and performance profiling of network inference methods. Bioinformatics, 27(16): 2263-2270, 2011. +Nino Scherrer, Olexa Bilaniuk, Yashas Annadani, Anirudh Goyal, Patrick Schwab, Bernhard Scholkopf, Michael C Mozer, Yoshua Bengio, Stefan Bauer, and Nan Rosemary Ke. Learning neural causal models with active interventions. arXiv preprint arXiv:2109.02429, 2021. +Mark Schmidt, Alexandru Niculescu-Mizil, Kevin Murphy, et al. Learning graphical model structure using 11-regularization paths. In AAAI, volume 7, pages 1278-1283, 2007. +Karthikeyan Shanmugam, Murat Kocaoglu, Alexandros G Dimakis, and Sriram Vishwanath. Learning causal graphs with small interventions. Advances in Neural Information Processing Systems, 28, 2015. +Chandler Squires, Sara Magliacane, Kristjan Greenewald, Dmitriy Katz, Murat Kocaoglu, and Karthikeyan Shanmugam. Active structure learning of causal dags via directed clique trees. Advances in Neural Information Processing Systems, 33:21500-21511, 2020. +Niranjan Srinivas, Andreas Krause, Sham Kakade, and Matthias W Seeger. Gaussian process optimization in the bandit setting: No regret and experimental design. In ICML, 2010. +Scott Sussex, Andreas Krause, and Caroline Uhler. Near-optimal multi-perturbation experimental design for causal structure learning. arXiv preprint arXiv:2105.14024, 2021. +MTCAJ Thomas and A Thomas Joy. Elements of information theory. Wiley-Interscience, 2006. +Simon Tong and Daphne Koller. Active learning for structure in bayesian networks. In International joint conference on artificial intelligence, volume 17, pages 863-869. CiteSeer, 2001. +Julius von Kugelgen, Paul K Rubenstein, Bernhard Scholkopf, and Adrian Weller. Optimal experimental design via bayesian optimization: active causal structure learning for gaussian process networks. arXiv preprint arXiv:1910.03962, 2019. +Jiaqi Zhang, Chandler Squires, and Caroline Uhler. Matching a desired causal state via shift interventions. Advances in Neural Information Processing Systems, 34:19923-19934, 2021. +Xun Zheng, Bryon Aragam, Pradeep Ravikumar, and Eric P Xing. Dags with no tears: Continuous optimization for structure learning. arXiv preprint arXiv:1803.01422, 2018. +AG Zhilinskas. Single-step bayesian search method for an extremum of functions of a single variable. Cybernetics, 11(1):160-166, 1975. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] See end of Section 1. Our limitations arise from the fact that the proposed methodology and conclusion hold when the assumptions laid out are satisfied. +(c) Did you discuss any potential negative societal impacts of your work? [Yes] Negative societal impact is discussed in appendix A and will be added to the extra page of the camera ready after the reviewing process. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] The assumptions are laid out in Introduction as well as in Theorem 3.1. +(b) Did you include complete proofs of all theoretical results? [Yes] The proofs are in Appendix. + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Appendix D.1, D.2 and H +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] See Figure 3 and 4. +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] Please check appendix K for details. + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] +(b) Did you mention the license of the assets? [Yes] Please check appendix L for details. +(c) Did you include any new assets either in the supplemental material or as a URL? [No] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] Data are simulated. +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] Data are simulated. + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/interventionswhereandhowexperimentaldesignforcausalmodelsatscale/images.zip b/interventionswhereandhowexperimentaldesignforcausalmodelsatscale/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..cb2bc705f9cdcea0cb78da036971a13290e8806f --- /dev/null +++ b/interventionswhereandhowexperimentaldesignforcausalmodelsatscale/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1c564f2e3488f8ad08a87cb358e363c0e506aab36d53fde3a1fa54f4273f0a2f +size 322130 diff --git a/interventionswhereandhowexperimentaldesignforcausalmodelsatscale/layout.json b/interventionswhereandhowexperimentaldesignforcausalmodelsatscale/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..c4f9c7ca0d08ce81bd995b094e461a0c909dd398 --- /dev/null +++ b/interventionswhereandhowexperimentaldesignforcausalmodelsatscale/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5ad6b3d09d996bbc3b890b6e9efd6ecc29be39fc50949ed3211c717aedb7675d +size 477621 diff --git a/intraagentspeechpermitszeroshottaskacquisition/9d2eab00-9d96-4b38-8d14-c85a7bfe9d19_content_list.json b/intraagentspeechpermitszeroshottaskacquisition/9d2eab00-9d96-4b38-8d14-c85a7bfe9d19_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..769e71744eef4754acfda3522e6c8b7aa7722310 --- /dev/null +++ b/intraagentspeechpermitszeroshottaskacquisition/9d2eab00-9d96-4b38-8d14-c85a7bfe9d19_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:26d19c5e1acb3c124d56dc6475fb3e2ba4afda625b6c1e74b96b25ac195be70a +size 92731 diff --git a/intraagentspeechpermitszeroshottaskacquisition/9d2eab00-9d96-4b38-8d14-c85a7bfe9d19_model.json b/intraagentspeechpermitszeroshottaskacquisition/9d2eab00-9d96-4b38-8d14-c85a7bfe9d19_model.json new file mode 100644 index 0000000000000000000000000000000000000000..853ad9005a1582c37e8dceccf3e34dc80aee7070 --- /dev/null +++ b/intraagentspeechpermitszeroshottaskacquisition/9d2eab00-9d96-4b38-8d14-c85a7bfe9d19_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:549a23da05ae82111cf3c8005bde4a60f19f651c3afd5c812dc98b3786762cc1 +size 120484 diff --git a/intraagentspeechpermitszeroshottaskacquisition/9d2eab00-9d96-4b38-8d14-c85a7bfe9d19_origin.pdf b/intraagentspeechpermitszeroshottaskacquisition/9d2eab00-9d96-4b38-8d14-c85a7bfe9d19_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..528592c143918bd5b87ce3f06324b061ab4bb3ec --- /dev/null +++ b/intraagentspeechpermitszeroshottaskacquisition/9d2eab00-9d96-4b38-8d14-c85a7bfe9d19_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:92a3d693210e0d4e431e10152997e7feb5cb92faa6161a73e0424f19f19df410 +size 9674367 diff --git a/intraagentspeechpermitszeroshottaskacquisition/full.md b/intraagentspeechpermitszeroshottaskacquisition/full.md new file mode 100644 index 0000000000000000000000000000000000000000..8f0f7c3f6eaa30ee1c9141145edaf538475a8403 --- /dev/null +++ b/intraagentspeechpermitszeroshottaskacquisition/full.md @@ -0,0 +1,422 @@ +# Intra-agent speech permits zero-shot task acquisition + +# Chen Yan + +DeepMind + +London, UK + +ywc@deepmind.com + +# Federico Carnevale + +DeepMind + +London, UK + +fedecarnev@deepmind.com + +# Petko Georgiev + +DeepMind + +London, UK + +petkoig@deepmind.com + +# Adam Santoro + +DeepMind + +London, UK + +adamsantoro@deepmind.com + +# Aurelia Guy + +OpenAI* + +San Francisco, USA + +7aureliaguy@gmail.com + +# Alistair Muldal + +DeepMind + +London, UK + +alimuldal@deepmind.com + +# Chia-Chun Hung + +Isomorphic Labs* + +London, UK + +aldenhung@google.com + +# Josh Abramson + +DeepMind + +London, UK + +jabramson@deepmind.com + +# Timothy Lillicrap + +DeepMind + +London, UK + +countzero@deepmind.com + +# Gregory Wayne + +DeepMind + +London, UK + +gregwayne@deepmind.com + +# Abstract + +Human language learners are exposed to a trickle of informative, context-sensitive language, but a flood of raw sensory data. Through both social language use and internal processes of rehearsal and practice, language learners are able to build high-level, semantic representations that explain their perceptions. Here, we take inspiration from such processes of "inner speech" in humans (Vygotsky, 1934) to better understand the role of intra-agent speech in embodied behaviour. First, we formally pose intra-agent speech as a semi-supervised problem and develop two algorithms that enable visually grounded captioning with little labeled language data. We then experimentally compute scaling curves over different amounts of labeled data and compare the data efficiency against a supervised learning baseline. Finally, we incorporate intra-agent speech into an embodied, mobile manipulator agent operating in a 3D virtual world, and show that with as few as 150 additional image captions, intra-agent speech endows the agent with the ability to manipulate and answer questions about a new object without any related task-directed experience (zero-shot). Taken together, our experiments suggest that modelling intra-agent speech is effective in enabling embodied agents to learn new tasks efficiently and without direct interaction experience. + +# 1 Introduction + +Contemporary language models learn from troves of text comprising billions, and sometimes trillions of tokens. This is not the same situation faced by embodied language learners, such as human children, + +![](images/d83b2736e81f7ab7dcf35a5cb077d9ec879774bc2889766027f370a4c15f8d22.jpg) +Training +Caption about new object (rare) + +![](images/8d00bc7c6407160d516b23c263ac57201a3d955209e7d0965dba2e2dcff01a36.jpg) +Self supervision about new object + +![](images/d9d06a27cb03de8fbebc7a06c2ece6f1336b0c44b1bb2667ac86e2687513dc58.jpg) +Tasks about known objects + +![](images/7b2a57f63b5d5c3a820f6272af867cc2fc743356b785a380a68ed2e795e995f4.jpg) +Inference +Figure 1: Learning to speak about new objects permits zero-shot motor task behavior. Is it possible for agents to perform complex tasks with a new object just by learning to name it? In this work, we show it is. We first trained agents to speak about objects that had never been used in any task, nor named in any interaction, by training agents to caption their observations (top row, left and middle). We then introduced interactive tasks involving other objects and trained agents with imitation learning (top right). Using only a small number of labeled captions that pertained to a new object category (drums), agents were able to perform tasks involving the new objects, such as lifting and delivering them to a second avatar (bottom). + +whose raw sensory data vastly exceeds their social-linguistic experiences. Psychologists have long noted the existence of non-social, intra-personal dialogue—such as inner speech (silent) or private speech (aloud)—which provides additional linguistic experiences beyond those encountered in social settings. Indeed, one possible reason for intra-personal speech may be to support the development of social speech [1–5], though the inverse causal relation may also be possible [1, 6]. + +Intra-personal speech may also affect broader aspects of our cognition: the process wherein we privately speak about our perceptions subsequently impacts how we attend to, remember, or manipulate the objects of our perception [7-12]. For example, our short-term memories tend to commit errors for items that are phonetically but not visually or semantically similar [8, 9], and "self-talk" affects task performance on executive tasks both in children [11, 12] and in adults [7], and has been widely used to improve athletic performance [10]. + +Inspired by these ideas, here we ask if we can leverage intra-agent speech as a tool for artificial intelligence research. Specifically, we ask the following questions: First, is it possible to model intra-agent speech as a machine learning problem, enabling us to make up for a paucity of language data when given access to a large amount of unlabeled data? Second, can mechanisms for learning intra-agent speech impact the subsequent behavior of an embodied agent? + +Regarding the first, we formally structure intra-agent speech as a semi-supervised problem. In particular, we model intra-agent speech samples as variational latent variables representing images, and use this perspective to devise two algorithms enabling visual captioning given a paucity of directly labeled data. Regarding the second, we go on to show how embedding such algorithms in an embodied agent not only permits the capacity to speak about any given perception (that is, to caption, which is precisely what is being optimized for) but rather also permits zero-shot behaviors involving new objects that were never directly implicated in any task-directed experience (see Figure 1). + +# 2 Approach + +At a high level, we structured intra-agent speech as the production of language generated from inputs (which in our case manifests as captions of images), with two additional concerns: First, there will be a preponderance of unlabeled data (i.e., pure images) relative to labeled data (i.e., images with associated captions) in our captioning dataset, much like the situations faced by human children in nature and semi-supervised learning in machine learning. Second, the linguistic representations eventually produced will provide auxiliary supervision for an embodied, acting agent so that they may influence interactive behavior. + +![](images/233538e04e61d108e7bc38a8b9efa002a7f0b9db152dd6ebd7ad1c480380818b.jpg) +Figure 2: Using models of intra-agent speech to influence behavior. During intra-agent speech pre-training, agents receive image observations as input and produce either utterances that describe the observations (for the small number of inputs for which we have human annotated labels) or are tasked with reconstructing the images (using a generative model whose latent representations comprise language tokens). During behavioral training, the intra-agent speech module is frozen and is used to provide targets for an auxiliary captioning loss, whose gradients affect components responsible for action selection. + +In humans, the learning of external and internal speech, the rehearsal of inner speech, and the practice of tasks can develop concurrently. In the first stage, we pretrain a captioning model by semi-supervised learning, using a small amount of labeled language data and the large amount of agent's experience as unlabeled data. This model is able to commentate about visual observations – a critical function of "inner speech". This model is then used to commentate (via what we have named "intra-agent speech") on further experiences to shape representations as the agent goes on to learn specific tasks, and we show comparisons of the agent's performance with and without this intra-agent speech process. + +A diagram of the semi-supervised learning approach to intra-agent speech and its role in acquiring behaviors is shown in Figure 2. + +# 2.1 Methods for Semi-supervised Language Learning + +Our data $D$ are composed of a dataset $D_{p}$ of paired data $\{\mathbf{x},\mathbf{y}\}$ and a dataset $D_{u}$ of unpaired data $\{\mathbf{x}\}$ . In our interpretation, $\mathbf{y}$ corresponds to language (a caption) describing the image $\mathbf{x}$ . When observing unpaired data, we treat $\mathbf{y}$ as a latent variable that must be inferred to explain the observed data [13]. We develop two variants, one generative and one contrastive, of the semi-supervised language learning algorithm in what follows. + +# 2.1.1 Generative variant + +The preponderance of our data is unlabeled. To model these data we can maximise a variational lower bound on the log marginal distribution, $\log p_{\theta}(\mathbf{x})$ , corresponding to posterior inference. We will use a learned approximation to the true posterior distribution, $q_{\omega}(\mathbf{y} \mid \mathbf{x})$ . We call this approximate distribution an "image-conditional language encoder" (or sometimes, simply, caption model) since its functional role is to convert images into a discrete latent code that is, ideally, a semantically meaningful language caption: + +$$ +\sum_ {\mathbf {x} \sim D _ {u}} \log p _ {\theta} (\mathbf {x}) \geq \sum_ {\mathbf {x} \sim D _ {u}} \mathbb {E} _ {q _ {\omega} (\mathbf {y} | \mathbf {x})} [ \log p _ {\theta} (\mathbf {x} \mid \mathbf {y}) ] - \mathcal {D} _ {\mathrm {K L}} [ q _ {\omega} (\mathbf {y} \mid \mathbf {x}) \| p _ {\phi} (\mathbf {y}) ] = J _ {u}. \tag {1} +$$ + +In Equation 1, the space of latent codes (captions) is discrete and vast, complicating optimization. However, we can form a stochastic approximation by sampling from $q_{\omega}(\mathbf{y} \mid \mathbf{x})$ to estimate a gradient. + +$$ +\nabla_ {\omega} J _ {u} = \sum_ {\mathbf {x} \sim D _ {u}} \mathbb {E} _ {q _ {\omega} (\mathbf {y} | \mathbf {x})} \left[ \nabla_ {\omega} \log q _ {\omega} (\mathbf {y} \mid \mathbf {x}) \left(\log p _ {\theta} (\mathbf {x} \mid \mathbf {y}) + \log p _ {\phi} (\mathbf {y}) - \log q _ {\omega} (\mathbf {y} \mid \mathbf {x})\right) \right]. \tag {2} +$$ + +For simplicity, we pretrain the prior $p_{\phi}(\mathbf{y})$ as a language model that learns on all of our caption data, and fix it during this optimisation phase. Thus, optimising $J_{u}$ corresponds to an entropy-regularised + +RL problem [14-16]. The encoder $q_{\omega}(\mathbf{y} \mid \mathbf{x})$ serves as a policy that achieves reward for matching the language model prior while enabling the language-conditional decoder to reconstruct the image. + +While this reward pressures the image-conditional language encoder to produce linguistically meaningful latent codes, we can also exert additional pressure by using a small number of images with associated captions ("labeled data"), and leverage supervised learning to learn $\log p_{\theta}(\mathbf{x}|\mathbf{y}),\log p_{\phi}(\mathbf{y}),\log q_{\omega}(\mathbf{y}|\mathbf{x})$ .. + +$$ +J _ {p} = \sum_ {\mathbf {x}, \mathbf {y} \sim D _ {p}} \left[ \log p _ {\theta} (\mathbf {x} \mid \mathbf {y}) + \log p _ {\phi} (\mathbf {y}) + \log q _ {\omega} (\mathbf {y} \mid \mathbf {x}) \right]. \tag {3} +$$ + +Over the combined paired and unpaired datasets, our complete objective is to maximise $J = J_{p} + J_{u}$ . + +# 2.1.2 Contrastive variant + +The language-conditional image decoder $p_{\theta}(\mathbf{x} \mid \mathbf{y})$ is a potentially complicated term to model. To understand if this term represents a liability for the approach and to generate an algorithm with potentially complementary strengths, we also developed a contrastive, energy-based approach, amounting to multi-class classification, to approximate it [17-19]. If we have a multi-class classifier that discriminates if a batch element $\mathbf{y}_j$ is paired to a batch element $\mathbf{x}_j$ , and we express its cross-entropy loss for the correct index $c = j$ as $L(\{\mathbf{x}_b\}_{b=1}^B, \mathbf{y}_j, c = j)$ , then we can show that the generative reconstruction loss $\log p_{\theta}(\mathbf{x}_j \mid \mathbf{y}_j)$ is proportional to $L(\{\mathbf{x}_b\}_{b=1}^B, \mathbf{y}_j, c = j)$ up to constant factors with respect to $\mathbf{y}$ (Appendix A.1). Thus, we can substitute $L(\{\mathbf{x}_b\}_{b=1}^B, \mathbf{y}_j, c = j)$ for batch element $j$ , $\log p_{\theta}(\mathbf{x}_j \mid \mathbf{y}_j)$ , in Equation 2, and the gradients with respect to $\omega$ remain the same in expectation. + +We represented the softmax in the classifier as $\frac{e^{\mathbf{f}(\mathbf{x}_j)^\top\mathbf{g}(\mathbf{y}_j)}}{\sum_{b = 1}^{B}e^{\mathbf{f}(\mathbf{x}_b)^\top\mathbf{g}(\mathbf{y}_j)}}$ , where $\mathbf{f}$ and $\mathbf{g}$ are networks that compress the image into a vector and the caption into a vector, respectively. To train this classifier, we adopted a similar approach to recent models for visual language representation learning [20, 21] by minimizing the sum of two losses, one for matching each image to its paired caption in the batch, and one for matching each caption to its paired image: + +$$ +L = \frac {1}{B} \sum_ {j = 1} ^ {B} \log \frac {e ^ {\mathbf {f} \left(\mathbf {x} _ {j}\right) ^ {\top} \mathbf {g} \left(\mathbf {y} _ {j}\right)}}{\sum_ {b = 1} ^ {B} e ^ {\mathbf {f} \left(\mathbf {x} _ {b}\right) ^ {\top} \mathbf {g} \left(\mathbf {y} _ {j}\right)}} + \frac {1}{B} \sum_ {j = 1} ^ {B} \log \frac {e ^ {\mathbf {f} \left(\mathbf {x} _ {j}\right) ^ {\top} \mathbf {g} \left(\mathbf {y} _ {j}\right)}}{\sum_ {b = 1} ^ {B} e ^ {\mathbf {f} \left(\mathbf {x}, _ {j}\right) ^ {\top} \mathbf {g} \left(\mathbf {y}, _ {b}\right)}} \tag {4} +$$ + +The networks $\mathbf{f}$ and $\mathbf{g}$ are trained at the same time as the rest of the model, and samples from $q_{\omega}(\mathbf{y}_j \mid \mathbf{x}_j)$ are included as positive examples for the classifier along with the original paired data. + +# 2.1.3 Intra-agent speech architecture and optimization + +Image-conditional language encoder. The image-conditional language encoder received input images with resolution $96 \times 72$ . We used the ResNet architecture described in [22], with strides $(1,1,2,2)$ , $3 \times 3$ kernel size, and channel sizes (64, 64, 128, 256) for a total of 20 layers. Language was produced by a 4-layer causal transformer with 256 embedding size and 4 attention heads [23], which attended to the 432 hyper-pixel vectors generated from the ResNet, and produced a sequence of logits corresponding to a 4,000 token vocabulary. Language targets were encoded with a SentencePiece byte-pair encoder [24] trained using language data from [25]. + +Generative semi-supervised model. The language prior comprised a separate transformer pretrained on all the caption labels in the training data (and hence, did not have image inputs). For the image decoder, we first pre-trained a VQ-VAE [26] on all unlabeled images to define the VQ-VAE's codebook, compressing each image into 432 tokens with a vocabulary of 512. We then used an 8-layer transformer with 512 embedding size with causal masking to model the VQ-VAE tokens autoregressively. The conditioning captions were tokenized and embedded as in the image-conditional language encoder, and then processed by a distinct transformer with 4 layers, 256 embedding size, and 4 heads, whose output was then cross-attended by the image decoder to produce a reconstruction. + +Contrastive semi-supervised model. For the contrastive model, images were first encoded using a ResNet with the same architecture as the image-conditional language encoder, and globally mean-pooled into one vector with dimension 1024. Language was first encoded using a transformer with + +the same 4-layer architecture described above, and then flattened and compressed with a 2-layer MLP with dimensions (2048, 1024). + +**Optimization.** We used V-MPO [16] to optimize $q_{\omega}(\mathbf{y} \mid \mathbf{x})$ . The loss was optimized by the Adam optimizer [27] with $\beta_{1} = 0.9, \beta_{2} = 0.999$ and a learning rate of $2 \times 10^{-4}$ with early stopping at the lowest log-likelihood over captions in validation data. We trained all models with a batch size of 128 except for the contrastive classifier model, which also received 2,048 unlabeled images per batch, giving a total batch size of 2,176. We trained our models using Tensor Processing Units (TPUv3) [28]. In all experiments the early stopping criteria was reached within 150K optimization steps. + +# 2.2 Agent training + +The agent was trained by behavioral cloning on a large corpus of human interactions in the Playhouse environment [22]. Briefly, it comprises a 3D simulated environment wherein two embodied avatars interact with natural language to cooperatively accomplish tasks involving object manipulation, navigation, and question answering. In addition to receiving visual observations and producing motor actions, agents in this environment also receive language inputs and produce language outputs. This allows them to answer questions, participate in dialogue, ask for clarifications, and so on. + +Our approach to training the linguistic representations of the agent therefore has two steps. First, by using semi-supervised language learning, we can amplify the impact of sparse language annotations provided for a small number of images in learning the intra-agent speech module. In turn, using this trained module, we are able to sample captions at high frequency as the agent acts, providing the agent with dense language supervision. Therefore, while the agent trains using behavioral cloning, we can sample captions from the pretrained intra-agent speech module, and provide these as either auxiliary inputs or targets to the agent so that they may influence the agent parameters optimized to produce embodied behaviors. + +For our first loss – the caption loss – captions arising as intra-agent speech samples were provided as targets for the agent's language output policy: + +$$ +L _ {C} = - \frac {1}{B} \sum_ {b = 1} ^ {B} \sum_ {t = 0} ^ {K} \ln \pi_ {l} \left(\mathbf {y} _ {b, t} ^ {c} \mid \mathbf {o} _ {b, \leq t}\right), \tag {5} +$$ + +where $\pi_{l}$ is the language action policy of the agent, $\mathbf{y}^{c}$ is the caption sample, $\mathbf{o}$ represents all visual and text observations, and $K$ represents the maximum unroll length. To allow the agent to distinguish whether it was being tasked with emitting a caption of its current observation, or whether it was being tasked with emitting language for the purposes of interactive behavior (see [22]), the input of the language policy is summed with a learnable embedding of the indicator variable representing whether the target is captioning or language output from demonstration. + +While the caption loss trains the agent to speak about what it sees, the agent's language encoding (via linguistic inputs) remains untrained. To this end we introduced a second loss: the caption-matching loss. In the caption-matching loss, the agent is required to predict whether a given caption, provided as input, matches the observed image. Negative samples (i.e., captions that do not match the observation) are captions associated with images from elsewhere in the batch [29]. To perform this prediction, an auxiliary classifier $D$ is attached to the network of the agent that encodes both visual and text observations in a separate training pass from the behavioral cloning optimization. + +$$ +L _ {C M} = - \frac {1}{B} \sum_ {b = 1} ^ {B} \sum_ {t = 0} ^ {K} \left[ \ln D \left(\mathbf {o} _ {b, t} ^ {X}, \mathbf {y} _ {b, t} ^ {c}\right) + \ln \left(1 - D \left(\mathbf {o} _ {b, t} ^ {X}, \mathbf {y} _ {\text {r o l l} (b), t} ^ {c}\right)\right) \right]. \tag {6} +$$ + +Here $\mathbf{o}^X$ represents the visual observation, and the caption sample is fed as a text observation. The roll() function rolls the index over batches, so that $y_{\mathrm{roll}(b)}^{c}$ represents a caption from another batch element as a negative example. The roll function was implemented as $\mathrm{roll}(b) = (b + 1) \mod B$ . + +And finally, the behavioral cloning loss over human language and movement action sequences is as described in Interactive Agents Team [22]: + +$$ +L _ {B C} = - \frac {1}{B} \sum_ {b = 1} ^ {B} \sum_ {t = 0} ^ {K} \left[ \ln \pi_ {l} \left(\mathbf {a} _ {b, t} ^ {l} \mid \mathbf {o} _ {b, \leq t}\right) + \ln \pi_ {m} \left(\mathbf {a} _ {b, t} ^ {m} \mid \mathbf {o} _ {b, \leq t}\right) \right], \tag {7} +$$ + +where the $\pi_{m}$ and $\mathbf{a}^m$ represents the movement policy and action, respectively. + +The total loss is the sum of these losses $L = L_{C} + L_{CM} + L_{BC}$ . Other than the addition of the caption loss and caption-matching loss, we follow Interactive Agents Team [22] for the agent architecture and training hyper-parameters. + +# 3 Experiments + +# 3.1 Semi-supervised captioning + +Hypothesis. We first sought to validate our method of semi-supervised learning. We hypothesized that with the additional unlabeled images, the semi-supervised model would be more data efficient (with respect to labelled data) than a supervised baseline. + +Data. As mentioned, the domain in which we tested our methods is called the Playhouse, which originated in Interactive Agents Team [22]. The authors compiled approximately three years worth of interaction data, comprising about 2 billion image frames. The authors have confirmed no personally identifiable information or offensive content is contained in the dataset and gave consent for us to access it. As there are no associated captions with any frames, we treat each frame in this dataset as a single image, and used all the data as our "unpaired" dataset. + +For the "paired" dataset, we engaged with crowd raters to provide corresponding captions for 78K uniformly sampled images from the unpaired dataset. Raters were instructed to describe what they saw in the image, with particular reference to a randomly selected object indicated in a bounding box. Detailed instructions are included in Appendix A.2. On average, each image contain 12.9 objects, and its corresponding caption describes 1.2 of them. + +Evaluation. We measured the log probability of captions in the validation set, CIDEr score [30], object precision and "color-object pair precision". As the images were generated from the Playhouse environment, we had access to the ground truth object identities and colors present in each image, allowing us to check if any object and its color mentioned in a caption were indeed present in the image. We calculated object precision to be the proportion of correct objects among all mentioned in sampled captions, normalized by the same calculation from human captions. The color-object pair precision is calculated in the same manner, except for any mentions of an object and its color. As there are usually many objects in an image and captions tend to mention just a few, the recall counterpart of this metric (number of correct color-object pairs divided by those present in the image) is not very informative. Captions were greedily sampled for the calculation of CIDEr score object precision and color-object pair precision. + +Results. Figure 3 shows sample data used to train the our models, as well as samples generated from the generative semi-supervised model. Models were able to both produce coherent and relevant captions given an image (e.g., "I can see a white bed where a green ball and a green duck are on it") and also generated realistic visual depictions of the Playhouse when conditioned on a language description. + +Both semi-supervised methods performed better than the supervised baseline across log prob, CIDER and color-object pair precision, including settings where we artificially constrained the size of the labeled dataset (Figure 4). Notably, when using the full amount of data our semi-supervised methods exceeded human color-object pair precision. To further put the performance gain in context, by leveraging the unpaired dataset of images the semi-supervised methods performed at a level equivalent to training a supervised model on $3 \times$ more labeled data [31]. + +Interestingly, the semi-supervised methods perform similarly in the object precision metric, despite an advantage in color-object pair precision. This result suggests that the semi-supervised methods may have learned to bind color to objects from the unlabelled images, and this results in a performance gain compared to pure supervised methods. + +# 3.2 Learning captions of new objects + +Hypothesis. Upon validating our methodology and amassing the relevant data, we were well-poised to ask the following questions: do semi-supervised methods of intra-agent speech allow a model to quickly learn to speak about a new object with little supervision? + +![](images/fb666299d1060ea593bc99e498db3d74a520e3f5c1b1ec012d1c3ff6167c3f88.jpg) +Figure 3: Data and Model Samples. Depicted are data used to train the semi-supervised model (left) and samples from the caption model (middle) and generative image model (right). As seen from the captions, generative modeling of images using a pre-trained language prior, in conjunction with auxiliary supervised training on a small number of labeled samples, is sufficient to produce meaningful and relevant language captions of images. Moreover, the model is able to generate realistic-looking scenes from provided captions. See Appendix A.3 for more samples. + +![](images/1c171fa54524b93d66950b9271e928862dee662469e0a43e798e16d07aae07e0.jpg) + +![](images/e7fa91ea3e63a98478556135f285113ab9c779058816389ed5a035fc01b784c2.jpg) + +![](images/62136276a548c0da403fd5c783ac3ec3b5ced3f95b9f46ce7209f73c9b49d4da.jpg) +Figure 4: Scaling performance of semi-supervised models over labeled dataset sizes. Semi-supervised methods are trained with unlabeled data and titered amounts of labeled image-caption pairs. Here we calculate the log probability of validation set captions, the CIDEr score [30], object precision and color-object pair precision. Object precision (human normalized) is calculated by dividing the probability of any mentioned object in the image with that of the human ground truth. Color object pair precision (human normalized) is calculated similarly, except for any mentions of an object with its color. Lines represent means from 3 random seeds. + +Data. To address the hypothesis, we first chose an object - a drum - and filtered our labeled caption data to remove all instances where the drum is either depicted visually or spoken about verbally. While not strictly necessary, from the unlabeled dataset we also removed all instances where the underlying (and unobserved) instruction included mention of a drum, which ensured that all instances of drum appearances were truly "passive". For example, the unlabeled data may have included trajectories of experience wherein a players was tasked with removing a ball from a shelf, but there might have also happened to be a drum in view in the room. + +Evaluation. We evaluated the model using three different metrics. We first created a validation dataset of all captions mentioning drum with their associated image, and evaluated the model's average log likelihood on this drum dataset (drum caption log likelihood). The drum recall, which is the probability that them model mentions a drum given that a drum is present, measures how the model recognizes drums in the images. We also calculate its counterpart, the probability that a drum is present given a drum is mentioned, as the drum precision, to measure the accuracy of any drum mentions from the model. The perfect scores for drum recall and drum precision are 1 as a result of titering the drum data: we have removed all the data where drum is in the image or caption, and added back a small amount where drum is mentioned in the caption. This has a consequence that for any image with drum (although very few), its caption will always mention drum. + +Results. We then performed the same experiment as in Section 3.1 at varying levels of re-introduced labeled drum data, as seen in Figure 4. As expected, the model's ability to speak about drums scales with the amount of labeled drum data with which it is trained. Notably, the model's recall reaches approximately $70\%$ given only 585 labeled samples of drums. In contrast, the supervised method, where the new drum data is trained in concatenation with the non-drum data, reaches just over $20\%$ . The increase of drum recall in the semi-supervised method is also accompanied with an increase of precision, where the semi-supervised method reaches $80\%$ , versus $40\%$ of the supervised method. These results indicate that the semi-supervised methods are able to learn about new objects, implicitly, by virtue of their language-conditioned reconstruction objective. That is, the mere presence of drums + +in the visual observations was sufficient, in conjunction with a small amount of labeled drum captions, to elicit linguistic understanding of drums as relevant objects in the Playhouse. + +![](images/cae842ed0f2b314862f173084f89940c09c6ebeab8a7f53ceeb83043b4364fdb.jpg) +Drum data size + +![](images/0c4260e2f6f3587bf23baca6c416ed41c564af62e36be202f55fba613b6fef6f.jpg) +Figure 5: Scaling performance of our semi-supervised methods over drum dataset sizes. We examined how the semi-supervised and supervised methods scaled across different amounts of labeled data for a novel object. The semi-supervised trained model had a higher log likelihood, was more likely to recognize a drum in the image (high true positive rate) while displaying a comparable error-rate (same false positive rate). Extrapolating from supervised true positive rate, the supervised method would need more than $300 \times$ more data to reach the same performance as the semi-supervised model. Lines represent means from 3 random seeds. + +![](images/23e9650e9b5e66174e2e6b90c31cfa89ee9548e91d932d380612d43dcb588ea5.jpg) + +# 3.3 Learning to manipulate a new object + +Hypothesis. As a final test we tackled the final question: Can the ability to quickly learn to speak about an object confer advantages for learning behaviors involving the new object (such as manipulating the object, or answering questions about it)? + +Methods and data. To answer this question we leveraged the semi-supervised models built in Section 3.2 to provide auxiliary intra-agent speech objectives. While we employed a two-stage process (learning to caption, and subsequently learning from those captions to shape behavior) for expedition and ease of experimental setup, in principle the two learning procedures could occur in parallel in a unified agent. The agent then proceeded with behavioral cloning-based training as in Interactive Agents Team [22] on data that was filtered to not include any drum-based instructions (resulting in 9,344 removed interactions). While after filter the dataset do not contain any demonstration of drum interaction, in some episodes the drum object is visible (larger than a pixel) in the background in $4.4\%$ of the image frames. + +Evaluation. We evaluated agent performance on two tasks: in the "lift drum" task, the agent receives the instruction "lift a drum", and is required to find the drum in a randomized Playhouse environment and lift it. In the "ask color drum" task, a single drum is spawned in the environment. The agent receives the instruction "what is the color of the drum?", and is then required to output language that answers the question (See Appendix A.4 for details). At the end of each episode, the task environment gives out a score of 0 or 1, indicating whether the task is completed successfully (note that these scores are used for evaluation purposes only, and not for training). We collected human performance on each of the tasks. Our participants receive an average of 0.98 for the "lift a drum" task, and 0.51 for the "ask color drum" task. The low score of "ask color drum" is primary due to the stringent reward function that require exact match of the canonical color name, and the fact that many colors are similar to the canonical name (for example, the canonical "cyan" color is can often referred as "light blue" by human participants). We calculate the final score by dividing the agent score by the average human score, so that a final score of 0 represents no success, and a 1 represents human-level performance. + +# Results. + +As seen in Figure 6, a baseline agent trained without any drum-based instructions performs poorly on drum-based evaluation tasks, indicating that there is minimal transfer to be had when learning from the base interaction dataset. On the other hand, a model trained with drum-based instructions (that is, one that trains on the 9,344 episodes that we had filtered) displays an expected upper bound for this agent of just over $75\%$ on "lifting drums", and just under $80\%$ for answering questions about a drum's color, similar to previously reported results [22]. + +Agents trained with both the caption loss and caption-matching loss, but without any drum-based interaction data achieve approximately $70\%$ of the performance attained by models trained directly on drum-based interaction data. To confirm the generalisability of our methods, we repeated our experiments on the teddy bear object, and observed similar results (Appendix A.5). + +This is a substantial increase over the baseline model, and directly indicates that learning to speak about an object, which is afforded by training a model on as few as 585 labeled examples using semi-supervised methods, allows an agent to subsequently exhibit behaviors that implicate the manipulation or mention of the object, without affecting performance on other known objects (Appendix A.5). + +We then tested whether we could reduce the number of labeled captions even further, and observed that with as few as 150 labeled captions we observed similar performance on drum-color question answering tasks, and only a slight decrease in drum lifting task performance. + +Figure 6: Zero-shot task-directed interaction with a novel object. We evaluated agent performance on two tasks that require interaction with the novel object (drum): in the first, the agent was tasked to locate and lift a drum, and in the second, the agent is required to mention the color of the drum using language. Our model with both the caption loss and caption matching loss (+CM) reaches more than 0.5 human normalized reward, comparable to approximately $70\%$ of the performance of an agent trained with an additional 9344 episodes of interaction data including drums (+D; left two panels). This result also suggests the crucial role of semi-supervised training in zero-shot generalization (right two panels): with just 150 labeled captions of drum (G150), our model only displays a slight decrease in performance, but still significantly outperforms the supervised model trained on all the labelled captions (S585). +![](images/e29d159e54d906e69c5113ebeb71cf7a994d9c9ea35840db32996b9bf0570ab4.jpg) +$\mathbf{B} =$ baseline without drum interaction, $+\mathbf{C} =$ caption loss, $+M =$ caption matching loss, +$\mathbf{G}_{\{150,585\}} =$ generative semi-supervised caption model with $\{150,585\}$ annotations of drum + +![](images/0f079756fe0de316645054a69f8854523cba195f8f7ffd59d0efb1b9d7b920fe.jpg) +$+\mathbf{D} =$ drum interaction data, $\mathbf{S}_{585} =$ supervised caption model with 585 annotations of drum, + +While we created two procedural tasks to quantitatively evaluate the agent, due to the diversity of the interaction data we used to train the agent, we hypothesized that the agent can perform more tasks with the novel object. Figure 7 summarizes a typical interactive session with our main agent ("+CM" from Figure 6), where the agent is asked to manipulate the novel object drum, and answer questions about it. The agent can recognize and manipulate the novel object under a variety of tasks. This further confirms that our method is general to many background tasks that the agent is able to perform. + +![](images/df6cd276decc416d220017106c4b9b9033381beeeadab333b7785c8661268ec5.jpg) +Figure 7: Sample frames from human-agent interaction. With our caption matching loss and caption loss, the agent trained without any drum-based instructions is able to manipulate the novel object drum and answer related questions under a variety of tasks. + +# 4 Related Work + +Components. The modeling in this study builds on components developed for generative modeling (VQVAE-2: [32]) and contrastive learning (CLIP: [20]). + +Task generalization in embodied agents. Our work is in the tradition of grounded language research in virtual environments [33-35]. Recently, there have been efforts to demonstrate zero-shot task acquisition using a variety of means including with the use of pretrained models for language encoders [36] or visual-language models for zero-shot navigation [37]. The majority of these works have focused on generalization to novel phrasings of task instructions [38, 39] with some recent studies exploring generalization to new tasks given background knowledge from previous tasks [22, 40]. Similar to phenomena of zero-shot generalization in supervised classification and object detection [20, 21, 41], these studies have often relied on a large, diverse dataset providing supervision – where held-out tasks represent a novel recombination of parts of the training dataset (e.g., “compositional” generalization or systematicity [42]). Another line of research has focused on few-shot generalization [43-46] through meta-learning over a distribution of tasks – with generalization to other tasks within the distribution’s support. Our work is complementary to both lines of work – and presents a means by which a different learning objective can embody “mental practice” enabling generalisation. + +Semi-supervised learning with natural language. The semi-supervised methods we used to train the intra-agent speech module are related to many previous methods that use language as a latent variable. For example, Kingma et al. [13] developed a semi-supervised, variational autoencoder (VAE) with discrete latent variables, and this work has also been extended to use language as the latent variable. VAEs with language latent variables have also been studied in language summarization [47], and in the context of multi-agent communication with natural language [48, 49]. Our work may present a valuable contribution to this area, showcasing the utility of modern generative and contrastive models in supporting data-efficient learning. Our work's analysis of the scaling curve [31] properties of semi-supervised captioning [50-52] may provide additional analytical tools for the field. + +Language-conditioned image generation. The use of language to create sophisticated, controllable generative models has seen rapid development in recent years. Recent works based on diffusion models [53-55] and autoregressive models have produced some of the most impressive results. Notable work includes the DALL-E family of models [56, 57] and GLIDE [58]. Other work in the area has also employed VAEs [59] and GANs [60-64]. + +# 5 Conclusions and Future Work + +In this work we built a model for intra-agent speech by leveraging semi-supervised learning techniques. We have first shown that the semi-supervised methods outperforms the supervised model in captioning by leveraging unlabeled images. We further demonstrated that with 150 captions of a novel object, such models can help embodied agents execute interactive tasks with the novel object without having to learn from direct interactive experience (zero-shot), reaching $70\%$ performance of a baseline agent trained with 9,000 interaction episodes. + +Although we developed the method in a virtual environment, it can be easily generalized to real world applications, applied with either good or bad intent. Embodied language agents acting as robots could be instructed to perform a wide manner of tasks, including harmful ones. Thus, if this work is to be applied in real settings, we advise extra caution to minimize unintended or harmful consequences. + +This work is a first step into leveraging ideas from the psychology of inner and private speech in humans. While our source of speech was captioning, humans have a richer repertoire of techniques for intra-personal dialogue that affect modalities beyond vision. Direct next steps are, therefore, to explore a possible role of intra-agent speech in abstracting over time, and observing its effects on planning and reasoning. + +# Acknowledgments and Disclosure of Funding + +The authors would like to thank Felix Hill for critical discussion, Nathaniel Wong for help with the development of scripted probe tasks, Chris Dyer and Daan Wierstra for reviewing and comments on the manuscript, and Alex Goldin and Guy Scully for organizational support. + +# References + +[1] Lev S Vygotsky. Thought and language. MIT press, 1934. +[2] Adam Ed Winsler, Charles Ed Fernyhough, and Ignacio Ed Montero. Private speech, executive functioning, and the development of verbal self-regulation. Cambridge University Press, 2009. +[3] Patti Adank, Peter Hagoort, and Harold Bekkering. Imitation improves language comprehension. Psychological Science, 21(12):1903-1909, 2010. +[4] Conchi San Martín Martínez, Humbert Boada i Calbet, and Peter Feigenbaum. Private and inner speech and the regulation of social speech communication. Cognitive Development, 26(3): 214-229, 2011. +[5] Alan D Baddeley, Susan E Gathercole, and Costanza Papagno. The phonological loop as a language learning device. Exploring Working Memory, pages 164-198, 2017. +[6] Adam Winsler, Rafael M Diaz, and Ignacio Montero. The role of private speech in the transition from collaborative to independent task performance in young children. Early Childhood Research Quarterly, 12(1):59-79, 1997. +[7] Ben Alderson-Day and Charles Fernyhough. Inner speech: development, cognitive functions, phenomenology, and neurobiology. *Psychological bulletin*, 141(5):931, 2015. +[8] Alan D Baddeley. Short-term memory for word sequences as a function of acoustic, semantic and formal similarity. Quarterly journal of experimental psychology, 18(4):362-365, 1966. +[9] Diane J Schiano and Michael J Watkins. Speech-like coding of pictures in short-term memory. Memory & Cognition, 9(1):110-114, 1981. +[10] Antonis Hatzigeorgiadis, Nikos Zourbanos, Evangelos Galanis, and Yiannis Theodorakis. Self-talk and sports performance: A meta-analysis. Perspectives on Psychological Science, 6(4): 348-356, 2011. +[11] Virginia S Tinsley and Harriet Salatas Waters. The development of verbal control over motor behavior: A replication and extension of luria's findings. Child Development, pages 746-753, 1982. +[12] Charles Fernyhough and Emma Fridley. Private speech on an executive task: Relations with task difficulty and task performance. Cognitive development, 20(1):103-120, 2005. +[13] Durk P Kingma, Shakir Mohamed, Danilo Jimenez Rezende, and Max Welling. Semi-supervised learning with deep generative models. Advances in neural information processing systems, 27, 2014. +[14] John Schulman, Xi Chen, and Pieter Abbeel. Equivalence between policy gradients and soft q-learning. arXiv preprint arXiv:1704.06440, 2017. +[15] Sergey Levine. Reinforcement learning and control as probabilistic inference: Tutorial and review. arXiv preprint arXiv:1805.00909, 2018. +[16] H Francis Song, Abbas Abdelmaleki, Jost Tobias Springenberg, Aidan Clark, Hubert Soyer, Jack W Rae, Seb Noury, Arun Ahuja, Siqi Liu, Dhruva Tirumala, et al. V-mpo: On-policy maximum a posteriori policy optimization for discrete and continuous control. arXiv preprint arXiv:1909.12238, 2019. +[17] Aaron Van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv e-prints, pages arXiv-1807, 2018. +[18] Aapo Hyvarinen and Hiroshi Morioka. Unsupervised feature extraction by time-contrastive learning and nonlinearica. Advances in Neural Information Processing Systems, 29, 2016. +[19] Chris Dyer. Notes on noise contrastive estimation and negative sampling. arXiv preprint arXiv:1410.8251, 2014. + +[20] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International Conference on Machine Learning, pages 8748-8763. PMLR, 2021. +[21] Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc Le, Yun-Hsuan Sung, Zhen Li, and Tom Duerig. Scaling up visual and vision-language representation learning with noisy text supervision. In International Conference on Machine Learning, pages 4904-4916. PMLR, 2021. +[22] DeepMind Interactive Agents Team. Creating multimodal interactive agents with imitation and self-supervised learning. arXiv preprint arXiv:2112.03763, 2021. +[23] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017. +[24] Taku Kudo and John Richardson. Sentencepiece: A simple and language independent subword tokenizer and tokenizer for neural text processing. arXiv preprint arXiv:1808.06226, 2018. +[25] Jack W Rae, Sebastian Borgeaud, Trevor Cai, Katie Millican, Jordan Hoffmann, Francis Song, John Aslanides, Sarah Henderson, Roman Ring, Susannah Young, et al. Scaling language models: Methods, analysis & insights from training gopher. arXiv preprint arXiv:2112.11446, 2021. +[26] Aaron Van Den Oord, Oriol Vinyals, et al. Neural discrete representation learning. Advances in neural information processing systems, 30, 2017. +[27] Zijun Zhang. Improved adam optimizer for deep neural networks. In 2018 IEEE/ACM 26th International Symposium on Quality of Service (IWQoS), pages 1-2. IEEE, 2018. +[28] Google Cloud. Cloud tensor processing units (tpus), 2022. https://cloud.google.com/tpu/docs,tpus [Accessed: 2022-05-19]. +[29] Jean-Baptiste Alayrac, Adria Recasens, Rosalia Schneider, Relja Arandjelovic, Jason Ramapuram, Jeffrey De Fauw, Lucas Smaira, Sander Dieleman, and Andrew Zisserman. Self-supervised multimodal versatile networks. Advances in Neural Information Processing Systems, 33:25-37, 2020. +[30] Ramakrishna Vedantam, C Lawrence Zitnick, and Devi Parikh. Cider: Consensus-based image description evaluation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 4566-4575, 2015. +[31] Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020. +[32] Ali Razavi, Aaron Van den Oord, and Oriol Vinyals. Generating diverse high-fidelity images with vq-vae-2. Advances in neural information processing systems, 32, 2019. +[33] Karl Moritz Hermann, Felix Hill, Simon Green, Fumin Wang, Ryan Faulkner, Hubert Soyer, David Szepesvari, Wojciech Marian Czarnecki, Max Jaderberg, Denis Teplyashin, et al. Grounded language learning in a simulated 3d world. arXiv preprint arXiv:1706.06551, 2017. +[34] Maxime Chevalier-Boisvert, Dzmitry Bahdanau, Salem Lahlou, Lucas Willems, Chitwan Saharia, Thien Huu Nguyen, and Yoshua Bengio. Babyai: A platform to study the sample efficiency of grounded language learning. arXiv preprint arXiv:1810.08272, 2018. +[35] Corey Lynch, Mohi Khansari, Ted Xiao, Vikash Kumar, Jonathan Tompson, Sergey Levine, and Pierre Sermanet. Learning latent plans from play. In Conference on robot learning, pages 1113-1132. PMLR, 2020. +[36] Felix Hill, Sona Mokra, Nathaniel Wong, and Tim Harley. Human instruction-following with deep reinforcement learning via transfer-learning from text. arXiv preprint arXiv:2005.09382, 2020. + +[37] Ziad Al-Halah, Santhosh K Ramakrishnan, and Kristen Grauman. Zero experience required: Plug & play modular transfer learning for semantic visual navigation. arXiv preprint arXiv:2202.02440, 2022. +[38] Suraj Nair, Eric Mitchell, Kevin Chen, Silvio Savarese, Chelsea Finn, et al. Learning language-conditioned robot behavior from offline data and crowd-sourced annotation. In Conference on Robot Learning, pages 1303-1315. PMLR, 2022. +[39] Corey Lynch and Pierre Sermanet. Language conditioned imitation learning over unstructured data. arXiv preprint arXiv:2005.07648, 2020. +[40] Eric Jang, Alex Irpan, Mohi Khansari, Daniel Kappler, Frederik Ebert, Corey Lynch, Sergey Levine, and Chelsea Finn. Bc-z: Zero-shot task generalization with robotic imitation learning. In Conference on Robot Learning, pages 991-1002. PMLR, 2022. +[41] Hieu Pham, Zihang Dai, Golnaz Ghiasi, Hanxiao Liu, Adams Wei Yu, Minh-Thang Luong, Mingxing Tan, and Quoc V Le. Combined scaling for zero-shot transfer learning. arXiv preprint arXiv:2111.10050, 2021. +[42] Laura Ruis, Jacob Andreas, Marco Baroni, Diane Bouchacourt, and Brenden M Lake. A benchmark for systematic generalization in grounded language understanding. Advances in neural information processing systems, 33:19861-19872, 2020. +[43] Chelsea Finn, Tianhe Yu, Tianhao Zhang, Pieter Abbeel, and Sergey Levine. One-shot visual imitation learning via meta-learning. In Conference on robot learning, pages 357-368. PMLR, 2017. +[44] Yan Duan, Marcin Andrychowicz, Bradly Stadie, OpenAI Jonathan Ho, Jonas Schneider, Ilya Sutskever, Pieter Abbeel, and Wojciech Zaremba. One-shot imitation learning. Advances in neural information processing systems, 30, 2017. +[45] Allan Zhou, Eric Jang, Daniel Kappler, Alex Herzog, Mohi Khansari, Paul Wohlhart, Yunfei Bai, Mrinal Kalakrishnan, Sergey Levine, and Chelsea Finn. Watch, try, learn: Meta-learning from demonstrations and reward. arXiv preprint arXiv:1906.03352, 2019. +[46] Kourosh Hakhamaneshi, Ruihan Zhao, Albert Zhan, Pieter Abbeel, and Michael Laskin. Hierarchical few-shot imitation with skill transition models. arXiv preprint arXiv:2107.08981, 2021. +[47] Yishu Miao and Phil Blunsom. Language as a latent variable: Discrete generative models for sentence compression. arXiv preprint arXiv:1609.07317, 2016. +[48] Jason Lee, Kyunghyun Cho, and Douwe Kiela. Countering language drift via visual grounding. arXiv preprint arXiv:1909.04499, 2019. +[49] Angeliki Lazaridou, Anna Potapenko, and Olivier Tieleman. Multi-agent communication meets natural language: Synergies between functional and structural language learning. arXiv preprint arXiv:2005.07064, 2020. +[50] Wenhu Chen, Aurelien Lucchi, and Thomas Hofmann. A semi-supervised framework for image captioning. arXiv preprint arXiv:1611.05321, 2016. +[51] Bicheng Xu, Weirui Kong, and Jiaxuan Chen. Semi-supervised image captioning via reconstruction. In Proceedings of the Intern. Conf. on Comp. Vis.(ICCV), pages 4135-4144, 2017. +[52] Dong-Jin Kim, Jinsoo Choi, Tae-Hyun Oh, and In So Kweon. Image captioning with very scarce supervised data: Adversarial semi-supervised learning approach. arXiv preprint arXiv:1909.02201, 2019. +[53] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 33:6840-6851, 2020. +[54] Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In International Conference on Machine Learning, pages 2256-2265. PMLR, 2015. + +[55] Yang Song and Stefano Ermon. Improved techniques for training score-based generative models. Advances in neural information processing systems, 33:12438-12448, 2020. +[56] Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. In International Conference on Machine Learning, pages 8821-8831. PMLR, 2021. +[57] Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022. +[58] Alex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew, Ilya Sutskever, and Mark Chen. Glide: Towards photorealistic image generation and editing with text-guided diffusion models. arXiv preprint arXiv:2112.10741, 2021. +[59] Tiago Ramalho, Tomáš Kočisky, Frederic Besse, SM Eslami, Gábor Melis, Fabio Viola, Phil Blunsom, and Karl Moritz Hermann. Encoding spatial relations from natural language. arXiv preprint arXiv:1807.01670, 2018. +[60] Scott Reed, Zeynep Akata, Xinchen Yan, Lajanugen Logeswaran, Bernt Schiele, and Honglak Lee. Generative adversarial text to image synthesis. In International conference on machine learning, pages 1060-1069. PMLR, 2016. +[61] Tao Xu, Pengchuan Zhang, Qiuyuan Huang, Han Zhang, Zhe Gan, Xiaolei Huang, and Xiaodong He. Atngan: Fine-grained text to image generation with attentional generative adversarial networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1316-1324, 2018. +[62] Minfeng Zhu, Pingbo Pan, Wei Chen, and Yi Yang. Dm-gan: Dynamic memory generative adversarial networks for text-to-image synthesis. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 5802-5810, 2019. +[63] Han Zhang, Jing Yu Koh, Jason Baldridge, Honglak Lee, and Yinfei Yang. Cross-modal contrastive learning for text-to-image generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 833-842, 2021. +[64] Hui Ye, Xiulong Yang, Martin Takac, Rajshekhar Sunderraman, and Shihao Ji. Improving text-to-image synthesis using contrastive learning. arXiv preprint arXiv:2107.02423, 2021. + +# Checklist + +The checklist follows the references. Please read the checklist guidelines carefully for information on how to answer these questions. For each question, change the default [TODO] to [Yes], [No], or [N/A]. You are strongly encouraged to include a justification to your answer, either by referencing the appropriate section of your paper or providing a brief inline description. For example: + +- Did you include the license to the code and datasets? [Yes] See Section?. +- Did you include the license to the code and datasets? [No] The code and the data are proprietary. +- Did you include the license to the code and datasets? [N/A] + +Please do not modify the questions and only use the provided macros for your answers. Note that the Checklist section does not count towards the page limit. In your paper, please delete this instructions block and only keep the Checklist section heading above along with the questions/answers below. + +# 1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] See Section 5. +(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Section 5. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +# 2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] +(b) Did you include complete proofs of all theoretical results? [Yes] + +# 3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [No] The code and the data are proprietary. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] See Figure 4, 5 and 6. +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Section 3.1. We trained our models using Tensor Processing Units (TPUv3), in all experiments the early stopping criteria is reached within $150K$ optimization steps. + +# 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] We have cited Interactive Agents Team [22]. +(b) Did you mention the license of the assets? [N/A] The assets are proprietary. +(c) Did you include any new assets either in the supplemental material or as a URL? [N/A] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [Yes] Consent for using the data was obtained from Interactive Agents Team [22] under proprietary contract. See Section 3.1. +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [Yes] See Section 3.1. Interactive Agents Team [22] has confirmed no personal identifiable information or harmful content is contained in the dataset. + +# 5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [Yes] See Appendix A.2. +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [Yes] The full details of our study design were reviewed by our institution's independent ethical review committee. See Appendix A.2. +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [No] The compensation rates were reviewed by our institution's independent ethical review committee as part of the study design. See Appendix A.2. \ No newline at end of file diff --git a/intraagentspeechpermitszeroshottaskacquisition/images.zip b/intraagentspeechpermitszeroshottaskacquisition/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..2419b4fbc5d7d7ae78dd1f483ded9c6aa9480fde --- /dev/null +++ b/intraagentspeechpermitszeroshottaskacquisition/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:22f878763a43cef2c6a1480756a607fc182d48062a96dd6fcc7aaa4e4fcce39f +size 332120 diff --git a/intraagentspeechpermitszeroshottaskacquisition/layout.json b/intraagentspeechpermitszeroshottaskacquisition/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..7640bff978d4c7e8b3d7d4f29ad7e1035e09adaa --- /dev/null +++ b/intraagentspeechpermitszeroshottaskacquisition/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9d4f10b0dc72935ebad67541400f260d29ce2f765ee095e7eaf211f47b6e5341 +size 466025 diff --git a/intrinsicdimensionalityestimationusingnormalizingflows/2ba3a097-c389-46cd-a00e-e163c83233b1_content_list.json b/intrinsicdimensionalityestimationusingnormalizingflows/2ba3a097-c389-46cd-a00e-e163c83233b1_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..149eee5c70baa5192e76ff2e4fae432211e86b04 --- /dev/null +++ b/intrinsicdimensionalityestimationusingnormalizingflows/2ba3a097-c389-46cd-a00e-e163c83233b1_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1807a8b7174a383c349e0b5f37b6320d9b642a56065ec2da548ac43e5c577055 +size 75802 diff --git a/intrinsicdimensionalityestimationusingnormalizingflows/2ba3a097-c389-46cd-a00e-e163c83233b1_model.json b/intrinsicdimensionalityestimationusingnormalizingflows/2ba3a097-c389-46cd-a00e-e163c83233b1_model.json new file mode 100644 index 0000000000000000000000000000000000000000..707c232e3f326fa7b990765b7dbc30f0493bba6d --- /dev/null +++ b/intrinsicdimensionalityestimationusingnormalizingflows/2ba3a097-c389-46cd-a00e-e163c83233b1_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3e47dfdf6472d2067e7459cdc59f58d30ce6465375177dcb6a04b1c1ab3777e +size 95008 diff --git a/intrinsicdimensionalityestimationusingnormalizingflows/2ba3a097-c389-46cd-a00e-e163c83233b1_origin.pdf b/intrinsicdimensionalityestimationusingnormalizingflows/2ba3a097-c389-46cd-a00e-e163c83233b1_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..52636f2df32c6346db434b97c9f634b6f5e0a446 --- /dev/null +++ b/intrinsicdimensionalityestimationusingnormalizingflows/2ba3a097-c389-46cd-a00e-e163c83233b1_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:65a44b8c2fd509af6d12272941ef2628229558be2255518785080ac4d15c130a +size 649484 diff --git a/intrinsicdimensionalityestimationusingnormalizingflows/full.md b/intrinsicdimensionalityestimationusingnormalizingflows/full.md new file mode 100644 index 0000000000000000000000000000000000000000..641fd24843e9d5539cc6582be6840474f177305e --- /dev/null +++ b/intrinsicdimensionalityestimationusingnormalizingflows/full.md @@ -0,0 +1,327 @@ +# Estimating the intrinsic dimensionality using Normalizing Flows + +Christian Horvat + +Department of Physiology + +University of Bern + +christian.horvat@unibe.ch + +Jean-Pascal Pfister + +Department of Physiology + +Bern, Switzerland + +jeanpascal.pfister@unibe.ch + +# Abstract + +How many degrees of freedom are there in a dataset consisting of $M$ samples embedded in $\mathbb{R}^D$ ? This number, formally known as intrinsic dimensionality, can be estimated using nearest neighbor statistics. However, nearest neighbor statistics do not scale to large datasets as their complexity scales quadratically in $M$ , $\mathcal{O}(M^2)$ . Additionally, methods based on nearest neighbor statistics perform poorly on datasets embedded in high dimensions where $D \gg 1$ . In this paper, we propose a novel method to estimate the intrinsic dimensionality using Normalizing Flows that scale to large datasets and high dimensions. The method is based on some simple back-of-the-envelope calculations predicting how the singular values of the flow's Jacobian change when inflating the dataset with different noise magnitudes. Singular values associated with directions normal to the manifold evolve differently than singular values associated with directions tangent to the manifold. We test our method on various datasets, including 64x64 RGB images, where we achieve state-of-the-art results. + +# 1 Introduction + +Learning low-dimensional representations of high-dimensional data is becoming increasingly important in the era of big data. Therefore, representation learning is a very active area of research [33] with a wide range of applications ranging from neuroscience [27], molecular biology [28], bioinformatics [12] or image analysis [21]. But how many low-dimensional variables are exactly needed to accurately describe the original data? Unfortunately, this number is typically not known and needs to be estimated - a task formally known as intrinsic dimensionality (ID) estimation. + +Moreover, estimating the ID turned out to be an useful tool for understanding the functioning of Neural Networks and generative models [23, 11, 1, 31]. In a recent study, [29] verified that the ID plays a large role in deep learning on natural images and hence motivated the necessity to better estimate the ID in this setting. In the context of generative models, the ID corresponds to the number of latent variables generating the data. Some of these generative models do even rely on knowing the exact number of latent variables generating the data which limits their applicability to real-world problems where this number is unknown [3, 16]. + +ID estimation is mathematically challenging. Most approaches rely on the assumption that, locally, the samples are uniformly distributed, and therefore the ID can be estimated using nearest neighbor statistics [4]. However, such nearest neighbor methods do not scale to large datasets consisting of $M \gg 1$ samples as the complexity scales with $\mathcal{O}(DM^2)$ where $D$ is the dimensionality of the embedding space and accounts for calculating the (Euclidean) distance $^1$ . Thus, this scaling issue is amplified whenever the embedding space $D$ is of the order of the sample size $M$ , $D = \mathcal{O}(M)$ . + +Additionally, nearest neighbor methods suffer from the curse of dimensionality in the sense that they perform badly in high dimensions $D \gg 1$ [5, 4, 32]. In this paper, we propose to overcome these scalability issues by estimating the ID using standard NFs which do scale to large datasets and dimensions. + +Our high-level idea is very simple and based on some back-of-the-envelope calculations which predict how the flow's eigenvalues change depending on the amount of noise injected into the data prior to training. For directions of small variability (i.e. off-manifold directions), the corresponding eigenvalues should decrease at a rate predicted by our theory. However, for directions of great variability (i.e. manifold directions), the corresponding eigenvalues will behave differently which allows us to estimate $d$ . We show the soundness of our approach on various datasets, including RGB images of resolution $64 \times 64$ . + +# 2 Problem statement, background and notations + +Here we briefly discuss the problem of estimating the ID, introduce the concept of an NF and additional notations which will be used throughout the paper. + +Estimating ID: An $d$ -dimensional manifold $\mathcal{M}$ is a set of points that are locally diffeomorphic to subsets of $\mathbb{R}^d$ , see e.g. [22] for a formal definition of manifolds. Given $M$ samples $x_1, \ldots, x_M$ from such a $d$ -dimensional manifold embedded in $\mathbb{R}^D$ , $d < D$ , the task is to estimate $d$ . More generally, if the dataset is living on unions of manifolds with different IDs, the task is to estimate $d$ locally for a given point $x^*$ . For real-world datasets, however, samples are corrupted by noise making the dataset full-dimensional, i.e. $d = D$ . In this case, estimating the ID corresponds to estimating how many main degrees of freedom there are in the observed dataset. We refer to those degrees of freedom to directions of large variability in the following. + +Standard Normalizing Flows: In the simplest case, an NF $f_{\theta}$ is a change of variable transforming a sample from the unknown distribution $p(x)$ to a sample from a standard Normal $\mathcal{N}(0, I_D)$ . If $\mathcal{M}$ is full-dimensional, i.e. $d = D$ , then the resulting density is given by $p_{\theta}(x) = |\det J_{f_{\theta}^{-1}}(u)|^{-1}\mathcal{N}(u; 0, I_D)$ where $u = f_{\theta}^{-1}(x)$ , and the parameters $\theta$ are updated to minimize + +$$ +D _ {K L} (p (x) | | p _ {\theta} (x)) = - \mathbb {E} _ {x \sim p (x)} [ \log p _ {\theta} (x) ] + c o n s t. \tag {1} +$$ + +For the general case where $d < D$ , the general change of variable formula needs to be considered, see e.g. [17, 8, 10, 3]. From now on we omit the NF's dependence on the parameter $\theta$ and write $f$ instead of $f_{\theta}$ . + +Notations: We denote the data density with support on $\mathcal{M}$ as $p(x)$ . Given a sample $x\sim p(x)$ , if we add some Gaussian noise $\varepsilon$ to it, the resulting random variable $\tilde{x} = x + \varepsilon$ has the following density + +$$ +q _ {\sigma^ {2}} (\tilde {x}) = \int_ {\mathcal {M}} \mathcal {N} (\tilde {x}; x, \sigma^ {2} I _ {D}) p (x) d x \tag {2} +$$ + +where $I_D$ is the $D \times D$ unit matrix. + +The Jacobian of a flow $f: \mathbb{R}^D \to \mathbb{R}^D$ has $D$ eigenvalues and singular values, which we both denote by $\lambda^{(1)}, \ldots, \lambda^{(D)}$ . + +# 3 Related work + +Estimating the ID is a well-studied problem with a vast literature, see [5, 4] for exhaustive overviews. + +Nearest Neighbor methods: Historically, two main branches have developed: global and local methods [4]. Global methods estimate the dimensionality of the dataset globally with methods based on PCA is the most famous representative of this class, while local methods do estimate it locally. Consistent local estimators are based on nearest neighbor statistics. Intuitively, the volume of a $d$ -dimensional ball scales as $r^d$ with its radius $r$ , and, therefore, the number of nearest neighbors within the $r$ -ball of a point should scale similarly. This intuition was formalized by [13] and generalized in [14]. Recently, [9] derived the distribution of the distance to the second nearest neighbor - a power law with the ID as the exponent. We choose this method, coined twoNN, as a + +representative for nearest neighbor methods and compare its performance with our method in Section 5. + +Methods based on NN: Neural Networks (NN) scale to large datasets. Surprisingly, to the best of our knowledge, next to our method, there exists only one method which attempts to directly estimate the ID using an NN based method [32], coined LIDL (see below for a detailed description). However, there exist different indirect methods which use performance metrics to estimate the ID. The general idea is to train different models with different latent dimensionalities and compare their performance on a chosen metric, see e.g. [2, 34, 3]. Arguably, the model yielding the best result on this metric corresponds to the right latent dimensionality. However, the estimate will be relative to the chosen performance metric and therefore might not reflect the true ID. As an example of this relativity, we refer to Figure 14 in [3] which use their NF-based method to estimate the ID of the CelebA dataset [24]. They get different results when using the FID-score [15] or reconstruction error as performance metric. In [30], it was argued that the Jacobian of the encoder $f:\mathbb{R}^D\to \mathbb{R}^d$ of an Autoencoder can give information of directions of contraction. Intuitively, manifold directions correspond to directions of low contraction while off-manifold directions correspond to directions of high contraction. The gist of this idea is very similar to our intuition which we will present Section 4 as directions of contraction can be directly related to the singular values of the encoder's Jacobian. However, the number of contractive directions will only give a lower bound on the ID. + +LIDL: [32] propose to use NFs to estimate the ID. LIDL stands for locally intrinsic dimensionality likelihood and is based on the assumption that the inflated log-likelihood $\log q_{\sigma^2}(x)$ scales linearly in $\sigma^2$ with the normal space dimension as slope. More precisely, they argue that the inflated distribution $q_{\sigma^2}(x)$ can be written as the product of $p(x)$ and the noise distribution restricted on the normal space, i.e. $q_{\sigma^2}(x) = p(x)\mathcal{N}(x;x,I_{D - d})$ where $\mathcal{N}(x;x,I_{D - d})$ is a $(D - d)$ -dimensional Gaussian in the normal space of $x$ . This intuition is mathematically confirmed in [17] under certain conditions on the manifold and generating latent distribution. Thus, [32] estimate the rate at which the log-likelihoods change depending on the noise magnitude $\sigma^2$ , and therefore train different models with different noise magnitudes $\bar{\sigma}_1^2 < \dots < \bar{\sigma}_N^2$ to estimate that change. + +LIDL heavily relies on the assumption that $q_{\sigma^2}(x) = p(x)\mathcal{N}(x;x,I_{D - d})$ , which is generally only true for sufficiently smooth manifolds and latent distributions, see [17] for details. Even if these conditions are fulfilled, the outcome of LIDL depends on the noise magnitudes $\bar{\sigma}_1^2 < \dots < \bar{\sigma}_N^2$ used to estimate the log-likelihood rate. However, the optimal range again depends on both the manifold and generating latent distribution which is hard to estimate a priori [17]. We will revisit these issues in the experiments, Section 5. + +# 4 Method + +How can we estimate the intrinsic dimensionality of data sampled from a manifold using an NF? + +Simplest scenario: Assume the simple case where the target distribution $p(x)$ is a normal distribution, i.e. $p(x) = \mathcal{N}(\mu, \Sigma)$ with $\mu \in \mathbb{R}^D$ and + +$$ +\Sigma = \operatorname {d i a g} \left(\sigma_ {1} ^ {2}, \dots , \sigma_ {D} ^ {2}\right), \quad \sigma_ {i} ^ {2} > 0. \tag {3} +$$ + +Thus, we assume that the data manifold is given by the entire embedding space, $\mathcal{M} = \mathbb{R}^D$ . Note, however, that if $\sigma_i^2 \to 0$ , $i = 1, \dots, D - d$ , this corresponds to samples from a $d$ -dimensional manifold embedded in $\mathbb{R}^D$ . Then, the true NF $f$ transforming $x \sim \mathcal{N}(\mu, \Sigma)$ into $u = f^{-1}(x)$ distributed according to $\mathcal{N}(0, I_D)$ is given by $f_i^{-1}(x) = (x_i - \mu_i) / \sigma_i$ , $i = 1, \dots, D$ , with Jacobian + +$$ +J _ {f ^ {- 1}} (x) = \operatorname {d i a g} \left(\frac {1}{\sigma_ {1}}, \dots , \frac {1}{\sigma_ {D}}\right). \tag {4} +$$ + +Therefore, an eigenvector of $J_{f^{-1}}(x)$ corresponding to a large eigenvalue $\lambda^{(i)}$ (i.e. small $\sigma_i$ ) is in direction of small variability in the data. It is easy to see that the same holds for more general covariance matrices $\Sigma$ . The true NF $f$ transforming $x \sim \mathcal{N}(\mu, \Sigma)$ into $u = f^{-1}(x)$ distributed according to $\mathcal{N}(0, I_D)$ is given by + +$$ +f ^ {- 1} (x) = \Sigma^ {- \frac {1}{2}} (x - \mu) \tag {5} +$$ + +with Jacobian + +$$ +J _ {f ^ {- 1}} (x) = \Sigma^ {- \frac {1}{2}} = S ^ {T} D ^ {- \frac {1}{2}} S \tag {6} +$$ + +where $\Sigma = S^T DS$ , $D = \mathrm{diag}(\sigma_1^2, \ldots, \sigma_D^2)$ and $S$ is orthonormal and consists of the eigenvectors of $\Sigma$ . Thus, the eigenvalues of $J_{f^{-1}}(x)$ are given by $\frac{1}{\sigma_1}, \ldots, \frac{1}{\sigma_D}$ as for the simplest scenario. + +From simple to the generic scenario: In general, the NF $f^{-1}$ non-linearly transforms a sample $x \sim p(x)$ such that $u = f^{-1}(x)$ is distributed according to $\mathcal{N}(0, I_D)$ . Hence, Equation (5) does not hold anymore. However, Equation (5) is a good first-order approximation as locally the flow acts linearly, + +$$ +f ^ {- 1} (x) \approx f ^ {- 1} \left(x ^ {*}\right) + J _ {f ^ {- 1}} \left(x ^ {*}\right) \left(x - x ^ {*}\right). \tag {7} +$$ + +What follows is that a flow $f^{-1}$ not only transforms globally samples from $p(x)$ to samples from a Gaussian, but also locally. This was already observed in [7] (Lemma 1) for $f$ , i.e. for the direction from latent to data space. The same holds true for $f^{-1}$ which immediately follows from the delta method [26]. + +Lemma 1 Let $x^{*}$ be a sample from $p(x)$ , and let $f^{-1}$ be the flow such that $z^{*} \sim \mathcal{N}(0, I_{D})$ . where $z^{*} = f^{-1}(x^{*})$ . Let $\varepsilon \sim \mathcal{N}(0, I_{D})$ and $s > 0$ be a scalar. Consider samples generated by $\tilde{z} = f^{-1}(x^{*} + s\varepsilon)$ . Then, for $s \to 0$ we have that $\frac{1}{s} (\tilde{z} - z^{*}) \longrightarrow \mathcal{N}(0, J_{f^{-1}}(x^{*})^{T} J_{f^{-1}}(x^{*}))$ where the convergence is in distribution. + +Lemma 1 states that a small ball around $x^{*}$ will be mapped into an ellipsoid where the principal axes of the ellipsoid are given by the eigenvectors of the Gram matrix $J_{f^{-1}}(x^{*})^{T}J_{f^{-1}}(x^{*})$ . Those eigenvectors are the singular directions of $J_{f^{-1}}(x^{*})$ and correspond to direction of small and large variability if the corresponding singular value is small or large, respectively. For $J_{f^{-1}}(x^{*})$ symmetric, the singular and eigenvalues coincide3. + +Thus, the flow of arguments from the simplest scenario takes on and we observe: + +Observation 1: Large singular values of the NF's Jacobian evaluated at $x$ correspond to directions of small variability in the data. Directions of large variability, however, correspond to small singular values. + +How can we make use of this observation to estimate the ID of a data manifold? When training an NF on clean manifold data (i.e. samples from a manifold without intrinsic noise), Observation 1 predicts a clear change in magnitude between singular values corresponding to off-manifold and on-manifold directions $^4$ . Indeed, we can observe such a change in magnitude in various toy examples, see Section 4.1. However, to estimate $d$ based on this observation only would require setting an arbitrary threshold on the magnitude of those singular values. On the other hand, in a more realistic scenario, real world data have some intrinsic noise. + +Data with intrinsic noise: With the same setting as in the simplest scenario, we now additionally assume that the intrinsic noise is coming from a standard Gaussian with magnitude $\sigma_0$ , i.e. $p(x) \sim \mathcal{N}(\mu, \Sigma + \sigma_0^2 I)$ . Then, Equation (4) turns into + +$$ +J _ {f ^ {- 1}} (x) = \operatorname {d i a g} \left(\frac {1}{\sqrt {\sigma_ {0} ^ {2} + \sigma_ {1} ^ {2}}}, \dots , \frac {1}{\sqrt {\sigma_ {0} ^ {2} + \sigma_ {D} ^ {2}}}\right). \tag {8} +$$ + +Now, what happens if we inflate the data-manifold with Gaussian noise of variance $\sigma^2$ ? For directions of small variability in the data, $\sigma_i^2$ is small. Thus, only if $\sigma^2$ exceeds the intrinsic noise magnitude $\sigma_0^2$ , we expect to see a change in $\lambda^{(i)}$ . For directions of large variability, however, we expect to see a change in $\lambda^{(j)}$ only if $\sigma^2$ is greater than $\sigma_0^2 + \sigma_j^2$ as in this case $\sigma_j^2$ is not small. To account for the more general case where the intrinsic noise is not isotropic, we denote the intrinsic noise in the direction of the singular vector corresponding to singular value $\lambda^{(i)}$ as $\sigma_0^2(i)$ in the following. + +**Observation 2:** If we were to inflate the noisy data-manifold with a Gaussian of variance $\sigma^2$ in direction of + +(i) small variability, we expect the corresponding singular value $\lambda^{(i)}$ to change significantly only if $\sigma^2\gg \sigma_0^2 (i)$ . + +(ii) large variability, we expect the corresponding singular value $\lambda^{(i)}$ to change significantly only if $\sigma^2\gg \sigma_0^2 (i) + \sigma_i^2$ + +Indeed, we show in the supplementary that if the noise is only added in the manifold's normal space, then only those singular values will change while the singular values in direction of large variability will stay constant. Given this observation, we propose to train a separate NF for different noise magnitudes $\bar{\sigma}_1^2 < \dots < \bar{\sigma}_N^2$ , calculate for all of those models the flow's singular values on a sample $x$ from the manifold, and, according to Equation (8), find parameters $\alpha_{i}$ and $\beta_{i}$ such that $\hat{\lambda} (\sigma^{2}) = \frac{\beta_{i}}{\sqrt{\alpha_{i}^{2} + \sigma^{2}}}$ fits the set of pairs $\{(\bar{\sigma}_n^2,\lambda_n^{(i)}(x))\}_{n = 1,\ldots ,N}$ . Note that $\beta_{i} / \alpha_{i}$ corresponds to $\lambda^{(i)}$ if no noise was used to inflate the manifold and that $\alpha_{i}^{2}$ corresponds to the onset of strong decay. + +Our method for estimating the ID: Given $(\alpha_{i},\beta_{i})$ for all $i = 1,\ldots ,D$ , we expect to see a clear pattern separating singular values corresponding to directions of small and large variability, respectively. According to Observation 1, $\beta_{i} / \alpha_{i}$ must be much larger for large variability directions and according to Observation 2, the onsets $\alpha_{i}^{2}$ must be smaller compared to small variability directions. More concretely, the latter suggests that counting the number of singular values with onset $\leq \alpha$ , + +$$ +F (\alpha) = \# \left\{i \in \{1, \dots , D \} \text {s . t .} \alpha^ {(i)} \leq \alpha \right\}, \tag {9} +$$ + +$F(\alpha)$ should have a plateau when varying $\alpha$ from $-\infty$ to $\infty$ corresponding to the number of singular values in direction of small variability. Ideally, this plateau can be seen clearly when plotting $F(\alpha)$ and thus the number of off-manifold directions can be directly read out. + +Alternatively, a sum of two sigmoidal functions can be fitted to approximate $F$ , + +$$ +\hat {F} (\alpha) = \frac {a _ {1}}{1 + e ^ {- b _ {1} (\alpha - c _ {1})}} + \frac {a _ {2}}{1 + e ^ {- b _ {2} (\alpha - c _ {2})}}, \tag {10} +$$ + +where $c_{1} < c_{2}$ and hence $a_{1}$ corresponds to the number of small variability directions and $a_{2}$ to the number of large variability directions, see Algorithm 4 for an algorithmic overview of the method. + +Algorithm 4: Estimating the intrinsic dimensionality given a set of data points. +Require: Dataset $\mathcal{D} = \{x_i\}_{i=1}^M$ with $x_i \in \mathbb{R}^D$ . Samples $\{x_i^*\}_{i=1}^K \subset \mathcal{D}$ to use for estimating the ID. Noise magnitudes $\bar{\sigma}_1^2 < \ldots < \bar{\sigma}_N^2$ . +for $n = 1$ to $N$ do $\rightarrow$ add noise to dataset: $\tilde{\mathcal{D}} = \{x_i + \varepsilon_i\}$ , where $\varepsilon_{i}\sim \mathcal{N}(0,\bar{\sigma}_{n}^{2}I_{D})$ $\rightarrow$ learn $q_{\bar{\sigma}_n^2}$ using an NF $f_{n}$ $\rightarrow$ calculate and store singular values $\{\lambda_n^{(i)}(x_k^*)\}_{i = 1,\dots ,D}$ of $J_{f_n^{-1}}(x_k^*)$ , $k = 1,\ldots ,K$ end for $\rightarrow$ calculate mean singular values for all $i$ and $n$ , $\hat{\lambda}_n^{(i)}\coloneqq \frac{1}{K}\sum_{k = 1}^{K}\lambda_n^{(i)}(x_k^*)$ for $i = 1$ to $D$ do $\rightarrow$ store $(\alpha_{i},\beta_{i})$ such that $\hat{\lambda} (\sigma^2) = \frac{\beta_i}{\sqrt{\alpha_i^2 + \sigma^2}}$ fits $\{(\bar{\sigma}_n^2,\hat{\lambda}_n^{(i)})\}_{n = 1,\dots ,N}$ end for $\rightarrow$ calculate $F(\alpha) = \# \{i$ s.t. $\alpha_{i}\leq \alpha \}$ for $\alpha \in (-\infty ,\infty)$ $\rightarrow$ fit $\hat{F} (\alpha)$ given by Equation (10) and store parameter $a_2$ $\rightarrow$ estimator is given by $\hat{d} = a_2$ + +The averaging over the singular values does not have a geometrical interpretation as such. We are only interested in the cut-off separating singular values corresponding to on- and off-manifold directions. Hence, the averaging reduces the noise introduced by limited sample size or unexact learning of $q_{\sigma^2}$ . + +# 4.1 Pedagogical example + +We illustrate our method on a pedagogical example - a uniform distribution on the unit sphere corrupted by some intrinsic Gaussian noise with magnitude $\sigma_0^2 = 10^{-6}$ . In Figure 1 left, we show how the three singular values change in log-log-scale depending on various noise magnitudes. For the error bars, we use 200 clean training examples (i.e. not corrupted by noise). After the intrinsic noise magnitude is surpassed (first dashed line from the left), the large singular value changes with slope $\approx -0.5$ whereas the two smallest singular value barely change. After the noise magnitude + +exceeds the radius of the sphere (second dashed line from the left), the singular values approach each other. In the right figure, we show $F(\alpha)$ and its estimate $\hat{F}(\alpha)$ . The title of the right figure shows the output of Algorithm 4, the parameter $a_2$ of $\hat{F}(\alpha)$ . + +![](images/6370211b5d9ca3eb4e8dfcee6495dd0bf5b27c153b6114536d75a016b3232cf6.jpg) +Figure 1: Left: $\lambda$ vs. $\sigma^2$ plot as described in the main text. The red curve corresponds to singular values associated to direction of small variability (i.e. normal to the manifold). The blue and yellow curves correspond to singular values associated to directions of large variability (i.e. tangent to the manifold). Right: $F(\alpha)$ and $\hat{F}(\alpha)$ as defined in Equations (9) and (10). + +![](images/f73a284e6194974480a01769268302b4fbf4e4e2f8157e221a5b5e4f14577ab4.jpg) + +# 4.2 Special case: Images + +So far, our theory assumes unbounded data such that if the inflation noise $\sigma^2$ tends to infinity, $\sigma^2 \to \infty$ , the eigenvalues of the flow's Jacobian tend to 0, $\lambda \to 0$ . According to our theory, this decay happens much later for singular values corresponding to manifold directions than for off-manifold directions manifesting as a plateau for the decay onsets $\alpha$ . According to Equation (8), those onsets reflect the amount of variability in the manifold directions. + +However, some real world datasets are bounded. For example, RGB images consist of pixels which take values in $[0,255]$ . Thus, for $\sigma^2\to \infty$ , inflated images will become too noisy and all the information about the manifold is lost. Now, assume that $\sigma_{\mathrm{max}}^2$ is the maximal amount of noise that can be tolerated before all the images become so noisy that they become meaningless. Then, all onsets greater or equal to $\sigma_{\mathrm{max}}^2$ will correspond to manifold directions as the amount of variability in manifold directions must be greater than $\sigma_{\mathrm{max}}^2$ . + +How can we set this $\sigma_{\mathrm{max}}^2$ in the least arbitrary way? In the supplementary, Section A.4, we compute this maximal amount of noise from the following rationale. If $\sigma^2$ is too large, then essentially all the pixels will saturate to either the lower or the upper bounds, so a reasonable maximal amount of noise is such that $50\%$ of the pixels are saturated. If the pixel values fall in the interval $[0, x_{\mathrm{max}}]$ (and if we assume that pixel values are uniformly distributed on this interval), then $\sigma_{\mathrm{max}} = 0.68x_{\mathrm{max}}$ . + +# Remark 1 + +(i) Note, for $K = 1$ , Algorithm 4 estimates the ID locally at a given point $x_1^*$ . In the supplementary, we show that we can learn the ID locally on the lolipop dataset proposed in [32]. This manifold consists of a 1 dimensional line (the stick of a lolipop) and a 2 dimensional disk. +(ii) There is no need to calculate $F(\alpha)$ for all $\alpha \in \mathbb{R}$ since $F(\alpha) \in \{0,1,\dots,D\}$ . Given $\alpha_{i}$ for all $i = 1,\ldots ,D$ , we set $\alpha \in [\alpha_{min},\alpha_{max}]$ where $\alpha_{min} = \operatorname{argmin}_{i = 1,\dots,D}\{\alpha_i\}$ and $\alpha_{max} = \operatorname{argmax}_{i = 1,\dots,D}\{\alpha_i\}$ . + +
DistributionDIDID-NFLIDLtwoNN
mixture on sphere322.011.91±0.061.98
correlated on sphere322.041.66±0.071.99
mixture on torus322.022.05±0.041.97
correlated on torus322.022.07±0.052.02
correlated on hyperboloid322.022.01±0.071.99
unimodal on hyperboloid322.011.92±0.11.96
exponential on thin spiral2111.08±0.061
mixture on swiss roll322.022.26±0.031.98
correlated on swiss roll322.022.48±0.031.94
mixture on stiefel411.071.19±0.010.99
+ +Table 1: Performance of different ID estimation methods (ID-NF, LIDL, twoNN), on various datasets. Numbers highlighted in orange depict strong deviation from ground truth. + +# 5 Experiments + +We benchmark our method with twoNN and LIDL, see Section 3. The latter is very similar to our method as we both inflate the manifold with different values of $\sigma^2$ and then use an NF to learn $q_{\sigma^2}$ . However, [32] estimate the rate at which the log-likelihoods change depending on the noise magnitude $\sigma^2$ , whereas we study how the flow's Jacobian eigenvalues evolve. Hence, we rely on the NF being able to transform a sample of $p(x)$ to a standard Gaussian - a much easier task than learning the inflated distribution $q_{\sigma^2}$ exactly. Also, we don't rely on the assumption that $q_{\sigma^2}(x) = p(x)\mathcal{N}(x;x,I_{D - d})$ and thus we don't need to fine-tune the different noise magnitudes $\bar{\sigma}_1^2,\dots ,\bar{\sigma}_N^2$ , see Section 3 for more details. + +As an abbreviation for our method, we use ID-NF. We refer to the supplementary for corresponding training details and additional figures. The code for using ID-NF or reproducing our experiments can be found here https://github.com/chrvt/ID-NF. + +# 5.1 Low-dimensional synthetic datasets + +We test our method on various synthetic datasets with known ID: a sphere, torus, hyperboloid, thin spiral, swiss roll, and Stiefel manifold, see Table 1. We use different distributions on those manifolds to test the sensitivity on the sampling distribution $p(x)$ . We compare our method with the LIDL and twoNN estimator introduced in Section 3. For those low-dimensional examples, all methods perform well. The twoNN and our method estimate all ID exactly. The LIDL method, however, shows some sensitivity towards the sampling distribution (see the highlighted estimate for the correlated on sphere distribution), and slightly overestimates the swiss roll dimensionality (see the highlighted estimate for the swiss roll). However, we did not try to find the optimal range for $\sigma^2$ and use the same across all distributions. By this, we want to demonstrate the disadvantage of having to estimate the correct range for every distribution separately. + +# 5.2 High-dimensional synthetic datasets + +Next, we study how the methods scale to higher embedding dimensions. For that, we sample uniformly from $S(D / 2)$ embedded in $\mathbb{R}^D$ for different even values of $D$ . For a fair comparison, we only use a training set of size $10^4$ for all methods. In Figure 2 left, we display how the different methods estimate the dimensionality. ID-NF is on par with LIDL and outperforms twoNN. The latter suffers from the curse of dimensionality as mentioned in the introduction, Section 1. + +In Figure 2 right, we repeat the experiment using only $10^{3}$ samples. ID-NF still performs very well. LIDL, however, has greater variability and significantly underestimates the ID for $d = 200$ (i.e. $D = 400$ ). This indicates another benefit of our method: as opposed to LIDL, we do not need to learn the density exactly, a task that requires more samples for higher dimensions. + +![](images/f8f50286348533d13bd9b944cc6d09d53b49a13f1cbc07f4d5683acb6bd08331.jpg) +Figure 2: Left: Performance of different ID-estimation methods on uniform samples from $S(D / 2)$ embedded in $\mathbb{R}^D$ for $D$ ranging from 20 to 400. Right: Corresponding plot using $10^{3}$ instead of $10^{4}$ samples for training. + +![](images/888641cdf08668675bc1b2367aca17e8d680afe65f44233956b31fb46a8954ee.jpg) + +# 5.3 StyleGan image manifolds + +In [3], a image manifold was created by using a recent variant of a generative adversarial network, StyleGAN2 [19], trained on a high-quality image dataset, the FFHQ dataset [18]. When generating new images, only $d$ of total 512 latent variables were varied while keeping the others fixed. Note, that this does not necessarily generate a $d$ -dimensional image manifold. Indeed, [29] showed that whenever the generator is Lipschitz continuous, the ID is at most $d$ . We downsample those images to a resolution of $64 \times 64 \times 3$ , i.e. the embedding space has dimension $D = 12288$ . + +We apply our method on the StyleGan $d = 2$ and $d = 64$ image manifold consisting of $10^{4}$ and $2 \cdot 10^{4}$ images, respectively. Unfortunately, training $N$ flows on these datasets is computationally expensive, so is calculating the eigenspectrum of the flows Jacobian for $K$ samples. However, we are only interested whether the onset of the eigenvalue's decay happens after $\sigma_{\max} = 255 \cdot 0.68$ or not, see Section 4.2. Therefore, it is sufficient to train only 3 NFs: one where the inflation noise $\sigma$ has a very small magnitude, one where $\sigma = 255 \cdot 0.68$ , and one where $\sigma$ is very large. + +In Figure 3, we show the heights and onsets for all singular value curves of a specific example for $d = 2$ on the left, and $d = 64$ on the right. We highlight the points corresponding to the 2 smallest and 64 smallest singular values, respectively, in red. The dashed vertical line is located at $\sigma_{\max} = 255 \cdot 0.68$ . For $d = 2$ , the smallest two singular values are nicely separated, though we count $\hat{d} = 4$ singular values which have onsets greater than $\sigma_{\max}^2$ for this particular example. For $d = 64$ , we count $\hat{d} = 57$ . When averaging over $K = 50$ samples, our estimate for $d = 2$ is $\hat{d} = 4.06$ and for $d = 64$ we have $\hat{d} = 62.24$ .5 + +We also estimated the ID using LIDL, however, we did not get a consistent estimator. In fact, depending on the range one uses for the inflation noise $\sigma^2$ , the estimate varies greatly. + +# 5.4 Proof-of-concept applications + +We show that the ID can be used to improve latent variable models and observe that out-of-distribution (OOD) samples have a higher ID. + +Latent variable models: Recently, two latent variable models for manifold valued data based on NFs were developed, the manifold flow $(\mathcal{M}$ -flow) [3] and denoising normalizing flow (DNF) [16]. Both methods rely on knowing the exact number of latent variables (i.e. the ID) which limits their applicability to real-world problems. For instance, the true ID (if exists) of the CelebA-HQ [18] is + +![](images/ab6bb566fb8452cd03894b7f897416f7fef9ad73b161f138020e33cef271a119.jpg) +Figure 3: Scatter plots of onsets and heights, $(\alpha ,\beta /\alpha)$ , for all singular values in log-log scale. In red, the $d$ smallest singular values are highlighted. The dashed line corresponds to the $\sigma_{\mathrm{max}} = 0.68\cdot 255$ + +![](images/c4128a99eb97b2fd1cf9136e6d31549417d7f5a8f1ea752f5ab36f3ce750e1f2.jpg) + +unknown and the latent dimensionality was set arbitrarily to 512. We used our method to estimate the ID and obtained $\hat{d} = 130$ . We then trained an DNF with the same architecture as in the original paper using a latent dimensionality of 130 instead of 512. After 300 epochs, we assess the quality of the generated images with the Frechet Inception distance (FID) - where lower distances are better [15]. We obtain an FID score of 36.92. The original DNF has an FID score of 34.14, and the $\mathcal{M}$ -flow of 38.07 - after 500 epochs of training. Thus, we obtain very similar results in terms of generative power (measured by the FID score) with only 130 latent dimensions instead of 512. + +ID on OOD-samples: Having trained on a specific dataset, such as the StyleGan 2d image manifold, how does the ID changes for an out-of-distribution (OOD) sample? In table 2, we report the average ID estimated on $K = 50$ samples from different datasets when trained on the Stylegan2d image manifold. As we can see, the ID of OOD samples is significantly higher than for in-distribution samples. Intuitively, OOD samples live on the manifolds normal space, and thus, in case $d < D / 2$ , have more directions of large variability. We conduct more OOD experiments in the supplementary. + +
Datasets / OODStyleGan2dStyleGan64dCelebA
StyleGan2d4.06 ± 1.75151.72 ± 54.04272.14 ± 261.71
+ +Table 2: Average ID estimates for 50 samples using our method trained StyleGan2d. + +# 6 Discussion + +We have introduced a new method to estimate the ID exploiting the ability of NFs to transform data into samples from a Gaussian random variable. Based on some simple back-of-the-envelope calculations, we derived how the singular values of the flows Jacobian evolve when inflating the data with Gaussian noise before training. Crucially for our estimator, singular values corresponding to the directions of large variability (i.e. manifold directions) evolve significantly different compared to singular values corresponding to the directions of small variability (i.e. off-manifold directions). + +We demonstrated that we can estimate the ID for different manifolds with different sampling distribution. We compared our method to a state-of-the-art ID estimator based on nearest neighbor statistics, twoNN, and to a related method which is also based on NFs, LIDL. We outperform twoNN for high dimensions (Table 1), and LIDL for small data regimes (Figure 2) and images, Section 5.3. As opposed to LIDL, we don't have to fine-tune the noise magnitudes $\bar{\sigma}_1^2,\dots,\bar{\sigma}_N^2$ . However, we need $\bar{\sigma}_{1}$ to be small and $\bar{\sigma}_N$ to be sufficiently large which may be computationally expensive. + +We showed that our method scales to RGB images of resolution $64 \times 64$ populating a $d = 2$ and $d = 64$ dimensional manifold, where we estimate $\hat{d} = 4$ and for $\hat{d} = 62$ , respectively. However, + +this estimate is sensitive to the number $K$ of images used to estimate $d$ (we used $K = 50$ ), the number of NFs trained on (we argued that $N = 3$ is sufficient), and to the maximum amount of noise to be tolerated before the images become too blurry ( $\sigma_{\mathrm{max}} = 0.68 \cdot 255$ see Section 4.2). Nevertheless, to the best of our knowledge, this is the first method which estimates the ID on such high-resolution image manifolds consistently. Additionally, we demonstrated that estimating the ID can help to improve recently developed latent variable models based on NFs where knowing this exact number is crucial. Also, we observed that for out-of-distribution (OOD) data, the ID is higher than for on-manifold examples motivating further research on the relation between OOD samples and ID. + +Finally, our theoretical derivations rely on the assumption that data is unbounded, although we adapted our method for bounded data too. However, for this case more research is needed to understand the exact behaviour of the flow's Jacobian singular values when approaching the boundary. An interesting direction to pursue is to adapt the target distribution and inflation noise to the data topology. For images, this amounts to changing the NF's target distribution to be uniform instead of Gaussian, and using uniform instead of Gaussian noise. + +Broader Impact: As a theoretical paper, we don't foresee any direct negative social impacts of our work. + +# Acknowledgments and Disclosure of Funding + +This study has been supported by the Swiss National Science Foundation grant 31003A_175644. + +# References + +[1] Alessio Ansuini, Alessandro Laio, Jakob H Macke, and Davide Zoccolan. Intrinsic dimension of data representations in deep neural networks. In Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. +[2] Nitish Bahadur and Randy Paffenroth. Dimension estimation using autoencoders. arXiv preprint arXiv:1909.10702, 2019. +[3] Johann Brehmer and Kyle Cranmer. Flows for simultaneous manifold learning and density estimation. Advances in Neural Information Processing Systems, 33, 2020. +[4] Francesco Camastra and Antonino Staiano. Intrinsic dimension estimation: Advances and open problems. Inf. Sci., 328:26-41, 2016. +[5] Paola Campadelli, Elena Casiraghi, Claudio Ceruti, and Alessandro Rozza. Intrinsic dimension estimation: Relevant techniques and a benchmark framework. Mathematical Problems in Engineering, 2015, 2015. +[6] Eike Cramer, Felix Rauh, Alexander Mitsos, Raul Tempone, and Manuel Dahmen. Nonlinear isometric manifold learning for injective normalizing flows. arXiv preprint arXiv:2203.03934, 2022. +[7] Edmond Cunningham, Adam Cobb, and Susmit Jha. Principal manifold flows. arXiv preprint arXiv:2202.07037, 2022. +[8] Edmond Cunningham, Renos Zabounidis, Abhinav Agrawal, Ina Fiterau, and Daniel Sheldon. Normalizing flows across dimensions. arXiv preprint arXiv:2006.13070, 2020. +[9] Elena Facco, Maria d'Errico, Alex Rodriguez, and Alessandro Laio. Estimating the intrinsic dimension of datasets by a minimal neighborhood information. Scientific reports, 7(1):1-8, 2017. +[10] Mevlana C Gemici, Danilo Rezende, and Shakir Mohamed. Normalizing flows on riemannian manifolds. arXiv preprint arXiv:1611.02304, 2016. +[11] Sixue Gong, Vishnu Naresh Boddeti, and Anil K. Jain. On the intrinsic dimensionality of image representations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2019. + +[12] Daniele Granata and Vincenzo Carnevale. Accurate estimation of the intrinsic dimension using graph distances: Unraveling the geometric complexity of datasets. Scientific reports, 6(1):1-12, 2016. +[13] Peter Grassberger and Itamar Procaccia. Measuring the strangeness of strange attractors. Physica D: Nonlinear Phenomena, 9:189-208, 1983. +[14] Matthias Hein and Jean-Yves Audibert. Intrinsic dimensionality estimation of submanifolds in rd. In Proceedings of the 22nd international conference on Machine learning, pages 289-296, 2005. +[15] Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pages 6629-6640, 2017. +[16] Christian Horvat and Jean-Pascal Pfister. Denoising Normalizing Flow. In Advances in Neural Information Processing Systems, volume 34, pages 9099-9111. Curran Associates, Inc., 2021. +[17] Christian Horvat and Jean-Pascal Pfister. Density estimation on low-dimensional manifolds: an inflation-deflation approach. arXiv:2105.12152 [cs, stat], February 2022. arXiv: 2105.12152. +[18] T Karras, S Laine, and T Aila. A style-based generator architecture for generative adversarial networks. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2020. +[19] Tero Karras, Samuli Laine, Miika Aittala, Janne Hellsten, Jaakko Lehtinen, and Timo Aila. Analyzing and improving the image quality of stylegan. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 8107-8116. IEEE, 2020. +[20] Hyeongju Kim, Hyeonseung Lee, Woo Hyun Kang, Joun Yeop Lee, and Nam Soo Kim. Softflow: Probabilistic framework for normalizing flow on manifolds. Advances in Neural Information Processing Systems, 33, 2020. +[21] N. Krueger and M. Felsberg. A continuous formulation of intrinsic dimension. In Proc. BMVC, pages 27.1–27.10, 2003. doi:10.5244/C.17.27. +[22] J.M. Lee. Introduction to Riemannian Manifolds. Graduate Texts in Mathematics. Springer International Publishing, 2019. +[23] Bai Li, Changyou Chen, Wenlin Wang, and Lawrence Carin. Certified adversarial robustness with additive noise. arXiv preprint arXiv:1809.03113, 2018. +[24] Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaou Tang. Deep learning face attributes in the wild. In Proceedings of International Conference on Computer Vision (ICCV), December 2015. +[25] Marius Muja and David G. Lowe. Scalable nearest neighbor algorithms for high dimensional data. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(11):2227-2240, 2014. +[26] Gary W. Oehlert. A note on the delta method. The American Statistician, 46(1):27-29, 1992. +[27] Rich Pang, Benjamin J Lansdell, and Adrienne L Fairhall. Dimensionality reduction in neuroscience. Current Biology, 26(14):R656-R660, 2016. +[28] Stefano Piana and Alessandro Laio. Advillin folding takes place on a hypersurface of small dimensionality. Phys. Rev. Lett., 101:208101, Nov 2008. +[29] Phillip Pope, Chen Zhu, Ahmed Abdelkader, Micah Goldblum, and Tom Goldstein. The intrinsic dimension of images and its impact on learning. arXiv preprint arXiv:2104.08894, 2021. +[30] Salah Rifai, Pascal Vincent, Xavier Muller, Xavier Glorot, and Yoshua Bengio. Contractive Auto-Encoders: Explicit Invariance During Feature Extraction. page 8. + +[31] Paul K Rubenstein, Bernhard Schoelkopf, and Ilya Tolstikhin. On the latent space of wasserstein auto-encoders. arXiv preprint arXiv:1802.03761, 2018. +[32] Piotr Tempczyk, Przemysław Spurek, and Jacek Tabor. LIDL: LOCAL INTRINSIC DIMENSION ESTIMATION USING APPROXIMATE LIKELIHOOD. page 10, 2021. +[33] S Velliangiri, S Alagumuthukrishnan, et al. A review of dimensionality reduction techniques for efficient computation. Procedia Computer Science, 165:104-111, 2019. +[34] Yasi Wang, Hongxun Yao, and Sicheng Zhao. Auto-encoder based dimensionality reduction. Neurocomput., 184(C):232-242, apr 2016. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] See Section 5. +(b) Did you describe the limitations of your work? [Yes] See Section 6. +(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Section 6. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] +(b) Did you include complete proofs of all theoretical results? [Yes] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] See https://github.com/chrvt/ID-NF +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] In the supplemental material. +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] See Table 1. +(d) Did you include the total amount of comute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [No] + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [N/A] +(b) Did you mention the license of the assets? [N/A] +(c) Did you include any new assets either in the supplemental material or as a URL? [No] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [No] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/intrinsicdimensionalityestimationusingnormalizingflows/images.zip b/intrinsicdimensionalityestimationusingnormalizingflows/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..241e0763ed2a3a2b05cefe4c201146956d54c25c --- /dev/null +++ b/intrinsicdimensionalityestimationusingnormalizingflows/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e83f97511e28347d23b8cbcc916cb95580a62aaf3283778d8eeb2b3ec593d56a +size 242193 diff --git a/intrinsicdimensionalityestimationusingnormalizingflows/layout.json b/intrinsicdimensionalityestimationusingnormalizingflows/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..886ffdaf4c23da7873b58f69a8b4db3e3c6d6b5b --- /dev/null +++ b/intrinsicdimensionalityestimationusingnormalizingflows/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea0f6aa5d9e8aa97f2e2afcb00ba987e6f09b162694b68bd426bd341ba3a52cb +size 569943 diff --git a/introspectivelearningatwostageapproachforinferenceinneuralnetworks/47352965-4327-4f29-99cf-2b5ed28d5e64_content_list.json b/introspectivelearningatwostageapproachforinferenceinneuralnetworks/47352965-4327-4f29-99cf-2b5ed28d5e64_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..be1eccd7b0fb15c5ba283ff3f0631e2d84b7f9d5 --- /dev/null +++ b/introspectivelearningatwostageapproachforinferenceinneuralnetworks/47352965-4327-4f29-99cf-2b5ed28d5e64_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:474cca5f1642cf65ab6a75693f1b15822eb141ba3497a04f7eefc6a8648805bf +size 90485 diff --git a/introspectivelearningatwostageapproachforinferenceinneuralnetworks/47352965-4327-4f29-99cf-2b5ed28d5e64_model.json b/introspectivelearningatwostageapproachforinferenceinneuralnetworks/47352965-4327-4f29-99cf-2b5ed28d5e64_model.json new file mode 100644 index 0000000000000000000000000000000000000000..9fdc13ea7fa752ae04b4045e5c6f5b84c9945cbf --- /dev/null +++ b/introspectivelearningatwostageapproachforinferenceinneuralnetworks/47352965-4327-4f29-99cf-2b5ed28d5e64_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:44e8eed0cdee9be97daea598f97fe9f117c2b1bec796fd8b3d710978dfaaea0b +size 117842 diff --git a/introspectivelearningatwostageapproachforinferenceinneuralnetworks/47352965-4327-4f29-99cf-2b5ed28d5e64_origin.pdf b/introspectivelearningatwostageapproachforinferenceinneuralnetworks/47352965-4327-4f29-99cf-2b5ed28d5e64_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..92812c68aeedadd6424986ad54474e3df8055308 --- /dev/null +++ b/introspectivelearningatwostageapproachforinferenceinneuralnetworks/47352965-4327-4f29-99cf-2b5ed28d5e64_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aee4b26e9bead18af9239c3e24fbe44b45bed26376fa4d32e30b208fda6b9d02 +size 2940115 diff --git a/introspectivelearningatwostageapproachforinferenceinneuralnetworks/full.md b/introspectivelearningatwostageapproachforinferenceinneuralnetworks/full.md new file mode 100644 index 0000000000000000000000000000000000000000..139599da08e0642cdc1f8417031bc1d9b0c6b478 --- /dev/null +++ b/introspectivelearningatwostageapproachforinferenceinneuralnetworks/full.md @@ -0,0 +1,372 @@ +# Introspective Learning : A Two-Stage Approach for Inference in Neural Networks + +Mohit Prabhushankar + +Electrical and Computer Engineering + +Georgia Institute of Technology + +Atlanta, GA 30308 + +mohit.p@gatech.edu + +Ghassan AlRegib + +Electrical and Computer Engineering + +Georgia Institute of Technology + +Atlanta, GA 30308 + +alregib@gatech.edu + +# Abstract + +In this paper, we advocate for two stages in a neural network's decision making process. The first is the existing feed-forward inference framework where patterns in given data are sensed and associated with previously learned patterns. The second stage is a slower reflection stage where we ask the network to reflect on its feed-forward decision by considering and evaluating all available choices. Together, we term the two stages as introspective learning. We use gradients of trained neural networks as a measurement of this reflection. A simple three-layered Multi Layer Perceptron is used as the second stage that predicts based on all extracted gradient features. We perceptually visualize the post-hoc explanations from both stages to provide a visual grounding to introspection. For the application of recognition, we show that an introspective network is $4\%$ more robust and $42\%$ less prone to calibration errors when generalizing to noisy data. We also illustrate the value of introspective networks in downstream tasks that require generalizability and calibration including active learning, out-of-distribution detection, and uncertainty estimation. Finally, we ground the proposed machine introspection to human introspection for the application of image quality assessment. + +# 1 Introduction + +Introspection is the act of looking into one's own mind (1). Classical introspection has its roots in philosophy. Locke (2), the founder of empiricism, held that all human ideas come from experience. This experience is a result of both sensation and reflection. By sensation, one receives passive information using the sensory systems of sight, sound, and touch. Reflection is the objective observation of our own mental operations. Consider the toy example in Fig. 1 Given an image $x$ and an objective of recognizing $x$ , we first sense some key features in the bird. These features include the color and shape of the body, feathers and beak. The features are chosen based on our existing notion of what is required to contrast between birds. We then associate these features with our existing knowledge of birds and make a coarse decision that $x$ is a spoonbill. This is the sensing stage. Reflection involves questioning the coarse decision and asking why $x$ cannot be a Flamingo, Crane, Pig or any other class. If the answers are satisfactory, then an introspective decision that $x$ is indeed a spoonbill is made. The observation of this reflection is introspection. + +In this paper, we adopt this differentiation between sensing and reflection to advocate for two-stage neural network architectures for perception-based applications. Specifically, we consider classification. The sensing stage is any existing feed-forward neural network including VGG (3), ResNet (4), and DenseNet (5) architectures among others. These networks sense patterns in $x$ and make a coarse feed-forward decision, $\hat{y}$ . The second stage examines this decision by reflecting on the introspective question 'Why $\hat{y}$ , rather than $y_I$ ?' where $y_I$ is any introspective class that the sensing network has learned. Note that there is no external intervention or new information that informs + +![](images/01c504f4bad6a0d040f40345e14761d343dcc4f0c810a49d80ac201eae2d00c6.jpg) +Figure 1: Example of the introspection process. The visual post-hoc explanations are from Grad-CAM (6) framework using the proposed features. Additional heatmaps along with the generation process is provided in Appendix A. The written text is for illustrative purpose only. + +the reflection stage. Hence, the introspective features are post-hoc in the sense that they are not causal answers to the introspective questions but rather, are the network's notion of the answers. This is inline with the original definition of introspection which is that introspection is the observation of existing knowledge reflected upon by the network. These post-hoc introspective features are visualized using Grad-CAM (6) in the reflection stage of Fig. 1. + +The challenge that we address in this paper is in defining the reflection stage in terms of neural networks. The authors in (7), utilize the same intuition to construct a reflective stage composed of explanations. However, when the train and test distributions are dissimilar, the predictions and hence the explanations are incorrect. We overcome this by considering alternative questions for the explanation. Consider any dataset with $N$ classes. A network trained on this dataset will have $N$ possible introspective questions and answers, similar to the ones shown in Fig. Our goal is to implicitly extract features that answer all $N$ introspective questions without explicitly training on said features. This involves 1) implicitly creating introspective questions, 2) answering the posed questions to obtain introspective features, and 3) predicting the output $\tilde{y}$ from the introspective features. We show that gradients w.r.t network parameters store notions about the difference between classes and can be used as introspective features. We use an MLP termed $\mathcal{H}(\cdot)$ , as our introspective network that combines all features to predict $\tilde{y}$ . A limitation of the proposed method is the size of $N$ which is discussed in Sections 3 + +We show that the introspective prediction $\tilde{y}$ is robust to noise. An intuition for this robustness is that not only should the network sense the feed-forward patterns, it must also satisfy $\mathcal{H}(\cdot)$ 's $N$ notions of difference between classes. Hence, during inference, we extract $N$ additional features that inform the introspective prediction $\tilde{y}$ . The main contributions of this paper are the following: + +1. We define implicit introspective questions that allow for reflection in a neural network. This reflection is measured using loss gradients w.r.t. network parameters across all possible introspective classes in Section 3. +2. We provide a methodology to efficiently extract introspective loss gradients and combine them using a second $\mathcal{H}(\cdot)$ MLP network in Section 4. +3. We illustrate $\mathcal{H}(\cdot)$ 's robust and calibrated nature in Section 6. We validate the effectiveness of this generalization in downstream applications like active learning, out-of-distribution detection, uncertainty estimation, and Image Quality Assessment in Appendix D. + +# 2 Background + +# 2.1 Introspective questions, features, and network + +Introspective questions The choice of 'Why $\hat{y}$ , rather than $y_{I}$ ?' is not arbitrary. The authors in (8) describe three questions that complete post-hoc explanations - correlation, counterfactual, and contrastive questions. These questions together allow for an alternate form of reasoning within neural networks called abductive reasoning. The sensing network predicts based on correlations. + +Since, we do not intervene within the data during the reflection stage, counterfactual questions cannot be answered. Hence, we use contrastive questions as our introspective questions. Further details regarding abductive reasoning and our choice of question is provided in Appendix A + +Gradients as Introspective Features The gradients from a base network have been utilized in diverse applications including post-hoc visual explanations (6: 9: 10), adversarial attacks (11), uncertainty estimation (12), anomaly detection (13: 14), and saliency detection (15) among others. Fisher Vectors use gradients of generative models to characterize the change that data creates within features (16). (17) uses gradients of parameters to characterize the change in manifolds when new data is introduced to an already trained manifold. Our framework uses the intuition from (17) to characterize changes for a datapoint that is perceived as new, due to it being assigned an introspective class $y_{I}$ , that is different from its predicted class $\hat{y}$ . In (18), the authors view the network as a graph and intervene within it to obtain holographic features. Our introspective features are also holographic in the sense that they characterize the change between $\hat{y}$ and $y_{I}$ without changing the network. However, our features do not require interventions that become expensive with scale. + +Two-stage networks The usage of two-stage approaches to inference in neural networks is not new. In (7), the authors extract Grad-CAM explanations from feed-forward networks to train a reflective stage. However, our framework involves reflecting on all contrastive questions rather than correlation questions. The authors in (19) propose SimCLR, a self-supervised framework where multiple data augmentation strategies are used to contrastively train an overhead MLP. The MLP provides features which are stored as a dictionary. This feature dictionary is used as a look-up table for new test data. In this paper, we use gradients against all classes as features and an MLP $\mathcal{H}(\cdot)$ , to predict on these features. (20) and (21) consider all classes in a conditional maximum likelihood estimate on test data to retrain the model. These works differ from ours in our usage of the base sensing network. (22) uses gradients and activations together as features and note that the validity of gradients as features is in pretrained base networks rather than additional parameters from the two-stage networks. This adds to our argument of using two-stage networks but with loss gradients against introspective classes. + +# 2.2 Feed-forward Features + +For the application of recognition, a sensing neural network $f(\cdot)$ is trained on a distribution $\mathcal{X}$ to classify data into $N$ classes. The network learns notions about data samples when classifying them. These notions are stored as network weights $W$ . Given a data sample $x$ , $f(x)$ is a projection on the network weights. Let $y_{feat}$ be the logits projected before the final fully connected layer. In the final fully connected layer $f_{L}(\cdot)$ , the parameters $W_{L}$ can be considered as $N$ filters each of dimensionality $d_{L-1} \times 1$ . The output of the network $\hat{y}$ is given by, + +$$ +y _ {f e a t} = f _ {L - 1} (x), \forall y \in \Re^ {N \times 1}, +$$ + +$$ +\hat {y} = \arg \max \left(W _ {L} ^ {T} y _ {\text {f e a t}}\right), \forall W _ {L} \in \Re^ {d _ {L - 1} \times N}, f _ {L - 1} (x) \in \Re^ {d _ {L - 1} \times 1}. \tag {1} +$$ + +Here $\hat{y}$ is the feed-forward inference and $y_{\text{feat}}$ are the feed-forward features. In this paper, we compare our introspective features against feed-forward features. Since introspection occurs after $f(\cdot)$ , all our results are plug-in on top of existing $f(\cdot)$ . + +# 3 Introspective Features + +In this section, we describe introspective features and implicitly extract them using the sensing network. We then analyze them for sparsity, efficiency, and robustness. + +Definition 3.1 (Introspection). Given a network $f(\cdot)$ , a datum $x$ , and the network's prediction $f(x) = \hat{y}$ , introspection in $f(\cdot)$ is the measurement of change induced in the network parameters when a label $y_{I}$ is introduced as the label for $x$ . This measurement is the gradient induced by a loss function $J(y_{I},\hat{y})$ , w.r.t. the network parameters. + +This definition for introspection is in accordance with the sensing and reflection stages in Fig. 1. The network's prediction $\hat{y}$ is the output of the sensing stage and the change induced by an introspective label, $y_{I}$ , is the network reflecting on its decision $\hat{y}$ as opposed to $y_{I}$ . Note that introspection can occur when $\hat{y}$ is contrasted against any trained label $y_{I}, I \in [1, N]$ . For instance, in Fig. 1, the network is asked to reflect on its decision of spoonbill by considering other $y_{I}$ that $x$ can take -flamingo, crane, or pig. These results are extracted from ImageNet (23) and hence, $I \in [1, 1000]$ . Additional visual introspective saliency maps similar to Fig. 1 are provided in Appendix A + +![](images/fdda2719bb4c48723ef27c89cc28d226016accbf9defb2bb6e27f09bc01880bb.jpg) +Figure 2: For the input image on the left, the $\nabla_{W_L}J(y_I,5)$ are shown on the right. Each image is a visualization of the $50\times 10$ gradient matrix. All images are sparse except in the prediction row 5 and introspective question row $i$ . + +![](images/35bc123a5f65dcdc4698e9f5481ada1f4065cc82689b1b6f4af9b156d7894fd8.jpg) + +![](images/ed3a9eace381434b7b955a4434a92610f72dca21c72c3349530792c6b0033573.jpg) + +Reflection is the empirical risk that the network has predicted $x$ as $\hat{y}$ instead of $y_I$ . Given the network parameters, this risk is measured through some loss function $J(y_I, \hat{y})$ . $y_I$ is a one-hot vector with a one at the $I^{th}$ location. The change that is induced in the network is given by the gradient of $J(y_I, \hat{y})$ w.r.t. the network parameters. For an $N$ -class classifier, there are $N$ possible introspective classes and hence $N$ possible gradients each given by, $r_I = \nabla_W J(y_I, \hat{y}), I \in [1, N]$ . Here, $r_I$ are the introspective features. Since we introspect based on classes, we measure the change in network weights in the final fully connected layer. Therefore, the introspective features are given by, + +$$ +r _ {I} = \nabla_ {W _ {L}} J (y _ {I}, \hat {y}), I \in [ 1, N ], r _ {I} \in \Re^ {d _ {L - 1} \times N} \tag {2} +$$ + +where $W_{L}$ are the network weights for the final fully connected layer. Note that the final fully connected layer from Eq. [1] has a dimensionality of $\Re^{d_{L-1} \times N}$ . For every $x$ , Eq. [2] is applied $N$ times to obtain $N$ separate $r_{I}$ . We first analyze these features. + +# 3.1 Sparsity and Robustness of Introspective Features + +Consider $r_I$ in Eq. 2 Each $r_I$ is a $d_{L-1} \times N$ matrix. Expressing gradients in $r_I$ separately w.r.t. the different filters in $W_L$ , we have a row-wise concatenated set of gradients given by, + +$$ +r _ {I} = \left[ \nabla_ {W _ {L, 1}} J (y _ {I}, \hat {y}); \nabla_ {W _ {L, 2}} J (y _ {I}, \hat {y}); \nabla_ {W _ {L, 3}} J (y _ {I}, \hat {y}) \dots \nabla_ {W _ {L, N}} J (y _ {I}, \hat {y}) \right] \tag {3} +$$ + +where each $W_{L,j}\in \Re^{d_{L - 1}\times 1}$ and $r_I\in \Re^{d_{L - 1}\times N^2}$ . For all data $x\in \mathcal{X}$ the following lemma holds: + +Lemma 1. Given a unique ordered pair $(x, \hat{y})$ and a well-trained network $f(\cdot)$ , the gradients for a loss function $J(y_I, \hat{y})$ w.r.t. classes are pairwise orthogonal under the second-order Taylor series approximation, each class paired with the predicted class. + +Proof. Provided in Appendix B.1. + +![](images/6b87c0f4bea3e867e5b1e7ac41084f6da9db254928fa033daf459db333151f7b.jpg) + +Sparsity Lemma $\boxed{1}$ states that backpropagating class $y_{I}$ does not provide any information to $W_{L,j}, j \neq I$ and hence there is no need to use $\nabla_{W_{L,j}} J(y_j, \hat{y}), j \neq i$ as features when considering $y_{I}$ . The proof is provided in Appendix B.1. $\nabla_W J(y_I, \hat{y})$ for an introspective class reduces to, + +$$ +\nabla_ {W} J \left(y _ {I}, \hat {y}\right) = - \nabla_ {W} y _ {I} + \nabla_ {W} \log \left(1 + \frac {y _ {\hat {y}}}{2}\right). \tag {4} +$$ + +where $y_{\hat{y}}$ is the logit associated with the predicted class. We demonstrate the sparsity of Eq. 4 in Fig. 2. A two-layer CNN is trained on MNIST (24) dataset with a test accuracy exceeding $99\%$ . This satisfies the condition for Lemma 1 that $f(\cdot)$ is well-trained. The final fully connected layer in this network has a size of $50 \times 10$ . We provide an input image $x$ of number 5 to a trained network as shown in Fig. 2. The network correctly identifies the image as a 5. We then backpropagate the introspective class 0 using $J(5,0)$ with $\hat{y} = 5$ and $y_{I} = 0$ . This answers the question 'Why 5, rather + +![](images/5ab1638a17ade803ed45ba1850ff7316bd00d25f3ccf18badd4c2e1cea678f2c.jpg) +Figure 3: Introspective Learning process. Once $r_x$ for all images in the dataset are generated, an introspective network $\mathcal{H}(\cdot)$ is trained. During testing, the noisy image is passed through sensing network $f(\cdot)$ , extraction module to generate $r_x$ and finally through the introspective network $\mathcal{H}(\cdot)$ . + +![](images/fa26b8ef5902c135f2866368c6d21c8152f90f3774c01bc6f99d901532f69fbd.jpg) + +than $0?$ . The gradient features in the final fully connected layer are the same dimensions as the final fully connected layer, $50\times 10$ or more generally $\mathcal{O}(d_{L - 1}\times N)$ . This matrix is displayed as a normalized image in Fig.2 Yellow scales to 1 and blue is $-1$ while green is 0. It can be seen that the only values present in the matrix are negative at $W_{L,0}$ , in blue, and positive in $W_{L,5}$ , in yellow. This validates Eq.5 that for a fully-trained network the only values, and hence the only information, required from $W_{L}$ for $I = 0$ is $\nabla_{W_{L,0}}$ . We show the matrix $\nabla_{W_L}$ when $I = 0,1,2,4,5,6$ . The difference among all matrices is the location of the negative values that exist at $\nabla_{W_L,I}$ for different values of $I$ + +Robustness Eq.4 motivates the generalizable nature of introspective features. Consider some noise added to $x$ . To change the prediction $\hat{y}$ , the noise must sufficiently decrease $y_{\hat{y}}$ from Eq.4 and increase the closest logit value, $y_{I}$ , to change the prediction. Hence, it needs to change one orthogonal relationship. However, by constraining our final prediction $\tilde{y}$ on $N$ such features, the noise needs to change the orthogonal relationship between $N$ pairwise logits. This motivates an introspective network $\mathcal{H}(\cdot)$ that is conditioned on all $N$ pairwise logits. + +# 3.2 Efficient Extraction of Introspective Features + +From Lemma [1], the introspective feature is only dependent on the predicted class $\hat{y}$ and the introspective class $y_{I}$ making their span orthogonal to all other gradients. Hence, + +$$ +r _ {I} = \nabla_ {W _ {L, I}} J (y _ {I}, \hat {y}), I \in [ 1, N ], r _ {I} \in \Re^ {d _ {L - 1} \times 1} \tag {5} +$$ + +Building on Lemma 1, we present the following theorem. + +Theorem 1. Given a unique ordered pair $(x, \hat{y})$ and a well-trained network $f(\cdot)$ , the gradients for a loss function $J(y_{I}, \hat{y}), I \in [1, N]$ w.r.t. classes when $y_{I}$ are $N$ orthogonal one-hot vectors is equivalent to when $y_{I}$ is a vector of all ones, under the second-order Taylor series approximation. + +Proof. Provided in Appendix B.2 + +![](images/acb2c6dcefded075c0fc9e11af3897f8a17e9c3e6a9be6aaf7b847d9260af8a2.jpg) + +The proof follows Lemma [1]. Theorem [1] states that backpropagating a vector of all ones $(\mathbf{1}_N)$ is equivalent to backpropagating $N$ one-hot vectors with ones at orthogonal positions. This reduces the time complexity from $\mathcal{O}(N)$ to a constant $\mathcal{O}(1)$ since we only require a single pass to backpropagate $\mathbf{1}_N$ . Hence, our introspective feature is given by, + +$$ +r _ {x} = \nabla_ {W _ {L}} J (\mathbf {1} _ {N}, \hat {y}), r _ {x} \in \Re^ {d _ {L - 1} \times N}, \mathbf {1} _ {N} = 1 ^ {N \times 1} \tag {6} +$$ + +Note the LHS is now $r_x$ instead of $r_I$ from Eq. 5. The final introspective feature is a matrix of the same size as $W_L$ extracted in $\mathcal{O}(1)$ time with a space complexity of $\mathcal{O}(d_{L-1} \times N)$ . $r_x$ is vectorized and scaled between $[-1,1]$ before being used in Sections 4 and 6 as introspective features. This procedure is illustrated in Fig. 3 + +# 4 Introspective Network + +Once $r_x$ are extracted using Eq. 6, the introspective label $\tilde{y}$ from Fig. 3 is given by $\tilde{y} = \mathcal{H}(r_x)$ where $\mathcal{H}(\cdot)$ is an MLP. In this section, we analyze $\mathcal{H}(\cdot)$ . From Fig. 3, $f(\cdot)$ is any existing trained network used to obtain introspective features $r_x$ . It is trained to predict the ground truth $y$ given any $x$ . Based on the assumption that $\mathcal{H}(r_x) = \mathbb{E}(y | f(x))$ and hence expectation of $y - \mathcal{H}(r_x)$ is 0, the loss function can be decomposed as, + +$$ +\mathbb {E} \left[ (f (x) - y) ^ {2} \right] = \mathbb {E} \left[ (f (x) - \mathcal {H} \left(r _ {x}\right)) ^ {2}) \right] + \mathbb {E} \left[ \left(\mathcal {H} \left(r _ {x}\right) - y\right) ^ {2}\right) ]. \tag {7} +$$ + +Note that since the goal is to predict $y$ given $x$ , $\mathcal{H}(r_x) = \mathbb{E}(y|f(x))$ is a fair assumption to make. Substituting for $f(x)$ in Eq. 7 and using variance decomposition of $y$ onto $f(x)$ , we have, + +$$ +\mathbb {E} \left[ (\hat {y} - y) ^ {2} \right] = \operatorname {V a r} (\hat {y}) - \operatorname {V a r} \left(\mathcal {H} \left(r _ {x}\right)\right) + \mathbb {E} \left[ \left(\mathcal {H} \left(r _ {x}\right) - y\right) ^ {2} \right]. \tag {8} +$$ + +This decomposition is adopted from structured calibration techniques. A full derivation is presented in (25). The first term $\operatorname{Var}(\hat{y})$ is the variance in the prediction from $f(\cdot)$ . This term is the precision of $f(\cdot)$ and is low for a well trained network. The third term is the MSE function between the introspective network $\mathcal{H}(\cdot)$ and the ground truth. It is minimized while training the $\mathcal{H}(\cdot)$ network. The second term is the variance of the network $\mathcal{H}(\cdot)$ , given features $r_x$ . Note that minimizing Eq. 8 can occur by maximizing $\operatorname{Var}(\mathcal{H}(r_x))$ . We use a fisher vector interpretation from (17) to analyze $\operatorname{Var}(\mathcal{H}(r_x))$ . If $\mathcal{H}(\cdot)$ is a linear layer with parameters $W_{\mathcal{H}}$ , the $\operatorname{Var}(\mathcal{H}(r_x))$ term reduces to $W_{\mathcal{H}}^T W_{\mathcal{H}} \times \operatorname{Var}(r_x) \propto \operatorname{Tr}(r_x^T \Sigma^{-1} r_x)$ where $\Sigma$ is the covariance matrix. $\Sigma$ is a gaussian approximation for the shape of the manifold. Generalizing it to a higher dimensional manifold and replacing $\Sigma$ with $F$ , we have, + +$$ +\operatorname {V a r} \left(\mathcal {H} \left(r _ {x}\right)\right) = \operatorname {T r} \left(r _ {x} ^ {T} F ^ {- 1} r _ {x}\right), \tag {9} +$$ + +$$ +\operatorname {V a r} \left(\mathcal {H} \left(r _ {x}\right)\right) = \sum_ {j = 1} ^ {N} r _ {j} ^ {T} F ^ {- 1} r _ {j}. \tag {10} +$$ + +The RHS of Eq. [10] is a sum of fisher vectors taken across all possible labels. + +When do introspective networks provide robustness? We use Eq. [10] to analyze introspective learning usage. Specifically, we consider two cases: When input $x$ is taken from the training distribution $\mathcal{X}$ , and when it is taken from a noisy distribution $\mathcal{X}'$ . + +1. When a sample $x \in \mathcal{X}$ is provided to a network $f(\cdot)$ trained on $\mathcal{X}$ , all $r_j, j \neq \hat{y}$ in Eq. 10 tend to 0. The RHS reduces to $r_{\hat{y}}^T F^{-1} r_{\hat{y}}$ . $r_{\hat{y}}$ is a function of $f(x)$ only and hence adds no new information to the framework. The results of $\mathcal{H}(\cdot)$ remain the same as $f(\cdot)$ . In other words, given a trained ResNet-18 on CIFAR-10, the results of feed-forward learning will be the same as introspective learning on CIFAR-10 testset. +2. When a new sample $x' \notin \mathcal{X}$ is provided to a network $f(\cdot)$ trained on $\mathcal{X}$ , a fisher vector based projection across labels is more descriptive compared to a feed-forward approach. The $N$ gradients in Eq. [10] add new information based on how the network needs to change the manifold shape $F$ to accommodate the introspective gradients. Hence, given a distorted version of CIFAR-10 testset, our proposed introspective learning generalizes with a higher accuracy while providing calibrated outputs from Eq. [8]. We empirically illustrate these claims in Section 6. We motivate other applications including active learning, Out-Of-Distribution (OOD) detection, uncertainty estimation, and Image Quality Assessment (IQA) that are dependent on generalizability and calibration in Section 5. + +# 5 Related Works for Considered Applications + +Augmentations and Robustness The considered $r_x$ features from Eq. 6 can be considered as feature augmentations. Augmentations, including SimCLR (19), Augmix (26), adversarial augmentation (27), and noise augmentations (28) have shown to increase robustness of neural networks. We use introspection on top of non-augmented and augmented (Section 6) networks and show that our proposed two-stage framework increases the robustness to create generalizable and calibrated inferences which aids active learning and out-of-distribution (OOD) detection. The same framework that robustly recognizes images despite noise can also detect noise to make an out-of-distribution detection. + +Confidence and Uncertainty The existence of adversarial images (11) heuristically decouples the probability of neural network predictions from confidence and uncertainty. A number of works including (29) and (30) use bayesian formulation to provide uncertainty. However, in downstream tasks like active learning and Out-Of-Distribution (OOD) detection applications, existing state-of-the-art methods utilize softmax probability as confidences. This is because of the simplicity and ease of numerical computation of softmax. In active learning, uncertainty is quantified by the entropy (31), least confidence (31), or maximum margin (32) of predicted logits, or through extracted features in BADGE (33), and BALD (34). In OOD detection, (35) proposes Maximum Softmax Probability (MSP) as a baseline method by creating a threshold function on the softmax output. (36) proposes ODIN and improves on MSP by calibrating the network's softmax probability using temperature scaling (37). In this paper, we show that the proposed introspective features are better calibrated than their feed-forward counterparts. Hence existing methods in active learning and OOD detection have a superior performance when using $\mathcal{H}(\cdot)$ to make predictions. + +Human Introspection We are unaware of any direct application that tests visual human introspection. In its absence, we choose the application of Full-Reference Image Quality Assessment (FR-IQA) to connect machine vision with human vision. The goal in FR-IQA is to objectively estimate the subjective quality of an image. Humans are shown a pristine image along with a distorted image and asked to score the quality of the distorted image (38). This requires reflection on the part of the observers. We take an existing algorithm (39) and show that introspecting on top of this IQA technique brings its assessed scores closer to human scores. + +# 6 Experiments + +Across all applications except in Ablation studies in Table 9, we use a 3-layered MLP with sigmoid activations as $\mathcal{H}(\cdot)$ . The structure is presented in Appendix C.1. We first define robustness and calibration in the context of this paper. + +Robustness In this paper, without loss of consistency with related works, we say that the network trained on distribution $\mathcal{X}$ is robust if it correctly predicts on a shifted distribution $\mathcal{X}'$ . The difference in data distributions can be because of data acquisition setups, environmental conditions, distortions among others. We use CIFAR-10 for $\mathcal{X}$ and two distortion datasets - CIFAR-10C (27) and CIFAR-10-CURE (40) as $\mathcal{X}'$ . Generalization is measured through performance accuracy. + +Calibration Given a data distribution $x \in \mathcal{X}$ , belonging to any of $y \in [1, N]$ , a neural network provides two outputs - the decision $\hat{y}$ and the confidence associated with $\hat{y}$ , given by $\hat{p}$ . Let $p$ be the true probability empirically estimated as $p = \hat{p}_i, \forall i \in [1, M]$ . Then calibration is given by (37), + +$$ +\mathbb {P} (y = \hat {y} | p = \hat {p}) = p \tag {11} +$$ + +Calibration measures the difference between the confidence levels and the prediction accuracy. To showcase calibration we use the metric of Expected Calibration Error (ECE) as described in (37). The network predictions are placed in 10 separate bins based on their prediction confidences. Ideally, the accuracy equals the mid-point of confidence bins. The difference between accuracy and mid-point of bins, across bins is measured by ECE. Lower the ECE, better calibrated is the network. + +Datasets and networks CIFAR-10C consists of 950,000 images whose purpose is to evaluate the robustness of networks trained on original CIFAR-10 trainset. CIFAR-10C perturbs the CIFAR-10 testset using 19 distortions in 5 progressive levels. Hence, there are 95 separate $\mathcal{X}^{\prime}$ distributions to test on with each $\mathcal{X}^{\prime}$ consisting of 10000 images. Note that we are not using any distortions or data from CIFAR-10C as a validation split during training. The authors in (40) provide realistic distortions that they used to benchmark real-world recognition applications including Amazon Rekognition and Microsoft Azure. We use these distortions to perturb the test set of CIFAR-10. There are 6 distortions, each with 5 progressive levels. Of these 6 distortions - Salt and Pepper, Over Exposure, and Under Exposure noises are new compared to CIFAR-10C. We train four ResNet architectures - ResNet-18, 34, 50, and 101 (4). All four ResNets are evaluated as sensing networks $f(\cdot)$ . The training procedure and hyperparameters are presented in Appendix C.1 + +Testing on CIFAR-10 testset The trained networks are tested on CIFAR-10 testset with accuracies $91.02\%$ , $93.01\%$ , $93.09\%$ , and $93.11\%$ respectively. Next we extract $r_x$ on all training and testing images in CIFAR-10. $\mathcal{H}(\cdot)$ is trained using $r_x$ from the trainset using the same procedure as $f(\cdot)$ . When tested on $r_x$ of the testset, the accuracy for ResNets-18,34,50,101 is $90.93\%$ , $92.92\%$ , $93.17\%$ , + +![](images/f242de1e9999b81b82051088e67d51379aa9827bd4f492d4119ff24555e654f2.jpg) + +![](images/2ea2f217265d36904a58f1576e229d0703da0f849a3cd55daa9334af8866d164.jpg) + +![](images/7277e7b3cf6fe33dc28812dfb2cad0b5727df71be4faa0eb33dbc22189457f91.jpg) + +![](images/fb0d13c642bed1b96b06c6a8c738d60cd5eae613d9d250788f0dae45eff937ce.jpg) +Figure 4: Scatter plot with performance accuracy vs expected calibration error. Ideally, networks are in top left. Introspectivity increases performance accuracy while decreasing calibration error. +Figure 5: (a) ResNet-18 on CIFAR-10C. (b) Expected calibration error across 5 challenge levels in brightness and saturate distortions. Note that both these distortions do not affect the performance of the network and their feed-forward accuracy is high. The improvement in accuracy is statistically insignificant. However, introspection decreases the ECE across challenge levels. + +and $93.03\%$ . Note that this is similar to the feed-forward results. The average ECE of all feedforward and introspective networks is 0.04. Hence, when the test distribution is the same as training distribution there is no change in performance. + +Testing on CIFAR-10C and CIFAR-10-CURE The results of all networks averaged across distortions in both the datasets are shown in Fig. 4. Note that in each case, there is a shift leftward and upward indicating that the performance improves while the calibration error decreases. In the larger CIFAR-10C dataset, the introspective ResNet-18 performs similar to ResNets-34 and 50 in terms of accuracy while beating them both in calibration. A more fine-grained analysis is shown in Fig. 5 for ResNet-18. The blue bars in Fig. 5a) represent the feed-forward accuracy. The red bars are the introspective accuracy gains over the feed-forward accuracy. Among 7 of the 19 distortions, the accuracy gains are over $5\%$ . In Appendix C.2.1, we see that the gains are higher when the distortions are higher. Introspection performs well on blur-like distortions while struggling with distortions that disrupt the lower level characteristics of the image like brightness, contrast, and saturate. This can be attributed to the fact that $r_x$ are derived from the last layer of $f(\cdot)$ and are missing low-level + +statistics that are filtered out by network in the initial layers. However, in Fig. 5b), we show ECE for brightness and saturate distortions across all 5 distortion levels - higher the level, more is the distortion affecting $\mathcal{X}'$ . It can be seen that while the ECE for feed-forward networks increases across levels, the ECE for introspective networks decrease. Hence, even when there are no accuracy gains to be had, introspection helps in calibration. + +Plug-in results of Introspection Note that there are a number of techniques proposed to alleviate a neural network's robustness challenges against distortions. + +Table 1: Introspecting on top of existing robustness techniques. + +
METHODSACCURACY
RESNET-18FEED-FORWARD67.89%
INTROSPECTIVE71.4%
DENOISINGFEED-FORWARD65.02%
INTROSPECTIVE68.86%
ADVERSARIAL TRAIN (27)FEED-FORWARD68.02%
INTROSPECTIVE70.86%
SIMCLR (19)FEED-FORWARD70.28%
INTROSPECTIVE73.32%
AUGMENT NOISE (28)FEED-FORWARD76.86%
INTROSPECTIVE77.98%
AUGMIX (26)FEED-FORWARD89.85%
INTROSPECTIVE89.89%
+ +The authors in (28) show that finetuning VGG-16 using blurry training images increases the performance of classification under blurry conditions. (41) propose utilizing distorted virtual images to boost performance accuracy. The authors in (27) use adversarial images to augment the training data. All these works require knowledge of distortion or large amounts of new data during training. Our proposed method can infer introspectively on top of any existing $f(\cdot)$ enhanced using existing methods. In Table I, we show results of introspection as a plug-in approach on top of existing techniques. In all methods, introspection outperforms its feed-forward counterpart. While introspecting on top of Augmix, trained on WideResNet (26) provides insignificant recognition accuracy gains, introspection reduces ECE of Augmix network by $43.33\%$ . In Appendix C.2, we show performance on top of (28) and (27) of $6.8\%$ + +on Level 5 distortions. In Appendix C.3, we analyze SimCLR and show that introspecting on the self supervised features increases its CIFAR-10C performance by about $6\%$ on ResNet-101. A number of ablation studies including analysis of structure of $\mathcal{H}(\cdot)$ , loss functions, distortion levels on performance accuracy and ECE are shown in Appendix C.4. Moreover, we examine introspection when $\mathcal{X}'$ is domain shifted data from Office (42) dataset in Appendix C.6.1 + +Downstream Applications We consider four downstream applications: Active Learning, Out-of-Distribution detection, Uncertainty estimation, and Image Quality Assessment (IQA) to demonstrate the validity of introspection. Similar to recognition experiments, in all considered applications there is a distributional difference between train and testset. We show results that conform to Eq.10. We show statistically significant introspective IQA results in Appendix D.3 and Table 13 and uncertainty estimation results in Appendix D.4 + +Active Learning The goal in active learning is to decrease the test error in a model by choosing the best samples from a large pool of unlabeled data to annotate and train the model. A number of strategies are proposed to query the best samples. A full review of active learning and query strategies are given in (43). Existing active learning strategies define best samples to annotate as those samples that the model is either most uncertain about. This uncertainty is quantified by either entropy (31), least confidence (31), maximum margin (32), or through extracted features in BADGE (33), and BALD (34). We show the results of ResNet-18 and 34 architecture in Table 2. Implementations of all query strategies in Table 2 are taken from the codebase of (33) and reported as Feed-Forward results. Note that the query strategies act on $f(\cdot)$ to sample images at every round. Instead of sampling on $f(\cdot)$ , all query strategies sample using $\mathcal{H}(\cdot)$ in the Introspective results. The training, testing, and all strategies are the same as Feed-Forward from (33). Doing so we find similar results as recognition - on the original testset the active learning results are the same while there is a gain across strategies on Gaussian noise testset from CIFAR-10C. Note that the results shown are averaged over 20 rounds with a query batch size of a 1000 and initial random choice - which were kept same for $f(\cdot)$ and $\mathcal{H}(\cdot)$ - of 100. Further details, plots, and variances are shown in Appendix D.1 + +Out-of-distribution Detection The goal of Out-Of-Distribution (OOD) detection is to detect those samples that are drawn from a distribution $\mathcal{X}' \neq \mathcal{X}$ given a fully trained $f(\cdot)$ . A number of techniques are proposed to detect out-of-distribution samples. The authors in (35) propose Maximum Softmax Probability (MSP) as a baseline method by creating a threshold function on the softmax output. The authors in (36) propose ODIN and improved on MSP by calibrating the network's softmax probability using temperature scaling (37). In this paper, we illustrate that applying existing methods when applied on $\mathcal{H}(\cdot)$ , their detection performance is greater than if they were applied on the feed-forward + +Table 2: Recognition accuracy of Active Learning strategies. + +
MethodsArchitectureOriginal TestsetGaussian Noise
R-18R-34R-18R-34
Entropy (31)Feed-Forward0.3650.3580.2440.249
Introspective0.3650.3590.2580.255
Least (31)Feed-Forward0.3710.3590.2520.25
Introspective0.3730.3620.2640.26
Margin (32)Feed-Forward0.380.3690.2510.253
Introspective0.3810.3730.2650.263
BALD (34)Feed-Forward0.3930.3680.260.253
Introspective0.3960.3750.2730.263
BADGE (33)Feed-Forward0.3880.370.250.247
Introspective0.390.370.2650.260
+ +Table 3: Out-of-distribution Detection of existing techniques compared between feed-forward and introspective networks. + +
MethodsOOD DatasetsFPR (95% at TPR) ↓Detection Error ↓AUROC ↑
MSP (35)TexturesFeed-Forward/Introspective
SVHN58.74/19.6618.04/7.4988.56/97.79
Places36561.41/51.2716.92/15.6789.39/91.2
LSUN-C58.04/54.4317.01/15.0789.39/91.3
ODIN (36)Textures27.95/27.59.42/10.2996.07/95.73
SVHN52.3/9.3122.17/6.1284.91/91.9
Places36566.81/48.5223.51/15.8683.52/91.07
LSUN-C42.21/51.8716.23/15.7191.06/90.95
6.59/23.665.54/10.298.74/ 95.87
+ +$f(\cdot)$ . The code for OOD detection techniques are taken from (44) along with all hyperparameters and the training regimen for their reported DenseNet architecture. The temperature scaling coefficient for ODIN is set to 1000. Note that we do not use temperature scaling on $\mathcal{H}$ , to illustrate the effectiveness of our method. We use three established metrics to evaluate OOD detection - False Positive Rate (FPR) at $95\%$ True Positive Rate (TPR), Detection error, and AUROC. Ideally, AUROC values for a given method is high while the other two metrics are low. We use CIFAR-10 as our in-distribution dataset and use four OOD datasets - SVHN (45), Describable Textures Dataset (46), Places 365 (47), and LSUN (48). The results are presented in Table 3. Note that among the four datasets, textures and SVHN are more out-of-distribution from CIFAR-10 than the natural image datasets of Places365 and LSUN. The results of the introspective network is highest on Textures DTD dataset and gets progressively worse among the natural image datasets. Further analysis on networks and methods, along with their training regimen is provided in Appendix D.2 + +# 7 Discussion and Conclusion + +Limitations and future work The paper illustrates the benefits of utilizing the change in model parameters as a measure of model introspection. In Section 3.2 we accelerate the time complexity to $\mathcal{O}(1)$ . However, the space complexity is still dependent on $N$ . The paper uses an MLP for $\mathcal{H}(\cdot)$ and constructs $r_x$ by vectorizing extracted gradients. For datasets with large $N$ , usage of $r_x$ as a vector is prohibitive. Hence, a required future work is to provide a method of combining all $N$ gradients without vectorization. Also, our implementation uses serial gradient extraction across images. This is non-ideal since the available GPU resources are not fully utilized. A parallel implementation with per-sample gradient extraction (49) is a pertinent acceleration technique for the future. + +Broader and Societal Impact In his seminal book in 2011 (50), Daniel Kahneman outlines two systems of thought and reasoning in humans - a fast and instinctive 'system 1' that heuristically associates sensed patterns followed by a more deliberate and slower 'system 2' that examines and analyzes the data in context of intrinsic biases. Our framework derives its intuition based on these two systems of reasoning. The introspective explanations can serve to examine the intrinsic notions and biases that a network uses to categorize data. Note that the network $\mathcal{H}(\cdot)$ obtains its introspective answers through $f(\cdot)$ . Hence, similar to the 'system 2' reasoning in humans, any internal bias present in $f(\cdot)$ only gets strengthened in $\mathcal{H}(\cdot)$ through confirmation bias. The framework will benefit from a human intervention between $f(\cdot)$ and $\mathcal{H}(\cdot)$ in sensitive applications. One way would be to ask counterfactual questions by providing an established counterfactual and asking the network to reflect based on that. While the introspective framework will remain the same, the features will change. + +Conclusion We introduce the concept of introspection in neural networks as two separate stages in a network's decision process - the first is making a quick assessment based on sensed patterns in data and the second is reflecting on that assessment based on all possible decisions that could have been taken and making a final decision based on this reflection. We show that doing so increases the generalization performance of neural networks as measured against distributionally shifted data while reducing the calibration error of neural networks. Existing state-of-the-art methods in downstream tasks like active learning and out-of-distribution detection perform better in an introspective setting compared to a feed-forward setting especially when the distributional difference is high. + +# References + +[1] Edwin G Boring, “A history of introspection,” Psychological bulletin, vol. 50, no. 3, pp. 169, 1953. +[2] John Locke, An essay concerning human understanding, Kay & Troutman, 1847. +[3] Karen Simonyan and Andrew Zisserman, "Very deep convolutional networks for large-scale image recognition," in International Conference on Learning Representations, 2015. +[4] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun, "Deep residual learning for image recognition," in Proceedings of the IEEE conference on computer vision and pattern recognition, 2016, pp. 770-778. +[5] Gao Huang, Zhuang Liu, Laurens Van Der Maaten, and Kilian Q Weinberger, “Densely connected convolutional networks,” in Proceedings of the IEEE conference on computer vision and pattern recognition, 2017, pp. 4700–4708. +[6] Ramprasaath R Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra, "Grad-cam: Visual explanations from deep networks via gradient-based localization," in Proceedings of the IEEE international conference on computer vision, 2017, pp. 618-626. +[7] Johannes Schneider and Michalis Vlachos, “Reflective-net: Learning from explanations,” arXiv preprint arXiv:2011.13986, 2020. +[8] Ghassan AlRegib and Mohit Prabhushankar, “Explanatory paradigms in neural networks: Towards relevant and contextual explanations,” IEEE Signal Processing Magazine, vol. 39, no. 4, pp. 59–72, 2022. +[9] Mohit Prabhushankar, Gukyeong Kwon, Dogancan Temel, and Ghassan AlRegib, "Contrastive explanations in neural networks," in 2020 IEEE International Conference on Image Processing (ICIP). IEEE, 2020, pp. 3289-3293. +[10] Mohit Prabhushankar and Ghassan AlRegib, "Extracting causal visual features for limited label classification," in 2021 IEEE International Conference on Image Processing (ICIP). IEEE, 2021, pp. 3697-3701. +[11] Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy, “Explaining and harnessing adversarial examples,” arXiv preprint arXiv:1412.6572, 2014. +[12] Jinsol Lee and Ghassan AlRegib, "Gradients as a measure of uncertainty in neural networks," in 2020 IEEE International Conference on Image Processing (ICIP). IEEE, 2020, pp. 2416-2420. +[13] Gukyeong Kwon, Mohit Prabhushankar, Dogancan Temel, and Ghassan AlRegib, "Backpropagated gradient representations for anomaly detection," in European Conference on Computer Vision. Springer, 2020, pp. 206-226. +[14] Gukyeong Kwon, Mohit Prabhushankar, Dogancan Temel, and Ghassan AlRegib, “Novelty detection through model-based characterization of neural networks,” in 2020 IEEE International Conference on Image Processing (ICIP). IEEE, 2020, pp. 3179–3183. +[15] Yutong Sun, Mohit Prabhushankar, and Ghassan AlRegib, "Implicit saliency in deep neural networks," in 2020 IEEE International Conference on Image Processing (ICIP). IEEE, 2020, pp. 2915-2919. +[16] Tommi S Jaakkola, David Haussler, et al., "Exploiting generative models in discriminative classifiers," Advances in neural information processing systems, pp. 487-493, 1999. +[17] David A Cohn, “Neural network exploration using optimal experiment design,” 1994. +[18] Martin A Zinkevich, Alex Davies, and Dale Schuurmans, “Holographic feature representations of deep networks,” in UAI, 2017. + +[19] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton, "A simple framework for contrastive learning of visual representations," in International conference on machine learning. PMLR, 2020, pp. 1597-1607. +[20] Aurick Zhou and Sergey Levine, “Amortized conditional normalized maximum likelihood: Reliable out of distribution uncertainty estimation,” in International Conference on Machine Learning. PMLR, 2021, pp. 12803–12812. +[21] Koby Bibas, Yaniv Fogel, and Meir Feder, "Deep pnml: Predictive normalized maximum likelihood for deep neural networks," arXiv preprint arXiv:1904.12286, 2019. +[22] Fangzhou Mu, Yingyu Liang, and Yin Li, “Gradients as features for deep representation learning,” arXiv preprint arXiv:2004.05529, 2020. +[23] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei, "Imagenet: A large-scale hierarchical image database," in 2009 IEEE conference on computer vision and pattern recognition. IEEE, 2009, pp. 248-255. +[24] Yann LeCun, Léon Bottou, Yoshua Bengio, Patrick Haffner, et al., "Gradient-based learning applied to document recognition," Proceedings of the IEEE, vol. 86, no. 11, pp. 2278-2324, 1998. +[25] Volodymyr Kuleshov and Percy S Liang, “Calibrated structured prediction,” Advances in Neural Information Processing Systems, vol. 28, pp. 3474–3482, 2015. +[26] Dan Hendrycks, Norman Mu, Ekin D Cubuk, Barret Zoph, Justin Gilmer, and Balaji Lakshminarayanan, "Augmix: A simple data processing method to improve robustness and uncertainty," arXiv preprint arXiv:1912.02781, 2019. +[27] Dan Hendrycks and Thomas Dietterich, "Benchmarking neural network robustness to common corruptions and perturbations," arXiv preprint arXiv:1903.12261, 2019. +[28] Igor Vasiljevic, Ayan Chakrabarti, and Gregory Shakhnarovich, “Examining the impact of blur on recognition by convolutional networks,” arXiv preprint arXiv:1611.05760, 2016. +[29] Murat Sensoy, Lance Kaplan, and Melih Kandemir, "Evidential deep learning to quantify classification uncertainty," arXiv preprint arXiv:1806.01768, 2018. +[30] David JC MacKay, "Probable networks and plausible predictions-a review of practical bayesian methods for supervised neural networks," Network: computation in neural systems, vol. 6, no. 3, pp. 469, 1995. +[31] Dan Wang and Yi Shang, "A new active labeling method for deep learning," in 2014 International joint conference on neural networks (IJCNN). IEEE, 2014, pp. 112-119. +[32] Dan Roth and Kevin Small, “Margin-based active learning for structured output spaces,” in European Conference on Machine Learning. Springer, 2006, pp. 413–424. +[33] Jordan T Ash, Chicheng Zhang, Akshay Krishnamurthy, John Langford, and Alekh Agarwal, "Deep batch active learning by diverse, uncertain gradient lower bounds," arXiv preprint arXiv:1906.03671, 2019. +[34] Yarin Gal, Riashat Islam, and Zoubin Ghahramani, "Deep bayesian active learning with image data," in International Conference on Machine Learning. PMLR, 2017, pp. 1183-1192. +[35] Dan Hendrycks and Kevin Gimpel, “A baseline for detecting misclassified and out-of-distribution examples in neural networks,” arXiv preprint arXiv:1610.02136, 2016. +[36] Shiyu Liang, Yixuan Li, and Rayadurgam Srikant, “Enhancing the reliability of out-of-distribution image detection in neural networks,” arXiv preprint arXiv:1706.02690, 2017. +[37] Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q Weinberger, "On calibration of modern neural networks," in International Conference on Machine Learning. PMLR, 2017, pp. 1321-1330. + +[38] Hamid R Sheikh, Muhammad F Sabir, and Alan C Bovik, “A statistical evaluation of recent full reference image quality assessment algorithms,” IEEE Transactions on image processing, vol. 15, no. 11, pp. 3440–3451, 2006. +[39] Dogancan Temel, Mohit Prabhushankar, and Ghassan AlRegib, "Unique: Unsupervised image quality estimation," IEEE signal processing letters, vol. 23, no. 10, pp. 1414-1418, 2016. +[40] Dogancan Temel, Jinsol Lee, and Ghassan AlRegib, “Cure-or: Challenging unreal and real environments for object recognition,” in 2018 17th IEEE International Conference on Machine Learning and Applications (ICMLA). IEEE, 2018, pp. 137–144. +[41] Dogancan Temel, Gukyeong Kwon, Mohit Prabhuhankar, and Ghassan AlRegib, “CURE-TSR: Challenging unreal and real environments for traffic sign recognition,” Advances in Neural Information Processing Systems (NIPS) Machine Learning for Intelligent Transportations Systems Workshop, 2017. +[42] Kate Saenko, Brian Kulis, Mario Fritz, and Trevor Darrell, "Adapting visual category models to new domains," in European conference on computer vision. Springer, 2010, pp. 213-226. +[43] Burr Settles, "Active learning literature survey," 2009. +[44] Jiefeng Chen, Yixuan Li, Xi Wu, Yingyu Liang, and Somesh Jha, “Robust out-of-distribution detection for neural networks,” arXiv preprint arXiv:2003.09711, 2020. +[45] Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng, "Reading digits in natural images with unsupervised feature learning," 2011. +[46] M. Cimpoi, S. Maji, I. Kokkinos, S. Mohamed, , and A. Vedaldi, “Describing textures in the wild,” in Proceedings of the IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2014. +[47] Bolei Zhou, Agata Lapedriza, Aditya Khosla, Aude Oliva, and Antonio Torralba, "Places: A 10 million image database for scene recognition," IEEE transactions on pattern analysis and machine intelligence, vol. 40, no. 6, pp. 1452-1464, 2017. +[48] Fisher Yu, Ari Seff, Yinda Zhang, Shuran Song, Thomas Funkhouser, and Jianxiong Xiao, "Lsun: Construction of a large-scale image dataset using deep learning with humans in the loop," arXiv preprint arXiv:1506.03365, 2015. +[49] Ian Goodfellow, "Efficient per-example gradient computations," arXiv preprint arXiv:1510.01799, 2015. +[50] Daniel Kahneman, Thinking, fast and slow, Macmillan, 2011. +[51] Wilhelm Max Wundt, Grundzüge der physiologischen Psychologie, vol. 1, W. Engelman, 1874. +[52] Eric Schwitzgebel, “Introspection,” in The Stanford Encyclopedia of Philosophy, Edward N. Zalta, Ed. Metaphysics Research Lab, Stanford University, winter 2019 edition, 2019. +[53] Charles Sanders Peirce, Collected papers of charles sanders peirce, Harvard University Press, 1931. +[54] Gabriele Paul, "Approaches to abductive reasoning: an overview," Artificial intelligence review, vol. 7, no. 2, pp. 109-152, 1993. +[55] Mohit Prabhushankar and Ghassan AlRegib, “Contrastive reasoning in neural networks,” arXiv preprint arXiv:2103.12329, 2021. +[56] Jonathan Krause, Michael Stark, Jia Deng, and Li Fei-Fei, "3d object representations for fine-grained categorization," in 4th International IEEE Workshop on 3D Representation and Recognition (3dRR-13), Sydney, Australia, 2013. +[57] Yazeed Alaudah, Motaz Alfarraj, and Ghassan AlRegib, “Structure label prediction using similarity-based retrieval and weakly supervised label mapping,” Geophysics, vol. 84, no. 1, pp. V67–V79, 2018. + +[58] Muhammad A Shafiq, Mohit Prabhushankar, Haibin Di, and Ghassan AlRegib, "Towards understanding common features between natural and seismic images," in SEG Technical Program Expanded Abstracts 2018, pp. 2076-2080. Society of Exploration Geophysicists, 2018. +[59] Xingchao Peng, Ben Usman, Neela Kaushik, Judy Hoffman, Dequan Wang, and Kate Saenko, "Visda: The visual domain adaptation challenge," arXiv preprint arXiv:1710.06924, 2017. +[60] N. Ponomarenko, O. Ieremeiev, V. Lukin, K. Egiazarian, and M. Carli, “Modified image visual quality metrics for contrast change and mean shift accounting,” in Proc. CADSM, 2011, pp. 305–311. +[61] Z. Wang and Q. Li, "Information content weighting for perceptual image quality assessment," IEEE Trans. Image Proc., vol. 20, no. 5, pp. 1185-1198, 2011. +[62] L. Zhang and H. Li, "SR-SIM: A fast and high performance iqa index based on spectral residual," in IEEE Int. Conf. Image Proc., 2012, pp. 1473-1476. +[63] L. Zhang, L. Zhang, X. Mou, D. Zhang, et al., "Fsim: a feature similarity index for image quality assessment," IEEE Trans. Image Proc., vol. 20, no. 8, pp. 2378-2386, 2011. +[64] D. Temel and G. AlRegib, “PerSIM: Multi-resolution image quality assessment in the perceptually uniform color domain,” in IEEE Int. Conf. Image Proc., 2015, pp. 1682–1686. +[65] D. Temel and G. AlRegib, "CSV: Image quality assessment based on color, structure, and visual system," Sig. Proc.: Image Comm., vol. 48, pp. 92 - 103, 2016. +[66] D. Temel and G. AlRegib, “Perceptual image quality assessment through spectral analysis of error representations,” Sig. Proc.: Image Comm., 2019. +[67] Mohit Prabhushankar, Dogancan Temel, and Ghassan AlRegib, "Generating adaptive and robust filter sets using an unsupervised learning framework," in 2017 IEEE International Conference on Image Processing (ICIP). IEEE, 2017, pp. 3041-3045. +[68] Mohit Prabhushankar, Dogancan Temel, and Ghassan AlRegib, "Ms-unique: Multi-model and sharpness-weighted unsupervised image quality estimation," *Electronic Imaging*, vol. 2017, no. 12, pp. 30–35, 2017. +[69] Dinesh Jayaraman, Anish Mittal, Anush K Moorthy, and Alan C Bovik, “Objective quality assessment of multiply distorted images,” in 2012 Conference record of the forty sixth asilomar conference on signals, systems and computers (ASILOMAR). IEEE, 2012, pp. 1693–1697. +[70] Nikolay Ponomarenko, Lina Jin, Oleg Ieremeiev, Vladimir Lukin, Karen Egiazarian, Jaakko Astola, Benoit Vozel, Kacem Chehdi, Marco Carli, Federica Battisti, et al., "Image database tid2013: Peculiarities, results and perspectives," Signal processing: Image communication, vol. 30, pp. 57-77, 2015. +[71] Moloud Abdar, Farhad Pourpanah, Sadiq Hussain, Dana Rezazadegan, Li Liu, Mohammad Ghavamzadeh, Paul Fieguth, Xiaochun Cao, Abbas Khosravi, U Rajendra Acharya, et al., “A review of uncertainty quantification in deep learning: Techniques, applications and challenges,” Information Fusion, vol. 76, pp. 243–297, 2021. +[72] Yarin Gal and Zoubin Ghahramani, “Dropout as a bayesian approximation: Representing model uncertainty in deep learning,” in international conference on machine learning. PMLR, 2016, pp. 1050–1059. +[73] Durk P Kingma, Tim Salimans, and Max Welling, "Variational dropout and the local reparameterization trick," Advances in neural information processing systems, vol. 28, 2015. +[74] Dequan Wang, Evan Shelhamer, Shaoteng Liu, Bruno Olshausen, and Trevor Darrell, "Tent: Fully test-time adaptation by entropy minimization," arXiv preprint arXiv:2006.10726, 2020. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes]. See Section 7. +(c) Did you discuss any potential negative societal impacts of your work? [Yes]. See Section 7 +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] +(b) Did you include complete proofs of all theoretical results? [Yes]. See Appendix B + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [No]. The code will be made public upon acceptance. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]. See Section 6 and Appendix C.1 +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]. See Appendix D +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)?[Yes] in Appendix E + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes]. See Appendix E +(b) Did you mention the license of the assets? [Yes]. See Appendix E +(c) Did you include any new assets either in the supplemental material or as a URL? [No] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [No] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/introspectivelearningatwostageapproachforinferenceinneuralnetworks/images.zip b/introspectivelearningatwostageapproachforinferenceinneuralnetworks/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..46e6d5bef1d33611e7891e9425158ebf3f5ac24f --- /dev/null +++ b/introspectivelearningatwostageapproachforinferenceinneuralnetworks/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca14bd914ce5db2ae8de84a4875f222c0ac96c80f8e9bc67343060e79f89a361 +size 450741 diff --git a/introspectivelearningatwostageapproachforinferenceinneuralnetworks/layout.json b/introspectivelearningatwostageapproachforinferenceinneuralnetworks/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..240283f8719ac154cdd3dc2da8fa4bc982fb44d5 --- /dev/null +++ b/introspectivelearningatwostageapproachforinferenceinneuralnetworks/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bc3e0980b354673d0118d857d6b0d5b3a1cc008a69746999a20df8b31ce6ebd5 +size 615629 diff --git a/invarianceawarerandomizedsmoothingcertificates/d3bdae8b-81ba-445d-b52e-22b0e34835b8_content_list.json b/invarianceawarerandomizedsmoothingcertificates/d3bdae8b-81ba-445d-b52e-22b0e34835b8_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..6067fd27967da61876de84c8b08d02ce9afa7d54 --- /dev/null +++ b/invarianceawarerandomizedsmoothingcertificates/d3bdae8b-81ba-445d-b52e-22b0e34835b8_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:afa5dc4b12ce66cfff2ce343c3d725f5a7f1c906fbcb00c4cc573c5710c74cbf +size 112293 diff --git a/invarianceawarerandomizedsmoothingcertificates/d3bdae8b-81ba-445d-b52e-22b0e34835b8_model.json b/invarianceawarerandomizedsmoothingcertificates/d3bdae8b-81ba-445d-b52e-22b0e34835b8_model.json new file mode 100644 index 0000000000000000000000000000000000000000..bdaa33f57512c7d57837964b2dae6c472acb05c6 --- /dev/null +++ b/invarianceawarerandomizedsmoothingcertificates/d3bdae8b-81ba-445d-b52e-22b0e34835b8_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:663440fd26bac30cefef5e53c9debf44b73f852854a1d7233fd3fdf25fd91a3c +size 153071 diff --git a/invarianceawarerandomizedsmoothingcertificates/d3bdae8b-81ba-445d-b52e-22b0e34835b8_origin.pdf b/invarianceawarerandomizedsmoothingcertificates/d3bdae8b-81ba-445d-b52e-22b0e34835b8_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..ace48dc886799c4a5778e74dd1c217bcf2ce3e40 --- /dev/null +++ b/invarianceawarerandomizedsmoothingcertificates/d3bdae8b-81ba-445d-b52e-22b0e34835b8_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be6de3adc4f188e09487a589ce9e72de5b41580a5420e4a00cf86f47af7f6b44 +size 616333 diff --git a/invarianceawarerandomizedsmoothingcertificates/full.md b/invarianceawarerandomizedsmoothingcertificates/full.md new file mode 100644 index 0000000000000000000000000000000000000000..b3fe5e813881cb469d6c62cdb255ecad7bd8a9c5 --- /dev/null +++ b/invarianceawarerandomizedsmoothingcertificates/full.md @@ -0,0 +1,469 @@ +# Invariance-Aware Randomized Smoothing Certificates + +Jan Schuchardt + +Technical University of Munich + +j.schuchardt@tum.de + +Stephan Gunnemann + +Technical University of Munich + +s.guennemann@tum.de + +# Abstract + +Building models that comply with the invariances inherent to different domains, such as invariance under translation or rotation, is a key aspect of applying machine learning to real world problems like molecular property prediction, medical imaging, protein folding or LiDAR classification. For the first time, we study how the invariances of a model can be leveraged to provably guarantee the robustness of its predictions. We propose a gray-box approach, enhancing the powerful black-box randomized smoothing technique with white-box knowledge about invariances. First, we develop gray-box certificates based on group orbits, which can be applied to arbitrary models with invariance under permutation and Euclidean isometries. Then, we derive provably tight gray-box certificates. We experimentally demonstrate that the provably tight certificates can offer much stronger guarantees, but that in practical scenarios the orbit-based method is a good approximation. + +# 1 Introduction + +It is well-established that machine learning models are susceptible to adversarial attacks [1-4]. Even without malevolent actors, adversarial attacks can be considered worst case scenarios in environments with noisy, erroneous or otherwise corrupted data, thus necessitating robust machine learning methods. + +Invariance is a central design principle that has so far received little dedicated attention in the realm of adversarially robust machine learning. Over the past decades, there has been ongoing research into developing machine learning models that comply with the invariances inherent to different data types and tasks. Prominent recent examples include Deep Sets [5], PointNet [6], Group Equivariant CNNs [7], Spherical CNNs [8] and Graph Convolutional Networks [9], but the study of invariant models significantly precedes the surge in popularity of deep learning methods [10-15]. + +For the first time, we explore the following question: Can a-priori knowledge about invariances be leveraged in deriving provable guarantees for a model's robustness to adversarial attacks? + +Going by a loose categorization of prior work, we could adopt one of two possible approaches for our exploration: A white-box or black-box one. White-box certificates (e.g. [16-23]) analyze a model's internals, such as its weights and non-linearities, to provably guarantee that a prediction does not change under adversarial attack. Black box certificates – specifically randomized smoothing [24-26] – use statistical methods to provide provable guarantees that hold for all models sharing the same prediction probabilities under a random input distribution, irrespective of their internals. + +We opt for a randomized smoothing approach, as it allows us to focus on the interplay between invariances and robustness, rather than the specific means of implementing these invariances. By combining white-box knowledge about invariances with black-box knowledge about prediction probabilities we obtain gray-box certificates. We first derive a gray-box certificate that follows a post-processing paradigm: It takes an existing black-box certificate and augments the certified region using information about the model's invariances. This orbit-based certificate serves as a baseline for the provably tight gray-box certificates we derive in subsequent sections. + +For our exploration, we focus on models operating on spatial data, rather than structured data (e.g. images and sequences) – both because spatial symmetries can be elegantly formalized using algebraic concepts and because there is an ongoing trend towards using machine learning for real-world applications with inherent spatial invariances, e.g. molecular property prediction [27–34], LiDAR classification [35–38], drug discovery [39–41], particle physics [42–44] and protein folding [45–49]. + +Our main contributions are + +- the first study on the interplay of invariance and certifiable robustness, +- a principled method for deriving tight invariance-aware randomized smoothing certificates, +- tight certificates for models invariant to translations and rotations. + +We further demonstrate experimentally that the orbit-based certificates offer a good approximation of our tight certificates, if the variance of the smoothing distribution is small. + +# 2 Related work + +Invariant machine learning. Given the diversity of approaches to invariant machine learning, and the fact that our approach is model-agnostic, we refrain from attempting a survey and instead refer to [50] for a principled, high-level introduction into the realm of learning with invariances and equivariances. + +Invariance and robustness. Two recent empirical studies [51, 52] demonstrate that data augmentation meant to increase robustness to $\ell_p$ -norm adversarial attacks reduces robustness to semantically meaningful transformations (e.g. rotation) and vice-versa, suggesting an inherent invariance-robustness trade-off. However, neither study models that are invariant by design. In [53], the negative effect of translation-invariance on the robustness of image classifiers is investigated. Note that our work is not meant to resolve potential trade-offs, but to tightly bound the actual robustness of models. + +Gray-box certificates. While we propose the first gray-box certificate for invariant models, there exists prior work on combining white-box knowledge with black-box certification. In [54] and [55], knowledge about a classifier's gradients is used to derive tighter randomized smoothing certificates. In [56], knowledge about a graph neural network's receptive fields is used to derive collective gray-box certificates for multiple predictions. In [57], the message-passing scheme of graph neural networks is used for gray-box certification against adversaries that control all features of multiple nodes. + +Adversarial attacks on spatial data. Adversarial attacks on spatial data either modify [58-66], insert [65, 67, 68], or delete [69-71] points in space and have been particularly actively studied for point cloud-classification. While the earliest work simply adopted gradient-based attacks from the image domain [58], more recent work has developed a rich assortment of domain-specific methods, for example to preserve object smoothness [64, 72], leverage critical points [69, 70] or craft physically realizable attacks (e.g. to attack models through LiDAR sensors) [61, 73-75]. Of particular note are attacks via isometries (e.g. rotations and translations) [76, 77], whose effectiveness motivates the use of invariant models. Note that we certify the robustness of invariant models to arbitrary point modification attacks – not just isometry attacks (see also “orthogonal research directions” below). Like in other domains, empirical defenses have been proposed [59, 78, 79] and subsequently broken [80-82], motivating the development of black-box [83-85] and white-box [86] robustness certificates for spatial data. It should be noted that Gaussian randomized smoothing, without invariance information, has already been used in prior work – either as a baseline [83] or as a special case of the respective certificate [85]. + +Orthogonal research directions. One related but orthogonal research direction is transformation-specific certification [23, 85-93]. There, a model is assumed to potentially change its prediction under adversarial parametric transformations (e.g. rotations) and one certifies robustness for specific parameter ranges. White-box methods [23, 86-89] over-approximate the set of inputs reachable by a transformation and then propagate it through a model using existing white-box techniques. Black-box methods – namely transformation-specific randomized smoothing [90, 94] – randomize the transformation parameters to provide robustness guarantees for arbitrary models via statistical methods. Later work generalized this principle to spatial data [85], vector-field deformations [92] and multiplicative parameters [93]. Different from these methods, we assume our model to be invariant under a set of transformations, i.e. never change its prediction. We use this property as a tool for certification against arbitrary perturbations. Aside from that, there exist white-box certification techniques for specific operations with invariances (e.g. global max-pooling [86], message passing [95, 96] and batch normalization [97]). But prior work does not use or even discuss this property – it treats these invariant + +operations as coincidental building blocks of the models it is trying to certify. Our work is the first to study invariance itself in the context of provable robustness and how to leverage it for certification. + +# 3 Background + +# 3.1 Randomized smoothing + +Randomized smoothing is a black-box certification technique that can be adapted to various data types, tasks and threat models [98-103, 91, 104-106]. Instead of directly certifying a classifier $g$ , it constructs a smoothed classifier $f$ that returns the most likely prediction under random perturbations of its input. It then certifies the robustness of this smoothed classifier. We present the tight Gaussian smoothing certificate derived by Cohen et al. [26] and its generalization to matrix data [83, 85]. + +Assume a continuous $(N\times D)$ -dimensional input space $\mathbb{R}^{N\times D}$ , label set $\mathbb{Y}$ and base classifier $g:\mathbb{R}^{N\times D}\to \mathbb{Y}$ . Let $\mu_{\pmb{X}}(\pmb {Z}) = \prod_{d = 1}^{D}\mathcal{N}\left(\pmb{Z}_{:,d}\mid \pmb{X}_{:,d},\sigma^2\mathbf{I}_N\right)$ be the isotropic matrix normal distribution with mean $\pmb{X}$ and standard deviation $\sigma$ . Let $p_{\pmb{X},y} = \operatorname*{Pr}_{\pmb{Z}\sim \mu_{\pmb{X}}}[g(\pmb {Z}) = y]$ be the probability of $g$ predicting class $y$ under this smoothing distribution. One can then define a smoothed classifier $f(\pmb {X}) = \mathrm{argmax}_{y\in \mathbb{Y}}p_{\pmb{X},y}$ that returns the most likely prediction of $g$ under $\mu_{\pmb{X}}$ . + +Let $y^{*} = f(\pmb{X})$ be a smoothed prediction and $\pmb{X}' = \pmb{X} + \pmb{\Delta}$ a perturbed input. One can show $f(\pmb{X}') = y^{*}$ by proving that, for perturbed input $\pmb{X}'$ , $y^{*}$ is more likely than all other classes combined. That is, $p_{\pmb{X}',y^{*}} > 0.5$ . A tighter certificate can be obtained by proving that $y^{*}$ is more likely than the second most likely class, i.e., $p_{\pmb{X}',y^{*}} > \max_{y' \neq y^{*}} p_{\pmb{X}',y'}$ . For the sake of exposition, we use the first approach throughout the main text and generalize all results to the second one in Appendix H. One can lower-bound $p_{\pmb{X}',y^{*}}$ by finding the worst-case classifier from a set of functions $\mathbb{H}$ with $g \in \mathbb{H}$ : + +$$ +p _ {\mathbf {X} ^ {\prime}, y ^ {*}} \geq \min _ {h \in \mathbb {H}} \Pr_ {\mathbf {Z} \sim \mu_ {\mathbf {X} ^ {\prime}}} [ h (\mathbf {Z}) = y ^ {*} ]. \tag {1} +$$ + +For $\mathbb{H} = \left\{h:\mathbb{R}^{N\times D}\to \mathbb{Y}\mid \operatorname *{Pr}_{Z\sim \mu_X}\left[h(Z) = y^*\right]\geq p_{X,y^*}\right\}$ , the classifiers that are at least as likely as $g$ to classify $\pmb{X}$ as $y^{*}$ , the exact solution is given by the Neyman-Pearson lemma [107] (see Appendix F.2). The optimal value is $\Phi \left(\Phi^{-1}(p_{X,y^*}) - \frac{||\Delta||_2}{\sigma}\right)$ , where $\Phi$ is the standard-normal CDF and $||\cdot ||_2$ is the Frobenius norm. If $||\Delta ||_2 < \sigma \Phi^{-1}(p_{X,y^*})$ , then $p_{X',y^*} > 0.5$ and the prediction is provably robust. Because Eq. (1) was solved exactly, this is a tight certificate, i.e. the best possible certificate that can be obtained by only using black-box knowledge about prediction probability $p_{X,y^*}$ . + +Probabilistic certificates. For neural networks, the prediction probability $p_{\mathbf{X},y^*}$ can usually not be computed analytically. Instead, one has to use Monte Carlo sampling to compute a lower confidence bound $p_{\mathbf{x}',y^*}$ that holds with high probability $1 - \alpha$ . The resulting certificate is a probabilistic one. + +# 3.2 Group invariance + +Let $f: \mathbb{R}^{N \times D} \to \mathbb{Y}$ be a classifier and $\mathbb{T}$ a group, i.e. a set and associated operator $\cdot: \mathbb{T} \times \mathbb{T} \to \mathbb{T}$ that is closed and associative under the operation, has an inverse $t^{-1}$ for each element $t \in \mathbb{T}$ and features an identity element $e$ . Further let $\mathbb{T}$ act on the input space via a group action $\circ: \mathbb{T} \times \mathbb{R}^{N \times D} \to \mathbb{R}^{N \times D}$ that preserves the group structure, i.e. $(t \cdot t') \circ X = t \circ (t' \circ X)$ . Group actions naturally partition the domain into orbits, i.e. sets that can be reached by applying group actions to inputs: + +Definition 1 (Orbits). The orbit of an input $\mathbf{X} \in \mathbb{R}^{N \times D}$ w.r.t. a group $\mathbb{T}$ is $[\mathbf{X}]_{\mathbb{T}} = \{t \circ \mathbf{X} \mid t \in \mathbb{T}\}$ . + +Classifier $f$ is said to be invariant under group $\mathbb{T}$ if $\forall \pmb {X}\in \mathbb{R}^{N\times D},\forall \pmb {X}'\in [\pmb {X}]_{\mathbb{T}}:f(\pmb {X}) = f(\pmb {X}')$ + +# 3.3 Haar measures + +Haar measures [108] are a generalization of Lebesgue measures for integration over groups. Their key property is invariance, meaning the group operator does not affect the measure. + +Definition 2 (Right Haar measure). Let $\eta$ be a finite, regular measure on the Borel subsets of $\mathbb{T}$ . If $\eta(\mathbb{S}) = \eta(\{s \cdot t \mid s \in \mathbb{S}\})$ for all $t \in \mathbb{T}$ and Borel subsets $\mathbb{S} \subseteq \mathbb{T}$ , then $\eta$ is a right Haar measure. + +For the groups we consider, the Haar measure is unique up to a multiplicative constant [109, 110]. In Section 6.1 we use Haar measures as a notational tool to summarize certificates for different groups. However, an understanding of measure theory is not required to follow any part of the derivations. + +![](images/f952c21c0dc083bdefcce8e6aa818f2b4a6ee2b2fcfdd7d4c6ad383d987e7995.jpg) +(a) Robustness for individual points + +![](images/dbb607cf0eddce82ebb663565755c44ba2c744fce06d049f321615d427a58b04.jpg) +(b) Augmented certified region +Figure 1: Orbit-based gray-box certificate for translation invariance and $N = 2, D = 1$ . a.) Input $X'$ can be translated into certified region $\mathbb{B}$ . It is not an adversarial example. Input $X''$ can not be translated into $\mathbb{B}$ . It might be an adversarial example. b.) The prediction $y^{*} = f(\boldsymbol{X})$ is certifiably robust to all perturbed inputs from augmented region $\tilde{\mathbb{B}}$ , the union over all translations of $\mathbb{B}$ . + +# 4 Problem setting + +We consider a similar setup to that described in Section 3.1, i.e. we have a smoothed classifier $f: \mathbb{R}^{N \times D} \to \mathbb{Y}$ that is the result of randomly smoothing a base classifier $g$ with an isotropic matrix normal distribution $\mu_{\mathbf{X}}$ . Given a clean prediction $y^{*} = f(\mathbf{X})$ with clean prediction probability $p_{\mathbf{X},y^{*}}$ , we want to determine whether $f(\mathbf{X}') = y^{*}$ for an adversarially perturbed input $\mathbf{X}' = \mathbf{X} + \Delta$ . + +Different from all prior work, we additionally assume that the base classifier $g$ is invariant under a group $\mathbb{T}$ . This does not necessarily mean that the smoothed classifier $f$ shares the same invariances. But, we can use the isotropy of smoothing distribution $\mu_{X}$ to prove (see Appendix D) that randomized smoothing preserves invariance under Euclidean isotropies (rotation, reflection and translation) and permutation, which we shall leverage in Section 5. + +Theorem 1. Let base classifier $g: \mathbb{R}^{N \times D} \to \mathbb{Y}$ be invariant under group $\mathbb{T}$ with $\mathbb{T} \subseteq E(D)$ or $\mathbb{T} \subseteq S(N)$ , where $E(D)$ is the Euclidean group and $S(N)$ is the permutation group. Then the isotropically smoothed classifier $f$ , as defined in Section 3.1, is also invariant under $\mathbb{T}$ . + +Note that the above result also holds for subgroups of $E(D)$ , such as the translation group $T(D)$ , the rotation group $SO(D)$ and the roto-translation group $SE(D)$ . We define these groups and their actions on $\mathbb{R}^{N\times D}$ more formally in Appendix C. + +# 5 Orbit-based gray-box certificates + +Since we are the first to consider robustness certification for invariant models, we begin by defining a baseline that other certificates can be benchmarked against: It is based on the insight that certificates correspond to sets of inputs $\mathbb{B} \subseteq \mathbb{R}^{N \times D}$ that preserve clean prediction $y^*$ , and group $\mathbb{T}$ corresponds to sets of transformations that preserve predictions. By transitivity, a perturbed input $\pmb{X}'$ that can reach $\mathbb{B}$ via a transformation from $\mathbb{T}$ , i.e. $\exists t \in \mathbb{T}: t \circ \pmb{X}' \in \mathbb{B}$ , must fulfill $f(\pmb{X}') = y^*$ and cannot be an adversarial example. Combining all such inputs, i.e. combining the orbits of elements of $\mathbb{B}$ (see Definition 1), yields an augmented certified region $\tilde{\mathbb{B}} \supseteq \mathbb{B}$ (proof in Appendix E.1): + +Theorem 2 (Orbit-based certificates). Let $f \in \mathbb{R}^{N \times D} \to \mathbb{Y}$ be invariant under a group $\mathbb{T}$ . Let $y^* = f(\pmb{X})$ be a prediction that is certifiably robust to a set of perturbed inputs $\mathbb{B} \subseteq \mathbb{R}^{N \times D}$ , i.e. $\forall Z \in \mathbb{B}: f(Z) = y^*$ . Let $\tilde{\mathbb{B}} = \cup_{Z \in \mathbb{B}} [Z]_{\mathbb{T}}$ . Then $\forall X' \in \tilde{\mathbb{B}}: f(X') = y^*$ . + +This orbit-based approach is illustrated in Fig. 1. While we focus on randomized smoothing, Theorem 2 holds for arbitrary models and certified regions $\mathbb{B}$ . However, obtaining $\mathbb{B}$ via other means may not be possible. For instance, there exist no white-box certificates for rotation-invariant models. + +Because randomized smoothing preserves invariance to Euclidean isometries and permutation (see Theorem 1), we may apply the orbit-based approach with $\mathbb{T} \subseteq E(D)$ or $\mathbb{T} \subseteq S(N)$ to the certified region $\mathbb{B} = \{\pmb{X} + \pmb{\Delta} \mid ||\pmb{\Delta}||_2 < r\}$ with $r = \sigma \Phi^{-1}(p_{\pmb{X},y^*})$ that we derived in Section 3.1. + +While $\tilde{\mathbb{B}} = \cup_{Z\in \mathbb{B}}[Z]_{\mathbb{T}}$ , is a valid certificate, one may desire an equivalent, but more explicit characterization of the certified region $\tilde{\mathbb{B}}$ to determine whether a specific perturbed input preserves the prediction $y^{*}$ . We discuss such explicit characterizations in Appendix E. In particular, translation invariance (i.e. $\mathbb{T} = T(D)$ ) leads to certified region $\tilde{\mathbb{B}} = \left\{X + \Delta \mid ||\Delta -\mathbf{1}_N\overline{\Delta} ||_2 < r\right\}$ , where + +$\overline{\Delta} \in \mathbb{R}^{1 \times D}$ are column-wise averages and $r$ is defined as above. Rotation invariance (i.e. $\mathbb{T} = SO(D)$ ) leads to certified region $\tilde{\mathbb{B}} = \left\{X' \mid ||X'R^T - X||_2 < r\right\}$ , where $\pmb{R}$ is an optimal rotation matrix defined by the singular value decomposition of $X^T X'$ [111, 112] (see Appendix E.2.2). + +# 6 Tight gray-box certificates + +Now that we have established a baseline for gray-box certification, one may naturally wonder about its optimality. We answer this by deriving tight gray-box certificates, i.e. the best certificates that can be obtained for prediction $y^{*}$ using only the invariances of base classifier $g$ under group $\mathbb{T}$ and its prediction probability $p_{\pmb{X},y^{*}}$ under clean smoothing distribution $\mu_{\pmb{X}}$ . Similar to Section 3.1, we do so by finding a worst-case classifier. In addition to constraining its clean prediction probability, we constrain the classifier to be invariant under $\mathbb{T}$ , i.e. solve $\min_{h\in \mathbb{H}_{\mathbb{T}}} \operatorname{Pr}_{\pmb{Z}\sim \mu_{\pmb{X}^{\prime}}}[h(\pmb{Z}) = y^{*}]$ with + +$$ +\mathbb {H} _ {\mathbb {T}} = \left\{h: \mathbb {R} ^ {N \times D} \rightarrow \mathbb {Y} \mid \Pr_ {\boldsymbol {Z} \sim \mu_ {\boldsymbol {X}}} [ h (\boldsymbol {Z}) = y ^ {*} ] \geq p _ {\boldsymbol {X}, y ^ {*}}, \forall \boldsymbol {Z}, \forall \boldsymbol {Z} ^ {\prime} \in [ \boldsymbol {Z} ] _ {\mathbb {T}}: h (\boldsymbol {Z}) = h \left(\boldsymbol {Z} ^ {\prime}\right)\right\}, \tag {2} +$$ + +where $[Z]_{\mathbb{T}}$ is the orbit of $Z$ w.r.t. $\mathbb{T}$ (see Definition 1). In the following, we show how to solve the above optimization problem and then apply our certification methodology to specific invariances. + +# 6.1 Certification methodology + +To work with invariance constraints, it is convenient to not think of $h$ as a function, but a family of variables $(h_{\mathbf{Z}}) \in \mathbb{Y}$ indexed by $\mathbb{R}^{N \times D}$ . The invariance constraint states that all variables from an orbit should have the same value, i.e. $\forall \mathbf{Z}, \forall \mathbf{Z}' \in [\mathbf{Z}]_{\mathbb{T}} : h_{\mathbf{Z}} = h_{\mathbf{Z}'}$ . Intuitively, the constraint can be enforced by replacing all these variables with a single variable. We propose to formalize this idea by using canonical maps, which map all inputs from an orbit to a single, distinct representative: + +Definition 3 (Canonical map). A canonical map for invariance under a group of transformations $\mathbb{T}$ is a function $\gamma : \mathbb{R}^{N \times D} \to \mathbb{R}^{N \times D}$ with + +$$ +\forall \boldsymbol {Z} \in \mathbb {R} ^ {N \times D}: \gamma (\boldsymbol {Z}) \in [ \boldsymbol {Z} ] _ {\mathbb {T}}, \tag {3} +$$ + +$$ +\forall \boldsymbol {Z} \in \mathbb {R} ^ {N \times D}, \forall \boldsymbol {Z} ^ {\prime} \in [ \boldsymbol {Z} ] _ {\mathbb {T}}: \gamma (\boldsymbol {Z}) = \gamma \left(\boldsymbol {Z} ^ {\prime}\right). \tag {4} +$$ + +In Appendix F.1, we prove that canonical maps let us discard the invariance constraints: + +Lemma 1. Let $g: \mathbb{R}^{N \times D} \to \mathbb{Y}$ be invariant under group $\mathbb{T}$ and let $\mathbb{H}_{\mathbb{T}}$ be defined as in Eq. (2). If $\gamma: \mathbb{R}^{N \times D} \to \mathbb{R}^{N \times D}$ is a canonical map for invariance under $\mathbb{T}$ , then + +$$ +\min _ {h \in \mathbb {H} _ {\mathbb {T}}} \operatorname * {P r} _ {\boldsymbol {Z} \sim \mu_ {\boldsymbol {X} ^ {\prime}}} [ h (\boldsymbol {Z}) = y ^ {*} ] = \min _ {h: \mathbb {R} ^ {N \times D} \to \mathbb {Y}} \operatorname * {P r} _ {\boldsymbol {Z} \sim \mu_ {\boldsymbol {X} ^ {\prime}}} [ h (\gamma (\boldsymbol {Z})) = y ^ {*} ] s. t. \operatorname * {P r} _ {\boldsymbol {Z} \sim \mu_ {\boldsymbol {X}}} [ h (\gamma (\boldsymbol {Z})) = y ^ {*} ] \geq p _ {\boldsymbol {X}, y ^ {*}}. +$$ + +Like in Section 3.1, the optimization problem without invariance constraints from Lemma 1 could now be solved exactly using the Neyman-Pearson lemma – if we could find the distribution of $\gamma(Z)$ , i.e. the distribution of representatives1. This can be achieved for groups $T(D)$ , $SO(D)$ and $SE(D)$ via careful change of variables into an alternative parameterization of $\mathbb{R}^{N \times D}$ (see Appendix F.3). + +This leads us to our main result, which we derive more formally in Appendix F.3. In the following, let $\langle \mathbf{A},\mathbf{B}\rangle_{\mathrm{F}}$ be the Frobenius inner product $\sum_{n = 1}^{N}(\mathbf{A}_n)^T\mathbf{B}_n$ and recall from Section 3.3 that a right Haar measure is a measure for integration over a group $\mathbb{T}$ . + +Theorem 3. Let $g: \mathbb{R}^{N \times D} \to \mathbb{Y}$ be invariant under $\mathbb{T}$ with $\mathbb{T}$ chosen from $\{T(D), SO(D), SE(D)\}$ . For $SO(D)$ and $SE(D)$ , let $D \in \{2,3\}$ . Let $\mathbb{H}_{\mathbb{T}}$ be defined as in Eq. (2) and $\eta$ be a right Haar measure on $\mathbb{T}$ . Define the indicator function $h^*: \mathbb{R}^{N \times D} \to \{0,1\}$ with + +$$ +h ^ {*} (\boldsymbol {Z}) = \mathbb {1} \left[ \frac {\beta_ {\boldsymbol {X} ^ {\prime}} (\boldsymbol {Z})}{\beta_ {\boldsymbol {X}} (\boldsymbol {Z})} \leq \kappa \right], \text {w h e r e} \beta_ {\boldsymbol {X}} (\boldsymbol {Z}) = \int_ {t \in \mathbb {T}} \exp \left(\langle t \circ \boldsymbol {Z}, \boldsymbol {X} \rangle_ {\mathrm {F}} / \sigma^ {2}\right) d \eta (t) \tag {5} +$$ + +$$ +a n d \kappa \in \mathbb {R} s u c h t h a t \underset {\boldsymbol {Z} \sim \mu_ {\boldsymbol {X}}} {\mathbf {E}} [ h ^ {*} (\boldsymbol {Z}) ] = p _ {\boldsymbol {X}, y ^ {*}}. \tag {6} +$$ + +Then + +$$ +\min _ {h \in \mathbb {H} _ {\mathbb {T}}} \Pr_ {\boldsymbol {Z} \sim \mu_ {\boldsymbol {X} ^ {\prime}}} [ h (\boldsymbol {Z}) = y ^ {*} ] = \underset {\boldsymbol {Z} \sim \mu_ {\boldsymbol {X} ^ {\prime}}} {\mathbf {E}} [ h ^ {*} (\boldsymbol {Z}) ]. \tag {7} +$$ + +The indicator function $h^*$ in Eq. (5) corresponds to the worst-case invariant classifier for clean prediction probability $p_{\mathbf{X},y^*}$ . To classify an input sample $Z$ , it integrates Gaussian kernels of $(t \circ Z, X')$ and $(t \circ Z, X)$ over group $\mathbb{T}$ (e.g. over all possible rotations). If the ratio of these integrals is below a threshold $\kappa$ , it classifies $Z$ as $y^*$ . The constraint in Eq. (6) ensures that the probability of predicting $y^*$ under the clean smoothing distribution $\mu_{\mathbf{X}}$ matches that of the actual base classifier $g$ . The expected value with respect to perturbed smoothing distribution $\mu_{\mathbf{X'}}$ in Eq. (7) is the optimal value of our optimization problem. As discussed in Section 3.1, the prediction is certifiably robust if this optimal value is greater than $1/2$ . + +Applying the certificate to a group $\mathbb{T}$ requires three steps: 1.) Calculating the Haar integrals in Eq. (5). 2.) Solving Eq. (6) for classification threshold $\kappa$ . 3.) Evaluating the expected value in Eq. (7). + +Connection to prior work. This result differs from black-box randomized smoothing with Gaussian noise, where the worst-case classifier is a linear model [26]. The group averaging performed by the worst-case invariant classifier, i.e. integrating a function over group $\mathbb{T}$ , is a key technique for building invariant models [7, 113-117]. Group-averaged kernels have been proposed in [15]. It is fascinating to see them naturally materialize from nothing but an invariance constraint. + +# 6.2 Translation invariance + +In the case of translation invariance (i.e. $\mathbb{T} = T(D)$ ), we can evaluate the worst-case classifier (Eq. (5), solve for threshold $\kappa$ (Eq. (6)) and evaluate the perturbed prediction probability (Eq. (7)) analytically. This leads to the following result (proof in Appendix F.4.1): + +Theorem 4. Let $g: \mathbb{R}^{N \times D} \to \mathbb{Y}$ be invariant under $\mathbb{T} = T(D)$ and $\mathbb{H}_{\mathbb{T}}$ be defined as in Eq. (2). Then + +$$ +\min _ {h \in \mathbb {H} _ {\mathbb {T}}} \operatorname * {P r} _ {\boldsymbol {Z} \sim \mu_ {\boldsymbol {X} ^ {\prime}}} \left[ h (\boldsymbol {Z}) = y ^ {*} \right] = \Phi \left(\Phi^ {- 1} \left(p _ {\boldsymbol {X}, y ^ {*}}\right) - \frac {1}{\sigma} \left| \left| \boldsymbol {\Delta} - \mathbf {1} _ {N} \overline {{\boldsymbol {\Delta}}} \right| \right| _ {2}\right), +$$ + +where $\overline{\Delta} \in \mathbb{R}^{1 \times D}$ are the column-wise averages of $\Delta = X' - X$ and $\sigma$ is the standard deviation of the isotropic matrix normal smoothing distribution $\mu_{X}$ . + +Certificate parameters. For a fixed smoothing standard deviation $\sigma$ , the certificate depends on a single parameter: The norm $\left|\left|\boldsymbol{\Delta} - \mathbf{1}_N\overline{\boldsymbol{\Delta}}\right|\right|_2$ of the mean-centered perturbation matrix $\pmb{\Delta}$ . + +Comparison to the orbit-based certificate. Substituting into robustness condition $\min_{h\in \mathbb{H}_{\mathbb{T}}}\operatorname *{Pr}_{Z\sim \mu_{X'}}[h(Z) = y^* ] > \frac{1}{2}$ shows that $f(X^{\prime}) = y^{*}$ if $\left|\left|\pmb {\Delta} - \mathbf{1}_N\overline{\pmb{\Delta}}\right|\right|_2 < \sigma \Phi^{-1}(p_{\pmb {X},y^*})$ This result, obtained via our tight certification methodology, is identical to the orbit-based certificate for translation invariance from the end of Section 5. In other words: Despite its simplicity, the orbit-based certificate is the best possible gray-box certificate for translation invariance. + +# 6.3 Rotation invariance in 2D + +Considering the previous result, one may suspect the orbit-based certificate to be tight for arbitrary invariances. This is not the case. For instance, it is not tight for rotation invariance $(\mathbb{T} = SO(D))$ : + +Theorem 5. Let $g: \mathbb{R}^{N \times D} \to \mathbb{Y}$ be invariant under $\mathbb{T} = SO(D)$ and $\mathbb{H}_{\mathbb{T}}$ be defined as in Eq. (2). Assume that perturbed input $\pmb{X}'$ is not obtained via rotation of $\pmb{X}$ , i.e. $\not\exists \pmb{R} \in SO(D): \pmb{X}' = \pmb{X}\pmb{R}^T$ . Further assume that $p_{\pmb{X},y^*} \in (0,1)$ . Then, for all $\pmb{R} \in SO(D)$ : + +$$ +\min _ {h \in \mathbb {H} _ {\mathbb {T}}} \Pr_ {\boldsymbol {Z} \sim \mu_ {\boldsymbol {X} ^ {\prime}}} \left[ h (\boldsymbol {Z}) = y ^ {*} \right] > \Phi \left(\Phi^ {- 1} \left(p _ {\boldsymbol {X}, y ^ {*}}\right) - \frac {1}{\sigma} \left| \left| \boldsymbol {X} ^ {\prime} \boldsymbol {R} ^ {T} - \boldsymbol {X} \right| \right| _ {2}\right). \tag {8} +$$ + +In other words: The tight certificate is strictly stronger. Proof in Appendix G. + +Next, we apply Theorem 3 to obtain the strictly stronger, tight certificate for rotation invariance in 2D. In the following, let $\pmb{R}(\theta) \in SO(2)$ be the matrix that rotates counterclockwise by angle $\theta$ and $\mathcal{I}_0$ be the modified Bessel function of the first kind and order 0. The Haar integral from Eq. (5) that defines the worst-case classifier can be evaluated analytically (see Appendix F.4.2): + +$$ +\beta_ {\boldsymbol {X}} (\boldsymbol {Z}) = \mathcal {I} _ {0} \left(\frac {1}{\sigma^ {2}} \sqrt {\langle \boldsymbol {Z} , \boldsymbol {X} \rangle_ {\mathrm {F}} ^ {2} + \langle \boldsymbol {Z} , \boldsymbol {X} \boldsymbol {R} (- \pi / 2) ^ {T} \rangle_ {\mathrm {F}} ^ {2}}\right), \tag {9} +$$ + +We can substitute this into Theorem 3 and use the fact that Eq. (9) depends on linear transformations of the matrix normal random variable $Z$ to obtain the following certificate (proof in Appendix F.4.2): + +Theorem 6. Let $g: \mathbb{R}^{N \times 2} \to \mathbb{Y}$ be invariant under $\mathbb{T} = SO(2)$ and $\mathbb{H}_{\mathbb{T}}$ be defined as in Eq. (2). Define the indicator function $\rho: \mathbb{R}^4 \to \{0,1\}$ with + +$$ +\rho (\boldsymbol {q}) = \mathbb {1} \left[ \mathcal {I} _ {0} \left(\sqrt {q _ {1} ^ {2} + q _ {2} ^ {2}}\right) / \mathcal {I} _ {0} \left(\sqrt {q _ {3} ^ {2} + q _ {4} ^ {2}}\right) \leq \kappa \right], \tag {10} +$$ + +$$ +\text {w i t h} \kappa \in \mathbb {R} \text {s u c h t h a t} \underset {\boldsymbol {q} \sim \mathcal {N} \left(\boldsymbol {m} ^ {(2)}, \boldsymbol {\Sigma}\right)} {\mathbf {E}} [ \rho (\boldsymbol {q}) ] = p _ {\boldsymbol {X}, \boldsymbol {y} ^ {*}}. \tag {11} +$$ + +Then + +$$ +\min _ {h \in \mathbb {H} _ {\mathrm {T}}} \Pr_ {Z \sim \mu_ {\boldsymbol {X} ^ {\prime}}} [ h (\boldsymbol {Z}) = y ^ {*} ] = \underset {\boldsymbol {q} \sim \mathcal {N} \left(\boldsymbol {m} ^ {(1)}, \boldsymbol {\Sigma}\right)} {\mathbf {E}} [ \rho (\boldsymbol {q}) ], \tag {12} +$$ + +where $\pmb{m}^{(1)},\pmb{m}^{(2)}\in \mathbb{R}^4,\pmb{\Sigma}\in \mathbb{R}^{4\times 4}$ are linear combinations (see Appendix F.4.2) of $||X||_2^2 /\sigma^2$ $||\Delta ||_2^2 / \sigma^2$ and parameters $\epsilon_{1} = \langle X,\Delta \rangle_{\mathrm{F}},\epsilon_{2} = \langle X R(-\pi /2)^{T},\Delta \rangle_{\mathrm{F}}$ + +Certificate parameters. This certificate depends on the perturbation norm $||\Delta ||_2$ and clean data norm $||X||_2$ , relative to the smoothing standard deviation $\sigma$ . It further depends on parameters $\epsilon_{1}$ and $\epsilon_{2}$ , which are Frobenius inner products between $\Delta$ and the clean input $X$ before and after a rotation by $-\pi /2$ . These parameters capture the orientation of $X' = X + \Delta$ relative to $X$ , as one would expect from a rotation-invariance aware certificate. + +Monte Carlo evaluation. Evidently, we do not have a closed-form expression for the expectations in Eqs. (11) and (12). However, recall from Section 3.1 that randomized smoothing already involves an intractable expectation, namely the prediction probability $p_{X,y^*}$ . One has to use Monte Carlo sampling to compute a lower confidence bound that hold with high probability $1 - \alpha$ . We adopt the same approach: First, we lower-bound threshold $\kappa$ from Eq. (11), i.e. make the classifier slightly less likely to predict $y^*$ . Then, we lower-bound bound expectation $\mathbf{E}_{q\sim \mathcal{N}(m^{(1)},\Sigma)}[\rho (\boldsymbol {q})]$ from Eq. (12). Because the resulting value is slightly smaller than the optimal value of our optimization problem $\min_{h\in \mathbb{H}_{\mathbb{T}}}\mathrm{Pr}_{Z\sim \mu_{X'}}[h(Z) = y^*]$ , this procedure yields a valid certificate. We discuss the full algorithm and how to ensure that all bounds simultaneously hold in Appendix F.5. Because the expectations only require sampling from four-dimensional normal distributions and do not depend on base classifier $g$ , one can use a large number of samples to obtain narrow bounds at little computational cost (e.g. 0.59s for 100000 samples per confidence bound on an Intel Xeon E5-2630 CPU). + +# 6.4 Rotation invariance in 3D + +To evaluate the tight certificate for 3D rotation invariance (i.e. $\mathbb{T} = SO(3)$ ), we adopt the same Monte Carlo evaluation approach discussed in Section 6.3. Different from 2D rotation invariance, evaluating the worst-case classifier analytically is not tractable. It can however be evaluated by numerical integration over an Euler angle parameterization of rotation group $SO(3)$ (see Appendix F.4.3). + +# 6.5 Roto-translation invariance in 2D and 3D + +In Appendix F.4.4 we prove that additionally enforcing translation invariance (i.e. $\mathbb{T} = SE(D)$ ) is equivalent to centering $X$ and $\Delta$ before evaluating the certificates for rotation invariance. This is consistent with our result from Section 6.2, i.e. the orbit-based approach being optimal for translation. + +# 7 Limitations and broader impact + +The main limitation of our work lies in its exploratory nature. We have derived the first certificates for models invariant under arbitrary Euclidean isometries and/or permutation. While these invariances are of key importance to many practical applications, there is a vast swath of invariances that we have not covered, such as spatio-temporal invariances [44], invariance under graph isomorphisms [9] or invariances for planar images [7]. Furthermore, we have not yet derived tight certificates for reflections and permutations (though our certification methodology could conceivably be applied to them). + +Broader impact. With the growing prevalence of machine learning in safety-critical and sensitive domains like autonomous driving [118, 119] or healthcare [120, 121], trustworthy models promise to become increasingly important. Certification is one pillar of trustworthiness, alongside concepts like fairness [122, 123] or differential privacy [124, 125]. Unique to our work is that we certify models + +![](images/379af31cdcd159d38c863343d5f85646e8911eb15fcae8e6c3cf3e864797fafe.jpg) +Figure 2: Comparison of tight and orbit-based certificates applied to adversarial scaling for $\sigma = 0.5$ and varying $||\Delta ||$ and $||X||$ (smaller $p_{\mathrm{min}}$ is better). As $||\mathbf{X}||$ increases, the difference between the certificates shrinks. + +![](images/f6ccbe78968fe5129c589dd752f164625d9aaf3f1f18ed0ac75498cad51e0531.jpg) +Figure 3: Difference in $p_{\mathrm{min}}$ between the tight certificate for 2D rotation invariance and the black-box baseline for $\sigma = 0.5$ , $||X|| = 1.0$ . Crosses correspond to adversarial rotations. Large $d(p_{\mathrm{min}})$ can be observed near adversarial rotations. + +with spatial invariances. These invariances naturally occur in the physical sciences, including those with a direct societal impact like pharmacology and biochemistry. Our work can be seen as a first step towards provable trustworthiness for tasks like drug discovery [39-41] or protein folding [45-49]. + +# 8 Experimental evaluation + +We already know that the orbit-based certificate for translation invariance is tight and certifies robustness for an infinitely larger volume than black-box randomized smoothing (see Fig. 1). Therefore, we focus our experiments on the certificates for rotation invariance. Recall that the orbit-based certificate guarantees robustness for the set $\tilde{\mathbb{B}} = \left\{X' \mid ||X'R^T - X||_2 < r\right\}$ with $r = \sigma \Phi^{-1}(p_{X,y^*})$ and optimal rotation matrix $\pmb{R}$ . In other words: It certifies robustness for perturbations with rotational components that can be eliminated to bring $X'$ into distance $r$ of $\pmb{X}$ . We want to understand whether the tight certificates offer any benefit beyond that, or if the strict inequality in Theorem 5 is due to some negligible $\epsilon$ . To this end, we first thoroughly examine the four-dimensional parameter space of the tight certificate for rotation invariance in 2D, before applying our certificates to rotation invariant point cloud classifiers. + +All parameters and experimental details are specified in Appendix B. We use 10000 samples per confidence bound and set $\alpha = 0.001$ , i.e. all certificates hold with $99.9\%$ probability. A reference implementation will be made available at https://www.cs.cit.tum.de/daml/invariance-smoothing. + +# 8.1 Tight certificate parameter space + +The tight certificate for 2D rotation invariance depends on $||\pmb{X}||_2 / \sigma, ||\pmb{\Delta}||_2 / \sigma$ and parameters $\epsilon_{1}$ and $\epsilon_{2}$ , which capture the orientation of the perturbed point cloud and fulfill $\sqrt{\epsilon_1^2 + \epsilon_2^2} \leq ||\pmb{X}||_2 \cdot ||\pmb{\Delta}||_2$ (see Appendix J). To avoid clutter, we define $\tilde{\epsilon}_k \coloneqq \epsilon_k / (||\pmb{X}||_2 \cdot ||\pmb{\Delta}||_2)$ . As our metric for this section, we report $p_{\mathrm{min}}$ , the smallest probability $p_{\pmb{X},y^*}$ for which a prediction can still be certified2 + +Adversarial scaling. First, we assume that $\mathbf{X}' = (1 + c)\mathbf{X}$ , i.e. the input is adversarially scaled. In this case, we have $\tilde{\epsilon}_1 = 1$ and $\tilde{\epsilon}_2 = 0$ . We then vary $||\pmb{\Delta}||_2$ and $||\mathbf{X}||_2$ and evaluate our certificates. Note that such attacks have no rotational component, i.e. the orbit-based certificate is identical to the black-box one. Fig. 2 shows that, even in the absence of rotations, the tight certificate can yield significantly stronger guarantees. For $\sigma = 0.5$ and $||\mathbf{X}||_2 = 0.01$ , the baseline can only certify robustness for a prediction with $p_{\mathbf{X},y^*} = 0.8$ if $||\pmb{\Delta}||_2 \leq 0.4$ . The tight certificate can certify robustness up to $||\pmb{\Delta}||_2 = 0.73$ . However, the gap shrinks as the norm of the clean data increases. + +Effect of data norm. We would like to see if this is a pervasive pattern. To this end, we fix $||\Delta ||_2$ gradually increase $||X||_2$ , and evaluate the tight certificate for $\tilde{\epsilon}_1$ , $\tilde{\epsilon}_2$ on a $100\times 100$ rasterization of $[0,1]\times [0,1]$ . We then measure the difference $d(p_{\mathrm{min}})$ to the black-box certificate (we will discuss + +![](images/74de5a73fecfe75512ff77a9223a68731ed43a1f0a959df1e80b6f667dd5df80.jpg) +Figure 4: Difference in $p_{\mathrm{min}}$ between the tight certificate for 2D rotation invariance and the black-box baseline for $\sigma = 0.5$ , $||\pmb{\Delta}|| = 0.5$ under varying $||\pmb{X}||$ , $\tilde{\epsilon}_1$ and $\tilde{\epsilon}_2$ . As $||\pmb{X}||$ increases, the regions where the tight certificate outperforms the black-box baseline shrink. + +![](images/ae887aa8586d752b83e010bb6886a1030a3e76db14376c9abb2ff48b6a52e058.jpg) + +![](images/6c5ab5469167ad87af8d4533b93ca34a4e2f5b0b126627a08a0964f65f50dbfa.jpg) + +![](images/3d7d8fb53e0ffa2529faa91f9b6a3cc5a85a474ee16991712f817f0d3b65bfaf.jpg) + +![](images/09528c5b1b2dfec5fdb95f8e959afe3586148f0f8291da187c4b04f8cc2501e8.jpg) +Figure 5: Test set accuracy of smoothed translation and rotation invariant point cloud classifiers on the ModelNet40 and MNIST pointcloud datasets, under varying standard deviation $\sigma$ . + +![](images/3ff312ec6c8523ab2f97330fe727d6ae2a70ed78194c02201fc462cef683d2ef.jpg) +Figure 6: Comparison of certificates for adversarial scaling of MNIST with EnsPointNet and $\sigma = 0.15$ . The tight and orbit-based certificates yield similar certified accuracies. + +how these results relate to the orbit-based one shortly). Fig. 4 shows that for small $||\pmb{X}||_2$ , the tight certificate outperforms the black-box certificate for arbitrary perturbations of norm $||\pmb{\Delta}||_2$ . But, as $||\pmb{X}||_2$ increases, the regions where it outperforms the black-box one shrink. + +Rotational components. Simple algebra (see Appendix J) shows that for any combination of $||X||_2$ and $||\Delta||_2$ , adversarial rotations, i.e. $X' = XR^T$ such that $||X' - X|| = ||\Delta||$ , correspond to two specific points with $\sqrt{\tilde{\epsilon}_1^2 + \tilde{\epsilon}_2^2} = 1$ in the certificate's parameter space. In Fig. 3 we fix $\sigma = 0.5$ and $||X||_2 = 1$ , vary $||\Delta||$ and highlight these two points. We observe that the tight certificate only outperforms the black-box certificate for values of $\tilde{\epsilon}_1, \tilde{\epsilon}_2$ that are close to adversarial rotations. However, robustness to such attacks can also be readily certified by the orbit-based approach. Combined with our previous observations, and because the certificate only depends on norms relative to smoothing standard deviation $\sigma$ , i.e. $||X||_2 / \sigma$ and $||\Delta||_2 / \sigma$ , we expect the tight and the orbit-based certificate to perform similarly well, assuming that the smoothing standard deviation $\sigma$ is small relative to $||X||_2$ . + +# 8.2 Application to point cloud classification + +To verify whether our observations hold in practice, we apply our certificates to point cloud classification. We consider two datasets: 3D point cloud representations of ModelNet40 [126], which consists of CAD models from 40 different categories, and 2D point cloud representations of MNIST [127]. We apply the same pre-processing steps as in [6]. Certification is performed on the default test sets. As our base classifiers, we use rotation and translation (i.e. $SE(D)$ ) invariant versions of two well-established models that are used in prior work on robustness certification for point clouds: PointNet [6] and DGCNN [128]. To implement the invariances, we center the input data, perform principal component analysis, apply the model to all possible poses (see discussion in [129, 130]) and average the output logits (EnsPointNet and EnsDGCNN). In addition, we consider a more refined model [129] that combines canonical poses via a self-attention mechanism (AttnPointNet). Throughout this section, we report both probabilistic upper and lower bounds for the Monte Carlo evaluation of the tight certificates (recall Section 6.3). + +![](images/c8b6339cc23fa73037f21509ab9c268466f7184a4bbd7782c75183f24996df59.jpg) +(a) EnsPointNet on MNIST + +![](images/9116737577bb550e1fc72ab288dba1c7aa079cfec78b9622a9c03ce5e67a47da.jpg) +(b) EnsDGCNN on ModelNet40 +Figure 7: Comparison of tight, orbit-based and black-box certificates for randomly perturbed inputs with $||\pmb{\Delta}|| = \sigma = 0.1$ , rotated by angle $\theta$ . The gray-box certificates effectively eliminate the induced rotation, while the black-box method cannot certify robustness for large $\theta$ . + +Practical smoothing parameters. Fig. 5 shows the test set accuracies of randomly smoothed models under varying standard deviations $\sigma$ . Values of $\sigma$ that preserve an accuracy above $50\%$ are small, relative to the average norm of the test sets (10.67 for MNIST, 19.17 for ModelNet40). Going by our previous results, we expect the tight and orbit-based certificates to perform similarly well. + +Adversarial scaling. In Fig. 6 we again consider adversarial scaling, i.e. attacks without rotational components, but applied to the MNIST point cloud dataset with $\sigma = 0.15$ . We report the certified accuracy, i.e. the percentage of correct and provably robust predictions, for certification with $(SE(2))$ and without $(SO(2))$ translation invariance. The tight and orbit-based certificate yield similar results. We further observe that enforcing translation invariance increases the certified accuracy and extends the range of $||\Delta ||$ for which robustness can be certified. + +Rotational components. Finally, we study perturbations with rotational components. We fix $||\Delta||$ , randomly sample perturbations of the specified norm and then rotate $Z = X + \Delta$ by a specified angle $\theta \in [0,10^{\circ}]$ (in the case of ModelNet40, around one randomly chosen axis). For each element of the test set and each $\theta$ , we generate 10 such samples. We then compute the percentage of samples $X'$ for which $f(X)$ is correct and $f(X') = f(X)$ is provably guaranteed ("probabilistic certified accuracy"). Fig. 7 shows results for MNIST and ModelNet40 evaluated with $||\Delta|| = \sigma = 0.1$ . The black-box baseline's probabilistic certified accuracy drops close to 0 for $\theta = 2^{\circ}$ . The gray-box certificates are almost constant in $\theta$ , i.e. effectively eliminate any induced rotation. However, the tight certificate did not offer any meaningful benefit beyond that. Using the lower bound for Monte Carlo evaluation, there was not a single sample for which only the tight certificate could guarantee robustness. + +In Appendix A we repeat the experiments from this and the previous section for various other combinations of parameter values. All results are consistent with the ones presented here, confirming that the orbit-based approach offers a good approximation of the tight certificates in practice. + +# 9 Conclusion + +For the first time, we have studied the use of invariances for robustness certification. We proposed a gray-box approach, combining white-box knowledge about invariances with black-box randomized smoothing. We have derived a orbit-based procedure for certification that can be applied to arbitrary models with invariance to permutations and Euclidean isometries. We have proven that the orbit-based certificate for translation invariance is tight and derived strictly stronger certificates for rotation invariance. Our experiments are to be interpreted in two ways: Firstly, the fact that it is possible to derive tight invariance-aware certificates and that there exist scenarios in which they offer stronger guarantees for arbitrary perturbations should be an exciting inspiration for future work. Secondly, the fact that the orbit-based certificates are easily interpretable and offer good approximations of our tight certificates should invite their application to real-world tasks with inherent invariances. + +Acknowledgements. The authors would like to thank Johannes Gasteiger for valuable discussions on invariant deep learning and Lukas Gosch for constructive criticism of the manuscript. This research was supported by the German Research Foundation, grant GU 1409/4-1. + +# References + +[1] Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In International Conference on Learning Representations, 2014. +[2] Ian Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In International Conference on Learning Representations, 2015. +[3] Naveed Akhtar and Ajmal Mian. Threat of adversarial attacks on deep learning in computer vision: A survey. IEEE Access, 6:14410-14430, 2018. +[4] Han Xu, Yao Ma, Hao-Chen Liu, Debayan Deb, Hui Liu, Ji-Liang Tang, and Anil K Jain. Adversarial attacks and defenses in images, graphs and text: A review. International Journal of Automation and Computing, 17(2):151-178, 2020. +[5] Manzil Zaheer, Satwik Kottur, Siamak Ravanbakhsh, Barnabas Poczos, Russ R Salakhutdinov, and Alexander J Smola. Deep sets. Advances in neural information processing systems, 30, 2017. +[6] Charles R Qi, Hao Su, Kaichun Mo, and Leonidas J Guibas. Pointnet: Deep learning on point sets for 3d classification and segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 652-660, 2017. +[7] Taco Cohen and Max Welling. Group equivariant convolutional networks. In International conference on machine learning, 2016. +[8] Taco S Cohen, Mario Geiger, Jonas Kohler, and Max Welling. Spherical CNNs. In International Conference on Learning Representations, 2018. +[9] Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In International Conference on Learning Representations, 2017. +[10] Kunihiko Fukushima. Neural network model for a mechanism of pattern recognition unaffected by shift in position – neocognitron. IEICE Technical Report, A, 62(10):658–665, 1979. +[11] C Lee Giles and Tom Maxwell. Learning, invariance, and generalization in high-order neural networks. Applied optics, 26(23):4972-4978, 1987. +[12] Christopher J Burges and Bernhard Scholkopf. Improving the accuracy and speed of support vector machines. Advances in neural information processing systems, 9, 1996. +[13] Olivier Chapelle and Bernhard Schölkopf. Incorporating invariances in non-linear support vector machines. Advances in neural information processing systems, 14, 2001. +[14] Dennis DeCoste and Bernhard Scholkopf. Training invariant support vector machines. Machine learning, 46(1):161-190, 2002. +[15] Bernard Haasdonk, A Vossen, and Hans Burkhardt. Invariance in kernel methods by Haar-integration kernels. In Scandinavian Conference on Image Analysis, pages 841-851. Springer, 2005. +[16] Chih-Hong Cheng, Georg Nuhrenberg, and Harald Ruess. Maximum resilience of artificial neural networks. In International Symposium on Automated Technology for Verification and Analysis, pages 251-268. Springer, 2017. +[17] Guy Katz, Clark Barrett, David L Dill, Kyle Julian, and Mykel J Kochenderfer. Reluplex: An efficient SMT solver for verifying deep neural networks. In International conference on computer aided verification, pages 97-117. Springer, 2017. +[18] Ruediger Ehlers. Formal verification of piece-wise linear feed-forward neural networks. In International Symposium on Automated Technology for Verification and Analysis, pages 269-286. Springer, 2017. + +[19] Lily Weng, Huan Zhang, Hongge Chen, Zhao Song, Cho-Jui Hsieh, Luca Daniel, Duane Boning, and Inderjit Dhillon. Towards fast computation of certified robustness for relu networks. In International Conference on Machine Learning, 2018. +[20] Eric Wong and Zico Kolter. Provable defenses against adversarial examples via the convex outer adversarial polytope. In International Conference on Machine Learning, 2018. +[21] Timon Gehr, Matthew Mirman, Dana Drachsler-Cohen, Petar Tsankov, Swarat Chaudhuri, and Martin Vechev. AI2: Safety and robustness certification of neural networks with abstract interpretation. In IEEE Symposium on Security and Privacy (SP). IEEE, 2018. +[22] Huan Zhang, Tsui-Wei Weng, Pin-Yu Chen, Cho-Jui Hsieh, and Luca Daniel. Efficient neural network robustness certification with general activation functions. Advances in neural information processing systems, 31, 2018. +[23]Gagandeep Singh, Timon Gehr, Markus Puschel, and Martin Vechev. An abstract domain for certifying neural networks. Proceedings of the ACM on Programming Languages, 3(POPL): 1-30, 2019. +[24] Xuanqing Liu, Minhao Cheng, Huan Zhang, and Cho-Jui Hsieh. Towards robust neural networks via random self-ensemble. In Computer Vision - ECCV 2018, pages 381-397. 2018. +[25] Mathias Lécuyer, Vaggelis Atlidakis, Roxana Geambasu, Daniel Hsu, and Suman Jana. Certified robustness to adversarial examples with differential privacy. In IEEE Symposium on Security and Privacy, pages 656-672. IEEE, 2019. +[26] Jeremy Cohen, Elan Rosenfeld, and Zico Kolter. Certified adversarial robustness via randomized smoothing. In International Conference on Machine Learning, 2019. +[27] David K Duvenaud, Dougal Maclaurin, Jorge Iparraguirre, Rafael Bombarell, Timothy Hirzel, Alán Aspuru-Guzik, and Ryan P Adams. Convolutional networks on graphs for learning molecular fingerprints. Advances in neural information processing systems, 28, 2015. +[28] Connor W Coley, Regina Barzilay, William H Green, Tommi S Jaakkola, and Klavs F Jensen. Convolutional embedding of attributed molecular graphs for physical property prediction. Journal of chemical information and modeling, 57(8):1757-1772, 2017. +[29] Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. In International conference on machine learning, 2017. +[30] Kristof T Schütt, Huziel E Sauceda, P-J Kindermans, Alexandre Tkatchenko, and K-R Müller. SchNet – a deep learning architecture for molecules and materials. The Journal of Chemical Physics, 148(24):241722, 2018. +[31] Johannes Gasteiger, Janek Groß, and Stephan Gunnemann. Directional message passing for molecular graphs. In International Conference on Learning Representations, 2019. +[32] Johannes Gasteiger, Florian Becker, and Stephan Gunnemann. GemNet: Universal directional graph neural networks for molecules. Advances in Neural Information Processing Systems, 34, 2021. +[33] Johannes Gasteiger, Chandan Yeshwanth, and Stephan Gunnemann. Directional message passing on molecular graphs via synthetic coordinates. Advances in Neural Information Processing Systems, 34, 2021. +[34] Nicholas Gao and Stephan Gunnemann. Ab-initio potential energy surfaces by pairing GNNs with neural wave functions. In International Conference on Learning Representations, 2022. +[35] Joachim Niemeyer, Franz Rottensteiner, and Uwe Soergel. Contextual classification of lidar data and building object detection in urban areas. ISPRS journal of photogrammetry and remote sensing, 87:152-165, 2014. + +[36] Aili Wang, Xin He, Pedram Ghamisi, and Yushi Chen. Lidar data classification using morphological profiles and convolutional neural networks. IEEE Geoscience and Remote Sensing Letters, 15(5):774-778, 2018. +[37] Xin He, Aili Wang, Pedram Ghamisi, Guoyu Li, and Yushi Chen. Lidar data classification using spatial transformation and cnn. IEEE Geoscience and Remote Sensing Letters, 16(1): 125-129, 2018. +[38] Ying Li, Lingfei Ma, Zilong Zhong, Fei Liu, Michael A Chapman, Dongpu Cao, and Jonathan Li. Deep learning for lidar point clouds in autonomous driving: A review. IEEE Transactions on Neural Networks and Learning Systems, 32(8):3412-3432, 2020. +[39] Zhaoping Xiong, Dingyan Wang, Xiaohong Liu, Feisheng Zhong, Xiaozhe Wan, Xutong Li, Zhaojun Li, Xiaomin Luo, Kaixian Chen, Hualiang Jiang, et al. Pushing the boundaries of molecular representation for drug discovery with the graph attention mechanism. Journal of medicinal chemistry, 63(16):8749-8760, 2019. +[40] Hubert Ramsauer, Bernhard Schäfl, Johannes Lehner, Philipp Seidl, Michael Widrich, Lukas Gruber, Markus Holzleitner, Thomas Adler, David Kreil, Michael K Kopp, et al. Hopfield networks is all you need. In International Conference on Learning Representations, 2020. +[41] Chenjing Cai, Shiwei Wang, Youjun Xu, Weilin Zhang, Ke Tang, Qi Ouyang, Luhua Lai, and Jianfeng Pei. Transfer learning for drug discovery. Journal of Medicinal Chemistry, 63(16): 8683-8694, 2020. +[42] Pierre Baldi, Peter Sadowski, and Daniel Whiteson. Searching for exotic particles in high-energy physics with deep learning. Nature communications, 5(1):1-9, 2014. +[43] Dan Guest, Kyle Cranmer, and Daniel Whiteson. Deep learning and its application to lhc physics. Annual Review of Nuclear and Particle Science, 68:161-181, 2018. +[44] Alexander Bogatskiy, Brandon Anderson, Jan Offermann, Marwah Roussi, David Miller, and Risi Kondor. Lorentz group equivariant neural network for particle physics. In International Conference on Machine Learning, 2020. +[45] Ning Qian and Terrence J Sejnowski. Predicting the secondary structure of globular proteins using neural network models. Journal of molecular biology, 202(4):865-884, 1988. +[46] Piero Fariselli, Osvaldo Olmea, Alfonso Valencia, and Rita Casadio. Prediction of contact maps with neural networks and correlated mutations. Protein engineering, 14(11):835-843, 2001. +[47] Jinbo Xu. Distance-based protein folding powered by deep learning. Proceedings of the National Academy of Sciences, 116(34):16856-16865, 2019. +[48] Mohammed AlQuraishi. End-to-end differentiable learning of protein structure. Cell systems, 8(4):292-301, 2019. +[49] Kiersten M Ruff and Rohit V Pappu. AlphaFold and implications for intrinsically disordered proteins. Journal of Molecular Biology, 433(20):167208, 2021. +[50] Michael M Bronstein, Joan Bruna, Taco Cohen, and Petar Velickovic. Geometric deep learning: Grids, groups, graphs, geodesics, and gauges. arXiv preprint arXiv:2104.13478, 2021. +[51] Florian Tramér, Jens Behrmann, Nicholas Carlini, Nicolas Papernot, and Jörn-Henrik Jacobsen. Fundamental tradeoffs between invariance and sensitivity to adversarial perturbations. In International Conference on Machine Learning, 2020. +[52] Sandesh Kamath, Amit Deshpande, Subrahmanyam Kambhampati Venkata, and Vineeth N Balasubramanian. Can we have it all? on the trade-off between spatial and adversarial robustness of neural networks. Advances in Neural Information Processing Systems, 34, 2021. +[53] Vasu Singla, Songwei Ge, Basri Ronen, and David Jacobs. Shift invariance can reduce adversarial robustness. In Advances in Neural Information Processing Systems, volume 34, 2021. + +[54] Jeet Mohapatra, Ching-Yun Ko, Tsui-Wei Weng, Pin-Yu Chen, Sijia Liu, and Luca Daniel. Higher-order certification for randomized smoothing. In Advances in Neural Information Processing Systems, volume 33, 2020. +[55] Alexander Levine, Aounon Kumar, Thomas Goldstein, and Soheil Feizi. Tight second-order certificates for randomized smoothing. arXiv preprint arXiv:2010.10549, 2020. +[56] Jan Schuchardt, Aleksandar Bojchevski, Johannes Klicpera, and Stephan Gunnemann. Collective robustness certificates: Exploiting interdependence in graph neural networks. In International Conference on Learning Representations, 2021. +[57] Yan Scholten, Jan Schuchardt, Simon Geisler, Aleksandar Bojchevski, and Stephan Gunnemann. Randomized message-interception smoothing: Gray-box certificates for graph neural networks. Advances in Neural Information Processing Systems, 35, 2022. +[58] Jong-Chyi Su, Matheus Gadelha, Rui Wang, and Subhransu Maji. A deeper look at 3d shape classifiers. In Proceedings of the European Conference on Computer Vision (ECCV) Workshops, 2018. +[59] Daniel Liu, Ronald Yu, and Hao Su. Extending adversarial attacks and defenses to deep 3d point cloud classifiers. In IEEE International Conference on Image Processing (ICIP), pages 2279-2283, 2019. +[60] Hang Zhou, Dongdong Chen, Jing Liao, Kejiang Chen, Xiaoyi Dong, Kunlin Liu, Weiming Zhang, Gang Hua, and Nenghai Yu. LG-GAN: Label guided adversarial network for flexible targeted attack of point cloud based deep networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10356-10365, 2020. +[61] Tzungyu Tsai, Kaichen Yang, Tsung-Yi Ho, and Yier Jin. Robust adversarial objects against deep learning models. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 954-962, 2020. +[62] Kibok Lee, Zhuoyuan Chen, Xinchen Yan, Raquel Urtasun, and Ersin Yumer. ShapeAdv: Generating shape-aware adversarial 3d point clouds. arXiv preprint arXiv:2005.11626, 2020. +[63] Yiren Zhao, Ilia Shumailov, Robert Mullins, and Ross Anderson. Nudge attacks on point-cloud dnns. arXiv preprint arXiv:2011.11637, 2020. +[64] Yuxin Wen, Jiehong Lin, Ke Chen, CL Philip Chen, and Kui Jia. Geometry-aware generation of adversarial point clouds. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2020. +[65] Jaeyeon Kim, Binh-Son Hua, Thanh Nguyen, and Sai-Kit Yeung. Minimal adversarial examples for deep learning on 3d point clouds. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 7797–7806, 2021. +[66] Yiming Sun, Feng Chen, Zhiyu Chen, and Mingjie Wang. Local aggressive adversarial attacks on 3d point cloud. In Asian Conference on Machine Learning, pages 65-80. PMLR, 2021. +[67] Chong Xiang, Charles R Qi, and Bo Li. Generating 3d adversarial point clouds. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9136-9144, 2019. +[68] Atrin Arya, Hanieh Naderi, and Shohreh Kasaei. Adversarial attack by limited point cloud surface modifications. arXiv preprint arXiv:2110.03745, 2021. +[69] Matthew Wicker and Marta Kwiatkowska. Robustness of 3d deep learning in an adversarial setting. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 11767-11775, 2019. +[70] Jiancheng Yang, Qiang Zhang, Rongyao Fang, Bingbing Ni, Jinxian Liu, and Qi Tian. Adversarial attack and defense on point sets. arXiv preprint arXiv:1902.10899, 2019. + +[71] Tianhang Zheng, Changyou Chen, Junsong Yuan, Bo Li, and Kui Ren. Pointcloud saliency maps. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 1598-1606, 2019. +[72] Qidong Huang, Xiaoyi Dong, Dongdong Chen, Hang Zhou, Weiming Zhang, and Nenghai Yu. Shape-invariant 3d adversarial point clouds. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 15335-15344, June 2022. +[73] Yulong Cao, Chaowei Xiao, Dawei Yang, Jing Fang, Ruigang Yang, Mingyan Liu, and Bo Li. Adversarial objects against lidar-based autonomous driving systems. arXiv preprint arXiv:1907.05418, 2019. +[74] James Tu, Mengye Ren, Sivabalan Manivasagam, Ming Liang, Bin Yang, Richard Du, Frank Cheng, and Raquel Urtasun. Physically realizable adversarial examples for lidar object detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 13716-13725, 2020. +[75] Mazen Abdelfattah, Kaiwen Yuan, Z Jane Wang, and Rabab Ward. Towards universal physical attacks on cascaded camera-lidar 3d object detection models. In 2021 IEEE International Conference on Image Processing (ICIP), pages 3592-3596. IEEE, 2021. +[76] Yue Zhao, Yuwei Wu, Caihua Chen, and Andrew Lim. On isometry robustness of deep 3d point cloud models under adversarial attacks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1201-1210, 2020. +[77] Wen Shen, Qihan Ren, Dongrui Liu, and Quanshi Zhang. Interpreting representation quality of dnns for 3d point cloud processing. Advances in Neural Information Processing Systems, 34, 2021. +[78] Hang Zhou, Kejiang Chen, Weiming Zhang, Han Fang, Wenbo Zhou, and Nenghai Yu. DUPNet: Denoiser and upsampler network for 3d adversarial point clouds defense. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 1961-1970, 2019. +[79] Xiaoyi Dong, Dongdong Chen, Hang Zhou, Gang Hua, Weiming Zhang, and Nenghai Yu. Self-robust 3d point recognition via gather-vector guidance. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2020. +[80] Daniel Liu, Ronald Yu, and Hao Su. Adversarial shape perturbations on 3d point clouds. In European Conference on Computer Vision, pages 88-104. Springer, 2020. +[81] Chengcheng Ma, Weiliang Meng, Baoyuan Wu, Shibiao Xu, and Xiaopeng Zhang. Efficient joint gradient based attack against sor defense for 3d point cloud classification. In Proceedings of the 28th ACM International Conference on Multimedia, pages 1819-1827, 2020. +[82] Jiachen Sun, Karl Koenig, Yulong Cao, Qi Alfred Chen, and Zhuoqing Morley Mao. On adversarial robustness of 3d point cloud classification under adaptive attacks. In 32nd British Machine Vision Conference, 2021. +[83] Hongbin Liu, Jinyuan Jia, and Neil Zhenqiang Gong. PointGuard: Provably robust 3d point cloud classification. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 6186-6195, 2021. +[84] Dishanika Dewani Denipitiyage, Thalaiyasingam Ajanthan, Parameswaran Kamalaruban, and Adrian Weller. Provable defense against clustering attacks on 3d point clouds. In The AAAI-22 Workshop on Adversarial Machine Learning and Beyond, 2021. +[85] Wenda Chu, Linyi Li, and Bo Li. TPC: Transformation-specific smoothing for point cloud models. In International Conference on Machine Learning, 2022. +[86] Tobias Lorenz, Anian Ruoss, Mislav Balunovic, Gagandeep Singh, and Martin Vechev. Robustness certification for point cloud models. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 7608-7618, 2021. + +[87] Mislav Balunovic, Maximilian Baader, Gagandeep Singh, Timon Gehr, and Martin Vechev. Certifying geometric robustness of neural networks. Advances in Neural Information Processing Systems, 32, 2019. +[88] Anian Ruoss, Maximilian Baader, Mislav Balunovic, and Martin Vechev. Efficient certification of spatial robustness. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 2504-2513, 2021. +[89] Jeet Mohapatra, Tsui-Wei Weng, Pin-Yu Chen, Sijia Liu, and Luca Daniel. Towards verifying robustness of neural networks against a family of semantic perturbations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020. +[90] Linyi Li, Maurice Weber, Xiaojun Xu, Luka Rimanic, Bhavya Kailkhura, Tao Xie, Ce Zhang, and Bo Li. TSS: Transformation-specific smoothing for robustness certification. In Proceedings of the 2021 ACM SIGSAC Conference on Computer and Communications Security, pages 535-557, 2021. +[91] Marc Fischer, Maximilian Baader, and Martin Vechev. Scalable certified segmentation via randomized smoothing. In International Conference on Machine Learning, 2021. +[92] Motasem Alfarra, Adel Bibi, Naeemullah Khan, Philip HS Torr, and Bernard Ghanem. DeformRS: Certifying input deformations with randomized smoothing. In Proceedings of the AAAI Conference on Artificial Intelligence, number 6, pages 6001-6009, 2022. +[93] Nikita Muravev and Aleksandr Petiushko. Certified robustness via randomized smoothing over multiplicative parameters of input transformations. In Proceedings of the Thirty-First International Joint Conference on Artificial Intelligence, IJCAI-22, pages 3366-3372, 7 2022. +[94] Marc Fischer, Maximilian Baader, and Martin Vechev. Certified defense to image transformations via randomized smoothing. Advances in Neural Information Processing Systems, 33, 2020. +[95] Daniel Züigner and Stephan Gümnmann. Certifiable robustness and robust training for graph convolutional networks. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 246-256, 2019. +[96] Daniel Zügner and Stephan Gunnemann. Certifiable robustness of graph convolutional networks under structure perturbations. In Proceedings of the 26th ACM SIGKDD international conference on knowledge discovery & data mining, pages 1656-1665, 2020. +[97] Akhilan Boopathy, Tsui-Wei Weng, Pin-Yu Chen, Sijia Liu, and Luca Daniel. CNN-cert: An efficient framework for certifying robustness of convolutional neural networks. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 3240–3247, 2019. +[98] Guang-He Lee, Yang Yuan, Shiyu Chang, and Tommi Jaakkola. Tight certificates of adversarial robustness for randomly smoothed classifiers. Advances in Neural Information Processing Systems, 32, 2019. +[99] Aleksandar Bojchevski, Johannes Klicpera, and Stephan Gunnemann. Efficient robustness certificates for discrete data: Sparsity-aware randomized smoothing for graphs, images and more. In International Conference on Machine Learning, 2020. +[100] Alexander J Levine and Soheil Feizi. Improved, deterministic smoothing for L_1 certified robustness. In International Conference on Machine Learning, 2021. +[101] Jinyuan Jia, Xiaoyu Cao, Binghui Wang, and Neil Zhenqiang Gong. Certified robustness for top-k predictions against adversarial perturbations via randomized smoothing. arXiv preprint arXiv:1912.09899, 2019. +[102] Ping-yeh Chiang, Michael Curry, Ahmed Abdelkader, Aounon Kumar, John Dickerson, and Tom Goldstein. Detection as regression: Certified object detection with median smoothing. Advances in Neural Information Processing Systems, 33, 2020. + +[103] Aounon Kumar and Tom Goldstein. Center smoothing: Certified robustness for networks with structured outputs. Advances in Neural Information Processing Systems, 34, 2021. +[104] Linyi Li, Maurice Weber, Xiaojun Xu, Luka Rimanic, Tao Xie, Ce Zhang, and Bo Li. Provable robust learning based on transformation-specific smoothing. arXiv preprint arXiv:2002.12398, 4, 2020. +[105] Binghui Wang, Xiaoyu Cao, Neil Zhenqiang Gong, et al. On certifying robustness against backdoor attacks via randomized smoothing. arXiv preprint arXiv:2002.11750, 2020. +[106] Elan Rosenfeld, Ezra Winston, Pradeep Ravikumar, and Zico Kolter. Certified robustness to label-flipping attacks via randomized smoothing. In International Conference on Machine Learning, 2020. +[107] Jerzy Neyman and Egon Sharpe Pearson. On the problem of the most efficient tests of statistical hypotheses. Philosophical Transactions of the Royal Society of London. Series A, Containing Papers of a Mathematical or Physical Character, 231(694-706):289-337, 1933. +[108] Alfred Haar. Der Massbegriff in der Theorie der kontinuierlichen Gruppen. Annals of mathematics, pages 147-169, 1933. +[109] Henri Cartan. Sur le mesure de Haar. Comptes Rendus de l'Académie des Sciences de Paris, 211:759-762, 1940. +[110] Erik M Alfsen. A simplified constructive proof of the existence and uniqueness of Haar measure. Mathematica Scandinavica, 12(1):106-116, 1963. +[111] Peter H Schonemann. A generalized solution of the orthogonal procrustes problem. Psychometrika, 31(1):1-10, 1966. +[112] Wolfgang Kabsch. A solution for the best rotation to relate two sets of vectors. Acta Crystallographica Section A: Crystal Physics, Diffraction, Theoretical and General Crystallography, 32(5):922-923, 1976. +[113] Joan Bruna and Stéphane Mallat. Invariant scattering convolution networks. IEEE transactions on pattern analysis and machine intelligence, 35(8):1872-1886, 2013. +[114] Ryan L Murphy, Balasubramaniam Srinivasan, Vinayak Rao, and Bruno Ribeiro. Janossy pooling: Learning deep permutation-invariant functions for variable-size inputs. arXiv preprint arXiv:1811.01900, 2018. +[115] Ryan Murphy, Balasubramaniam Srinivasan, Vinayak Rao, and Bruno Ribeiro. Relational pooling for graph representations. In International Conference on Machine Learning, 2019. +[116] Omri Puny, Matan Atzmon, Edward J. Smith, Ishan Misra, Aditya Grover, Heli Ben-Hamu, and Yaron Lipman. Frame averaging for invariant and equivariant network design. In International Conference on Learning Representations, 2022. +[117] Dmitry Yarotsky. Universal approximations of invariant maps by neural networks. Constructive Approximation, 55(1):407-474, 2022. +[118] Sorin Grigorescu, Bogdan Trasnea, Tiberiu Cocias, and Gigel Macesanu. A survey of deep learning techniques for autonomous driving. Journal of Field Robotics, 37(3):362-386, 2020. +[119] Khan Muhammad, Amin Ullah, Jaime Lloret, Javier Del Ser, and Victor Hugo C de Albuquerque. Deep learning for safe autonomous driving: Current challenges and future directions. IEEE Transactions on Intelligent Transportation Systems, 22(7):4316-4336, 2020. +[120] Riccardo Miotto, Fei Wang, Shuang Wang, Xiaogian Jiang, and Joel T Dudley. Deep learning for healthcare: review, opportunities and challenges. Briefings in bioinformatics, 19(6): 1236-1246, 2018. +[121] Beau Norgeot, Benjamin S Glicksberg, and Atul J Butte. A call for deep-learning healthcare. Nature medicine, 25(1):14-15, 2019. + +[122] Sam Corbett-Davies and Sharad Goel. The measure and mismeasure of fairness: A critical review of fair machine learning. arXiv preprint arXiv:1808.00023, 2018. +[123] Ninareh Mehrabi, Fred Morstatter, Nripsuta Saxena, Kristina Lerman, and Aram Galstyan. A survey on bias and fairness in machine learning. ACM Computing Surveys (CSUR), 54(6): 1-35, 2021. +[124] Cynthia Dwork. Differential privacy: A survey of results. In International conference on theory and applications of models of computation, pages 1-19. Springer, 2008. +[125] Zhanglong Ji, Zachary C Lipton, and Charles Elkan. Differential privacy and machine learning: a survey and review. arXiv preprint arXiv:1412.7584, 2014. +[126] Zhirong Wu, Shuran Song, Aditya Khosla, Fisher Yu, Linguang Zhang, Xiaou Tang, and Jianxiong Xiao. 3D ShapeNets: A deep representation for volumetric shapes. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1912-1920, 2015. +[127] Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278-2324, 1998. +[128] Yue Wang, Yongbin Sun, Ziwei Liu, Sanjay E Sarma, Michael M Bronstein, and Justin M Solomon. Dynamic graph CNN for learning on point clouds. Acm Transactions On Graphics (tog), 38(5):1-12, 2019. +[129] Zelin Xiao, Hongxin Lin, Renjie Li, Lishuai Geng, Hongyang Chao, and Shengyong Ding. Endowing deep 3d models with rotation invariance based on principal component analysis. In 2020 IEEE International Conference on Multimedia and Expo (ICME), pages 1-6. IEEE, 2020. +[130] Feiran Li, Kent Fujiwara, Fumio Okura, and Yasuyuki Matsushita. A closer look at rotation-invariant deep point cloud analysis. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 16218-16227, 2021. +[131] Sture Holm. A simple sequentially rejective multiple test procedure. Scandinavian Journal of Statistics, 6(2):65-70, 1979. ISSN 03036898, 14679469. +[132] Nico Schlömer. quadpy. URL https://github.com/sigma-py/quadpy. +[133] Xu Yan. Pointnet/pointnet++ pytorch, 2019. URL https://github.com/yanx27/Pointnet_Pointnet2Pytorch. +[134] Harold W Kuhn. The hungarian method for the assignment problem. Naval research logistics quarterly, 2(1-2):83-97, 1955. +[135] Xiaoshui Huang, Guofeng Mei, Jian Zhang, and Rana Abbas. A comprehensive survey on point cloud registration. arXiv preprint arXiv:2103.02690, 2021. +[136] William Jake Johnson. Comparing variations of the neyman-pearson lemma. Master's thesis, Montana State University, 2016. +[137] Mark Aronovich Naimark. Linear representations of the Lorentz group. Elsevier, 1964. +[138] Francisco Eiras, Motasem Alfarra, Philip Torr, M. Pawan Kumar, Puneet K. Dokania, Bernard Ghanem, and Adel Bibi. ANCER: Anisotropic certification via sample-wise volume maximization. Transactions of Machine Learning Research, 2022. +[139] Emily A Cooper and Hany Farid. A toolbox for the radial and angular marginalization of bivariate normal distributions. arXiv preprint arXiv:2005.09696, 2020. +[140] DLMF. NIST Digital Library of Mathematical Functions. http://dlmf.nist.gov/, Release 1.1.5 of 2022-03-15. URL http://dlmf.nist.gov/. F. W. J. Olver, A. B. Olde Daalhuis, D. W. Lozier, B. I. Schneider, R. F. Boisvert, C. W. Clark, B. R. Miller, B. V. Saunders, H. S. Cohl, and M. A. McClain, eds. + +[141] Charles J Clopper and Egon S Pearson. The use of confidence or fiducial limits illustrated in the case of the binomial. Biometrika, 26(4):404-413, 1934. +[142] Gerald J. Hahn and William Q. Meeker. Statistical Intervals. Wiley, August 1991. +[143] George B Dantzig and Abraham Wald. On the fundamental lemma of neyman and pearson. The Annals of Mathematical Statistics, 22(1):87-93, 1951. +[144] Kenneth Hung and William Fithian. Rank verification for exponential families. The Annals of Statistics, 47(2):758-782, 2019. \ No newline at end of file diff --git a/invarianceawarerandomizedsmoothingcertificates/images.zip b/invarianceawarerandomizedsmoothingcertificates/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..366f7b2ad34a47560c9c61cf4abbd6567b05b191 --- /dev/null +++ b/invarianceawarerandomizedsmoothingcertificates/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d9d49b9dff3e86c788fce316f0b62751b9098270b98fff1b90f388249a40e382 +size 253198 diff --git a/invarianceawarerandomizedsmoothingcertificates/layout.json b/invarianceawarerandomizedsmoothingcertificates/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..b0d79d5bfd69bdab74bc66c458ce67317b4d150a --- /dev/null +++ b/invarianceawarerandomizedsmoothingcertificates/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f226915a98ce2e332c4aab5c5584037728c0e1ee4b9f3985c030c1ca12af6d0b +size 787711 diff --git a/invariancelearningbasedonlabelhierarchy/a8f586cf-b81e-4c13-a247-40949d680b39_content_list.json b/invariancelearningbasedonlabelhierarchy/a8f586cf-b81e-4c13-a247-40949d680b39_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..7ae98e3a8402852ca457521f03802233de721949 --- /dev/null +++ b/invariancelearningbasedonlabelhierarchy/a8f586cf-b81e-4c13-a247-40949d680b39_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:61758329eeac2537b37880699637eaa47964eb82d110475cad725e980dd07d1b +size 95264 diff --git a/invariancelearningbasedonlabelhierarchy/a8f586cf-b81e-4c13-a247-40949d680b39_model.json b/invariancelearningbasedonlabelhierarchy/a8f586cf-b81e-4c13-a247-40949d680b39_model.json new file mode 100644 index 0000000000000000000000000000000000000000..7b6e2f7dc01414dcb251db8863895ebc9d6321c5 --- /dev/null +++ b/invariancelearningbasedonlabelhierarchy/a8f586cf-b81e-4c13-a247-40949d680b39_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fdee05673bb0d3fd0918c6e7a574817660bcc88d411b22e850fea2e339284177 +size 123585 diff --git a/invariancelearningbasedonlabelhierarchy/a8f586cf-b81e-4c13-a247-40949d680b39_origin.pdf b/invariancelearningbasedonlabelhierarchy/a8f586cf-b81e-4c13-a247-40949d680b39_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..bd909ba884a7993a71acf883f7cf3b3e446ec142 --- /dev/null +++ b/invariancelearningbasedonlabelhierarchy/a8f586cf-b81e-4c13-a247-40949d680b39_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:04340ae4b6f1799a9baa6a0aea1a6e1a29d2e8ee97946083ccc896e9920044a7 +size 1045843 diff --git a/invariancelearningbasedonlabelhierarchy/full.md b/invariancelearningbasedonlabelhierarchy/full.md new file mode 100644 index 0000000000000000000000000000000000000000..28027b1fc3384203a02e95333b24bdebe20aa8e8 --- /dev/null +++ b/invariancelearningbasedonlabelhierarchy/full.md @@ -0,0 +1,442 @@ +# Invariance Learning based on Label Hierarchy + +Shoji Toyota + +The Graduate University for Advanced Studies + +Tokyo 190-8562, Japan + +shoji@ism.ac.jp + +Kenji Fukumizu + +The Institute of Statistical Mathematics + +The Graduate University for Advanced Studies + +Tokyo 190-8562, Japan + +fukumizu@ism.ac.jp + +# Abstract + +Deep Neural Networks inherit biased correlations embedded in training data and hence may fail to predict desired labels on unseen domains (or environments), which have different distributions from the domain to provide training data. Invariance Learning (IL) has been developed recently to overcome this shortcoming; using training data in many domains, IL estimates such a predictor that is invariant to a change of domain. However, the requirement of training data in multiple domains is a strong restriction of using IL, since it demands expensive annotation. We propose a novel IL framework to overcome this problem. Assuming the availability of data from multiple domains for a classification task at a higher level, for which the labeling cost is lower, we estimate an invariant predictor for the target classification task with training data gathered in a single domain. Additionally, we propose two cross-validation methods for selecting hyperparameters of invariance regularization, which has not been addressed properly in existing IL methods. The effectiveness of the proposed framework, including the cross-validation, is demonstrated empirically. Theoretical analysis reveals that our framework can estimate the desirable invariant predictor with a hyperparameter fixed correctly, and that such a preferable hyperparameter is chosen by the proposed CV methods under some conditions. + +# 1 Introduction + +Training data used in machine learning may contain features that are spuriously correlated to the labels of data. Deep Neural Networks (DNNs) often learn such biased correlations embedded in training data and hence may fail to predict desired labels of test data generated by a different distribution from one to provide training data. In classification of animal images, DNNs tend to misclassify cows on sandy beaches, since most training pictures are taken in green pastures and DNNs inherit context information in training [3, 9]. Another example is learning from medical data. Systems trained with data collected in one hospital do not generalize well to other hospitals; DNNs unintentionally extract environmental factors specific to a particular hospital in training [16-18]. + +Invariance Learning (IL) is a rapidly developed approach to overcome the issue of biased correlation, which is caused by some bias in the distribution of a training dataset [10-15, 21, 33-36, 54]. In this paper, we use the term domain to specify the bias in the distribution of a dataset. IL is thus a method for removing the influence of domain shits. Using training data from multiple domains, IL + +estimates a predictor invariant to the change of domains, aiming at keeping good performance in unseen domains as well as in the training domains. + +While the IL approach has attracted much attention, requiring training data from multiple domains may hinder wide applications in practice; preparing training data in many domains often involves expensive data annotation. In real-world data, labels may be missing [42-45, 56-58] or incomplete; in some cases, data may only specify classes to which the image does not belong [46-48]. Such data with insufficient annotation are not directly applicable to the standard IL methods; they must be re-annotated accurately, often at great financial or human expense. The high cost drives a strong need to establish a new IL framework without or with lower annotation costs. + +To mitigate the problem of annotation cost, we propose a novel IL framework for the situation where the training data of target classification is given in only one domain, while the task of higher label hierarchy, which needs lower annotation cost, has data from multiple domains. Here, the task of higher label hierarchy means a classification task with coarser labels than those of the target classification. Figure 1 shows an + +![](images/bf33c62ebd94d7e42185b2d8c4d263749eef498a7d74e13897f795e8464404d1.jpg) +Figure 1: Example of Label hierarchy. Blue labels are in higher level of label hierarchy than red labels. + +example of label hierarchy. Consider the case where a target classification has 300 labels $\{\mathrm{bird}_1,..\mathrm{bird}_{100},\mathrm{snake}_1,\dots,\mathrm{snake}_{100},\mathrm{turtle}_1,\dots,\mathrm{turtle}_{100}\}$ corresponding to 300 species. Then, the binary labels $\{\mathrm{bird},\mathrm{reptile}\}$ are an example of labels in the higher hierarchy. The decrease in the number of classes reduces annotation time per image. Moreover, annotation of the binary labels does not require any expert knowledge, while annotation of the original 300 labels would require expert knowledge about birds, snakes, and turtles. Hence, the new IL framework significantly reduces the annotation cost in comparison with previous IL methods; we need exhausting annotation of 300 classes only for one domain and just binary labels for other domains. + +Another important issue in IL is hyperparameter selection. Most IL methods involve some hyperparameters to balance the classification accuracy and the degree of invariance. As [21] and [19] point out, in the literature of IL, the best performances of invariance had often been achieved by selecting the hyperparameters using test data from unseen domains. Moreover, [19] numerically demonstrated that, without using test data, simple methods of hyperparameter selection fail to find a preferable hyperparameter. It demonstrates a strong need for establishing an appropriate method of hyperparameter selection for IL. + +We propose two methods of cross-validation (CV) for hyperparameter selection in our new IL framework. Since we assume training data of a single domain for the target task, it is impossible to estimate the deviation of the risks over the domains. Our CV methods mitigate the difficulty by using additional data from multiple domains in the higher label hierarchy. Theoretical analysis proves that our methods select a hyperparameter correctly under some conditions. + +The main contributions of this paper are as follows: + +- We establish a novel framework of invariance learning, which estimates an invariant predictor from a single domain data, assuming additional data from multiple domains for a classification task at a higher level. +- Under the framework, we propose two methods of cross-validation for selecting hyperparameters without accessing any samples from unseen target domains. +- Experimental studies verify that the proposed framework extracts an invariant predictor more effectively than other existing methods. +- We mathematically prove that our framework can estimate a correct invariant predictor with a hyperparameter fixed correctly and that such a preferable hyperparameter is selected by the proposed CV methods under some settings. + +# 2 Invariance Learning based on Label Hierarchy + +Notations Throughout this paper, the space of input features and finite class labels are denoted by $\mathcal{X}$ and $\mathcal{Y}$ , respectively. For given predictor $f: \mathcal{X} \to \mathcal{Y}$ and random variable $(X,Y)$ on $\mathcal{X} \times \mathcal{Y}$ with its probability $P_{X,Y}$ , $\mathcal{R}^{(X,Y)}(f)$ denotes the risk of $f$ on $(X,Y)$ ; i.e., $\mathcal{R}^{(X,Y)}(f) := \int l(f(x),y)dP_{X,Y}$ , where $l: \mathcal{Y} \times \mathcal{Y} \to \mathbb{R}$ is a loss function. For $m \in \mathbb{N}_{>0}$ , $[m]$ denotes the set $\{1,\dots,m\}$ . For a finite set $A$ , $|A| \in \mathbb{N}$ denotes the number of elements in $A$ . + +# 2.1 Review of Invariance Learning + +Following [10], to formulate the out-of-distribution (o.o.d.) generalization, we assume that the joint distribution of data $(X^{e},Y^{e})$ depends on the domain (or environment) $e\in \mathcal{E}$ , and consider the dependence of a predictor $f$ on the domain variable $e$ . Suppose we are given training datasets $\mathcal{D}^e := \{(x_i^e,y_i^e)\}_{i = 1}^{n_e^e}\sim P_{X^e,Y^e}$ i.i.d. from multiple domains $\mathcal{E}_{tr}\subset \mathcal{E}$ . The final goal of the o.o.d. problem is to predict a desired label $Y^{e}\in \mathcal{V}$ from $X^{e}\in \mathcal{X}$ for larger target domains $\mathcal{E}\supset \mathcal{E}_{tr}$ . To discuss the o.o.d. performance, [10] introduced the o.o.d. risk + +$$ +\mathcal {R} ^ {o. o. d.} (f) := \max _ {e \in \mathcal {E}} \mathcal {R} ^ {e} (f), \tag {1} +$$ + +where $\mathcal{R}^e (f)\coloneqq \mathcal{R}^{(X^e,Y^e)}(f)$ . This is the worst case risk over $\mathcal{E}$ , including unseen domains $\mathcal{E}\setminus \mathcal{E}_{tr}$ + +To solve (1), [10] estimates a predictor $f$ that performs well in unseen domains $\mathcal{E} \setminus \mathcal{E}_{tr}$ as well as training domains $\mathcal{E}_{tr}$ , namely a predictor invariant to a change of domains. The invariant predictor $f$ is composed of two maps $\Phi$ and $w$ ; that is, $f = w \circ \Phi$ holds. A feature map $\Phi : \mathcal{X} \to \mathcal{H}$ , which is often called an invariance, realizes a feature of $x \in \mathcal{X}$ in the feature space $\mathcal{H}$ with biased correlations in $x$ removed. A predictor $w : \mathcal{H} \to \mathcal{Y}$ estimates the label of feature $\Phi(x)$ . The estimation of an invariant predictor is implemented by solving the following optimization problem: + +$$ +\min _ {\Phi \in \mathcal {I} _ {t r}, w: \mathcal {H} \rightarrow \mathcal {Y}} \sum_ {e \in \mathcal {E} _ {t r}} \mathcal {R} ^ {e} (w \circ \Phi), \tag {2} +$$ + +where $\mathcal{I}_{tr}$ is the set of invariances captured by $\bigcup_{e\in \mathcal{E}_{tr}}\mathcal{D}^e$ : + +$$ +\mathcal {I} _ {t r} := \left\{\Phi : \mathcal {X} \rightarrow \mathcal {H} \mid P \left(Y ^ {e _ {1}} \mid \Phi \left(X ^ {e _ {1}}\right)\right) = P \left(Y ^ {e _ {2}} \mid \Phi \left(X ^ {e _ {2}}\right)\right) \text {f o r a n y} e _ {1}, e _ {2} \in \mathcal {E} _ {t r} \right\}. +$$ + +This invariance is based on conditional independence as [14, 15, 40], while [10, 11] use a different type invariance based on $\arg \min_w\mathcal{R}^e (w\circ \Phi)$ instead of $P(Y^{e}|\Phi (X^{e}))$ . All IL methods estimate the invariance using the difference among $\mathcal{E}_{tr}$ , assuming the availability of multiple training domains. + +# 2.2 Invariance estimation by higher label data + +Our goal is to make an invariant predictor from a single training domain $\mathcal{E}_{tr} = \{e^{*}\}$ . In this case, (2) is reduced to the empirical risk minimization $\min_{f}\mathcal{R}^{e^{*}}(f)$ on $e^{*}$ , and therefore the standard IL framework is not able to extract an invariance. + +In this paper, we introduce an assumption that additional data $\mathcal{D}_{ad}^{e}$ for an another task $(X^{e},Z^{e})$ , which is in the higher label hierarchy than $(X^{e},Y^{e})$ , is available with respect to multiple domains $\mathcal{E}_{ad}\subset \mathcal{E}$ . The task of higher hierarchy $(X^{e},Z^{e})$ has a coarser label $Z^{e}\in \mathcal{Z}$ than $Y^{e}\in \mathcal{V}$ ; more formally, $Z^{e}$ is represented as $Z^{e} = g(Y^{e})$ with a surjective label mapping $g:\mathcal{V}\to \mathcal{Z}$ from the lower to the higher level in the label hierarchy. The example in Section 1 is formalized by a surjective function $g$ as, setting $\mathcal{V}\coloneqq \{\mathrm{bird}_1,\dots,\mathrm{bird}_{100},\mathrm{turtle}_1,\dots,\mathrm{turtle}_{100},\mathrm{snake}_1,\dots,\mathrm{snake}_{100}\}$ and $\mathcal{Z}\coloneqq \{\mathrm{bird},\mathrm{reptile}\}$ , $g(y)\coloneqq \mathrm{bird}$ if $y = \mathrm{bird}_i$ ( $i\in \{1,2,\dots,100\}$ ) and $g(y)\coloneqq$ reptile else. + +By making use of $\{\mathcal{D}_{ad}^e\}_{e\in \mathcal{E}_{ad}}$ , our objective for the invariant prediction is given by + +$$ +\min _ {\Phi \in \mathcal {I} _ {a d}, w: \mathcal {H} \rightarrow \mathcal {Y}} \mathcal {R} ^ {e ^ {*}} (w \circ \Phi), \tag {3} +$$ + +where $\mathcal{I}_{ad}$ is the set of invariances: + +$$ +\mathcal {I} _ {a d} := \left\{\Phi : \mathcal {X} \rightarrow \mathcal {H} \mid P (g (Y ^ {e _ {1}}) | \Phi (X ^ {e _ {1}})) = P (g (Y ^ {e _ {2}}) | \Phi (X ^ {e _ {2}})) \text {f o r a n y} e _ {1}, e _ {2} \in \mathcal {E} _ {a d} \right\}. +$$ + +Note that (3) evaluates the risk with a single training domain while the invariances are given by additional data of multiple domains. + +# 2.3 Construction of objective function + +Among several candidates of the loss and model design, we focus a probabilistic output case and evaluate its error by the cross entropy loss; that is, we model $w$ by $p_{\theta} : \mathcal{H} \to \mathcal{P}_{\mathcal{Y}}$ , where $\mathcal{P}_{\mathcal{Y}}$ denotes the set of probabilities on $\mathcal{Y}$ and $\theta$ denotes a model parameter. The risk is then written by + +$$ +\mathcal {R} ^ {e} (p _ {\theta} \circ \Phi) = \int - \log p _ {\theta} (Y ^ {e} | \Phi (X ^ {e})) d P _ {X ^ {e}, Y ^ {e}}. +$$ + +We aim to solve (3) by minimizing the following objective function: + +$$ +\begin{array}{l} \text {O b j e c t i v e} (\theta , \Phi) := \hat {\mathcal {K}} ^ {e ^ {*}} \left(p _ {\theta} \circ \Phi\right) \\ + \lambda \cdot (\text {D e p e n d e n c e} P (g \left(Y ^ {e}\right) | \Phi \left(X ^ {e}\right)) \text {o n} e \in \mathcal {E} _ {a d}). \tag {4} \\ \end{array} +$$ + +Here, $\hat{\mathcal{R}}^{e^*}(p_\theta \circ \Phi)$ denotes the empirical risk of $p_\theta \circ \Phi$ on the training domain $\mathcal{E}_{tr} = \{e^*\}$ evaluated by $\mathcal{D}^{e^*} \colon \hat{\mathcal{R}}^{e^*}(p_\theta \circ \Phi) := -\frac{1}{|\mathcal{D}^{e^*}|} \sum_{(x^{e^*}, y^{e^*}) \in \mathcal{D}^{e^*}} \log p_\theta(y^{e^*} | \Phi(x^{e^*}))$ . While we can consider some variations of invariance regularization, we adopt the one used in [10] and construct an objective function as + +$$ +\text {O b j e c t i v e} (\theta , \theta_ {a d}, \Phi) := \hat {\mathcal {R}} ^ {e ^ {*}} (p _ {\theta} \circ \Phi) + \lambda \cdot \sum_ {e \in \mathcal {E} _ {a d}} \| \nabla_ {\hat {\theta} _ {a d} = \theta_ {a d}} \hat {\mathcal {R}} ^ {(X ^ {e}, Z ^ {e})} \left(p _ {\hat {\theta} _ {a d}} ^ {\mathcal {Z} | \mathcal {H}} \circ \Phi\right) \| ^ {2}. \tag {5} +$$ + +Here, $p_{\theta}^{\mathcal{Z}|\mathcal{H}}:\mathcal{H}\to \mathcal{P}_{\mathcal{Z}}$ is the linear logistic regression model same as [10], $\Phi$ is a nonlinear neural network, and $\hat{\mathcal{R}}^{(X^e,Z^e)}(p_{\theta_{ad}}^{\mathcal{Z}|\mathcal{H}}\circ \Phi)\coloneqq -\frac{1}{|\mathcal{D}_{ad}^e|}\sum_{(x^e,z^e)\in \mathcal{D}_{ad}^e}\log p_{\theta_{ad}}^{\mathcal{Z}|\mathcal{H}}(z^e |\Phi (x^e))$ + +It is not obvious if the regularization term in (5) is valid as a dependence measure of $P(g(Y^{e})|\Phi (X^{e}))$ , since it was proposed for another type of invariance based on $\mathrm{argmin}_w\mathcal{R}^e (w\circ \Phi)$ . The next lemma shows that these notions of invariance are the same in the current setting. + +Lemma 1. When modeling $w$ by conditional probabilities, the following statements are equivalent: + +$P(Z^{e}|\Phi (X^{e}))$ does not depend on $e\Leftrightarrow \operatorname{argmin}_{p_{\theta_{ad}}^{\mathcal{Z}|\mathcal{H}}}\mathcal{R}^{(X^{e},Z^{e})}(p_{\theta_{ad}}^{\mathcal{Z}|\mathcal{H}}\circ \Phi)$ does not depend on $e,$ where model $p_{\theta_{ad}}^{\mathcal{Z}|\mathcal{H}}$ in the right hand side runs over all probability densities. + +While our objective function (5) is similar to the ones in [10, 21] in that they are composed of an empirical risk and an invariance regularization, the correctness has not been fully discussed so far. In Section 4, we will mathematically prove the correctness of (5) under some settings. + +# 3 Hyperparameter selection method + +# 3.1 Hyperparameter Selection in Invariance Learning + +The objective function (5) has a hyperparameter $\lambda$ to select, as is often the case with IL methods. The hyperparameter selection in IL has special difficulty, however; because the o.o.d. problem needs to predict $Y^{e}$ on unseen domains, $\lambda$ must be chosen without accessing any data in such unseen domains. It was reported in [19, 21] that the success of IL methods depends strongly on the careful choice of hyperparameters, and some of the results even used data from unseen domains in the choice. [19] reported also experimental results of various IL methods with two CV methods, training-domain validation (Tr-CV) and leave-one-domain-out validation (LOD-CV), and showed that the CV methods failed to select preferable hyperparameters. In the Colored MNIST experiment, for example, the accuracy of Invariant Risk Minimization [10] is $52.0\%$ at best, which is about a random guess level. + +The failure of the CV methods is caused by the improper design of the objective function for CV; they do not simulate the o.o.d. risk, which is the maximum risk over the domains. Tr-CV splits data in each training domain into training and validation subsets, and takes the sum of the validated risks over the training domains. Obviously, this is not an estimate of the o.o.d. risk. LOD-CV holds out one domain among the training domains in turn and validates models with the average of the validated risks over the held-out domains. Again, this average does not correspond to the o.o.d. risk. In summary, the problem we need to solve is answering the following question: how can we construct an evaluation function of the o.o.d. risk from validation data? In the sequel, we will propose two methods of CV, which are summarized in Algorithm 1. + +Algorithm 1 CV methods. If CORRECTION = True, $\lambda$ is selected by method II and if False, I. +Require: : Split $\mathcal{D}^{e^*},\mathcal{D}_{ad}^{e_1},\ldots ,\mathcal{D}_{ad}^{e_n}$ into $K$ parts. Set the hyperparameter candidates $\Lambda$ +Require: $\hat{P}^{e}(z^{\sim})\gets \frac{|D_{ad,z^{\sim}}^{e}|}{|D_{ad}^{e}|}$ where $\mathcal{D}_{ad,z}^{e}:= \{(x,z)\in \mathcal{D}_{ad}^{e}|z = z^{\sim}\}$ for all $e\in \mathcal{E}_{ad}$ and $z^{\sim}\in \mathcal{Z}^{\prime \prime}$ +1: for $\lambda \in \Lambda$ do +2: for $k = 1$ to $K$ do +3: Learn $\theta_{[-k]}^{\lambda},\Phi_{[-k]}^{\lambda}$ by using $\mathcal{D}_{[-k]}^{e^*},\mathcal{D}_{ad,[-k]}^{e_1},\ldots ,\mathcal{D}_{ad,[-k]}^{e_n}$ +4: $\hat{\mathcal{R}}_k^{e^*}(\lambda)\leftarrow \frac{1}{|\mathcal{D}_{[k]}^{e^*}|}\sum_{(x^{e^*},y^{e^*})\in \mathcal{D}_{[k]}^{e^*}} - \log p_{\theta_{[-k]}}(\boldsymbol {y}^{e^*}|\Phi_{[-k]}^{\lambda}(\boldsymbol{x}^{e^*}))$ //Risk estimation on $e^*$ +5: $\hat{\mathcal{R}}_k^{e^* |z^{\sim}}(\lambda)\leftarrow \frac{1}{|\mathcal{D}_{[k],z^{\sim}}^{e^*}|}\sum_{(x,y)\in \mathcal{D}_{[k],z^{\sim}}^{e^*}} - \log p_{\theta_{[-k]}}(\boldsymbol {y}|\Phi_{[-k]}^{\lambda}(\boldsymbol {x}),g(Y) = z^{\sim})$ for $z^{\prime}$ in $\mathcal{Z}^{\prime \prime}$ +6: for $e\in \mathcal{E}_{ad}$ do +7: $\hat{\mathcal{R}}_k^e (\lambda)\leftarrow \frac{1}{|\mathcal{D}_{ad,[k]}^e|}\sum_{(x^e,z^e)\in \mathcal{D}_{ad,[k]}^e} - \log p_{\theta_{[-k]}^{\lambda}}(z^{e}|\Phi_{[-k]}^{\lambda}(x^{e}))$ // Risk estimation on e. +8: if CORRECTION then +9: $\hat{\mathcal{R}}_k^e (\lambda) + \leftarrow \sum_{z^{\sim}\in \mathcal{Z}^{\sim}}\hat{P}^{e}(z^{\sim})\cdot \hat{\mathcal{R}}_k^{e^* |z^{\sim}}(\lambda)$ // Correction term addition. +10: end if +11: end for +12: $\hat{\mathcal{R}}_{k}^{o.o.d.}(\lambda)\gets \max_{e\in \mathcal{E}_{ad}\cup \{e^{*}\}}\hat{\mathcal{R}}_k^e (\lambda)$ // o.o.d. risk estimation. +13: end for +14: $\hat{\mathcal{R}}^{o.o.d.}(\lambda)\leftarrow \frac{1}{K}\sum_{k = 1}^{K}\hat{\mathcal{R}}_k^{o.o.d.}(\lambda)$ // Final o.o.d. risk estimation. +15: end for +16: Select $\lambda^{*}\coloneqq \mathrm{argmin}_{\lambda \in \Lambda}\hat{\mathcal{R}}^{o.o.d.}(\lambda)$ + +# 3.2 Method I: using data of higher level task + +We divide each of $\mathcal{D}^{e^*},\mathcal{D}_{ad}^{e_1},\dots,\mathcal{D}_{ad}^{e_n}$ into $K$ parts where $|\mathcal{E}_{ad}| = n$ , and use the $k$ -th sample $\{\mathcal{D}_{[k]}^{e^*},\mathcal{D}_{ad,[k]}^{e_1},\dots,\mathcal{D}_{ad,[k]}^{e_n}\}$ and the rest $\{\mathcal{D}_{[-k]}^{e^*},\mathcal{D}_{ad,[-k]}^{e_1},\dots,\mathcal{D}_{ad,[-k]}^{e_n}\}$ for validation and training, respectively. To approximate the o.o.d. risk of the trained predictor $p_{\theta_{[-k]}^{\lambda}}\circ \Phi_{[-k]}^{\lambda}$ , we wish to estimate $\mathcal{R}^e (p_{\theta_{[-k]}^{\lambda}}\circ \Phi_{[-k]}^{\lambda})$ for $e\in \mathcal{E}_{ad}\cup \{e^{*}\}$ by the validation set. For $e^{*}$ , we use the standard empirical estimate $\hat{\mathcal{R}}_{[k]}^{e^*}(p_{\theta_{[-k]}^{\lambda}}\circ \Phi_{[-k]}^{\lambda})$ . For $e\in \mathcal{E}_{ad}$ , we substitute unavailable $Y^{e}$ with $Z^{e}$ and use $\hat{\mathcal{R}}_{[k]}^{(X^{e},Z^{e})}(p_{\theta_{[-k]}^{\lambda}}\circ \Phi_{[-k]}^{\lambda}) := \frac{1}{|\mathcal{D}_{ad,[k]}^{e}|}\sum_{(x^{e},z^{e})\in \mathcal{D}_{ad,[k]}^{e}} - \log p_{\theta_{[-k]}^{\lambda}}(z^{e}|\Phi_{[-k]}^{\lambda}(x^{e}))$ . + +# 3.3 Method II: using correction term + +Method I can be improved by correcting the replacement $\mathcal{R}^e = \mathcal{R}(X^e,Y^e)$ with $\mathcal{R}(X^e,Z^e)$ for $e\in$ $\mathcal{E}_{ad}$ . We use the following theorem for the correction: + +Theorem 2. Let $\mathcal{Z}^{\mathcal{K}}\coloneqq \left\{z\in \mathcal{Z}\left||g^{-1}(z)| > 1\right.\}$ . For any map $\Phi :\mathcal{X}\to \mathcal{H}$ , $p_{\theta}:\mathcal{H}\rightarrow \mathcal{P}_{\mathcal{V}}$ , and random variable $(X,Y)$ on $\mathcal{X}\times \mathcal{V}$ , the following equality holds: + +$$ +\mathcal {R} ^ {(X, Y)} (p _ {\theta} \circ \Phi) = \mathcal {R} ^ {(X, g (Y))} (p _ {\theta} \circ \Phi) + \sum_ {z ^ {\nearrow} \in \mathcal {Z} ^ {\nearrow}} \Big \{P (g (Y) = z ^ {\nearrow}) \times \mathcal {R} ^ {(X, Y) | z ^ {\nearrow}} (p _ {\theta} \circ \Phi) \Big \}. +$$ + +Here, $\mathcal{R}^{(X,Y)|z^{\prime}}(p_{\theta}\circ \Phi)\coloneqq \int -\log p_{\theta}\big(Y|\Phi (X),g(Y) = z^{\prime}\big)dP_{(X,Y)|g(Y) = z^{\prime}}$ where $P_{(X,Y)|g(Y) = z^{\prime}}$ denotes the conditional distribution of $(X,Y)$ given the event $g(Y) = z^{\prime}$ , and $p_{\theta}(y|\Phi (x),g(Y) = z^{\prime})\coloneqq \frac{p_{\theta}(y|\Phi(x))}{\sum_{y\in g^{-1}(z^{\prime})}p_{\theta}(y|\Phi(x))}$ . + +The proof is given in Appendix A. The theorem shows that, to estimate the correction term, we need to estimate (i) $P(g(Y^{e}) = z^{\prime})$ and (ii) $\mathcal{R}^{(X^e,Y^e)|z^\prime}(p_{\theta_{[-k]}^{\lambda}}\circ \Phi_{[-k]}^{\lambda})$ for every $z^{\prime}\in \mathcal{Z}^{\prime}$ . + +(i) is naturally estimated even on $e \in \mathcal{E}_{ad}$ : $\hat{P}(Z^e = z^{\prec}) \coloneqq \frac{|\mathcal{D}_{ad,z^{\prec}}^e|}{|\mathcal{D}_{ad}^e|}$ , where $\mathcal{D}_{ad,z^{\prec}}^e \coloneqq \{(x,z) \in \mathcal{D}_{ad}^e | z = z^{\prec}\}$ . (ii) is not easily estimable; while a direct simulation of the integration $\int dP_{(X^e,Y^e)|g(Y^e) = z^{\prec}}$ demands data from $(X^e,Y^e) \sim P_{X^e,Y^e}$ , our available data $\mathcal{D}_{ad}^e$ on $e \in \mathcal{E}_{ad}$ is from $P_{X^e,g(Y^e)}$ , not from $P_{X^e,Y^e}$ . To solve the non-availability of data from $P_{X^e,Y^e}$ , we use the training data $\mathcal{D}^{e^*} \sim P_{X^{e^*},Y^{e^*}}$ instead. Namely, (ii) is estimated by + +$$ +\hat {\mathcal {R}} _ {[ k ]} ^ {(X ^ {e ^ {*}}, Y ^ {e ^ {*}}) | z ^ {\nearrow}} (p _ {\theta_ {[ - k ]} ^ {\lambda}} \circ \Phi_ {[ - k ]} ^ {\lambda}) := \frac {1}{| \mathcal {D} _ {[ k ] , z ^ {\nearrow}} ^ {e ^ {*}} |} \sum_ {(x, y) \in \mathcal {D} _ {[ k ] , z ^ {\nearrow}} ^ {e ^ {*}}} - \log p _ {\theta_ {[ - k ]} ^ {\lambda}} (y | \Phi_ {[ - k ]} ^ {\lambda} (x), g (Y) = z ^ {\nearrow}), +$$ + +where $\mathcal{D}_{[k],z^{\times}}^{e^{*}}\coloneqq \left\{(x,y)\in \mathcal{D}_{[k]}^{e^{*}}|g(y) = z^{\times}\right\} \subset \mathcal{D}_{[k]}^{e^{*}}$ . In Algorithm 1, the above risk estimate is abbreviated by $\hat{\mathcal{R}}_{[k]}^{e^* |z^{\times}}(\lambda)$ for notation simplicity. + +# 4 Theoretical analysis + +Throughout this section, to avoid discussing the non-trivial effects of nonlinear $\Phi$ , we focus on the simplified case of variable selections, where the feature map $\Phi$ is chosen from the projections of $x$ to a subset of its components. For example, $\Phi$ may be $\Phi(x_1, x_2, x_3) = (x_1, x_3)$ when $x$ is three-dimensional. This type of IL appears practically in causal inference [14, 13] and regression [40]. Let $\mathcal{X} \coloneqq \mathcal{X}_1 \times \mathcal{X}_2$ where $\mathcal{X}_1 \coloneqq \mathbb{R}^{n_1}$ and $\mathcal{X}_2 \coloneqq \mathbb{R}^{n_2}$ with $n_1, n_2 \in \mathbb{N}$ . For a projection $\Phi$ , let $\Phi_i$ denote the $\mathcal{X}_i$ -component of $\Phi$ ( $i = 1, 2$ ). If $\Phi$ has a $\mathcal{X}_2$ -component, we write $\operatorname{Im} \Phi_2 \neq \emptyset$ . For simplicity of analysis, the domain set $\mathcal{E}$ is defined by all the probability distributions with the fixed marginal distribution $P_{X_1^I, Y^I}$ of $(X_1, Y)$ ; namely, + +$$ +\left\{\left(X ^ {e}, Y ^ {e}\right) \right\} _ {e \in \mathcal {E}} := \left\{\left(X, Y\right): \text {a r a n d o m v a r i a b l e o n} \mathcal {X} \times \mathcal {Y} \left| P _ {\Phi^ {x _ {1}} (X), Y} = P _ {X _ {1} ^ {I}, Y ^ {I}} \right. \right\}. \quad (\text {※}) +$$ + +In this case, for any $e \in \mathcal{E}$ the variable $(X^e, Y^e)$ satisfies (i) $P_{Y^e|\Phi^{x_1}(X^e)}$ equals to $P_{Y^I|X_1^I}$ , and (ii) the marginal distribution $P_{\Phi^{x_1}(X)}$ of the invariant feature $\Phi^{x_1}(X)$ equals to $P_{X_1^I}$ . The above setting and definition persist through Section 4. + +# 4.1 Theoretical analysis of our objective function + +The following theorem ensures that, neglecting estimations and under some conditions, a minimum of our objective function (5) with careful hyperparameter choice also minimizes the o.o.d. risk (1): + +Theorem 3 (o.o.d. optimality of our objective function). Under the setting $(\ast)$ , additionally assume that the following condition holds: + +(A) For any variable selection $\Phi$ with $\operatorname{Im}\Phi_2 \neq \emptyset$ , there exist two domains $\{e_1, e_2\} \subset \mathcal{E}_{ad}$ such that $P(g(Y^{e_1})|\Phi(X^{e_1})) \neq P(g(Y^{e_2})|\Phi(X^{e_2}))$ . + +Then, there exists $\lambda^{*}\in \mathbb{R}$ such that any minimizer $(\theta^{\dagger},\theta_{ad}^{\dagger},\Phi^{\dagger})$ of (5), + +$$ +\left(\theta^ {\dagger}, \theta_ {a d} ^ {\dagger}, \Phi^ {\dagger}\right) \in \operatorname * {a r g m i n} _ {\theta , \theta_ {a d}. \Phi} \left\{\mathcal {R} ^ {e ^ {*}} \left(p _ {\theta} \circ \Phi\right) + \lambda^ {*} \cdot \sum_ {e \in \mathcal {E} _ {a d}} \| \nabla_ {\hat {\theta} _ {a d} = \theta_ {a d}} \mathcal {R} ^ {\left(X ^ {e}, Z ^ {e}\right)} \left(p _ {\hat {\theta} _ {a d}} ^ {\mathcal {Z} | \mathcal {H}} \circ \Phi\right) \| ^ {2} \right\}, +$$ + +is o.o.d. optimal, i.e., + +$$ +p _ {\theta^ {\dagger}} \circ \Phi^ {\dagger} \in \operatorname * {a r g m i n} _ {p _ {\theta}: \mathcal {X} \to \mathcal {P} _ {\mathcal {Y}}} \mathcal {R} ^ {o. o. d.} (p _ {\theta}), +$$ + +where models $p_{\theta}$ and $p_{\theta_{ad}}^{\mathcal{Z}|\mathcal{H}}$ in $\min_{\theta, \theta_{ad}, \Phi}$ run all the probability density functions, and $\Phi$ runs all the variable selections. The gradient $\nabla_{\theta_{ad}}$ should be understood as the functional derivative on the space of probability density functions. + +For the proof, see Appendix B. Condition (A) means that $\mathcal{E}_{ad}$ has sufficient variation to capture the desirable invariance $\Phi^{\mathcal{X}_1}$ . + +# 4.2 Theoretical analysis of our cross validation methods + +In Sections 3.2 and 3.3, we approximate $\mathcal{R}^{(X^e,Y^e)}$ using label $Z^{e}$ of higher level. While the approximation is not exact, we will prove that the proposed CV methods still select a correct hyperparameter under some conditions. We will also elucidate the difference of the two CV methods. Given hyperparameter $\lambda$ , minimizing (5) over the model yields the feature map (variable selection) denoted by $\Phi^{\lambda}:\mathcal{X}\to \mathbb{R}^{n_{\lambda}}$ ( $n_{\lambda}\leq n_1 + n_2$ ). For simplicity of theoretical analysis, we assume that the minimization of (5) achieves perfectly the conditional probability density function of $P_{Y^{e^*}|\Phi^\lambda (X^{e^*})}$ , denoted by $p^{*,\lambda}(y|\Phi^{\lambda}(x))$ . Then, neglecting estimation errors, the approximated o.o.d. risk of $p^{*,\lambda}\circ \Phi^{\lambda}$ used in Methods I and II are represented by the following $\mathcal{R}^I (\lambda)$ and $\mathcal{R}^{II}(\lambda)$ , respectively: + +$$ +\mathcal {R} ^ {I} (\lambda) := \max \left\{\max _ {e \in \mathcal {E} _ {a d}} \mathcal {R} ^ {\left(X ^ {e}, g \left(Y ^ {e}\right)\right)} \left(p ^ {* , \lambda} \circ \Phi^ {\lambda}\right), \mathcal {R} ^ {\left(X ^ {e ^ {*}}, Y ^ {e ^ {*}}\right)} \left(p ^ {*}, \lambda \circ \Phi^ {\lambda}\right) \right\}, \tag {6} +$$ + +$$ +\mathcal {R} ^ {I I} (\lambda) := \max _ {e \in \mathcal {E} _ {a d} \cup \{e ^ {*} \}} \left\{\mathcal {R} ^ {\left(X ^ {\epsilon}, g \left(Y ^ {\epsilon}\right)\right)} \left(p ^ {*, \lambda} \circ \Phi^ {\lambda}\right) + \sum_ {z ^ {\nearrow} \in \mathcal {Z} ^ {\nearrow}} P \left(Z ^ {e} = z ^ {\nearrow}\right) \cdot \mathcal {R} ^ {\left(X ^ {\epsilon^ {*}}, Y ^ {\epsilon^ {*}}\right) | z ^ {\nearrow}} \left(p ^ {*, \lambda} \circ \Phi^ {\lambda}\right) \right\}. \tag {7} +$$ + +We have the following theoretical justification of our CV methods: the chosen $\lambda$ gives a minimizer of the correct CV criterion. For the proofs, see Appendices C and D. + +Theorem 4 (Correctness of Method I). Under the setting of variable selection $(\ast)$ , assume further that the following conditions (i) and (ii) hold: + +(i) Among a set $\Lambda$ of hyperparameter candidates, there exists $\lambda^I\in \Lambda$ such that $\Phi^{\lambda^I} = \Phi^{\mathcal{X}_1}$ +(ii) Let $p^{e^*}$ be the probability density function of $P_{X^{e^*},g(Y^{e^*})}$ . Then, for any $\lambda$ with $\mathrm{Im}\Phi_2^\lambda \neq \emptyset$ , there is $e_\lambda \in \mathcal{E}_{ad}$ such that + +$$ +(x, z) \sim P _ {X ^ {\epsilon_ {\lambda}}, g (Y ^ {\epsilon_ {\lambda}})} \text {s a t i s f i e s} p ^ {e ^ {*}} (z | \Phi^ {\lambda} (x)) \leq e ^ {- \beta} - \varepsilon \text {w i t h} +$$ + +Here, $\varepsilon \in \mathbb{R}_{>0}$ is some sufficient small positive real number (that is, $0 < \varepsilon \ll 1$ ) and $\beta := H(Y^{e^*}|\Phi^{\mathcal{X}_1}(X^{e^*}))$ is the conditional entropy of $(\Phi^{\mathcal{X}_1}(X^{e^*}),Y^{e^*})$ . + +Then, we have + +$$ +\operatorname {a r g m i n} _ {\lambda \in \Lambda} \mathcal {R} ^ {I} (\lambda) \subset \operatorname {a r g m i n} _ {\lambda \in \Lambda} \mathcal {R} ^ {o. o. d.} (p ^ {*}, \lambda \circ \Phi^ {\lambda}). +$$ + +Theorem 5 (Correctness of Method II). Under the setting of variable selection $(\ast)$ , assume that, in addition to $(i)$ in Theorem 4, the following condition (iii) holds: + +(ii)' for any $\lambda$ with $\operatorname{Im}\Phi_2^{\lambda} \neq \emptyset$ , there is $e_{\lambda} \in \mathcal{E}_{ad}$ such that + +$$ +(x, z) \sim P _ {X ^ {e _ {\lambda}}, g \left(Y ^ {e _ {\lambda}}\right)} \text {s a t i s f i e s} p ^ {e ^ {*}} (z | \Phi^ {\lambda} (x)) \leq e ^ {- \beta_ {\lambda}} - \varepsilon \text {h o l d s w i t h p r o b a b i l i t y 1}. +$$ + +Here, $\varepsilon$ is some sufficiently small positive real number and + +$$ +\beta_ {\lambda} := H \big (Y ^ {e ^ {*}} | \Phi^ {\mathcal {X} _ {1}} \big (X ^ {e ^ {*}} \big) \big) - \sum_ {z ^ {*} \in \mathcal {Z S A}} \Big \{P (g (Y ^ {e ^ {*}}) = z ^ {*}) \times \mathcal {R} ^ {(X ^ {e ^ {*}}, Y ^ {e ^ {*}}) | z ^ {*}} (p ^ {*}, \lambda \circ \Phi^ {\lambda}) \Big \}. +$$ + +Then, under the setting $(\text{※})$ , we have + +$$ +\operatorname {a r g m i n} _ {\lambda \in \Lambda} \mathcal {R} ^ {I I} (\lambda) \subset \operatorname {a r g m i n} _ {\lambda \in \Lambda} \mathcal {R} ^ {o. o. d.} \left(p ^ {*}, \lambda \circ \Phi^ {\lambda}\right). +$$ + +The conditions (ii) and (ii)' impose that, for at least one $e_{\lambda} \in \mathcal{E}_{ad}$ , the two domains $e_{\lambda}$ and $e^{*}$ are different in the following meaning. If $\lambda$ fails to remove domain-specific factors (i.e., $\operatorname{Im}\Phi_2^\lambda \neq \emptyset$ ), for some $e_{\lambda} \in \mathcal{E}_{ad}$ , $(x,z) \sim P_{X^{\epsilon_{\lambda}},g(Y^{\epsilon_{\lambda}})}$ yields low $p^{e^{*}}(z|\Phi^{\lambda}(x))$ with high probability. On the other hand, $(x,z) \sim P_{X^{e^{*}},g(Y^{e^{*}})}$ yields high $p^{e^{*}}(z|\Phi^{\lambda}(x))$ with high probability: that is, $e^{*}$ and $e_{\lambda}$ are different. + +The theoretical analysis shows, while Method I is simpler to implement than Method II, Method II is more applicable. Noting that $\beta \geq \beta_{\lambda}$ and hence, $e^{-\beta} - \varepsilon \leq e^{-\beta_{\lambda}} - \varepsilon$ , the condition (ii)' is milder than (ii). Recalling that (ii) and (ii)' impose the discrepancy between $\mathcal{E}_{ad}$ and $e^{*}$ as discussed in the last paragraph, relaxation of conditions from (ii) to (ii)' implies that method II can be applied even when domains $\mathcal{E}_{ad}$ and $e^{*}$ have smaller discrepancy than the condition for Method I. The difference of these two methods will be demonstrated in Section 6. The real-world feasibility of the assumptions (ii) and (ii)' are discussed in Appendix F. + +# 5 Related work + +Fine-tuning The proposed framework uses additional data from multiple domains as well as the training data for the target task. It is relevant to Transfer learning (TL) [22-24] and meta-learning [30, 41], which realize fast and accurate learning for a new target task based on a model pre-trained with additional data sets. For example, after initial learning with a large data set, fine tune [22, 23] + +re-trains the model with the target task, while frozen feature [24] fixes the pre-trained model and tunes a head network. Although they show advantages in many learning problems, they may not work effectively in the current setting; in the fine-tuning with the target task $(X^{e^*}, Y^{e^*})$ , the model tends to learn biased correlation in the data set and does not generalize to unseen domains. Some fine-tuning methods will be compared with the proposed approach in Section 6. + +Domain adaptation by deep feature learning Domain adaptation strategies by deep feature learning [25-27, 31, 32] assume that we can access input data on a test domain in advance, and try to obtain data representation $\Phi(X^e)$ that follows the same distribution for the training and test domains. While the strategies lead to high predictive performance on a test domain similar to a training domain, such $\Phi$ does not function by discarding environmental factors from $X^e \in \mathcal{X}$ as noted in [10]. Experimental comparisons will be shown in Section 6. + +Distributionally robust optimization The proposed work tries to minimize the worst risk among risks on distributions perturbed from a training distribution [69, 68, 64]. The perturbated distributions are formalized as a small $\varepsilon$ -ball centered at the training distribution evaluated by some divergence. In our setting, the change of distributions in training and testing is necessarily small; if the background changes drastically, it is expected that its corresponding distribution also changes drastically. + +Few-shot and zero-shot learning Some methods of few-shot and zero-shot learning [70, 71] try to generalize to new classes not seen in the training set, given only a small number of examples of each new class or given no examples of each new class. Their problem setting is relevant to ours in that both of them have restrictions on the data obtained in training. [70, 71] train prototype representations of each class, which enable us to generalize to new classes not seen in the training set. While these methods are useful for generalizing new classes, they do not intend to remove biased correlations embedded in all training data and hence, are unsuitable for our problem setting. + +Other strategies [65] tries to obtain a de-biased feature $\Phi$ following the independence $\Phi(X) \perp E$ , seeing $\mathcal{E}$ as a random variable $E$ . Recently, [66] considers the setting where there exists some $f$ in the model that $f \neq f^{o.o.d}$ , where $f^{o.o.d.}$ is an estimator with high prediction performance on both training and test domain, and that $f(x) = f^{o.o.d.}(x)$ for a sample $x$ from training domains. Under the setting, they derive an upper bound of the risk on a test domain and propose a method for decreasing the upper bound. As a debias method, [67] uses two NNs; the first NN learns a biased mapping by the standard ERM, while the second one is trained with the samples that have large errors by the first NN. This method is based on the idea that the training with samples with large errors by the first NN mitigates data bias. + +# 6 Experiments + +We study the effectiveness of the proposed framework and CVs through experiments, comparing them with several existing methods: empirical risk minimization (ERM), fine-tuning methods, and deep domain adaptation strategies. For fine-tuning, we employ two typical methods of transfer learning: fine tune (FT) and frozen feature (FF) [22-24]. As a deep domain adaptation technique, we adopt the state-of-the-art method $DSAN$ [31]. We also compare our two CVs (CVI and CVII) with conventional CVs: training-domain validation (Tr-CV) and leave-one-domain-out cross-validation (LOD-CV) [19]. We have two hyperparameters to be selected by CV. In the training with (5), we set $\lambda := \lambda_{\text{before}}$ when the training epoch is less than a certain threshold $t$ , and $\lambda := \lambda_{\text{after}}$ if the epoch is larger than $t$ . It is known that these two hyperparameters are critical for IL methods to achieve good results. From a set of candidates, each of the CV methods selects a pair $(t, \lambda_{\text{after}})$ . To know the best possible performance among the candidates, we also apply the test-domain validation (TDV) [19], which selects the hyperparameters with the unseen test domain, and thus is not applicable in practical situations. Additional experiments and experimental details can be found in Appendices G and H, respectively. The code is available in Supplementary Material. + +Colored MNIST We apply our framework to Colored MNIST [10] with $\mathcal{V} = [10]$ and $\mathcal{Z} := [2]$ . We aim to predict $Y^{e} \in \mathcal{V}$ from digit image data $X^{e} \in \mathbb{R}^{2 \times 24 \times 24}$ . The label $Y^{e}$ is changed randomly to one of the rest uniformly with a probability of $25\%$ . All digits in images are colored + +
DatasetCMNISTImageNet y = [3]ImageNet y = [7]ImageNet y = [17],
Best possible.750
random guess.100.333.143.059
Oracle.715 (.001).743 (.018).749 (.008).708 (.010)
ERM.433 (.004).417 (.016).507 (.020).357 (.020)
FT.250 (.020).463(.030).409 (.020).361 (.011)
FF.248 (.019).482 (.127).226 (.046).162 (.011)
DSAN.073 (.003).278 (.004).293 (.008).060 (.007)
Ours + CV I.606 (.051).652 (.028).622 (.011).556 (.004)
Ours + CV II.618 (.018).666 (.027).622 (.011).556 (.004)
Ours + Tr-CV.500 (.006).641 (.033).612 (.012).544 (.013)
Ours + LOD CV.460 (.200).525(.028).572 (.022).528 (.019)
Ours + TDV.657 (.008).673 (.035).634 (.033).556 (.004)
+ +Table 1: Average Test Accuracies and SEs of Colored MNIST and ImageNet (5 runs): Oracle show the result of ERM with grayscale MNIST (CMNIST) and of training with both $e_1$ and $e_2$ (ImageNet). TDV selects $\lambda$ that yields the highest performance on $e_2$ . The best scores are bolded. + +
DatasetCVICVIITr-CVLOD-CV
CMNIST.051 (.053).039 (.017).163 (.006).197 (.205)
ImageNet: Y = [3].027 (.029).013 (.020).025 (.021).170 (.041)
ImageNet: Y = [7].012 (.001).012 (.001).018 (.015).054 (.024)
ImageNet: Y = [17].000 (.000).000 (.000).001 (.002).025 (.021)
+ +Table 2: Means and SEs of $\left\{(\text{Accuracy of TDV on } e_2) - (\text{Accuracy of Each CV on } e_2)\right\}$ (5runs). The lowest errors are bolded. + +red or green. The domain $e \in [0,1]$ controls the color of digits; the digits $Y^{e} > 4$ and $Y^{e} \leq 4$ are colored in red and green, respectively, with probability $e$ . In training, $\mathcal{D}^{e^*} \sim P_{X^{0.1},Y^{0.1}}$ is drawn with sample size $n^{e^*} = 5000$ , and in testing, $Y^{e}$ is predicted from $X^{e}$ for $e_2 \coloneqq 0.9$ . Regarding the higher level $Z^{e}$ , the task is to predict $Z^{e} = 0$ for $X^{e}$ in $0 - 4$ and $Z^{e} = 1$ for $5 - 9$ (that is, $g(Y^{e}) = 1$ if $Y^{e} > 4$ and else, $g(Y^{e}) = 0$ ). The label $Z^{e}$ is swapped randomly with $25\%$ . We set $\mathcal{E}_{ad} = \{0.1,0.3,0.5,0.7,0.9\}$ with $n^{e} = 5000$ for each $e \in \mathcal{E}_{ad}$ . We model $\Phi$ by a 3-layer neural net. Setting the maximum epoch 500 and $\lambda_{\mathrm{before}} := 1.0$ , we select $(t,\lambda_{\mathrm{after}})$ from $4 \times 7$ candidates with $t \in \{0,100,200,300\}$ , $\lambda_{\mathrm{after}} \in \{10^0,10^1,\dots,10^6\}$ by each of the CVs. + +Table 1 shows the test accuracies for 2000 random samples in the domain $e_2$ . The results, together with additional ones in Appendices G.1 and G.2, demonstrate that the proposed methods significantly outperform the others for $e_2$ . Among the two proposed methods, CV II yields higher test accuracies on $e_2$ . Table 2 shows the accuracy gain of each CV from TDV with the same data sets for domain $e_2$ . These results, together with Appendices G.1 and G.2, concur with the theory in Section 4 suggesting that CVII succeeds in wider situations, resulting in smaller errors. + +ImageNet To see the performance of the proposed methods for more practical data, they are applied to the ImageNet [53] with its label re-annotated imitating BREEDS [52], which proposes a method for re-annotating ImageNet to create an o.o.d. benchmark. The target task here is to predict labels $Y^{e} \in \mathcal{V}$ of images $X^{e} \in \mathbb{R}^{3 \times 224 \times 224}$ . We conduct three experiments with $|\mathcal{V}| = 3, 7, 17$ . For each experiment, we prepare image datasets in different two manners $e_{1}$ and $e_{2}$ . The datasets consist of images belonging to one of the classes $\mathcal{V}$ , 2, 4, and 8 classes out of 3, 7, and 17 classes, respectively, are composed of different subtypes between $e_{1}$ and $e_{2}$ ; for example, the images of class bird in $e_{1}$ are composed of ruffed grouse and in + +![](images/04ca48b01ac58746e0ad664705d55b810605572045ca7b87ce4628e31f64a907.jpg) +Figure 2: ImageNet experiment dataset. + +digo bunting, and the bird images on $e_2$ are composed of albatross and water ouzel (Figure 2). In detail, show Appendix H.3. In training, $\mathcal{D}^{e^*} \sim P_{X^{e_1},Y^{e_1}}$ is drawn, and in testing, $Y^e$ is predicted from $X^e$ on $e_2$ . The coarser label $Z^e$ is binary (that is, $\mathcal{Z} = [2]$ ), and the sample in the higher level $\mathcal{D}_{ad}^e$ of $(X^e,Z^e)$ is drawn from both $e_1$ and $e_2$ . Here, $\mathcal{D}_{ad}^{e_1}$ is the same as $\mathcal{D}^{e^*}$ but with labels reannotated by $g$ . We model $\Phi$ by ResNet50 [29]. Setting the maximum epoch 32 and $\lambda_{\mathrm{before}} := 0.1$ , we select $(t,\lambda_{\mathrm{after}})$ from $3 \times 4$ candidates with $t \in \{10,20,30\}$ , $\lambda_{\mathrm{after}} \in \{0,1,10,100\}$ by each of the CVs. + +Table 1 shows the test accuracies on $e_2$ . We can see that the proposed framework succeeded in predicting on $e_2$ , while the other methods failed. Table 2, which shows the difference between accuracies by TDV and each CV, verify that CVI and II selects $\lambda$ with the smallest error. + +Comparison of two CV methods To highlight the difference between the proposed two CVs, we compare them regarding the discrepancy between the additional domains of higher level $\mathcal{E}_{ad}$ and the domain for training of the target task $e^{*}$ . We used synthesized data with $\mathcal{X} = \mathbb{R}^2$ , $\mathcal{Y} = [10]$ and $\mathcal{Z} := [2]$ , preparing ten distributions $\{N_i\}_{i=1}^{10}$ on $\mathbb{R}^2$ , which include a domain-specific factor in the second component depending on $e \in \mathbb{Z}$ (see Appendix H.2 for explicit representations of $\{N_i\}_{i=1}^{10}$ ). The task is to predict the distribution label $i \in \{1, \ldots, 10\}$ . Setting $e^{*} := 20$ with $n^{e^{*}} = 60000$ , the test task is to predict the label for domain $e = -20$ . Regarding the task with label of higher level, we use $g(y) = 0$ if $y > 4$ and $g(y) = 0$ else. We draw $\mathcal{D}_{ad}^{e} \sim P_{X^{e}, Z^{e}}(n^{e} = 20000)$ from $\mathcal{E}_{ad} = \{e_{ad}, 40\}$ , where $e_{ad}$ ranges from $-9$ to $1$ . As $e_{ad}$ increases, $e_{ad}$ approaches to $e^{*}$ . The model $\Phi$ is a 3-layer neural net. We set the maximum epoch 500 and $t = 0$ , and select $\lambda_{\mathrm{after}}$ from 4 candidates $\lambda_{\mathrm{after}} \in \{0, 0.001, 80, 100\}$ by each CV method. + +
\( e_{ad}=-9 \)\( e_{ad}=-8 \)\( e_{ad}=-7 \)\( e_{ad}=-6 \)\( e_{ad}=-5 \)\( e_{ad}=-4 \)\( e_{ad}=-3 \)\( e_{ad}=-2 \)\( e_{ad}=-1 \)\( e_{ad}=0 \)\( e_{ad}=1 \)
TDV.596 (.078).621 (.046).630 (.041).595 (.061).590 (.087).621 (.059).564 (.071).582 (.056).535 (.093).520 (.121).575 (.107)
CV I.529 (.128).555 (.111).562 (.086).566 (.109).375 (.145).346 (.172).372 (.176).358 (.167).300 (.146).173 (.143).218 (.087)
CV II.527 (.152).573 (.089).565 (.085).572 (.072).522 (.110).523 (.102).482 (.113).506 (.153).430 (.146).437 (.157).502 (.149)
+ +Table 3: Comparison of Two CVs: Average Test ACCs and SEs of the estimates (10runs). + +Table 3 shows the test accuracy on $e = -e^{*}$ with 2000 random samples $(x, y) \sim P_{X^{-e^{*}}, Y^{-e^{*}}}$ . From the results, we can see that CVII tends to select better hyperparameters than CVI, especially in the case where the variation among the domains is smaller as $e_{ad}$ approaches to $e^{*}$ . This accords with the theoretical results in Theorems 4 and 5, which show that CVII finds a correct hyperparameter in smaller discrepancy between $\mathcal{E}_{ad}$ and $e^{*}$ than CVI. + +# 7 Conclusion + +We have proposed a new framework of invariance learning: assuming the availability of datasets for another relevant task in higher label hierarchy, we obtain an invariant predictor for the target classification task using training data in a single domain. We have also proposed two CV methods for hyperparameter selection, which has been an outstanding problem of previous methods for invariant learning. Theoretical analysis has revealed correctness of our methods, including CVs, and the experimental results have demonstrated the effectiveness of the proposed framework and CVs. + +Limitations and potential societal impact In Theorem 3, it is ensured that our objective function gives a minimizer of the o.o.d. risk, only if at least two domains have different distributions. In general, different domains do not necessarily have different distributions. Judging the discrepancy is a further important problem. As a positive impact, our method will enable us to estimate predictors that don't use discriminatory factors such as gender. There may be some negative aspects in that our method removes important information for a prediction as well as unnecessary ones. + +# Acknowledgements + +The research was supported by Grant-in-Aid for JSPS Fellows 20J21396, JST CREST JP-MJCR2015, and JSPS Grant-in-Aid for Transformative Research Areas (A) 22H05106. + +# References + +[1] V. Vapnik. Principles of risk minimization for learning theory. In NIPS, 1992. +[2] L. Adolphs, J. Kohler, and A. Lucchi. Ellipsoidal trust region methods and the marginal value of Hessian information for neural network training. arXiv:1905.09201 (version 1), 2019. +[3] S. Beery, G. V. Horn, P. Perona. Recognition in terra incognita. In ECCV, 2019. +[4] J. R. Zech, M.A. Badgeley, M. Liu, A. B. Costa, J. J. Titano, E. K. Oermann. Variable generalization performance of a deep learning model to detect pneumonia in chest radiographs: A cross-sectional study. PLoS Medicine 15, e1002683, 2018. +[5] T. Niven, H.-Y Kao. Probing neural network comprehension of natural language arguments. Proceedings of the 57th Annual Meeting of the Association for Computational, 2019. +[6] S. Gururangan, S. Swayamdipta, O. Levy, R. Schwartz, S. R. Bowman, N. A. Smith. Annotation artifacts in Natural Language Inference data. Proceedings of the Conference of the North American Chapter of the Association for Computational Linguistics, 2018. +[7] J. Dastin. Amazon scraps secret AI recruiting tool that showed bias against women. https://reut.rs/2Od9fPr, 2018. +[8] A. Ilyas, S. Santurkar, D. Tsipras, L. Engstrom, B. Tran, A. Madry. Adversarial examples are not bugs, they are features. In NeurIPS, 2019. +[9] J. Shane. Do neural nets dream of electric sheep? https://aiweirdness.com/post/171451900302/, 2018. +[10] M. Arjovsky, L. Bottou, I. Gulrajani, and D. Lopez-Paz. Invariant Risk Minimization. arXiv:1907.02893, 2019. +[11] K. Ahuja, K. Shanmugam, K. Varshney, and A. Dhurandhar. Invariant risk minimization games. In ICML, 2020. +[12] D. Rothenhausler, P. Buhlmann, N. Meinshausen, and J. Peters. Anchor regression: heterogeneous data meets causality. JRSS B, 83(2):215-246, 2018. +[13] C. Heinze-Deml, J. Peters, and N. Meinshausen. Invariant causal prediction for nonlinear models. Journal of Causal Inference, 6(2), 2018. +[14] J. Peters, P. Buhlmann, and N. Meinshausen. Causal inference using invariant prediction: identification and confidence intervals. JRSS B, 6(2): 947-1012, 2016. +[15] M. Koyama, S. Yamaguchi. When is invariance useful in an Out-of-Distribution Generalization problem? arXiv, 2008.01883, 2020. +[16] E. A. AlBadawy, A. Saha, and M. A. Mazurowski. Deep learning for segmentation of brain tumors: Impact of cross-institutional training and testing. Medical physics, 45(3): 1150-1158, 2018. +[17] C. S. Perone, P. Ballester, R. C. Barros, and J. Cohen-Adad. Unsupervised domain adaptation for medical imaging segmentation with self-ensembling. NeuroImage, 194(1): 1-11, 2019. +[18] W. D. Heaven. Google's medical AI was super accurate in a lab. real life was a different story. MIT Technology Review, 2020. +[19] I. Gulrajani, D. Lopez-Paz. In Search of Lost Domain Generalization. In ICLR, 2021. +[20] P. Kamath. Does Invariant Risk Minimization Capture Invariance? In AISTATS, 2021. +[21] D. Krueger, E. Caballero, J. Jacobsen, A. Zhang, J. Binas, D. Zhang, R. L. Priol, A. Courville. Out-of-Distribution Generalization via Risk Extrapolation. In ICML, 2021. +[22] S. J. Pan, and Q. Yang. A survey on transfer learning. IEEE Transactions on Knowledge and Data Engineering, 22(10):1345-1359, 2009. +[23] Q. Yang, Y. Zhang, W. Dai, and S. J. Pan. Transfer Learning. Cambridge University Press, 2020. +[24] J. Yosinski, J. Clune, Y. Bengio, and H. Lipson. How transferable are features in deep neural networks? In NIPS, 2014. + +[25] Y. Ganin, E. Ustinova, H. Ajakan, P. Germain, H. Larochelle, F. Laviolette, M. March, and V. Lempitsky. Domain-adversarial training of neural networks. Journal of Machine Learning Research, 17(59):1-35, 2016. +[26] S. Ben-David, J. Blitzer, K. Crammer, and F. Pereira. Analysis of representations for domain adaptation. In NIPS, 2007. +[27] G. Louppe, M. Kagan, and K. Cranmer. Learning to pivot with adversarial networks. In NIPS, 2017. +[28] S. Sagawa, P. W. Koh, T. B. Hashimoto, P. Liang. Distributionally Robust Neural Networks for Group Shifts: On the Importance of Regularization for worst-case generalization. In ECCV, 2019. +[29] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In CVPR, 2016. +[30] C. Finn, P. Abbeel, and S. Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In ICML, 2017. +[31] P. Stojanov, Z. Li, M. Gong, Ruichu Cai, J. G. Carbonell, K. Zhang. Domain Adaptation with Invariant Representation Learning: What Transformations to Learn? In NeurIPS, 2021. +[32] Y. Zhang, H. Tang, K. Jia, M. Tan. Domain-Symmetric Networks for Adversarial Domain Adaptation. In CVPR, 2019. +[33] J. Liu, Z. Hu, P. Cui, B. Li, Z. Shen. Heterogeneous Risk Minimization. In ICML, 2021. +[34] J. Liu, Z. Hu, P. Cui, B. Li, Z. Shen. Kernelized Heterogeneous Risk Minimization. In NeurIPS, 2021. +[35] J. Creager, J. Jacobsen, R. Zemel. Environment Inference for Invariant Learning. In ICML, 2021. +[36] G. Parascandolo, A. Neitz, A. Orvieto, L. Gresele, B. Scholkopf. Learning explanations that are hard to vary. In ICLR, 2021. +[37] D. P. Kingma, J. L. Ba. Adam: A Method for Stochastic Optimization. In ICLR, 2015. +[38] C. Wah, S. Branson, P. Welinder, P. Perona, and S. Belongie. The Caltech-UCSD Birds-200-2011 dataset. Technical report, California Institute of Technology, 2011. +[39] B. Zhou, A. Lapedriza, A. Khosla, A. Oliva, and A. Torralba. Places: A 10 million image database for scene recognition. IEEE Transactions on Pattern Analysis and Machine Intelligence, 40(6): 1452-1464, 2017 +[40] M. Rojas-Carulla, B. Scholkopf, R. Turner, and J. Peters. Invariant models for causal transfer learning. Journal of Machine Learning Research, 19(36):1-34, 2018 +[41] M. Andrychowicz1, M. Denil1, S. Colmenarejo1, M. W. Hoffman1, D. Pfau1, T. Schaul, B. Shillingford, N. de Freitas. Learning to learn by gradient descent by gradient descent. In NIPS, 2016 +[42] H. Pham, Z. Dai, Q. Xie, Q. V. Le. Meta Pseudo Labels. In CVPR, 2021 +[43] D. Lee. Pseudo-Label : The Simple and Efficient Semi-Supervised Learning Method for Deep Neural Networks. In ICML Workshop, 2013 +[44] Z, Zheng, L. Zheng, Y. Yang. Unlabeled Samples Generated by GAN Improve the Person Reidentification Baseline in vitro. In ICCV, 2017 +[45] X. Gu, J. Sun, Z. Xu. Spherical Space Domain Adaptation With Robust Pseudo-Label Loss. In CVPR, 2020 +[46] T. Cour, B. Sapp, and B. Taskar. Learning from partial labels. Journal of Machine Learning Research, 12(42):1501-1536, 2011. +[47] Y. Yan, Y. Guo. Partial Label Learning with Batch Label Correction. In AAAI, 2021. +[48] N. Xu, J. Lv, X.Geng. Partial label learning via label enhancement. In AAAI, 2019. +[49] Y. Katsura, M. Uchida. Bridging Ordinary-Label Learning and Complementary-Label Learning. In ACML, 2020. +[50] L. Feng, T. Kaneko, B. Han, Ga. Niu, B. An, M. Sugiyama. Learning with Multiple Complementary Labels. In ICML, 2020. + +[51] T. Ishida, G. Niu, A. Menon, M. Sugiyama. Complementary-Label Learning for Arbitrary Losses and Models. In ICML, 2019. +[52] S. Santurkar, D. Tsipras, and A. Madry. Breeds: Benchmarks for subpopulation shift. In ICLR, 2021. +[53] J. Deng, A. Berg, S. Satheesh, H. Su, A. Khosla, L. Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, 2009. +[54] C. Lu, Y. Wu, J. M. Hernández-Lobato, B. Scholkopf. Invariant Causal Representation Learning For out-of-distribution generalization. In ICLR, 2022. +[55] M. Takada, H. Fujisawa, T. Nishikawa. HMLasso: Lasso with High Missing Rate. In IJCAI, 2019. +[56] C. K. Enders. Imputation of missing data in industrial databases. Applied intelligence. Psychological methods, 8(3):322, 2003. +[57] K. Lakshminarayan, S. A. Harp, and T. Samad. Imputation of missing data in industrial databases. Applied intelligence, 11(3):259-275, 1999. +[58] H. Tan, G. Feng, J. Feng, W. Wang, Y. Y. J. Zhang, F. Li. A tensor-based method for missing traffic data completion. Transportation Research Part C: Emerging Technologies, 28:15-27, 2013. +[69] S. Sagawa, P. W. Koh, T. B. Hashimoto, P. Liang. Distributionally Robust Neural Networks In ICLR, 2020. +[68] W. Hu, G. Niu, I. Sato, and M. Sugiyama. Does distributionally robust supervised learning give robust classifiers? In ICML, 2018. +[64] Y. Oren, S. Sagawa, T. Hashimoto, and P. Liang. Distributionally robust language modeling. In EMNLP, 2019. +[65] H. Bahng, S. Chun, S. Yun, J. Choo, S. J. Oh Learning De-biased Representations with Biased Representations. In ICML, 2020. +[66] H, Wang, Z. Huang, H. Zhan, Y. J. Lee, E. P. Xing Toward Learning Human-aligned Cross-domain Robust Models by Countering Misaligned Features. In UAI, 2022. +[64] Y. Oren, S. Sagawa, T. Hashimoto, and P. Liang. Distributionally robust language modeling. In EMNLP, 2019. +[65] H. Bahng, S. Chun, S. Yun, J. Choo, S. J. Oh Learning De-biased Representations with Biased Representations. In ICML, 2020. +[66] H, Wang, Z. Huang, H. Zhan, Y. J. Lee, E. P. Xing Toward Learning Human-aligned Cross-domain Robust Models by Countering Misaligned Features. In UAI, 2022. +[67] J. Nam, H. Cha, S. Ahn, J. Lee, J. Shin Learning from Failure: Training Debiased Classifier from Biased Classifier. In Neurips, 2020. +[68] W. Hu, G. Niu, I. Sato, and M. Sugiyama. Does distributionally robust supervised learning give robust classifiers? In ICML, 2018. +[69] S. Sagawa, P. W. Koh, T. B. Hashimoto, P. Liang. Distributionally Robust Neural Networks In ICLR, 2020. +[70] J. Snell, K. Swersky, R. Zemel. Prototypical Networks for Few-shot Learning In Neurips, 2017. +[71] O. Vinyals, C. Blundell, T. Lillicrap, k. kavukcuoglu, D. Wierstra. Matching networks for one shot learning. In Neurips, 2016. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] In Section 1, we note that data with target classification label needs from at least one domain. In Section 4, we theoretically reveal the conditions for our objective function and CV methods to succeed. +(c) Did you discuss any potential negative societal impacts of your work? [Yes] It is included in Section 7. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] See Section 4. +(b) Did you include complete proofs of all theoretical results? [Yes] They are included in Appendices. + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] We put the code in the supplemental material. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] They are specified in Section 6 and Appendix H.4. +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] They are included in Appendix H.4. + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] +(b) Did you mention the license of the assets? [Yes] +(c) Did you include any new assets either in the supplemental material or as a URL? [N/A] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/invariancelearningbasedonlabelhierarchy/images.zip b/invariancelearningbasedonlabelhierarchy/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..0b755c5ba3541ca9cf310d12a44af9d5ce5b8377 --- /dev/null +++ b/invariancelearningbasedonlabelhierarchy/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:938a9e81a97a5bdc8c9ce93f5423a4db40d0983e3865afcbbb58b2968ea8241c +size 365994 diff --git a/invariancelearningbasedonlabelhierarchy/layout.json b/invariancelearningbasedonlabelhierarchy/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..a075978c484ef8810445b5d2f692159310705268 --- /dev/null +++ b/invariancelearningbasedonlabelhierarchy/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b725eb12dfbea4a6336a7b0c9751bc18764ca18beb5a42d3cdc7716db14e1c3 +size 726398 diff --git a/invariancelearningindeepneuralnetworkswithdifferentiablelaplaceapproximations/68655b32-e11f-48cb-8466-88b04d64f55f_content_list.json b/invariancelearningindeepneuralnetworkswithdifferentiablelaplaceapproximations/68655b32-e11f-48cb-8466-88b04d64f55f_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..46d55881c4e708e44e6ae4189ce2a41acbdfbe19 --- /dev/null +++ b/invariancelearningindeepneuralnetworkswithdifferentiablelaplaceapproximations/68655b32-e11f-48cb-8466-88b04d64f55f_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:48a811e209714f89367f600bf6e81bfada38dbe2efe1acb0cc3ec76488f8782b +size 97696 diff --git a/invariancelearningindeepneuralnetworkswithdifferentiablelaplaceapproximations/68655b32-e11f-48cb-8466-88b04d64f55f_model.json b/invariancelearningindeepneuralnetworkswithdifferentiablelaplaceapproximations/68655b32-e11f-48cb-8466-88b04d64f55f_model.json new file mode 100644 index 0000000000000000000000000000000000000000..8869e35d0397a624d73e31c74442a5284ddb17a9 --- /dev/null +++ b/invariancelearningindeepneuralnetworkswithdifferentiablelaplaceapproximations/68655b32-e11f-48cb-8466-88b04d64f55f_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f4b8fff6eafae21f0b2dbcdedfa6f9efe5532056b550dab97e96115c17a54597 +size 120907 diff --git a/invariancelearningindeepneuralnetworkswithdifferentiablelaplaceapproximations/68655b32-e11f-48cb-8466-88b04d64f55f_origin.pdf b/invariancelearningindeepneuralnetworkswithdifferentiablelaplaceapproximations/68655b32-e11f-48cb-8466-88b04d64f55f_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..3bdefd230f21b15ad6c267559405874c6cc84af0 --- /dev/null +++ b/invariancelearningindeepneuralnetworkswithdifferentiablelaplaceapproximations/68655b32-e11f-48cb-8466-88b04d64f55f_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:470b7af1cd7b0ce1fe60db9a8d134ed05ec9de618c4dd8b38c5415f1b91f8e9e +size 2723496 diff --git a/invariancelearningindeepneuralnetworkswithdifferentiablelaplaceapproximations/full.md b/invariancelearningindeepneuralnetworkswithdifferentiablelaplaceapproximations/full.md new file mode 100644 index 0000000000000000000000000000000000000000..aea1d1cfaf74af2d5ed49ba7aaec6ad2da0a2985 --- /dev/null +++ b/invariancelearningindeepneuralnetworkswithdifferentiablelaplaceapproximations/full.md @@ -0,0 +1,369 @@ +# Invariance Learning in Deep Neural Networks with Differentiable Laplace Approximations + +Alexander Immer\*,1,2 Tycho F.A. van der Ouderaa\*,3 Gunnar Ratsch' Vincent Fortuin1,4 Mark van der Wilk3 + +$^{1}$ Department of Computer Science, ETH Zurich, Switzerland + $^{2}$ Max Planck Institute for Intelligent Systems, Tübingen, Germany + $^{3}$ Department of Computing, Imperial College London, UK + $^{4}$ Department of Engineering, University of Cambridge, UK + +# Abstract + +Data augmentation is commonly applied to improve performance of deep learning by enforcing the knowledge that certain transformations on the input preserve the output. Currently, the data augmentation parameters are chosen by human effort and costly cross-validation, which makes it cumbersome to apply to new datasets. We develop a convenient gradient-based method for selecting the data augmentation without validation data during training of a deep neural network. Our approach relies on phrasing data augmentation as an invariance in the prior distribution on the functions of a neural network, which allows us to learn it using Bayesian model selection. This has been shown to work in Gaussian processes, but not yet for deep neural networks. We propose a differentiable Kronecker-factored Laplace approximation to the marginal likelihood as our objective, which can be optimised without human supervision or validation data. We show that our method can successfully recover invariances present in the data, and that this improves generalisation and data efficiency on image datasets. + +# 1 Introduction + +Data augmentation is a commonly used machine learning technique that is essential to high-performing deep learning and computer vision systems. It aims to obtain a model that is invariant to a set or distribution of transformations, by fitting a model with inputs that are transformed in a way that is known to leave the output class unchanged. This procedure can be regarded as artificially creating more data and is well known to increase generalisation performance and data efficiency. Yet, choosing the right transformations is an expensive and task-specific process that relies on domain knowledge and human effort, as well as trial-and-error through cross-validation. This can quickly become intractable when many parameters are considered, particularly if they are continuous, because each setting requires training a model to convergence. + +We aim to make selecting suitable transformations easier, by learning them via gradient descent. Our approach is inspired by the procedure of van der Wilk et al. (2018), which casts learning invariances and data augmentations as a Bayesian model selection problem. This view suggests selecting invariances by maximising the marginal likelihood with gradient-based optimisation. While this approach was successful in Gaussian process models, it has not yet been demonstrated in deep neural networks, where the marginal likelihood is harder to approximate. + +![](images/a4c3a9f2c7c51fb99d122b75a04f8969c637e77f92f6b2b5174d4db3d771c4f6.jpg) +Figure 1: Illustration of our approach on a dataset with rotational invariance. Steps A and B allow to define a Bayesian neural network with a likelihood dependant on invariance parameter $\eta$ (van der Wilk et al., 2018). Our contributions enable tractable marginal likelihood estimation and differentiation during training, as illustrated in Step C. The right-most figure shows the posterior predictive of our Bayesian neural network after learning the invariance present in the data. + +![](images/9eaa0e04c5659c02e588175368e5ead5779b36cdd8d70b462c65d3a276b9be08.jpg) + +![](images/a7cf66f33341600f90ad0986267e3dda36c36ed2d9c79235145cb59af5854cbf.jpg) + +To circumvent this problem, we built upon the scalable Laplace approximation to the marginal likelihood developed by Immer et al. (2021a), who recently showed that maximising it can successfully select neural network hyperparameters, such as architectures. We extend their method to enable gradient-based optimisation of complex hyperparameters that control invariances in deep neural networks. To that end, we propose an efficient and differentiable Kronecker-factored Laplace approximation for invariant neural networks and a novel method to obtain stochastic gradients with respect to invariance parameters, which is also useful for optimising other hyperparameters. Our method is the first to enable differentiable Bayesian model selection to learn complex hyperparameters, in particular invariances, in deep neural networks. + +Our approach is illustrated in Fig. 1. We specify invariances as a parameterised distribution over perturbations of the network's input, like in data augmentation (Step A). The model output is averaged over samples from the distribution (Step B), which yields a Bayesian neural network with likelihood dependent on the perturbations (Nabarro et al., 2021). We derive a marginal likelihood approximation for such neural networks and show how to efficiently compute its gradients with respect to the invariance parameters (Step C). By approximating the marginal likelihood, we can differentiably learn invariances during training, jointly with neural network parameters, and without validation data. + +We demonstrate experimentally that our method can differentiably learn useful distributions over affine invariances, which are common data augmentations, on various versions of the image classification datasets MNIST, FashionMNIST, and CIFAR-10, without validation data. Our learned invariances improve the generalisation and data efficiency of neural networks, without the effort required for choosing data augmentations or custom architectures. On original datasets, our method can increase test performance by up to 8-10 percentage points. On random subsets of image classification datasets, we show that our method can achieve up to $10 \times$ better data efficiency. Our work strengthens how Bayesian methods can be useful for deep learning beyond predictive uncertainty estimation. + +# 2 Related Work + +Invariances in deep learning. Since the inception of the convolutional neural network (CNN) (Fukushima and Miyake, 1982; LeCun et al., 1998), building invariances and equivariances into deep learning models has drastically increased data efficiency and generalisation (Cohen et al., 2018; Brandstetter et al., 2021), for instance, on image classification (Cohen and Welling, 2016), molecular dynamics (Batzner et al., 2021), and reinforcement learning (van der Pol et al., 2020). However, these approaches require knowing the invariances a priori. In this work, on the other hand, we aim to automatically learn the correct type and amount of invariance from data without supervision. + +Learning invariances. Learning invariances from data is hard, because symmetries define constraints on the functions a network can represent, and therefore do not improve data fit according to the training loss, even if they would lead to better generalisation on test data. Some methods have therefore proposed to learn invariances or data augmentation by estimating gradients on the validation loss. For example, AutoAugment (Cubuk et al., 2018) learns data augmentation using + +policy gradients, Lorraine et al. (2020) use the implicit function theorem, and Zhou et al. (2020) phrase the problem as meta-learning. Such approaches require validation sets of sufficient size to prevent high variance and overfitting (Lorraine et al., 2020). Here, we tackle the problem of learning invariances when validation data is not available. + +Validation-free invariance learning. When casting invariance learning as a Bayesian model selection problem, we can select helpful invariances using the marginal likelihood of the model with training data alone. This has been successfully demonstrated in Gaussian processes (van der Wilk et al., 2018) and in the weight space of single-layer neural networks (van der Ouderaa and van der Wilk, 2021). To scale this approach to deep networks, Schwöbel et al. (2022) attempt to use a marginal likelihood that is only computed in the last layer. While the latter was successful for small neural networks, it failed to learn invariances on more complex datasets that require deep neural networks, likely due to known limitations of last-layer approaches (Ober et al., 2021; van Amersfoort et al., 2021). Augerino (Benton et al., 2020) is an alternative to Bayesian model selection that works for deep learning by regularising invariances to increase during training. However, this approach depends on the chosen parameterisation of the invariance and may still require a validation set to tune the regularisation strength. In App. C, we show that these issues can be detrimental to Augerino's performance. In contrast, our proposed method uses the Bayesian marginal likelihood estimate in deep neural networks that is parameterisation-invariant and improves performance. The main differences between our proposed method and the alternatives are summarised in App. A. + +Bayesian model selection for deep learning. Marginal likelihood approximations have recently enabled gradient-based hyperparameter optimisation for deep neural networks (Immer et al., 2021a; Ober and Aitchison, 2021; Antorán et al., 2022a). Laplace approximations (MacKay, 1992) with structured Hessian approximations, such as KFAC (Martens and Grosse, 2015; Botev et al., 2017), or linearisation have been shown to improve generalisation, for example, by optimising weight regularisation (Immer et al., 2021a; Daxberger et al., 2021) and learning length-scales of convolutions (Antorán et al., 2022a). Other approximate inference methods that rely on ensembling or sampling do not directly apply to marginal likelihood estimation while common methods like mean-field variational inference (Blundell et al., 2015) or last-layer approaches (Ober et al., 2021; Daxberger et al., 2021; Schwöbel et al., 2022) have been shown to fail for model selection. We therefore focus on Laplace approximations and extend them to enable gradient-based optimisation of more complex hyperparameters like invariances. + +# 3 Background + +We consider a supervised learning task with dataset $\mathcal{D} = \{(\mathbf{x}_n,\mathbf{y}_n)\}_{n = 1}^N$ consisting of $N$ inputs $\mathbf{x}\in \mathbb{R}^{D}$ and targets $\mathbf{y}\in \mathbb{R}^{C}$ . Our goal is to learn the function $\mathbf{f}:\mathbb{R}^{D}\to \mathbb{R}^{C}$ that relates the inputs and outputs, which we represent as a neural network $\mathbf{f}(\mathbf{x};\pmb {\theta})$ with parameters $\pmb{\theta}$ . We control which solutions for $\mathbf{f}$ are preferred over others (i.e., the inductive bias) with hyperparameters $\mathcal{H}$ , which parameterise the prior over $\pmb{\theta}$ and $\mathbf{f}$ . Invariance is a particularly helpful inductive bias that constrains the output of $\mathbf{f}$ to remain similar for certain transformations of the input $\mathbf{x}$ , which can improve generalisation by allowing a single datapoint to inform predictions for a wider range of inputs. Our goal is to learn useful invariances together with the network weights. + +# 3.1 Parameterising Invariance + +To construct and parameterise invariant functions, we consider a local invariance that intuitively requires the function to not change "too much" in response to transformed inputs. To obtain such an invariant function $\hat{\mathbf{f}}$ , we average an unconstrained function $\mathbf{f}$ over a perturbation distribution $p(\mathbf{x}'|\mathbf{x},\boldsymbol {\eta})$ . In practice, we sample $\mathbf{x}'$ by reparameterising $\epsilon \sim p(\epsilon)$ with a differentiable function $\mathbf{g}$ and approximate the expectation with $S$ Monte Carlo samples $\epsilon_{1},\ldots ,\epsilon_{S}\stackrel {\mathrm{iid}}{\sim}p(\epsilon)$ (van der Wilk et al., 2018; Benton et al., 2020): + +$$ +\hat {\mathbf {f}} (\mathbf {x}; \boldsymbol {\theta}, \boldsymbol {\eta}) = \mathbb {E} _ {p \left(\mathbf {x} ^ {\prime} \mid \mathbf {x}, \boldsymbol {\eta}\right)} [ \mathbf {f} \left(\mathbf {x} ^ {\prime}; \boldsymbol {\theta}\right) ] = \mathbb {E} _ {p (\epsilon)} [ \mathbf {f} (\mathbf {g} (\mathbf {x}, \epsilon ; \boldsymbol {\eta}); \boldsymbol {\theta}) ] \approx \frac {1}{S} \sum_ {s} \mathbf {f} (\mathbf {g} (\mathbf {x}, \epsilon_ {s}; \boldsymbol {\eta}); \boldsymbol {\theta}), \tag {1} +$$ + +where $\hat{\mathbf{f}}$ is differentiable in the parameters $\eta$ that control the perturbation distribution and therefore the invariance. When the perturbation distribution is uniform on the orbit of a group, we recover exact invariance in $\hat{\mathbf{f}}$ (Kondor, 2008; Ginsbourger et al., 2016). The perturbation distribution resembles data augmentation applied to $\mathbf{f}$ instead of the loss and is also used at test time ( $\hat{\mathbf{f}}$ depends on it). Because the unconstrained function $\mathbf{f}$ is a neural network, we refer to $\hat{\mathbf{f}}$ as an invariant neural network. + +Given that we can parameterise a suitable data augmentation distribution $p(\mathbf{x}'|\mathbf{x},\boldsymbol {\eta})$ , we can learn invariances in arbitrary domains or group structures. What parameterisation works best in practice remains a research question. In our experiments, we consider a combination of uniform distributions and corresponding parameters $\pmb{\eta}\in \mathbb{R}^{6}$ over 6 generator matrices that define a probability density over the group of affine transformations, similar to Benton et al. (2020) and detailed in App. B. + +Finding invariance parameters $\eta$ is hard because $\hat{\mathbf{f}}$ is a constrained version of $\mathbf{f}$ and, especially for flexible models, this cannot improve the data fit according to the standard training loss (see also App. G.1). To overcome this, we propose to use Bayesian inference which provides a convenient framework to optimise invariance parameters with gradients during training without validation data. + +# 3.2 Bayesian Model Selection + +Bayesian inference prescribes how unknowns, such as invariance parameters, should be determined from data. To infer hyperparameters $\mathcal{H}$ from data, we are interested in the their posterior, $p(\mathcal{H}|\mathcal{D})\propto p(\mathcal{D}|\mathcal{H})p(\mathcal{H})$ (MacKay, 2003). Because this posterior is intractable, type II maximum likelihood (ML-II) is often used instead, which obtains a point estimate $\mathcal{H}^*$ for the optimal hyperparameters according to the marginal likelihood $p(\mathcal{D}|\mathcal{H})$ , which requires integration over the model parameters. + +ML-II is routinely used in Gaussian processes (Rasmussen and Williams, 2006, § 5.2) and trades off model simplicity with data fit (Rasmussen and Ghahramani, 2001). There are also strong relations to quantities from other statistical frameworks, like cross-validation (Fong and Holmes, 2020), Minimum Description Length (Grünwald, 2007), and generalisation error bounds (Germain et al., 2016). Van der Wilk et al. (2018) showed its usefulness for selecting invariances, and elaborated on the mechanism by which it works. The main advantage of the marginal likelihood, + +$$ +p (\mathcal {D} | \mathcal {H}) = \int p (\mathcal {D} | \boldsymbol {\theta}, \mathcal {H}) p (\boldsymbol {\theta} | \mathcal {H}) \mathrm {d} \boldsymbol {\theta} = \int \prod_ {n = 1} ^ {N} p (\mathbf {y} _ {n} | \mathbf {f} (\mathbf {x} _ {n}; \boldsymbol {\theta}), \mathcal {H}) p (\boldsymbol {\theta} | \mathcal {H}) \mathrm {d} \boldsymbol {\theta}, \tag {2} +$$ + +is that it can be computed from the training data alone and optimised with gradients. In our work, the integration is over the neural network parameters and requires particularly scalable approximations. + +# 3.3 Bayesian Model Selection for Deep Learning + +Computing the marginal likelihood for neural networks involves intractable integrals. The Laplace approximation (Laplace, 1774; MacKay, 2003, § 27) offers a solution by approximating the log joint of the parameters and data, $p(\mathcal{D}, \theta | \mathcal{H})$ , with a second-order Taylor expansion around a mode $\theta_*$ : + +$$ +\log p (\mathcal {D} | \mathcal {H}) \approx \log p (\mathcal {D}, \boldsymbol {\theta} _ {*} | \mathcal {H}) - \frac {1}{2} \log \left| \frac {1}{2 \pi} \mathbf {H} _ {\boldsymbol {\theta} _ {*}} \right|, \tag {3} +$$ + +where the first term decomposes into the log likelihood, a sum over data points, and the log prior, both of which are cheap and easy to evaluate and correspond to a typical training loss evaluated at a mode $\theta_{*}$ . The second term depends on the log determinant of the log-joint Hessian at the same mode + +$$ +\mathbf {H} _ {\boldsymbol {\theta} _ {*}} \stackrel {\text {d e f}} {=} - \nabla_ {\boldsymbol {\theta}} ^ {2} \log p (\mathcal {D}, \boldsymbol {\theta} | \mathcal {H}) | _ {\boldsymbol {\theta} = \boldsymbol {\theta} _ {*}} = \mathbf {H} _ {\boldsymbol {\theta} _ {*}} ^ {\mathrm {N L L}} - \nabla_ {\boldsymbol {\theta}} ^ {2} \log p (\boldsymbol {\theta} | \mathcal {H}) | _ {\boldsymbol {\theta} = \boldsymbol {\theta} _ {*}}, \tag {4} +$$ + +where $\mathbf{H}_{\theta_*}^{\mathrm{NLL}}$ denotes the Hessian of the negative log likelihood. This approach allows to estimate the marginal likelihood using a MAP estimate $\theta_{*}$ of the weights and its local curvature $\mathbf{H}_{\theta_{*}}$ . + +To circumvent the high cost of estimating the full Hessian, structured generalised Gauss-Newton (GGN) approximations are preferred for model selection in deep learning, as also in optimisation (Martens, 2020; Bottou, 2010). Immer et al. (2021a) recently demonstrated successful hyperparameter and architecture selection with such approximations. Further, they observe empirically that their algorithm does not require to be at a mode $\theta_{*}$ , which allows for interleaved gradient-based optimisation of parameters and hyperparameters during training. With the Jacobian matrix $\mathbf{J}_{\theta}(\mathbf{x}) \stackrel{\mathrm{def}}{=} \frac{\partial \mathbf{f}(\mathbf{x}; \theta)}{\partial \theta} \in \mathbb{R}^{C \times P}$ of the network output given input $\mathbf{x}$ w.r.t. parameters, and Hessian of the log likelihood w.r.t. network outputs $\Lambda(\mathbf{f}) = -\nabla_{\mathbf{f}}^2 \log p(\mathbf{y} | \mathbf{f})$ , the GGN simplifies the negative-log-likelihood-dependent term of the Hessian: + +$$ +\mathbf {H} _ {\boldsymbol {\theta}} ^ {\mathrm {N L L}} \approx \mathbf {H} _ {\boldsymbol {\theta}} ^ {\mathrm {G G N}} \stackrel {\text {d e f}} {=} \sum_ {n = 1} ^ {N} \mathbf {J} _ {\boldsymbol {\theta}} \left(\mathbf {x} _ {n}\right) ^ {\top} \boldsymbol {\Lambda} \left(\mathbf {f} \left(\mathbf {x} _ {n}; \boldsymbol {\theta}\right)\right) \mathbf {J} _ {\boldsymbol {\theta}} \left(\mathbf {x} _ {n}\right). \tag {5} +$$ + +Here, we assume that $\mathbf{f}$ forms the natural parameters of an exponential family likelihood function (Murphy, 2012). In classification, for example, $\mathbf{f}$ are the logits. We refer to the resulting approximations as Laplace-GGN. To overcome the still intractable quadratic size of $\mathbf{H}_{\theta}^{\mathrm{GGN}}$ in $P$ , Immer et al. (2021a) use structured approximations like KFAC (Martens and Grosse, 2015). Cheaper approximations, such as diagonal ones, often compromise accuracy (App. F; Daxberger et al., 2021). + +# 3.4 Kronecker-Factored Gauss-Newton Approximation (KFAC) + +Kronecker-factored approximations to the Gauss-Newton, such as KFAC, are commonly used for Laplace approximations as they currently seem to provide the best known trade-off between performance and complexity (Ritter et al., 2018; Daxberger et al., 2021). KFAC is a block-diagonal approximation to the Gauss-Newton matrix $\mathbf{H}_{\theta}^{\mathrm{GGN}}$ where each block corresponds to a layer in the neural network (Martens and Grosse, 2015; Botev et al., 2017). It is particularly efficient because each block is represented as two Kronecker factors instead of one dense matrix. For example, the GGN block of a layer with $D\times G$ parameters, that is, a fully-connected layer connecting $D$ to $G$ neurons, would have quadratic memory complexity $\mathcal{O}(D^2 G^2)$ while the corresponding Kronecker approximation of KFAC is in $\mathcal{O}(D^2 +G^2)$ and is therefore even tractable for wide neural networks. + +Mathematically, KFAC approximates the GGN of the $l$ th block of the neural network parameters by enforcing a Kronecker factorisation across data points. This would only be exact for a single data point $\mathbf{x}_n$ , for which we can write the GGN block corresponding to the parameters of the $l$ th layer as + +$$ +\mathbf {H} _ {l, n} ^ {\mathrm {G G N}} = \left[ \mathbf {a} _ {l, n} \otimes \mathbf {g} _ {l, n} \right] \boldsymbol {\Lambda} _ {n} \left[ \mathbf {a} _ {l, n} \otimes \mathbf {g} _ {l, n} \right] ^ {\intercal} = \left[ \mathbf {a} _ {l, n} \mathbf {a} _ {l, n} ^ {\intercal} \right] \otimes \left[ \mathbf {g} _ {l, n} \boldsymbol {\Lambda} _ {n} \mathbf {g} _ {l, n} ^ {\intercal} \right] \stackrel {\text {d e f}} {=} \mathbf {A} _ {l, n} \otimes \mathbf {G} _ {l, n}, \tag {6} +$$ + +where $\mathbf{a}_{l,n} \in \mathbb{R}^{D_l}$ is the input to the $l$ th layer for data point $\mathbf{x}_n$ , $\mathbf{g}_{l,n} \in \mathbb{R}^{G_l \times C}$ is the transposed Jacobian of the network output with respect to the output of the $l$ th layer for $\mathbf{x}_n$ , and $\boldsymbol{\Lambda}_n = \boldsymbol{\Lambda}(\mathbf{f}(\mathbf{x}_n; \boldsymbol{\theta}))$ . Thus, the factors in Eq. 6 are the Jacobian terms as in the GGN (Eq. 5) but only for the $l$ th layer, i.e., $\mathbf{J}_{\boldsymbol{\theta}_l}(\mathbf{x}_n)^\top = \mathbf{a}_{l,n} \otimes \mathbf{g}_{l,n}$ . KFAC then approximates the sum over $N$ data points by summing up the Kronecker factors individually instead of breaking the Kronecker-factored structure: + +$$ +\mathbf {H} _ {l} ^ {\mathrm {G G N}} = \sum_ {n = 1} ^ {N} \left[ \mathbf {a} _ {l, n} \mathbf {a} _ {l, n} ^ {\intercal} \right] \otimes \left[ \mathbf {g} _ {l, n} \boldsymbol {\Lambda} _ {n} \mathbf {g} _ {l, n} ^ {\intercal} \right] \approx \frac {1}{N} \left[ \underbrace {\sum_ {n = 1} ^ {N} \mathbf {a} _ {l , n} \mathbf {a} _ {l , n} ^ {\intercal}} _ {\stackrel {\text {d e f}} {=}} \right] \otimes \left[ \underbrace {\sum_ {n = 1} ^ {N} \mathbf {g} _ {l , n} \boldsymbol {\Lambda} _ {n} \mathbf {g} _ {l , n} ^ {\intercal}} _ {\stackrel {\text {d e f}} {=}} \right], \tag {7} +$$ + +where $\mathbf{A}_l\in \mathbb{R}^{D_l\times D_l}$ and $\mathbf{G}_l\in \mathbb{R}^{G_l\times G_l}$ can be understood as the uncentered covariance over $N$ data points of the inputs to the $l$ th layer and the Jacobians wrt. the output of the $l$ th layer, respectively. The normalization by $\frac{1}{N}$ is necessary to account for the additional terms that arise from distributing the sum over the factors. For a single-layer model, i.e., a linear model, KFAC is exact (cf. App. F). + +# 4 Invariance Learning with Differentiable Laplace Approximations + +We propose a Laplace-GGN approximation to the marginal likelihood for invariant neural networks and enable gradient-based optimisation of their invariance parameters during training, without the use of validation data (see Fig. 1 for a high-level overview). In our approach, we integrate the augmentation distribution $p(\mathbf{x}'|\mathbf{x},\boldsymbol {\eta})$ into a Bayesian neural network model such that the marginal likelihood directly depends on the invariance parameters $\pmb {\eta}\in \mathcal{H}$ . In particular, this is due to a modified likelihood function $p(\mathbf{y}|\hat{\mathbf{f}} (\mathbf{x};\boldsymbol {\theta},\boldsymbol {\eta}),\mathcal{H})$ (c.f., Nabarro et al., 2021). This model enables optimisation of the invariance parameters $\pmb{\eta}$ using gradient ascent on the log marginal likelihood, + +$$ +\eta \leftarrow \eta + \nabla_ {\eta} \log p (\mathcal {D} | \mathcal {H} = \{\eta , \mathcal {M} \}), \tag {8} +$$ + +where $\mathcal{M} = \mathcal{H}\setminus \{\eta \}$ are remaining hyperparameters, such as regularisation strength or model architecture. However, the tractable Laplace-GGN and KFAC approximations are not available for invariant Bayesian neural networks, which prohibits straightforward application of the update in Eq. 8 using the methods described in Sec. 3. + +In the following, we extend the Laplace-GGN and KFAC approximations to invariant neural networks (Secs. 4.1 and 4.2), which enables optimising the log marginal likelihood in parallel to the neural network parameters, as in Immer et al. (2021a). However, their algorithm has an intractable memory complexity for computing the gradients w.r.t. invariance parameters or other complex hyperparameters that act on the neural network function $\mathbf{f}$ directly. In practice, they only considered gradient-based optimisation of hyperparameters that act linearly on the Hessian $\mathbf{H}_{\theta}$ , for example regularisation strength and observation noise. In Sec. 4.3, we lift this constraint by proposing a method to obtain gradients w.r.t. complex hyperparameters without memory overhead. The final algorithm and a discussion of approximations for invariance learning are detailed in Apps. F and H. + +# 4.1 Laplace-GGN for an Invariant Neural Network + +To define the Laplace-GGN approximation to the log marginal likelihood, the hyperparameter objective, we need to extend the GGN to invariant neural networks. For an invariant neural network with + +parameter estimate $\theta_{*}$ , the log marginal likelihood approximation is given by + +$$ +\log p (\mathcal {D} | \boldsymbol {\eta}, \mathcal {M}) \approx \sum_ {n = 1} ^ {N} \log p (\mathbf {y} _ {n} | \hat {\mathbf {f}} (\mathbf {x} _ {n}; \boldsymbol {\theta} _ {*}, \boldsymbol {\eta}), \mathcal {M}) + \log p (\boldsymbol {\theta} _ {*} | \mathcal {M}) - \frac {1}{2} \log | \frac {1}{2 \pi} \hat {\mathbf {H}} _ {\boldsymbol {\theta} _ {*}} ^ {\mathrm {G G N}} (\boldsymbol {\eta}) |, \tag {9} +$$ + +where the first two terms constitute the training loss of the invariant neural network corresponding to the log joint as in the vanilla Laplace approximation in Eq. 3 and the last term is the Gauss-Newton approximation $\hat{\mathbf{H}}_{\boldsymbol{\theta}_{*}}^{\mathrm{GGN}}$ of the invariant neural network $\hat{\mathbf{f}}$ , which we derive below. The first and last term depend on the invariance parameter $\eta$ that we want to learn and differentiate with respect to. We use $S$ Monte Carlo samples $\epsilon_1,\ldots ,\epsilon_S\stackrel {\mathrm{iid}}{\sim}p(\epsilon)$ to estimate the invariant neural network $\hat{\mathbf{f}}$ as in Eq. 1. + +The log-likelihood term is approximated with $S$ Monte Carlo samples, which leads to a lower bound, + +$$ +\begin{array}{l} \sum_ {n = 1} ^ {N} \log p (\mathbf {y} _ {n} | \hat {\mathbf {f}} (\mathbf {x} _ {n}; \boldsymbol {\theta}, \boldsymbol {\eta}), \mathcal {M}) \geq \sum_ {n = 1} ^ {N} \mathbb {E} _ {\boldsymbol {\epsilon} _ {1}, \dots , \boldsymbol {\epsilon} _ {S}} [ \log p (\mathbf {y} _ {n} | \frac {1}{S} \sum_ {s} \mathbf {f} (\mathbf {g} (\mathbf {x} _ {n}, \boldsymbol {\epsilon} _ {s}; \boldsymbol {\eta}); \boldsymbol {\theta}), \mathcal {M}) ] \\ \approx \sum_ {n = 1} ^ {N} \log p \left(\mathbf {y} _ {n} \mid \frac {1}{S} \sum_ {s} \mathbf {f} \left(\mathbf {g} \left(\mathbf {x} _ {n}, \boldsymbol {\epsilon} _ {s}; \boldsymbol {\eta}\right); \boldsymbol {\theta}\right), \mathcal {M}\right), \tag {10} \\ \end{array} +$$ + +which is due the concavity of the log likelihood in its natural parameter $\hat{\mathbf{f}}$ and Jensen's inequality as shown by Nabarro et al. (2021), Schwöbel et al. (2022), and detailed in App. F.1. The subsequent Monte Carlo approximation is then unbiased. Increasing $S$ leads to a tighter bound and improves the approximation. In practice, we sample $\epsilon_{s}$ independently per data point $\mathbf{x}_n$ to reduce correlation. We can obtain a stochastic gradient w.r.t. $\eta$ by sampling a mini-batch of $M \ll N$ data but it is not possible to batch over the $S$ augmentations that parameterise the likelihood function. The runtime and memory complexity are therefore increased by a factor of $S$ . For a subset of data and $S \leq 100$ augmentations, the gradient w.r.t. $\eta$ can be computed using backpropagation (Benton et al., 2020). + +The Gauss-Newton can be derived from the log-likelihood approximation in Eq. 10 using the same $S$ samples. In particular, the Jacobian and log-likelihood Hessian required for the GGN are given by + +$$ +\hat {\mathbf {J}} _ {\boldsymbol {\theta}} (\mathbf {x}; \boldsymbol {\eta}) \stackrel {\text {d e f}} {=} \frac {1}{S} \sum_ {s} \mathbf {J} _ {\boldsymbol {\theta}} (\mathbf {g} (\mathbf {x}, \epsilon_ {s}; \boldsymbol {\eta})) \text {a n d} \hat {\boldsymbol {\Lambda}} (\mathbf {x}; \boldsymbol {\theta}, \boldsymbol {\eta}) \stackrel {\text {d e f}} {=} \boldsymbol {\Lambda} \left(\frac {1}{S} \sum_ {s} \mathbf {f} (\mathbf {g} (\mathbf {x}, \epsilon_ {s}; \boldsymbol {\eta}); \boldsymbol {\theta})\right). \tag {11} +$$ + +Both terms depend on the invariance parameter $\eta$ and are later differentiated with respect to it. The resulting GGN of the invariant neural network log likelihood estimated with $S$ samples is defined as + +$$ +\hat {\mathbf {H}} _ {\boldsymbol {\theta}} ^ {\mathrm {G G N}} (\boldsymbol {\eta}) \stackrel {\text {d e f}} {=} \sum_ {n = 1} ^ {N} \hat {\mathbf {J}} _ {\boldsymbol {\theta}} \left(\mathbf {x} _ {n}; \boldsymbol {\eta}\right) ^ {\top} \hat {\boldsymbol {\Lambda}} \left(\mathbf {x} _ {n}; \boldsymbol {\theta}, \boldsymbol {\eta}\right) \hat {\mathbf {J}} _ {\boldsymbol {\theta}} \left(\mathbf {x} _ {n}; \boldsymbol {\eta}\right). \tag {12} +$$ + +The GGN for an invariant model therefore requires averaging individual Jacobians and functions of the underlying neural network $\mathbf{f}$ . This is in contrast to the GGN of an improper Bayesian model (Wenzel et al., 2020) with standard data augmentation, which averages log-likelihood terms instead of functions. In this case, entire GGN terms are averaged over the $S$ augmentations and the marginal likelihood cannot be optimised because it requires tempering (Immer et al., 2021a). Computing the GGN of an invariant model increases the runtime by a factor of $S$ over a non-invariant model. The empirical Fisher, which is often cheaper, can be extended analogously and requires averaging gradients instead of Jacobians. Finally, the Laplace-GGN is obtained by computing the log determinant. + +The Laplace-GGN approximation derived here already allows to learn small invariant neural networks with few layers and small datasets via automatic differentiation. For example, this is tractable for the classification example illustrated in Fig. 1. However, computing the log determinant of the GGN has a cubic complexity in the number of parameters $P$ and is therefore intractable for deep neural networks on larger datasets. To enable its estimation, we extend KFAC to invariant neural networks in Sec. 4.2. Further, differentiating the log determinant has intractable memory complexity because it does not allow for a stochastic gradient but requires construction of a computational graph for the entire GGN approximation. This is a key limitation of the method proposed by Immer et al. (2021a) when optimising complex hyperparameters, for which we provide a solution in Sec. 4.3. + +# 4.2 Extending KFAC to Invariant Neural Networks + +Computing KFAC as described in Sec. 3 for an invariant neural network would not preserve the Kronecker structure and therefore be intractable for deep neural networks due to the quadratic cost in the numbers of parameters per layer. In particular in Eq. 6, KFAC uses the fact that the Jacobian w.r.t. the parameters of the $l$ th layer, $\mathbf{J}_{\theta_l}(\mathbf{x}_n)$ , can be written as the Kronecker product $\mathbf{a}_{l,n}\otimes \mathbf{g}_{l,n}$ . For an invariant neural network, the Kronecker structure cannot be maintained because of the sum over $S$ augmentation-sample Jacobians, each of which constitutes a Kronecker product: + +$$ +\hat {\mathbf {J}} _ {\boldsymbol {\theta} _ {l}} \left(\mathbf {x} _ {n}; \boldsymbol {\eta}\right) = \frac {1}{S} \sum_ {s} \mathbf {J} _ {\boldsymbol {\theta} _ {l}} \left(\mathbf {g} \left(\mathbf {x} _ {n}, \boldsymbol {\epsilon} _ {s}; \boldsymbol {\eta}\right)\right) = \frac {1}{S} \sum_ {s} \left[ \mathbf {a} _ {l, n} ^ {(s)} \otimes \mathbf {g} _ {l, n} ^ {(s)} \right], \tag {13} +$$ + +where $\mathbf{a}^{(s)},\mathbf{g}^{(s)}$ depend on the $s$ th sample $\mathbf{x}_s = \mathbf{g}(\mathbf{x},\epsilon_s;\pmb {\eta})$ and thus $\pmb{\eta}$ . In general, the sum of Kronecker products does not allow for efficient computation and requires evaluating the products, which is intractable as it requires $\mathcal{O}(D_l^2 G_l^2)$ instead of $\mathcal{O}(D_l^2 +G_l^2)$ memory. + +Similar to the idea underlying KFAC itself (Martens and Grosse, 2015), we enforce the efficient Kronecker-factored structure by approximating the sum of a Kronecker product as a Kronecker product of sums and appropriately normalizing by the number of terms. However, instead of applying this approximation to the GGN over multiple data points, we apply it to the Jacobian and have + +$$ +\hat {\mathbf {J}} _ {\boldsymbol {\theta} _ {l}} \left(\mathbf {x} _ {n}; \boldsymbol {\eta}\right) = \frac {1}{S} \sum_ {s} \left[ \mathbf {a} _ {l, n} ^ {(s)} \otimes \mathbf {g} _ {l, n} ^ {(s)} \right] \approx \frac {1}{S ^ {2}} \left[ \sum_ {s} \mathbf {a} _ {l, n} ^ {(s)} \right] \otimes \left[ \sum_ {s} \mathbf {g} _ {l, n} ^ {(s)} \right]. \tag {14} +$$ + +Applying this Jacobian approximation, the $n$ th summand of the GGN can be written as + +$$ +\begin{array}{l} \hat {\mathbf {H}} _ {l, n} ^ {\mathrm {G G N}} (\boldsymbol {\eta}) \approx \left[ \frac {1}{S ^ {2}} \left[ \sum_ {s} \mathbf {a} _ {l, n} ^ {(s)} \right] \otimes \left[ \sum_ {s} \mathbf {g} _ {l, n} ^ {(s)} \right] \right] \hat {\boldsymbol {\Lambda}} (\mathbf {x} _ {n}; \boldsymbol {\theta}, \boldsymbol {\eta}) \left[ \frac {1}{S ^ {2}} \left[ \sum_ {s} \mathbf {a} _ {l, n} ^ {(s)} \right] \otimes \left[ \sum_ {s} \mathbf {g} _ {l, n} ^ {(s)} \right] \right] ^ {\top} \tag {15} \\ = \frac {1}{S ^ {4}} \left[ \left[ \sum_ {s} \mathbf {a} _ {l, n} ^ {(s)} \right] \left[ \sum_ {s} \mathbf {a} _ {l, n} ^ {(s)} \right] ^ {\intercal} \right] \otimes \left[ \left[ \sum_ {s} \mathbf {g} _ {l, n} ^ {(s)} \right] \hat {\mathbf {A}} (\mathbf {x} _ {n}; \boldsymbol {\theta}, \boldsymbol {\eta}) \left[ \sum_ {s} \mathbf {g} _ {l, n} ^ {(s)} \right] ^ {\intercal} \right] \stackrel {\mathrm {d e f}} {=} \hat {\mathbf {A}} _ {l, n} \otimes \hat {\mathbf {G}} _ {l, n}. \\ \end{array} +$$ + +To compute the full KFAC, we then accumulate the Kronecker factors for the $l$ th layer, $\hat{\mathbf{A}}_{l,n}$ and $\hat{\mathbf{G}}_{l,n}$ , of the invariant neural network over all $n$ data points to obtain $\hat{\mathbf{A}}_l$ and $\hat{\mathbf{G}}_l$ as in Eq. 7 for vanilla KFAC. Like KFAC, our approximation for invariant models remains exact for linear models (App. F.1). + +The log determinant required for the marginal-likelihood approximation can be computed from $\hat{\mathbf{G}}_l$ , $\hat{\mathbf{A}}_l$ individually (Immer et al., 2021a) and has a complexity of $\mathcal{O}(D_l^3 + G_l^3)$ as opposed to the intractable $\mathcal{O}(D_l^3 G_l^3)$ . This enables us to apply our method to deep invariant neural networks with widths of order $10^4$ , like vanilla KFAC. We discuss computational complexities in depth in App. D. We note that KFAC for invariant neural networks could further be of independent interest for second-order optimisation and inference (Martens and Grosse, 2015; Zhang et al., 2018). + +# 4.3 Efficient Gradient Estimation of the Laplace-GGN w.r.t. Complex Hyperparameters + +Automatic differentiation (AD) of the log determinant term in the Laplace-GGN w.r.t. complex hyperparameters, such as invariances, has an intractable memory complexity. Here, we propose a method to estimate the gradient of the log determinant in the Laplace-GGN without memory overhead. For AD, the memory complexity is equivalent to the runtime complexity of computing the log determinant, which is at least $\mathcal{O}(NP)$ , the cost of training a deep neural network for one epoch. Such computation is only tractable due to batching (e.g., for standard training losses) and otherwise would require several terabytes of memory for deep neural networks. However, the log determinant does not allow for a batched gradient and therefore AD requires storing the full training data pass. + +Our approach to reducing the memory complexity relies on computing a vector-Jacobian product where both, the vector and the Jacobian, can be estimated from batches of data. Mathematically, the problem reduces to differentiation of the log determinant of a sum of square matrices w.r.t. hyperparameter $\pmb{\eta}$ , i.e., $\frac{\partial}{\partial\pmb{\eta}}\log |\mathbf{H}(\pmb{\eta})|$ with $\mathbf{H}(\pmb {\eta}) = \sum_{n}\mathbf{H}_{n}(\pmb {\eta})\in \mathbb{R}^{P\times P}$ . For a positive definite matrix $\mathbf{H}$ , we have $\frac{\partial\log|\mathbf{H}|}{\partial\mathbf{H}} = \mathbf{H}^{-1}$ . Therefore, we can differentiate w.r.t. $\pmb{\eta}$ with + +$$ +\begin{array}{l} \frac {\partial}{\partial \pmb {\eta}} \log | \mathbf {H} (\pmb {\eta}) | = \sum_ {p = 1} ^ {P} \sum_ {q = 1} ^ {P} [ \mathbf {H} ^ {- 1} (\pmb {\eta}) ] _ {p, q} [ \frac {\partial}{\partial \pmb {\eta}} \sum_ {n = 1} ^ {N} \mathbf {H} _ {n} (\pmb {\eta}) ] _ {p, q} \\ = \operatorname {v e c} \left(\mathbf {H} ^ {- 1} (\boldsymbol {\eta})\right) ^ {\top} \sum_ {n = 1} ^ {N} \frac {\partial}{\partial \boldsymbol {\eta}} \operatorname {v e c} \left(\mathbf {H} _ {n} (\boldsymbol {\eta})\right), \tag {16} \\ \end{array} +$$ + +where the two vectorised matrices are $P^2$ -dimensional vectors and can both be computed from individual batches of $\mathbf{H}_n$ as follows: the first term acts as a preconditioner and can be computed by summing up the batches and inverting the resulting matrix $\mathbf{H}$ without storing the computation graph. The second term is a sum over $N$ Jacobians w.r.t. $\pmb{\eta}$ and we can either aggregate it or obtain an unbiased stochastic estimate from batches of data. The product of both terms constitutes a vector-Jacobian product and is a standard procedure of AD (Paszke et al., 2017). + +The proposed method allows to aggregate gradients with respect to complex hyperparameters with memory complexity that is controlled by the batch size $1 \leq M \leq N$ . In contrast to naive application of AD to the log determinant, this allows to decouple memory and runtime complexity and enables gradient-based optimisation of the log determinant in Eq. 9 w.r.t. the augmentation parameters for deep invariant networks on large datasets. More generally, our method enables gradient-based marginal likelihood optimisation for more complex hyperparameters than previously considered (Immer et al., 2021a; Antorán et al., 2022a). In App. E, we describe the gradient computation for KFAC in detail. + +![](images/5834fa27df3a0658aa89a9ff195efd416a740e584321684bceee0bf006a0d980.jpg) + +![](images/df745c30c69861c376f0beb95c5f6a6b2a06f54f16782edacbc8452a237845b3.jpg) +Figure 2: Trajectories of invariance parameters $\eta = [\eta_1, \eta_2, \dots, \eta_6]^T$ optimised with LILA over 1000 epochs for different versions of the MNIST dataset. From each distribution, two sampled transformations are represented as flow fields with arrow lengths scaled to pixel movement. LILA automatically learns the correct type and amount of invariance for each of the modified training datasets and keeps the other affine invariance parameters at zero as desired. + +# 5 Experiments + +We evaluate our method that learns invariances using Laplace approximations (LILA) by optimising affine invariances on different MNIST (LeCun and Cortes, 2010), FashionMNIST (Xiao et al., 2017), and CIFAR-10 (Krizhevsky et al., 2009) classification tasks. To validate whether the method is capable of learning appropriate invariances, we construct several additional datasets modified by known sets of invariance transformations with the goal to recover them. We consider the following affine transformations: full rotation, partial rotation, translation, and scaling (full details in App. B). We compare our approach with a non-invariant baseline and Augerino (Benton et al., 2020), which is, to our knowledge, the only other method that is capable of learning invariances on complex image datasets in deep neural networks without validation data. In the non-invariant model, prior parameters are learned using the marginal likelihood (Immer et al., 2021a). For invariance learning, prior parameters and $\eta$ are jointly learned based on the marginal likelihood. For Augerino, we minimise the regular cross entropy with added regularising term $-10^{-2}||\eta ||_2$ and a fixed weight decay of $10^{-4}$ following the original paper (Benton et al., 2020). The same parameterisation, network architecture, and initialisations (in particular $\eta = 0$ ) were used for all methods. We assess performance of our approach by inspecting learned invariances $\eta$ , marginal likelihoods, and final test performances. + +# 5.1 Recovering Known Invariances + +To assess the invariances learned by our method LILA, we can inspect the learned invariance parameters. The invariance parameter vector $\pmb{\eta} = [\eta_1,\eta_2,\dots,\eta_6]^T$ describes affine invariances with components corresponding to x-translation, y-translation, rotation, horizontal and vertical scaling, and shearing (App. B). As an MLP has little symmetry encoded in the architecture itself, we expect $\pmb{\eta}$ to almost correctly recover the invariances. In Fig. 2, we plot the trajectories of each vector component over the course of training for an MLP model on different transformed MNIST datasets. As reference, we show the amount of invariance that was imposed on each dataset as a dashed line. From the figure, we can observe that for each dataset, LILA learns the correct invariance as well as the amount of each invariance. To some extent, the model also learned translational invariance on the regular MNIST dataset which can be explained by intrinsic translational invariance of the dataset. + +Other network architectures have certain symmetries already built-in to some extent (e.g., translational equivariance of convolutional layers). Yet, we find that LILA is also capable of inferring the correct invariances with such larger and other network architectures and on a variety of datasets in App. J.3. In App. F, we further show that cheaper Hessian approximations, such as the diagonal GGN instead of KFAC and empirical Fisher (EF) instead of GGN lead to worse performance for invariance learning. This suggests that our extension of KFAC to invariant neural networks is necessary for sufficient invariance learning. While Immer et al. (2021a) find that diagonal approximations can suffice for learning regularisation hyperparameters, this does not apply for the more complex invariance parameters considered here and more accurate approximations tend to increase performance. + +![](images/1263d6aa14074efa8b7ef5b094c27cfe5de8339c933fe0a129818e10bc0176d5.jpg) + +![](images/ebd4e29b7071e01ed3275d61ba667fcb3dc5d97a233053a1ab38f2a048ad5f01.jpg) + +![](images/9077a9c3d8705b30d882a71b2e399e46650e55b99f3c580ce6ce33a364badc32.jpg) +Figure 3: LILA improves data efficiency on different versions of CIFAR-10 by learning invariances. We compare test accuracy on randomly sampled subsets to a non-invariant network and Augerino using a ResNet. For example on fully-rotated CIFAR-10, invariance learning achieves the final accuracy of the non-invariant model with 10 times less data. In most cases, LILA further improves over Augerino. We plot the average performance and standard error over three seeds. + +![](images/d11e3f2009270eadf783e4e685c735db83db960a805d0fac372bf02b32b2b9c6.jpg) + +![](images/2a5e25db209e7d08f1a01b6fac1d14171e54fe132785bb0402be116bc33f3fb1.jpg) + +
DatasetNetworkMethodFully RotatedPartially RotatedTranslatedScaledOriginal
MNISTMLPnon-invariant93.82 ±0.1095.83 ±0.0394.15 ±0.0297.07 ±0.0698.20 ±0.03
Augerino97.83 ±0.0396.35 ±0.0294.47 ±0.0897.45 ±0.0398.45 ±0.03
Diff. Laplace (ours)97.74 ±0.0797.81 ±0.1197.28 ±0.0598.33 ±0.0598.98 ±0.05
CNNnon-invariant95.97 ±0.3397.51 ±0.1796.54 ±0.2998.37 ±0.0099.09 ±0.02
Augerino99.04 ±0.0298.91 ±0.0397.79 ±0.0998.77 ±0.0698.26 ±0.10
LIL KFAC (ours)98.83 ±0.0798.92 ±0.0598.69 ±0.0799.01 ±0.0699.42 ±0.02
F-MNISTMLPnon-invariant77.62 ±0.3081.10 ±0.2377.68 ±0.1081.84 ±0.0588.48 ±0.56
Augerino77.76 ±0.1581.40 ±0.0578.05 ±0.1082.46 ±0.0989.10 ±0.13
LILA (ours)87.39 ±0.0686.72 ±0.1384.62 ±0.0884.31 ±0.0689.94 ±0.12
CNNnon-invariant78.69 ±0.2882.12 ±0.3580.33 ±0.1983.66 ±0.3789.54 ±0.23
Augerino85.76 ±3.2381.54 ±0.1982.94 ±0.1383.58 ±0.0890.07 ±0.12
LILA (ours)89.45 ±0.0388.40 ±0.0087.73 ±0.2087.33 ±0.0091.92 ±0.21
CIFAR-10ResNetnon-invariant54.16 ±0.4059.90 ±0.1269.65 ±0.1666.06 ±0.1374.13 ±0.51
Augerino75.40 ±0.1974.76 ±0.3473.71 ±0.3172.07 ±0.0979.03 ±1.04
LILA (ours)79.50 ±0.6277.71 ±0.4679.21 ±0.1776.03 ±0.1584.19 ±0.76
+ +# 5.2 Invariance Learning in Different Networks + +To quantify the benefit of models with learned invariances, we present final test accuracies of LILA and the baselines with different models on each of the datasets in Table 1. Additional marginal likelihood scores can be found in App. J.2. In terms of test accuracy and marginal likelihood, we find that learning invariances always outperforms the non-invariant baseline and that our approach improves over Augerino in almost all cases. This holds across the transformed and original datasets. While the improvements are modest for MNIST, the performance + +improvements on F-MNIST and CIFAR-10 can be up to 10 percent points. In Table 2, we use the commonly used Wide ResNet architecture on CIFAR-10 and find that invariance learning with Augerino merely improves performance while our method achieves performance improvement of almost $7\%$ points. We also report the performance of LILA with the cheaper KFAC-EF instead of GGN. + +Table 1: Test accuracy for models using LILA on different versions of the MNIST, FashionMNIST, and CIFAR-10 datasets. We report the average performance and the standard error over three random seeds. Our method outperforms the non-invariant network and Augerino for most models and datasets. + +
MethodTest accuracy
non-invariant85.17 ±0.39
Augerino87.67 ±0.08
LILA (ours)91.98 ±0.04
LILA EF (ours)91.64 ±0.26
+ +Table 2: Invariance Learning with KFAC on CIFAR-10 with a Wide ResNet achieves best test accuracy. Also, the cheaper empirical Fisher (EF) variant improves over Augerino. + +# 5.3 Invariance Learning Improves Data Efficiency + +Invariances can be particularly useful for data-efficiency, which can be evaluated by measuring performance on subsets of data. In Fig. 3, we show the test accuracy of LILA, the non-invariant baseline, and Augerino trained on different subsets of CIFAR-10 and its modified versions. We further provide results for all architectures and datasets in App. J.5. In general, we find that invariance learning with both Augerino and our method always improves performance across datasets and subset sizes. Most notably on a subset of 1000 regular CIFAR-10 dataset samples, Augerino improved performance by 18 percentage points compared to the non-invariant baseline, whereas our method showed an improvement of 22 percentage points. LILA requires only $10\%$ of the data to obtain the same accuracy as the non-invariant model on the fully-rotated dataset. These findings suggest that learning invariances is useful in general, and in particular when limited data is available. + +# 5.4 On the Learned Distributions + +In some instances (see CIFAR-10 results in Apps. J.3 and J.4), we observed that the model learned translational invariance on the scaled dataset rather than scale invariance. Our independent uniform distributions over invariance components cannot capture correlations between components whereas the scaled dataset was jointly scaled across the horizontal and vertical axes and thus is correlated. We hypothesise that more complex distributions that do allow for capturing correlations could offer a potential solution in such cases, but leave investigation of more complex families to future work. + +# 6 Discussion and Limitations + +We discuss the runtime complexity and approximations of our method in general, and for invariance learning in particular, in detail in App. D and App. F, respectively. The runtime complexity of LILA, just like that of Augerino and other methods that use test-time data augmentation, increases linearly by the factor $S$ , which denotes the number of augmentation samples used. Since we know that we are sampling from a lower bound (Eq. 24), more samples are generally better and are expected to improve the performance, which we also observed in our experiments. In addition, LILA requires estimation and differentiation of the log-determinant term. While our extension of KFAC to sampling-based invariant models and the batched gradients make such computation at all tractable, it can still be expensive for a large number of classes $C$ and augmentation samples $S$ . Using the EF instead of the GGN overcomes scaling in $C$ but is a cruder approximation. Although these additional computations make LILA slower than Augerino, they enable overcoming its issues, i.e., parameterisation-dependence and additional hyperparameters that need to be tuned (App. C), enable to learn soft invariances much more precisely. + +# 7 Conclusion + +We presented a method that enables automatic invariance learning in deep neural networks directly from training data, without requiring supervision or validation data. The approach is inspired by using the marginal likelihood, which is a parameterisation-independent quantity coinciding with generalisation performance. To make this practical, we use a differentiable Laplace approximation to allow for gradient-based optimisation of invariances in deep learning. While the accuracy of the approximation is difficult to verify, we do show experimentally that the method is capable of learning invariances in MNIST, FashionMNIST, and CIFAR-10 datasets, leading to better marginal likelihoods and higher test performances. Our work shows that approximate Bayesian inference methods can be useful for learning complex hyperparameters, even in deep learning, and are therefore relevant beyond predictive uncertainty estimation. In future work, it would be interesting to improve the scalability and accuracy of marginal likelihood approximations which could enable learning even more complex hyperparameters, such as augmentation distributions parameterised by neural networks. Alternatively, improving parameterisations of invariances in neural networks could greatly improve the scalability of LILA and related approaches. + +# Acknowledgements + +A.I. acknowledges funding by the Max Planck ETH Center for Learning Systems (CLS). V.F. acknowledges funding by the Swiss Data Science Center through a PhD Fellowship, the Swiss National Science Foundation through a Postdoc.Mobility Fellowship, St John's College Cambridge through a Research Fellowship, and the Branco Weiss Foundation through a Branco Weiss Fellowship. + +# References + +Javier Antorán, Riccardo Barbano, Johannes Leuschner, José Miguel Hernández-Lobato, and Bangti Jin. A probabilistic deep image prior for computational tomography. arXiv preprint arXiv:2203.00479, 2022a. +Javier Antorán, David Janz, James U Allingham, Erik Daxberger, Riccardo Rb Barbano, Eric Nalisnick, and José Miguel Hernández-Lobato. Adapting the linearised laplace model evidence for modern deep learning. In International Conference on Machine Learning, 2022b. + +Simon Batzner, Albert Musaelian, Lixin Sun, Mario Geiger, Jonathan P Mailoa, Mordechai Kornbluth, Nicola Molinari, Tess E Smidt, and Boris Kozinsky. Se (3)-equivariant graph neural networks for data-efficient and accurate interatomic potentials. arXiv preprint arXiv:2101.03164, 2021. +Gregory Benton, Marc Finzi, Pavel Izmailov, and Andrew Gordon Wilson. Learning invariances in neural networks. arXiv preprint arXiv:2010.11882, 2020. +Christopher M Bishop. Pattern recognition and machine learning. Information Science and Statistics. Springer, 2006. +Charles Blundell, Julien Cornebise, Koray Kavukcuoglu, and Daan Wierstra. Weight uncertainty in neural networks. In Proceedings of the 32nd International Conference on Machine Learning, pages 1613-1622, 2015. +Aleksandar Botev, Hippolyt Ritter, and David Barber. Practical Gauss-Newton optimisation for deep learning. In International Conference on Machine Learning, International Convention Centre, Sydney, Australia, 2017. PMLR. +Léon Bottou. Large-scale machine learning with stochastic gradient descent. In Proceedings of COMPSTAT'2010, pages 177-186. Springer, 2010. +Johannes Brandstetter, Rob Hesselink, Elise van der Pol, Erik Bekkers, and Max Welling. Geometric and physical quantities improve e (3) equivariant message passing. arXiv preprint arXiv:2110.02905, 2021. +Taco Cohen and Max Welling. Group equivariant convolutional networks. In International conference on machine learning, pages 2990-2999. PMLR, 2016. +Taco S Cohen, Mario Geiger, Jonas Kohler, and Max Welling. Spherical cnns. arXiv preprint arXiv:1801.10130, 2018. +Ekin D Cubuk, Barret Zoph, Dandelion Mane, Vijay Vasudevan, and Quoc V Le. Autoaugment: Learning augmentation policies from data. arXiv preprint arXiv:1805.09501, 2018. +Felix Dangel, Frederik Kunstner, and Philipp Hennig. Backpack: Packing more into backprop. In Proceedings of 7th International Conference on Learning Representations, 2019. +Erik Daxberger, Agustinus Kristiadi, Alexander Immer, Runa Eschenhagen, Matthias Bauer, and Philipp Hennig. Laplace redux-effortless bayesian deep learning. Advances in Neural Information Processing Systems, 34, 2021. +Guillaume P Dehaene. A deterministic and computable bernstein-von mises theorem. arXiv preprint arXiv:1904.02505, 2019. +Edwin Fong and CC Holmes. On the marginal likelihood and cross-validation. Biometrika, 107(2): 489-496, 2020. +Andrew YK Foong, Yingzhen Li, José Miguel Hernández-Lobato, and Richard E Turner. 'inbetween'uncertainty in bayesian neural networks. arXiv preprint arXiv:1906.11537, 2019. +Kunihiko Fukushima and Sei Miyake. Neocognitron: A self-organizing neural network model for a mechanism of visual pattern recognition. In *Competition and cooperation in neural nets*, pages 267–285. Springer, 1982. +Pascal Germain, Francis Bach, Alexandre Lacoste, and Simon Lacoste-Julien. Pac-bayesian theory meets bayesian inference. In D. Lee, M. Sugiyama, U. Luxburg, I. Guyon, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 29. Curran Associates, Inc., 2016. +David Ginsbourger, Olivier Roustant, and Nicolas Durrande. On degeneracy and invariances of random fields paths with applications in gaussian process modelling. Journal of Statistical Planning and Inference, 170:117-128, 2016. ISSN 0378-3758. +Peter D Grünwald. The minimum description length principle. MIT press, 2007. + +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770-778, 2016. +Alexander Immer, Matthias Bauer, Vincent Fortuin, Gunnar Ratsch, and Mohammad Emtiyaz Khan. Scalable marginal likelihood estimation for model selection in deep learning. arXiv preprint arXiv:2104.04975, 2021a. +Alexander Immer, Maciej Korzepa, and Matthias Bauer. Improving predictions of bayesian neural nets via local linearization. In Proceedings of The 24th International Conference on Artificial Intelligence and Statistics, pages 703-711, 2021b. +Alexander Immer, Lucas Torroba Hennigen, Vincent Fortuin, and Ryan Cotterell. Probing as quantifying inductive bias. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics, pages 1839-1851, 2022. +Arthur Jacot, Franck Gabriel, and Clément Hongler. Neural tangent kernel: Convergence and generalization in neural networks. In Advances in neural information processing systems, pages 8571-8580, 2018. +Max Jaderberg, Karen Simonyan, Andrew Zisserman, et al. Spatial transformer networks. Advances in neural information processing systems, 28:2017-2025, 2015. +Mohammad Emtiyaz E Khan, Alexander Immer, Ehsan Abedi, and Maciej Korzepa. Approximate inference turns deep networks into gaussian processes. In Advances in Neural Information Processing Systems, pages 3088-3098, 2019. +Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2015. +Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013. +Imre Risi Kondor. Group theoretical methods in machine learning, 2008. +Risi Kondor, Zhen Lin, and Shubhendu Trivedi. Clebsch-gordan nets: a fully fourier space spherical convolutional neural network. Advances in Neural Information Processing Systems, 31:10117-10126, 2018. +Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009. +Frederik Kunstner, Philipp Hennig, and Lukas Balles. Limitations of the empirical fisher approximation for natural gradient descent. In Advances in Neural Information Processing Systems, pages 4158-4169, 2019. +Pierre-Simon de Laplace. Mémoire sur la probabilité des causes par les événements. Mémoires de l'Académie royale des sciences de Paris (Savants étrangers), 6:621-656, 1774. +Yann LeCun and Corinna Cortes. MNIST handwritten digit database. http://yann.lecun.com/exdb/mnist/, 2010. URL http://yann.lecun.com/exdb/mnist/. +Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278-2324, 1998. +Jonathan Lorraine, Paul Vicol, and David Duvenaud. Optimizing millions of hyperparameters by implicit differentiation. In Silvia Chiappa and Roberto Calandra, editors, Proceedings of the Twenty Third International Conference on Artificial Intelligence and Statistics, volume 108 of Proceedings of Machine Learning Research, pages 1540-1552. PMLR, 26-28 Aug 2020. +David JC MacKay. A practical bayesian framework for backpropagation networks. Neural computation, 4(3):448-472, 1992. +David JC MacKay. Information theory, inference and learning algorithms. Cambridge university press, 2003. + +James Martens. New insights and perspectives on the natural gradient method. Journal of Machine Learning Research, 21(146):1-76, 2020. +James Martens and Roger Grosse. Optimizing neural networks with kronecker-factored approximate curvature. In International conference on machine learning, pages 2408-2417, 2015. +Cleve Moler and Charles Van Loan. Nineteen dubious ways to compute the exponential of a matrix, twenty-five years later. SIAM review, 45(1):3-49, 2003. +Kevin P Murphy. Machine learning: a probabilistic perspective. MIT press, 2012. +Seth Nabarro, Stoil Ganev, Adrià Garriga-Alonso, Vincent Fortuin, Mark van der Wilk, and Laurence Aitchison. Data augmentation in bayesian neural networks and the cold posterior effect. arXiv preprint arXiv:2106.05586, 2021. +Sebastian W Ober and Laurence Aitchison. Global inducing point variational posteriors for bayesian neural networks and deep gaussian processes. In International Conference on Machine Learning, pages 8248-8259. PMLR, 2021. +Sebastian W. Ober, Carl E. Rasmussen, and Mark van der Wilk. The promises and pitfalls of deep kernel learning. In Cassio de Campos and Marloes H. Maathuis, editors, Proceedings of the Thirty-Seventh Conference on Uncertainty in Artificial Intelligence (UAI), volume 161 of Proceedings of Machine Learning Research, pages 1206-1216. PMLR, 27-30 Jul 2021. +Kazuki Osawa, Siddharth Swaroop, Mohammad Emtiyaz E Khan, Anirudh Jain, Runa Eschenhagen, Richard E Turner, and Rio Yokota. Practical deep learning with bayesian principles. In Advances in Neural Information Processing Systems, pages 4289-4301, 2019. +Kazuki Osawa, Yohei Tsuji, Yuichiro Ueno, Akira Naruse, Chuan-Sheng Foo, and Rio Yokota. Scalable and practical natural gradient for large-scale deep learning. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2020. +Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in pytorch. 2017. +Carl Edward Rasmussen and Zoubin Ghahramani. Occam's razor. In Advances in neural information processing systems, pages 294-300, 2001. +Carl Edward Rasmussen and Christopher KI Williams. Gaussian processes for machine learning. MIT press Cambridge, MA, 2006. +Hippolyt Ritter, Aleksandar Botev, and David Barber. A scalable laplace approximation for neural networks. In International Conference on Learning Representations, 2018. +Pola Schwöbel, Martin Jørgensen, Sebastian W. Ober, and Mark van der Wilk. Last layer marginal likelihood for invariance learning. In Proceedings of the Twenty Fifth International Conference on Artificial Intelligence and Statistics (AISTATS), 2022. +Joost van Amersfoort, Lewis Smith, Andrew Jesson, Oscar Key, and Yarin Gal. Improving deterministic uncertainty estimation in deep learning for classification and regression. CoRR, abs/2102.11409, 2021. +Tycho FA van der Ouderaa and Mark van der Wilk. Learning invariant weights in neural networks. In Workshop in Uncertainty & Robustness in Deep Learning, ICML, 2021. +Elise van der Pol, Daniel Worrall, Herke van Hoof, Frans Oliehoek, and Max Welling. Mdp homomorphic networks: Group symmetries in reinforcement learning. Advances in Neural Information Processing Systems, 33, 2020. +Mark van der Wilk, Matthias Bauer, ST John, and James Hensman. Learning invariances using the marginal likelihood. In Advances in Neural Information Processing Systems, pages 9938-9948, 2018. + +Florian Wenzel, Kevin Roth, Bastiaan S Veeling, Jakub Światkowski, Linh Tran, Stephan Mandt, Jasper Snoek, Tim Salimans, Rodolphe Jenatton, and Sebastian Nowozin. How good is the bayes posterior in deep neural networks really? In International Conference on Machine Learning, 2020. +Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms, 2017. +Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. In BMVC. BMVA Press, 2016. +Guodong Zhang, Shengyang Sun, David Duvenaud, and Roger Grosse. Noisy natural gradient as variational inference. In International Conference on Machine Learning, pages 5852-5861, 2018. +Hongyi Zhang, Yann N Dauphin, and Tengyu Ma. Fixup initialization: Residual learning without normalization. In International Conference on Learning Representations, 2019. +Allan Zhou, Tom Knowles, and Chelsea Finn. Meta-learning symmetries by reparameterization. arXiv preprint arXiv:2007.02933, 2020. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] We point out all approximations and discuss complexities of the method. +(c) Did you discuss any potential negative societal impacts of your work? [N/A] There are no direct societal impacts. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [N/A] +(b) Did you include complete proofs of all theoretical results? [N/A] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] Code available on https://github.com/tychovdo/lila. Details are in Sec. 5 and App. I. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] all experiments are repeated 3 times to estimate the error bars. +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [No] + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] +(b) Did you mention the license of the assets? [No] +(c) Did you include any new assets either in the supplemental material or as a URL? [No] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/invariancelearningindeepneuralnetworkswithdifferentiablelaplaceapproximations/images.zip b/invariancelearningindeepneuralnetworkswithdifferentiablelaplaceapproximations/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..2ce321dff2628bce6f0bdd779549fde3a8484f27 --- /dev/null +++ b/invariancelearningindeepneuralnetworkswithdifferentiablelaplaceapproximations/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:677ed70fb750bafdb393a19707be603d5783f88b5b91ed93c7f82ee2ee9796db +size 472001 diff --git a/invariancelearningindeepneuralnetworkswithdifferentiablelaplaceapproximations/layout.json b/invariancelearningindeepneuralnetworkswithdifferentiablelaplaceapproximations/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..51e9f81561ba0433498b6b1ffde8b2f5ee494abb --- /dev/null +++ b/invariancelearningindeepneuralnetworkswithdifferentiablelaplaceapproximations/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f6425d64f525f57bce65ee21a99ed90cf55c2044167dd0203780c2c2781980e0 +size 500662 diff --git a/invariantandtransportablerepresentationsforanticausaldomainshifts/3e4c475c-d0e5-4b1d-82b5-8bb6b19f95b1_content_list.json b/invariantandtransportablerepresentationsforanticausaldomainshifts/3e4c475c-d0e5-4b1d-82b5-8bb6b19f95b1_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..d98884c7f69c6133f4cdcf1c1bee0012c58e5ed1 --- /dev/null +++ b/invariantandtransportablerepresentationsforanticausaldomainshifts/3e4c475c-d0e5-4b1d-82b5-8bb6b19f95b1_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:faca37a10075ba4dea71f9207dbcb42de34d488fc3af9ac2e860302b70940937 +size 80336 diff --git a/invariantandtransportablerepresentationsforanticausaldomainshifts/3e4c475c-d0e5-4b1d-82b5-8bb6b19f95b1_model.json b/invariantandtransportablerepresentationsforanticausaldomainshifts/3e4c475c-d0e5-4b1d-82b5-8bb6b19f95b1_model.json new file mode 100644 index 0000000000000000000000000000000000000000..f6f1ecca50200a8d3ca8a5c7d28447200a21da8f --- /dev/null +++ b/invariantandtransportablerepresentationsforanticausaldomainshifts/3e4c475c-d0e5-4b1d-82b5-8bb6b19f95b1_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:013fcb060e515823fc75dcb781249aa4d632f09625910b1100a26061f9b2053a +size 106619 diff --git a/invariantandtransportablerepresentationsforanticausaldomainshifts/3e4c475c-d0e5-4b1d-82b5-8bb6b19f95b1_origin.pdf b/invariantandtransportablerepresentationsforanticausaldomainshifts/3e4c475c-d0e5-4b1d-82b5-8bb6b19f95b1_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..ea5e004a0631d2f353996bb144c0b31bbceb4fa3 --- /dev/null +++ b/invariantandtransportablerepresentationsforanticausaldomainshifts/3e4c475c-d0e5-4b1d-82b5-8bb6b19f95b1_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2ffaaa1ff4f009c175b3a77e1e0ee7d1e59d683f9cde80e429d21af0af0e0a9a +size 1376297 diff --git a/invariantandtransportablerepresentationsforanticausaldomainshifts/full.md b/invariantandtransportablerepresentationsforanticausaldomainshifts/full.md new file mode 100644 index 0000000000000000000000000000000000000000..71241d6c4e67fd8c8d2a1aef22770882bf016156 --- /dev/null +++ b/invariantandtransportablerepresentationsforanticausaldomainshifts/full.md @@ -0,0 +1,363 @@ +# Invariant and Transportable Representations for Anti-Causal Domain Shifts + +Yibo Jiang1 and Victor Veitch2,3 + +$^{1}$ Department of Computer Science, University of Chicago + +$^{2}$ Department of Statistics, University of Chicago + +3Google Research + +# Abstract + +Real-world classification problems must contend with domain shift, the (potential) mismatch between the domain where a model is deployed and the domain(s) where the training data was gathered. Methods to handle such problems must specify what structure is common between the domains and what varies. A natural assumption is that causal (structural) relationships are invariant in all domains. Then, it is tempting to learn a predictor for label $Y$ that depends only on its causal parents. However, many real-world problems are "anti-causal" in the sense that $Y$ is a cause of the covariates $X$ — in this case, $Y$ has no causal parents and the naive causal invariance is useless. In this paper, we study representation learning under a particular notion of domain shift that both respects causal invariance and that naturally handles the "anti-causal" structure. We show how to leverage the shared causal structure of the domains to learn a representation that both admits an invariant predictor and that also allows fast adaptation in new domains. The key is to translate causal assumptions into learning principles that disentangle "invariant" and "non-stable" features. Experiments on both synthetic and real-world data demonstrate the effectiveness of the proposed learning algorithm. Code is available at https://github.com/ybjiaang/ACTIR. + +# 1 Introduction + +This paper concerns the problem of domain shift in supervised learning, the phenomenon where a predictor with good performance in some (training) domains may have poor performance when deployed in a novel (test) domain. There are two goals when faced with domain shifts. First, we would like to learn a fixed predictor that is domain-invariant in the sense that it has good performance in all domains. Note, however, that even a good domain-invariant predictor may still be far from optimal in any given target domain. In such cases, we'd like to learn an optimal domain-specific predictor as quickly as possible. Then, the second goal is to learn a representation for our data that is transportable in the sense that, when given data from a new domain, we can use the representation to learn a domain-specific predictor using only a small number of examples. + +Domain shifts plague real-world applications of machine learning and there is a large and active literature aimed at mitigating the problem [e.g., Arj+19; Vei+21; PBM16; Rot+21; Wan+21; Zho+21; Koh+21; Zhu+20; Cai+21; Shi+21; Sag+19; Bai+20; SSS19; Zhe+21; Liu+21; Lu+21]. Empirically, when domain shift methods are applied to wide-ranging benchmarks, there is no single dominant method—indeed, it's common for methods that work well in one context to do worse than naive empirical risk minimization (i.e., ignore the shift problem) in another context [Koh+21; GL21]. This problem is fundamental: it is impossible to build predictors that are robust to all possible kinds of + +![](images/96fbd86d37005d0d756ec68975a07169ead5945eebd75ba3ef1e9774ccb0c4b0.jpg) +Figure 1: Causal model for the data generating process. We decompose the observed covariate X into latent parts defined by their causal relationships with Z. Solid circles denote observed variables, while shaded circles denote hidden variables. + +shifts. Accordingly, it is necessary to specify the manner in which the training and test domains are related to each other; that is, what structure is common to all domains, and what structure can vary across them. Then, to make progress on the domain shift problem, the task is to identify structural assumptions that are well matched to real-world problems and then find methods that can achieve domain-invariance and transportability under this structure. + +In this paper, we rely on a particular variant of the assumption that structural causal relationships are invariant across domains, but certain "non-causal" relationships may vary. The motivation is that relationships fixed by the underlying dynamics of a system are the same regardless of the domain [PJS17]. A similar causal domain-structure assumption is already well-studied in the domain-shift literature [e.g., PBM16, Arj+19, Rot+21, Roj+18, MBS13]. There, the goal is to predict the target label $Y$ using only its causal parents (reconstructed from observed features $X$ ). In particular, the aim is to build predictors that do not rely on any part of the features that is causally affected by $Y$ . However, in many problems, it can happen that the observed covariates $X$ are all caused by $Y$ , so that the causal parents of $Y$ are the empty set. In this case, the naive causally invariant predictor is vacuous. + +The purpose of this paper is to study an alternative causal notion of domain shift that handles such "anti-causal" ( $Y$ causes $X$ ) problems, and that maintains the interpretation that structural causal relationships are held fixed across all domains. Specifically, + +1. We formalize the anti-causal domain shift assumption. +2. We show how the causal domain shift assumption can be leveraged to find an invariant predictor and transportable representation. +3. We use this as the basis of a concrete learning procedure for domain-invariant and domain-adaptive representations. + +# 2 Causal Setup + +The first step is to make precise what structure is preserved across domains, and what structure varies. Once we have this, we'll make the notions of invariant and fast-adapting predictor precise. + +In each domain $e$ , we have observed data $(X_{i},Y_{i}) \stackrel{\mathrm{iid}}{\sim} P^{e}$ , where $P^{e}$ is a domain-specific data-generating distribution. We will mainly consider problems where we have (finite) datasets sampled from multiple distinct domains at training time, and wish to make predictions on data sampled from some additional domains not observed during training. This paper discusses classification problems where $Y_{i}$ is discrete. + +To formalize the causal structure assumption, we'll introduce two additional latent (unobserved) variables. First, $Z$ , a (subset of) the causes of $X$ . Second, $U$ , a confounding variable that affects both $Z$ and $Y$ ; see Figure 1. Conceptually, $Z$ are the factors of variation where the association with $Y$ can vary across domains. The confounder $U$ is the reason the association can vary. The relationship between $Y$ and $Z$ induced by $U$ needs not be stable across domains. Slightly abusing notation, we have that $Z_{i}, U_{i}, X_{i}, Y_{i} \stackrel{\mathrm{iid}}{\sim} P^{e}$ in each domain $e$ . We can now describe the set of domain shifts we consider. + +Definition 1. (Compatible Anti-Causal Shift Domains) Distributions $\{P^e\}$ (over $X, Y$ ) are compatible anti-causal shift domains if the following conditions hold. First, there are unobserved variables $Z, U$ such that causal graph in Figure II holds in all domains. Second, there is a fixed distribution $P$ and for each $e$ there is some distribution $Q^e(U)$ such that $P^e(X, Y, Z) = \int P(X, Y, Z \mid U) \mathrm{d}Q^e(U)$ . + +Informally: The causal structure is fixed in all domains (implying the conditional distribution over $X$ , $Y$ , $Z$ given $U$ is the same). We allow only the distribution of the unobserved common cause $U$ to vary. + +This notion of domain shift respects the preserved-causal-structure desiderata. However, it is not obvious that it suggests any useful algorithms for learning robust predictors. This is the subject of the remainder of the paper. + +# 2.1 Invariant Prediction + +Intuitively, a predictor will be robust against domain shifts if it depends only on causes of $X$ that have a stable relationship with $Y$ in all domains. In our setup, these are the factors of variation that are not included in $Z$ . Accordingly, we want a predictor that depends only on the parts of $X$ that are not causally influenced by $Z$ . + +To formalize this notion, we'll use the concept of counterfactual invariance to $Z$ [Vei+21]. A function $f$ is counterfactually invariant to $Z$ if $f(X(z)) = f(X(z'))$ for all $z, z'$ , where $X(z)$ denotes the counterfactual $X$ we would see had $Z$ been $z$ . Learning a predictor that does not depend on the factors of variation $Z$ that induce unstable relationships means learning a predictor that is counterfactually invariant to $Z$ . + +Part of our goal in the following will be to learn a counterfactually invariant predictor. This causal notion of invariance is closely related to the notion of invariance that requires a predictor to be the risk minimizer in all domains [PBM16; Arj+19]. Specifically, under the anti-causal structure, if prior distributions $P^{e}(Y)$ are the same in all domains, then Veitch et al. [Vei+21, Thm. 4.2] shows that if $f$ is the counterfactually invariant predictor with the lowest risk in any training domain, it is also the counterfactually invariant predictor with the lowest risk in all domains. Even when $P^{e}(Y)$ is not constant across domains—there's a prior shift—imposing counterfactual invariance should still improve out-of-domain performance since it removes the domain-varying part of the features $X$ . This is supported by experiments in Appendix B.2. Throughout the paper, we use the term "invariant" in the sense of counterfactual invariance. + +# 2.2 Causal Decomposition of $X$ + +To go further in our formalization, we'll need another idea from Veitch et al. [Vei+21]: the decomposition of $X$ into (latent) parts defined by their causal relationship with $Z$ . We define $X_{z}^{\perp}$ to be the part of $X$ that is not causally affected by $Z$ . More precisely, $X_{z}^{\perp}$ is the part of $X$ such that any function of $X$ is counterfactually invariant if and only if it is a function of $X_{z}^{\perp}$ alone (that is, $f(X)$ is $X_{z}^{\perp}$ measurable). Under weak conditions on $Z$ , $X_{z}^{\perp}$ is well defined (e.g., discrete $Z$ suffices) [Vei+21]. + +We also introduce $X_{z}$ to denote the part of $X$ that is not invariant to $Z$ . We make the extra assumption that $X_{z}^{\perp}$ does not have a causal effect on $X_{z}$ (the other direction is ruled out by the definition of $X_{z}^{\perp}$ ). The meaning of this assumption is that the $Z$ -specific parts of $X$ can be disentangled in the sense that it's possible to vary the other parts of $X$ without affecting $X_{z}$ . For example, we can change the object of the image without changing the background. This is a non-trivial assumption about the structure of the anti-causal shift domains, baked into the causal compatibility assumption by the absence of an arrow between $X_{z}$ and $X_{z}^{\perp}$ . + +# 2.3 Rapid Adaptation + +Even if $P(Y)$ is held fixed, the optimal counterfactually invariant predictor $g(X)$ is unlikely to be the best predictor in any given domain. The reason is that it excludes $Z$ -dependent information that may in fact be highly predictive in a given domain. Given a new domain $e$ , we would like to be able to quickly learn a new predictor $f^{e}(X)$ that updates the invariant predictor with domain-specific associations. This update should only depend on $X_{z}$ because the relation between $X_{z}^{\perp}$ and $Y$ is stable. Accordingly, we want to learn a representation $h(X)$ that encapsulates the information in + +$X_{z}$ . Moreover, this should be done in a manner such that, given $g(X)$ and $h(X)$ , we can learn a good predictor for $P^{e}$ with only a small number of samples. + +To formalize this, we'll introduce the following domain-specific predictors: + +$$ +f ^ {e} (X) = g (X) + M ^ {e} h (X) \tag {2.1} +$$ + +Here $f^{e}(X)$ is logits. In words: $f^{e}$ adds a correction to the invariant predictor $g$ that is logit-linear in the learned representation $h(X)$ . We take the correction to be a linear map because, once $h$ is known, linear maps are very sample efficient to learn. Accordingly, we can formalize "learn $h$ such that we can rapidly adapt in new domains" as "learn $h$ such that the domain-specific predictor with optimal $M^{e}$ has low risk under $P^{e}$ ". Then, our second goal is to learn such a representation $h$ . + +# 2.4 Learning Goals + +We have now given a causal formalization of the domain transfer scenario we consider, and formalizations of the problems of learning invariant and rapidly adapting predictors. With the causal notation in hand, our goal can be plainly stated. We want to learn an invariant $g(X)$ and a domain-varying $h(X)$ with the following properties. + +1. $g(X)$ depends only on $X_{z}^{\perp}$ . +2. $g(X)$ has low risk in each training domain. +3. $h(X)$ depends only on $X_{z}$ . +4. $f^{e}(X) = g(X) + M^{e}h(X)$ should have low risk in each training domain, where $M^{e}$ is the linear map that minimizes the domain-specific risk. + +The challenge now is that we do not observe $Z$ (or $U$ ) for any data point and we do not know the decomposition of $X$ into $X_{z}^{\perp}$ and $X_{z}$ . As we will see in the next section, we can find a relaxation that is enforced with observed data which relies on the particular anti-causal structure. + +# 3 Observable Signature + +The first problem we must confront is how to learn a function $g(X)$ that depends on $X_{z}^{\perp}$ alone, and $h(X)$ that depends on $X_{z}$ alone. Strictly speaking, learning such functions precisely would be impossible, even if we observed $Z[\mathrm{Vei} + 21]$ . The reason is that we have access to only observational data, but the two parts of $X$ are defined in terms of the underlying causal structure. Instead, the best we can hope for is to require that $g(X)$ and $h(X)$ satisfy the observable implications of the causal structure. That is, the properties of the causal assumption that can actually be measured using the observed data. + +When $Z$ is observed, a signature for $g(X)$ is that $g(X)$ is conditionally independent of $Z$ given $Y$ [Vei+21]. But when $Z$ is unobserved, it is challenging to learn $g(X)$ and $h(X)$ , as these representations of $X$ are intimately tied to $Z$ . + +The key observation is that there are two relations that connect $g(X)$ and $h(X)$ . The first relation comes from the causal graph. In particular, we want to impose the requirement that $g(X)$ and $h(X)$ satisfy the observable implications of the causal structure. The next theorem gives such an observable implication, which can serve as an observable signature of the causal decomposition. + +Theorem 2. If $g(X)$ depends only on $X_{z}^{\perp}$ and $h(X)$ depends only on $X_{z}$ , then, under the causal graph in Figure $\boxed{7}$ $g(X) \perp h(X) \mid Y$ . + +The usefulness of this theorem is that the conditional independence statement can be measured from data, and enforced in the model training. + +The second relation is subtler and it comes from our formulation of domain-specific predictors $f^e$ . Specifically, $f^e$ , as a linear combination of $g$ and $h$ , should minimize the risk in every domain. And by only allowing coefficients of $h$ to change, we hope $g$ would capture "invariant" information $(X_z^\perp)$ and $h$ would learn "unstable" information $(X_z)$ . + +Therefore, to try to enforce conditions 1 and 3 in Section 2.4 we can learn $g$ and $h$ jointly to minimize domain-specific risk, while enforcing that $g(\bar{X})$ and $h(X)$ satisfy the conditional independence + +implied by the causal structure. Since the observable signature is only necessary (not sufficient) for the causal decomposition and there could be multiple candidates of $g$ and $h$ pairs that can parameterize $f^e$ in the aforementioned way, it's not guaranteed to recover $g$ and $h$ that only rely on $X_z^\perp$ and $X_z$ respectively. However, it does strongly constrain the functions we can learn. And, as we will see in Section 6, enforcing the signature does lead to predictors with good robustness and fast adaptation properties. + +# 3.1 Causal Regularization + +We enforce $g(X)$ and $h(X)$ to satisfy the conditional independence condition via regularization. Specifically, we want to define a regularizer such that its value goes to zero whenever the conditional independence requirement is met. In general, measuring conditional independence is hard [Zha+12; Fuk+07; TSS16]. Instead, we enforce a weaker condition that uses the following fact. + +Lemma 3. If $A \perp B \mid D$ , then, $\mathbb{E}[A \cdot (B - \mathbb{E}[B|D])] = 0$ + +This is a necessary but not sufficient condition for conditional independence. However, it is easy to compute and leads to good results in practice (as shown in Section 6). With this identity in hand, we define $C_{\mathrm{cond}}(A,B,D)$ , the (infinite data) conditional independent regularization term between random variables $A,B$ given random variable $D$ , and its empirical estimate $\hat{C}_{\mathrm{cond}}$ as follows: + +$$ +C _ {\text {c o n d}} (A, B, D) = \mathbb {E} [ A \cdot (B - \mathbb {E} [ B | D ]) ] +$$ + +$$ +\hat {C} _ {\mathrm {c o n d}} (\{(a _ {i}, b _ {i}, d _ {i}) \} _ {i = 1} ^ {n}) = \left| \left| \frac {1}{n} \sum_ {i} a _ {i} \left(b _ {i} - \frac {1}{| \# j : d _ {j} = d _ {i} |} \sum_ {j: d _ {j} = d _ {i}} b _ {i}\right) \right| \right| _ {1} +$$ + +where $\{a_i\}_{i=1}^n$ , $\{b_i\}_{i=1}^n$ , $\{d_i\}_{i=1}^n$ are samples of $A, B$ and $D$ . Here, the conditional random variable $D$ is assumed to be discrete which is true for the use case in this paper. + +# 4 Learning Algorithm + +We have reduced our goal to learning $g$ and $h$ such that + +1. For training domains, $g(X)$ has low risk. +2. For a given domain $e$ , there exists $M^e$ such that $f^e(X) = g(X) + M^e h(X)$ is the risk minimizer of that domain. +3. $g(X), h(X)$ are constrained by the conditional independence regularization. + +We now design a specific algorithm that accomplishes the learning task. First, we parameterize the learning problem in a form that's convenient to use with neural networks. Then, we translate our learning objectives into a bi-level optimization problem. Finally, we introduce a practical algorithm to solve the bi-level optimization problem. We name our method ACTIR for Anti-Causal Transportable and Invariant Representation. + +# 4.1 Reparameterization + +In principle, we could learn two completely separate functions $g(X)$ and $h(X)$ . However, this can be wasteful. For instance, in vision, many low-level features can be reused by different predictors. To address this, we first notice that we can always rewrite (2.1) as follows + +$$ +f ^ {e} (X) = \left(W ^ {b} + W ^ {e}\right) \Phi (X). \tag {4.1} +$$ + +That is, as a shared representation $\Phi$ followed by a fixed linear map $W^{b}$ defining $g$ and a domain-specific linear map $W^{e}$ defining $M^{e}h(X)$ . The task is then learning the representation (which we'll parameterize by a neural network), and the invariant and domain-specific linear maps. + +In fact, a further simplification is possible: we can fix $W^b$ to be $\begin{bmatrix} \mathbf{I} & \mathbf{0} \\ \mathbf{0} & \mathbf{0} \end{bmatrix}$ . The reason is that, because $\Phi$ is unconstrained, learning $W^b$ doesn't actually add expressive power—any non-zero map suffices. + +# 4.2 Bi-Level Optimization + +We have now reduced our task to a bi-level optimization problem + +$$ +\begin{array}{l} \left| \min _ {\Phi} \sum_ {e \in \mathcal {E} _ {t r}} \gamma R ^ {e} \left(\left(W ^ {b} + W ^ {e}\right) \Phi\right) + (1 - \gamma) R ^ {e} \left(W ^ {b} \Phi\right) \right. \tag {4.2} \\ \operatorname {s t} W ^ {e} \in \underset {W} {\operatorname * {a r g m i n}} R ^ {e} ((W ^ {b} + W) \Phi) + \lambda C _ {\mathrm {c o n d}} (W ^ {b} \Phi , W \Phi , Y) \forall e \in \mathcal {E} _ {t r} \\ \end{array} +$$ + +where $\gamma \in [0,1]$ , $\lambda > 0$ . The set $\mathcal{E}_{tr}$ consists of all training domains, and $R^{e}(f)$ is the domain-specific population risk defined as $R^{e}(f) = \mathbb{E}_{(\mathbf{x},\mathbf{y})\sim P^{e}}[\ell (f(\mathbf{x}),\mathbf{y})]$ with the cross-entropy loss function $\ell$ . + +In words: we try to learn a representation $\Phi$ such that the invariant predictor has low risk (second term), the domain-specific predictor has low risk in each domain (first term), and the domain-specific perturbation $W^{e}$ is optimal given $W^{b}$ and $\Phi$ while satisfying the observable signature of the causal condition (constraint, with the $C_{\mathrm{cond}}$ regularization). + +# 4.3 Practical Algorithm + +(4.2) is a challenging optimization problem. In general, each constraint calls for an inner optimization routine. So instead of solving (4.2) directly, we use a gradient penalty to make the problem more tractable. Specifically, we translate the condition that the domain-specific risk is optimal (the inner loop) into the condition that the gradient of the domain-specific risk with respect to $W^{e}$ is 0. Then, we regularize the $\ell_{2}$ -norm of this gradient. This is inspired by a similar trick used in Invariant Risk Minimization [Arj+19]. The finite sample objective function can be expressed as: + +$$ +\begin{array}{l} L (W ^ {b}, W ^ {e}, \Phi) = \\ \sum_ {e \in \mathcal {E} _ {t r}} \left[ \sum_ {(x, y) \in D ^ {e}} \gamma \ell \big ((W ^ {b} + W ^ {e}) \Phi (x), y \big) + (1 - \gamma) \ell \big (W ^ {b} \Phi (x), y \big) \right] + \lambda_ {g} \sum_ {e \in \mathcal {E} _ {t r}} \| \nabla L _ {\mathrm {i n n e r}} ^ {e} (W ^ {e}) \| ^ {2} \\ \end{array} +$$ + +where $\lambda_g > 0$ is a regularization coefficient for the gradient penalty, $D^e$ is a labeled dataset collected from training domain $P^e$ and $L_{\mathrm{inner}}^e$ is given by + +$$ +L _ {\mathrm {i n n e r}} ^ {e} (W) = \sum_ {(x, y) \in D ^ {e}} \ell \Bigg ((W ^ {b} + W) \Phi (x), y \Bigg) + \lambda \hat {C} _ {\mathrm {c o n d}} \left(\left\{(W ^ {b}) \Phi (x), W \Phi (x), y \right\} _ {(x, y) \in D ^ {e}}\right) +$$ + +# 4.4 Invariant and Adaptive Prediction + +After training, suppose the returned representation is $\hat{\Phi}$ . Then the invariant predictor is + +$$ +g (X) = W ^ {b} \hat {\Phi} (X) +$$ + +Moreover, given a few labeled examples from a new domain, we can find a domain-specific predictor by fine-tuning the linear layer $W^{b}$ . + +# 5 Related Work + +Causal Prediction Several papers connect causality and robustness to domain shifts. [e.g., PBM16; HDPM18; Arj+19; Lu+21]. These papers usually assume that all domains share a common causal structure, and consider the set of domains induced by arbitrary intervention on any node other than the label $Y$ . In this case, the predictor that has invariant risk across domains is the one that depends only on the causal parents of $Y$ . By contrast, in this paper, we only allow changes of unobserved confounders—resulting in a much smaller set of possible shifts. Restricting the possible shifts enlarged the set of possible invariant predictors, allowing for invariant predictors that depend on the descendants of $Y$ . + +A closely related work is Invariant Risk Minimization [Arj+19], that also seeks to learn a representation $\Phi$ of $X$ such that a fixed linear map on top of the representation yields an invariant predictor. The major distinction with the approach here is that we have a different notion of invariance (see + +Section 2.1), and we rely on simultaneously learning the non-stable factors of variation in order to identify the representation. + +Other papers also consider settings where the covariates $X$ are not direct causes of $Y$ [Liu+21; Mit+21; [Is+20]. They assume that both $X$ and $Y$ are caused by latent variables that can be divided into stable and non-stable parts. Then, they use generative models reflecting this assumption. By contrast, the approach in this paper is fully nonparametric—there is no explicit modeling of the generative process. Prediction in the anti-causal direction has also been studied in other contexts [Sch+12; Li+18; Wal+21; KPS18; Gon+16; HM21]. In particular, Schölkopf et al. [Sch+12] study the role of anti-causal learning in semi-supervised learning and transfer learning. + +This work fits into the emerging literature on causal representation learning [e.g., Bes+18; Loc+20; Sch+21; WJ21]. This literature seeks to find representations that disentangle causally meaningful components of the data—here, we disentangle the factors of variation that have domain-stable or domain-varying relationships with the target $Y$ . + +Veitch et al. [Vei+21] introduce the notion of counterfactual invariance to a spurious factor and make some connections with domain shifts. However, they assume $Z$ is known in advance and observed, and rely on this to learn the counterfactually-invariant predictor. In contrast, in this paper we merely assume the existence of some $Z$ -we don't need to know it in advance, and we don't need to measure it directly. And, they use data from only a single domain, whereas we require observations from several distinct domains. We also treat the problem of learning transportable representations, but they only handle invariant learning. + +Domain Adaptation and Meta Learning There have been numerous fruitful developments in the fields of domain generalization and adaptation [e.g., Zho+21; Wan+21], including ones under various causal assumptions [Zha+13; Mag+18; CB21; SSS19; Sch+12; Lv+22]. A distinctive aspect of the work in this paper is that we consider the interplay between both the problem of invariant/robust learning and adaptation. + +The adaptive part of the learning model in this paper is also related to meta learning, where the goal is to learn predictors that can quickly adapt to new tasks. Meta learning has been used for supervised learning [San+16], reinforcement learning [Wan+16] and even unsupervised learning [JV19]. Traditional approaches to meta learning include defining a distribution over the structure of input data to perform inference [Lak+11] or to use a memory model such as LSTM [Wan+18]. But the dominant models for meta learning are generic gradient-based learning methods such as MAML [FAL17] and Reptile [NAS18]. Theoretically, Tripuraneni et al. [TJJ21] and Du et al. [Du+20] also examine the representation power of meta-learning. Although not motivated by causality, they show that if there is a shared common structure, meta learning can be used to reduce sample complexity in unseen domains. + +# 6 Experiments + +The main claims of the paper are: + +1. The invariant predictor $g(X)$ will have good performance in new domains, so long as the shifts obey the anti-causal structure. +2. The learned representation $\Phi$ enables rapid adaptation to new domains by learning only a linear adjustment term on top of $\Phi$ . +3. The learned $\Phi$ disentangles the parts of $X$ that are not affected by $Z$ from the parts that are. + +To evaluate the above claims, we conduct experiments on synthetic and real-world data. While causal structures of real-world problems like image classification are usually unknown, we find that the anti-causal based method works well on many such problems—suggesting the anti-causal structure is appropriate. For space reasons, in addition to the experiments reported in this section, we also report experiments on PACS [Li+17] and VLCS [FXR13] in Appendix B. These experiments also strongly support the effectiveness of the causal adaptive model. We also provide a counterexample showing that ACTIR can fail when causal assumptions fail to hold in Appendix B.3 + +Baselines For each experiment, all methods share a common architecture; they differ only in objective functions or optimization procedures. For invariant learning, we compare with empirical risk minimization (ERM), IRM [Arj+19] and the MAML [FAL17] base learner. To test how well learned + +![](images/fb12bc8a52c8b6fe44c4f9bf3594689790d225f7148f217d7ed45b9f6979a956.jpg) +(a) Synthetic Dataset + +![](images/9e5ff9764fdb6b66e400ba6e17eca05f3cb61231acdd752c101f0dbb4d2b1caf.jpg) +(b) Color MNIST +Figure 2: The learned representation $\Phi$ disentangles stable and unstable factors of variation. Plots show activation levels of different representation units. Units 0 and 1 are trained as the invariant part of the representation. The invariant units have no dependency on the unstable factor $Z$ , but the other unit has a strong dependency. For synthetic dataset, $Z$ is the random variable defined in the structural equations. For Color MNIST, $Z$ is the color. + +representations $\Phi$ can enable fast adaptation, we fine-tune linear models on top of the representation. For comparison, we also fine-tune linear layers on top of the representations (penultimate layers) from ERM, IRM, and MAML. It has been shown recently that fine-tuning the last layer of models trained by ERM has surprisingly good performance on many real-world datasets [RRR22]. For MAML, the last layer is trained using the MAML update rule. + +# 6.1 Synthetic Dataset + +We generate synthetic data according to the following structural equations (which obey the anti-causal structure): + +$$ +Y \leftarrow \operatorname {R a d} (0. 5) \quad X _ {z} ^ {\perp} \leftarrow Y \cdot \operatorname {R a d} (0. 7 5) \quad Z \leftarrow Y \cdot \operatorname {R a d} (\beta_ {e}) \quad X _ {z} \leftarrow Z +$$ + +where input $X$ is $(X_{z}, X_{z}^{\perp})$ and $\operatorname{Rad}(\beta)$ means that a random variable is $-1$ with probability $1 - \beta$ and $+1$ with probability $\beta$ . We create two training domains with $\beta_{e} \in \{0.95, 0.7\}$ , one validation domain with $\beta_{e} = 0.6$ and one test domain with $\beta_{e} = 0.1$ . Prediction with $X_{z}^{\perp}$ is stable but has a lower accuracy compared to prediction with $X_{z}$ during training. If a learning model only chooses the classifier with the best prediction accuracy in training domains and ignores its instability, it will choose $X_{z}$ as its predictor and end up with only $10\%$ accuracy on the test set. The robust predictor would be $X_{z}^{\perp}$ with $75\%$ accuracy. On the other hand, in the test domain, $-X_{z}$ predicts $Y$ with $90\%$ accuracy—so an adaptive predictor is better than the invariant one. + +We use a three-layer neural network with hidden size 8 and ReLU activation for $\Phi$ and train the neural network with Adam optimizer. The hyperparameters are chosen based on performance on the validation set. For the fine-tuning test, we run 20 steps with a learning rate $10^{-2}$ . The result is shown in Table 1. Both IRM and ACTIR learn good invariant predictors. But ACTIR is also equipped with the ability to adapt given a very small amount of data points while the performance of IRM stays the same after fine-tuning. Perhaps unsurprisingly, ERM has a test accuracy of $10\%$ , suggesting that it uses only spurious features $X_{z}$ . + +# 6.2 Color MNIST + +Color MNIST modifies the original MNIST dataset [Arj+19]. First, we assign label 0 to digits 0-4 and label 1 to digits 5-9. We then flip the label with probability $25\%$ and assign colors to the original images based on the label but with a flip rate $1 - \beta^{e}$ . That is, we assign color 0 to images with label 0 with probability $\beta^{e}$ . Here, color is naturally the factor of variation $Z$ . We create two training domains with $\beta^{e} \in \{0.95, 0.7\}$ , a validation domain with $\beta^{e} = 0.2$ and a test domain with $\beta^{e} = 0.1$ . Ideally, we want to learn invariant predictors based on the shape of the digit—this will achieve $75\%$ accuracy. But the problem is significantly more challenging than the synthetic example because the color is a much easier feature to learn than the shape of the digit, making models more susceptible to spurious correlations. We use a three-layer convolutional neural network for $\Phi$ and train the neural network with Adam optimizer. The hyperparameters are chosen based on performance on the validation set. + +![](images/420b9fea6525a3feb7451bbd3e500ec377e18f30c2f12365e71fef6ba1afc7f6.jpg) +Figure 3: ACTIR has good accuracy after fine-tuning with small datasets on Camelyon17. Graph shows accuracy $(\%)$ on Camelyon17 for different numbers of fine-tuning examples. Standard errors are over 5 runs. For each run, the accuracy is averaged for 100 fine-tuning tests. + +Table 1: ACTIR has good invariant and adaptive performance on synthetic datasets and Color MNIST, and it outperforms baseline methods on Camelyon17 for invariant prediction. The table shows accuracy $(\%)$ . Note that adaptation $(n)$ means that the predictor is tuned on $n$ number of labeled examples. For synthetic datasets, standard errors are over 100 runs. For Color MNIST, it is over 50 runs. For Camelyon17, it is over 5 runs. In each run, the adaptive accuracy is determined by the average of 100 fine-tuning tests for both synthetic datasets and Color MNIST. + +
METHODSYNTHETIC DATASETCOLOR MNISTCAMELYON17
TEST ACC.ADAPTATION (10)TEST ACC.ADAPTATION (10)TEST ACC.
ERM9.95±0.1011.57±0.7128.24±0.5127.26±0.4870.77±1.98
IRM74.91±0.1374.27±0.4759.97±0.9160.16±0.9071.59±2.76
MAML17.14±2.2244.01±3.4822.18±1.0175.03±3.3070.22±2.40
ACTIR74.77±0.4489.28±0.2570.30±0.7185.25±1.1177.73±1.74
+ +For the fine-tuning test, we run 20 steps with a learning rate $10^{-2}$ . The result is shown in Table 1. ACTIR learns both the invariant and adaptive structure significantly better than reference baselines. + +Causal Disentanglement To understand why ACTIR can adapt to test domains in both synthetic and Color MNIST datasets, we plot distributions of activation values of $\Phi$ . See Figure 2. We see that the first two coordinates—used as the invariant part of the representation in training (see Section 4.3)—have distributions that do not depend on the value of $Z$ . On the other hand, some other (non-invariant) representation coordinates have activations that change dramatically depending on the value of $Z$ . Thus, the representation effectively disentangles the $X_{z}^{\perp}$ and $X_{z}$ features. Importantly, this is achieved with no a priori knowledge of what $Z$ might be, and no observations of it. + +# 6.3 Camelyon17 + +The goal of the Camelyon17 dataset [Ban+18] is to predict the existence of a tumor given a region of tissue. This is a binary classification problem. Data are collected from a small number of hospitals. But there are variations in data collection and processing that could negatively impact model performance on data from a new hospital. We take the individual hospitals to be separate domains. The objective is to generalize to new hospitals not seen in training. The dataset consists of input images with size $96 \times 96$ and binary labels that indicate if the central $32 \times 32$ regions contain any tumor tissues. The dataset can be divided into 5 subsets, each from a different hospital. Following the WILDS benchmark [Koh+21], we use 3 for training, 1 for validation, and the last one for test. + +We use a pre-trained ResNet-18 model for our $\Phi$ and train the whole model using Adam optimizer with a learning rate $10^{-4}$ . For the fine-tuning test, we run 20 iterations with a learning rate $10^{-2}$ . As shown in Table 1, ACTIR has the best invariant accuracy. For adaptive performance, Figure 3 shows that ACTIR has a large performance improvement when given a small fine-tuning dataset, while other models require more fine-tuning examples to see a significant increase in accuracy. + +# 7 Discussion + +This paper studies learning invariant and transportable representations for a specific class of anti-causal shift domains. We assume that all domains have a common anti-causal structure and are differentiated only by the distribution of certain unobserved confounders. This setup is a reasonable match for many practical problems. + +This work serves as a proof of concept for this anti-causal domain shift notion, showing that it can be translated into useful learning principles for domain adaptation. This opens the door for substantial future work. In particular, the practical training procedure we use can likely be refined. It would also be nice to find formal guarantees for robust models trained under this setup—e.g., relying on some notion of diversity of training domains. + +# 8 Acknowledgments + +Thanks to Jacob Eisenstein for feedback on an earlier version. We also acknowledge the University of Chicago's Research Computing Center for providing computing resources. This work was partially supported by Open Philanthropy. + +# References + +[Arj+19] M. Arjovsky, L. Bottou, I. Gulrajani, and D. Lopez-Paz. "Invariant risk minimization". In: arXiv preprint arXiv:1907.02893 (2019). +[Bai+20] H. Bai, R. Sun, L. Hong, F. Zhou, N. Ye, H.-J. Ye, S.-H. G. Chan, and Z. Li. “Decaug: out-of-distribution generalization via decomposed feature representation and semantic augmentation”. In: arXiv preprint arXiv:2012.09382 (2020). +[Ban+18] P. Bandi, O. Geessink, Q. Manson, M. Van Dijk, M. Balkenhol, M. Hermsen, B. E. Bejnordi, B. Lee, K. Paeng, A. Zhong, et al. "From detection of individual metastases to classification of lymph node status at the patient level: the camelyon17 challenge". In: IEEE Transactions on Medical Imaging (2018). +[Bes+18] M. Besserve, A. Mehrjou, R. Sun, and B. Schölkopf. "Counterfactuals uncover the modular structure of deep generative models". In: arXiv preprint arXiv:1812.03253 (2018). +[Cai+21] T. Cai, R. Gao, J. D. Lee, and Q. Lei. "A theory of label propagation for subpopulation shift". In: arXiv preprint arXiv:2102.11203 (2021). +[CB21] Y. Chen and P. Buhlmann. "Domain adaptation under structural causal models". In: Journal of Machine Learning Research 261 (2021). +[Du+20] S. S. Du, W. Hu, S. M. Kakade, J. D. Lee, and Q. Lei. “Few-shot learning via learning the representation, provably”. In: arXiv preprint arXiv:2002.09434 (2020). +[FXR13] C. Fang, Y. Xu, and D. N. Rockmore. "Unbiased metric learning: on the utilization of multiple datasets and web images for softening bias". In: IEEE International Conference on Computer Vision, ICCV 2013, Sydney, Australia, December 1-8, 2013. 2013. +[FAL17] C. Finn, P. Abbeel, and S. Levine. "Model-agnostic meta-learning for fast adaptation of deep networks". In: International Conference on Machine Learning. PMLR. 2017. +[Fuk+07] K. Fukumizu, A. Gretton, X. Sun, and B. Schölkopf. "Kernel measures of conditional dependence." In: NIPS. 2007. +[Gon+16] M. Gong, K. Zhang, T. Liu, D. Tao, C. Glymour, and B. Scholkopf. "Domain adaptation with conditional transferable components". In: International conference on machine learning. PMLR. 2016. +[GL21] I. Gulrajani and D. Lopez-Paz. "In search of lost domain generalization". In: 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. 2021. +[HM21] C. Heinze-Deml and N. Meinshausen. "Conditional variance penalties and domain shift robustness". In: Mach. Learn. 2 (2021). +[HDPM18] C. Heinze-Deml, J. Peters, and N. Meinshausen. "Invariant causal prediction for nonlinear models". In: Journal of Causal Inference 2 (2018). + +[Ils+20] M. Ilse, J. M. Tomczak, C. Louizos, and M. Welling. “Diva: domain invariant variational autoencoders”. In: Medical Imaging with Deep Learning. PMLR. 2020. +[YJV19] Y. Jiang and N. Verma. “Meta-learning to cluster”. In: arXiv preprint arXiv:1910.14134 (2019). +[KPS18] N. Kilbertus, G. Parascandolo, and B. Scholkopf. "Generalization in anti-causal learning". In: arXiv preprint arXiv:1812.00524 (2018). +[Koh+21] P. W. Koh, S. Sagawa, H. Marklund, S. M. Xie, M. Zhang, A. Balsubramani, W. Hu, M. Yasunaga, R. L. Phillips, I. Gao, et al. "Wilds: a benchmark of in-the-wild distribution shifts". In: International Conference on Machine Learning. PMLR. 2021. +[Lak+11] B. Lake, R. Salakhutdinov, J. Gross, and J. Tenenbaum. "One shot learning of simple visual concepts". In: Proceedings of the annual meeting of the cognitive science society. 33. 2011. +[Li+17] D. Li, Y. Yang, Y.-Z. Song, and T. M. Hospedales. "Deeper, broader and artier domain generalization". In: Proceedings of the IEEE international conference on computer vision. 2017. +[Li+18] Y. Li, X. Tian, M. Gong, Y. Liu, T. Liu, K. Zhang, and D. Tao. "Deep domain generalization via conditional invariant adversarial networks". In: Proceedings of the European Conference on Computer Vision (ECCV). 2018. +[Liu+21] C. Liu, X. Sun, J. Wang, H. Tang, T. Li, T. Qin, W. Chen, and T.-Y. Liu. "Learning causal semantic representation for out-of-distribution prediction". In: Advances in Neural Information Processing Systems (2021). +[Loc+20] F. Locatello, B. Poole, G. Ratsch, B. Scholkopf, O. Bachem, and M. Tschannen. "Weakly-supervised disentanglement without compromises". In: International Conference on Machine Learning. PMLR. 2020. +[Lu+21] C. Lu, Y. Wu, J. M. Hernández-Lobato, and B. Schölkopf. "Nonlinear invariant risk minimization: a causal approach". In: arXiv preprint arXiv:2102.12353 (2021). +[Lv+22] F. Lv, J. Liang, S. Li, B. Zang, C. H. Liu, Z. Wang, and D. Liu. "Causality inspired representation learning for domain generalization". In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. 2022. +[Mag+18] S. Magliacane, T. Van Ommen, T. Claassen, S. Bongers, P. Versteeg, and J. M. Mooij. "Domain adaptation by using causal inference to predict invariant conditional distributions". In: Advances in neural information processing systems (2018). +[Mit+21] J. Mitrovic, B. McWilliams, J. C. Walker, L. H. Buesing, and C. Blundell. "Representation learning via invariant causal mechanisms". In: 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. 2021. +[MBS13] K. Muandet, D. Balduzzi, and B. Scholkopf. "Domain generalization via invariant feature representation". In: Proceedings of the 30th International Conference on Machine Learning, ICML 2013, Atlanta, GA, USA, 16-21 June 2013. 2013. +[NAS18] A. Nichol, J. Achiam, and J. Schulman. "On first-order meta-learning algorithms". In: arXiv preprint arXiv:1803.02999 (2018). +[PBM16] J. Peters, P. Buhlmann, and N. Meinshausen. "Causal inference by using invariant prediction: identification and confidence intervals". In: Journal of the Royal Statistical Society. Series B (Statistical Methodology) (2016). +[PJS17] J. Peters, D. Janzing, and B. Schölkopf. Elements of causal inference: foundations and learning algorithms. 2017. +[Roj+18] M. Rojas-Carulla, B. Schölkopf, R. E. Turner, and J. Peters. "Invariant models for causal transfer learning". In: J. Mach. Learn. Res. (2018). +[RRR22] E. Rosenfeld, P. Ravikumar, and A. Risteski. Domain-Adjusted Regression or: ERM May Already Learn Features Sufficient for Out-of-Distribution Generalization. 2022. +[Rot+21] D. Rothenhausler, N. Meinshausen, P. Buhlmann, and J. Peters. "Anchor regression: heterogeneous data meet causality". In: Journal of the Royal Statistical Society: Series B (Statistical Methodology) 2 (2021). +[Sag+19] S. Sagawa, P. W. Koh, T. B. Hashimoto, and P. Liang. "Distributionally robust neural networks for group shifts: on the importance of regularization for worst-case generalization". In: arXiv preprint arXiv:1911.08731 (2019). + +[San+16] A. Santoro, S. Bartunov, M. Botvinick, D. Wierstra, and T. Lillicrap. “Meta-learning with memory-augmented neural networks”. In: International conference on machine learning. PMLR. 2016. +[Sch+12] B. Schölkopf, D. Janzing, J. Peters, E. Sgouritsa, K. Zhang, and J. M. Mooij. “On causal and anticausal learning”. In: ICML. 2012. +[Sch+21] B. Schölkopf, F. Locatello, S. Bauer, N. R. Ke, N. Kalchbrenner, A. Goyal, and Y. Bengio. "Towards causal representation learning". In: CoRR (2021). +[Shi+21] Y. Shi, J. Seely, P. H. Torr, N Siddharth, A. Hannun, N. Usunier, and G. Synnaeve. "Gradient matching for domain generalization". In: arXiv preprint arXiv:2104.09937 (2021). +[SSS19] A. Subbaswamy, P. Schulam, and S. Saria. “Preventing failures due to dataset shift: learning predictive models that transport”. In: The 22nd International Conference on Artificial Intelligence and Statistics. PMLR. 2019. +[TSS16] I. O. Tolstikhin, B. K. Sriperumbudur, and B. Schölkopf. “Minimax estimation of maximum mean discrepancy with radial kernels”. In: Advances in Neural Information Processing Systems (2016). +[TJJ21] N. Tripuraneni, C. Jin, and M. Jordan. "Provable meta-learning of linear representations". In: International Conference on Machine Learning. PMLR. 2021. +[Vei+21] V. Veitch, A. D'Amour, S. Yadlowsky, and J. Eisenstein. "Counterfactual invariance to spurious correlations: why and how to pass stress tests". In: arXiv preprint arXiv:2106.00545 (2021). +[Wal+21] Y. Wald, A. Feder, D. Greenfeld, and U. Shalit. "On calibration and out-of-domain generalization". In: Advances in neural information processing systems (2021). +[Wan+18] J. X. Wang, Z. Kurth-Nelson, D. Kumaran, D. Tirumala, H. Soyer, J. Z. Leibo, D. Hassabis, and M. Botvinick. “Prefrontal cortex as a meta-reinforcement learning system”. In: Nature neuroscience 6 (2018). +[Wan+16] J. X. Wang, Z. Kurth-Nelson, D. Tirumala, H. Soyer, J. Z. Leibo, R. Munos, C. Blundell, D. Kumaran, and M. Botvinick. "Learning to reinforcement learn". In: arXiv preprint arXiv:1611.05763 (2016). +[Wan+21] J. Wang, C. Lan, C. Liu, Y. Ouyang, and T. Qin. "Generalizing to unseen domains: A survey on domain generalization". In: Proceedings of the Thirtieth International Joint Conference on Artificial Intelligence, IJCAI 2021, Virtual Event / Montreal, Canada, 19-27 August 2021. 2021. +[WJ21] Y. Wang and M. I. Jordan. "Desiderata for representation learning: a causal perspective". In: arXiv preprint arXiv:2109.03795 (2021). +[Zha+12] K. Zhang, J. Peters, D. Janzing, and B. Schölkopf. "Kernel-based conditional independence test and application in causal discovery". In: arXiv preprint arXiv:1202.3775 (2012). +[Zha+13] K. Zhang, B. Schölkopf, K. Muandet, and Z. Wang. "Domain adaptation under target and conditional shift". In: International Conference on Machine Learning. PMLR. 2013. +[Zhe+21] X. Zheng, X. Sun, W. Chen, and T.-Y. Liu. "Causally invariant predictor with shift-robustness". In: arXiv preprint arXiv:2107.01876 (2021). +[Zho+21] K. Zhou, Z. Liu, Y. Qiao, T. Xiang, and C. C. Loy. "Domain generalization: A survey". In: CoRR (2021). +[Zhu+20] F. Zhuang, Z. Qi, K. Duan, D. Xi, Y. Zhu, H. Zhu, H. Xiong, and Q. He. “A comprehensive survey on transfer learning”. In: Proceedings of the IEEE 1 (2020). + +# Checklist + +The checklist follows the references. Please read the checklist guidelines carefully for information on how to answer these questions. For each question, change the default [TODO] to [Yes], [No], or [N/A]. You are strongly encouraged to include a justification to your answer, either by referencing the appropriate section of your paper or providing a brief inline description. For example: + +- Did you include the license to the code and datasets? [Yes] See Section ?? + +- Did you include the license to the code and datasets? [No] The code and the data are proprietary. +- Did you include the license to the code and datasets? [N/A] + +Please do not modify the questions and only use the provided macros for your answers. Note that the Checklist section does not count towards the page limit. In your paper, please delete this instructions block and only keep the Checklist section heading above along with the questions/answers below. + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] See Section 7. +(c) Did you discuss any potential negative societal impacts of your work? [N/A] +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] +(b) Did you include complete proofs of all theoretical results? [Yes] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [No] + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] +(b) Did you mention the license of the assets? [N/A] +(c) Did you include any new assets either in the supplemental material or as a URL? [N/A] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/invariantandtransportablerepresentationsforanticausaldomainshifts/images.zip b/invariantandtransportablerepresentationsforanticausaldomainshifts/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..5302935d067a742770630b9c44abc73730b7f5d2 --- /dev/null +++ b/invariantandtransportablerepresentationsforanticausaldomainshifts/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1fd057ecbed15ae784e756ab6d99ed61461bdfddbad7c1df37abad18059a6340 +size 170641 diff --git a/invariantandtransportablerepresentationsforanticausaldomainshifts/layout.json b/invariantandtransportablerepresentationsforanticausaldomainshifts/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..ad5c2a4b957b400c51c64f37e756981a82f6fc95 --- /dev/null +++ b/invariantandtransportablerepresentationsforanticausaldomainshifts/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a97c2611d52f36e1deb7208ea721a82c32364ba44b479a02cf42f2878275dfd +size 608123 diff --git a/inversedesignforfluidstructureinteractionsusinggraphnetworksimulators/7b51854d-a358-4866-b95f-23c9428fc770_content_list.json b/inversedesignforfluidstructureinteractionsusinggraphnetworksimulators/7b51854d-a358-4866-b95f-23c9428fc770_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..72f3c31cb24da3ab417c51eb451f0229ab90a649 --- /dev/null +++ b/inversedesignforfluidstructureinteractionsusinggraphnetworksimulators/7b51854d-a358-4866-b95f-23c9428fc770_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f3435aaae9bd31578b072a279e1bc22db331dca42f657b728c4c52a1717dff44 +size 93563 diff --git a/inversedesignforfluidstructureinteractionsusinggraphnetworksimulators/7b51854d-a358-4866-b95f-23c9428fc770_model.json b/inversedesignforfluidstructureinteractionsusinggraphnetworksimulators/7b51854d-a358-4866-b95f-23c9428fc770_model.json new file mode 100644 index 0000000000000000000000000000000000000000..3a5a8cc70363fd3fcf3f06f6d4c3f58615d59259 --- /dev/null +++ b/inversedesignforfluidstructureinteractionsusinggraphnetworksimulators/7b51854d-a358-4866-b95f-23c9428fc770_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:21f80dda4f2d868885d0a718badcc8df34485a596a3121b84d9c97e003fd6dbf +size 120675 diff --git a/inversedesignforfluidstructureinteractionsusinggraphnetworksimulators/7b51854d-a358-4866-b95f-23c9428fc770_origin.pdf b/inversedesignforfluidstructureinteractionsusinggraphnetworksimulators/7b51854d-a358-4866-b95f-23c9428fc770_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7bd47ce753319d4e22ee71e88bd9a9b0f2d0b1c6 --- /dev/null +++ b/inversedesignforfluidstructureinteractionsusinggraphnetworksimulators/7b51854d-a358-4866-b95f-23c9428fc770_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:038ec58ea72d319ac5e04492561ff721368a09c03f1e1afc09902cf8b944df3c +size 15111309 diff --git a/inversedesignforfluidstructureinteractionsusinggraphnetworksimulators/full.md b/inversedesignforfluidstructureinteractionsusinggraphnetworksimulators/full.md new file mode 100644 index 0000000000000000000000000000000000000000..5867a291dc9d1437fe8eca9feab20e060008939f --- /dev/null +++ b/inversedesignforfluidstructureinteractionsusinggraphnetworksimulators/full.md @@ -0,0 +1,349 @@ +# Inverse Design for Fluid-Structure Interactions using Graph Network Simulators + +Kelsey R. Allen * DeepMind, UK + +Tatiana Lopez Guevara * DeepMind, UK + +Kimberly Stachenfeld * DeepMind, UK + +Alvaro Sanchez-Gonzalez DeepMind, UK + +Peter Battaglia DeepMind, UK + +Jessica Hamrick DeepMind, UK + +Tobias Pfaff DeepMind, UK + +{krallen, zepolitat, stachenfeld, alvarosg, peterbattaglia, jhamrick, tpaff}@deepmind.com + +# Abstract + +Designing physical artifacts that serve a purpose—such as tools and other functional structures—is central to engineering as well as everyday human behavior. Though automating design using machine learning has tremendous promise, existing methods are often limited by the task-dependent distributions they were exposed to during training. Here we showcase a task-agnostic approach to inverse design, by combining general-purpose graph network simulators with gradient-based design optimization. This constitutes a simple, fast, and reusable approach that solves high-dimensional problems with complex physical dynamics, including designing surfaces and tools to manipulate fluid flows and optimizing the shape of an airfoil to minimize drag. This framework produces high-quality designs by propagating gradients through trajectories of hundreds of steps, even when using models that were pre-trained for single-step predictions on data substantially different from the design tasks. In our fluid manipulation tasks, the resulting designs outperformed those found by sampling-based optimization techniques. In airfoil design, they matched the quality of those obtained with a specialized solver. Our results suggest that despite some remaining challenges, machine learning-based simulators are maturing to the point where they can support general-purpose design optimization across a variety of fluid-structure interaction domains. + +# 1 Introduction + +Automatically designing objects to exhibit a desired property—often referred to as inverse design—has the potential to transform science and engineering, including aerodynamics [27], material design [14], optics [21], and robotics [35, 75]. Despite its promise, widespread practice of inverse design has been limited by the availability of fast, general-purpose forward models. Traditionally, many methods rely on specialized “classical” solvers, which are handcrafted to simulate a particular physical process. However, these models can sometimes be slow, may not provide gradients, or in certain domains, might even be unknown [23]. + +To mitigate these issues, machine learning is playing an increasingly important role by substituting all or part of the inverse design pipeline. "End-to-end" methods can bypass expensive simulation and data collection by learning a mapping directly from design parameters (such as the shape of an airplane wing) to a task objective (such as the observed drag) [59, 76, 19]. Learned generative + +models or policies can propose candidate design parameters for a given task [52, 17, 19, 24, 12, 47]. These types of methods can be used to solve narrowly defined tasks more efficiently than traditional methods, but come with significant limitations: they require access to a dataset of example designs and tasks for training, and often cannot generalize to tasks or designs outside this distribution [71, 77]. + +In this work, we focus on a task-agnostic approach to inverse design, by employing learned simulator models pre-trained on dynamics with no access to the task objective or design space during training, and that, once trained, can be used to solve many new design tasks. This approach, however, requires models with sufficient long-term stability and strong generalization, which commonly applied black-box model architectures such as CNNs often lack [45, 69, 72, 4]. + +A class of learned physics simulators based on graph neural networks (GNNs) [57, 63] could be a promising candidate for supporting inverse design, as they have shown success in general-purpose physical prediction, exhibiting high accuracy and generalization for a broad range of physics tasks. However, these models have so far mostly been tested for forward prediction alone. To be useful in a design setting, they must also be smooth and robust, as optimizers will exploit unreliable regions in the state space [53]. Moreover, to use scalable gradient-based optimization techniques, simulation models must additionally exhibit gradient stability over extremely large state and action spaces, and over hundreds of time-steps. It is unclear if graph network simulators exhibit these properties. + +In this paper, we investigate whether learned GNN simulators can support effective inverse design. We pretrain a GNN simulator on a task-independent dynamics dataset, and at test time perform gradient-based optimization for zero-shot design across a variety of tasks. We perform a large set of experiments and find that (1) the learned simulator model is accurate and flexible enough to support a wide variety of design tasks; (2) it generalizes well enough to support design tasks far outside the training regime; (3) gradients from the learned model turn out to be very useful for inverse design, with gradient-based optimization strongly outperforming a variety of sampling-based optimizers; (4) and surprisingly, gradients remain stable even when rolling the model out for hundreds of steps. In experiments on high-dimensional fluid manipulation (2D FLUID TOOLS and 3D WATERCOURSE) we demonstrate that gradient-based optimization on learned models can find high-quality designs over hundreds of time steps, through states with thousands of particles, in tasks with up to 625 design parameters. The same model matches performance of a specialized solver on aerodynamics design (AIRFOIL) with a much simpler setup, highlighting the flexibility and precision of this approach. + +# 2 Related Work + +Modern design techniques rely on physical simulators so that designs can be evaluated virtually before being tested physically. Solving inverse design problems with simulators has been studied in a variety of disciplines, including nanophotonics [54], material science [25], mechanical design [22], and aerodynamics [2, 60]. Many of these rely on black-box optimization, including active and adaptive sampling methods [68, 3]. In recent years, differentiable simulators [29, 44, 64] have garnered attention, as they allow for more sample-efficient gradient-based optimization. However, like classical solvers, they are typically narrow in application scope, as many simulation techniques are hard to express as a differentiable program (e.g. constraint dynamics and multiphysics coupling). Our work aims to lessen this burden by learning these simulators from data. + +Machine learning for inverse design replaces or augments the simulation model and/or the optimization procedure with learned modules [e.g. 16, 19, 34, 28, 37, 42, 48, 50, 52, 59, 66, 78]. Generative approaches enable efficient optimization by learning to sample more likely designs (thus calling an expensive simulator fewer times). End-to-end predictive approaches learn a surrogate model that maps designs to task rewards directly (replacing the simulator entirely). This permits not only sampling-based optimization, but also gradient-based techniques when the surrogate model is differentiable [59]. However, surrogate models often generalize poorly to designs that lie outside of their training dataset, so many ML approaches for design must keep the optimization procedure close to the training dataset [12, 30], or introduce alternative objectives for the surrogate model to increase robustness [71, 77]. In all cases, these methods require access to datasets with (design, task reward) pairs on the specific task, making zero-shot generalization to new tasks impossible. Instead, we propose to learn the underlying physical dynamics independent of the design task, allowing both the design space and task to be specified at design time. + +![](images/8a30a56d31439c8df825f90862ba143253049aa2dd82d7d590bd3028b9a0feb1.jpg) +Figure 1: Optimizing a physical design. Here, the goal is to direct a stream of water (shown in blue) into two "pools" (shown in purple) by designing a "landscape" (shown in green) parameterized as a 2D height field. (a) The simulation pipeline takes in a design $\phi$ and initial conditions $\alpha$ and uses the design function $f_{D}$ to produce an initial state. The simulation is rolled out with a pre-trained learned simulator $f_{M}$ for $K$ steps, at which point the final state is passed (along with reward parameters $\theta_{R}$ ) to the reward function $f_{R}$ , which computes the quality of the design. (b) Each step of optimization involves rolling out the simulation and then adjusting the design $(\phi)$ accordingly using an optimizer such as gradient descent or CEM. Shown are selected frames from gradient-based optimization in the 2 Pools task of the 3D WATERCOURSE domain. + +In this way, our approach is related to methods in model-based reinforcement learning (MBRL), which learns action-conditioned transition models to support flexible downstream planning and control. However, learned simulators are rarely accurate, stable, and generalizable enough to support better downstream task performance [36, 53]. Techniques from MBRL need to mitigate model error either by learning a global, task-conditioned policy during model learning [45] (which then cannot be adapted to novel tasks on-the-fly), or by re-planning at every timestep to avoid error accumulation [15]. Because of such sensitivities, these methods have only been demonstrated in relatively small-scale problems, for example with (up to 21 degrees of freedom DOF [10, 62, 73]) or more complex domains with small action spaces (6 DOF [51]), unlike the thousands of state dimensions and hundreds of action dimensions and timesteps we consider here. + +We focus on graph neural networks as our simulator model, as they have recently demonstrated high accuracy, stability, domain-generality, and generalization performance in the forwards direction for physics domains [7, 57, 63]. However, it is not known whether these simulators can now support gradient-based, high-dimensional inverse design which demands high accuracy, well-behaved gradients, long-term rollout stability, and generalization beyond the training data. Our experimental investigations show that they can, and that particular architectural choices are critical to this success. + +# 3 Problem Formulation + +Consider the design task depicted in Figure 1, in which the goal is to direct a stream of water (shown in blue) into two "pools" (shown in purple) by designing a "landscape" (shown in green) parameterized as a 2D height field. Here, an ideal design will create ridges and valleys that direct fluid into the two targets. In the next sections, we formalize what it means to find and evaluate such a design and discuss our choices for simulator and optimizer. + +Learned simulators To demonstrate the utility of learned simulators for finding physical designs, we rely on the recently developed MESHGRAPHNETS model [57], which is an extension of the Graph Network Simulator (GNS) model for particle simulation [63]. MESHGRAPHNETS is a type of message-passing graph neural network (GNN) that performs both edge and node updates [6, 32], and which was designed specifically for physics simulation by enforcing locality and translation equivariance. We briefly summarize the learned simulator here, and refer interested readers to the original papers for details. + +We consider simulations over physical states represented as graphs $G \in \mathcal{G}$ . The state $G = (V, E)$ has nodes $V$ connected by edges $E$ , where each node $v \in V$ is associated with a position $\mathbf{u}_v$ and additional dynamical quantities $\mathbf{q}_v$ . These graphs may be either meshes (as in MESHGRAPHNETS) or particle systems (as in GNS). In a mesh-based system (such as AIRFOIL), $V$ and $E$ correspond to vertices and edges in the mesh, respectively. In a particle system (such as 2D FLUID TOOLS), each node corresponds to a particle and edges are computed dynamically based on proximity. Under this framework, we can also consider hybrid mesh-particle systems (such as 3D WATERCOURSE). The model is constrained to perform local computation, by performing message passing over these edges, and to perform equivariant computations by encoding position as the relative displacement and distance between neighboring particles. Intuitively, this allows it to generalize well to scenarios where the local interactions are the same but the global arrangement of particles changes. See Appendix B for model implementation details, and Appendix C for domain-specific details. + +The simulation dynamics are given by a "ground-truth" simulator $f_{S}:\mathcal{G}\to \mathcal{G}$ which maps the state at time $t$ to that at time $t + \Delta t$ . The simulator $f_{S}$ can be applied iteratively over $K$ time steps to yield a trajectory of states, or a "rollout," which we denote $(G^{t_0},\dots,G^{t_K})$ . Using MESHGRAPHNETS, we learn an approximation $f_{M}$ of the ground-truth simulator $f_{S}$ . The learned simulator $f_{M}$ can be similarly applied to produce rollouts $(\tilde{G}^{t_0},\tilde{G}^{t_1},\dots,\tilde{G}^{t_K})$ , where $\tilde{G}^{t_0} = G^{t_0}$ represents initial conditions given as input. We note that a learned simulator allows us to take larger time-steps than $f_{S}$ permitting shorter rollout lengths: in our running example, one model step corresponds to 200 steps of the classical simulator. See Figure 1a for an illustration of simulation using a learned model. To improve stability for longer rollouts, random Gaussian noise was added to the inputs during training. + +To optimize a physical design, we leverage the pipeline shown in Figure 1: (1) transform design parameters into an initial scene, (2) simulate the scene using $f_{M}$ or $f_{S}$ , (3) evaluate how well the simulation achieves the desired behavior, and (4) adjust the design parameters accordingly. + +Design parameters To produce the initial state $G^{t_0}$ , we introduce a differentiable design function $f_{D}: \Phi \times \mathcal{A} \rightarrow \mathcal{G}$ which maps design parameters $\phi \in \Phi$ and other initial conditions $\alpha \in \mathcal{A}$ to an initial state: $G^{t_0} = f_{D}(\phi, \alpha)$ . In Figure 1, $\phi$ is the 2D height field of the mesh, while $\alpha$ is the non-controllable objects in the scene like the initial position of the fluid. + +Maximizing reward The reward function $f_{R}:\mathcal{G}\times \Theta_{R}\to \mathbb{R}$ maps the final state of a length- $K$ trajectory $(G^{t_K}$ or $\tilde{G}^{t_K}$ ) and reward function parameters $\theta_{R}\in \Theta_{R}$ to a scalar value. In our running example, the reward function is defined as the Gaussian likelihood of each fluid particle under the closest "pool", averaged across particles (Figure 1a). Reward function parameters $\theta_{R}$ are the means and standard deviations of these pools. + +We define the objective under the ground-truth simulator $f_{S}$ as $J_{S}(\phi) \coloneqq f_{R}(f_{S}^{(K)}(f_{D}(\phi, \alpha)); \theta_{R})$ , where $f_{S}^{(K)}$ indicates $K$ applications of the simulator. We want to find the design parameters that maximize $J_{S}$ , i.e. $\phi^{*} = \operatorname{argmax}_{\phi} J_{S}(\phi)$ . We can approximate this optimization using a learned simulation model by maximizing $J_{M}(\phi) \coloneqq f_{R}(f_{M}^{(K)}(f_{D}(\phi, \alpha)); \theta_{R})$ . Crucially, multiple reward functions can be optimized with the same model $f_{M}$ . + +Optimizers Optimal design parameters $\phi^*$ can be found using any generic optimization technique. Given the differentiability of the learned simulator $f_{M}$ , we are particularly interested in evaluating gradient-based optimization, which requires fewer function evaluations and scales better to large design spaces than sampling-based techniques [10]. We use the Adam optimizer [46] to find $\phi^*$ by computing the gradient $\nabla_{\phi}J_{M}(\phi)$ . This involves backpropagating gradients through the reward function $f_{R}$ , length- $K$ rollout produced by $f_{M}^{(K)}$ , and design function $f_{D}$ . + +As a baseline, we consider the cross-entropy method (CEM) [61], a gradient-free sampling-based technique that is popular in model-based control [20, 73]. CEM can be used with any simulator and works by sampling a population of candidates for $\phi$ and evolving them to maximize the reward. However, CEM requires multiple evaluations of $f_{M}$ or $f_{S}$ per optimizer iteration (depending on the population size), whereas Adam requires only a single evaluation per iteration. We additionally consider covariance matrix adaptation (CMA-ES) [38] and Bayesian Optimization (BO) [68] in Section D.2 as two additional gradient-free optimizers. + +Across our design tasks (Section 4) we compared: gradient descent with Adam on the learned simulator model (GD-M), CEM with the learned simulator model (CEM-M), and CEM with the + +![](images/0784f7799c0604be0af289890cffae93f54971dc37dbe4bcb6959c21309f1507.jpg) +(a) GD-M design evolution + +![](images/021cf22e4fb8b8f4572ad19c5b8beac5049bc5c98aa043f937211cda8bea28ec.jpg) + +![](images/dceca1f87990031c2564b13b7da07f8c21a33c1eaaa99fcef8ab77031aa56c3e.jpg) + +![](images/ac24acadb61dd173dd0baf66eb52b9c0f60611783ccdb2d5e8373ee27aeebd86.jpg) + +![](images/6212c79ca331f9067270aa6dc8857d203ca88d1bf75c8cc15fb777575a329eac.jpg) + +![](images/5e28a6e60a86414694186405bf0d3c850ff9a82a9aa8f6ac0f886a7ca927c6af.jpg) + +![](images/0c8b6b831b74193f7fe9fc0fdf237a721eec3f8932fcfaba47a1f274a62ec59c.jpg) + +![](images/803a605c460c85c4eff69faee3a150e26c9236e93e7c770dacf14b8e4c62374e.jpg) + +![](images/ce43430bf0f90b3148c38ae65ed8ed1d656c8707fc8639160750760cd7c7fe88.jpg) + +![](images/9f13c695d842357cce7a4e7cc5db23a0a86885aa9eb10fb9a650c2b3c113914d.jpg) +(b) CEM-M + +![](images/f0ebb1e18e1a3058285975471ea9418dc6bd76af591325b46af0fa06ebd16be2.jpg) + +![](images/5c4a7b895c88ff82e2e0fb0a8007f59dc9f16e34c196d043e6ae9493fe5f1f35.jpg) + +![](images/847c32a77fc5eda82486a66571b7e355ee7ce40142e253bcebaf65ca82d76934.jpg) +(c) Reward + +![](images/ce7d790c1556534216b06b2aa2a3ab4d6be4680403465d95d7b6f6b46881ca83.jpg) + +![](images/d0ae19ee9787ae39978d34f618dc0856448ecd56f605df7e0ac1fe07bc2efe1e.jpg) +Figure 2: 2D FLUID TOOLS results. The state spaces consist of $10^{2} - 10^{3}$ particles and the design spaces of 16-36 parameters. (a) Evolution of designs found by GD-M during optimization for each 2D FLUID TOOLS task. Visualizations correspond to simulations of the designs under $f_{S}$ . The design is shown in black, fluid particles in blue, and Gaussian reward in yellow. The transparent particles show the location of fluid for $t < t_{K}$ , and the solid particles show the location of fluid at the final frame ( $K = 150$ ). $r$ denotes reward for the current design. (b) Final designs found by CEM-M. (c) Mean reward over 50 reward locations (with bootstrapped $95\%$ confidence intervals) obtained by each optimizer across the 2D FLUID TOOLS tasks. For Contain and Ramp, results are shown for 16 joints; for Maze, results are shown for a $6 \times 6$ grid of 36 rotors. Across these tasks, GD-M outperforms both CEM-M and CEM-S. + +ground-truth simulator (CEM-S). We compare to further optimizer baselines, such as Bayesian Optimization [68] and CMA-ES [38] in the Appendix (Section D.2). In all tasks, $f_{S}$ is non-differentiable, preventing a comparison to GD-S. However, in the special case of AIRFOIL, we compare to DAFoam [40], a specialized solver which computes gradients with the adjoint method. + +Evaluation Unless otherwise noted, we always evaluate the quality of an optimized design $\phi^{*}$ using the ground-truth objective $J_{S}(\phi^{*})$ , regardless of whether $\phi^{*}$ was found using the learned model $f_{M}$ (as in CEM-M and GD-M) or the ground-truth simulator $f_{S}$ (as in CEM-S). We also use rollouts from $f_{S}$ to produce visualizations in the figures. + +# 4 Design Tasks + +We formulate a set of design tasks across three different physical domains with high-dimensional state spaces and complex dynamics. Each domain uses a different ground-truth simulator $f_{S}$ , which is used to evaluate designs and pre-train the learned simulator model $f_{M}$ in a task-agnostic way. During optimization, all the design tasks on each domain share the same pre-trained model. + +2D FLUID TOOLS Inspired by existing 2D physical reasoning benchmarks [1, 5], these tasks involve creating one or more 2D "tool" shapes to direct fluid into a particular goal region (Figure 2, Section C.1). We consider three tasks with 4-48 design parameters where the goal is to guide the fluid such that each particle comes as close as possible to the center of a randomly-sampled yellow reward region. In Contain, the joint angles $\phi_{\mathrm{oints}}$ of a multi-segment tool must be optimized to catch the fluid by creating cup- or spoon-like shapes. In Ramp, the joint angles $\phi_{\mathrm{oints}}$ of a multi-segment tool must be optimized to guide the fluid to a distant location. In Maze, the rotation $\phi_{\mathrm{rot}}$ of multiple tools must be optimized to funnel the fluid to the target location. Fluid dynamics are represented using $10^{2} - 10^{3}$ particles, and unrolled for up to 300 time steps. + +The learned model $f_{M}$ is trained on the 2D WaterRamps dataset released in [63] which uses the solver in [43] to generate trajectories. The dataset contains scenes with 1-4 straight line segments; no + +![](images/a0ac516338a8977b0d7643168e5014230058898d85c326cefbf0949379d0f2b2.jpg) +(a) Direction (GD-M) $r = 1.19$ [1.184, 1.201] + +![](images/ac437c52c092a0fe97c6dbea89ec9e90fc5bfe62290c98d1c93b1e7c05ac77d3.jpg) +(b) 2 Pools (GD-M) $r = 0.90$ [0.897, 0.909] + +![](images/f3da985d0c2703a9c4345ad57f7f8a906ec8e2275a36fd8585e9102a49a9fa8d.jpg) +c) 3 Pools (GD-M) $r = 0.87$ [0.844, 0.887] +Figure 3: 3D WATERCOURSE results found with GD-M or CEM-M and evaluated with $f_{S}$ . Simulations use up to 2000 particles and 625 design parameters. The heightmap of a 2D landscape is optimized to redirect the fluid towards the purple targets; birds eye views of heightmaps are shown in the upper right corner of each subplot. In this high-dimensional task domain, GD finds designs with high reward (a-c), while CEM fails to find meaningful solutions for 2 Pools (d) as well as the other tasks (Figure A.5a). Each subplot reports the mean reward (r) and bootstrapped [lower, upper] $95\%$ confidence intervals for the corresponding optimizer and task (averaged over 10 randomized initial designs for each task variation, see Section C.2). + +![](images/ae0d9e102b9a7af41d97f4b957c527c93c1056441b89d65ca566481d06fb668d.jpg) +d) 2 Pools (CEM-M) $r = 0.01$ [0.004, 0.019] + +curved lines or large numbers of obstacles are shown. Therefore, designs which solve 2D FLUID TOOLS tasks are necessarily out of distribution for the learned model. + +3D WATERCOURSE To evaluate higher-dimensional inverse design, we created a "landscaping" task that requires optimizing a 3D surface to guide fluids into different areas of an environment (Figure 3, Section C.2). Specifically, water flows out of a pipe and onto an obstacle parameterized by $\phi_{\mathrm{map}}$ , a $25 \times 25$ heightmap (625 design parameters). In Direction, $\phi_{\mathrm{map}}$ is optimized to redirect the fluid stream towards a specified direction. In 2 Pools and 3 Pools, $\phi_{\mathrm{map}}$ is optimized to split the fluid stream such that particles hitting the floor land as close as possible to one of two or three specified pools. Each task has multiple variants, such as different target directions in Direction. The simulation is unrolled for 50 time steps, and contains up to 2048 particles. The learned model $f_{M}$ is trained on data generated from the simulator in [8]. + +AIRFOIL Shape optimization in aerodynamics is one area where gradient-based optimization is routinely applied using traditional simulators [13]. Here, we consider the well-studied task of drag optimization of a 2D airfoil profile (Figure 5, Section C.3). In this task, a wing is defined using a curve on a 2D mesh, which can be deformed using a set of 10 control points $\phi_{\mathrm{ctrl}}$ . The task is formulated as optimizing the wing shape to minimize drag under certain constraints such as constant lift and bounds on the shape to prevent degenerate (e.g. infinitely thin) configurations. Lift and drag coefficients are computed by running an aerodynamics simulation on a 4158 node mesh. The learned model $f_{M}$ is trained on data generated with the OpenFOAM solver [55], which pairs wing shapes with targets of RANS pressure and Reynolds stress fields discretized on a 4158 node mesh. Note that unlike the fluids domains, this simulation is steady-state (ie. a rollout length of 1). + +Model learning and optimization While each domain has a different state space structure and uses a different ground-truth simulator $f_{S}$ , the learned simulators $f_{M}$ all share the same architecture (with identical hyperparameters in 2D FLUID TOOLS and 3D WATERCOURSE, and only minor variations of the hyperparameters for AIRFOIL due to it being a steady state simulation; see Appendix B). The models are trained for next-step prediction on task-independent datasets (random perturbations of the design space for AIRFOIL and 3D WATERCOURSE, and an open-source, qualitatively distinct dataset for 2D FLUID TOOLS), and are unrolled for up to 300 time steps during design optimization without further fine-tuning (see Section 3 for details). Importantly, all the pre-trained models are shared across the multiple design tasks for each domain. + +# 5 Results + +Our results show that learned simulators can be used to effectively optimize various designs despite significant domain shift and long rollout lengths. The same underlying model architecture is used for each domain, highlighting the generality of learned simulators for design. Examples of designs found with + +![](images/1b33a45a81cede496702e217886fd362344382f5572d58ccb210ed03176ef75d.jpg) +Figure 4: Ablation experiments on the Contain and Maze tasks. (a) Performance of all optimizers increase with rollout length; GD-M performance starts to deteriorate around step 225. (b) In Contain, CEM performance drops when increasing the number of joints above 24, while GD-M remains stable. (c) We observe a similar trend with the number of tools in Maze. (d) CEM often gets stuck in sub-optimal solutions early in optimization, while GD-M performance continues to increase. (e) Model choice matters: good performance on GD-M is enabled by key architectural choices of the learned model, such as training noise and translational equivariance. + +![](images/3620fc6dcd5c5fb308fd4b8e692b4459824940836fd40b9b34a6e813bad5799b.jpg) + +![](images/0670e3327c2653c70e3eafab5260ff7927347082dbcb28398ddf2de92d45a8bf.jpg) + +![](images/395f0b3f786dc0fc341f9b8de46b12ce9de54edb4f11f30f064877f637ed0c1f.jpg) + +our approach are available at: https://sites.google.com/view/optimizing-designs. Example code can be found at https://github.com/deepmind/deepmind-research/inverse/design/. Performance is always evaluated using the ground-truth simulator $f_{S}$ (see Section 3). Here we discuss these results, and compare the capabilities of gradient descent with learned simulators over classical simulators and sampling-based optimization techniques. + +Overall results We first asked whether a learned simulator combined with gradient descent (GD-M) could produce good-quality designs at all. This approach might fail in various ways: accumulating model error, vanishing or exploding gradients [9], or domain shift [36, 71]. However, as the following results show, GD-M produced high-quality designs across all three domains. + +Figure 2a shows qualitative results for 2D FLUID TOOLS (Section 4), where our approach (GD-M) produces intuitive, functional designs to contain (Contain), transport (Ramp), or funnel (Maze) the fluid to a target location. On average, GD-M outperforms CEM-M by $16.1 - 118.9\%$ , indicating a substantial benefit of gradient-based optimization. GD-M also outperforms CEM-S by $3.9 - 37.5\%$ despite using a learned simulator rather than the ground-truth. However, these design spaces are still relatively small (between 16 and 36 dimensions). In 3D WATERCOURSE (Section 4), we substantially increase the dimensionality to a 625-dimensional landscape. Here, GD-M produces robust designs, creating ridges to re-route water in particular directions or valleys to direct water into pools (Figure 3a-c). By comparison, CEM-M cannot solve any of these tasks, with performance $30 - 85\times$ worse than GD-M. In the Appendix (Section D.2) we demonstrate that these results also hold for other optimizer choices (Bayesian Optimization, CMA-ES). + +In AIRFOIL (Figure 5b), GD-M recovers the characteristic S-curve shape for a low-drag airfoil under a small angle of attack, and matches the design obtained with DAFoam, an adjoint aerodynamics solver which computes close-to-optimal designs for this task. The design obtained with DAFoam yields a drag coefficient of 0.01902, while GD-M finds designs with drag between 0.01898-0.01919 depending on ensemble size (see Section 5). Importantly, DAFoam's solver and optimizer are highly specialized for the particular task of airfoil design, while our approach is more general-purpose, requiring only trajectory data for training and a generic gradient-based optimizer. + +Model stability & gradient quality We investigated accuracy over long timescales by measuring the effect of rollout length on design quality in 2D FLUID TOOLS (Figure 4a and A.11). Longer rollouts can in principle allow for higher reward in this task as they give the fluid time to settle; however, with learned models, they can also be unstable due to error accumulation [69, 72]. Nevertheless, we find that the learned simulator does not seem to be severely impacted by this problem. Specifically, the quality of designs found by GD-M increases up to 225 steps (Figure 4a), indicating that the learned simulator's accuracy and gradients remain stable for a surprisingly long time. Across the episode lengths evaluated, we find that GD-M outperforms not only CEM-M (by $18.1\%$ on average) but also CEM-S (by $4.4\%$ on average). This indicates that the benefits of a having a learned model that supports better optimization techniques can outweigh the small errors incurred by long rollouts. + +The strong performance of GD-M on longer rollout lengths is noteworthy. Gradients tend to degrade when passed through chains of many model evaluations, and as a result, previous work generally only optimizes gradients in small action spaces over just a few time-steps [51]. + +![](images/f9ec05c57c1936c4e49e3cf4525b5b4b1355f2557b560f111ab368df9bed4746.jpg) +(a) Initial design +Figure 5: AIRFOIL results. (a) An initial airfoil design is warped by moving 10 control points (orange dots). The physics model simulates the resulting aerodynamics on a 4158 node mesh, based on which lift and drag are computed. (b) For the task of finding a minimum-drag configuration under constant lift constraint, gradient-based learned design is able to find similar designs to specialized solver DAFoam, both using single models and ensembles. (c-d) Larger ensemble sizes of 3-5 achieve a close quantitative match to DAFoam for both drag and overall reward. Shown are means over 10 randomized initial designs, with bootstrapped $95\%$ confidence intervals. + +![](images/2f81f183d15c3e155f905f356aff5919a0ae7e18732bad8b9a9a2ff1f6bcfea7.jpg) +(b) Optimized designs + +![](images/73dc0b03fac33dc06a1f2bfff8b8d6b1e6d082de2a0dd025e7a248a59782b599.jpg) +(c) Drag + +![](images/72bb3727a0fb4f0ed8d8b4b17ff97d78218567ef47246c34f611f73335e84ac3.jpg) +(d) Reward + +We hypothesize that a key reason for the success of GD-M is the addition of noise in training the model $f_{M}$ , which promotes stability on the forward pass and smoother gradients. We test this by considering a model variant trained without noise (Figure 4e, red). We observe much worse design quality compared to the full model, particularly for longer rollouts. + +Improving accuracy with ensembles In engineering tasks like AIRFOIL, simulators must be especially accurate, as small differences in the predicted pressure field can cause large errors in lift and drag coefficients. While GD-M (without ensembling) produces designs close to DAFoam's, we notice a slightly rounder wing front (Figure 5b, bottom) causing a small increase in drag (0.01919 versus 0.01902 in DAFoam). + +To further improve performance, we implemented an ensemble of learned simulators trained on separate splits of the training set. Ensembles are a popular choice for training transition models for use in control [20], as they can provide higher quality predictions and are more resistant to delusions—a particularly problematic issue for accuracy-sensitive domains such as airfoil design. During optimization, we make predictions with all models in the ensemble, each trained on a different data split, and average the gradients. As shown in Figure 5b-c, larger ensembles yield designs with significantly lower drag ( $\beta = -5.3 \times 10^{-5}$ , $p = 0.0003$ , where $\beta$ is a linear regression coefficient) and higher overall reward ( $\beta = 5.6 \times 10^{-5}$ , $p = 0.0001$ ), and are able to produce designs very close to the solution found by DAFoam, with a drag coefficient of 0.01898 (size-5 ensemble). Thus we are able to achieve performant designs with a general-purpose learned simulator, indicating that we can use learned models for design optimization in spaces traditionally reserved for specialized solvers like DAFoam. + +Scalability to larger design spaces In larger design spaces, sampling-based optimization procedures quickly become intractable, especially with relatively slow simulators. We hypothesized that gradient descent with fast, learned simulators could overcome this issue, especially as the size of the design space is increased. We therefore compared different optimizers on 2D FLUID TOOLS as a function of the dimensionality of the design space (the number of tool joints in Contain or the number of tools in Maze) and on the higher-dimensional 3D WATERCOURSE. + +For Contain (Figure 4b), the performance of GD-M increases with the number of joints as increasingly fine grained solutions are made possible. In contrast, for both CEM-M and CEM-S, design quality deteriorates with more joints as high quality solutions become harder to find with random sampling. In the highest dimensional Contain task with 48 tool joints, GD-M outperforms CEM-M by $154.9\%$ and CEM-S by $126.5\%$ . When CEM does find solutions (Figure 2b), they lack global coherence and appear more jagged than solutions found with GD-M. Similarly, for Maze (Figure 4c), the performance of GD-M is largely unaffected by the number of tools, while the performance of CEM-M and CEM-S both degrade as the design space grows. For the highest dimensional Maze problem with 36 joints, GD-M outperforms CEM-M by $207.4\%$ and CEM-S by $133.7\%$ . + +In the 625-dimensional 3D WATERCOURSE task, CEM-M performs $30 - 85 \times$ worse than GD-M (Figure 3) despite extensive hyperparameter tuning. This trend held across all tasks (Figure A.5a), and even persisted when using fewer control points in the design space (Figure A.7). This is due not only to 3D WATERCOURSE's larger design space, but also because this problem requires a globally coherent solution: small, independent changes have a negligible effect on the global movement of the fluid. + +![](images/9c665fcf82ea8961ea339649d257426f9a8e670859d0708571ed8780d9920d44.jpg) +(a) In Distribution Test Designs + +![](images/29e0d44dda554abb1f5612ded638bda91a81d52d131e05fe39dd87c0173c3e17.jpg) + +![](images/462312b71fcbba28733237937035eb5bc710c87cefb3d5d31a2427567d2c131b.jpg) + +![](images/1b0c3ec4894174b9750e201fde341334df93229d5d1228fd285cb14a2fe312bb.jpg) +(d) Actual v. End-to-End Predicted Reward +Figure 6: Analysis of an End-to-End surrogate reward model (GD-E2E) versus our approach (GD-M). (a) Test designs sampled from the same distribution as the training data. (b,c) Optimized designs and top view of resulting flow trajectories from the (b) Learned Simulator (GD-M) and (c) End-to-End (GD-E2E) model for two Direction tasks in 3D WATERCOURSE. (d) Ground Truth (evaluated using $f_{s}$ ) vs Predicted reward for different sets of designs. (black dots) held-out in-distribution test designs, (blue) designs optimized using (GD-M), (orange) designs optimized using (GD-E2E). + +Model speed and sample efficiency Learned simulators can provide large speedups over traditional simulators in certain domains by learning to compensate for coarser sub-stepping and making optimal use of hardware acceleration. In AIRFOIL, although we use a very simple GD setup, our approach is able to find very similar designs as DAFoam's specialized optimizer. Moreover, our approach requires only 21s (single model) to 62s (size-5 ensemble) on a single A100 GPU, compared to 1021s for DAFoam run on an 8-core workstation, despite requiring $10 \times$ more optimization steps. + +In 2D FLUID TOOLS, the ground-truth simulator runs at a similar speed to the learned model [see 63], but is non-differentiable and therefore depends on more expensive gradient-free optimization techniques which require more function evaluations. We use 20-40 function evaluations per optimization step of CEM, compared to a single evaluation with GD (which is about $3 \times$ more costly, due to the gradient computation). Thus, GD with a differentiable learned model can be much more efficient than using the ground truth simulator with a sampling-based method. + +Generalization Deep networks often struggle to generalize far from their training data [31]. This poses a problem for design: to produce in-distribution training data, we would already need to know what good designs look like, thus defeating the aim of wanting to find new designs. However, we find that the GNN-based simulators generalize well in the setting studied here. As noted in Section 4, the learned simulator for 2D FLUID TOOLS was trained on a pre-existing, highly simplified dataset where only one to four straight line segments interact with a fluid (Appendix C). However, it still can support the design tasks studied here, which involve highly articulated, curved obstacles (Contain, Ramp) or a larger number of obstacles (Maze), without further finetuning (Figure 2). + +In Section D.6, we show similarly compelling generalization results for 3D WATERCOURSE. Without fine-tuning, we optimize the heightfields of two meshes along with their global rotations to redirect water. These design tasks now consist of $1250 + 2$ design dimensions, while also being further from the training distribution (only one, un-rotated heightfield was ever observed). Despite these added challenges, the method still produces good designs with reward between 0.52 and 1.16. + +This generalization capability emerges due to certain design choices of the simulator model $f_{M}$ . Specifically, the GNN operates on local neighborhoods of particles, and particle coordinates are represented in a relative manner, which encourages learning local rules that can transfer to very different setups. We tested a model variant which breaks this property by encoding absolute, instead of relative particles coordinates (Figure 4e, purple). We find that this variant can no longer robustly simulate out-of-domain designs, leading to worse performance at any rollout length. + +Using a learned simulator trained in a relatively simple environment has another unexpected advantage. In rare cases, classical simulators suffer from degenerate behavior around certain edge cases. For example, with the classical simulator for 2D FLUID TOOLS, particles can get stuck in between joint segments, especially when there are a large number of parts or joints (Figure A.10). However, since the learned simulator was trained on simpler data where these effects are unobserved, it picks up only on the appropriate collision performance and not the unrealistic edge cases. Thus, the learned simulator produces more plausible rollouts than the classical simulator in these cases, and might therefore be a better candidate for producing designs that would transfer to the real world. There are also cases where we would expect the classical simulator to generalize better than the learned simulator, such as in dealing with fluids with viscosities outside the training data with different local dynamics. + +Comparing to end-to-end surrogate models To further benchmark the generalization capabilities of our approach, we compare to an end-to-end surrogate model trained to map design parameters $(\phi_{\mathrm{map}})$ directly to rewards for each of the $\mathbf{d} = 8$ target angles of the Direction task in 3D WATER-COURSE. To train the end-to-end surrogate model, we use the same designs as those used to train the GNN dynamics model (Section C.2), but additionally paired with the rewards predicted by the ground truth simulator, so that $\mathcal{D}_{sur} = \{(\phi_{\mathrm{map}},f_{R_{\mathrm{dir}}}(\phi_{\mathrm{map}},\mathbf{d}))^{(i)}\}_{i = 0}^{1000}$ . We use a ResNet-18 [39] as the surrogate model with a $25\times 25$ dimensional input image corresponding to the heightfield mesh, and we train a separate model for each target direction. We focus on 3D WATERCOURSE for these experiments, as the training data and design problems contain meshes in the same domain ( $25\times 25$ meshes). For 2D FLUID TOOLS the training data and design spaces are different, making the end-to-end surrogate approach fundamentally under-determined. + +The surrogate model could fit the training set and an in-distribution test set well (MSE=0.0070 ± 0.0025, Figure 6d). However, when used for design optimization with a GD optimizer, the surrogate moves into out of distribution regions of design space where it makes overly optimistic predictions (predicted=1.12 ± 0.31, actual=0.40 ± 0.05, MSE=0.615 ± 0.403, Figure 6b,c). The surrogate model also severely underestimates the reward of high-scoring designs found using our method GD-M (predicted=0.33 ± 0.06, actual=1.21 ± 0.18, MSE=0.813 ± 0.344, Figure 6d). Overall, this suggests that using task-agnostic, dynamics-based models for design can have appealing regularization properties which avoid issues of model delusion that are commonly seen with end-to-end surrogate approaches. + +# 6 Discussion + +We find that state-of-the-art learned, differentiable physics simulators can be used with gradient-based optimization to solve challenging inverse design problems. Across three domains and seven tasks, which involved designing landscapes and tools to control water flows or optimizing the shape of an airfoil, we demonstrated that gradient descent with pre-trained simulators can discover high-quality designs that match or exceed the quality of those found using alternative methods. This approach succeeds in a variety of interesting and surprising ways: it permits gradient backpropagation through complex physical trajectories for hundreds of steps; scales to tasks with large design and state spaces (100s and 1000s of dimensions, respectively); and successfully generates designs which require the learned simulator to generalize far beyond its training data. In the classic aerodynamics problem of airfoil shape optimization, our approach produces a design comparable to that of a specialized solver using only simple, general-purpose strategies like model ensembling. + +While our results have exciting implications for inverse design, they also open up possibilities for explaining everyday human behavior like tool invention—a longstanding puzzle in cognitive science [1, 56, 67]. With general-purpose learned simulators, we have the potential not just to create highly specialized tools in engineering domains, but also to model everyday tool creation, such as creating a hook from a pipe cleaner, building a blanket fort, or folding a paper boat. + +Our approach has limitations that should be visited in future work. Gradient descent is inappropriate for design spaces with regions of zero gradients, such as in 2D FLUID TOOLS tasks where the fluid may not always make contact with the tool (Figure A.9). Many interesting design tasks also have variably-sized or combinatorial design spaces that cannot easily be optimized with gradient descent, such as computer-aided design (CAD) approaches to 3D modeling. An exciting future direction will be to integrate general-purpose learned simulators with hybrid optimization techniques such as those used in material science and robotics [17, 70]. As learned simulators continue to improve, we could also use them to do even broader cross-domain, multi-physics design. While challenges remain, our results represent a promising step towards faster and more general-purpose inverse design. + +# 7 Acknowledgements + +We thank Yulia Rubanova and Evan Shelhamer for their detailed comments on the manuscript, and Yusuf Aytar, Jonathan Godwin, Luis Piloto, Remi Lam, and Meire Fortunato for helpful discussions. + +# References + +[1] Kelsey R. Allen, Kevin A. Smith, and Joshua B. Tenenbaum. Rapid trial-and-error learning with simulation supports flexible tool use and physical reasoning. Proceedings of the National Academy of Sciences, 2020. +[2] W Kyle Anderson and V Venkatakrishnan. Aerodynamic design optimization on unstructured grids with a continuous adjoint formulation. Computers & Fluids, 28(4-5):443-480, 1999. +[3] Christof Angermüller, David Belanger, Andreea Gane, Zelda Mariet, David Dohan, Kevin Murphy, Lucy J. Colwell, and D. Sculley. Population-based black-box optimization for biological sequence design. CoRR, abs/2006.03227, 2020. URL https://arxiv.org/abs/2006.03227. +[4] Aharon Azulay and Yair Weiss. Why do deep convolutional networks generalize so poorly to small image transformations? CoRR, abs/1805.12177, 2018. URL http://arxiv.org/abs/1805.12177. +[5] Anton Bakhtin, Laurens van der Maaten, Justin Johnson, Laura Gustafson, and Ross Girshick. Phyre: A new benchmark for physical reasoning. Advances in Neural Information Processing Systems, 32:5082-5093, 2019. +[6] Peter W Battaglia, Jessica B Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, et al. Relational inductive biases, deep learning, and graph networks. arXiv preprint arXiv:1806.01261, 2018. +[7] Filipe de Avila Belbute-Peres, Thomas D. Economon, and J. Zico Kolter. Combining differentiable PDE solvers and graph neural networks for fluid flow prediction. In Proceedings of the 37th International Conference on Machine Learning ICML 2020, 2020. +[8] Jan Bender and Dan Koschier. Divergence-free smoothed particle hydrodynamics. In Proceedings of the 14th ACM SIGGRAPH/Eurographics symposium on computer animation, pages 147-155, 2015. +[9] Yoshua Bengio, Patrice Simard, and Paolo Frasconi. Learning long-term dependencies with gradient descent is difficult. IEEE transactions on neural networks, 5(2):157-166, 1994. +[10] Homanga Bharadhwaj, Kevin Xie, and Florian Shkurti. Model-predictive control via cross-entropy and gradient-based optimization. In Learning for Dynamics and Control, pages 277–286. PMLR, 2020. +[11] James Bradbury, Roy Frostig, Peter Hawkins, Matthew James Johnson, Chris Leary, Dougal Maclaurin, George Necula, Adam Paszke, Jake VanderPlas, Skye Wunderman-Milne, and Qiao Zhang. JAX: composable transformations of Python+NumPy programs, 2018. +[12] David H. Brookes, Hahnbeom Park, and Jennifer Listgarten. Conditioning by adaptive sampling for robust design, 2019. URL https://arxiv.org/abs/1901.10060. +[13] Howard P Buckley, Beckett Y Zhou, and David W Zingg. Airfoil optimization using practical aerodynamic design requirements. Journal of Aircraft, 47(5):1707-1719, 2010. +[14] Keith T Butler, Jarvist M Frost, Jonathan M Skelton, Katrine L Svane, and Aron Walsh. Computational materials design of crystalline solids. Chemical Society Reviews, 45(22):6138-6146, 2016. +[15] Eduardo F Camacho and Carlos Bordons Alba. Model predictive control. Springer science & business media, 2013. +[16] Adithya Challapalli, Dhrumil Patel, and Gouqiang Li. Inverse machine learning framework for optimizing lightweight metamaterials. Materials & Design, 208:109937, 2021. +[17] Chun-Teh Chen and Grace X. Gu. Generative deep neural networks for inverse materials design using backpropagation and active learning. Advanced Science, 7(5):1902607, 2020. + +[18] Tianqi Chen, Bing Xu, Chiyuan Zhang, and Carlos Guestrin. Training deep nets with sublinear memory cost. arXiv preprint arXiv:1604.06174, 2016. +[19] Thomas Christensen, Charlotte Loh, Stjepan Picek, Domagoj Jakobovic, Li Jing, Sophie Fisher, Vladimir Ceperic, John D. Joannopoulos, and Marin Soljacic. Predictive and generative machine learning models for photonic crystals. Nanophotonics, 9(13):4183-4192, 2020. +[20] Kurtland Chua, Roberto Calandra, Rowan McAllister, and Sergey Levine. Deep reinforcement learning in a handful of trials using probabilistic dynamics models. arXiv preprint arXiv:1805.12114, 2018. +[21] Shane Colburn and Arka Majumdar. Inverse design and flexible parameterization of meta-optics using algorithmic differentiation. Communications Physics, 4(1):1-11, 2021. +[22] Stelian Coros, Bernhard Thomaszewski, Gioacchino Noris, Shinjiro Sueda, Moira Forberg, Robert W. Sumner, Wojciech Matusik, and Bernd Bickel. Computational design of mechanical characters. ACM Trans. Graph., 32(4), jul 2013. +[23] Kyle Cranmer, Johann Brehmer, and Gilles Louppe. The frontier of simulation-based inference. Proceedings of the National Academy of Sciences, 117(48):30055-30062, 2020. +[24] Yabo Dan, Yong Zhao, Xiang Li, Shaobo Li, Ming Hu, and Jianjun Hu. Generative adversarial networks (GAN) based efficient sampling of chemical composition space for inverse design of inorganic materials. Nature Computational Materials, 6(1):84, 2020. +[25] Marjolein Dijkstra and Erik Luijten. From predictive modelling to machine learning and reverse engineering of colloidal self-assembly. Nature Materials, 20(6):762-773, 2021. +[26] Frederik Ebert, Chelsea Finn, Sudeep Dasari, Annie Xie, Alex Lee, and Sergey Levine. Visual foresight: Model-based deep reinforcement learning for vision-based robotic control. arXiv preprint arXiv:1812.00568, 2018. +[27] Richard Eppler. Airfoil design and data. Springer Science & Business Media, 2012. +[28] Antonio Elia Forte, Paul Z. Hanakata, Lishuai Jin, Emilia Zari, Ahmad Zareei, Matheus C. Fernandes, Laura Sumner, Jonathan Alvarez, and Katia Bertoldi. Inverse design of inflatable soft membranes through machine learning. Advanced Functional Materials, page 2111610, 2022. +[29] C Daniel Freeman, Erik Frey, Anton Raichuk, Sertan Girgin, Igor Mordatch, and Olivier Bachem. Brax-a differentiable physics engine for large scale rigid body simulation, 2021. +[30] Justin Fu and Sergey Levine. Offline model-based optimization via normalized maximum likelihood estimation. CoRR, abs/2102.07970, 2021. URL https://arxiv.org/abs/2102.07970. +[31] Robert Geirhos, Carlos R Medina Temme, Jonas Rauber, Heiko H Schütt, Matthias Bethge, and Felix A Wichmann. Generalisation in humans and deep neural networks. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, pages 7549-7561, 2018. +[32] Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. In International conference on machine learning, pages 1263-1272. PMLR, 2017. +[33] Daniel Golovin, Benjamin Solnik, Subhodeep Moitra, Greg Kochanski, John Karro, and David Sculley. Google vizier: A service for black-box optimization. In Proceedings of the 23rd ACM SIGKDD international conference on knowledge discovery and data mining, pages 1487-1495, 2017. +[34] Rafael Gómez-Bombarelli, Jennifer N. Wei, David Duvenaud, José Miguel Hernández-Lobato, Benjamín Sánchez-Lengeling, Dennis Sheberla, Jorge Aguilera-Iparraguirre, Timothy D. Hirzel, Ryan P. Adams, and Alán Aspuru-Guzik. Automatic chemical design using a data-driven continuous representation of molecules. ACS Central Science, 4(2):268-276, 02 2018. + +[35] Agrim Gupta, Silvio Savarese, Surya Ganguli, and Li Fei-Fei. Embodied intelligence via learning and evolution. Nature Communications, 12(1):5721, Oct 2021. +[36] Jessica B Hamrick, Abram L Friesen, Feryal Behbahani, Arthur Guez, Fabio Viola, Sims Witherspoon, Thomas Anthony, Lars Buesing, Petar Velicković, and Théophane Weber. On the role of planning in model-based deep reinforcement learning. arXiv preprint arXiv:2011.04021, 2020. +[37] Paul Z. Hanakata, Ekin D. Cubuk, David K. Campbell, and Harold S. Park. Forward and inverse design of kirigami via supervised autoencoder. Phys. Rev. Research, 2:042006, Oct 2020. +[38] Nikolaus Hansen, Pedro Larrañaga, Inaki Inza, and Endika Bengoetxea. The CMA Evolution Strategy: A Comparing Review, pages 75–102. Springer Berlin Heidelberg, Berlin, Heidelberg, 2006. +[39] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770-778, 2016. +[40] Ping He, Charles A Mader, Joaquim RRA Martins, and Kevin J Maki. Dafoam: An open-source adjoint framework for multidisciplinary design optimization with openfoam. *AIAA journal*, 58 (3):1304–1319, 2020. +[41] Matteo Hessel, David Budden, Fabio Viola, Mihaela Rosca, Eren Sezener, and Tom Hennigan. Optax: composable gradient transformation and optimisation, in JAX!, 2020. +[42] Stephan Hoyer, Jascha Sohl-Dickstein, and Sam Greydanus. Neural reparameterization improves structural optimization. CoRR, abs/1909.04240, 2019. +[43] Yuanming Hu, Yu Fang, Ziheng Ge, Ziyin Qu, Yixin Zhu, Andre Pradhana, and Chenfanfu Jiang. A moving least squares material point method with displacement discontinuity and two-way rigid body coupling. ACM Transactions on Graphics (TOG), 37(4):1-14, 2018. +[44] Yuanming Hu, Luke Anderson, Tzu-Mao Li, Qi Sun, Nathan Carr, Jonathan Ragan-Kelley, and Frédo Durand. Difftaichi: Differentiable programming for physical simulation. arXiv preprint arXiv:1910.00935, 2019. +[45] Michael Janner, Justin Fu, Marvin Zhang, and Sergey Levine. When to trust your model: Model-based policy optimization. In Advances in Neural Information Processing Systems, 2019. +[46] Diederick P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations (ICLR), 2015. +[47] Aviral Kumar, Xue Bin Peng, and Sergey Levine. Reward-conditioned policies. CoRR, abs/1912.13465, 2019. URL http://arxiv.org/abs/1912.13465. +[48] Siddhant Kumar, Stephanie Tan, Li Zheng, and Dennis M. Kochmann. Inverse-designed spinodoid metamaterials. Nature Computational Materials, 6(1):73, 2020. +[49] Charles L Ladson. Effects of independent variation of Mach and Reynolds numbers on the low-speed aerodynamic characteristics of the NACA 0012 airfoil section, volume 4074. National Aeronautics and Space Administration, Scientific and Technical ..., 1988. +[50] Jichao Li, Mengqi Zhang, Joaquim Martins, and Chang Shu. Efficient aerodynamic shape optimization with deep-learning-based geometric filtering. AIAA Journal, 58:1-17, 07 2020. +[51] Yunzhu Li, Jiajun Wu, Russ Tedrake, Joshua B. Tenenbaum, and Antonio Torralba. Learning particle dynamics for manipulating rigid bodies, deformable objects, and fluids. In International Conference on Learning Representations, 2019. +[52] Zhaocheng Liu, Dayu Zhu, Sean P. Rodrigues, Kyu-Tae Lee, and Wenshan Cai. Generative model for the inverse design of metasurfaces. Nano Letters, 18(10):6570-6576, Sep 2018. ISSN 1530-6992. + +[53] Michael Lutter, Leonard Hasenclever, Arunkumar Byravan, Gabriel Dulac-Arnold, Piotr Trochim, Nicolas Heess, Josh Merel, and Yuval Tassa. Learning dynamics models for model predictive agents. arXiv preprint arXiv:2109.14311, 2021. +[54] Sean Molesky, Zin Lin, Alexander Y Piggott, Weiliang Jin, Jelena Vuckovic, and Alejandro W Rodriguez. Inverse design in nanophotonics. Nature Photonics, 12(11):659-670, 2018. +[55] OpenCFD Ltd. OpenFOAM CFD solver. www.openfoam.org, 2021. +[56] François Osiurak and Arnaud Badets. Tool use and affordance: Manipulation-based versus reasoning-based approaches. Psychological review, 123(5):534, 2016. +[57] Tobias Pfaff, Meire Fortunato, Alvaro Sanchez-Gonzalez, and Peter Battaglia. Learning mesh-based simulation with graph networks. In International Conference on Learning Representations, 2021. +[58] Janeita Reid. Free-form deformation. dafoam.github.io/docs/FFD/main.pdf, 2021. +[59] Simiao Ren, Willie Padilla, and Jordan Malof. Benchmarking deep inverse models over time, and the neural-adjoint method. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 38–48. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper/2020/file/007ff380ee5ac49ffc34442f5c2a2b86-Paper.pdf. +[60] Li Rhie, C Chow. Numerical study of the turbulent flow past an airfoil with trailing edge separation. AIAA Journal, 21(11):1525-1532, 1983. +[61] Reuven Y Rubinstein and Dirk P Kroese. The cross-entropy method: A unified approach to monte carlo simulation, randomized optimization and machine learning. Information Science & Statistics, Springer Verlag, NY, 2004. +[62] Alvaro Sanchez-Gonzalez, Nicolas Heess, Jost Tobias Springenberg, Josh Merel, Martin Ried-miller, Raia Hadsell, and Peter Battaglia. Graph networks as learnable physics engines for inference and control. In International Conference on Machine Learning, pages 4470-4479. PMLR, 2018. +[63] Alvaro Sanchez-Gonzalez, Jonathan Godwin, Tobias Pfaff, Rex Ying, Jure Leskovec, and Peter Battaglia. Learning to simulate complex physics with graph networks. In International Conference on Machine Learning, pages 8459-8468. PMLR, 2020. +[64] Connor Schenck and Dieter Fox. Spnets: Differentiable fluid dynamics for deep neural networks. Conference on Robot Learning (CoRL), 2018. +[65] Ney Secco, Gaetan K. W. Kenway, Ping He, Charles A. Mader, and Joaquim R. R. A. Martins. Efficient mesh generation and deformation for aerodynamic shape optimization. AIAA Journal, 2021. +[66] Wuxin Sha, Yan Li, Shun Tang, Jie Tian, Yuming Zhao, Yaqing Guo, Weixin Zhang, Xinfang Zhang, Songfeng Lu, Yuan-Cheng Cao, and Shijie Cheng. Machine Learning in polymer informatics. InfoMat, 3(4):353-361, 2021. +[67] Robert W Shumaker, Kristina R Walkup, and Benjamin B Beck. Animal tool behavior: the use and manufacture of tools by animals. JHU Press, 2011. +[68] Jasper Snoek, Hugo Larochelle, and Ryan P Adams. Practical bayesian optimization of machine learning algorithms. In F. Pereira, C.J. Burges, L. Bottou, and K.Q. Weinberger, editors, Advances in Neural Information Processing Systems, volume 25. Curran Associates, Inc., 2012. URL https://proceedings.neurips.cc/paper/2012/file/05311655a15b75fab86956663e1819cd-Paper.pdf. +[69] Erik Talvitie. Model regularization for stable sample rollouts. In UAI, pages 780-789, 2014. +[70] Marc A Toussaint, Kelsey Rebecca Allen, Kevin A Smith, and Joshua B Tenenbaum. Differentiable physics and stable modes for tool-use and manipulation planning. In Proceedings of the Robotics: Science and Systems, RSS 2018, 2018. + +[71] Brandon Trabucco, Aviral Kumar, Xinyang Geng, and Sergey Levine. Conservative objective models for effective offline model-based optimization. In International Conference on Machine Learning, pages 10358-10368. PMLR, 2021. +[72] Arun Venkatraman, Martial Hebert, and J Andrew Bagnell. Improving multi-step prediction of learned time series models. In Twenty-Ninth AAAI Conference on Artificial Intelligence, 2015. +[73] Tingwu Wang, Xuchan Bao, Ignasi Clavera, Jerrick Hoang, Yeming Wen, Eric Langlois, Shunshi Zhang, Guodong Zhang, Pieter Abbeel, and Jimmy Ba. Benchmarking model-based reinforcement learning. arXiv preprint arXiv:1907.02057, 2019. +[74] Christopher K Williams and Carl Edward Rasmussen. Gaussian processes for machine learning, volume 2. MIT press Cambridge, MA, 2006. +[75] Jie Xu, Tao Chen, Lara Zlokapa, Wojciech Matusik, Shinjiro Sueda, and Pulkit Agrawal. An end-to-end differentiable framework for contact-aware robot design. Robotics: Science and Systems, 2021. +[76] Sunwoong Yang, Sanga Lee, and Kwanjung Yee. Inverse design optimization framework via a two-step deep learning approach: application to a wind turbine airfoil. Engineering with Computers, 2022. doi: 10.1007/s00366-022-01617-6. URL https://doi.org/10.1007/s00366-022-01617-6. +[77] Sihyun Yu, Sungsoo Ahn, Le Song, and Jinwoo Shin. Roma: Robust model adaptation for offline model-based optimization. Advances in Neural Information Processing Systems, 34, 2021. +[78] Li Zheng, Siddhant Kumar, and Dennis M. Kochmann. Data-driven topology optimization of spinoid metamaterials with seamlessly tunable anisotropy. Computer Methods in Applied Mechanics and Engineering, 383:113894, 2021. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] See e.g. failure cases in Section D.3.1 and Discussion. +(c) Did you discuss any potential negative societal impacts of your work? [No] We didn't identify anything specific to this paper, the same considerations as for most work in ML apply (e.g. cost/impact of compute). +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [N/A] +(b) Did you include complete proofs of all theoretical results? [N/A] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] The core model we use (MeshGraphNets) has an open-source implementation available, as do the solvers we used to for the task domains (cited in the paper). Detailed description of the task setup can be found in Appendix C. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Appendix A, Appendix B. +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] + +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [No] We didn't calculate the total amount; but model training was done on typical hardware (up to 4 TPUv3/v100 GPUs, see Appendix B). + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] We didn't use any data, but cite the model, and solvers used for the task domains. +(b) Did you mention the license of the assets? [No] All of them are available under open-source licenses. +(c) Did you include any new assets either in the supplemental material or as a URL? [No] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/inversedesignforfluidstructureinteractionsusinggraphnetworksimulators/images.zip b/inversedesignforfluidstructureinteractionsusinggraphnetworksimulators/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..e7a51e08158957fdf1047859990dfb326b872564 --- /dev/null +++ b/inversedesignforfluidstructureinteractionsusinggraphnetworksimulators/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aca1b659536f48282c9c626b0344b6c8fdbf4f086e49d4643f51a0138f2b62b1 +size 302619 diff --git a/inversedesignforfluidstructureinteractionsusinggraphnetworksimulators/layout.json b/inversedesignforfluidstructureinteractionsusinggraphnetworksimulators/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..63d2601d22f8cc5c11b7d0dc38fec259e63efefe --- /dev/null +++ b/inversedesignforfluidstructureinteractionsusinggraphnetworksimulators/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:54c6276cefaa453d65f6be5ca1de1dc53ec39ebf3e220cc2b25590da38d3698b +size 511941 diff --git a/inversegametheoryforstackelberggamestheblessingofboundedrationality/1b67a2f9-b23d-4f58-91ee-d81bad956321_content_list.json b/inversegametheoryforstackelberggamestheblessingofboundedrationality/1b67a2f9-b23d-4f58-91ee-d81bad956321_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..99de12609e0a8c3bc61e5ed0417cfa1c9931ada8 --- /dev/null +++ b/inversegametheoryforstackelberggamestheblessingofboundedrationality/1b67a2f9-b23d-4f58-91ee-d81bad956321_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6861643f1ec57e313c0d674743158ad5a292dac8af8bebbe2c2c1acbc7631431 +size 82975 diff --git a/inversegametheoryforstackelberggamestheblessingofboundedrationality/1b67a2f9-b23d-4f58-91ee-d81bad956321_model.json b/inversegametheoryforstackelberggamestheblessingofboundedrationality/1b67a2f9-b23d-4f58-91ee-d81bad956321_model.json new file mode 100644 index 0000000000000000000000000000000000000000..45409d2630fc99f7d3641d04844c2b51427564d7 --- /dev/null +++ b/inversegametheoryforstackelberggamestheblessingofboundedrationality/1b67a2f9-b23d-4f58-91ee-d81bad956321_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce12086d0c79ea0a0394563b6a9d67a09349bdfebc136fad040decec954879f0 +size 105806 diff --git a/inversegametheoryforstackelberggamestheblessingofboundedrationality/1b67a2f9-b23d-4f58-91ee-d81bad956321_origin.pdf b/inversegametheoryforstackelberggamestheblessingofboundedrationality/1b67a2f9-b23d-4f58-91ee-d81bad956321_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7eda64b62edfcdace1735b9349608b46fc34914c --- /dev/null +++ b/inversegametheoryforstackelberggamestheblessingofboundedrationality/1b67a2f9-b23d-4f58-91ee-d81bad956321_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:065e6ba1aaa1dbe98057e25cd4652374e3da5223e37d25f3275112a98d07a359 +size 3694980 diff --git a/inversegametheoryforstackelberggamestheblessingofboundedrationality/full.md b/inversegametheoryforstackelberggamestheblessingofboundedrationality/full.md new file mode 100644 index 0000000000000000000000000000000000000000..72a4afb94f209a45f902521de2a226377228f087 --- /dev/null +++ b/inversegametheoryforstackelberggamestheblessingofboundedrationality/full.md @@ -0,0 +1,306 @@ +# Inverse Game Theory for Stackelberg Games: the Blessing of Bounded Rationality + +Jibang Wu + +Department of Computer Science + +University of Chicago + +wujibang@uchicago.edu + +Fei Fang + +Institute for Software Research + +Carnegie Mellon University + +feif@cmu.edu + +Weiran Shen + +Gaoling School of Artificial Intelligence + +Renmin University of China + +shenweiran@ruc.edu.cn + +Haifeng Xu + +Department of Computer Science + +University of Chicago + +haifengxu@uchicago.edu + +# Abstract + +Optimizing strategic decisions (a.k.a. computing equilibrium) is key to the success of many non-cooperative multi-agent applications. However, in many real-world situations, we may face the exact opposite of this game-theoretic problem — instead of prescribing equilibrium of a given game, we may directly observe the agents' equilibrium behaviors but want to infer the underlying parameters of an unknown game. This research question, also known as inverse game theory, has been studied in multiple recent works in the context of Stackelberg games. Unfortunately, existing works exhibit quite negative results, showing statistical hardness [27, 37] and computational hardness [24, 25, 26], assuming follower's perfectly rational behaviors. Our work relaxes the perfect rationality agent assumption to the classic quantal response model, a more realistic behavior model of bounded rationality. Interestingly, we show that the smooth property brought by such bounded rationality model actually leads to provably more efficient learning of the follower utility parameters in general Stackelberg games. Systematic empirical experiments on synthesized games confirm our theoretical results and further suggest its robustness beyond the strict quantal response model. + +# 1 Introduction + +One primary objective of game theory is to predict the behaviors of agents through equilibrium concepts in a given game. In practice, however, we may observe some equilibrium behaviors of agents, but the game itself turns out to be unknown. For example, an online shopping platform can observe the shoppers' purchase decisions on different sale prices, but the platform has limited knowledge of the exact utilities of the shoppers. Similarly, while the policymaker could observe the market reactions to its policy announcement, the exact motives behind traders' reactions are usually unclear. In various security domains, the defender may want to understand the intentions or incentives of the attackers from their responses to different defense strategies so as to improve her future defense strategy. As such, recovering the underlying game parameters would not only lead us to better strategic decisions, but also improve our explications of the motives and rationale in the dark. + +These potentials and prospects motivate a class of research problems known as the inverse game theory [26]: given the agents' equilibrium behaviors, what are possible utilities that induce these behaviors? In this paper, we specifically target the sequential game setting from the perspective of the + +first-moving agent (e.g., Internet platform, policymaker, or defender) whose different strategies (e.g., price, regulation, or defense scheme) would induce different equilibrium behaviors of the following agent (e.g., Internet users, traders, or attacker). Studies of such game settings have seen broad impacts and extensive applications ranging from the principal-agent problems in contract design [21, 19], the AI Economist [43] to security games modeled for social good [16]. We formalize our problem under the normal form Stackelberg game, where a leader has the commitment power of a randomized strategy, and a follower accordingly decides his response. It is known that the optimal commitment of the leader can be efficiently computed in a single linear program, given full knowledge of the game [14]. However, the inverse learning problem to determine the underlying game from the follower's responses is more challenging: Letchford et al. [27], Peng et al. [37] show that learning optimal leader strategy from the follower's best responses requires number of samples that is a high-degree polynomial in the game size and may be exponential in the worst cases. This significantly limits the practicality of these algorithms, as the leader usually cannot afford the time or cost to gather feedback from so many interactions. + +More concerning is the inconvenient reality that we can hardly expect the agents' optimal equilibrium responses assumed in existing work. In fact, these shoppers, traders, or attackers themselves hardly know their exact utilities and are naturally unable to determine the expected-utility maximizing strategy. Extensive studies of behavioral economics and psychology [23, 5, 32, 11, 10] have pinpointed the cognitive limitations that make human decisions prone to the noisy perception of their utilities. Among various models for quantifying irrational agent behaviors, one of the most popular ones is perhaps the quantal response (QR) model [32], which adopts the well-known logit choice model to capture agents' probabilistic selection of actions. This will also be the bounded rationality model of our focus in this paper. + +The Blessing of Bounded Rationality. The key insight revealed from this paper is that the extra layer of behavioral complexity due to bounded rationality, while complicating the modeling and computation, provides a more informative source for us to learn the underlying utility of agents. To understand the intuitions and motivations behind our results, consider a case where the follower has a dominated action $j_{1}$ as shown in Table I, where the leader's and follower's utility of action profile $(i,j)$ is specified by $u_{i,j}, v_{i,j}$ respectively. Conventionally, such an instance is treated as a degenerated instance, because the leader could ignore the action $j_{1}$ that a perfectly rational follower would never play. Then, the optimal leader strategy is clearly to always play the action $i_{2}$ . However, when facing a + +
ui,j,vi,jj1j2
i1100,0.90.9,1
i2-99,0.91.1,1
+ +Table 1: An example of dangerously "degenerated" Stackelberg game. + +boundedly rational follower, it becomes possible to observe the response $j_{1}$ and estimate the utilities regarding this dominated action. For example, if the follower plays his action $j_{1}$ and $j_{2}$ at almost the same frequency, the follower's expected utility on the two actions should be close. Although such dominated action has no effect on the leader's optimal strategy against a perfectly rational follower, it could be a potentially damaging (or beneficial) action that leader want to avoid (or encourage) a bounded rational follower to play. That is, in the above game instance, if a somewhat irrational follower plays action $j_{1}$ , it would be dangerous for the leader to play action $i_{2}$ yet rewarding to play action $i_{1}$ ; therefore, a more robust leader strategy should randomize by assigning some probability to play action $i_{1}$ . We remark that in general, even without such extreme case of dominated actions, the extra payoff information is now available on how much worse (or better) it is to use the empirical frequency of the boundedly rational action responses (as long as some smoothness properties are exhibited), which are overlooked under the assumption of perfectly rational followers. + +Our Results. We present a set of tight analysis on the number of strategies and sample complexity sufficient and necessary to learn the follower's utility, for both situations in which the leader can observe the follower's full mixed strategies or only the follower's sampled pure strategies. In the former situation of observing follower's mixed strategies, our algorithm can recover the follower utility parameters using $m$ follower mixed strategy responses in any general Stackelberg game where $m$ is the number of leader actions. Surprisingly, the required number of queries is independent of follower actions! This is due to the fact that the randomness introduced by bounded rationality carries much more information about follower payoffs, compared to the perfect best response. In the later + +(more realistic) situation of only observing follower's sampled pure strategy, our algorithm learns the follower utility parameters within precision $\epsilon$ with probability at least $\delta$ using $\Theta\left(\frac{m\log(mn / \delta)}{\rho\epsilon^2}\right)$ carefully chosen queries, where $n$ is the number of follower actions and $\rho$ depends on agent's bounded rationality level and is of order $\Theta(1/n)$ for typical boundedly rational agents. Interestingly, the additional challenge of only observing sampled actions only deteriorates the sample complexity by a factor of $\log(mn) / \rho$ . These sample completeness results should be compared with that of [37, 27], which study similar learning questions but from perfectly rational follower responses. The $m\log(mn) / \rho$ order in our sample complexity is in sharp contrast to their complexity with exponential dependence in $m$ or $n$ in the worst case. Our experimental results empirically confirm the tightness of our sample complexity analysis. + +At the conceptual level, our work illustrates that noises due to bounded rational behaviors could be leveraged as additional information sources to learn the follower utility. This intuition also drives the design of our analytical tools to explain how efficient and effective learning of the follower's utility is possible in real situations, in complementing the previous negative results developed under the idealized perfect rational behavior models [27, 37]. + +# 2 Related Work + +Learning in Stackelberg Game. The learning problem in sequential games has been studied in several different setups. Marecki et al. [30], Balcan et al. [7] consider the online learning problem in the Stackelberg security game with adversarially chosen follower types. Bai et al. [6] consider a bandit learning setting where one could query any entry of the followers' utility under noise and use the estimation of utility to approximate the optimal leader strategy; however, this learning process assumes centralization, that is, the learner can control both leader's and follower's actions. More similar to ours is the strategic learning setup in Stackelberg games studied by [27, 37, 9], where the leader adaptively chooses her strategies based on the observation of the follower's best response and eventually recovers the follower's utility up to some precision level. + +Bounded Rationality. McKelvey and Palfrey [32] introduced the quantal response equilibrium (QRE) by adopting the logit choice model [15, 31]. QRE serves as a strict generalization of Nash equilibrium (NE) — when the agents become perfectly rational, QRE converges to the NE. The modeling success of QR model attributes to the nice mathematical and statistical properties of the logit function that can capture a variety of boundedly rational behaviors under different parameter $\lambda$ . QRE is widely adopted especially in Stackelberg (security) games [42, 35, 39, 16, 20, 12] and zero-sum games [29] and notably has been deployed in various real world applications [2, 17]. Moreover, the model structure of QR has been also used in various other contexts, such as the softmax activation in neural network [18], multinomial logistic regression [8] and the multiplicative weight update algorithm for no-regret learning [3]. + +As an initial attempt to our general learning problem, we also adopt the QR model to capture our agent's bounded rational behavior, for its modeling success in practice and being the most common choice of prior work [42, 35, 16, 20, 12, 29, 2, 17]. We acknowledge that there exist other models of bounded rational behaviors beyond the QR model. For example, Kahneman [23] introduced the prospect theory to model the bounded rationality of agents in games under risk; Camerer et al. [11] proposed the cognitive hierarchy theory that classifies the agents according to their degree of reasoning in forming expectations of others. We anticipate that the message of our paper — i.e., the observation of suboptimal responses could provide additional information to learn the follower's preferences — would apply to many of these bounded rationality models. + +Inverse Game Theory. Vorobeychik et al. [40] considered the payoff function learning problem using the strategy profiles and the corresponding utilities through regression. Kuleshov and Schrijvers [26] introduced the concept of inverse game theory, and the authors showed that the problem of computing the agents' utilities from a set of correlated equilibrium is NP-Hard, unless the game is known to have special structures. More recently, the inverse game theory problem is studied under the QR model and leads to a few positive results: Sinha et al. [39] considers the offline PAC-learning setup where the follower responses can be predicted with small error for a fixed leader strategy + +distribution; Haghtalab et al. [20] proves only three strategies are sufficient to recover linear follower payoff functions in security games; Ling et al. [29] presents an end-to-end learning framework that learns the zero-sum game payoff from its QRE. Following their success, our paper is the first work that provides theoretical guarantee of payoff recovery in general Stackelberg game. Finally, inverse problems have received significantly more attention in single-agent decision making problems; The most notable problem is the inverse reinforcement learning pioneered by Ng et al. [34], Abbeel and Ng [1]. + +# 3 Problem Formulation + +Game Setup We consider the Stackelberg game between a single leader (she) and follower (he). We let $U \in \mathbb{R}^{m \times n}$ (resp. $V \in \mathbb{R}^{m \times n}$ ) be the leader (resp. follower's) utility matrix, where $m, n$ are the number of actions for the leader (resp. follower). We use $\mathcal{G}(U, V)$ to denote the game instance. Each entry $u_{i,j}$ (resp. $v_{i,j}$ ) of the utility matrix denotes the leader's utility (resp. follower's utility) when leader plays action $i$ and follower plays action $j$ . Without loss of generality, let $u_{i,j}, v_{i,j} \in [0,1]$ . Let $V_j \in \mathbb{R}^m$ be the $j$ th column of the matrix $V$ . We denote the set of the leader's (resp. follower's) action set by $[m] := \{1, \dots, m\}$ (resp. $[n] := \{1, \dots, n\}$ ). + +In this sequential game, the leader moves first by committing to a (possibly randomized) strategy, $\pmb{x} = (x_{1},\dots ,x_{m})\in \Delta_{m}$ , where the simplex $\Delta_m = \{\pmb {x}:\sum_{i\in [m]}x_i = 1$ and $0\leq x_{i}\leq 1\}$ and each $x_{i}$ represents the probability the leader playing action $i$ . Similarly, let $\Delta_n$ denote the follower's strategy space. Under perfect rationality, given the leader's committed strategy, the follower would in turns choose the best response action $j^{*}$ that maximizes his utility, i.e., $j^{*} = \operatorname{argmax}_{j\in [n]}\{\pmb{x}^{\top}V_{j}\}$ . In our problem, we use the QR model instead of capturing the follower's bounded rational behavior. That is, the follower would respond to the leader's committed strategy by choosing an strategy $y^{*}$ that maximizes his utility up to a Gibbs entropic regularizer, i.e., $y^{*} = \operatorname{argmax}_{y\in \Delta_{n}}\{\lambda x^{\top}Vy - y\ln y\}$ . This is shown to be equivalent to the setting where the follower is best responding according to the payoff perturbed by noises from a Gumbel distribution [22]. And we know the close form solution of follower's optimal strategy for this convex optimization program is exactly the logit choice model on the true payoff, i.e., for each $j\in [n]$ , $y_{j}^{*} = \frac{\exp(\lambda x^{\top}V_{j})}{\sum_{k\in[n]}\exp(\lambda x^{\top}V_{k})}$ [33]. + +We refer to $\lambda$ as the bounded rationality constant that is given in each specific problem, as several existing work have already determined its empirical value in practice: the human behavior experiments in [38, 41] compute $\lambda = 7.6$ ; the experiments [28, 36, 32] show $\lambda$ is in the range of 4 to 16. + +Learning Problem We consider the inverse game theory problem in sequential game with unknown follower utility and seek to quantify how much the leader can learn about a bounded rational follower's utility. We frame this problem under an active and strategic learning setup, where the leader can interactively choose a randomized strategy and observe follower's strategic responses. Specifically, at each round $t \in [T]$ , the leader commits to a strategy $x(t)$ . The follower observes the committed $x(t)$ and responds based on the QR strategy $y(t)$ . Below we will consider both feedback settings based on whether the leader is able to observe the exact distribution $y(t)$ or merely its samples. + +We set our primary learning objective as to recover a full characterization of the follower's utility; our results below shall explain how it is unnecessary and almost unrealistic to expect an exact recovery of the follower's utility. And we show in Observation $\square$ and Theorem $\square$ that such utility characterization can be used to compute the optimal leader strategy under both perfect rationality, known as the strong Stackelberg equilibrium (SSE), and bounded rationality, known as the quantal Stackelberg equilibrium (QSE). And besides developing the optimal (or robust) leader strategies, we believe the recovered utilities are generally useful for our better understanding and reasoning of the followers' motives. However, given the limited scope of the paper, we focus on the inverse game theory problems and defer the problems regarding how to strategize using the knowledge of game (i.e., the typical game-theoretical problems) to related and future work. + +Such learning problem has been considered in [20] specifically for Stackelberg security games, where the payoff is a strictly simplified single-dimensional linear utility function. Our paper overcomes the curse of dimensionality and answers the open question in recovering payoffs in the general Stackelberg game. On the other hand, Sinha et al. [39] showed a case of learning the nonparametric + +Lipschitz function (which includes the payoff function in the general Stackelberg game as a special case) in PAC-learning setup and they obtained a sample complexity exponential to the number of actions. Notably, the PAC-learning problem is fundamentally different from our active learning problem, as its learning guarantee is tied to the given data distribution and is not guaranteed to recover the follower's payoff. + +# 4 Theoretical Results + +# 4.1 Warm-up: Learning from Mixed Strategies + +As a warm-up, we first consider a rather ideal case where the leader can directly observe the follower's mixed strategy $\pmb{y}(t)$ . In this case, it turns out that the leader would be able to perfectly recover the follower's payoff matrix from his responses to $m$ different strategies and thereby determine the her optimal strategy. Despite a seemingly intuitive result, its underlying rationale is actually not as straightforward. Specifically, many would raise the following doubt: the logit transformation is not bijective and thus its inverse mapping is not injective; in particular, it only gives us a system of at most $n - 1$ different linear equations w.r.t. the follower's utility; one can check that if we add a constant to all entries of the utility matrix, the resulting probability distribution stays the same after the logit transformation. Thus, it should require more than $m$ such linear equation systems to recover a utility matrix with $m \times n$ unknown parameters. However, thanks to Observation [1], it happens that the follower's utility matrix can be fully characterized by $m \times (n - 1)$ parameters that is essentially the difference of each column in the utility matrix. This somewhat coincidentally compensates the missing information on follower utility due to the logit transformation. + +Knowing that $m$ strategies is the lower bound of this learning problem in general, below we will explicitly construct a learning algorithm that have the matching upper bound. To begin, a useful game-theoretic property of Stackelberg games is the following observation about the class of follower utilities that will induce the same leader and follower policies. While similar observation has been made in [20, 39], we also provide a formal proof in Appendix A for completeness. + +Observation 1 (Equilibrium Invariance under Payoff Transformation). For any $\widetilde{V} \in \{V + c \otimes 1_n | c \in \mathbb{R}^m\}$ , i.e., a row-wise shifted matrix of $V$ , the follower's quantal response (resp. best response) policy to leader's committed strategy remains the same, and thus the optimal leader strategy in SSE or QSE remains the same. + +Observation $\boxed{I}$ suggests that the row-wise shifted payoff matrix is just as good as the ground-truth payoff matrix in our setting. This essentially means that only the difference between action payoffs matters for the follower's policy. As such, we introduce a row-wise distance metric that accommodates such policy-invariant transformation to empirically measure the quality of the recovered follower utility. + +Definition 1 (Logit Distance). We define a logit distance between the ground truth follower utility $V$ and the recovered follower utility $\widetilde{V} \in \mathbb{R}^{m \times n}$ , $\Phi(V, \widetilde{V}) = \frac{1}{mn} \sum_{i \in [m]} \min_z \left\| V_i - \widetilde{V}_i - z \right\|_1$ . Whenever the distance $\Phi(V, \widetilde{V}) = 0$ , we say that the recovered follower utility is perfect. + +We next present a result that generalizes the well-known result, three strategies to success in security games, by Haghtalab et al. [20]. Notably, we identify a simple but fundamental condition (in terms of rank) necessary to recover the game payoffs, rather than the special distance conditions tailored to the structure of the security game as in [20]. The notion of rank has a clear physical meaning and we would later follow this theoretical insights to design learning algorithms to actively select leader strategies to query. + +Proposition 1 (m Strategies to Success). There exists a learning algorithm that can always perfectly recover the follower strategy from m queries of the follower's mixed strategies. + +Proof Sketch. We pick $m$ linearly independent basis vectors for each $\boldsymbol{x}(t)$ in $m$ rounds and argue that the following optimization program can perfectly recover the follower's utility matrix $\widetilde{V}$ . + +$$ +\begin{array}{l} \text {m i n i m i z e} \quad \sum_ {t \in [ m ]} \left[ \log \sum_ {j \in [ n ]} \exp z _ {j} (t) - \boldsymbol {y} (t) \cdot \boldsymbol {z} (t) \right] \tag {4.1} \\ \boldsymbol {z} (t) = \lambda \boldsymbol {x} (t) ^ {\top} \widetilde {V}, \quad \text {f o r} t \in [ m ]. \\ \end{array} +$$ + +We can see that the objective of the optimization program is a log-sum-exp function w.r.t. variables $\{\pmb{z}(t)\}_{t\in [m]}$ , which is convex. This means we can determine its minimizer set of $\{\pmb{z}(t)\}_{t\in [m]}$ . Meanwhile, the constraints of the optimization program gives a system of linear equation between $\{\pmb{z}(t),\pmb{x}(t)\}_{t\in [m]}$ and the variable $\widetilde{V}$ . But the solution of $\widetilde{V}$ is not unique, as the minimizer set of $\{\pmb{z}(t)\}_{t\in [m]}$ contains infinitely many elements. But it turns out that when $\{\pmb{x}(t)\}_{t\in [m]}$ forms an linearly independent basis of $\mathbb{R}^m$ , any solution $\widetilde{V}$ to the linear system given by any minimizer $\{\pmb{z}(t)\}_{t\in [m]}$ are guaranteed to have $\Phi (V,\widetilde{V}) = 0$ . We defer the full proof to Appendix B. + +![](images/e8f8312d53c9b8fbceaec083c9702c832c473d51a45d91796a6b726873af8132.jpg) + +# 4.2 More Realistic Situations: Learning from Realized Actions + +In this section, we consider the more challenging yet realistic scenario, where the leader is able to observe a single action from follower at each round, i.e., the best response w.r.t. his perceived utility under the Gumbel noise, or equivalently the realized action of the follower's quantal response strategy. It turns out that the intuitions from Section 4.1 still apply, and we are able to prove a strict generalization of these results. In particular, Theorem 1 strengthens Observation in that learning the follower's utility up to some logit distance could also lead to an approximation of the optimal leader strategy under some mild condition given by Definition 2 in general Stackelberg games. Theorem 2 generalizes Proposition 1 as we showcase the sample complexity of our learning framework to recover the follower's utility in face of the follower's stochastic responses. + +Definition 2 (Inducibility Gap). For any follower utility $V$ , we define its inducibility gap as + +$$ +\sigma (V) := \min _ {j \in [ n ]} \max _ {x \in \Delta_ {m}} \min _ {j ^ {\prime} \neq j} \boldsymbol {x} ^ {\top} V [ e _ {j} - e _ {j ^ {\prime}} ]. +$$ + +That is, the maximum constant $\sigma(V)$ such that for any follower actions $j \in [n]$ , there exists a leader strategy $\pmb{x}^j$ that makes $j$ dominate any other action $j'$ by a margin of at least $\sigma(V)$ , i.e., $\pmb{x}^j V e_j \geq \pmb{x}^j V e_{j'} + \sigma(V), \forall j' \neq j \in [n]$ . + +If a game has small inducibility gap $\sigma$ , then there must exist two follower actions $j, j'$ such that the follower's utility for action $j$ can never be $\delta$ better than his utility for action $j'$ , regardless of what strategies the leader play. In such cases, action $j$ is essentially dominated by $j'$ (up to at most $\delta$ ). It is not difficult to see that in such case with small $\delta$ it will be difficult to recover all the payoffs in such cases since action $j$ is expected to be played very rarely. This intuition is also reflected in our following two results. + +Theorem 1. Given a follower utility $\widetilde{V}$ with inducibility gap $\sigma(\widetilde{V}) > 5\epsilon$ , we can construct an $O(\epsilon / \sigma(\widetilde{V}))$ -optimal leader strategy for any game $\mathcal{G}(U, V)$ with logit distance $\Phi(\widetilde{V}, V) \leq \frac{\epsilon}{mn}$ . + +Proof Sketch. We prove through an explicit construction. That is, given the estimate of the follower's utility $\widetilde{V}$ , we construct a $\epsilon$ -robust strategy $\pmb{x} = (1 - \frac{3\epsilon}{\sigma(V)})\widetilde{\pmb{x}}^{*} + \frac{3\epsilon}{\sigma(V)}\widetilde{\pmb{x}}^{j^{*}}$ based on the SSE $(\widetilde{\pmb{x}}^{*},\widetilde{j}^{*})$ of $\mathcal{G}(U,\widetilde{V})$ and the strategy $\pmb{x}^{\widetilde{j}^{*}}$ such that $(\pmb{x}^{\widetilde{j}^{*}})^{\top}Ve_{\widetilde{j}^{*}}\geq (\pmb{x}^{\widetilde{j}^{*}})^{\top}Ve_{j^{\prime}} + \sigma (V),\forall j^{\prime}\neq \widetilde{j}^{*}$ . We show this strategy is guaranteed to be an $(\frac{6\epsilon}{\sigma(\widetilde{V}) - 2\epsilon})$ -SSE of the Stackelberg game $\mathcal{G}(U,V)$ . The proof then relies on two key observations stated in Lemma 1.1 and 1.2: First, given that $\Phi (\widetilde{V},V)\leq \frac{\epsilon}{mn}$ and $\sigma (V) > 3\epsilon$ , the best response of a robust strategy $\pmb{x}$ in game $\mathcal{G}(U,V)$ remains the same as that of a game $\mathcal{G}(U,\widetilde{V})$ , and so is the leader utility. This means $\pmb{x}$ gets at least $(1 - \frac{3\epsilon}{\sigma(V)})$ portion of SSE utility in $\mathcal{G}(U,\widetilde{V})$ . Second, the difference between the SSE utility in $\mathcal{G}(U,V)$ and $\mathcal{G}(U,\widetilde{V})$ are bounded by $\frac{3\epsilon}{\sigma(V)}$ . Meanwhile, even though $V$ is unknown to us, Lemma 1.3 shows that we can bound $\sigma (V)\geq \sigma (\widetilde{V}) - 2\epsilon$ , so we can use $\sigma (\widetilde{V}) - 2\epsilon$ to substitute $\sigma (V)$ . And this requires $\sigma (\widetilde{V})\geq 5\epsilon$ . + +Due to the space limit, we defer the full statement of the lemmas and proofs to the Appendix C. After restoring the connections between the logit distance and the leader's optimal equilibrium utility, we now show the relationship between the logit distance and sample complexity in the learning problem. We remark that by satisfying our full rank condition, this sample complexity result does not depend on any additional parameter on the distance of queried leader strategies, such as $\lambda, \nu$ in [20], both of which are only guaranteed to affect the sample complexity by polynomial (not necessarily linear) factors w.r.t. the number of targets. + +Theorem 2. It takes $\Theta\left(\frac{m\log(mn / \delta)}{\rho e^2}\right)$ queries of the follower's quantal response to recover the follower's utility $\widetilde{V}$ within the logit distance $\Phi (V,\widetilde{V}) = \frac{\epsilon}{\lambda}$ with probability at least $1 - \delta$ , where $\rho$ is the least non-zero measure among all of the follower's mixed strategies induced by leader's strategy queries during learning. + +This theorem is a strict generalization of Proposition $\boxed{1}$ and we defer the full proof to Appendix $\boxed{D}$ due to space limit. The high level intuition comes from the fact that $(1 - \epsilon)$ -multiplicative approximation guarantee is translated to $\epsilon$ additive error after the logarithmic transformation using the approximation that for small positive $\epsilon$ close to zero, we have $\ln \left(\frac{1}{1 - \epsilon}\right) = O(\epsilon)$ . And to obtain such $(1 - \epsilon)$ -multiplicative approximation of an mixed strategy, we use standard concentration results for a tight sample complexity bound. We formalize these statements and proofs in Lemma 2.1, 2.2. + +Lemma 2.1. There exists a learning algorithm that can recover the follower's utility $\widetilde{V}$ within the logit distance $\Phi(V, \widetilde{V}) = O\left(\frac{\epsilon}{\lambda}\right)$ from $m$ queries of the $(1 - \epsilon)$ -multiplicative approximation of the follower's mixed strategies. + +Lemma 2.2. For any discrete distribution $\mathbf{y}$ with support size $n$ and the least non-zero measure $\min_{i\in [n],y_i > 0}\{y_i\} \geq \rho$ , with $\Theta (\frac{\log(n / \delta)}{\rho\epsilon^2})$ samples, the corresponding empirical distribution $\widehat{\mathbf{y}}$ is an $(1 - \epsilon)$ -multiplicative approximation to $\mathbf{y}$ , with probability at least $1 - \delta$ . + +# 4.3 A Learning Framework of Practicality + +PURE, Less is More The above results lead to a simple but provably effective method, PURE; the name comes from the fact that it only uses the $m$ different pure strategies in $\Delta_{m}$ , $\{\pmb{x}(t)\}_{t\in [m]}$ . As specified in the proof of Theorem 2, it gathers the follower's sampled quantal responses of these pure strategies to estimate the corresponding empirical distributions $\{\widetilde{\pmb{y}}(t)\}_{t\in [m]}$ and solves for the $\widetilde{V}$ through the optimization program 4.1. While it is a seemingly naive learning algorithm, we would like to make a few crucial points on its unique advantages from both theoretical and practical perspectives. + +Theoretically, we know PURE is guaranteed to perfectly recover the follower utility in the setting of Section 4.1. More importantly, when randomness is present, PURE guarantees that the estimation error measured by the logit distance is always bounded as $O\left(\frac{\epsilon}{\lambda}\right)$ ; the Equation (D.1) in the proof of Theorem 2 suggests that the inverse of a general row-stochastic matrix $X$ and the error matrix $\beta$ could otherwise lead to possibly unbounded estimation error. + +Meanwhile, we anticipate that the simplicity of PURE would be especially valuable to its applicability in practice. First, the randomized leader strategies in many applications are difficult to be implemented precisely, because the followers may not have the perfect estimation of the leader's distributions of randomization. This means that observing the follower's responses to randomized leader strategies could be more noisy in nature. Second, it might be inappropriate and possibly forbidden for the learner (e.g., an Internet platform or policy marker) to frequently change its strategies (e.g., prices or policies). Instead, the deployment of PURE only requires the learner to observe the responses of only a small number of pure strategies at the population level. + +PURE for Structured Games We remark that the learning framework of PURE could be tailored to the special structures in Stackelberg game. For example, let us consider a celebrated variant, known as the Stackelberg security game. Namely, a leader (defender) commits to a randomized allocation of security resource to defend a set of $n(= m)$ targets from a follower (attacker). In turn, the follower observes this randomized allocation and picks a target to attack. Both the leader and the follower receive payoffs depending on the target that was attacked and the probability that it was defended. So in this case the follower utility can be expressed as linear functions, where each entry in vector $\boldsymbol{w}, \boldsymbol{b} \in \mathbb{R}^n$ denotes, respectively, the attacker's cost and reward on each target. When the leader defends each target with the randomized strategy $\boldsymbol{x} \in \Delta_n$ , if the follower attacks the target $j$ , he receives utility based on the cost w.r.t. the chance target $j$ is defended, and the reward for the attack, i.e., $V(\boldsymbol{x}, j) = w_j x_j + b_j$ . Then, we can use the learning framework of PURE that only solves for the linear utility function parameters using the optimization program [4.2]. This not only reduces the + +number of parameters to be learnt but also directly gives the reward and cost parameters of each targets. Our empirical experiments below suggest a significantly faster error convergence rate once the structure insights is brought into the learning framework. + +$$ +\begin{array}{l l} \text {m i n i m i z e} & \sum_ {t \in [ d ]} \left[ \log \sum_ {j \in [ n ]} \exp z _ {j} (t) - \widetilde {\boldsymbol {y}} (t) \cdot \boldsymbol {z} (t) \right] \\ & \boldsymbol {z} _ {j} (t) = \lambda \left(w _ {j} x _ {j} (t) + b _ {j}\right), & \text {f o r} j \in [ n ], t \in [ T ]. \end{array} \tag {4.2} +$$ + +PURE-Exp for the Worst Cases In certain situations, however, the followers could be more rational and the parameter $\lambda$ is larger than the standard estimation. Then, the follower's stochastic quantal response becomes rather deterministic, and the least non-zero measure $\rho$ decreases. Lemma 2.2 suggests that querying through simple pure strategies could become much less inefficient in obtaining the $(1 - \epsilon)$ -multiplicative approximation of the actual strategy. Nevertheless, it turns out that we can introduce the "exploration and exploitation" principle here for the remedy, and we thus name such variant of PURE algorithm as PURE-Exp. Specifically, we introduce an exploration procedure to search for better strategies if an empirical estimation of the follower strategy tends to concentrate on a single action. We knew such strategy would contain more noise than information, as the error introduced by its multiplicative approximation ratio can be significant; reversing a one-hot distribution from logit transformation provides no information about the follower utility. In this case, we carefully replace it by a perturbed strategy from the original strategy. This ensures that the resulting strategy set after replacement still forms a full-rank matrix that ensures the invertibility necessary for a provably more effective recovery of $V$ in Theorem 2. Otherwise, the algorithm would continue to exploit the leader strategies to better estimate the follower responses. Our empirical experiments show substantial performance improvement by PURE-Exp in those extreme cases. + +# Algorithm 1 PURE-Exp + +1: Input: Game parameters $m, n, \lambda$ , QR oracle $\mathcal{O} : \Delta_m \to [n]$ and optimization program $\mathcal{Q}$ based on the game structure. +2: Initialization: $\mathcal{X}$ , a list of leader strategies where the $i$ -th strategy $\pmb{x}^{(i)} \gets [e_i]_{i \in [m]}$ ; $\mathcal{Y}$ , a list of empirical estimation of follower strategies w.r.t. $\pmb{x}^{(i)}$ ; set $i \gets 0$ . +3: for $t = 0,1,\dots ,T$ do +4: Use leader strategy $\pmb{x}^{(i)}$ from $\mathcal{X}$ to query for follower response $j \gets \mathcal{O}(\pmb{x}^{(i)})$ . +5: Update empirical estimation $\pmb{y}^{(i)}$ of the follower's QR strategy to $\pmb{x}^{(i)}$ . +6: if Probability mass of $\pmb{y}^{(i)}$ concentrates on a single action then +7: Sample a random perturbation $\widetilde{\pmb{x}}$ from simplex $\Delta_{m}$ +8: Replace $\pmb{x}^{(i)}$ in list $\mathcal{X}$ by the new strategy $\pmb{x}^{(i)}\gets \frac{1}{2}\widetilde{\pmb{x}} +\frac{1}{2} e_i$ +9: Reset the empirical estimator $\pmb{y}^{(i)}$ in $\mathcal{V}$ . +10: end if +11: Update $i \gets (i + 1) \mod m$ . +12: end for +13: Solve the optimization program $\mathcal{Q}$ for the best game parameters using $\mathcal{X},\mathcal{Y}$ . + +# 5 Experiment + +In this section, we seek to further understand the empirical implications of our learnability results. A major challenge when evaluating the learning performance is that the measures rely on the underlying ground truth utility. While there are several real world data collected in particular to understand the human behaviors and QR model [32, 38, 41, 35], they are sensitive, proprietary datasets in security domains that we are unfortunately unable to access. Moreover, these offline dataset only offer limited number of offline samples that can hardly be used in our active learning setup. Therefore, our experiments have to rely on synthesized game instances, from which we can construct oracles to respond to the active learning queries and accurately evaluate for the learning performance. As motivated in the previous section, we will use the logit distance in Definition 1 to empirically measure the quality of recovered follower utilities. We start by investigating the empirical performance of PURE in games synthesized using several sets of different parameters below. + +![](images/6683ad11a6a25d3ba3756b343b77831481863404f0b0cb0f443ccd968f428c80.jpg) +Figure 1: Recovering payoffs under varying parameters $m \times n$ (left), $\lambda$ (middle), $\alpha$ (right) + +![](images/55b3df1972b85eaf9f92438f348c9aca1587d9c3705ae91dca142dcc077057c5.jpg) + +![](images/0cc31ae643ba3c00d24e53addfe67b42993ecb63c1d19f728f99fbd8a1c0cf30.jpg) + +- The number of leader and follower actions $m, n$ : We compare the learning performance in game of varying sizes, while fixing the number of query $T = 10^{7}$ . In the left plot of Figure 1, the first trend to notice is that the error grows almost linear to $m$ , exactly as Theorem 2 predicts. Meanwhile, the error also grows as $n$ increases, as the error bound depends on $1 / \rho \geq n$ . In Appendix, we shows that $1 / \rho$ in average among those randomized generated game instances grows linearly with $n$ , which justifies the almost linear relation between the logit distance and $n$ . +- The level of bounded rationality $\lambda$ : We consider different $\lambda$ ranging from 0.5 to 16 estimated in prior human behavior experiments [32, 38, 41]. In the middle plot of Figure I, we display the convergence trend of logit distance in the number of queries. The PURE algorithm shows consistently good performance among these different $\lambda$ . On one hand, in games with the smaller $\lambda$ , the error tends to converge slower, as bounded by the $\frac{1}{\lambda \sqrt{t}}$ convergence rate implied by Theorem 2. On the other hand, the variance of error increases especially in the initial half of the timeline in games with larger $\lambda$ . This is explained by the fact that sample complexity of learning distribution up to $(1 - \epsilon)$ -multiplicative factor increases as the distribution concentrates when $\lambda$ increase. +- The payoff margin $\alpha$ : We generate the follower's utility matrix, $V = \alpha I + (1 - \alpha)\Xi$ , as a convex combination of diagonal matrix $I \in \mathbb{R}^{m \times n}$ and Gaussian random noise $\Xi$ normalized to $[0, 1]^{m \times n}$ such that the larger $\alpha$ , the follower are likely to have higher margin for his best response against each of the leader's action. In the right plot of Figure $\square$ , we can see a consistent trend of improving estimation of the follower's utility as query number increases across different levels of $\alpha$ . Interestingly, as the utility matrix becomes closer to the simple diagonal matrix, and the follower easily becomes less irrational, the convergence rate slows down; this again suggests our message on the blessing of bounded rationality that provides the stochasticity in follower's responses used as our additional information source. + +We also compare the performance of PURE and its variants introduced in Section 4.3 and the results closely match with our theoretical insights. In the left plot of Figure 2, we compare PURE using only 10 leader strategies with the standard offline learning setup using $10^{2}$ , $10^{3}$ or $10^{4}$ leader strategies with less samples in average and less accurate estimation of follower response for each leader strategy. We can see that the PURE significantly outperforms these offline learning setups, especially when $\lambda$ is smaller such that the response of follower tends to be more irrational and thus "noisy". In the middle plot of Figure 2, we study the learning performance of PURE in various security games with or without using the optimization program specialized for the game structure (in dotted or straight lines). The result suggests that the structure insights can be used for fast recovery of follower utility. In the right plot of Figure 2, we found that PURE-Exp, with the principle of exploration and exploitation, are able to improve the learning performance in the case when the follower appears to be more rational. However, its performance also degrades as $\lambda$ further increases and the problem becomes almost the perfect rationality setting that are proved to be statistically hard to learn [27, 37]. In the limit of space, please check out Appendix E for more descriptions and analysis of our experiments. + +# 6 Conclusion + +Two common assumptions of a typical game theory problem are: (1) the agents know the game parameters; (2) the agents are perfectly rational. Though these assumptions have enabled elegant mathematical models and fundamental theoretical insights, they could be limiting in some real-world scenarios. Our paper tackles the particular problem in sequential game-theoretical interactions without these two common assumptions. While similar inverse game theory problems under perfect rationality + +![](images/43211234c2e854f49e15909eaead1f8328e7b1a5aab70989b8a7fdee32743763.jpg) +Figure 2: Comparison of PURE v.s. offline data (left), PURE with or without structure insights (middle), PURE v.s. PURE-Exp (right). + +![](images/6ca9d0420b1da230cb98aaec9acbf66fffbcce127a5356848847f62355c3abbe.jpg) + +![](images/b70416d4c5658472b6eecaadf564941f7924dde8e6755b0b7cb0129d970ffc28.jpg) + +are shown to be statistically or computationally intractable, we made an intriguing finding in which relaxing us from these idealistic settings in turns lead us to a provably efficient learning guarantee. Therefore, we proposed the learning framework of PURE intended for fewer usage restrictions in real-world applications. In future work, we wish to extend our analysis and insights to more general game settings and other models of bounded rationality. + +# Acknowledgement + +We thank all the anonymous reviewers for their helpful comments. Co-author Haifeng Xu is supported in part by an ARO award W911NF-23-1-0030. Fei Fang was supported in part by NSF CAREER grant IIS-2046640. Weiran Shen gratefully acknowledges financial support from the National Natural Science Foundation of China (No. 62106273), the Fundamental Research Funds for the Central Universities, and the Research Funds of Renmin University of China. + +# References + +[1] Pieter Abbeel and Andrew Y Ng. Apprenticeship learning via inverse reinforcement learning. In Proceedings of the twenty-first international conference on Machine learning, page 1, 2004. +[2] Bo An, Fernando Ordóñez, Milind Tambe, Eric Shieh, Rong Yang, Craig Baldwin, Joseph DiRenzo III, Kathryn Moretti, Ben Maule, and Garrett Meyer. A deployed quantal response-based patrol planning system for the us coast guard. Interfaces, 43(5):400-420, 2013. +[3] Sanjeev Arora, Elad Hazan, and Satyen Kale. The multiplicative weights update method: a meta-algorithm and applications. Theory of computing, 8(1):121-164, 2012. +[4] Patrice Assouad. Deux remarques sur l'estimation. Comptes rendus des séances de l'Académie des sciences. Série 1, Mathématique, 296(23):1021-1024, 1983. +[5] Robert J Aumann. Rationality and bounded rationality. In Cooperation: Game-Theoretic Approaches, pages 219-231. Springer, 1997. +[6] Yu Bai, Chi Jin, Huan Wang, and Caiming Xiong. Sample-efficient learning of stackelberg equilibria in general-sum games. Advances in Neural Information Processing Systems, 34, 2021. +[7] Maria-Florina Balcan, Avrim Blum, Nika Haghtalab, and Ariel D Procaccia. Commitment without regrets: Online learning in stackelberg security games. In Proceedings of the sixteenth ACM conference on economics and computation, pages 61–78, 2015. +[8] Christopher M Bishop and Nasser M Nasrabadi. Pattern recognition and machine learning, volume 4. Springer, 2006. +[9] Avrim Blum, Nika Haghtalab, and Ariel D Procaccia. Learning optimal commitment to overcome insecurity. Advances in Neural Information Processing Systems, 27, 2014. +[10] Colin F Camerer. Behavioral game theory: Experiments in strategic interaction. Princeton university press, 2011. + +[11] Colin F Camerer, Teck-Hua Ho, and Juin-Kuan Chong. A cognitive hierarchy model of games. The Quarterly Journal of Economics, 119(3):861-898, 2004. +[12] Jakub Černý, Viliam Lisý, Branislav Bošanský, and Bo An. Computing quantal stackelberg equilibrium in extensive-form games. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 5260-5268, 2021. +[13] Herman Chernoff. A measure of asymptotic efficiency for tests of a hypothesis based on the sum of observations. The Annals of Mathematical Statistics, pages 493-507, 1952. +[14] Vincent Conitzer. On stackelberg mixed strategies. Synthese, 193(3):689-703, 2016. +[15] Gerard Debreu. Individual choice behavior: A theoretical analysis, 1960. +[16] Fei Fang, Peter Stone, and Milind Tambe. When security games go green: Designing defender strategies to prevent poaching and illegal fishing. In Twenty-fourth international joint conference on artificial intelligence, 2015. +[17] Fei Fang, Thanh H Nguyen, Rob Pickles, Wai Y Lam, Gopalasamy R Clements, Bo An, Amandeep Singh, Brian C Schwedock, Milin Tambe, and Andrew Lemieux. Paws—a deployed game-theoretic application to combat poaching. AI Magazine, 38(1):23-36, 2017. +[18] Ian Goodfellow, *Yoshua Bengio*, and Aaron Courville. *Deep learning*. MIT press, 2016. +[19] Sanford J Grossman and Oliver D Hart. An analysis of the principal-agent problem. In Foundations of insurance economics, pages 302-340. Springer, 1992. +[20] Nika Haghtalab, Fei Fang, Thanh Hong Nguyen, Arunesh Sinha, Ariel D Procaccia, and Milind Tambe. Three strategies to success: Learning adversary models in security games. 2016. +[21] Bengt Holmström. Moral hazard and observability. The Bell journal of economics, pages 74–91, 1979. +[22] Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with gumbel-softmax. arXiv preprint arXiv:1611.01144, 2016. +[23] Daniel Kahneman. Econometrica i ci. Econometrica, 47(2):263-291, 1979. +[24] Shankar Kalyanaraman and Christopher Umans. The complexity of rationalizing matchings. In International Symposium on Algorithms and Computation, pages 171-182. Springer, 2008. +[25] Shankar Kalyanaraman and Christopher Umans. The complexity of rationalizing network formation. In 2009 50th Annual IEEE Symposium on Foundations of Computer Science, pages 485-494. IEEE, 2009. +[26] Volodymyr Kuleshov and Okke Schrijvers. Inverse game theory: Learning utilities in succinct games. In International Conference on Web and Internet Economics, pages 413-427. Springer, 2015. +[27] Joshua Letchford, Vincent Conitzer, and Kamesh Munagala. Learning and approximating the optimal strategy to commit to. In International symposium on algorithmic game theory, pages 250-262. Springer, 2009. +[28] Bernhardt Lieberman. Human behavior in a strictly determined $3 \times 3$ matrix game. Behavioral Science, 5(4):317-322, 1960. +[29] Chun Kai Ling, Fei Fang, and J Zico Kolter. What game are we playing? end-to-end learning in normal and extensive form games. arXiv preprint arXiv:1805.02777, 2018. +[30] Janusz Marecki, Gerry Tesauro, and Richard Segal. Playing repeated stackelberg games with unknown opponents. In Proceedings of the 11th International Conference on Autonomous Agents and Multiagent Systems-Volume 2, pages 821–828, 2012. +[31] Daniel L McFadden. Quantal choice analysis: A survey. Annals of economic and social measurement, volume 5, number 4, pages 363-390, 1976. + +[32] Richard D McKelvey and Thomas R Palfrey. Quantal response equilibria for normal form games. Games and economic behavior, 10(1):6-38, 1995. +[33] Panayotis Mertikopoulos and William H Sandholm. Learning in games via reinforcement and regularization. Mathematics of Operations Research, 41(4):1297-1324, 2016. +[34] Andrew Y Ng, Stuart J Russell, et al. Algorithms for inverse reinforcement learning. In Icml, volume 1, page 2, 2000. +[35] Thanh Nguyen, Rong Yang, Amos Azaria, Sarit Kraus, and Milind Tambe. Analyzing the effectiveness of adversary modeling in security games. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 27, pages 718-724, 2013. +[36] Barry O'Neill. Nonmetric test of the minimax theory of two-person zerosum games. Proceedings of the national academy of sciences, 84(7):2106-2109, 1987. +[37] Binghui Peng, Weiran Shen, Pingzhong Tang, and Song Zuo. Learning optimal strategies to commit to. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 2149-2156, 2019. +[38] James Pita, Manish Jain, Milind Tambe, Fernando Ordónez, and Sarit Kraus. Robust solutions to stackelberg games: Addressing bounded rationality and limited observations in human cognition. Artificial Intelligence, 174(15):1142-1171, 2010. +[39] Arunesh Sinha, Debarun Kar, and Milind Tambe. Learning adversary behavior in security games: A pac model perspective. arXiv preprint arXiv:1511.00043, 2015. +[40] Yevgeniy Vorobeychik, Michael P Wellman, and Satinder Singh. Learning payoff functions in infinite games. Machine Learning, 67(1):145-168, 2007. +[41] Rong Yang, Christopher Kiekintveld, Fernando Ordonez, Milind Tambe, and Richard John. Improving resource allocation strategy against human adversaries in security games. In Twenty-Second International Joint Conference on Artificial Intelligence, 2011. +[42] Rong Yang, Fernando Ordonez, and Milind Tambe. Computing optimal strategy against quantal response in security games. In AAMAS, pages 847-854, 2012. +[43] Stephan Zheng, Alexander Trot, Sunil Srinivasa, Nikhil Naik, Melvin Gruesbeck, David C Parkes, and Richard Socher. The ai economist: Improving equality and productivity with ai-driven tax policies. arXiv preprint arXiv:2004.13332, 2020. + +# Checklist + +The checklist follows the references. Please read the checklist guidelines carefully for information on how to answer these questions. For each question, change the default [TODO] to [Yes], [No], or [N/A]. You are strongly encouraged to include a justification to your answer, either by referencing the appropriate section of your paper or providing a brief inline description. For example: + +- Did you include the license to the code and datasets? [Yes] See Section ?? +- Did you include the license to the code and datasets? [No] The code and the data are proprietary. +- Did you include the license to the code and datasets? [N/A] + +Please do not modify the questions and only use the provided macros for your answers. Note that the Checklist section does not count towards the page limit. In your paper, please delete this instructions block and only keep the Checklist section heading above along with the questions/answers below. + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] + +(b) Did you describe the limitations of your work? [Yes] See Section 1. +(c) Did you discuss any potential negative societal impacts of your work? [No] There is no foreseeable negative societal impacts of this work. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] +(b) Did you include complete proofs of all theoretical results? [Yes] Most of them in Appendix due to space limits + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] In the supplemental material +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Appendix E +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Appendix E + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [N/A] +(b) Did you mention the license of the assets? [N/A] +(c) Did you include any new assets either in the supplemental material or as a URL? [N/A] + +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/inversegametheoryforstackelberggamestheblessingofboundedrationality/images.zip b/inversegametheoryforstackelberggamestheblessingofboundedrationality/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..a0c2cc6d832ffe54359d04305fe9fb6616fbdce0 --- /dev/null +++ b/inversegametheoryforstackelberggamestheblessingofboundedrationality/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf573c57416c39d0a97b3d4939d3716bc260eb75094e909451c5188d426f00ff +size 109394 diff --git a/inversegametheoryforstackelberggamestheblessingofboundedrationality/layout.json b/inversegametheoryforstackelberggamestheblessingofboundedrationality/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..7d8457856f67a933e0206878b8779f0ce51906cf --- /dev/null +++ b/inversegametheoryforstackelberggamestheblessingofboundedrationality/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4ce205cdae6342a97e3bb0477406b14e367063793fe2a1077b6e4e3d01760622 +size 542773 diff --git a/invertiblemonotoneoperatorsfornormalizingflows/6b45258a-b970-4ef3-9641-fecc3232a277_content_list.json b/invertiblemonotoneoperatorsfornormalizingflows/6b45258a-b970-4ef3-9641-fecc3232a277_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..602cb54430261e27a8d02732534119ab03d1581f --- /dev/null +++ b/invertiblemonotoneoperatorsfornormalizingflows/6b45258a-b970-4ef3-9641-fecc3232a277_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e9a4aecd841093f422a0f2b5b717069896531e3362497f02f4bba0860378c3d8 +size 82044 diff --git a/invertiblemonotoneoperatorsfornormalizingflows/6b45258a-b970-4ef3-9641-fecc3232a277_model.json b/invertiblemonotoneoperatorsfornormalizingflows/6b45258a-b970-4ef3-9641-fecc3232a277_model.json new file mode 100644 index 0000000000000000000000000000000000000000..b5dbf24b4bdb202cad41328cb6973b3248b680ac --- /dev/null +++ b/invertiblemonotoneoperatorsfornormalizingflows/6b45258a-b970-4ef3-9641-fecc3232a277_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d23b5ce4fe08c1391901e482e54286522d5486c399afdb4e63d33f1b1f64aaeb +size 109584 diff --git a/invertiblemonotoneoperatorsfornormalizingflows/6b45258a-b970-4ef3-9641-fecc3232a277_origin.pdf b/invertiblemonotoneoperatorsfornormalizingflows/6b45258a-b970-4ef3-9641-fecc3232a277_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..4d09289998414981755930511a1654383f6b2f2f --- /dev/null +++ b/invertiblemonotoneoperatorsfornormalizingflows/6b45258a-b970-4ef3-9641-fecc3232a277_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:de4288de13002159f06c738a0c4a2c44be909d1adddec515d80ec29dfaca4c80 +size 3294572 diff --git a/invertiblemonotoneoperatorsfornormalizingflows/full.md b/invertiblemonotoneoperatorsfornormalizingflows/full.md new file mode 100644 index 0000000000000000000000000000000000000000..a16003f8160c50e66fdf3c1194fa4351f69c811b --- /dev/null +++ b/invertiblemonotoneoperatorsfornormalizingflows/full.md @@ -0,0 +1,406 @@ +# Invertible Monotone Operators for Normalizing Flows + +Byeongkeun Ahn $^{1}$ , Chiyoon Kim $^{1}$ , Youngjoon Hong $^{2*}$ , Hyunwoo J. Kim $^{1*}$ + +Korea University1, Sungkyunkwan University2 + +{byeongkeunahn, kimchiyoon, hyunwoojkim}@korea.ac.kr + +hongyj@skku.edu + +# Abstract + +Normalizing flows model probability distributions by learning invertible transformations that transfer a simple distribution into complex distributions. Since the architecture of ResNet-based normalizing flows is more flexible than that of coupling-based models, ResNet-based normalizing flows have been widely studied in recent years. Despite their architectural flexibility, it is well-known that the current ResNet-based models suffer from constrained Lipschitz constants. In this paper, we propose the monotone formulation to overcome the issue of the Lipschitz constants using monotone operators and provide an in-depth theoretical analysis. Furthermore, we construct an activation function called Concatenated Pila (CPila) to improve gradient flow. The resulting model, Monotone Flows, exhibits an excellent performance on multiple density estimation benchmarks (MNIST, CIFAR-10, ImageNet32, ImageNet64). Code is available at https://github.com/mlvlab/MonotoneFlows. + +# 1 Introduction + +Normalizing flows [1, 2] are a method for constructing complex distributions by transforming a probability density through a series of invertible transformations. Normalizing flows are trained using a plain log-likelihood function, and they are capable of exact density evaluation and efficient sampling. Applications include image generation [2, 3, 4, 5, 6, 7, 8], image super-resolution [9, 10, 11], image noise modelling [12, 13], audio synthesis [14, 15], anomaly detection [16, 17], and computational physics [18, 19, 20, 21], highlighting the importance of developing expressive normalizing flows. + +However, a major hurdle to designing normalizing flow architectures is that not only should each transformation be invertible but also its Jacobian determinant needs to be tractable [22, 23]. Despite multiple efforts to satisfy the aforementioned constraints [2, 3, 4, 24, 25], the expressive power of the normalizing flow transformations stays limited due to the adoption of specialized architectures [5]. + +In this regard, ResNet-based normalizing flows [5, 6, 7] are a compelling alternative since they do not impose any structural restrictions. However, they keep the Lipschitz constant of the residual branch less than 1 in order to ensure invertibility. As a result, the Lipschitz constant of each residual block is less than 2. This causes a serious issue on the expressive power since a large Lipschitz constant is often required in converting between distributions. A recent work [26] tackled this problem, but as we show in this paper, their method is equivalent to a simple rescaling of ResNet-based normalizing flows, which has a similar expressive power. + +In this work, we propose the approach of monotone operators to alleviate the Lipschitz constraint. More precisely, in order to parameterize monotone operators, we use the well-known fact from monotone operator theory: the Cayley operator of maximally monotone operators (MMOs) is a 1-Lipschitz function. The residual branch of ResNet-based normalizing flows can be used to parameterize the Cayley operators. + +![](images/68f1c1574131b9b1c2320bbeae8e9db0c4a38d960dab944aab1db55d48d4532a.jpg) +Figure 1: The duality between 1-Lipschitz operators (left) and monotone operators (right) in 1D. + +In summary, our contributions are as follows: + +- We propose Monotone Flows, which greatly loosens the Lipschitz constraint while retaining invertibility and architectural flexibility. +- We derive the monotone formulation, a monotone operator-based normalizing flow by parametrizing the Cayley operator, and provide efficient training and inference schemes. +- We propose a new activation function called Pila and its variant Concatenated Pila (CPila) to alleviate the saturated gradient problem. +- We theoretically analyze the expressive power of the monotone formulation and related models [6, 26], and prove our formulation outperforms the other models in practice. +- Monotone Flows consistently outperform comparable baseline normalizing flows on multiple image density estimation benchmarks as well as on 2D toy datasets. In addition, ablation studies demonstrate the effectiveness of the proposed methods. + +# 2 Preliminaries + +The monotone formulation is a normalizing flow that parametrizes monotone operators in terms of Cayley operators. The parametrization, which must be 1-Lipschitz, and the methods for log determinant computation, are borrowed from ResNet-based normalizing flows. Also, the resulting model is an implicit neural network involving inverse functions. Here, we briefly review these topics. + +Normalizing flows [1] explicitly model probability distributions by transforming a tractable source distribution, e.g., Gaussian, into a target distribution with a differentiable invertible transform $F: \mathbb{R}^n \to \mathbb{R}^n$ . Suppose $F$ maps a sample space $X$ to a latent space $Z$ . Given a source distribution $p_Z(z)$ , the change-of-variables theorem yields the log-likelihood of any $x \in X$ : + +$$ +\log p _ {X} (x) = \log p _ {Z} (z) + \log | \det J _ {F} |, \tag {1} +$$ + +where $z = F(x)$ and $J_{F} = \partial z / \partial x$ is the Jacobian. Normalizing flows are beneficial since the evaluation of (1) yields the exact density $p_{X}(x)$ . Furthermore, target data $x \sim p_{X}(x)$ can be efficiently sampled by first sampling $z \sim p_{Z}(z)$ and then mapping $z$ to $X$ by $x = F^{-1}(z)$ . When $F$ consists of multiple transformations applied in succession, each transformation is called a flow. + +ResNet-based normalizing flows have been initially proposed in i-ResNets [5], which are built with a variant of the residual blocks $R(x) = x + G(x)$ . By requiring $G(x)$ to be a contraction map, they ensured the invertibility of $R(x)$ with the Banach fixed point theorem. The contractiveness of $G(x)$ is implemented by spectral normalization [27] and 1-Lipschitz activation functions. However, they use a biased truncation of the log Taylor series for computing the log determinant. Residual Flows [6] address this issue with an unbiased estimator based on randomized truncation. They also introduce a new activation function LipSwish to avoid the gradient saturation problem. i-DenseNets [7] improve Residual Flows with a DenseNet variant accompanying learnable concatenation coefficients. They also introduce the Concatenated LipSwish activation function to further improve the gradient flow. + +Implicit neural networks map an input $x$ to an output $y$ through an implicit equation $F(x, y) = 0$ , in contrast with explicit models of the form $y = F(x)$ . The main advantage of implicit mappings is their ability to express a richer family of functions under the same parameter budget [28]. Implicit Flows [26] propose to use invertible implicit neural networks in normalizing flows and study an example where residual blocks and the inverse of residual blocks are stacked in an alternating fashion. + +Monotone operator $F: \mathbb{R}^n \to \mathbb{R}^n$ is an operator that satisfies $\langle u - v, x - y \rangle \geq 0$ for all $x, y \in \mathbb{R}^n$ and all $u \in F(x), v \in F(y)$ . This definition generalizes monotonic functions in $\mathbb{R}$ , to $\mathbb{R}^n$ . The resolvent of a monotone operator $F$ is defined as $R_F = (\mathrm{Id} + F)^{-1}$ , where $\mathrm{Id}$ is the identity operator. The Cayley operator of $F$ is defined as $C_F = 2R_F - \mathrm{Id}$ . It is well-known that the Cayley operators of monotone operators are exactly 1-Lipschitz operators. The Cayley operator can be interpreted as a 45-degrees rotation (up to constant scaling) of the corresponding monotone operator in $\mathbb{R}^n \times \mathbb{R}^n$ ; see Figure 1 for a 1D illustration. Minty surjectivity theorem ([29] and [30, Theorem 21.1]) shows that the Cayley operators of maximally monotone operators are exactly 1-Lipschitz functions, which are defined at every point. We formally state this correspondence in Theorem 2. See [31] for a survey and [30] for a comprehensive treatment on monotone operators. + +# 3 Monotone Flows + +In this section, we propose a novel approach, the monotone formulation, and describe the training and inference procedure. Moreover, we introduce a new activation function Concatenated Pila (CPila). + +# 3.1 Motivation from monotone operator theory + +ResNet-based normalizing flows consist of blocks of the form $R(x) = x + G(x)$ , where $G(x)$ is a parametrized neural network. If $G(x)$ is a contraction (the Lipschitz constant $\operatorname{Lip}(G) < 1$ ), the Banach fixed point theorem shows that $R(x)$ is invertible. In this case, $\operatorname{Lip}(R)$ is strictly less than 2, resulting in a severe limitation on the expressive power of the neural network $R$ since a large Lipschitz constant is required in general to transform the source distribution into the target distribution. + +However, as shown in the next example, $G(x)$ need not be a contraction for $R(x)$ to be invertible. + +Example 1. Consider $G_{1}(x) = 5x$ . Then, $R_{1}(x) = x + G_{1}(x) = 6x$ is invertible even though $G_{1}(x)$ is not a contraction. + +Hence, when considering a relaxed condition and parametrization, it is possible to enhance the expressive power to include a larger class of functions as in Example 1. For this, we introduce monotone operators which have been widely studied in the fields of functional analysis and partial differential equations. We first recall various definitions of the monotonicity of operators in $\mathbb{R}^n$ : + +Definition 1. Consider an operator $F:\mathbb{R}^n\to \mathbb{R}^n$ + +(i) $F$ is monotone if for all $x,y\in \mathbb{R}^n$ $\langle F(x) - F(y),x - y\rangle \geq 0$ +(ii) $F$ is strictly monotone if for all $x,y\in \mathbb{R}^n$ $(x\neq y)$ $\langle F(x) - F(y),x - y\rangle >0.$ +(iii) $F$ is $\eta$ -strongly monotone ( $\eta > 0$ ) if for all $x, y \in \mathbb{R}^n$ , $\langle F(x) - F(y), x - y \rangle \geq \eta \|x - y\|_2^2$ . +(iv) $F$ is maximally monotone if $F$ is monotone and not a proper subset of any monotone operator. + +It is noteworthy that monotonicity does not guarantee injectivity nor surjectivity, and strict monotonicity guarantees injectivity but not surjectivity. However, we have the following theorem: + +Theorem 1. An $\eta$ -strongly monotone continuous function $F: \mathbb{R}^n \to \mathbb{R}^n$ is invertible for any $\eta > 0$ . + +Proof. See Corollary 20.28 and Proposition 22.11 in [30]. + +Theorem 1 easily shows that $R_{1}(x)$ in Example 1 is invertible. Moreover, if $G(x)$ is $L$ -Lipschitz ( $L < 1$ ), $R(x)$ is $(1 - L)$ -strongly monotone (see Appendix A.1) and thus invertible by Theorem 1. + +As in Example 1, the ResNet-based formulation of normalizing flows does not include all possible invertible and monotone functions. To address this issue, we directly parameterize monotone operators in terms of their Cayley operators. We first formally state the rationale behind our construction. + +Theorem 2. Let $F: \mathbb{R}^n \to \mathbb{R}^n$ be an operator and $C_F = 2(\mathrm{Id} + F)^{-1} - \mathrm{Id}$ be its Cayley operator. Then the followings hold. + +(i) $F$ is monotone $\Leftrightarrow C_F$ is 1-Lipschitz. +(ii) $F$ is maximally monotone $\Leftrightarrow C_F$ is 1-Lipschitz and $\operatorname{dom} C_F = \mathbb{R}^n$ . + +Proof. See Proposition 23.8 and Proposition 4.4 in [30]. + +Theorem 2 shows that each 1-Lipschitz function characterizes a unique MMO since the Lipschitz continuity of $C_F$ implies $C_F$ is single-valued. Hence, the Lipschitz continuous parametrizations of the residual branch in ResNet-based models fit naturally for specifying $C_F$ . + +We now revisit Example 1 and apply Theorem 2. The Cayley operator of $R_{1}(x) = 6x$ is given by $C_{R_1}(x) = 2(\mathrm{Id} + R_1)^{-1}(x) - x = -(5 / 7)x$ , which is indeed 1-Lipschitz in accord with Theorem 2. + +In general, however, MMOs can be multivalued or undefined at some points. However, when the Cayley operator $C_F$ is an $L$ -Lipschitz function with $L < 1$ , then $F$ is $(1 - L) / (1 + L)$ -strongly monotone and $(1 + L) / (1 - L)$ -Lipschitz continuous; see Appendix A.8 for a complete derivation. Theorem 1 then implies $F$ is invertible. Hence, we use $L$ -Lipschitz functions for Cayley operators. + +# 3.2 Description of the monotone formulation + +Definition 2. Let $G: \mathbb{R}^n \to \mathbb{R}^n$ be a Lipschitz-continuous function with Lipschitz constant $L < 1$ . The monotone formulation of $G$ is defined as the following function $F: \mathbb{R}^n \to \mathbb{R}^n$ : + +$$ +F (x) = \left(\frac {\operatorname {I d} + G}{2}\right) ^ {- 1} (x) - x, \tag {2} +$$ + +where $\operatorname{Id}$ denotes the identity function. + +Here, $F$ is well-defined since $(\mathrm{Id} + G) / 2$ has a unique inverse by the Banach fixed point theorem [5]. The definition of $F$ is a direct application of Theorem 2. On the other hand, from the Cayley operator identity $C_F + C_{F^{-1}} = 0$ , we deduce that $F^{-1}$ has the Cayley operator $-G$ . Hence, if $y = F(x)$ , + +$$ +x = \left(\frac {\operatorname {I d} - G}{2}\right) ^ {- 1} (y) - y, \tag {3} +$$ + +which is well-defined by an analogous argument. Thus we arrive at the following theorem: + +Theorem 3. For each $G$ with $\operatorname{Lip}(G) < 1$ , there is a unique invertible function $F$ as in (2). + +Note that by rearranging (2) or (3), we obtain the implicit equation connecting $x$ and $y$ : + +$$ +x - y = G (x + y). \tag {4} +$$ + +To parametrize $G$ , we use the architecture proposed in i-DenseNets [7], but replace the activation function with a new function called Concatenated Pila (CPila), which we introduce later in the paper. + +Remark. While we parametrize each layer as a monotone operator, the resulting functions need not be monotone. For example, consider the $\pi /3$ counterclockwise rotation operator $R_{\pi /3}$ in $\mathbb{R}^2$ . Although $R_{\pi /3}$ is monotone, the composition of $R_{\pi /3}$ with itself is not monotone. This illustrates that monotone functions are not closed under composition, hinting neural networks generated by the composition of invertible monotone operators can represent a much broader class of invertible functions than just monotone operators. Indeed, functions of the monotone formulation are sup-universal diffeomorphism approximators since the monotone formulation includes the "nearly-Id" functions $(\mathcal{R}_L$ in section 4) whose composition suffices for sup-universal diffeomorphism approximation [32]. + +# 3.3 Training and inference + +Training and inference largely follow previous approaches developed in [6, 26] except for minor modifications to adapt them to our monotone formulation. For the function $F$ of Definition 2, implicit differentiation3 gives + +$$ +\log \det J _ {F} = \operatorname {t r} \left[ \log \left(I - J _ {G}\right) - \log \left(I + J _ {G}\right) \right], \tag {5} +$$ + +where $J_{G} = \partial G(w) / \partial w$ at $w = \left(\frac{\mathrm{Id} + G}{2}\right)^{-1}(x)$ ; see Appendix A.3 for derivation. Now, we construct an unbiased estimator of the log determinant using the Hutchinson trace estimator and the unbiased Russian roulette estimator, following the approach of [6]. Combining (1) and (5), + +$$ +\log p _ {X} (x) = \log p _ {Z} (z) + \mathbb {E} _ {n \sim p _ {N} (n), v \sim \mathcal {N} (0, I)} \left[ \sum_ {k = 1} ^ {n} \frac {(- 1) - (- 1) ^ {k + 1}}{k} \frac {v ^ {T} J _ {G} ^ {k} v}{P (N \geq k)} \right], \tag {6} +$$ + +![](images/c2c93d17a021cf0f0c1648a6e810e08ee33031a58f0b7f6058bb4f3b301fda5f.jpg) +Figure 2: Graphical illustrations of Pila and CPila. (a) The graph of Pila (red) and its first (green) and second derivatives (blue) with $k = 5$ . (b) The speed of the curve of CPila (red) with $k = 5$ and CLipSwish (green) with $\beta = 1$ . + +![](images/884a01c825329f137ce4f22079a013c2224d4d2a23ec750a47f94e543284787e.jpg) + +where $p_N(n)$ is a distribution with support over the positive integers. Note that the derivative of the log-likelihood (6) can be evaluated by the memory-efficient Neumann gradient estimator as in [6]. + +Training consists of forward and backward propagations using (2) and (6). For forward propagation, $F$ can be evaluated with fixed-point iterations since $G$ is a contraction mapping while it suffices to backpropagate through $(\operatorname{Id} + G)^{-1}$ since $F(x) = \left(\frac{\operatorname{Id} + G}{2}\right)^{-1}(x) - x = (\operatorname{Id} + G)^{-1}(2x) - x$ . For this, we follow the approach of [26]. Let $G$ be parametrized by $\theta$ . Denote the training objective (6) as $\ell$ and write $w = (\operatorname{Id} + G)^{-1}(u)$ (where $u = 2x$ ). Implicit differentiation yields + +$$ +\frac {\partial \ell}{\partial u} = \frac {\partial \ell}{\partial w} (I + J _ {G}) ^ {- 1}, \quad \frac {\partial \ell}{\partial \theta} = \left(\frac {\partial \ell}{\partial w} (I + J _ {G}) ^ {- 1}\right) \frac {\partial G}{\partial \theta}, \tag {7} +$$ + +where $G$ and $J_{G}$ are evaluated at $w = (\mathrm{Id} + G)^{-1}(u)$ ; see Appendix A.5 for derivation. Since the linear map $J_{G}: \mathbb{R}^{n} \to \mathbb{R}^{n}$ is a contraction mapping, the vector-matrix inverse product in (7) can be evaluated by a fixed-point iteration. For this, we adopt the secant method, but when convergence is not improved for 10 consecutive iterations, the Krasnoselskii-Mann iteration is used instead. + +Inference consists of forward propagation through (3), which is almost the same as the forward propagation in training except that the sign of $G$ is the opposite. + +# 3.4 Concatenated positive identity 1-Lipschitz activation function + +The LipSwish activation function proposed in [6] is based on the premise that having a non-vanishing second-order gradient would improve training. However, LipSwish still suffers from the vanishing gradient problem since its first-order derivative stays around 0.5 in the neighborhood of $x = 0$ where most of the preactivations would reside. Concatenated LipSwish (CLipSwish) [7] improves upon LipSwish by concatenating LipSwish(x) and LipSwish(-x), but a similar issue still occurs as shown in Figure 2 (b). + +In this regard, we propose Pila (positive identity 1-Lipschitz activation) function, which makes the gradient flow equal to the identity function on $x \geq 0$ during backpropagation. When $x < 0$ , Pila converges to zero as $x \to -\infty$ while matching the identity function at $x = 0$ up to the third derivative. The Pila function is described as follows: + +$$ +\operatorname {P i l a} (x) = \left\{ \begin{array}{l l} x & \text {i f} x \geq 0, \\ \left(\frac {k ^ {2}}{2} x ^ {3} - k x ^ {2} + x\right) e ^ {k x} & \text {i f} x < 0. \end{array} \right. \tag {8} +$$ + +Here, $k > 0$ is treated either as a fixed hyperparameter or a learnable parameter. In all of our experiments, we set $k = 5$ and do not learn $k$ . Note that $\mathrm{Lip}(\mathrm{Pila}) = 1$ for any $k > 0$ . + +As in [7], we introduce a concatenated version of Pila, which we call Concatenated Pila (CPila): + +$$ +\operatorname {C P i l a} (x) = \alpha_ {1} \left[ \operatorname {P i l a} \left(x - \alpha_ {2}\right), \operatorname {P i l a} (- x - \alpha_ {2}) \right] ^ {T}, \tag {9} +$$ + +where $\alpha_{1} = 1 / 1.06$ and $\alpha_{2} = 0.2$ . By rescaling and translating with $\alpha_{1}$ and $\alpha_{2}$ , we fabricate the CPila function to be 1-Lipschitz. Figure 2 (b) describes the speed of the curve, which shows CPila has a speed closer to 1 around $x = 0$ compared to the speed of CLipSwish. + +![](images/c2c5c3d5e50075e1931c5025e5a383f6c9d14e0f539fb9cddccf4584872ada60.jpg) +Figure 3: Comparison of $\mathcal{R}_L$ (blue), $\mathcal{I}_L$ (green), and $\mathcal{M}_L$ (red). The figure depicts the possible ranges of $q = F(x_1) - F(x_2)$ with respect to $p = x_1 - x_2$ for each function class, assuming the domain and the codomain of $F$ are both $\mathbb{R}^2$ . For visualization, we choose $L = 0.8$ and fix $p$ as a unit vector pointing in the $+y$ direction. + +# 4 Expressive power + +In this section, we analyze the expressive power of the monotone formulation and related models. We prove that the monotone formulation is superior to the residual formulation [6] and the implicit formulation of Lu et al. [26] when the Lipschitz constant $L$ of the $G$ -network is less than unity. In practice, since $L$ should not be close to unity, the monotone formulation is a better choice than the residual formulation or the implicit formulation of Lu et al. + +We start with a formal definition of the function classes of each model. + +Definition 3. For $0 \leq L < 1$ , we define the following function classes: + +$L$ -Lipschitz functions $\mathcal{G}_L = \big\{G\in C^2 (\mathbb{R}^n,\mathbb{R}^n)|\mathrm{Lip}(G) = L\}$ + +Residual formulation $\mathcal{R}_L = \{\mathrm{Id} + G|G\in \mathcal{G}_L\}$ + +Inverse residual formulation $\mathcal{I}_L = \left\{\left(\mathrm{Id} + \dot{G}\right)^{-1}|G\in \mathcal{G}_L\right\}$ + +Monotone formulation $\mathcal{M}_L = \left\{\left(\frac{\mathrm{Id} + G}{2}\right)^{-1} - \mathrm{Id}|G\in \mathcal{G}_L\right\}$ + +Here, $C^2(\mathbb{R}^n, \mathbb{R}^n)$ denotes the set of twice continuously differentiable functions. + +Note that the implicit formulation of Lu et al. [26] defines one block as the composition of two functions $F_2^{-1} \circ F_1$ for any $F_1, F_2 \in \mathcal{R}_L$ . We perform our analysis only on the second layers, which corresponds to the comparison between $\mathcal{R}_L$ and $\mathcal{I}_L$ . For convenience, we use the following notation. + +Definition 4. Let $A$ be one of $\mathcal{G}_L$ , $\mathcal{R}_L$ , $\mathcal{I}_L$ , or $\mathcal{M}_L$ , and $\alpha > 0$ . Then, + +$$ +\alpha A = \left\{\alpha F | F \in A \right\}, \quad \mathbb {R} ^ {+} A = \left\{\beta F | \forall \beta \in \mathbb {R} ^ {+}, F \in A \right\}. +$$ + +We now examine the relations between the function spaces. + +Theorem 4. For $0 \leq L < 1$ , the following holds. + +(i) $\mathcal{I}_L = \frac{1}{1 - L^2}\mathcal{R}_L$ , (ii) $\mathcal{M}_L = \frac{1 + L^2}{1 - L^2}\mathcal{R}_{\frac{2L}{1 + L^2}}$ , (iii) $\mathcal{R}_L \subsetneq \mathcal{M}_L$ , (iv) $\mathcal{I}_L \subsetneq \mathcal{M}_L$ . + +Proof. See Appendix A.6 for a complete proof. + +Figure 3 shows the ranges of $q = F(x_{1}) - F(x_{2})$ with respect to $p = x_{1} - x_{2}$ for $\mathcal{R}_L, \mathcal{I}_L$ , and $\mathcal{M}_L$ , clearly demonstrating the relations (i)-(iv) of Theorem 4. + +Theorem 4 shows the inverse residual formulation $\mathcal{I}_L$ can only express functions that are a constant multiple of the functions expressed by the residual formulation $\mathcal{R}_L$ . Hence, the inverse residual formulation has no advantage over the residual formulation in this respect. On the other hand, the monotone formulation $\mathcal{M}_L$ can express functions that are not expressible by any constant multiple of the functions in $\mathcal{R}_L$ , because $2L / (1 + L^2) > L$ whenever $L < 1$ . + +When $L$ can approach unity arbitrarily close, the monotone formulation has the same expressive power as the residual formulation or the inverse residual formulation. However, this is not possible + +in practice because the variance of the log determinant estimator (6) diverges to infinity when $L$ is greater than a specific threshold less than unity that depends on the distribution $p_N(n)$ [33]. Since the log determinant estimator (6) is a linear combination of the log determinant estimator of the same $G$ -network's residual formulation, (6) has a finite variance whenever the corresponding residual formulation's estimator possesses a finite variance. Suppose the constraints, in practice, bound the Lipschitz constant of the $G$ -networks to be at most $L_{\mathrm{max}} < 1$ . Then, the residual formulation gives rise to $\mathbb{R}^{+}\mathcal{R}_{L_{\mathrm{max}}}$ whereas the monotone formulation provides $\mathbb{R}^{+}\mathcal{M}_{L_{\mathrm{max}}} = \mathbb{R}^{+}\mathcal{R}_{\frac{2L_{\mathrm{max}}}{1 + L_{\mathrm{max}}^2}} \supseteq \mathbb{R}^{+}\mathcal{R}_{L_{\mathrm{max}}}$ . + +An analogous argument holds for $\mathbb{R}^{+}\mathcal{I}_{L_{\max}}$ . Hence, the analysis shows that the monotone formulation outperforms the other formulations in terms of the expressive power. + +# 5 Related work + +Normalizing flows. Normalizing flows require each layer to be invertible and the Jacobian determinant of each layer to be tractable, which have spurred multiple approaches for architecture design. Restricted Jacobian models introduce specific structures to the Jacobian to make the Jacobian determinants tractable. They include determinant identity-based models [1, 25] which use the Weinstein-Aronszajn identity with reduced intermediate layer dimensions, and coupling-based models [2, 3, 4, 34, 35] which split the input into two parts and transform one part conditioned on another. However, the restrictions on the Jacobian limit their expressivity. In contrast, free-form Jacobian models are not subject to the same constraints and include ResNet-based models (discussed in section 2) and Neural ODEs. Neural ODEs [36] parametrize the rate of change in ODEs with neural networks. They ensure invertibility through the existence and uniqueness theorem of ODEs. However, they have relatively high time complexity since they require solving ODEs numerically on every iteration. + +So far, the normalizing flows we have discussed are non-autoregressive models. In contrast, autoregressive models [37, 38, 39] decompose probability distributions as conditional distributions depending only on the previous values. While autoregressive models typically achieve higher log-likelihoods, they are orders of magnitudes slower to train or sample [4]. Therefore, we focus on non-autoregressive models in our paper. + +Monotone operators in neural networks. [40] pioneers monotone operator neural networks to assure the convergence of fixed-point iterations in implicit depth networks. They build linear monotone operators by parametrizing the symmetric and antisymmetric parts separately. Positive definiteness is enforced only on the symmetric part. One shortcoming is that the construction is limited to linear monotone operators, which our work addresses using nonlinear Cayley operators. [41] proposes the first neural network model of nonlinear MMOs by parametrizing the Cayley operators. One key difference is that the 1-Lipschitz constraint on Cayley operators is enforced through a penalty loss, which may fail to control the Lipschitz constant globally [5]. Our method systematically ensures 1-Lipschitzness by the use of spectral normalization [27] and 1-Lipschitz activations, following [5, 6, 7]. Also, their work does not consider normalizing flows. To the best of our knowledge, our work proposes the first normalizing flow based on monotone operators. + +# 6 Experiments + +We start by validating the modeling capacity of our model with a 1D toy function. We then evaluate Monotone Flows on density estimation of 2D toy and image datasets and conduct ablation studies. In all experiments, we parameterize the $G$ -network in Definition 2 using i-DenseNets [7] with our activation function CPila (except for the 1D toy experiments that use CReLU and for part of the ablation study where we ablate CPila). The $G$ -network consists of fully-connected layers for 1D and 2D toy tasks and convolutional layers for image tasks. We use the Poisson distribution for $p_N(n)$ whenever the estimator (6) is used. We use Adam [42] for all experiments. + +# 6.1 Toy 1D experiments + +Figure 4 illustrates the expressive power of the monotone formulation with a 1D toy example. We fit a 1D function that consists of four consecutive step-like shapes designed to exhibit a high Lipschitz constant. We consider four different 2-layer networks, as shown in Figure 4. Experimental details + +![](images/75953780b5656177e01a087b948c094cab60e923cc4d07267cfd24ae0c84a2e7.jpg) +(a) 2 RBs w/o LS + +![](images/ba8d94c2a485596c37f99ab2844436f5def4960764b74b73040d687085d390a6.jpg) +(MSE: $1.6 \times 10^{-2}$ ) +(b) 2 RBs w/ LS +(MSE: $5.8 \times 10^{-3}$ ) + +![](images/37fb09ed00f440dc9ec8faf287f68cc2a8578d3e8cc707390ad175f8411d0ce8.jpg) +(c) $1\mathrm{RB} + 1$ IRB w/ LS +(MSE: $4.5 \times 10^{-3}$ ) + +![](images/bed4fe408e02ee1d0c559e8367dd7af747a25947edb9d19c43e0357a4feb12a5.jpg) +(d) 2 MBs w/ LS +(MSE: $7.6 \times 10^{-5}$ ) + +![](images/4d76f7177000d758e6c9a12396bbe2a2660fb83f7d76cbd562bbe31f4651ada7.jpg) +Figure 4: Comparison of 2 RBs without learnable scaling, 2 RBs, 1 RB followed by 1 IRB, and 2 MBs. All experiments except (a) are performed with learnable scaling (LS). Blue and red lines represent the target function and the approximation by neural networks, respectively. +Figure 5: 2D toy density modeling results (full results in Appendix D). + +Table 1: Toy density modelling results in nats. We display the average of the test loss for the last 20 tests at checkpoints (iterations 48100, 48200, ..., 50000) for a single run. + +
Datai-DenseNetMonotone Flow
2 Spirals2.7292.658
8 Gaussians2.8402.840
Checkerboard3.6093.540
Circles3.2803.276
Moons2.4012.400
Pinwheel2.3432.333
Rings2.8842.665
Swissroll2.6802.676
+ +are discussed in Appendix C.1. We denote residual block, inverse residual block, and monotone block by RB, IRB, and MB. Note that the learnable scaling (LS) is used only for Figure 4 (b)-(d). The $G$ -networks in the experiments (a)-(d) have the same structure, and hence the same number of parameters are used. Consequently, differences in the result solely come from the differences in the formulations. Figure 4 (a) and (b) demonstrate that the expressive power is improved when using $\mathbb{R}^{+}\mathcal{R}_{L}$ instead of $\mathcal{R}_L$ . Figure 4 (b) and (c) reveal that the expressive power of $\mathbb{R}^{+}\mathcal{R}_{L}$ and $\mathbb{R}^{+}\mathcal{I}_{L}$ are similar, in agreement with Theorem 4. Figure 4 (d) shows that our monotone formulation $\mathbb{R}^{+}\mathcal{M}_{L}$ exceedingly outperforms the other networks. + +# 6.2 Density estimation on 2D toy data + +We use the 2D toy datasets provided with the official source code of i-DenseNets [7]. Following [7], we use ten flow blocks (see Appendix C.2 for details). Exact Jacobian evaluation is used instead of the stochastic estimation (6) as it is inexpensive for 2D data. We train the models for $50\mathrm{K}$ epochs with the learnable concatenation of i-DenseNets enabled after $25\mathrm{K}$ epochs. We use a batch size of 500. + +Qualitative and quantitative results in Figure 5 and Table 1 show that Monotone Flows outperform i-DenseNets in almost all settings, especially on challenging datasets. One limitation of normalizing flows manifests in the qualitative results. For instance, in the dataset 'rings', the circles cannot be closed because normalizing flows are required to preserve topology. Despite the inherent restriction, our model finds an excellent approximation. + +# 6.3 Density estimation on images + +We evaluate our method on MNIST [43], CIFAR-10 [44], and the downscaled version of ImageNet in $32 \times 32$ and $64 \times 64$ [45].6 We use (6) for estimating the Jacobian determinant. We use uniform + +Table 2: Density estimation results on images in bits-per-dimension (bpd) with the number of parameters of each model. All numbers except for the last row are with uniform dequantization. VDQ: variational dequantization. + +
ModelMNISTCIFAR-10ImageNet32ImageNet64
bpd ↓paramsbpd ↓paramsbpd ↓paramsbpd ↓params
Real NVP [3]1.06-3.496.4M4.2846.0M3.9896.0M
Glow [4]1.05-3.3544.2M4.0966.1M3.81111.1M
FFJORD [36]0.99-3.40-----
i-ResNet [5]1.06-3.4544.2M----
Residual Flow [6]0.9716.6M3.2825.2M4.0147.1M3.7653.3M
i-DenseNet [7]--3.2524.9M3.9847.0M--
Monotone Flow0.92820.9M3.21524.9M3.96147.0M3.73448.9M
Monotone Flow + VDQ--3.06246.9M3.90169.0M--
+ +![](images/ba409a41a436a27f00f8ba24853c1ae6cb2fff06261efb6834c80f9ea4878111.jpg) +(a) CIFAR-10 train data. + +![](images/b7d011b1f7c72190827c737e49b49ee236dd00d808e7b2a18d678e35fe921299.jpg) +(b) Monotone Flows trained on CIFAR-10. + +![](images/0d9059ebbc514a55a911e5ae0ff90395ae9fa52664bc068627a0c6daecb1006e.jpg) +(c) ImageNet32 train data. + +![](images/4ec978061f5d2ba3ec7cb99332f141128aadb8ddd4b11f9bcefae5eb8e6af672.jpg) +(d) Monotone Flows trained on ImageNet32. +Figure 6: Train data and generated samples of CIFAR-10 and ImageNet32. + +dequantization for both training and testing. For MNIST and CIFAR-10, the learnable concatenation is enabled after 25 epochs; for ImageNet32 and ImageNet64, it is enabled from the start. We train for 100, 1,000, 20, 20 epochs with batch sizes 64, 64, 256, 256 with learning rates 0.001, 0.001, 0.004, 0.004 for MNIST, CIFAR-10, ImageNet32, ImageNet64, respectively. We report single-seed results following [4, 5, 6, 7]. Details are in Appendix C.3. Samples from the trained models are displayed in Figure 6. More samples can be found in Appendix E. + +Table 2 shows our model outperforms baselines on all datasets considered, demonstrating the effectiveness of our proposal. In concrete numbers, our model reduces 0.042 bpd in MNIST, 0.035 bpd in CIFAR-10, 0.019 bpd in ImageNet32, and 0.023 bpd in ImageNet64 compared to baseline normalizing flow models. + +Remark on comparison. Flow++ [34] introduced variational dequantization which improves the log-likelihood, reporting 3.08 and 3.86 bits/dim on CIFAR-10 and ImageNet32, respectively. With variational dequantization, Monotone Flows achieve 3.062 and 3.901 bits/dim on the same benchmarks. Also, there is a line of research that achieves better likelihood values by introducing latent variables in extra dimensions, at the cost of losing exact likelihood computation [46, 47, 48]. On the other hand, ScoreFlow [49] achieves better likelihood values by training with a weighted score-matching objective that lower bounds the log likelihood. We leave it for future research to adapt these methods for Monotone Flows. + +# 6.4 Ablation study + +Our model has two new components: the monotone formulation and CPila activation function. We quantify their contributions by ablating either of the two components while leaving the other intact. When ablating the monotone formulation (row #2), we used the residual connections of [7]; when ablating CPila (row #3), we used CLipSwish instead. Table 3 compares the performance of i-DenseNets (row #1) and the ablated models on the CIFAR-10 dataset under the same experimental setup as in section 6.3. Details are in Appendix C.5. Results confirm that both components are + +Table 3: Ablation study for density estimation on CIFAR-10. MFL: monotone formulation. + +
#MFLCPilabpd ↓
1××3.252
2×✓3.243
3✓×3.229
4✓✓3.215
+ +beneficial for achieving a low bits-per-dimension (bpd). The monotone formulation provides a higher performance gain (0.028 bpd) than CPila (0.014 bpd). + +# 7 Conclusion + +We presented Monotone Flows, a novel parametrization of normalizing flows based on monotone operators (the monotone formulation) combined with a new activation function called Concatenated Pila (CPila). Our theoretical analysis elucidated why the monotone formulation is more expressive than the residual or inverse residual formulations. Experimental results demonstrated the effectiveness of the proposed method on various density estimation benchmarks. We believe our contribution is a solid step towards improving the expressivity of normalizing flows. + +# Acknowledgments and Disclosure of Funding + +Our work is supported by ICT Creative Consilience program (IITP-2022-2020-0-01819) supervised by the IITP, and Kakao Brain Corporation. The work of Y. Hong was supported by Basic Science Research Program through the National Research Foundation of Korea (NRF) funded by the Ministry of Education (NRF-2021R1A2C1093579) and the Korea government (MSIT) (No. 2022R1A4A3033571). + +# References + +[1] Danilo Rezende and Shakir Mohamed. Variational inference with normalizing flows. In ICML, 2015. +[2] Laurent Dinh, David Krueger, and Yoshua Bengio. Nice: Non-linear independent components estimation. In ICLR Workshop, 2015. +[3] Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. Density estimation using real nvp. In ICLR, 2017. +[4] Durk P. Kingma and Prafulla Dhariwal. Glow: Generative flow with invertible 1x1 convolutions. In NeurIPS, 2018. +[5] Jens Behrmann, Will Grathwohl, Ricky T. Q. Chen, David Duvenaud, and Jorn-Henrik Jacobsen. Invertible residual networks. In ICML, 2019. +[6] Ricky T. Q. Chen, Jens Behrmann, David K. Duvenaud, and Jorn-Henrik Jacobsen. Residual flows for invertible generative modeling. In NeurIPS, 2019. +[7] Yura Perugachi-Diaz, Jakub Tomczak, and Sandjai Bhulai. Invertible densenets with concatenated lipswish. In NeurIPS, 2021. +[8] Chin-Wei Huang, Ricky T. Q. Chen, Christos Tsirigotis, and Aaron Courville. Convex potential flows: Universal probability distributions with optimal transport and convex optimization. In ICLR, 2021. +[9] Andreas Lugmayr, Martin Danelljan, Luc Van Gool, and Radu Timofte. Srflow: Learning the super-resolution space with normalizing flow. In ECCV, 2020. +[10] Younghyun Jo, Sejong Yang, and Seon Joo Kim. Srflow-da: Super-resolution using normalizing flow with deep convolutional block. In CVPR Workshop, 2021. +[11] Andreas Lugmayr, Martin Danelljan, Fisher Yu, Luc Van Gool, and Radu Timofte. Normalizing flow as a flexible fidelity objective for photo-realistic super-resolution. In WACV, 2022. +[12] Abdelrahman Abdelhamed, Marcus Brubaker, and Michael Brown. Noise flow: Noise modeling with conditional normalizing flows. In ICCV, 2019. +[13] Yang Liu, Zhenyue Qin, Saeed Anwar, Pan Ji, Dongwoo Kim, Sabrina Cadwell, and Tom Gedeon. Invertible denoising network: A light solution for real noise removal. In CVPR, 2021. + +[14] Jaehyeon Kim, Sungwon Kim, Jungil Kong, and Sungroh Yoon. Glow-tts: A generative flow for text-to-speech via monotonic alignment search. In NeurIPS, 2020. +[15] Ryan Prenger, Rafael Valle, and Bryan Catanzaro. Waveglow: A flow-based generative network for speech synthesis. In ICASSP, 2019. +[16] Marco Rudolph, Tom Wehrbein, Bodo Rosenhahn, and Bastian Wandt. Fully convolutional cross-scale-flows for image-based defect detection. In WACV, 2022. +[17] Denis Gudovskiy, Shun Ishizaka, and Kazuki Kozuka. Cflow-ad: Real-time unsupervised anomaly detection with localization via conditional normalizing flows. In WACV, 2022. +[18] M. S. Albergo, G. Kanwar, and P. E. Shanahan. Flow-based generative models for markov chain monte carlo in lattice field theory. Phys. Rev. D, 100:034515, August 2019. +[19] Christina Gao, Stefan Hoche, Joshua Isaacson, Claudius Krause, and Holger Schulz. Event generation with normalizing flows. Phys. Rev. D, 101:076002, April 2020. +[20] Benjamin Nachman and David Shih. Anomaly detection with density estimation. Phys. Rev. D, 101:075042, April 2020. +[21] Jonas Kohler, Andreas Kramer, and Frank Noe. Smooth normalizing flows. In NeurIPS, 2021. +[22] Ivan Kobyzev, Simon J. D. Prince, and Marcus A. Brubaker. Normalizing flows: An introduction and review of current methods. IEEE Trans. Pattern Anal. Mach. Intell., 43(11):3964-3979, 2021. +[23] George Papamakarios, Eric T. Nalisnick, Danilo Jimenez Rezende, Shakir Mohamed, and Balaji Lakshminarayanan. Normalizing flows for probabilistic modeling and inference. J. Mach. Learn. Res., 22:57:1-57:64, 2021. +[24] Emiel Hoogeboom, Victor Garcia Satorras, Jakub Tomczak, and Max Welling. The convolution exponential and generalized sylvester flows. In NeurIPS, 2020. +[25] You Lu and Bert Huang. Woodbury transformations for deep generative flows. In NeurIPS, 2020. +[26] Cheng Lu, Jianfei Chen, Chongxuan Li, Qiuhao Wang, and Jun Zhu. Implicit normalizing flows. In ICLR, 2021. +[27] Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. In ICLR, 2018. +[28] Shaojie Bai, J. Zico Kolter, and Vladlen Koltun. Deep equilibrium models. In NeurIPS, 2019. +[29] George J. Minty. Monotone (nonlinear) operators in hilbert space. Duke Math J., 29(3):341-346, September 1962. +[30] Heinz H. Bauschke and Patrick L. Combettes. Convex analysis and monotone operator theory in Hilbert spaces. Springer, Cham, 2011. +[31] Ernest K. Ryu and Stephen Boyd. A primer on monotone operator methods. Appl. Comput. Math., 15(1):3-43, 2016. +[32] Takeshi Teshima, Isao Ishikawa, Koichi Tojo, Kenta Oono, Masahiro Ikeda, and Masashi Sugiyama. Coupling-based invertible neural networks are universal diffeomorphism approximators. In NeurIPS, 2020. +[33] Robert Cornish, Anthony L. Caterini, George Deligiannidis, and Arnaud Doucet. Relaxing bijectivity constraints with continuously indexed normalising flows. In ICML, 2020. +[34] Jonathan Ho, Xi Chen, Aravind Srinivas, Yan Duan, and Pieter Abbeel. Flow++: Improving flow-based generative models with variational dequantization nd architecture design. In ICML, 2019. + +[35] Conor Durkan, Artur Bekasov, Iain Murray, and George Papamakarios. Neural spline flows. In NeurIPS, 2019. +[36] Will Grathwohl, Ricky T. Q. Chen, Jesse Bettencourt, and David Duvenaud. Scalable reversible generative models with free-form continuous dynamics. In ICLR, 2019. +[37] Chin-Wei Huang, David Krueger, Alexandre Lacoste, and Aaron Courville. Neural autoregressive flows. In ICML, 2018. +[38] Durk P. Kingma, Tim Salimans, Rafal Jozefowicz, Xi Chen, Ilya Sutskever, and Max Welling. Improved variational inference with inverse autoregressive flow. In NeurIPS, 2016. +[39] George Papamakarios, Theo Pavlakou, and Iain Murray. Masked autoregressive flow for density estimation. In NeurIPS, 2017. +[40] Ezra Winston and J. Zico Kolter. Monotone operator equilibrium networks. In NeurIPS, 2020. +[41] Jean-Christophe Pesquet, Audrey Repetti, Matthieu Terris, and Yves Wiaux. Learning maximally monotone operators for image recovery. SIAM J. Imaging Sci., 14(3):1206-1237, 2021. +[42] Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015. +[43] Li Deng. The mnist database of handwritten digit images for machine learning research. IEEE Signal Process. Mag., 29(6):141-142, 2012. +[44] Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical report, 2009. +[45] Aäron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. In ICML, 2016. +[46] Jianfei Chen, Cheng Lu, Biqi Chenli, Jun Zhu, and Tian Tian. VFlow: More expressive generative flows with variational data augmentation. In ICML, 2020. +[47] Chin-Wei Huang, Laurent Dinh, and Aaron Courville. Augmented normalizing flows: Bridging the gap between generative flows and latent variable models. arXiv:2002.07101. +[48] Matej Grcic, Ivan Grubišić, and Siniša Šegvic. Densely connected normalizing flows. In NeurIPS, 2021. +[49] Yang Song, Conor Durkan, Iain Murray, and Stefano Ermon. Maximum likelihood training of score-based diffusion models. In NeurlPS, 2021. +[50] Giovanni S. Alberti and Luigi Ambrosio. A geometrical approach to monotone functions in $\mathbb{R}^n$ . Math. Z., 230:259-316, 1999. +[51] M. D. Kirschbraun. Über die zusammenziehenden und lipschitzschen transformationen. Fund. Math., 22:77-108, 1934. + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] In Appendix. +(c) Did you discuss any potential negative societal impacts of your work? [Yes] In Appendix. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] +(b) Did you include complete proofs of all theoretical results? [Yes] In Appendix. + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] In the supplementary material. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] In Appendix. +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] We use single-seed results following [4, 5, 6, 7]. +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] In Appendix. + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] In section 6.3. +(b) Did you mention the license of the assets? [No] +(c) Did you include any new assets either in the supplementary material or as a URL? [N/A] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/invertiblemonotoneoperatorsfornormalizingflows/images.zip b/invertiblemonotoneoperatorsfornormalizingflows/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..775859935fa053e37e6919d13ba6a0b660e37b1a --- /dev/null +++ b/invertiblemonotoneoperatorsfornormalizingflows/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9460d7f499814ef9781bcb34a59ec22dc17a9481613b0ddfc91243349123af66 +size 348636 diff --git a/invertiblemonotoneoperatorsfornormalizingflows/layout.json b/invertiblemonotoneoperatorsfornormalizingflows/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..943899cf793ea23c62020697ebe3bb29d62372c1 --- /dev/null +++ b/invertiblemonotoneoperatorsfornormalizingflows/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:64a1fbc289f6488731c08518eaadcbca9acded1cccd4121b8ce318ee089e75d8 +size 590814 diff --git a/ironprivateinferenceontransformers/b47b2e50-416d-40ff-bfe9-5c5b1d81afc7_content_list.json b/ironprivateinferenceontransformers/b47b2e50-416d-40ff-bfe9-5c5b1d81afc7_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..e79453755a9069e3b0f52091f6bc3f2a45d619cf --- /dev/null +++ b/ironprivateinferenceontransformers/b47b2e50-416d-40ff-bfe9-5c5b1d81afc7_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cbb04a775aa01eff3bc35488108717589dbd9f6bacaacd6a4ad21d8fdbd487e3 +size 89889 diff --git a/ironprivateinferenceontransformers/b47b2e50-416d-40ff-bfe9-5c5b1d81afc7_model.json b/ironprivateinferenceontransformers/b47b2e50-416d-40ff-bfe9-5c5b1d81afc7_model.json new file mode 100644 index 0000000000000000000000000000000000000000..52170cdd4f21f720649a836dfdc139fea23576e3 --- /dev/null +++ b/ironprivateinferenceontransformers/b47b2e50-416d-40ff-bfe9-5c5b1d81afc7_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:31cb38959176b009ca0bd17404c0c2e82f34bee60d2cf65e9e44db0cf5c03611 +size 115573 diff --git a/ironprivateinferenceontransformers/b47b2e50-416d-40ff-bfe9-5c5b1d81afc7_origin.pdf b/ironprivateinferenceontransformers/b47b2e50-416d-40ff-bfe9-5c5b1d81afc7_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..f39d1f3e4be002c9c07d68bbae44d87fdac38f96 --- /dev/null +++ b/ironprivateinferenceontransformers/b47b2e50-416d-40ff-bfe9-5c5b1d81afc7_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f88e3b4ef22539978c1075ab6ff49381978d646ebeb1532b58e0b63118128134 +size 855722 diff --git a/ironprivateinferenceontransformers/full.md b/ironprivateinferenceontransformers/full.md new file mode 100644 index 0000000000000000000000000000000000000000..5fb7cf03de05f4365e91a45b48a385cecde28020 --- /dev/null +++ b/ironprivateinferenceontransformers/full.md @@ -0,0 +1,344 @@ +# Iron: Private Inference on Transformers + +Meng Hao $^{1*}$ Hongwei Li $^{1\dagger}$ Hanxiao Chen $^{1}$ Pengzhi Xing $^{1}$ Guowen Xu $^{2}$ Tianwei Zhang $^{2}$ + +1University of Electronic Science and Technology of China +2Nanyang Technological University +{menghao,hanxiao.chen,p.xing}@std.uestc.edu.cn +hongweili@uestc.edu.cn +{guowen.xu,tianwei.zhang}@ntu.edu.sg + +# Abstract + +We initiate the study of private inference on Transformer-based models in the client-server setting, where clients have private inputs and servers hold proprietary models. Our main contribution is to provide several new secure protocols for matrix multiplication and complex non-linear functions like Softmax, GELU activations, and LayerNorm, which are critical components of Transformers. Specifically, we first propose a customized homomorphic encryption-based protocol for matrix multiplication that crucially relies on a novel compact packing technique. This design achieves $\sqrt{m} \times$ less communication ( $m$ is the number of rows of the output matrix) over the most efficient work. Second, we design efficient protocols for three non-linear functions via integrating advanced underlying protocols and specialized optimizations. Compared to the state-of-the-art protocols, our recipes reduce about half of the communication and computation overhead. Furthermore, all protocols are numerically precise, which preserve the model accuracy of plaintext. These techniques together allow us to implement Iron, an efficient Transformer-based private inference framework. Experiments conducted on several real-world datasets and models demonstrate that Iron achieves $3 \sim 14 \times$ less communication and $3 \sim 11 \times$ less runtime compared to the prior art. + +# 1 Introduction + +Transformer-based models [1-5] have realized tremendous success in the fields of natural language processing (NLP) and computer vision (CV) due to their strong representation capabilities. As a new neural network architecture, the Transformer [1] mainly utilizes the self-attention mechanism to compute representations without sequence-aligned recurrence or convolution. Following this work, a number of Transformer variants, such as BERT [2] and GPT [3] in NLP, ViT [4] and Swin Transformer [5] in CV, have achieved state-of-the-art performance on lots of real-world tasks. + +The success of Transformers and other big models facilitates emerging inference services and applications [6, 7]. In particular, a service provider trains a complex model based on the Transformer, and deploys it as a paid inference service, e.g., machine translation and question answering. A client queries this service with his input samples and obtains the desired responses. Unfortunately, current inference systems suffer from serious privacy concerns [8]. On the one hand, clients need to send confidential inputs to the service provider, which could compromise the data privacy of these clients if the provider is untrusted. On the other hand, it is undesirable for the provider to distribute the proprietary Transformer-based model to clients, since he needs a large amount of data and computation resources to construct the model [9]. Therefore, there exists a gap between + +unprecedented performance and privacy constraints, which motivates our study of private Transformer inference. + +Private inference aims to protect server's model weights from clients, while guaranteeing that the server learns no information about clients' private inputs. Recently, private inference on traditional neural networks (e.g., convolutional neural networks) have been approached by using secure 2-party computation (2PC) techniques [10-14]. However, due to essentially different structures, private Transformer inference brings several new challenges. First, Transformer-based models use lots of high-dimensional matrix multiplications, rather than matrix-vector multiplications widely studied in prior works. While we can straightforwardly extend prior matrix-vector multiplication protocols to our setting, unfortunately, even the most efficient design [14] incurs heavy communication because of interacting a large amount of ciphertexts. Second, Transformer-based models use complex math functions like Softmax, GELU activations [15], and LayerNorm, in each block, rather than crypto-friendly non-linear functions such as ReLU and Maxpool. Existing methods either use precision-impaired high-order polynomial approximations [16, 11] or only support limited math functions for specific scenarios [17]. Even worse, all of these approaches are computationally intensive and often require a large amount of communication (for more related works, please refer to Appendix A.5). To facilitate the widespread adoption of Transformer-based inference services in privacy-critical scenarios, designing efficient protocols for the above complex operations is of paramount importance. + +In this paper, we design Iron, an efficient hybrid cryptographic framework for private Transformer inference without revealing any sensitive information about the server's model weights or clients' inputs. Iron contributes several new specialized protocols for the complicated operations in Transformers to alleviate the performance overhead. Specifically, we first propose a customized homomorphic encryption-based protocol for matrix multiplications. Our insight is to pack more plaintext inputs into a single ciphertext by devising a compact packing method, while preserving the functionality of matrix multiplication. Compared to the most efficient matrix-vector multiplication solution implemented in Cheetah [14], we can achieve $\sqrt{m} \times (m$ is the number of rows of the output matrix) improvement in terms of communication overhead, which is about $8 \times$ reduction for various Transformer models. Second, we carefully design efficient protocols for Softmax, GELU, and LayerNorm. These protocols are built upon SIRNN [17], the state-of-the-art cryptographic framework for private inference on recurrent neural networks, and make several customized optimizations, such as reducing the overhead of exponentiation in Softmax and simplifying GELU and LayerNorm. These optimizations achieve $1.3 \sim 1.8 \times$ less runtime and $1.4 \sim 1.8 \times$ less communication on three non-linear functions. Furthermore, these protocols are numerically precise, which preserve the model accuracy of plaintext. We also give a formal security proof for our designed protocols to demonstrate the security guarantee. + +Based on the above efficient components, we implement a private Transformer inference framework, Iron, and conduct end-to-end experiments with various BERT architectures [2] (BERT-Tiny, BERT-Medium, BERT-Base, and BERT-Large) on GLUE benchmarks [18]. Note that Iron is readily extended to other Transformer-based models (e.g., ViT) since they share very similar architectures and same operations. Experimental results show that Iron achieves $3 \sim 14 \times$ less communication and $3 \sim 11 \times$ less runtime costs over SIRNN on four BERT models. Moreover, compared with the general-purpose state-of-the-art framework MP-SPDZ [16], Iron has up to two orders of magnitude improvement in terms of both communication and computation efficiency. + +A concurrent work [19] proposed a privacy-preserving Transformer inference with homomorphic encryption, called THE-X. Below, we illustrate some important differences in terms of protocol design and security. (1) Protocol design. Our work aims to design new efficient protocols for the complex operations of Transformer-based models, while orthogonal to ours, THE-X replaces them with crypto-friendly operations. For example, THE-X replaces GELUs with simpler operations, i.e., ReLUs, and Softmax with the combination of ReLU and polynomials. (2) Security. Our work achieves more rigorous privacy protection than THE-X. Specifically, our work uses homomorphic encryption and secret sharing techniques to hide private information (including intermediate results) of all layers. Such rigorous privacy guarantee is in line with recent state-of-the-art private inference works [14, 17]. However, in THE-X, the inputs of each non-linear layer are leaked to the client, which may causes severe privacy leakages in real-world applications [13]. Therefore, our work may be used to enhance the security of THE-X. + +# 2 Preliminaries + +# 2.1 Threat Model + +As shown in the left part of Figure 1, Iron works in a general private inference scenario, where the server $P_0$ holds a Transformer-based model $M$ with private weights $w$ , while the client $P_1$ holds a private input $x$ . Our framework enables the client to query the server's inference service and learn the output of the model on its input, i.e., $M(w, x)$ . Same as prior works [14, 17], we consider an honest-but-curious adversary that passively corrupts either the server or the client, but not both. Such an adversary follows the protocol specification exactly, but may try to learn more information3 than allowed (e.g., the model's weights or inference inputs) via analyzing the data it receives. In Appendix A.1.2, we give a more formal description of the threat model for security analysis. + +# 2.2 Cryptographic Primitives + +All our protocols are built on the 2-out-of-2 additive secret sharing (ASS) technique [21, 22] over the ring $\mathbb{Z}_{2\ell}$ , in which an $\ell$ -bit input $x$ is split into two random shares $\langle x\rangle_0,\langle x\rangle_1$ , held by $P_{0}$ and $P_{1}$ , respectively, such that $x = \langle x\rangle_0 + \langle x\rangle_1 \bmod \mathbb{Z}_{2\ell}$ . When $\ell = 1$ , i.e., over $\mathbb{Z}_2$ , we use $\langle x\rangle^{\mathrm{B}}$ to denote boolean shares. In our protocols, we use $\langle x\rangle$ to denote that $P_{b}$ holds $\langle x\rangle_{b}$ for $b\in \{0,1\}$ . The security [21] guarantees that given a share $\langle x\rangle_0$ or $\langle x\rangle_1$ , the value of $x$ is perfectly hidden. This secret-sharing property is maintained throughout our private inference scheme. ASS naturally supports linear operations without communication. For instance, to compute $cx + y$ with the constant $c$ and secret shares $\langle x\rangle$ and $\langle y\rangle$ , $P_{b}$ can locally compute $\langle z\rangle_{b} = c\langle x\rangle_{b} + \langle y\rangle_{b}$ , where $\langle z\rangle_0 + \langle z\rangle_1 = cx + y\bmod 2^\ell$ . To achieve more functionalities under shared inputs, we require to invoke advanced homomorphic encryption or oblivious transfer techniques [22]. + +Notations. Let $x \nmid y$ means $x$ is not a divisor of $y$ . We use bold lower-case letters (e.g., $\mathbf{x}$ ) to represent vectors, and bold upper-case letters (e.g., $\mathbf{X}$ ) to denote matrices. Like prior works [17, 14], we encode inputs with the fixed-point representation denoted by Fix (refer to Appendix A.1.1 for details). Let $\mathbb{A}_{N,p}$ denote the set of integer polynomials $\mathbb{A}_{N,p} = \mathbb{Z}_p[x] / (x^N + 1)$ . We use the circumflex of lower-case letters (e.g., $\hat{a}$ ) to represent a polynomial, and $\hat{a}[i]$ to denote the $i$ -th coefficient of $\hat{a}$ . Given polynomials $\hat{x}, \hat{y} \in \mathbb{A}_{N,p}$ , the product $\hat{z} = \hat{x} \cdot \hat{y}$ over $\mathbb{A}_{N,p}$ is defined as + +$$ +\hat {z} [ i ] = \sum_ {0 \leq j \leq i} \hat {x} [ j ] \hat {y} [ i - j ] - \sum_ {i < j < N} \hat {x} [ j ] \hat {y} [ N - j + i ] \bmod p. \tag {1} +$$ + +Additively Homomorphic Encryption (AHE) [23, 24]. This encryption scheme additionally enables linearly homomorphic operations on ciphertexts. Specifically, an AHE scheme is a tuple of algorithms $\mathrm{AHE} = (\mathrm{KeyGen}; \mathrm{Enc}; \mathrm{Dec}; \mathrm{Eval})$ with the parameter $\{N, q, p\}$ and the following syntax: 1) $\mathrm{KeyGen}(1^k) \to (pk, sk)$ : on input a security parameter $\kappa$ , $\mathrm{KeyGen}$ is a randomized algorithm that outputs a public key $pk \in \mathbb{A}_{N,q}$ and a secret key $sk \in \mathbb{A}_{N,q}$ . 2) $\mathrm{Enc}(pk, \hat{m}) \to \hat{c}$ : the encryption algorithm $\mathrm{Enc}$ takes a plaintext polynomial $\hat{m} \in \mathbb{A}_{N,p}$ and encrypts it using $pk$ into a ciphertext polynomial $\hat{c} \in \mathbb{A}_{N,q}$ . 3) $\mathrm{Dec}(sk, \hat{c}) \to \hat{m}$ : on input $sk$ and a ciphertext $\hat{c}$ , the (deterministic) decryption algorithm $\mathrm{Dec}$ recovers the plaintext message $\hat{m}$ . 4) $\mathrm{Eval}(pk, \hat{c}_1, \hat{c}_2, \mathrm{func}) \to \hat{c}$ : on input $pk$ , two ciphertexts $\hat{c}_1, \hat{c}_2$ containing $\hat{m}_1, \hat{m}_2$ , and a linear function func, Eval outputs a new ciphertext $\hat{c}$ encrypting func $(\hat{m}_1, \hat{m}_2)$ . Let $\boxplus, \boxminus, \boxtimes$ denote homomorphic addition, homomorphic subtraction and homomorphic multiplication with a plaintext, respectively. Iron builds the matrix multiplication protocol on the Brakerski-Fan-Vercauteren (BFV) scheme [25, 26], which is one of the state-of-the-art lattice-based homomorphic encryption solutions. + +Oblivious Transfer. The 1-out-of- $k$ oblivious transfer (OT) [27] is denoted by $k\mathrm{-OT}_{\ell}$ , where one party is the sender with $k$ messages $x_0,\ldots ,x_{k - 1}\in \{0,1\}^\ell$ and the other party is the receiver with an index $i\in [k]$ . The receiver learns $x_{i}$ as the output, and the sender learns nothing. Additionally, we also use the 1-out-of-2 correlated OT, denoted by $2\mathrm{-COT}_{\ell}$ [28], which is defined as follows: the sender inputs a correlation $x\in \mathbb{Z}_{2^{\ell}}$ , the receiver inputs a choice bit $i\in \{0,1\}$ , and the protocol outputs a random element $r\in \mathbb{Z}_{2^{\ell}}$ to the sender and $r + i\cdot x$ to the receiver. $k\mathrm{-OT}_{\ell}$ and $2\mathrm{-COT}_{\ell}$ require $2\lambda +k\ell$ and $\lambda +\ell$ bits of communication, respectively, and are executed in 2 rounds. The OT protocols are widely used to build the underlying protocols [13, 17] in Figure 3 we rely on. + +![](images/3ab6a0b3379219a795e3cfef68d00f63302d138d1a5e8f234822f8c9a404b6d4.jpg) +Figure 1: Overview of private Transformer inference + +# 3 Overview + +# 3.1 Transformer Architecture + +The Transformer is an encoder-decoder architecture, where both parts have a similar structure. Hence, we mainly focus on the encoder below. The encoder is composed of a stack of identical blocks, each with two sub-layers, i.e., a multi-head self-attention mechanism and a feed-forward network, as shown in Figure 1. Besides, residual connection and layer normalization (LayerNorm) are employed around each of the two sub-layers. We describe a block of the encoder as follows. + +Attention layer. An attention function can be described as mapping a query $\mathbf{X}_Q$ and a set of key-value pairs $(\mathbf{X}_K, \mathbf{X}_V)$ to a weighted sum of the values, where the weight is computed by a metric of the query with the corresponding key [1]. This function can be formalized as below: + +$$ +\operatorname {A t t e n t i o n} \left(\mathbf {X} _ {Q}, \mathbf {X} _ {K}, \mathbf {X} _ {V}\right) = \operatorname {S o f t m a x} \left(\mathbf {X} _ {Q} \mathbf {X} _ {K} ^ {T} / \sqrt {d}\right) \mathbf {X} _ {V}, \tag {2} +$$ + +where $\mathbf{X}_Q, \mathbf{X}_K, \mathbf{X}_V$ are different linear projections of the input $\mathbf{X}$ , i.e., $\mathbf{X}_Q = \mathbf{X}\mathbf{W}_Q, \mathbf{X}_K = \mathbf{X}\mathbf{W}_K, \mathbf{X}_V = \mathbf{X}\mathbf{W}_V$ , and $d$ is the dimension of representations. Multi-head attention extends the above mechanism to $H$ parallel attention layers and is illustrated in Appendix A.1.3. + +Feed-forward layer. A fully connected feed-forward layer consists of two linear transformations with a GELU activation in between, where GELU is the Gaussian Error Linear Unit function [15]. This layer can be represented as follows: + +$$ +\operatorname {F e e d F o r w a r d} (\mathbf {X}) = \operatorname {G E L U} \left(\mathbf {X} \mathbf {W} _ {1} + \mathbf {b} _ {1}\right) \mathbf {W} _ {2} + \mathbf {b} _ {2}. \tag {3} +$$ + +In addition to the above encoder-decoder blocks, an embedding layer is employed at the beginning of the model to convert input tokens $\mathbf{X}_{\mathrm{input}}$ to continuous feature vector representations. This is formulated as $\mathbf{X} = \mathbf{X}_{\mathrm{input}}\mathbf{W}_E$ , where $\mathbf{W}_E$ is the embedding lookup table. + +# 3.2 Private Transformer Inference + +According to the required cryptographic operations, the layers of Transformers can be broken into two categories - linear and non-linear. + +1) Linear layers: these include embedding, matrix multiplication in Attention, and fully-connected layer. All protocols of these operations rely crucially on the matrix multiplication protocol $\Pi_{\mathrm{MatMul}}$ in Section 4.1. It lies in the setting where $P_0$ and $P_{1}$ take as input the matrices $\mathbf{X}$ and $\mathbf{Y}$ , and learn the sharings $\langle \mathbf{Z} \rangle_0$ and $\langle \mathbf{Z} \rangle_1$ , respectively, such that $\mathbf{Z} = \mathbf{X}\mathbf{Y}$ . +2) Non-linear layers: these consist of Softmax, GELU and LayerNorm. The non-linear operations are directly evaluated by exploiting our proposed protocols in Section 4.2, i.e., $\Pi_{\mathrm{GELU}}$ , $\Pi_{\mathrm{Softmax}}$ , $\Pi_{\mathrm{LayerNorm}}$ . All of these take the additive shares $\langle \mathbf{X} \rangle$ as input, and output the additive shares $\langle \mathbf{Y} \rangle = \Pi_{\mathrm{Func}}(\langle \mathbf{X} \rangle)$ , where $\mathrm{Func} \in \{\mathrm{GELU}, \mathrm{Softmax}, \mathrm{LayerNorm}\}$ . + +Overview of private inference. In the entire private inference process, we maintain the following invariant: $P_{0}$ and $P_{1}$ begin with additive shares of the input to the layer, and end with additive shares (over the same ring $\mathbb{Z}_{2\ell}$ ) of the output of the layer after the protocol. This allows us to stitch protocols for arbitrary layers sequentially to obtain a secure computation scheme for any Transformer-based models. To clearly understand our scheme, we take an example of private inference between $P_{0}$ and $P_{1}$ on the embedding layer and the first encoder block, as shown in the right part of Figure 1. Here, our example uses the designed protocols as a black box, i.e., $\Pi_{MatMul}$ , $\Pi_{GELU}$ , $\Pi_{Softmax}$ , and $\Pi_{LayerNorm}$ , and we discuss how to efficiently implement these protocols in Section 4. + +![](images/8d5dd1975d0d891b5742efcd5e6514f89d493fdbe94f63d55ba704687a1a7a14.jpg) +Figure 2: A toy example of our matrix multiplication protocol. + +In the embedding layer, $P_0$ and $P_1$ take as inputs $\mathbf{W}_E$ and $\mathbf{X}_{\mathrm{input}}$ , and invoke the matrix multiplication protocol $\Pi_{\mathrm{MatMul}}$ to compute the input embedding $\mathbf{X}$ . This is represented as $\langle \mathbf{X} \rangle = \Pi_{\mathrm{MatMul}}(\mathbf{X}_{\mathrm{input}}, \mathbf{W}_E)$ . In the attention layer, $\Pi_{\mathrm{MatMul}}$ is also invoked to generate the query, key and value matrices. For instance, $\langle \mathbf{X}_Q \rangle = \Pi_{\mathrm{MatMul}}(\langle \mathbf{X} \rangle_1, \mathbf{W}_Q) + \langle \mathbf{X} \rangle_0 \mathbf{W}_Q$ , where $\langle \mathbf{X} \rangle_0 \mathbf{W}_Q$ can be computed locally by $P_0$ . The same idea is used in the generation of $\langle \mathbf{X}_K \rangle$ and $\langle \mathbf{X}_V \rangle$ . Then, we compute $\mathbf{X}_{QK} = \mathbf{X}_Q \mathbf{X}_K^T$ that requires two invocations of $\Pi_{\mathrm{MatMul}}$ . The formulation is $\langle \mathbf{X}_{QK} \rangle = \Pi_{\mathrm{MatMul}}(\langle \mathbf{X}_Q \rangle_0, \langle \mathbf{X}_K \rangle_1) + \Pi_{\mathrm{MatMul}}(\langle \mathbf{X}_Q \rangle_1, \langle \mathbf{X}_K \rangle_0) + \langle \mathbf{X}_Q \rangle_0 \langle \mathbf{X}_K \rangle_0^T + \langle \mathbf{X}_Q \rangle_1 \langle \mathbf{X}_K \rangle_1^T$ , where the last two terms can be evaluated by $P_0$ and $P_1$ locally. After that, we evaluate $\langle \widetilde{\mathbf{X}}_{QK} \rangle = \Pi_{\mathrm{Softmax}}(\langle \mathbf{X}_{QK} \rangle / \sqrt{d})$ , followed by computing $\langle \widetilde{\mathbf{Z}} \rangle = \langle \widetilde{\mathbf{X}}_{QK} \mathbf{X}_V \rangle$ by two invocations of $\Pi_{\mathrm{MatMul}}$ . Then, the two parties invoke the LayerNorm protocol to evaluate $\langle \mathbf{Z} \rangle = \Pi_{\mathrm{LayerNorm}}(\langle \widetilde{\mathbf{Z}} \rangle)$ . In the feed-forward layer, they compute $\langle \widetilde{\mathbf{Y}}_1 \rangle = \Pi_{\mathrm{MatMul}}(\langle \mathbf{Z} \rangle_1, \mathbf{W}_1) + \langle \mathbf{Z} \rangle_0 \mathbf{W}_1$ , followed by $\langle \widetilde{\mathbf{Y}} \rangle = \Pi_{\mathrm{GELU}}(\langle \widetilde{\mathbf{Y}}_1 \rangle)$ . After that, they compute $\langle \widetilde{\mathbf{Y}}_2 \rangle = \Pi_{\mathrm{MatMul}}(\langle \widetilde{\mathbf{Y}}_1, \mathbf{W}_1) + \langle \widetilde{\mathbf{Y}}_1, \widetilde{\mathbf{Y}}_2 \rangle$ where $\langle \widetilde{\mathbf{Y}}_1, \mathbf{W}_1 \rangle$ can be computed locally by $P_0$ . Finally, the evaluation of the encoder completes after computing $\langle \mathbf{Y} \rangle = \Pi_{\mathrm{LayerNorm}}(\langle \widetilde{\mathbf{Y}}_2 \rangle)$ . + +# 4 Supporting Protocols + +# 4.1 Protocol for Matrix Multiplication + +As shown in Section 1, naively extending well-studied matrix-vector multiplication protocols [29, 13, 14] to our matrix multiplication setting results in a significant communication overhead, mainly due to frequently interacting ciphertexts. In this work, we build a specialized matrix multiplication protocol on top of the most efficient protocol, Cheetah [14]. Recall that the plaintext of an AHE scheme is a polynomial, which can pack a large number of inputs to amortize the overhead [29, 13]. The key contribution of our proposed protocol is a more compact input packing approach. + +Our starting point is that polynomial multiplication implies vector inner product, if we arrange the coefficients properly [14]. As shown in Equation 1, when multiplying two polynomials of degree- $(N-1)$ , the $(N-1)$ -th coefficient of the resulting polynomial is the inner product of the two coefficient vectors in opposite orders. By using an appropriate arrangement of coefficients, this idea can be extended to matrix multiplications, since they consist of a set of inner products. We give the definitions of two input packing functions $\pi_{\mathrm{L}}: \mathbb{Z}_{2^{\ell}}^{m \times n} \to \mathbb{A}_{N,2^{\ell}}$ and $\pi_{\mathrm{R}}: \mathbb{Z}_{2^{\ell}}^{n \times k} \to \mathbb{A}_{N,2^{\ell}}$ as follows: + +$$ +\hat {x} = \pi_ {\mathrm {L}} (\mathbf {X}), \text {s . t .}, \hat {x} [ i \cdot n \cdot k + (n - 1) - j ] = \mathbf {X} [ i, j ], \text {f o r} i \in [ m ], j \in [ n ] +$$ + +$$ +\hat {y} = \pi_ {\mathrm {R}} (\mathbf {Y}), \text {s . t .}, \hat {y} [ j \cdot n + i ] = \mathbf {Y} [ i, j ], \text {f o r} i \in [ n ], j \in [ k ] +$$ + +where all other coefficients of $\hat{x}$ and $\hat{y}$ are set to 0. Multiplication of polynomials $\hat{z} = \hat{x} \cdot \hat{y}$ directly gives the result of matrix multiplication $\mathbf{Z} = \mathbf{X}\mathbf{Y} \mod 2^{\ell}$ in some of $\hat{z}$ 's coefficients. We formalize this process as below, and give a toy example in Figure 2. + +Theorem 4.1. Assuming $mnk \leq N$ and given two polynomials $\hat{x} = \pi_L(\mathbf{X})$ and $\hat{y} = \pi_R(\mathbf{Y})$ , the matrix multiplication $\mathbf{Z} = \mathbf{X}\mathbf{Y} \mod 2^{\ell}$ can be evaluated via the product $\hat{z} = \hat{x} \cdot \hat{y}$ , where $\mathbf{Z}[i,j]$ is computed in $\hat{z} [i\cdot n\cdot k + (j + 1)\cdot n - 1]$ for $i \in [m]$ and $j \in [k]$ . + +We defer the proof to Appendix A.2.1. When $mnk > N$ , we first partition the matrices $\mathbf{X}, \mathbf{Y}$ into sub-matrices of $m_w \times n_w$ and $n_w \times k_w$ elements, respectively, such that $m_w n_w k_w \leq N$ . Zero-padding is required when $m_w \nmid m$ , $n_w \nmid n$ or $k_w \nmid k$ . The protocol is shown in Algorithm 1. + +Complexity and security analysis. For complexity, totally, two parties interact $\frac{k}{k_w} \left( \frac{m}{m_w} + \frac{n}{n_w} \right)$ ciphertexts, and operate with $O(mnk / N)$ homomorphic additions and multiplications. We formalize the selection of parameters $m_w, n_w, k_w$ as an optimization problem, to minimize the communication + +cost. Through our analysis in Appendix A.2.2, in general scenarios, our method theoretically achieves $\sqrt{m}$ communication improvement over Cheetah [14]. Notably, when $mnk \leq N$ , we reduce the communication cost by a factor of $m$ , since Cheetah encodes each row of the matrix into a ciphertext. Besides, the security proof is shown in Appendix A.2.3. + +# Algorithm 1 Secure Matrix Multiplication Protocol + +Input: $P_0$ holds $\mathbf{X} \in \mathbf{Z}_{2\ell}^{m \times n}$ , and $P_1$ holds $\mathbf{Y} \in Z_{2\ell}^{n \times k}$ . + +Output: $P_0$ and $P_{1}$ get $\langle \mathbf{Z}\rangle_0,\langle \mathbf{Z}\rangle_1\in \mathbb{Z}_{2\ell}^{m\times k}$ , respectively, where $\mathbf{Z} = \mathbf{X}\mathbf{Y}$ . + +1: $P_0, P_1$ compute the partition window size $0 < m_{\mathrm{w}} \leq m, 0 < n_{\mathrm{w}} \leq n$ and $0 < k_{\mathrm{w}} \leq k$ such that $m_{\mathrm{w}}n_{\mathrm{w}}k_{\mathrm{w}} \leq N$ , and set $n' = \lceil n / n_{\mathrm{w}} \rceil$ , $m' = \lceil m / m_{\mathrm{w}} \rceil$ , and $k' = \lceil k / k_{\mathrm{w}} \rceil$ . +2: $P_{1}$ partitions the matrix $\mathbf{Y}$ into block matrices $\mathbf{Y}_{\beta ,\gamma}\in \mathbb{Z}_{2\ell}^{n_{\mathrm{w}}\times k_{\mathrm{w}}}$ for $\beta \in [n^{\prime}]$ and $\gamma \in [k^{\prime}]$ . +3: $P_{1}$ encodes the matrices to polynomials $\hat{y}_{\beta, \gamma} = \pi_R(\mathbf{Y}_{\beta, \gamma})$ for $\beta \in [n']$ and $\gamma \in [k']$ . Then $P_{1}$ sends to $P_{0}$ the ciphertexts $\{\mathrm{CT}_{\beta, \gamma} = \mathsf{Enc}(\hat{y}_{\beta, \gamma})\}$ . +4: $P_0$ partitions the matrix $\mathbf{X}$ into block matrices $\mathbf{X}_{\alpha,\beta} \in \mathbb{Z}_{2\ell}^{m_{\mathrm{w}} \times n_{\mathrm{w}}}$ for $\alpha \in [m']$ and $\beta \in [n']$ . $P_0$ encodes the matrices to polynomials $\hat{x}_{\alpha,\beta} = \pi_L(\mathbf{X}_{\alpha,\beta})$ . +5: $P_0$ uniformly at random samples plaintext polynomials $\hat{r}_{\alpha,\gamma}$ for $\alpha \in [m']$ and $\gamma \in [k']$ . $P_0$ decodes these polynomials to a random mask $\mathbf{R} \in \mathbb{Z}_{2\ell}^{m \times k}$ according to Theorem 4.14. +6: On receiving the ciphertexts $\{\mathrm{CT}_{\beta,\gamma}\}$ from $P_1$ , $P_0$ operates $\mathrm{CT}_{\alpha,\gamma}' = \boxplus_{\beta \in [n']} (\hat{x}_{\alpha,\beta} \boxtimes \mathrm{CT}_{\beta,\gamma}) \boxminus \hat{r}_{\alpha,\gamma}$ for $\alpha \in [m']$ and $\gamma \in [k']$ . Then $P_0$ sends to $P_1$ the ciphertexts $\{\mathrm{CT}_{\alpha,\gamma}'\}$ . +7: $P_0$ outputs $\mathbf{R}$ mod $2^{\ell}$ as the share $\langle \mathbf{Z}\rangle_{0}$ . +8: On receiving the ciphertexts $\{\mathrm{CT}_{\alpha,\gamma}^{\prime}\}$ from $P_0$ , $P_1$ computes $\langle \hat{z}_{\alpha,\gamma} \rangle_1 = \mathrm{Dec}(\mathrm{CT}_{\alpha,\gamma}^{\prime})$ that are decoded to $\langle \mathbf{Z} \rangle_1$ using the method in Theorem 4.1. + +# 4.2 Protocols for Non-linear Functions + +Our non-linear protocols rely on several underlying protocols from the state-of-the-art works [13, 17]. In Figure 3, we enumerate the inputs and outputs of these protocols and then use them as a black box (See Appendix A.3.2 for details). On this basis, we provide efficient protocols for Softmax, GELU, and LayerNorm with specific optimizations. Additional details and security analysis are shown in Appendices A.3.3 and A.3.4. + +![](images/557be0e5e58f536156fdad82eb590cbb890b1fa7cfdf67912d73409e9dd636b2.jpg) +Figure 3:Underlying protocols from [13, 17] + +# 4.2.1 Softmax + +To evaluate attention layers, we need an efficient protocol to compute Softmax on secret-shared values. In particular, for a vector $\mathbf{x} \in \mathbb{Z}_{2\ell}^{d}$ , the Softmax function is denoted as $\mathrm{Softmax}_i(\mathbf{x}) = e^{x_i} / \sum_{j \in [d]} e^{x_j}$ for $i \in [d]$ . The main challenge is to efficiently compute the underlying exponential function. Following the idea from [11, 30], we first normalize the input vector by $\mathbf{x} - \max_{i \in [d]} x_i$ , which is always negative, and then invoke the existing exponential protocol $\Pi_{\mathrm{nExp}}$ in Figure 3 that only evaluates exponentiation on negative inputs. A simple analysis shows $\mathrm{softmax}(\mathbf{x} - \max_{i \in [d]} x_i)$ is equal to $\mathrm{softmax}(\mathbf{x})$ . We evaluate max using a tree-reduction protocol, denoted by $\Pi_{\mathrm{max}}$ . Specifically, we arrange the vector $\mathbf{x} \in \mathbb{Z}_{2\ell}^{d}$ into a 2-ary tree with the depth of $\log d$ , and evaluate the tree in a top-down fashion [31]. In each comparison of two secret-shared elements $x_i$ and $x_j$ , we reduce it to the invocations of $\Pi_{\mathrm{CMP}}$ and $\Pi_{\mathrm{Mulot}}$ , i.e., $\max(x_i, x_j) = \Pi_{\mathrm{Mulot}}(x_i - x_j, \Pi_{\mathrm{CMP}}(x_i - x_j)) + x_j$ . With the above insight, the Softmax protocol is detailed in Algorithm 2. + +SIRNN [17] also provides a solution for the generic exponential protocol by extending $\Pi_{\mathrm{nExp}}$ . The idea is that the exponential of $x$ equals $\frac{1}{\mathrm{nExp}(-x)}$ if $x \geq 0$ , and $\mathrm{nExp}(x)$ otherwise, where $\mathrm{nExp}$ is the + +same as the exponential function except for negative inputs. Compared to our solution, realizing the softmax function with this generic exponential protocol additionally requires $d$ calls to the reciprocal protocol $\Pi_{\mathrm{Recip}}$ and multiplication protocol $\Pi_{\mathrm{MUT}_{\mathrm{or}}}$ . Besides, compared with the generic library MP-SPDZ [16] that provides native support for exponentiation, our protocols achieve orders of magnitude improvement as shown in Section 5.2. + +# Algorithm 2 Secure Softmax Protocol + +Input: $P_0, P_1$ hold $\langle \mathbf{x} \rangle_0 \in \mathbb{Z}_{2\ell}^d$ , $\langle \mathbf{x} \rangle_1 \in \mathbb{Z}_{2\ell}^d$ , respectively. + +Output: $P_0, P_1$ get $\langle \mathbf{y} \rangle_0 \in \mathbb{Z}_{2\ell}^d$ , $\langle \mathbf{y} \rangle_1 \in \mathbb{Z}_{2\ell}^d$ , respectively, where $\mathbf{y} = \mathrm{Softmax}(\mathbf{x})$ . + +1: $P_0, P_1$ invoke $\Pi_{\max}(\mathbf{x})$ to compute $\langle \mathsf{max}(\mathbf{x})\rangle$ , where $\mathsf{max}(\mathbf{x}) = \max_{i\in [d]}x_i$ . +2: For $i \in [d]$ , $P_0, P_1$ invoke $\Pi_{\mathrm{nExp}}$ on input $\langle \bar{x}_i \rangle$ , and learn $\langle e^{\bar{x}_i} \rangle$ , where $\bar{x}_i = x_i - \max(\mathbf{x})$ . +3: $P_0, P_1$ invoke $\Pi_{\mathrm{Recip}}$ with inputs $\langle \sum_{i \in [d]} e^{\bar{x}_i} \rangle$ and learn $\langle 1 / \sum_{i \in [d]} e^{\bar{x}_i} \rangle$ . +4: For $i \in [d]$ , $P_0, P_1$ invoke $\Pi_{\mathrm{Mul}_{\mathrm{OT}}}$ with inputs $\langle 1 / \sum_{i \in [d]} e^{\bar{x}_i} \rangle$ and $\langle e^{\bar{x}_i} \rangle$ , and set outputs as $\langle y_i \rangle$ . + +# 4.2.2 GELU + +Rather than crypto-friendly ReLU [13], Transformer-based models utilize GELU activations [15], which can be represented as $\mathrm{GELU}(x) = 0.5x\left(1 + \mathrm{Tanh}\left[\sqrt{2 / \pi}\left(x + 0.044715x^3\right)\right]\right)$ . The complete protocol is shown in Algorithm 3, in which we provide two insights to reduce the cost of GELU. First, we present an optimized protocol for the square of a secret-shared input $\langle x\rangle$ . This relies on the observation: $x^{2} = \langle x\rangle_{0}^{2} + \langle x\rangle_{1}^{2} + 2\langle x\rangle_{0}\langle x\rangle_{1}$ , where the first two terms can be locally computed by $P_0$ and $P_{1}$ . We only invoke OT protocols to compute the cross term $2\langle x\rangle_{0}\langle x\rangle_{1}$ , and the optimized overhead is half that of the multiplication protocol $\Pi_{\mathrm{Mul}_{\mathrm{OT}}}$ . + +Second, we further optimize the evaluation of $\mathrm{Tanh}(x) = \frac{e^{2x} - 1}{e^{2x} + 1}$ . We observe that the sign of $x$ is equal to the sign of $\mathrm{Tanh}(x)$ , which allows us to leverage the negative exponential protocol $\Pi_{\mathrm{nExp}}$ almost for free. At a high level, our $\mathrm{Tanh}$ protocol first learns the sign of the input $x$ , and then evaluates $\mathrm{Tanh}$ on the negative input $\bar{x}$ with the constraint $|\bar{x}| = |x|$ . Finally, the protocol generates the real output $\mathrm{Tanh}(x)$ that equals $\mathrm{Tanh}(\bar{x})$ if $x \leq 0$ , and $-\mathrm{Tanh}(\bar{x})$ otherwise. Our leaner $\mathrm{Tanh}$ protocol is given in Algorithm 5 of Appendix A.3.1. SIRNN [17] recently proposed the most efficient $\mathrm{Tanh}$ protocol with the insight of $\mathrm{Tanh}(x) = 2\mathrm{Sigmoid}(2x) - 1$ , where $\mathrm{Sigmoid}(x) = \frac{1}{1 + e^{-x}}$ . However, the evaluation of Sigmoid uses the same idea as the general exponential protocol, as shown in Section 4.2.1. Compared with the protocol in SIRNN, our recipe for $\mathrm{Tanh}$ saves one invocation of the reciprocal protocol $\Pi_{\mathrm{Recip}}$ and multiplication protocol $\Pi_{\mathrm{Mul}_{\mathrm{OT}}}$ . + +# Algorithm 3 Secure GELU Protocol + +Input: $P_0, P_1$ hold $\langle x\rangle_0\in \mathbb{Z}_{2^\ell}$ , $\langle x\rangle_{1}\in \mathbb{Z}_{2^{\ell}}$ , respectively. + +Output: $P_0, P_1$ get $\langle y \rangle_0 \in \mathbb{Z}_{2^\ell}, \langle y \rangle_1 \in \mathbb{Z}_{2^\ell}$ , respectively, where $y = \mathrm{GELU}(x)$ . + +1: $P_0$ , $P_1$ invoke $\Pi_{\mathrm{Mul}_{\mathrm{OT}}}$ with inputs $\langle x\rangle$ , and set their outputs as $\langle z\rangle = \operatorname{Fix}(\sqrt{2 / \pi})(\langle x\rangle + \operatorname{Fix}(0.044715)\langle x\rangle^3)$ +2: $P_0, P_1$ invoke $\Pi_{\mathrm{Tanh}}$ with inputs $\langle z\rangle$ , and set their outputs as $\langle \mathrm{Tanh}(z)\rangle$ . +3: $P_0, P_1$ invoke $\Pi_{\mathrm{Mul}_{\mathrm{OT}}}$ with inputs $\langle \mathrm{Fix}(0.5)x\rangle$ and $\langle \mathrm{Fix}(1) + \mathrm{Tanh}(z)\rangle$ , and output $\langle y\rangle$ . + +# 4.2.3 LayerNorm + +For a vector $\mathbf{x} \in \mathbb{Z}_{2\ell}^{d}$ , the LayerNorm function is denoted by $\text{LayerNorm}_i(\mathbf{x}) = \gamma (x_i - \mu) / \sigma + \beta$ for $i \in [d]$ , where $\mu = \sum_{i \in [d]} x_i / d$ and $\sigma = \sqrt{\sum_{i \in [d]} (x_i - \mu)^2}$ . In contrast to batch normalization (BN) in CNNs that is evaluated for free [14], LayerNorm requires multiplication and reciprocal square root operations. In our implementation, we observe that the multiplication dominates the overhead of LayerNorm. To address this issue, we adopt the same idea in GELU to compute the square of $x_i - \mu$ , which saves half of the communication and computation costs. + +Besides, inspired by the optimization in BN [14], we apply a LayerNorm merge technique to further reduce the overhead. Specifically, we make the observation that the weights $\gamma$ and $\beta$ of the LayerNorm layer are already known by $P_0$ . As a result, $P_0$ first multiplies the scale factor $\gamma$ with the weights of + +Table 1: Comparing the runtime (sec) and communication (MB) costs of our matrix multiplication and non-linear protocols with SOTA + +
Matrix MultiplicationNon-Linear Protocols
MethodsDims=(32, 8, 16)(128, 64, 128)(128, 768, 768)MethodsSoftmaxLayerNormGELU
TimeComm.TimeComm.TimeComm.TimeComm.TimeComm.TimeComm.
Ours0.0060.110.0661.741.7115.45Ours4.78206.2652.34102.4350.3010.07
Cheetah0.16 (26×)2.79 (25×)0.77 (11×)14.78 (8×)6.10 (3×)134.37 (8×)SIRNN7.95 (1.7×)347.71 (1.7×)4.16 (1.8×)184.42 (1.8×)0.38 (1.3×)14.07 (1.4×)
SIRNN0.04 (6×)1.34 (12×)1.59 (23×)70.08 (40×)110.33 (64×)4920.08 (318×)MP-SPDZ297.75 (62×)172,837 (837×)202.75 (86×)101,642 (992×)15.34 (51×)7,908.69 (785×)
+ +the next linear layer. After invoking the linear layer protocol on the scaled weights, $P_0$ adds the shift weight $\sigma$ to his additive share. The optimized protocol for LayerNorm is presented in Algorithm 4. + +# Algorithm 4 Secure LayerNorm Protocol + +Input: $P_0, P_1$ hold $\langle \mathbf{x} \rangle_0 \in \mathbb{Z}_{2\ell}^d$ , $\langle \mathbf{x} \rangle_1 \in \mathbb{Z}_{2\ell}^d$ , respectively. + +Output: $P_0, P_1$ get $\langle \mathbf{y} \rangle_0, \langle \mathbf{y} \rangle_1$ , respectively, where $\mathbf{y} = \mathrm{LayerNorm}(\mathbf{x})$ . + +1: For $i \in [d]$ , $P_0$ , $P_1$ invoke $\Pi_{\mathrm{Mul}_{\mathrm{or}}}$ to compute $\langle (x_i - \mu)^2 \rangle$ , where $\mu = \sum_{i \in [d]} x_i / d$ . +2: $P_0, P_1$ invoke $\Pi_{\mathrm{rSqrt}}$ with inputs $\langle \sum_{i \in [d]} (x_i - \mu)^2 \rangle$ to learn output $\langle \frac{1}{\sigma} \rangle$ . +3: For $i \in [d]$ , $P_0, P_1$ invoke $\Pi_{\mathrm{Mul}_{\mathrm{OT}}}$ with inputs $\langle \frac{1}{\sigma} \rangle$ and $\langle x_i - \mu \rangle$ , and set outputs as $\langle y_i \rangle$ . + +# 5 Evaluation + +# 5.1 Experimental Setup + +Implementation. Iron is built on top of the SEAL library [32] and the EMP toolkit [33] in $\mathrm{C + + }$ . We also use the EzPC framework [34]. This framework compiles a high-level TensorFlow code to secure computation protocols, which are then executed by our designed cryptographic backends. Like [17], we simulate a LAN network setting, where the bandwidth is 377 MBps and the echo latency is 0.8ms. All the following experiments are performed on AWS c5.9xlarge instances with Intel Xeon 8000 series CPUs at $3.6\mathrm{GHz}$ + +Datasets and Models. We evaluate Iron on four NLP models from [35, 36]: BERT-Tiny, BERT-Medium, BERT-Base and BERT-Large. These models are parameterized by three hyper-parameters: the number of blocks, the dimension of representations and the number of input tokens (refer to Appendix A.4.1 for the hyper-parameters of these models). We train the models for four NLP tasks over the datasets of the Stanford Sentiment Treebank (SST-2), the Microsoft Research Paraphrase Corpus (MRPC), the Multi-Genre Natural Language Inference Corpus (MNLI) and the Stanford Question Answering Dataset (QNLI) from GLUE benchmarks [18]. + +# 5.2 Microbenchmark Evaluation + +Matrix multiplication. In the left part of Table 1, we compare the performance of the proposed matrix multiplication protocol with the state-of-the-art counterparts of Cheetah [14] and SIRNN [17]. For fairness, we follow Cheetah for the parameter setup of homomorphic encryption. Compared with Cheetah, our runtime is $3 \sim 26 \times$ faster, and our communication cost is $8 \sim 25 \times$ lower, depending on the input size. Notably, for small-size matrices (e.g., ones with $32 \times 8$ and $8 \times 16$ elements), our protocol only requires $0.11\mathrm{MB}$ communication and $6\mathrm{ms}$ runtime, while Cheetah achieves the computation with $2.79\mathrm{MB}$ and $160~\mathrm{ms}$ . The reason is that our protocol encrypts the whole matrix into a single ciphertext, while Cheetah could only encrypt each row into a ciphertext, totally $m$ ciphertexts ( $m$ is the number of rows of the output matrix). Moreover, compared with SIRNN that implements the most efficient OT-based matrix multiplication protocol, our protocol incurs up to two orders of magnitude less communication and an order of magnitude less runtime. + +Non-linear functions. The right part of Table 1 shows the comparison of our Softmax, GELU and LayerNorm protocols with the generic MP-SPDZ framework [16] and the state-of-the-art SIRNN library [17] for math functions. It is worth noting that we implement some functions that these + +![](images/8184e561b9b5591777b219a110513651019318a4495890e650f3cbda8a2d59cf.jpg) +Figure 4: End-to-end comparisons with SIRNN and MP-SPDZ + +![](images/06550bad675510011f52d49732b136741955042e9d27a3e18d1a55e37190ebac.jpg) + +![](images/9ec25e59b65c276c5a3dc2a224063da9025721c459740f18193b5ca7701da673.jpg) + +![](images/4fc090209d2decac6c032639ccbda04343c56a7f340fb692b49030371b279bfc.jpg) + +frameworks did not provide before. In particular, GELU and LayerNorm are implemented in MP-SPDZ by calling its built-in functions for tanh, square root, and reciprocal, while we add Softmax and GELU protocols in SIRNN utilizing sigmoid and exponent functions. As shown in this table, our protocols are orders of magnitude better than those of MP-SPDZ, in terms of both runtime and communication. In particular, for the communication cost, our protocols achieve $785 \sim 993 \times$ improvement. Moreover, while our protocols are built upon the underlying protocols from SIRNN, we also achieve $1.3 \sim 1.8 \times$ lower runtime and $1.4 \sim 1.8 \times$ lower communication due to our customized optimizations. Such an improvement gives us significant savings in communication complexity, since the non-linear layer protocols dominate the overall overhead, as described below. + +# 5.3 End-to-end Inference Evaluation + +Comparison with prior methods. In the left part of Figure 4, we evaluate our protocols on 4 BERT models compared with SIRNN [17]. It is observed that our runtime is $3.3 \sim 11.83 \times$ faster than that of SIRNN, and our communication cost is $3.47 \sim 14.11 \times$ lower over four models. Moreover, our performance gains scale up as the model size grows. This is because our protocols achieve better amortized overhead when processing large-scale evaluations. We also compare the end-to-end private inference with MP-SPDZ in Figure 4. The results show that our protocols are orders of magnitude better, in terms of both time and communication costs. This is because specialized protocols are more communication efficient than generic alternatives, which is also observed by SIRNN. + +Performance breakdown. In Figure 5, we present the runtime and communication breakdown of Iron on four BERT models. For clarity, we just report the result of one encoder. Recall that our private inference can be divided into linear protocols and non-linear protocols. For linear protocols, we observe that as the model size increases, the proportion of communication overhead remains approximately constant, accounting for $12 \sim 13\%$ . This shows that our compact ciphertext encoding method effectively reduces the size of communication. For non-linear functions, as the model size increases, the proportion of computation overhead gradually decreases, from $84\%$ in BERT-Tiny to $76\%$ in BERT-Large. The savings come from amortizing the communication and computation costs by packing data from large tensors. Despite such advantages, the main bottleneck of our work is the communication overhead of non-linear layers. However, it is an open problem to solve the communication issue while maintaining the model accuracy. + +Accuracy comparison with plaintext. In the left part of Figure 6, we show the accuracy of plaintext (float-point) and Iron (fixed-point) on the BERT-Tiny model. We observe that the accuracy achieved by Iron matches the accuracy of the plaintext TensorFlow code. Specifically, the accuracy loss does not exceed $0.3\%$ over all datasets, and surprisingly, Iron exceeds the plaintext baseline on MNLI by $0.85\%$ . Similar results also appear in private CNN inference [13]. Such accuracy advantages experimentally validate that our protocols are numerically precise. Moreover, in the right part of Figure 6, we also compare the accuracy with the plaintext baseline, as the fractional scale varies on MRPC. We observe that Iron with the scale of 12 exactly matches the accuracy of the plaintext model. The accuracy loss is lower than $1\%$ when the scale $\geq 6$ . This conclusion is in line with the prior work [13], namely that neural networks can tolerate stochastic fault behavior [37]. + +# 6 Discussion + +We discuss possible solutions to further improve the efficiency of private inference on Transformers. They are compatible with our proposed protocols and hence can be directly integrated into our framework. + +![](images/9bddef799490a50c4670c3a60cf011e86011ec0192a833bc2f178760f914ac50.jpg) +Figure 5: Performance breakdown on BERT. + +![](images/c496688b9026e1b418d158e21942785aaf3c6c54061826433075d92707799384.jpg) + +![](images/6b29350c232aee463abab7ab0ba723072ca33f2012928e58c2d48b3cc4d365e1.jpg) +Figure 6: Accuracy comparison with plaintext + +![](images/4b9b7f6340ab253ddf052283aa7b616d8a4d865c4059bfa324a5f1680b48464a.jpg) + +Pushing expensive operations into an offline phase. Our framework is readily extended to the preprocessing model, including an offline client-input independent phase and an online input-dependent phase. This paradigm has been instantiated in private CNN inference [38, 8], and the results show that about $99\%$ of the cryptographic overhead can be moved to the offline phase. We briefly outline how to build our protocols with this paradigm. For linear operations, we can generate in advance Beaver's triple in the matrix form [22, 38] using our matrix multiplication protocol. In the online phase, these triples are consumed, and it additionally requires non-cryptographic operations and plaintext communication. For non-linear layers, almost all operations crucially rely on the OT protocols, which can be pre-generated in the offline phase [39, 14]. Like linear protocols, the online phase is cheap. + +Using mixed-bitwidths in private inference. Iron works with a uniform bitwidth, which is required to be large enough to accommodate all intermediate values. While effectively avoiding integer overflows, our protocols may cause intensive communication, since the performance of non-linear operators depends critically on bitwidths. Taking inspiration from [17, 40], one possible optimization is to employ non-uniform (mixed) bitwidths, operate in low bitwidths and switch to high bitwidths only when necessary. To this end, the mixed-precision model should be generated with proper compilers by using techniques like quantization [41, 42]. With mixed-bitwidths fixed-point models, our protocols can be integrated seamlessly. + +Applying orthogonal model optimizations. We can improve performance by simplifying the model architecture such as model pruning and advanced neural architecture search [43, 44], which have been commonly adopted in private CNN inference [12, 45, 37]. Like prior works [12, 45, 37] that find and tailor models to the requirements of private inference, we can define a proper search space with the goal of decreasing the overhead, e.g., substituting costly Softmax and GELU functions, or reducing the matrices' dimension in matrix multiplication. As mentioned in Section 1, the concurrent work, THE-X [19], has explored replacing complex math functions with HE-friendly alternatives while achieving comparable accuracy. + +# 7 Conclusion + +We propose Iron, an efficient cryptographic framework for private Transformer inference. Specifically, we carefully design a new encoding method for optimizing homomorphic encryption-based matrix multiplication. Further, we devise several communication-efficient non-linear protocols like Softmax, LayerNorm and GELU by integrating advanced secret-sharing primitives. Experimental results show that Iron outperforms prior art by up to one order of magnitude in terms of computation and communication overheads. We believe that our novel protocols would help advance the practical instantiations of private Transformer inference. + +# Acknowledgment + +The authors would like to thank the anonymous reviewers for their insightful comments. This work is supported by the Key-Area Research and Development Program of Guangdong Province under Grant 2020B0101360001, National Natural Science Foundation of China under Grants 62020106013, 61972454, and 61802051, Sichuan Science and Technology Program under Grants 2020JDTD0007 and 2020YFG0298, the Fundamental Research Funds for Chinese Central Universities under Grant ZYGX2020ZB027, and Singapore Ministry of Education (MOE) AcRF Tier 2 MOE-T2EP20121-0006. + +# References + +[1] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Proceedings of NeurIPS, 2017. +[2] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of NeurIPS, 2018. +[3] Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. 2018. +[4] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In Proceedings of ICLR, 2020. +[5] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. In Proceedings of ICCV, pages 10012-10022, 2021. +[6] Clarifai general image embedding model. URL https://www clarifai.com/models/general-image-embedding. +[7] Openai api. URL https://openai.com/blog/openai-api. +[8] Ryan Lehmkuhl, Pratyush Mishra, Akshayaram Srinivasan, and Raluca Ada Popa. Muse: Secure inference resilient to malicious clients. In Proceedings of USENIX Security, pages 2201-2218, 2021. +[9] Yupei Liu, Jinyuan Jia, Hongbin Liu, and Neil Zhenqiang Gong. Stolenencoder: Stealing pre-trained encoders. arXiv:2201.05889, 2022. +[10] Ran Gilad-Bachrach, Nathan Dowlin, Kim Laine, Kristin Lauter, Michael Naehrig, and John Wernsing. Cryptonets: Applying neural networks to encrypted data with high throughput and accuracy. In Proceedings of ICML, pages 201-210, 2016. +[11] Brian Knott, Shobha Venkataraman, Awni Hannun, Shubho Sengupta, Mark Ibrahim, and Laurens van der Maaten. Crypten: Secure multi-party computation meets machine learning. In Proceedings of NeurIPS, 2021. +[12] Zahra Ghodsi, Akshaj Kumar Veldanda, Brandon Reagen, and Siddharth Garg. Cryptonas: Private inference on a relu budget. In Proceedings of NeurIPS, pages 16961-16971, 2020. +[13] Deevashwer Rathee, Mayank Rathee, Nishant Kumar, Nishanth Chandran, Divya Gupta, Aseem Rastogi, and Rahul Sharma. Cryptflow2: Practical 2-party secure inference. In Proceedings of ACM CCS, pages 325-342, 2020. +[14] Zhicong Huang, Wen-jie Lu, Cheng Hong, and Jiansheng Ding. Cheetah: Lean and fast secure two-party deep neural network inference. In Proceedings of USENIX Security, 2022. +[15] Dan Hendrycks and Kevin Gimpel. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016. +[16] Marcel Keller. Mp-spdz: A versatile framework for multi-party computation. In Proceedings of ACM CCS, pages 1575-1590, 2020. +[17] Deevashwer Rathee, Mayank Rathee, Rahul Kranti Kiran Goli, Divya Gupta, Rahul Sharma, Nishanth Chandran, and Aseem Rastogi. Sirnn: A math library for secure rnn inference. In Proceedings of IEEE S&P, pages 1003-1020, 2021. +[18] Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R Bowman. Glue: A multi-task benchmark and analysis platform for natural language understanding. In Proceedings of ICLR, pages 535-548, 2018. + +[19] Tianyu Chen, Hangbo Bao, Shaohan Huang, Li Dong, Binxing Jiao, Daxin Jiang, Haoyi Zhou, Jianxin Li, and Furu Wei. The-x: Privacy-preserving transformer inference with homomorphic encryption. In Findings of ACL, pages 3510-3520, 2022. +[20] Martin Abadi, Andy Chu, Ian Goodfellow, H Brendan McMahan, Ilya Mironov, Kunal Talwar, and Li Zhang. Deep learning with differential privacy. In Proceedings of ACM CCS, pages 308-318, 2016. +[21] Ronald Cramer, Ivan Bjerre Damgård, et al. Secure multiparty computation. Cambridge University Press, 2015. +[22] Daniel Demmler, Thomas Schneider, and Michael Zohnner. Aby-a framework for efficient mixed-protocol secure two-party computation. In Proceedings of NDSS, 2015. +[23] Taher ElGamal. A public key cryptosystem and a signature scheme based on discrete logarithms. IEEE transactions on information theory, 31(4):469-472, 1985. +[24] Pascal Paillier. Public-key cryptosystems based on composite degree-residuosity classes. In Proceedings of Eurocrypt, pages 223-238, 1999. +[25] Zvika Brakerski. Fully homomorphic encryption without modulus switching from classical gapsvp. In Proceedings of Crypto, pages 868-886, 2012. +[26] Junfeng Fan and Frederik Vercauteren. Somewhat practical fully homomorphic encryption. Cryptology ePrint Archive, 2012. +[27] Vladimir Kolesnikov and Ranjit Kumaresan. Improved ot extension for transferring short secrets. In Proceedings of Crypto, pages 54-70, 2013. +[28] Gilad Asharov, Yehuda Lindell, Thomas Schneider, and Michael Zohnner. More efficient oblivious transfer and extensions for faster secure computation. In Proceedings of ACM CCS, pages 535-548, 2013. +[29] Chiraag Juvekar, Vinod Vaikuntanathan, and Anantha Chandrakasan. Gazelle: A low latency framework for secure neural network inference. In Proceedings of USENIX Security, pages 1651-1669, 2018. +[30] Sijun Tan, Brian Knott, Yuan Tian, and David J Wu. Cryptgpu: Fast privacy-preserving machine learning on thegpu. In Proceedings of IEEE S&P, 2021. +[31] Théo Ryffel, Pierre Tholoniat, David Pointcheval, and Francis Bach. Ariann: Low-interaction privacy-preserving deep learning via function secret sharing. In Proceedings of PETS, pages 291-316, 2022. +[32] Seal. URL https://github.com/microsoft/SEAL. +[33] emp-toolkit. URL https://github.com/emp-toolkit. +[34] Ezpc. URL https://github.com/mpc-msri/EzPC. +[35] Bert. URL https://github.com/google-research/bert. +[36] Iulia Turc, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Well-read students learn better: On the importance of pre-training compact models. arXiv:1908.08962, 2019. +[37] Zahra Ghodsi, Nandan Kumar Jha, Brandon Reagen, and Siddharth Garg. Circa: Stochastic relus for private deep learning. In Proceedings of NeurIPS, 2021. +[38] Pratyush Mishra, Ryan Lehmkuhl, Akshayaram Srinivasan, Wenting Zheng, and Raluca Ada Popa. Delphi: A cryptographic inference service for neural networks. In Proceedings of USENIX Security, pages 2505-2522, 2020. +[39] M Sadegh Riazi, Christian Weinert, Oleksandr Tkachenko, Ebrahim M Songhori, Thomas Schneider, and Farinaz Koushanfar. Chameleon: A hybrid secure computation framework for machine learning applications. In Proceedings of AsiaCCS, pages 707-721, 2018. + +[40] Siam Umar Hussain, Mojan Javaheripi, Mohammad Samragh, and Farinaz Koushanfar. Coinn: Crypto/ml codesign for oblivious inference via neural networks. In Proceedings of ACM CCS, pages 3266-3281, 2021. +[41] Sehoon Kim, Amir Gholami, Zhewei Yao, Michael W Mahoney, and Kurt Keutzer. I-bert: Integer-only bert quantization. In Proceedings of ICML, pages 5506-5518, 2021. +[42] Sheng Shen, Zhen Dong, Jiayu Ye, Linjian Ma, Zhewei Yao, Amir Gholami, Michael W Mahoney, and Kurt Keutzer. Q-bert: Hessian based ultra low precision quantization of bert. In Proceedings of AAAI, pages 8815-8821, 2020. +[43] François Lagunas, Ella Charlaix, Victor Sanh, and Alexander M Rush. Block pruning for faster transformers. In Proceedings of EMNLP, 2021. +[44] Paul Michel, Omer Levy, and Graham Neubig. Are sixteen heads really better than one? In Proceedings of NeurIPS, 2019. +[45] Nandan Kumar Jha, Zahra Ghodsi, Siddharth Garg, and Brandon Reagen. Deepreduce: Relu reduction for fast private inference. In Proceedings of ICML, pages 4839-4849, 2021. +[46] Payman Mohassel and Yupeng Zhang. Securel: A system for scalable privacy-preserving machine learning. In Proceedings of IEEE S&P, pages 19-38, 2017. +[47] Ran Canetti. Universally composable security: A new paradigm for cryptographic protocols. In Proceedings of FOCS, pages 136-145, 2001. +[48] Robert E Goldschmidt. Applications of division by convergence. PhD thesis, MIT, 1964. +[49] Xiaogqian Jiang, Miran Kim, Kristin Lauter, and Yongsoo Song. Secure outsourced matrix computation and application to neural networks. In Proceedings ACM CCS, pages 1209-1222, 2018. +[50] Fabian Boemer, Anamaria Costache, Rosario Cammarota, and Casimir Wierzynski. ngraph-he2: A high-throughput framework for neural network inference on encrypted data. In Proceedings of the 7th ACM Workshop on Encrypted Computing & Applied Homomorphic Cryptography, pages 45-56, 2019. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] +(c) Did you discuss any potential negative societal impacts of your work? [No] +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] +(b) Did you include complete proofs of all theoretical results? [Yes] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [No] +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] +(b) Did you mention the license of the assets? [No] +(c) Did you include any new assets either in the supplemental material or as a URL? [No] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/ironprivateinferenceontransformers/images.zip b/ironprivateinferenceontransformers/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..8b1d021b98526dc53b3020074fbb021490fbd330 --- /dev/null +++ b/ironprivateinferenceontransformers/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:401cfc2b38c12f6e87bac64b601bf62e7e241c66129d935773e04f84767b5bf6 +size 265668 diff --git a/ironprivateinferenceontransformers/layout.json b/ironprivateinferenceontransformers/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..44c092d9aecf8e88ffd2b5d3d18afb8837c8f809 --- /dev/null +++ b/ironprivateinferenceontransformers/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:406b1a7ba5a5ea2a8f444541876fffcc51ab289d48ddece1d2b8cdc6dbbf02d1 +size 730395 diff --git a/isamodulararchitectureenough/b6d562e0-61a5-48a1-8edc-12e26a86f432_content_list.json b/isamodulararchitectureenough/b6d562e0-61a5-48a1-8edc-12e26a86f432_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..17db280071b3fea92468014623cbf1103775b989 --- /dev/null +++ b/isamodulararchitectureenough/b6d562e0-61a5-48a1-8edc-12e26a86f432_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1bcd8ca131e2cc6992f47c9499b30d2e4455cf8d207f5ffd5a4e6b27c99ff058 +size 84458 diff --git a/isamodulararchitectureenough/b6d562e0-61a5-48a1-8edc-12e26a86f432_model.json b/isamodulararchitectureenough/b6d562e0-61a5-48a1-8edc-12e26a86f432_model.json new file mode 100644 index 0000000000000000000000000000000000000000..bef281d4edcd461d31d7fccbd9170dae4bb37a93 --- /dev/null +++ b/isamodulararchitectureenough/b6d562e0-61a5-48a1-8edc-12e26a86f432_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2e05110991f99bcb819be1051b4aa3d77975795444fde46476e02cc303e8cf08 +size 104830 diff --git a/isamodulararchitectureenough/b6d562e0-61a5-48a1-8edc-12e26a86f432_origin.pdf b/isamodulararchitectureenough/b6d562e0-61a5-48a1-8edc-12e26a86f432_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..207f8b748506548c9d10a4535e9106082d23f2ca --- /dev/null +++ b/isamodulararchitectureenough/b6d562e0-61a5-48a1-8edc-12e26a86f432_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c937a9f1ff2e87d38d9cbf1d98cd5b275ba2322d8cca2f645356f7e0f9b2f638 +size 543191 diff --git a/isamodulararchitectureenough/full.md b/isamodulararchitectureenough/full.md new file mode 100644 index 0000000000000000000000000000000000000000..4f7d2fcdd59f130af6b0358c948b32451a4b340c --- /dev/null +++ b/isamodulararchitectureenough/full.md @@ -0,0 +1,379 @@ +# Is a Modular Architecture Enough? + +Sarthak Mittal†, Yoshua Bengio, Guillaume Lajoie + +Mila, Université de Montréal + +# Abstract + +Inspired from human cognition, machine learning systems are gradually revealing advantages of sparser and more modular architectures. Recent work demonstrates that not only do some modular architectures generalize well, but they also lead to better out-of-distribution generalization, scaling properties, learning speed, and interpretability. A key intuition behind the success of such systems is that the data generating system for most real-world settings is considered to consist of sparsely interacting parts, and endowing models with similar inductive biases will be helpful. However, the field has been lacking in a rigorous quantitative assessment of such systems because these real-world data distributions are complex and unknown. In this work, we provide a thorough assessment of common modular architectures, through the lens of simple and known modular data distributions. We highlight the benefits of modularity and sparsity and reveal insights on the challenges faced while optimizing modular systems. In doing so, we propose evaluation metrics that highlight the benefits of modularity, the regimes in which these benefits are substantial, as well as the sub-optimality of current end-to-end learned modular systems as opposed to their claimed potential.1 + +# 1 Introduction + +Deep learning research has an established history of drawing inspiration from neuroscience and cognitive science. From the way hidden units combine afferent inputs, to how connectivity and network architectures are designed, many breakthroughs have relied on mimicking brain strategies. It is no surprise then that modularity and attention have been leveraged, often together, in artificial networks in recent years (Bahdanau et al., 2015; Andreas et al., 2016; Hu et al., 2017; Vaswani et al., 2017; Kipf et al., 2018; Battaglia et al., 2018; Goyal et al., 2019, 2021), with impressive results. Indeed, work from cognitive neuroscience (Baars, 1997; Dehaene et al., 2017) suggests that cortex represents knowledge in a modular way, with different such modules communicating through the bottleneck of working memory (where very few items can simultaneously be represented), in which content is selected by attention mechanisms. In recent work from the AI community (Bengio, 2017; Goyal & Bengio, 2020), it was proposed that these characteristics could correspond to meaningful inductive biases for deep networks, i.e., statistical assumptions about the dependencies between concepts manipulated at the higher levels of cognition. Both sparsity of the dependencies between these high-level variables and the decomposition of knowledge into recomposable pieces that are as independent as possible (Peters et al., 2017; Bengio et al., 2019; Goyal & Bengio, 2020; Ke et al., 2021) would make learning more efficient. Out-of-distribution (OoD) generalization would be facilitated by making it possible to sequentially compose the computations performed by these modules where new situations can be explained by novel combinations of existing concepts. + +Although a number of recent results hinge on such modular architectures (Graves et al., 2014; Andreas et al., 2016; Hu et al., 2017; Vaswani et al., 2017; Kipf et al., 2018; Santoro et al., 2018; Battaglia et al., 2018; Goyal et al., 2019, 2021; Locatello et al., 2020; Mittal et al., 2020; Madan et al., 2021), + +the abundance of tricks and proposed architectural modifications makes it challenging to parse real, usable architectural principles. It is also unclear whether the performance gains obtained by such Mixture-of-Experts (MoE) based modular systems are actually due to good specialization, as is often claimed, or due to other potential confounding factors like ease of optimization. + +In this work, we extend the analysis from Rosenbaum et al. (2019); Maziarz et al. (2019); Cui & Jaech (2020); Csordás et al. (2020) and propose a principled approach to evaluate, quantify, and analyse common ingredients of modular architectures, supported by either standard MLP-like connectivity, recurrent connections or attention (Bahdanau et al., 2015; Vaswani et al., 2017) operations. To do so, we develop a series of benchmarks and metrics aimed at probing the efficacy of a wide range of modular networks, where computation is factorized. This reveals valuable insights and helps identify not only where current approaches succeed but also when and how they fail. Whereas previous work on disentangling (Bengio, 2013; Higgins et al., 2016; Kim & Mnih, 2018) has focused on factoring out the different high-level variables that explain the data, here we focus on disentangling system modules from each other, the structural ingredients of network that can facilitate this factorization, and how such ingredients relate to the data generating distributions being parsed and processed. + +Given the recent increased interest in sparse modular systems (Rahaman et al., 2021; Fedus et al., 2021; Du et al., 2021; Mittal et al., 2021), we believe that this work will provide a test-bed for investigating the workings of such models and allow for research into inductive biases that can push such models to achieve good specialization. Through detailed experiments and evaluation metrics, we make the following observations and contributions: + +- We develop benchmark tasks and metrics based on probabilistically selected rules to quantify two important phenomena in modular systems, the extent of collapse and specialization. +- We distill commonly used modularity inductive biases and systematically evaluate them through a series of models aimed at extracting commonly used architectural attributes (Monolithic, Modular, Modular-op and GT-Modular models). +- We find that specialization in modular systems leads to significant boosts in performance when there are many underlying rules within a task, but not so much with only few rules. +- We find standard modular systems to be often sub-optimal in both their capacity on focusing on the right information as well as in their ability to specialize, suggesting the need for additional inductive biases. + +# 2 Notation / Terminology + +In this paper, we study how a family of modular systems performs on a common set of tasks, prescribed by a synthetic data generating process which we call rule-based data. Below, we introduce the notation for key ingredients: (1) rules and how they form tasks, (2) modules and how they can take different model architectures, (3) specialization and how we evaluate models. We refer the reader to Figure 1 for an illustration of our setup. + +Rules. To properly understand modular systems and analyze their benefits and shortcomings, we consider synthetic settings that allow fine-grained control over different aspects of task requirements. In particular, operations must be learned on the data-generating distri + +bution illustrated in Equations 1-3, which we also refer to as rules. Details about the exact operations used in experiments are described in Section 3. + +![](images/ab71062d0a7c70148f1010d8502f7a799322425623dbfab96e8fbd94d78950b1.jpg) +Figure 1: Illustration of modularity evaluation framework. Task configurations define the rules in the data-generating process while model parameters define the kind of model to be trained on it. + +Given this distribution, we define a rule to be an expert of this distribution, that is, rule $r$ is defined as $p_{y}(\cdot |\mathbf{x},\mathbf{c} = r)$ where $\mathbf{c}$ is a categorical variable representing context, and $\mathbf{x}$ is an input sequence. For example, consider $\mathbf{x} = (1,2)$ and $\mathbf{c}$ to select between addition and multiplication. Then, depending on $\mathbf{c}$ , the correct + +$$ +\mathbf {c} \sim \text {C a t e g o r i c a l} (\cdot) \tag {1} +$$ + +$$ +\mathbf {x} \sim p _ {x} (\cdot) \tag {2} +$$ + +$$ +\mathbf {y} \mid \mathbf {x}, \mathbf {c} \sim p _ {y} (\cdot \mid \mathbf {x}, \mathbf {c}). \tag {3} +$$ + +output should be either $\mathbf{y} = 3$ or $\mathbf{y} = 2$ . More details about the specifics of these data distributions are presented in Section 3. Systems will be trained to infer $\mathbf{y}$ given $\mathbf{c}$ and $\mathbf{x}$ . This simple setup is meant to capture context-dependent tasks on variable data distributions, e.g. reasoning according to different features (e.g. shape, color, etc.). However, unlike such complex systems, ground truth knowledge of required operations is known for our synthetic task, allowing for deeper quantitative analysis. + +Tasks. A task is described by the set of rules (data-generating distribution) illustrated in Equations 1-3. Different sets of $\{p_y(\cdot |\mathbf{x},\mathbf{c})\}_{\mathbf{c}}$ imply different tasks. For a given number of rules, we train models on multiple tasks to remove bias towards any particular task. + +Modules. A modular system comprises a set of neural network modules, each of which can contribute to the overall output. One can see this through the functional form $\mathbf{y} = \sum_{m=1}^{M} p_m \mathbf{y}_m$ , where $\mathbf{y}_m$ denotes the output and $p_m$ the activation of the $m^{th}$ module. Details about the different modular systems are outlined in Section 4. + +From this point onwards, we exclusively use rules to refer to the specialized components in the data-generating process, and modules to refer to the experts that are learned by a modular system. Further, for ease of quantitative assessment, we always set the number of modules equal to the number of rules, except when evaluating monolithic models (with a single module). Modules can be implemented in three different architectures, as described next. + +Model Architectures. Model architectures describe the choice of architecture considered for each module of a modular system, or the single module in a monolithic system. Here we consider Multi-Layer Perceptron (MLP), Multi-Head Attentions (MHA), and Recurrent Neural Network (RNN). Importantly, the rules (or data generating distributions) are adapted to the model architecture, and we often refer to them as such (e.g. MLP based rules). Details about the data distributions and models considered in this work are provided in Sections 3 and 4 respectively. + +Perfect Specialization. When training modular systems on rule-based data, we would like the modules to specialize according to the rules in the data-generating distribution. Thus, there is an important need to quantify what constitutes perfect specialization of the system to the data. To allow for easier quantification, we always consider an equal number of modules and rules. However, future work should evaluate the ability of modular systems to automatically infer the required number of modules. + +# 3 Data Generating Process + +Since we aim to study modular systems through synthetic data, here we flesh out the data-generating processes operating based on the rules scheme described above (see Equations 1-3). We use a simple Mixture-of-Experts (MoE) Yuksel et al. (2012); Masoudnia & Ebrahimpour (2014) styled data-generating process (Mixture Distribution), where we expect different modules to specialize to the different mixture components (rules). It is important to note that this system is slightly different from the traditional flat MoE since the experts are more plug-and-play and can be composed to solve a particular problem. As an example, if we consider a mixture of recurrent systems, different tokens (timepoints) in the input sequence can undergo computations according to different rules (e.g. a switching linear dynamical system), as opposed to the choice of expert being governed by the whole sequence. + +We now look at more specific setups of the data-generating systems in consideration, the general template of which was outlined above. To do so, we explain the data-generating processes amenable to our three model architectures: MLP, MHA, and RNN. Additionally, each of the following tasks have two versions: regression, and classification. These are included to explore potential differences these distinct loss types may induce. + +MLP. Here, we define the data scheme that is amenable for learning of modular MLP-based systems. In this synthetic data-generating scheme, a data sample consists of two independent numbers and a choice of rule being sampled from some distribution. Different rules lead to different linear combinations of the two numbers to give the + +$$ +c \sim \mathcal {U} \{1, R \} \tag {4} +$$ + +$$ +\mathbf {x} _ {1}, \mathbf {x} _ {2} \stackrel {\text {i i d}} {\sim} \mathcal {N} (0, I) \tag {5} +$$ + +$$ +\mathbf {y} = \alpha_ {c} \mathbf {x} _ {1} + \beta_ {c} \mathbf {x} _ {2} \tag {6} +$$ + +output. That is, the choice of linear combination is dynamically instantiated based on the rule drawn. This is mathematically formulated in Equations 4-6, where $\alpha_{c}$ and $\beta_{c}$ are the data parameters, I the identity matrix and $\mathbf{y}$ denotes the label for the regression tasks and $\mathrm{sign}(\mathbf{y})$ for the classification tasks. + +Hence, the data comes from a MoE distribution where $c$ denotes which linear combination governs the conditional distribution $p_{y}(\cdot \mid \mathbf{x}_{1},\mathbf{x}_{2},c)$ . When training modular architectures on such data, one expects each module in the trained system to specialize according to a unique rule. + +MHA. Now, we define the data scheme that is tuned for learning in modular MHA based systems. Essentially, a MHA module can be understood through a set of searches (query-key interactions), a set of corresponding retrievals (values) and then some computation of the retrieved values, as explained by Mittal et al. (2021). Accordingly, we design the data-generating distribution with the following properties: Each rule is composed of a different notion of search, retrieval and the final + +$$ +\mathbf {c} _ {n} \stackrel {\text {i i d}} {\sim} \mathcal {U} \{1, R \} \tag {7} +$$ + +$$ +\mathbf {q} _ {n r}, \mathbf {q} _ {n r} ^ {\prime}, \mathbf {v} _ {n r}, \mathbf {v} _ {n r} ^ {\prime} \stackrel {{\mathrm {i i d}}} {{\sim}} \mathcal {N} (0, I) \tag {8} +$$ + +$$ +\mathbf {s} _ {n} = \min _ {i \neq n} d \left(\mathbf {q} _ {n c _ {n}}, \mathbf {q} _ {i c _ {n}}\right) \tag {9} +$$ + +$$ +\mathbf {s} _ {n} ^ {\prime} = \min _ {i \neq n} d \left(\mathbf {q} _ {n c _ {n}} ^ {\prime}, \mathbf {q} _ {i c _ {n}} ^ {\prime}\right) \tag {10} +$$ + +$$ +\mathbf {y} _ {n} = \alpha_ {c _ {n}} \mathbf {v} _ {\mathbf {s} _ {n} c _ {n}} + \beta_ {c _ {n}} \mathbf {v} _ {\mathbf {s} _ {n} ^ {\prime} c _ {n}} ^ {\prime} \tag {11} +$$ + +linear combination of the retrieved information respectively. We mathematically describe the process in Equations 7-11, where $n = 1,\dots ,N$ and $r = 1,\ldots ,R$ with $N$ as the sequence length and $R$ the number of rules. We denote the tuple $\left( {{\mathbf{q}}_{nr},{\mathbf{q}}_{nr}^{\prime },{\mathbf{v}}_{nr},{\mathbf{v}}_{nr}^{\prime }}\right)$ as ${\mathbf{x}}_{n}$ . Further, ${\mathbf{y}}_{n}$ denotes the label for the regression tasks while for classification, we consider the categorical label to be $\operatorname{sign}\left( {\mathbf{y}}_{n}\right)$ . + +Thus, we can see that $\mathbf{c}_n$ denotes the rule for the $n^{th}$ token. This rule governs which two tokens are closest to the $n^{th}$ token, demonstrated as $\mathbf{s}_n$ and $\mathbf{s}_n'$ . It also governs what features are retrieved from the searched tokens, which are $\mathbf{v}_{\mathbf{s}_n\mathbf{c}_n}$ and $\mathbf{v}_{\mathbf{s}_n'\mathbf{c}_n}$ . These retrieved features then undergo a rule-dependent linear combination (on $\mathbf{c}_n$ ). Here, too, when training a modular MHA architecture, we want each MHA module in the system to be able to specialize to a unique MHA rule in the data system. + +RNN. For recurrent systems, we define a rule as a kind of linear dynamical system, where one of multiple rules can be triggered at any time-point. Mathematically, this process can be defined through Equations 12-15, where $n = 1,\dots N$ , with $N$ describing the sequence length. Each rule thus describes a different procedure for the update of the state $\mathbf{s}_t$ as well as the effect of the input $\mathbf{x}_t$ to the state. Thus, we can see that $\mathbf{c}_n$ + +$$ +\mathbf {c} _ {n} \stackrel {\text {i i d}} {\sim} \mathcal {U} \{1, R \} \tag {12} +$$ + +$$ +\mathbf {x} _ {n} \stackrel {\text {i i d}} {\sim} \mathcal {N} (0, I) \tag {13} +$$ + +$$ +\mathbf {s} _ {n} = A _ {c _ {n}} \mathbf {s} _ {n - 1} + B _ {c _ {n}} \mathbf {x} _ {n} \tag {14} +$$ + +$$ +\mathbf {y} _ {n} = \mathbf {w} ^ {T} \mathbf {s} _ {n} \tag {15} +$$ + +denotes the rule to be used at the $n^{th}$ time-point. Further, $\mathbf{y}_n$ denotes the label for the regression tasks while for classification, we consider the labels as $\mathrm{sign}(\mathbf{y}_n)$ . + +Hence, in all settings, the data comes from a MoE distribution where $c$ denotes the rule and governs the conditional $p_{y}(\cdot|\mathbf{x},c)$ . When training modular architectures on such data, one expects each module in the trained system to specialize according to a unique rule. Our aim is to use these synthetic rule-based data setting to study and analyse modular systems and understand whether end-to-end trained modular systems concentrate on the right information to specialize based on, i.e. based on $\mathbf{c}$ , whether they do learn perfect specialization and whether perfect specialization actually helps in these settings. To properly understand this, we detail the different kinds of models considered in Section 4 as well as the different metrics proposed in Section 5 to analyze trained systems. + +For this work, we limit our analysis to infinite-data regime where each training iteration operates on a new data sample. Future work would perform similar analysis in the regime of limited data. + +# 4 Models + +Several works claim that end-to-end trained modular systems outperform their monolithic counterparts, especially in out-of-distribution settings. However, there is a lack of step-by-step analysis on the benefits of such systems and whether they actually specialize according to the data generating distribution or not. To perform an in-depth analysis, we consider four different types of models that allow for varying levels of specialization, which are: Monolithic, Modular, Modular-op, and GT-Modular. We give the formulations for each of these models below and then discuss the different analysis we can perform through them. We also illustrate these models in Table 1 and depending on the data-generating procedure described in Section 3, $f$ and $f_{m}$ can be implemented as either MLP, MHA or RNN cells in this work. + +Monolithic. A monolithic system is a big neural network that takes the entire data $(\mathbf{x},\mathbf{c})$ as input and makes + +
ModelFunctional Form
Monolithic\(\hat{\mathbf{y}} = f(\mathbf{x}, \mathbf{c})\)
Modular\(\hat{\mathbf{y}}_m, p_m = f_m(\mathbf{x}, \mathbf{c})\) \(\hat{\mathbf{y}} = \sum_{m=1}^{R} p_m \hat{\mathbf{y}}_m\)
Modular-op\(\hat{\mathbf{y}}_m = f_m(\mathbf{x}, \mathbf{c})\) \(\mathbf{p} = g(\mathbf{c})\) \(\hat{\mathbf{y}} = \sum_{m=1}^{R} p_m \hat{\mathbf{y}}_m\)
GT-Modular\(\hat{\mathbf{y}}_m = f_m(\mathbf{x}, \mathbf{c})\) \(\hat{\mathbf{y}} = \sum_{m=1}^{R} c_m \hat{\mathbf{y}}_m\)
+ +Table 1: Functional Forms of Different Models. Exact functional forms of the different models considered in this work, given the data (x, c). Depending on context, $f$ and ${f}_{m}$ are either MLP,MHA or RNN architectures. + +predictions $\hat{\mathbf{y}}$ based on it. There is no inductive bias about modularity or sparsity explicitly baked in the system and it is completely up to back-propagation to learn whatever functional form is needed to solve the task. An example of such a system is a traditional Multi-Head Attention (MHA) based + +system, eg. a Transformer. + +Modular. A modular system is composed of a number of modules, each of which is a neural network of a given architectural type (MLP, MHA, or RNN). Each module $m$ takes the data $(\mathbf{x},\mathbf{c})$ as input and computes an output $\hat{\mathbf{y}}_m$ and a confidence score, normalized across modules into an activation probability $p_m$ . The activation probability reflects the contribution of each module's output to the final output $\hat{\mathbf{y}}$ of the system. Thus, there is an explicit baked-in inductive bias of modularity but it is still up to system-wide back-propagation to figure out the right specialization. An example of such a system is a mixture of MLPs or reusable RNNs, reusable across different time/positions. + +Modular-op. A modular-op (for operation only) system is very similar to the modular system with just one small difference. Instead of the activation probability $p_m$ of module $m$ being a function of $(\mathbf{x},\mathbf{c})$ , we instead make sure that the activation is decided only by the rule context + +c. Hence, unlike modular systems, modular-op cannot be distracted by $\mathbf{x}$ in figuring out specialization of different modules. Even though the operation required is explicitly provided, this model still needs to learn specialization through back-propagation. + +![](images/9a800f41decd87c681dd65d1ea4453d63e850f21e5f99f14b69e78241d327eeb.jpg) +Figure 2: Example of Collapse. Entry $(i,j)$ denotes the activation probability of module $j$ on rule $i$ . We see that Module 3 never activates, signifying collapse, while Module 4 covers two rules. + +GT-Modular. A GT-modular system (for ground truth) serves as an oracle benchmark, i.e., a modular system that specializes perfectly. In particular, the activation probability $p_m'$ s of modules are just set according to $c$ , which is the indicator present in the data $(\mathbf{x}, \mathbf{c})$ . Thus, this is a perfectly specializing system that chooses different modules sparsely and perfectly according to the different data rules. + +Given enough capacity, we can see that there is a hierarchy of models based on the functions they can implement, with GT-Modular $\subseteq$ Modular-op $\subseteq$ Modular $\subseteq$ Monolithic. Put differently, models from Monolithic to GT-Modular increasingly incorporate the inductive biases for modularity and sparsity. This is proved in Appendix C by inspecting the function classes implemented by these models. + +![](images/0b49e1b40fd693fc23540d7d97c4912dd3661733d1e093f8736e78a98933b9db.jpg) +Figure 3: Ranking Metric. Spread indicates the number of experiments where the corresponding model did better. Plots include Left: All models, Right: Models trained without explicit rule-based module selection. Note that (a) explicit specialization (GT-Modular) helps, and (b) Modular systems outperform Monolithic but with small margin. + +In what follows, we want to analyse the benefits of having simple end-to-end trained modular systems as opposed to monolithic ones. This can be understood through a comparison of various performance based metrics between Monolithic and Modular models, explained in the next section. This will allow us to answer if a modular architecture is always better for various distinct rule-based data generating systems. For instance, a comparison between the Modular and Modular-op models will show whether the stan + +dard modular systems are able to focus on the right information and ignore the distractors in driving specialization. To study this, we will look at performance as well as collapse and specialization metrics between these class of models. A comparison between GT-Modular and Modular-op will show the benefits of having a sparse activation pattern with proper resource allocation of modules as opposed to an end-to-end learned specialization on the right information (without distractors). + +Finally, we note that GT-Modular is a modular system which obtains perfect specialization. Through this model, we aim to analyse whether perfect specialization is in-fact important and if so, how far are typical modular systems from obtaining similar performance and specialization through end-to-end training. We now describe the metrics used for these evaluations. + +![](images/b8a561d5180b02c3c526af01a94e665e76c1588ed2fe07e59575ea2f24b6140b.jpg) + +![](images/2d1dc7ddcbff7985276fbf52d7271a9af3f860fcb6bf03900c68de634948f7d0.jpg) + +![](images/2aa758c15efcf14514a993a6550bc6ba8136f1a31e3a2f47bdb7c904e61dd43e.jpg) + +![](images/d1c76f1302744f16d6ca64663681f42e22332dc16abae2beef7a958a7718e417.jpg) + +![](images/3798929e18a00ef267f3cecc12e7e5bede121defd0f0385d1122df7854897dac.jpg) + +![](images/76278d48bc6c7369b1abc3583e87aa2ecb171f2acd558c2c9d8d3fb039534747.jpg) + +![](images/83c36c5813912e41793e081fe9e9bf97f21e620c165016e1ac8cfcff34558708.jpg) + +![](images/bd5d84bbdbcba5c6e1cf60a7772cafa3949cbc3d8e97b314001615d8500b9e80.jpg) + +![](images/0de9c582441c9a410f793bf5e9f19056d290d44c5b6b968cc8443559eeb9ee20.jpg) + +![](images/3bc3e5d8bade02fe32549466040df527a52fc59bb5ded97bde664a14a309bfeb.jpg) +GT-Modular Modular-op Modular Monolithic + +![](images/8e560f8c65c976d86807b600c1c65f7d108c2fb3833f458584b7af58f11e8e8e.jpg) +Figure 4: Performance Results. Performance of different models with MLP (top row), MHA (middle row) and RNN (bottom row) architectures against varying number of rules, evaluated both in-distribution and out-of-distribution. Modular systems generally outperform monolithic ones (lower is better) but a typical end-to-end trained modular system (green) is neither able to concentrate on the right information (compare with orange) nor able to get optimal specialization (compare with blue). + +![](images/943b63729f43259a4ce3fdaa282e0628c275c23a64b3e7bb2608e7572ac7649a.jpg) + +# 5 Metrics + +To reliably evaluate modular systems, we propose a suite of metrics that not only gauge the performance benefits of such systems but also evaluate them across two important modalities: collapse and specialization, which we use to analyse the extent of resource allocation (in terms of parameters/modules) and specialization respectively of a modular system. + +Performance. The first set of evaluation metrics are based on performance of the models in both in-distribution as well as out-of-distribution (OoD) settings. These metrics capture how well the different models perform on a wide variety of different tasks. For classification settings, we report the classification error while for regression settings, we report the loss. + +In-Distribution. This refers to the in-distribution performance, evaluated by looking at both the final performance as well as convergence speeds of the different models. + +Out-of-Distribution. This refers to the OoD performance of different models. We consider very simple forms of OoD generalization: either (a) change in distribution of $\mathbf{x}$ by increasing variance, or (b) different sequence lengths, wherever the possibility presents (eg. in MHA and RNN). + +Collapse Metrics. We propose a set of metrics Collapse-Avg and Collapse-Worst that quantify the amount of collapse suffered by a modular system. Collapse refers to the degree of under-utilization of the modules. An example of this is illustrated in Figure 2, where we can see that Module 3 is never used. We consider the setting where all the data rules are equi-probable and the number of modules in the model are set to be the same as the number of data rules, to $R$ . High collapse thus refers to under-utilization of resource (parameters) provided to the model, illustrating that certain modules are never being used and concurrently meaning that certain modules are being utilized for multiple rules. + +Collapse-Avg. Given the data-setting with $R$ equi-probable rules, and hence $R$ modules in the model, we let $p(m)$ be the marginal probability + +$$ +C _ {A} = \frac {R}{R - 1} \sum_ {m = 1} ^ {R} \max \left(0, \frac {1}{R} - p (m)\right) \tag {16} +$$ + +distribution of activation of module $m$ . Then, we define the Collapse-Avg metric $C_A$ as in Equation + +![](images/2a9a8995cb5773807ea6508b3b521b35eda7388d900828489618642009701cb8.jpg) +Figure 5: Metrics against Increasing Number of Rules. Evaluation of different modular systems through collapse (first two columns) and specialization (next three columns) metrics (lower is better) while varying the number of rules. We see that the problems increase with more rules. + +16, where $\frac{R}{R - 1}$ is for normalization. This metric captures the amount of under-utilization of all the modules of the system. A lower number is preferable for this metric, as a lower number demonstrates that all the modules are equally utilized. + +Collapse-Worst. Given the same data and model setting as above, $C_W = 1 - R \min_m p(m)$ (17) the Collapse-Worst metric $C_W$ is defined as in Equation 17. This metric captures the amount of under-utilization of the least used module of the system. Again, a low number is preferable as it signifies that even the least used module is decently utilized by the model. + +Specialization Metrics. To complement collapse metrics, we also propose a set of metrics, (1) Alignment, (2) Adaptation and (3) Inverse Mutual Information to quantify the amount of specialization obtained by the modular systems. We again consider the setting of equi-probable rules and the same number of modules and rules $R$ . These metrics are aimed at capturing how well the modules specialize to the rules, that is, whether different modules stick to different rules (good specialization) or whether all modules contribute almost equally to all rules (poor specialization). + +Alignment. Given a modular system trained on rule-based data with $R$ rules and modules, one can obtain the activation matrix $\mathbf{A}$ , where $\mathbf{A}_{rm}$ denotes $p(\mathrm{module} = m \mid \mathrm{rule} = r)$ , that is, the probability of + +activation of module $m$ conditioned on rule $r$ . Further, given a distance metric $d(\cdot, \cdot)$ over the space of matrices, perfect specialization can be quantified through Equation 18, where $\mathbf{S}_R$ denotes the space of permutation matrices over $R$ objects. We consider $d(\cdot, \cdot)$ as a normalized $L_1$ distance. The score $s_d$ demonstrates the distance between the activation matrix $A$ and its closest permutation matrix, with distances computed according to the metric $d(\cdot, \cdot)$ . Note that $s_d \to 0$ implies that each module specializes to a unique rule, thereby signifying perfect specialization. Since the space of permutation matrices $\mathbf{S}_R$ grows exponentially at the rate of $\Theta(R!)$ , computing $s_d$ naively soon becomes intractable. However, we use the Hungarian algorithm (Kuhn, 1955) to compute it in polynomial time. This metric shows how close the learned modular system is to a perfectly specializing one, where a low score implies better specialization. + +Inverse Mutual Information. Given $R$ as the number of rules and modules and let the joint distribution $p(m, r)$ denote the + +$$ +S _ {I M I} = 1 - \frac {1}{\log R} \mathbb {E} _ {p (m, r)} \left[ \log \frac {p (m , r)}{p (m) \times p (r)} \right] \tag {19} +$$ + +activation probability of module $m$ on rule $r$ , the Inverse Mutual Information metric $S_{IMI}$ is defined as in Equation 19. A low inverse mutual information metric is preferable as it denotes that the modules are more specialized to the rules as opposed to multiple modules contributing to a single rule. + +Adaptation. Let $R$ be the number of rules and modules and $\mathcal{P}$ a distribution over the $R$ -dimensional simplex. Further, let $p(\cdot)$ be the distribution over rules (not equi-probable in this metric) and $q(\cdot)$ the corresponding + +$$ +S _ {A} = \mathbb {E} _ {p \sim \mathcal {P}} \left[ \sum_ {i = 1} ^ {R} \left| p \left(\hat {r} _ {i}\right) - q \left(\hat {m} _ {i}\right) \right| \right] \tag {20} +$$ + +distribution obtained over the modules. Note that the distribution $q(\cdot)$ is dependent on $p(\cdot)$ . Given these distributions, we define the Adaptation metric $S_A$ in Equation 20, where $\hat{r}_i$ and $\hat{m}_i$ are such that $p(\hat{r}_1) \leq p(\hat{r}_2) \leq \ldots \leq p(\hat{r}_R)$ and $q(\hat{m}_1) \leq q(\hat{m}_2) \leq \ldots \leq q(\hat{m}_R)$ and $\mathcal{P}$ is a dirichlet distribution. + +This metric can be understood as the amount by which the modules adapt (signified through the distribution $q(\cdot)$ ) to changes in the rule distributions (which are $p(\cdot)$ sampled from $\mathcal{P}$ ). The matching between the rule and module is obtained through a simple sort as defined above. A low adaptation score implies that the marginal distribution of the modules adapt well according to the distribution of the rules. That is, when a rule is weakly present in the data, there exists a module which weakly contributes in the corresponding output, averaged over multiple different rule distributions. + +![](images/46a70e176fb854bf38b94ca9f9c76dd6b641121b656199cbfe29dee6d33539c1.jpg) +Figure 6: Metrics for Different Models. While end-to-end training of activation decisions leads to reduced collapse (first two columns) and better specialization (next three columns) (lower is better) than random activations, it is still far from a perfectly specializing system. This signifies that the models are not able to learn good specialization and actually suffer from increased collapse when learned solely through back-propagation. + +To understand these metrics, note that uniform random activation patterns for the modules lead to low collapse metrics but high alignment, adaptation and inverse mutual information metrics, implying little collapse but poor specialization, as expected. On the other hand, GT-Modular systems necessarily lead to low collapse metrics as well as low alignment, adaptation and inverse mutual information, denoting little collapse and good specialization, which is expected since specialization is given as oracle. + +# 6 Experiments + +We are now ready to report experiments on the models outlined in Section 4 with associated data generation processes described in Section 3. For each level of modularity (i.e. Monolithic, Modular, Modular-op, GT-Modular), we analyse models learning over five different number of rules, ranging from few (2) to many (32), five different model capacities (number of parameters) and two different training settings, i.e. regression and binary classification. To remove any biases towards particular task parameters (e.g. $\alpha_{c},\beta_{c}$ in Equation 6), we randomly select new rules to create five different tasks per setting and, train five seeds per task. In essence, we train $\sim 20,000$ models² to properly analyse the benefits of modularity, the level of specialization obtained by end-to-end trained systems, + +the impact of number of rules and the impact of model capacity. + +Performance. We refer the readers to Figure 3 for a compressed overview on the performance of various models. We see that GT-Modular system wins most of the times (left), indicating the benefits of perfect specialization. We also see that between standard end-to-end trained Modular and Monolithic systems, the former outperforms but not by a huge gap. Together, these two pie charts indicate that current end-to-end trained modular systems do not achieve good specialization and are thus sub-optimal by a substantial margin. + +We then look at the specific architectural choices (MLP, MHA and RNN cells for functions $f$ and $f_{m}$ in Table 1) and analyse their performance and trends across increasing number of rules. Figure 4 shows that while there are concrete benefits of a perfectly specializing system (GT-Modular) or even models that know what information to drive specialization from (Modular-op), typical end-to-end trained Modular systems are quite sub-optimal and not able to realize these benefits, especially with increasing number of rules which is where we see substantial benefits of good specialization (contrast Modular vs GT-Modular and Modular-op). Moreover, while such end-to + +![](images/9facbe02b1a72e1107212883e55370d411ac478f00242fe2fc87d929daab4dbb.jpg) +Figure 7: Training Curve. Averaged over different model architectures, training settings, model capacities and number of rules. We see that end-to-end trained modular systems are still far from the benefits of perfect specialization. + +end Modular systems do generally outperform the Monolithic ones, it is often only by a small margin. + +We also see the training pattern of different models averaged over all other settings, with the average containing error for classification and loss for regression, in Figure 7. We can see that good specialization not only leads to better performances but also faster training. + +Collapse. We evaluate all the models on the two collapse metrics outlined in Section 5. Figure 5 shows the two collapse metrics, Collapse-Avg and Collapse-Worst, for different models against + +varying number of rules, averaged over the different model architectures (MLP, MHA and RNN), training settings (Classification and Regression), model capacities, tasks and seeds. First, we notice that a Random activation baseline and the GT-Modular system do not have any collapse, which is expected. Next, we notice that both Modular and Modular-op suffer from the problems of collapse and this problem becomes worse with increasing number of rules. Figure 6 further shows similar information averaged over the number of rules too, highlighting that Modular-op has less collapse than Modular in general. However, we still see that the problem of collapse is significant whenever back-propagation is tasked with finding the right activation patterns, especially in the regime of large number of rules. This clearly indicates the need for investigation into different forms of regularizations to alleviate some of the collapse problems. + +Specialization. Next, we evaluate through the proposed specialization metrics in Section 5 whether the end-to-end trained modular systems actually specialize according to the data-generating distribution. Figure 5 shows the three specialization metrics, Alignment, Adaptation and Inverse Mutual Information, for different models against varying number of rules, again averaged over different model architectures, training settings, model capacities, tasks and seeds. As expected, we see that the Random activation baseline has poor specialization (high metrics) while the GT-Modular system has very good specialization. We further see that end-to-end trained Modular systems as well as Modular-op suffer from sub-optimal specialization, as indicated by the high metrics. As with collapse, we again see that it becomes harder to reach optimal specialization with increasing number of rules. Figure 6 shows that while Modular-op has marginally better specialization than standard Modular systems, they are indeed quite sub-optimal when compared to a perfectly specializing system, i.e. GT-Modular. + +We refer the readers to Appendix D, E and F for training details as well as additional experiments regarding the effect of model sizes for MLP, MHA and RNN architectures respectively. + +# 7 Conclusion and Discussion + +We provide a benchmark suitable for the analysis of modular systems and provide metrics that not only evaluate them on in-distribution and out-of-distribution performance, but also on collapse and specialization. Through our large-scale analysis, we uncover many intriguing properties of modular systems and highlight potential issues that could lead to poor scaling properties of such systems. + +Perfect Specialization. We discover that perfect specialization indeed helps in boosting performance both in-distribution and out-of-distribution, especially in the regime of many rules. On the contrary, monolithic systems often do comparatively or sometimes better when there are only a few rules, but do not rely on specialization to do so. + +End-to-End Trained Modular systems. While Modular systems outperform Monolithic ones, the margin of improvement is often small. This is because when solely relying on back-propagation of the task-losses, these models do not discover perfect specialization. In fact, the problem of poor specialization and high collapse becomes worse with increasing number of rules. This is slightly mitigated by allowing contextual information from the task to be used explicitly, as is the case for Modular-op, but the problems still persist and get worse over large number of rules. + +In summary, through systematic and extensive experiments, this work shows that modularity, when supporting good and distributed specialization (i.e. little collapse), can outperform monolithic models both in and out of distribution testing. However, we also find that although perfectly specialized solutions are attainable by modular networks, end-to-end training does not recover them, often even with explicit information about task context (as in Modular-op). Since real-world data distributions are often complex and unknown, we cannot get access to oracle networks like GT-Modular for analysis. An important conclusion is that additional inductive biases are required to learn adequately specialized solutions. These could include other architectural features to facilitate module routing, or regularization schemes (e.g. load-balancing Fedus et al. (2021)) or optimization strategies (e.g. learning rate scheduling) to promote module specialization. We refer the reader to Appendices A and B for further discussion on these exciting prospects and extensions to real-world domains. We believe the framework proposed in this work is ideal to drive research into such inductive biases and a necessary stepping stone for applications of these designs at scale. + +Finally, we highlight that the use of network architectures that promote contextual specialization, such as the use of modules as studied here, could potentially promote unwanted biases when deployed in models use by the public due to collapse or ill-distributed specialization. The framework proposed in this work could help mitigate this potentially problematic impact on society. + +# Acknowledgments and Disclosure of Funding + +SM would like to acknowledge the support of scholarships from UNIQUE and IVADO as well as compute resources from Alliance and its regional partner organizations (ACENET, Calcul Quebec, Compute Ontario, the BC DRI Group and the Prairie DRI Group) towards his research. YB and GL acknowledge the support from Canada CIFAR AI Chair Program, as well as Samsung Electronics Co., Ldt. GL acknowledges NSERC Discovery Grant [RGPIN-2018-04821]. + +# References + +Andreas, J., Rohrbach, M., Darrell, T., and Klein, D. Neural module networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 39-48, 2016. +Baars, B. J. In the theatre of consciousness. global workspace theory, a rigorous scientific theory of consciousness. Journal of Consciousness Studies, 4(4):292-309, 1997. +Bahdanau, D., Cho, K., and Bengio, Y. Neural machine translation by jointly learning to align and translate. *ICLR'2015*, arXiv:1409.0473, 2015. +Battaglia, P. W., Hamrick, J. B., Bapat, V., Sanchez-Gonzalez, A., Zambaldi, V., Malinowski, M., Tacchetti, A., Raposo, D., Santoro, A., Faulkner, R., et al. Relational inductive biases, deep learning, and graph networks. arXiv preprint arXiv:1806.01261, 2018. +Bengio, Y. Deep learning of representations: Looking forward. In International conference on statistical language and speech processing, pp. 1-37. Springer, 2013. +Bengio, Y. The consciousness prior. arXiv preprint arXiv:1709.08568, 2017. +Bengio, Y., Deleu, T., Rahaman, N., Ke, N. R., Lachapelle, S., Bilaniuk, O., Goyal, A., and Pal, C. A meta-transfer objective for learning to disentangle causal mechanisms. In *ICLR'2020*, arXiv:1901.10912, 2019. +Csordás, R., van Steenkiste, S., and Schmidhuber, J. Are neural nets modular? inspecting functional modularity through differentiable weight masks. arXiv preprint arXiv:2010.02066, 2020. +Cui, L. and Jaech, A. Re-examining routing networks for multi-task learning. 2020. +Dehaene, S., Lau, H., and Kouider, S. What is consciousness, and could machines have it? Science, 358(6362):486-492, 2017. +Du, N., Huang, Y., Dai, A. M., Tong, S., Lepikhin, D., Xu, Y., Krikun, M., Zhou, Y., Yu, A. W., First, O., et al. Glam: Efficient scaling of language models with mixture-of-experts. arXiv preprint arXiv:2112.06905, 2021. +Fedus, W., Zoph, B., and Shazeer, N. Switch transformers: Scaling to trillion parameter models with simple and efficient sparsity. arXiv preprint arXiv:2101.03961, 2021. +Fox, E., Sudderth, E., Jordan, M., and Willsky, A. Nonparametric bayesian learning of switching linear dynamical systems. Advances in neural information processing systems, 21, 2008. +Fox, E. B., Sudderth, E. B., Jordan, M. I., and Willsky, A. S. Bayesian nonparametric inference of switching linear dynamical systems. arXiv preprint arXiv:1003.3829, 2010. +Glaser, J., Whiteway, M., Cunningham, J. P., Paninski, L., and Linderman, S. Recurrent switching dynamical systems models for multiple interacting neural populations. Advances in neural information processing systems, 33:14867-14878, 2020. +Goyal, A. and Bengio, Y. Inductive biases for deep learning of higher-level cognition. arXiv preprint arXiv:2011.15091, 2020. +Goyal, A., Lamb, A., Hoffmann, J., Sodhani, S., Levine, S., Bengio, Y., and Scholkopf, B. Recurrent independent mechanisms. arXiv preprint arXiv:1909.10893, 2019. +Goyal, A., Didolkar, A., Ke, N. R., Blundell, C., Beaudoin, P., Heess, N., Mozer, M., and Bengio, Y. Neural production systems. arXiv preprint arXiv:2103.01937, 2021. +Graves, A., Wayne, G., and Danihelka, I. Neural tuning machines. arXiv preprint arXiv:1410.5401, 2014. +Higgins, I., Matthew, L., Pal, A., Burgess, C., Glorot, X., Botvinick, M., Mohamed, S., and Lerchner, A. beta-vae: Learning basic visual concepts with a constrained variational framework. 2016. + +Hu, R., Andreas, J., Rohrbach, M., Darrell, T., and Saenko, K. Learning to reason: End-to-end module networks for visual question answering. In Proceedings of the IEEE International Conference on Computer Vision, pp. 804-813, 2017. +Ke, N. R., Didolkar, A. R., Mittal, S., Goyal, A., Lajoie, G., Bauer, S., Rezende, D. J., Mozer, M. C., Bengio, Y., and Pal, C. Systematic evaluation of causal discovery in visual model based reinforcement learning. 2021. +Kim, H. and Mnih, A. Disentangling by factorising. In International Conference on Machine Learning, pp. 2649-2658. PMLR, 2018. +Kipf, T., Fetaya, E., Wang, K.-C., Welling, M., and Zemel, R. Neural relational inference for interacting systems. arXiv preprint arXiv:1802.04687, 2018. +Kuhn, H. W. The hungarian method for the assignment problem. Naval research logistics quarterly, 2(1-2):83-97, 1955. +Lepikhin, D., Lee, H., Xu, Y., Chen, D., First, O., Huang, Y., Krikun, M., Shazeer, N., and Chen, Z. Gshard: Scaling giant models with conditional computation and automatic sharding. arXiv preprint arXiv:2006.16668, 2020. +Linderman, S. W., Miller, A. C., Adams, R. P., Blei, D. M., Paninski, L., and Johnson, M. J. Recurrent switching linear dynamical systems. arXiv preprint arXiv:1610.08466, 2016. +Locatello, F., Weissenborn, D., Unterthiner, T., Mahendran, A., Heigold, G., Uszkoreit, J., Dosovitskiy, A., and Kipf, T. Object-centric learning with slot attention. arXiv preprint arXiv:2006.15055, 2020. +Madan, K., Ke, R. N., Goyal, A., Scholkopf, B. B., and Bengio, Y. Fast and slow learning of recurrent independent mechanisms. arXiv preprint arXiv:2105.08710, 2021. +Masoudnia, S. and Ebrahimpour, R. Mixture of experts: a literature survey. Artificial Intelligence Review, 42(2):275-293, 2014. +Maziarz, K., Kokiopoulou, E., Gesmundo, A., Sbaiz, L., Bartok, G., and Berent, J. Flexible multi-task networks by learning parameter allocation. arXiv preprint arXiv:1910.04915, 2019. +Mittal, S., Lamb, A., Goyal, A., Voleti, V., Shanahan, M., Lajoie, G., Mozer, M., and Bengio, Y. Learning to combine top-down and bottom-up signals in recurrent neural networks with attention over modules. In International Conference on Machine Learning, pp. 6972-6986. PMLR, 2020. +Mittal, S., Raparthy, S. C., Rish, I., Bengio, Y., and Lajoie, G. Compositional attention: Disentangling search and retrieval. arXiv preprint arXiv:2110.09419, 2021. +Peters, J., Janzing, D., and Scholkopf, B. Elements of causal inference: foundations and learning algorithms. The MIT Press, 2017. +Rahaman, N., Gondal, M. W., Joshi, S., Gehler, P., Bengio, Y., Locatello, F., and Scholkopf, B. Dynamic inference with neural interpreters. Advances in Neural Information Processing Systems, 34, 2021. +Rosenbaum, C., Cases, I., Riemer, M., and Klinger, T. Routing networks and the challenges of modular and compositional computation. arXiv preprint arXiv:1904.12774, 2019. +Santoro, A., Faulkner, R., Raposo, D., Rae, J., Chrzanowski, M., Weber, T., Wierstra, D., Vinyals, O., Pascanu, R., and Lillicrap, T. Relational recurrent neural networks. arXiv preprint arXiv:1806.01822, 2018. +Shazeer, N., Mirhoseini, A., Maziarz, K., Davis, A., Le, Q., Hinton, G., and Dean, J. Outrageously large neural networks: The sparsely-gated mixture-of-experts layer. arXiv preprint arXiv:1701.06538, 2017. +Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., and Polosukhin, I. Attention is all you need. In Advances in neural information processing systems, pp. 5998-6008, 2017. + +Wang, Y., Mukherjee, S., Liu, X., Gao, J., Awadallah, A. H., and Gao, J. Adamix: Mixture-of-adapter for parameter-efficient tuning of large language models. arXiv preprint arXiv:2205.12410, 2022. +Wulsin, D., Fox, E., and Litt, B. Parsing epileptic events using a markov switching process model for correlated time series. In International Conference on Machine Learning, pp. 356-364. PMLR, 2013. +Yuksel, S. E., Wilson, J. N., and Gader, P. D. Twenty years of mixture of experts. IEEE transactions on neural networks and learning systems, 23(8):1177-1193, 2012. +Zuo, S., Liu, X., Jiao, J., Kim, Y. J., Hassan, H., Zhang, R., Zhao, T., and Gao, J. Taming sparsely activated transformer with stochastic experts. arXiv preprint arXiv:2110.04260, 2021. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] See Appendix A +(c) Did you discuss any potential negative societal impacts of your work? [N/A] +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] +(b) Did you include complete proofs of all theoretical results? [Yes] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [N/A] +(b) Did you mention the license of the assets? [N/A] +(c) Did you include any new assets either in the supplemental material or as a URL? [N/A] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/isamodulararchitectureenough/images.zip b/isamodulararchitectureenough/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..21ce0925c163eea146b3df50c6ffdbc27fa8adcf --- /dev/null +++ b/isamodulararchitectureenough/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5cbf0ac573d682431457bec2e250d79563c1882ea8333d687cad15bf41ad3a6a +size 290818 diff --git a/isamodulararchitectureenough/layout.json b/isamodulararchitectureenough/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..2a8633d17be5e37ecd157cee04157e1d7477792d --- /dev/null +++ b/isamodulararchitectureenough/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4dae40f5842312fcb3fed06b8ede5466c26c63a0528236535a8b7bef7ab4ce2b +size 455106 diff --git a/isintegerarithmeticenoughfordeeplearningtraining/48e5dfbd-b906-4512-8ea0-2722b4f4ec43_content_list.json b/isintegerarithmeticenoughfordeeplearningtraining/48e5dfbd-b906-4512-8ea0-2722b4f4ec43_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..d7d44af8ea6f5d1cfae3bae7eff80998fb77834c --- /dev/null +++ b/isintegerarithmeticenoughfordeeplearningtraining/48e5dfbd-b906-4512-8ea0-2722b4f4ec43_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd71229a28aea576870494fae246d47bd4df086df1f1facd16d6554d0436dc38 +size 75437 diff --git a/isintegerarithmeticenoughfordeeplearningtraining/48e5dfbd-b906-4512-8ea0-2722b4f4ec43_model.json b/isintegerarithmeticenoughfordeeplearningtraining/48e5dfbd-b906-4512-8ea0-2722b4f4ec43_model.json new file mode 100644 index 0000000000000000000000000000000000000000..5e11e067e0896e5f5b79890118cb36362c157b18 --- /dev/null +++ b/isintegerarithmeticenoughfordeeplearningtraining/48e5dfbd-b906-4512-8ea0-2722b4f4ec43_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fd984a99070b29be43c1f7fcc349924b6e16be5cc364885ff458506bb824d1ea +size 91689 diff --git a/isintegerarithmeticenoughfordeeplearningtraining/48e5dfbd-b906-4512-8ea0-2722b4f4ec43_origin.pdf b/isintegerarithmeticenoughfordeeplearningtraining/48e5dfbd-b906-4512-8ea0-2722b4f4ec43_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..3d628da7fc2948f03d2d75edbdee927f5ff4d4ea --- /dev/null +++ b/isintegerarithmeticenoughfordeeplearningtraining/48e5dfbd-b906-4512-8ea0-2722b4f4ec43_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0baf3100d873874779c7ef366e1846c235495fdc725718622e582867b9ee5d9d +size 734526 diff --git a/isintegerarithmeticenoughfordeeplearningtraining/full.md b/isintegerarithmeticenoughfordeeplearningtraining/full.md new file mode 100644 index 0000000000000000000000000000000000000000..52c0dc63096a4a8c46abe707283c836d32363993 --- /dev/null +++ b/isintegerarithmeticenoughfordeeplearningtraining/full.md @@ -0,0 +1,324 @@ +# Is Integer Arithmetic Enough for Deep Learning Training? + +Alireza Ghaffari $^{1}$ Marzieh S. Tahaei $^{1}$ Mohammadreza Tayaranian $^{1}$ Masoud Asgharian $^{2}$ Vahid Partovi Nia $^{1}$ + +1 Huawei Noah's Ark Lab, Montreal Research Center + +$^{2}$ Department of Mathematics and Statistics, McGill University {alireza.ghaffari, marzieh.tahaei, mohammadreza.tayaranian}@huawei.com vahid/partovinia@huawei.com masoud.asgharian2@mcgill.ca + +# Abstract + +The ever-increasing computational complexity of deep learning models makes their training and deployment difficult on various cloud and edge platforms. Replacing floating-point arithmetic with low-bit integer arithmetic is a promising approach to save energy, memory footprint, and latency of deep learning models. As such, quantization has attracted the attention of researchers in recent years. However, using integer numbers to form a fully functional integer training pipeline including forward pass, back-propagation, and stochastic gradient descent is not studied in detail. Our empirical and mathematical results reveal that integer arithmetic seems to be enough to train deep learning models. Unlike recent proposals, instead of quantization, we directly switch the number representation of computations. Our novel training method forms a fully integer training pipeline that does not change the trajectory of the loss and accuracy compared to floating-point, nor does it need any special hyper-parameter tuning, distribution adjustment, or gradient clipping. Our experimental results show that our proposed method is effective in a wide variety of tasks such as classification (including vision transformers), object detection, and semantic segmentation. + +# 1 Introduction + +Recently, deep learning models have evolved to deliver acceptable performance in many areas such as computer vision, natural language processing, and speech recognition. However, the number of parameters and computational complexity of most deep learning applications have increased significantly. This ever-increasing computational complexity makes the deployment of deep neural networks harder on edge devices. Furthermore, the energy required to train a deep learning model increases proportionately with computational complexity. Thus, the training cost of these large and complex models also increases significantly on the high-end cloud servers. Although, quantization techniques are commonly used to accelerate inference of deep learning models, here we target a fully integer training pipeline (i.e. forward propagation, back-propagation and SGD). Unlike recent proposals in quantized back-propagation, we directly change the number representation of floating-point values. Furthermore, we show empirically and theoretically that our proposed integer training methodology is effective in training deep learning models with integer-only arithmetic. + +Despite the fact that accelerated training using integer back-propagation seems intriguing, there are some challenges associated with integer gradient computation. For example, (i) gradients must be scaled correctly in order to be adapted to the limited dynamic range of the integer number (e.g. int8: $[-128, 127]$ ). (ii) The numerical error of the gradient must be unbiased in order to preserve the convergence trajectory of the training algorithm. A small numerical error can be accumulated + +through the course of training and change the convergence behaviour. (iii) The integer training must be distribution independent, i.e. the training method should not depend on the distribution of the gradients, weights, or training data. + +We propose a novel integer training method designed to address aforementioned challenges (i), (ii) and (iii) simultaneously. Having a linear dynamic fixed-point mapping coupled with a non-linear inverse mapping is the key to full integer training. + +To this end, we make the following contributions: + +- A hardware-friendly integer training method is proposed based on extracting the maximum floating-point exponent of the tensors as the scale. We propose linear fixed-point mapping of tensors, while the corresponding inverse mapping for floating-point is non-linear. Our proposed method addresses all the previously mentioned challenges: (i) it computes the scales dynamically, and moreover the scale does not need to be adjusted in the course of training; (ii) it provides an unbiased estimation of the gradients and consequently, its convergence trajectory closely follows the floating-point version; (iii) our proposed representation mapping does not depend on the distribution of the training data, weights, or gradients. +- We study the optimality gap of our proposed integer training algorithm and show it is analogous to its floating-point counterpart in the course of training (Theorem 1). Our analysis of stochastic gradient descent with our proposed fixed-point gradients shows the original floating-point optimality gap is only shifted by a negligible amount (Remark 3). +- Our proposed method effectively performs all operations required in modern neural networks using integer-only arithmetic. For instance, the computation of linear layer, convolutional layer, batch-norm and layer-norm, residual connections and also stochastic gradient descent (including gradients, momentum, weight decay, and weight update) are all performed in integer arithmetic. To the best of our knowledge, this is the first time that back-propagation of a batch-norm, and the computation of stochastic gradient descent (SGD) is performed in integer arithmetic with negligible loss in the accuracy for large datasets such as ImageNet. + +The rest of this paper is structured as follows. Section 2 reviews some previous works in the field of quantized back-propagation and quantifies the similarities and differences with our representation mapping method. Section 3 discusses our integer training methodology in detail. Theoretical aspects of our integer training method on SGD are studied in Section 4. Experimental results supporting our integer training methodology and convergence theory are presented in Section 5. + +# 2 Related works + +Banner et al. [1], proposed a bifurcated back-propagation method where the gradient of weights are in floating-point format and input gradients are in 8-bit fixed-point format. Moreover, they proposed a range-based batch-norm which is more tolerant to quantization noise. The main difference of our proposed algorithm with Banner et al. [1] is that our integer training method does not demand bifurcation. In other words, our gradients with respect to weights and inputs are represented and computed using int8 format. Furthermore, in our method, the back-propagation of batch-norm, as well as stochastic gradient descent (SGD) algorithm, are also represented and computed using integer values. Zhang et al. [2] have proposed a layer-wise "precision-adaptive" quantization method that does not affect the distribution of the data. In their method, the quantization error is measured and the quantization scale is adjusted over the course of training accordingly. Similarly, in Zhao et al. [3] a distribution adaptive quantization method is proposed that takes into account the distribution of gradients in the channel dimension. In addition, they introduced a gradient clipping strategy in order to normalize the magnitude of the gradients in the back-propagation. The scale of the quantization is adapted to the distribution of the gradients and adjusted iteratively over the course of training. Unlike the distribution adaptive methods such as [2,3], our proposed integer training method does not depend on the distribution of training data, weights, and gradients. Thus, there is no need to adjust the scale iteratively in the course of training. In Zhu et al. [4], a "direction sensitive gradient clipping method" is proposed to avoid inappropriate updates in the back-propagation. Moreover, they proposed a learning rate scaling that tackles the problem of unbiased gradient error accumulation. In a similar work, Sakr and Shanbhag [5] proposed a precision assignment methodology to improve the convergence of the quantized back-propagation. This precision assignment is based on some criterion + +on internal accumulator noise, quantization noise of backward and forward propagation, and gradient clipping. Unlike [45], our proposed method enjoys having the advantage of unbiased gradients, hence the convergence trajectory closely follows the floating-point counterpart. Thus, our method does not need any specific gradient correction, gradient clipping strategy, and learning rate corrections as opposed to [45]. Jin et al. [6] proposed a unified fixed-point and parameterized clipping activation to achieve high accuracy. Furthermore, they proposed a method that directly trains the fractional length (i.e. scale) of the fixed-point quantization. Additionally, they use a double forward batch-norm fusion to determine the scaling factor of the batch-norm layer in the forward propagation, while the back-propagation of batch-norm remains floating-point. In contrast, our proposed integer training method is capable of implementing integer variant of the batch-norm layer in forward propagation without double fusion as opposed to [6]. We also perform batch-norm's back-propagation in integer arithmetic which was ignored in the previous works. Note that back-propagation of batch-norm and layer-norm is sensitive to quantization, as such, naive quantization leads to training divergence. Additionally, we perform stochastic gradient descent (SGD) computation including weight update, weight decay, and momentum in integer arithmetic with no significant loss of accuracy. Wang et al. [7] explored an integer-arithmetic implementation of some preliminary CNN architectures such as AlexNet, however they experienced considerable accuracy drop for ImageNet dataset. Moreover, more complicated architectures such as ResNet and transformers are not considered. In our proposed method, we used dynamic fixed-point number format [8] as the primary number format for integer training. This specific fixed-point number format (also known as block floating-point format) has been used previously to quantize inference of deep learning models in Courbariaux et al. [8], Drumond et al. [9], and Rouhani et al. [10]. + +# 3 Methodology + +Common quantization methods, which use division and clipping techniques (refer to Appendix A.6), are inefficient for back-propagation. Therefore, we decided to go one step deeper and change the number format directly. Here, we propose a hardware-friendly number representation mapping using the dynamic fixed-point number format where the scale is defined per tensor. In this approach, each tensor can be represented by its int8 version while it is multiplied by a shared scale, as opposed to other methods that allow multiple shared scales for different partitions of the tensor (see Rouhani et al. [10, Figure 4]). One shared scale per tensor makes the computations easier in the computing hardware (e.g. CPU or GPU). However, the training algorithm diverges if the representation mapping is not executed properly. To tackle this problem, we suggest two subtle changes; (i) we propose to perform fixed-point mapping of a tensors in a linear fashion while the inverse mapping is non-linear as explained in Sections 3.1 and 3.2. This is the key to success of our algorithm since a linear fixed-point mapping allows monotonic conversion of floating-point format to fixed-point, while a non-linear inverse mapping allows preserving information. (ii) We suggest to use stochastic rounding in the back-propagation in a way that preserves the expected value of the tensors as well as their vital statistics, such as the mean. Stochastic rounding in conjunction with representation mapping is crucial to keep the integer training loss trajectory close to its floating-point counterpart. + +# 3.1 Linear fixed-point mapping + +Our proposed integer training method is based on manipulating the floating-point number format. This is a very simple and effective way of converting floating-point values to fixed-point values as opposed to other commonly used methods that involve division operation. Our method essentially uses shift and round operations to convert floating-point to fixed-point format, see Figure 1(a). + +In this method, a tensor comprising $n$ floating-point numbers $(f_{1}, f_{2}, \ldots, f_{n})$ is converted to a fixed-point tensor. First, as shown in Figure I(a), sign, exponent, and mantissa of each floating-point number are extracted using the unpack to integer function. For instance, $f_{1}$ is unpacked to $s_{1}, e_{1}, m_{1}$ where $(s, e, m)$ is used to denote (sign, exponent, mantissa). We simply find the maximum element of $e_{1}, e_{2}, \ldots, e_{n}$ i.e. $e_{\max} = \max(e_{1}, e_{2}, \ldots, e_{n})$ to extract the shared scale of the tensor. Subsequently, the original mantissas are shifted to the right according to the difference of their exponent and $e_{\max}$ to get the individual mantissas. For instance, $m_{1}$ is shifted to right by $e_{\max} - e_{1}$ which is denoted by $m_{1} >> (e_{\max} - e_{1})$ . By shifting mantissas to right, we intentionally push the small values to the sub-normal region, where the most significant bit of mantissa is not 1 in binary format i.e. $(1)_{2}$ , see Zuras et al. [I]. Pushing the mantissas to the sub-normal region is performed to align their exponents + +![](images/b425272fa8ad14553d75c6b4768029bbcb393bfd37aa63ce0f55aef3d65665da.jpg) +(a) + +![](images/6acb8f8a8efcee818146736bd37d9c4f35a28fc85ecb1fa6364ebd49ab9f6544.jpg) +(b) +Figure 1: (a) Linear fixed-point mapping, (b) Non-linear inverse mapping. + +with $e_{\mathrm{max}}$ and this unifies the scale for fixed-point values in a tensor. In the next step, to create int8 mantissas, the 24-bit single floating-point mantissas (i.e. 23-bit mantissa + 1 implicit hidden bit) are further rounded to 7-bit mantissas to construct signed int8 values i.e 7-bit unsigned integer and 1 sign bit. As an example, let us assume the shifted mantissa is $(0.01011001010101010100000)_{2}$ , then it is going to be randomly rounded to either $(0.010110)_{2}$ or $(0.010111)_{2}$ based on a probability (Refer to A.1 for details). + +# 3.2 Non-linear inverse mapping + +Our proposed fixed-point mapping method is performed by pushing mantissa values to the sub-normal region and rounding them stochastically. Hence, the inverse mapping must be performed using a floating-point alignment module that normalizes the mantissas. A normalized floating-point mantissa is required to start with the most significant bit $(1)_2$ . For instance, an alignment module converts $2^{127} \times (0.0101)_2$ to $2^{127-2} \times (1.0100)_2$ . The alignment module is a very well-known logic circuit that is available in the commodity hardware using Leading Zero Anticipator (LZA) block [12]. Coupling a linear fixed-point mapping with a non-linear inverse mapping in this way keeps the number format close to floating-point. Moreover, combining them with stochastic rounding, results in having unbiased fixed-point variant that forces the trajectory of the integer training closely follow the floating-point counterpart. + +Figure [1](b) shows the inverse mapping unit. This unit receives a tensor of mantissas and a single value of shared exponent computed by an integer layer. Then a tensor of exponents is reconstructed by repeating the value of the shared exponent. The size of this tensor is equal to the mantissa tensor's size. Moreover, the mantissa tensor is rounded and its sign is extracted. Note that the rounding is used here because the output of the previous layer might have some excessive mantissa bits; this normally happens in matrix multiplication and convolution operations. Then the sign, exponent, and mantissa tensors are sent to an alignment unit that shifts the mantissa and adjust the exponent in order to normalize the floating-point number format [11]. Finally, the result is packed and carried out to the next layer. + +# 3.3 Integer layer computations + +When the fixed-point mapping of floating-point values is completed, the fixed-point values are used to perform the integer-only layer computations. For instance, let us consider a linear layer which consists of a General Matrix Multiplication (GEMM) operation, but, the idea can be generalized to other types of layers. Figure 2 demonstrates the layer-wise integer computations of a linear layer where the shared exponents and integer mantissas are treated separately. As shown in the Figure 2, in order to perform an integer-only GEMM operation, we need to multiply scales $(2^{e_{\max 1}} \times 2^{e_{\max 2}})$ . This multiplication performs an integer addition operation on the exponents $(e_{\max 1} + e_{\max 2})$ . Furthermore, the integer mantissas are sent to an integer GEMM module to compute the output mantissa tensor. + +![](images/d8df0df7dd324d17bc3499879c7dffba48d4761da6458420a0afde973e77e83e.jpg) +Figure 2: A fully integer linear layer. + +Also note that in our implementation, when the mantissa tensor is in int8 format, multiplication is in int16 format and accumulation is in int32 format. + +# 3.4 Understanding the representation mapping + +Here we provide an intuition of how our proposed representation mapping approach works. Let us denote $A$ as a tensor and $\hat{A}$ as its fixed-point version in the way that is introduced earlier. In addition, random variables $A_{i}$ and $\hat{A}_{i}$ are $i^{\text{th}}$ element of those tensors. Also note that $A_{i}$ and $\hat{A}_{i}$ are different representations of the same real number, but one is in floating-point format and the other is in dynamic fixed-point format. Thus, one can relate $A_{i}$ and $\hat{A}_{i}$ with a random error term $\delta_{i}$ as $\hat{A}_{i} = A_{i} + \delta_{i}$ . Since in our training method we used stochastic rounding [13], $\mathbb{E}\{\hat{A}_i\} = A_i$ , or equivalently $\mathbb{E}\{\delta_i\} = 0$ (see Appendix A.1). In other words, the fixed-point value is on the average equal to the floating-point value. Note that here we consider single precision floating-point values as a surrogate of real values. + +Linear and convolutional layers: For these two types of layers, both forward and backward propagation computations are based on inner products. Thus, it is easy to see that our proposed fixed-point inner product $\hat{C}_{ij} = \sum_{k}\hat{A}_{ik}\hat{B}_{kj}$ is an unbiased estimator of the floating-point inner product + +$$ +\mathbb {E} \left\{\hat {C} _ {i j} \right\} = \mathbb {E} \left\{\sum_ {k} \hat {A} _ {i k} \hat {B} _ {k j} \right\} = \mathbb {E} \left\{\sum_ {k} \left(A _ {i k} + \delta_ {i k} ^ {A}\right) \left(B _ {k j} + \delta_ {k j} ^ {B}\right) \right\} = \sum_ {k} A _ {i k} B _ {k j} = C _ {i j}. \tag {1} +$$ + +Residual connections: A residual connection involves element-wise addition of two tensors. Each fixed-point element $\hat{C}_{ij} = \hat{A}_{ij} + \hat{B}_{ij}$ is an unbiased estimator of its floating-point version + +$$ +\mathbb {E} \left\{\hat {C} _ {i j} \right\} = \mathbb {E} \left\{\hat {A} _ {i j} + \hat {B} _ {i j} \right\} = \mathbb {E} \left\{\left(A _ {i j} + \delta_ {i j} ^ {A}\right) + \left(B _ {i j} + \delta_ {i j} ^ {B}\right) \right\} = A _ {i j} + B _ {i j} = C _ {i j}. \tag {2} +$$ + +Batch-norm: A batch-norm layer is defined as + +$$ +\hat {\omega} \frac {\hat {A} - \hat {\mu}}{\sqrt {\hat {\sigma} ^ {2} + \epsilon}} + \hat {\beta}. \tag {3} +$$ + +For this type of layer, it is important to compute signal statistics such as mean $\hat{\mu}$ and variance $\hat{\sigma}^2$ correctly in integer arithmetic. Thus, the fixed-point mean $\hat{\mu}$ is also an unbiased estimator of the true mean $\mu$ + +$$ +\mathbb {E} \left\{\hat {\mu} \right\} = \mathbb {E} \left\{\frac {\sum_ {i = 1} ^ {N} \hat {A} _ {i}}{N} \right\} = \frac {1}{N} \mathbb {E} \left\{\sum_ {i = 1} ^ {N} \left(A _ {i} + \delta_ {i}\right) \right\} = \mu . \tag {4} +$$ + +Then the following derivation holds for fixed-point variance $\hat{\sigma}^2$ + +$$ +\mathbb {E} \left\{\hat {\sigma} ^ {2} \right\} = \mathbb {E} \left\{\frac {\sum_ {i = 1} ^ {N} \left(\hat {A} _ {i} - \hat {\mu}\right) ^ {2}}{N} \right\} = \frac {1}{N} \mathbb {E} \left\{\sum_ {i = 1} ^ {N} \left[ \left(A _ {i} - \mu\right) ^ {2} + \delta_ {i} ^ {2} \right] \right\} = \sigma^ {2} + \sigma_ {\delta} ^ {2}, \tag {5} +$$ + +where $\sigma^2$ is the true floating-point variance of the batch and $\sigma_{\delta}^{2}$ is the variance of the noise introduced by the linear mapping to fixed-point. Note that the error variance $\sigma_{\delta}^{2}$ is rather small and can be integrated to $\epsilon$ in the denominator of equation (3). + +# 4 Theoretical analysis of SGD using the proposed method + +The generic equation of weight update in the $k^{\mathrm{th}}$ iteration of SGD is + +$$ +w _ {k + 1} = w _ {k} + \alpha_ {k} g \left(w _ {k}, \xi_ {k}\right), \tag {6} +$$ + +where $g(w_{k},\xi_{k})$ is the estimated gradients of random samples of the batch generated by the seed $\xi_{k}$ , and $\alpha_{k}$ is the learning rate. We make the following common assumption in the sequel. + +Assumption 1 (Lipschitz-continuity). The loss function $\mathcal{L}(w)$ is continuously differentiable and its gradients $\nabla \mathcal{L}(w)$ satisfies the following inequality where $L > 0$ is the Lipschitz constant + +$$ +\mathcal {L} (w) \leqslant \mathcal {L} (\bar {w}) + \nabla \mathcal {L} (\bar {w}) ^ {\top} (w - \bar {w}) + \frac {1}{2} L | | w - \bar {w} | | _ {2} ^ {2}; \quad \forall w, \bar {w} \in \mathbb {R} ^ {d}. \tag {7} +$$ + +Assumption 2. (i) $\mathcal{L}(w_k)$ is bounded. (ii) Estimated gradients $g(w_{k},\xi_{k})$ is an unbiased estimator of the true gradients of the loss function + +$$ +\nabla \mathcal {L} (w _ {k}) ^ {\top} \mathbb {E} _ {\xi_ {k}} \{g (w _ {k}, \xi_ {k}) \} = | | \nabla \mathcal {L} (w _ {k}) | | _ {2} ^ {2} = | | \mathbb {E} _ {\xi_ {k}} \{g (w _ {k}, \xi_ {k}) \} | | _ {2} ^ {2}, +$$ + +and (iii,a) there exist scalars $M \geqslant 0$ and $M_V \geqslant 0$ such that for all iterations of SGD $\mathbb{V}_{\xi_k}\{g(w_k, \xi_k)\} \leqslant M + M_V||\nabla \mathcal{L}(w_k)||_2^2$ . + +Note that here we define + +$$ +\left. \right. \mathbb {V} _ {\xi_ {k}} \left\{g \left(w _ {k}, \xi_ {k}\right)\right\} := \mathbb {E} _ {\xi_ {k}} \left\{\left|\left| g \left(w _ {k}, \xi_ {k}\right)\right|\right| _ {2} ^ {2} \right\} - \left|\left| \mathbb {E} _ {\xi_ {k}} \left\{g \left(w _ {k}, \xi_ {k}\right)\right\}\right|\right| _ {2} ^ {2}. +$$ + +Also from Assumption 2. (ii) and (iii,a), the second moment bound can be derived + +$$ +\mathbb {E} _ {\xi_ {k}} \left\{\left| \left| g \left(w _ {k}, \xi_ {k}\right) \right| \right| _ {2} ^ {2} \right\} \leqslant M + M _ {G} \| \nabla \mathcal {L} (w _ {k}) \| _ {2} ^ {2} \quad \text {w i t h} M _ {G} := 1 + M _ {V}. \tag {8} +$$ + +Effect of gradient variance on convergence: The quality of the estimated gradients $g(w_{k},\xi_{k})$ directly affects the convergence of the SGD. The effect of first and second moments of gradient are already studied on real numbers in the literature. + +Lemma 1. Suppose Assumption 2 is true, then we have + +$$ +\mathbb {E} _ {\xi_ {k}} \left\{\mathcal {L} \left(w _ {k + 1}\right) \right\} - \mathcal {L} \left(w _ {k}\right) \leqslant - \left(1 - \frac {1}{2} \alpha_ {k} L M _ {G}\right) \alpha_ {k} \| \nabla \mathcal {L} \left(w _ {k}\right) \| _ {2} ^ {2} + \frac {1}{2} \alpha_ {k} ^ {2} L M. \tag {9} +$$ + +Proof: See Bottou et al. [14, Lemma 4.4]. + +Inequality (9) shows the effect of gradient variance bounds, $M$ and $M_G$ , on each iterate of SGD, and shows the greater the variance, the more deterioration in the quality of SGD steps. The first term, $-(1 - \frac{1}{2}\alpha_k LM_G)\alpha_k||\nabla \mathcal{L}(w_k)||_2^2$ contributes to the decrease of the loss function while the second term, $\frac{1}{2}\alpha_k^2 LM$ , prevents it. Upon choosing the correct gradient estimates, the right hand side of inequality (9) is bounded by a deterministic quantity, and asymptotically ensures sufficient descent of the loss $\mathcal{L}(w)$ . Note that the expectation $\mathbb{E}_{\xi_k}$ is taken over random samples with seed $\xi_k$ . + +# 4.1 Fixed-point gradient noise + +When performing representation mapping in the back-propagation, the quality of the gradients deteriorate. Thus, there is a need to consider the effect of fixed-point mapping variance. Then, Assumption 2 (iii,a) should be modified accordingly. + +Remark 1. Note that Assumption 2 (i), (ii) still hold after fixed-point mapping because of stochastic rounding, i.e. the fixed-point gradient remains an unbiased estimator of gradient (refer to Appendix A.1). + +Assumption 2 (iii,b). When the gradients are in fixed-point format i.e. $\hat{g} (w_k,\xi_k)$ , there exist scalars $M\geqslant 0,M_V\geqslant 0,M^q\geqslant 0$ and $M_V^q\geqslant 0$ such that for all iterations of SGD + +$$ +\mathbb {V} _ {\xi_ {k}} \{\hat {g} (w _ {k}, \xi_ {k}) \} \leqslant M + M ^ {q} + (M _ {V} + M _ {V} ^ {q}) | | \nabla \mathcal {L} (w _ {k}) | | _ {2} ^ {2}. +$$ + +If $\tilde{M} := M + M^q$ and $\tilde{M}_V := M_V + M_V^q$ , then Assumption 2 (iii,b) takes the exact form of Assumption 2 (iii,a) i.e. $\mathbb{V}_{\xi_k}\{g(w_k,\xi_k)\} \leqslant \tilde{M} + \tilde{M}_V||\nabla \mathcal{L}(w_k)||_2^2$ . However, here we separated $M^q$ and $M_V^q$ to emphasize the effect of fixed-point mapping on the true gradients. + +Remark 2. If Assumption 2 (iii,b) holds true, inequality (9) can be transformed to its fixed-point version + +$$ +\mathbb {E} _ {\xi_ {k}} \left\{\mathcal {L} \left(w _ {k + 1}\right) \right\} - \mathcal {L} \left(w _ {k}\right) \leqslant - \left(1 - \frac {1}{2} \alpha_ {k} L \left(M _ {G} + M _ {G} ^ {q}\right)\right) \alpha_ {k} | | \nabla \mathcal {L} \left(w _ {k}\right) | | _ {2} ^ {2} + \frac {1}{2} \alpha_ {k} ^ {2} L (M + M ^ {q}) +$$ + +$$ +\text {w i t h} M _ {G} ^ {q} := 1 + M _ {V} ^ {q}. +$$ + +(10) + +Inequality (10) shows the effect of added representation mapping variance with bounds, $M^q$ and $M_G^q$ , on each iterate of SGD. This observation shows that fixed-point mapping degrades the convergence of SGD unless its variance bounds are relatively small, or controlled by the learning rate. As an example, refer to Appendix A.2 for analytical derivations of $M^q$ and $M_G^q$ for the back-propagation of a linear layer involving a fixed-point inner product. + +# 4.2 Strongly convex and locally convex loss + +Assumption 3 (Strong convexity). The loss function $\mathcal{L}(w)$ is differentiable and strongly convex. We recall that strong convexity for differentiable functions is equivalent to the following inequality with some constant $c > 0$ + +$$ +\mathcal {L} (w) \geqslant \mathcal {L} (\bar {w}) + \nabla \mathcal {L} (\bar {w}) ^ {\top} (w - \bar {w}) + \frac {1}{2} c | | w - \bar {w} | | _ {2} ^ {2}; \quad \forall w, \bar {w} \in \mathbb {R} ^ {d}. \tag {11} +$$ + +A strongly convex function has a unique minimum point at $w_{*}$ with the loss value $\mathcal{L}_{*} = \mathcal{L}(w_{*})$ . + +Theorem 1. Suppose Assumptions 1, 2(i), 2(ii), 2 (iii,b), 3 are all true, then a SGD method running with fixed-point gradients i.e. $\hat{g} (w_k,\xi_k)$ and a fixed learning rate $0 < \bar{\alpha}\leqslant \frac{1}{L(M_G + M_G^q)}$ satisfies the following bound for its optimality gap with the minimum loss $\mathcal{L}_{*}$ at the $k^{\mathrm{th}}$ iteration + +$$ +\begin{array}{l} \mathbb {E} \left\{\mathcal {L} \left(w _ {k}\right) - \mathcal {L} _ {*} \right\} \leqslant \frac {\bar {\alpha} L (M + M ^ {q})}{2 c} + (1 - \bar {\alpha} c) ^ {(k - 1)} \left(\mathcal {L} \left(w _ {1}\right) - \mathcal {L} _ {*} - \frac {\bar {\alpha} L (M + M ^ {q})}{2 c}\right) \\ \xrightarrow {k \rightarrow \infty} \frac {\bar {\alpha} L (M + M ^ {q})}{2 c}. \tag {12} \\ \end{array} +$$ + +Proof. See Appendix A.3 + +Remark 3. Note that when $k \to \infty$ , $\frac{\bar{\alpha}LM}{2c}$ is the original optimality gap (i.e. $\mathbb{E}\{\mathcal{L}(w_k) - \mathcal{L}_*\}$ ) with real gradients, see Bottou et al. [14] Theorem 4.6], and then, the optimality gap is also increased by $\frac{\bar{\alpha}LM^q}{2c}$ due to fixed-point representation. Here we argue that by keeping the variance bound $M^q$ relatively small via choosing the correct number format, we can theoretically achieve the original performance. On the other hand, optimality gap is related to $\bar{\alpha}$ , which means smaller learning rates leads to smaller optimality gap. + +Remark 4 (Local convexity). Strongly convex loss is not a realistic assumption in large deep learning models. However, local convexity is a more realistic assumption i.e. $\mathcal{L}$ is convex around the minimum point $w_{*}$ . Hence, inequality (12) still holds around the minimum point $w_{*}$ of a locally convex loss. We essentially train our ImageNet ResNet18 classification in the same way: first we train the network with a fixed learning rate until reaching a certain optimality gap; then the learning rate is reduced to a smaller fixed value in order to shrink the optimality gap. + +Empirical evidence: Figure 3(a) demonstrates the locally convex loss landscape of ResNet18 training on CIFAR10 dataset using floating-point computation. Figure 3(b) shows the same loss landscape in the fixed-point int8 format. We perturbed the weights around the $w_{*}$ in $x$ and $y$ axes using Gaussian noise and evaluated the loss $\mathcal{L}$ in the $z$ axis to acquire Figures 3(a) and 3(b). Comparing these two figures pronounces our assumption of local convexity in both integer and floating-point tests. Figure 3(c) shows a comparison of the loss trajectory for floating-point and integer training. The fixed-point gradients are unbiased estimators of the true gradients, so the trajectory of the integer training closely follows the trajectory of its floating-point counterpart. + +Remark 5. We implemented an integer weight update, hence, the computations of equation (6) is also performed in integer arithmetic. It is shown in Appendix A.4 that integer weight update with stochastic rounding is an unbiased estimator of the true weight update. + +![](images/f026269ce7702a31128870cbf614d0300f1e90f45980a58070a494dd76ea29ff.jpg) +Figure 3: (a) Floating-point loss landscape, (b) Fixed-point int8 loss landscape c) Training loss trajectory comparison. Integer training setup: int8 linear layer, int8 convolutional layer and int8 batch-norm layer. + +![](images/fddae86cf596d3c951c762ef7a318f88f2e25cb52f7e0a7f3058294fa33c4fde.jpg) + +![](images/815f7de90361616781371693669fd17845bf135de9babd801af4e8319961b7e8.jpg) + +# 5 Experimental results + +Image classification: Table1 reports the experimental results of our proposed integer training method on the conventional vision classification models. In this set of models, we used int8 linear layer, int8 convolutional layer, int8 batch-norm layer, and int16 SGD to form a fully integer training pipeline. Note that all forward and back-propagation computations of layers are performed in integer format. Moreover, we have chosen smaller vision models such as ResNet18 and MobileNetV2 knowing that smaller models are harder to train. Our experimental results show that our proposed integer training method is as good as floating-point with negligible loss of accuracy ( $\leq 0.5\%$ on ImageNet). + +Remark 6. We compare our integer training results with official Pytorch floating-point training. For instance, in conventional vision models (Table I), we compare the results directly with the accuracy of torchvision models that are reported on the official Pytorch website [1]. We further emphasize that there is no change in hyper-parameters of the training. The full set of hyper-parameters of our experiments are reported in Appendix A.5 + +Vision transformer: We validated the applicability of our proposed integer training on the original vision transformer model, notably ViT-B-16-224 [15]. We took the floating point checkpoint pretrained on ImageNet21K². We used Huggingface [16] to fine-tune the model on CIFAR10. In this experiment, we used int8 linear layer, int8 matrix multiplication, int8 convolutional layer, and int8 layer-norm for our integer training pipeline. The result is reported in Table I demonstrating negligible loss of accuracy ( $\leqslant 0.5\%$ ). Note that for this experiment, the computation of softmax in attention mechanism is in floating point. + +Semantic segmentation: To validate our proposed integer training on semantic segmentation task, we used DeepLabV1/V2 with ResNet-101 as the backbone. We trained the models on PASCAL VOC-2012 [17] and MS COCO 10K [18]. For the PASCAL dataset, as suggested by Chen et al. [19], the models were initialized with MS COCO checkpoint and data augmentation was used during training. Likewise, for COCO dataset we used PASCAL checkpoint for initialization. The batch-norm layers are frozen in our experiments as suggested in [19]. We used linear and convolutional layers in int8 format. Table 2 shows that the mean intersect of union (mIOU) of our method closely matches the floating-point baseline. + +Object detection: We used Faster R-CNN[20] with ResNet50 as its backbone and Single Shot Detector (SSD)[21] which relies on VGG-16 for its backbone. In these experiments, we used int8 linear and convolutional layers, while batch-norm layers are frozen. We integrated our integer training method with MMDetection[22] toolbox and performed our experiments on MS COCO 10K[18], PASCAL VOC-2007[23], VOC-2012[17], and Cityscapes[24] datasets. As shown in Table 3 the mean average precision (mAP) of our proposed integer training method is very close to floating-point baseline. + +Table 1: Classification + +
ModelDatasetAccuracy
int8(top1 - top5)Pytorch baseline float(top1 - top5)
Conventional Vision Models
ResNet18CIFAR1094.84 - N/A95.34 - N/A
ResNet18CIFAR10075.38 - N/A76.14 - N/A
ResNet18ImageNet69.25 - 88.7969.75 - 89.07
MobileNetV2ImageNet72.80 - 90.8371.87 - 90.28
Vision Transformer
ViT-B (fine-tuning)CIFAR1098.80 - N/A99.10 - N/A
+ +Table 2: Semantic Segmentation + +
MethodDatasetmIOU
int8baseline float
DeepLab-V1VOC74.7375.00
COCO34.8034.70
DeepLab-V2VOC77.6577.71
COCO35.9036.00
+ +Table 3: Object Detection + +
MethodDatasetmAP
int8baseline float
Faster R-CNNCOCO37.4037.80
VOC07+1280.1480.31
Cityscapes39.5040.00
SSDCOCO42.5043.60
+ +Table 4: Comparison with State of the Art + +
ModelDatasetMethod
Ours[2][3][4][6]
MobileNetV2ImageNet72.870.571.971.272.6
ResNet18ImageNet69.3-70.269.771.1
DeepLab-V1VOC74.769.9---
Faster R-CNNCOCO37.4-37.434.9-
+ +Table 5: Low-bit Integer Training + +
ModelDatasetbit-width
int8int7int6int5int4
ResNet18CIFAR1094.894.794.4788.5Diverges
+ +Comparison with state of the art: Table 4 provides a comparison between our training method and state of the art across different experiments. There are some important differences between our proposed method and other works: (i) our proposed integer training method uses a fixed-point batchnorm layer where both forward and back propagation is computed using integer arithmetic, (ii) our proposed training method uses an integer-only SGD, (iii) in our training method, no hyper-parameter is changed while other methods have changed hyper-parameters or used gradient clipping. + +Low-bit integer training: Table 5 provides an ablation study of how lowering integer bit-width can affect the training accuracy. Our experiments show that training has a significant drop of accuracy with int5 and diverges using int4 number formats. + +# 6 Conclusion + +We proposed a hardware-friendly integer training method based on coupling a linear fixed-point mapping with a non-linear inverse mapping. This method performs the representation mapping directly on the floating-point number format. Furthermore, our method uses stochastic rounding and produces unbiased estimators of gradients in the back-propagation. Thus, benefiting from unbiased + +gradients and effective representation mapping, the training loss trajectory closely follows its floating-point version. Moreover, there is no need to tune hyper-parameters or perform gradient clipping to correct the inappropriate gradient and weight updates. Using our proposed technique, we designed the integer version of the most vital components of deep learning such as linear layer, convolutional layer, batch-norm, layer-norm, and stochastic gradient descent (SGD). Our experimental results show the effectiveness of the proposed method, where the accuracy loss is negligible in a wide variety of the training tasks. Furthermore, in our classification tests all training components are in integer arithmetic. We theoretically studied the effect of our proposed method on SGD, and demonstrated why the optimality gap of convergence is shifted by a negligible amount. + +# Acknowledgments and Disclosure of Funding + +The authors would like to thank Richard Wu and Vanessa Courville for their constructive comments. The authors would like to thank Sara Elkerdawy for initiating the object detection and semantic segmentation experiments during her internship at Huawei. + +# References + +[1] Ron Banner, Itay Hubara, Elad Hoffer, and Daniel Soudry. Scalable methods for 8-bit training of neural networks. Advances in neural information processing systems, 31, 2018. +[2] Xishan Zhang, Shaoli Liu, Rui Zhang, Chang Liu, Di Huang, Shiyi Zhou, Jiaming Guo, Qi Guo, Zidong Du, Tian Zhi, et al. Fixed-point back-propagation training. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 2330-2338, 2020. +[3] Kang Zhao, Sida Huang, Pan Pan, Yinghan Li, Yingya Zhang, Zhenyu Gu, and Yinghui Xu. Distribution adaptive int8 quantization for training cnns. In Proceedings of the Thirty-Fifth AAAI Conference on Artificial Intelligence, 2021. +[4] Feng Zhu, Ruihao Gong, Fengwei Yu, Xianglong Liu, Yanfei Wang, Zhelong Li, Xiuqi Yang, and Junjie Yan. Towards unified int8 training for convolutional neural network. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1969-1979, 2020. +[5] Charbel Sakr and Naresh Shanbhag. Per-tensor fixed-point quantization of the back-propagation algorithm. arXiv preprint arXiv:1812.11732, 2018. +[6] Qing Jin, Jian Ren, Richard Zhuang, Sumant Hanumante, Zhengang Li, Zhiyu Chen, Yanzhi Wang, Kaiyuan Yang, and Sergey Tulyakov. F8net: Fixed-point 8-bit only multiplication for network quantization. arXiv preprint arXiv:2202.05239, 2022. +[7] Maolin Wang, Seyedramin Rasoulinezhad, Philip HW Leong, and Hayden K-H So. Niti: Training integer neural networks using integer-only arithmetic. IEEE Transactions on Parallel and Distributed Systems, 33 (11):3249-3261, 2022. +[8] Matthieu Courbariaux, Yoshua Bengio, and Jean-Pierre David. Training deep neural networks with low precision multiplications. arxiv 2014. arXiv preprint arXiv:1412.7024, 2014. +[9] Mario Drumond, Tao Lin, Martin Jaggi, and Babak Falsafi. Training dnns with hybrid block floating point. Advances in Neural Information Processing Systems, 31, 2018. +[10] Bita Rouhani, Daniel Lo, Ritchie Zhao, Ming Liu, Jeremy Fowers, Kalin Ovtcharov, Anna Vinogradsky, Sarah Massengill, Lita Yang, Ray Bittner, et al. Pushing the limits of narrow precision inferencing at cloud scale with microsoft floating point. Advances in Neural Information Processing Systems, 33:10271-10281, 2020. +[11] Dan Zuras, Mike Cowlishaw, Alex Aiken, Matthew Applegate, David Bailey, Steve Bass, Dileep Bhandarkar, Mahesh Bhat, David Bindel, Sylvie Boldo, et al. IEEE standard for floating-point arithmetic. IEEE Std, 754(2008):1-70, 2008. +[12] Martin S Schmookler and Kevin J Nowka. Leading zero anticipation and detection-a comparison of methods. In Proceedings 15th IEEE Symposium on Computer Arithmetic. ARITH-15 2001, pages 7–12. IEEE, 2001. +[13] Michael P Connolly, Nicholas J Higham, and Theo Mary. Stochastic rounding and its probabilistic backward error analysis. SIAM Journal on Scientific Computing, 43(1):A566-A585, 2021. + +[14] Léon Bottou, Frank E Curtis, and Jorge Nocedal. Optimization methods for large-scale machine learning. Siam Review, 60(2):223-311, 2018. +[15] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020. +[16] Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierrick Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, et al. Huggingface's transformers: State-of-the-art natural language processing. arXiv preprint arXiv:1910.03771, 2019. +[17] M. Everingham, L. Van Gool, C. K. I. Williams, J. Winn, and A. Zisserman. The PASCAL Visual Object Classes Challenge 2012 (VOC2012) Results. http://www.pascalnetwork.org/challenges/VOC/voc2012/workshop/index.html, . +[18] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dólar, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In European conference on computer vision, pages 740-755. Springer, 2014. +[19] Liang-Chieh Chen, George Papandreou, Iasonas Kokkinos, Kevin Murphy, and Alan L Yuille. Deep convolutional nets, atrous convolution, and fully connected crfs. IEEE transactions on pattern analysis and machine intelligence, 40(4):834-848, 2017. +[20] Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. Advances in neural information processing systems, 28, 2015. +[21] Wei Liu, Dragomir Anguelov, Dumitru Erhan, Christian Szegedy, Scott Reed, Cheng-Yang Fu, and Alexander C Berg. Ssd: Single shot multibox detector. In European conference on computer vision, pages 21-37. Springer, 2016. +[22] Kai Chen, Jiaqi Wang, Jiangmiao Pang, Yuhang Cao, Yu Xiong, Xiaoxiao Li, Shuyang Sun, Wansen Feng, Ziwei Liu, Jiarui Xu, Zheng Zhang, Dazhi Cheng, Chenchen Zhu, Tianheng Cheng, Qijie Zhao, Buyu Li, Xin Lu, Rui Zhu, Yue Wu, Jifeng Dai, Jingdong Wang, Jianping Shi, Wanli Ouyang, Chen Change Loy, and Dahua Lin. MMDetection: Open mmlab detection toolbox and benchmark. arXiv preprint arXiv:1906.07155, 2019. +[23] M. Everingham, L. Van Gool, C. K. I. Williams, J. Winn, and A. Zisserman. The PASCAL Visual Object Classes Challenge 2007 (VOC2007) Results. http://www.pascalnetwork.org/challenges/VOC/voc2007/workshop/index.html, . +[24] Marius Cordts, Mohamed Omran, Sebastian Ramos, Timo Rehfeld, Markus Enzweiler, Rodrigo Benenson, Uwe Franke, Stefan Roth, and Bernt Schiele. The cityscapes dataset for semantic urban scene understanding. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 3213-3223, 2016. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] See Theorem 1 and Remark 3 in Section 4.2 reflecting the effect of representation mapping noise. Moreover, the accuracy deviation from baseline floating-point training experiments are reported in Table 1, Table 2, and Table 3 +(c) Did you discuss any potential negative societal impacts of your work? [N/A] The work is purely methodological and related to number format. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] See Section 4 +(b) Did you include complete proofs of all theoretical results? [Yes] See Appendix A.1, Appendix A.2, Appendix A.3 and Appendix A.4 + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [No] The code is proprietary, however we will provide them upon publication. We ran the experiments on publicly available datasets. + +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Appendix A.5 +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No]. It was too costly to train multiple times, we just ran the experiments once. Also note the type of training experiments we reported are resilient to random initialization changes. +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Appendix A.5 + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] +(b) Did you mention the license of the assets? [N/A] +(c) Did you include any new assets either in the supplemental material or as a URL? [N/A] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/isintegerarithmeticenoughfordeeplearningtraining/images.zip b/isintegerarithmeticenoughfordeeplearningtraining/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..792422b67621ecb69bd9c8b3a93b744cec87cac7 --- /dev/null +++ b/isintegerarithmeticenoughfordeeplearningtraining/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c4b8969d8ccb2e41230666e33215dd4885f86a122ddbc1532804a5fcc99613e8 +size 405711 diff --git a/isintegerarithmeticenoughfordeeplearningtraining/layout.json b/isintegerarithmeticenoughfordeeplearningtraining/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..1c5b77fdf20a9dae7a8ed29ec866b896b6d22efa --- /dev/null +++ b/isintegerarithmeticenoughfordeeplearningtraining/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7ba279360b566ed2b3f3ec824cbb771cbc31c50c2d02614039400462cbea3132 +size 375934 diff --git a/isl2physicsinformedlossalwayssuitablefortrainingphysicsinformedneuralnetwork/87cc040e-907f-489b-8b98-86e092d3df99_content_list.json b/isl2physicsinformedlossalwayssuitablefortrainingphysicsinformedneuralnetwork/87cc040e-907f-489b-8b98-86e092d3df99_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..a590b867e3211ab552a0148890c2053b1a09e324 --- /dev/null +++ b/isl2physicsinformedlossalwayssuitablefortrainingphysicsinformedneuralnetwork/87cc040e-907f-489b-8b98-86e092d3df99_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a73313820135d44ecc6ebed86325d92f3ac4b41a6f20267706f4f88573c2c34d +size 82224 diff --git a/isl2physicsinformedlossalwayssuitablefortrainingphysicsinformedneuralnetwork/87cc040e-907f-489b-8b98-86e092d3df99_model.json b/isl2physicsinformedlossalwayssuitablefortrainingphysicsinformedneuralnetwork/87cc040e-907f-489b-8b98-86e092d3df99_model.json new file mode 100644 index 0000000000000000000000000000000000000000..14f3c565d79a724b245eb7c8ab60a6703309b100 --- /dev/null +++ b/isl2physicsinformedlossalwayssuitablefortrainingphysicsinformedneuralnetwork/87cc040e-907f-489b-8b98-86e092d3df99_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6e51b18431ce8564813bde82728ac5ce3a9c917c07146edb241373f3ec674621 +size 101798 diff --git a/isl2physicsinformedlossalwayssuitablefortrainingphysicsinformedneuralnetwork/87cc040e-907f-489b-8b98-86e092d3df99_origin.pdf b/isl2physicsinformedlossalwayssuitablefortrainingphysicsinformedneuralnetwork/87cc040e-907f-489b-8b98-86e092d3df99_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..621997dc42dd0441e743494423b044f3c3fc8834 --- /dev/null +++ b/isl2physicsinformedlossalwayssuitablefortrainingphysicsinformedneuralnetwork/87cc040e-907f-489b-8b98-86e092d3df99_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7abec035b26fdaf5a042b91132cbb209b303a93b2a76411a8b6225f62d440742 +size 836939 diff --git a/isl2physicsinformedlossalwayssuitablefortrainingphysicsinformedneuralnetwork/full.md b/isl2physicsinformedlossalwayssuitablefortrainingphysicsinformedneuralnetwork/full.md new file mode 100644 index 0000000000000000000000000000000000000000..630a8c2422303c59e877dec168a2463b6d0a628a --- /dev/null +++ b/isl2physicsinformedlossalwayssuitablefortrainingphysicsinformedneuralnetwork/full.md @@ -0,0 +1,357 @@ +# Is $L^2$ Physics-Informed Loss Always Suitable for Training Physics-Informed Neural Network? + +Chuwei Wang $^{1*}$ , Shanda Li $^{2,5*}$ , Di He $^{3\dagger}$ , Liwei Wang $^{3,4\dagger}$ + +$^{1}$ School of Mathematical Sciences, Peking University + +$^{2}$ Machine Learning Department, School of Computer Science, Carnegie Mellon University + +$^{3}$ National Key Laboratory of General Artificial Intelligence, + +School of Intelligence Science and Technology, Peking University + +4 Center for Data Science, Peking University 5 Zhejiang Lab + +chuwei.wang@pku.edu.cn, shandal@cs.cmu.edu + +dihe@pku.edu.cn, wanglw@pku.edu.cn + +# Abstract + +The Physics-Informed Neural Network (PINN) approach is a new and promising way to solve partial differential equations using deep learning. The $L^2$ Physics-Informed Loss is the de-facto standard in training Physics-Informed Neural Networks. In this paper, we challenge this common practice by investigating the relationship between the loss function and the approximation quality of the learned solution. In particular, we leverage the concept of stability in the literature of partial differential equation to study the asymptotic behavior of the learned solution as the loss approaches zero. With this concept, we study an important class of high-dimensional non-linear PDEs in optimal control, the Hamilton-Jacobi-Bellman (HJB) Equation, and prove that for general $L^p$ Physics-Informed Loss, a wide class of HJB equation is stable only if $p$ is sufficiently large. Therefore, the commonly used $L^2$ loss is not suitable for training PINN on those equations, while $L^\infty$ loss is a better choice. Based on the theoretical insight, we develop a novel PINN training algorithm to minimize the $L^\infty$ loss for HJB equations which is in a similar spirit to adversarial training. The effectiveness of the proposed algorithm is empirically demonstrated through experiments. Our code is released at https://github.com/LithiumDA/L_inf-PINN. + +# 1 Introduction + +Recently, with the explosive growth of available data and computational resources, there have been growing interests in developing machine learning approaches to solve partial differential equations (PDEs) [14, 13, 33, 28]. One seminal work in this direction is the Physics-Informed Neural Network (PINN) approach [28] which parameterizes the PDE's solution as a neural network. By defining differentiable loss functionals that measure how well the model fits the PDE and boundary conditions, the network parameters can be efficiently optimized using gradient-based approaches. $L^2$ distance is one of the most popularly used measures, which calculates the $L^2$ norm of the PDE and boundary residual on the domain and boundary, respectively. Previous works demonstrated that PINN could solve a wide range of PDE problems using the $L^2$ Physics-Informed Loss, such as Poisson equation, Burgers' equation, and Navier-Stokes equation [28, 6]. + +Although previous works empirically demonstrated promising results using $L^2$ Physics-Informed Loss, we argue the plausibility of using this loss for (high-dimensional) non-linear PDE problems. + +We know the trivial fact that the learned solution will equal the exact solution when its $L^2$ loss equals zero. However, the quality of a learned solution with a small but non-zero loss, which is a more realistic scenario in practice, remains unknown to have any approximation guarantees. In this work, we aim at answering a fundamental question: + +Can we guarantee that a learned solution with a small Physics-Informed Loss always corresponds to a good approximator of the exact solution? + +To thoroughly investigate the problem, we advocate analyzing the stability of PDE [8] in the PINN framework. Stability characterizes the asymptotic behavior of the distance between the learned solution and the exact solution when the Physics-Informed Loss approaches zero. If the PDE is not stable with respect to certain loss functions, we may not obtain good approximate solutions by minimizing the loss. To show the strength of the theory, we perform a comprehensive study on the stability of an important class of high-dimensional non-linear PDEs in optimal control, the Hamilton-Jacobi-Bellman (HJB) equation, which establishes a necessary and sufficient condition for a control's optimality with regard to the cost function. Interestingly, we prove that for general $L^p$ Physics-Informed Loss, the HJB equation is stable only if $p$ is sufficiently large. This finding suggests that the most widely used $L^2$ loss may not be suitable for training PINN on HJB equations as the learned solution can be arbitrarily distant from the exact solution. Empirical observation verifies the theoretical results. + +We further show our theory can serve as a principled way to design loss functions for training PINN. For the high-dimensional HJB equation we target in the paper, the theoretical result suggests that $L^{\infty}$ loss may be a better choice to learn approximate solutions. Motivated by this insight, we propose a new algorithm for training PINN, which adopts a min-max optimization procedure to minimize the $L^{\infty}$ loss. Our approach resembles the well-known adversarial training framework. In each iteration, we first fix the network parameters and learn adversarial data points to approximate $L^{\infty}$ loss, and then optimize the network parameters to minimize the loss. When the training finishes, the learned network will converge to a solution with small $L^{\infty}$ losses and is close to the exact solution. We conduct experiments to demonstrate the effectiveness of the proposed algorithm. All empirical results show that our method can indeed learn accurate solutions for HJB equations and is much better than several baseline methods. + +The contribution of the paper is summarized as follows. + +- We make the first step towards theoretically studying the loss design in PINN, and formally introduce the concept of stability in the literature of PDE to characterize the quality of a learned solution with small but non-zero Physics-Informed Loss. +- We provide rigorous investigations on an important class of high-dimensional non-linear PDEs in optimal control, the HJB equation. Our results suggest that the widely used $L^2$ loss is not a suitable choice for training PINN on HJB equations. +- Based on the theoretical insight, we develop a novel PINN training algorithm to minimize the $L^{\infty}$ loss for HJB equations. We empirically demonstrate that the proposed algorithm can significant improve the accuracy of PINN in solving the optimal control problems. + +# 2 Related Works + +Physics-Informed Neural Network approaches [33, 28] learn to find parametric solutions to satisfy equations and boundary conditions with gradient descent. There has been a notable scarcity of papers that rigorously justify why PINNs work. Important works include [31], which prove the convergence of PINN for second-order elliptic and parabolic equations. In [21], the authors study the statistical limit of learning a PDE solution from sampled observations for elliptic equations. In [29], the convergence of PINN with $L^2$ loss is established for Navier-Stokes equations. At the same time, several works observed different failure modes for training PINN in other PDE problems. In [17], researchers discover that PINN sometimes fails to learn accurate solutions to a class of convection and reaction equations. Their analysis shows that this may be attributed to the complicated loss landscape. [34] observed PINN failed to learn the Helmholtz equation due to the incommensurability between PDE and boundary losses. + +In this work, we mainly experiment with the Hamilton-Jacobi-Bellman (HJB) equation in optimal control. Previously, there were several works aiming at solving the HJB equation using deep learning methods [12, 13, 25, 39, 24, 1, 27, 5]. [13] is among the first to leverage neural networks to solve HJB equations. In particular, [13] targets constructing an approximation to a solution value $u$ at $T = 0$ , which is further transformed into a backward stochastic differential equation and learned by neural networks. The main difference between [13] and ours is that [13] only learns the solution on a pre-defined time frame, while with our method, the obtained solution can be evaluated for any time frame. Recently, [12] tackled the offline reinforcement learning problem and developed a soft relaxation of the classical HJB equation, which can be learned using offline behavior data. The main difference between [12] and ours is that no additional data is required in our setting. + +Stability is one of the most fundamental concepts in studying the well-posedness of PDE problems. Formally speaking, it characterizes the behavior of the solution to a PDE problem when a small perturbation modifies the operator, initial condition, boundary condition, or force term. We say the equation is stable if the solution of the perturbed PDE converges to the exact solution as the perturbations approach zero [8]. The problem regarding whether a PDE is stable has been intensively studied [8, 19, 11] in literature. There are also some works studying how (regularity) conditions affect stability. [20] and [7] investigate in which topology Couette Flow is asymptotic stable. [4] answers in which Sobolev space defocusing nonlinear Schrodinger equation, real Korteweg-de Vries (KdV), and modified KdV are locally well-posed. Our main focus is akin to the latter works but is settled in the machine learning framework. + +# 3 Preliminary + +In this section, we introduce basic background on Physics-Informed Neural Networks and stochastic optimal control problems. Without loss of generality, we formulate any partial differential equation as: + +$$ +\int \mathcal {L} u (x) = \varphi (x) \quad x \in \Omega \subset \mathbb {R} ^ {n} \tag {1} +$$ + +$$ +\left\lfloor \mathcal {B} u (x) = \psi (x) \quad x \in \partial \Omega , \right. +$$ + +where $\mathcal{L}$ is the partial differential operator and $\mathcal{B}$ is the boundary condition. We use $x$ to denote the spatiotemporal-dependent variable, and use $\Omega$ and $\partial \Omega$ to denote the domain and boundary. + +Physics-Informed Neural Networks (PINN) PINN [28] is a popular choice to learn the function $u(x)$ automatically by minimizing the loss function induced by the PDE (1). To be concrete, given $p \in (1, +\infty)$ , we define the $L^p$ Physics-Informed Loss as + +$$ +\ell_ {\Omega , p} (u) = \| \mathcal {L} u (x) - \varphi (x) \| _ {L ^ {p} (\Omega)} ^ {p}, \tag {2} +$$ + +$$ +\ell_ {\partial \Omega , p} (u) = \| \mathcal {B} u (x) - \psi (x) \| _ {L ^ {p} (\partial \Omega)} ^ {p}. \tag {3} +$$ + +The loss term $\ell_{\Omega,p}(u)$ in Eq. (2) corresponds to the PDE residual, which evaluates how $u(x)$ fits the partial differential equation on $\Omega$ ; and $\ell_{\partial \Omega,p}(u)$ in Eq. (3) corresponds to the boundary residual, which measures how well $u(x)$ satisfies the boundary condition on $\partial \Omega$ . $L^p$ denotes $p$ -norm, where $p$ is usually set to 2, leading to a "mean squared error" interpretation of the loss function [33, 28]. The goal is to find $u^*$ that minimizes a linear combination of the two losses defined above. The function $u(x)$ is usually parameterized by neural network $u_\theta(x)$ with parameter $\theta \in \Theta$ . To find $\theta^*$ efficiently, PINN approaches use gradient-based optimization methods. Note that computing the loss involves integrals over $\Omega$ and $\partial \Omega$ . Thus, Monte Carlo methods are commonly used to approximate $\ell_{\Omega,p}(u)$ and $\ell_{\partial \Omega,p}(u)$ in practice. + +Stochastic Optimal Control Stochastic control [9, 3] is an important sub-field in optimal control theory. In stochastic control, the state function $\{X_{t}\}_{0\leq t\leq T}$ is a stochastic process, where $T$ is the time horizon of the control problem. The evolution of the state function is governed by the following stochastic differential equation: + +$$ +\left\{ \begin{array}{l} \mathrm {d} X _ {s} = m \left(s, X _ {s}\right) \mathrm {d} s + \sigma \mathrm {d} W _ {s} \quad s \in [ t, T ] \\ X _ {t} = x \end{array} , \right. \tag {4} +$$ + +where $m:[t,T]\times \mathbb{R}^n\to \mathbb{R}^n$ is the control function and $\{W_s\}$ is a standard $n$ -dimensional Brownian motion. + +Given a control function $m$ , its total cost is defined as $J_{x,t}(m) = \mathbb{E}\int_t^T r(X_s,m,s)\mathrm{d}s + g(X_T)$ , where $r:\mathbb{R}^n\times \mathbb{R}^n\times [0,T]\to \mathbb{R}$ measures the cost rate during the process and $g:\mathbb{R}^n\rightarrow \mathbb{R}$ measures the final cost at the terminal state. The expectation is taken over the randomness of the trajectories. + +We are interested in finding a control function that minimizes the total cost for a given initial state. Formally speaking, we define the value function of the control problem (4) as $u(x,t) = \min_{m\in \mathcal{M}}J_{x,t}(m)$ , where $\mathcal{M}$ denotes the set of possible control functions that we take into consideration. It can be obtained that the value function will follow a particular partial differential equation as stated below. + +Definition 3.1 ([38]). The value function $u(x,t)$ is the unique solution to the following partial differential equation, which is called Hamilton-Jacobi-Bellman Equation: + +$$ +\left\{ \begin{array}{l} \partial_ {t} u (x, t) + \frac {1}{2} \sigma^ {2} \Delta u (x, t) + \min _ {m \in \mathcal {M}} [ r (x, m (t, x), t) + \nabla u \cdot m _ {t} ] = 0 \\ u (x, T) = g (x). \end{array} \right. \tag {5} +$$ + +Hamilton-Jacobi-Bellman (HJB) equation establishes a necessary and sufficient condition for a control's optimality with regard to the cost functions. It is one of the most important high-dimensional PDEs [16] in optimal control with tremendous applications in physics [32], biology [18], and finance [26]. Many well-known equations, including Riccati equation, Linear-Quadratic-Gaussian control problem [36], Merton's portfolio problem [22] are special cases of HJB equation [37]. + +Conventionally, the solution to the HJB equation, i.e., the value function $u(x,t)$ , can be computed using dynamic programming [2]. However, the computational complexity of dynamic programming will grow exponentially with the dimension of state function. Considering that the state function in many applications is high-dimensional, solving such HJB equations is notoriously difficult in practice using conventional solvers. As neural networks have shown impressive power in learning high-dimensional functions, it's natural to resort to neural-network-based approaches for solving high-dimensional HJB equations. + +# 4 Failure Mode of PINN on High-Dimensional Stochastic Optimal Control + +Note that $u(x)$ is the exact solution to the PDE (1) if and only if both loss terms $\ell_{\Omega,p}(u)$ and $\ell_{\partial \Omega,p}(u)$ are zero. However, in practice, we usually can only obtain small but non-zero loss values due to the randomness in the optimization procedure or the capacity of the neural network. In such cases, a natural question arises: whether a learned $u(x)$ with a small loss will correspond to a good approximator to the exact solution $u^{*}(x)$ ? Such a property is highly related to the concept stability in PDE literature, which can be defined as below in our learning scenario: + +Definition 4.1. Suppose $Z_{1}, Z_{2}, Z_{3}$ are three Banach spaces. We say a PDE defined as Eq. (1) is $(Z_{1}, Z_{2}, Z_{3})$ -stable, if $\| u^{*}(x) - u(x) \|_{Z_{3}} = O(\| \mathcal{L}u(x) - \varphi(x) \|_{Z_{1}} + \| \mathcal{B}u(x) - \psi(x) \|_{Z_{2}})$ as $\| \mathcal{L}u(x) - \varphi(x) \|_{Z_{1}}, \| \mathcal{B}u(x) - \psi(x) \|_{Z_{2}} \to 0$ for any function $u$ . + +By definition, if a PDE is $(L^2(\Omega), L^2(\partial \Omega), Z)$ -stable with a suitable Banach space $Z$ , we can minimize the widely used $L^2$ Physics-Informed Losses $\| \mathcal{L}u(x) - \varphi(x) \|_{L^2(\Omega)}^2$ and $\| \mathcal{B}u(x) - \psi(x) \|_{L^2(\partial \Omega)}^2$ , and the learned solution is guaranteed to be close to the exact solution when the loss terms approach zero. However, stability is not always an obvious property for PDEs. There are tremendous equations that are unstable, such as the inverse heat equation. Moreover, even if an equation is stable, it is possible that the equation is not $(L^2(\Omega), L^2(\partial \Omega), Z)$ -stable, which suggests that the original $L^2$ Physics-Informed Loss might not be a good choice for solving it. We will show later that for control problems, some practical high-dimensional HJB equations are stable but not $(L^2(\Omega), L^2(\partial \Omega), Z)$ -stable, and using $L^2$ Physics-Informed Loss will fail to find an approximated solution in practice. + +We consider a class $^3$ of HJB equations in which the cost rate function is formulated as $r(x, m) = a_1 |m_1|^{\alpha_1} + \dots + a_n |m_n|^{\alpha_n} - \varphi(x, t)$ . The corresponding Hamilton-Jacobi-Bellman equation can + +be reformulated as: + +$$ +\left\{ \begin{array}{l l} \mathcal {L} _ {\mathrm {H J B}} u := \partial_ {t} u (x, t) + \frac {1}{2} \sigma^ {2} \Delta u (x, t) - \sum_ {i = 1} ^ {n} A _ {i} \left| \partial_ {x _ {i}} u \right| ^ {c _ {i}} = \varphi (x, t) & (x, t) \in \mathbb {R} ^ {n} \times [ 0, T ] \\ \mathcal {B} _ {\mathrm {H J B}} u := u (x, T) = g (x) & x \in \mathbb {R} ^ {n} \end{array} , \right. \tag {6} +$$ + +where $A_{i} = (a_{i}\alpha_{i})^{-\frac{1}{\alpha_{i} - 1}} - a_{i}(a_{i}\alpha_{i})^{-\frac{\alpha_{i}}{\alpha_{i} - 1}} \in (0, + \infty)$ and $c_{i} = \frac{\alpha_{i}}{\alpha_{i} - 1} \in (1,\infty)$ . See Appendix B for the detailed derivation. For a function $f: X \to \mathbb{R}$ , where $X$ is a measurable space, we denote by $\operatorname{supp}f$ the support set of $f$ , i.e. the closure of $\{x \in X : f(x) \neq 0\}$ . + +An important concept for analyzing PDEs is the Sobolev space, which is defined as follows: + +Definition 4.2. For $m \in \mathbb{N}$ , $p \in [1, +\infty)$ and an open set $\Omega \subset \mathbb{R}^n$ , the Sobolev space $W^{m,p}(\Omega)$ is defined as $\{f(x) \in L^p(\Omega): D^\alpha f \in L^p(\Omega), \forall \alpha \in \mathbb{N}^n, |\alpha| \leq m\}$ . The function space $W^{m,p}(\Omega)$ is equipped with Sobolev norm, which is defined as $\|f\|_{W^{m,p}(\Omega)} = \left( \sum_{|\alpha| \leq m} \|D^\alpha f\|_{L^p(\Omega)}^p \right)^{\frac{1}{p}}$ . + +The definition above can be extended to functions defined on a spatiotemporal domain $Q \subseteq \mathbb{R}^n \times [0, T]$ . With a slight abuse of notation, we define $W^{m,p}(Q) = \{f(x,t) \in L^p(Q) : D^\alpha f \in L^p(Q), \forall \alpha \in \mathbb{N}^n, |\alpha| \leq m\}$ , where the differential $D^\alpha$ is only operated over spatial variable $x$ . The norm $\| \cdot \|_{W^{m,p}(Q)}$ can also be defined accordingly. + +Stability of the HJB Equation We present our main theoretical result which characterizes the stability of the HJB equation (Eq. (6)). In particular, we show that the HJB equation is $(L^{p}(\mathbb{R}^{n}\times [0,T]),L^{q}(\mathbb{R}^{n}),W^{1,r}(\mathbb{R}^{n}\times [0,T]))$ -stable when $p,q$ and $r$ satisfies certain conditions. We take the Banach space $Z_{3}$ in Definition 4.1 as $W^{1,r}$ here because it captures the properties of both the value and the derivatives of a function, but $L^p$ spaces do not. However, as could be seen from Appendix B, for optimal control problems, it is essential to obtain an accurate approximator for both the value and the gradient of the value function $u$ (the solution of (Eq. (6)). Thus, it is appropriate to analyze the quality of the approximate solution in $W^{1,r}$ space. + +Theorem 4.3. For $p, q \geq 1$ , let $r_0 = \frac{(n + 2)q}{n + q}$ . Assume the following inequalities hold for $p, q$ and $r_0$ : + +$$ +p \geq \max \left\{2, \left(1 - \frac {1}{\bar {c}}\right) n \right\}; q > \frac {(\bar {c} - 1) n ^ {2}}{(2 - \bar {c}) n + 2}; \frac {1}{r _ {0}} \geq \frac {1}{p} - \frac {1}{n}, \tag {7} +$$ + +where $\bar{c} = \max_{1\leq i\leq n}c_i$ in Eq. (6). Then for any $r\in [1,r_0)$ and any bounded open set $Q\subset \mathbb{R}^n\times [0,T]$ , Eq. (6) is $(L^{p}(\mathbb{R}^{n}\times [0,T]),L^{q}(\mathbb{R}^{n}),W^{1,r}(Q))$ stable for $\bar{c}\leq 2$ + +The proof of Theorem 4.3 can be found in Appendix C and an improved theorem with relaxed dependency on $\bar{c}$ can be found in Appendix E. Intuitively, Theorem 4.3 states that $(L^p,L^q,W^{1,r})$ -stability of Eq. (6) can be achieved when $p,q = \Omega (n)$ . We further show that this linear dependency on $n$ cannot be relaxed in the following theorem: + +Theorem 4.4. There exists an instance of Eq. (6), whose exact solution is $u^{*}$ , such that for any $\varepsilon > 0, A > 0, r \geq 1, m \in \mathbb{N}$ and $p \in \left[1, \frac{n}{4}\right]$ , there exists a function $u \in C^{\infty}(\mathbb{R}^{n} \times (0, T])$ which satisfies the following conditions: + +- $\| \mathcal{L}_{\mathrm{HJB}}u - \varphi \|_{L^p (\mathbb{R}^n\times [0,T])} < \varepsilon$ $\mathcal{B}_{\mathrm{HJB}}u = \mathcal{B}_{\mathrm{HJB}}u^{*}$ , and $\operatorname {supp}(u - u^{*})$ is compact, where $\mathcal{L}_{\mathrm{HJB}}$ and $\mathcal{B}_{\mathrm{HJB}}$ are defined in Eq. (6). +$\| u - u^{*}\|_{W^{m,r}(\mathbb{R}^n\times [0,T])} > A.$ + +The proof of Theorem 4.4 can be found in Appendix D. + +Discussion. Theorem 4.3 and 4.4 together state that when the dimension of the state function $n$ is large, the HJB equation in Eq. (6) cannot be $(L^p, L^q, W^{1,r})$ -stable if $p$ and $q$ are small. Furthermore, since $L^r = W^{0,r}$ by definition, Theorem 4.4 also implies that Eq. (6) is not even $(L^p, L^q, L^r)$ -stable. Therefore, for high-dimensional HJB problems, if we use classic $L^2$ Physics-Informed Loss for training PINN, the learned solution may be arbitrarily distant from $u^*$ even if the loss is very small. Such theoretical results are verified in our empirical studies in Section 6. + +More importantly, our theoretical results indicate that the design choice of the Physics-Informed Loss plays a significant role in solving PDEs using PINN. In this work, we shed light upon this problem using HJB equations. We believe the relationship between PDE's stability and the Physics-Informed Loss should be carefully investigated in the future, especially for high-dimensional non-linear PDEs whose stability are more complicated than low-dimensional and linear ones [8, 11, 19]. Given the above observations, we further propose a new algorithm for training PINN to solve HJB Equations, which will be presented in the subsequent sections. + +# 5 Solving HJB Equations with Adversarial Training + +The above results suggest that we should use a large value of $p$ and $q$ in the loss $\ell_{\Omega,p}(u)$ and $\ell_{\partial \Omega,q}(u)$ to guarantee a learned solution $u$ is close to $u^*$ for high-dimensional HJB problems. Note that $L^p$ -norm and $L^\infty$ -norm behave similarly when $p$ is large. We can substitute $L^p$ -norm by $L^\infty$ -norm and directly optimize $\ell_{\Omega,\infty}(u)$ and $\ell_{\partial \Omega,\infty}(u)$ . Overall, the training objective can be formulated as: + +$$ +\min _ {u} \ell_ {\infty} (u) = \sup _ {x \in \Omega} | \mathcal {L} u (x) - \varphi (x) | + \lambda \sup _ {x \in \partial \Omega} | \mathcal {B} u (x) - \psi (x) |, \tag {8} +$$ + +where $\lambda > 0$ is a hyper-parameter to trade off the two objectives. + +It is straightforward to obtain that setting $p$ and $q$ to infinity satisfies the conditions in Theorem 4.3, and thus the quality of the learned solution enjoys theoretical guarantee. Furthermore, Eq. (8) can be regarded as a min-max optimization problem. The inner loop is a maximization problem to find data points on $\Omega$ and $\partial \Omega$ where $u$ violates the PDE most, and the outer loop is a minimization problem to find $u$ (i.e., the neural network parameters) that minimizes the loss on those points. + +In deep learning, such a min-max optimization problem has been intensively studied, and adversarial training is one of the most effective learning approaches in many applications. We leverage adversarial training, and the detailed implementation is described in Algorithm 1. In each training step, the model parameters and data points are iteratively updated. We first fix the model $u$ and randomly sample data points $x^{(1)},\dots ,x^{(N_1)}\in \Omega$ and $\tilde{x}^{(1)},\dots ,\tilde{x}^{(N_2)}\in \partial \Omega$ , serving as a random initialization of the inner loop optimization. Then we perform gradient-based methods to obtain data points with large point-wise Physics-Informed Losses, which leads to the following inner-loop update rule: + +$$ +x ^ {(k)} \leftarrow \operatorname {P r o j e c t} _ {\Omega} \left(x ^ {(k)} + \eta \operatorname {s i g n} \nabla_ {x} \left(\mathcal {L} u _ {\theta} \left(x ^ {(k)}\right) - \varphi \left(x ^ {(k)}\right)\right) ^ {2}\right); \tag {9} +$$ + +$$ +\tilde {x} ^ {(k)} \leftarrow \operatorname {P r o j e c t} _ {\partial \Omega} \left(\tilde {x} ^ {(k)} + \eta \operatorname {s i g n} \nabla_ {x} \left(\mathcal {B} u _ {\theta} \left(\tilde {x} ^ {(k)}\right) - \psi \left(\tilde {x} ^ {(k)}\right)\right) ^ {2}\right), \tag {10} +$$ + +Algorithm 1 $L^{\infty}$ Training for Physics-Informed Neural Networks +Input: Target PDE (Eq. (1)); neural network $u_{\theta}$ ; initial model parameters $\theta$ +Output: Learned PDE solution $u_{\theta}$ +Hyper-parameters: Number of total training iterations $M$ ; number of iterations and step size of inner loop $K$ , $\eta$ ; weight for combining the two loss term $\lambda$ +1: for $i = 1, \dots, M$ do +2: Sample $x^{(1)}, \dots, x^{(N_1)} \in \Omega$ and $\tilde{x}^{(1)}, \dots, \tilde{x}^{(N_2)} \in \partial \Omega$ +3: for $j = 1, \dots, K$ do +4: for $k = 1, \dots, N_1$ do +5: $x^{(k)} \gets \mathrm{Project}_{\Omega}\left(x^{(k)} + \eta \mathrm{sign} \nabla_x\left(\mathcal{L} u_{\theta}(x^{(k)}) - \varphi(x^{(k)})\right)^2\right)$ +6: for $k = 1, \dots, N_2$ do +7: $\tilde{x}^{(k)} \gets \mathrm{Project}_{\partial \Omega}\left(\tilde{x}^{(k)} + \eta \mathrm{sign} \nabla_x\left(\mathcal{B} u_{\theta}(\tilde{x}^{(k)}) - \psi(\tilde{x}^{(k)})\right)^2\right)$ +8: $g \gets \nabla_{\theta}\left(\frac{1}{N_1} \sum_{i=1}^{N_1}\left(\mathcal{L} u_{\theta}(x^{(i)}) - \varphi(x^{(i)})\right)^2 + \lambda \cdot \frac{1}{N_2} \sum_{i=1}^{N_2}\left(\mathcal{B} u_{\theta}(\tilde{x}^{(i)}) - \psi(\tilde{x}^{(i)})\right)^2\right)$ +9: $\theta \gets \text{Optimizer}(\theta, g)$ +10: return $u_{\theta}$ + +Table 1: Experimental results of solving the 100/250-dimensional LQG control problems. $n$ denotes the dimensionality of the problem. Performances are measured by ${L}^{1},{L}^{2}$ ,and ${W}^{1,1}$ relative error in ${\left\lbrack 0,1{\right\rbrack }^{n} \times \left\lbrack {0,T}\right\rbrack$ . The best performances are indicated in bold. + +
MethodRelative error for n = 100Relative error for n = 250
L1L2W1,1L1L2W1,1
Original PINN [28]3.47%4.25%11.31%6.74%7.67%17.51%
Adaptive time sampling [35]3.05%3.67%13.63%7.18%7.91%18.38%
Learning rate annealing [34]11.09%11.82%33.61%6.94%8.04%18.47%
Curriculum regularization [17]3.40%3.91%9.53%6.72%7.51%17.52%
Adversarial training (ours)0.27%0.33%2.22%0.95%1.18%4.38%
+ +where $\mathrm{Project}_{\Omega}(\cdot)$ and $\mathrm{Project}_{\partial \Omega}(\cdot)$ project the updated data points to the domain. When the inner-loop optimization finishes, we fix the generated data points and calculate the gradient $g$ to the model parameter: + +$$ +g \leftarrow \nabla_ {\theta} \left(\frac {1}{N _ {1}} \sum_ {i = 1} ^ {N _ {1}} \left(\mathcal {L} u _ {\theta} \left(x ^ {(i)}\right) - \varphi \left(x ^ {(i)}\right)\right) ^ {2} + \lambda \cdot \frac {1}{N _ {2}} \sum_ {i = 1} ^ {N _ {2}} \left(\mathcal {B} u _ {\theta} \left(\tilde {x} ^ {(i)}\right) - \psi \left(\tilde {x} ^ {(i)}\right)\right) ^ {2}\right), \tag {11} +$$ + +then the model parameter can be updated using any first-order optimization methods. When the training finishes, the learned neural network will converge to a solution with small $L^{\infty}$ losses and is guaranteed to be close to the exact solution. + +# 6 Experiments + +In this section, we conduct experiments to verify the effectiveness of our approach. Ablation studies on the design choices and hyper-parameters are then provided. Our codes are implemented based on PyTorch [23]. All the models are trained on one NVIDIA Tesla V100 GPU with 16GB memory. Due to space limitation, we only showcase our methods on the Linear Quadratic Gaussian control problem in the main body of the paper. More experimental results on other PDE problems can be found in Appendix G. + +# 6.1 High Dimensional Linear Quadratic Gaussian Control Problem + +We follow [13] to study the classical linear-quadratic Gaussian (LQG) control problem in $n$ dimensions, a special case of the HJB equation: + +$$ +\left\{ \begin{array}{l l} \partial_ {t} u (x, t) + \Delta u (x, t) - \mu \| \nabla_ {x} u (x, t) \| ^ {2} = 0 & x \in \mathbb {R} ^ {n}, t \in [ 0, T ] \\ u (x, T) = g (x) & x \in \mathbb {R} ^ {n}, \end{array} \right. \tag {12} +$$ + +As is shown in [13], there is a unique solution to Eq. (12): + +$$ +u (x, t) = - \frac {1}{\mu} \ln \left(\int_ {\mathbb {R} ^ {n}} (2 \pi) ^ {- n / 2} \mathrm {e} ^ {- \| y \| ^ {2} / 2} \cdot \mathrm {e} ^ {- \mu g (x - \sqrt {2 (T - t)} y)} \mathrm {d} y\right), \tag {13} +$$ + +We set $\mu = 1$ , $T = 1$ , and the terminal cost function $g(x) = \ln \left(\frac{1 + \|x\|^2}{2}\right)$ . + +Experimental Design The neural network used for training is a 4-layer MLP with 4096 neurons and tanh activation in each hidden layer. To train the models, we use Adam as the optimizer [15]. The learning rate is set to $7\mathrm{e} - 4$ in the beginning and then decays linearly to zero during training. The total number of training iterations is set to 5000/10000 for the 100/250-dimensional problem. In each training iteration, we sample $N_{1} = 100 / 50$ points from the domain $\mathbb{R}^n\times [0,T]$ and $N_{2} = 100 / 50$ points from the boundary $\mathbb{R}^n\times \{T\}$ to obtain a mini-batch for the 100/250-dimensional problem. The number of inner-loop iterations $K$ is set to 20, and the inner-loop step size $\eta$ is set to 0.05 unless otherwise specified. Evaluations are performed on a hold-out validation set which is unseen during + +![](images/9bfc198f400c8501e106b3f02427c653f2c73418b2d7b126fca8b971b29cb3c4.jpg) + +![](images/d5073c67d9e2b21af012a323b140c13fb5d8747639994f138a582d30070fc76f.jpg) + +![](images/11a8d2fa6849d14dec07727ddaf14030c5278c4ccc24a0478a3bf91d3b2a1c8a.jpg) + +![](images/dfacd4a5ebf6c80b45c36bb40e4ff5a9cacca51754000fb5566406fb0ca9bee2.jpg) +Figure 1: Visualization for the solutions of Eq. (12). The left panel shows the exact solution $u^{*}$ ; the middle panel shows the learned solutions $u$ of the original PINN method with $L^2$ loss and our method with adversarial training; the right panel shows the point-wise absolute error $|u - u^{*}|$ . Note that the solution is a high dimensional function, and we visualize its snapshot on a two-dimensional domain. Specifically, we visualize a bivariate function $u(x_{1},x_{2},0,\dots ,0;0)$ for $x_{1},x_{2}\in [0,1]$ with the horizontal axis and vertical axis corresponding to $x_{1}$ and $x_{2}$ respectively. + +![](images/2c9af15b83862d1bf1bf7dca672a1d37b815124724733e0ccaba66e897d08de5.jpg) + +training. We use the $L^1, L^2$ , and $W^{1,1}$ relative error in $[0, 1]^n \times [0, T]$ as evaluation metrics: $L^1$ and $L^2$ relative errors are popular evaluation metrics in literature. We additionally consider $W^{1,1}$ relative error since the gradient of the solution to HJB equations plays an important role in applications, and our theory indicates that Eq. (12) is $(L^\infty, L^\infty, W^{1,r})$ stable. More detailed descriptions of the experimental setting and evaluation metrics can be found in Appendix F. + +We compare our method with a few strong baselines: 1) original PINN trained with $L^2$ Physics-Informed Loss [28]; 2) adaptive time sampling for PINN training proposed in [35]; 3) PINN with the learning rate annealing algorithm proposed in [34]; 4) curriculum PINN regularization proposed in [17]. The training recipes for the baseline methods, including the neural network architecture, the training iterations, the optimizer, and the learning rate, are the same as those of our method described above. It should be noted that although these approaches modify the data sampler, training algorithms or the loss function, they all keep the $L^2$ norm of the PDE residual and boundary residual unchanged in the training objective. + +**Experimental Results** The experimental results are summarized in Table 1. It's clear that the relative error of the model trained using the original PINN does not fit the solution well, e.g., the $L^1$ relative error is larger than $6\%$ when $n = 250$ . This empirical observation aligns well with our theoretical analysis, i.e., minimizing $L^2$ loss cannot guarantee the learned solution to be accurate. Advanced methods, e.g., curriculum PINN regularization [17], can improve the accuracy of the learned solution but with marginal improvement, which suggests that these methods do not address the key limitation of PINN in solving high-dimensional HJB Equations. By contrast, our proposed method significantly outperforms all the baseline methods in terms of both $L^p$ relative error and Sobolev relative error, which indicates that both the values and the gradients of our learned solutions are more accurate than the baselines. + +We also examine the quality of the learned solution $u(x,t)$ by visualization. As the solution is a high-dimensional function, we visualize its snapshot on a two-dimensional space. Specifically, we consider a bivariate function $u(x_{1},x_{2},0,\dots ,0;0)$ and use a heatmap to show its function value given different $x_{1}$ and $x_{2}$ . Figure 1 shows the ground truth $u^{*}$ , the learned solutions $u$ of original PINN and our method, and the point-wise absolute error $|u - u^{*}|$ for each methods. The two axes correspond $x_{1}$ and $x_{2}$ , respectively. We can see that the point-wise error of the learned solution using our algorithm is less than $2\mathrm{e} - 2$ on average. In contrast, the point-wise error of the learned solution using original PINN method with $L^2$ loss is larger than $1.3\mathrm{e} - 1$ for most areas. Therefore, + +![](images/9dfe0b7722a6c31cd9e2a8b14f9de2f56d0d746274662d5acad51d789c07465c.jpg) + +![](images/def9c6962dd84ca9a8efde290963223fb2a15289583dc907ee2705e301a37fb4.jpg) + +![](images/99a7812ac3d5abaef2e32c1372bfcffe0efb43777cc1aa72ef92afc5f25e0a27.jpg) + +![](images/f4d7b3e326230883f8cf07893cd9dd66137a3b96a44878cfbda61036b2102932.jpg) +Figure 2: Visualization for the gradient norm of the solutions of Eq. (12). The left panel shows the ground truth $|\nabla_x u^*|$ ; the middle panel shows the learned $|\nabla_x u|$ of the original PINN method with $L^2$ loss and our method with adversarial training; the right panel shows the point-wise absolute error $|\nabla_x (u - u^*)|$ . We only visualize a snapshot on a two-dimensional domain. Specifically, we visualize a bivariate function $u(x_1, x_2, 0, \dots, 0; 0)$ for $x_1, x_2 \in [0, 1]$ with the horizontal axis and vertical axis corresponding to $x_1$ and $x_2$ respectively. + +![](images/33a1a1d8a16b39bd1f7416323511bb9a0b9fe09316ef7d160e534ec47d70c5c6.jpg) + +the visualization of the solutions clearly illustrate that PINN learned more accurate solution using our proposed algorithm. + +Furthermore, we visualize the gradient norm $|\nabla_x u|$ of the learned solution of both our method and the original PINN in Figure 2, to illustrate that not only can the learned solution of our method accurately approximate the exact solution, but also the gradient of the learned solution can accurately approximate the gradient of the exact solution. Again, since $|\nabla_x u|$ is a high dimensional function, we use a heatmap to show its function value given different $x_1$ and $x_2$ , and set the other variables to 0. From the right panel of Figure 2, we can clearly see that the gradient of the learned solution of our method is much more accurate compared with that of the gradient of the learned solution using original PINN. The gradient norm error of the vanilla PINN approach is nearly $1\mathrm{e} - 2$ in some areas shown in the visualization, while the error of our method is less than $1\mathrm{e} - 3$ for most data points. This empirical observation aligns well with our theory, which states that Eq. (12) is $(L^{\infty}, L^{\infty}, W^{1,r})$ stable. + +# 6.2 Ablation studies + +We conduct ablation studies on the 100-dimensional LQG control problem (Eq. (12)) to ablate the main designs in our algorithm. + +Adversarial training v.s. Directly optimizing $L^p$ physic-informed loss. Our proposed algorithm introduces a min-max optimization procedure. One may have concerns that such an approach may be unnecessarily complicated, and directly minimizing $L^p$ physic-informed loss with a large $p$ would have the same effect. We use these two methods to solve Eq. (12), and compare their performance in the left panel of Table 2. It can be seen that directly minimizing $L^p$ physic-informed loss does not lead to satisfactory results. + +We point out that this observation does not contradict our theoretical analysis (Theorem 4.3). Theorem 4.3 focuses on the approximation ability, which indicates that a model with a small $L^p$ loss can approximate the exact solution well. The empirical results in Table 2 demonstrate the optimization difficulty of learning such a model with $L^p$ loss. By comparison, our proposed adversarial training method is more stable and leads to better performance. More detailed discussions are provided in Appendix H. + +Table 2: Experimental results for ablation studies. The left panel compares PINN trained with $L^p$ Physic Informed Loss and our method; the right panel compares PINN trained with partial or no adversarial training and our method. In the first two columns of the right panel, $\mathcal{X}$ indicates using the original $L^2$ Physics-Informed Loss for the PDE/boundary residual loss term, while $\checkmark$ indicates using the proposed adversarial training method for the corresponding loss term. Performances are measured by $L^1$ relative error. Best performances are indicated in bold. + +
MethodRelative error
L4Loss2.42%
L8Loss53.55%
L16Loss113.24%
Ours0.27%
+ +
Adversarial trainingRelative error
DomainBoundary
XX3.47%
X✓2.79%
✓✓0.27%
+ +![](images/cbfd1cc73e17a755ad980ef511a697dede0d05e28041717ce8ed6d1632c9dce5.jpg) + +Adversarial training should be applied to both the PDE residual and the boundary residual. Our theoretical analysis suggests that we should use a large value of $p$ and $q$ in the loss $\ell_{\Omega,p}(u)$ and $\ell_{\partial \Omega,q}(u)$ to guarantee the quality of the learned solution $u$ . Thus, in the proposed Algorithm 1, both the data points inside the domain and the data points on the boundary are learned in the inner-loop maximization. From the right panel of Table 2, we can see that when adversarial training is applied to one loss term, the performance is slightly improved, but its accuracy is still not satisfactory. When both loss terms use adversarial training, the solution is one order of magnitude more accurate, indicating that applying adversarial training to the whole loss function is essential. + +Hyper-parameters $K$ and $\eta$ for the inner loop maximization. Our approach introduces additional hyper-parameters $K$ (the number of inner-loop iterations) and $\eta$ (the inner-loop step size). These two parameters control the accuracy of inner-loop maximization. We conduct ablation studies to examine the effects of different design choices. Specifically, we experiment with $K = 5, 10, 20$ and $\eta = 0.05, 0.1, 0.2$ , and show the $L^1$ relative error in the right panel of Table 2. Typically we find that setting the product $K\eta = 1$ achieves the best performance. When $K\eta$ is fixed, our results suggest that using a larger $K$ and a smaller $\eta$ , i.e., more inner-loop iterations and smaller step sizes, will lead to better performance while being more time-consuming. + +# 7 Conclusions + +In this paper, we theoretically investigate the relationship between the loss function and the approximation quality of the learned solution using the concept of stability in the partial differential equation. We study an important class of high-dimensional non-linear PDEs in optimal control, the Hamilton-Jacobi-Bellman (HJB) equation, and prove that for general $L^p$ Physics-Informed Loss, the HJB equation is stable only if $p$ is sufficiently large. Such a theoretical finding reveals that the widely used $L^2$ loss is not suitable for training PINN on high-dimensional HJB equations, while $L^\infty$ loss is a better choice. The theory also inspires us to develop a novel PINN training algorithm to minimize the $L^\infty$ loss for HJB equations in a similar spirit to adversarial training. One limitation of this work is that we only work on the HJB Equation. Theoretical investigation of other important equations can be an exciting direction for future works. We believe this work provides important insights into the loss design in Physics-Informed deep learning. + +# Acknowledgements + +We thank Weinan E, Bin Dong, Yiping Lu, Zhifei Zhang, and Yufan Chen for the helpful discussions. + +This work is supported by National Science Foundation of China (NSFC62276005), The Major Key Project of PCL (PCL2021A12), Exploratory Research Project of Zhejiang Lab (No. 2022RC0AN02), and Project 2020BD006 supported by PKUBaidu Fund. + +# References + +[1] Christian Beck, Sebastian Becker, Patrick Cheridito, Arnulf Jentzen, and Ariel Neufeld. Deep splitting method for parabolic pdes. SIAM Journal on Scientific Computing, 43(5):A3135-A3154, 2021. +[2] Richard Bellman. Dynamic programming. Science, 153(3731):34-37, 1966. +[3] Dimitri Bertsekas and Steven E Shreve. Stochastic optimal control: the discrete-time case, volume 5. Athena Scientific, 1996. +[4] Michael Christ, James Colliander, and Terrence Tao. Asymptotics, frequency modulation, and low regularity ill-posedness for canonical defocusing equations. American journal of mathematics, 125(6):1235–1293, 2003. +[5] Ashley Davey and Harry Zheng. Deep learning for constrained utility maximisation. Methodology and Computing in Applied Probability, 24(2):661-692, 2022. +[6] Tim De Ryck, Ameya D Jagtap, and Siddhartha Mishra. Error estimates for physics informed neural networks approximating the navier-stokes equations. arXiv preprint arXiv:2203.09346, 2022. +[7] Yu Deng and Nader Masmoudi. Long time instability of the couette flow in low gevrey spaces. arXiv preprint arXiv:1803.01246, 2018. +[8] Lawrence C Evans. Partial differential equations. Graduate studies in mathematics, 19(4):7, 1998. +[9] Wendell H Fleming and Raymond W Rishel. Deterministic and stochastic optimal control, volume 1. Springer Science & Business Media, 2012. +[10] Peter A Forsyth, J Shannon Kennedy, Shu Tong Tse, and Heath Windcliff. Optimal trade execution: a mean quadratic variation approach. Journal of Economic dynamics and Control, 36(12):1971-1991, 2012. +[11] David Gilbarg, Neil S Trudinger, David Gilbarg, and NS Trudinger. Elliptic partial differential equations of second order, volume 224. Springer, 1977. +[12] Igor Halperin. Distributional offline continuous-time reinforcement learning with neural physics-informed pdes (sciphyrl for doctr-1). arXiv preprint arXiv:2104.01040, 2021. +[13] Jiequn Han, Arnulf Jentzen, and E Weinan. Solving high-dimensional partial differential equations using deep learning. Proceedings of the National Academy of Sciences, 115(34):8505-8510, 2018. +[14] Yuehaw Khoo, Jianfeng Lu, and Lexing Ying. Solving parametric pde problems with artificial neural networks. arXiv preprint arXiv:1707.03351, 2017. +[15] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR (Poster), 2015. +[16] Donald E Kirk. Optimal control theory: an introduction. Courier Corporation, 2004. +[17] Aditi Krishnapriyan, Amir Gholami, Shandian Zhe, Robert Kirby, and Michael W Mahoney. Characterizing possible failure modes in physics-informed neural networks. Advances in Neural Information Processing Systems, 34, 2021. +[18] Weiwei Li, Emanuel Todorov, and Dan Liu. Inverse optimality design for biological movement systems. IFAC Proceedings Volumes, 44(1):9662-9667, 2011. +[19] Gary M Lieberman. Second order parabolic differential equations. World scientific, 1996. +[20] Zhiwu Lin and Chongchun Zeng. Inviscid dynamical structures near couette flow. Archive for rational mechanics and analysis, 200(3):1075-1097, 2011. + +[21] Yiping Lu, Haoxuan Chen, Jianfeng Lu, Lexing Ying, and Jose Blanchet. Machine learning for elliptic pdes: Fast rate generalization bound, neural scaling law and minimax optimality. arXiv preprint arXiv:2110.06897, 2021. +[22] Robert C Merton. Optimum consumption and portfolio rules in a continuous-time model. In Stochastic optimization models in finance, pages 621-661. Elsevier, 1975. +[23] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems, 32:8026-8037, 2019. +[24] Marcus Pereira, Ziyi Wang, Tianrong Chen, Emily Reed, and Evangelos Theodorou. Feynman-kac neural network architectures for stochastic control using second-order fbsde theory. In Learning for Dynamics and Control, pages 728-738. PMLR, 2020. +[25] Marcus Pereira, Ziyi Wang, Ioannis Exarchos, and Evangelos A Theodorou. Learning deep stochastic optimal control policies using forward-backward sdes. arXiv preprint arXiv:1902.03986, 2019. +[26] Huyen Pham. Continuous-time stochastic control and optimization with financial applications, volume 61. Springer Science & Business Media, 2009. +[27] Huyen Pham, Xavier Warin, and Maximilien Germain. Neural networks-based backward scheme for fully nonlinear pdes. SN Partial Differential Equations and Applications, 2(1):1-24, 2021. +[28] Maziar Raissi, Paris Perdikaris, and George E Karniadakis. Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations. Journal of Computational Physics, 378:686-707, 2019. +[29] Tim De Ryck, Ameya D. Jagtap, and Siddhartha Mishra. Error estimates for physics informed neural networks approximating the navier-stokes equations. CoRR, abs/2203.09346, 2022. +[30] Alexander Schied and Torsten Schöneborn. Risk aversion and the dynamics of optimal liquidation strategies in illiquid markets. Finance and Stochastics, 13(2):181-204, 2009. +[31] Yeonjong Shin, Zhongqiang Zhang, and George Em Karniadakis. Error estimates of residual minimization using neural networks for linear pdes. arXiv preprint arXiv:2010.08019, 2020. +[32] Stanislaw Sieniutycz. Hamilton-jacobi-bellman framework for optimal control in multistage energy systems. Physics Reports, 326(4):165-258, 2000. +[33] Justin Sirignano and Konstantinos Spiliopoulos. Dgm: A deep learning algorithm for solving partial differential equations. Journal of computational physics, 375:1339-1364, 2018. +[34] Sifan Wang, Yujun Teng, and Paris Perdikaris. Understanding and mitigating gradient flow pathologies in physics-informed neural networks. SIAM Journal on Scientific Computing, 43(5):A3055-A3081, 2021. +[35] Colby L Wight and Jia Zhao. Solving allen-cahn and cahn-hilliard equations using the adaptive physics informed neural networks. arXiv preprint arXiv:2007.04542, 2020. +[36] Jan Willems. Least squares stationary optimal control and the algebraic riccati equation. IEEE Transactions on automatic control, 16(6):621-634, 1971. +[37] William M Wonham. On a matrix Riccati equation of stochastic control. SIAM Journal on Control, 6(4):681-697, 1968. +[38] Jiongmin Yong and Xun Yu Zhou. Stochastic controls: Hamiltonian systems and HJB equations, volume 43. Springer Science & Business Media, 1999. +[39] Yajie Yu, Bernhard Hientzsch, and Narayan Ganesan. Backward deep bsde methods and applications to nonlinear problems. arXiv preprint arXiv:2006.07635, 2020. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] +(c) Did you discuss any potential negative societal impacts of your work? [No] We don't see any potential negative societal impacts of this work. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] +(b) Did you include complete proofs of all theoretical results? [Yes] The proofs are provided in the appendix. + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A] +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] +(b) Did you mention the license of the assets? [Yes] +(c) Did you include any new assets either in the supplemental material or as a URL? [No] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/isl2physicsinformedlossalwayssuitablefortrainingphysicsinformedneuralnetwork/images.zip b/isl2physicsinformedlossalwayssuitablefortrainingphysicsinformedneuralnetwork/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..1b088817227b9d4f9c67a1ff4d7e8686474e6118 --- /dev/null +++ b/isl2physicsinformedlossalwayssuitablefortrainingphysicsinformedneuralnetwork/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e50baf01ceb0cb3f867ea7b38772a1c0f78db6ac3696f4438bb94666bf427ace +size 318160 diff --git a/isl2physicsinformedlossalwayssuitablefortrainingphysicsinformedneuralnetwork/layout.json b/isl2physicsinformedlossalwayssuitablefortrainingphysicsinformedneuralnetwork/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..4adcc719e796d7396efadc687cde4521315f2833 --- /dev/null +++ b/isl2physicsinformedlossalwayssuitablefortrainingphysicsinformedneuralnetwork/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fabb428f92b40b88d79777c297b404014405eb22bd0b328b7de8fb1d358a2c59 +size 577421 diff --git a/isodreamisolatingandleveragingnoncontrollablevisualdynamicsinworldmodels/5f5bbb10-d83e-492a-89c7-6a9da7cc7364_content_list.json b/isodreamisolatingandleveragingnoncontrollablevisualdynamicsinworldmodels/5f5bbb10-d83e-492a-89c7-6a9da7cc7364_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..f4522b15a8be139869194688c983c324f2ba94b5 --- /dev/null +++ b/isodreamisolatingandleveragingnoncontrollablevisualdynamicsinworldmodels/5f5bbb10-d83e-492a-89c7-6a9da7cc7364_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ba0ce55f673d76bc9d42a81ab3bbc7abacae7b04c499479a149fc3cb580c3d01 +size 75565 diff --git a/isodreamisolatingandleveragingnoncontrollablevisualdynamicsinworldmodels/5f5bbb10-d83e-492a-89c7-6a9da7cc7364_model.json b/isodreamisolatingandleveragingnoncontrollablevisualdynamicsinworldmodels/5f5bbb10-d83e-492a-89c7-6a9da7cc7364_model.json new file mode 100644 index 0000000000000000000000000000000000000000..d46ea364cdb8ff2c090605dbeaf8c09a61a6d895 --- /dev/null +++ b/isodreamisolatingandleveragingnoncontrollablevisualdynamicsinworldmodels/5f5bbb10-d83e-492a-89c7-6a9da7cc7364_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a839daa855c0e7cb091769ee1d96cdf18d4ad79ba438fb4b60ef19311b7c86f6 +size 98085 diff --git a/isodreamisolatingandleveragingnoncontrollablevisualdynamicsinworldmodels/5f5bbb10-d83e-492a-89c7-6a9da7cc7364_origin.pdf b/isodreamisolatingandleveragingnoncontrollablevisualdynamicsinworldmodels/5f5bbb10-d83e-492a-89c7-6a9da7cc7364_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..dd8fbcdabbea68fceac4cd1f873cfefad1768b3e --- /dev/null +++ b/isodreamisolatingandleveragingnoncontrollablevisualdynamicsinworldmodels/5f5bbb10-d83e-492a-89c7-6a9da7cc7364_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a04010498cead61443b9eff82165ab2ef2c0248f79941ac7ab08bb426ca29148 +size 4999162 diff --git a/isodreamisolatingandleveragingnoncontrollablevisualdynamicsinworldmodels/full.md b/isodreamisolatingandleveragingnoncontrollablevisualdynamicsinworldmodels/full.md new file mode 100644 index 0000000000000000000000000000000000000000..f5ae3c9e7d41033389e33861ad86ae16fe430481 --- /dev/null +++ b/isodreamisolatingandleveragingnoncontrollablevisualdynamicsinworldmodels/full.md @@ -0,0 +1,306 @@ +# Iso-Dream: Isolating and Leveraging Noncontrollable Visual Dynamics in World Models + +Minting Pan* Xiangming Zhu* Yunbo Wang† Xiaokang Yang MoE Key Lab of Artificial Intelligence, AI Institute, Shanghai Jiao Tong University {panmt53, xmzhu76, yunbow, xkyang}@sjtu.edu.cn + +# Abstract + +World models learn the consequences of actions in vision-based interactive systems. However, in practical scenarios such as autonomous driving, there commonly exists noncontrollable dynamics independent of the action signals, making it difficult to learn effective world models. To tackle this problem, we present a novel reinforcement learning approach named Iso-Dream, which improves the Dream-to-Control framework [22] in two aspects. First, by optimizing the inverse dynamics, we encourage the world model to learn controllable and noncontrollable sources of spatiotemporal changes on isolated state transition branches. Second, we optimize the behavior of the agent on the decoupled latent imaginations of the world model. Specifically, to estimate state values, we roll-out the noncontrollable states into the future and associate them with the current controllable state. In this way, the isolation of dynamics sources can greatly benefit long-horizon decision-making of the agent, such as a self-driving car that can avoid potential risks by anticipating the movement of other vehicles. Experiments show that Iso-Dream is effective in decoupling the mixed dynamics and remarkably outperforms existing approaches in a wide range of visual control and prediction domains. + +# 1 Introduction + +Humans can infer and predict real-world dynamics by simply observing and interacting with the environment. Inspired by this, many cutting-edge AI agents use self-supervised learning [37, 20, 12] or reinforcement learning [38, 22, 41] techniques to acquire knowledge from their surroundings. Among them, world models [20] have received widespread attention in the field of robot visual control, and led the recent progress in model-based reinforcement learning (MBRL) [22, 41, 24, 29]. A typical approach [22] is to use the trajectories of observations and control signals collected by an RL agent to learn a differentiable simulator of the environment, namely the world model, and then update the RL agent by optimizing the behaviors on the latent imaginations of the world model. + +However, since the observation sequence is high-dimensional, non-stationary, and often driven by multiple sources of physical dynamics, how to learn effective world models in complex visual scenes remains an open problem. In realistic scenarios such as autonomous driving, we can generally divide spatiotemporal dynamics in the system into controllable parts that perfectly respond to action signals, and parts beyond the control of the agent, such as the movement of other vehicles and other external changes. The isolation of controllable and noncontrollable states can improve MBRL in two aspects: + +- Modular representation improves the generalization of the agent to non-stationary environments with noises, such as the time-varying background in our modified DeepMind Control Suite. + +![](images/791926916f9150693b4b786284f8ce00f4dd1cc2fd8a216ad17dfb5f30ea8c38.jpg) +Figure 1: Probabilistic graph of Iso-Dream. It learns to decouple complex visual dynamics into controllable states $(s_t)$ and noncontrollable states $(z_t)$ by optimizing the inverse dynamics (Red dashed arrows). On top of the disentangled states, it performs model-based reinforcement learning by explicitly considering the predicted noncontrollable component of future dynamics (Blue arrows). + +- More importantly, it improves long-horizon RL tasks that can greatly benefit from decisions based on predictions of future noncontrollable dynamics. For example, in autonomous driving, potential risks can be better avoided by predicting the movement of other vehicles. + +We present Iso-Dream, a novel MBRL framework that learns to decouple and leverage the controllable and noncontrollable state transitions. Accordingly, it improves the original Dreamer [22] from two perspectives: (i) a new form of world model representations and (ii) a new actor-critic algorithm to derive the behavior from the world model. As shown in Figure 1, the foundation of decoupling the world model is to separate the mixed latent states into an action-conditioned branch and an action-free branch, which can individually transit different sources of visual dynamics. The components are jointly trained to maximize the variational lower bounds. To further isolate the controllable states, the action-conditioned branch is also optimized with inverse dynamics, that is, to reason about the actions that have driven the state transitions between adjacent time steps. + +Another contribution of Iso-Dream is to find that disentangling physical dynamics can greatly benefit the downstream decision-making tasks by more accurately foreseeing the inherent changes in the environment. Intuitively, humans can decide how to interact with the environment at each moment based on their anticipation of future changes in the surroundings. To make more forward-looking decisions, as shown by the blue arrows in Figure 1, the policy network integrates the current controllable state and multiple steps of predicted noncontrollable states through an attention mechanism. It enables the agent to thoroughly consider possible future interactions with the environment. + +We evaluate Iso-Dream in the following domains: The modified DeepMind Control Suite with noisy video background; The CARLA autonomous driving environment in which other vehicles can be naturally viewed as noncontrollable components; The real-world BAIR robot dataset and the RoboNet dataset that are helpful to validate the effectiveness of the world model for disentanglement. On all benchmarks, Iso-Dream remarkably outperforms the existing approaches by large margins. + +# 2 Related Work + +Action-conditioned video prediction. A straightforward deep learning solution to visual control problems is to learn action-conditioned video prediction models [37, 14, 8, 52] and then perform Monte-Carlo importance sampling and optimization algorithms, such as the cross-entropy methods, over available behaviors [15, 12, 28]. Hot topics in video prediction mainly includes long-term and high-fidelity future frames generation [43, 42, 50, 5, 51, 49, 53, 40, 39, 35, 55, 27, 2], dynamics uncertainty modeling [1, 10, 47, 30, 7, 16, 54], object-centric scene decomposition [46, 26, 18, 57, 3], and space-time disentanglement [48, 26, 19, 6]. The corresponding technical improvements mainly involve the use of more effective neural architectures, novel probabilistic modeling methods, and specific forms of video representation. The disentanglement methods are closely related to the world + +model in Iso-Dream. They commonly separate visual dynamics into content and motion vectors, or long-term and short-term states. In contrast, Iso-Dream is designed to learn a decoupled world model based on controllability, which contributes more to the downstream behavior learning process. + +Visual MBRL. In visual control tasks, the agents have to learn the action policy directly from high-dimensional observations. They can be roughly grouped into two categories, that is, model-free methods [33, 56, 31, 32, 25] and model-based methods [15, 38, 20, 23, 22, 29, 41, 58, 4]. Among them, the MBRL approaches explicitly model the state transitions and generally yield higher sample efficiency than the model-free methods. Ha and Schmidhuber [20] proposed the World Models that first learn compressed latent states of the environment in a self-supervised manner, and then train the agent on the latent states generated by the world model. Following the two-stage training procedure, PlaNet [23] uses an action-conditioned, recurrent state-space model (RSSM) as the world model, and optimizes the action policy on the recurrent states with the cross-entropy methods. In Dreamer [22] and DreamerV2 [24], agents learn behaviors by optimizing the expected values over the predicted latent states in RSSM. InfoPower [4] prioritizes functional-related information from visual observations to obtain a more robust representation for MBRL. Notably, Iso-Dream is very different from InfoPower in two aspects. First, we explicitly model the state transitions of controllable and noncontrollable dynamics, so that it is possible to choose whether to take the noncontrollable states into behavior learning according to the prior knowledge of a specific domain. Second, we propose a new behavior learning method that greatly benefits from the decoupled world model, so that we can preview possible future states of noncontrollable patterns before making decisions at this moment. + +# 3 Method + +In this section, we first present basic assumptions and the general framework of Iso-Dream for decoupling and leveraging controllable and noncontrollable dynamics for visual control (Section 3.1). For representation learning, we introduce the three-branch world model and its training objectives of inverse dynamics (Section 3.2). For behavior learning, we present an actor-critic method that is trained on the imaginations of the decoupled world model latent states, so that the agent may consider possible future states of noncontrollable dynamics (Section 3.3). Finally, we discuss how Iso-Dream is deployed to interact with the environment (Section 3.4). + +# 3.1 Basic Assumptions of Iso-Dream + +As shown in Figure 1, when the agent receives a sequence of visual observations $o_{1:T}$ , the underlying spatiotemporal dynamics can be defined as $u_{1:T}$ . Our goal is to understand the inner relationships of different dynamics by decoupling $u_{1:T}$ into controllable latent states $s_{1:T}$ and noncontrollable latent states $z_{1:T}$ that vary in spacetime, such that: + +$$ +u _ {1: T} \sim (s, z) _ {1: T}, \quad s _ {t + 1} \sim p \left(s _ {t + 1} \mid s _ {t}, a _ {t}\right), \quad z _ {t + 1} \sim p \left(z _ {t + 1} \mid z _ {t}\right), \tag {1} +$$ + +where $a_{t}$ is the action signal. To achieve long-term prediction, we isolate $s_{t}$ and $z_{t}$ to each other and model their state transitions of $p(s_{t + 1} \mid s_t, a_t)$ and $p(z_{t + 1} \mid z_t)$ respectively. + +According to our prior knowledge of the environment, we can optionally choose whether to roll out the noncontrollable states and consider them during behavior learning. For tasks where the noncontrollable components can be viewed as time-varying noise, we simply derive the action policy by $a_{t} \sim \pi (a_{t} \mid s_{t})$ . The isolation of controllable states improves the generalization of the agent to non-stationary systems. For tasks like autonomous driving, the behaviors are derived by + +$$ +a _ {t} \sim \pi \left(a _ {t} \mid s _ {t}, z _ {t: t + \tau}\right), \tag {2} +$$ + +where we calculate the relationships between $s_t$ and the imagined noncontrollable states over time horizon $\tau$ . It assumes that, in specific long-horizon tasks, the agent can greatly benefit from predicting the consequences of external noncontrollable forces. + +# 3.2 Representation Learning of Controllable and Noncontrollable Dynamics + +Inspired by previous approaches [36, 17] showing that modular structures are effective for disentanglement learning, we leverage a three-branch architecture to decouple $u_{t}$ into controllable dynamics state $s_t$ , noncontrollable dynamics state $z_{t}$ , and time-invariant representation of the background. As + +![](images/d615e740d37a2dc9c9a0d603bd5d220468dabce3030778862c1956d27de4ba5c.jpg) +(a) World model of Iso-Dream + +![](images/c1c657f73728813865a7764885c25da8881e803bde14dd6072eae44b6879e491.jpg) +(b) Learn behavior in imagination +Figure 2: The overall architecture of the world model and the behavior learning algorithm in IsoDream. (a) World model with three branches to explicitly disentangle controllable, noncontrollable, and static components from visual data, where the action-conditioned branch learns controllable state transitions by modeling inverse dynamics. (b) The agent optimizes the behaviors in imaginations of the world model through a future state attention mechanism. + +shown in Figure 2(a), the action-conditioned branch models $p(s_{t+1} \mid s_t, a_t)$ . It follows the RSSM architecture from PlaNet [23] to use a recurrent neural network GRUs( $\cdot$ ), the deterministic hidden state $h_t$ , and the stochastic state $s_t$ to form the transition model, where the GRU keeps the historical information of the controllable dynamics. The action-free branch models $p(z_{t+1} \mid z_t)$ with similar network structures. The transition models with separate parameters can be written as follows: + +$$ +\begin{array}{l} p \left(\tilde {s} _ {t} \mid s _ {< t}, a _ {< t}\right) = p \left(\tilde {s} _ {t} \mid h _ {t}\right), \quad \text {w h e r e} h _ {t} = \operatorname {G R U} _ {s} \left(h _ {t - 1}, s _ {t - 1}, a _ {t - 1}\right), \\ p \left(\tilde {z} _ {t} \mid z _ {< t}\right) = p \left(\tilde {z} _ {t} \mid h _ {t} ^ {\prime}\right), \quad \text {w h e r e} h _ {t} ^ {\prime} = \mathrm {G R U} _ {z} \left(h _ {t - 1} ^ {\prime}, z _ {t - 1}\right). \\ \end{array} +$$ + +We here use $\tilde{s}_t$ and $\tilde{z}_t$ to denote the prior representations. We optimize the transition models with posterior representations that are derived from $s_t\sim q(s_t\mid h_t,o_t)$ and $z_{t}\sim q(z_{t}\mid h_{t}^{\prime},o_{t})$ . We learn the posteriors from the observation at current time step $o_t\in \mathbb{R}^{3\times H\times W}$ by a shared encoder Enc $_\theta$ and subsequent branch-specific encoders Enc $_\phi_1$ and Enc $_\phi_2$ . + +To enhance the disentanglement representation learning corresponding to the control signals, we introduce the training objective of inverse dynamics. Accordingly, we design an Inverse Cell of a 2-layer MLP to infer the actions that lead to certain transitions of the controllable states: + +$$ +\text {I n v e r s e d y n a m i c s :} \tilde {a} _ {t - 1} = \operatorname {M L P} \left(s _ {t - 1}, s _ {t}\right), \tag {4} +$$ + +where the inputs are the posterior representations in the action-conditioned branch. By learning to regress the true behavior $a_{t-1}$ , the Inverse Cell facilitates the action-conditioned branch to isolate the representation of the controllable dynamics. To avoid the training collapse where the action-conditioned branch captures most of the useful information, while the action-free branch learns almost nothing, in the process of image reconstruction, we respectively use the prior state $\tilde{s}_t$ and the posterior state $z_t$ to generate the controllable visual component $\hat{o}_t^s \in \mathbb{R}^{3 \times H \times W}$ with mask $M_t^s \in \mathbb{R}^{1 \times H \times W}$ and the noncontrollable component $\hat{o}_t^z \in \mathbb{R}^{3 \times H \times W}$ with $M_t^z \in \mathbb{R}^{1 \times H \times W}$ . By further integrating the time-invariant information extracted from the first $K$ frames, we have + +$$ +\hat {o} _ {t} = M _ {t} ^ {s} \odot \hat {o} _ {t} ^ {s} + M _ {t} ^ {z} \odot \hat {o} _ {t} ^ {z} + \left(1 - M _ {t} ^ {s} - M _ {t} ^ {z}\right) \odot \hat {o} ^ {b}, \quad \text {w h e r e} \hat {o} ^ {b} = \operatorname {D e c} _ {\varphi_ {3}} \left(\operatorname {E n c} _ {\theta , \phi_ {3}} \left(o _ {1: K}\right)\right). \tag {5} +$$ + +For reward modeling, we have two options with the action-free branch. In one case, the noncontrollable dynamics can be considered as noises that are not related to the task, and therefore $z_{t}$ is no longer useful during imagination. In other words, the policy and the predicted reward are only related to the controllable states. In the other case, future noncontrollable states would affect how the agent makes decisions, and we consider the action-free components during behavior learning. For this, we learn alternative reward models $p(r_{t} \mid s_{t})$ or $p(r_{t} \mid s_{t}, z_{t})$ in forms of MLPs. + +Algorithm 1: Iso-Dream (Highlight: Our modifications to behavior learning & policy deployment) +Hyperparameters: $L$ : Imagination horizon; $\tau$ : Window size for future state attention +Initialize the replay buffer $\tilde{B}$ with random episodes. +while not converged do +for update step $c = 1\dots C$ do Draw data sequences $\{(o_t,a_t,r_t)\}_{t = 1}^T\sim \mathcal{B}$ // Representation learning Compute world model loss using Eq. (6) and update model parameters. // Behavior learning Roll-out the noncontrollable states $\{\tilde{z}_i\}_{i = t + 1}^{t + L + \tau}$ from $z_{t}$ through the action-free branch alone. for time step $j = i\dots i + L$ do Compute latent state $e_j\sim \mathrm{Attention}(\tilde{s}_j,\tilde{z}_{j:j + \tau})$ using Eq. (7). Imagine an action $a_{j}\sim \pi (a_{j}|e_{j})$ Predict the next controllable state $\tilde{s}_{j + 1}\sim p(\tilde{s}_j,a_j)$ using the action-conditioned branch alone. end Update the policy and value models in Eq. (8) using estimated rewards and values. +end +// Environment interaction + $o_1\gets \mathrm{env}\cdot \mathrm{reset()}$ +for time step $t = 1\dots T$ do Calculate the posterior representation $s_t\sim q(s_t|h_t,o_t),z_t\sim q(z_t|h'_t,o_t)$ Roll-out the noncontrollable states $\tilde{z}_{t + 1:t + \tau}$ from $z_{t}$ through the action-free branch alone. Generate $a_{t}\sim \pi (a_{t}|s_{t},z_{t},\tilde{z}_{t + 1:t + \tau})$ using future state attention in Eq. (7). $r_t,o_{t + 1}\gets \mathrm{env}\cdot \mathrm{step}(a_t)$ +end +Add experience to the replay buffer $\mathcal{B}\gets \mathcal{B}\cup \{(o_t,a_t,r_t)_t = 1\}$ +end + +For a sequence of $(o_t, a_t, r_t)_{t=1}^T$ sampled from the replay buffer during training, the world model can be optimized using the following loss functions, where $\alpha$ , $\beta_1$ , and $\beta_2$ are hyper-parameters: + +$$ +\begin{array}{l} \mathcal {L} = \mathrm {E} \left\{\sum_ {t = 1} ^ {T} \underbrace {- \ln p \left(o _ {t} \mid h _ {t} , s _ {t} , h _ {t} ^ {\prime} , z _ {t}\right)} _ {\text {i m a g e l o g l o s s}} \underbrace {- \ln p \left(r _ {t} \mid h _ {t} , s _ {t} , h _ {t} ^ {\prime} , z _ {t}\right)} _ {\text {r e w a r d l o g l o s s}} \underbrace {- \ln p \left(\gamma_ {t} \mid h _ {t} , s _ {t} , h _ {t} ^ {\prime} , z _ {t}\right)} _ {\text {d i s c o u n t l o g l o s s}} \right. \tag {6} \\ + \underbrace {\alpha \ell_ {2} (a _ {t} , \tilde {a} _ {t})} _ {\text {a c t i o n l o s s}} + \underbrace {\beta_ {1} \mathrm {K L} [ q (s _ {t} | h _ {t} , o _ {t}) | p (s _ {t} | h _ {t}) ] + \beta_ {2} \mathrm {K L} [ q (z _ {t} | h _ {t} ^ {\prime} , o _ {t}) | p (z _ {t} | h _ {t} ^ {\prime}) ] \bigr \}} _ {\text {K L d i v e r g e n c e}}. \\ \end{array} +$$ + +The world model training approach can be partly customized for different environments. In situations where noncontrollable states are indeed involved in behavior learning, minimizing the ELBO objective can maintain the semantics of $\tilde{z}_t$ . Otherwise, if the action-free features are only used to prevent noisy distractions from affecting the training process of Iso-Dream, rather than being used for behavior learning, we can simply train the action-free branch with the reconstruction loss alone. + +# 3.3 Behavior Learning in Decoupled Imaginations + +Thanks to the decoupled world model, we can optimize the agent behaviors to adaptively consider the relations between available actions and possible future states of the noncontrollable dynamics. A practical example is autonomous driving, where the motion of other vehicles can be naturally viewed as noncontrollable but predictable components. As shown in Figure 2(b), we here propose an improved actor-critic learning algorithm that 1) allows the action-free branch to foresee the future ahead of the action-conditioned branch, and 2) exploits the predicted future information of noncontrollable dynamics to make more forward-looking decisions. + +Suppose we are making decisions at time step $t$ in the imagination period. A straightforward solution from the original Dreamer method is to learn an action model and a value model based on the isolated controllable state $\tilde{s}_t\in \mathbb{R}^{1\times d}$ . However, we notice that by employing an attention mechanism, we can explicitly calculate its relations to a sequence of future noncontrollable states $\tilde{z}_{t:t + \tau}\in \mathbb{R}^{\tau \times d}$ , where + +$\tau$ is the length of a sliding window from now on. + +$$ +\text {F u t u r e s t a t e a t t e n t i o n :} \quad e _ {t} = \operatorname {s o f t m a x} \left(\tilde {s} _ {t} \tilde {z} _ {t: t + \tau} ^ {T}\right) \tilde {z} _ {t: t + \tau} + \tilde {s} _ {t}. \tag {7} +$$ + +In this way, $\tilde{s}_t$ evolves to a more "visionary" representation $e_t \in \mathbb{R}^{1 \times d}$ . We update the action model and the value model in Dreamer [22] as follows: + +$$ +\text {A c t i o n m o d e l :} a _ {t} \sim \pi \left(a _ {t} \mid e _ {t}\right), \quad \text {V a l u e m o d e l :} v _ {\xi} \left(e _ {t}\right) \approx \mathbb {E} _ {\pi \left(\cdot \mid e _ {t}\right)} \sum_ {k = t} ^ {t + L} \gamma^ {k - t} r _ {k}, \tag {8} +$$ + +where $L$ is the imagination time horizon. As shown in Alg. 1, during imagination, we first use the action-free transition model to obtain sequences of noncontrollable states of length $L + \tau$ , denoted by $\{\tilde{z}_i\}_{i = t}^{i + L + \tau}$ . At each time step in the imagination period, the agent draws an action $a_{j}$ from the visionary state $e_j$ , which is derived from Eq. (7). The action-conditioned branch uses the action $a_{j}$ in latent imagination and predicts the next controllable state $s_{j + 1}$ . We follow DreamerV2 [24] to train the action model to maximize the $\lambda$ -return [44], and train the value model to regress the $\lambda$ -return3. + +# 3.4 Policy Deployment by Rolling-out Noncontrollable Dynamics + +As discussed above, in the cases that noncontrollable dynamics are irrelevant to the control task, when interacting with the environment, we only use the state of controllable dynamics to generate the policy at each time step $t$ . However, for the situation where noncontrollable dynamics should be closely related to the behavior of the agent, as shown in Lines 21-22 in Alg. 1, the action-free branch consecutively predicts the next $\tau - 1$ noncontrollable states $\tilde{z}_{t + 1:t + \tau}$ starting from the current posterior state $z_{t}$ . Similar to Eq. (7) in the process of behavior learning, we here use the learned future state attention network to adaptively integrate $s_t$ , $z_{t}$ and $\tilde{z}_{t + 1:t + \tau}$ . Based on the integrated feature $e_t$ , the Iso-Dream agent draws $a_{t}$ from the action model to interact with the environment. + +# 4 Experiments + +# 4.1 Experimental Setup + +Benchmarks. We quantitatively and qualitatively evaluate Iso-Dream on two reinforcement learning environments, i.e., DeepMind Control Suite [45] and CARLA [11], and two real-world datasets for action-conditioned video prediction, i.e., BAIR robot pushing [13] and RoboNet [9]. The video prediction experiments can provide more intuitive visualizations of disentanglement learning. + +Compared methods. For the visual control tasks, we compare our approach with five baselines, including both model-based and model-free methods, i.e., DreamerV2 [24], CURL [33], SVEA [25], SAC [21], and DBC [58]. For action-conditioned video prediction, we mainly compare our decoupled world model with three approaches, i.e., SVG [10], SA-ConvLSTM [34] and PhyDNet [19]. + +# 4.2 DeepMind Control Suite + +Implementation details. In order to verify the enhancement of Iso-Dream by disentangling different components under complex visual dynamics, we evaluate Iso-Dream on environments from DMC Generalization Benchmark. Instead of training on original DeepMind Control Suite environments, agents are trained and tested both with natural video backgrounds (i.e. video_easy environments). In this environment, since the background is randomly replaced by a real-world video, the noncontrollable motion of the background can affect the procedure of dynamics learning and behavior learning of agents. Therefore, to obtain a better decision policy and avoid the disruption from noisy backgrounds, the agent may decouple noncontrollable representation (i.e., dynamic background) and controllable representation in spacetime, and only use controllable representation for control. To this end, we simply train the action-free branch with only reconstruction loss and discard it in imagination and policy deployment. We evaluate our model with baselines in 4 tasks from four different domains. The number of environment steps is limited to $500\mathrm{k}$ . + +Table 1: Performance of visual control tasks in the DMC Suite. The agents are trained and evaluated in environments with video_easy dynamic background. We report the mean and std of final performance over 3 seeds and 5 trajectories. *We use a different setup from that in the paper of DBC. + +
TASKSVEACURLDBC*DREAMERV2ISO-DREAM
WALKER WALK826 ± 65443 ± 20632 ± 7655 ± 47911 ± 50
CHEETAH RUN178 ± 64269 ± 2415 ± 5475 ± 159659 ± 62
FINGER SPIN562 ± 22280 ± 501 ± 2755 ± 92800 ± 59
HOPPER STAND6 ± 8451 ± 2505 ± 9260 ± 366746 ± 312
+ +![](images/607310c4e5d725d18533751a214efecc5281c0c4eb357cf48cfeb4279c4bf7af.jpg) +Figure 3: Video prediction results on the DMC (left) and CARLA (right) benchmarks of Iso-Dream. For each sequence, we use the first 5 images as context frames. Iso-Dream successfully disentangles controllable and noncontrollable components. + +Quantitative results. To evaluate the performance, we train and test the agents in environments with video backgrounds. As shown in Table 1, Iso-Dream exceeds the performance of DreamerV2 and other baselines in all tasks, indicating that the three-branch structure can effectively learn task-related visual representations and alleviate complex background interference in visual data. + +Qualitative results. We leverage Iso-Dream to complete video prediction tasks in video_easy environments. The sequence of frames and actions are randomly collected during test episodes. The first 5 frames are given to the model and the next 45 frames are predicted only based on action inputs. To show the qualitative results, we visualize the masks and visual decoupled components from the action-conditioned and action-free branches. The overall visualization is shown in Figure 3(left). From this prediction result, we can find that Iso-Dream has the ability to predict long-term sequence and disentangle controllable and noncontrollable dynamics from images in video_easy environments. As shown in the third and fourth row of action-conditioned branch output in Figure 3, the controllable representation has been successfully isolated and matches its mask. Besides, in this visualization, the action-free component in this background video is the motion of sea waves, which is captured by the fifth and sixth row of action-free branch outputs. + +![](images/4e63c6ff38a0128f496d3265d243dcf5c952dc659ccc6b1f5315274f43d5027b.jpg) +(a) Comparison with the state-of-the-arts. + +![](images/91ec11f6a651839fcffb30ca7cc825ef0e0c3c2793527b2b8478822102db0148.jpg) +(b) Ablation study of Iso-Dream. +Figure 4: Performance with 3 seeds on the CARLA driving task. (a) Comparison of existing methods, in which Iso-Dream outperforms DreamerV2 by a large margin. (b) Ablation studies that can show the respective impact of optimizing the inverse dynamics (orange), rolling out noncontrollable states (green), and modeling the time-invariant information with a separate network branch (red). + +# 4.3 CARLA Autonomous Driving Environment + +Implementation details. In the autonomous driving task, We use a camera with 60 degree view on the roof of the ego-vehicle, which obtains images of $64 \times 64$ pixels. Following the setting in the DBC [58], in order to encourage highway progression and penalise collisions, the reward is formulated as: $r_t = v_{ego}^T \hat{u}_h \cdot \Delta t - \xi_1 \cdot \mathbb{I} - \xi_2 \cdot |steer|$ , where $v_{ego}$ is the velocity vector of the ego-vehicle, projected onto the highway's unit vector $\hat{u}_h$ , and multiplied by time discretization $\Delta t = 0.05$ to measure highway progression in meters. Impulse $\mathbb{I} \in \mathbb{R}^+$ is caused by collisions, and a steering penalty steer $\in [-1,1]$ facilitates lane-keeping. The hyper-parameters $\xi_1$ and $\xi_2$ are set to $10^{-4}$ and 1, respectively. We use $\beta_1 = 1$ , $\beta_2 = 1$ and $\alpha = 1$ in Eq. (6) and $\tau = 5$ in Eq. (7). + +Quantitative results. As shown in Figure 4(a), Iso-Dream has significant advantages compared to other baselines and outperforms DreamerV2 by a large margin. Furthermore, we conduct ablation studies to confirm the validity of inverse dynamics and the rolling-out strategy of noncontrollable states. Figure 4(b) shows that the performance drops when Inverse Cell is removed, indicating the importance of modeling inverse dynamics to isolate controllable and noncontrollable components from the whole dynamics. In order to verify the effectiveness of the proposed attention mechanism, we conduct experiments to evaluate Iso-Dream where policy networks directly concatenate the current controllable state and the noncontrollable state as input. Comparing the blue curve and green curve, we observe that rolling-out noncontrollable states in the action-free branch can significantly improve the agent's decision-making results. The red curve shows that the performance of Iso-Dream degrades by about $15\%$ in the absence of a separate network branch that captures the static information. + +Qualitative results. Reconstruction results of predictions in CARLA environment are shown in Figure 3(right column). In CARLA, we observe that the agent actions potentially affect all pixel values in the observation, as the camera on the main car (i.e., the agent) moves. Therefore, we view the visual dynamics of other vehicles as a combination of controllable and noncontrollable states. Accordingly, our model can determine which component is dominant by learning attention masks (values between 0 and 1) across the action-conditioned and action-free branches. The "action-free masks" present hot spots around other vehicles, while the attention values in corresponding areas on the "action-cond masks" are still greater than 0. The agent can avoid collisions by rolling-out noncontrollable components to preview possible future states of other vehicles. We include more showcases with different numbers of vehicles in the supplementary materials. + +# 4.4 BAIR & RoboNet for Action-Conditioned Video Prediction + +Implementation details. In order to evaluate the effectiveness of our world model in a more complex environment, we test the video prediction ability of the proposed structure on BAIR and + +Table 2: Video prediction results on BAIR and RoboNet datasets with bouncing balls. We use the first 2 frames as input to predict the next 28 frames on BAIR and the next 18 frames on RoboNet. + +
MODELBAIRROBONET
PSNR ↑SSIM ↑PSNR ↑SSIM ↑
SVG [10]18.120.71219.860.708
SA-CONVLSTM [34]18.280.67719.300.638
PHYDNET [19]18.910.74320.890.727
ISO-DREAM19.510.76821.710.769
+ +![](images/308f15a1a3222466f00face30e5e04103e33d43d0d13a23e442f44fabc4eb0b2.jpg) +Figure 5: The results of models trained on BAIR (blue) and BAIR + bouncing balls (red), and tested on BAIR. We use the first 2 frames as input to predict the next 18 frames. The horizontal axis represents the different models, and the vertical axes represent test results of PSNR and SSIM. + +![](images/ba92a94b6b0ec165ab9071a6173aa0c3d1614c8f79d66efa1861d8c88f03a491.jpg) + +![](images/6d7369a7284582ca7d3d643385c43d0226d3fcba930a80d08674d558a5d83d59.jpg) + +RoboNet dataset. Moreover, we add predictable visual dynamics unrelated to the control signals to the raw observations, i.e., bouncing balls of the same size and speed. In the training phase, we train the model to predict 10 frames into the future from 2 observations. For testing, we use the first 2 frames as input to predict the next 28 frames in the BAIR dataset, and the next 18 frames in the RoboNet dataset. All inputs for training and testing are resized to $64 \times 64$ . Considering the simplicity and predictability of bouncing balls, in the action-free branch, we use a similar structure as in the DMC experiment. Moreover, we replace the GRU cell with two layers of ST-LSTM unit [51] in both branches. The optimization objective consists of image reconstruction loss and action reconstruction loss of Inverse Cell. SSIM and PSNR are adopted as evaluation metrics. + +Quantitative results. Table 2 gives the quantitative results on BAIR and RoboNet datasets with bouncing balls in the training and testing phase. Compared with other models, Iso-Dream shows the competitive performance in two datasets. For PSNR, Iso-Dream improves SVG by $7.7\%$ in BAIR and $9.3\%$ in RoboNet. Compared with PhyDNet, which also disentangles features in two branches, Iso-Dream achieves better performance in both PSNR and SSIM. It shows that our Iso-Dream has a stronger ability of disentanglement learning to achieve long-term prediction. Moreover, Figure 5 shows an interesting result of the different training sets (i.e., BAIR, BAIR+bouncing balls) and the same testing set (i.e., BAIR). Iso-Dream is the only approach that achieves improvements when training on noisy data with bouncing balls, as shown in Figure 5(red bars). In this training setup, it performs best on the standard test set without balls. Iso-Dream is built on a more efficient architecture than the baseline models. It provides a general framework that can be easily extended to other backbones. + +Qualitative results. We visualize a sequence of predicted frames on BAIR with bouncing balls in Figure 6. Specifically, the output of two branches and corresponding masks are provided. We can see from these demonstrations that the world model of Iso-Dream is more accurate in modeling future dynamics for long-term prediction. It shows the fact that the action-free branch learns noncontrollable dynamics, while the action-conditioned branch learns controllable dynamics related to input action. + +![](images/20ca81e15c871f0f83476457fe7c12035786078a11ddf99001ca11e18315786b.jpg) +Figure 6: Showcases of video prediction results on the BAIR robot pushing dataset. We display every 3 frames in the prediction horizon. The generated masks show that each branch of Iso-Dream captures coarse localisation of controllable representations and noncontrollable representations. + +# 5 Conclusions + +In this paper, we proposed an MBRL framework named Iso-Dream, which mainly tackles the difficulty of vision-based prediction and control in the presence of complex visual dynamics. Our approach has two novel contributions to world model representation learning and corresponding MBRL algorithms. First, it learns to decouple controllable and noncontrollable latent state transitions via modular network structures and inverse dynamics. Further, it makes long-horizon decisions by rolling-out the noncontrollable dynamics into the future and learning their influences on current behavior. Iso-Dream achieves competitive results on the CARLA autonomous driving task, where other vehicles can be naturally viewed as noncontrollable components, indicating that with the help of decoupled latent states, the agent can make more forward-looking decisions by previewing possible future states in the action-free network branch. Besides, Iso-Dream was shown to effectively improve the visual control task in a modified DeepMind Control Suite, as well as the visual prediction task on the BAIR robot pushing dataset and the RoboNet dataset. + +One limitation of Iso-Dream is the computational efficiency. Compared with DreamerV2, it requires longer training time per episode due to more intensive state transitions in behavior learning. But fortunately, from Figure 4(a), Iso-Dream is more sample-efficient than existing MBRL methods. Another limitation is the special treatment for different environments. In our preliminary experiments, we attempted to use the same model architecture for all test benchmarks. However, we observed that different benchmarks have specific requirements on the network structure, which we found should be dependent on our prior knowledge of the environments. + +# Acknowledgements + +This work was supported by the Natural Science Foundation of China (U19B2035, 62106144), Shanghai Municipal Science and Technology Major Project (2021SHZDZX0102), and Shanghai Sailing Program (21Z510202133). + +# References + +[1] Mohammad Babaeizadeh, Chelsea Finn, Dumitru Erhan, Roy H Campbell, and Sergey Levine. Stochastic variational video prediction. In ICLR, 2018. +[2] Nadine Behrmann, Jurgen Gall, and Mehdi Noroozi. Unsupervised video representation learning by bidirectional feature prediction. In WACV, pages 1670-1679, 2021. +[3] Xinzhu Bei, Yanchao Yang, and Stefano Soatto. Learning semantic-aware dynamics for video prediction. In CVPR, pages 902-912, 2021. + +[4] Homanga Bharadhwaj, Mohammad Babaeizadeh, Dumitru Erhan, and Sergey Levine. Information prioritization through empowerment in visual model-based RL. In ICLR, 2022. +[5] Prateep Bhattacharjee and Sukhendu Das. Temporal coherency based criteria for predicting video frames using deep multi-stage generative adversarial networks. In NeurIPS, pages 4271-4280, 2017. +[6] Navaneeth Bodla, Gaurav Shrivastava, Rama Chellappa, and Abhinav Shrivastava. Hierarchical video prediction using relational layouts for human-object interactions. In CVPR, 2021. +[7] Lluis Castrejon, Nicolas Ballas, and Aaron Courville. Improved conditional VRNNs for video prediction. In ICCV, pages 7608-7617, 2019. +[8] Silvia Chiappa, Sébastien Racaniere, Daan Wierstra, and Shakir Mohamed. Recurrent environment simulators. In ICLR, 2017. +[9] Sudeep Dasari, Frederik Ebert, Stephen Tian, Suraj Nair, Bernadette Bucher, Karl Schmeckpeper, Siddharth Singh, Sergey Levine, and Chelsea Finn. Robonet: Large-scale multi-robot learning. arXiv preprint arXiv:1910.11215, 2019. +[10] Emily Denton and Rob Fergus. Stochastic video generation with a learned prior. In ICML, pages 1174-1183. PMLR, 2018. +[11] Alexey Dosovitskiy, Germán Ros, Felipe Codevilla, Antonio M. López, and Vladlen Koltun. CARLA: an open urban driving simulator. In CoRL, volume 78, pages 1-16. PMLR, 2017. +[12] Frederik Ebert, Chelsea Finn, Sudeep Dasari, Annie Xie, Alex Lee, and Sergey Levine. Visual foresight: Model-based deep reinforcement learning for vision-based robotic control. arXiv preprint arXiv:1812.00568, 2018. +[13] Frederik Ebert, Chelsea Finn, Alex X Lee, and Sergey Levine. Self-supervised visual planning with temporal skip connections. In CoRL, pages 344-356, 2017. +[14] Chelsea Finn, Ian Goodfellow, and Sergey Levine. Unsupervised learning for physical interaction through video prediction. In NeurIPS, pages 64-72, 2016. +[15] Chelsea Finn and Sergey Levine. Deep visual foresight for planning robot motion. In ICRA, pages 2786-2793. IEEE, 2017. +[16] Jean-Yves Franceschi, Edouard Delasalles, Mickaël Chen, Sylvain Lamprier, and Patrick Gallinari. Stochastic latent residual video prediction. In ICML, pages 3233-3246, 2020. +[17] Anirudh Goyal, Alex Lamb, Jordan Hoffmann, Shagun Sodhani, Sergey Levine, Yoshua Bengio, and Bernhard Schölkopf. Recurrent independent mechanisms. In ICLR, 2021. +[18] Klaus Greff, Raphaël Lopez Kaufman, Rishabh Kabra, Nick Watters, Christopher Burgess, Daniel Zoran, Loic Matthey, Matthew Botvinick, and Alexander Lerchner. Multi-object representation learning with iterative variational inference. In ICML, pages 2424-2433, 2019. +[19] Vincent Le Guen and Nicolas Thome. Disentangling physical dynamics from unknown factors for unsupervised video prediction. In CVPR, pages 11474-11484, 2020. +[20] David Ha and Jürgen Schmidhuber. Recurrent world models facilitate policy evolution. In NeurIPS, 2018. +[21] Tuomas Haarnoja, Aurick Zhou, Kristian Hartikainen, George Tucker, Sehoon Ha, Jie Tan, Vikash Kumar, Henry Zhu, Abhishek Gupta, Pieter Abbeel, et al. Soft actor-critic algorithms and applications. arXiv preprint arXiv:1812.05905, 2018. +[22] Danijar Hafner, Timothy Lillicrap, Jimmy Ba, and Mohammad Norouzi. Dream to control: Learning behaviors by latent imagination. In ICLR, 2020. +[23] Danijar Hafner, Timothy Lillicrap, Ian Fischer, Ruben Villegas, David Ha, Honglak Lee, and James Davidson. Learning latent dynamics for planning from pixels. In ICML, pages 2555-2565. PMLR, 2019. +[24] Danijar Hafner, Timothy Lillicrap, Mohammad Norouzi, and Jimmy Ba. Mastering atari with discrete world models. arXiv preprint arXiv:2010.02193, 2020. +[25] Nicklas Hansen, Hao Su, and Xiaolong Wang. Stabilizing deep q-learning with convnets and vision transformers under data augmentation. In NeurIPS, 2021. + +[26] Jun-Ting Hsieh, Bingbin Liu, De-An Huang, Li F Fei-Fei, and Juan Carlos Niebles. Learning to decompose and disentangle representations for video prediction. In NeurIPS, pages 517-526, 2018. +[27] Beibei Jin, Yu Hu, Qiankun Tang, Jingyu Niu, Zhiping Shi, Yinhe Han, and Xiaowei Li. Exploring spatial-temporal multi-frequency analysis for high-fidelity and temporal-consistency video prediction. In CVPR, pages 4554-4563, 2020. +[28] Minju Jung, Takazumi Matsumoto, and Jun Tani. Goal-directed behavior under variational predictive coding: Dynamic organization of visual attention and working memory. In IROS, pages 1040-1047. IEEE, 2019. +[29] Lukasz Kaiser, Mohammad Babaeizadeh, Piotr Milos, Blazej Osinski, Roy H Campbell, Konrad Czechowski, Dumitru Erhan, Chelsea Finn, Piotr Kozakowski, Sergey Levine, et al. Model-based reinforcement learning for Atari. In ICLR, 2020. +[30] Taesup Kim, Sungjin Ahn, and Yoshua Bengio. Variational temporal abstraction. In NeurIPS, volume 32, pages 11570-11579, 2019. +[31] Ilya Kostrikov, Denis Yarats, and Rob Fergus. Image augmentation is all you need: Regularizing deep reinforcement learning from pixels. arXiv preprint arXiv:2004.13649, 2020. +[32] Michael Laskin, Kimin Lee, Adam Stooke, Lerrel Pinto, Pieter Abbeel, and Aravind Srinivas. Reinforcement learning with augmented data. arXiv preprint arXiv:2004.14990, 2020. +[33] Michael Laskin, Aravind Srinivas, and Pieter Abbeel. CURL: contrastive unsupervised representations for reinforcement learning. In ICML, volume 119 of Proceedings of Machine Learning Research, pages 5639-5650. PMLR, 2020. +[34] Zhihui Lin, Maomao Li, Zhuobin Zheng, Yangyang Cheng, and Chun Yuan. Self-attention convlstm for spatiotemporal prediction. In AAAI, volume 34, pages 11531–11538, 2020. +[35] Wenqian Liu, Abhishek Sharma, Octavia Camps, and Mario Sznaier. Dyan: A dynamical atoms-based network for video prediction. In ECCV, pages 170-185, 2018. +[36] Francesco Locatello, Dirk Weissenborn, Thomas Unterthiner, Aravindh Mahendran, Georg Heigold, Jakob Uszkoreit, Alexey Dosovitskiy, and Thomas Kipf. Object-centric learning with slot attention. Advances in Neural Information Processing Systems, 33:11525-11538, 2020. +[37] Junhyuk Oh, Xiaoxiao Guo, Honglak Lee, Richard Lewis, and Satinder Singh. Action-conditional video prediction using deep networks in atari games. arXiv preprint arXiv:1507.08750, 2015. +[38] Junhyuk Oh, Satinder Singh, and Honglak Lee. Value prediction network. In NeurlPS, 2017. +[39] Marc Oliu, Javier Selva, and Sergio Escalera. Folded recurrent neural networks for future video prediction. In ECCV, pages 716-731, 2018. +[40] Fitsum A Reda, Guilin Liu, Kevin J Shih, Robert Kirby, Jon Barker, David Tarjan, Andrew Tao, and Bryan Catanzaro. Sdc-net: Video prediction using spatially-displaced convolution. In ECCV, pages 718-733, 2018. +[41] Ramanan Sekar, Oleh Rybkin, Kostas Daniilidis, Pieter Abbeel, Danijar Hafner, and Deepak Pathak. Planning to explore via self-supervised world models. In ICML, pages 8583-8592, 2020. +[42] Xingjian Shi, Zhourong Chen, Hao Wang, Dit-Yan Yeung, Wai-Kin Wong, and Wang-chun Woo. Convolutional LSTM network: A machine learning approach for precipitation nowcasting. In NeurIPS, pages 802-810, 2015. +[43] Nitish Srivastava, Elman Mansimov, and Ruslan Salakhudinov. Unsupervised learning of video representations using lstms. In ICML, pages 843-852. PMLR, 2015. +[44] Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT press, 2018. +[45] Yuval Tassa, Yotam Doron, Alistair Muldal, Tom Erez, Yazhe Li, Diego de Las Casas, David Budden, Abbas Abdelmaleki, Josh Merel, Andrew Lefrancq, et al. Deepmind control suite. arXiv preprint arXiv:1801.00690, 2018. +[46] Sjoerd van Steenkiste, Michael Chang, Klaus Greff, and Jurgen Schmidhuber. Relational neural expectation maximization: Unsupervised discovery of objects and their interactions. In ICLR, 2018. + +[47] Ruben Villegas, Arkanath Pathak, Harini Kannan, Dumitru Erhan, Quoc V Le, and Honglak Lee. High fidelity video prediction with large stochastic recurrent neural networks. In NeurIPS, pages 81-91, 2019. +[48] Ruben Villegas, Jimei Yang, Seunghoon Hong, Xunyu Lin, and Honglak Lee. Decomposing motion and content for natural video sequence prediction. In ICLR, 2017. +[49] Ruben Villegas, Jimei Yang, Yuliang Zou, Sungryull Sohn, Xunyu Lin, and Honglak Lee. Learning to generate long-term future via hierarchical prediction. In ICML, pages 3560-3569, 2017. +[50] Carl Vondrick, Hamed Pirsiavash, and Antonio Torralba. Generating videos with scene dynamics. In NeurIPS, pages 613-621, 2016. +[51] Yunbo Wang, Mingsheng Long, Jianmin Wang, Zhifeng Gao, and Philip S Yu. Predrnn: Recurrent neural networks for predictive learning using spatiotemporal lstms. In NeurIPS, pages 879-888, 2017. +[52] Yunbo Wang, Haixu Wu, Jianjin Zhang, Zhifeng Gao, Jianmin Wang, Philip S Yu, and Mingsheng Long. Predrnn: A recurrent neural network for spatiotemporal predictive learning. arXiv preprint arXiv:2103.09504, 2021. +[53] Nevan Wichers, Ruben Villegas, Dumitru Erhan, and Honglak Lee. Hierarchical long-term video prediction without supervision. In ICML, pages 6038-6046, 2018. +[54] Bohan Wu, Suraj Nair, Roberto Martin-Martin, Li Fei-Fei, and Chelsea Finn. Greedy hierarchical variational autoencoders for large-scale video prediction. In CVPR, pages 2318-2328, 2021. +[55] Jingwei Xu, Bingbing Ni, Zefan Li, Shuo Cheng, and Xiaokang Yang. Structure preserving video prediction. In CVPR, pages 1460-1469, 2018. +[56] Denis Yarats, Amy Zhang, Ilya Kostrikov, Brandon Amos, Joelle Pineau, and Rob Fergus. Improving sample efficiency in model-free reinforcement learning from images. In AAAI, pages 10674-10681, 2021. +[57] Polina Zablotskaia, Edoardo A Dominici, Leonid Sigal, and Andreas M Lehrmann. Unsupervised video decomposition using spatio-temporal iterative inference. arXiv preprint arXiv:2006.14727, 2020. +[58] Amy Zhang, Rowan McAllister, Roberto Calandra, Yarin Gal, and Sergey Levine. Learning invariant representations for reinforcement learning without reconstruction. In ICLR, 2021. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] See Abstract and Section 1. +(b) Did you describe the limitations of your work? [Yes] See Section 5. +(c) Did you discuss any potential negative societal impacts of your work? [N/A] Our work is only for academic research purpose. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [N/A] We report the experimental results in comparison with most related works to verify the effectiveness of our method. +(b) Did you include complete proofs of all theoretical results? [N/A] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [No] Our code is proprietary, but we will release the code once the paper is accepted. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 4. +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] See Section 4. + +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] Our model is trained on Ubuntu system, 8 V100 GPUs with 32G. + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] See the Reference part. +(b) Did you mention the license of the assets? [No] The data used in our work are publicly released. +(c) Did you include any new assets either in the supplemental material or as a URL? [No] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [Yes] The data and models used in our work are publicly released. +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [Yes] The data used in our work does not contain personally identifiable information or offensive content. + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] Our work does not involve human subjects. And the following items are the same. +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/isodreamisolatingandleveragingnoncontrollablevisualdynamicsinworldmodels/images.zip b/isodreamisolatingandleveragingnoncontrollablevisualdynamicsinworldmodels/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..976c445beccc7dca55a3c8f4ae1b44c67f918a4a --- /dev/null +++ b/isodreamisolatingandleveragingnoncontrollablevisualdynamicsinworldmodels/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2760533fa0d7013739b11423c2ad55c0accfc9e0f15ad3b7a685107152151519 +size 547623 diff --git a/isodreamisolatingandleveragingnoncontrollablevisualdynamicsinworldmodels/layout.json b/isodreamisolatingandleveragingnoncontrollablevisualdynamicsinworldmodels/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..e656da790ceb515bfbd84a5ea4c30f7801e3d865 --- /dev/null +++ b/isodreamisolatingandleveragingnoncontrollablevisualdynamicsinworldmodels/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:44bca026070bd01128a84206b7280ee6b81027fb9cbb3839ba0400052698295f +size 411587 diff --git a/isometric3dadversarialexamplesinthephysicalworld/262b3437-b579-4753-9a72-92aa76602ec4_content_list.json b/isometric3dadversarialexamplesinthephysicalworld/262b3437-b579-4753-9a72-92aa76602ec4_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..9c3cb0657ff8bbd30cfefa9d7246a8a20256919f --- /dev/null +++ b/isometric3dadversarialexamplesinthephysicalworld/262b3437-b579-4753-9a72-92aa76602ec4_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c83083d1eeb07b05115e56f382fe2b735bafb27a910081850042f1ca8e62fe19 +size 99488 diff --git a/isometric3dadversarialexamplesinthephysicalworld/262b3437-b579-4753-9a72-92aa76602ec4_model.json b/isometric3dadversarialexamplesinthephysicalworld/262b3437-b579-4753-9a72-92aa76602ec4_model.json new file mode 100644 index 0000000000000000000000000000000000000000..f9f57f09e92e231cd50fbd275fa464245ad1be47 --- /dev/null +++ b/isometric3dadversarialexamplesinthephysicalworld/262b3437-b579-4753-9a72-92aa76602ec4_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eda96c244a267bedc9dae188499d3f9271c4c202d85a097225b4cd2257aecb3d +size 131116 diff --git a/isometric3dadversarialexamplesinthephysicalworld/262b3437-b579-4753-9a72-92aa76602ec4_origin.pdf b/isometric3dadversarialexamplesinthephysicalworld/262b3437-b579-4753-9a72-92aa76602ec4_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..82db83daf9c684503af71b5913d007b634afa343 --- /dev/null +++ b/isometric3dadversarialexamplesinthephysicalworld/262b3437-b579-4753-9a72-92aa76602ec4_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e193ddc2fcc81f8ef11f03269a4d760624658954c4477b9ae41d5c1e0850287 +size 2369821 diff --git a/isometric3dadversarialexamplesinthephysicalworld/full.md b/isometric3dadversarialexamplesinthephysicalworld/full.md new file mode 100644 index 0000000000000000000000000000000000000000..16b4d47962795d3a0eab3ad8b03a30444b6a6f5a --- /dev/null +++ b/isometric3dadversarialexamplesinthephysicalworld/full.md @@ -0,0 +1,415 @@ +# Isometric 3D Adversarial Examples in the Physical World + +Yibo Miao $^{1,3\star}$ , Yinpeng Dong $^{2,3\dagger}$ , Jun Zhu $^{2,3,4,5}$ , Xiao-Shan Gao $^{1\dagger}$ + +$^{1}$ KLMM, UCAS, Academy of Mathematics and Systems Science, Chinese Academy of Sciences, Beijing 100190, China + +$^{2}$ Dept. of Comp. Sci. & Tech., Institute for AI, Tsinghua-Bosch Joint ML Center, + +THBI Lab, BNrst Center, Tsinghua University, Beijing 100084, China + +$^{3}$ RealAI Peng Cheng Laboratory Pazhou Laboratory (Huangpu), Guangzhou, China + +yibomiao21@163.com, {dongyinpeng, dcszj}@tsinghua.edu.cn, xgao@mmrc.iss.ac.cn + +# Abstract + +3D deep learning models are shown to be as vulnerable to adversarial examples as 2D models. However, existing attack methods are still far from stealthy and suffer from severe performance degradation in the physical world. Although 3D data is highly structured, it is difficult to bound the perturbations with simple metrics in the Euclidean space. In this paper, we propose a novel $\epsilon$ -isometric ( $\epsilon$ -ISO) attack to generate natural and robust 3D adversarial examples in the physical world by considering the geometric properties of 3D objects and the invariance to physical transformations. For naturalness, we constrain the adversarial example to be $\epsilon$ -isometric to the original one by adopting the Gaussian curvature as a surrogate metric guaranteed by a theoretical analysis. For invariance to physical transformations, we propose a maxima over transformation (MaxOT) method that actively searches for the most harmful transformations rather than random ones to make the generated adversarial example more robust in the physical world. Experiments on typical point cloud recognition models validate that our approach can significantly improve the attack success rate and naturalness of the generated 3D adversarial examples than the state-of-the-art attack methods. + +# 1 Introduction + +Deep neural networks (DNNs) have achieved unprecedented performance on numerous tasks, including 2D image classification [33, 25, 27] and 3D point cloud recognition [48, 49, 68]. However, DNNs are vulnerable to adversarial examples [59, 20] — inputs crafted by adding imperceptible perturbations to original examples that can cause misclassification of the victim model. Adversarial examples are prevalent in various domains beyond images, including texts [28], speeches [84] and 3D objects [73]. As deep 3D point cloud recognition has been adopted in safety-critical applications, such as autonomous driving [5, 85], robotics [65, 94], medical image processing [60], it has garnered increasing attention to studying the adversarial robustness of 3D point cloud recognition models [6]. + +However, the existing adversarial attacks on point cloud recognition models are still far from stealthy and suffer from drastic performance degeneration in the physical world. There is usually a trade-off between the stealthiness and the real-world attacking performance, making it challenging to achieve the best of both worlds. Early methods [79, 73, 42] adopt gradient-based attacks to add, remove, and modify points, but they are limited to digital-world attacks. The KNN attack [63] and the GeoA $^3$ attack [69] constrain the smoothness of the adversarial point clouds and reconstruct adversarial + +![](images/0844e8e975f36e8f343306d7ab1819c5465bfc7afd05f7067125146ea685cb04.jpg) +Figure 1: An illustration of adversarial objects crafted by KNN attack [63], $GeoA^3$ attack [69], Mesh Attack [88] and our $\epsilon$ -ISO attack against the PointNet model: KNN attack and $GeoA^3$ attack can produce unnatural adversarial objects (and often low success rates); Mesh Attack can generate a lot of distortions; while $\epsilon$ -ISO attack improves the naturalness of the 3D adversarial sample and ensures the consistency between the intrinsic geometric properties of the adversarial and original 3D objects [8]. + +![](images/11ceea85ea7f022858f17b71586e0a2f4dbb97e3f8dae8fbf5125699d566a90f.jpg) + +![](images/e8cc9c796120926fb114c7591a4ee15a6fd35bbb8c2017e76309d920cfed6ed6.jpg) + +![](images/5312ff00bea261cf5409d3d80501db470c06b418ab0b5a34b781e6e3301ba79f.jpg) + +![](images/69e846ff130401b6fc0c3e08fbf93bcad4bea69d3569c4382a60f2dc48c538e3.jpg) + +meshes from the point clouds that can be 3D-printed in the physical world. Although these works demonstrate successful physical attacks, point cloud reconstruction introduces large noises and errors, resulting in low attack success rates and unnaturalness of the adversarial objects in the physical world. Mesh Attack [88] is recently proposed to perturb the mesh representation of 3D objects, which improves the success rate but often creates large distortions that can be easily detected by humans as anomalies, as illustrated in Fig. 1. Overall, it is difficult to achieve both the naturalness and effectiveness of 3D adversarial attacks in the physical world, which we think is largely due to the lack of an appropriate metric to characterize the naturalness of 3D data. + +To address these issues, we propose an $\epsilon$ -isometric $(\epsilon$ -ISO) attack method to generate natural and robust 3D adversarial examples in the physical world against point cloud recognition models. The $\epsilon$ -ISO attack improves the naturalness of the 3D adversarial example by constraining it to be $\epsilon$ -isometric (see Definition 1) to the original one, which guarantees the consistency between the intrinsic geometric properties of two 3D objects [8]. We theoretically demonstrate that Gaussian curvature (see Definition 2) can be used to provide a sufficient condition to ensure that two surfaces are $\epsilon$ -isometric. Due to the computable and differentiable nature of Gaussian curvature, we adopt it as a new regularization loss to practically generate natural 3D adversarial examples. To improve the robustness of 3D adversarial examples under physical transformations, we further propose a maxima over transformation (MaxOT) method that actively searches for the most harmful transformations rather than random ones [1] for optimization. Armed with Bayesian optimization that provides better initialization of the transformations, MaxOT is able to find a set of diverse worst-case transformations, leading to improved performance of the 3D adversarial examples in the physical world. + +We conduct extensive experiments to evaluate the performance of our method on attacking typical point cloud recognition models [48, 49, 68]. Results demonstrate that, in comparison with the alternative state-of-the-art attack methods [63, 69, 88], $\epsilon$ -ISO attack achieves higher success rates, while making the generated adversarial examples more natural and robust under physical transformations. A physical-world experiment is conducted by 3D-printing the adversarial meshes and re-scanning the objects for evaluation, which also validates the effectiveness of our method. + +# 2 Related work + +Deep learning on 3D point clouds. Deep 3D point cloud recognition [48, 21, 74, 76, 81, 50, 61] has emerged in recent years with various applications in many fields, such as 3D object classification [55, 37, 83, 86], 3D scene segmentation [22, 67, 77, 26], and 3D object detection in autonomous driving [97, 78]. One of the pioneering works is PointNet [48], which directly applies a multilayer perceptron to learn point features and aggregates them in an efficient way using a max-pool module. PointNet++ [49] and a large number of later works [13, 43, 80] are built on PointNet to further capture fine-grained local structure information from the neighborhood of each point. Recently, some works have focused on designing special convolutions on 3D domains [2, 39, 44, 62] or developing graph neural networks [18, 52, 53, 68] to improve point cloud recognition. + +3D adversarial attacks. Following the previous studies on adversarial machine learning in the 2D image domain [59, 34, 4, 10, 19, 82, 11, 12], many works [73, 3, 41] apply adversarial attacks to the + +3D point cloud domain. Xiang et al. [73] proposed point generation attacks by adding a limited number of synthetic points to the point cloud. Recently, more studies [70, 93] use gradient-based attack methods to identify key points from the point cloud for deletion. More point perturbation attacks [24, 45, 91, 9] learn to perturb the xyz coordinates of each point through a C&W framework [4] based on metrics defined in the Euclidean space. Zhao et al. [92] attack by the isometric transformations in the Euclidean space such as rotation. It is worth noting that we consider isometric mappings between surfaces, which is essentially different from [92]. Later works [35, 87] further apply iterative gradient methods to achieve more advanced adversarial perturbations. Besides, other works consider generative models [96], 3D data attacks [64, 57], adversarial robustness [89, 58], attacks against LIDAR [36, 30], autonomous driving [56, 90], backdoor attacks [38, 75], etc., in the 3D domain. However, the existing attacks on 3D point cloud recognition are still far from stealthy and the only three methods that consider the physical-world attacks [63, 69, 88] are not very effective. In this paper, we surpass the performance of previous methods by proposing a novel $\epsilon$ -isometric ( $\epsilon$ -ISO) attack method to generate natural and robust 3D adversarial examples in the physical world. + +# 3 Methodology + +We now formally present $\epsilon$ -ISO attack. We first present the general problem formulation, and then describe how $\epsilon$ -ISO attack enhances the imperceptibility and robustness of the generated 3D adversarial samples, respectively. + +# 3.1 Problem formulation + +To generate 3D adversarial objects in the physical world, it is more straightforward to perturb the mesh representation of 3D objects rather than point clouds [88] since the reconstruction process can incur large errors [63, 69]. A mesh $\mathcal{M} = (\mathcal{V},\mathcal{F})$ is an approximate shape representation of its underlying surface, where $\mathcal{V} := \{v_i\}_{i=1}^{n_v}$ is the set of $n_v$ vertices of $xyz$ coordinates, and $\mathcal{F} := \{z_i\}_{i=1}^{n_f}$ is the set of $n_f$ triangle faces represented by the indices of vertices. We let $S$ denote a differentiable sampling process such that $\mathcal{P} := S(\mathcal{M}) \in \mathcal{X}$ is the point cloud obtained by randomly sampling on the mesh surface, where $\mathcal{X}$ is the set of all point clouds. We let $y \in \mathcal{Y}$ denote the corresponding ground-truth label of $\mathcal{M}$ as well as $\mathcal{P}$ . + +In this paper, we focus on the challenging targeted attacks against deep 3D point cloud classification models [48, 49, 68]. Given a point cloud classifier $f: \mathcal{X} \to \mathcal{Y}$ , the goal of the attack is to generate an adversarial mesh $\mathcal{M}_{adv} = (\mathcal{V}_{adv}, \mathcal{F})$ for the original one $\mathcal{M}$ with vertex perturbations such that the sampled point cloud $\mathcal{P}_{adv} := S(\mathcal{M}_{adv})$ will be misclassified by $f$ as the target class $y^{*}(\neq y)$ . In general, the perturbation should be small to make the adversarial mesh $\mathcal{M}_{adv}$ inconspicuous under human inspection. Thus, the optimization problem of generating the adversarial mesh can be generally formulated as + +$$ +\min _ {\mathcal {M} _ {a d v}} \mathcal {L} _ {f} \left(S \left(\mathcal {M} _ {a d v}\right), y ^ {*}\right) + \beta \cdot \mathcal {R} \left(\mathcal {M} _ {a d v}, \mathcal {M}\right), \tag {1} +$$ + +where $\mathcal{L}_f$ is the loss that facilitates the misclassification of $\mathcal{P}_{adv}$ to $y^{*}$ , $\mathcal{R}$ is the regularization term that minimizes a perceptibility distance between $\mathcal{M}_{adv}$ and $\mathcal{M}$ , and $\beta$ is a balancing hyperparameter between these two losses. In this paper, we try to develop a stealthy and robust attack method by proposing a new regularization loss $\mathcal{R}$ based on Gaussian curvature with theoretical guarantees to remain the naturalness as well as a new attacking loss $\mathcal{L}_f$ to enhance the robustness of the generated 3D adversarial objects under physical transformations. $\mathcal{R}$ and $\mathcal{L}_f$ will be introduced in the following. + +# 3.2 $\epsilon$ -ISO attack + +Most of the existing 3D adversarial attacks only consider the constraints $\mathcal{R}$ defined in the Euclidean space [15, 81, 23]. The generated adversarial examples have noticeable point outliers that cause spikes to appear on the object's surface, thus losing the naturalness. Moreover, the outliers are more easily removed and defended against. The main reason is that the existing methods do not consider the geometric properties of the 3D objects. In differential geometry, isometric mapping guarantees the consistency of the intrinsic geometric features of two objects [8]. Therefore, we propose a constraint loss $\mathcal{R}$ based on $\epsilon$ -isometric mapping to restrict the naturalness of 3D adversarial objects. We first give the definition of $\epsilon$ -isometric below. + +![](images/1c61417c797f7e54f481cd81b4b9dc05a1b4eb700d58d4d2e781d0352d00e633.jpg) +(a) Original + +![](images/cbefa4b81b4c09cb3f92e7ab2547b9d75cf410e0fc22ac20721d59f89816335b.jpg) +(b) KNN & GeoA3 +Figure 2: An illustration of $\epsilon$ -isometric attack. (a): Original mesh. (b) and (c): Adversarial meshes generated by KNN & GeoA3 attack and Mesh Attack, respectively. They consider only the constraints defined in the Euclidean space, and the curve lengths (shown as the black curves) of the generated adversarial examples differ significantly from those of the original samples, which do not satisfy $\epsilon$ -isometric and lose naturalness. (d): Adversarial mesh generated by $\epsilon$ -ISO. We consider the geometric features of 3D objects and constrain the 3D adversarial example to be $\epsilon$ -isometric to the original one, such that the curve lengths of the generated adversarial samples vary little and have naturalness. + +![](images/fec49af71b9a389236b19d048431e8e17e3f0fb8349b6a73b4f16c0de8cd56ee.jpg) +(c) Mesh Attack + +![](images/a604c669fea002d94e33dfda26177c75ed30232d0c3ae60139fcef2463b2f764.jpg) +(d) $\epsilon$ -ISO + +Definition 1. Let $S$ and $\tilde{S}$ denote two surfaces of $\mathbb{R}^3$ . A diffeomorphism $\varphi : S \to \tilde{S}$ is called an $\epsilon$ -isometric mapping if there exists a constant $n$ such that it takes any local curve $C$ in $S$ to a curve $\tilde{C} = \varphi(C)$ in $\tilde{S}$ satisfying $(1 - n\epsilon)s(C) < s(\tilde{C}) < (1 + n\epsilon)s(C)$ where $s(\cdot)$ is the length. The surfaces $S$ and $\tilde{S}$ are then said to be $\epsilon$ -isometric. + +As shown in Fig. 2, Fig. 2(a) is the original mesh, Fig. 2(b) is the adversarial mesh generated by KNN attack and $GeoA^3$ attack, and Fig. 2(c) is the adversarial mesh generated by Mesh Attack. These three methods only consider the constraints defined in the Euclidean space, and the curve lengths of the generated adversarial samples differ greatly from those of the original samples, which are not $\epsilon$ -isometric and lose naturalness. Fig. 2(d) is the adversarial mesh generated by our proposed $\epsilon$ -ISO attack. We consider the geometric features of 3D objects to generate natural adversarial examples by constraining them to be $\epsilon$ -isometric to the original examples (i.e., the curve length of the resulting adversarial examples varies very little). However, it is intractable to directly optimize the adversarial mesh to be $\epsilon$ -isometric as the original one. Therefore, we give the definition of the Gaussian curvature of the surface from [8]. + +Definition 2. Let $S$ be a surface of $\mathbb{R}^3$ parameterized by $\pmb{r} \coloneqq \pmb{r}(u, v) = [x(u, v), y(u, v), z(u, v)]$ , where $(u, v) \in \mathbb{R}^2$ . We let $\pmb{r}_u, \pmb{r}_v$ denote the partial derivatives of $\pmb{r}$ w.r.t. $u$ and $v$ , $\pmb{r}_{uu}, \pmb{r}_{uv}, \pmb{r}_{vv}$ denote the second partial derivatives of $\pmb{r}$ , and $\wedge, \langle \cdot, \cdot \rangle$ denote the outer product and inner product, respectively. The parametrization thus defines unit normal vectors $\pmb{n} \coloneqq \frac{\pmb{r}_u \wedge \pmb{r}_v}{|\pmb{r}_u \wedge \pmb{r}_v|}$ of the surface $S$ . We + +denote the eigenvalues of the coefficient matrix of the Weingarten map $\left[ \begin{array}{cc}L & M\\ M & N \end{array} \right]\left[ \begin{array}{cc}E & F\\ F & G \end{array} \right]^{-1}$ as $k_{1}$ and $k_{2}$ , where $E = \langle r_u,r_u\rangle$ , $F = \langle r_u,r_v\rangle$ and $G = \langle r_v,r_v\rangle$ are coefficients of the first fundamental form and $L = \langle r_{uu},n\rangle$ , $M = \langle r_{uv},n\rangle$ and $N = \langle r_{vv},n\rangle$ are coefficients of the second fundamental form. The Gaussian curvature is defined as $K = k_{1}k_{2} = \frac{LN - M^{2}}{EG - F^{2}}$ . + +Remark 1. The Gaussian curvature intrinsically measures the bending degree of the surface reflected by the Gaussian mapping. Let the area element of the surface $S$ be $dA = \langle \pmb{r}_u \wedge \pmb{r}_v, \pmb{n} \rangle$ dudv and the area element under the Gaussian mapping $g: S \in \mathbb{R}^3 \to S^2$ be $dA' = \langle \pmb{n}_u \wedge \pmb{n}_v, \pmb{n} \rangle$ dudv. From $\pmb{n}_u \wedge \pmb{n}_v = K\pmb{r}_u \wedge \pmb{r}_v$ (proof in Appendix D), we obtain + +$$ +\lim _ {D \rightarrow P} \frac {\operatorname {A r e a} (g (D))}{\operatorname {A r e a} (D)} = \lim _ {D \rightarrow P} \frac {\int_ {g (D)} d A ^ {\prime}}{\int_ {D} d A} = \lim _ {D \rightarrow P} \frac {\int_ {D} K d A}{\int_ {D} d A} = K (P). \tag {2} +$$ + +Eq. (2) illustrates that the geometric meaning of Gaussian curvature is the ratio of the area of the domain at the point $P$ on the surface $S$ and the area of the domain at the corresponding point under the Gaussian mapping, i.e., the bending degree of the surface reflected by the Gaussian mapping. + +Based on Definitions 1 and 2, we have the following theorem. + +Theorem 1 (proof in Appendix A). Let $S$ and $\tilde{S}$ denote two surfaces of $\mathbb{R}^3$ ; $\varphi : S \to \tilde{S}$ denote a diffeomorphism that takes a point $v$ in $S$ to point $v' = \varphi(v)$ in $\tilde{S}$ ; and $K(\cdot)$ be the Gaussian curvature of the points. If $|K(v) - K(v')| < \epsilon$ for any point $v$ , then the surfaces $S$ and $\tilde{S}$ are $\epsilon$ -isometric. + +Theorem 1 indicates that to make two surfaces $\epsilon$ -isometric, one can constrain their Gaussian curvatures. Since the Gaussian curvature is computable and differentiable w.r.t. vertices, we adopt it to constrain the naturalness of 3D adversarial meshes as + +$$ +\mathcal {R} _ {\text {G a u s s}} \left(\mathcal {M} _ {\text {a d v}}, \mathcal {M}\right) = \frac {1}{n _ {v}} \sum_ {v \in \mathcal {V}, v ^ {\prime} = \varphi (v) \in \mathcal {V} _ {\text {a d v}}} \| K \left(v ^ {\prime}\right) - K (v) \| _ {2} ^ {2}, \tag {3} +$$ + +where $\varphi(\cdot)$ is the corresponding mapping between vertices in $\mathcal{V}$ and $\mathcal{V}_{adv}$ . We follow the Gauss-Bonnet formula [7] to calculate the Gaussian curvature of the vertices as + +$$ +K (v) = \frac {2 \pi - \sum_ {i \in N (v)} \theta_ {i} (v)}{A (v)}, \tag {4} +$$ + +where $A(\cdot)$ is the area of the vertex neighborhood, i.e., the area of the polygonal region joined by the consecutive midpoints of triangles incident on the vertex of interest, $N(v)$ is the set of faces containing $v$ , and $\theta_i(v)$ is the interior angle of the face at vertex $v$ . Note that the value of $\sum_{i\in N(v)}\theta_i(v)$ for a plane is $2\pi$ and the Gaussian curvature is 0. The more curved the surface, the smaller the value of $\sum_{i\in N(v)}\theta_i(v)$ and the larger the Gaussian curvature. + +In addition, we prevent the generated adversarial meshes from self-intersecting by using the Laplace loss [16], denoted as $\mathcal{R}_{Lap}(\mathcal{M}_{adv})$ , which represents the distance between a vertex and its nearest neighbor's center of mass, and the edge length loss [66], denoted as $\mathcal{R}_{edge}(\mathcal{M}_{adv})$ , which represents the smoothness of the surface. Thus, the overall regularization term can be expressed as: + +$$ +\mathcal {R} \left(\mathcal {M} _ {a d v}, \mathcal {M}\right) = \lambda_ {1} \cdot \mathcal {R} _ {\text {G a u s s}} \left(\mathcal {M} _ {a d v}, \mathcal {M}\right) + \lambda_ {2} \cdot \mathcal {R} _ {\text {L a p}} \left(\mathcal {M} _ {a d v}\right) + \lambda_ {3} \cdot \mathcal {R} _ {\text {e d g e}} \left(\mathcal {M} _ {a d v}\right), \tag {5} +$$ + +where $\lambda_{1},\lambda_{2}$ and $\lambda_{3}$ are balancing hyperparameters. + +# 3.3 Improving the robustness under physical transformations + +Besides concerning the naturalness of 3D adversarial examples, we further enhance their robustness under physical transformations, such as 3D rotations, affine projections, cutouts, etc. A common method is the expectation over transformation (EOT) algorithm [1], which optimizes the adversarial example over the distribution of different transformations. However, it is still challenging to maintain the attacking performance under various physical transformations. As shown in the experiments, after using the EOT algorithm, there are still some transformations that the generated adversarial examples are not robust to, leading to a reduction of the attack success rate. + +To address this issue, our key insight is to consider the worst-case transformations rather than their expectation, since if the adversarial examples are resistant to the most harmful physical transformations, they can also resist much weaker transformations, inspired by adversarial training [46]. Therefore, we propose a maxima over transformation (MaxOT) algorithm to actively search for physical transformations that maximize the misclassification loss. The loss function $\mathcal{L}_f$ is thus formulated as: + +$$ +\mathcal {L} _ {f} \left(S \left(\mathcal {M} _ {a d v}\right), y ^ {*}\right) = \max _ {T ^ {*} \subset T} \mathbb {E} _ {t \in T ^ {*}} \mathcal {L} _ {c e} \left(t \left(S \left(\mathcal {M} _ {a d v}\right)\right), y ^ {*}\right), \tag {6} +$$ + +where $T$ contains all possible transformations, $T^{*}$ is a subset of transformations in $T$ , and $\mathcal{L}_{ce}$ is the cross-entropy loss. Note that in Eq. (6) we consider a subset of transformations $T^{*}$ rather than a single one because the loss landscape w.r.t. transformations is largely non-convex and contains many local maxima [14]. Thus we aim to find a set of diverse worst-case transformations. By integrating Eq. (6) into Eq. (1), it forms a minimax optimization problem, where the inner maximization aims to find physical transformations that maximize the cross-entropy loss, while the outer minimization aims to optimize the adversarial example with the worst-case transformations. + +# 3.3.1 Bayesian optimization + +To solve problem (6), we search for the worst-case transformations one by one. Given an initialized transformation, we perform gradient-based optimization to update the transformation parameters (e.g., angles for rotations). However, randomly selecting initialized transformations is ineffective since the random initialization may drop into regions of weak transformations, which limits the exploration of the space of all transformations. To address this issue, we propose to adopt the Bayesian optimization [17, 54] to better break the dilemma between exploration and exploitation to find more appropriate initialized transformations. + +![](images/5044f990bdbb69c46d9de9de727450a750fe79ba94234de4c17b239a48e585f7.jpg) + +![](images/641377e5e70ac3e8cf27ebec10ca24fd9e8dc509d5581073684d2361291d6d67.jpg) + +![](images/0cd42643982c1c79821563989dfbccdf203f7f021bb7d079c5f4516de8b2e73f.jpg) + +![](images/18c798fb2fe2c52b7a646880bbc3fc31a50a7a252023e43591c7782d36172526.jpg) + +![](images/cacff7113cefc35fd66fda3498352c77be7b3f95205baba7431799c3d4f3605a.jpg) + +![](images/9e2ce6a2a373a64ac99bdf1e7a276ef6ae0c6cc7fb3b3b734e3d816851333e00.jpg) +Original + +![](images/9df2b7134e6668f90432d307ffd69bfa8f77aa69ee394321df20394c43740f5a.jpg) +KNN + +![](images/72e9406ec37bdaa3af238bc4be82b971a3f8530b2e91359b127d1d93b578b2d9.jpg) +GeoA3 + +![](images/625d3db46ebccdbffb67f64aea6e1f8eae4350b0cc1a31914bdda7be3db27ebd.jpg) +Mesh Attack + +![](images/df47eebfa2ca0923bafca89c8aca74b7b55d2de8ad76f0733d91f0d3ca93fa47.jpg) +$\epsilon$ -ISO + +![](images/3bdb72400e22f4c53add01bce945389752e6a7ecb34e88a285f4b771d509bb10.jpg) + +![](images/9e2e32e4f5709f88fa9e57968af812c7dc605d15bfa660d4addd2688fbab55cd.jpg) +Original + +![](images/307a8e635bf99630d25cedb3603b3d3c79e800e2ac0d7ecff1a5de045e732c91.jpg) + +![](images/207bd68a87b0ec728bed5e6bfb70ef84b7a28bf70088f89fd80753b34a4a99d6.jpg) +KNN +Figure 3: Adversarial objects obtained by KNN attack, $GeoA^3$ attack, Mesh Attack, and our $\epsilon$ -ISO attack against the PointNet model. The KNN and $GeoA^3$ attack produce adversarial samples with dense irregular deformations. The Mesh Attack produces distortions and self-intersecting surfaces (i.e., black surfaces). None of them guarantees naturalness, while $\epsilon$ -ISO attack is more natural. + +![](images/3a417b3f2ce53e2f92556377f77181cb3b396cf7e82811075d7ac2ca02afcbce.jpg) + +![](images/de4cff919bdaad61c649e713833091cf3b34b97b8a5fe8051d0446ba4335a06e.jpg) +$\mathbf{GeoA}^3$ + +![](images/9875555392c792a23012e7d40cce42e7383d92aa0433ed0f4b76d069c44f648d.jpg) + +![](images/7a243ba5d8481eade8bf7269ff46de1a257894b132e4f9e7351f89026b337527.jpg) +Mesh Attack + +![](images/763a04bc212f87e596c59a13e968d37a1046927b0d343eac44f9c69a4c65c899.jpg) + +![](images/a63054e16a84c5fe3c10c8b66521aa0e32c2ecba644fe6e4733e63a276d668d9.jpg) +$\epsilon$ -ISO + +Bayesian optimization is an efficient method for solving global optimization problems consisting of two key components: a surrogate model, such as a Gaussian process (GP) [51] or a Bayesian neural network (BNN) [32], which models the unknown objective; and an acquisition function $\alpha(\cdot)$ , which is maximized by balancing exploitation and exploration to recommend the next query location. We choose GP as a surrogate model, which provides a Bayesian posterior distribution to describe the unknown function $\mathcal{L}_{ce}(t(S(\mathcal{M}_{adv})), y^*)$ . We use the expected improvement (EI) [29, 47] acquisition function, which measures the expected improvement of each point with respect to the current best value. Then, the unknown function is sampled by maximizing the acquisition function to better explore the space of all transformations by selecting the next query point in the region where the prediction is high and the model is very uncertain. + +As shown in the overall algorithm (in Appendix B), we update the Bayesian posterior distribution of the objective $f$ using the observations obtained from the previous iterations in the gradient descent process. Then, we maximize the EI acquisition function $\alpha_{EI}(t;D_n)$ to find the initial transformation. From the initialization, we optimize the transformation parameters by gradient-based method to solve problem (6). This process is repeated for the number of transformations in the MaxOT algorithm. + +# 4 Experiments + +# 4.1 Experimental setup + +Dataset. We use the ModelNet40 [71] dataset in our experiments. This dataset contains 12,311 CAD models with 40 common object semantic categories in the real world. We use the official split [48, 49], where 9,843 examples are used for training and the remaining 2,468 examples are used for testing. We follow [88] and get closed manifolds. For adversarial attacks, we follow [69] and take all the instances of the 40 categories that are well classified in the ModelNet40 testing set. + +Victim models. Following [69, 88, 40], we select three commonly used point cloud classification networks as the victim models, i.e., PointNet [48], PointNet++ [49], and DGCNN [68]. + +Evaluation metrics. To quantitatively evaluate the effectiveness of our proposed $\epsilon$ -ISO attack, we measure the attack success rate (ASR). Besides, to measure the imperceptibility of different attack methods, we use the Chamfer distance $\mathcal{D}_c$ [15] and Gaussian curvature distance $\mathcal{D}_g$ (i.e., Eq. (3)) as evaluation metrics. We also report the attack success rates on several existing defenses [79, 95, 72] and under the physical world to further validate the superiority of our $\epsilon$ -ISO attack. + +Implementation details. We use Adam [31] to optimize the objective of our proposed $\epsilon$ -ISO attack. We use a fixed learning schedule of 250 iterations, where the learning rate and momentum are respectively set as 0.01 and 0.9. We assign the weighting parameters $\lambda_{1} = 1.0$ , $\lambda_{2} = 0.2$ and $\lambda_{3} = 0.8$ . The balancing parameter $\beta$ is initialized as 1,500 and automatically adjusted by conducting 10 runs of binary search following [4]. We uniformly sample 1,024 points from the adversarial mesh. + +Table 1: Quantitative results of KNN attack, $GeoA^3$ attack, Mesh Attack, and our proposed $\epsilon$ -ISO attack against different models. Our proposed $\epsilon$ -ISO attack outperforms all existing methods in terms of attack success rate (ASR) and imperceptibility. We adopt the Chamfer distance $\mathcal{D}_c$ [15] and Gaussian curvature distance $\mathcal{D}_g$ as the evaluation metrics. + +
ModelPointNetPointNet++DGCNN
ASR\( \mathcal{D}_c \)\( \mathcal{D}_g \)ASR\( \mathcal{D}_c \)\( \mathcal{D}_g \)ASR\( \mathcal{D}_c \)\( \mathcal{D}_g \)
KNN14.78%0.00340.00966.24%0.00270.01224.17%0.00360.0125
\( GeoA^3 \)19.65%0.00660.003711.20%0.01920.00318.24%0.01720.0042
Mesh Attack88.10%0.00540.004894.79%0.00450.004666.79%0.00510.0055
ε-ISO98.45%0.00310.000499.58%0.00400.000484.16%0.00320.0009
+ +![](images/422ebffce882fb753e8ef772bd77ee69034e354ad65327a18cecc6c03877ec1a.jpg) +Figure 4: The attack success rate w.r.t number of iterations curves of EOT and MaxOT against PointNet, PointNet++, and DGCNN. Our proposed MaxOT algorithm can lead to a higher attack success rate with a small number of iterations than that of EOT with a large number of iterations. + +![](images/3c7254ae05dc57b5b160fa8f7a24973d332c92684b4d373de72b566892a49675.jpg) + +![](images/200d514936fa347e4f925e4db17557da6f9eb9c0b94a0f2bd08e923f70764c0a.jpg) + +# 4.2 Pseudo physical attack + +In this section, we compare our proposed $\epsilon$ -ISO attack with existing methods [63, 69, 88] that generate adversarial objects under the setting of white-box targeted attack, including the KNN attack [63], $GeoA^3$ attack [69], and Mesh Attack [88]. In Table 1, we compare different methods under the measures of attack success rate (ASR), Chamfer distance $\mathcal{D}_c$ [15] and Gaussian curvature distance $\mathcal{D}_g$ . Our proposed $\epsilon$ -ISO attack outperforms all existing methods in terms of attack success rate and is almost optimal in terms of Chamfer distance $\mathcal{D}_c$ and Gaussian curvature distance $\mathcal{D}_g$ , the evaluation metrics for measuring imperceptibility. These comparisons confirm the effectiveness of our proposed regularization term based on Gaussian curvature, to simultaneously achieve the strongest adversarial attack and the most natural perturbations. + +Fig. 3 shows the adversarial objects generated by different methods. The KNN attack and $GeoA^3$ attack produce dense irregular deformations on the mesh surface, losing smoothness and regularity. The Mesh Attack creates severe deformations and spurs, which are easily perceived by humans visually. In addition, the severe irregularities and distortions generated by the Mesh Attack can lead to self-intersecting phenomena in the mesh of 3D objects, i.e., the black surfaces in Fig. 3. These self-intersecting surfaces can prohibit 3D-printing the adversarial objects in the physical world. By considering geometric features of the object instead of using metrics in the Euclidean space, our $\epsilon$ -ISO attack produces adversarial samples without dense deformations, bursts, distortions, and self-intersection phenomena, while are stealthy and natural. + +# 4.3 Robustness under physical transformation + +To further verify the superior robustness of our proposed MaxOT algorithm under transformations in the physical world, we compare MaxOT to EOT. In Table 2, we compare the different methods under rotations to calculate the attack success rate, Chamfer distance $\mathcal{D}_c$ and Gaussian curvature distance $\mathcal{D}_g$ . Our proposed MaxOT algorithm outperforms the EOT algorithm in terms of attack success rate. This comparison confirms our insight that the resistance to the most harmful physical transformations is better than random ones. + +Table 2: Quantitative results of attacking different models using EOT and MaxOT. Our proposed MaxOT algorithm outperforms the EOT algorithm in terms of attack success rate. + +
ModelPointNetPointNet++DGCNN
ASR\( \mathcal{D}_c \)\( \mathcal{D}_g \)ASR\( \mathcal{D}_c \)\( \mathcal{D}_g \)ASR\( \mathcal{D}_c \)\( \mathcal{D}_g \)
EOT76.20%0.00740.000974.28%0.00940.000765.72%0.00680.0041
MaxOT82.50%0.00740.000984.14%0.00940.000672.40%0.00670.0039
+ +Table 3: The attack success rate of various methods against PointNet under different defense methods. Our proposed $\epsilon$ -ISO attack performs better under stronger defenses, and the attack success rate under DUP-Net and IF-Defence is higher than all other attacks. + +
no defenceSRSSORDUP-NetIF-Defence
KNN32.15%24.34%13.36%11.25%7.46%
GeoA340.87%3.34%33.22%11.97%1.04%
Mesh Attack93.39%87.38%89.93%78.28%49.06%
ε-ISO99.81%79.85%85.42%78.55%60.51%
+ +Table 4: The success rate of attacking the PointNet model in the physical world using the EOT algorithm and our proposed MaxOT algorithm. + +
PointNet
EOT72.36%
MaxOT80.12%
+ +In Fig. 4, we give the success rate w.r.t. iterations curves for EOT and MaxOT of different victim models. Our proposed MaxOT algorithm is always ahead of the EOT algorithm at different number of iterations. Moreover, we note that our proposed MaxOT algorithm can lead to higher attack success rate with a small number of iterations than that of EOT with a large number of iterations. Therefore, our proposed MaxOT algorithm is more efficient. + +# 4.4 Performance under defense + +We further verify the effectiveness of our $\epsilon$ -ISO attack under the existing defense methods. To evaluate the adversarial robustness of various attacks, we use the following defense methods: Simple Random Sampling (SRS) [79], Statistical Outlier Removal (SOR) [95], DUP-Net defense [95], and IF-Defense [72]. We give the attack success rate of various attacks under each defense method in Table 3. Under simple defenses such as SRS and SOR, the attack success rate of Mesh Attack is higher than our $\epsilon$ -ISO attack. + +However, under more advanced and effective defenses such as IF-Defence, the attack success rate of our $\epsilon$ -ISO attack is higher than all other attacks. This is because KNN attack and $GeoA^3$ attack generate adversarial objects through dense local deformation, generating outliers that are easily detected by the defense methods. The Mesh Attack generates adversarial objects through large anomalous deformation, resulting in fewer local outliers that have advantages under simple statistical defenses such as SRS and SOR, but cannot effectively attack the IF-Defence with better defense performance. Our $\epsilon$ -ISO attack produces adversarial samples without local outliers or anomalous deformations, with better attack performance, especially under IF-Defence. + +# 4.5 Physical attack + +We randomly select 100 instances in Table 2, 50 of which are generated by the MaxOT algorithm and the other 50 are the corresponding instances generated by the EOT algorithm. The selected meshes are printed by the Stratsys J850 Prime 3D printer and scanned by the EinScan-SE 3D scanner. The attack success rate in the physical world is shown in Table 4, where our algorithm almost completely maintains the effect of the pseudo physical world attack. None of the previous algorithms could maintain the pseudo physical world attack well in the physical world because the dense deformation and self-intersection phenomena would interfere with the scanning and prevent the scanner from correctly scanning the surface of the adversarial samples generated by their algorithms. In contrast, the surface of the adversarial sample produced by our $\epsilon$ -ISO attack is smooth and natural and can be scanned correctly by the scanner, preserving the adversarial effect. In addition, the improvement on the attack success rate of our proposed MaxOT algorithm against the EOT algorithm is also reflected in the physical world. Our proposed MaxOT algorithm is necessary to improve the robustness of the adversarial sample under the transformation of the physical world. The adversarial meshes, 3D printed physical meshes, and scanned point clouds are shown in Fig. 5. + +![](images/7431d1109e37935f0d514dc603d7b103e5d7ba53fe46e7a5581df7c7ea9178ca.jpg) +Figure 5: Visualization of the $\epsilon$ -ISO attack in the physical world. The adversarial mesh is randomly selected from Table 2. After 3D-printing and scanning, the point cloud obtained from the scanning is used to attack the PointNet. A green check mark indicates a successful attack. The adversarial samples we generated are natural and stealthy, and because of their smoothness and naturalness, can be scanned correctly by the 3D-scanner, maintaining the adversarial effect in the physical world. + +![](images/03b554f1a77608d525947b0b58fd4ca3846d0a1736b0da538113b1ec5f6205d6.jpg) +Figure 6: The effects of the penalty parameter $\lambda_{1}$ of the Gaussian curvature consistency regularization term. When $\lambda_{1}$ is large, the attack success rate decreases rapidly. When $\lambda_{1}$ is small, the naturalness of the adversarial objects is worse. The default $\lambda_{1} = 1$ gives the best result for balancing the attack success rate and stealthiness. + +![](images/9cc1e975855f753ae44658f8fa76adba3c805dc838412245c50161a2e70047e4.jpg) + +![](images/ca7c648fba89bd397a148c422ab852c9634a188b86beaf8626155c31714a1bf5.jpg) + +# 4.6 Ablation studies + +To investigate the effect of the penalty parameter $\lambda_{1}$ of the Gaussian curvature consistency regularization term on the attack success rate and imperceptibility metrics, we adjust the value of $\lambda_{1}$ to perform quantitative and qualitative experiments. The plots in Fig. 6 show that when $\lambda_{1}$ is tuned high, the attack success rate decreases rapidly. When $\lambda_{1}$ is adjusted lower, the values of the evaluation metrics increase and deteriorate rapidly. The qualitative visualization results in Appendix C demonstrate the irregularity of the 3D objects as $\lambda_{1}$ is turned down. Our default value of $\lambda_{1} = 1$ gives the best result for balancing the attack success rate and stealthiness. To investigate the effectiveness of Bayesian optimization to find the initial transformations, we test the attack success rate for randomly selecting the initial transformation in the MaxOT algorithm. As shown in Appendix C, the improvement of using Bayesian optimization over random initialization in the MaxOT algorithm is significant. This confirms the importance of Bayesian optimization methods in our approach. More ablation studies can be found in Appendix C. + +# 5 Conclusion + +In this paper, we propose a novel $\epsilon$ -isometric ( $\epsilon$ -ISO) attack method to generate natural and robust 3D adversarial examples in the physical world. We improve the naturalness of 3D adversarial examples by constraining it to be $\epsilon$ -isometric to the original one. Through a theoretical analysis, we adopt + +the Gaussian curvature as the surrogate metric. We further propose a maxima over transformation (MaxOT) algorithm armed with Bayesian optimization that actively searches for the most harmful transformations rather than random ones to make the generated adversarial example more robust in the physical world. Extensive Experiments on typical point cloud recognition models validate the effectiveness of our approach in terms of attack success rate and naturalness compared to the state-of-the-art methods. A potential negative societal impact of our work in that the malicious adversaries may adopt our method to generate 3D adversarial objects in the physical world, which can cause severe security/safety consequences for real-world applications. Thus it is imperative to develop more robust 3D recognition models, which we leave to future work. + +# Acknowledgement + +Yibo Miao and Xiao-Shan Gao were supported by NKRDP grant No.2018YFA0704705 and NSFC grant No.12288201. Yinpeng Dong and Jun Zhu were supported by the National Key Research and Development Program of China (2020AAA0106000, 2020AAA0104304, 2020AAA0106302), NSFC Projects (Nos. 62061136001, 62076145, 62076147, U19B2034, U1811461, U19A2081, 61972224), Beijing NSF Project (No. JQ19016), BNRist (BNR2022RC01006), Tsinghua Institute for Guo Qiang, and the High Performance Computing Center, Tsinghua University. Y. Dong was also supported by the China National Postdoctoral Program for Innovative Talents and Shuimu Tsinghua Scholar Program. J. Zhu was also supported by the XPlorer Prize. + +# References + +[1] Anish Athalye, Logan Engstrom, Andrew Ilyas, and Kevin Kwok. Synthesizing robust adversarial examples. In International conference on machine learning, pages 284-293. PMLR, 2018. +[2] Matan Atzmon, Haggai Maron, and Yaron Lipman. Point convolutional neural networks by extension operators. arXiv preprint arXiv:1803.10091, 2018. +[3] Yulong Cao, Chaowei Xiao, Dawei Yang, Jing Fang, Ruigang Yang, Mingyan Liu, and Bo Li. Adversarial objects against lidar-based autonomous driving systems. arXiv preprint arXiv:1907.05418, 2019. +[4] Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In 2017 IEEE symposium on security and privacy (sp), pages 39-57. IEEE, 2017. +[5] Xiaozhi Chen, Huimin Ma, Ji Wan, Bo Li, and Tian Xia. Multi-view 3d object detection network for autonomous driving. In Proceedings of the IEEE conference on Computer Vision and Pattern Recognition, pages 1907-1915, 2017. +[6] Wenda Chu, Linyi Li, and Bo Li. Tpc: Transformation-specific smoothing for point cloud models. arXiv preprint arXiv:2201.12733, 2022. +[7] David Cohen-Steiner and Jean-Marie Morvan. Restricted delaunay triangulations and normal cycle. In Proceedings of the nineteenth annual symposium on Computational geometry, pages 312-321, 2003. +[8] Manfredo P Do Carmo. Differential geometry of curves and surfaces: revised and updated second edition. Courier Dover Publications, 2016. +[9] Xiaoyi Dong, Dongdong Chen, Hang Zhou, Gang Hua, Weiming Zhang, and Nenghai Yu. Self-robust 3d point recognition via gather-vector guidance. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 11513–11521. IEEE, 2020. +[10] Yinpeng Dong, Fangzhou Liao, Tianyu Pang, Hang Su, Jun Zhu, Xiaolin Hu, and Jianguo Li. Boosting adversarial attacks with momentum. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018. +[11] Yinpeng Dong, Zhijie Deng, Tianyu Pang, Jun Zhu, and Hang Su. Adversarial distributional training for robust deep learning. Advances in Neural Information Processing Systems, 33:8270-8283, 2020. +[12] Yinpeng Dong, Ke Xu, Xiao Yang, Tianyu Pang, Zhijie Deng, Hang Su, and Jun Zhu. Exploring memorization in adversarial training. arXiv preprint arXiv:2106.01606, 2021. +[13] Yueqi Duan, Yu Zheng, Jiwen Lu, Jie Zhou, and Qi Tian. Structural relational reasoning of point clouds. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 949-958, 2019. + +[14] Logan Engstrom, Brandon Tran, Dimitris Tsipras, Ludwig Schmidt, and Aleksander Madry. Exploring the landscape of spatial robustness. In International Conference on Machine Learning, pages 1802-1811, 2019. +[15] Haoqiang Fan, Hao Su, and Leonidas J Guibas. A point set generation network for 3d object reconstruction from a single image. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 605-613, 2017. +[16] David A Field. Laplacian smoothing and delaunay triangulations. Communications in applied numerical methods, 4(6):709-712, 1988. +[17] Peter I Frazier. A tutorial on bayesian optimization. arXiv preprint arXiv:1807.02811, 2018. +[18] Xiang Gao, Wei Hu, and Guo-Jun Qi. Grapher: Unsupervised learning of graph transformation equivariant representations via auto-encoding node-wise transformations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 7163–7172, 2020. +[19] Justin Gilmer, Ryan P Adams, Ian Goodfellow, David Andersen, and George E Dahl. Motivating the rules of the game for adversarial example research. arXiv preprint arXiv:1807.06732, 2018. +[20] Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In International Conference on Learning Representations (ICLR), 2015. +[21] Ankit Goyal, Hei Law, Bowei Liu, Alejandro Newell, and Jia Deng. Revisiting point cloud shape classification with a simple and effective baseline. In International Conference on Machine Learning, pages 3809-3820. PMLR, 2021. +[22] Benjamin Graham, Martin Engelcke, and Laurens Van Der Maaten. 3d semantic segmentation with submanifold sparse convolutional networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 9224-9232, 2018. +[23] T Groueix, M Fisher, VG Kim, BC Russell, and M Aubry. Atlasnet: A papier-mâché approach to learning 3d surface generation. arxiv 2018. arXiv preprint arXiv:1802.05384, 1802. +[24] Abdullah Hamdi, Sara Rojas, Ali Thabet, and Bernard Ghanem. Advpc: Transferable adversarial perturbations on 3d point clouds. In European Conference on Computer Vision, pages 241-257. Springer, 2020. +[25] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770-778, 2016. +[26] Qingyong Hu, Bo Yang, Linhai Xie, Stefano Rosa, Yulan Guo, Zhihua Wang, Niki Trigoni, and Andrew Markham. Learning semantic segmentation of large-scale point clouds with random sampling. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2021. +[27] Gao Huang, Zhuang Liu, Laurens Van Der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 4700-4708, 2017. +[28] Di Jin, Zhijing Jin, Joel Tianyi Zhou, and Peter Szolovits. Is bert really robust? a strong baseline for natural language attack on text classification and entailment. In Proceedings of the AAAI conference on artificial intelligence, volume 34, pages 8018-8025, 2020. +[29] Donald R Jones, Matthias Schonlau, and William J Welch. Efficient global optimization of expensive black-box functions. Journal of Global optimization, 13(4):455-492, 1998. +[30] Jaeyeon Kim, Binh-Son Hua, Thanh Nguyen, and Sai-Kit Yeung. Minimal adversarial examples for deep learning on 3d point clouds. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 7797–7806, 2021. +[31] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. +[32] Igor Kononenko. Bayesian neural networks. Biological Cybernetics, 61(5):361-370, 1989. +[33] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems (NeurIPS), 2012. +[34] Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial examples in the physical world. In International Conference on Learning Representations (ICLR) Workshops, 2017. + +[35] Itai Lang, Uriel Kotlicki, and Shai Avidan. Geometric adversarial attacks and defenses on 3d point clouds. In 2021 International Conference on 3D Vision (3DV), pages 1196-1205. IEEE, 2021. +[36] Kibok Lee, Zhuoyuan Chen, Xinchen Yan, Raquel Urtasun, and Ersin Yumer. Shapeadv: Generating shape-aware adversarial 3d point clouds. arXiv preprint arXiv:2005.11626, 2020. +[37] Huan Lei, Naveed Akhtar, and Ajmal Mian. Spherical kernel for efficient graph convolution on 3d point clouds. IEEE transactions on pattern analysis and machine intelligence, 43(10):3664-3680, 2020. +[38] Xinke Li, Zhirui Chen, Yue Zhao, Zekun Tong, Yabang Zhao, Andrew Lim, and Joey Tianyi Zhou. Pointba: Towards backdoor attacks in 3d point cloud. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 16492-16501, 2021. +[39] Yangyan Li, Rui Bu, Mingchao Sun, Wei Wu, Xinhan Di, and Baoquan Chen. PointCNN: Convolution on x-transformed points. Advances in neural information processing systems, 31, 2018. +[40] Daizong Liu and Wei Hu. Imperceptible transfer attack and defense on 3d point cloud classification. arXiv preprint arXiv:2111.10990, 2021. +[41] Daizong Liu, Wei Hu, and Xin Li. Point cloud attacks in graph spectral domain: When 3d geometry meets graph signal processing. arXiv preprint arXiv:2207.13326, 2022. +[42] Daniel Liu, Ronald Yu, and Hao Su. Extending adversarial attacks and defenses to deep 3d point cloud classifiers. In 2019 IEEE International Conference on Image Processing (ICIP), pages 2279-2283. IEEE, 2019. +[43] Yongcheng Liu, Bin Fan, Gaofeng Meng, Jiwen Lu, Shiming Xiang, and Chunhong Pan. Densepoint: Learning densely contextual representation for efficient point cloud processing. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 5239-5248, 2019. +[44] Yongcheng Liu, Bin Fan, Shiming Xiang, and Chunhong Pan. Relation-shape convolutional neural network for point cloud analysis. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8895-8904, 2019. +[45] Chengcheng Ma, Weiliang Meng, Baoyuan Wu, Shibiao Xu, and Xiaopeng Zhang. Efficient joint gradient based attack against sor defense for 3d point cloud classification. In Proceedings of the 28th ACM International Conference on Multimedia, pages 1819-1827, 2020. +[46] Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. In International Conference on Learning Representations (ICLR), 2018. +[47] Jonas Mockus, Vytautas Tiesis, and Antanas Zilinskas. The application of bayesian methods for seeking the extremum. Towards global optimization, 2(117-129):2, 1978. +[48] Charles R Qi, Hao Su, Kaichun Mo, and Leonidas J Guibas. Pointnet: Deep learning on point sets for 3d classification and segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 652-660, 2017. +[49] Charles Ruizhongtai Qi, Li Yi, Hao Su, and Leonidas J Guibas. Pointnet++: Deep hierarchical feature learning on point sets in a metric space. Advances in neural information processing systems, 30, 2017. +[50] Yongming Rao, Jiwen Lu, and Jie Zhou. Global-local bidirectional reasoning for unsupervised representation learning of 3d point clouds. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 5376-5385, 2020. +[51] Carl Edward Rasmussen. Gaussian processes in machine learning. In Summer school on machine learning, pages 63-71. Springer, 2003. +[52] Yiru Shen, Chen Feng, Yaoqing Yang, and Dong Tian. Mining point cloud local structures by kernel correlation and graph pooling. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 4548-4557, 2018. +[53] Martin Simonovsky and Nikos Komodakis. Dynamic edge-conditioned filters in convolutional neural networks on graphs. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 3693-3702, 2017. +[54] Jasper Snoek, Hugo Larochelle, and Ryan P Adams. Practical bayesian optimization of machine learning algorithms. Advances in neural information processing systems, 25, 2012. + +[55] Hang Su, Subhransu Maji, Evangelos Kalogerakis, and Erik Learned-Miller. Multi-view convolutional neural networks for 3d shape recognition. In Proceedings of the IEEE international conference on computer vision, pages 945-953, 2015. +[56] Jiachen Sun, Yulong Cao, Qi Alfred Chen, and Z Morley Mao. Towards robust {LiDAR-based} perception in autonomous driving: General black-box adversarial sensor attack and countermeasures. In 29th USENIX Security Symposium (USENIX Security 20), pages 877-894, 2020. +[57] Jiachen Sun, Karl Koenig, Yulong Cao, Qi Alfred Chen, and Z Morley Mao. On adversarial robustness of 3d point cloud classification under adaptive attacks. arXiv preprint arXiv:2011.11922, 2020. +[58] Jiachen Sun, Yulong Cao, Christopher B Choy, Zhiding Yu, Anima Anandkumar, Zhuoqing Morley Mao, and Chaowei Xiao. Adversarially robust 3d point cloud recognition using self-supervisions. Advances in Neural Information Processing Systems, 34:15498-15512, 2021. +[59] Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013. +[60] Abdel Aziz Taha and Allan Hanbury. Metrics for evaluating 3d medical image segmentation: analysis, selection, and tool. BMC medical imaging, 15(1):1-28, 2015. +[61] Gusi Te, Wei Hu, Amin Zheng, and Zongming Guo. Rgcnn: Regularized graph cnn for point cloud segmentation. In Proceedings of the 26th ACM international conference on Multimedia, pages 746-754, 2018. +[62] Hugues Thomas, Charles R Qi, Jean-Emmanuel Deschaud, Beatrix Marcotegui, François Goulette, and Leonidas J Guibas. Kpconv: Flexible and deformable convolution for point clouds. In Proceedings of the IEEE/CVF international conference on computer vision, pages 6411–6420, 2019. +[63] Tzungyu Tsai, Kaichen Yang, Tsung-Yi Ho, and Yier Jin. Robust adversarial objects against deep learning models. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 954–962, 2020. +[64] James Tu, Mengye Ren, Sivabalan Manivasagam, Ming Liang, Bin Yang, Richard Du, Frank Cheng, and Raquel Urtasun. Physically realizable adversarial examples for lidar object detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 13716-13725, 2020. +[65] Jacob Varley, Chad DeChant, Adam Richardson, Joaquín Ruales, and Peter Allen. Shape completion enabled robotic grasping. In 2017 IEEE/RSJ international conference on intelligent robots and systems (IROS), pages 2442-2447. IEEE, 2017. +[66] Nanyang Wang, Yinda Zhang, Zhuwen Li, Yanwei Fu, Wei Liu, and Yu-Gang Jiang. Pixel2mesh: Generating 3d mesh models from single rgb images. In Proceedings of the European conference on computer vision (ECCV), pages 52-67, 2018. +[67] Weiyue Wang, Ronald Yu, Qiangui Huang, and Ulrich Neumann. Sgpn: Similarity group proposal network for 3d point cloud instance segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2569-2578, 2018. +[68] Yue Wang, Yongbin Sun, Ziwei Liu, Sanjay E Sarma, Michael M Bronstein, and Justin M Solomon. Dynamic graph cnn for learning on point clouds. Acm Transactions On Graphics (tog), 38(5):1-12, 2019. +[69] Yuxin Wen, Jiehong Lin, Ke Chen, CL Philip Chen, and Kui Jia. Geometry-aware generation of adversarial point clouds. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2020. +[70] Matthew Wicker and Marta Kwiatkowska. Robustness of 3d deep learning in an adversarial setting. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 11767-11775, 2019. +[71] Zhirong Wu, Shuran Song, Aditya Khosla, Fisher Yu, Linguang Zhang, Xiaou Tang, and Jianxiong Xiao. 3d shapenets: A deep representation for volumetric shapes. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1912-1920, 2015. +[72] Ziyi Wu, Yueqi Duan, He Wang, Qingnan Fan, and Leonidas J Guibas. If-defense: 3d adversarial point cloud defense via implicit function based restoration. arXiv preprint arXiv:2010.05272, 2020. +[73] Chong Xiang, Charles R Qi, and Bo Li. Generating 3d adversarial point clouds. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9136-9144, 2019. + +[74] Tiange Xiang, Chaoyi Zhang, Yang Song, Jianhui Yu, and Weidong Cai. Walk in the cloud: Learning curves for point clouds shape analysis. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 915-924, 2021. +[75] Zhen Xiang, David J Miller, Siheng Chen, Xi Li, and George Kesidis. A backdoor attack against 3d point cloud classifiers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 7597-7607, 2021. +[76] Mutian Xu, Runyu Ding, Hengshuang Zhao, and Xiaojuan Qi. Paconv: Position adaptive convolution with dynamic kernel assembling on point clouds. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 3173-3182, 2021. +[77] Qiangeng Xu, Xudong Sun, Cho-Ying Wu, Panqu Wang, and Ulrich Neumann. Grid-gcn for fast and scalable point cloud learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 5661-5670, 2020. +[78] Bo Yang, Jianan Wang, Ronald Clark, Qingyong Hu, Sen Wang, Andrew Markham, and Niki Trigoni. Learning object bounding boxes for 3d instance segmentation on point clouds. Advances in neural information processing systems, 32, 2019. +[79] Jiancheng Yang, Qiang Zhang, Rongyao Fang, Bingbing Ni, Jinxian Liu, and Qi Tian. Adversarial attack and defense on point sets. arXiv preprint arXiv:1902.10899, 2019. +[80] Jiancheng Yang, Qiang Zhang, Bingbing Ni, Linguo Li, Jinxian Liu, Mengdie Zhou, and Qi Tian. Modeling point clouds with self-attention and gumbel subset sampling. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 3323–3332, 2019. +[81] Yaoqing Yang, Chen Feng, Yiru Shen, and Dong Tian. Foldingnet: Point cloud auto-encoder via deep grid deformation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 206–215, 2018. +[82] Lijia Yu, Yihan Wang, and Xiao-Shan Gao. Adversarial parameter attack on deep neural networks. arXiv preprint arXiv:2203.10502, 2022. +[83] Tan Yu, Jingjing Meng, and Junsong Yuan. Multi-view harmonized bilinear network for 3d object recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 186-194, 2018. +[84] Xuejing Yuan, Yuxuan Chen, Yue Zhao, Yunhui Long, Xiaokang Liu, Kai Chen, Shengzhi Zhang, Heqing Huang, Xiaofeng Wang, and Carl A Gunter. {CommanderSong}: A systematic approach for practical adversarial voice recognition. In 27th USENIX security symposium (USENIX security 18), pages 49-64, 2018. +[85] Xiangyu Yue, Bichen Wu, Sanjit A Seshia, Kurt Keutzer, and Alberto L Sangiovanni-Vincentelli. A lidar point cloud generator: from a virtual world to autonomous driving. In Proceedings of the 2018 ACM on International Conference on Multimedia Retrieval, pages 458-464, 2018. +[86] Manzil Zaheer, Satwik Kottur, Siamak Ravanbakhsh, Barnabas Poczos, Russ R Salakhutdinov, and Alexander J Smola. Deep sets. Advances in neural information processing systems, 30, 2017. +[87] Maciej Zamorski, Maciej Zieba, Piotr Klukowski, Rafal Nowak, Karol Kurach, Wojciech Stokowiec, and Tomasz Trzeciński. Adversarial autoencoders for compact representations of 3d point clouds. Computer Vision and Image Understanding, 193:102921, 2020. +[88] Jinlai Zhang, Lyujie Chen, Binbin Liu, Bo Ouyang, Qizhi Xie, Jihong Zhu, Weiming Li, and Yanmei Meng. 3d adversarial attacks beyond point cloud. arXiv preprint arXiv:2104.12146, 2021. +[89] Jinlai Zhang, Lyujie Chen, Bo Ouyang, Binbin Liu, Jihong Zhu, Yujin Chen, Yanmei Meng, and Danfeng Wu. Pointcutmix: Regularization strategy for point cloud classification. Neurocomputing, 505:58-67, 2022. +[90] Jinlai Zhang, Weiming Li, Shuang Liang, Hao Wang, and Jihong Zhu. Adversarial samples for deep monocular 6d object pose estimation. arXiv preprint arXiv:2203.00302, 2022. +[91] Yu Zhang, Gongbo Liang, Tawfiq Salem, and Nathan Jacobs. Defense-pointnet: Protecting pointnet against adversarial attacks. In 2019 IEEE International Conference on Big Data (Big Data), pages 5654-5660. IEEE, 2019. + +[92] Yue Zhao, Yuwei Wu, Caihua Chen, and Andrew Lim. On isometry robustness of deep 3d point cloud models under adversarial attacks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1201-1210, 2020. +[93] Tianhang Zheng, Changyou Chen, Junsong Yuan, Bo Li, and Kui Ren. Pointcloud saliency maps. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 1598-1606, 2019. +[94] Boxuan Zhong, He Huang, and Edgar Lobaton. Reliable vision-based grasping target recognition for upper limb prostheses. IEEE Transactions on Cybernetics, 2020. +[95] Hang Zhou, Kejiang Chen, Weiming Zhang, Han Fang, Wenbo Zhou, and Nenghai Yu. Dup-net: Denoiser and upsampler network for 3d adversarial point clouds defense. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 1961-1970, 2019. +[96] Hang Zhou, Dongdong Chen, Jing Liao, Kejiang Chen, Xiaoyi Dong, Kunlin Liu, Weiming Zhang, Gang Hua, and Nenghai Yu. Lg-gan: Label guided adversarial network for flexible targeted attack of point cloud based deep networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10356-10365, 2020. +[97] Xinge Zhu, Hui Zhou, Tai Wang, Fangzhou Hong, Wei Li, Yuexin Ma, Hongsheng Li, Ruigang Yang, and Dahua Lin. Cylindrical and asymmetrical 3d convolution networks for lidar-based perception. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2021. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] We do not develop more robust 3D models in this work, which we leave to future work. +(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Sec. 5 +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] +(b) Did you include complete proofs of all theoretical results? [Yes] See Appendix A. + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] The code is included in the supplementary material. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Sec. 4.1. +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] +(b) Did you mention the license of the assets? [N/A] +(c) Did you include any new assets either in the supplemental material or as a URL? [N/A] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/isometric3dadversarialexamplesinthephysicalworld/images.zip b/isometric3dadversarialexamplesinthephysicalworld/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..23e43de31e72bc493e749bbe40169d4d6c8435a5 --- /dev/null +++ b/isometric3dadversarialexamplesinthephysicalworld/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:24429c50ffbd83499a7183814b0c4c28824dcb139ff02521459c4a8f46c1f09f +size 436429 diff --git a/isometric3dadversarialexamplesinthephysicalworld/layout.json b/isometric3dadversarialexamplesinthephysicalworld/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..acf2f7c37c953d4a0fa4ecc287d223d136ede45c --- /dev/null +++ b/isometric3dadversarialexamplesinthephysicalworld/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0eaf4f6793b6fbbbd96d3b429b52436e7c8b1c5acfa6aa4cf691f081224692f4 +size 636791 diff --git a/isoneannotationenoughadatacentricimageclassificationbenchmarkfornoisyandambiguouslabelestimation/6d243b97-81aa-4ea8-9074-232fc383ad30_content_list.json b/isoneannotationenoughadatacentricimageclassificationbenchmarkfornoisyandambiguouslabelestimation/6d243b97-81aa-4ea8-9074-232fc383ad30_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..bbb0d78c41b73d0afa73399c653bfaf4632658ff --- /dev/null +++ b/isoneannotationenoughadatacentricimageclassificationbenchmarkfornoisyandambiguouslabelestimation/6d243b97-81aa-4ea8-9074-232fc383ad30_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0da0c9b7cc6bfb0d6bf5f3dc73e73c7e5cf9e38fecf779cb2055d387daee68c1 +size 98933 diff --git a/isoneannotationenoughadatacentricimageclassificationbenchmarkfornoisyandambiguouslabelestimation/6d243b97-81aa-4ea8-9074-232fc383ad30_model.json b/isoneannotationenoughadatacentricimageclassificationbenchmarkfornoisyandambiguouslabelestimation/6d243b97-81aa-4ea8-9074-232fc383ad30_model.json new file mode 100644 index 0000000000000000000000000000000000000000..9e39f02425e68bd75af1788d8407fb87c0d04c2e --- /dev/null +++ b/isoneannotationenoughadatacentricimageclassificationbenchmarkfornoisyandambiguouslabelestimation/6d243b97-81aa-4ea8-9074-232fc383ad30_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:95cafb837b65f3c0b976cffc52459630bc16eb5db9e92582783cad0a5ba5676c +size 128675 diff --git a/isoneannotationenoughadatacentricimageclassificationbenchmarkfornoisyandambiguouslabelestimation/6d243b97-81aa-4ea8-9074-232fc383ad30_origin.pdf b/isoneannotationenoughadatacentricimageclassificationbenchmarkfornoisyandambiguouslabelestimation/6d243b97-81aa-4ea8-9074-232fc383ad30_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..52deef605c77ce622ee8f040a54990567461b51f --- /dev/null +++ b/isoneannotationenoughadatacentricimageclassificationbenchmarkfornoisyandambiguouslabelestimation/6d243b97-81aa-4ea8-9074-232fc383ad30_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:48367096f55e95c4da1cb44532fc91064b370f239b7eda5e96841ec1f55d7156 +size 752501 diff --git a/isoneannotationenoughadatacentricimageclassificationbenchmarkfornoisyandambiguouslabelestimation/full.md b/isoneannotationenoughadatacentricimageclassificationbenchmarkfornoisyandambiguouslabelestimation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..ec7351f675da338e6f7b30ee2dcaa579d97053b9 --- /dev/null +++ b/isoneannotationenoughadatacentricimageclassificationbenchmarkfornoisyandambiguouslabelestimation/full.md @@ -0,0 +1,290 @@ +# Is one annotation enough? + +A data-centric image classification benchmark for noisy and ambiguous label estimation + +# Lars Schmarje $^{1*}$ Vasco Grossmann $^{1}$ Claudius Zelenka $^{1}$ Sabine Dippel $^{2}$ Rainer Kiko $^{3}$ Mariusz Oszust $^{4}$ Matti Pastell $^{6}$ Jenny Stracke $^{5}$ Anna Valros $^{7}$ Nina Volkmann $^{7}$ Reinhard Koch $^{1}$ + +1MIP, Kiel University 2ITT, Friedrich-Loeffler-Institut 3LOV, Sorbonne Université + +$^{4}$ Rzeszow University of Technology $^{5}$ ITW, University Bonn $^{6}$ University of Helsinki $^{7}$ Luke, Natural Resources Institute Finland $^{8}$ WING, University of Veterinary Medicine Hannover + +# Abstract + +High-quality data is necessary for modern machine learning. However, the acquisition of such data is difficult due to noisy and ambiguous annotations of humans. The aggregation of such annotations to determine the label of an image leads to a lower data quality. We propose a data-centric image classification benchmark with ten real-world datasets and multiple annotations per image to allow researchers to investigate and quantify the impact of such data quality issues. With the benchmark we can study the impact of annotation costs and (semi-)supervised methods on the data quality for image classification by applying a novel methodology to a range of different algorithms and diverse datasets. Our benchmark uses a two-phase approach via a data label improvement method in the first phase and a fixed evaluation model in the second phase. Thereby, we give a measure for the relation between the input labeling effort and the performance of (semi-)supervised algorithms to enable a deeper insight into how labels should be created for effective model training. Across thousands of experiments, we show that one annotation is not enough and that the inclusion of multiple annotations allows for a better approximation of the real underlying class distribution. We identify that hard labels can not capture the ambiguity of the data and this might lead to the common issue of overconfident models. Based on the presented datasets, benchmarked methods, and analysis, we create multiple research opportunities for the future directed at the improvement of label noise estimation approaches, data annotation schemes, realistic (semi-)supervised learning, or more reliable image collection. + +# 1 Introduction + +High-quality data is the fuel of modern machine learning and almost all models improve with higher quality data [8, 80, 50]. Therefore, such data are a key component for developing future techniques. The acquisition of a large amount of data is considered particularly challenging due to the participation of humans in the process. Their mistakes or subjective interpretations of annotation tasks can lead to noisy or ambiguous labels, respectively [54, 16, 61, 28, 52, 9, 18, 29]. Consequently, the labels suffer from heteroscedastic aleatoric uncertainty which means that the data contains inherent noise, which is class- or even sample-dependent and negatively affects the quality [14]. + +In Figure 1, we present the impact of this uncertainty on the class "cat" in the CIFAR-10 dataset [32]. While all images have the same ground truth label in CIFAR-10, humans created agreeing annotations + +only with varying rates from four to 100 percent [54]. This means that individual annotations can be expected to be noisy as they diverge from the majority opinion. Furthermore, a majority vote across multiple annotations can not capture the ambiguity between different images. In some extreme cases (red borders), we even see a disagreeing majority vote across all annotators from the expected ground truth class. We raise the question if all images should be treated equally if human annotations show such varying certainties. Taking a data-centric perspective [47, 62, 45, 25], we investigate the data in contrast to only the model for answering this question. Specifically, we propose a data-centric image classification (DCIC) benchmark that indirectly measures a method's ability to identify noisy and ambiguous labels and correct them. DCIC consists of ten real-world datasets of different domains (see Figure 2) and multiple human annotations for each image. The benchmark focuses on a data-centric view of the image classification problem by separating the data quality improvement and the classification performance into two tasks. + +The main structure of the benchmark is divided into a Labeling and an Evaluation phase (see Figure 3a) which is comparable to established Teacher-Student-Approaches [70, 36]. Using this denotation, the benchmarked method will, as a teacher, improve labels during the first phase. These are then benchmarked in the second phase by analyzing their quality as training input to a student model. Be aware that we do not allow a knowledge transfer from the second phase to the first phase. + +In detail, during the Labeling phase, we use samples from the distribution of the above-mentioned annotations to get different realistic label estimates as an initialization. The task of the benchmarked method is to improve these estimates for better performance of an other classification model in the second phase. In that phase (Evaluation), the obtained labels are used as input for training a fixed model and its performance is measured on a testing subset of the original data. In contrast to common model-centric deep learning approaches (see Figure 3b), we can vary the initialization for the same method and better separate its performance from the data improvement. The fixed model is used for the evaluation to facilitate distinguishing between performance gains due to improved input data and better learning of the method itself. + +![](images/bcf3a023004a2d10556b0955bcf5e740e2a42a728d46eaf7872e18350357b13b.jpg) + +![](images/d19e3570594052986a1dc8c8d4fa79ad05c0ffb5ec3bfbc22b11d17cbef417ea.jpg) +Figure 1: Are all images showing a cat? - Based on their ground truth labels from CIFAR-10 [32] they should all be cats. However, we give the agreement rate with the class cat from [54] in the lower right corner and see a wide range from four to $100\%$ . Based on a majority vote, the last images (red border) would have not to be labeled as a cat but as dog, frog, dog, and deer, respectively. Based on these observations, we answer in our paper the question of whether all images should be treated equally as cats or if we should use multiple annotations and the resulting soft labels to capture this intrinsic noise and ambiguity. +Figure 2: Three example images for all datasets. Details about the statistics of the dataset are given in Table 1. + +Our benchmark is not only useful to evaluate existing methods, but will support research into algorithms for realistic datasets. Especially, it can bridge the research between semi-supervised learning and noise estimation based on realistic ambiguous noise patterns. We provide multiple algorithms as baselines and support the integration of more algorithms by common dataloaders for the two most popular deep learning frameworks: Tensorflow [1] and Pytorch [53]. We analyzed thousands of combinations of baseline methods, different initializations, and datasets. The obtained results confirm that the improvement of data quality leads to performance gains. Additionally, we investigated factors that influence the data quality and identified trends that lead to better learning of the underlying distribution. + +![](images/6edf6640e5b4ad87c6969eb45777bc867fb266063a8826efc0232172e6b1d562.jpg) +(a) Data-Centric (Ours) + +![](images/454a8d62e4aa6925fffce7a42dd2df175d7158f578bfd68cc69ffea86b47230d.jpg) +(b) Model-Centric (Common) +Figure 3: Comparison of our data-centric approach with the commonly used model-centric approach. The circles and arrows represent the available label information in addition to the corresponding images. The squares represent the methods which generate / change these label. There are two main differences between our and the common model-centric approach. Firstly, we also look at how the raw unlabeled data is initialized and thus how many annotations are required. Secondly, we use a fixed model to evaluate the output of the benchmarked method. These differences lead to a greater separation of data quality and method performance on the final scores on the predicted labels. + +Our key contributions are: (1) We collected and created ten real-world image classification datasets with multiple annotations per image. These annotations allow a realistic simulation of noise patterns and will be helpful for future research in machine learning on real world data sets. (2) We provide a multi-domain benchmark based on these datasets for noisy and ambiguous label estimation. We implemented 20 methods as comparison. The benchmark also covers the topic of cost and bridges research between semi-supervised learning and ambiguous label estimation. (3) We show that one annotation per image is not enough because model performance improves as more labels are given for each input. We identify that the current focus on hard labels for classifications is ill-suited to learn the underlying ground truth distribution. A change in data preprocessing especially in annotation protocols could mitigate this and lead to less overconfident models. + +# 1.1 Related Work + +Human annotations of one image can differ due to complex reasons. Next to mere individual errors, cognitive sciences have shown that human judgement under uncertainty is driven by a subjective bias and the context of the annotation process [66]. As labeling relies on human perception, data quality problems, including issues with noisy and ambiguous labels, have been broadly discussed in the literature [68, 4, 54, 77, 3]. While voting strategies have proven to be robust tools to remove outlying annotation errors in a single label scenario, they also eliminate subjective disagreement, even in cases with more than just one valid interpretation [56]. The impact of this information loss has been discussed in numerous studies, indicating limitations in capturing ground truth by just one label [71, 17, 22, 6]. We empirically support these arguments across 9 datasets and 20 methods. + +As label noise can severely degrade the classification performance [50], learning with flawed training data has become a substantial field of research in which numerous strategies have been proposed: while sample selection methods separate clean and noisy data by evaluating small-loss or disagreement [78, 79], correction methods aim at relabeling wrongly assigned labels by either learning class prototypes [24] or by pseudo-labeling strategies that utilize confident predictions [38]. Multiple methods have been proposed, but are often evaluated on synthetic noise [44, 40]. However, Wei et al. showed that synthetic noise is different from real noise by humans, which limits the generality of findings [77]. Gao et al. proposed synthetic annotators with individual labeling behavior instead of random noise to reduce uncertainty in predictions [20]. We go beyond this by using human annotations to reproduce realistic noise pattern and we do not only look at annotation errors but also at ambiguous annotations from subjective interpretations. + +Datasets like CIFAR-10H [54] and CIFAR-10N [77] address the problem of realistic noise by providing multiple annotations per image for example of the original CIFAR-10 dataset. By doing so, both publications demonstrate an improved performance and a higher robustness, while also claiming that further research in dealing with human noise is still inevitable. The utilization of soft label distributions instead of hard one-hot label encodings enables the detailed representation of subjective disagreement and improves the generalization with ambiguous datasets [54, 5, 34]. In our benchmark, we extend this idea to eight diverse datasets apart from CIFAR-10 for a broader evaluation. + +If we want to use multiple annotations per image, we need to consider the cost of such annotations to make it feasible in a project. Current research such as semi-supervised learning [12, 67, 64, 63] could + +be used to analyze only a portion of the data with multiple annotations. However, approaches which combine noisy labels with semi-supervised learning have not been extended to real-world image classification tasks or do not consider the possibility that one labels is not enough to capture the ambiguity of subjectivity [42, 81, 76]. We provide with our benchmark the datasets and infrastructure to bridge the research between semi-supervised learning and noise estimation. + +Prediction uncertainty can be attributed to unexplainable noise in the given training or test dataset (aleatoric uncertainty) or a wrong model inference (epistemic uncertainty) and it can be difficult to approximate and differentiate between them [58, 2, 72, 30]. Several real-world noisy datasets have been utilized as a foundation for classification benchmarks [41, 39, 54], Song et al. provide a current survey on datasets and methods [68]. Moreover, most robust methods are evaluated based on the test set accuracy [40, 68, 77, 59, 82]. However, even a small change in the structure or parameters of a method can directly impact its performance, limiting the comparability [31]. Other fields, such as Bayesian Neural Networks, address this issue by comparing results to statistical simulations, for example [27]. A recent benchmark [49] tries to overcome this issue by providing a baseline for noisy labels as a form of uncertainty estimation [14]. However, this benchmark relies on synthetic noise or noisy datasets without knowledge about the underlying ground truth distributions [41]. We use a data-centric approach to minimize the impact of implementation detail differences and measure the impact of the data indirectly during the Labeling phase by evaluating on a fixed model. + +# 2 Benchmark + +Our benchmark is divided into two major phases: Labeling and Evaluation. In alignment with the Data-Centric Idea [47], we separate the improvement of the data (Labeling) from the improvement of the models (Evaluation). The benchmark can be utilized to analyze a variety of research questions, but we focus on evaluating methods that estimate noisy or ambiguous labels. + +We use the terms noisy and ambiguous throughout this work synonymously because we often do not differentiate between their cause during the annotation process. As mentioned above, these causes are errors or mistakes of human annotators which can be recovered for noisy label or noise. Subjective interpretations, imprecise task descriptions or poor image quality lead to ambiguous labels. + +In general, we have an image dataset $X$ with $k$ known classes and use human annotations to approximate the image labels. Each image $x \in X$ has an often unknown soft ground truth label $\hat{l}_x \in [0,1]^k$ . Therefore, we use $N$ hard human annotations $a_i \in \{0,1\}^k$ with $i \in 1,\dots,N$ as estimates of $\hat{l}_x$ . We assume that an average of annotations $(l_x = \sum_{i=0}^{N} \frac{a_i}{N})$ is an approximation of this target label $\hat{l}_x$ as in [64]. Based on this definition, an annotation $a_i$ or hard label sampled from the distribution $l_x$ are in general of lower quality because they can not capture the aleatoric uncertainty of the soft label $l_x$ . We split the data equally and randomly in five folds and ensure a similar class distribution between the folds as best as possible. For one run, we use three folds as training $(X_T)$ and one fold each as validation $(X_V)$ and test $(X_E)$ data, respectively. We call such an assignment of folds to the training, validation and test data slice. + +Labeling The Labeling phase consists of two steps. In the first step an initialization is used to get label estimates and in the second step, the benchmarked method $\Theta$ aims to improve these labels. As initialization, we acquire $m\in \mathbb{N}$ annotations for $n\in [0,100]$ percent of the training and validation images. + +We call the total number of required annotations budget $b = m \cdot n$ and report it as proportions of training and validation images $(|X_T \cup X_V|)$ . In general, a classification task gets easier with more annotations or a higher budget. Be aware that the same initialization results in the same budget while the same budget can be achieved by different initializations. + +The used initialization schemes per method are defined later in this section. We chose fixed initialization schemes for better comparability between the methods. How these labels are improved by the method $\Theta$ is not restricted. However, annotations aside from the given initialization are not allowed to be used. Since we measure the quality by training a different fixed network in the next phase, a good label would be presumably as close as possible to $l_{x}$ . + +Table 1: Overview of the used datasets - # is an abbreviation for number. The class imbalance is given as the percentage of the smallest and largest class with regard to the complete dataset. The agreement is the percentage of annotations that agree with the majority vote. The scores ACC and $\hat{A C C}$ are given for the supervised baseline across three test folds. The access describes if the (raw) data is available openly, requires permission (restricted) or was not previously available (N/A). In the last column, datasets with modifications to the original data are marked with X. A modification might be adding more annotations or crop images to a region of interest. + +
Name# classesInput size [px]# ImagesClass Imbalance [%]Agreement [%]# AnnotationsACC [%]AICC [%]AccessUpdated
SmallestLargestMean ± STDMean ± STDMean ± STDMean ± STD
Benthic10112×11248672.3139.6682.61 ± 19.674.54 ± 2.0164.17 ± 0.6383.36 ± 0.47RestrictedX
CIFAR-10H1032×32100009.8810.1695.44 ± 8.9151.10 ± 1.5490.75 ± 0.3995.72 ± 0.12Open
Mice Bone3224×224724014.7570.4885.06 ± 17.5215.30 ± 21.9061.88 ± 9.4478.39 ± 1.95RestrictedX
Pig496×96102377.8241.2365.32 ± 19.507.26 ± 2.2935.97 ± 3.6164.77 ± 0.79N/AX
Plankton1096×96122804.1630.3793.26 ± 13.6024.38 ± 44.1789.89 ± 0.8292.41 ± 0.41Restricted
Quality MRI2224×22431034.8464.1671.56 ± 12.2799.94 ± 13.4466.62 ± 3.5575.81 ± 0.17RestrictedX
Synthetic6224×2241500016.1717.5774.41 ± 24.2898.86 ± 0.9987.85 ± 0.4874.65 ± 0.34N/AX
Treediversity#16224×22494899.9830.6788.60 ± 16.1314.78 ± 7.0679.50 ± 1.5389.20 ± 0.31OpenX
Treediversity#66224×22498268.7731.2666.53 ± 19.4835.45 ± 11.4756.71 ± 4.8968.88 ± 0.72OpenX
Turkey3192×192804010.8875.9591.56 ± 13.8214.85 ± 20.9575.51 ± 2.8086.89 ± 1.03RestrictedX
+ +Evaluation In the Evaluation phase, the model and its hyperparameters are fixed to measure only the impact of the provided labels $(\Theta(x))$ . The training of this fixed model $\Phi$ is calculated on the provided $\Theta(x)$ with $x \in X_T$ . The best network parameters during training are selected based on a minimal divergence between $\Phi(x)$ and $\Theta(x)$ with $x \in X_V$ . The generalization is then tested by measuring the difference between $\Phi(x)$ and $l_x$ for $x \in X_E$ . + +Metrics Kullback-Leibler divergence $(KL)$ [35] between $\Phi(x)$ and $l_x$ for $x \in X_E$ has been used as our main metric since it is an established method to measures the difference between two distributions [48]. We averaged in a 3-fold cross-validation per dataset for a high reproducibility. We used the three slices defined by $X_{V_i} = \{f_{i+1}\}$ , $X_{E_i} = \{f_{i+2}\}$ and the rest as training $(X_{T_i} = \{f_i, f_{((i+2)\%) + 1}, f_{((i+3)\%) + 1},\}$ with $\%$ for modulo) for the folds $f_1, \ldots, f_5$ with $i \in 1, 2, 3$ as the index of the slices. While $KL$ directly allows to measure the desired distribution divergence, we provide additional metrics as comparisons. We evaluate the accuracy (ACC) and F1-Score (F1) between $\Phi(x)$ and $l_x$ for $x \in X_E$ per class and report the mean across the classes, which is commonly called the macro value and allows evaluation even in the presence of class imbalance. We used the most likely class based on the evaluated distributions for these metrics. We analyze the calibration of the models by reporting the Expected Calibration Error (ECE) [23]. As reference, we provide all of these metrics also on the difference between the proposed label before the second training $\Theta(x)$ and the expected ground-truth $l_x$ for $x \in X_E$ . The metrics are noted as $\hat{A C C}, \hat{F 1}$ and $\hat{E C E}$ . We report the Cohen's Kappa Score $(\kappa)$ [46] as the measurement of the consistency of $\Theta(x)$ between the folds because more consistent labels result in higher model performance. + +Datasets We include ten real-world classification datasets in our benchmark. Since we need multiple annotations per image for the evaluation of the quality of labels and this information is often not available in existing datasets or insufficient for our benchmark, we collected, adopted, or extended annotations of the following datasets. Their details are shortly described below, while their properties and exemplary images are shown in Table 1 and Figure 2, respectively. As presented, the datasets vary across all reported properties, giving an opportunity to comprehensively evaluate considered methods. More challenging datasets are characterized by a high-class imbalance, a low average agreement, or a low number of annotations per image. Detailed reports about the collection process and remaining dataset specifics are given in the supplementary. + +1. Benthic depicts images from the seafloor and consists of underwater flora and fauna. We used annotations from [65, 37] but filtered for at least three annotations per object and cropped the main image to this object. We combined classes with too few images in agreement with domain experts. 2. CIFAR-10H is a variant of CIFAR-10 [32] introduced in [54]. Peterson et al. analyzed the underlying class distribution like us by reannotating the CIFAR-10 test set. In contrast to other variants like CIFAR-10N [77], this dataset provides more annotations per image. 3. MiceBone consists of Second-Harmonic-Generation images of collagen fibers in mice [60]. The raw images were preprocessed as described in [64]. Since there is a need for multiple annotations per image, we hired workers to increase their number by a factor of five. 4. Pig consists cropped tail images from European farms. The annotations were collected by hired workers with high domain knowledge. The goal is + +Table 2: Overview of used methods grouped into supervised, semi-supervised and self-supervised. The second to fifth column describe if the method uses unlabeled data, makes noise estimation, what pretraining is the used input of the initialized dataset are hard or soft labels, respectively. The initialization schemes columns describe which schemes were evaluated for individual methods. The average runtime of the labeling phase is given in the last column. + +
NameUnlabeled DataNoise EstimationPretrainingLabelsInitialization SchemesAvg. Runtime [h]
SLSL+SSLSSL+
BaselineSoftXXXX0.00
Heteroscedastic (Het) [15]XHardXXXX0.50
SNGP [43]XHardXXXX0.29
ELR+ [44]XImageNetHardXXXX0.09
Mean-Teacher (Mean) [70]XHardXX1.08
Mean-Teacher (Mean+DC3) [64]XHardXX1.20
π-Model (π) [36]XHardXX1.03
π-Model (π+DC3) [64]XHardXX1.15
FixMatch [67]XHardXX4.53
FixMatch +DC3 [64]XHardXX4.01
Pseudo-Label (Pseudo v1) [38]XHardXX1.10
Pseudo-Label (Pseudo v1 +DC3) [64]XHardXX1.40
Pseudo-Label (Pseudo v2 hard) [38]XImageNetHardXXXX0.16
Pseudo-Label (Pseudo v2 soft) [38]XImageNetSoftXXXX0.12
Pseudo-Label (Pseudo v2 not) [38]XSoftXXXX0.12
DivideMix [40]XXImageNetHardXXXX1.39
BYOL [21]XSelf-SupervisedHardXX2.59
MOCOV2 [13]XSelf-SupervisedHardXX7.94
SimCLR [11]XSelf-SupervisedHardXX5.89
SWAV [10]XSelf-SupervisedHardXX4.17
+ +the classification of the injury degree of the tail. 5. Plankton is a collection of underwater plankton images with multiple annotations from citizen scientists [61]. We use the preprocessing described in [64]. 6. QualityMRI consists of human magnetic resonance images (MRI) with a varying quality and multiple subjective quality ratings gathered in tests with radiologists. It was introduced and evaluated in [51, 69]. 7. Synthetic dataset was generated for the purpose of this study. It consists of images that contain one blue, red, or green circle or ellipse on a black background. To create ambiguous images, we added color and axis interpolations of these classes. $8 + 9$ . TreeVersity is a publicly available crowdsourced dataset of plant images from the Arnold Arboretum of Harvard University3. In the crowdsourcing project, the images were tagged with a given set of labels. We used a simplified version with six classes where we combined classes with too few images. Only images with at least three tags were used. Tags are not the same as class labels, therefore, we provide two subsets of TreeVersity. In TreeVersity#1, we filtered for exactly one given tag of the six possible ones per user which is similar to a classification. In TreeVersity#6, we filtered for a maximum of six different tags which means we did not apply any restrictions. 10. Turkey is a dataset with images of turkeys and their injuries [74, 75]. We used the preprocessing described in [64] and extended the original annotations, increasing their number by a factor of five with hired workers. + +Methods We compare a variety of recent supervised, self-supervised, and semi-supervised algorithms against our baseline. The baseline does not adjust the initialized dataset in the first phase in any way and just forwards these labels to the supervised training of the second phase. Thus it is equivalent to supervised learning in a model-centric benchmark. We selected the other methods based on their recency, access to authors code or reimplementations and if they are state-of-the-art or commonly used as comparisons in the literature. The supervised methods are Heteroscedastic [15], SNGP [43], and $\mathrm{ELR + }$ [44]. The semi-supervised methods are Mean-Teacher [70], $\pi$ -Model [36], FixMatch [67], DC3 [64], Pseudo-Label [38], and DivideMix [40]. The self-supervised methods are BYOL [21], MOCOv2 [13], SimCLR [11], and SWAV [10]. Detailed descriptions about most of them are given in [63] and their key characteristics are presented in Table 2. We use the reported hyperparameters for Imagenet [33] or Webvision [41] by the original authors to ensure a comparison out-of-the-box across different image domains. For DC3[64], we investigated the combinations with Mean-Teacher, $\pi$ -Model, FixMatch, and Pseudo-Label. For Pseudo-Label, we used two different implementations (v1 and v2) and variants with or without pretraining and soft or hard labels as input. In total, this results in 20 investigated methods. For better referencing, we group them as described above but put methods that use soft labels into their own group. + +Initialization Schemes We investigated a fixed set of initialization schemes and note them $m - n$ for $m$ annotations for a subset of data with a relative size $n$ . For easier reference, we group them as + +Supervised Learning (SL) 01-1.00 +Supervised Learning $^+$ $(SL + )$ 03-1.00, 05-1.00, 10-1.00 +- Semi-Supervised Learning (SSL) 01-0.10, 01-0.20, 01-0.50 +- Semi-Supervised Learning (SSL+) 10-0.10, 05-0.20, 02-0.50 + +Implementation Details The final results depend on a good set of fixed hyperparameters like learning rate for the model $\Phi$ for each dataset during the evaluation. Therefore, we determined them by applying Hyperopt [7] with 100 search trials across the same grid of parameters for all datasets. The target was the minimization of $KL$ between $\Phi(x)$ and $l_x$ for the baseline experiment with exactly ten annotations per image across one slice. We executed these and later experiments on an Nvidia RTX 3090 with 24GB VRAM or comparable hardware. Some combinations of models and input sizes could not fit on this hardware and therefore were ignored to keep the needed hardware to a minimum. Details about the used parameter grid are given in the supplementary. We ensure that all folds are randomly generated, while restrictions about similar images are considered. Without these restrictions, similar images, e.g., frames from the same camera might lead to an information leakage between the folds which would negatively influence the interpretability of the results. + +# 3 Analysis + +The evaluation was conducted across combinations of all datasets, methods, initialization schemes, and slices. A complete cross-combination would result in 5400 experiments from which we selected 3456 experiments to save resources since some combinations would not add more insights e.g. due to inferior performance of similar methods. A detailed overview of the initialization schemes used per method can be found in Table 2. As shown in Table 1, we have a large variability between the datasets, especially in $ACC$ and $\hat{A C C}$ that range from $36\%$ to $96\%$ for the baseline. Due to the fact that the baseline does not adjust the initialization, $A\hat{C}C$ can be seen as the performance of humans in improving the labels for the given budget. The datasets Benthic, MiceBone, Pig, Treeverity#6, and Turkey have an over $10\%$ lower $ACC$ than the expected $A\hat{C}C$ , which marks them as particularly challenging for the model. Moreover, the datasets Benthic, MiceBone, Pig, QualitMRI, and Treeverity#6 have an $A\hat{C}C$ of lower than $85\%$ which marks them as difficult even for humans. The $A\hat{C}C$ of Synthetic is even lower due to the artificially created labels. Due to this variability, an average across the scores can be misleading. For this reason, we report the median in this paper and report the full results including the standard error of the mean (SEM) in the supplementary. + +What metrics should we use? We analyzed the correlations between our metrics to determine which contain the same or similar information and which are complementary. All calculated Pearson correlation coefficients have a p-value $< 0.01$ and the four strongest correlations are $ACC$ vs. $F1$ (0.99), $KL$ vs. $ECE$ (0.68) $F1$ vs. $\kappa$ (0.77) and $ACC$ vs. $\kappa$ (0.77). The other correlations are around -0.5. Selected correlations are illustrated in Figure 4 and additional graphics and analysis are given in the supplementary. $F1$ balances the precision and recall but in our experiments we see almost identical values to $ACC$ which we credit to the averaging per class. This means we only need to concentrate on $ACC$ as a classification score. Overconfident models are a problem of modern machine learning [23] and the higher correlation between $KL$ and $ECE$ compared to any of the two with $ACC$ , $F1$ or $\kappa$ indicates that our focus on classification metrics like $ACC$ and $F1$ could be the issue. Only metrics like $KL$ and $ECE$ consider the complete distribution and which justifies using mainly $KL$ for the evaluation of this benchmark. + +One annotation is not enough It is to be expected that more and better data should lead to increased performance which we quantify in Figure 5a. It can be seen that all metrics improve with an increased budget in the form of more annotated data or more annotations per image. However, the impact is lower for more annotations per image. For example, $ACC$ increases from around $55\%$ to $69\%$ for the full supervision. Up to 10 annotations per image increase the score only to around $72\%$ . This difference can be explained by the fact that additional annotations are most valuable to improve uncertain labels. In alignment with previous research [71, 22, 6], these results across thousands of + +![](images/2f0229d59505bcebc017fc56468ebd0b0aea676634d169e89534fb83a5e3dc41.jpg) +(a) $ACC$ vs. $F1$ + +![](images/deb2ea423744800bf39bec92a119be19f7b57be3118311b503e139e6ed9795e7.jpg) +(b) $KL$ vs. $ECE$ + +![](images/39e72d0b857bbf30636a7fe68fbb7e8b3b76fcb9e17b2439b0457b7dc95208f7.jpg) +(c) ACC vs. ECE + +![](images/4a7ffcbedfbec47291289a2cb3163ceb17d987115683427d37ddc9d3fcd88c12.jpg) +Figure 4: Correlations between selected metrics across all experiments. The red line represents the linear regression between the metrics and the light red area the mean absolute error of the regression. +(a) Transfer Learning +Figure 5: Analysis of all or selected methods across different budgets or initialization schemes. For details about the definitions see section 2. The orange crosses in (c) represent the best performance of Pseudo v2 soft with another initialization scheme see (b). The budget is increased by an raised portion of labeled data $(n)$ until 1.00 and then increased further by using additionally multiple annotations per image $(m)$ . + +![](images/3cc563ddab123e2c53649533c4a0d6c9993845b74a1152fac40a490eb4cb51db.jpg) +(b) Quantity vs. Quality + +![](images/e1536bccb224f0c6d743e9a35f3699d0d014830c22a15be25596176ea6c415ea.jpg) +(c) Method comparison + +experiments empirically justify that one annotation is not enough to capture the ground-truth of an item. Some improvements can be gained from correction annotation errors via a majority vote but the high disagreement and low $A\hat{C}C$ of the baseline on some datasets support the hypothesis that ambiguous annotations are a main source for the improvement. This ambiguity can not be described with a single hard majority vote and thus highlights the importance of using soft labels. Additionally, we see that $KL$ is about half as small as $\hat{KL}$ , $ECE$ is around 3-10% lower than $E\hat{C}E$ and $ACC$ is 1-2% better than $A\hat{C}C$ . As shown previously by Hinton et al. [26, 12] the knowledge distillation via a neural network into soft labels can be beneficial for $ACC$ . We find the impact for metrics like $KL$ and $ECE$ even higher which supports our design of a two-phase benchmark. + +Limits of current state-of-the-art To determine the best-performing state-of-the-art method, we gathered their relative improvements over the baseline in Table 3a. The best algorithm for each type of the soft, semi-supervised, supervised, self-supervised approaches based on the average performance across the budgets of $10\%$ , $100\%$ , and $1000\%$ are Pseudo v2 soft, DivideMix, $\mathrm{ELR+}$ , and Mocov2, respectively. We visualize the best three of them in Figure 5c and give detailed results across the datasets for the budget $100\%$ in Table 3b. The full results can be found in the supplementary. All top three methods are pretrained on ImageNet and outperform the rest in the field they were designed for. DivideMix is the best during partial supervision (budget $< 100\%$ ), $\mathrm{ELR+}$ is more noise robust (budget $>100\%$ ), and Pseudo v2 soft has the lowest $KL$ score (budget $>100\%$ ). It is important to note that ImageNet pretraining leads to improvements on many datasets (see Pseudo v2 not in the supplementary) but also to worse results on others. It needs to be investigated if other pretraining such as CLIP [55] or unsupervised pretraining on larger datasets [12, 57] could improve on these results. Overall, the current state-of-the-art methods are insufficient for a label preprocessing across all domains. For a high budget any investigated method is worse than the supervised baseline without adjustments of the initialized dataset which shows the lack of appropriate algorithms for such budgets. + +Table 3: Results for the best performing methods – The best metric is marked bold while the 2nd and 3rd best are italic. Only methods with at least one top3 ranking across the budgets are presented. The full results are in the supplementary. (a) show the relative improvement over the baseline. (b) are detailed results for the budget of $100\%$ across all datasets. +(a) Improvements + +
Budget10%100%1000%DatasetBenthicCIFAR10HMicebonePigPlanktonQualiteMR1SyntheticTraversity#1Treeness#6Turkey
MedianMean ± SEMMedianMean ± SEMMedianMean ± SEM
ELR+-0.16-0.59 ± 0.22-0.13-0.17 ± 0.060.150.24 ± 0.06Baseline1.17 ± 0.040.41 ± 0.020.55 ± 0.060.75 ± 0.050.34 ± 0.021.73 ± 0.480.08 ± 0.010.49 ± 0.041.02 ± 0.030.40 ± 0.08
ELR+-0.16-0.59 ± 0.22-0.13-0.17 ± 0.060.150.24 ± 0.06ELR+0.79 ± 0.010.29 ± 0.020.29 ± 0.010.62 ± 0.090.24 ± 0.031.44 ± 0.830.18 ± 0.020.46 ± 0.010.47 ± 0.050.52 ± 0.05
DivideMix-0.21-0.78 ± 0.25-0.03-0.17 ± 0.080.160.31 ± 0.07SGNP1.11 ± 0.050.38 ± 0.010.56 ± 0.140.77 ± 0.070.33 ± 0.020.25 ± 0.140.10 ± 0.000.46 ± 0.011.07 ± 0.050.42 ± 0.08
Mean-0.14-0.59 ± 0.22-0.12-0.22 ± 0.08N/ADivideMix0.87 ± 0.060.43 ± 0.050.54 ± 0.050.64 ± 0.040.32 ± 0.020.29 ± 0.050.11 ± 0.010.09 ± 0.010.51 ± 0.010.46 ± 0.03
π-0.33-0.63 ± 0.19-0.06-0.17 ± 0.05N/Aπ0.71 ± 0.070.33 ± 0.030.38 ± 0.020.80 ± 0.130.30 ± 0.020.98 ± 0.040.08 ± 0.010.52 ± 0.010.51 ± 0.030.55 ± 0.01
π+DC3-0.32-0.62 ± 0.20-0.10-0.22 ± 0.06N/Aπ+DC30.72 ± 0.060.39 ± 0.020.39 ± 0.040.67 ± 0.060.29 ± 0.010.38 ± 0.040.08 ± 0.010.48 ± 0.010.49 ± 0.000.44 ± 0.08
Pseudo v2 + hard-0.28-0.49 ± 0.19-0.16-0.27 ± 0.080.190.28 ± 0.04Pseudo v2 hard0.97 ± 0.100.49 ± 0.020.48 ± 0.100.67 ± 0.040.29 ± 0.030.19 ± 0.010.46 ± 0.010.49 ± 0.010.59 ± 0.090.39 ± 0.05
Pseudo v2 soft-0.28-0.40 ± 0.19-0.04-0.17 ± 0.060.010.00 ± 0.02Pseudo v2 soft1.00 ± 0.080.41 ± 0.020.40 ± 0.080.70 ± 0.060.32 ± 0.060.62 ± 0.160.10 ± 0.010.46 ± 0.010.83 ± 0.130.37 ± 0.08
MOCov2-0.29-0.63 ± 0.22-0.08-0.13 ± 0.10N/AMOCov20.91 ± 0.050.98 ± 0.020.37 ± 0.040.56 ± 0.010.52 ± 0.010.29 ± 0.110.13 ± 0.010.80 ± 0.030.61 ± 0.010.42 ± 0.08
+ +(b) Details $100\%$ Budget + +Moreover, an average better performance does not mean that the gains are equal across all datasets. For example, $\mathrm{ELR + }$ has the lowest KL at a budget of $100\%$ for five out of ten datasets but on the QualityMRI dataset, it is among the worst methods. This means while some methods might work on some datasets they might not generalize to other datasets. Overall, we see the highest $KL$ for the datasets Benthic, Pig, Quality MRI and Treeversity#6 which also have the lowest agreement as seen in Table 1 except for the synthetic dataset. These datasets also show the largest variance in results across the methods. We conclude that the impact of the data is larger than the impact of the current preprocessing of state-of-the-art methods. This highlights the importance for investigating the data and label generation more if they a more impactful than the method itself. + +While a higher budget leads to improved metrics, it also matters how it is used. In Figure 5b, we investigated the impact on $KL$ and $ACC$ for a budget of $100\%$ for Pseudo-Label using hard or soft labels. We find that the accuracy is comparable between the methods and increases with a rising percentage of labeled data ( $m$ ). For hard labels, the $KL$ improves equally. If we use soft labels for training, we see lower results for 05-0.20 and 10-0.10. We conclude that we should investigate more how we distribute our budget if increasing it is not an option. + +# 4 Discussion + +Overall, we can confirm several previous research hypotheses while identifying missing information and thus new research opportunities with our novel datasets and benchmark. + +We can demonstrate that data quality positively impacts the classifications scores like $ACC$ and $F1$ and distribution-based scores like $KL$ and $ECE$ . Knowledge distillation can improve the approximation of the underlying distribution further. We agree with previous research [71, 17, 22, 6] that one annotation is not enough and we need to use soft labels to handle ambiguous data. $KL$ and $ECE$ are highly correlated (0.7) and are improved more when using soft labels. We believe that focusing on learning the real distribution and thus minimizing $KL$ can lead to less overconfident models. Using soft labels as input seems to be crucial for achieving this since hard labels and classification metrics like $ACC$ lead to models which slightly ignore the real ground truth distribution. + +Nevertheless, most of the investigated state-of-the-art method do not use soft labels and often interpret noise only as errors in the annotation process. These issues need to be addressed in future research and a simple method like Pseudo v2 soft illustrates how the $KL$ score can be lowered with this approach. For the largest budget, the baseline is the best model and even special noise estimation algorithms like $\mathrm{ELR} + [44]$ and SNGP [43] can not achieve better results. We see a high variance across the datasets for different methods in our benchmark. However, we need methods which work across a variety of domains out-of-the-box to allow an easy application to current research question in other domains. Another practical issue is that we need to find solutions for acquiring soft labels even with a limited budget. In many research projects, it is difficult to annotate thousands of images with domain experts and annotating them multiple times would only increase the costs further. Thus, we need to bridge the research in semi-supervised learning and ambiguous and noise estimation. Such combinations could allow the usage of soft labels on a subset of images and simultaneously determine annotation errors. Our benchmark and datasets allowed the identification of these issues and thus could also be used to research new methods to solve these issues. We are confident that our benchmark and datasets can facilitate the bridged research on the topic of semi-supervised learning and ambiguous image estimation for real world image classification problems. + +Impact This work as a benchmark provides ten datasets and a detailed evaluation across 20 algorithms on this benchmark. The provided data can allow the investigation of research questions on the topics of e.g. noise estimation, data annotation scheme, or realistic semi-supervised learning. This work is intended to allow and spark future research and thus no direct social impacts are expected. However, this basic research is time and resource-consuming. For the final evaluation, we conducted experiments with about 5500 GPU hours which equals around $600\mathrm{kg}CO_2$ . For this reason, we limited the evaluation always to necessary elements when possible in order to not increase the needed GPU hours further. + +**Limitations** The 20 investigated algorithms are only evaluated with one fixed set of hyperparameters across different datasets during the labeling phase. For optimal performance, a tuning per algorithm would have been required. We were interested in the general performance out-of-the-box and therefore neglected this issue due to resource minimization. The researched datasets are all below 15,000 images and the unsupervised learning potential on millions of images could not be investigated. We want to provide a detailed analysis in relation to the underlying distribution $l_{x}$ per image which is only possible with multiple annotations per image. For larger datasets, this effort was just not feasible. Classification with hundreds or more classes are also not feasible because the annotation costs increase with the number of classes. As described above we conducted more than a thousand experiments but we had to select and combine several results in a comprehensive manner in this paper. These aggregations can not capture all details. Much more detailed analysis e.g., per dataset would be possible and thus we included all raw results in the supplementary. Due to the fixed initialization scheme, we can not investigate active learning approaches. However, this restriction is chosen to allow a better comparability and future researchers could decide against such a restriction. + +Conclusion In alignment with previous research, we show that one annotation is not enough to handle ambiguous and noisy images and their underlying ground truth distribution. Multiple annotations and some kind of soft label are required to capture the difference in the images. Future research needs to investigate in more detail how annotations are being created, including annotation costs. We show that current state-of-the-art can help under certain budget or dataset constraints. However, methods with consistent results across a variety of datasets and budgets are missing. We release all datasets and the benchmark publicly to enrich future research on these topics. + +# Acknowledgments and Disclosure of Funding + +We thank Mark Collier for his valuable feedback and discussion about the benchmark. We thank the annotators Kristina Ahlqvist, Daniel Grundig, Stine Heindorff, Jana Krambeck, Kathrin Korner, Richard Lange, Miina Tuominen-Brinkas and Emirhan Ustalar for their valuable work. + +We acknowledge funding of L. Schmarje by the ARTEMIS project (Grant number 01EC1908E) funded by the Federal Ministry of Education and Research (BMBF, Germany). R. Kiko also acknowledges support via a "Make Our Planet Great Again" grant of the French National Research Agency within the "Programme d'Investissements d'Avenir"; reference "ANR-19-MPGA-0012". V. Grossmann is employed with funds provided by Kiel Marine Science (KMS) and Future Ocean Network (FON) by Kiel University. Funds to conduct the PlanktonID project were granted to R. Kiko and R. Koch (CP1733) by the Cluster of Excellence 80 "Future Ocean" within the framework of the Excellence Initiative by the Deutsche Forschungsgemeinschaft (DFG) on behalf of the German federal and state governments. Turkey data set was collected as part of the project "RedAlert - detection of pecking injuries in turkeys using neural networks" which was supported by the "Animal Welfare Innovation Award" of the "Initiative Tierwohl". + +# References + +[1] Martin Mart\`in Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, Manjunath Kudler, Josh Levensberg, Rajat Monga, Sherry Moore, Derek Murray, Benoit Steiner, Paul Tucker, Vijay Vasudevan, Pete Warden, Martin Wicke, Yuan Yu, Xiaoqiang Zheng, and Others. TensorFlow: A System for Large-Scale Machine Learning. In 12th USENIX symposium on operating systems design and implementation (OSDI 16), pages 265-283, 2016. + +[2] Moloud Abdar, Farhad Pourpanah, Sadiq Hussain, Dana Rezazadegan, Li Liu, Mohammad Ghavamzadeh, Paul Fieguth, Xiaochun Cao, Abbas Khosravi, U. Rajendra Acharya, Vladimir Makarenkov, and Saeid Nahavandi. A review of uncertainty quantification in deep learning: Techniques, applications and challenges. Information Fusion, 76:243-297, 2021. ISSN 15662535. doi: 10.1016/j.inffus.2021.05.008. +[3] P. F.E. E E Addison, D. J. Collins, R. Trebilco, S. Howe, N. Bax, P. Hedge, G. Jones, P. Miloslavich, C. Roelfsema, M. Sams, R. D. Stuart-Smith, P. Scanes, P. Von Baumgarten, and A. McQuatters-Gollop. A new wave of marine evidence-based management: Emerging challenges and solutions to transform monitoring, evaluating, and reporting. ICES Journal of Marine Science, 75(3):941-952, 2018. ISSN 10959289. doi: 10.1093/icesjms/fsx216. +[4] Görkem Algan and Ilkay Ulusoy. Image Classification with Deep Learning in the Presence of Noisy Labels: A Survey. Knowledge-Based Systems, 2020. ISSN 23318422. doi: 10.1016/j.knosys.2021.106771. +[5] Hessam Bagherinezhad, Maxwell Horton, Mohammad Rastegari, and Ali Farhadi. Label refinery: Improving imagenet classification through label progression. arXiv preprint arXiv:1805.02641, 2018. +[6] Valerio Basile, Michael Fell, Tommaso Fornaciari, Dirk Hovy, Silviu Paun, Barbara Plank, Massimo Poesio, and Alexandra Uma. We Need to Consider Disagreement in Evaluation. In BPPF, 2021. +[7] James Bergstra, Daniel Yamins, and David Cox. Making a science of model search: Hyperparameter optimization in hundreds of dimensions for vision architectures. In International conference on machine learning, pages 115-123. PMLR, 2013. +[8] Lucas Beyer, Olivier J. Henaff, Alexander Kolesnikov, Xiaohua Zhai, and Aaron van den Oord. Are we done with ImageNet? arXiv preprint arXiv:2006.07159, 2020. +[9] J Brünger, S Dippel, R Koch, and C Veit. 'Tailception': using neural networks for assessing tail lesions on pictures of pig carcasses. Animal, 13(5):1030-1036, 2019. ISSN 17517311. doi: 10.1017/S1751731118003038. +[10] Mathilde Caron, Priya Goyal, Ishan Misra, Piotr Bojanowski, Julien Mairal, and Armand Joulin. Unsupervised Learning of Visual Features by Contrasting Cluster Assignments. Proceedings of Advances in Neural Information Processing Systems (NeurIPS), 2020. ISSN 23318422. +[11] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A Simple Framework for Contrastive Learning of Visual Representations. arXiv preprint arXiv:2002.05709, (PMLR): 1597-1607, 2020. ISSN 23318422. +[12] Ting Chen, Simon Kornblith, Kevin Swersky, Mohammad Norouzi, and Geoffrey Hinton. Big Self-Supervised Models are Strong Semi-Supervised Learners. Advances in Neural Information Processing Systems 33 pre-proceedings (NeurIPS 2020), 2020. +[13] Xinlei Chen, Haoqi Fan, Ross Girshick, and Kaiming He. Improved Baselines with Momentum Contrastive Learning. arXiv preprint arXiv:2003.04297, 2020. +[14] Mark Collier, Basil Mustafa, Efi Kokiopoulou, Rodolphe Jenatton, and Jesse Berent. A Simple Probabilistic Method for Deep Classification under Input-Dependent Label Noise. arXiv preprint arXiv:2003.06778, 2020. +[15] Mark Collier, Basil Mustafa, Efi Kokiopoulou, Rodolphe Jenatton, and Jesse Berent. Correlated Input-Dependent Label Noise in Large-Scale Image Classification. Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, (c):1551-1560, 2021. +[16] Phil Culverhouse, Robert Williams, Beatrix Reguera, Vincent Herry, and Sonsoles González-Gil. Do experts make mistakes? A comparison of human and machine identification of dinoflagellates. *Marine Ecology Progress Series*, 247:17-25, 2003. doi: 10.3354/meps247017. +[17] Aida Mostafazadeh Davani, Mark Díaz, and Vinodkumar Prabhakaran. Dealing with Disagreements: Looking Beyond the Majority Vote in Subjective Annotations. 2021. + +[18] Jeffrey De Fauw, Joseph R Ledsam, Bernardino Romera-Paredes, Stanislav Nikolov, Nenad Tomasev, Sam Blackwell, Harry Askham, Xavier Glorot, Brendan O'Donoghue, Daniel Visentin, Others, Brendan O'Donoghue, Daniel Visentin, and Others. Clinically applicable deep learning for diagnosis and referral in retinal disease. Nature medicine, 24(9):1342-1350, 2018. +[19] Laurens der Maaten and Geoffrey Hinton. Visualizing data using t-SNE. Journal of machine learning research, 9(11), 2008. +[20] Zhengqi Gao, Fan-Keng Sun, Mingran Yang, Sucheng Ren, Zikai Xiong, Marc Engeler, Antonio Burazer, Linda Wildling, Luca Daniel, and Duane S. Boning. Learning from Multiple Annotator Noisy Labels via Sample-wise Label Fusion. 2022. +[21] Jean-Bastien Grill, Florian Strub, Florent Alché, Coretin Tallec, Pierre H. Richemond, Elena Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Daniel Guo, Mohammad Gheshlaghi Azar, Bilal Piot, Koray Kavukcuoglu, Rémi Munos, and Michal Valko. Bootstrap your own latent: A new approach to self-supervised Learning. Advances in Neural Information Processing Systems 33 pre-proceedings (NeurIPS 2020), 2020. +[22] Vasco Grossmann, Lars Schmarje, and Reinhard Koch. Beyond Hard Labels: Investigating data label distributions. ICML 2022 Workshop DataPerf: Benchmarking Data for Data-Centric AI, 2022. +[23] Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q Weinberger. On calibration of modern neural networks. In International Conference on Machine Learning, pages 1321-1330. PMLR, 2017. +[24] Jiangfan Han, Ping Luo, and Xiaogang Wang. Deep self-learning from noisy labels. In Proceedings of the IEEE/CVF international conference on computer vision, pages 5138-5147, 2019. +[25] Tony Hey. The Fourth Paradigm – Data-Intensive Scientific Discovery. In Communications in Computer and Information Science, pages 1–1. 2012. doi: 10.1007/978-3-642-33299-9_1. +[26] Geoffrey Hinton, Oriol Vinyls, and Jeff Dean. Distilling the Knowledge in a Neural Network. 2015. +[27] Pavel Izmailov, Sharad Vikram, Matthew D. Hoffman, and Andrew Gordon Gordon Wilson. What Are Bayesian Neural Network Posteriors Really Like? International Conference on Machine Learning, pages 4629-4640, 2021. +[28] Alain Jungo, Raphael Meier, Ekin Ermis, Marcela Blatti-Moreno, Evelyn Herrmann, Roland Wiest, and Maurizio Reyes. On the effect of inter-observer variability for a reliable estimation of uncertainty of medical image segmentation. In Medical Image Computing and Computer Assisted Interventions, MICCAI, pages 682–690. Springer, 2018. +[29] D Karimi, G Nir, L Fazli, P C Black, L Goldenberg, and S E Salcudean. Deep Learning-Based Gleason Grading of Prostate Cancer From Histopathology Images—Role of Multiscale Decision Aggregation and Data Augmentation. IEEE Journal of Biomedical and Health Informatics, 24 (5):1413-1426, 2020. doi: 10.1109/JBHI.2019.2944643. +[30] Alex Kendall and Yarin Gal. What Uncertainties Do We Need in Bayesian Deep Learning for Computer Vision? 2017. +[31] Alexander Kolesnikov, Xiaohua Zhai, and Lucas Beyer. Revisiting self-supervised visual representation learning. In Proceedings of the IEEE conference on Computer Vision and Pattern Recognition, pages 1920-1929, 2019. +[32] Alex Krizhevsky, Geoffrey Hinton, and Others. Learning multiple layers of features from tiny images. Technical report, 2009. +[33] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E. Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, volume 60, pages 1097-1105. Association for Computing Machinery, 2012. doi: 10.1145/3065386. + +[34] Ujwal Krothapalli and A Lynn Abbott. Adaptive label smoothing. arXiv preprint arXiv:2009.06432, 2020. +[35] S Kullback and R A Leibler. On Information and Sufficiency. Ann. Math. Statist., 22(1):79-86, 1951. doi: 10.1214/aoms/1177729694. +[36] Samuli Laine and Timo Aila. Temporal ensembling for semi-supervised learning. In International Conference on Learning Representations, 2017. +[37] Daniel Langenkämper, Robin van Kevelaer, Autun Purser, and Tim W Nattkemper. Gear-Induced Concept Drift in Marine Images and Its Effect on Deep Learning Classification. Frontiers in Marine Science, 7, 2020. ISSN 2296-7745. doi: 10.3389/fmars.2020.00506. +[38] Dong-Hyun Lee. Pseudo-label: The simple and efficient semi-supervised learning method for deep neural networks. In Workshop on challenges in representation learning, ICML, volume 3, page 2, 2013. +[39] Kuang-Huei Lee, Xiaodong He, Lei Zhang, and Linjun Yang. Cleannet: Transfer learning for scalable image classifier training with label noise. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 5447-5456, 2018. +[40] Junnan Li, Richard Socher, and Steven C. H. Hoi. DivideMix: Learning with Noisy Labels as Semi-supervised Learning. In International Conference on Learning Representations, pages 1-14, 2020. +[41] Wen Li, Limin Wang, Wei Li, Eirikur Agustsson, and Luc Van Gool. WebVision Database: Visual Learning and Understanding from Web Data. 2017. +[42] Zhenghua Li, Min Zhang, and Wenliang Chen. Ambiguity-aware Ensemble Training for Semi-supervised Dependency Parsing. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 457-467. Association for Computational Linguistics, 2014. doi: 10.3115/v1/P14-1043. +[43] Jeremiah Liu, Zi Lin, Shreyas Padhy, Dustin Tran, Tania Bedrax Weiss, and Balaji Lakshminarayanan. Simple and principled uncertainty estimation with deterministic deep learning via distance awareness. Advances in Neural Information Processing Systems, 33:7498-7512, 2020. +[44] Sheng Liu, Jonathan Niles-Weed, Narges Razavian, and Carlos Fernandez-Granda. Early-Learning Regularization Prevents Memorization of Noisy Labels. Advances in neural information processing systems, 33:20331–20342, 2020. +[45] Adam Marcu, Antonia; Prugel-Bennett. On Data-centric Myths. NeurIPS 2021 Data-centric AI workshop, 2021. +[46] Mary L McHugh. Interrater reliability: the kappa statistic. *PubMed, Biochemistry* (3):276-82, 2012. +[47] Mohammad Motamedi, Nikolay Sakharnykh, and Tim Kaldewey. A Data-Centric Approach for Training Deep Neural Networks with Less Data. NeurIPS 2021 Data-centric AI workshop, 2021. +[48] Kevin P Murphy. Machine learning: a probabilistic perspective. MIT press, 2012. +[49] Zachary Nado, Neil Band, Mark Collier, Josip Djolonga, Michael W Dusenberry, Sebastian Farquhar, Angelos Filos, Marton Havasi, Rodolphe Jenatton, Ghassen Jerfel, and Others. Uncertainty Baselines: Benchmarks for uncertainty & robustness in deep learning. arXiv preprint arXiv:2106.04015, 2021. +[50] Curtis G. Northcutt, Anish Athalye, and Jonas Mueller. Pervasive Label Errors in Test Sets Destabilize Machine Learning Benchmarks. 35th Conference on Neural Information Processing Systems (NeurIPS 2021) Track on Datasets and Benchmarks, 2021. +[51] Rafal Obuchowicz, Mariusz Oszust, and Adam Piorkowski. Interobserver variability in quality assessment of magnetic resonance images. BMC Medical Imaging, 20(1):109, 2020. ISSN 1471-2342. doi: 10.1186/s12880-020-00505-z. + +[52] E.A. A Ooms, H.M. M Zonderland, M.J.C. J C Eijkemans, M. Kriege, B. Mahdavian Delavary, C.W. W Burger, and A.C. C Ansink. Mammography: Interobserver variability in breast density assessment. The Breast, 16(6):568-576, 2007. ISSN 09609776. doi: 10.1016/j.breast.2007.04.007. +[53] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. PyTorch: An Imperative Style, High-Performance Deep Learning Library. In Advances in Neural Information Processing Systems 32, pages 8024–8035. Curran Associates, Inc., 2019. +[54] Joshua Peterson, Ruairidh Battleday, Thomas Griffiths, and Olga Russakovsky. Human uncertainty makes classification more robust. Proceedings of the IEEE International Conference on Computer Vision, 2019-Octob:9616-9625, 2019. ISSN 15505499. doi: 10.1109/ICCV.2019.00971. +[55] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning Transferable Visual Models From Natural Language Supervision. 2021. +[56] Sai Rajeswar, Pau Rodriguez, Soumye Singhal, David Vazquez, and Aaron Courville. Multilabel iterated learning for image classification with label ambiguity. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 4783-4793, 2022. +[57] Pierre H. Richemond, Jean-Bastien Grill, Florent Altché, Corentin Tallec, Florian Strub, Andrew Brock, Samuel Smith, Soham De, Razvan Pascanu, Bilal Piot, and Michal Valko. BYOL works even without batch statistics. arXiv preprint arXiv:2010.10241, 2020. +[58] Abhishek Singh Sambyal, Narayanan C. Krishnan, and Deepti R. Bathula. Towards Reducing Aleatoric Uncertainty for Medical Imaging Tasks. 2021. +[59] Monty Santarossa, Ayse Kilic, Claus von der Burchard, Lars Schmarje, Claudius Zelenka, Stefan Reinhold, Reinhard Koch, and Johann Roider. MedRegNet: unsupervised multimodal retinal-image registration with GANs and ranking loss. In Medical Imaging 2022: Image Processing, volume 12032, pages 321-333. SPIE, 2022. +[60] Lars Schmarje, Claudius Zelenka, Ulf Geisen, Claus-C. Glüer, and Reinhard Koch. 2D and 3D Segmentation of uncertain local collagen fiber orientations in SHG microscopy. DAGM German Conference of Pattern Regocnition, 11824 LNCS(November):374-386, 2019. ISSN 23318422. doi: 10.1007/978-3-030-33676-9_26. +[61] Lars Schmarje, Johannes Brünger, Monty Santarossa, Simon-Martin Schroder, Rainer Kiko, and Reinhard Koch. Fuzzy Overclustering: Semi-Supervised Classification of Fuzzy Labels with Overclustering and Inverse Cross-Entropy. Sensors, 21(19):6661, 2021. ISSN 1424-8220. doi: 10.3390/s21196661. +[62] Lars Schmarje, Yuan-Hong Liao, and Reinhard Koch. A Data-Centric Image Classification Benchmark. NeurIPS 2021 Data-centric AI workshop, 2021. +[63] Lars Schmarje, Monty Santarossa, Simon-Martin Schroder, Reinhard Koch, Simon-Martin Schroder, Reinhard Koch, Simon-Martin Schroder, and Reinhard Koch. A Survey on Semi-, Self-and Unsupervised Learning for Image Classification. IEEE Access, pages 1-1, 2021. ISSN 2169-3536. doi: 10.1109/ACCESS.2021.3084358. +[64] Lars Schmarje, Monty Santarossa, Simon-Martin Schroder, Claudius Zelenka, Rainer Kiko, Jenny Stracke, Nina Volkmann, and Reinhard Koch. A data-centric approach for improving ambiguous labels with combined semi-supervised classification and clustering. Proceedings of the European Conference on Computer Vision (ECCV), 2022. +[65] T Schoening, A Purser, D Langenkämper, I Suck, J Taylor, D Cuvelier, L Lins, E Simon-Lledó, Y Marcon, D O B Jones, T Nattkemper, K Köser, M Zurowietz, J Greinert, and J Gomes-Pereira. Megafauna community assessment of polymetallic-nodule fields with cameras: + +platform and methodology comparison. Biogeosciences, 17(12):3115-3133, 2020. doi: 10. 5194/bg-17-3115-2020. +[66] Philipp Schustek and Rubén Moreno-Bote. Instance-based generalization for human judgments about uncertainty. PLOS Computational Biology, 14(6):e1006205, jun 2018. ISSN 1553-7358. doi: 10.1371/journal.pcbi.1006205. URL https://dx.plos.org/10.1371/journal.pcbi.1006205. +[67] Kihyuk Sohn, David Berthelot, Chun-Liang Li, Zizhao Zhang, Nicholas Carlini, Ekin D. Cubuk, Alex Kurakin, Han Zhang, and Colin Raffel. FixMatch: Simplifying Semi-Supervised Learning with Consistency and Confidence. Advances in Neural Information Processing Systems 33 pre-proceedings (NeurIPS 2020), 2020. +[68] Hwanjun Song, Minseok Kim, Dongmin Park, Jae-Gil Lee, Yooju Shin, and Jae-Gil Lee. Learning From Noisy Labels With Deep Neural Networks: A Survey. IEEE Transactions on Neural Networks and Learning Systems, pages 1-19, 2022. ISSN 2162-237X. doi: 10.1109/TNNLS.2022.3152527. +[69] Igor Stepić, Rafal Obuchowicz, Adam Piórkowski, and Mariusz Oszust. Fusion of Deep Convolutional Neural Networks for No-Reference Magnetic Resonance Image Quality Assessment. Sensors, 21(4), 2021. ISSN 1424-8220. doi: 10.3390/s21041043. +[70] Antti Tarvainen and Harri Valpola. Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results. In ICLR, 2017. +[71] Alexandra N. Uma, Tommaso Fornaciari, Dirk Hovy, Silviu Paun, Barbara Plank, and Massimo Poesio. Learning from Disagreement: A Survey. Journal of Artificial Intelligence Research, 72: 1385–1470, 2021. ISSN 1076-9757. doi: 10.1613/jair.1.12752. +[72] Matias Valdenegro-Toro and Daniel Saromo. A Deeper Look into Aleatoric and Epistemic Uncertainty Disentanglement. 2022. +[73] Nina Volkmann, Johannes Brünger, Jenny Stracke, Claudius Zelenka, Reinhard Koch, Nicole Kemper, and Birgit Spindler. So much trouble in the herd: Detection of first signs of cannibalism in turkeys. In *Recent advances in animal welfare science VII* Virtual UFAW Animal Welfare Conference, page 82, 2020. +[74] Nina Volkmann, Johannes Brünger, Jenny Stracke, Claudius Zelenka, Reinhard Koch, Nicole Kemper, and Birgit Spindler. Learn to train: Improving training data for a neural network to detect pecking injuries in turkeys. *Animals* 2021, 11:1–13, 2021. doi: 10.3390/ani11092655. +[75] Nina Volkmann, Claudius Zelenka, Archana Malavalli Devaraju, Johannes Brünger, Jenny Stracke, Birgit Spindler, Nicole Kemper, and Reinhard Koch. Keypoint Detection for Injury Identification during Turkey Husbandry Using Neural Networks. Sensors, 22(14):5188, 2022. ISSN 1424-8220. doi: 10.3390/s22145188. +[76] Zhuowei Wang, Jing Jiang, Bo Han, Lei Feng, Bo An, Gang Niu, and Guodong Long. SemiNLL: A Framework of Noisy-Label Learning by Semi-Supervised Learning. 2020. +[77] Jiaheng Wei, Zhaowei Zhu, Hao Cheng, Tongliang Liu, Gang Niu, and Yang Liu. Learning with Noisy Labels Revisited: A Study Using Real-World Human Annotations. 2021. +[78] Quanming Yao, Hansi Yang, Bo Han, Gang Niu, and James Kwok. Searching to exploit memorization effect in learning from corrupted labels. arXiv preprint arXiv:1911.02377, 2019. +[79] Xingrui Yu, Bo Han, Jiangchao Yao, Gang Niu, Ivor Tsang, and Masashi Sugiyama. How does disagreement help generalization against label corruption? In International Conference on Machine Learning, pages 7164-7173. PMLR, 2019. +[80] Sangdoo Yun, Seong Joon Oh, Byeongho Heo, Dongyoon Han, Junsuk Choe, and Sanghyuk Chun. Re-Labeling ImageNet: From Single to Multi-Labels, From Global to Localized Labels. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 2340–2350, 2021. + +[81] Xin Zhang, Zixuan Liu, Kaiwen Xiao, Tian Shen, Junzhou Huang, Wei Yang, Dimitris Samaras, and Xiao Han. CoDiM: Learning with Noisy Labels via Contrastive Semi-Supervised Learning. 2021. +[82] Zizhao Zhang, Han Zhang, Sercan O. Arik, Honglak Lee, and Tomas Pfister. Distilling Effective Supervision from Severe Label Noise. Conference on Computer Vision and Pattern Recognition, 2020. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] All claims are either introduced in Section 2 or are concluded in Section 4 +(b) Did you describe the limitations of your work? [Yes] See Section 4 +(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Section 4 +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] All raw data was acquired from open data or in agreement with ethical guidelines. + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [N/A] No theoretical claims made +(b) Did you include complete proofs of all theoretical results? [N/A] No theoretical claims made + +3. If you ran experiments (e.g. for benchmarks)... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] See Supplementary or the main repository. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 2 +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] See Section 1, As explained in 3 most reported values are median values due to outliers, error bars would clutter the graphics and decrease their interpretability. We give all results (including SEM) in the supplementary for any interested reader. +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See the implementation details in Section 2 + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] We credited all authors when we used or extended their datasets. See under datasets in Section 2 +(b) Did you mention the license of the assets? [Yes] All license information are in the license file in the Git Repository +(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] Multiple datasets are created or extended by us, also the source code for the benchmark is new. The source code and datasets are reachable as described in the access section in the supplementary or in the main repository. +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [Yes] We either used own datasets, public datasets or received personal permission from respective data owners. +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] The datasets are images of animals, objects or plants and thus can not identify people. Our data does not contain offensive content. + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] We either used preliminary existing crowd sourcing materials or used only selected few workers as annotators and gave only oral instructions. We give credit and reference all previous instructions. +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] Not applicable, we see no potential risk for humans by annotating images. + +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [Yes] We included hourly wages where applicable in the supplementary. \ No newline at end of file diff --git a/isoneannotationenoughadatacentricimageclassificationbenchmarkfornoisyandambiguouslabelestimation/images.zip b/isoneannotationenoughadatacentricimageclassificationbenchmarkfornoisyandambiguouslabelestimation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..54c9c67c61575c18cf0782917506f257af52c48b --- /dev/null +++ b/isoneannotationenoughadatacentricimageclassificationbenchmarkfornoisyandambiguouslabelestimation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6835c68745762a9879e35961f8492924578f20c6450ed4f59ca85601007d57c8 +size 368565 diff --git a/isoneannotationenoughadatacentricimageclassificationbenchmarkfornoisyandambiguouslabelestimation/layout.json b/isoneannotationenoughadatacentricimageclassificationbenchmarkfornoisyandambiguouslabelestimation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..cd893d3a24de0002f120ca453b0221084d925196 --- /dev/null +++ b/isoneannotationenoughadatacentricimageclassificationbenchmarkfornoisyandambiguouslabelestimation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:79728700659db38d21878b776396bcb25f25a9aa5621fae1795bd8389348d02c +size 521309 diff --git a/isoutofdistributiondetectionlearnable/aa78670d-66d2-41b2-a3de-25aec40b64d0_content_list.json b/isoutofdistributiondetectionlearnable/aa78670d-66d2-41b2-a3de-25aec40b64d0_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..a2a196429b44db8c0d89809b1b5ecd7dedd47576 --- /dev/null +++ b/isoutofdistributiondetectionlearnable/aa78670d-66d2-41b2-a3de-25aec40b64d0_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b852e397ede3ce323f4b1f46cafef32bab564ce87c8a9499d2eb5865f9682e5d +size 104670 diff --git a/isoutofdistributiondetectionlearnable/aa78670d-66d2-41b2-a3de-25aec40b64d0_model.json b/isoutofdistributiondetectionlearnable/aa78670d-66d2-41b2-a3de-25aec40b64d0_model.json new file mode 100644 index 0000000000000000000000000000000000000000..9ceacbff26bd04ff67eaed608d3da64026b4ae33 --- /dev/null +++ b/isoutofdistributiondetectionlearnable/aa78670d-66d2-41b2-a3de-25aec40b64d0_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b746f0e33af89f5143782d78541133af6c8a255dac5bde30f6d433e68a9ee52f +size 137946 diff --git a/isoutofdistributiondetectionlearnable/aa78670d-66d2-41b2-a3de-25aec40b64d0_origin.pdf b/isoutofdistributiondetectionlearnable/aa78670d-66d2-41b2-a3de-25aec40b64d0_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..fa252756bef07505bcbb21b0082ffbb716b23279 --- /dev/null +++ b/isoutofdistributiondetectionlearnable/aa78670d-66d2-41b2-a3de-25aec40b64d0_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b1ee18ae5a6719f8d0cde2c46eb60966b4ef44bc7960f133334d163868c4251d +size 1979135 diff --git a/isoutofdistributiondetectionlearnable/full.md b/isoutofdistributiondetectionlearnable/full.md new file mode 100644 index 0000000000000000000000000000000000000000..07340af2f157054837dc79870a7457f65ce44fd2 --- /dev/null +++ b/isoutofdistributiondetectionlearnable/full.md @@ -0,0 +1,448 @@ +# Is Out-of-Distribution Detection Learnable? + +Zhen Fang $^{1}$ , Yixuan Li $^{2}$ , Jie Lu $^{1*}$ , Jiahua Dong $^{3,4}$ , Bo Han $^{5}$ , Feng Liu $^{1,6*}$ + +$^{1}$ Australian Artificial Intelligence Institute, University of Technology Sydney. + +$^{2}$ Department of Computer Sciences, University of Wisconsin-Madison. + +$^{3}$ State Key Laboratory of Robotics, Shenyang Institute of Automation, Chinese Academy of Sciences. $^{4}$ ETH Zurich, Switzerland. + +$^{5}$ Department of Computer Science, Hong Kong Baptist University. + +$^{6}$ School of Mathematics and Statistics, University of Melbourne. + +{zhen.fang,jie.lu}@uts.edu.au,sharonli@cs.wisc.edu, + +dongjiahua1995@gmail.com,bhanml@comp.hkbu.edu.hk,feng.liul@unimelb.edu.au + +# Abstract + +Supervised learning aims to train a classifier under the assumption that training and test data are from the same distribution. To ease the above assumption, researchers have studied a more realistic setting: out-of-distribution (OOD) detection, where test data may come from classes that are unknown during training (i.e., OOD data). Due to the unavailability and diversity of OOD data, good generalization ability is crucial for effective OOD detection algorithms. To study the generalization of OOD detection, in this paper, we investigate the probably approximately correct (PAC) learning theory of OOD detection, which is proposed by researchers as an open problem. First, we find a necessary condition for the learnability of OOD detection. Then, using this condition, we prove several impossibility theorems for the learnability of OOD detection under some scenarios. Although the impossibility theorems are frustrating, we find that some conditions of these impossibility theorems may not hold in some practical scenarios. Based on this observation, we next give several necessary and sufficient conditions to characterize the learnability of OOD detection in some practical scenarios. Lastly, we also offer theoretical supports for several representative OOD detection works based on our OOD theory. + +# 1 Introduction + +The success of supervised learning is established on an implicit assumption that training and test data share a same distribution, i.e., in-distribution (ID) [1, 2, 3, 4]. However, test data distribution in many real-world scenarios may violate the assumption and, instead, contain out-of-distribution (OOD) data whose labels have not been seen during the training process [5, 6]. To mitigate the risk of OOD data, researchers have considered a more practical learning scenario: OOD detection which determines whether an input is ID/OOD, while classifying the ID data into respective classes. OOD detection has shown great potential to ensure the reliable deployment of machine learning models in the real world. A rich line of algorithms have been developed to empirically address the OOD detection problem [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]. However, very few works study theory of OOD detection, which hinders the rigorous path forward for the field. This paper aims to bridge the gap. + +In this paper, we provide a theoretical framework to understand the learnability of the OOD detection problem. We investigate the probably approximately correct (PAC) learning theory of OOD detection, which is posed as an open problem to date. Unlike the classical PAC learning theory in a supervised setting, our problem setting is fundamentally challenging due to the absence of OOD data in training. + +In many real-world scenarios, OOD data can be diverse and priori-unknown. Given this, we study whether there exists an algorithm that can be used to detect various OOD data instead of merely some specified OOD data. Such is the significance of studying the learning theory for OOD detection [4]. This motivates our question: is OOD detection PAC learnable? i.e., is there the PAC learning theory to guarantee the generalization ability of OOD detection? + +To investigate the learning theory, we mainly focus on two basic spaces: domain space and hypothesis space. The domain space is a space consisting of some distributions, and the hypothesis space is a space consisting of some classifiers. Existing agnostic PAC theories in supervised learning [21, 22] are distribution-free, i.e., the domain space consists of all domains. Yet, in Theorem 4, we show that the learning theory of OOD detection is not distribution-free. In fact, we discover that OOD detection is learnable only if the domain space and the hypothesis space satisfy some special conditions, e.g., Conditions 1 and 3. Notably, there are many conditions and theorems in existing learning theories and many OOD detection algorithms in the literature. Thus, it is very difficult to analyze the relation between these theories and algorithms, and explore useful conditions to ensure the learnability of OOD detection, especially when we have to explore them from the scratch. Thus, the main aim of our paper is to study these essential conditions. From these essential conditions, we can know when OOD detection can be successful in practical scenarios. We restate our question and goal in following: + +Given hypothesis spaces and several representative domain spaces, what are the conditions to ensure the learnability of OOD detection? If possible, we hope that these conditions are necessary and sufficient in some scenarios. + +Main Results. We investigate the learnability of OOD detection starting from the largest space—the total space, and give a necessary condition (Condition 1) for the learnability. However, we find that the overlap between ID and OOD data may result in that the necessary condition does not hold. Therefore, we give an impossibility theorem to demonstrate that OOD detection fails in the total space (Theorem 4). Next, we study OOD detection in the separate space, where there are no overlaps between the ID and OOD data. Unfortunately, there still exists impossibility theorem (Theorem 5), which demonstrates that OOD detection is not learnable in the separate space under some conditions. + +Although the impossibility theorems obtained in the separate space are frustrating, we find that some conditions of these impossibility theorems may not hold in some practical scenarios. Based on this observation, we give several necessary and sufficient conditions to characterize the learnability of OOD detection in the separate space (Theorems 6 and 10). Especially, when our model is based on fully-connected neural network (FCNN), OOD detection is learnable in the separate space if and only if the feature space is finite. Furthermore, we investigate the learnability of OOD detection in other more practical domain spaces, e.g., the finite-ID-distribution space (Theorem 8) and the density-based space (Theorem 9). By studying the finite-ID-distribution space, we discover a compatibility condition (Condition 3) that is a necessary and sufficient condition for this space. Next, we further investigate the compatibility condition in the density-based space, and find that such condition is also the necessary and sufficient condition in some practical scenarios (Theorem 11). + +Implications and Impacts of Theory. Our study is not of purely theoretical interest; it has also practical impacts. First, when we design OOD detection algorithms, we normally only have finite ID datasets, corresponding to the finite-ID-distribution space. In this case, Theorem 8 gives the necessary and sufficient condition to the success of OOD detection. Second, our theory provides theoretical support (Theorems 10 and 11) for several representative OOD detection works [7, 8, 23]. Third, our theory shows that OOD detection is learnable in image-based scenarios when ID images have clearly different semantic labels and styles (far-OOD) from OOD images. Fourth, we should not expect a universally working algorithm. It is necessary to design different algorithms in different scenarios. + +# 2 Learning Setups + +We start by introducing the necessary concepts and notations for our theoretical framework. Given a feature space $\mathcal{X} \subset \mathbb{R}^d$ and a label space $\mathcal{Y} \coloneqq \{1, \dots, K\}$ , we have an ID joint distribution $D_{X_1Y_1}$ over $\mathcal{X} \times \mathcal{Y}$ , where $X_1 \in \mathcal{X}$ and $Y_1 \in \mathcal{Y}$ are random variables. We also have an OOD joint distribution $D_{X_0Y_0}$ , where $X_0$ is a random variable from $\mathcal{X}$ , but $Y_0$ is a random variable whose outputs do not belong to $\mathcal{Y}$ . During testing, we will meet a mixture of ID and OOD joint distributions: $D_{XY} \coloneqq (1 - \pi^{\mathrm{out}})D_{X_1Y_1} + \pi^{\mathrm{out}}D_{X_0Y_0}$ , and can only observe the marginal distribution $D_X \coloneqq (1 - \pi^{\mathrm{out}})D_{X_1} + \pi^{\mathrm{out}}D_{X_0}$ , where the constant $\pi^{\mathrm{out}} \in [0,1)$ is an unknown class-prior probability. + +Problem 1 (OOD Detection [4]). Given an ID joint distribution $D_{X_1Y_1}$ and a training data $S \coloneqq \{(\mathbf{x}^1, y^1), \dots, (\mathbf{x}^n, y^n)\}$ drawn independent and identically distributed from $D_{X_1Y_1}$ , the aim of OOD detection is to train a classifier $f$ by using the training data $S$ such that, for any test data $\mathbf{x}$ drawn from the mixed marginal distribution $D_X$ : 1) if $\mathbf{x}$ is an observation from $D_{X_1}$ , $f$ can classify $\mathbf{x}$ into correct ID classes; and 2) if $\mathbf{x}$ is an observation from $D_{X_0}$ , $f$ can detect $\mathbf{x}$ as OOD data. + +According to the survey [4], when $K > 1$ , OOD detection is also known as the open-set recognition or open-set learning [24, 25]; and when $K = 1$ , OOD detection reduces to one-class novelty detection and semantic anomaly detection [26, 27, 28]. + +OOD Label and Domain Space. Based on Problem 1, we know it is not necessary to classify OOD data into the correct OOD classes. Without loss of generality, let all OOD data be allocated to one big OOD class, i.e., $Y_{\mathrm{O}} = K + 1$ [24, 29]. To investigate the PAC learnability of OOD detection, we define a domain space $\mathcal{D}_{XY}$ , which is a set consisting of some joint distributions $D_{XY}$ mixed by some ID joint distributions and some OOD joint distributions. In this paper, the joint distribution $D_{XY}$ mixed by ID joint distribution $D_{X_{\mathrm{I}}Y_{\mathrm{I}}}$ and OOD joint distribution $D_{X_{\mathrm{O}}Y_{\mathrm{O}}}$ is called domain. + +Hypothesis Spaces and Scoring Function Spaces. A hypothesis space $\mathcal{H}$ is a subset of function space, i.e., $\mathcal{H} \subset \{h : \mathcal{X} \to \mathcal{Y} \cup \{K + 1\}\}$ . We set $\mathcal{H}^{\mathrm{in}} \subset \{h : \mathcal{X} \to \mathcal{Y}\}$ to the ID hypothesis space. We also define $\mathcal{H}^{\mathrm{b}} \subset \{h : \mathcal{X} \to \{1,2\}\}$ as the hypothesis space for binary classification, where 1 represents the ID data, and 2 represents the OOD data. The function $h$ is called the hypothesis function. A scoring function space is a subset of function space, i.e., $\mathcal{F}_l \subset \{\mathbf{f} : \mathcal{X} \to \mathbb{R}^l\}$ , where $l$ is the output's dimension of the vector-valued function $\mathbf{f}$ . The function $\mathbf{f}$ is called the scoring function. + +Loss and Risks. Let $\mathcal{Y}_{\mathrm{all}} = \mathcal{Y} \cup \{K + 1\}$ . Given a loss function $\ell^2: \mathcal{Y}_{\mathrm{all}} \times \mathcal{Y}_{\mathrm{all}} \to \mathbb{R}_{\geq 0}$ satisfying that $\ell(y_1, y_2) = 0$ if and only if $y_1 = y_2$ , and any $h \in \mathcal{H}$ , then the risk with respect to $\bar{D}_{XY}$ is + +$$ +R _ {D} (h) := \mathbb {E} _ {(\mathbf {x}, y) \sim D _ {X Y}} \ell (h (\mathbf {x}), y). \tag {1} +$$ + +The $\alpha$ -risk $R_D^\alpha(h) \coloneqq (1 - \alpha) R_D^{\mathrm{in}}(h) + \alpha R_D^{\mathrm{out}}(h), \forall \alpha \in [0,1]$ , where the risks $R_D^{\mathrm{in}}(h), R_D^{\mathrm{out}}(h)$ are + +$$ +R _ {D} ^ {\mathrm {i n}} (h) := \mathbb {E} _ {(\mathbf {x}, y) \sim D _ {X _ {\mathrm {I}} Y _ {\mathrm {I}}}} \ell (h (\mathbf {x}), y), \qquad R _ {D} ^ {\mathrm {o u t}} (h) := \mathbb {E} _ {\mathbf {x} \sim D _ {X _ {\mathrm {O}}}} \ell (h (\mathbf {x}), K + 1). +$$ + +Learnability. We aim to select a hypothesis function $h \in \mathcal{H}$ with approximately minimal risk, based on finite data. Generally, we expect the approximation to get better, with the increase in sample size. Algorithms achieving this are said to be consistent. Formally, we introduce the following definition: + +Definition 1 (Learnability of OOD Detection). Given a domain space $\mathcal{D}_{XY}$ and a hypothesis space $\mathcal{H} \subset \{h : \mathcal{X} \to \mathcal{Y}_{\mathrm{all}}\}$ , we say OOD detection is learnable in $\mathcal{D}_{XY}$ for $\mathcal{H}$ , if there exists an algorithm $\mathbf{A}^3 : \cup_{n=1}^{+\infty} (\mathcal{X} \times \mathcal{Y})^n \to \mathcal{H}$ and a monotonically decreasing sequence $\epsilon_{\mathrm{cons}}(n)$ , such that $\epsilon_{\mathrm{cons}}(n) \to 0$ , as $n \to +\infty$ , and for any domain $D_{XY} \in \mathcal{D}_{XY}$ , + +$$ +\mathbb {E} _ {S \sim D _ {X _ {1} Y _ {1}} ^ {n}} \left[ R _ {D} (\mathbf {A} (S)) - \inf _ {h \in \mathcal {H}} R _ {D} (h) \right] \leq \epsilon_ {\text {c o n s}} (n), \tag {2} +$$ + +An algorithm $\mathbf{A}$ for which this holds is said to be consistent with respect to $\mathcal{D}_{XY}$ . + +Definition 1 is a natural extension of agnostic PAC learnability of supervised learning [30]. If for any $D_{XY} \in \mathcal{D}_{XY}$ , $\pi^{\mathrm{out}} = 0$ , then Definition 2 is the agnostic PAC learnability of supervised learning. Although the expression of Definition 1 is different from the normal definition of agnostic PAC learning in [21], one can easily prove that they are equivalent when $\ell$ is bounded, see Appendix D.3. + +Since OOD data are unavailable, it is impossible to obtain information about the class-prior probability $\pi^{\mathrm{out}}$ . Furthermore, in the real world, it is possible that $\pi^{\mathrm{out}}$ can be any value in [0, 1). Therefore, the imbalance issue between ID and OOD distributions, and the priori-unknown issue (i.e., $\pi^{\mathrm{out}}$ is unknown) are the core challenges. To ease these challenges, researchers use AUROC, AUPR and FPR95 to estimate the performance of OOD detection [18, 31, 32, 33, 34, 35]. It seems that there is a gap between Definition 1 and existing works. To eliminate this gap, we revise Eq. (2) as follows: + +$$ +\mathbb {E} _ {S \sim D _ {X _ {1} Y _ {1}} ^ {n}} \left[ R _ {D} ^ {\alpha} (\mathbf {A} (S)) - \inf _ {h \in \mathcal {H}} R _ {D} ^ {\alpha} (h) \right] \leq \epsilon_ {\text {c o n s}} (n), \forall \alpha \in [ 0, 1 ]. \tag {3} +$$ + +If an algorithm $\mathbf{A}$ satisfies Eq. (3), then the imbalance issue and the prior-unknown issue disappear. That is, $\mathbf{A}$ can simultaneously classify the ID data and detect the OOD data well. Based on the above discussion, we define the strong learnability of OOD detection as follows: + +Definition 2 (Strong Learnability of OOD Detection). Given a domain space $\mathcal{D}_{XY}$ and a hypothesis space $\mathcal{H} \subset \{h : \mathcal{X} \to \mathcal{Y}_{\mathrm{all}}\}$ , we say OOD detection is strongly learnable in $\mathcal{D}_{XY}$ for $\mathcal{H}$ , if there exists an algorithm $\mathbf{A} : \cup_{n=1}^{+\infty} (\mathcal{X} \times \mathcal{Y})^n \to \mathcal{H}$ and a monotonically decreasing sequence $\epsilon_{\mathrm{cons}}(n)$ such that $\epsilon_{\mathrm{cons}}(n) \to 0$ , as $n \to +\infty$ , and for any domain $D_{XY} \in \mathcal{D}_{XY}$ , + +$$ +\mathbb {E} _ {S \sim D _ {X _ {1} Y _ {1}} ^ {n}} \left[ R _ {D} ^ {\alpha} (\mathbf {A} (S)) - \inf _ {h \in \mathcal {H}} R _ {D} ^ {\alpha} (h) \right] \leq \epsilon_ {\mathrm {c o n s}} (n), \forall \alpha \in [ 0, 1 ]. +$$ + +In Theorem 1, we have shown that the strong learnability of OOD detection is equivalent to the learnability of OOD detection, if the domain space $\mathcal{D}_{XY}$ is a prior-unknown space (see Definition 3). In this paper, we mainly discuss the learnability in the prior-unknown space. Therefore, when we mention that OOD detection is learnable, we also mean that OOD detection is strongly learnable. + +Goal of Theory. Note that the agnostic PAC learnability of supervised learning is distribution-free, i.e., the domain space $\mathcal{D}_{XY}$ consists of all domains. However, due to the absence of OOD data during the training process [8, 14, 24], it is obvious that the learnability of OOD detection is not distribution-free (i.e., Theorem 4). In fact, we discover that the learnability of OOD detection is deeply correlated with the relationship between the domain space $\mathcal{D}_{XY}$ and the hypothesis space $\mathcal{H}$ . That is, OOD detection is learnable only when the domain space $\mathcal{D}_{XY}$ and the hypothesis space $\mathcal{H}$ satisfy some special conditions, e.g., Condition 1 and Condition 3. We present our goal as follows: + +Goal: given a hypothesis space $\mathcal{H}$ and several representative domain spaces $\mathcal{D}_{XY}$ , what are the conditions to ensure the learnability of OOD detection? Furthermore, if possible, we hope that these conditions are necessary and sufficient in some scenarios. + +Therefore, compared to the agnostic PAC learnability of supervised learning, our theory doesn't focus on the distribution-free case, but focuses on discovering essential conditions to guarantee the learnability of OOD detection in several representative and practical domain spaces $\mathcal{D}_{XY}$ . By these essential conditions, we can know when OOD detection can be successful in real applications. + +# 3 Learning in Priori-unknown Spaces + +We first investigate a special space, called prior-unknown space. In such space, Definition 1 and Definition 2 are equivalent. Furthermore, we also prove that if OOD detection is strongly learnable in a space $\mathcal{D}_{XY}$ , then one can discover a larger domain space, which is prior-unknown, to ensure the learnability of OOD detection. These results imply that it is enough to consider our theory in the prior-unknown spaces. The prior-unknown space is introduced as follows: + +Definition 3. Given a domain space $\mathcal{D}_{XY}$ , we say $\mathcal{D}_{XY}$ is a priori-unknown space, if for any domain $D_{XY} \in \mathcal{D}_{XY}$ and any $\alpha \in [0,1)$ , we have $D_{XY}^{\alpha} := (1 - \alpha)D_{X_1Y_1} + \alpha D_{X_0Y_0} \in \mathcal{D}_{XY}$ . + +Theorem 1. Given domain spaces $\mathcal{D}_{XY}$ and $\mathcal{D}_{XY}^{\prime} = \{D_{XY}^{\alpha}:\forall D_{XY}\in \mathcal{D}_{XY},\forall \alpha \in [0,1)\}$ , then 1) $\mathcal{D}_{XY}^{\prime}$ is a priori-unknown space and $\mathcal{D}_{XY}\subset \mathcal{D}_{XY}^{\prime}$ ; +2) if $\mathcal{D}_{XY}$ is a priori-unknown space, then Definition 1 and Definition 2 are equivalent; +3) OOD detection is strongly learnable in $\mathcal{D}_{XY}$ if and only if OOD detection is learnable in $\mathcal{D}_{XY}^{\prime}$ . + +The second result of Theorem 1 bridges the learnability and strong learnability, which implies that if an algorithm $\mathbf{A}$ is consistent with respect to a prior-unknown space, then this algorithm $\mathbf{A}$ can address the imbalance issue between ID and OOD distributions, and the priori-unknown issue well. Based on Theorem 1, we focus on our theory in the prior-unknown spaces. Furthermore, to demystify the learnability of OOD detection, we introduce five representative priori-unknown spaces: + +- Single-distribution space $\mathcal{D}_{XY}^{D_{XY}}$ . For a domain $D_{XY}$ , $\mathcal{D}_{XY}^{D_{XY}} := \{D_{XY}^{\alpha} : \forall \alpha \in [0,1)\}$ . +- Total space $\mathcal{D}_{XY}^{\mathrm{all}}$ , which consists of all domains. +- Separate space $\mathcal{D}_{XY}^s$ , which consists of all domains that satisfy the separate condition, that is for any $D_{XY} \in \mathcal{D}_{XY}^s$ , $\operatorname{supp} D_{X_0} \cap \operatorname{supp} D_{X_1} = \emptyset$ , where $\operatorname{supp}$ means the support set. +- Finite-ID-distribution space $\mathcal{D}_{XY}^{F}$ , which is a prior-unknown space satisfying that the number of distinct ID joint distributions $D_{X_{\mathrm{I}}Y_{\mathrm{I}}}$ in $\mathcal{D}_{XY}^{F}$ is finite, i.e., $|\{D_{X_{\mathrm{I}}Y_{\mathrm{I}}}: \forall D_{XY} \in \mathcal{D}_{XY}^{F}\}| < +\infty$ . +- Density-based space $\mathcal{D}_{XY}^{\mu, b}$ , which is a prior-unknown space consisting of some domains satisfying that: for any $D_{XY}$ , there exists a density function $f$ with $1/b \leq f \leq b$ in $\mathrm{supp}\mu$ and $0.5 * D_{X_1} +$ + +![](images/94b304cf7408dd68825b2496072d7162a526eeb91204aea63c5b3f3828ef273d.jpg) +(a) ID and OOD Distributions + +![](images/b78f68f65d74cdcd198072c621e96f67efb1310e0621d7e3d439e8413e0fcc6c.jpg) +(b) Overlap exists + +![](images/9ad07d92195be2cd3a1f8cd543e39617985d591ae5ba58ce2f8a2e3fa55655f9.jpg) +(c) No Overlap + +Figure 1: Illustration of $\inf_{h\in \mathcal{H}}R_D^\alpha (h)$ (solid lines with triangle marks) and the estimated $\mathbb{E}_{S\sim D_{\mathrm{in}}^n}R_D^\alpha (\mathbf{A}(S))$ (dash lines) with $\alpha \in [0,1)$ in different scenarios, where $D_{\mathrm{in}} = D_{X_1Y_1}$ and the algorithm $\mathbf{A}$ is the free-energy OOD detection method [23]. Subfigure (a) shows the ID and OOD distributions. In (a), $\mathrm{gap}_{\mathrm{IO}}$ represents the distance between the support sets of ID and OOD distributions. In (b), since there is an overlap between ID and OOD data, the solid line is a ployline. In (c), since there is no overlap between ID and OOD data, we can check that $\inf_{h\in \mathcal{H}}R_D^\alpha (h)$ forms a straight line (the solid line). However, since dash lines are always straight lines, two observations can be obtained from (b) and (c): 1) dash lines cannot approximate the solid ployline in (b), which implies the unlearnability of OOD detection; and 2) the solid line in (c) is a straight line and may be approximated by the dash lines in (c). The above observations motivate us to propose Condition 1. + +$0.5 * D_{X_0} = \int f \, \mathrm{d}\mu$ , where $\mu$ is a measure defined over $\mathcal{X}$ . Note that if $\mu$ is discrete, then $D_X$ is a discrete distribution; and if $\mu$ is the Lebesgue measure, then $D_X$ is a continuous distribution. + +The above representative spaces widely exist in real applications. For example, 1) if the images from different semantic labels with different styles are clearly different, then those images can form a distribution belonging to a separate space $\mathcal{D}_{XY}^s$ ; and 2) when designing an algorithm, we only have finite ID datasets, e.g., CIFAR-10, MNIST, SVHN, and ImageNet, to build a model. Then, finite-ID-distribution space $\mathcal{D}_{XY}^F$ can handle this real scenario. Note that the single-distribution space is a special case of the finite-ID-distribution space. In this paper, we mainly discuss these five spaces. + +# 4 Impossibility Theorems for OOD Detection + +In this section, we first give a necessary condition for the learnability of OOD detection. Then, we show this necessary condition does not hold in the total space $\mathcal{D}_{XY}^{\mathrm{all}}$ and the separate space $\mathcal{D}_{XY}^{s}$ . + +Necessary Condition. We find a necessary condition for the learnability of OOD detection, i.e., Condition 1, motivated by the experiments in Figure 1. Details of Figure 1 can be found in Appendix C.2. + +Condition 1 (Linear Condition). For any $D_{XY} \in \mathcal{D}_{XY}$ and any $\alpha \in [0,1)$ , + +$$ +\inf _ {h \in \mathcal {H}} R _ {D} ^ {\alpha} (h) = (1 - \alpha) \inf _ {h \in \mathcal {H}} R _ {D} ^ {\mathrm {i n}} (h) + \alpha \inf _ {h \in \mathcal {H}} R _ {D} ^ {\mathrm {o u t}} (h). +$$ + +To reveal the importance of Condition 1, Theorem 2 shows that Condition 1 is a necessary and sufficient condition for the learnability of OOD detection if the $\mathcal{D}_{XY}$ is the single-distribution space. + +Theorem 2. Given a hypothesis space $\mathcal{H}$ and a domain $D_{XY}$ , OOD detection is learnable in the single-distribution space $\mathcal{D}_{XY}^{D_{XY}}$ for $\mathcal{H}$ if and only if linear condition (i.e., Condition 1) holds. + +Theorem 2 implies that Condition 1 is important for the learnability of OOD detection. Due to the simplicity of single-distribution space, Theorem 2 implies that Condition 1 is the necessary condition for the learnability of OOD detection in the prior-unknown space, see Lemma 1 in Appendix F. + +Impossibility Theorems. Here, we first study whether Condition 1 holds in the total space $\mathcal{D}_{XY}^{\mathrm{all}}$ . If Condition 1 does not hold, then OOD detection is not learnable. Theorem 3 shows that Condition 1 is not always satisfied, especially, when there is an overlap between the ID and OOD distributions: + +Definition 4 (Overlap Between ID and OOD). We say a domain $D_{XY}$ has overlap between ID and OOD distributions, if there is a $\sigma$ -finite measure $\tilde{\mu}$ such that $D_X$ is absolutely continuous with respect to $\tilde{\mu}$ , and $\tilde{\mu}(A_{\mathrm{overlap}}) > 0$ , where $A_{\mathrm{overlap}} = \{\mathbf{x} \in \mathcal{X} : f_{\mathrm{I}}(\mathbf{x}) > 0 \text{ and } f_{\mathrm{O}}(\mathbf{x}) > 0\}$ . Here $f_{\mathrm{I}}$ and $f_{\mathrm{O}}$ are the representatives of $D_{X_1}$ and $D_{X_0}$ in Radon-Nikodym Theorem [36], + +$$ +D _ {X _ {\mathrm {I}}} = \int f _ {\mathrm {I}} \mathrm {d} \tilde {\mu}, \quad D _ {X _ {\mathrm {O}}} = \int f _ {\mathrm {O}} \mathrm {d} \tilde {\mu}. +$$ + +Theorem 3. Given a hypothesis space $\mathcal{H}$ and a prior-unknown space $\mathcal{D}_{XY}$ , if there is $D_{XY} \in \mathcal{D}_{XY}$ which has overlap between $ID$ and $OOD$ , and $\inf_{h \in \mathcal{H}} R_D^{\mathrm{in}}(h) = 0$ and $\inf_{h \in \mathcal{H}} R_D^{\mathrm{out}}(h) = 0$ , then Condition 1 does not hold. Therefore, OOD detection is not learnable in $\mathcal{D}_{XY}$ for $\mathcal{H}$ . + +Theorem 3 clearly shows that under proper conditions, Condition 1 does not hold, if there exists a domain whose ID and OOD distributions have overlap. By Theorem 3, we can obtain that the OOD detection is not learnable in the total space $\mathcal{D}_{XY}^{\mathrm{all}}$ for any non-trivial hypothesis space $\mathcal{H}$ . + +Theorem 4 (Impossibility Theorem for Total Space). OOD detection is not learnable in the total space $\mathcal{D}_{XY}^{\mathrm{all}}$ for $\mathcal{H}$ , if $|\phi \circ \mathcal{H}| > 1$ , where $\phi$ maps ID labels to 1 and maps OOD labels to 2. + +Since the overlaps between ID and OOD distributions may cause that Condition 1 does not hold, we then consider studying the learnability of OOD detection in the separate space $\mathcal{D}_{XY}^{s}$ , where there are no overlaps between the ID and OOD distributions. However, Theorem 5 shows that even if we consider the separate space, the OOD detection is still not learnable in some scenarios. Before introducing the impossibility theorem for separate space, i.e., Theorem 5, we need a mild assumption: + +Assumption 1 (Separate Space for OOD). A hypothesis space $\mathcal{H}$ is separate for OOD data, if for each data point $\mathbf{x} \in \mathcal{X}$ , there exists at least one hypothesis function $h_{\mathbf{x}} \in \mathcal{H}$ such that $h_{\mathbf{x}}(\mathbf{x}) = K + 1$ . + +Assumption 1 means that every data point $\mathbf{x}$ has the possibility to be detected as OOD data. Assumption 1 is mild and can be satisfied by many hypothesis spaces, e.g., the FCNN-based hypothesis space (Proposition 1 in Appendix K), score-based hypothesis space (Proposition 2 in Appendix K) and universal kernel space. Next, we use Vapnik-Chervonenkis (VC) dimension [22] to measure the size of hypothesis space, and study the learnability of OOD detection in $\mathcal{D}_{XY}^{s}$ based on the VC dimension. + +Theorem 5 (Impossibility Theorem for Separate Space). If Assumption 1 holds, $\mathrm{VCdim}(\phi \circ \mathcal{H}) < +\infty$ and $\sup_{h\in \mathcal{H}}|\{\mathbf{x}\in \mathcal{X}:h(\mathbf{x})\in \mathcal{Y}\}| = +\infty$ , then OOD detection is not learnable in separate space $\mathcal{D}_{XY}^s$ for $\mathcal{H}$ , where $\phi$ maps $ID$ labels to 1 and maps $OOD$ labels to 2. + +The finite VC dimension normally implies the learnability of supervised learning. However, in our results, the finite VC dimension cannot guarantee the learnability of OOD detection in the separate space, which reveals the difficulty of the OOD detection. Although the above impossibility theorems are frustrating, there is still room to discuss the conditions in Theorem 5, and to find out the proper conditions for ensuring the learnability of OOD detection in the separate space (see Sections 5 and 6). + +# 5 When OOD Detection Can Be Successful + +Here, we discuss when the OOD detection can be learnable in the separate space $\mathcal{D}_{XY}^{s}$ , finite-ID-distribution space $\mathcal{D}_{XY}^{F}$ and density-based space $\mathcal{D}_{XY}^{\mu,b}$ . We first study the separate space $\mathcal{D}_{XY}^{s}$ . + +OOD Detection in the Separate Space. Theorem 5 has indicated that $\mathrm{VCdim}(\phi \circ \mathcal{H}) = +\infty$ or $\sup_{h\in \mathcal{H}}|\{\mathbf{x}\in \mathcal{X}:h(\mathbf{x})\in \mathcal{Y}\} | < +\infty$ is necessary to ensure the learnability of OOD detection in $\mathcal{D}_{XY}^s$ if Assumption 1 holds. However, generally, hypothesis spaces generated by feed-forward neural networks with proper activation functions have finite VC dimension [37, 38]. Therefore, we study the learnability of OOD detection in the case that $|\mathcal{X}| < +\infty$ , which implies that $\sup_{h\in \mathcal{H}}|\{\mathbf{x}\in \mathcal{X}: h(\mathbf{x})\in \mathcal{Y}\} | < +\infty$ . Additionally, Theorem 10 also implies that $|\mathcal{X}| < +\infty$ is the necessary and sufficient condition for the learnability of OOD detection in separate space, when the hypothesis space is generated by FCNN. Hence, $|\mathcal{X}| < +\infty$ may be necessary in the space $\mathcal{D}_{XY}^s$ . + +For simplicity, we first discuss the case that $K = 1$ , i.e., the one-class novelty detection. We show the necessary and sufficient condition for the learnability of OOD detection in $\mathcal{D}_{XY}^s$ , when $|\mathcal{X}| < +\infty$ . + +Theorem 6. Let $K = 1$ and $|\mathcal{X}| < +\infty$ . Suppose that Assumption 1 holds and the constant function $h^{\mathrm{in}} := 1 \in \mathcal{H}$ . Then OOD detection is learnable in $\mathcal{D}_{XY}^{s}$ for $\mathcal{H}$ if and only if $\mathcal{H}_{\mathrm{all}} - \{h^{\mathrm{out}}\} \subset \mathcal{H}$ , where $\mathcal{H}_{\mathrm{all}}$ is the hypothesis space consisting of all hypothesis functions, and $h^{\mathrm{out}}$ is a constant function that $h^{\mathrm{out}} := 2$ , here 1 represents ID data and 2 represents OOD data. + +The condition $h^{\mathrm{in}} \in \mathcal{H}$ presented in Theorem 6 is mild. Many practical hypothesis spaces satisfy this condition, e.g., the FCNN-based hypothesis space (Proposition 1 in Appendix K), score-based hypothesis space (Proposition 2 in Appendix K) and universal kernel-based hypothesis space. Theorem 6 implies that if $K = 1$ and OOD detection is learnable in $\mathcal{D}_{XY}^{s}$ for $\mathcal{H}$ , then the hypothesis space $\mathcal{H}$ + +should contain almost all hypothesis functions, implying that if the OOD detection can be learnable in the distribution-agnostic case, then a large-capacity model is necessary. + +Next, we extend Theorem 6 to a general case, i.e., $K > 1$ . When $K > 1$ , we will first use a binary classifier $h^b$ to classify the ID and OOD data. Then, for the ID data identified by $h^b$ , an ID hypothesis function $h^{\mathrm{in}}$ will be used to classify them into corresponding ID classes. We state this strategy as follows: given a hypothesis space $\mathcal{H}^{\mathrm{in}}$ for ID distribution and a binary classification hypothesis space $\mathcal{H}^{\mathrm{b}}$ introduced in Section 2, we use $\mathcal{H}^{\mathrm{in}}$ and $\mathcal{H}^{\mathrm{b}}$ to construct an OOD detection's hypothesis space $\mathcal{H}$ , which consists of all hypothesis functions $h$ satisfying the following condition: there exist $h^{\mathrm{in}} \in \mathcal{H}^{\mathrm{in}}$ and $h^{\mathrm{b}} \in \mathcal{H}^{\mathrm{b}}$ such that for any $\mathbf{x} \in \mathcal{X}$ , + +$$ +h (\mathbf {x}) = i, \quad \text {i f} h ^ {\mathrm {i n}} (\mathbf {x}) = i \text {a n d} h ^ {\mathrm {b}} (\mathbf {x}) = 1; \text {o t h e r w i s e}, h (\mathbf {x}) = K + 1. \tag {4} +$$ + +We use $\mathcal{H}^{\mathrm{in}}\bullet \mathcal{H}^{\mathrm{b}}$ to represent a hypothesis space consisting of all $h$ defined in Eq. (4). In addition, we also need an additional condition for the loss function $\ell$ . This condition is shown as follows: + +Condition 2. $\ell(y_2, y_1) \leq \ell(K + 1, y_1)$ , for any in-distribution labels $y_1$ and $y_2 \in \mathcal{V}$ . + +Theorem 7. Let $|\mathcal{X}| < +\infty$ and $\mathcal{H} = \mathcal{H}^{\mathrm{in}} \bullet \mathcal{H}^{\mathrm{b}}$ . If $\mathcal{H}_{\mathrm{all}} - \{h^{\mathrm{out}}\} \subset \mathcal{H}^{\mathrm{b}}$ and Condition 2 holds, then OOD detection is learnable in $\mathcal{D}_{XY}^{s}$ for $\mathcal{H}$ , where $\mathcal{H}_{\mathrm{all}}$ and $h^{\mathrm{out}}$ are defined in Theorem 6. + +OOD Detection in the Finite-ID-Distribution Space. Since researchers can only collect finite ID datasets as the training data in the process of algorithm design, it is worthy to study the learnability of OOD detection in the finite-ID-distribution space $\mathcal{D}_{XY}^{F}$ . We first show two necessary concepts below. + +Definition 5 (ID Consistency). Given a domain space $\mathcal{D}_{XY}$ , we say any two domains $D_{XY} \in \mathcal{D}_{XY}$ and $D_{XY}' \in \mathcal{D}_{XY}$ are ID consistency, if $D_{X_1Y_1} = D_{X_1Y_1}'$ . We use the notation $\sim$ to represent the ID consistency, i.e., $D_{XY} \sim D_{XY}'$ if and only if $D_{XY}$ and $D_{XY}'$ are ID consistency. + +It is easy to check that the ID consistency $\sim$ is an equivalence relation. Therefore, we define the set $[D_{XY}]\coloneqq \{D_{XY}'\in \mathcal{D}_{XY}:D_{XY}\sim D_{XY}'\}$ as the equivalence class with respect to space $\mathcal{D}_{XY}$ . + +Condition 3 (Compatibility). For any equivalence class $[D_{XY}^{\prime}]$ with respect to $\mathcal{D}_{XY}$ and any $\epsilon >0$ there exists a hypothesis function $h_\epsilon \in \mathcal{H}$ such that for any domain $D_{XY}\in [D_{XY}^{\prime}]$ + +$$ +h _ {\epsilon} \in \{h ^ {\prime} \in \mathcal {H}: R _ {D} ^ {\mathrm {o u t}} (h ^ {\prime}) \leq \inf _ {h \in \mathcal {H}} R _ {D} ^ {\mathrm {o u t}} (h) + \epsilon \} \cap \{h ^ {\prime} \in \mathcal {H}: R _ {D} ^ {\mathrm {i n}} (h ^ {\prime}) \leq \inf _ {h \in \mathcal {H}} R _ {D} ^ {\mathrm {i n}} (h) + \epsilon \}. +$$ + +In Appendix F, Lemma 2 has implied that Condition 3 is a general version of Condition 1. Next, Theorem 8 indicates that Condition 3 is the necessary and sufficient condition in the space $\mathcal{D}_{XY}^{F}$ . + +Theorem 8. Suppose that $\mathcal{X}$ is a bounded set. OOD detection is learnable in the finite-ID-distribution space $\mathcal{D}_{XY}^{F}$ for $\mathcal{H}$ if and only if the compatibility condition (i.e., Condition 3) holds. Furthermore, the learning rate $\epsilon_{\mathrm{cons}}(n)$ can attain $O(1 / \sqrt{n^{1 - \theta}})$ , for any $\theta \in (0,1)$ . + +Theorem 8 shows that, in the process of algorithm design, OOD detection cannot be successful without the compatibility condition. Theorem 8 also implies that Condition 3 is essential for the learnability of OOD detection. This motivates us to study whether OOD detection can be successful in more general spaces (e.g., the density-based space), when the compatibility condition holds. + +OD Detection in the Density-based Space. To ensure that Condition 3 holds, we consider a basic assumption in learning theory—Realizability Assumption (see Appendix D.2), i.e., for any $D_{XY} \in \mathcal{D}_{XY}$ , there exists $h^* \in \mathcal{H}$ such that $R_D(h^*) = 0$ . We discover that in the density-based space $\mathcal{D}_{XY}^{\mu,b}$ , Realizability Assumption can conclude the compatibility condition (i.e., Condition 3). Based on this observation, we can prove the following theorem: + +Theorem 9. Given a density-based space $\mathcal{D}_{XY}^{\mu,b}$ , if $\mu(\mathcal{X}) < +\infty$ , the Realizability Assumption holds, then when $\mathcal{H}$ has finite Natarajan dimension [21], OOD detection is learnable in $\mathcal{D}_{XY}^{\mu,b}$ for $\mathcal{H}$ . Furthermore, the learning rate $\epsilon_{\mathrm{cons}}(n)$ can attain $O(1/\sqrt{n^{1-\theta}})$ , for any $\theta \in (0,1)$ . + +To further investigate the importance and necessary of Realizability Assumption, Theorem 11 has indicated that in some practical scenarios, Realizability Assumption is the necessary and sufficient condition for the learnability of OOD detection in the density-based space. Therefore, Realizability Assumption may be indispensable for the learnability of OOD detection in some practical scenarios. + +# 6 Connecting Theory to Practice + +In Section 5, we have shown the successful scenarios where OOD detection problem can be addressed in theory. In this section, we will discuss how the proposed theory is applied to two representative hypothesis spaces—neural-network-based hypothesis spaces and score-based hypothesis spaces. + +Fully-connected Neural Networks. Given a sequence $\mathbf{q} = (l_1, l_2, \dots, l_g)$ , where $l_i$ and $g$ are positive integers and $g > 2$ , we use $g$ to represent the depth of neural network and use $l_i$ to represent the width of the $i$ -th layer. After the activation function $\sigma$ is selected4, we can obtain the architecture of FCNN according to the sequence $\mathbf{q}$ . Let $\mathbf{f}_{\mathbf{w},\mathbf{b}}$ be the function generated by FCNN with weights $\mathbf{w}$ and bias $\mathbf{b}$ . An FCNN-based scoring function space is defined as: $\mathcal{F}_{\mathbf{q}}^{\sigma} := \{\mathbf{f}_{\mathbf{w},\mathbf{b}} : \forall \text{weights } \mathbf{w}, \forall \text{bias } \mathbf{b}\}$ . In addition, for simplicity, given any two sequences $\mathbf{q} = (l_1, \dots, l_g)$ and $\mathbf{q}' = (l_1', \dots, l_{g'}')$ , we use the notation $\mathbf{q} \lesssim \mathbf{q}'$ to represent the following equations and inequalities: + +1) $g\leq g^{\prime},l_{1} = l_{1}^{\prime},l_{g} = l_{g^{\prime}}^{\prime}$ 2) $l_{i}\leq l_{i}^{\prime}$ $\forall i = 1,\dots,g - 1$ and 3) $l_{g - 1}\leq l_i^\prime$ $\forall i = g,\ldots ,g^{\prime} - 1$ + +In Appendix L, Lemma 10 shows $\mathbf{q} \lesssim \mathbf{q}' \Rightarrow \mathcal{F}_{\mathbf{q}}^{\sigma} \subset \mathcal{F}_{\mathbf{q}'}^{\sigma}$ . We use $\lesssim$ to compare the sizes of FCNNs. + +FCNN-based Hypothesis Space. Let $l_g = K + 1$ . The FCNN-based scoring function space $\mathcal{F}_{\mathbf{q}}^{\sigma}$ can induce an FCNN-based hypothesis space. For any $\mathbf{f}_{\mathbf{w},\mathbf{b}} \in \mathcal{F}_{\mathbf{q}}^{\sigma}$ , the induced hypothesis function is: + +$$ +h _ {\mathbf {w}, \mathbf {b}} := \underset {k \in \{1, \dots , K + 1 \}} {\arg \max } f _ {\mathbf {w}, \mathbf {b}} ^ {k}, \text {w h e r e} f _ {\mathbf {w}, \mathbf {b}} ^ {k} \text {i s} k \text {- t h c o o r d i n a t e o f} \mathbf {f} _ {\mathbf {w}, \mathbf {b}}. +$$ + +Then, the FCNN-based hypothesis space is defined as $\mathcal{H}_{\mathbf{q}}^{\sigma} \coloneqq \{h_{\mathbf{w},\mathbf{b}} : \forall \text{ weights } \mathbf{w}, \forall \text{ bias } \mathbf{b}\}$ . + +Score-based Hypothesis Space. Many OOD detection algorithms detect OOD data by using a score-based strategy. That is, given a threshold $\lambda$ , a scoring function space $\mathcal{F}_l \subset \{\mathbf{f} : \mathcal{X} \to \mathbb{R}^l\}$ and a scoring function $E : \mathcal{F}_l \to \mathbb{R}$ , then $\mathbf{x}$ is regarded as ID data if and only if $E(\mathbf{f}(\mathbf{x})) \geq \lambda$ . We introduce several representative scoring functions $E$ as follows: for any $\mathbf{f} = [f^1, \dots, f^l]^\top \in \mathcal{F}_l$ , + +- softmax-based function [7] and temperature-scaled function [8]: $\lambda \in (\frac{1}{l}, 1)$ and $T > 0$ , + +$$ +E (\mathbf {f}) = \max _ {k \in \{1, \dots , l \}} \frac {\exp (f ^ {k})}{\sum_ {c = 1} ^ {l} \exp (f ^ {c})}, \quad E (\mathbf {f}) = \max _ {k \in \{1, \dots , l \}} \frac {\exp (f ^ {k} / T)}{\sum_ {c = 1} ^ {l} \exp (f ^ {c} / T)}; \tag {5} +$$ + +- energy-based function [23]: $\lambda \in (0, +\infty)$ and $T > 0$ + +$$ +E (\mathbf {f}) = T \log \sum_ {c = 1} ^ {l} \exp \left(f ^ {c} / T\right). \tag {6} +$$ + +Using $E, \lambda$ and $\mathbf{f} \in \mathcal{F}_{\mathbf{q}}^{\sigma}$ , we have a classifier: $h_{\mathbf{f}, E}^{\lambda}(\mathbf{x}) = 1$ , if $E(\mathbf{f}(\mathbf{x})) \geq \lambda$ ; otherwise, $h_{\mathbf{f}, E}^{\lambda}(\mathbf{x}) = 2$ , where 1 represents the ID data and 2 represents the OOD data. Hence, a binary classification hypothesis space $\mathcal{H}^b$ , which consists of all $h_{\mathbf{f}, E}^{\lambda}$ , is generated. We define $\mathcal{H}_{\mathbf{q}, E}^{\sigma, \lambda} \coloneqq \{h_{\mathbf{f}, E}^{\lambda}: \forall \mathbf{f} \in \mathcal{F}_{\mathbf{q}}^{\sigma}\}$ . + +Learnability of OOD Detection in Different Hypothesis Spaces. Next, we present applications of our theory regarding the above two practical and important hypothesis spaces $\mathcal{H}_{\mathbf{q}}^{\sigma}$ and $\mathcal{H}_{\mathbf{q},E}^{\sigma,\lambda}$ . + +Theorem 10. Suppose that Condition 2 holds and the hypothesis space $\mathcal{H}$ is FCNN-based or score-based, i.e., $\mathcal{H} = \mathcal{H}_{\mathbf{q}}^{\sigma}$ or $\mathcal{H} = \mathcal{H}^{\mathrm{in}}\bullet \mathcal{H}^{\mathrm{b}}$ , where $\mathcal{H}^{\mathrm{in}}$ is an ID hypothesis space, $\mathcal{H}^{\mathrm{b}} = \mathcal{H}_{\mathbf{q},E}^{\sigma ,\lambda}$ and $\mathcal{H} = \mathcal{H}^{\mathrm{in}}\bullet \mathcal{H}^{\mathrm{b}}$ is introduced below Eq. (4), here $E$ is introduced in Eqs. (5) or (6). Then + +$$ +\begin{array}{l} \text {T h e r e i s a s e q u e n c e q = (l _ {1} , \dots , l _ {g}) s u c h t h a t O O D d e f e c t i o n i s} \\ \text {l e a r n a b l e i n t h e s e p a r a t e s p a c e \mathcal {D} _ {X Y} ^ {s} f o r \mathcal {H} i f a n d o n l y i f | \mathcal {X} | < + \infty .} \end{array} +$$ + +Furthermore, if $|\mathcal{X}| < +\infty$ , then there exists a sequence $\mathbf{q} = (l_1, \dots, l_g)$ such that for any sequence $\mathbf{q}'$ satisfying that $\mathbf{q} \lesssim \mathbf{q}'$ , OOD detection is learnable in $\mathcal{D}_{XY}^s$ for $\mathcal{H}$ . + +Theorem 10 states that 1) when the hypothesis space is FCNN-based or score-based, the finite feature space is the necessary and sufficient condition for the learnability of OOD detection in the separate space; and 2) a larger architecture of FCNN has a greater probability to achieve the learnability of + +OOD detection in the separate space. Note that when we select Eqs. (5) or (6) as the scoring function $E$ , Theorem 10 also shows that the selected scoring functions $E$ can guarantee the learnability of OOD detection, which is a theoretical support for the representative works [8, 23, 7]. Furthermore, Theorem 11 also offers theoretical supports for these works in the density-based space, when $K = 1$ . + +Theorem 11. Suppose that each domain $D_{XY}$ in $\mathcal{D}_{XY}^{\mu,b}$ is attainable, i.e., $\arg \min_{h\in \mathcal{H}}R_D(h)\neq \emptyset$ (the finite discrete domains satisfy this). Let $K = 1$ and the hypothesis space $\mathcal{H}$ be score-based $(\mathcal{H} = \mathcal{H}_{\mathbf{q},E}^{\sigma,\lambda}$ , where $E$ is in Eqs. (5) or (6)) or FCNN-based $(\mathcal{H} = \mathcal{H}_{\mathbf{q}}^{\sigma})$ . If $\mu(\mathcal{X}) < +\infty$ , then the following four conditions are equivalent: + +Learnability in $\mathcal{D}_{XY}^{\mu,b}$ for $\mathcal{H} \iff$ Condition 1 $\iff$ Realizability Assumption $\iff$ Condition 3 + +Theorem 11 still holds if the function space $\mathcal{F}_{\mathbf{q}}^{\sigma}$ is generated by Convolutional Neural Network. + +Overlap and Benefits of Multi-class Case. We investigate when the hypothesis space is FCNN-based or score-based, what will happen if there exists an overlap between the ID and OOD distributions? + +Theorem 12. Let $K = 1$ and the hypothesis space $\mathcal{H}$ be score-based ( $\mathcal{H} = \mathcal{H}_{\mathbf{q},E}^{\sigma,\lambda}$ , where $E$ is in Eqs. (5) or (6)) or FCNN-based ( $\mathcal{H} = \mathcal{H}_{\mathbf{q}}^{\sigma}$ ). Given a prior-unknown space $\mathcal{D}_{XY}$ , if there exists a domain $D_{XY} \in \mathcal{D}_{XY}$ , which has an overlap between $ID$ and OOD distributions (see Definition 4), then OOD detection is not learnable in the domain space $\mathcal{D}_{XY}$ for $\mathcal{H}$ . + +When $K = 1$ and the hypothesis space is FCNN-based or score-based, Theorem 12 shows that overlap between ID and OOD distributions is the sufficient condition for the unlearnability of OOD detection. Theorem 12 takes roots in the conditions $\inf_{h\in \mathcal{H}}R_D^{\mathrm{in}}(h) = 0$ and $\inf_{h\in \mathcal{H}}R_D^{\mathrm{out}}(h) = 0$ . However, when $K > 1$ , we can ensure $\inf_{h\in \mathcal{H}}R_D^{\mathrm{in}}(h) > 0$ if ID distribution $D_{X_1Y_1}$ has overlap between ID classes. By this observation, we conjecture that when $K > 1$ , OOD detection is learnable in some special cases where overlap exists, even if the hypothesis space is FCNN-based or score-based. + +# 7 Discussion + +Understanding Far-OOD Detection. Many existing works [7, 39] study the far-OOD detection issue. Existing benchmarks include 1) MNIST [40] as ID dataset, and Texture [41], CIFAR-10 [42] or Place365 [43] as OOD datasets; and 2) CIFAR-10 [42] as ID dataset, and MNIST [40], or Fashion-MNIST [43] as OOD datasets. In far-OOD case, we find that the ID and OOD datasets have different semantic labels and different styles. From the theoretical view, we can define far-OOD detection tasks as follows: for $\tau > 0$ , a domain space $\mathcal{D}_{XY}$ is $\tau$ -far-OOD, if for any domain $D_{XY} \in \mathcal{D}_{XY}$ , + +$$ +\operatorname {d i s t} \left(\operatorname {s u p p} D _ {X _ {\mathrm {O}}}, \operatorname {s u p p} D _ {X _ {\mathrm {I}}}\right) > \tau . +$$ + +Theorems 7, 8 and 10 imply that under appropriate hypothesis space, $\tau$ -far-OOD detection is learnable. In Theorem 7, the condition $|\mathcal{X}| < +\infty$ is necessary for the separate space. However, one can prove that in the far-OOD case, when $\mathcal{H}^{\mathrm{in}}$ is agnostic PAC learnable for ID distribution, the results in Theorem 7 still hold, if the condition $|\mathcal{X}| < +\infty$ is replaced by a weaker condition that $\mathcal{X}$ is compact. In addition, it is notable that when $\mathcal{H}^{\mathrm{in}}$ is agnostic PAC learnable for ID distribution and $\mathcal{X}$ is compact, the KNN-based OOD detection algorithm [44] is consistent in the $\tau$ -far-OOD case. + +Understanding Near-OOD Detection. When the ID and OOD datasets have similar semantics or styles, OOD detection tasks become more challenging. [45, 46] consider this issue and name it near-OOD detection. Existing benchmarks include 1) MNIST [40] as ID dataset, and Fashion-MNIST [43] or Not-MNIST [47] as OOD datasets; and 2) CIFAR-10 [42] as ID dataset, and CIFAR-100 [48] as OOD dataset. From the theoretical view, some near-OOD tasks may imply the overlap condition, i.e. Definition 4. Therefore, Theorems 3 and 12 imply that near-OOD detection may be not learnable. Developing a theory to understand the feasibility of near-OOD detection is still an open question. + +Understanding One-class Novelty Detection. In one-class novelty detection and semantic anomaly detection (i.e. $K = 1$ ), Theorem 6 has revealed that it is necessary to use a large-capacity model to ensure the good generalization in the separate space. Theorem 3 and Theorem 12 suggest that we should try to avoid the overlap between ID and OOD distributions in the one-class case. If the overlap cannot be avoided, we suggest considering the multi-class OOD detection instead of the one-class case. Additionally, in the density-based space, Theorem 11 has shown that it is necessary to select a suitable hypothesis space satisfying the Realizability Assumption to ensure the learnability of OOD + +detection in the density-based space. Generally, a large-capacity model can be helpful to guarantee that the Realizability Assumption holds. + +# 8 Related Work + +We briefly review the related theoretical works below. See Appendix A for detailed related works. + +OOD Detection Theory. [49] understands the OOD detection via goodness-of-fit tests and typical set hypothesis, and argues that minimal density estimation errors can lead to OOD detection failures without assuming an overlap between ID and OOD distributions. Beyond [49], [50] paves a new avenue to designing provable OOD detection algorithms. Compared to [50, 49], our theory focuses on the PAC learnable theory of OOD detection and identifies several necessary and sufficient conditions for the learnability of OOD detection, opening a door to study OOD detection in theory. + +Open-set Learning Theory. [51] and [29, 52] propose the agnostic PAC learning bounds for open-set detection and open-set domain adaptation, respectively. Unfortunately, [29, 51, 52] all require that the test data are indispensable during the training process. To investigate open-set learning (OSL) without accessing the test data during training, [24] proposes and investigates the almost agnostic PAC learnability for OSL. However, the assumptions used in [24] are very strong and unpractical. + +Learning Theory for Classification with Reject Option. Many works [53, 54] also investigate the classification with reject option (CwRO) problem, which is similar to OOD detection in some cases. [55, 56, 57, 58, 59] study the learning theory and propose the PAC learning bounds for CwRO. However, compared to our work regarding OOD detection, existing CwRO theories mainly focus on how the ID risk $R_{D}^{\mathrm{in}}$ (i.e., the risk that ID data is wrongly classified) is influenced by special rejection rules. Our theory not only focuses on the ID risk, but also pays attention to the OOD risk. + +Robust Statistics. In the field of robust statistics [60], researchers aim to propose estimators and testers that can mitigate the negative effects of outliers (similar to OOD data). The proposed estimators are supposed to be independent of the potentially high dimensionality of the data [61, 62, 63]. Existing works [64, 65, 66] in the field have identified and resolved the statistical limits of outlier robust statistics by constructing estimators and proving impossibility results. In the future, it is a promising and interesting research direction to study the robustness of OOD detection based on robust statistics. + +PQ Learning Theory. Under some conditions, PQ learning theory [67, 68] can be regarded as the PAC theory for OOD detection in the semi-supervised or transductive learning cases, i.e., test data are required during training. Besides, [67, 68] aim to give the PAC estimation under Realizability Assumption [21]. Our theory does not only study the PAC estimation in the realization cases, but also studies the other cases, which are more difficult than PAC theory under Realizability Assumption. + +# 9 Conclusions and Future Works + +Detecting OOD data has shown its significance in improving the reliability of machine learning. However, very few works discuss OOD detection in theory, which hinders real-world applications of OOD detection algorithms. In this paper, we are the first to provide the PAC theory for OOD detection. Our results imply that we cannot expect a universally consistent algorithm to handle all scenarios in OOD detection. Yet, it is still possible to make OOD detection learnable in certain scenarios. For example, when we design OOD detection algorithms, we normally only have finite ID datasets. In this real scenario, Theorem 8 provides a necessary and sufficient condition for the success of OOD detection. Our theory reveals many necessary and sufficient conditions for the learnability of OOD detection, hence opening a door to studying the learnability of OOD detection. In the future, we will focus on studying the robustness of OOD detection based on robust statistics [64, 69]. + +# Acknowledgment + +JL and ZF were supported by the Australian Research Council (ARC) under FL190100149. YL is supported by the AFOSR Young Investigator Program Award. BH was supported by the RGC Early Career Scheme No. 22200720 and NSFC Young Scientists Fund No. 62006202. ZF would also like to thank Prof. Peter Bartlett and Dr. Tongliang Liu for productive discussions. + +# References + +[1] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021. +[2] Gao Huang, Zhuang Liu, Laurens van der Maaten, and Kilian Q. Weinberger. Densely connected convolutional networks. In CVPR, 2017. +[3] Yen-Chang Hsu, Yilin Shen, Hongxia Jin, and Zsolt Kira. Generalized ODIN: detecting out-of-distribution image without learning from out-of-distribution data. In CVPR, 2020. +[4] Jingkang Yang, Kaiyang Zhou, Yixuan Li, and Ziwei Liu. Generalized out-of-distribution detection: A survey. CoRR, abs/2110.11334, 2021. +[5] Abhijit Bendale and Terrance E Boult. Towards open set deep networks. In CVPR, 2016. +[6] Jiefeng Chen, Yixuan Li, Xi Wu, Yingyu Liang, and Somesh Jha. Atom: Robustifying out-of-distribution detection using outlier mining. ECML, 2021. +[7] Dan Hendrycks and Kevin Gimpel. A baseline for detecting misclassified and out-of-distribution examples in neural networks. In ICLR, 2017. +[8] Shiyu Liang, Yixuan Li, and R. Srikant. Enhancing the reliability of out-of-distribution image detection in neural networks. In ICLR, 2018. +[9] Kimin Lee, Kibok Lee, Honglak Lee, and Jinwoo Shin. A simple unified framework for detecting out-of-distribution samples and adversarial attacks. In NeurIPS, 2018. +[10] Bo Zong, Qi Song, Martin Renqiang Min, Wei Cheng, Cristian Lumezanu, Dae-ki Cho, and Haifeng Chen. Deep autoencoding gaussian mixture model for unsupervised anomaly detection. In ICLR, 2018. +[11] Stanislav Pidhorskyi, Ranya Almohsen, and Gianfranco Doretto. Generative probabilistic novelty detection with adversarial autoencoders. In NeurIPS, 2018. +[12] Eric T. Nalisnick, Akihiro Matsukawa, Yee Whye Teh, Dilan Gorur, and Balaji Lakshminarayanan. Do deep generative models know what they don't know? In ICLR, 2019. +[13] Dan Hendrycks, Mantas Mazeika, and Thomas G. Dietterich. Deep anomaly detection with outlier exposure. In ICLR, 2019. +[14] Jie Ren, Peter J. Liu, Emily Fertig, Jasper Snoek, Ryan Poplin, Mark A. DePristo, Joshua V. Dillon, and Balaji Lakshminarayanan. Likelihood ratios for out-of-distribution detection. In NeurIPS, 2019. +[15] Ziqian Lin, Sreya Dutta Roy, and Yixuan Li. Mood: Multi-level out-of-distribution detection. In CVPR, 2021. +[16] Mohammadreza Salehi, Hossein Mirzaei, Dan Hendrycks, Yixuan Li, Mohammad Hossein Rohban, and Mohammad Sabokrou. A unified survey on anomaly, novelty, open-set, and out-of-distribution detection: Solutions and future challenges. arXiv preprint arXiv:2110.14051, 2021. +[17] Yiyou Sun, Chuan Guo, and Yixuan Li. React: Out-of-distribution detection with rectified activations. In NeurIPS, 2021. +[18] Rui Huang, Andrew Geng, and Yixuan Li. On the Importance of Gradients for Detecting Distributional Shifts in the Wild. In NeurIPS, 2021. +[19] Stanislav Fort, Jie Ren, and Balaji Lakshminarayanan. Exploring the Limits of Out-of-Distribution Detection. In NeurIPS, 2021. +[20] Yifei Ming, Hang Yin, and Yixuan Li. On the impact of spurious correlation for out-of-distribution detection. AAAI, 2022. +[21] Shai Shalev-Shwartz and Shai Ben-David. Understanding machine learning: From theory to algorithms. Cambridge university press, 2014. +[22] Mehryar Mohri, Afshin Rostamizadeh, and Ameet Talwalkar. Foundations of machine learning. MIT press, 2018. + +[23] Weitang Liu, Xiaoyun Wang, John D. Owens, and Yixuan Li. Energy-based out-of-distribution detection. In NeurIPS, 2020. +[24] Zhen Fang, Jie Lu, Anjin Liu, Feng Liu, and Guangquan Zhang. Learning bounds for open-set learning. In ICML, 2021. +[25] Guangyao Chen, Peixi Peng, Xiangqian Wang, and Yonghong Tian. Adversarial reciprocal points learning for open set recognition. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2021. +[26] Lukas Ruff, Nico Gornitz, Lucas Deecke, Shoaib Ahmed Siddiqui, Robert A. Vandermeulen, Alexander Binder, Emmanuel Müller, and Marius Kloft. Deep one-class classification. In ICML, 2018. +[27] Sachin Goyal, Aditi Raghunathan, Moksh Jain, Harsha Vardhan Simhadri, and Prateek Jain. DROCC: deep robust one-class classification. In ICML, 2020. +[28] Lucas Deecke, Robert A. Vandermeulen, Lukas Ruff, Stephan Mandt, and Marius Kloft. Image anomaly detection with generative adversarial networks. In ECML, 2018. +[29] Z. Fang, Jie Lu, F. Liu, Junyu Xuan, and G. Zhang. Open set domain adaptation: Theoretical bound and algorithm. IEEE Transactions on Neural Networks and Learning Systems, 2020. +[30] Shai Shalev-Shwartz, Ohad Shamir, Nathan Srebro, and Karthik Sridharan. Learnability, stability and uniform convergence. J. Mach. Learn. Res., 11:2635-2670, 2010. +[31] Guangyao Chen, Limeng Qiao, Yemin Shi, Peixi Peng, Jia Li, Tiejun Huang, Shiliang Pu, and Yonghong Tian. Learning open set network with discriminative reciprocal points. ICCV, 2020. +[32] Jiefeng Chen, Yixuan Li, Xi Wu, Yingyu Liang, and Somesh Jha. Informative outlier matters: Robustifying out-of-distribution detection using outlier mining. ICML Workshop, 2020. +[33] Jiefeng Chen, Yixuan Li, Xi Wu, Yingyu Liang, and Somesh Jha. Robust out-of-distribution detection for neural networks. arXiv preprint arXiv:2003.09711, 2020. +[34] Wentao Bao, Qi Yu, and Yu Kong. Evidential deep learning for open set action recognition. ICCV, 2021. +[35] Wentao Bao, Qi Yu, and Yu Kong. Opental: Towards open set temporal action localization. CVPR, 2022. +[36] Donald L Cohn. Measure theory. Springer, 2013. +[37] Peter L. Bartlett, Nick Harvey, Christopher Liaw, and Abbas Mehrabian. Nearly-tight v-c-dimension and pseudodimension bounds for piecewise linear neural networks. Journal of Machine Learning Research, 20(63):1-17, 2019. +[38] Marek Karpinski and Angus Macintyre. Polynomial bounds for VC dimension of sigmoidal and general pfaffian neural networks. J. Comput. Syst. Sci., 54(1):169-176, 1997. +[39] Jingkang Yang, Kaiyang Zhou, and Ziwei Liu. Full-spectrum out-of-distribution detection. CoRR, 2022. +[40] Li Deng. The MNIST database of handwritten digit images for machine learning research [best of the web]. IEEE Signal Process. Mag., 2012. +[41] Gustaf Kylberg. Kylberg texture dataset v. 1.0. 2011. +[42] Alex Krizhevsky and Geoff Hinton. Convolutional deep belief networks on CIFar-10. Technical report, Citeseer, 2009. +[43] Bolei Zhou, Ágata Lapedriza, Aditya Khosla, Aude Oliva, and Antonio Torralba. Places: A 10 million image database for scene recognition. IEEE Trans. Pattern Anal. Mach. Intell., 2018. +[44] Yiyou Sun, Yifei Ming, Xiaojin Zhu, and Yixuan Li. Out-of-distribution detection with deep nearest neighbors. In ICML, 2022. +[45] Jie Ren, Stanislav Fort, Jeremiah Liu, Abhijit Guha Roy, Shreyas Padhy, and Balaji Lakshminarayanan. A simple fix to mahalanobis distance for improving near-ood detection. CoRR, abs/2106.09022, 2021. +[46] Stanislav Fort, Jie Ren, and Balaji Lakshminarayanan. Exploring the limits of out-of-distribution detection. In NeurIPS, 2021. + +[47] Yaroslav Bulatov. Notmnist dataset. Google (Books/OCR), Tech. Rep.[Online]. Available: http://yaroslavvbb.blogspot.it/2011/09/notmnist-dataset.html,2, 2011. +[48] Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. Cifar-10 and cifar-100 datasets. 2009. +[49] Lily H. Zhang, Mark Goldstein, and Rajesh Ranganath. Understanding failures in out-of-distribution detection with deep generative models. In ICML, 2021. +[50] Peyman Morteza and Yixuan Li. Provable guarantees for understanding out-of-distribution detection. AAAI, 2022. +[51] Si Liu, Risheek Garrepalli, Thomas G. Dietterich, Alan Fern, and Dan Hendrycks. Open category detection with PAC guarantees. In ICML, 2018. +[52] Yadan Luo, Zijian Wang, Zi Huang, and Mahsa Baktashmotlagh. Progressive graph learning for open-set domain adaptation. In ICML, 2020. +[53] C. K. Chow. On optimum recognition error and reject tradeoff. IEEE Transactions on Information Theory, 1970. +[54] Vojtech Franc, Daniel Prusă, and V. Voracek. Optimal strategies for reject option classifiers. CoRR, abs/2101.12523, 2021. +[55] Corinna Cortes, Giulia DeSalvo, and Mehryar Mohri. Learning with rejection. In ALT, 2016. +[56] Corinna Cortes, Giulia DeSalvo, and Mehryar Mohri. Boosting with abstention. In NeurIPS, 2016. +[57] Chenri Ni, Nontawat Charoenphakdee, Junya Honda, and Masashi Sugiyama. On the calibration of multiclass classification with rejection. In NeurIPS, 2019. +[58] Nontawat Charoenphakdee, Zhenghang Cui, Yivan Zhang, and Masashi Sugiyama. Classification with rejection based on cost-sensitive classification. In ICML, 2021. +[59] Peter L. Bartlett and Marten H. Wegkamp. Classification with a reject option using a hinge loss. Journal of Machine Learning Research, 2008. +[60] Peter J Rousseeuw, Frank R Hampel, Elvezio M Ronchetti, and Werner A Stahel. Robust statistics: the approach based on influence functions. John Wiley & Sons, 2011. +[61] Elvezio M Ronchetti and Peter J Huber. Robust statistics. John Wiley & Sons, 2009. +[62] Ilias Diakonikolas, Daniel M. Kane, and Ankit Pensia. Outlier robust mean estimation with subgaussian rates via stability. In NeurIPS, 2020. +[63] Ilias Diakonikolas, Daniel Kane, Sushrut Karmalkar, Eric Price, and Alistair Stewart. Outlier-robust high-dimensional sparse estimation via iterative filtering. In NeurIPS, 2019. +[64] Ilias Diakonikolas, Daniel M. Kane, Alistair Stewart, and Yuxin Sun. Outlier-robust learning of ising models under dobrushin's condition. In $COLT$ , 2021. +[65] Yu Cheng, Ilias Diakonikolas, Daniel M Kane, Rong Ge, Shivam Gupta, and Mahdi Soltanolkotabi. Outlier-robust sparse estimation via non-convex optimization. In NeurIPS, 2021. +[66] Ilias Diakonikolas, Daniel M Kane, Jasper CH Lee, and Ankit Pensia. Outlier-robust sparse mean estimation for heavy-tailed distributions. In NeurIPS, 2022. +[67] Shafi Goldwasser, Adam Tauman Kalai, Yael Kalai, and Omar Montasser. Beyond perturbations: Learning guarantees with arbitrary adversarial test examples. In NeurIPS, 2020. +[68] Adam Tauman Kalai and Varun Kanade. Efficient learning with arbitrary covariate shift. In ALT, Proceedings of Machine Learning Research, 2021. +[69] Ilias Diakonikolas and Daniel M. Kane. Recent advances in algorithmic high-dimensional robust statistics. A shorter version appears as an Invited Book Chapter in Beyond the Worst-Case Analysis of Algorithms, 2020. +[70] Akshay Raj Dhamija, Manuel Günther, and Terrance E. Boult. Reducing network agnostophobia. In NeurIPS, pages 9175–9186, 2018. +[71] Haoran Wang, Weitang Liu, Alex Bocchieri, and Yixuan Li. Can multi-label classification networks know what they don't know? In NeurIPS, 2021. +[72] Diederik P. Kingma and Prafulla Dhariwal. Glow: Generative flow with invertible 1x1 convolutions. In NeurIPS, 2018. + +[73] Zhisheng Xiao, Qing Yan, and Yali Amit. Likelihood regret: An out-of-distribution detection score for variational auto-encoder. In NeurIPS, 2020. +[74] Alireza Zaeemzadeh, Niccoló Bisagno, Zeno Sambugaro, Nicola Concí, Nazanin Rahnavard, and Mubarak Shah. Out-of-distribution detection using union of 1-dimensional subspaces. In CVPR, 2021. +[75] Joost Van Amersfoort, Lewis Smith, Yee Whye Teh, and Yarin Gal. Uncertainty estimation using a single deep deterministic neural network. In ICML, 2020. +[76] Sachin Vernekar, Ashish Gaurav, Vahdat Abdelzad, Taylor Denouden, Rick Salay, and Krzysztof Czarnecki. Out-of-distribution detection in classifiers via generation. In NeurIPS Workshop, 2019. +[77] Ryuichi Kiryo, Gang Niu, Martinus Christoffel du Plessis, and Masashi Sugiyama. Positive unlabeled learning with non-negative risk estimator. In NeurIPS, 2017. +[78] Takashi Ishida, Gang Niu, and Masashi Sugiyama. Binary classification from positive-confidence data. In NeurIPS, 2018. +[79] Shuo Chen, Gang Niu, Chen Gong, Jun Li, Jian Yang, and Masashi Sugiyama. Large-margin contrastive learning with distance polarization regularizer. In ICML, 2021. +[80] Jiahua Dong, Yang Cong, Gan Sun, Bineng Zhong, and Xiaowei Xu. What can be transferred: Unsupervised domain adaptation for endoscopic lesions segmentation. In CVPR, 2020. +[81] Zhen Fang, Jie Lu, Feng Liu, and Guangquan Zhang. Semi-supervised heterogeneous domain adaptation: Theory and algorithms. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2022. +[82] Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015. +[83] Arthur Gretton, Karsten M. Borgwardt, Malte J. Rasch, Bernhard Schölkopf, and Alexander J. Smola. A kernel two-sample test. Journal of Machine Learning Research, 2012. +[84] Itay Safran and Ohad Shamir. Depth-width tradeoffs in approximating natural functions with neural networks. In ICML, 2017. +[85] Allan Pinkus. Approximation theory of the mlp model in neural networks. Acta numerica, 8: 143-195, 1999. +[86] Peter L Bartlett and Wolfgang Maass. Vapnik-chervonenkis dimension of neural nets. The handbook of brain theory and neural networks, 2003. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] See Appendix B +(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Appendix B +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] +(b) Did you include complete proofs of all theoretical results? [Yes] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [N/A] +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [N/A] + +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A] +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [N/A] + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [N/A] +(b) Did you mention the license of the assets? [N/A] +(c) Did you include any new assets either in the supplemental material or as a URL? [N/A] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/isoutofdistributiondetectionlearnable/images.zip b/isoutofdistributiondetectionlearnable/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..dc07dab9206f88755ce11ae39b6e753231da92a7 --- /dev/null +++ b/isoutofdistributiondetectionlearnable/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:535f4aa3539835b6f0482f1b4ab34962ff83db77a7fbe92f544c78f4c5bc86eb +size 147308 diff --git a/isoutofdistributiondetectionlearnable/layout.json b/isoutofdistributiondetectionlearnable/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..c39d684ccf7b81dbbb0bfedb14076d5acc28ffdd --- /dev/null +++ b/isoutofdistributiondetectionlearnable/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a67c691b02d6cb574109affeecc318f08907d18045f2db4bddb7d0699502d701 +size 788779 diff --git a/issortitionbothrepresentativeandfair/78e573c2-b332-40b9-9620-c79511265531_content_list.json b/issortitionbothrepresentativeandfair/78e573c2-b332-40b9-9620-c79511265531_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..f3f7647f8ceb7c52f099d5968ffbb496653a2ef1 --- /dev/null +++ b/issortitionbothrepresentativeandfair/78e573c2-b332-40b9-9620-c79511265531_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:79f824224b60893f257c0cd8f3dbfc0893d1a67b241321debd3cfdcf0ecf084e +size 84855 diff --git a/issortitionbothrepresentativeandfair/78e573c2-b332-40b9-9620-c79511265531_model.json b/issortitionbothrepresentativeandfair/78e573c2-b332-40b9-9620-c79511265531_model.json new file mode 100644 index 0000000000000000000000000000000000000000..a8ff9847ab06d1469ec9fc26e0adb44c9d1d8b6d --- /dev/null +++ b/issortitionbothrepresentativeandfair/78e573c2-b332-40b9-9620-c79511265531_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1de30f098763a2621204e8bcf988cbc6fd95b069079f8fb8c7d0ed958eb54331 +size 104787 diff --git a/issortitionbothrepresentativeandfair/78e573c2-b332-40b9-9620-c79511265531_origin.pdf b/issortitionbothrepresentativeandfair/78e573c2-b332-40b9-9620-c79511265531_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..9c122ca4f4c5c967b4d84df8f74a2a9070a1671f --- /dev/null +++ b/issortitionbothrepresentativeandfair/78e573c2-b332-40b9-9620-c79511265531_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d27696e59e299af79bca165670cd4e47291c55c16df2d9279e0fb5306dfdec96 +size 607497 diff --git a/issortitionbothrepresentativeandfair/full.md b/issortitionbothrepresentativeandfair/full.md new file mode 100644 index 0000000000000000000000000000000000000000..ba272b61ce2ed8c82961683e47c9b95fea318dce --- /dev/null +++ b/issortitionbothrepresentativeandfair/full.md @@ -0,0 +1,391 @@ +# Is Sortition Both Representative and Fair? + +# Soroush Ebadian + +Department of Computer Science + +University of Toronto + +soroush@cs.toronto.edu + +# Evi Micha + +Department of Computer Science + +University of Toronto + +emicha@cs.toronto.edu + +# Gregory Kehne + +School of Engineering and Applied Sciences + +Harvard University + +gkehne@g.harvard.edu + +# Ariel D. Procaccia + +School of Engineering and Applied Sciences + +Harvard University + +arielpro@seas.harvard.edu + +# Nisarg Shah + +Department of Computer Science + +University of Toronto + +nisarg@cs.toronto.edu + +# Abstract + +Sortition is a form of democracy built on random selection of representatives. Two of the key arguments in favor of sortition are that it provides representation (a random panel reflects the composition of the population) and fairness (everyone has a chance to participate). Uniformly random selection is perfectly fair, but is it representative? Towards answering this question, we introduce the notion of a representation metric on the space of individuals, and assume that the cost of an individual for a panel is determined by the $q$ -th closest representative; the representation of a (random) panel is measured by the ratio between the (expected) sum of costs of the optimal panel for the individuals and that of the given panel. For $k/2 < q \leq k - \Omega(k)$ , where $k$ is the panel size, we show that uniform random selection is indeed representative by establishing a constant lower bound on this ratio. By contrast, for $q \leq k/2$ , no random selection algorithm that is almost fair can give such a guarantee. We therefore consider relaxed fairness guarantees and develop a new random selection algorithm that sheds light on the tradeoff between representation and fairness. + +# 1 Introduction + +Most people think of democracy as synonymous with elections. But that has not always been the case: from the inception of democracy in ancient Athens until the American and French revolutions, democracy had typically been associated with random selection of representatives [1], a paradigm known as sortition. + +These days, sortition is mainly practiced in the form of citizens' assemblies—randomly selected groups of people who deliberate on central questions, with the goal of generating recommendations and informing policy. The impact and prevalence of citizens' assemblies around the world have motivated computational work on how to fairly and transparently select assembly members [2-4]. But there are signs that sortition is becoming even more widely accepted, including its recent institutionalization in Belgium, where permanent sortition-based bodies are now working alongside the parliaments of the German-speaking region and the Brussels region. In light of this progress, it + +may only be a matter of time until one of the many blueprints for sortition-based democracy [5] is implemented at the level of an entire country. + +The excitement about sortition is driven by several appealing qualities, which are seen as providing solutions to some of the problems plaguing electoral democracy. We briefly present two of them in the context of uniform selection, which selects a uniformly random panel and is considered to be the ideal sortition method [6]. + +- Descriptive representation: A panel selected uniformly at random is likely to reflect the composition of the population from which it was drawn. Representation lends legitimacy to the process [7, 8], as individuals are able to identify some panelists who are similar to themselves.1 +- Fairness: Under uniform selection, each individual has an equal chance to participate. Political theorists have argued that this quality realizes philosophical ideals like equality of opportunity and allocative justice [10]. + +By any reasonable measure of the fairness of selection probabilities — e.g., the minimum selection probability of any individual [2] — uniform selection achieves perfect fairness, as selection probabilities are equalized. We ask: Is uniform selection also representative in a rigorous sense? If we had an analogous measure of representation, we would be able to explore whether this is the case. But quantifying representation poses a conceptual challenge. + +Our approach. We address this challenge by assuming that there exists a representation metric on individuals, which measures to what degree one individual represents another (smaller distance means better representation). Readers familiar with the algorithmic fairness literature will no doubt make the connection to the similarity metric of Dwork et al. [11], which has been criticized on the grounds that it is difficult to explicitly construct [12]; a major obstacle is that the question of whether certain features should be used to determine similarity is domain-specific and tied to legal interpretation. By contrast, the prospect of constructing a representation metric is perhaps more tractable for practitioners. This is because the organizers of a citizens assembly (say) can choose it to be a function of a common set of features which are already routinely used by practitioners for the purpose of guaranteeing the representation of selection rules. Moreover, some of our main results, which pertain to uniform selection, are fully independent of the metric—for these results it suffices to suppose that such a metric exists. + +Note, however, that a distance metric (on individuals) does not directly define a measure of the degree to which an individual is represented by a panel. Following very recent work by Caragiannis et al. [13], we assume that the cost of a panel for an individual is determined by the $q$ -th closest member of the panel, and our results are parameterized by $q$ . + +We can now define representation by taking a page from the literature on distortion in social choice [14]. Specifically, for a given selection algorithm, we measure its representation via the ratio between the social cost (sum of costs) of the optimal panel and that of the panel chosen by the algorithm, in the worst case over underlying representation metrics. + +Our results. Returning to the question of whether uniform selection is also representative, and, more generally, the eponymous question of whether sortition is both representative and fair, our answer is that "it depends" on the value of $q$ . + +When $k / 2 < q \leq k - \Omega(k)$ , where $k$ is the size of the panel, we show that uniform selection (which is perfectly fair) achieves constant representation. Qualitatively, we view this as providing positive answers to our questions in the regime of $q > k / 2$ . Note that this regime has a natural interpretation: each individual wants a majority of the panel to be representative of themselves. This is especially justifiable when the panel makes decisions or recommendations through voting, which is often the case in citizens' assemblies. + +By contrast, for the regime of $q \leq k / 2$ , we prove that any selection algorithm that chooses each individual with probability somewhat higher than $q / n$ , where $n$ is the number of individuals, must in the worst case have representation of precisely 0. This result clearly applies to uniform selection, where + +the minimum selection probability is $k / n$ , and it motivates us to consider weaker fairness guarantees. We design an algorithm, RANDOMREPLACE, which selects each individual with probability at least $q / n$ and has a nontrivial representation guarantee of $1 / (q + 1)$ for any value of $q$ . + +Finally, we evaluate the average-case representation of uniform selection and RANDOMREPLACE on inferred metrics derived from two demographic datasets. For $q > k / 2$ , our experiments show that uniform selection achieves representation consistently greater than $55\%$ . Even for $q \leq k / 2$ in contrast to our worst-case result, uniform selection achieves good average-case representation. These results suggest that, in practice, uniform selection may be a good choice for all $q$ -cost distance functions. While RANDOMREPLACE outperforms uniform selection across the board in terms of representation (at the expense of fairness), its advantage is small for values of $q$ around $k / 2$ and close to $k$ , which means it does not offer a good representation-fairness tradeoff in those regimes. Lastly, for both algorithms, we observe a spike in representation at $q = k / 2$ , which demonstrates that the chasm between provable guarantees for $q \leq k / 2$ versus $q > k / 2$ is not merely a theoretical curiosity. + +Related work. The design of practical, fair and transparent algorithms for selecting citizens' assemblies was explored in several previous papers [2-4]—two of which appeared in previous NeurIPS conferences. Assemblies are required to be representative of the population with respect to features like gender, age, ethnicity, education and geography. This is generally done by setting quotas on individual features; for example, a panel of 100 people might be required to include at least 48 men, at least 48 women, and at least 2 people who identify as non-binary. The challenge is that an assembly is selected from a pool of volunteers, and this pool is typically unrepresentative of the population due to self-selection bias. Uniformly random selection from the pool, therefore, would likely itself result in an unrepresentative panel. Instead, the primary selection algorithm advocated by Flanigan et al. [2] computes a distribution over quota-compliant panels that (roughly speaking) maximizes the minimum selection probability of any volunteer, thereby maximizing fairness subject to these hard demographic constraints. By contrast, like Benadè et al. [15] and the political theory literature, we take a longer-term view: We are interested in random selection directly from the population, which is a hallmark of some plans for sortition-based democracy [5]. In addition, we take a fundamentally different, and arguably more nuanced, view of representation. Indeed, our framework can theoretically accommodate considerations of intersectionality (to what degree is a rural, college-educated man represented by a rural, college-educated woman?) and could also capture a more holistic analysis of the composition of the panel (to what degree is a rural, college-educated man represented by a panel that includes 10 rural, college-educated men and 90 urban women with no college education?). Lang and Skowron [16], Celis et al. [17], and Do et al. [18] also study the problem of creating committees or assemblies in which the features of the participants satisfy some desired quotas, but in the absence of an underlying representation metric and any fairness constraints. + +Our approach to evaluating representation through a metric is rooted in spatial theories of voting from political theory [19, 20]. The idea of measuring how poorly a panel represents an individual by the distance of the $q$ -th closest panel member to the individual was introduced by Caragiannis et al. [13] in the context of committee elections. Finally, aiming to minimize the total misrepresentation across all people and comparing that to the optimal panel makes our representation measure the inverse of distortion in voting theory [21, 22]. In voting, it is assumed that we only have partial access to the metric in the form of voters' ranked preferences over the candidates, which are induced by distance comparisons. In contrast, our results for uniform selection use no knowledge of the underlying metric, while our other algorithms assume complete access. When selecting a single candidate as the winner, it is known that the best distortion achievable by deterministic selection is 3 (which maps to $1/3$ representation in our formulation) [23]. Our setting is closer to committee selection, where a committee of $k$ candidates is selected. Here, Caragiannis et al. [13] show that when each voter measures her distance to the $q$ -th closest committee member, there is a trichotomy: the best possible distortion is infinite when $q \leq k/3$ , linear in the number of voters when $q \in (k/3, k/2]$ , and 3 for deterministic selection when $q > k/2$ . Sortition may be viewed as a special case of randomized committee elections, in which the set of candidates is the same as the set of voters. Hence, all the positive results from Caragiannis et al. [13] carry over in the absence of any fairness constraints. However, our results show that when (perfect) fairness in selection probabilities is sought in conjunction with representation, the distortion becomes infinite (zero representation) for all $q \leq k/2$ but constant distortion can still be achieved for $q > k/2$ . The idea of the set of voters acting as the set of candidates was explored by Cheng et al. [24, 25]. However, they model infinitely many voters using a continuous distribution over the metric space. + +# 2 Preliminaries + +For all $t \in \mathbb{N}$ , define $[t] = \{1, \dots, t\}$ . Let $N = [n]$ be the set that indexes the underlying population. A panel $P$ is a subset of the population. Let $S_{k}(N)$ denote the set of all subsets of $N$ of size $k$ . (We omit $N$ when it is clear from the context.) The population lies in a metric space with distance $d$ , which we view as the representation metric discussed earlier. For each $i, j \in N$ , $d(i, j)$ denotes the distance between $i$ and $j$ ; $d$ is a metric if the following properties are satisfied: (a) $d(i, j) \geq 0$ , and $d(i, j) = 0$ if and only if $i = j$ , (b) $d(i, j) = d(j, i)$ , and (c) for each $i, j, \ell \in N$ , $d(i, \ell) + d(\ell, j) \geq d(i, j)$ . The last property is known as the triangle inequality. An instance of our problem is given by the underlying population along with distances as defined by $d$ ; hereinafter, we simply denote such an instance by $d$ . + +Given a panel $P$ of size $k$ and a positive integer $q \in [k]$ , the $q$ -cost of individual $i$ for $P$ , denoted by $c_{q}(i, P; d)$ , is equal to the distance of $i$ from her $q$ -th closest representative in $P$ . Note that for $q = 1$ , we have $c_{1}(i, P; d) = \min_{j \in P} d(i, j)$ and for $q = k$ we get $c_{k}(i, P; d) = \max_{j \in P} d(i, j)$ . Let $\mathrm{top}_{q}(i, P; d)$ be the set of $q$ closest members of $P$ to $i$ (with ties broken arbitrarily). The $q$ -social cost of panel $P$ is given by $\mathrm{SC}_{q}(P; d) = \sum_{i \in N} c_{q}(i, P; d)$ , i.e., the sum of the $q$ -costs over all individuals. (Observe that if $q = 1$ then $\mathrm{SC}_{q}(P; d)$ is the standard $k$ -medians clustering objective evaluated for centers $P$ .) We omit $d$ from the notation when it is clear from the context. + +In this setting, a selection algorithm $\mathcal{A}_{k,q}$ parameterized by $k$ and $q$ takes as input the metric $d$ and outputs a distribution over all panels of size $k$ . We are especially interested in the uniform selection algorithm, denoted by $\mathcal{U}_k$ , that always outputs a uniform distribution over $\mathcal{S}_k$ , regardless of $q$ . In other words, it does not take into account the underlying metric space or $q$ , but instead outputs a committee of size $k$ chosen uniformly at random. We now formally introduce the fairness and representation of a selection algorithm. + +Fairness: One appealing property of uniform selection is that each individual is selected to be part of the panel with probability exactly equal to $k / n$ , i.e., $\operatorname*{Pr}[i\in \mathcal{U}_k] = \frac{k}{n}$ . In particular, all individuals have an equal chance of being chosen. We call this property perfect fairness; in general an algorithm $\mathcal{A}_{k,q}$ provides perfect fairness when for each instance $d$ , it ensures that $\min_{i\in N}\operatorname*{Pr}[i\in \mathcal{A}_{k,q}] = k / n$ . + +When perfect fairness is too restrictive, we relax this constraint by allowing individuals to be selected with probability less than $k / n$ . In this case, the fairness of an algorithm $\mathcal{A}_{k,q}$ is the worst-case ratio of the minimum probability of an individual to be selected by the algorithm and the ideal selection probability of $k / n$ . Formally, + +$$ +\mathsf {f a i r n e s s} _ {q} (\mathcal {A} _ {k, q}) = \inf _ {d} \frac {\min _ {i \in N} \Pr [ i \in \mathcal {A} _ {k , q} (d) ]}{k / n}. +$$ + +Representation: The other key property we would like to measure is representation. To do so, we consider a panel to be a good representative of the whole population when its $q$ -social cost is not much larger than the best possible. In other words, a selection algorithm $\mathcal{A}_{k,q}$ that outputs a distribution over the different committees of size $k$ provides good representation when the expected $q$ -social cost of the panel is similarly small. More formally, we define the representation of a selection algorithm $\mathcal{A}_{k,q}$ as the worst-case ratio of the minimum possible social $q$ -cost of any panel and the expected $q$ -social cost of the panel chosen by $\mathcal{A}_{k,q}$ over all possible instances; i.e., + +$$ +\mathsf {r e p r} _ {q} (\mathcal {A} _ {k, q}) = \inf _ {d} \frac {\min _ {P ^ {\prime} \in \mathcal {S} _ {k} (N)} \mathrm {S C} _ {q} (P ^ {\prime} ; d)}{\mathbb {E} [ \mathrm {S C} _ {q} (\mathcal {A} _ {k , q} (d) ]}. +$$ + +# 3 Representation with Perfect Fairness for $q > k / 2$ + +We begin by considering the case that $q > k / 2$ . We show that in this case uniform selection is asymptotically optimal with respect to representation among all selection algorithms that are perfectly fair. Moreover, the representation of uniform selection is constant for any $q = c \cdot k$ for $1 / 2 < c < 1$ . + +Theorem 1. For $q > k / 2$ , uniform selection satisfies $\mathsf{repr}_q(\mathcal{U}_k) \geq \frac{1}{2} \cdot \frac{k - q + 1}{k}$ . + +A crucial property that we exploit in this section is that the $q$ -costs of the individuals satisfy the triangle inequality when $q > k/2$ . This observation was first made by Caragiannis et al. [13]; we present the lemma below for completeness. + +Lemma 1. For $q > k / 2$ , individuals $i,j \in N$ , and a panel $P$ , $c_{q}(i,P;d) + c_{q}(j,P;d) \geq d(i,j)$ . + +Proof. Let $T_{i} = \mathrm{top}_{q}(i,P)$ and $T_{j} = \mathrm{top}_{q}(i,P)$ be the $q$ closest neighbors of $i$ and $j$ , respectively, in the panel $P$ . As $|T_{i}| = |T_{j}| > k / 2$ , there exists an individual $k \in T_{i} \cap T_{j}$ . Therefore, + +$$ +d (i, j) \leq d (i, k) + d (k, j) \leq c _ {q} (i, P) + c _ {q} (j, P). +$$ + +We use this observation to lower bound the social cost of the optimal committee. + +Lemma 2. For $q > k / 2$ , the $q$ -social cost of the optimal panel $P^{*}$ is at least + +$$ +\operatorname {S C} _ {q} (P ^ {*}; d) \geq \frac {1}{2 (n - 1)} \cdot \sum_ {i \in N} \sum_ {j \in N \backslash \{i \}} d (i, j). +$$ + +Proof. By applying Lemma 1 for all pairs of individuals $(i,j)$ , we get + +$$ +\sum_ {i \in N} \sum_ {j \in N \backslash \{i \}} \left(c _ {q} (i, P ^ {*}) + c _ {q} (j, P ^ {*})\right) \geq \sum_ {i \in N} \sum_ {j \in N \backslash \{i \}} d (i, j). +$$ + +The $q$ -cost of each person appears exactly $2(n - 1)$ times on the left hand side. Thus, + +$$ +\operatorname {S C} _ {q} (P ^ {*}; d) = \sum_ {i \in N} c _ {q} (i, P ^ {*}) \geq \frac {1}{2 (n - 1)} \sum_ {i \in N} \sum_ {j \in N \backslash \{i \}} d (i, j). +$$ + +![](images/2cd9e039d509408b7d35fd9476021e30e219f40fbd4855e68002581651084461.jpg) + +We are now ready to prove the theorem. + +Proof of Theorem 1. For any committee $P$ of size $k$ , + +$$ +\begin{array}{l} c _ {q} (i, P) = \min _ {q ^ {\prime} \in \{q, \dots , k \}} c _ {q ^ {\prime}} (i, P) \leq \frac {1}{k - q + 1} \sum_ {q ^ {\prime} \in [ q, k ]} c _ {q ^ {\prime}} (i, P) \\ \leq \frac {1}{k - q + 1} \sum_ {q ^ {\prime} \in [ 1, k ]} c _ {q ^ {\prime}} (i, P) = \frac {1}{k - q + 1} \sum_ {j \in P} d (i, j), \\ \end{array} +$$ + +where in the first inequality the minimum is upper bounded by the average. Therefore, the expected social cost of uniform selection is at most + +$$ +\begin{array}{l} \mathbb {E} \left[ \operatorname {S C} _ {q} \left(\mathcal {U} _ {k} (N)\right) \right] = \sum_ {i \in N} \mathbb {E} _ {P \sim \mathcal {U} _ {k}} \left[ c _ {q} (i, P) \right] \\ \leq \frac {1}{k - q + 1} \sum_ {i \in N} \mathbb {E} _ {P \sim \mathcal {U} _ {k}} \left[ \sum_ {j \in P} d (i, j) \right] \\ = \frac {1}{k - q + 1} \sum_ {i \in N} \sum_ {j \in N \backslash \{i \}} d (i, j) \cdot \Pr_ {P \sim \mathcal {U} _ {k}} [ j \in P ] \\ = \frac {1}{k - q + 1} \sum_ {i \in N} \sum_ {j \in N \backslash \{i \}} d (i, j) \cdot \frac {k}{n}. \\ \end{array} +$$ + +By Lemma 2 and the upper bound shown above, we have + +$$ +\operatorname {r e p r} _ {q} \left(\mathcal {U} _ {k}\right) \geq \frac {\frac {1}{2 (n - 1)} \sum_ {i \in N} \sum_ {j \in N \backslash \{i \}} d (i , j)}{\frac {1}{k - q + 1} \cdot \frac {k}{n} \cdot \sum_ {i \in N} \sum_ {j \in N \backslash \{i \}} d (i , j)} = \frac {1}{2} \cdot \frac {n}{n - 1} \cdot \frac {k - q + 1}{k} \geq \frac {1}{2} \cdot \frac {k - q + 1}{k}. +$$ + +In the proof above, the only property of uniform selection we use is that the marginal probabilities are equal to $k / n$ . Hence, this lower bound also holds for any perfectly fair selection algorithm. + +We next establish an upper bound on the representation of any perfectly fair selection algorithm. It shows that the lower bound of Theorem 1 is tight up to a factor of 4. + +Theorem 2. For any $q > k / 2$ , every selection algorithm $\mathcal{A}_{k,q}$ with fairness $(\mathcal{A}_{k,q}) = 1$ satisfies $\mathrm{repr}_q(\mathcal{A}_{k,q}) \leq 2 \cdot \frac{k - q + 1}{k + 1}$ . + +Proof. First, note that if $q = \frac{k + 1}{2}$ , the statement trivially holds, since $\mathrm{repr}_q(\mathcal{A}_{k,q}) \leq 2 \cdot \frac{k - q + 1}{k + 1} = 1$ which is true for any algorithm. Thus, we assume $q > \frac{k + 1}{2}$ . Consider an instance with $n = k + 1$ individuals where $k - q + 1$ individuals are located at 0 and $q$ individuals are at 1, denoted by $N_0$ and $N_1$ , respectively. Any committee of size $k$ leaves one person out of the committee, and for each individual $i \in N$ , this happens with probability of + +$$ +\Pr_ {P \sim \mathcal {A} _ {k, q}} [ i \notin P ] = 1 - \Pr_ {P \sim \mathcal {A} _ {k, q}} [ i \in P ] = (1 - \frac {k}{k + 1}) = \frac {1}{k + 1}. +$$ + +Individuals in $N_0$ will always have a $q$ -cost of 1, because $k + 1 - q < \frac{k + 1}{2} < q$ individuals are located there. Therefore, $\mathbb{E}_{P \sim \mathcal{A}_{k,q}}[\sum_{i \in N_0} c_q(i, P)] = |N_0|$ . For individuals in $N_1$ , their $q$ -cost is 1 if and only if less than $q$ individuals are selected from $N_1$ , i.e., the single person left out of the committee is located at 1. This event happens with probability + +$$ +\Pr_ {P \sim \mathcal {A} _ {k, q}} [ \bigcup_ {i \in N _ {1}} (i \notin P) ] = \sum_ {i \in N _ {1}} \Pr_ {P \sim \mathcal {A} _ {k, q}} [ i \notin P ] = \frac {| N _ {1} |}{k + 1}, +$$ + +where the first equality comes from the fact that the events are disjoint (which holds because any committee leaves out exactly one individual). Therefore, $\mathbb{E}_{P\sim \mathcal{A}_{k,q}}[\sum_{i\in N_1}c_q(i,P)] = |N_1|\cdot \frac{|N_1|}{k + 1}$ , and the expected social cost of any perfectly fair algorithm is + +$$ +\mathbb {E} _ {P \sim \mathcal {A} _ {k, q}} [ \operatorname {S C} _ {q} (P; d) ] = | N _ {0} | + | N _ {1} | \cdot \frac {q}{k + 1} \geq | N _ {0} | + | N _ {1} | \cdot \frac {1}{2}. +$$ + +The optimal committee would leave out a person from $N_0$ and achieve a social cost of $|N_0|$ . Therefore, the representation of any algorithm with perfect fairness is at most + +$$ +\frac {\left| N _ {0} \right|}{\left| N _ {0} \right| + \frac {1}{2} \cdot \left| N _ {1} \right|} \leq \frac {\left| N _ {0} \right|}{\frac {1}{2} \cdot \left| N _ {0} \right| + \frac {1}{2} \cdot \left| N _ {1} \right|} = 2 \cdot \frac {k - q + 1}{k + 1}. +$$ + +![](images/be2869d7361900a019f649b106166991777cadfb5f0ab060163d3acb25c4c3c1.jpg) + +# 4 Representation with Relaxed Fairness for $q \leq k / 2$ + +In stark contrast to the case of $q > k / 2$ , uniform selection and, more generally, any perfectly fair selection algorithm, cannot obtain bounded representation when $q \leq k / 2$ . In fact, the following theorem shows that selection algorithms with fairness strictly more than $\frac{q + (k \bmod q)}{k}$ (which itself is upper bounded by $(2q - 1) / k$ ) suffer from unbounded representation. The proof is in Appendix A. + +Theorem 3. For $q \leq k/2$ , $\epsilon > 0$ , and any selection algorithm $\mathcal{A}_{k,q}$ with fairness $(\mathcal{A}_{k,q}) \geq \frac{q + (k \bmod q)}{k} + \epsilon$ , $\mathrm{repr}_q(\mathcal{A}_{k,q})$ is $0$ . + +Although bounded representation is not feasible with fairness slightly larger than $\frac{q}{k}$ , we design a selection algorithm that, given an $\alpha$ -representative panel, can achieve representation of at least $\frac{\alpha}{q + 1}$ with fairness of $\frac{q}{k}$ . In particular, starting from the optimal panel $(\alpha = 1)$ , it achieves $\frac{1}{q + 1}$ representation. Although finding the optimal panel given the metric space is an NP-hard problem for most metric spaces, computing a constant-factor approximation (i.e., constant $\alpha$ ) is feasible in polynomial time [26], as we explain in Section 5. + +Our Algorithm, RANDOMREPLACE $_q$ , is given in Algorithm 1. It starts from a panel $P$ , randomly selects a panel $S$ of $q$ individuals, and replaces individuals in $P$ with individuals in $S$ as follows. First, individuals in $S \cap P$ remain in the final panel. Then, for $i \in S \setminus P$ , swap $i$ with one of its $q$ -closest neighbors in the optimal panel $\mathrm{top}_q(i, P)$ that has not been replaced by the algorithm yet. The next theorem establishes the fairness and representation guarantees of RANDOMREPLACE. + +Theorem 4. For any $q \in [k]$ and any panel $P$ with $\mathrm{repr}_q(P) = \alpha$ , we have that $\mathrm{repr}_q(\mathrm{RANDOMREPLACE}_q(P)) \geq \frac{\alpha}{q + 1}$ and $\mathrm{fairness}(\mathrm{RANDOMREPLACE}_q) \geq \frac{q}{k}$ . + +Proof. Let $S \subseteq N$ be a set of size $q$ chosen uniformly at random. We denote with $P_S$ the panel that is returned from the algorithm. First, we show that Line 4 of the algorithm is valid. The algorithm reaches this line when it considers $i \in S \setminus P_S$ , meaning that $i$ is not included in the panel $P_S$ and therefore is not included in $P$ . Hence, $\operatorname{top}_q(i, P) \setminus S$ cannot be empty since $|\operatorname{top}_q(i, P)| = q$ , $|S| = q$ and there exists $i$ in $S$ but not in $\operatorname{top}_q(i, P)$ . + +ALGORITHM 1: RANDOMREPLACEq +Input: Panel $P$ with $\mathrm{repr}_q(P) = \alpha$ +Output: Randomly selected panel by replacing at most $q$ individuals of $P$ 1: Pick $S\in S_q$ uniformly at random 2: Set $P_{S}\gets P$ and $\overline{S}\gets S\setminus P$ 3: for $i\in \overline{S}$ do 4: Pick an arbitrary $j_{i}\in \mathrm{top}_{q}(i,P)\setminus S$ 5: $P_{S}\leftarrow P_{S}\cup \{i\} \setminus \{j_{i}\}$ 6: end for 7: return $P_S$ + +We see that every individual in $S$ is included in $P_S$ as in Line 5 the algorithms ensure that each such individual is included and is never excluded afterwards. Hence, as each individual is chosen in $S$ with probability at least $q / n$ , we can see that fairness(RANDOMREPLACE $_q$ ) $\geq q / k$ . + +Now, we prove that for any $S \in S_q$ and any individual $i' \in N$ , + +$$ +c _ {q} \left(i ^ {\prime}, P _ {S}\right) \leq c _ {q} \left(i ^ {\prime}, P\right) + \max _ {i \in S} c _ {q} (i, P) \leq c _ {q} \left(i ^ {\prime}, P\right) + \sum_ {i \in S} c _ {q} (i, P). \tag {1} +$$ + +The second inequality holds as the maximum is at most the sum. Therefore, we focus on the first inequality. If $c_{q}(i^{\prime},P_{S})\leq c_{q}(i^{\prime},P)$ , then it trivially holds. Otherwise, $c_{q}(i^{\prime},P_{S}) > c_{q}(i^{\prime},P)$ . In this case, we can show that there exists some $i\in S\setminus P$ such that $d(i^{\prime},i)\geq c_{q}(i^{\prime},P_{S})$ and $j_{i}\in \mathsf{top}_{q}(i^{\prime},P)$ . First, note if for each $i\in S\setminus P^{*}$ , $j_{i}$ does not belong in $\mathsf{top}_q(i',P)$ , then it is not possible that $c_{q}(i^{\prime},P_{S}) > c_{q}(i^{\prime},P)$ , since $\mathsf{top}_q(i',P)\subseteq P_S$ . Next, suppose for contradiction that for every $i$ that was included in $P_S$ when $j_{i}\in \mathsf{top}_{q}(i^{\prime},P)$ was excluded from it, it holds that $d(i^{\prime},i) < c_{q}(i^{\prime},P)$ . Then, in $P_S$ there are $|\mathsf{top}_q(i',P)\backslash \cup_{i\in S\setminus P}(\{j_i\} \cap \mathsf{top}_q(i',P))|$ individuals that have distance at most $c_{q}(i^{\prime},P) < c_{q}(i^{\prime},P_{S})$ from $i^{\prime}$ and $|\{i\in S\setminus P:j_i\in \mathsf{top}_q(i',P)\} |$ individuals that have distance less than $c_{q}(i^{\prime},P_{S})$ from $i^{\prime}$ . Note that + +$$ +\left. \mid \cup_ {i \in S \backslash P} \left(\left\{j _ {i} \right\} \cap \mathsf {t o p} _ {q} \left(i ^ {\prime}, P\right)\right) \right| = \left| \left\{i \in S \backslash P: j _ {i} \in \mathsf {t o p} _ {q} \left(i ^ {\prime}, P\right) \right\} \right|, +$$ + +and hence we get that there are at least $|\operatorname{top}_q(i', P)| = q$ individuals in $P_S$ with distance strictly less than $c_q(i', P_S)$ from $i'$ , which is a contradiction. + +From the above observation, we have that + +$$ +c _ {q} (i ^ {\prime}, P _ {S}) \leq d (i ^ {\prime}, i) \leq d (i ^ {\prime}, j _ {i}) + d (j _ {i}, i) \leq c _ {q} (i ^ {\prime}, P) + c _ {q} (i, P) \leq c _ {q} (i ^ {\prime}, P) + \max _ {i \in S} c _ {q} (i, P) +$$ + +where the penultimate inequality holds because $j_{i} \in \mathrm{top}_{q}(i', P)$ and $j_{i} \in \mathrm{top}_{q}(i, P)$ from the definition of $j_{i}$ . This proves (1). + +Summing (1) over all $i' \in N$ , we have $\mathrm{SC}_q(P_S) \leq \mathrm{SC}_q(P) + n \cdot \sum_{i \in S} c_q(i, P)$ . Taking the expectation of this equation with respect to $S$ , and using the fact that $\operatorname*{Pr}[i \in S] = q / n$ , we have + +$$ +\mathbb {E} [ \mathrm {S C} _ {q} (P _ {S}) ] \leq \mathrm {S C} _ {q} (P) + n \cdot \sum_ {i \in N} \frac {q}{n} \cdot c _ {q} (i, P) = (q + 1) \cdot \mathrm {S C} _ {q} (P), +$$ + +that is, $\frac{1}{q + 1} \cdot \mathbb{E}[\mathrm{SC}_q(P_S)] \leq \mathrm{SC}_q(P)$ . Combined with the assumption that $P$ is $\alpha$ -representative, i.e., $\alpha \cdot \mathrm{SC}_q(P) \leq \min_{P' \in S_k(N)} \mathrm{SC}_q(P')$ , we get $\mathrm{repr}_q(\mathrm{RANDOMREPLACE}_q(P)) \leq \frac{\alpha}{k + 1}$ . + +The next theorem shows that when $q = \Omega(k)$ , RANDOMREPLACE $_q$ attains an asymptotically optimal representation-fairness tradeoff. + +Theorem 5. For any $q \leq k/2$ such that $k \bmod q = 0$ , every selection algorithm $\mathcal{A}_{k,q}$ with fairness $(\mathcal{A}_{k,q}) \geq q/k$ satisfies $\mathrm{repr}_q(\mathcal{A}_{k,q}) \leq k/q^2$ . + +Proof. Let $m = k / q$ . Consider an instance with $n > 2k$ individuals on the real line, where one individual $i_0$ is located at 0, $\lceil n / m \rceil - 1$ people are at 1, and at least $\lfloor n / m \rfloor$ people are located at + +each position $j \in \{2, \dots, m\}$ . This way, there are at least $n / m - 1 = (n / k) \cdot q - 1 \geq 2q - 1 \geq q$ individuals located at each $j \in [m]$ . + +Any optimal panel would include $q$ individuals from each position $j \in [m]$ , which results in a $q$ -cost of 1 for $i_0$ and a $q$ -cost of 0 for the rest. Hence, $\mathrm{SC}_q(P^*) = 1$ . However, any selection algorithm with fairness of at least $q / k$ selects $i_0$ with probability of at least $q / n$ . When $i_0$ is selected, there must exist a group $j \in [m]$ from which the algorithm selects at most $q - 1$ people, incurring a $q$ -cost of 1 for at least $n / m$ people (person $i_0$ and at least $n / m - 1$ people at position $j$ ). Hence, + +$$ +\mathbb {E} [ \mathrm {S C} _ {q} (\mathcal {A} _ {k, q}) ] \geq \frac {q}{n} \cdot \frac {n q}{k} = \frac {q ^ {2}}{k}, +$$ + +which completes the proof. + +![](images/97b7c036c55100103732e2d4a806f5e5222845a64566230721a4b4181d2824d8.jpg) + +From the above theorem, it follows that Algorithm 1 achieves the highest possible fairness of $q / k$ subject to positive representation. + +# 5 Experiments + +Next, to complement the worst-case analysis of the selection algorithms we have considered so far, we conduct an empirical comparison between the average-case $q$ -social cost and representation (repr $_q$ ) of the different selection methods. + +Datasets. Data on the metric-structure preferences of groups in their full richness are difficult to come by, but it is reasonable to expect that the extent to which individuals feel well-represented by one another is at least partly a function of their relative characteristics along some observable features. We therefore begin with two datasets that express the characteristics of populations along a range of features, and randomly construct synthetic metric preferences from these feature signatures. + +Adult dataset. Our first source of demographic data is the UCI Adult dataset, which was derived from the 1994 Current Population Survey of the US Census Bureau, and is made available by the UCI Machine Learning Repository under a CC BY 4.0 license [27]. It contains a range of demographic variables principally related to employment. Our experiments do not require Adult to be representative of any actual population, nor should this an assumption be made lightly [28]. For Adult we choose the features workclass, education, marital status and sex. Adult contains $n = 30162$ individuals with values for each feature, who may be viewed as a distribution over the 721 unique feature vectors which they collectively hold. + +ESS dataset. Our second source of demographic data is the European Social Survey (ESS) [29], which is made available by the Norwegian Centre for Research Data under a CC BY 4.0 license. We use the ESS Round 9 (2018) data, which consists of 46,276 people in 27 countries, and contains $\sim 1450$ features regarding socioeconomic demographic, political beliefs, geographical region, house-hold composition, personal values, media use and trust, etc. Most of the features are country-specific, which leaves roughly 250 features available per country, while each country has between 781 and 2745 entries (with a mean of 1713). Each entry is assigned an analysis weight which is aimed to correct the differential selection probabilities. In contrast to our experiments with Adu1t, we use all of the available features available in ESS. We report the experiment results based on the data of the United Kingdom (2204 entries). Similar results were obtained using the data from other countries. + +Metric construction. We choose some set of features along which to evaluate the individuals in the population. These are the features which will inform our metric. For each feature $s$ , $F^s$ is the set of possible values that this feature can take. Each individual $i$ is then represented as a vector of feature values, where $f_i^s$ is the value that $i$ has for feature $s$ . For categorical features (e.g., marital status, sex), we define $d(i,j;s) = 1 - \mathbb{1}\{f_i^s = f_j^s\}$ . For range (e.g., income) features we define $d(i,j;s) = |f_i^s - f_j^s| / (\max_{i',j'} |f_{i'}^s - f_{j'}^s|)$ , where the normalization makes $d(i,j;s) \in [0,1]$ . Then, for each feature we sample a weight $w_t \sim U[0,1]$ uniformly at random from the interval [0, 1]. Finally the distance between individuals $i$ and $j$ and our metric $d$ is defined to be $d(i,j) := \sum_s w_s \cdot d(i,j;s)$ . + +For the empirical evaluation of our selection algorithms on these randomly generated metrics, we suppose that this is in fact the distribution for a population large enough that there are at least $k$ individuals with any given feature vector. As these metrics represent populations, the $q$ -social costs in Figures 1 and 2 are normalized by population size. Figures 1 to 3 depict data averaged over 100 random metrics constructed in this manner, and the error bars show the standard error of the mean. + +![](images/0a4867f2b167fd1ef014f3910f57fe2f70a7cff6343ad1b221896ef12cb5b2e7.jpg) +(a) UNIFORMSELECTION + +![](images/1a9c0053b1c7b5e6b83e9eeb461a263deab13697f75c5a72129d936934264dd5.jpg) +(b) OPTPROXY +Figure 1: The $q$ -social cost of UNIFORMSELECTION and OPT-PROXY for $k \in [1,20]$ and a selection of $q$ , based on Adult. + +![](images/2656dc53a9a7307d9324becd6f5e6502afb36c305dd5a5d84b69739d4082d4a1.jpg) +Figure 2: OPTPROXY finds the optimal panel $\mathrm{SC}_q(P^*,d)$ on small instances $k = 10$ , based on Adult. + +Proxy for the optimum. In evaluating UNIFORMSELECTION and RANDOMREPLACE, we use a proxy for the optimal $q$ -social cost, since $n$ and $k$ are too large to support finding $SC_{q}(P^{*},d)$ exactly. This selection algorithm OPTPROXY (indicated as 'opt_apx' in legends) is an implementation of the fault-tolerant metric $k$ -medians algorithm of Kumar et al. [26], which guarantees a constant-factor approximation to $SC_{q}(P^{*},d)$ . This algorithm uses a constant-factor metric $k$ -medians algorithm as a primitive; we implement the local search algorithm of Arya et al. [30] with single swaps. More specifically, OPTPROXY works as follows. It finds the (approximately) optimal $\lfloor k / q\rfloor$ -median solution and picks $q$ individuals from each of these $\lfloor k / q\rfloor$ positions, and then selects the remaining $k \mod q$ people uniformly at random. + +To evaluate the fidelity of OPTPROXY we compare it with $\mathrm{SC}_q(P^*,d)$ for 100 metrics $d$ constructed by drawing 30 randomly chosen feature vectors from the supports of Adult instances described above. For panels of size $k = 10$ and all values of $q$ we find that OPTPROXY recovers $\mathrm{SC}_q(P^*,d)$ exactly (Figure 2). The fact that the $q$ -social cost attained by OPTPROXY for fixed $q$ and $q \in (k/2, k]$ appears constant, on the other hand, is not universally true of $\mathrm{SC}_q(P^*,d)$ . These plateaus are due to the way OPTPROXY selects panels by returning $q$ copies of the optimal 1-median location. Since $P_q^*$ need not be of this form, it is interesting that it exhibits this same step-like behavior in Figure 2. + +Experimental results. In Figure 1a, we see UNIFORMSELECTION behaving as expected. For a fixed $k$ , the $q$ -social cost of a uniformly random panel is reliably higher for larger $q$ , and for a fixed $q$ , it decays smoothly as we increase the panel size $k$ . Under the same conditions, OPTPROXY behaves similarly (Figure 1b) but the decay is not as smooth due to the reasons explained above. Here, all of our approximately optimal panels $P_{q}$ start at the same value of $\mathrm{SC}_q(P_q,d)$ when $q = k$ and decay as $q$ remains fixed and the size of the panel $k$ increases. + +Figure 3 shows the ratio between the $q$ -social cost obtained by different selection algorithms and the $q$ -social cost of OPTPROXY, which is an approximation of their representation, averaged over 100 randomly generated metrics. Specifically, we evaluate UNIFORMSELECTION and RANDOMREPLACE $_r$ (indicated as 'unif_select' and 'rand_replace_r' in legends, respectively), the latter being a generalization of RANDOMREPLACE $_q$ that replaces $r$ individuals instead of $q$ in the input panel and achieves representation at least $\alpha / (r + 1)$ (when the input panel has representation $\alpha$ ) and fairness at least $r / k$ . We compare these algorithms for a range of $r$ and $q$ , on the Adu1t dataset (Figure 3a) with panels of size $k = 20$ and on the ESS (Figure 3b) dataset with panels of size $k = 40$ . + +Representation of UNIFORMSELECTION. As expected, the representation of UNIFORMSELECTION is the lowest for all $k$ and $q$ . However, it still achieves consistently good representation across the board, with representation dipping below 50% only on the Adult dataset with $q$ close to $k$ . + +We find it especially interesting that, on both datasets, UNIFORMSELECTION exhibits good representation in the regime of $q \leq k / 2$ , as this contrasts with our worst-case result. We conclude that, in real-world datasets, UNIFORMSELECTION may be quite representative even with respect to the + +![](images/65b20d1b6f50a91377b1f2b14f57658f0e1ef6fca82a9b52d264d8d69a068680.jpg) +(a) Adult with $k = 20$ . + +![](images/894fbcdfb4ac8d3b72a2ac1f6b5b8f8fea39a399b5be7d839a8d823ca8a9a914.jpg) +(b) ESS UK with $k = 40$ . +Figure 3: Comparison of different algorithms for fixed $k$ , where RANDOMREPLACE $_r$ is applied to the panel selected by OPTPROXY. The $y$ -axis shows the average ratio of the $q$ -social cost of OPTPROXY to that of different algorithms. + +$q$ -social cost measure when $q \leq k/2$ . Overall, we view these results a providing empirical support for the use of UNIFORMSELECTION in practice. + +Representation of RANDOMREPLACE. Figure 3 shows that $\mathrm{RANDOMREPLACE}_r$ achieves significant improvements in representation compared to UNIFORMSELECTION for small values of $r$ — at the cost of fairness, of course. This tradeoff may be justified for some values of $q$ , but the advantage of RANDOMREPLACE is much smaller around $q = k/2$ and when $q$ approaches $k$ , so for these regimes RANDOMREPLACE should not be in the running. + +Shift at $q = k/2$ . In both Figures 3a and 3b, there is a sudden improvement in the representation of UNIFORMSELECTION at $q = k/2$ . This provides empirical support for the peculiar transition in the $q$ -social cost occurring $q = k/2$ , which is predicted by the theory and is the reason we separated Sections 3 and 4. + +# 6 Discussion + +Our results in Section 4 show that in some cases, relaxing fairness requirements allows improving representation dramatically. More generally, it is interesting to understand the tradeoff between representation and fairness, and to chart the Pareto frontier. In Appendix B, we take some first steps in this direction. One observation is the aforementioned generalization of RANDOMREPLACE that replaces $r$ individuals instead of $q$ . We also show that a random-dictatorship-like algorithm gives nontrivial fairness and representation guarantees in the regime of $q > k / 2$ . However, there remain several open questions: for example, when $q \leq k / 2$ , what level of fairness can be achieved if we seek constant representation? + +We focused our attention on the $q$ -cost formulation of Caragiannis et al. [13], in which each individual measures their distance to the $q$ -th closest panel member. One can analyze the representation-fairness tradeoff with other cost functions. For example, what if different individuals use different values of $q$ ? Another appealing choice is when each individual measures the average distance to all panel members; in Appendix C, we show that for this cost function, uniform selection achieves representation of at least $1/2$ . + +More broadly, one can use measures of representation other than the total cost to all individuals. For example, one may wish to use a selection algorithm that minimizes the maximum cost to any individual, or strikes a balance between maximum cost and total cost. We hope that answers to some of these questions will lead to a better understanding of the strengths of sortition, and to new ways of realizing this democratic paradigm. + +Acknowledgements. This work was partially supported by the National Science Foundation under grants IIS-2147187, CCF-2007080, IIS-2024287, and CCF-1733556; by the Office of Naval Research under grant N00014-20-1-2488; and by an NSERC Discovery Grant. + +# References + +[1] D. Van Reybrouck. Against Elections: The Case for Democracy. Random House, 2016. +[2] B. Flanigan, P. Gölz, A. Gupta, B. Hennig, and A. D. Procaccia. Fair algorithms for selecting citizens' assemblies. Nature, 596:548-552, 2021. +[3] B. Flanigan, P. Gölz, A. Gupta, and A. D. Procaccia. Neutralizing self-selection bias in sampling for sortition. In Proceedings of the 34th Annual Conference on Neural Information Processing Systems (NeurIPS), pages 6528-6539, 2020. +[4] B. Flanigan, G. Kehne, and A. D. Procaccia. Fair sortition made transparent. In Proceedings of the 35th Annual Conference on Neural Information Processing Systems (NeurIPS), pages 25720-25731, 2021. +[5] J. Gastil and E. O. Wright, editors. Legislature by Lot: Transformative Designs for Deliberative Governance. Verso, 2019. +[6] F. Engelstad. The assignment of political office by lot. Social Science Information, 28(1):23-50, 1989. +[7] J. M. Parker. *Randomness and Legitimacy in Selecting Democratic Representatives*. PhD thesis, University of Texas at Austin, 2011. +[8] J. Fishkin. Democracy When the People Are Thinking: Revitalizing Our Politics Through Public Deliberation. Oxford University Press, 2018. +[9] H. Landemore. Deliberation, cognitive diversity, and democratic inclusiveness: An epistemic argument for the random selection of representatives. Synthese, 190:1209-1231, 2013. +[10] P. Stone. The Luck of the Draw: The Role of Lotteries in Decision Making. Oxford University Press, 2011. +[11] C. Dwork, M. Hardt, T. Pitassi, O. Reingold, and R. S. Zemel. Fairness through awareness. In Proceedings of the 3rd Innovations in Theoretical Computer Science Conference (ITCS), pages 214–226, 2012. +[12] M.-F. Balcan, T. Dick, R. Noothigattu, and A. D. Procaccia. Envy-free classification. In Proceedings of the 33rd Annual Conference on Neural Information Processing Systems (NeurIPS), pages 1238-1248, 2019. +[13] I. Caragiannis, N. Shah, and A. A. Voudouris. The metric distortion of multiwinner voting. Artificial Intelligence, 313:103802, 2022. +[14] E. Anshelevich, A. Filos-Ratsikas, N. Shah, and A. A. Voudouris. Distortion in social choice problems: The first 15 years and beyond. In Proceedings of the 30th International Joint Conference on Artificial Intelligence (IJCAI) (Survey Track), pages 4294-4301, 2021. +[15] G. Benadé, P. Gölz, and A. D. Procaccia. No stratification without representation. In Proceedings of the 20th ACM Conference on Economics and Computation (EC), pages 281–314, 2019. +[16] J. Lang and P. Skowron. Multi-attribute proportional representation. Artificial Intelligence, 227: 74–106, 2018. +[17] L. E. Celis, L. Huang, and N. K. Vishnoi. Multiwinner voting with fairness constraints. In Proceedings of the 27th International Joint Conference on Artificial Intelligence (IJCAI), pages 144-151, 2018. +[18] V. Do, J. Atif, J. Lang, and N. Usunier. Online selection of diverse committees. In Proceedings of the 30th International Joint Conference on Artificial Intelligence (IJCAI), pages 154-160, 2021. +[19] James M Enelow and Melvin J Hinich. The spatial theory of voting: An introduction. CUP Archive, 1984. + +[20] Kenneth Arrow. Advances in the spatial theory of voting. Cambridge University Press, 1990. +[21] A. D. Procaccia and J. S. Rosenschein. The distortion of cardinal preferences in voting. In Proceedings of the 10th International Workshop on Cooperative Information Agents (CIA), pages 317-331, 2006. +[22] E. Anshelevich, O. Bhardwaj, E. Elkind, J. Postl, and P. Skowron. Approximating optimal social choice under metric preferences. Artificial Intelligence, 264:27-51, 2018. +[23] V. Gkatzelis, D. Halpern, and N. Shah. Resolving the optimal metric distortion conjecture. In Proceedings of the 61st Symposium on Foundations of Computer Science (FOCS), pages 1427-1438, 2020. +[24] Y. Cheng, S. Dughmi, and D. Kempe. Of the people: voting is more effective with representative candidates. In Proceedings of the 18th ACM Conference on Economics and Computation (EC), pages 305-322, 2017. +[25] Y. Cheng, S. Dughmi, and D. Kempe. On the distortion of voting with multiple representative candidates. In Proceedings of the 32nd AAAI Conference on Artificial Intelligence (AAAI), pages 973-980, 2018. +[26] N. Kumar and B. Raichel. Fault tolerant clustering revisited. In Proceedings of the 25th Canadian Conference on Computational Geometry, CCCG 2013, Waterloo, Ontario, Canada, August 8-10, 2013. Carleton University, Ottawa, Canada, 2013. +[27] D. Dua and C. Graff. UCI machine learning repository, 2017. URL http://archive.ics.uci.edu/ml. +[28] F. Ding, M. Hardt, J. Miller, and L. Schmidt. Retiring Adult: New datasets for fair machine learning. In Proceedings of the 34th Annual Conference on Neural Information Processing Systems (NeurIPS), pages 6478-6490, 2021. +[29] ESS Round 9: European Social Survey (2021): ESS-9 2018 Documentation Report. Edition 3.1. bergen, european social survey data archive, nsd - norwegian centre for research data for ESS ERIC. 2021. doi: 10.21338/NSD-ESS9-2018. URL https://www.europeansocialsurvey.org/data/. +[30] V. Arya, N. Garg, R. Khandekar, A. Meyerson, K. Munagala, and V. Pandit. Local search heuristics for k-median and facility location problems. SIAM J. Comput., 33(3):544-562, 2004. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] +(c) Did you discuss any potential negative societal impacts of your work? [N/A] +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] +(b) Did you include complete proofs of all theoretical results? [Yes] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [N/A] +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] + +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [N/A] + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] +(b) Did you mention the license of the assets? [Yes] +(c) Did you include any new assets either in the supplemental material or as a URL? [N/A] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/issortitionbothrepresentativeandfair/images.zip b/issortitionbothrepresentativeandfair/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..2082f32628d1224b543549e04af8bbda181c8bdb --- /dev/null +++ b/issortitionbothrepresentativeandfair/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:deeeb0c3fa32407860edad923f20a1847b6fc8226c76db0aa8036dbdfdf45901 +size 246265 diff --git a/issortitionbothrepresentativeandfair/layout.json b/issortitionbothrepresentativeandfair/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..4155069aa4f73de407865c0a18d733713afb14b3 --- /dev/null +++ b/issortitionbothrepresentativeandfair/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0fb804a8bda6a9554f376c6b24f2380f6c06680f0956d0458b4dd9ad16418aae +size 684446 diff --git a/isthistherightneighborhoodaccurateandqueryefficientmodelagnosticexplanations/4ba037fb-10af-4c4f-8cfd-ed0e30f6f0e7_content_list.json b/isthistherightneighborhoodaccurateandqueryefficientmodelagnosticexplanations/4ba037fb-10af-4c4f-8cfd-ed0e30f6f0e7_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..74d942ffa854649e6c85fbd4856360bf08af5342 --- /dev/null +++ b/isthistherightneighborhoodaccurateandqueryefficientmodelagnosticexplanations/4ba037fb-10af-4c4f-8cfd-ed0e30f6f0e7_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cfdbea206eb8fb68fc858da4445fdda74d06c1c205cd2428af64bc890b7c5b91 +size 75157 diff --git a/isthistherightneighborhoodaccurateandqueryefficientmodelagnosticexplanations/4ba037fb-10af-4c4f-8cfd-ed0e30f6f0e7_model.json b/isthistherightneighborhoodaccurateandqueryefficientmodelagnosticexplanations/4ba037fb-10af-4c4f-8cfd-ed0e30f6f0e7_model.json new file mode 100644 index 0000000000000000000000000000000000000000..ea54a1a25228c5f93319914bafdac17814e0f217 --- /dev/null +++ b/isthistherightneighborhoodaccurateandqueryefficientmodelagnosticexplanations/4ba037fb-10af-4c4f-8cfd-ed0e30f6f0e7_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5902f3c69ed24e434b4399bdc79ac99d984455c9e9b966d911d932769c20574b +size 91579 diff --git a/isthistherightneighborhoodaccurateandqueryefficientmodelagnosticexplanations/4ba037fb-10af-4c4f-8cfd-ed0e30f6f0e7_origin.pdf b/isthistherightneighborhoodaccurateandqueryefficientmodelagnosticexplanations/4ba037fb-10af-4c4f-8cfd-ed0e30f6f0e7_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b28f4233df67a900d642f96423162e1c970d9233 --- /dev/null +++ b/isthistherightneighborhoodaccurateandqueryefficientmodelagnosticexplanations/4ba037fb-10af-4c4f-8cfd-ed0e30f6f0e7_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bc51757a202823d5e66f2e3f768217576231f5a9e77ec7cd2af2f7a6858cb2c9 +size 13608641 diff --git a/isthistherightneighborhoodaccurateandqueryefficientmodelagnosticexplanations/full.md b/isthistherightneighborhoodaccurateandqueryefficientmodelagnosticexplanations/full.md new file mode 100644 index 0000000000000000000000000000000000000000..0916d3bbfbb40c8e0227c334c553b5ca8a04ce0b --- /dev/null +++ b/isthistherightneighborhoodaccurateandqueryefficientmodelagnosticexplanations/full.md @@ -0,0 +1,321 @@ +# Is this the Right Neighborhood? Accurate and Query Efficient Model Agnostic Explanations + +Amit Dhurandhar + +IBM Research +Yorktown Heights, NY, USA +adhuran@us.ibm.com + +Karthikeyan Natesan Ramamurthy + +IBM Research +Yorktown Heights, NY, USA +knatesa@us.ibm.com + +Karthikeyan Shannugam* + +IBM Research +Yorktown Heights, NY, USA +karthikeyanshanmugam88@gmail.com + +# Abstract + +There have been multiple works that try to ascertain explanations for decisions of black box models on particular inputs by perturbing the input or by sampling around it, creating a neighborhood and then fitting a sparse (linear) model (e.g. LIME). Many of these methods are unstable and so more recent work tries to find stable or robust alternatives. However, stable solutions may not accurately represent the behavior of the model around the input. Thus, the question we ask in this paper is are we approximating the local boundary around the input accurately? In particular, are we sampling the right neighborhood so that a linear approximation of the black box is faithful to its true behavior around that input given that the black box can be highly non-linear (viz. deep relu network with many linear pieces). It is difficult to know the correct neighborhood width (or radius) as too small a width can lead to a bad condition number of the inverse covariance matrix of function fitting procedures resulting in unstable predictions, while too large a width may lead to accounting for multiple linear pieces and consequently a poor local approximation. In this paper, we propose a simple approach that is robust across neighborhood widths in recovering faithful local explanations. In addition to a naive implementation of our approach which can still be accurate, we propose a novel adaptive neighborhood sampling scheme (ANS) that we formally show can be much more sample and query efficient. We then empirically evaluate our approach on real data where our explanations are significantly more sample and query efficient than the competitors, while also being faithful and stable across different widths. + +# 1 Introduction + +Explainable artificial intelligence (XAI) has come to prominence in recent years with the proliferation of deep learning technologies, which are inherently black box, across various facets of society [13]. Regulations such as the General Data Protection Regulation (GDPR) [31] in Europe demand explanations to be provided for automatic decision making systems that affect humans. The explanations demanded are typically local in the sense that we want explanations for individual decisions rather than for the entire system, which could also be much more challenging. Given this need many local + +explanation methods have been developed [26, 21, 6, 24, 33] that can be used to explain arbitrary models, i.e. are model agnostic. Even though a plethora of these methods exist it is not clear if they are truly faithful to the underlying black box model. Most of these methods employ some type of sampling or perturbation scheme to estimate a simple interpretable model (viz. a sparse linear model), which can then be read off to ascertain explanations. Because of the inherent randomness of such procedures the most important question is are we learning the right (local) interpretable model? This essentially boils down to are we using the right samples for the estimation? + +In this paper, we argue that sampling a neighborhood just based on the input values and using it for estimation can lead to a poor local approximation of the black box function. This also applies when samples are generated from an underlying data manifold [2], which is oblivious to the black box's behavior. As such, we propose a novel neighborhood sampling scheme called Adaptive Neighborhood Sampling (ANS) which generates a neighborhood taking into account the local behavior of the black box. Our main idea is to estimate the region where the black box model is (approximately) linear around the input we want to explain followed by adaptively sampling in this region still respecting the original sampling process/distribution. The estimate of the relevant linear region will be done using much fewer black box queries than say a total budget of $N$ . As it will turn out our sampling process will result in many more samples in the desired region hence minimizing query wastage compared with simply querying the black box $N$ times, finding the relevant region and then fitting a sparse linear model. Query efficiency is important as it has been argued in recent works [5, 18] that in todays multi-cloud environments each query can have an associated monetary cost not to mention factors such as inference time, power consumption and network latency in a distributed system need to be taken into account. + +![](images/6355447acc61d69d521a73b61514a8dd851a6fae1eac878992f4acd166a096f9.jpg) +Figure 1: We show the variation of Infidelity (INFD) measure over various kernel width multiplier values for the proposed methods (ANS and ANS-Basic) with CIFAR10 dataset. Lower values of this measure are better. At very small kernel widths, INFD actually goes up indicating instability. Hence in lieu of choosing arbitrarily low kernel widths, we need explanations that are accurate over many kernel widths, which is provided by our methods. More details are in the experiments section. + +An illustration of our approach is shown in Figure 1. While it can be argued that very small kernel widths, + +which corresponds to considering only extremely close samples in the sparse linear estimation, can be chosen to circumvent the problem of choosing the right neighborhood, we show that this can lead to instability (high infidelity). Hence it is important to find methods that work well across multiple kernel widths. This is achieved by our methods (ANS, ANS-Basic). In addition, choosing the right neighborhood also leads to high sample and query efficiency for ANS. + +In the rest of the paper, we repeatedly use the terms faithful and stable with respect to the explanations. What we mean by faithful is that simple models (viz. sparse linear) built using these explanations should closely replicate the behavior of the black box model on the corresponding examples. This corresponds to low infidelity (INFD). By stability (unless mentioned otherwise) we mean for different kernel widths we should recover similar quality explanations. This corresponds to lesser variation in INFD and coefficient inconsistency (CI), both of which are defined in Section 4, across kernel widths. + +# 2 Related Work + +There have been many works trying to uncover local explanations in model agnostic settings [26, 33, 6, 21, 25]. Local explanations also do not have to be feature based and could also be exemplar based [14]. There are also methods that provide both forms of explanations [24]. Some methods in a sense stitch together local explanations and create global ones [25, 23]. Although there are many methods there is still a need to design explanation methods that are faithful and stable [12]. This is + +particularly true for LIME like neighborhood sampling methods where stability and faithfulness w.r.t. neighborhood width is highly desired [32] as it is difficult to predefine an optimal width. + +Some recent works try to accomplish improved stability for certain modalities such as tabular [15] through adversarial training. This notion of stability however is across examples sampled from linear shifts in the distribution. Others assume access to a partial causal graph [10, 17] and build on top of SHAP to create stable feature attributions. Stability here is achieved by trying to obtain attributions that are as consistent as possible with respect to the provided partial graph. Another popular strategy is to learn the data manifold and then sample from it [2, 29] or project onto it [1] creating more faithful explanations. The premise here is that the realistic sampled neighbors will give rise to better explanations. There are other works that aim for stability and unidirectionality [6] in the explanations, by proposing a new algorithm for fitting rather than modifying the sampling scheme. Hence the methodology in [6] is complimentary in a sense to our contribution and could potentially benefit from the neighborhood sampling scheme proposed in our current work. + +The conceptual contribution of our work is to realize that manifold or not, examples sampled in a neighborhood could belong to different linear parts in a non-linear function such as a deep relu network and hence using them to obtain a local explanation through sparse linear or some other simple model fitting can be misleading. + +Algorithm 1: Adaptive neighborhood sampling (ANS). Estimation of $\mathbf{a}$ and $\mathbf{b}$ can also be performed not just once but multiple times and the latest estimates can be used for future sampling. For realistic perturbations sampling can be done in the latent space. More details in section 3.1. +Input: Example to explain $\mu$ , black-box predictor $f(\cdot)$ , maximum number of neighbors generated $N$ , standard deviation $\sigma$ and number top features to output $k$ +Output: Top $k$ coefficients of $l(.)$ +```latex +Set $Q = \phi$ # Examples to query Sample $n(< < N)$ examples from $\mathcal{N}(\mu, \sigma^2\mathbf{I})$ and query $f(.)$ Find region $[a_n, b_n]$ that corresponds to $\pmb{\mu}$ using MPLSR methods [9, 7] on the $n$ samples Add to $Q$ samples that lie in $[a_n, b_n]$ Estimate uncertainty $\alpha$ # Could be set $\propto \frac{1}{\sqrt{n}}$ or based on stability of the region (i.e. $1 - \rho$ ) Sample $N - n$ examples from $\mathcal{N}\left(\alpha \pmb {\mu} + (1 - \alpha)\frac{\pmb{a}_n + \pmb{b}_n}{2},\sigma^2\pmb {I}\right)$ Add to $Q$ samples that lie in $[a_n, b_n]$ Query $f(.)$ on these additional samples added to $Q$ Fit interpretable model (viz. sparse linear) $l(.)$ to $(x,f(x))$ where $x\in Q$ +``` + +# 3 Method + +We now describe our approach. In terms of notation vectors are bolded. Matrices are also bolded and in capital letters. Inequalities and assignments indicated for vectors and matrices are element wise. + +# 3.1 Description + +As mentioned before, if you consider the black box function to be piecewise linear (viz. deep relu network) our main idea is to sample a neighborhood around an input $\mu$ such that the neighbors belong to the linear piece corresponding to it. Since any continuous black box function can be arbitrarily well-approximated by a piecewise linear function [20] and hence our setup is quite general. + +Typical neighborhood sampling schemes such as those for LIME and its variants [2, 33, 6] (i.e. ambient or latent space) can be seen to sample from an independent Gaussian distribution $\mathcal{N}(\boldsymbol{\mu}, \sigma^2\boldsymbol{I})$ where $\sigma$ is the standard deviation for each feature (or kernel width) and $\boldsymbol{\mu}$ is a $d$ dimensional example we want to explain. It is difficult to find the correct $\sigma$ as too small a $\sigma$ can lead to numeric instabilities during function fitting because of a bad condition number of the inverse covariance matrix, while too large a $\sigma$ will not accurately capture the local information [32]. So a pertinent question is, can we + +devise a neighborhood sampling procedure that captures local information and is (largely) robust across different values of $\sigma$ ? + +Main Idea: Our idea is to leverage multidimensional piecewise linear segmented regression (MPLSR) schemes [9, 7] to assist in this endeavor. These methods will learn a piecewise linear function identifying boundaries of each linear piece. One simple (or naive) solution for our problem using these methods would be to i) sample $N$ neighbors using $\mathcal{N}(\boldsymbol{\mu}, \sigma^2\boldsymbol{I})$ , ii) run MPLSR on these samples to find the boundaries of the linear piece corresponding to $\boldsymbol{\mu}$ , iii) select only samples that belong to this region and iv) train a sparse linear or some other interpretable model only on the selected samples followed by outputting the important features. Although this approach captures our general idea, it has two sources of inefficiency; i) Low sample efficiency: If $\boldsymbol{\mu}$ is close to the boundary of the range $[a, b]$ in which it lies, then the naive sampling scheme will have many samples lying outside the range leaving much fewer valid samples to train an interpretable model. ii) Low query efficiency: The naive scheme requires us to query the black box $N$ times, but only a small fraction of these samples may lie within the desired range, as previously mentioned. + +Algorithm 1: Given this, in algorithm 1 we propose an adaptive neighborhood sampling (ANS) scheme which aims to enhance both these efficiencies. A detailed analysis is given in Section 3.2. Our idea is to sample a small set of examples $n$ similar to the naive scheme. However, we then run MPLSR and find an estimate of the true range $[a,b]$ given by $[a_{n},b_{n}]$ . Depending on our uncertainty in the estimate denoted by $\alpha \in [0,1]$ we sample from an updated distribution $\mathcal{N}\left(\alpha \mu + (1 - \alpha)\frac{a_n + b_n}{2},\sigma^2 I\right)$ . The intuition behind the updated distribution is that if we are highly uncertain (i.e. $\alpha \approx 1$ ) about the range then we want to be conservative and sample close to $\pmb{\mu}$ . However, if we are confident $\alpha \approx 0$ , then we want to sample close to the middle of the range so that we get (many) valid samples belonging to the correct linear piece that corresponds to $\pmb{\mu}$ . + +For realistic perturbations using autoencoders one can sample in the latent space, find the (linear) region in the input space by decoding the current neighboring samples followed by updating the mean of the sampling distribution as indicated in algorithm 1 and then passing it through the autoencoder to find its corresponding latent to sample around. + +Estimating $\alpha$ : $\alpha$ could be estimated in at least a couple of ways: i) Since the error of MPLSR [7] schemes in terms of $n$ scales as $\frac{1}{\sqrt{n}}$ , we could set $\alpha \propto \frac{1}{\sqrt{n}}$ . ii) One could also perform subsampling or bootstrap sampling on the $n$ samples², run MPLSR on each such sample and compute a (normalized) metric indicative of the variability in estimating the range $[a, b]$ . For instance, one could use the overlap coefficient [30] $\rho$ as an indicator of the stability of the range. Given $m$ bootstrap samples with corresponding estimated ranges using MPSLR being $[a_n^{(1)}, b_n^{(1)}], \ldots, [a_n^{(m)}, b_n^{(m)}]$ and their corresponding volumes being $\vartheta_1, \ldots, \vartheta_m$ respectively, if $\vartheta_{\cap}$ denotes the volume of the intersection of these ranges (i.e. volume of $[a_n^{(1)}, b_n^{(1)}] \cap \ldots \cap [a_n^{(m)}, b_n^{(m)}]$ ), then the overlap coefficient would be + +$$ +\rho = \frac {\vartheta_ {\cap}}{\min \left\{\vartheta_ {1} , \dots , \vartheta_ {m} \right\}} \tag {1} +$$ + +The coefficient would be indicative of how stably we can estimate the range, where if we get the exact same ranges for the $m$ bootstraps, $\rho$ will be 1, while if the ranges had little overlap, $\rho$ would be close to 0. Our uncertainty $\alpha$ can then be set to $1 - \rho$ . + +# 3.2 Analysis + +We now analyze our approach in terms of sampling efficiency, query efficiency and time complexity. + +# 3.2.1 Sampling Inefficiency + +The sampling inefficiency or the expected number of iterations to get a valid sample in the range $[a, b]$ based on a naive implementation of our idea which is described in the previous subsection (lets call it ANS-Basic) that involves sampling from the original distribution $\mathcal{N}(\mu, \sigma^2 I)$ would be $\frac{1}{P(x \in [a, b])}$ . If we sample $n$ examples based on the original distribution then the sample efficiency will be the + +same for these examples. However, for $N - n$ examples if we sample using the proposed distribution $\mathcal{N}\left(\alpha \pmb{\mu} + (1 - \alpha)\frac{\pmb{a}_n + \pmb{b}_n}{2},\sigma^2\pmb{I}\right)$ the sampling inefficiency will be $\frac{1}{P_{\alpha}(\pmb{x}\in[\pmb{a}_n,\pmb{b}_n])}\cdot \frac{P_{\alpha}(\pmb{x}\in[\pmb{a}_n,\pmb{b}_n])}{P_{\alpha}(\pmb{x}\in[\pmb{a},\pmb{b}])} = \frac{1}{P_{\alpha}(\pmb{x}\in[\pmb{a},\pmb{b}])}$ , where $P_{\alpha}(.)$ denotes the (cumulative) probability w.r.t. the proposed distribution. Thus, the relative sampling inefficiency $s_I$ will be as follows: + +$$ +\begin{array}{l} s _ {I} = \frac {\text {I n e f f i c i e n c y o f A N S}}{\text {I n e f f i c i e n c y o f A N S - B a s i c}} \\ = \frac {\frac {n}{N} \frac {1}{P (\boldsymbol {x} \in [ \boldsymbol {a} , \boldsymbol {b} ])} + \frac {N - n}{N} \frac {1}{P _ {\alpha} (\boldsymbol {x} \in [ \boldsymbol {a} , \boldsymbol {b} ])}}{\frac {1}{P (\boldsymbol {x} \in [ \boldsymbol {a} , \boldsymbol {b} ])}} \\ = \frac {n}{N} + \frac {N - n}{N} \frac {P (\boldsymbol {x} \in [ \boldsymbol {a} , \boldsymbol {b} ])}{P _ {\alpha} (\boldsymbol {x} \in [ \boldsymbol {a} , \boldsymbol {b} ])} \tag {2} \\ \end{array} +$$ + +When $\alpha = 1$ (i.e. high uncertainty of range) $P_{\alpha}(\pmb{x} \in [a, b]) = P(\pmb{x} \in [a, b])$ and hence our efficiency is the same as sampling from the original distribution. However, for smaller $\alpha$ , $P_{\alpha}(.)$ should significantly increase making our procedure much more sample efficient especially when the range is large and $\pmb{\mu}$ is far away from the center of the range. Hence, + +$$ +\ln \left(\frac {P (\boldsymbol {x} \in [ \boldsymbol {a} , \boldsymbol {b} ])}{P _ {\alpha} (\boldsymbol {x} \in [ \boldsymbol {a} , \boldsymbol {b} ])}\right) \propto - \frac {(1 - \alpha)}{\sigma^ {2}} \| \boldsymbol {b} - \boldsymbol {a} \| \left| \left| \frac {\boldsymbol {a} + \boldsymbol {b}}{2} - \boldsymbol {\mu} \right| \right| \tag {3} +$$ + +Ideally, we would want to choose an $n$ where equation 2 is minimized. Finding the optimal $n$ in closed form is difficult. Note that there is a tradeoff for different values of $n$ . Too large a $n$ will lead us to sample very few points from our proposed distribution thus mitigating its benefit. Too small a $n$ might lead to high uncertainty (i.e. $\alpha$ close to 1) in estimation of the range $[a, b]$ which will again increase $s_I$ . However one could in practice choose a reasonable $n$ depending on the dimension of the data. One could also evaluate the quality by looking at (random) subsets or bootstrapped samples of the queried $n$ instances, fitting the linear piecewise methods and evaluating the stability of the obtained partitions, which is similar to one of the methods proposed to estimate $\alpha$ . + +Further, one does not only have to perform the estimation of the ranges once but can do so periodically updating the estimates for $\mathbf{a}$ and $\mathbf{b}$ . The relative inefficiency analysis in this case also should naturally extend. For instance, if we estimate the ranges $r$ times producing the corresponding $\alpha_{i}$ during the $i^{\text{th}}$ estimation at intervals of $n_i$ respectively with $n_{r+1} = N - \sum_{i=1}^{r} n_i$ and $P_{\alpha_1}(\mathbf{x} \in [a, b]) = P(\mathbf{x} \in [a, b])$ , then the relative inefficiency $s_I^{(r)}$ would be, + +$$ +s _ {I} ^ {(r)} = \frac {1}{N} \sum_ {i = 1} ^ {r + 1} n _ {i} \frac {P (\boldsymbol {x} \in [ \boldsymbol {a} , \boldsymbol {b} ])}{P _ {\alpha_ {i}} (\boldsymbol {x} \in [ \boldsymbol {a} , \boldsymbol {b} ])} \tag {4} +$$ + +where, $s_I^{(1)}$ can be denoted as simply $s_I$ . We expect that we would get better estimates of the range for later iterations i.e. $\alpha_j \leq \alpha_i \forall j > i$ and hence $P_{\alpha_j}(\pmb{x} \in [\pmb{a}, \pmb{b}]) \geq P_{\alpha_i}(\pmb{x} \in [\pmb{a}, \pmb{b}])$ leading to higher efficiency for examples sampled at later stages. Of course the larger the $r$ , more the computational complexity, as we have to run the piecewise linear routine $r$ times. + +# 3.2.2 Query Efficiency + +What we saw up until now was the efficiency in sampling examples within the range. Interestingly however, the (relative) black box query efficiency is likely to be much higher. The reason for this is that with ANS we need only query those examples that are accepted by our sampling scheme as opposed to querying all the examples as in the naive sampling case. The efficiency of naive sampling is thus still $P(\pmb{x} \in [\pmb{a}, \pmb{b}])$ , while for us the accepted examples after sampling $N - n$ times which in expectation will be $(N - n)P_{\alpha}(\pmb{x} \in [\pmb{a}_n, \pmb{b}_n])$ will definitely lie within $[a_n, b_n]$ and hence the probability they will lie in $[\pmb{a}, \pmb{b}]$ is given by $\frac{P_{\alpha}(\pmb{x} \in [\pmb{a}, \pmb{b}])}{P_{\alpha}(\pmb{x} \in [\pmb{a}_n, \pmb{b}_n])}$ . Note that the region $[\pmb{a}, \pmb{b}]$ will not be underestimated based on finite samples i.e. $[\pmb{a}, \pmb{b}] \subseteq [a_n, b_n]$ given a good piecewise linear method, and hence the ratio of probabilities meaningfully represents the probability of accepted samples lying + +in $[a, b]$ . The reason for this is that our sampling can never add not existent non-linearities as this is just a function of the black box model, but may miss regions where the linear piece corresponding to $\mu$ ends. Hence, the total relative query efficiency $q_{E}$ of ANS is, + +$$ +\begin{array}{l} q _ {E} = \frac {\frac {n}{N} P (\boldsymbol {x} \in [ \boldsymbol {a} , \boldsymbol {b} ]) + \frac {N - n}{N} \frac {P _ {\alpha} (\boldsymbol {x} \in [ \boldsymbol {a} , \boldsymbol {b} ])}{P _ {\alpha} (\boldsymbol {x} \in [ \boldsymbol {a} _ {n} , \boldsymbol {b} _ {n} ])}}{P (\boldsymbol {x} \in [ \boldsymbol {a} , \boldsymbol {b} ])} \\ = \frac {n}{N} + \frac {N - n}{N} \frac {P _ {\alpha} (\boldsymbol {x} \in [ \boldsymbol {a} , \boldsymbol {b} ])}{P _ {\alpha} (\boldsymbol {x} \in [ \boldsymbol {a} _ {\boldsymbol {n}} , \boldsymbol {b} _ {\boldsymbol {n}} ]) P (\boldsymbol {x} \in [ \boldsymbol {a} , \boldsymbol {b} ])} \tag {5} \\ \end{array} +$$ + +The gain can thus be large when we are quite certain of the range (i.e. small $\alpha$ ) for not too large a $n$ and the black box model is highly non-linear since, $\frac{P_{\alpha}(\pmb{x}\in[a,\pmb{b}])}{P_{\alpha}(\pmb{x}\in[a_n,\pmb{b}_n])}$ will be close to 1 and $P(\pmb {x}\in [a,b])$ will in all likelihood be small. Similar to equation 4, here too the above analysis can be straightforwardly extended to multiple estimations of the range where the $\alpha$ would be replaced by the corresponding $\alpha_{i}$ for the $i^{\mathrm{th}}$ estimate. + +# 3.2.3 Time Complexity + +The additional time complexity for ANS over LIME comes from having to run MPLSR methods [9, 7] which have complexities such as $O(nd\log n)$ or $O(nd^2)$ . However, this time could be reduced across examples through embarrassing parallelism [16]. Moreover, efficient heuristics may be used to speed up such partitioning schemes [11]. Interestingly though, with deeper models where inference time is not insignificant the lower query complexity of ANS can more than compensate for the additional time it requires running the MPLSR schemes. We see evidence of this in the experiments. + +If we use $\rho$ to estimate $\alpha$ we may not have to estimate it per example, but we could estimate it for a few examples and then the maximum of those values (if we want to be conservative) could be used for other examples we want to explain for a given $n$ . This will save on time as the amortized complexity over many examples will be similar to running MPSLR schemes just once per example to find the range $[a_n, b_n]$ , rather than multiple times. + +# 4 Experiments + +We now empirically evaluate our approach. We compare ANS with ANS-Basic, LIME and Smoothed-Lime (S-Lime) on two commonly used tabular datasets IRIS [4] and HELOC [8], where the latter was the dataset used in the FICO explainability challenge. We also experiment on CIFAR10 [19] where an additional baseline Melime [2] is compared with. The black box models for the tabular datasets are random forest classifiers consisting of 100 trees that have an accuracy of $\sim 100\%$ and $\sim 78\%$ on IRIS and HELOC respectively, which is state-of-the-art. The black box model for CIFAR10 is a ResNet-18 which has an accuracy of $\sim 95\%$ . Except CIFAR10 which comes with its own test we randomly split the other two datasets into $80\%$ train and $20\%$ test. For 10 randomly selected examples in each test set we performed bootstrap sampling 20 times for the respective $n$ , estimated $[a_n, b_n]$ and calculated $\alpha$ based on the overlap coefficient $\rho$ as defined in equation 1. The maximum of those values was the $\alpha$ used for all the examples. + +Given our goal of showcasing that the ANS (and ANS-Basic) neighborhood generation procedures elevate a given proxy model explanation scheme with generated neighborhoods we believe LIME, S-LIME and Meline to be good baselines which validate our idea on random as well as realistic neighborhoods. Methods such as SHAP [21] and MAPLE [24] do not really fit in here as they do not perform proxy model fitting on generated neighborhoods. Moreover, saliency based methods such as gradcam, saliency maps, layerwise relevance propagation also do not fit in our framework since they are white-box explanation methods. + +Metrics: We now define evaluation metrics that we use to evaluate methods in this paper. The five metrics we use are Infidelity (INFD) [26], Generalized Infidelity (GI) [25], Coefficient Inconsistency (CI) [15], accepted sampling complexity (ASC) and query complexity (QC). INFD and GI evaluate fidelity of the explanations. CI evaluates stability. ASC and QC evaluate the sample and query efficiency respectively. + +![](images/d5696c314f1727ecc2dd75d6ec8058212947b103e36e0e987fa61d0fdb1b4be6.jpg) + +![](images/64fc142367d476040bfd4f18cbc5bc66a253d94c0d641e49d167f2febced7510.jpg) + +![](images/9292c7ac89b4f1b4da00730700254169109161061791b123cec688c3af6e47c7.jpg) + +![](images/1e6642a2a1e33449614f519000bbef7e2a0f0be67477d78f41db8f881c39dc6f.jpg) + +![](images/266ab8edd97f512c5650f7fae700920549e440e2e7c681a897523ac24238a133.jpg) + +![](images/c831a9e0a2d52df250819d6e72d7b0084e408c1ea92f3c8239525541bc215e0f.jpg) + +![](images/bdc2f3d3730bf7b5e5c40d9dc4855ff0fda9292e8ea71e0231805658f4434a5f.jpg) + +![](images/eb970a68fabeb86a4f4dbc60c8b603d40a8d555f6ea135f312615de6ab2d4db3.jpg) + +![](images/8e14e4200ff339e9cdbe47af336541660fe31a85228440fd8e4ac311861065b2.jpg) + +![](images/f8135a773bdfa8036dbc5002a34071259ac91ffbe05d3dc867d5cc41c3c81e9e.jpg) + +![](images/1b924b6a3483f5824bd9bb9fc35878fd15650c5bca8b73654b53617e5a28aa04.jpg) + +![](images/024ab1a808204ee90fb18ab5c5ae28d14356deb93a7fff860bd88231856fa0a6.jpg) + +![](images/a5e0a87a1c99f46cff8ff750aec557ea4688bfaa0b466c2df079fe068bb69633.jpg) +ANS-Basic + +![](images/4143013877b34c6226142085170b7c2e46bccc5424ecbafea0cccbe4e2245811.jpg) +LIME + +![](images/cfeca92c573d6bad56b35c47b1bbbc64035c80bec71fa77fb8c90bb0f59e41e5.jpg) +S-LIME + +![](images/c1dbd245e5e1eea5ba6c7366d7c6f44b0a953560c3a9e1c40d0f58e5aa0ede9b.jpg) +Figure 2: Various metrics vs. kernel width multiplier (kwm) for Iris (left), HELOC (middle), and CIFAR (right) datasets. The metrics are (from top to bottom - each row): Infidelity (INFD), Generalized Infidelity (GI), Coefficient Inconsistency (CI), Accepted Sample Complexity (ASC), and Query Complexity (QC). For all metrics lower values are better. The method legend is at the bottom. + +![](images/ae531bc3fca85f1417e8d248ae8089c9112705c3119cebc31c85dce6993d8f44.jpg) +ANS + +![](images/3d022e9c5ca6d0d1b0fc0088b5b7f22573f9e72cf2aa6ef2983d069928f6ccf4.jpg) + +![](images/2cf719aec9e6864672bf572280fd814d0bf2053d64e2af0840d6656fc783d72a.jpg) + +![](images/fd1350a14df6abeed63e5883c7b1b2126ddce1207e55654950aefcb6b104cf44.jpg) +MeLIME + +If $(\pmb{x},\pmb{y})$ denote examples in a test set $D_{t}$ . Let $y_{b}(\pmb{x})$ be the black box models prediction on an input $\pmb{x}$ and $y_{e}^{x^{\prime}}(\pmb{x})$ be the prediction on $\pmb{x}$ applying the explanation model at $\pmb{x}^{\prime}$ . Also let $c_{e}^{x}$ and $\mathcal{N}_{\pmb{x}}$ denote the feature attributions and the test/real neighborhood of $\pmb{x}$ with $|.|_{\mathrm{card}}$ denoting cardinality. With we have the following definitions. + +Infidelity (INFD): We define infidelity as the mean absolute error (MAE) between the explanation and black box model over the test set. $\mathrm{INF} = \frac{1}{|D_t|_{\mathrm{card}}}\sum_{(\boldsymbol {x},\boldsymbol {y})\in D_t}|y_b(\boldsymbol {x}) - y_e^{\boldsymbol{x}}(\boldsymbol {x})|$ . + +Generalized Infidelity (GI): Based on previous works we define GI as: GI = $\frac{1}{|D_t|_{\mathrm{card}}}\sum_{(\pmb {x},\pmb {y})\in D_t}\frac{1}{|\mathcal{N}_{\pmb{x}}|_{\mathrm{card}}}\sum_{\pmb{x}'\in \mathcal{N}_{\pmb{x}}} |y_b(\pmb {x}) - y_e^{\pmb{x}'}(\pmb {x})|$ . + +![](images/16584d8d26a04937296cddc54b32e5c02c5828e1eca0133f22a11f22b35d034a.jpg) +Figure 3: Qualitative explanations for an image from the CIFAR dataset for three different kernel width multiplier (kwm) values. The feature attributions of our proposed method ANS (and even ANS-Basic) are much more stable and accurate over different kwm values compared to other methods as the face of the horse is highlighted for different kwms. This is not the case for the other methods. More examples in the supplement. + +Coefficient Inconsistency (CI): CI can be defined as the MAE between the attributions of the test points and their neighbors: $\mathrm{CI} = \frac{1}{|D_t|_{\mathrm{card}}}\sum_{(\boldsymbol{x},\boldsymbol{y})\in D_t}\frac{1}{|\mathcal{N}_{\boldsymbol{x}}|_{\mathrm{card}}}\sum_{\boldsymbol{x}'\in \mathcal{N}_{\boldsymbol{x}}}|c_e^{\boldsymbol{x}} - c_e^{\boldsymbol{x}'}|_1.$ + +ASC: This is just the total number of samples used to train the local sparse linear models. For ANS and ANS-Basic they are the accepted samples. While for other baselines it is just $N$ . + +$QC$ : This is the total number of queries made by the methods to the black box model. + +We report the results in Figure 2. The results show the behavior of the different metrics for different kernel width multiplier (kwm) used to weight the random or real neighbors i.e. $kwm = \{0.05, 0.1, 0.25, 0.5, 0.75, 1, 1.5, 2\}$ . $n = 0.2N$ , where $N = 5000$ which is the typical neighborhood size for LIME. $\alpha$ was found for 10 random examples and the maximum of those values was used across other examples in the dataset. Real test neighborhoods are not natural to find for random perturbation based neighborhoods for CIFAR10 as superpixels may vary between neighbors. Hence, GI and CI for CIFAR10 are only reported for realistic neighborhoods generated by Melime. In this case our procedures are also run on these real neighborhoods. More details about explanation generation are in the supplement. We used 56 core and 242 GB RAM LINUX machines to run the experiments. + +![](images/93b47662a3e831c016707ecbd4d39877e0bc15d14ba8bdac90f3251870329d79.jpg) + +![](images/b1986cdf724cdf36e00ed73b8a97613926a5ecb027158c927e7f9629282b9ecb.jpg) + +![](images/6a32a1e817d2697e3af0ca918f1cbd4d27f9a9c6762c1b56d50829d3d06cba68.jpg) + +![](images/8d8880b7b4ab3b5abca595270b58ae5876367a5d44a73fd3ae2ab3474c6ee363.jpg) + +Figure 4: For two examples in the Iris test set corresponding to the two rows of figures above, we provide feature attributions for sepal length (sl), sepal width (sw), petal length and petal width (pw) for three different kernel widths (0.1, 0.75, 2.0). Each row is a separate example and each column corresponds to the method indicated in the title of the subfigure. We can see that across different kernel widths ANS-Basic and ANS feature attributions are much more similar than those seen for LIME or S-LIME. As such, LIME and S-LIME feature attributions even seem to change signs in some cases, while ours do not. +![](images/4a87c88e05cb681952b525ff091001495063a562f530c45556e853d447d2c77c.jpg) +kwm=0.1 kwm=0.75 kwm=2.0 + +![](images/a40b7fcfbcdd275222350f072163c9c026992d76a9453d4000291b8ba4e51233.jpg) + +![](images/392d9bf75a2ce6153ac512e166d50b4c8204524455afded0834b0804f38d7dda.jpg) + +![](images/d15467a380665d957dc8a0405d846cafb5d5053195576db077e9903d3d609ea0.jpg) + +# Observations: + +We see from Figure 2 that ANS and ANS-Basic in general are significantly more accurate than the competitors across kernel widths. ANS while being similar in accuracy and even sample efficiency to ANS-Basic is significantly better in query complexity. The sample efficiency can possibly be improved by considering a larger $n$ . The only places where we seem to be worse than the competitors are on GI and CI for the HELOC dataset. We believe the reason for this is that the classification task is much harder for this dataset (state-of-the-art accuracy only $78\%$ ) as compared with the others ( $>95\%$ ) possibly resulting in a highly non-linear decision boundary. This makes the explanations even for neighbors different than the original example, resulting in higher GI and CI values even if the explanation for the particular example is correct. The correctness of the local explanation is reflected by us having a lower INFD value, although GI and CI may be higher. + +The average time taken by LIME for each explanation is about 0.5 seconds, while our methods take about 1 second for the tabular datasets which use random forests. However, for CIFAR10, LIME using ResNet-18 takes about a minute while ANS takes around 50 seconds showcasing the benefit of reduced query complexity. With deeper models this is slated to improve even further. In any case, additional time for our methods in some cases is probably worth it given the higher accuracy and the fact that local explanations are independent and hence can be parallelized. + +Qualitatively too in Figures 3 and 4 we observe that ANS produces much more stable and intuitive explanations compared with other methods. ANS-Basic is slightly less stable than ANS but still better than the competitors. + +# 5 Discussion + +Rather than piecewise linear regression one could also perform piecewise polynomial regression for decision boundaries with high curvature, which will be more computationally expensive, but our rejection sampling method and analysis should be applicable in that context too. + +Our proposed approach is distinct from typical rejection sampling schemes [3] where a proposal distribution is tilted and used to sample from the desired distribution. The reason we do not subscribe to these standard schemes in our case is that these schemes are mainly used in two settings: i) when we are not able to sample from the original distribution or ii) when we want to sample from the tails of the original distribution. Both of these conditions are not met in our case since we sample in regions which include the mean (i.e. highest probability density) while having access to these distributions. + +There are also motivations for our approach based on causality and practical behavior of neural networks. + +Causal motivation: It is known that given a structural causal model (SCM) [22], the best sparse model captures the Markov blanket – i.e. parents and children in a causal graph – of the variable to be estimated. In the post-hoc explanation setting the target variable $Y$ has no children as the black box model is of the form $y = f(x)$ . Hence, if the black box i.e. $f(.)$ is linear lasso it could recover the causal parents for some regularization parameter. However, in the non-linear setting, one could have a case where multiple linear pieces explain the causal relationship in different parts of the domain. If one tries to fit a linear model, gradient for one piece with respect to one feature might (approximately) cancel the gradient with respect to another piece for the same feature because the weights are of opposite signs. This could lead the linear model missing some (causal) parents when explaining the variance in $y$ . However, if we are able to identify the correct (linear) regions, then a simple lasso-like fit in each such region should be able to uncover the correct causal parents overall. This work may also motivate a notion of locally causal, which may be useful in practice, beyond the standard formalisms of causality [22, 27] which are predominantly global. + +Simplicity bias motivation: In a recent paper [28], investigating the reasons for neural networks fitting to spurious correlations in the in-domain data resulting in poor generalization, the authors argue that this is because of the simplicity bias of neural networks. That is, the networks pick the simplest boundary to separate classes which could simply be a linear separator on one feature. However, in the test data, the optimal separator could be based on a more complex decision boundary. Hence, one would ideally want to capture the true complexity of the decision boundary. The definition of complexity they use to analyze arbitrarily complex decision boundaries is closely related to the number of linear pieces that would make up different decision boundaries. This formalization thus further motivates our ANS and ANS-Basic approaches, which identify the appropriate linear component based on a piecewise linear decision boundary. + +The explanations that we obtain are more accurate in many measures with lower sample and query complexity than standard baselines as we discuss in the experiments. However, like other black box posthoc explainability methods it is difficult to say with certainty that the provided explanations are in fact the "true" explanations. Additionally, the performance gains of our approach are contingent on the quality of the MPLSR schemes. In case the ranges are incorrect the estimation may reduce to standard LIME quality explanations. Luckily, this is likely to only happen when the ranges are overestimated and we include neighbors belonging to different linear pieces, since in the opposite case of underestimation we should still have neighbors belonging to the correct linear piece. In general though, the MPLSR implementations seem to be reasonably mature which is reassuring. + +In summary, we have proposed a novel neighborhood generation approach that is adaptive and is robust across different kernel widths, much more so than other methods. We have theoretically shown the benefit of this scheme compared with naive implementation of our idea where our main proposal is likely to be sample but more so query efficient. This is further validated through real data experiments where our approach is more accurate quantitatively as well as qualitatively. + +# Acknowledgement + +We would like to thank Sara Magliacane and Kartik Ahuja for helpful discussions at the beginning of this project. + +# References + +[1] C. J. Anders, P. Pasliev, A.-K. Dombrowski, K.-R. Muller, and P. Kessel. Fairwashing explanations with off-manifold detergent. In Intl. Conference on Machine Learning (ICML), 2020. +[2] T. Botari, F. Hvilshøj, R. Izbicki, and A. C. P. L. F. de Carvalho. Melime: Meaningful local explanation for machine learning models, 2020. +[3] G. Casella, C. P. Robert, and M. T. Wells. Generalized accept-reject sampling schemes. Institute of Mathematical Statistics, 2004. +[4] D. Dheeru and E. Karra Taniskidou. UCI machine learning repository, 2017. + +[5] A. Dhurandhar, T. Pedapati, A. Balakrishnan, K. A. Pin-Yu Chen, Karthikeyan Shanmugam, and R. Puri. Model agnostic contrastive explanations for structured data. https://arxiv.org/abs/1906.00117, 2019. +[6] A. Dhurandhar, K. Ramamurthy, K. Ahuja, and V. Arya. Locally invariant explanations: Towards stable and unidirectional explanations through local invariant learning. arXiv:2201.12143, 2022. +[7] I. Diakonikolas, J. Li, and A. Voloshinov. Efficient algorithms for multidimensional segmented regression. arXiv:2003.11086, 2020. +[8] FICO. Explainable machine learning challenge. https://community.fico.com/s/explainable-machine-learning-challenge?tabset-3158a=2, 2018. Accessed: 2018-10-25. +[9] E. Frank, Y. Wang, S. Inglis, G. Holmes, and I. H. Witten. Using model trees for classification. Machine Learning, 1998. +[10] C. Frye, C. Rowat, and I. Feige. Asymmetric shapley values: incorporating causal knowledge into model-agnostic explainability. NeurIPS, 2020. +[11] M. Garofalakis, D. Hyun, R. Rastogi, and K. Shim. Efficient algorithms for constructing decision trees with constraints. In Proceedings of the Sixth ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD '00, page 335-339. Association for Computing Machinery, 2000. +[12] A. Ghorbani, A. Abid, and J. Zou. Interpretation of neural networks is fragile, 2019. +[13] D. Gunning. Explainable artificial intelligence (xai). In Defense Advanced Research Projects Agency, 2017. +[14] K. Gurumoorthy, A. Dhurandhar, G. Cecchi, and C. Aggarwal. Efficient data representation by selecting prototypes with importance weights. In Proceedings of the IEEE International Conference on Data Mining, 2019. +[15] L. Hancox-Li. Robustness in machine learning explanations: does it matter? In Proceedings of the 2020 Conference on Fairness, Accountability, and Transparency. ACM, 2020. +[16] M. Herlihy and N. Shavit. The art of multiprocessor programming. Elsevier, 2012. +[17] T. Heskes, E. Sijben, I. G. Bucur, and T. Claassen. Causal shapley values: Exploiting causal knowledge to explain individual predictions of complex models. Advances in Neural Information Processing Systems, 2020. +[18] A. Ilyas, L. Engstrom, A. Athalye, and J. Lin. Black-box adversarial attacks with limited queries and information. Intl. Conference on Machine Learning, 2018. +[19] A. Krizhevsky. Learning multiple layers of features from tiny images, 2009. +[20] Z. Lu, H. Pu, F. Wang, Z. Hu, and L. Wang. The expressive power of neural networks: A view from the width. Advances in Neural Inf. Proc. Systems, 2017. +[21] S. M. Lundberg and S.-I. Lee. A unified approach to interpreting model predictions. In Advances in Neural Information Processing Systems, pages 4765-4774, 2017. +[22] J. Pearl. Causality: Models, Reasoning, and Inference. Cambridge University Press, 2000. +[23] T. Pedapati, A. Balakrishnan, K. Shanmugam, and A. Dhurandhar. Learning global transparent models consistent with local contrastive explanations. Advances in Neural Inf. Proc. Systems, 2020. +[24] G. Plumb, D. Molitor, and A. Talwalkar. Model agnostic supervised local explanations. In Advances in Neural Information Processing Systems, page 2520-2529, 2018. +[25] K. N. Ramamurthy, B. Vinzamuri, Y. Zhang, and A. Dhurandhar. Model agnostic multilevel explanations, 2020. + +[26] M. T. Ribeiro, S. Singh, and C. Guestrin. "Why should I trust you?": Explaining the predictions of any classifier. In Proceedings of the ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pages 1135-1144, 2016. +[27] D. Rubin. Causal inference using potential outcomes. J. Amer. Statist. Assoc., 2005. +[28] H. Shah, K. Tamuly, A. Raghunathan, P. Jain, and P. Netrapalli. The pitfalls of simplicity bias in neural networks. Advances in Neural Information Processing Systems, 33:9573-9585, 2020. +[29] A. A. Shrotri, N. Narodytska, A. Ignatiev, J. Marques-Silva, K. S. Meel, and M. Vardi. Constraint-driven explanations of black-box {ml} models, 2021. +[30] M. K. Vijaymeena and K. Kavitha. A survey on similarity measures in text mining. Machine Learning and Applications, 2016. +[31] P. N. Yannella and O. Kagan. Analysis: Article 29 working party guidelines on automated decision making under gdpr. 2018. https://www.cyberadviserblog.com/2018/01/analysis-article-29-working-party-guidelines-on-automated-decision-making-under-gdpr/. +[32] Y. Zhang, K. Song, Y. Sun, S. Tan, and M. Udell. Why should you trust my explanation? ICML-AI for Social Good, 2019. +[33] X. Zhao, W. Huang, X. Huang, V. Robu, and D. Flynn. Baylime: Bayesian local interpretable model-agnostic explanations. UAI, 2021. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] +(c) Did you discuss any potential negative societal impacts of your work? [Yes] +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] +(b) Did you include complete proofs of all theoretical results? [Yes] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] +(b) Did you mention the license of the assets? [Yes] +(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/isthistherightneighborhoodaccurateandqueryefficientmodelagnosticexplanations/images.zip b/isthistherightneighborhoodaccurateandqueryefficientmodelagnosticexplanations/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..99a660fc84a17547ef5123746845521e4130b877 --- /dev/null +++ b/isthistherightneighborhoodaccurateandqueryefficientmodelagnosticexplanations/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a21e0b2a6500827918de3e43e4c2fd96aa74b0e09f9e7a9df4524d70bfda982a +size 462281 diff --git a/isthistherightneighborhoodaccurateandqueryefficientmodelagnosticexplanations/layout.json b/isthistherightneighborhoodaccurateandqueryefficientmodelagnosticexplanations/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..d803b5a12aab5f38a6feb09bd2abfa7173fd6abb --- /dev/null +++ b/isthistherightneighborhoodaccurateandqueryefficientmodelagnosticexplanations/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:429f5449d5cc24e3053ff68439c3d5fb68b887df6b84756bd881ede936c46456 +size 465270 diff --git a/iterativefeaturematchingtowardprovabledomaingeneralizationwithlogarithmicenvironments/76e423a9-42ad-44b5-9d4c-8cae2ff60bb7_content_list.json b/iterativefeaturematchingtowardprovabledomaingeneralizationwithlogarithmicenvironments/76e423a9-42ad-44b5-9d4c-8cae2ff60bb7_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..2fc9d62a936558f4f5d692e50af1ac1af8a76642 --- /dev/null +++ b/iterativefeaturematchingtowardprovabledomaingeneralizationwithlogarithmicenvironments/76e423a9-42ad-44b5-9d4c-8cae2ff60bb7_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8129e61c0f183485f40d7dbf997847f896c74e841951aff4ff4487b6ef9dd7ff +size 76474 diff --git a/iterativefeaturematchingtowardprovabledomaingeneralizationwithlogarithmicenvironments/76e423a9-42ad-44b5-9d4c-8cae2ff60bb7_model.json b/iterativefeaturematchingtowardprovabledomaingeneralizationwithlogarithmicenvironments/76e423a9-42ad-44b5-9d4c-8cae2ff60bb7_model.json new file mode 100644 index 0000000000000000000000000000000000000000..524286f82c8fc061c0fbae16c719dcafa5270f12 --- /dev/null +++ b/iterativefeaturematchingtowardprovabledomaingeneralizationwithlogarithmicenvironments/76e423a9-42ad-44b5-9d4c-8cae2ff60bb7_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ac03f5aa02e046ce6f6821398dd14d1d3f3da75bd9a7243f3748cfef5cb36116 +size 98870 diff --git a/iterativefeaturematchingtowardprovabledomaingeneralizationwithlogarithmicenvironments/76e423a9-42ad-44b5-9d4c-8cae2ff60bb7_origin.pdf b/iterativefeaturematchingtowardprovabledomaingeneralizationwithlogarithmicenvironments/76e423a9-42ad-44b5-9d4c-8cae2ff60bb7_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..6af4acdc1d6599f4f1dd5829239a0b50f4b3086f --- /dev/null +++ b/iterativefeaturematchingtowardprovabledomaingeneralizationwithlogarithmicenvironments/76e423a9-42ad-44b5-9d4c-8cae2ff60bb7_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:767d201183ecd3a04a0674628f433a5fc5d894c323948ebb68996c11a0b7f9bf +size 508137 diff --git a/iterativefeaturematchingtowardprovabledomaingeneralizationwithlogarithmicenvironments/full.md b/iterativefeaturematchingtowardprovabledomaingeneralizationwithlogarithmicenvironments/full.md new file mode 100644 index 0000000000000000000000000000000000000000..d5c72dc99c4c1203aa1c1df63ccd93be97d49337 --- /dev/null +++ b/iterativefeaturematchingtowardprovabledomaingeneralizationwithlogarithmicenvironments/full.md @@ -0,0 +1,338 @@ +# Iterative Feature Matching: Toward Provable Domain Generalization with Logarithmic Environments + +Yining Chen + +Stanford University cynnjjs@stanford.edu + +Elan Rosenfeld + +Carnegie Mellon University elan@cmu.edu + +Mark Sellke + +Stanford University +msellke@stanford.edu + +Tengyu Ma + +Stanford University tengyuma@stanford.edu + +Andrej Risteski + +Carnegie Mellon University aristesk@andrew.cmu.edu + +# Abstract + +Domain generalization aims at performing well on unseen test environments with data from a limited number of training environments. Despite a proliferation of proposed algorithms for this task, assessing their performance both theoretically and empirically is still very challenging. Distributional matching algorithms such as (Conditional) Domain Adversarial Networks [12, 28] are popular and enjoy empirical success, but they lack formal guarantees. Other approaches such as Invariant Risk Minimization (IRM) require a prohibitively large number of training environments—linear in the dimension of the spurious feature space $d_{s}$ —even on simple data models like the one proposed by Rosenfeld et al. [37]. Under a variant of this model, we show that ERM and IRM can fail to find the optimal invariant predictor with $o(d_{s})$ environments. We then present an iterative feature matching algorithm that is guaranteed with high probability to find the optimal invariant predictor after seeing only $O(\log d_{s})$ environments. Our results provide the first theoretical justification for distribution-matching algorithms widely used in practice under a concrete nontrivial data model. + +# 1 Introduction + +Domain generalization aims at performing well on unseen environments using labeled data from a limited number of training environments [8]. In contrast to transfer learning or domain adaptation, domain generalization assumes that neither labeled nor unlabeled data from the test environments is available at training time. In the empirical literature, invariance of a "signal" feature distribution conditioned on the label, i.e. $P(\Phi(x) \mid y)$ , is the underlying assumption in widely adopted algorithms such as Correlation Alignment (CORAL) [43, 42], Maximum Mean Discrepancy (MMD) [13, 25], and (Conditional) Domain Adversarial Networks [12, 28]. Distribution-matching algorithms regularize the distribution of intermediate representations of examples from different environments to be closer in some metric. They are among the top-performing methods for domain generalization benchmarks like PACS [24], VLCS [11], and DomainNet [34], but they lack formal guarantees. Previous empirical works usually characterize the performance of these algorithms using generalization bounds based on divergence between domain distributions [7, 31], but those bounds are vacuous for the typical benchmarks for domain generalization and thus cannot explain their success. For example, when different environments have disjoint supports (as is the case in the above-mentioned benchmarks) the $\mathcal{H}$ -divergence [7] is 1 even for the linear hypothesis class. To obtain useful guarantees, it is necessary to study data models that encode structure reflective of settings of interest. Prior works attempting to theoretically characterize the performance of feature matching algorithms emphasize + +lower bounds [49, 44]. In this work, we seek to give the first positive theoretical justification for feature matching algorithms. + +Another common assumption in the literature is invariance of the label distribution conditioned on the signal features. Invariant Risk Minimization (IRM) [3] assumes $\mathbb{E}[y\mid \Phi (x)]$ is invariant, and follow-up works assume invariance of higher moments [46, 18, 30, 6]. However, empirical results for these algorithms are mixed: Gulrajani and Lopez-Paz [15], Aubin et al. [4] present experimental evidence that these methods do not consistently outperform ERM for either realistic or simple linear data models, when fairly evaluated. + +Recent theoretical works [37, 19] also question the theoretical foundations of IRM and its variants, shedding light on their failure conditions. These works study specific data generative models; a common assumption is that, conditioned on the label, some invariant features have identical distribution for all environments, and other spurious features have varying distributions across environments. The goal of these methods is then to obtain an invariant predictor, i.e. a classifier which uses only the invariant features. These works also often assume each training environment contains infinite samples. Thus, the central measure of domain generalization is the number of environments needed to recover an invariant predictor—we refer to this measure as the environment complexity of a learning algorithm. Rosenfeld et al. [37] show even for a simple generative model and linear classifiers, the environment complexity of IRM—and other objectives based on the same principle of invariance—is at least as large as the dimension of the spurious latent features, $d_{s}$ . Further results by Kamath et al. [19], Ahuja et al. [2] also point to a linear environment complexity. Although the models in these works are simple, they help elucidate why existing algorithms fail and can help inform better algorithmic design. + +IRM's linear environment complexity is prohibitive for realistic applications. Domain generalization benchmarks have fewer training environments than spurious features dimensions—PACS, VLCS, DomainNet have 4-6 total environments but the stylistic variations between domains are likely high-dimensional. In this paper, we show that a variant of distributional matching algorithm (Algorithm 1) finds the optimal invariant predictor with sublinear (even logarithmic) environment complexity. + +# 1.1 Our contributions + +Conceptually, we propose a "smoothed covariance" extension of the data model in Rosenfeld et al. [37], which is rich enough to establish an environment complexity separation between IRM/ERM and feature matching algorithms. More precisely, we show that ERM and IRM can fail to find the optimal invariant predictor with fewer than $d_{s} + 1$ training environments (Theorems 4.2, 4.3), while a relatively simple and natural algorithm based on iterative feature matching (IFM) finds the optimal invariant predictor with $O(\log d_s)$ environments. + +Moreover, our analysis highlights the value of iterative matching, much similar to matching at multiple layers in a deep neural network. IFM iteratively projects the features to a lower dimension while matching the label-conditioned feature distributions on a small, disjoint subset of the training environments. A projection inducing invariance in the non-invariant features across one subset of environments is unlikely to do so for a different subset, so each projection only removes (a constant fraction of) spurious feature dimensions with high probability. Intuitively, the iterative scheme prevents the different environments from "colluding" to create a solution which depends on spurious features. As a result, IFM recovers the optimal invariant predictor after $O(\log d_s)$ rounds and uses $O(1)$ environments per round, thus requiring $O(\log d_s)$ environments. + +Our techniques for proving the upper and lower bounds may be of independent interest. The upper bound (Theorem 5.1) is proved by showing that any projection matrix that uses many spurious dimensions cannot match feature covariances in a large set of training environments. This is done via intricate matrix concentration bounds and decoupling inequalities [10]. + +We derive the exact lower bound for IRM (Theorem 4.3) using tools from differential topology. Each environment provides an ellipsoidal constraint on the solution, and we prove that there exists a non-trivial intersection of these constraints (besides the origin, which corresponds to the "intended" solution). Our key lemma shows that the total number of intersections between two manifolds of complementary dimensions $k, d - k$ is even when certain transversality conditions hold, implying that the origin cannot be the only solution. + +Finally, to corroborate the advantages of the proposed algorithm, we perform experiments on a Gaussian dataset and a semi-synthetic Noised MNIST dataset [23], where the background noise spuriously correlates with the label. Our results in Section 6 suggest that practitioners may benefit from feature matching algorithms when the distinguishing property of the signal feature is indeed conditional distributional invariance, and may get additional advantage via matching at multiple layers with diminishing dimensions, echoing existing empirical observations [27, 29]. + +# 2 Preliminaries + +# 2.1 Domain generalization + +In domain generalization, we are given a set of $E$ training environments $\mathcal{E}_{tr}$ indexed by $e\in [E],^1$ and a set of test environments $\mathcal{E}_{ts}$ . For environment $e$ we have $n$ examples $\{(X_i^e,Y_i^e)\}_{i = 1}^n$ drawn from the distribution $P_{e}$ . In this work we study the infinite sample limit $n\to \infty$ so as to separate the effect of limited training environments from that of limited samples per environment, as is done in previous theoretical works [37, 19]. Let $\mathcal{X},\mathcal{P},\mathcal{V}$ denote the space of inputs, intermediate features, and labels. For a featurizer $\Phi :\mathcal{X}\rightarrow \mathcal{P}$ and classifier $w:\mathcal{P}\rightarrow \mathcal{V}$ , their risk on environment $e$ is denoted by $R_{\Phi ,w}^{e} = \mathbb{E}_{(X,Y)\sim P_{e}}[l(w\circ \Phi (X),Y)]$ for any common loss function $l$ . In this paper we focus on $\mathcal{V} = \{\pm 1\}$ , linear featurizers $\Phi (X) = UX$ for $U\in \mathbb{R}^{k\times d}$ , and unit-norm predictors $\widehat{Y} = \operatorname {sgn}(w^{\top}Ux)$ where $w\in \mathbb{R}^k$ and $\| w^{\top}U\|_{2} = 1$ for some feature dimension $k\leq d$ chosen by the algorithm. A predictor's 0-1 risk on environment $e$ is denoted by $R_{U,w}^{e} = \mathrm{Pr}_{(X,Y)\sim P_{e}}[\mathrm{sgn}(w^{\top}UX)\neq Y]$ . We focus on unit-norm predictors because we evaluate on the 0-1 risk on test environments, which are invariant to the scaling of $w^{\top}U$ under our data model. + +# 2.2 Baseline algorithms + +We analyze the performance of our proposed method and compare it to two baseline algorithms, ERM and IRM. ERM learns a classifier that minimizes the average loss over all training environments, where $l$ is any common training loss such as the logistic loss: + +$$ +\min _ {w \in \mathbb {S} ^ {d - 1}} \frac {1}{E} \sum_ {e \in [ E ]} \mathbb {E} _ {(X, Y) \sim P _ {e}} [ l (w ^ {\top} X, Y) ]. +$$ + +IRM learns a featurizer $\Phi(X) \in \mathbb{R}^k$ such that the optimal classifier on top of the featurizer is invariant across training environments. As we focus on linear classifier, it is equivalent to learning a linear transformation $U \in \mathbb{R}^{k \times d}$ such that it induces a classifier $w$ that is optimal for all $e \in \mathbb{E}_{tr}$ : + +$$ +\min _ {U \in \mathbb {R} ^ {k \times d}, w \in \mathbb {R} ^ {k}, \| w ^ {\top} U \| _ {2} = 1} \frac {1}{E} \sum_ {e \in [ E ]} \mathbb {E} _ {(X, Y) \sim P _ {e}} l ((w ^ {\top} U X), Y) +$$ + +$$ +\mathrm {s . t .} \quad w \in \underset {w ^ {\prime} \in \mathbb {R} ^ {k}} {\arg \min } \mathbb {E} _ {(X, Y) \sim P _ {e}} [ l ((w ^ {\prime} ^ {\top} U X), Y) ], \forall e \in \mathcal {E} _ {t r}. +$$ + +This is objective is not the same as feature distribution matching; IRM only tries to match the first moment. Observe that this constrained objective is intended to solve a minimax domain generalization problem, as opposed to ERM which is typically viewed as minimizing the risk in expectation. + +# 3 Problem setup + +We first recall the data model from Rosenfeld et al. [37]. We assume without loss of generality that the label $Y$ is uniformly randomly drawn from $\{\pm 1\}$ (extension of our theorems to $Y = 1$ with probability $\eta \neq 0.5$ is straightforward). Latent variable $Z$ consists of invariant features $Z_{1} \in \mathbb{R}^{r}$ and spurious features $Z_{2} \in \mathbb{R}^{d_{s}}$ where $d_{s} = d - r$ . The number of spurious features can be much larger than the number of invariant features, i.e. $d_{s} \gg r$ . The input $X \in \mathbb{R}^{d}$ is generated via a linear + +transformation of latent variable $Z$ , i.e. $X = SZ$ for a matrix $S \in \mathbb{R}^{d \times d}$ such that its left $r$ columns have rank $r$ (so that there are $r$ invariant dimensions). + +For each training environment indexed by $e \in [E]$ , the invariant features conditioned on $Y$ are drawn from a Gaussian distribution with mean $Y \cdot \mu_1 \in \mathbb{R}^r$ and nonsingular covariance $\Sigma_1 \in \mathbb{R}^{r \times r}$ . The spurious features conditioned on $Y$ have mean $Y \cdot \mu_2^e \in \mathbb{R}^{d_e}$ and covariance $\Sigma_2^e \in \mathbb{R}^{d_e \times d_e}$ where $\mu_e$ 's and $\Sigma_e$ 's vary across $e \in [E]$ . The assumption of symmetric class center with respect to the origin can also be relaxed. Define $\mu^e = [\mu_1, \mu_2^e]$ and $\Sigma^e = [\Sigma_1, \mathbf{0}_{r \times d_s}; \mathbf{0}_{d_s \times r}, \Sigma_2^e]$ . The overall data model for training environments is summarized below: + +$$ +Y \stackrel {i i d} {\sim} \operatorname {u n i f} \{\pm 1 \} +$$ + +$$ +Z _ {1} | Y \sim N (Y \cdot \mu_ {1}, \Sigma_ {1}) \in \mathbb {R} ^ {r} +$$ + +$$ +Z _ {2} | Y \sim N \left(Y \cdot \mu_ {2} ^ {e}, \Sigma_ {2} ^ {e}\right) \in \mathbb {R} ^ {d _ {s}} +$$ + +$$ +Z = [ Z _ {1}, Z _ {2} ] \in \mathbb {R} ^ {d} +$$ + +$$ +X = S Z. +$$ + +Since the goal of invariant feature learning is to learn a predictor that only uses the invariant features, one reasonable measure for domain generalization is a predictor's performance on test environments where the spurious features $Z_{2}$ are drawn from a different distribution—in particular, they are usually chosen adversarially. A classifier that predicts using the spurious features will perform badly on such test environments. When modeling the test environments, we consider the difficult scenario where there is one corresponding test environment for each training environment, whose parameters are the same except that the spurious means are flipped. Formally, for each environment $e \in \mathcal{E}_{tr}$ we construct a corresponding test environment $e' \in \mathcal{E}_{test}$ where + +$$ +Z _ {2} \sim N (- Y \cdot \mu_ {2} ^ {e}, \Sigma_ {2} ^ {e}) \in \mathbb {R} ^ {d _ {s}}. +$$ + +In this setting where the observations $X$ are a linear function of the latents $Z$ , Rosenfeld et al. [37] assume that the covariances of spurious features are isotropic and vary only in magnitude: + +Assumption 3.1 (Data model for spurious covariances in Rosenfeld et al. [37]). + +$$ +\Sigma_ {2} ^ {e} = \sigma_ {e} ^ {2} I _ {d _ {s}}, \text {w h e r e} \sigma_ {e} \text {i s a s c a l a r f o r a n e v i r o n m e n t i n d e x e d b y} e. +$$ + +We consider a generalized model where the covariances of spurious features for each environment is a generic random PSD matrix, instead of only random in scaling: + +Assumption 3.2 (Data model for spurious covariances in this work). + +$$ +\Sigma_ {2} ^ {e} \sim \overline {{\Sigma}} _ {2} ^ {e} + G _ {e} G _ {e} ^ {\top}, \text {w h e r e} \overline {{\Sigma}} _ {2} ^ {e} \in \mathbb {R} ^ {d _ {s} \times d _ {s}} \text {i s a r b i t a r y (a n d c o n b e a d v a r i a l) , a n d} +$$ + +$$ +[ G _ {e} ] _ {i, j} \stackrel {i i d} {\sim} N (0, 1) \text {f o r a l l} i, j \in [ d _ {s} ]. \text {F u r t h e r m o r e , m a x} _ {e} \| \overline {{\Sigma_ {2} ^ {e}}} \| _ {2} ^ {2} \leq D. +$$ + +Assumption 3.2 allows the covariance matrix of the spurious features to be almost worst-case: it is an arbitrary matrix, plus a Gaussian perturbation. This is a common assumption in algorithmic complexity called smoothed analysis [41], as we allow the parameters to be a random smoothing of arbitrary parameters. + +While our data model is simple, it has already been used as a sandbox to understand algorithms like IRM [37, 19] because it captures some important aspects of real-life data like latent variables and correlations between the labels and the spurious features. + +In the next section, we show that baseline algorithms ERM and IRM still have $\Omega(d_s)$ environment complexity under assumption 3.2, whereas our iterative feature matching algorithm (Algorithm 1) requires only $O(\log d_s)$ training environments. Note that the environment complexity of our algorithm only depends logarithmically on the norm bound $D$ . + +# 4 Main results + +Armed with assumption 3.2, we now present our main results. We begin by presenting our algorithm based on iterative feature matching. We then provide formal guarantees for its environment complexity in comparison to ERM and IRM. + +# Algorithm 1 Iterative Feature Matching (IFM) algorithm + +Require: Invariant feature dimension $r$ , total feature dimension $d$ , number of training environments $E = |\mathcal{E}_{tr}|$ , infinite samples $\{(X_i^e,Y_i^e)\}_{i=1}^\infty \sim P_e$ from each environment $e \in \mathcal{E}_{tr}$ , an array of integers indicating the number of training environments to use at each iteration $E_1, E_2, \ldots$ . + +1: $r_0\gets d,t\gets 0$ +2: while $r_t > r$ do +3: $t\gets t + 1$ +4: Uniformly randomly sample $E_{t}$ training environments without replacement. +5: Binary search between 1 and $r_{t - 1}$ to find the maximum dimension $r_t$ such that there exists orthonormal $U_{t}\in \mathbb{R}^{r_{t}\times r_{t - 1}}$ and $C_t\in \mathbb{R}^{r_t\times r_t}$ , where for all $e\in \mathcal{E}_t$ + +$$ +\mathbb {E} _ {(X, Y) \sim P _ {e}} \left[ U _ {t} \dots U _ {1} X X ^ {\top} U _ {1} ^ {\top} \dots U _ {t} ^ {\top} | Y \right] = C _ {t}. \tag {4.1} +$$ + +6: Return a classifier on projected features that minimizes the average risk + +$$ +\widehat {w} = \min _ {w \in \mathbb {S} ^ {r - 1}} \frac {1}{E} \sum_ {e \in [ E ]} \mathbb {E} _ {(X, Y) \sim P _ {e}} l (w ^ {\top} U _ {t} \dots U _ {1} X, Y). +$$ + +# 4.1 Iterative feature matching algorithm + +We hope to recover the invariant features by imposing constraints which are satisfied by only those features (i.e., they are not satisfied by the spurious features). A natural idea is to match the feature means and covariances across $\mathcal{E}_{tr}$ . Since $\mu_1, \Sigma_1$ are constant, any orthonormal featurizer $U \in \mathbb{R}^{r \times d}$ such that $US$ has only non-zero entries in the first $r$ rows yields invariant means $US\mu^e$ and covariances $US\Sigma^e S^\top U^\top$ . Thus we need $E$ large enough such that any $U' \in \mathbb{R}^{r \times d}$ using spurious dimensions cannot match the means and covariances. Informally, for each $e \in [E]$ we get $r \times r$ equations from matching covariances $U\Sigma^e U^\top = C$ , and we have $r \times d$ parameters to estimate in $U$ . Rough parameter counting suggests that if we match covariances of all $E$ environments jointly, we need at least $E > d / r$ environments to find a unique solution. Our key observation is that, due to the independence of randomness in $\Sigma_2^e$ , we can split $E$ environments into disjoint groups $\mathcal{E}_1, \ldots, \mathcal{E}_T$ , and use $\mathcal{E}_t$ to train an orthonormal featurizer that shrinks the feature dimensions from $r_{t-1}$ to $r_t$ . Thus, in each round we shrink the dimension by a constant factor using a constant number of environments. The main theoretical challenge that remains is to show that in each iteration, with high probability, only spurious features are projected out. + +This brings us to IFM (Algorithm 1), which proceeds in $T = O(\log d_s)$ rounds. Starting with an input dimension $r_0 = d$ , each round we learn an orthonormal matrix $U_t$ projecting features from $r_{t-1}$ to $r_t$ dimensions so that the feature covariances after projection match across a fresh set of training environments. In practice, for each choice of $r_t$ , starting from random initialization, we perform SGD on objective $\min_{U_t \in \mathbb{R}^{r_t \times r_{t-1}}} \sum_{e,e' \in \mathcal{E}_t} \| U_t(\Sigma^e - \Sigma^{e'}) U_t^T\|_F^2 + \lambda \| U_t^\top U_t - I\|_F^2$ until the objective is $\epsilon$ -close to 0. To ensure that all invariant dimensions are preserved, we always find the projection with the maximum possible dimension $r_t$ that still matches the covariances (i.e. admits an $\epsilon$ -optimal solution $U_t$ ), until we are left with only $r$ dimensions. + +Among algorithms used in practice, IFM is most similar to CORAL [43]. We study IFM since it is more amenable to theoretical analysis. The differences between IFM and CORAL are: first, CORAL does not enforce that the featurizer is orthonormal; second, IFM learns to extract features in an unsupervised manner, whereas CORAL jointly minimizes the supervised loss and feature distribution discrepancy; third, IFM matches the feature distributions at multiple layers and uses a disjoint set of environments for each layer—this iterative process is necessary for the theoretical guarantees we provide—but CORAL matches only at the last layer. Despite these differences, our theoretical results serve as a justification for using feature matching algorithms in general, when the distinguishing attribute of signal vs. spurious features is that the former have invariant distributions across all environments. In section 6 we empirically show that adding the core features of IFM to CORAL can improve test accuracy. + +The following theorem states that the environment complexity of IFM is logarithmic in the spurious feature dimension. A proof sketch is given in Section 5. + +Theorem 4.1 (IFM upper bound). Under assumption 3.2, suppose at each round IFM uses $|\mathcal{E}_t| = \tilde{\Omega}(1)^2$ training environments, with probability $1 - \exp(-\Omega(d_s))$ , IFM terminates in $O(\log d_s)$ rounds and outputs $\widehat{w} = w^*$ . + +As a remark, we note that there is in fact a simple algorithm that achieves $O(1)$ environment complexity under Assumption 3.2 (see Appendix D). However, this algorithm is extremely brittle and reliant on very specific aspects of the data model (such as Gaussianity) and it cannot be extended to other settings, whereas feature matching algorithms are regularly applied to general model architectures and real-world datasets. The goal of this paper is to provide theoretical justification for distribution matching algorithms and to investigate why they may outperform ERM and IRM, rather than to solve a specific data model. + +# 4.2 ERM and IRM still have linear environment complexity + +In the previous section, we showed that IFM has low environment complexity thanks to the additional structure we imposed in our model. However, it is possible that this additional structure also allows ERM and IRM to succeed. These next two results demonstrate that this is not the case. + +ERM has low test accuracy. In contrast to IFM, ERM still suffers from linear environment complexity under Assumption 3.2. The first theorem says there are hard instances where the ERM solution has worse-than-random performance on the test environments. + +Theorem 4.2 (ERM lower bound). Suppose $E \leq d_s$ , parameters $\mu_1 \in \mathbb{R}^r$ , $\Sigma_1 = \sigma_1^2 I_r$ , $\mu_2^e \in \mathbb{R}^{d_s}$ , $\overline{\Sigma_2^e} = \sigma_2^2 I_{d_s}$ (recall $\Sigma_2^e \sim \overline{\Sigma_2^e} + G_e G_e^\top$ ). Then any unit-norm linear classifier which achieves accuracy $\geq \Phi\left(\frac{2\|\mu_1\|}{\min(\sigma_1, \sigma_2)}\right)$ on all training environments will suffer 0-1 error at least $\frac{1}{2}$ on every test environment with flipped spurious mean, where $\Phi$ is the standard Normal CDF. + +A complete proof of Theorem 4.2 is in Appendix B.3. Note that it is quite reasonable to assume that the ERM solution satisfies the accuracy condition. In particular, it is common to model the spurious features as having much greater magnitude than the invariant features, since they have much greater dimensionality. For example, with a unit-norm mean we would expect $\| \mu_1\|^2 \approx r / d$ , $\| \mu_2^e\|^2 \approx d_s / d$ . Then for $r \ll d$ and $\sigma_1, \sigma_2 = \omega(1 / \sqrt{d})$ one can verify that $2\|\mu_1\| / \min(\sigma_1, \sigma_2) = o(\sqrt{r / d})$ is very close to 0, meaning the lower bound $\Phi\left(\frac{2\|\mu_1\|}{\min(\sigma_1, \sigma_2)}\right)$ is only slightly larger than $\frac{1}{2}$ . + +IRM fails to learn invariant features Our next theorem proves that even under Assumption 3.2, IRM is still not guaranteed to find an invariant predictor. We can show this by proving that when $E \leq d_s$ , we can find a featurizer that only uses spurious dimensions, i.e., $u_s \in \mathbb{R}^{d_s}$ , such that $u_s^\top \Sigma_2^e u_s = u_s^\top \mu_2^e$ for all $e \in \mathcal{E}_{tr}$ . If so, the optimal predictor on top of features $u_s^\top Z_2$ , $\widehat{w^e} = (u_s^\top \Sigma_2^e u_s)^{-1} u_s^\top \mu^e$ is invariant across all $e$ , and can therefore be the preferred solution IRM when the spurious features have greater magnitude than the invariant features on the training environments. + +Theorem 4.3 (IRM lower bound). Suppose $E \leq d_s$ . If $\mu_2^1, \ldots, \mu_2^E \in \mathbb{R}^{d_s}$ are linearly independent, then there exists $u_s \in \mathbb{R}^{d_s}$ , $\| u_s \|_2 > 0$ , such that $u_s^\top \Sigma_2^e u_s = u_s^\top \mu_2^e$ for all $e \in [E]$ . + +Proof Sketch. Observe that each environment provides an ellipsoidal constraint $E_{e} = \{u_{s}\in \mathbb{R}^{d_{s}}: u_{s}^{\top}\Sigma_{2}^{e}u_{s} - u_{2}^{\top}\mu_{2}^{e} = 0\}$ . The origin is a trivial intersection. We prove the existence of a non-trivial intersection using tools from differential topology. The key lemma is that the total number of intersection points between two manifolds of complementary dimensions $k,d - k$ is even when certain transversality conditions hold. Using these techniques, we show that $|\bigcap_{e}E_{e}|\geq 2$ for almost all matrices $\Sigma_2^1,\ldots ,\Sigma_2^E$ , as long as the means are linearly independent. + +A complete proof of Theorem 4.3 is in Appendix B.4. + +# 5 Proof sketch for the main upper bound Theorem 4.1 + +To argue that IFM outputs a featurizer $U_{1} \ldots U_{T}$ that does not use the spurious features, we need to show that the right $d_{s}$ columns of matrix $U_{T} \ldots U_{1} S$ are all-zero. The main lemma below says that this happens with high probability if we match $\tilde{\Omega}(1)$ environments at every iteration, + +Lemma 5.1. If for all $1 \leq t \leq T$ , $|\mathcal{E}_t| = E_t = \Omega(c(\log(D / d_s) + \log d_s))$ , and $U_1, \ldots, U_T$ are the orthonormal matrices returned by IFM, then with probability $1 - \exp(-\Omega(d_s))$ , $r_t - r < (r_{t-1} - r + 1) / c$ for all $t$ , and if we write $U_T \ldots U_1 S = [A, B]$ , where $B \in \mathbb{R}^{r \times d_s}$ , then $B = \mathbf{0}_{r \times d_s}$ . + +Theorem 4.1 follows from Lemma 5.1 as follows: We take $c = 2$ and the algorithm terminates in $T = O(\log d_s)$ rounds. Therefore with an environment complexity of $O(\log d_s)$ , we learn a feature extractor $U = U_T \ldots U_1$ that does not use any spurious dimensions. Since $U$ is orthonormal, it must contain all signal dimensions. The predictor on top of this representation uses all and only signal dimensions, so with high probability, IFM outputs $\hat{w} = w^*$ . + +The first step towards proving Lemma 5.1 is to show that with high probability, any one-layer featurizer $Q_{1} \in \mathbb{R}^{k_{1} \times d_{s}}$ that uses only spurious dimensions cannot match feature covariances from $\tilde{\Omega}(d_{s} / k_{1})$ environments. If a featurizer $U_{1} \in \mathbb{R}^{r_{1} \times d}$ uses $k_{1}$ spurious dimensions, there is a corresponding rank- $k_{1}$ featurizer $Q_{1} \in \mathbb{R}^{k_{1} \times d_{s}}$ that uses only spurious dimensions. So Lemma 5.2 implies that any $U_{1}$ that matches covariances in $\mathcal{E}_{1}$ must use at most $d_{s} / E_{1}$ spurious dimensions. We will then apply this argument recursively until we have 0 spurious dimensions. + +Lemma 5.2 (Informal version of Lemma B.3). For any integer $2 \leq k_{1} \leq d_{s}/2$ , when $|\mathcal{E}_{1}| = E_{1} = \Omega\left(\frac{d_{s} - k_{1}}{k_{1} - 1}\max \left\{1, \log \left(\frac{D}{(k_{1} - 1)d_{s}}\right), \log \left(\frac{d_{s}}{k_{1} - 1}\right)\right\}\right)$ , with probability $1 - O(\exp(-d_{s}))$ , no orthonormal $Q \in \mathbb{R}^{k_{1} \times d_{s}}$ satisfies that for some constant $C_{1} \in \mathbb{R}^{k_{1} \times k_{1}}$ . + +$$ +\forall e \in [ E _ {1} ], \quad Q \Sigma_ {2} ^ {e} Q ^ {\top} = C _ {1}. \tag {5.1} +$$ + +Section B.1 gives a proof sketch. The formal statement Lemma B.3 and its proof can be found in Appendix B.2. + +The next claim says that Lemma 5.2 can be applied iteratively, i.e. fixing a featurizer from previous iterations that uses $k_{t-1}$ spurious dimensions, with high probability, any $U_t$ that matches features from $\Omega(k_{t-1}/k_t)$ new environments use at most $k_t$ spurious dimensions. + +Corollary 5.3 (Informal version of Corollary B.7). Suppose $2 \leq k_{t} \leq k_{t-1}/2 \leq d_{s}/2$ . When $|\mathcal{E}_{t}| = E_{t} = \Omega\left(\frac{k_{t-1} - k_{t}}{k_{t}-1}\max \left\{1, \log \left(\frac{D}{(k_{t}-1)d_{s}}\right), \log \left(\frac{d_{s}}{k_{t}-1}\right)\right\}\right)$ , for fixed orthonormal $P \in \mathbb{R}^{k_{t-1} \times d_{s}}$ , with probability $1 - O(\exp(-d_{s}))$ , no orthonormal $Q \in \mathbb{R}^{k_{t} \times k_{t-1}}$ satisfies $\forall e \in [E_{t}]$ , $QP\Sigma_{2}^{e}P^{\top}Q^{\top} = C_{t}$ for some constant $C_{t} \in \mathbb{R}^{r_{t} \times r_{t}}$ . + +The formal statement Corollary B.7 and its proof can be found in Appendix B.2. Lemma 5.1 follows from iterative application of Corollary 5.3, as shown in Appendix B.2. + +# 6 Experiments + +In light of the differences between IFM and CORAL discussed in section 4.1, we test several questions inspired by our theory: (Q1) Do feature matching algorithms (IFM and CORAL) have much smaller environment complexity compared to ERM and IRM, with finite samples drawn from data models similar to our assumptions? (Q2) Can decoupling feature matching and supervised training of the classifier (IFM) improve over joint training (CORAL)? (Q3) For neural network featurizers, can matching feature distributions at multiple layers improve over matching at only the last layer (naive CORAL)? (Q4) Can matching disjoint sets of environments at each layer perform as well as matching all environments at all layers? (Q5) Is it important to shrink feature dimensions? We use two tasks to investigate those questions empirically. Appendix C contains additional details. + +Gaussian dataset is a binary classification task that closely reflects our assumptions in section 3. + +Noised MNIST is a 10-way semi-synthetic classification task modified from LeCun and Cortes [23]. Conditioned on the class, we add noise with identical mean but changing covariances across training environments. In test environments, the noise is uncorrelated with the label. + +![](images/d8597f33d846b7ec6bccec2c83964a3f93d279b9839daf82507369db10b7ea49.jpg) +Avg Test Accuracy for Gaussian Dataset + +![](images/4998a12efd0cc1d3e322c568757dbf9b77b31a76f733f49860a30b12adb87a37.jpg) +Avg Test Accuracy for Noised MNIST +Figure 1: For Gaussian dataset, our algorithm IFM achieves highest test accuracy with the same number of training environments. +Figure 2: For Noised MNIST, matching feature distributions from multiple layers improves over naive CORAL across different architectures. + +Algorithms and architectures. For Gaussian dataset we use linear predictors. IRM follows the implementation in Arjovsky et al. [3]; CORAL jointly minimizes average supervised loss on training environments and $L_{\text{coral}}$ , which is the average of squared distances in conditional feature means (in $l_2$ norm) and covariances (in Frobenius norm) between adjacent training environments; CORAL+ON adds orthonormal penalty loss $L_{on}(U) = \|UU^\top - I\|_F^2$ where $U$ is the featurizer; IFM is our Algorithm 1, where for each layer $U_t$ , the training objective is $L_t(U_t) = \lambda_1 L_{\text{coral}} + \lambda_2 L_{on}$ . We test IFM with 1 vs. 3-layer featurizers, either matching all (match-all) or a disjoint set of training environments (match-disjoint) at each layer. + +For Noised MNIST we use ReLU networks with 1-6 layers. Although our theory for IFM is only for the linear setting, in practice we can extend the idea to deep network by training the classifier head together with feature matching at different layers. CORAL (match-all) and CORAL (match-disjoint) in Figure 2 are natural extensions of IFM to nonlinear models. They match at all layers post-activation, using either all (match-all) or a disjoint subset of training environments (match-disjoint) per layer. Figure 2 shows that they outperform naive CORAL, which matches features only at the last layer. Thus, the core ideas of IFM may be used to improve performance of existing feature matching algorithms with nonlinear models and realistic datasets (e.g. DANN, MMD). + +Results. (Q1) Figures 1 and 2 show that IFM and CORAL have much smaller environment complexity compared to ERM and IRM in both datasets. (Q2) In Gaussian dataset, IFM improves over CORAL. (Q3) For Noised MNIST, matching feature distributions at multiple layers (CORAL match-all, CORAL match-disjoint) improves over matching at only the last layer (CORAL). (Q4) In both datasets, matching disjoint sets of environments at each layer (IFM match-disjoint, CORAL match-disjoint) is almost as good as matching all environments at all layers (IFM match-all, CORAL match-all) while saving computation. (Q5) For Noised MNIST (Table 2 in Appendix C), shrinking feature dimensions is crucial for the advantage of feature matching at multiple layers, e.g. matching features at 3 layers with widths [24, 24, 24] does not significantly improve over matching features at the last layer (CORAL). Overall, our results suggest that practitioners may benefit from feature matching algorithms when the data is similar to our assumed model, and may get additional advantage via matching at multiple layers with diminishing dimensions, echoing existing empirical works [27, 29]. + +# 7 Conclusion + +This work presents the first domain generalization algorithm which provably recovers an invariant predictor with a number of environments that scales sub-linearly with the spurious feature dimension. Our results demonstrate that generalization which does not suffer from the "curse of dimensionality" is possible, and based on our theory we believe the use of an iterative approach is a key insight which could lead to additional positive results for out-of-distribution generalization. Notably, this work also represents the first theoretical justification for the empirical success of existing algorithms which use feature distribution matching. However, there remains much room for improvement: our results are + +for a linear data model with fairly special assumptions. It would be interesting to analyze data models in which the observables are a non-linear function of the latent variables. + +# Acknowledgements + +We would like to thank Colin Wei, Sang Michael Xie, Ananya Kumar, and Ciprian Manolescu for helpful discussions. YC is supported by Stanford Graduate Fellowship. MS is supported by NSF and Stanford Graduate Fellowships. TM acknowledges support of Google Faculty Award and NSF IIS 2045685. AR and ER acknowledge support from the NSF via IIS-2211907 and the CMU/PwC DT&I Center. AR acknowledges support of an Amazon Research Award. + +# References + +[1] K. Ahuja, E. Caballero, D. Zhang, J.-C. Gagnon-Audet, Y. Bengio, I. Mitliagkas, and I. Rish. Invariance principle meets information bottleneck for out-of-distribution generalization. Advances in Neural Information Processing Systems, 34:3438-3450, 2021. +[2] K. Ahuja, J. Wang, A. Dhurandhar, K. Shanmugam, and K. R. Varshney. Empirical or invariant risk minimization? a sample complexity perspective. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=jrA5GAccy_. +[3] M. Arjovsky, L. Bottou, I. Gulrajani, and D. Lopez-Paz. Invariant risk minimization. arXiv preprint arXiv:1907.02893, 2019. +[4] B. Aubin, A. Slowik, M. Arjovsky, L. Bottou, and D. Lopez-Paz. Linear unit-tests for invariance discovery. arXiv preprint arXiv:2102.10867, 2021. +[5] S. Beery, G. Van Horn, and P. Perona. Recognition in terra incognita. In Proceedings of the European Conference on Computer Vision (ECCV), September 2018. +[6] A. Bellot and M. van der Schaar. Generalization and invariances in the presence of unobserved confounding. arXiv preprint arXiv:2007.10653, 2020. +[7] S. Ben-David, J. Blitzer, K. Crammer, A. Kulesza, F. Pereira, and J. W. Vaughan. A theory of learning from different domains. Machine learning, 79(1-2):151-175, 2010. +[8] G. Blanchard, G. Lee, and C. Scott. Generalizing from several related classification tasks to a new unlabeled sample. In Advances in Neural Information Processing Systems, volume 24. Curran Associates, Inc., 2011. URL https://proceedings.neurips.cc/paper/2011/file/b571ecea16a9824023ee1af16897a582-Paper.pdf. +[9] M. Chevalley, C. Bunne, A. Krause, and S. Bauer. Invariant causal mechanisms through distribution matching. arXiv preprint arXiv:2206.11646, 2022. +[10] V. H. de la Peña and S. J. Montgomery-Smith. Decoupling inequalities for the tail probabilities of multivariate u-statistics. The Annals of Probability, pages 806-816, 1995. +[11] C. Fang, Y. Xu, and D. N. Rockmore. Unbiased metric learning: On the utilization of multiple datasets and web images for softening bias. In Proceedings of the IEEE International Conference on Computer Vision, pages 1657-1664, 2013. +[12] Y. Ganin, E. Ustinova, H. Ajakan, P. Germain, H. Larochelle, F. Laviolette, M. Marchand, and V. Lempitsky. Domain-adversarial training of neural networks. The journal of machine learning research, 17(1):2096-2030, 2016. +[13] A. Gretton, K. M. Borgwardt, M. J. Rasch, B. Scholkopf, and A. Smola. A kernel two-sample test. J. Mach. Learn. Res., 13(null):723-773, Mar. 2012. ISSN 1532-4435. +[14] V. Guillemin and A. Pollack. Differential topology, volume 370. American Mathematical Soc., 2010. + +[15] I. Gulrajani and D. Lopez-Paz. In search of lost domain generalization. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=1QdXeXDoWtI. +[16] A. Hyvarinen and H. Morioka. Unsupervised feature extraction by time-contrastive learning and nonlinear ica. Advances in neural information processing systems, 29, 2016. +[17] A. Hyvarinen, H. Sasaki, and R. Turner. Nonlinear ica using auxiliary variables and generalized contrastive learning. In K. Chaudhuri and M. Sugiyama, editors, Proceedings of the Twenty-Second International Conference on Artificial Intelligence and Statistics, volume 89 of Proceedings of Machine Learning Research, pages 859–868. PMLR, 16–18 Apr 2019. +[18] W. Jin, R. Barzilay, and T. Jaakkola. Domain extrapolation via regret minimization. arXiv preprint arXiv:2006.03908, 2020. +[19] P. Kamath, A. Tangella, D. Sutherland, and N. Srebro. Does invariant risk minimization capture invariance? In A. Banerjee and K. Fukumizu, editors, Proceedings of The 24th International Conference on Artificial Intelligence and Statistics, volume 130 of Proceedings of Machine Learning Research, pages 4069-4077. PMLR, 13-15 Apr 2021. URL http://proceedings.mlr.press/v130/kamath21a.html. +[20] I. Khemakhem, D. Kingma, R. Monti, and A. Hyvarinen. Variational autoencoders and nonlinear ica: A unifying framework. In International Conference on Artificial Intelligence and Statistics, pages 2207-2217. PMLR, 2020. +[21] D. Krueger, E. Caballero, J.-H. Jacobsen, A. Zhang, J. Binas, D. Zhang, R. Le Priol, and A. Courville. Out-of-distribution generalization via risk extrapolation (rex). In International Conference on Machine Learning, pages 5815-5826. PMLR, 2021. +[22] B. Laurent and P. Massart. Adaptive estimation of a quadratic functional by model selection. Ann. Statist., 28(5):1302-1338, 10 2000. doi: 10.1214/aos/1015957395. URL http://dx.doi.org/10.1214/aos/1015957395. +[23] Y. LeCun and C. Cortes. MNIST handwritten digit database. 2010. URL http://yann.lecun.com/exdb/mnist/. +[24] D. Li, Y. Yang, Y.-Z. Song, and T. M. Hospedales. Deeper, broader and artier domain generalization. In Proceedings of the IEEE international conference on computer vision, pages 5542-5550, 2017. +[25] H. Li, S. J. Pan, S. Wang, and A. C. Kot. Domain generalization with adversarial feature learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 5400-5409, 2018. +[26] Y. Li and Y. Liang. Learning overparameterized neural networks via stochastic gradient descent on structured data. In Advances in Neural Information Processing Systems, pages 8157-8166, 2018. +[27] M. Long, Y. Cao, J. Wang, and M. Jordan. Learning transferable features with deep adaptation networks. In F. Bach and D. Blei, Editors, Proceedings of the 32nd International Conference on Machine Learning, volume 37 of Proceedings of Machine Learning Research, pages 97-105, Lille, France, 07-09 Jul 2015. PMLR. URL http://proceedings.mlr.press/v37/long15.html. +[28] M. Long, Z. CAO, J. Wang, and M. I. Jordan. Conditional adversarial domain adaptation. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 31. Curran Associates, Inc., 2018. URL https://proceedings.neurips.cc/paper/2018/file/ab88b15733f543179858600245108dd8-Paper.pdf. +[29] Z. Luo, Y. Zou, J. Hoffman, and L. F. Fei-Fei. Label efficient learning of transferable representations acrossss domains and tasks. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017. URL https://proceedings.neurips.cc/paper/2017/file/a8baa56554f96369ab93e4f3bb068c22-Paper.pdf. + +[30] D. Mahajan, S. Tople, and A. Sharma. Domain generalization using causal matching. arXiv preprint arXiv:2006.07500, 2020. +[31] Y. Mansour, M. Mohri, and A. Rostamizadeh. Multiple source adaptation and the rényi divergence. arXiv preprint arXiv:1205.2628, 2012. +[32] K. Muandet, D. Balduzzi, and B. Schölkopf. Domain generalization via invariant feature representation. In S. Dasgupta and D. McAllester, editors, Proceedings of the 30th International Conference on Machine Learning, volume 28 of Proceedings of Machine Learning Research, pages 10-18, Atlanta, Georgia, USA, 17-19 Jun 2013. PMLR. URL http://proceedings.mlr.press/v28/muandet13.html. +[33] A. Pajor. Metric entropy of the grassmann manifold. Convex Geometric Analysis, 34:181-188, 1998. +[34] X. Peng, Q. Bai, X. Xia, Z. Huang, K. Saenko, and B. Wang. Moment matching for multi-source domain adaptation. In Proceedings of the IEEE International Conference on Computer Vision, pages 1406-1415, 2019. +[35] A. Rame, C. Dancette, and M. Cord. Fishr: Invariant gradient variances for out-of-distribution generalization. In International Conference on Machine Learning, pages 18347-18377. PMLR, 2022. +[36] A. Robey, G. J. Pappas, and H. Hassani. Model-based domain generalization. Advances in Neural Information Processing Systems, 34:20210-20229, 2021. +[37] E. Rosenfeld, P. Ravikumar, and A. Risteski. The risks of invariant risk minimization. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=BbNIbVPJ-42. +[38] M. Rudelson and R. Vershynin. Hanson-Wright inequality and sub-gaussian concentration. Electronic Communications in Probability, 18(none):1-9, 2013. doi: 10.1214/ECP.v18-2865. URL https://doi.org/10.1214/ECP.v18-2865. +[39] S. Sagawa, P. W. Koh, T. B. Hashimoto, and P. Liang. Distributionally robust neural networks for group shifts: On the importance of regularization for worst-case generalization. arXiv preprint arXiv:1911.08731, 2019. +[40] D. Serre. Matrices: Theory and Applications. Graduate Texts in Mathematics. Springer, 2010. ISBN 9781441930101. URL https://books.google.to/books?id=IYWLcgaACAAJ. +[41] D. A. Spielman and S.-H. Teng. Smoothed analysis of algorithms: Why the simplex algorithm usually takes polynomial time. J. ACM, 51(3):385-463, May 2004. ISSN 0004-5411. doi: 10.1145/990308.990310. URL https://doi.org/10.1145/990308.990310. +[42] B. Sun and K. Saenko. Deep coral: Correlation alignment for deep domain adaptation. In European conference on computer vision, pages 443-450. Springer, 2016. +[43] B. Sun, J. Feng, and K. Saenko. Return of frustratingly easy domain adaptation. In Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence, AAAI'16, page 2058-2065. AAAI Press, 2016. +[44] R. Tachet des Combes, H. Zhao, Y.-X. Wang, and G. J. Gordon. Domain adaptation with conditional distribution matching and generalized label shift. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 19276-19289. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper/2020/file/dfbfa7ddcfffeb581f50edcf9a0204bb-Paper.pdf. +[45] R. Vershynin. Introduction to the non-asymptotic analysis of random matrices. In Y. Eldar and G. Kutyniok, editors, Compressed Sensing, Theory and Applications, chapter 5, pages 210-268. Cambridge University Press, 2012. +[46] C. Xie, F. Chen, Y. Liu, and Z. Li. Risk variance penalization: From distributional robustness to causality. arXiv preprint arXiv:2006.07544, 2020. + +[47] G. Zhang, H. Zhao, Y. Yu, and P. Poupart. Quantifying and improving transferability in domain generalization. Advances in Neural Information Processing Systems, 34:10957-10970, 2021. +[48] M. Zhang, H. Marklund, N. Dhawan, A. Gupta, S. Levine, and C. Finn. Adaptive risk minimization: Learning to adapt to domain shift. Advances in Neural Information Processing Systems, 34:23664-23678, 2021. +[49] H. Zhao, R. T. D. Combes, K. Zhang, and G. Gordon. On learning invariant representations for domain adaptation. In Proceedings of the 36th International Conference on Machine Learning, pages 7523-7532. PMLR, 09-15 Jun 2019. URL http://proceedings.mlr.press/v97/zhao19a.html. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] See Section 1.1. +(b) Did you describe the limitations of your work? [Yes] See Section 7 and Appendix E. +(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Section E. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] See Section 3. +(b) Did you include complete proofs of all theoretical results? [Yes] See Section 4, Appendix B. + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] Code attached in supplemental file. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 6, Appendix C. +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] See figures 1, 2. +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Appendix C. + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] We cited LeCun and Cortes [23]. +(b) Did you mention the license of the assets? [Yes] See Appendix C. +(c) Did you include any new assets either in the supplemental material or as a URL? [N/A] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/iterativefeaturematchingtowardprovabledomaingeneralizationwithlogarithmicenvironments/images.zip b/iterativefeaturematchingtowardprovabledomaingeneralizationwithlogarithmicenvironments/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..e5d8cfacdce2fcfe79b6eed87901816ed8830c4b --- /dev/null +++ b/iterativefeaturematchingtowardprovabledomaingeneralizationwithlogarithmicenvironments/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4af8f395d1171ee32ce18ce67b367120bec67255284beff3ab3f256baf93974c +size 124460 diff --git a/iterativefeaturematchingtowardprovabledomaingeneralizationwithlogarithmicenvironments/layout.json b/iterativefeaturematchingtowardprovabledomaingeneralizationwithlogarithmicenvironments/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..d21076869427e0e9e88289ff0e825b7855465a22 --- /dev/null +++ b/iterativefeaturematchingtowardprovabledomaingeneralizationwithlogarithmicenvironments/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f376f2d0984dd644d0944fb8db05d5d55e312a8237a54a3a907b64f8125ea29d +size 504474 diff --git a/iterativescenegraphgeneration/2a70279f-e68e-4a7f-a930-bf125fec9c5a_content_list.json b/iterativescenegraphgeneration/2a70279f-e68e-4a7f-a930-bf125fec9c5a_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..a64f51a3ba8d14bbd4f8fd1d38ff47ef7acf8d70 --- /dev/null +++ b/iterativescenegraphgeneration/2a70279f-e68e-4a7f-a930-bf125fec9c5a_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:609282ebdb90e311b7b96dfac40cf7b92eea6349462202aa2492cb327565e810 +size 98046 diff --git a/iterativescenegraphgeneration/2a70279f-e68e-4a7f-a930-bf125fec9c5a_model.json b/iterativescenegraphgeneration/2a70279f-e68e-4a7f-a930-bf125fec9c5a_model.json new file mode 100644 index 0000000000000000000000000000000000000000..ea7068f9c5e7ed0f202e3344dbf8c1f7d8633322 --- /dev/null +++ b/iterativescenegraphgeneration/2a70279f-e68e-4a7f-a930-bf125fec9c5a_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b4646ee569a2dbfec927196f7823945eab299d3310490c55912814856b213797 +size 120530 diff --git a/iterativescenegraphgeneration/2a70279f-e68e-4a7f-a930-bf125fec9c5a_origin.pdf b/iterativescenegraphgeneration/2a70279f-e68e-4a7f-a930-bf125fec9c5a_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..593c37dbd48211308d88730097bc10e692ea80bc --- /dev/null +++ b/iterativescenegraphgeneration/2a70279f-e68e-4a7f-a930-bf125fec9c5a_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c365a79e7a5f5866e1ca32a6cd9831cc3e47142b9e75378abd63866aff9a9b3 +size 2989954 diff --git a/iterativescenegraphgeneration/full.md b/iterativescenegraphgeneration/full.md new file mode 100644 index 0000000000000000000000000000000000000000..362951c69da1c9a5df24f5fd8b20a7ff5a01859e --- /dev/null +++ b/iterativescenegraphgeneration/full.md @@ -0,0 +1,324 @@ +# Iterative Scene Graph Generation + +Siddhesh Khandelwal1,2 and Leonid Sigal1,2,3 + +$^{1}$ Department of Computer Science, University of British Columbia + +$^{2}$ Vector Institute for AI + +$^{3}$ CIFAR AI Chair + +{skhandel, lsignal}@cs.ubc.ca + +# Abstract + +The task of scene graph generation entails identifying object entities and their corresponding interaction predicates in a given image (or video). Due to the combinatorially large solution space, existing approaches to scene graph generation assume certain factorization of the joint distribution to make the estimation feasible (e.g., assuming that objects are conditionally independent of predicate predictions). However, this fixed factorization is not ideal under all scenarios (e.g., for images where an object entailed in interaction is small and not discernible on its own). In this work, we propose a novel framework for scene graph generation that addresses this limitation, as well as introduces dynamic conditioning on the image, using message passing in a Markov Random Field. This is implemented as an iterative refinement procedure wherein each modification is conditioned on the graph generated in the previous iteration. This conditioning across refinement steps allows joint reasoning over entities and relations. This framework is realized via a novel and end-to-end trainable transformer-based architecture. In addition, the proposed framework can improve existing approach performance. Through extensive experiments on Visual Genome [30] and Action Genome [25] benchmark datasets we show improved performance on the scene graph generation task. The code is available at github.com/ubc-vision/IterativeSG. + +# 1 Introduction + +Scene graphs allow for structured understanding of objects and their interactions within a scene. A scene graph is a graph where nodes represent objects within the scene, each detailed by the class label and spatial location, and the edges capture the relationships between object pairs. These relationships are usually represented by a , predicate, object> triple. Effectively generating such graphs, from either images or videos, has emerged as a core problem in computer vision [14, 35, 39, 46, 50, 52, 54]. Scene graph representations can be leveraged to improve performance on a variety of complex high-level tasks like VQA [24, 47], Image Captioning [17, 53], and Image Generation [26]. + +The task of scene graph generation involves estimating the conditional distribution of the relationship triplets given an image. Naively modelling this distribution is often infeasible as the space of possible relationship triplets is considerably larger than the space of possible subjects, objects, and predicates. To circumvent this issue, existing methods factorize the aforementioned distribution into easy-to-estimate conditionals. For example, two-stage approaches, like [11, 47, 55], follow the graphical model image $\rightarrow$ [subject, object] $\rightarrow$ predicate, wherein the subjects and objects are independently obtained via a pre-trained detector like Faster-RCNN [41]. These are then consumed by a downstream network to estimate predicates. Any such factorization induces conditional dependencies (and independencies) that heavily influence model characteristics. For example, in the aforesaid graphical model, errors made during the estimation of the subjects and objects are naturally propagated towards the predicate distribution, which makes the estimation of predicates involving + +classes with poor detectors challenging. Furthermore, the assumed fixed factorization might not always be optimal. Having information about predicates in an image can help narrow down the space of possible subjects/objects, e.g., predicate wearing makes it likely that the subject is a person. + +Additionally, due to the two-stage nature of most existing scene graph approaches (barring very recent methods like [14, 31, 35]), the image feature representations obtained from a pre-trained task-oblivious detector might not be optimally catered towards the scene graph generation problem. Intuitively, one can imagine that the information required to accurately localize an object might not necessarily be sufficient for predicate prediction, and by extension, accurate scene graph generation. Moreover, two-stage approaches often suffer with efficiency issues as the detected objects are required to be paired up before predicate assignment. Doing so naively, by pairing all possible objects [50], results in quadratic number of pairs that need to be considered. Traditional approaches deal with this using heuristics, such as IoU-based threshold-based pairing [47, 55]. + +In this work, we aim to alleviate the previously mentioned issues arising from a fixed factorization and potentially limited object-centric feature representations by proposing a general framework wherein the subject, objects, and predicates can be inferred jointly (i.e., depend on one another), while simultaneously avoiding the complexity of exponential search space of relational triplets. This is achieved by performing message passing within a Markov Random Field (MRF) defined by components of a relational triplet (Figure 1(a)). Unrolling this message passing is equivalent to an iterative refinement procedure (Figure 1(b)), where each message passing stage takes in the estimate from the previous step. Our proposed framework models this iterative refinement strategy by first producing a scene graph estimate using a traditional factorization, and then systematically improving it over multiple refinement steps, wherein each refinement is conditioned on the graph generated in the previous iteration. + +![](images/0387f7df9102d92fd9e100de0a590b91841b7230daa788cbb8ebd47ae3bb16ef.jpg) +Figure 1: Iterative Refinement for Scene Graph Generation. By unrolling the message passing in a Markov Random Field (a), our proposed approach essentially models an iterative refinement process (b) wherein each modification step is conditioned on the previously generated graph estimate. + +This conditioning across refinement steps compensates for the conditional independence assumptions and lets our framework jointly reason over the subjects (s), objects (o), and predicates (p). + +Contributions. To realize the aforementioned iterative framework, we propose a novel and intuitive transformer [48] based architecture. On a technical level, our model defines three separate multi-layer multi-output synchronized decoders, wherein each decoder layer is tasked with modeling either the subject, object, or predicate components of a relationship triplets. Therefore, the combined outputs from each layer of the three decoders generates a scene graph estimate. The inputs to each decoder layer are conditioned to enable joint reasoning across decoders and effective refinement of previous layer estimates. This conditioning is achieved implicitly via a novel joint loss, and explicitly via cross-decoder and layer-wise attention. Additionally, each decoder layer is also conditioned on the image features, which are provided by a shared encoder. As our proposed model is end-to-end trainable, it addresses the limitation of two-stage approaches, allowing image features to directly adopt to the scene graph generation task. Finally, to tackle the long-tail nature of the scene graph predicate classes [11], we employ a loss weighting strategy to enable flexible trade-off between dominant (head) and underrepresented (tail) predicate classes in the long-tail distribution. In contrast to data sampling strategies [11, 32], this has a benefit of not requiring additional fine-tuning of models with sampled data post training. We illustrate that our proposed architecture achieves state-of-the-art performance on two benchmark datasets – Visual Genome [30] and Action Genome [25]; and thoroughly analyze effectiveness of the approach as a function of the refinement steps, design choices employed and as a generic add-on to an existing, MOTIF [55], architecture. + +# 2 Related Work + +Scene Graph Generation. Scene graph generation has emerged as a popular research area in the vision community [11, 28, 31, 35, 39, 40, 46, 47, 50, 52, 54, 55]. Existing scene graph generation methods can be broadly categorized as either one-stage or two-stage approaches. The first step of the predominant approach – the two-stage methods – involves pre-training a strong object detector + +for all object classes in the dataset, usually using detector like Faster-RCNN [41]. The graph generation network is then built on top of the object information (bounding boxes and corresponding features) obtained from the detector. This second step entails freezing the detector parameters and solely training the graph generation network. The graph generation network is realized via different architectures such as Bi-directional LSTMs [55], Tree-LSTMs [47], Graph Neural Networks [52], and other message passing algorithms [40, 50]. The limitation of all two-stage approaches is apparent – the graph generation network has no influence over the detector and object features. One stage approaches overcome this obstacle by employing architectures that allow end-to-end training, such as fully convolutional networks [35] and transformer based models [7, 14, 31, 43]. The joint optimization enables interaction between the detection and the graph generation modules, leading to better scene graphs. However, all the aforementioned methods operate under the assumption of a fixed factorized model, inducing conditional independencies that might not be ideal under all scenarios. + +Long-Tail Recognition. The task of scene graph generation suffers from the challenge of long-tail recognition due to the combinatorial nature of relational triplets (both object and predicate distributions are skewed). Long-tail recognition, in general, is a well studied problem in literature. Data sampling is a popular strategy [3, 20, 21, 27, 37, 42, 58] wherein the training data is modified to either over-represent tail classes (oversampling) or under-represent the head classes (undersampling). Specific to the task of scene graph generation, [11, 32] have explored the use of data sampling strategies to improve performance on tail predicate classes. On the contrary, Loss re-weighting strategies [1, 9, 13, 27, 34] assign higher weights or impose larger decision boundaries for tail classes. [51] recently adopted this paradigm for the task of scene graph generation by proposing a re-weighting strategy based on correlations between predicate classes. Conceptually similar to [51], we propose a novel re-weighting strategy and illustrate its effectiveness both on its own, and in combination with data resampling. + +Transformer Models. In [48], authors introduced a new attention-based architecture called transformers for the task of machine translation, doing away with recurrent or convolutional architectures. Transformers have since widely been adopted for a variety of tasks, such as object detection [2, 38, 57], image captioning [8, 23], and image generation [12]. More recently, scene graph generation methods have also adopted transformer architectures [7, 14, 31, 43], owing to their end-to-end trainable nature and parallelism. Perhaps conceptually closest, [14], which focuses on visual relation detection (VRD) and not scene graph prediction, leverages the composite nature of relationships to simultaneously decode an entire relationship triplet alongside its constituent subject, object, and predicate components. Unlike [14], we do not explicitly model subject-predicate-object "sum" composites, resulting in a simpler architecture, and leverage iterative refinement procedure that relies on a different factorized attention mechanism. In the latest, concurrent work, [31] generates a set of entities and predicates separately, and then utilizes a graph assembly procedure to match the predicates to a pair of entities. In contrast to our formulation, this precludes conditioning of entities on predicate estimates; therefore relying on accuracy of less contextualized predictions for subsequent pairing. + +# 3 Formulation + +For a given image $\mathbf{I}$ , a scene graph $\mathbf{G}$ can be represented as a set of triplets $\mathbf{G} = \{\mathbf{r}_i\}_{i \leqslant n} = \{(\mathbf{s}_i, \mathbf{p}_i, \mathbf{o}_i)\}_{i \leqslant n}$ , where $\mathbf{r}_i$ denotes the $i$ -th triplet $(\mathbf{s}_i, \mathbf{p}_i, \mathbf{o}_i)$ , and $n$ denotes the total number of triplets. The subject $\mathbf{s}_i$ denotes a tuple $(\mathbf{s}_{i,c}, \mathbf{s}_{i,b})$ , where $\mathbf{s}_{i,c} \in \mathbb{R}^{\eta}$ is the one-hot class label, and $\mathbf{s}_{i,b} \in \mathbb{R}^4$ is the corresponding bounding box coordinates. $\eta$ is the total number of possible entity classes in the dataset. The object $\mathbf{o}_i$ and predicate $\mathbf{p}_i$ can similarly be represented as tuples $(\mathbf{o}_{i,c}, \mathbf{o}_{i,b})$ and $(\mathbf{p}_{i,c}, \mathbf{p}_{i,b})$ respectively. Note that, $\mathbf{p}_{i,b}$ corresponds to the box formed by the centers' of $\mathbf{s}_{i,b}$ and $\mathbf{o}_{i,b}$ as the diagonally opposite coordinates. Additionally, $\mathbf{p}_{i,c} \in \mathbb{R}^v$ represents the corresponding one-hot predicate label between the pair $(\mathbf{s}_i, \mathbf{o}_i)$ , where $v$ is the total number of possible predicate classes in the dataset. Then the task of scene graph generation can be thought of as modelling the conditional distribution $\operatorname*{Pr}(\mathbf{G} \mid \mathbf{I})$ . This distribution can be expressed as a product of conditionals, + +$$ +\Pr (\mathbf {G} \mid \mathbf {I}) = \Pr \left(\left\{\mathbf {s} _ {i} \right\} \mid \mathbf {I}\right) \cdot \Pr \left(\left\{\mathbf {o} _ {i} \right\} \mid \left\{\mathbf {s} _ {i} \right\}, \mathbf {I}\right) \cdot \Pr \left(\left\{\mathbf {p} _ {i} \right\} \mid \left\{\mathbf {s} _ {i} \right\}, \left\{\mathbf {o} _ {i} \right\}, \mathbf {I}\right) \tag {1} +$$ + +where $\{.\}$ denotes a set. For brevity, we omit explicitly mentioning the total number of set elements $n$ throughout the paper. Existing approaches model this product of conditionals by making some underlying assumptions. For example, [11, 47, 55] assume conditional independence between $\mathbf{s}_i$ and $\mathbf{o}_i$ as they rely on heuristics to obtain the entity pairs. However, modelling the conditional in Equation + +![](images/26e43b9458fde5a3a7445e82ca4198bdac09ef935a488c19ceddb8fb662c023d.jpg) +Figure 2: Transformer Architecture for Iterative Refinement. For a given image, the model extracts features via a convolutional backbone and a transformer encoder. The individual components of a relationship triplet are generated using separate subject, object, and predicate multi-layer decoders. The inputs to each layer of the decoder is appropriately conditioned. For example, for the predicate decoder, the positional embeddings are conditioned on the outputs generated by the subject and object decoders (blue Attn module) and the queries are conditioned on the previously generated graph estimate (orange Attn module). The model is additionally implicitly conditioned and trained in an end-to-end fashion using a joint matching loss. + +1 (or any other equivalent factorization) in such a "one-shot" manner makes certain assumptions on the flow of information, which, in this case, is from $\mathbf{s}_i \to \mathbf{o}_i \to \mathbf{p}_i$ . Therefore, any errors made during the estimation of $\mathbf{s}_i$ are naturally propagated towards the estimation of $\mathbf{o}_i$ and $\mathbf{p}_i$ . Additionally, the subject (or object) estimation procedure $\operatorname{Pr}(\{\mathbf{s}_i\} \mid \mathbf{I})$ is completely oblivious to the estimated predicate $\mathbf{p}_i$ . Having access to such information can help the subject (or object) predictor update its beliefs and significantly narrow down the space of feasible entity pairs. + +Contrary to existing works, our proposed formulation moves away from the "one-shot" generation ideology described in Equation 1. We instead argue for modelling the task of scene graph generation as an iterative refinement procedure, wherein the scene graph estimate at step $t$ , $\mathbf{G}^t$ , is dependent on the previous estimates $\{\mathbf{G}^{t'}\}_{t' < t}$ . Formally, our aim is to model the conditional distribution $\operatorname*{Pr}\left(\mathbf{G}^t\mid \{\mathbf{G}^{t'}\}_{t' < t},\mathbf{I}\right)$ . Assuming Markov property holds, this can be conveniently factorized as, + +$$ +\begin{array}{l} \Pr \left(\mathbf {G} ^ {t} \mid \mathbf {G} ^ {t - 1}, \mathbf {I}\right) = \overbrace {\operatorname* {P r} \left(\left\{\mathbf {s} _ {i} ^ {t} \right\} \mid \mathbf {G} ^ {t - 1} , \mathbf {I}\right)} ^ {\text {S u b j e c t P r e d i c t o r}} \cdot \overbrace {\operatorname* {P r} \left(\left\{\mathbf {o} _ {i} ^ {t} \right\} \mid \left\{\mathbf {s} _ {i} ^ {t} \right\} , \mathbf {G} ^ {t - 1} , \mathbf {I}\right)} ^ {\text {O b j e c t P r e d i c t o r}} \tag {2} \\ \underbrace {\Pr \left(\left\{\mathbf {p} _ {i} ^ {t} \right\} \mid \left\{\mathbf {s} _ {i} ^ {t} \right\} , \left\{\mathbf {o} _ {i} ^ {t} \right\} , \mathbf {C} \right.} _ {\text {P r e d i c a t e P r e d i c t o r}} \\ \end{array} +$$ + +Note that even though we assume the flow of information to be from $\mathbf{s}_i^t\to \mathbf{o}_i^t\to \mathbf{p}_i^t$ for $\mathbf{G}^t$ , conditioning on the previous graph estimate $\mathbf{G}^{t - 1}$ allows the subject, object, and predicate predictors to jointly reason and update their beliefs, leading to better predictions. Additionally, the framework described in Equation 2 is model agnostic and can be implemented using any of the existing architectures. + +# 4 Transformer Based Iterative Generation + +As described in Section 3, our proposed iterative scene graph generation formulation is agnostic to the architectural choices used to realise the subject, object, and predicate predictors. In this section we provide a realization of the proposed formulation in Equation 2 using Transformer networks [48]. The choice of using transformer networks is motivated by their natural tendency to model iterative refinement behaviour under the Markov property, wherein each layer of the transformer decoder takes as input the output of the previous layer. Our novel end-to-end trainable transformer based iterative generation architecture builds on top of the DETR [2] framework, which is shown to be effective for the task of object detection. Our proposed model architecture is shown in Figure 2. + +Given an image, our proposed approach first obtains corresponding image features using a combination of a convolutional backbone and a multi-layer transformer encoder, akin to DETR [2]. These image features are used as inputs to the subject, object, and predicate predictors, each implemented as + +a multi-layer Transformer decoder. To generate a scene graph estimate $\widehat{\mathbf{G}}^t$ at step $t$ in accordance with Equation 2, the queries used in each predictor decoder are appropriately conditioned. For example, in the case of the predicate decoder, its input queries are conditioned on the subject $(\{\widehat{\mathbf{s}}_i^t\})$ and object $(\{\widehat{\mathbf{o}}_i^t\})$ estimates at step $t$ . Additionally, the input to each predictor decoder is infused with all decoder estimates $\{(\widehat{\mathbf{s}}_i^{t-1}, \widehat{\mathbf{p}}_i^{t-1}, \widehat{\mathbf{o}}_i^{t-1})\}$ from the previous step $t-1$ via a structured attentional mechanism. The entire model is trained end-to-end, with a novel joint loss applied at each step $t$ to ensure the generation of a valid scene graph at every level. This section describes these components in detail. + +# 4.1 Image Encoder + +Similar to DETR [2], for each image $\mathbf{I}$ , our proposed architecture uses a deep convolutional network (like ResNet [22]) to obtain image level spatial map $\bar{\mathbf{I}} \in \mathbb{R}^{c \times w \times h}$ , where $c$ is the number of channels, and $w, h$ correspond to the spatial dimensions. A multi-layer encoder $f_{e}$ then transforms $\bar{\mathbf{I}}$ into a position-aware flattened image feature representation $\mathbf{Z} \in \mathbb{R}^{d \times wh}$ , where $d < c$ . + +# 4.2 Predictor Decoders + +Our approach models each of the subject, object, and predicate predictors using a multi-layer transformer decoder [2], which are denoted by $f_{\mathbf{s}}$ , $f_{\mathbf{o}}$ , and $f_{\mathbf{p}}$ respectively. The $t$ -th layer of each decoder, denoted as $f_{\mathbf{x},t}^{t}; \mathbf{x} \in \{\mathbf{s}, \mathbf{o}, \mathbf{p}\}$ , is tasked with generating the step $t$ scene graph $\mathbf{G}^t$ . Therefore, at each step $t$ , the decoders output a set of $n$ feature representations $\{\mathbf{q}_{\mathbf{x},i}^t\}; \mathbf{x} \in \{\mathbf{s}, \mathbf{o}, \mathbf{p}\}$ , which are transformed into a set of triplet estimates $\{(\hat{\mathbf{s}}_i^t, \hat{\mathbf{p}}_i^t, \hat{\mathbf{o}}_i^t)\}$ via fully-connected feed forward layers. + +Specifically, for a decoder $f_{\mathbf{x}}$ ; $\mathbf{x} \in \{\mathbf{s}, \mathbf{o}, \mathbf{p}\}$ , an arbitrary layer $t$ takes as input a set of queries $\{\mathbf{q}_{\mathbf{x},i}^{t-1}\}$ and a set of learnable positional encodings $\{\mathbf{p}_{\mathbf{x},i}\}$ , where $\mathbf{q}_{\mathbf{x},i}^{t-1}$ ; $\mathbf{p}_{\mathbf{x},i} \in \mathbb{R}^d$ . The output representations $\{\mathbf{q}_{\mathbf{x},i}^t\}$ are then obtained via a combination of self-attention between the input queries, and encoder-decoder attention across the encoder output $\mathbf{Z}$ . These attention modules allow the decoder to jointly reason across all queries, while simultaneously incorporating context from the input image. + +At a given step $t$ , naively using the inputs $\{\mathbf{q}_{\mathbf{x},i}^{t-1}\}$ and $\{\mathbf{p}_{\mathbf{x},i}\}$ to generate $\mathbf{G}^t$ forgoes leveraging the compositional property of relations. As described Equation 2, for any arbitrary step $t$ , our proposed formulation entails two types of conditioning for better scene graph estimation. The first involves conditioning decoders on the step $t$ outputs, specifically the object decoder $f_{\mathrm{o}}^t$ on the subject decoder $f_{\mathrm{s}}^t$ , and the predicate decoder $f_{\mathrm{p}}^t$ on both $f_{\mathrm{s}}^t$ and $f_{\mathrm{o}}^t$ . The second requires all three decoder layers at step $t$ to be conditioned on the outputs generated at step $t-1$ . To effectively implement this design, we modify the inputs to each decoder layer $f_{\mathrm{x}}^t$ . Specifically, the positional encodings $\{\mathbf{p}_{\mathbf{x},i}\}$ are modified to condition them on step $t$ outputs, and the queries $\mathbf{q}_{\mathbf{x},i}^{t-1}$ are updated to incorporate information from the previous step $t-1$ . Modifying the positional encoding and queries separately allows the model to easily disentangle and differentiate between the two conditioning types. + +Conditional Positional Encodings. At a particular step $t$ , the conditional positional encodings for the three decoders are obtained as, + +$$ +\begin{array}{l} \left\{\hat {\mathbf {p}} _ {\mathbf {s}, i} ^ {t} \right\} = \left\{\mathbf {p} _ {\mathbf {s}, i} \right\}; \quad \left\{\hat {\mathbf {p}} _ {\mathbf {o}, i} ^ {t} \right\} = \left\{\mathbf {p} _ {\mathbf {o}, i} \right\} + F F N \left(M u l t i H e a d \left(\left\{\mathbf {p} _ {\mathbf {o}, i} \right\}, \left\{\tilde {\mathbf {q}} _ {\mathbf {s}, i} ^ {t} \right\}, \left\{\mathbf {q} _ {\mathbf {s}, i} ^ {t} \right\}\right)\right) \\ \left\{\hat {\mathbf {p}} _ {\mathbf {p}, i} ^ {t} \right\} = \left\{\mathbf {p} _ {\mathbf {p}, i} \right\} + \text {F F N} \left(\text {M u l t i H e a d} \left(\left\{\mathbf {p} _ {\mathbf {p}, i} \right\}, \left\{\tilde {\mathbf {q}} _ {\mathbf {s}, i} ^ {t} \oplus \tilde {\mathbf {q}} _ {\mathbf {o}, i} ^ {t} \right\}, \left\{\mathbf {q} _ {\mathbf {s}, i} ^ {t} \oplus \mathbf {q} _ {\mathbf {o}, i} ^ {t} \right\}\right)\right) \tag {3} \\ \end{array} +$$ + +where MultiHead(Q, K, V) is the Multi-Head Attention module introduced in [48], $\mathsf{FFN}(.)$ is a fully-connected feed forward network, and $\oplus$ is the concatenation operation. Additionally, $\tilde{\mathbf{q}}_{\mathbf{x},i}^{t} = \mathbf{q}_{\mathbf{x},i}^{t} + \mathbf{p}_{\mathbf{x},i}^{t}; \mathbf{x} \in \{\mathbf{s}, \mathbf{o}, \mathbf{p}\}$ is the position-aware query. + +Conditional Queries. Similarly, for a step $t$ , conditional queries for the subject decoder are defined, + +$$ +\{\hat {\mathbf {q}} _ {\mathbf {s}, i} ^ {t - 1} \} = \left\{\mathbf {q} _ {\mathbf {s}, i} ^ {t - 1} \right\} + \text {F F N} \left(\text {M u l t i H e a d} \left(\{\tilde {\mathbf {q}} _ {\mathbf {s}, i} ^ {t - 1} \}, \{\tilde {\mathbf {q}} _ {\mathbf {s}, i} ^ {t - 1} \oplus \tilde {\mathbf {q}} _ {\mathbf {o}, i} ^ {t - 1} \oplus \tilde {\mathbf {q}} _ {\mathbf {p}, i} ^ {t - 1} \}, \left\{\mathbf {q} _ {\mathbf {s}, i} ^ {t - 1} \oplus \mathbf {q} _ {\mathbf {o}, i} ^ {t - 1} \oplus \mathbf {q} _ {\mathbf {p}, i} ^ {t - 1} \right\}\right)\right) \tag {4} +$$ + +$\widehat{\mathbf{q}}_{\mathbf{o},i}^{t - 1}$ and $\widehat{\mathbf{q}}_{\mathbf{p},i}^{t - 1}$ are defined identically. For a decoder layer $f_{\mathbf{x}}^t;\mathbf{x}\in \{\mathbf{s},\mathbf{o},\mathbf{p}\}$ we use the conditioned positional encodings $\{\widehat{\mathbf{p}}_{\mathbf{x},i}^{t}\}$ and queries $\{\widehat{\mathbf{q}}_{\mathbf{x},i}^{t - 1}\}$ as input. + +# 4.3 End-To-End Learning + +Our proposed transformer based refinement architecture can be trained in an end-to-end fashion. To ensure that a valid scene graph is generated at every level, we propose a novel joint loss that is applied at each step $t$ . Therefore, the combined loss $\mathcal{L}$ can be expressed as $\mathcal{L} = \sum_{t}\mathcal{L}^{t} = \sum_{t}\mathcal{L}_{\mathrm{s}}^{t} + \mathcal{L}_{\mathrm{o}}^{t} + \mathcal{L}_{\mathrm{p}}^{t}$ , + +where $\mathcal{L}_{\mathbf{x}}^{t}; \mathbf{x} \in \{\mathbf{s}, \mathbf{o}, \mathbf{p}\}$ represents the loss applied to the $t$ -th layer of the decoder $f_{\mathbf{x}}$ . Our approach generates a fixed-size set of $n$ triplet estimates $\{\hat{\mathbf{r}}_i^t\} = \{(\hat{\mathbf{s}}_i^t, \hat{\mathbf{p}}_i^t, \hat{\mathbf{o}}_i^t)\}$ at each step $t$ , where $n$ is larger than the number of ground truth relations for a given image. Therefore, in order to effectively optimize the proposed model, we obtain an optimal bipartite matching between the predicted and ground truth triplets. Note that, contrary to the matching algorithm in [2], our proposed matching is defined over triplets rather than individual entities. Additionally, instead of independently computing the loss over each decoder layer as in [2], our loss computes a joint matching across all refinement layers. + +Let $\mathbf{G} = \{\mathbf{r}_i\} = \{(\mathbf{s}_i, \mathbf{p}_i, \mathbf{o}_i)\}$ denote the ground truth scene graph for an image $\mathbf{I}$ . Note that, as the number of ground truth relations is less than $n$ , we convert $\mathbf{G}$ to a $n$ -sized set by padding it with $\varnothing$ (no relation). The goal then is to find a bipartite matching between the ground truth graph $\mathbf{G}$ and the set of all graph estimates $\{\hat{\mathbf{G}}^t\}$ that minimizes the joint matching cost. Specifically, assuming $\sigma$ to be a valid permutation of $n$ elements, + +$$ +\hat {\sigma} = \arg \min _ {\sigma} \sum_ {t} \sum_ {i} ^ {n} \mathcal {L} _ {\text {r e l}} \left(\mathbf {r} _ {i}, \hat {\mathbf {r}} _ {\sigma (i)} ^ {t}\right) \tag {5} +$$ + +where the pair-wise relation matching cost $\mathcal{L}_{\mathrm{rel}}$ is defined as, + +$$ +\mathcal {L} _ {\text {r e l}} \left(\mathbf {r} _ {i}, \hat {\mathbf {r}} _ {\sigma (i)} ^ {t}\right) = - \mathbb {1} _ {\{\mathbf {r} _ {i} \neq \emptyset \}} \left[ \begin{array}{l} \hat {\mathbf {s}} _ {\sigma (i), c} ^ {t} \cdot \mathbf {s} _ {i, c} - \mathcal {L} _ {\text {b o x}} \left(\hat {\mathbf {s}} _ {\sigma (i), b} ^ {t}, \mathbf {s} _ {i, b}\right) \\ + \hat {\mathbf {o}} _ {\sigma (i), c} ^ {t} \cdot \mathbf {o} _ {i, c} - \mathcal {L} _ {\text {b o x}} \left(\hat {\mathbf {o}} _ {\sigma (i), b} ^ {t}, \mathbf {o} _ {i, b}\right) \\ + \hat {\mathbf {p}} _ {\sigma (i), c} ^ {t} \cdot \mathbf {p} _ {i, c} - \mathcal {L} _ {\text {b o x}} \left(\hat {\mathbf {p}} _ {\sigma (i), b} ^ {t}, \mathbf {p} _ {i, b}\right) \end{array} \right] \tag {6} +$$ + +where $\cdot$ is the vector dot product, and $\mathcal{L}_{\mathrm{box}}$ is a combination of the L-1 and generalized IoU losses. Please refer to Section 3 for clarification on the notations. The optimal permutation $\hat{\sigma}$ can then be computed using the Hungarian algorithm. The loss $\mathcal{L}_{\mathrm{s}}^{t}$ is then defined as, + +$$ +\mathcal {L} _ {\mathbf {s}} ^ {t} = \sum_ {i = 1} ^ {n} \left[ - \log \left(\widehat {\mathbf {s}} _ {\hat {\sigma} (i), c} ^ {t} \cdot \mathbf {s} _ {i, c}\right) + \mathbb {1} _ {\{\mathbf {r} _ {i} \neq \emptyset \}} \mathcal {L} _ {\text {b o x}} \left(\widehat {\mathbf {s}} _ {\hat {\sigma} (i), b} ^ {t}, \mathbf {s} _ {i, b}\right) \right] \tag {7} +$$ + +$\mathcal{L}_{\mathbf{o}}^{t}$ and $\mathcal{L}_{\mathbf{p}}^{t}$ are defined identically. Note that as we use the same permutation $\hat{\sigma}$ for all refinement layers $t$ , it induces strong implicit dependencies between the subject, object, and predicate decoders. The potency of the aforementioned implicit conditioning is highlighted in the experiment section. + +# 4.4 Loss Re-Weighting + +Due to the inherent long-tail nature of the scene graph generation task, using an unbiased loss often leads to the model prioritizing the most common (a.k.a., head) predicate classes like has and on, which have abundant training examples. To afford our proposed model the flexibility to achieve the trade-off between head/tail classes, we integrate a loss-reweighing scheme into the model training procedure. Note that, contrary to existing methods that do this post-hoc via finetuning the final layer of the trained network (see Section 2), we instead train the model with this weighting to allow the internal feature representations to reflect the desired trade-off. Note, to the best of our knowledge, our paper is the first to illustrate effectiveness of such a strategy for the task of scene graph generation. For a particular predicate class $c \in [1, v]$ , we define the class weight $w_{c}$ as $\max \left\{ \left( \frac{\alpha}{f_{c}} \right)^{\beta}, 1.0 \right\}$ , where $f_{c}$ is the frequency of the predicate class $c$ in the training set, and $\{\alpha, \beta\}$ are scaling parameters. Note that this weighting scheme is similar to the data sampling strategy described in [19, 32]. However, instead of modifying the training set, we scale each class weight by the factor $w_{c}$ when computing the predicate classification loss $\mathcal{L}_{\mathbf{p}}^{t}$ . Therefore, $\mathcal{L}_{\mathbf{p}}^{t}$ can be defined similarly to Equation 7, + +$$ +\mathcal {L} _ {\mathbf {p}} ^ {t} = \sum_ {i = 1} ^ {n} \left[ - w _ {c} \log \left(\widehat {\mathbf {p}} _ {\hat {\sigma} (i), c} ^ {t} \cdot \mathbf {p} _ {i, c}\right) + \mathbb {1} _ {\{\mathbf {r} _ {i} \neq \emptyset \}} \mathcal {L} _ {\text {b o x}} \left(\widehat {\mathbf {p}} _ {\hat {\sigma} (i), b} ^ {t}, \mathbf {p} _ {i, b}\right) \right]. \tag {8} +$$ + +# 5 Experiments + +We demonstrate the effectiveness of our proposed approach on two datasets, + +Visual Genome [30]. This is a benchmark for scene graph generation. We use the common processed subset from [50], which contains $108k$ images, with 150 object and 50 predicate categories. + +Action Genome [25]. This dataset provides scene graph annotations over videos in the Charades dataset [44] for the task of human-object interaction. It contains 9,848 videos across 35 object + +Table 1: Scene Graph Generation on Visual Genome. Mean Recall (mR@K), Recall (R@K), and Harmonic Recall (hR@K) shown for baselines and our approach. B=Backbone, D=Detector. Baseline results are borrowed from [31]. $M$ indicates the number of top-k links used by the baseline [31]. Note that our approach implicitly assumes $M = 1$ . For the approaches that use the ResNet-101 backbone [22] (akin to our method), the best result is highlighted in red, second best in blue. + +
BD#MethodmR@50/100R@50/100hR@50/100HeadBodyTail
X101-FPNFaster RCNN①RelDN [56]6.0 / 7.331.4 / 35.910.1 / 12.1---
②MOTIF [55]5.5 / 6.832.1 / 36.99.4 / 11.5---
③VCTree [47]6.6 / 7.731.8 / 36.110.9 / 12.7---
④BGNN [32]10.7 / 12.631.0 / 35.815.9 / 18.634.012.96.0
⑤VCTree-TDE [46]9.3 / 11.119.4 / 23.212.6 / 15.0---
⑥VCTree-DLFE [6]11.8 / 13.822.7 / 26.315.5 / 18.1---
⑦VCTree-EBM [45]9.7 / 11.620.5 / 24.713.2 / 15.8---
⑧VCTree-BPLSA [18]13.5 / 15.721.7 / 25.516.6 / 19.4---
⑨DT2-ACBS [11]22.0 / 24.415.0 / 16.317.8 / 19.5---
ResNet-101DETR⑩BGNN [32, 31]8.6 / 10.328.2 / 33.813.2 / 15.829.112.62.2
⑪RelDN [56, 31]4.4 / 5.430.3 / 34.87.7 / 9.331.32.30.0
⑫AS-Net [4]6.1 / 7.218.7 / 21.19.2 / 10.719.67.72.7
⑬HOTR [29]9.4 / 12.023.5 / 27.713.4 / 16.726.116.23.4
Concurrent Work
⑭SGTRM=1 [31]12.0 / 14.625.1 / 26.616.2 / 18.827.117.26.9
⑮SGTRM=3 [31]12.0 / 15.224.6 / 28.416.1 / 19.828.218.67.1
⑯SGTRM=3,BGNN [32] [31]15.8 / 20.120.6 / 25.017.9 / 22.321.721.617.1
⑰Ours(α=0.0,β=*)8.0 / 8.829.7 / 32.112.6 / 13.831.79.01.4
⑱Ours(α=0.14,β=0.5)14.4 / 16.427.9 / 30.419.0 / 21.330.017.311.2
⑲Ours(α=0.07,β=0.75)15.7 / 17.827.2 / 29.819.9 / 22.328.518.813.3
⑳Ours(α=0.14,β=0.75)15.8 / 18.226.1 / 28.719.7 / 22.328.219.413.8
⑴Ours(α=0.14,β=0.75),BGNN [32]17.1 / 19.222.9 / 25.719.6 / 22.024.420.216.4
⑵Ours(α=0.14,β=0.75),M=319.5 / 23.430.8 / 35.623.9 / 28.232.928.115.8
+ +(excluding class person) and 25 relation categories. As not all video frames are annotated, consistent with prior work [16], we use the annotated frames provided by [25]. Additionally, as in [16], we remove frames without any person or object annotations as they do not provide usable scene graphs. + +Implementation Details (transformer-based approach). We use ResNet-101 [22] as the backbone network for image feature extraction. Each of the subject, object, and predicate decoders have 6 layers, with a feature size of 256. The decoders use 300 queries. For training we use a batch size of 12 and initial learning rate of $10^{-4}$ , which is gradually decayed. Note that although our model predicts individual relation triplets, a graph is obtained by applying a non-maximum suppression (NMS) strategy [15, 41] to group the predicted subjects and objects into entity instances. + +Implementation Details (MOTIF). For the re-implementation of the MOTIF [55] baseline and the subsequent augmentation of our proposed framework, we follow the same training procedure as [55]. Specifically, we assume the Faster-RCNN detector [41] with the ResNeXt-101-FPN [49] backbone. The detector is first pre-trained on the Visual Genome dataset [30]. As is the case with two-stage approaches, when learning the scene graph generator, the detector parameters are freezed. The specifics on how our approach is augmented to MOTIF is described in the supplementary (Sec. A). + +Evaluation Metrics. To measure performance, we report results using standard scene graph evaluation metrics, namely Recall (R@K) [50] and Mean Recall (mR@K) [5, 47]. While recall is class agnostic, mean recall averages the recalls computed for each predicate category independently. Usually, higher R@K is indicative of better performance on dominant (head) classes, where as higher mR@K suggests better tail class performance. Recent methods [11, 32] have argued for the use of mean recall as it reduces influence of dominant relationships such as on and has on the metric. However, even for the same model architecture, one can trade-off R@K for mR@K by using long tail recognition techniques described in Section 2. This trade-off is seldom analyzed or reported, making it difficult to compare performance across methods. Therefore, inspired by the generalized zero-shot + +Table 2: Ablation of Model Components. Mean Recall (mR@K) and Recall (R@K) reported on the Visual Genome dataset. CAS=Conditioning Across Steps (Eq. 4), CWS=Conditioning Within a Step (Eq. 3), JL=Joint Loss (Sec. 4.3). + +
#CASCWSJLmR@20/50R@20/50
1✓✓✓11.8 / 15.821.0 / 26.1
21.7 / 1.92.7 / 4.3
3✓11.2 / 14.720.1 / 25.4
4✓✓11.5 / 15.320.9 / 26.1
5✓✓11.7 / 15.420.9 / 25.9
+ +Table 4: Ablation of Loss Re-weighting Parameters. We vary $\alpha, \beta$ (Sec. 4.4) and report recall, mean recall, and harmonic recall on the Visual Genome test set. + +
αβmR@20/50R@20/50hR@20/50
0.0*5.8 / 8.024.2 / 29.79.4 / 12.6
0.070.7511.2 / 15.721.8 / 27.214.8 / 19.9
0.140.7511.8 / 15.821.0 / 26.115.1 / 19.7
0.210.7511.3 / 15.520.0 / 24.814.4 / 19.1
0.140.510.3 / 14.422.6 / 27.914.2 / 19.0
0.140.62511.0 / 15.121.4 / 26.414.5 / 19.2
0.140.7511.8 / 15.821.0 / 26.115.1 / 19.7
0.140.87511.2 / 15.919.3 / 24.514.2 / 19.3
+ +Table 3: Augmentation to MOTIF. Mean Recall (mR@K) and Recall (R@K) is reported on the Visual Genome dataset for the baseline and the variant with our iterative formulation. $\dagger$ denotes our reimplementation of the method. + +
ModeltmR@20/50R@20/50
MOTIF† [55]6.0 / 8.023.6 / 30.4
MOTIF†16.0 / 8.123.7 / 30.6
+26.2 / 8.423.9 / 30.7
Ours36.4 / 8.524.0 / 30.8
+ +Table 5: Ablation of Model Parameters. $\boxed{1} =$ Our proposed transformer approach with 6 decoder layers. $\boxed{2} =$ transformer with 6 decoder layers devoid of our proposed refinement. $\boxed{3} =$ transformer with 1 decoder layer devoid of our proposed refinement. + +
#mR@20/50R@20/50Model Size
111.8 / 15.821.0 / 26.11×
21.7 / 1.92.7 / 4.30.9×
39.9 / 13.117.5 / 21.81.1×
+ +learning harmonic average metric [10], we propose a new metric - harmonic recall (hR@K), defined as the harmonic mean of mR@K and R@K. Such a metric encourages methods to have a healthy balance between the head and tail class performance. Additionally, we report the performance of our model for different values of the loss weighing parameters described in Section 4.4. Furthermore, we also report the mR@100 on each long-tail category subset, namely head, body, and tail, as in [32]. + +# 5.1 Ablation Study + +All the subsequent ablation studies are done on the Visual Genome dataset [30]. + +Model Components. We analyze the importance of each of our model components, namely the conditioning within a particular step $t$ (CWS; Equation 3), the conditioning across steps (CAS; Equation 4), and the joint loss (JL; Section 4.3) in Table 2. For a fair comparison, all models are trained using the same loss weighing parameters, $\alpha = 0.14$ , $\beta = 0.75$ . It can be seen that our proposed novel joint loss provides a significant improvement in performance $(\langle \rangle)$ when compared to the ablated model that uses separate losses (as in [2]; $\langle \rangle$ ). This is largely due to the joint loss being able to induce strong implicit dependencies between the three decoders. As a consequence, even without CAS and CWS, the proposed joint loss by itself enables refinement. The two forms of conditioning $(\langle \rangle - \langle \rangle)$ provide a structured pathway to incorporating knowledge from previously generated estimates or other triplet components in an explicit fashion, leading to improved scene graphs. CAS $(\langle \rangle)$ builds upon the joint loss, integrating information that the aforementioned implicit conditioning is unable to capture. CWS $(\langle \rangle)$ is complementary to the refinement process, and allows for more consistent graph generation within a step. As these two types of conditionings capture complementary information, using them together $(\langle \rangle)$ further improves on performance. + +Refinement Across Steps. To further analyze the effectiveness of our refinement procedure, we contrast the quality of scene graphs generated at each refinement step for a particular trained model $(\alpha = 0.14, \beta = 0.75)$ . We provide a detailed analysis in the supplementary (Table A1). Visually, Figure 3 highlights steady improvements in the graph quality over refinement steps. Owing to our structured conditioning, the model is able to improve on both predicate detection and entity localization over refinement iterations. + +![](images/724fe4a20c0b7e8a8da0fcb37f9fdd8af86f8f62edb343541364366983421566.jpg) +Figure 3: Qualitative Refinement Analysis. Graph estimates for different refinement steps shown. Colours red and green indicate incorrect and correct predictions respectively. Additional visualizations are shown in the supplementary (Section C.3). + +![](images/6d20a85661cbb7200f9442aee67cd894231809ceba3dd1a6167666d4f95c3331.jpg) + +![](images/0e6c714aee58188e7890f7fe4607d5564be0515bb3bd3dee208766f52b985c89.jpg) + +![](images/f3a6a4898ac96633ba506a11451f871a4cf423659850df96640ae753ff1e55c4.jpg) + +![](images/98dd84805b026420b92808432e3b64c1a54e8201229090700f9c9881dcb41253.jpg) + +Loss Re-Weighting. As mentioned in Section 4.4, we employ a simple loss re-weighting scheme, allowing for an easy trade-off between recall for mean recall. Some results with different weightings are reported in Table 1 $(17) - (20)$ . To investigate this further, we train our proposed model with different values for the parameters $\alpha$ and $\beta$ , and report the performance in Table 4. We fix $\beta$ in the top half of the table (first 4 rows), and $\alpha$ in the bottom half (last 4 rows). It can be seen that increasing $\alpha$ and $\beta$ generally biases the model more towards the tail classes (higher mean recall), whereas lower values tend to favour the head classes (higher recall). As a consequence, our proposed approach is flexibly able to function in a wide range of recall and mean recall values. However, as is the case with every long-tail recognition approach, choosing values that are too high ( $e.g.$ $\alpha = 0.21$ , $\beta = 0.75$ ) lead to poor performance due to the model being extremely biased and therefore unable to learn accurate feature representations on the popular classes. + +Model Parameters. We additionally argue that the improvements obtained by our proposed refinement procedure are not a direct consequence of having an increased number of parameters. To corroborate this, we contrast our proposed model with alternatives with similar number of parameters but devoid of refinement in Table 5. $\boxed{1}$ corresponds to our transformer-based approach with 6 decoder layers that uses the proposed joint loss and both forms of conditioning. $\boxed{2}$ is a similar model with 6 decoder layers but bereft of the aforementioned proposed implicit and explicit conditionings. $\boxed{3}$ , on the other hand, is a single decoder layer transformer model without refinement, wherein the number of parameters are increased to be comparable to our proposed approach. The inferior performance of $\boxed{2}$ and $\boxed{3}$ highlight that increasing model capacity either via making each layer larger or via adding more layers (increasing model depth) does not emulate refinement. Our proposed refinement procedure, realized by the joint loss and explicit conditionings, allows for better learning, and the performance gains observed cannot be attributed to having additional parameters. + +# 5.2 Comparison to Existing Methods + +Visual Genome. We report the mean recall, recall, and harmonic recall values contrasting our proposed model with existing scene graph methods, including the concurrent work in [31], in Table 1. Contrary to existing approaches, depending on the loss weighting parameters used, our proposed approach is able to easily operate on a wide spectrum of recall and mean recall values $(\underline{17} -\underline{20})$ . More concretely, compared to the most competitive baseline in SGTR [31] $(\underline{14} -\underline{16})$ and other one stage methods in AS-Net [4] $(\underline{12})$ and HOTR [29] $(\underline{13})$ , our approach is able to achieve a considerably better recall on the head classes $(\underline{17};3.5\mathrm{mR}@100$ better on head classes compared to [31]). Additionally, when comparing a variant of our approach that has a similar R@100 value to SGTR $(\underline{15}$ and $\underline{20})$ we do significantly better on mean recall (3.8 higher mR@50) highlighting the proficiency of our method to generalize to tail classes wherein the training data is limited. Furthermore, our proposed model in $\underline{20}$ achieves the best performance across all models (including two-stage methods that use a superior backbone [49]) on hR@50/100, underlining the capability of our method to perform well on both the head and tail classes simultaneously. SGTR [31] additionally reports numbers by utilizing a data sampling approach BGNN [32] to bias the model towards the tail classes $(\underline{16})$ . We highlight that, compared to $\underline{16}$ , our model in $\underline{20}$ performs similarly on mR@50 but much better R@50/100 (5.5 R@50 higher). The poorer performance on mR@100 is largely due to SGTR [31] selecting top-3 subjects and objects for each predicate, leading to more relationship triplets being generated. On the contrary, our approach only uses 1 predicate per subject-object pair. For a fairer comparison, we evaluate our model in $\underline{20}$ using a similar top- $k$ strategy, wherein we select the top-3 predicates for each subject-object pair. The resulting model $(\underline{22})$ outperforms the closest baseline by a significant margin (3.3 higher mR@100, 10.6 higher R@100 compared to $\underline{16}$ ). Additionally, we show that our loss re-weighting strategy is complementary to existing data sampling approaches by fine-tuning our trained model in $\underline{20}$ using BGNN [32] $(\underline{21})$ . For further analysis, see supplementary Section C.2. + +Table 6: Scene Graph Prediction on Action Genome. Mean Recall (mR@K), Recall (R@K), and Harmonic Recall (hR@K) shown for baselines and variants of our approach with different loss weighting parameters. B=Backbone, D=Detector. Baseline results are taken from [16]. + +
BD#MethodR@20/50mR@20/50hR@20/50
X101-FPNFaster RCNN①VRD [36]10.3 / 10.9-
②Freq Prior [55]24.0 / 24.9--
③IMP [50]23.9 / 25.5--
④MSDN [33]24.0 / 25.6--
⑤Graph R-CNN [52]24.1 / 25.8--
⑥RelDN [56]25.0 / 26.2--
⑦SimpleBase [16]27.9 / 30.48.3 / 9.112.8 / 14.0
R-101DETR⑧Ours{α=0,β=*}31.0 / 37.520.9 / 25.324.9 / 30.2
⑨Ours{α=0.07,β=0.75}30.1 / 36.536.9 / 42.833.1 / 39.4
⑩Ours{α=0.14,β=0.75}29.2 / 35.337.9 / 44.032.9 / 39.2
+ +Action Genome. We additionally report recall, mean recall, and harmonic recall values on the Action Genome dataset [25] in Table 6. Similar to the observations on Visual Genome, we observe 3.1 higher R@20 and 12.6 higher mR@20 ( $\langle \overline{8} \rangle$ ) when compared to the closest baseline in [16] ( $\langle \overline{7} \rangle$ ) despite using an inferior backbone [49]. Furthermore, by effectively biasing our model towards the tail classes, we are able to achieve 29.6 better mR@20 while having better R@20/50 values ( $\langle \overline{10} \rangle$ ) compared to $\langle \overline{7} \rangle$ . + +We provide per class relation recall and object AP for both datasets in the supplementary (Section C). + +# 5.3 Generality of Proposed Formulation + +Although our transformer model effectively generates better scene graphs, the proposed iterative refinement formulation (Equation 2) can be applied to any existing method. To demonstrate this, we augment this framework to the simple two-stage MOTIF [55] architecture. The details on how this is achieved is deferred to the supplementary (Section A). We contrast the performance of the baseline and our augmented approach on the Visual Genome dataset [30] in Table 3. It can be seen that with each refinement step, the model is able to generate better scene graphs ( $\sim 6\%$ higher on mR@20 and mR@50 after 3 steps). Note that, owing to the two-stage nature of MOTIF [55], the image features used by our refinement framework are fixed and oblivious to the task of scene graph generation (as the detector parameters are frozen). Contrary to the proposed transformer model that can query the image at each layer, the performance gains when using the augmented MOTIF variant are largely limited due to the image features being the same across the refinement steps. + +# 6 Conclusion, Limitations, and Societal Impact + +In this work we propose a novel and general framework for iterative refinement that overcomes limitations arising from a fixed factorization assumption in existing methods. We demonstrate its effectiveness through a transformer based end-to-end trainable architecture. + +Limitations. Limitations of the proposed approach include using a shared image encoder, which improves efficiency, but may limit diversity of representations available for different decoder layers; and limited ability to model small objects inherited from the DETR object detection design [31]. + +Societal Impact. While our model does not have any direct serious societal implications, its impact could be consequential if it is used in specific critical applications (e.g., autonomous driving). In such cases both the overall performance and biases in object / predicate predictions would require careful analysis and further calibration. Our loss re-weighting strategy is a step in that direction. + +# Acknowledgments and Disclosure of Funding + +This work was funded, in part, by the Vector Institute for AI, Canada CIFAR AI Chair, NSERC CRC and an NSERC DG and Accelerator Grants. Hardware resources used in preparing this research were provided, in part, by the Province of Ontario, the Government of Canada through CIFAR, and companies sponsoring the Vector Institute1. Additional support was provided by JELF CFI grant and Compute Canada under the RAC award. Finally, we sincerely thank Bicheng Xu and Muchen Li for their valuable feedback on the paper draft. + +# References + +[1] Kaidi Cao, Colin Wei, Adrien Gaidon, Nikos Arechiga, and Tengyu Ma. Learning imbalanced datasets with label-distribution-aware margin loss. Advances in neural information processing systems, 32, 2019. +[2] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In European conference on computer vision, pages 213-229. Springer, 2020. +[3] Nitesh V Chawla, Kevin W Bowyer, Lawrence O Hall, and W Philip Kegelmeyer. Smote: synthetic minority over-sampling technique. Journal of artificial intelligence research, 16:321-357, 2002. +[4] Mingfei Chen, Yue Liao, Si Liu, Zhiyuan Chen, Fei Wang, and Chen Qian. Reformulating hoi detection as adaptive set prediction. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9004-9013, 2021. +[5] Tianshui Chen, Weihao Yu, Riquan Chen, and Liang Lin. Knowledge-embedded routing network for scene graph generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 6163–6171, 2019. +[6] Meng-Jiun Chiou, Henghui Ding, Hanshu Yan, Changhu Wang, Roger Zimmermann, and Jiashi Feng. Recovering the unbiased scene graphs from the biased ones. In Proceedings of the 29th ACM International Conference on Multimedia, pages 1581-1590, 2021. +[7] Yuren Cong, Michael Ying Yang, and Bodo Rosenhahn. Reltr: Relation transformer for scene graph generation. arXiv preprint arXiv:2201.11460, 2022. +[8] Marcella Cornia, Matteo Stefanini, Lorenzo Baraldi, and Rita Cucchiara. Meshed-memory transformer for image captioning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10578-10587, 2020. +[9] Yin Cui, Menglin Jia, Tsung-Yi Lin, Yang Song, and Serge Belongie. Class-balanced loss based on effective number of samples. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 9268-9277, 2019. +[10] Shabnam Daghaghi, Tharun Medini, and Anshumali Shrivastava. Sdm-net: a simple and effective model for generalized zero-shot learning. In Uncertainty in Artificial Intelligence, pages 2103-2113. PMLR, 2021. +[11] Alakh Desai, Tz-Ying Wu, Subarna Tripathi, and Nuno Vasconcelos. Learning of visual relations: The devil is in the tails. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 15404-15413, 2021. +[12] Ming Ding, Zhuoyi Yang, Wenyi Hong, Wendi Zheng, Chang Zhou, Da Yin, Junyang Lin, Xu Zou, Zhou Shao, Hongxia Yang, et al. Cogview: Mastering text-to-image generation via transformers. Advances in Neural Information Processing Systems, 34, 2021. +[13] Qi Dong, Shaogang Gong, and Xiatian Zhu. Class rectification hard mining for imbalanced deep learning. In Proceedings of the IEEE International Conference on Computer Vision, pages 1851-1860, 2017. +[14] Qi Dong, Zhuowen Tu, Haofu Liao, Yuting Zhang, Vijay Mahadevan, and Stefano Soatto. Visual relationship detection using part-and-sum transformers with composite queries. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 3550-3559, 2021. +[15] Ross Girshick, Jeff Donahue, Trevor Darrell, and Jitendra Malik. Rich feature hierarchies for accurate object detection and semantic segmentation. In 2014 IEEE Conference on Computer Vision and Pattern Recognition, pages 580-587, 2014. +[16] Raghav Goyal and Leonid Signal. A simple baseline for weakly-supervised human-centric relation detection. In British Machine Vision Conference, 2021. +[17] Jieuxiang Gu, Shafiq Joty, Jianfei Cai, Handong Zhao, Xu Yang, and Gang Wang. Unpaired image captioning via scene graph alignments. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 10323-10332, 2019. +[18] Yuyu Guo, Lianli Gao, Xuanhan Wang, Yuxuan Hu, Xing Xu, Xu Lu, Heng Tao Shen, and Jingkuan Song. From general to specific: Informative scene graph generation via balance adjustment. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 16383-16392, 2021. +[19] Agrim Gupta, Piotr Dollar, and Ross Girshick. Lvis: A dataset for large vocabulary instance segmentation. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 5356-5364, 2019. +[20] Hui Han, Wen-Yuan Wang, and Bing-Huan Mao. Borderline-smote: a new over-sampling method in imbalanced data sets learning. In International conference on intelligent computing, pages 878-887. Springer, 2005. +[21] H He, Y Bai, EA Garcia, and S ADASYN Li. adaptive synthetic sampling approach for imbalanced learning. ieee international joint conference on neural networks. In 2008 (IEEE World Congress On Computational Intelligence), 2008. +[22] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770-778, 2016. +[23] Sen He, Wentong Liao, Hamed R Tavakoli, Michael Yang, Bodo Rosenhahn, and Nicolas Pugeault. Image captioning through image transformer. In Proceedings of the Asian Conference on Computer Vision, 2020. +[24] Drew A Hudson and Christopher D Manning. Gqa: A new dataset for real-world visual reasoning and compositional question answering. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 6700-6709, 2019. + +[25] Jingwei Ji, Ranjay Krishna, Li Fei-Fei, and Juan Carlos Niebles. Action genome: Actions as compositions of spatio-temporal scene graphs. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10236-10247, 2020. +[26] Justin Johnson, Agrim Gupta, and Li Fei-Fei. Image generation from scene graphs. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1219–1228, 2018. +[27] Bingyi Kang, Saining Xie, Marcus Rohrbach, Zhicheng Yan, Albert Gordo, Jiashi Feng, and Yannis Kalantidis. Decoupling representation and classifier for long-tailed recognition. In International Conference on Learning Representations, 2020. +[28] Siddhesh Khandelwal, Mohammed Suhail, and Leonid Sigal. Segmentation-grounded scene graph generation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 15879-15889, 2021. +[29] Bumsoo Kim, Junhyun Lee, Jaewoo Kang, Eun-Sol Kim, and Hyunwoo J Kim. Hotr: End-to-end human-object interaction detection with transformers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 74-83, 2021. +[30] Ranjay Krishna, Yuke Zhu, Oliver Groth, Justin Johnson, Kenji Hata, Joshua Kravitz, Stephanie Chen, Yannis Kalantidis, Li-Jia Li, David A Shamma, et al. Visual genome: Connecting language and vision using crowdsourced dense image annotations. International journal of computer vision, 123(1):32-73, 2017. +[31] Rongjie Li, Songyang Zhang, and Xuming He. Sgtr: End-to-end scene graph generation with transformer. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 19486-19496, 2022. +[32] Rongjie Li, Songyang Zhang, Bo Wan, and Xuming He. Bipartite graph network with adaptive message passing for unbiased scene graph generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 11109-11119, 2021. +[33] Yikang Li, Wanli Ouyang, Bolei Zhou, Kun Wang, and Xiaogang Wang. Scene graph generation from objects, phrases and region captions. In Proceedings of the IEEE international conference on computer vision, pages 1261-1270, 2017. +[34] Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dólar. Focal loss for dense object detection. In Proceedings of the IEEE international conference on computer vision, pages 2980-2988, 2017. +[35] Hengyue Liu, Ning Yan, Masood Mortazavi, and Bir Bhanu. Fully convolutional scene graph generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 11546-11556, 2021. +[36] Cewu Lu, Ranjay Krishna, Michael Bernstein, and Li Fei-Fei. Visual relationship detection with language priors. In European conference on computer vision, pages 852–869. Springer, 2016. +[37] Dhruv Mahajan, Ross Girshick, Vignesh Ramanathan, Kaiming He, Manohar Paluri, Yixuan Li, Ashwin Bharambe, and Laurens Van Der Maaten. Exploring the limits of weakly supervised pretraining. In Proceedings of the European conference on computer vision (ECCV), pages 181-196, 2018. +[38] Depu Meng, Xiaokang Chen, Zejia Fan, Gang Zeng, Houqiang Li, Yuhui Yuan, Lei Sun, and Jingdong Wang. Conditional detr for fast training convergence. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 3651-3660, 2021. +[39] Alejandro Newell and Jia Deng. Pixels to graphs by associative embedding. Advances in neural information processing systems, 30, 2017. +[40] Mengshi Qi, Weijian Li, Zhengyuan Yang, Yunhong Wang, and Jiebo Luo. Attentive relational networks for mapping images to scene graphs. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 3957-3966, 2019. +[41] Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. Advances in neural information processing systems, 28, 2015. +[42] Li Shen, Zhouchen Lin, and Qingming Huang. Relay backpropagation for effective learning of deep convolutional neural networks. In European conference on computer vision, pages 467-482. Springer, 2016. +[43] Suprosanna Shit, Rajat Koner, Bastian Wittmann, Johannes Paetzold, Ivan Ezhov, Hongwei Li, Jiazhen Pan, Sahand Sharifzadeh, Georgios Kaissis, Volker Tresp, et al. Relationformer: A unified framework for image-to-graph generation. arXiv preprint arXiv:2203.10202, 2022. +[44] Gunnar A Sigurdsson, Gúl Varol, Xiaolong Wang, Ali Farhadi, Ivan Laptev, and Abhinav Gupta. Hollywood in homes: Crowdsourcing data collection for activity understanding. In European Conference on Computer Vision, pages 510–526. Springer, 2016. +[45] Mohammed Suhail, Abhay Mittal, Behjat Siddiquie, Chris Broaddus, Jayan Eledath, Gerard Medioni, and Leonid Sigal. Energy-based learning for scene graph generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 13936-13945, 2021. +[46] Kaihua Tang, Yulei Niu, Jianqiang Huang, Jiaxin Shi, and Hanwang Zhang. Unbiased scene graph generation from biased training. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 3716-3725, 2020. +[47] Kaihua Tang, Hanwang Zhang, Baoyuan Wu, Wenhan Luo, and Wei Liu. Learning to compose dynamic tree structures for visual contexts. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 6619-6628, 2019. + +[48] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017. +[49] Saining Xie, Ross Girshick, Piotr Dálár, Zhuowen Tu, and Kaiming He. Aggregated residual transformations for deep neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1492-1500, 2017. +[50] Danfei Xu, Yuke Zhu, Christopher B Choy, and Li Fei-Fei. Scene graph generation by iterative message passing. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 5410–5419, 2017. +[51] Shaotian Yan, Chen Shen, Zhongming Jin, Jianqiang Huang, Rongxin Jiang, Yaowu Chen, and Xian-Sheng Hua. Pcpl: Predicate-correlation perception learning for unbiased scene graph generation. In Proceedings of the 28th ACM International Conference on Multimedia, pages 265-273, 2020. +[52] Jianwei Yang, Jiasen Lu, Stefan Lee, Dhruv Batra, and Devi Parikh. Graph r-cnn for scene graph generation. In Proceedings of the European conference on computer vision (ECCV), pages 670–685, 2018. +[53] Xu Yang, Kaihua Tang, Hanwang Zhang, and Jianfei Cai. Auto-encoding scene graphs for image captioning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10685–10694, 2019. +[54] Alireza Zareian, Svebor Karaman, and Shih-Fu Chang. Bridging knowledge graphs to generate scene graphs. In European Conference on Computer Vision, pages 606-623. Springer, 2020. +[55] Rowan Zellers, Mark Yatskar, Sam Thomson, and Yejin Choi. Neural motifs: Scene graph parsing with global context. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 5831-5840, 2018. +[56] Ji Zhang, Kevin J Shih, Ahmed Elgammal, Andrew Tao, and Bryan Catanzaro. Graphical contrastive losses for scene graph parsing. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 11535-11543, 2019. +[57] Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, and Jifeng Dai. Deformable detr: Deformable transformers for end-to-end object detection. arXiv preprint arXiv:2010.04159, 2020. +[58] Yang Zou, Zhiding Yu, BVK Kumar, and Jinsong Wang. Unsupervised domain adaptation for semantic segmentation via class-balanced self-training. In Proceedings of the European conference on computer vision (ECCV), pages 289-305, 2018. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] see Section 6. +(c) Did you discuss any potential negative societal impacts of your work? [Yes] see Section 6. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [N/A] +(b) Did you include complete proofs of all theoretical results? [N/A] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] All the data we use in our experiments is publicly available. The code for our approach is available at github.com/ubc-vision/IterativeSG. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] We use widely popular data splits for our experiments. We briefly describe this in Section 5. The hyperparameters and additional data details are also mentioned in the supplementary (Section B). +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] As scene graph models are computationally expensive to train, none of the existing literature report error bars. However, we do report the performance of our method on different hyperparameter values to enable better understanding of the performance improvements. +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] This is described in the supplementary (Section B). + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] All the datasets we use are publicly available. We cite the creators of Visual Genome (Krishna et al. [30]) and Action Genome (Ji et al. [25]) throughout the paper. +(b) Did you mention the license of the assets? [Yes] Visual Genome [30] is licensed under the Creative Commons Attribution 4.0 International License. Action Genome [25] is licensed under the MIT license. +(c) Did you include any new assets either in the supplemental material or as a URL? [N/A] We don't introduce any new assets in the paper. +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] Both Visual Genome [30] and Action Genome [25] are publicly available. +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/iterativescenegraphgeneration/images.zip b/iterativescenegraphgeneration/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..eead909b0c97d3690fe55f3ac39e7057fcc19fed --- /dev/null +++ b/iterativescenegraphgeneration/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2e8b51c02bf94488150b62d02f818281ef9e55ff0096ad2bc91fcb53206baaa5 +size 555857 diff --git a/iterativescenegraphgeneration/layout.json b/iterativescenegraphgeneration/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..2b09722cbeac00c2045507e14d34b785210ea8f4 --- /dev/null +++ b/iterativescenegraphgeneration/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b1eba312682037babb9ef388b082556cb5a568da534896168ffbb0af80cb2f3f +size 518395 diff --git a/iterativestructuralinferenceofdirectedgraphs/173942a2-64bf-4cd8-a1b9-194a83a24877_content_list.json b/iterativestructuralinferenceofdirectedgraphs/173942a2-64bf-4cd8-a1b9-194a83a24877_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..17961ed2a0b43ce89d280cf6d884da5ffc42521a --- /dev/null +++ b/iterativestructuralinferenceofdirectedgraphs/173942a2-64bf-4cd8-a1b9-194a83a24877_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82b03bfea636cf4f180911883ce3a67e2fa9f57d77eb194e31849af2a8690f92 +size 91176 diff --git a/iterativestructuralinferenceofdirectedgraphs/173942a2-64bf-4cd8-a1b9-194a83a24877_model.json b/iterativestructuralinferenceofdirectedgraphs/173942a2-64bf-4cd8-a1b9-194a83a24877_model.json new file mode 100644 index 0000000000000000000000000000000000000000..8ff777c0684aca34fefe7b89cc7ac0738e7afdab --- /dev/null +++ b/iterativestructuralinferenceofdirectedgraphs/173942a2-64bf-4cd8-a1b9-194a83a24877_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0ce240bd4b92ed25cf199f57256779408c8348a9b6a2d5d35932ffe258fb1d4 +size 116097 diff --git a/iterativestructuralinferenceofdirectedgraphs/173942a2-64bf-4cd8-a1b9-194a83a24877_origin.pdf b/iterativestructuralinferenceofdirectedgraphs/173942a2-64bf-4cd8-a1b9-194a83a24877_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..76a6f1282c14b821876ac8601d578ebb911e21fe --- /dev/null +++ b/iterativestructuralinferenceofdirectedgraphs/173942a2-64bf-4cd8-a1b9-194a83a24877_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e5c29ba42cdd349ebb45009d9be2dfa3b4eefadd983077d8ba3b6ef899778e3 +size 1190415 diff --git a/iterativestructuralinferenceofdirectedgraphs/full.md b/iterativestructuralinferenceofdirectedgraphs/full.md new file mode 100644 index 0000000000000000000000000000000000000000..455534bb89a11b80ca859c81c40a611c7ac62cfa --- /dev/null +++ b/iterativestructuralinferenceofdirectedgraphs/full.md @@ -0,0 +1,398 @@ +# Iterative Structural Inference of Directed Graphs + +Aoran Wang + +University of Luxembourg + +aoran.wang@uni.lu + +Jun Pang + +University of Luxembourg + +jun.pang@uni.lu + +# Abstract + +In this paper, we propose a variational model, Iterative Structural Inference of Directed Graphs (iSIDG), to infer the existence of directed interactions from observational agents' features over a time period in a dynamical system. First, the iterative process in our model feeds the learned interactions back to encourage our model to eliminate indirect interactions and to emphasize directional representation during learning. Second, we show that extra regularization terms in the objective function for smoothness, connectiveness, and sparsity prompt our model to infer a more realistic structure and to further eliminate indirect interactions. We evaluate iSIDG on various datasets including biological networks, simulated fMRI data, and physical simulations to demonstrate that our model is able to precisely infer the existence of interactions, and is significantly superior to baseline models. + +# 1 Introduction + +A wide range of dynamical systems in the real world can be viewed as the composition of interacting agents, including physical systems [24, 13], multi-agent systems [5, 27] and biological systems [48, 35]. Knowing the interactions of dynamical systems can promote our understanding of the intrinsic mechanisms of these systems, and further facilitate accurate prediction and control of dynamical systems. However, in many cases, unlike the states of the agents, the interactions are usually not directly observable or measurable. Therefore, it is necessary to uncover the underlying interactions of dynamical systems based on the observational states of the agents. In dynamical systems, the states of an agent are affected by the interactions, and the states are usually recorded as a set of continuous variables, which make it difficult to uncover the interactions based on the similarity between the agents. It is also worth mentioning that most dynamical systems are characterized by directed interactions, such as citation networks [44], social ego networks [31], and gene regulatory networks [35]. We address the revealing of the existence of interactions in the dynamical systems as the problem of structural inference, and model the dynamical system as a directed graph, in which the nodes represent the agents of the system, and the directed edges denote the interactions between the agents. Thus, the structural inference problem is transformed into the inference of the asymmetric adjacency matrix of the graph based on observational nodes' features (dynamics). + +While several models have been proposed to address this problem with unsupervised variational generative frameworks [22, 51, 30], most of them only deal with undirected interactions, and almost none of them explains why the variational method succeeds in inferring the structure. In this paper, based on the theory of Information Bottleneck (IB) [47, 1], which states the training of variational auto-encoder (VAE) follows the two-step procedure of deep learning: label-fitting and representation-compression, we explain the intrinsic mechanism of structural inference with VAEs, and propose a novel VAE based machine learning approach, namely iterative Structural Inference of Directed Graphs (iSIDG), for iterative inference of the directed graph structure based on observational node features. Our iSIDG model utilizes a graph neural network (GNN) as encoder and infers adjacency matrix of the graph in its latent space. + +The key rationale of our iSIDG model is the iterative process for structural inference, which is designed based on the Variational Information Bottleneck [1]. The iterative process not only feeds the learned structure backward with direction information, but also creates tighter bounds and relaxation during the training process. The direction information contributes to a more diverse edge representations in the encoder and latent space. The iterative process connects several rounds of training a VAE into a loop, and joints the second phase: representation-compression with the label-fitting phase of the next round, which creates a tighter bound and a relaxation, to learn a more precise disentanglement between indirect connections and direct ones. Unlike previous works [22, 51, 30] that totally rely on the bottleneck structure of VAE to infer structure, iSIDG has extra terms to regularize the learned features in the latent space, such as sparsity and connectiveness, which carefully takes the properties of (asymmetric) adjacency matrix into account. Experimental results show that iSIDG outperforms or matches the state-of-the-art baselines on datasets with directed or undirected graphs. More importantly, iSIDG can distinguish indirect connections from direct ones more precisely. + +# 2 Related Work + +Neural relational inference (NRI) [22] is the first to utilize a VAE to address the problem of structural inference based on observational node features. NRI conducts message-passing operations on a fixed fully connected graph structure in its encoder and infers graph structure in its latent space. Based on NRI, Webb et al. [51] propose factorized neural relational inference (fNRI), which extends NRI to multi-interaction systems. However, fNRI relies on ground-truth graph structure to classify results for each type of interaction. To deal with more complex systems, Li et al. [29] and Chen et al. [9] take various prior knowledge into account, such as sparsity and the distribution of node degrees, to increase the accuracy of structural inference. Unfortunately, it is quite difficult to acquire prior knowledge in many problem settings. Alet et al. [2] propose a modular meta-learning-based framework that jointly infers the structure with higher data efficiency. However, the framework has to be trained on various datasets beforehand to reach its best performance. From the aspect of Granger-causality, Löwe et al. [30] propose amortized causality discovery (ACD) method, which infers a latent posterior graph from temporal conditional dependence. Despite its high accuracy, the ACD method suffers from indirect interactions. Compared with this line of work, iSIDG introduces an iterative structural inference process to create a tighter bound by updating the fully connected graph structure in the encoder, and encourages edge representations to be diverse with the integrated direction information. + +In addition to the aforementioned models to infer the structure of static graphs, several frameworks can also infer the structure of dynamic graphs. Ivanovic and Pavone [15] present a graph-structured model which combines recurrent sequence modeling and variational deep generative modeling to infer dynamic structure and predict future trajectories. Li et al. [26] propose a generic trajectory prediction forecasting network to provide multi-modal trajectory hypotheses and auxiliary structural inference. The framework in [12] utilizes sequential latent variable models to infer and predict separate relation graphs for every single time step. Moreover, the generic generative neural system proposed in [27] predicts trajectories based on dynamic graph representation and scene context information. The frameworks that can infer dynamic graph structures are mostly application-focused, and the structural inference is auxiliary to the task of trajectory prediction. + +Besides the models based on variational interface, we would like to mention a few works which deal with the problem of structural inference as well, but based on different methodologies. ARNI framework [6] infers the latent structure based on regression analysis and a careful choice of basis functions. Mutual information is also utilized to determine the existence of causal links and thus can infer the structure of dynamical systems [52, 40]. Some approaches fit a dynamics model and then produce a causal graph estimate of the model by using recurrent models [45, 19], or infer the structure by generating edges sequentially [17, 28] and others independently prune the generated edges from an over-complete graph [41]. Xue and Bogdan [54] reconstruct network structures under unknown adversarial interventions. Although these methods can provide insights about the correlations between adjacent nodes, such as mutual information and causal relation, they either require prior knowledge, or demand the comparison of features from all possible node-pairs, or are sensitive to indirect interactions in the graphs. + +There exists another branch of research called Graph Structure Learning, which aims to jointly learn an optimized graph structure and corresponding graph representations for downstream tasks [60, 11, 16]. However, these methods adopt similarity-based methods to optimize the noisy graph structure, which + +cannot be applied to dynamical systems. Furthermore, the main focus of these methods is the downstream task, not the reconstruction of the graph structure. Besides that, there are also a series of work to reconstruct the structure of directed acyclic graphs [59, 57, 38, 58]. However, these works have difficulties to work on graphs with cycles (and self-loops), which are commonly observed among dynamical systems. Last but not least, in the research field of biology, there are some work which can infer the structure of gene regulatory networks [25, 20, 7]. But these works either require prior assumption or cannot be extended to dynamical systems whose agents have multi-dimensional features. Unlike these works, iSIDG focuses on the structural inference of dynamical systems, and can deal with cycles in the system and high-dimensional node features. + +# 3 Preliminaries + +Notations and problem formulation. We view a dynamical system as a directed graph, where the agents of the system are represented as the nodes of the graph, and the directed interactions between the agents as the edges. We note the directed graph as $\mathcal{G} = (\mathcal{V},\mathcal{E})$ , in which $\mathcal{V}$ represents the set of $n$ nodes: $\{v_{i},1\leq i\leq n\}$ , and $\mathcal{E}$ represents the set of edges: $(v_{i},v_{j})\in \mathcal{E}\subseteq \mathcal{V}\times \mathcal{V}$ . Based on the set of edges, we derive to an asymmetric adjacency matrix $\mathbf{A}\in \mathbb{R}^{n\times n}$ , in which $\mathbf{a}_{ij}\in \{0,1\}$ indicates the presence $(\mathbf{a}_{ij} = 1)$ of the edge between $v_{i}$ and $v_{j}$ or not $(\mathbf{a}_{ij} = 0)$ . The edges in our work are assumed to be static and do not evolve with time. The feature recordings of the nodes over a time period are represented as $\mathcal{V} = \{V^t,0\leq t\leq T\}$ , where $T$ is the total number of time steps, and $V^t$ is the set of features of all the $n$ nodes at time step $t$ : $V^t = \{v_0^t,v_1^t,\dots ,v_n^t\}$ . Given $M$ sets of feature recordings $\{\mathcal{V}_k,0\leq k\leq M\}$ , the structural inference problem we consider in this paper is to reconstruct the asymmetric adjacency matrix $\mathbf{A}$ of the graph in an unsupervised way. + +We state the problem of structural inference as searching for a combinatorial distribution to describe the existence of the edges between any of the node pairs in the graph. As shown in Figure 1, we utilize a GNN based VAE [21] as the cornerstone, which can be trained to approximate complicated and high-dimensional probability distributions from the sampled node features [37]. We design an iterative process based on the IB theory, and feed the direction information, which is computed from the learned structure in the past training procedures, back to the input side, to encourage a more diverse learned representations, and to create a tighter bound as well as a relaxation of the training. + +Graph neural networks. Graph neural networks (GNNs) are powerful deep learning algorithms to learn the representations of nodes and graphs. Most modern GNNs are designed based on the neighbourhood aggregation strategy [14], where the representation of a node is updated by aggregating the representations of its neighbours. In brief, we denote $h_i^{(k)}$ as the representation of node $v_i$ at the $k$ -th layer, and the mechanism of these GNNs can be described as: + +$$ +h _ {i} ^ {(k)} = \operatorname {U P D A T E} ^ {(k)} \left(h _ {i} ^ {(k - 1)}, \mathbf {m} _ {\mathcal {N} (v _ {i})} ^ {(k - 1)}\right), \text {w h e r e} \mathbf {m} _ {\mathcal {N} (v _ {i})} ^ {(k - 1)} = \operatorname {A G G R E G A T E} ^ {(k)} \left(\left\{v _ {j} \in \mathcal {N} (v _ {i}) \right\}\right), \tag {1} +$$ + +where $\mathcal{N}(v_i)$ denotes the set of chosen nodes related to $v_{i}$ (e.g., its neighbours), UPDATE denotes the arbitrary function in the layer to update node representation, and AGGREGATE represents the aggregation function in the layer. + +GCN [23] updates node representation based on one-hop neighbours and also its own representation in the previous layer, and calculates new representations with ReLU. GIN [53] aggregates the representations of adjacent nodes and node's own representation in the previous layer as a weighted summation, and utilizes multilayer perceptron to update node representations. GAT [49] introduces attention mechanism to implicitly specify different weights to adjacent nodes, and then updates representations upon the weighted summation. GNNs are efficient in learning rich representations for nodes and graphs. As a result, we utilize GNNs in the encoder to firstly learn representations of the nodes, and later on learn edge representations from the node representations in iSIDG. + +Information bottleneck. The theory of Information Bottleneck (IB) provides an explanation and understanding of learning with deep neural networks [47, 46, 42]. In general, for the input data $X$ and its label $Y$ , the IB aims to learn the minimal sufficient representation $Z = \arg \min_{Z} I(Z;X) - \mathfrak{u} \cdot I(Z;Y)$ , where $\mathfrak{u}$ is the Lagrangian multiplier to balance sufficiency and minimality. The training epochs of standard deep learning can be divided into two phases: label-fitting and representation-compression. These two phases can be characterized by the mutual information between the input features and the learned representation of a layer $I(X;Z)$ , as well as between learned representation and the label variables $I(Z;Y)$ . In the label-fitting phase, both $I(X;Z)$ and $I(Z;Y)$ increase, but + +![](images/b196214c459b519e214f56ee2e3d838c70c60bfb234cc478f0ec361bc32d3404.jpg) +Figure 1: Overall architecture of the proposed iSIDG framework. iSIDG takes the fully-connected graph structure for the first run, but later on it takes the learned adjacency matrix with direction information as input. Regularization terms including smoothness, connectiveness and sparsity encourage learned features in latent space to be realistic and eliminate inferred indirect interactions. + +in the representation-compression phase, $I(X;Z)$ decreases while $I(Z;Y)$ can either decrease or increase, depending on the amount of data [42]. + +Alemi et al. [1] present a variational approximation to the IB theory (VIB), and prove VAE objective is a special case of the variational approximation. Under a fully unsupervised setting, VAEs learn the minimal sufficient statistics from the input features, which are sufficient to derive the output features, and keep the most compressed and abstractive representations in their latent space. We utilize a VAE to infer the structure of the graph in its latent space, which is minimally sufficient to predict the future states of the nodes together with present node states. + +It is suggested that IB iterations with stochastic relaxation methods may boost training [42]. It is also mentioned that a relaxation process is helpful to reduce local ambiguity and achieve global consistency [56], as already proved in previous work [8, 55]. Therefore, we design an iterative process with stochastic gradient descent (SGD) based optimizer to create a tighter bound and a relaxation for the training, and to encourage iSIDG to further disentangle dynamics from the adjacency matrix. In order to verify the effectiveness of this iterative process, we conduct a case study in Section D.3. + +# 4 Model Design + +# 4.1 Structural Inference by Information Bottleneck + +Together with node features, graph structure characterizes the basic information of a graph, which represents a dynamical system. The goal of structural inference is to accurately reconstruct the adjacency matrix $\mathbf{A}$ of the directed graph based on the recordings of node features: $\mathbf{A} \gets \{V^t, 0 \leq t \leq T\}$ . Interestingly, for dynamical systems, the future features of the nodes are deterministic by their previous features and the connectivity: $V^{t+1} \gets \{V^0, V^1, \ldots, V^t; \mathbf{A}\}$ . We assume the Markovian assumption works in our case, and thus previous statement can be simplified to: $V^{t+1} \gets \{V^t; \mathbf{A}\}$ . Thus, we derive to an assumption: the information about the adjacency matrix is implicitly included in the node features over a time period, which also conforms to the IB theory. + +Based on VIB, we derive the Information Bottleneck for Structural Inference, which aims at inferring the adjacency matrix $\mathbf{A}$ in the latent space $\mathbf{Z}$ : + +$$ +\mathbf {Z} = \arg \min _ {\mathbf {Z}} I (\mathbf {Z}; V ^ {t}, \mathbf {A}) - \mathfrak {u} \cdot I (\mathbf {Z}; V ^ {t + 1}), \tag {2} +$$ + +Interestingly, $\mathbf{A}$ is also required in the first term in Equation 2, which is unrealistic in our problem setting. Thus, we assume a fully connected graphs structure $\mathbf{A}^{(0)}$ as input, which is not less informative than the actual sparse adjacency matrix: + +$$ +\mathbf {Z} = \arg \min _ {\mathbf {Z}} I (\mathbf {Z}; V ^ {t}, \mathbf {A} ^ {(0)}) - \mathfrak {u} \cdot I (\mathbf {Z}; V ^ {t + 1}). \tag {3} +$$ + +Following the statement in VIB [1], we adopt a VAE [21] to deal with the problem described in Equation 3, where an encoder $q_{\phi}(\mathbf{Z}|V^{t},\mathbf{A}^{(0)})$ approximates $I(\mathbf{Z};V^t,\mathbf{A}^{(0)})$ , and a decoder + +$p_{\theta}(\hat{V}^{t + 1}|\mathbf{Z},V^t)$ approximates $I(\mathbf{Z};V^{t + 1})$ $\phi$ and $\theta$ represent the parameters of encoder and decoder, respectively. We set the latent space of the VAE with the size of $n\times n$ . The fixed dimension of the latent space restricts the size of the search space for the adjacency matrix. We utilize a weighted ELBO with multiple integrated regularization terms to optimize model parameters $\{\phi ,\theta \}$ + +# 4.2 Encoder + +The encoder in our model is tasked with inferring the existence of directed interactions $\mathbf{z}_{ij}$ between all node-pairs by extracting the most compressed representation given the node features $\mathcal{V}$ . + +The encoder $q_{\phi}(\mathbf{Z}|V^t, \mathbf{A}^{(0)})$ returns a set $\{\mathbf{z}_{ij}|v_i, v_j \in \mathcal{V}\}$ , which features the distribution to describe how probable the edge from node $j$ to node $i$ exists: $p(\mathbf{z}_{ij}) \in [0,1]$ . The prior $p(\mathbf{Z}) = \prod_{i,j \in \mathcal{V}} p(\mathbf{z}_{ij})$ is a factorized uniform distribution. We utilize GNNs to extract features in the encoder. But the GNNs learn new representation based on both node features and the topology of the graph $f_{\mathrm{GNN}}(\mathcal{V}, \mathbf{A})$ , in which the adjacency matrix $\mathbf{A}$ is our learning target. To encounter this problem, we impose an iterative learning process on the adjacency matrix, and we discuss the details in Section 4.4. For simplicity, in this section we use $\hat{\mathbf{A}}$ to represent the adjacency matrix. In general, the encoder: + +$$ +q _ {\phi} = \operatorname {s o f t m a x} \left(\mathbf {f} _ {\mathrm {e n c}} (\mathcal {V}, \hat {\mathbf {A}})\right), \tag {4} +$$ + +where $f_{\mathrm{enc}}$ represents the encoder. The basic setup of our encoder is similar to that in [22], which applies two rounds of node-to-edge and one round of edge-to-node message passing operations to learn the edge embeddings $\mathbf{h}_{ij}$ : + +$$ +\text {N o d e E m b e d d i n g :} \quad \mathbf {e} _ {j} ^ {1} = f _ {\text {e m b e d}} ^ {(1)} (v _ {j}), \tag {5} +$$ + +$$ +\text {N o d e - t o - e d g e :} \quad \mathbf {e} _ {i j} = f _ {e} ^ {1} \left(\left[ \mathbf {e} _ {i} ^ {1}, \mathbf {e} _ {j} ^ {1} \right]\right), \text {i f} a _ {i j} = 1 \text {i n} \hat {\mathbf {A}}, \tag {6} +$$ + +$$ +\text {E d g e - t o - n o d e :} \quad \mathbf {e} _ {j} ^ {2} = f _ {v} \left(\sum \mathbf {e} _ {i j}\right), \tag {7} +$$ + +$$ +\text {N o d e - t o - e d g e :} \quad \mathbf {h} _ {i j} = f _ {e} ^ {2} \left(\left[ \mathbf {e} _ {i} ^ {2}, \mathbf {e} _ {j} ^ {2} \right]\right), \text {i f} a _ {i j} = 1 \text {i n} \hat {\mathbf {A}}, \tag {8} +$$ + +where $f_{\mathrm{embed}}^{(1)}$ is the embedding network for input features, $f_{e}^{1}$ and $f_{e}^{2}$ are node-to-edge message-passing networks, and $f_{v}$ is the edge-to-node operation. We observe that Equations 5 - 7 is a round of message passing for node features in most GNNs, as a result, we substitute Equations 5 - 8 as: + +$$ +\mathbf {h} _ {i j} = f _ {e} ^ {2} \left(f _ {\mathrm {G N N}} (\mathcal {V}, \hat {\mathbf {A}}), \hat {\mathbf {A}}\right), \tag {9} +$$ + +so we can integrate state-of-the-art GNNs such as GCN, GAT and GIN into encoder. In this work, we integrate GIN into the encoder. + +As a consequence, our encoder is designed to learn informative features from input node features and compress them to fit the restricted search space, which has the dimension of a fully connected graph. By extracting information from the high-dimensional but low-level node features to the restricted and low-dimensional latent space, our encoder disentangles the dynamics and approximates the minimally sufficient statistics, the adjacency matrix. After that, we model the existence of edges as $\mathbf{Z} \in \mathbb{R}^{n \times n}$ , where its component $\mathbf{z}_{ij}$ comes from $q_{\phi}(\mathbf{z}_{ij}|V^t, \hat{\mathbf{A}}) = \mathrm{softmax}(\mathbf{h}_{ij})$ . + +# 4.3 Decoder + +The task of the decoder is to predict the future states $V^{t + 1}$ based on the samplings from latent space $\mathbf{Z}$ and the present node features $V^t$ . From the IB theory, if the encoder derives minimally sufficient statistics as the adjacency matrix, the decoder can precisely predict the future node features. However, there remains the problem of how to design the decoder, so that it can further encourage the encoder to disentangle dynamics and to infer the graph structure only. In order to deal with this problem, we design the decoder to imitate a single message-passing operation. We feed our decoder with the present node features besides the samplings from the latent space to predict the future node features. As a consequence, the node features are disentangled from the compressed information in the latent space during training. In short, the decoder deals with the following problem: $p_{\theta}(V^{t + 1}|V^t,\mathbf{Z})$ . We + +use a two-stage decoder, which consists of a message-passing layer and an embedding layer: + +$$ +\hat {\mathbf {h}} _ {j} ^ {t + 1} = v _ {j} ^ {t} + f _ {\text {e m b e d}} ^ {(3)} \left(\sum_ {\mathbf {z} _ {i j} > 0} \mathbf {z} _ {i j} f _ {\text {e m b e d}} ^ {(2)} ([ v _ {i} ^ {t}, v _ {j} ^ {t} ])\right), \tag {10} +$$ + +where $f_{\mathrm{embed}}^{(2)}$ and $f_{\mathrm{embed}}^{(3)}$ are multilayer perceptrons (MLPs) to embed the features. + +# 4.4 Iterative Learning with Direction Information + +The motivation of integrating iterative learning process into the structural inference consists of three aspects: (1) to create a tighter bound for Equation 3; (2) to create a relaxation for the training process; (3) to emphasize direction information. In order to formulate the ideas more precisely, we would like to firstly describe the iterative process with direction information in our model. + +From the very beginning, we have no prior knowledge about the structure of the graph. In order to utilize GNNs to extract and compress the features into a restricted search space for adjacency matrix, we feed the encoder with a fully connected graph $\mathbf{A}^{(0)} = \mathbf{1}\in \mathbb{R}^{n\times n}$ . After $\eta$ rounds of training, we obtain an asymmetric adjacency matrix $\mathbf{A}^{(p)}$ from the latent space, which is calculated from the averaged result of the entire training samples: + +$$ +\mathbf {A} ^ {(p)} = \frac {1}{m} \sum_ {k \in M} \mathbf {Z} _ {k}, \tag {11} +$$ + +where $m$ is the total number of training samples, and $M$ is the set of training data. The full-batch average operation not only preserves the most information from the training set, but also makes the $\mathbf{A}^{(p)}$ to be invulnerable to outliers. We then normalize $\mathbf{A}^{(t)}$ in both row-wise and column-wise: + +$$ +\mathbf {A} _ {\text {r o w}} ^ {(p)} = \mathbf {D} _ {\text {i n}} ^ {- 1} \mathbf {A} ^ {(p)}, \text {a n d} \mathbf {A} _ {\text {c o l}} ^ {(p)} = \mathbf {A} ^ {(p)} \mathbf {D} _ {\text {o u t}} ^ {- 1}, \tag {12} +$$ + +where $\mathbf{D}_{\mathrm{in}}^{-1}$ and $\mathbf{D}_{\mathrm{out}}^{-1}$ are in-degree and out-degree matrices which are calculated based on $\mathbf{A}^{(p)}$ respectively. We name Equations 12 as direction information. After that, we combine the direction information matrices with the normalized initial fully-connected adjacency matrix, respectively: + +$$ +\tilde {\mathbf {A}} _ {\text {r o w}} ^ {(p)} = \lambda \mathbf {L} + (1 - \lambda) \mathbf {A} _ {\text {r o w}} ^ {(p)}, \text {a n d} \tilde {\mathbf {A}} _ {\text {c o l}} ^ {(p)} = \lambda \mathbf {L} + (1 - \lambda) \mathbf {A} _ {\text {c o l}} ^ {(p)}, \tag {13} +$$ + +where $\mathbf{L}$ is the normalized adjacency matrix of the initial fully-connected graph $\mathbf{A}^{(0)}$ , and $\lambda$ is the combination coefficient. Since $\mathbf{A}^{(0)}$ is symmetric, we can use either column-wise or row-wise normalization. We map the results in Equation 13 to binary sets with the characteristic function: + +$$ +\tilde {\mathbf {R}} _ {\kappa} ^ {(p)} = \mathbb {1} _ {\xi} \left(\tilde {\mathbf {A}} _ {\kappa} ^ {(p)}\right) = \left\{ \begin{array}{l l} 1 & \text {i f} \mathbf {a} _ {i j} \geq \xi \text {f o r} \mathbf {a} _ {i j} \text {i n} \tilde {\mathbf {A}} _ {\kappa} ^ {(p)} \\ 0 & \text {o t h e r w i s e} \end{array} \right. \tag {14} +$$ + +where $\kappa \in \{\mathrm{row},\mathrm{col}\}$ , and $\xi$ is the threshold value. Finally, we feed $\tilde{\mathbf{R}}_{\kappa}^{(p)}$ back to the input side of encoder mentioned in Section 4.2 by substituting the $\hat{\mathbf{A}}$ in Equations 6 and 8. More formally, the two feature vectors which are concatenated in Equations 6 and 8 represent the sender and receiver of the edge, respectively. We rewrite the equations for the iterative process according to $\tilde{\mathbf{R}}_{\kappa}^{(p)}$ : + +$$ +\mathbf {k} _ {i j} = \left\{ \begin{array}{l l} f _ {e} ^ {\mathrm {n}} \left(\left[ \mathbf {k} _ {i}, \mathbf {k} _ {j} \right]\right) & \text {i f} \mathbf {r} _ {i j} = 1 \text {i n} \tilde {\mathbf {R}} _ {\mathrm {c o l}} ^ {(p)} \text {a n d} \tilde {\mathbf {R}} _ {\mathrm {r o w}} ^ {(p)} \\ f _ {e} ^ {\mathrm {n}} \left(\left[ \mathbf {k} _ {i}, 0 \right]\right) & \text {i f} \mathbf {r} _ {i j} = 1 \text {o n l y i n} \tilde {\mathbf {R}} _ {\mathrm {c o l}} ^ {(p)} \\ f _ {e} ^ {\mathrm {n}} \left(\left[ 0, \mathbf {k} _ {j} \right]\right) & \text {i f} \mathbf {r} _ {i j} = 1 \text {o n l y i n} \tilde {\mathbf {R}} _ {\mathrm {r o w}} ^ {(p)}, \end{array} \right. \tag {15} +$$ + +where $\mathbf{k}_{ij} \in \{\mathbf{e}_{ij}, \mathbf{h}_{ij}\}$ , $f_{e}^{\mathrm{n}} \in \{f_{e}^{1}, f_{e}^{2}\}$ , and $\mathbf{k}_n \in \{\mathbf{e}_n^1, \mathbf{e}_n^2\}$ in Equations 6 and 8, respectively. We then train iSIDG with the updated adjacency matrices $\tilde{\mathbf{R}}_{\kappa}^{(p)}$ . The stop condition for iteration is: + +$$ +\left\| \mathbf {A} ^ {[ i ]} - \mathbf {A} ^ {[ i - 1 ]} \right\| _ {F} ^ {2} < \delta \left\| \mathbf {A} ^ {(0)} \right\| _ {F} ^ {2}, \tag {16} +$$ + +where superscript $[i]$ represents the rounds within current iteration. Once this condition is satisfied, the adjacency matrix at the input side of the encoder will be updated according to Equations 11 - 15. + +Tighter bound. During training, the initial fully connected adjacency matrix $\mathbf{A}^{(0)}$ is updated to sparser matrices $\{\hat{\mathbf{A}}_{\kappa}^{(p)}, \kappa \in \{\mathrm{row}, \mathrm{col}\}$ . (We omit the description for $\kappa$ in this paragraph for clearer statement). The model is able to roughly detect which edges are not beneficial to the future state prediction, and eliminates these edges in the new representation. As a consequence, any of the matrices in $\{\hat{\mathbf{A}}_{\kappa}^{(p)}\}$ is sparser than $\mathbf{A}^{(0)}$ . Thus the first term in Equation 3 is re-framed as $I(\mathbf{Z}; V^t, \{\hat{\mathbf{A}}_{\kappa}^{(p)}\})$ , which obviously supports: $I(\mathbf{Z}; V^t, \{\hat{\mathbf{A}}_{\kappa}^{(p)}\}) \leq I(\mathbf{Z}; V^t, \mathbf{A}^{(0)})$ , and results in a tighter bound for $\mathbf{Z}$ in Equation 3. + +Relaxation. Besides that, our iterative training process imposes relaxation to connect the two phases, i.e., label-fitting and representation-compression, of training a deep learning network as a cycle. In the first phase, our model for structural inference tries to fit the target for prediction, when the training errors become small, it turns to the second phase and compresses the representation of any layer to be minimally sufficient to fit the target. In the second phase, the compression process affects the adjacency matrix in latent space as well, and due to the difficulty of training in an unsupervised manner, it is very apt to reach a local optimal. The iterative process, which feeds the learned adjacency matrix back to the encoder, stops the phase of representation-compression, and starts the next round of label-fitting and representation-compression. At this round, the combination of direction information and the initial adjacency matrix together creates a different adjacency matrix for the encoder compared with the previous round, which will relax the learning of adjacency matrix back from the local optimal. We verify the effectiveness of the iterative process through mutual information in Section D.3. + +Direction information. One of the main differences between undirected and directed graphs is that the former can be described with a unified degree matrix, but the latter requires two matrices for in-degree and out-degree. As a result, we introduce direction information by integrating the in- and out-degrees of every node with the new adjacency matrices, which contributes to a bifurcated training process and encourages the learned embeddings for edges to be more diverse. The integration of direction information is beneficial to the structural inference for directed graphs, which is validated experimentally in Section 5.1. + +# 4.5 Training with a Hybrid Loss + +Although the iterative process is an effective way to learn the adjacency matrix of directed graphs, adequate loss function can promote the training process as well. Firstly, the following is the loss function for prediction: + +$$ +\mathcal {L} _ {p} = \mathbb {E} _ {q _ {\phi} (\mathbf {Z} | V, \mathbf {A})} [ \log p _ {\theta} (V | \mathbf {Z}) ]. \tag {17} +$$ + +Then the Kullback-Leibler (KL) divergence acts as a regularization for the latent space: + +$$ +\mathcal {L} _ {K L} = - \mathrm {K L} \left[ q _ {\phi} (\mathbf {Z} \mid V) \| p _ {\theta} (\mathbf {Z}) \right]. \tag {18} +$$ + +We omit the superscripts of vectors $V$ and $v$ in Equations 17 - 21, the actual correspondence refers to Sections 4.2 and 4.3. + +In addition to the aforementioned terms which are often utilized as the objective function for VAEs, we introduce extra regularization terms. The regularization term of signal smoothness takes both inferred structure and node features into consideration to eliminate any connection which does not fulfill the smoothness assumption of adjacent node features, such as indirect interactions. We consider input features $V$ as graph signals, and the assumption for graph signals also works here: values change smoothly across adjacent nodes [10]. Therefore, we introduce Dirichlet energy [3] to measure the smoothness between the signals: + +$$ +\Omega (\mathbf {Z}, V) = \frac {1}{n ^ {2}} \sum_ {i, j} \mathbf {Z} _ {i j} \| v _ {i} - v _ {j} \| ^ {2}. \tag {19} +$$ + +It is worth mentioning that in most cases the adjacency matrix is asymmetric, we cannot use Laplacian matrices to simplify the formulation. + +Moreover, we introduce more regularization terms [3, 18] to feature the learned features in latent space with the properties of realistic adjacency matrices, such as connectiveness $\mathcal{L}_d$ and sparsity $\mathcal{L}_s$ . Training the network with these regularization terms encourages our model to further disentangle + +Table 1: AUROC values $(\%)$ of iSIDG and baselines on synthetic networks + +
METHODLILLCYBFTFBF-CV
iSIDG86.2±4.288.1±4.979.5±3.868.3±7.460.2±9.570.7±6.0
NRI70.5±5.075.0±4.764.5±6.259.0±3.655.1±7.659.2±7.4
fNRI73.0±5.377.6±4.967.1±7.063.8±6.959.0±7.164.8±8.2
MPIR46.8±5.649.0±6.431.7±10.947.5±8.040.9±6.149.2±4.0
ACD65.0±5.268.4±4.362.9±3.759.8±6.757.2±7.055.8±6.7
+ +node representations from the latent space and distinguish indirect interactions from direct ones: + +$$ +\mathcal {L} _ {d} = - \frac {1}{n} \mathbf {1} ^ {\top} \log (\mathbf {Z 1}), \text {a n d} \mathcal {L} _ {s} = \frac {1}{n ^ {2}} \| \mathbf {Z} \| _ {F} ^ {2}, \tag {20} +$$ + +where the logarithmic barrier in $\mathcal{L}_d$ forces the model to learn a connected adjacency matrix, but lacks the regularization of sparsity. In consequence, we introduce $\mathcal{L}_s$ to regularize its sparsity. + +To conclude, we train our iSIDG with the hybrid loss $\mathcal{L}$ : + +$$ +\mathcal {L} = \mathcal {L} _ {p} + \mu \cdot \mathcal {L} _ {K L} + \alpha \cdot \Omega (\mathbf {Z}, V) + \beta \cdot \mathcal {L} _ {d} + \gamma \cdot \mathcal {L} _ {s}, \tag {21} +$$ + +where $\{\mu, \alpha, \beta, \gamma\}$ are hyperparameters. The first two terms in Equation 21 formulate a weighted ELBO, which is the training objective for VAEs. The rest of the terms are regularization for the learned adjacency matrix in latent space. Together with the training cycles of fitting and compression, which are connected with relaxations, the hybrid loss function further encourages our iSIDG model to reconstruct the adjacency matrix precisely. We give a detailed discussion on the design methodology of iSIDG on how to effectively eliminate indirect connections in Section A. + +# 5 Experiments + +We test our iSIDG model on three different datasets, and present its ablation study on one of the datasets. Implementation details and further experimental results can be found in Sections B - F. + +# 5.1 Structural Inference on Different Systems + +Datasets. We test our model on the six directed synthetic biological networks [35], namely Linear (LI), Linear Long (LL), Cycle (CY), Bifurcating (BF), Trifurcating (TF), and Bifurcating Converging (BFCV) networks. These networks are essential components that lead to a variety of different trajectories that are commonly observed in differentiating and developing cells [39]. We use BoolODE [35] to simulate the process of developing cells with these synthetic networks, and obtain six groups of trajectories. The features at every node are one-dimensional, i.e., the level of mRNA expression. + +We also test our model on NetSim datasets [43] of simulated fMRI data. The NetSim datasets consist of simulated blood-oxygen-level-dependent imaging data across different regions within the human brain, which leads to asymmetric relation networks. The node features are one-dimensional. + +The last datasets to be mentioned here are three physical simulations mentioned in [22], namely springs, charged particles and phase-coupled oscillators (Kuramoto model). We keep the symmetric interactions in the setting of these networks. However, different from the setting mentioned in that work, we sample the trajectories with fixed interactions between the agents in the system, but with different initial conditions, in order to simulate the real application scenario on the observational data from a specific unknown system. The features at every node are 4-dimensional. + +Baselines and metrics. We compare iSIDG with the state-of-the-art models for structural inference: + +- NRI [22]: a VAE-based model for unsupervised relational inference. +- fNRI [51]: an NRI-based model with additional latent space for every factorized interaction type. +- MPIR [52] a model based on minimum predictive information regularization. +- ACD [30]: a variational model that leverages shared dynamics to infer causal relations. + +We describe the implementation details of the baseline methods in Section B.2. We demonstrate our evaluation results with the following metrics: the area under the receiver operating characteristic (AUROC), the area under the precision-recall curve (AUPRC) and the Jaccard similarity index (JI). We also provide results of two DAG-based structure learning methods on our datasets in Section E. + +Table 2: AUROC values (%) of iSIDG and baselines on physical simulations and NetSim datasets. + +
METHODSpringsParticlesKuramotoNetSim1NetSim2NetSim3
iSIDG90.5±3.978.1±4.979.8±5.575.5±5.272.4±5.271.0±4.2
NRI89.2±2.675.1±2.878.1±4.372.1±3.672.0±4.168.2±3.3
fNRI90.4±1.977.0±3.079.5±5.272.5±4.671.2±5.069.6±3.9
MPIR59.5±3.255.7±4.950.2±6.347.2±3.146.0±3.844.3±1.7
ACD90.1±4.177.9±3.680.5±5.666.7±3.664.0±3.162.9±2.5
+ +![](images/f937da407d071754f18789e970e0d4b6fc9734060f90e840524b3da4aba261f6.jpg) +Figure 2: Reconstruction results of iSIDG with different objective functions on LI dataset. + +![](images/dd98f3e50482092b7c1b87dc412ce3712ff8a91d04bf87fda6eb8431321b34f7.jpg) + +![](images/d4db8a560eee0a01abcb62dbce848ae5ab038904b415ed36f5e54f0deeaf026e.jpg) + +![](images/c50e08762f8eed1be5d209eaa76c387c0f71477f6312dbf2af83a1200958b513.jpg) + +Results. The experimental results of our iSIDG model and baseline methods are summarized in Tables 1 and 2 (also Tables 6 - 9 in Appendix), which consist of mean values and $95\%$ intervals of AUROC, AUPRC and JI from 15 experiments on each, respectively. Due to the alternative simulation pipelines between ours and other literature, we obtain different results of ACD and MPIR on physical simulations from other literature. iSIDG outperforms or matches the baseline methods. In the datasets of synthetic networks and three NetSim datasets, which consist of directed graphs and low dimensional input features, iSIDG outperforms baseline models by at most 13.2 percent in terms of AUROC, showing that it can infer structure more precisely than the baseline methods. These results highlight the validity of integrating the iterative training process and the direction information on structural inference problem for directed graphs. It is also remarkable that iSIDG matches or is slightly inferior to the baseline methods in the datasets of physical simulations, especially fNRI and ACD. The reason may be that high dimensional input features (4-dimensional features for physical simulation datasets) contain richer dynamics for fNRI and other methods to infer from. It is worth mentioning that fNRI method utilizes ground truth to distinguish every latent space and match them to the edge type with the highest accuracy, which results in higher AUROC, AUPRC and JI scores. Moreover, since ACD relies on the information shared by input features, the richer information contained in high dimensional features promotes a more promising result. + +# 5.2 Ablation Study + +We conduct ablation studies on the effectiveness of regularization terms in objective function: signal smoothness $\Omega$ , connectiveness $\mathcal{L}_d$ and sparsity $\mathcal{L}_s$ , and the reconstruction results are shown in terms of heat maps in Figure 2. The heat maps visualize the average results of 15 experiments of iSIDG with different objective functions by deleting one regularization term, respectively. As shown in the second plot in Figure 2, without considering signal smoothness, the indirect interactions emerge again in the results of structural inference with the correctly inferred edges. The third plot in Figure 2 shows that without considering the connectiveness, the model correctly infers only a few direct interactions but as isolated "islands", and connects these islands with numerous indirect interactions. The last plot in Figure 2 demonstrates the results that without the terms to regularize the sparsity, many direct interactions are substituted by the indirect ones. Therefore, the extra regularization terms in the objective function of iSIDG effectively encourage the model to infer realistic graph structures and to eliminate the influence of indirect interactions. More ablation studies can be found in Section D.4. + +# 5.3 Experiments on Scalability and Real-world Datasets + +Although iSIDG works well on small datasets from simulations, such as synthetic networks, physical simulations and NetSim datasets, we are curious about the performance of iSIDG on large datasets and real-world datasets. For this reason, we create another "springs" dataset with 100 nodes (we + +name it as "Springs100"), and with the same settings as the details mentioned in Section C.3. Besides that, we also test our model and baselines on two gene regulatory network (GRN) datasets: ESC dataset [4] and HSC dataset [32]. As a brief description about the GRNs: ESC has 96 nodes and 409 edges, while HSC has 33 nodes and 126 edges. We ran the iSIDG and baseline methods on three datasets for ten rounds, and summarize the averaged AUROC results in Table 3. As shown in the table, our iSIDG still outperforms baseline methods on all of the three datasets. + +Table 3: AUROC values $(\%)$ of iSIDG and baselines on "Springs100", ESC and HSC datasets. + +
METHODSprings100ESCHSC
iSIDG72.7±6.856.7±5.158.6±4.0
NRI67.1±5.939.2±5.042.9±4.3
fNRI68.4±5.539.8±4.545.0±5.0
MPIR35.6±3.230.6±6.237.6±3.3
ACD66.0±5.738.7±4.244.3±4.1
+ +However, we think that iSIDG cannot prove its scalability in a broader view: + +1. Despite the iSIDG performing better than baselines on "Springs100" dataset, the AUROC only values $72.7\%$ , which makes the inferred results to be highly unauthentic for downstream tasks. +2. On ESC dataset, iSIDG can only work better than guessing the existence of edges with equal probability (either exist or not). So that the results are not reliable. +3. Compared with the results shown in Section 5, we observe a significant decline, which suggests that we can extrapolate an even worse inference result on datasets with more nodes. +4. Because the latent space in iSIDG has a fixed size, which means that we have to adopt a larger latent space for larger graphs. Thus the scalability of the iSIDG is limited by VAE as well. + +Therefore, we suggest that iSIDG can be utilized to infer the structure of dynamical systems with tens of nodes. We will investigate the problem of scalability in structural inference in our future work, which is also interesting and of practical value. + +# 6 Future Work + +We so far only consider the structural inference for static and (relatively) small graphs, though we tested the scalability of iSIDG on graphs of 100 nodes. Future research includes introducing dynamic interactions and more scalable model design which remains as a critical challenge in structure learning for dynamical systems. Furthermore, we also want to integrate prior knowledge such as partial structural information to further promote the performance of iSIDG. + +# Acknowledgments and Disclosure of Funding + +This work is partially supported by the Audacity project GENERIC of Institute for Advanced Studies (IAS) at University of Luxembourg. + +# References + +[1] A. A. Alemi, I. Fischer, J. V. Dillon, and K. Murphy. Deep variational information bottleneck. In Proceedings of the 5th International Conference on Learning Representations (ICLR), 2017. +[2] F. Alet, E. Weng, T. Lozano-Pérez, and L. P. Kaelbling. Neural relational inference with fast modular meta-learning. In Proceedings of the 33rd Annual Conference on Neural Information Processing Systems (NeurIPS), pages 11804-11815, 2019. +[3] M. Belkin and P. Niyogi. Laplacian eigenmaps and spectral techniques for embedding and clustering. In Proceedings of the 15th International Conference on Neural Information Processing Systems (NIPS), pages 585-591, 2001. +[4] F. H. Biase, X. Cao, and S. Zhong. Cell fate inclination within 2-cell and 4-cell mouse embryos revealed by single-cell rna sequencing. Genome Research, 24(11):1787-1796, 2014. + +[5] G. Brasó and L. Leal-Taixe. Learning a neural solver for multiple object tracking. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 6247-6257, 2020. +[6] J. Casadiego, M. Nitzan, S. Hallerberg, and M. Timme. Model-free inference of direct network interactions from nonlinear collective dynamics. Nature Communications, 8, 12 2017. +[7] T. E. Chan, M. P. Stumpf, and A. C. Babtie. Gene regulatory network inference from single-cell data using multivariate information measures. Cell Systems, 5(3):251-267.e3, 2017. +[8] P. Chaudhari, A. Oberman, S. Osher, S. Soatto, and G. Carlier. Deep relaxation: partial differential equations for optimizing deep neural networks. Research in the Mathematical Sciences, 5(3):1-30, 2018. +[9] S. Chen, J. Wang, and G. Li. Neural relational inference with efficient message passing mechanisms. In Proceedings of the 35th AAAI Conference on Artificial Intelligence (AAAI), pages 7055-7063, 2021. +[10] Y. Chen, L. Wu, and M. Zaki. Iterative deep graph learning for graph neural networks: Better and robust node embeddings. In Proceedings of the 34th International Conference on Neural Information Processing Systems (NeurIPS), 2020. +[11] B. Fatemi, L. E. Asri, and S. M. Kazemi. SLAPS: self-supervision improves structure learning for graph neural networks. In Proceedings of the 35th Annual Conference on Neural Information Processing Systems (NeurIPS), pages 22667-22681, 2021. +[12] C. Graber and A. G. Schwing. Dynamic neural relational inference for forecasting trajectories. In Proceedings of the 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops, pages 4383-4392, 2020. +[13] S. Ha and H. Jeong. Unraveling hidden interactions in complex systems with deep learning. Scientific Reports, 11(1):1-13, 2021. +[14] W. L. Hamilton. Graph Representation Learning. Synthesis Lectures on Artificial Intelligence and Machine Learning. Morgan & Claypool Publishers, 2020. +[15] B. Ivanovic and M. Pavone. The Trajectory: Probabilistic multi-agent trajectory modeling with dynamic spatiotemporal graphs. In Proceedings of the 2019 IEEE/CVF International Conference on Computer Vision (ICCV), pages 2375-2384, 2019. +[16] W. Jin, Y. Ma, X. Liu, X. Tang, S. Wang, and J. Tang. Graph structure learning for robust graph neural networks. In Proceedings of the 26th ACM SIGKDD Conference on Knowledge Discovery and Data Mining (KDD), pages 66-74. ACM, 2020. +[17] D. D. Johnson. Learning graphical state transitions. In Proceedings of the 5th International Conference on Learning Representations (ICLR), 2017. +[18] V. Kalofolias. How to learn a graph from smooth signals. In Artificial Intelligence and Statistics, pages 920–929. PMLR, 2016. +[19] S. Khanna and V. Y. F. Tan. Economy statistical recurrent units for inferring nonlinear granger causality. In Proceedings of the 8th International Conference on Learning Representations (ICLR), 2020. +[20] S. Kim. Ppcor: An r package for a fast calculation to semi-partial correlation coefficients. Communications for Statistical Applications and Methods, 22:665-674, 11 2015. +[21] D. P. Kingma and M. Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013. +[22] T. Kipf, E. Fetaya, K.-C. Wang, M. Welling, and R. Zemel. Neural relational inference for interacting systems. In Proceedings of the 35th International Conference on Machine Learning (ICML), pages 2688-2697. PMLR, 2018. +[23] T. N. Kipf and M. Welling. Semi-supervised classification with graph convolutional networks. In Proceedings of the 5th International Conference on Learning Representations (ICLR), 2017. +[24] J. Kwapić and S. Drożdź. Physical approach to complex systems. Physics Reports, 515(3): 115-226, 2012. +[25] A. Lamere and J. Li. Leap: Constructing gene co-expression networks for single-cell RNA-sequencing data using pseudotime ordering. Bioinformatics, 33(5):764-766, 2016. + +[26] J. Li, F. Yang, M. Tomizuka, and C. Choi. Evolvegraph: Multi-agent trajectory prediction with dynamic relational reasoning. In Proceedings of the 34th Annual Conference on Neural Information Processing Systems (NeurIPS), 2020. +[27] J. Li, H. Ma, Z. Zhang, J. Li, and M. Tomizuka. Spatio-temporal graph dual-attention network for multi-agent prediction and tracking. arXiv preprint arXiv:2102.09117, 2021. +[28] Y. Li, O. Vinyals, C. Dyer, R. Pascanu, and P. W. Battaglia. Learning deep generative models of graphs. arXiv preprint arXiv:1803.03324, 2018. +[29] Y. Li, C. Meng, C. Shahabi, and Y. Liu. Structure-informed graph auto-encoder for relational inference and simulation. In Proceedings of ICML Workshop on Learning and Reasoning with Graph-Structured Data, page 2, 2019. +[30] S. Löwe, D. Madras, R. Zemel, and M. Welling. Amortized causal discovery: Learning to infer causal graphs from time-series data. arXiv preprint arXiv:2006.10833, 2020. +[31] J. J. McAuley and J. Leskovec. Learning to discover social circles in ego networks. In Proceedings of the 26th Annual Conference on Neural Information Processing Systems (NIPS), pages 548-556, 2012. +[32] V. Moignard, S. Woodhouse, L. Haghverdi, A. J. Lilly, Y. Tanaka, A. C. Wilkinson, F. Buettner, I. C. Macaulay, W. Jawaid, E. Diamanti, et al. Decoding the regulatory network of early blood development from single-cell gene expression measurements. Nature biotechnology, 33(3): 269-276, 2015. +[33] A. Paszke, S. Gross, F. Massa, A. Lerer, J. Bradbury, G. Chanan, T. Killeen, Z. Lin, N. Gimelshein, L. Antiga, A. Desmaison, A. Kopf, E. Yang, Z. DeVito, M. Raison, A. Tejani, S. Chilamkurthy, B. Steiner, L. Fang, J. Bai, and S. Chintala. Pytorch: An imperative style, high-performance deep learning library. In Proceedings of the 33rd Annual Conference on Neural Information Processing Systems (NeurIPS), pages 8024–8035, 2019. +[34] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011. +[35] A. Pratapa, A. P. Jalihal, J. N. Law, A. Bharadwaj, and T. Murali. Benchmarking algorithms for gene regulatory network inference from single-cell transcriptomic data. Nature Methods, 17(2): 147-154, 2020. +[36] B. C. Ross. Mutual information between discrete and continuous data sets. PLOS ONE, 9:1-5, 2014. +[37] L. Ruthotto and E. Haber. An introduction to deep generative modeling. GAMM-Mitteilungen, page e202100008, 2021. +[38] B. Saeed, S. Panigrahi, and C. Uhler. Causal structure discovery from distributions arising from mixtures of dags. In Proceedings of the 37th International Conference on Machine Learning (ICML), pages 8336-8345. PMLR, 2020. +[39] W. Saelens, R. Cannoodt, H. Todorov, and Y. Saeys. A comparison of single-cell trajectory inference methods. Nature Biotechnology, 37(5):547-554, 2019. +[40] T. Schreiber. Measuring information transfer. Physical Review Letters, 85(2):461, 2000. +[41] R. Selvan, T. N. Kipf, M. Welling, J. H. Pedersen, J. Petersen, and M. de Bruijne. Graph refinement based tree extraction using mean-field networks and graph neural networks. arXiv preprint arXiv:1811.08674, 2018. +[42] R. Shwartz-Ziv and N. Tishby. Opening the black box of deep neural networks via information. arXiv preprint arXiv:1703.00810, 2017. +[43] S. M. Smith, K. L. Miller, G. Salimi-Khorshidi, M. Webster, C. F. Beckmann, T. E. Nichols, J. D. Ramsey, and M. W. Woolrich. Network modelling methods for FMRI. Neuroimage, 54(2): 875-891, 2011. +[44] J. Tang, J. Zhang, L. Yao, J. Li, L. Zhang, and Z. Su. Arnetminer: extraction and mining of academic social networks. In Proceedings of the 14th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD), pages 990-998. ACM, 2008. + +[45] A. Tank, I. Covert, N. Foti, A. Shojaie, and E. Fox. Neural Granger Causality. arXiv preprint arXiv:1802.05842, 2018. +[46] N. Tishby and N. Zaslavsky. Deep learning and the information bottleneck principle. In Proceedings of 2015 IEEE Information Theory Workshop (ITW), pages 1-5. IEEE, 2015. +[47] N. Tishby, F. Pereira, and W. Biale. The information bottleneck method. In Proceedings of the 37th Annual Allerton Conference on Communication, Control, and Computing (Allerton), pages 368-377. IEEE, 1999. +[48] M. Tsubaki, K. Tomii, and J. Sese. Compound-protein interaction prediction with end-to-end learning of neural networks for graphs and sequences. Bioinformatics, 35(2):309-318, 2019. +[49] P. Velicković, G. Cucurull, A. Casanova, A. Romero, P. Lio, and Y. Bengio. Graph attention networks. In Proceedings of the 6th International Conference on Learning Representations (ICLR), 2018. +[50] M. J. Vowels, N. C. Camgoz, and R. Bowden. D'ya like dags? a survey on structure learning and causal discovery. arXiv preprint arXiv:2103.02582, 2021. +[51] E. Webb, B. Day, H. Andres-Terre, and P. Lió. Factorised neural relational inference for multi-interaction systems. arXiv preprints arXiv:1905.08721, 2019. +[52] T. Wu, T. Breuel, M. Skuhersky, and J. Kautz. Discovering nonlinear relations with minimum predictive information regularization. arXiv preprint arXiv:2001.01885, 2020. +[53] K. Xu, W. Hu, J. Leskovec, and S. Jegelka. How powerful are graph neural networks? In Proceedings of the 7th International Conference on Learning Representations (ICLR), 2019. +[54] Y. Xue and P. Bogdan. Reconstructing missing complex networks against adversarial interventions. Nature communications, 10(1):1-12, 2019. +[55] P. Yin, S. Zhang, J. Lyu, S. Osher, Y. Qi, and J. Xin. Binaryrelax: A relaxation approach for training deep neural networks with quantized weights. SIAM Journal on Imaging Sciences, 11 (4):2205-2223, 2018. +[56] S.-S. Yu and W.-H. Tsai. Relaxation by the Hopfield neural network. Pattern Recognition, 25 (2):197-209, 1992. +[57] Y. Yu, J. Chen, T. Gao, and M. Yu. DAG-GNN: DAG structure learning with graph neural networks. In Proceedings of the 36th International Conference on Machine Learning (ICML), pages 7154-7163. PMLR, 2019. +[58] Y. Yu, T. Gao, N. Yin, and Q. Ji. DAGs with No Curl: An efficient DAG structure learning approach. In Proceedings of the 38th International Conference on Machine Learning (ICML), pages 12156-12166. PMLR, 2021. +[59] X. Zheng, B. Aragam, P. Ravikumar, and E. P. Xing. DAGs with NO TEARS: continuous optimization for structure learning. In Proceedings of the 32nd Annual Conference on Neural Information Processing Systems (NeurIPS), 2018. +[60] Y. Zhu, W. Xu, J. Zhang, Q. Liu, S. Wu, and L. Wang. Deep graph structure learning for robust representations: A survey. arXiv preprint arXiv:2103.03036, 2021. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] See abstract and last paragraph of Section 1. +(b) Did you describe the limitations of your work? [Yes] Due to page limitation, we describe the limitation of our work with a few words in Section 5.3, and in Section 6. +(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Section G. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] We have read the ethics review guidelines and ensured that our paper conforms to them. + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] See Sections 3 and 4.1. +(b) Did you include complete proofs of all theoretical results? [Yes] The proofs are quite intuitive, see Section 4.1. + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] We attach the link to our code and data in the supplementary documents. We also give instructions about how to reproduce the main experimental results in Section B. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Sections 5 and B. +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] Instead of error bars, we report our experimental results with the mean value and $95\%$ intervals of the results from running the experiments several rounds. We describe the method to obtain the data in Section 5, and the results in Tables 1, 2 and 6-9. +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Section B.1. + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] See Section 5.1. +(b) Did you mention the license of the assets? [Yes] We mention the license in our code. +(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] We include new assets, and they can be found via a URL. +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [No] The datasets are generated with simulations, which has nothing to do with personal data. +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] The data is neutral to biological human being. + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/iterativestructuralinferenceofdirectedgraphs/images.zip b/iterativestructuralinferenceofdirectedgraphs/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..3bf0c180f8080ca2e72f23abeede4fe014563cca --- /dev/null +++ b/iterativestructuralinferenceofdirectedgraphs/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:22dbe8b1e9bfe487ed02c1724905bd62477cdc30d443cd64ef2534392df4cec4 +size 301340 diff --git a/iterativestructuralinferenceofdirectedgraphs/layout.json b/iterativestructuralinferenceofdirectedgraphs/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..af744997094f9ab9fbfd08466d89618eaf638c6d --- /dev/null +++ b/iterativestructuralinferenceofdirectedgraphs/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:58485eac0cedf42063d78544cd9a785f1aa19cdb4d3c45cadcb8a9b7b91869e2 +size 472178 diff --git a/jahsbench201afoundationforresearchonjointarchitectureandhyperparametersearch/9de2cce0-fdbe-424d-a439-b12c246e0177_content_list.json b/jahsbench201afoundationforresearchonjointarchitectureandhyperparametersearch/9de2cce0-fdbe-424d-a439-b12c246e0177_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..a498256526bbcfcbfd294da09f2afb4744f5d9d8 --- /dev/null +++ b/jahsbench201afoundationforresearchonjointarchitectureandhyperparametersearch/9de2cce0-fdbe-424d-a439-b12c246e0177_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:befb8c73d6d6af932ed49648458f2604da329c4e0f5747a71f8a43dc02848d21 +size 76040 diff --git a/jahsbench201afoundationforresearchonjointarchitectureandhyperparametersearch/9de2cce0-fdbe-424d-a439-b12c246e0177_model.json b/jahsbench201afoundationforresearchonjointarchitectureandhyperparametersearch/9de2cce0-fdbe-424d-a439-b12c246e0177_model.json new file mode 100644 index 0000000000000000000000000000000000000000..455828e4a0c5d6266334d0dfbb833de9a2124f0f --- /dev/null +++ b/jahsbench201afoundationforresearchonjointarchitectureandhyperparametersearch/9de2cce0-fdbe-424d-a439-b12c246e0177_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e72835dc6d701e52ffe8da203d16261778498bec24db08a0dd366f3a874dc47f +size 98740 diff --git a/jahsbench201afoundationforresearchonjointarchitectureandhyperparametersearch/9de2cce0-fdbe-424d-a439-b12c246e0177_origin.pdf b/jahsbench201afoundationforresearchonjointarchitectureandhyperparametersearch/9de2cce0-fdbe-424d-a439-b12c246e0177_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..2f670fdc00404a2deebfa11ccedc0750ca52a8bf --- /dev/null +++ b/jahsbench201afoundationforresearchonjointarchitectureandhyperparametersearch/9de2cce0-fdbe-424d-a439-b12c246e0177_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00f1910a71081c04082c9748817960f60522eeecffdbb626a76fdf6bba55147e +size 1087156 diff --git a/jahsbench201afoundationforresearchonjointarchitectureandhyperparametersearch/full.md b/jahsbench201afoundationforresearchonjointarchitectureandhyperparametersearch/full.md new file mode 100644 index 0000000000000000000000000000000000000000..50001e95ed896350a9feabd84db80e5d47f0889e --- /dev/null +++ b/jahsbench201afoundationforresearchonjointarchitectureandhyperparametersearch/full.md @@ -0,0 +1,276 @@ +# JAHS-Bench-201: A Foundation For Research On Joint Architecture And Hyperparameter Search + +Archit Bansal¹ Danny Stoll¹ Maciej Janowski¹ Arber Zela¹ Frank Hutter¹,² + +1University of Freiburg 2Bosch Center for Artificial Intelligence + +{bansala,stolld,janowski,zelaa,fh}@cs.uni-freiburg.de + +# Abstract + +The past few years have seen the development of many benchmarks for Neural Architecture Search (NAS), fueling rapid progress in NAS research. However, recent work, which shows that good hyperparameter settings can be more important than using the best architecture, calls for a shift in focus towards Joint Architecture and Hyperparameter Search (JAHS). Therefore, we present JAHS-Bench-201, the first collection of surrogate benchmarks for JAHS, built to also facilitate research on multi-objective, cost-aware and (multi) multi-fidelity optimization algorithms. To the best of our knowledge, JAHS-Bench-201 is based on the most extensive dataset of neural network performance data in the public domain. It is composed of approximately 161 million data points and 20 performance metrics for three deep learning tasks, while featuring a 14-dimensional search and fidelity space that extends the popular NAS-Bench-201 space. With JAHS-Bench-201, we hope to democratize research on JAHS and lower the barrier to entry of an extremely compute intensive field, e.g., by reducing the compute time to run a JAHS algorithm from 5 days to only a few seconds. + +# 1 Introduction + +In recent years, research on Automated Machine Learning (AutoML) [1] has made great strides in the data-driven design of neural network architectures [2, 3] and training hyperparameters [4]. Arguably, this fast pace of research on AutoML algorithms originates in the availability of several Neural Architecture Search (NAS) and Hyperparameter Optimization (HPO) benchmarks. + +Tabular NAS benchmarks, such as NAS-Bench-101 [5] and NAS-Bench-201 [6], pre-evaluate all configurations in a given architecture search space and provide the results in a large table, which allows researchers to simulate runs of NAS algorithms in seconds on a single CPU-core that would have otherwise taken multiple days on a powerful GPU cluster. The availability of these benchmarks democratized NAS research, enabling small academic labs to work on NAS and allowing scientific comparisons between methods without confounding factors. The concept of tabular NAS benchmarks has also been extended to larger spaces by means of surrogate benchmarks, such as NAS-Bench-301 [7] and NAS-Bench-x11 [8]. + +While the availability of these cheap-to-evaluate NAS benchmarks has fueled the development of NAS algorithms (with more than 1000 papers on NAS in the last two years [9]), this push focused only on NAS in isolation, despite recent work showing that good hyperparameter settings can be more important than using the best architecture [10]. It would thus be much more powerful to treat these problems jointly, in what we thus call Joint Architecture and Hyperparameter Search (JAHS). + +In order to facilitate work on JAHS, we build and release JAHS-Bench-201, an extended version of the popular NAS-Bench-201 architecture space that includes several hyperparameters and supports multi-fidelity, cost-aware and multi-objective optimization. Our individual contributions are: + +Table 1: The parameters of our search (top and middle) and fidelity space (bottom) and how many unique values are available for a given discrete parameter. + +
SpacePropertyDescription# Values
ArchitectureCell SpaceNAS-Bench-20115,625
HyperparameterActivationReLU/Hardswish/Mish3
Learning Rate[10-3, 100]Continuous
Weight Decay[10-5, 10-2]Continuous
Trivial AugmentOn/Off2
FidelityNDepth Multiplier3
WWidth Multiplier3
RResolution Multiplier3
Epoch# Training Epochs200
+ +- We created the most extensive dataset of neural network performance data available in the public domain, composed of approximately 161 million data points, each consisting of 20 performance metrics, across three image classification tasks, while featuring a 14-dimensional search and fidelity space (Section 2). +- Using surrogate models fit on our performance data, we derive benchmarking protocols covering different optimization tasks (three datasets, single/multiple objectives) and algorithmic settings (black-box, cost-aware, multi-fidelity, multi multi-fidelity). (Section 3) +- Our benchmark allows the study of several fundamental research questions in the JAHS domain, such as how important it is to optimize jointly in the space of architectures and hyperparameters, or how helpful different fidelity dimensions are (Section 4). + +We provide access to our data and code to use our benchmarks alongside respective documentation at https://github.com/automl/jahs_bench_201. Finally, to further encourage research on JAHS, we maintain leaderboards for JAHS-Bench-201 at our aforementioned repository and provide first entries for them using simple baselines. + +# 2 Design space, data collection, and surrogate modelling + +We first describe the JAHS-Bench-201 design space of neural architectures, hyperparameters, and fidelity parameters. Then, we describe how we recorded 20 metrics for 270000 configurations each on three image classification datasets and how we built surrogate models with this data. + +# 2.1 Design space + +The design space of JAHS-Bench-201 has two components: The search space and the fidelity space. The search space comprises the joint architecture and hyperparameter space of the JAHS problem, whereas the fidelity space comprises parameters that directly alter the training cost with some trade-off in performance. We include these fidelity parameters in our design space to support benchmarking of multi-fidelity algorithms [11-14] that use cheap, but low-fidelity, evaluations to gather knowledge quickly and thereby achieve speedups. Going beyond previous work in multi-fidelity optimization, we also introduce a multi multi-fidelity setting where the fidelity space has multiple (in our case four) dimensions that can be exploited. + +Search space We use the cell-based architecture search space from the popular and widely used tabular benchmark NAS-Bench-201 [6], which uses a directed acyclic graph with 4 vertices and 6 edges connecting them, for each of which there is a choice between an operation from the set of {skip-connect, zero, 1x1-conv, 3x3-conv, 3x3-avg-pool}. This accounts for a total of $5^6 = 15625$ possible architectures. See Appendix A for an illustration. + +Our hyperparameter space consists of a mix of categorical and continuous hyperparameters. As categorical hyperparameters, we added a choice between 3 activation functions (Mish [15], Hardswish [16] or ReLU [17]) in the convolution layers, as well as the choice to enable or disable + +Table 2: Overview of the image classification datasets we use in JAHS-Bench-201. "Base Image Size" refers to the image size corresponding to the highest fidelity we use. + +
CIFAR-10Colorectal-HistologyFashion-MNIST
# Images60,0005,00070,000
# Classes10810
Original Image Size32x32x3150x150x328x28x1
Train-Valid-Test split40-40-2063-27-1063-27-10
Base Image Size32x32x332x32x332x32x1
+ +the use of Trivial Augment [18] for data augmentation in the training pipeline. For continuous hyperparameters, we added the choice of learning rate and weight decay. See Table 1 for a summary of the full search space. The original NAS-Bench-201 search space used ReLU activations only, did not use Trivial Augment, and used fixed values for learning rate and weight decay. + +Fidelity space To support benchmarking of multi-fidelity algorithms [11-14], we consider four fidelity parameters that alter the training cost and performance: two architectural parameters controlling the network's modelling capacity, one to control the size of the input, and finally, the number of training epochs. We parameterised the cell architecture in order to represent two inherent properties of a neural network's modelling capacity - the network depth and the network width. Each cell may be repeated $N \in \{1, 3, 5\}$ times within a single block of the neural architecture. We call $N$ the depth-multiplier. The first convolution layer of any cell contains $W \in \{4, 8, 16\}$ filters, with the number of filters doubling in every subsequent convolution layer in the same cell. Thus, we call $W$ the width-multiplier. We note that, as in NAS-Bench-201, a single model contains only a single cell architecture. Additionally, to represent the impact of performing the same task on images of different sizes, we scaled the input images to different resolutions beforehand. This is denoted by the resolution-multiplier $R \in \{0.25, 0.5, 1.0\}$ . Here, $R$ is the fraction of the base image resolution that all inputs were scaled to before training, where base image resolution refers to the maximum square image size we use, which may or may not correspond to the native size of the images in that dataset (see Table 2). Since we recorded metrics for every epoch of training and evaluation, we can query the performance of every configuration at any epoch up to epoch 200. Therefore, we can use the number of epochs as a fidelity parameter, epoch $\in \{1, 2, \dots, 200\}$ . This number of epochs is indeed one of the most commonly used fidelity parameters in multi-fidelity optimization [14, 19]. + +# 2.2 Data collection and recorded metrics + +We used three image classification tasks: CIFAR-10 [20], Colorectal-Histology [21] and Fashion-MNIST [22] (see Table 2), and for each task we randomly sampled 270 000 configurations from the design space and recorded 20 metrics at each epoch for every configuration, for both training and evaluation. As we ran 200 epochs of training, we, therefore, collected more than 161 million data points (see calculation below). In Section 2.3 we describe how we use the collected data to create surrogate models for JAHS-Bench-201. The performance metrics consist of values, such as the average runtime requirements for a single forward or backward pass per minibatch, the model loss and accuracy on each data split, etc. (We summarize them in Table 3.) See Appendix B for a full description of our training pipeline, including the fixed hyperparameters. + +The benchmark dataset is thus queryable at any of the 200 epochs for any of these metrics, over the $3 \times 3 \times 3 = 27$ unique groups of values of the other three fidelity parameters (hereafter referred to as fidelity groups), and for up to 10 000 configurations over all the fidelity groups. Some configurations diverged before reaching 200 epochs of training; for these configurations, we only include the data until divergence. Combining three image classification tasks, 270 000 configurations per task and 200 data points per configuration amounts to a theoretical maximum of $162 \times 10^{6}$ possible data points (ignoring divergent configurations) and our dataset currently contains approximately $161 \times 10^{6}$ (161 million). We also discovered significant noise in the performance dataset for the Colorectal-Histology task and discuss this further in Appendix F. + +Table 3: Summary of all metrics recorded in the benchmark dataset. The "Duration" metrics correspond to the average per-minibatch runtime cost of each epoch, "Loss" corresponds to the average Cross-Entropy loss and "Accuracy" corresponds to top-1 classification accuracy of each epoch. "FLOPS" and "Size" are calculated for the model as a whole. "Latency" is calculated as a per-datapoint running average every epoch. "Runtime" is the total cumulative time at each epoch that training and evaluation took, including any overheads not accounted for in "Duration". + +
MetricSplitsDescription
DurationTrain/Valid/TestSum of the components (seconds)
Load dataTrain/Valid/TestMini-batch transfer overheads within system memory
ForwardTrain/Valid/TestForward pass duration
BackpropTrainBackward pass duration
LossTrain/Valid/TestLoss metric value
AccuracyTrain/Valid/TestTop-1 accuracy (percentages)
FLOPS-Floating Point Operations per Second
Latency-Average model latency
Runtime-Total runtime, including all overheads
Size-Estimated model size (MB)
+ +# 2.3 Surrogate models + +As is common in benchmarking for Neural Architecture Search and Hyperparameter Optimization, to expand the scope of queries that our benchmark supports beyond just the samples present in the performance dataset, we utilize surrogate models fit on our collected data [7, 8, 23]. Based on the excellent results of surrogate models based on gradient boosting for both NAS benchmarks [24] and HPO benchmarks [23], we chose to use XGBoost [25] with optimized hyperparameters. We optimize over the same hyperparameter space as Mehta et al. [24] and use Bayesian optimization [26] with expert priors [27] as implemented in the NePS python package [28]. We trained a separate model for each metric. To validate our surrogate models, we again follow Mehta et al. [24] and list Kendall Rank Correlation Coefficients (Kendall's $\tau$ ) and Coefficient of Determination ( $R^2$ ) scores in Table 4. We generally observe high scores; for CIFAR-10, for instance, Kendall's $\tau$ values up to 0.994 and $R^2$ scores as high as 0.998. Since a subset of the metrics present in the performance dataset can be subsumed by others, we chose to predict only 7 of the 20 available metrics. We list further details, such as how the training, validation and testing splits were generated, in Appendix C. + +Table 4: We report the Kendall's $\tau$ correlation values and $R^2$ regression scores for the final surrogate models that we trained, for all 3 tasks and all 7 metrics for which surrogates were trained. + +
MetricCIFAR-10Colorectal-HistologyFashion-MNIST
Kendall's τR2Kendall's τR2Kendall's τR2
FLOPS0.9940.9970.8360.6090.9970.999
Latency0.9440.6900.7850.5670.9770.977
Runtime0.9540.9070.7250.5560.9830.992
Size (MB)0.9700.9980.9921.0000.9940.999
Test-Accuracy0.8920.9530.6910.7720.9070.953
Train-Accuracy0.9130.9670.7610.7990.9770.986
Valid-Accuracy0.8900.9530.6820.7660.9220.957
+ +# 3JAHS-Bench-201 + +Here, we use the design space and surrogate models introduced in Section 2 to define the benchmarks and corresponding evaluation settings that make up JAHS-Bench-201. We provide code to use JAHS-Bench-201 and follow our evaluation protocols alongside documentation at https://github.com/automl/jahs_bench_201. For all benchmarks and evaluation settings, + +Table 5: A comparison of the compute requirements of surrogate-based experiments (values reported in CPU-seconds) vs training-based experiments (values reported in GPU-days). + +
TaskSurrogate-based [CPU-s]Training-based [GPU-d]
CIFAR-102.85.0
Colorectal-Histology2.90.4
Fashion-MNIST2.72.5
+ +we maintain leaderboards as described in our code repository and provide first entries with random search and Hyperband [29]. + +**Optimization tasks** We consider six optimization tasks in JAHS-Bench-201. For each of the three datasets (Table 2) we consider single-objective optimization (maximizing validation accuracy) and multi-objective optimization (finding the best trade-offs between high validation accuracy and low latency). While our surrogate models and our code allow for even more tasks, here, we focus on the most important ones that we also include in the JAHS-Bench-201 evaluation protocol below. + +Algorithmic settings JAHS-Bench-201 supports benchmarking in most algorithmic settings, however, we explicitly take into account the following four classes of algorithms that we maintain leaderboards for: black-box algorithms [30-32], cost-aware algorithms [33], multi-fidelity algorithms [14, 34, 35], and multi multi-fidelity algorithms [12]. Therefore, with 4 algorithmic settings and 6 optimization tasks, we maintain a total of 24 leaderboards. + +Evaluation protocol We accompany JAHS-Bench-201 with evaluation protocols and code to aid following these protocols, to facilitate fair, reproducible, and methodologically sound comparisons. Studies with JAHS-Bench-201 should report on all three datasets and present results as trajectories of best validation error (single-objective) or hypervolume (multi-objective). To allow using the same evaluation protocol and comparisons across the various algorithmic settings above, these trajectories should be reported across total runtime taking into account the training and evaluation costs predicted by the surrogate benchmark. We suggest to report until a runtime corresponding to approximately 100 evaluations (see Appendix D) and, for interpretability, show the total runtime divided by the mean runtime of one evaluation. Further, in (multi) multi-fidelity runs utilizing epochs, we support both using continuations from few to many epochs (to simulate the checkpointing and continuation of the model) as well as retraining from scratch for optimizers that do not support continuations. Results should report the mean and standard error around the mean and feature a minimum of 10 seeds. + +Runtime comparison In Table 5, we compare the CPU-routine of a surrogate-based versus training-based run of random search, averaged across 100 different seeds, reiterating the speed-ups achievable by utilizing a surrogate model. + +# 4 Experiments + +In this section, we use JAHS-Bench-201 and the evaluation protocol in Section 3 to tackle three research questions about the Joint Architecture and Hyperparameter Search (JAHS) problem. We provide experimental details in Appendix D. + +Is it helpful to jointly optimize architecture and hyperparameters? In our first experiment, we explore the motivation behind JAHS and compare two algorithms, random search and Bayesian Optimization (BO) [31], on the joint space to an HPO space and a NAS space. We construct the latter two by constraining our JAHS space, hereby calling the derived spaces "HPO-only" and "NAS-only", respectively. Specifically, for NAS-only, we need to decide on a fixed hyperparameter setting (as any NAS would have to); to avoid introducing any bias by this choice, we sample a new random hyperparameter setting for each seed of NAS-only. Analogously, in the case of HPO-only, we sample a random fixed architecture for each seed. We find that JAHS outperforms HPO-only and NAS-only in terms of both anytime and final performance across all datasets (Figure 1 and Figure 2), sometimes with very substantial differences. We observe that, when using random search, for instance, in order to produce configurations that achieve a similar level of accuracy on a given task, JAHS can be expected to be 33 times faster than HPO-only and 29 times faster than NAS-only; see Table 9 + +![](images/87d33ff36152e88f26146c3828de5374466337c1370171594f563b37f509bb1e.jpg) +Figure 1: Mean validation error of random search applied to a NAS space, an HPO space, and the joint space (JAHS). Error bounds correspond to the standard error across 100 seeds. For each seed of NAS-only we sample fixed hyperparameter settings randomly, and, similarly, for HPO-only a fixed architecture. + +![](images/5c2a449bc48e7948871e3ee75d19ec49e40eeb4243b59bacf0fedb8bb2458541.jpg) + +![](images/d8bd42baa353e6535b57dffb763b68d8c24f5c9cf4c4b9bb55489520331c9371.jpg) + +![](images/6933e8fd18b5b368a48bc35115774dccdf7a0bc5ba55daa6271c8fa001e3948d.jpg) +Figure 2: Mean validation error of Bayesian Optimization (BO) applied to a NAS space, an HPO space, and the joint space (JAHS). Error bounds correspond to the standard error across 100 seeds. For each seed of NAS-only we sample fixed hyperparameter settings randomly, and, similarly, for HPO-only a fixed architecture. + +![](images/811071480998b82332c23a524ad2b4bb4fc7cdfd5396058f6266dccb99bd1028.jpg) + +![](images/15c2f9cbfb6db0ccafddc6e1ad070ad650760ce56fdf84907762c5e727eed616.jpg) + +and Table 10 for exact performance speedups. JAHS also exhibits lower noise, indicating more robustness over HPO-only and NAS-only. Therefore, the answer to our research question is: Yes, in the JAHS-Bench-201 setting it is helpful to optimize the architecture and its hyperparameters jointly. + +Are some fidelities more useful than others? While multi-fidelity optimization promises speedups, it is often unclear which fidelity parameter to choose for deep learning to achieve the largest speedups, with the number of epochs as a natural default choice. To compare the impact of different fidelity parameters, we run a common multi-fidelity algorithm, Hyperband [29] and its model-based implementation in SMAC [31], once for each of the four fidelity parameters in our design space. To set a baseline for multi-fidelity optimization, we run Hyperband traversing on the fidelity hypercube diagonal (Figure 3 and Figure 4). We find that the different individual fidelity parameters lead to indistinguishable results on CIFAR-10 and Fashion-MNIST. On Colorectal-Histology, the + +width-multiplier performs worst in the model-free search, whereas the depth-multiplier performs best in model-based search. We find that diagonal traversal in the fidelity space does not bring speedups over single-fidelity optimization. Moreover, we find that in model-based search, diagonal traversal may even hinder the optimization (Figure 4). The answer to our research question is thus: All four choices of fidelity perform similarly well, with the width multiplier performing worse in one case. Since the default choice of number of epochs is not the only choice of fidelity that performs well, we expect that future work exploiting several of the fidelity choices at once in a more sophisticated multi multi-fidelity approach may lead to substantial further speedups. + +![](images/681ae3d09a138b2828feb8e8b1dbcf672e65ca2f3b61fc21ebe4d1e38d62c55d.jpg) +— Epochs — Resolution multiplier — Diagonal traversal + +Approx. Full Evaluations +![](images/d7696f1f1e6a23ce3aea828ce02317de48929362da2887905a595fd67003d1fb.jpg) +Depth multiplier Width multiplier + +![](images/050b83e7d5e2cada8917da5958898f907f45e48d24310f425fb348f84de6a1ad.jpg) + +Figure 3: Mean validation error of Hyperband for the different fidelity parameters in JAHS-Bench-201. Error bounds correspond to the standard error across 100 seeds +![](images/6000e91435b0aa25947cfb9b8a39dafd930beb04670f1a0d781cbb7c8f818c0f.jpg) +— Epochs — Resolution multiplier — Diagonal traversal + +Approx. Full Evaluations +![](images/3fe5d3bc93e0d82e8c43702a372eab3501449b0d9a71fc4a5fd30b2c4ae60827.jpg) +Depth multiplier Width multiplier + +![](images/96b3eabff786b583d0fbf146f90cdef4c86cb32be078597cb53b14ea09a4f480.jpg) +Figure 4: Mean validation error of model-based Hyperband for the different fidelity parameters in JAHS-Bench-201. Error bounds correspond to the standard error across 100 seeds. + +How correlated are the various metrics we collected to each other? Even though we collect a large number of metrics, a number of them are intuitively closely related to each other. In order to + +study this empirically, we examine the Kendall's tau rank correlation of our performance metrics and clearly observe that our metrics can be broadly clustered into two groups of highly correlated metrics (Figure 5). + +![](images/ef31eee33315851b1e6818934d4e8f24ebfe8dd9f77bd4c973c86f819379cd37.jpg) +Figure 5: Kendall's tau rank correlations between different metrics for the task CIFAR-10. Each row and column corresponds to one of the metrics we collected, represented using two sets of color codes for ease of visualization. The codes for "split" represent if a metric is associated with one of the sub-splits of the task or the model as a whole, whereas the "type" codes represent the type of metric from one of 4 broad categories that our metrics were divided into. The dendrogram on the left indicates a grouping of the rows based on similarity of the entire row. + +# 5 Related benchmarks + +While there already exists a long line of research that tackles easy and accessible benchmarking in NAS [5, 6, 36, 37, 8, 38-40] and HPO [41, 23, 42, 43] [44] separately, benchmarking in the joint NAS and HPO space has not been extensively adopted by the community yet, mainly due to the scarcity of algorithms that operate in such a joint space. In contrast, various pure special-case NAS benchmarks have been constructed by the NAS community due to the increasing popularity of NAS [45]; these tackle different tasks and spaces, such as NAS-Bench-ASR [39] for speech recognition, NAS-Bench-NLP [38] for natural language processing, HW-NAS-Bench [46] for hardware-aware NAS, TransNAS-Bench-101 [47] and NAS-Bench-360 [48] for a multitude of diverse tasks and spaces, and NAS-Bench-x11 [8] for learning curve predictions. + +Despite the scarcity of JAHS algorithms, there already exists first work on benchmarks in this domain. NAS-HPO-Bench [49], LCBench [50] and NAS-HPO-Bench-II [51] are notable forerunners of JAHS-Bench-201. However, our work offers a broader support compared to these benchmarks in many dimensions, such as multi-fidelity and multi-objective support, the broader nature of the hyperparameter space, and the number of stored evaluations in the benchmark (with ours being roughly 700 times larger than the previous largest one, NAS-HPO-Bench-II). In Table 6, we provide a comparison to other benchmarks (including some prominent pure NAS benchmarks) to demonstrate their similarities and differences with our work. We note that, compared to NAS-Bench-HPO + +Table 6: A broad comparison of some of the features of benchmarks that are very closely related to ours. For brevity, we used these abbreviations: JAHS-Bench-201 → Ours, NAS-HPO-Bench → NHB, NAS-HPO-Bench-II → NHBII, NAS-Bench-101 → NB101, NAS-Bench-201 → NB201, NAS-Bench-301 → NB301, NATS-Bench → NATSB. "Size Arch. Space" and "Size HP Space" refer to how many unique values are possible within the architecture and hyperparameter search spaces, respectively. We use these symbols: $(\dagger)$ only the topology space is considered here, the size space [40] is considered the fidelity space; $(\ddagger)$ details on the number of seeds were not given, thus, this is only the number of available architectures; $(\ast)$ epochs is supported, but not full learning curves; $(\S)$ only the size search space provides multi-fidelity support. + +
OursNHBNHBIINB101NB201NB301NATSB
Size Arch. Space15.6K1444K423K15.6K\( 10^{18} \)\( 15.6\mathrm{K}^{\dagger} \)
Size HP SpaceContinuous43248----
# Evaluations161M62K192K5M\( 33\mathrm{K}^{\ddagger} \)60K\( 145\mathrm{K}^{\ddagger} \)
# Metrics207354911
Multi-Fidelity?YesYesPartial*Partial*YesNoYes$
# Fidelity Params41111-\( 3^{\S} \)
Multi-Objective?YesYesPartialYesYesYesYes
Surrogate?YesNoYesNoNoYesNo
+ +Table 7: A comparison of NAS-HPO-Bench-II, JAHS-Bench-201 and NAS-Bench-201. (*) denotes that full information on the number of seeds for all datasets is not available for NAS-Bench-201, so we indicate the number of evaluations on CIFAR-10 only. + +
PropertyNAS-HPO-Bench-IINAS-Bench-201JAHS-Bench-201
Cell Space size4,09615,62515,625
Batch Size6 values--
Learning Rate8 values-Continuous
Weight Decay--Continuous
Trivial Augment--On/Off
Fidelities--Epochs, N, W, R
#Tasks133
# Trained config4.8K32.8K*810K
+ +and NAS-Bench-HPO-II, JAHS-Bench-201 covers a larger space in both the architectural and hyperparameters axes, with some of the hyperparameters being continuous, for which we use a surrogate model to model the space. Moreover, we store 20 metrics in our evaluations, more than any other previous benchmark. By storing the metrics' values at each epoch we enable full learning curve support, and not only partial on a handful of epochs like NAS-HPO-Bench-II does. JAHS-Bench-201 strictly extends NAS-Bench-201 [6], by adding continuous and discrete hyperparameter dimensions, as well as multiple fidelities, objectives and tasks. In Table 7, we provide the ranges for our space and compare it in more detail to NAS-HPO-Bench-II and NAS-Bench-201. + +Most works in the benchmark literature support a single fidelity parameter, the number of epochs of training of a configuration [50, 6, 5], allowing a user to query either full or partial learning curves. NATS-Bench [40] approached multi-fidelity support in a novel way and implemented a parameter for network width, directly comparable with $W$ in our work, in a way that allows it to support up to $8^{5}$ unique values, in addition to the number of training epochs. However, this also splits their search space into two spaces with some overlap. In contrast, JAHS-Bench-201 is able to provide full support for all 4 of our fidelity parameters across our entire joint NAS and HPO search space. + +Most benchmarks in the literature record multiple metrics for their configurations' performance [40, 42, 50], which all have the potential to support multi-objective optimization algorithms. However, supporting multiple metrics does not necessarily translate into effective support for multi-objective optimization, as some metrics may completely subsume each other. For instance, NAS-HPO-Bench-II only provides the training and validation accuracies, which tend to be highly correlated, + +and are not typically the scope of multi-objective optimization. Conversely, HW-NAS-Bench [46] demonstrates innovative and effective use of true multi-objective optimization for the NAS-Bench-201 and FBNet [52] contexts. + +# 6 Conclusion and discussion + +Recent work in the Neural Architecture Search (NAS) community [10] and our own experiments call for a shift in focus towards Joint Architecture and Hyperparameter Search (JAHS). To facilitate this shift, we provide a collection of cheap-to-evaluate surrogate benchmarks, JAHS-Bench-201, that support a broad range of algorithmic frameworks and optimization tasks, including multi-objective, cost-aware, multi-fidelity, and multi multi-fidelity optimization. + +While we expect JAHS-Bench-201 to contribute to fast progress on JAHS, there are limitations to it and our methodology. Firstly, as JAHS-Bench-201 extends NAS-Bench-201[6] with a fidelity and hyperparameter space, we inherit its scope for included architectures. We chose this architecture search space primarily due to the popularity it enjoys in benchmarking for NAS, thereby enabling NAS researchers who wish to work on JAHS to have a familiar starting point. For a more holistic evaluation of JAHS algorithms, the research community should explore additional search spaces. Secondly, while we collected many potential objectives, a large number of them are highly correlated (see Figure 5), leading to clusters of similar metrics and limited options to create multi-objective tasks. Thirdly, due to the breadth of different types of algorithmic settings we support with our 24 leaderboards, we do not consider a wide array of algorithms for each of these in our experiments and initial leaderboard entries, but we encourage users of our benchmarks to develop JAHS algorithms for their specific setting of interest to populate the leaderboards. Fourthly, as we detail further in Appendix F, there is some noise in the performance data for the Colorectal-Histology task. Our surrogate models for this task perform well given the circumstances, but still underperform as compared to those for CIFAR-10 and Fashion-MNIST. Finally, larger hyperparameter search spaces than the one we considered could prove very useful, but were not feasible for our work since every added hyperparameter adds to the burden of compute requirements. Thus, we leave extending our search space to future work. + +# Acknowledgements and disclosure of funding + +Robert Bosch GmbH is acknowledged for financial support. We gratefully acknowledge support by BMBF grant DeToL, by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under grant number 417962828, by TAILOR, a project funded by the EU Horizon 2020 research and innovation programme under GA No 952215, and by European Research Council (ERC) Consolidator Grant "Deep Learning 2.0" (grant no. 101045765). Funded by the European Union. Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or the ERC. Neither the European Union nor the ERC can be held responsible for them. The authors gratefully acknowledge the Gauss Centre for Supercomputing e.V. (www. gauss-centre.eu) for funding this project by providing computing time on the GCS Supercomputer SuperMUC-NG at Leibniz Supercomputing Centre (www.1rz.de). + +![](images/a6f1fa76a674abe0dbec6bd42f07bd48e0c41d9d4adc5197d747d17730811bfe.jpg) + +# Funded by the European Union + +# References + +[1] F. Hutter, L. Kotthoff, and J. Vanschoren, editors. Automated Machine Learning: Methods, Systems, Challenges. Springer, 2019. Available for free at http://automl.org/book. +[2] T. Elsken, J. Metzen, and F. Hutter. Neural Architecture Search: A survey. Journal of Machine Learning Research, 20(55):1-21, 2019. +[3] H. Benmeziane, K. El Maghraoui, H. Ouarnoughi, S. Niar, M. Wistuba, and N. Wang. A comprehensive survey on Hardware-aware Neural Architecture Search. arXiv:2101.09336 [cs.LG], 2021. +[4] M. Feurer and F. Hutter. Hyperparameter Optimization. In Hutter et al. [1], chapter 1, pages 3 - 38. Available for free at http://automl.org/book. + +[5] C. Ying, A. Klein, E. Christiansen, E. Real, K. Murphy, and F. Hutter. NAS-Bench-101: Towards reproducible Neural Architecture Search. In K. Chaudhuri and R. Salakhutdinov, editors, Proceedings of the 36th International Conference on Machine Learning (ICML'19), volume 97, pages 7105-7114. Proceedings of Machine Learning Research, 2019. +[6] X. Dong and Y. Yang. NAS-Bench-201: Extending the scope of reproducible Neural Architecture Search. In Proceedings of the International Conference on Learning Representations (ICLR'20) icl [53]. Published online: iclr.cc. +[7] J. Siems, L. Zimmer, A. Zela, J. Lukasik, M. Keuper, and F. Hutter. NAS-bench-301 and the case for surrogate benchmarks for Neural Architecture Search. arXiv:2008.09777v4 [cs.LG], 2020. +[8] S. Yan, C. White, Y. Savani, and F. Hutter. NAS-Bench-x11 and the power of learning curves. Advances in Neural Information Processing Systems, 34, 2021. +[9] D. Deng and M. Lindauer. Literature on Neural Architecture Search. https://www.automl.org/automl/literature-on-neural-architecture-search/, 2022. [Online; accessed 06-June-2022]. +[10] A. Yang, P. Esperança, and F. Carlucci. NAS evaluation is frustratingly hard. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id=HygrdpVKvr. +[11] K. Kandasamy, G. Dasarathy, J. Oliva, J. Schneider, and B. Póczos. Gaussian Process Bandit optimization with Multi-fidelity evaluations. In D. Lee, M. Sugiyama, U. von Luxburg, I. Guyon, and R. Garnett, editors, Proceedings of the 29th International Conference on Advances in Neural Information Processing Systems (NeurlIPS'16), pages 992-1000. Curran Associates, 2016. +[12] K. Kandasamy, G. Dasarathy, J. Schneider, and B. Poczos. Multi-fidelity Bayesian Optimisation with Continuous Approximations. In D. Precup and Y. Teh, editors, Proceedings of the 34th International Conference on Machine Learning (ICML'17), volume 70, pages 1799-1808. Proceedings of Machine Learning Research, 2017. +[13] L. Li, K. Jamieson, G. DeSalvo, A. Rostamizadeh, and A. Talwalkar. Hyperband: Bandit-based configuration evaluation for Hyperparameter Optimization. In International Conference on Learning Representations, 2017. +[14] S. Falkner, A. Klein, and F. Hutter. BOHB: Robust and efficient Hyperparameter Optimization at scale. In J. Dy and A. Krause, editors, Proceedings of the 35th International Conference on Machine Learning (ICML'18), volume 80, pages 1437-1446. Proceedings of Machine Learning Research, 2018. +[15] D. Misra. Mish: A self regularized non-monotonic activation function. arXiv preprint arXiv:1908.08681[cs.LG], 2019. +[16] A. Howard, M. Sandler, G. Chu, L. Chen, B. Chen, M. Tan, W. Wang, Y. Zhu, R. Pang, V. Vasudevan, et al. Searching for MobileNetV3. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 1314-1324, 2019. +[17] R. HR. Hahnloser, R. Sarpeshkar, M. A. Mahowald, R. J. Douglas, and H. S. Seung. Digital selection and analogue amplification coexist in a cortex-inspired silicon circuit. nature, 405(6789):947-951, 2000. +[18] Samuel G. Müller and Frank Hutter. Trivialaugment: Tuning-free yet state-of-the-art data augmentation. In Proceedings of the 24nd IEEE/CVF International Conference on Computer Vision (ICCV'21), pages 774-782. cvfandiee, IEEE, 2021. +[19] K. Jamieson and A. Talwalkar. Non-stochastic best arm identification and Hyperparameter Optimization. In A. Gretton and C. Robert, editors, Proceedings of the Seventeenth International Conference on Artificial Intelligence and Statistics (AISTATS'16), volume 51. Proceedings of Machine Learning Research, 2016. +[20] A. Krizhevsky. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009. +[21] J. N. Kather, C. Weis, F. Bianconi, S. M. Melchers, L. R. Schad, T. Gaiser, A. Marx, and F. G. Zöllner. Multi-class texture analysis in colorectal cancer histology. *Scientific reports*, 6(1):1-11, 2016. +[22] H. Xiao, K. Rasul, and R. Vollgraf. Fashion-MNIST: a novel image dataset for benchmarking Machine Learning algorithms. arXiv:1708.07747v2 [cs.LG], 2017. +[23] K. Eggensperger, F. Hutter, H. Hoos, and K. Leyton-Brown. Efficient benchmarking of hyperparameter optimizers via surrogates. In B. Bonet and S. Koenig, editors, Proceedings of the Twenty-ninth AAAI Conference on Artificial Intelligence (AAAI'15), pages 1114-1120. AAAI Press, 2015. + +[24] Y. Mehta, C. White, A. Zela, A. Krishnakumar, G. Zabergja, S. Moradian, M. Safari, K. Yu, and F. Hutter. NAS-Bench-Suite: NAS evaluation is (now) surprisingly easy. In Proceedings of the International Conference on Learning Representations (ICLR'22) icl [54]. URL https://openreview.net/forum? id=0DLwqQLmqV. Published online: iclr.cc. +[25] T. Chen and C. Guestrin. Xgboost: A scalable tree boosting system. In B. Krishnapuram, M. Shah, A. Smola, C. Aggarwal, D. Shen, and R. Rastogi, editors, Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD'16), pages 785-794. ACM Press, 2016. +[26] J. Mockus, V. Tiesis, and A. Zilinskas. The application of Bayesian methods for seeking the extremum. Towards Global Optimization, 2(117-129), 1978. +[27] C. Hvarfner, D. Stoll, A. Souza, L. Nardi, M. Lindauer, and F. Hutter. $\pi$ BO: Augmenting Acquisition Functions with User Beliefs for Bayesian Optimization. In Proceedings of the International Conference on Learning Representations (ICLR'22) icl [54]. Published online: ic1r.cc. +[28] D. Stoll, S. Schrodi, M. Janowski, N. Mallik, R. Bixin, T. Vallaeys, and F. Hutter. Neural Pipeline Search (NePS), May 2022. URL https://github.com/autom1/neps. +[29] L. Li, K. Jamieson, G. DeSalvo, A. Rostamizadeh, and A. Talwalkar. Hyperband: A novel bandit-based approach to Hyperparameter Optimization. Journal of Machine Learning Research, 18(185):1-52, 2018. +[30] E. Real, A. Aggarwal, Y. Huang, and Q. V. Le. Regularized evolution for image classifier architecture search. In Proceedings of the aai conference on artificial intelligence, volume 33, pages 4780-4789, 2019. +[31] M. Lindauer, K. Eggensperger, M. Feurer, A. Biedenkapp, D. Deng, C. Benjamins, T. Ruhkopf, R. Sass, and F. Hutter. SMAC3: A versatile bayesian optimization package for Hyperparameter Optimization. Journal of Machine Learning Research, 23(54):1-9, 2022. +[32] D. Eriksson, M. Pearce, J. Gardner, R. Turner, and M. Poloczek. Scalable global optimization via local bayesian optimization. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Proceedings of the 32nd International Conference on Advances in Neural Information Processing Systems (NeurIPS'19). Curran Associates, 2019. +[33] E. H. Lee, V. Perrone, C. Archambeau, and M. W. Seeger. Cost-aware Bayesian Optimization. CoRR, abs/2003.10870, 2020. URL https://arxiv.org/abs/2003.10870. +[34] N. Awad, N. Mallik, and F. Hutter. DEHB: Evolutionary hyperband for scalable, robust and efficient Hyperparameter Optimization. In Z. Zhou, editor, Proceedings of the 30th International Joint Conference on Artificial Intelligence (IJCAI'21), pages 2147-2153, 2021. +[35] A. Klein, L. C. Tiao, T. Lienart, C. Archambeau, and M. Seeger. Model-based asynchronous Hyperparameter and Neural Architecture Search. arXiv preprint arXiv:2003.10865, 2020. +[36] A. Zela, J. Siems, and F. Hutter. NAS-Bench-1Shot1: Benchmarking and dissecting One-shot Neural Architecture Search. In Proceedings of the International Conference on Learning Representations (ICLR'20) icl [53]. URL https://openreview.net/forum?id=SJx9ngStPH. Published online: iclr.cc. +[37] A. Zela, J. Siems, L. Zimmer, J. Lukasik, M. Keuper, and F. Hutter. Surrogate NAS benchmarks: Going beyond the limited search spaces of tabular NAS benchmarks. In Proceedings of the International Conference on Learning Representations (ICLR'22) icl [54]. URL https://openreview.net/forum? id=OnpFa95RVqs. Published online: ic1r.cc. +[38] N. Klyuchnikov, I. Trofimov, E. Artemova, M. Salnikov, M. Fedorov, and E. Burnaev. NAS-Bench-NLP: Neural Architecture Search benchmark for Natural Language Processing. arXiv:2006.07116v1 [cs.LG], 2020. +[39] A. Mehrotra, A. Ramos, S. Bhattacharya, L. Dudziak, R. Vipperla, T. Chau, M. Abdelfattah, S. Ishtiaq, and N. Lane. NAS-Bench-ASR: Reproducible Neural Architecture Search for Speech Recognition. In Proceedings of the International Conference on Learning Representations (ICLR'21) icl [55]. Published online: iclr.cc. +[40] X. Dong, L. Liu, K. Musial, and B. Gabrys. NATS-Bench: Benchmarking NAS algorithms for architecture topology and size. In K. M. Lee, editor, IEEE Transactions on Pattern Analysis and Machine Intelligence'21), pages 3634-3646. IEEE Computer Society, 2021. + +[41] K. Eggensperger, M. Feurer, F. Hutter, J. Bergstra, J. Snoek, H. Hoos, and K. Leyton-Brown. Towards an empirical foundation for assessing Bayesian optimization of hyperparameters. In M. Hoffman, J. Snoek, N. de Freitas, and M. Osborne, editors, NeurIPS Workshop on Bayesian Optimization in Theory and Practice (BayesOpt'13), 2013. +[42] K. Eggensperger, P. Müller, N. Mallik, M. Feurer, R. Sass, A. Klein, N. Awad, M. Lindauer, and F. Hutter. HPOBench: A collection of reproducible Multi-fidelity benchmark problems for HPO. In J. Vanschoeren and S. Yeung, editors, Proceedings of the Neural Information Processing Systems Track on Datasets and Benchmarks, volume 1, 2021. URL https://datasets-benchmarks-proceedings.neurips.cc/paper/2021/file/93db85ed909c13838ff95ccfa94cebd9-Paper-round2.pdf. +[43] J. Kiili, E. Laaksonen, R. Turner, D. Eriksson, S. Park, M. Mccourt, Z. Xu, and I. Guyon. Black box optimization challenge, 2020. +[44] R. Turner and D. Eriksson. Bayesmark: Benchmark framework to easily compare Bayesian Optimization methods on real machine learning tasks. github.com/uber/bayesmark, 2019. +[45] M. Lindauer, K. Eggensperger, M. Feurer, A. Biedenkapp, J. Marben, P. Müller, and F. Hutter. BOAH: A tool suite for Multi-fidelity Bayesian Optimization & analysis of hyperparameters. arXiv:1908.06756 [cs.LG], 2019. +[46] C. Li, Z. Yu, Y. Fu, Y. Zhang, Y. Zhao, H. You, Q. Yu, Y. Wang, C. Hao, and Y. Lin. HW-NAS-Bench: Hardware-Aware Neural Architecture Search Benchmark. In Proceedings of the International Conference on Learning Representations (ICLR'21) icl [55]. Published online: iclr.cc. +[47] Y. Duan, X. Chen, Xu H, Z. Chen, X. Liang, T. Zhang, and Z. Li. TransNAS-Bench-101: Improving Transferability and Generalizability of Cross-Task Neural Architecture Search. In Proceedings of the International Conference on Computer Vision and Pattern Recognition (CVPR'21), pages 5251–5260. Computer Vision Foundation and IEEE Computer Society, IEEE, 2021. +[48] R. Tu, N. Roberts, M. Khodak, J. Shen, F. Sala, and A. Talwalkar. NAS-Bench-360: Benchmarking Diverse Tasks for Neural Architecture Search. arXiv:2110.05668 [cs.CV], 2021. +[49] A. Klein and F. Hutter. Tabular benchmarks for Joint Architecture and Hyperparameter optimization. arXiv preprint arXiv:1905.04970, 2019. +[50] L. Zimmer, M. Lindauer, and F. Hutter. Auto-PyTorch Tabular: Multi-Fidelity MetaLearning for Efficient and Robust AutoDL. IEEE Transactions on Pattern Analysis and Machine Intelligence, 43:3079-3090, 2021. +[51] Y. Hirose, N. Yoshinari, and S. Shirakawa. NAS-HPO-Bench-II: A benchmark dataset on joint optimization of convolutional neural network architecture and training hyperparameters. In Asian Conference on Machine Learning, pages 1349-1364. PMLR, 2021. +[52] B. Wu, X. Dai, P. Zhang, Y. Wang, F. Sun, Y. Wu, Y. Tian, P. Vajda, Y. Jia, and K. Keutzer. FBNet: Hardware-aware efficient convnet design via differentiable Neural Architecture Search. In Proceedings of the International Conference on Computer Vision and Pattern Recognition (CVPR'19), pages 10726-10734. Computer Vision Foundation and IEEE Computer Society, IEEE, 2019. +[53] Proceedings of the International Conference on Learning Representations (ICLR'20), 2020. Published online: iclr.cc. +[54] Proceedings of the International Conference on Learning Representations (ICLR'22), 2022. Published online: iclr.cc. +[55] Proceedings of the International Conference on Learning Representations (ICLR'21), 2021. Published online: iclr.cc. +[56] I. Sutskever, J. Martens, G. Dahl, and G. Hinton. On the importance of initialization and momentum in deep learning. In S. Dasgupta and D. McAllester, editors, Proceedings of the 30th International Conference on Machine Learning, volume 28 of Proceedings of Machine Learning Research, pages 1139-1147, Atlanta, Georgia, USA, 17-19 Jun 2013. PMLR. URL https://proceedings.mlr.press/v28/sutskever13.html. +[57] I. Loshchilov and F. Hutter. SGDR: Stochastic gradient descent with warm restarts. In Proceedings of the International Conference on Learning Representations (ICLR'17), 2017. Published online: ic1r.cc. + +[58] J. K. Salmon, M. A. Moraes, R. O. Dror, and D. E. Shaw. Parallel random numbers: As easy as 1, 2, 3. In Proceedings of 2011 International Conference for High Performance Computing, Networking, Storage and Analysis, SC '11, New York, NY, USA, 2011. Association for Computing Machinery. ISBN 9781450307710. doi: 10.1145/2063384.2063405. URL https://doi.org/10.1145/2063384.2063405. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] See Section 2, Section 3, and Section 4. +(b) Did you describe the limitations of your work? [Yes] See section 6. +(c) Did you discuss any potential negative societal impacts of your work? [Yes] We discuss this in Appendix E. In summary, our work is extremely foundational and we do not foresee any direct paths to negative societal impacts. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [N/A] Our work is based on empirical results. +(b) Did you include complete proofs of all theoretical results? [N/A] + +3. If you ran experiments (e.g. for benchmarks)... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] See section 2 for our methodology; our code is open-source and freely available, along with instructions for accessing our data and reproducing our results at https://github.com/automl/jahs_bench_201. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 2.2 and Section 2.3. +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Section 6, where we acknowledge our sources of funding and compute. + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] See Section 2.1 and Section 2.2. +(b) Did you mention the license of the assets? [Yes] As part of our code repository at https://github.com/automl/jahs_bench_201. +(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] At https://github.com/automl/jahs_bench_201. +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] We generated all data ourselves based on code executions. +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] The data only pertains the performance of different neural architectures with different hyperparameter settings. + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] Our work neither used crowdsourcing nor involved research with human subjects. +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/jahsbench201afoundationforresearchonjointarchitectureandhyperparametersearch/images.zip b/jahsbench201afoundationforresearchonjointarchitectureandhyperparametersearch/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..56a7669279448a665a160413d56b2b4376aef9cc --- /dev/null +++ b/jahsbench201afoundationforresearchonjointarchitectureandhyperparametersearch/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:48cb1a9d8abba1fa34e55c61de20289eda8b62bddb4edd6310fa7d1c5ad1bda8 +size 525514 diff --git a/jahsbench201afoundationforresearchonjointarchitectureandhyperparametersearch/layout.json b/jahsbench201afoundationforresearchonjointarchitectureandhyperparametersearch/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..75fcb084424e1f9037e5ed73c1eb2bb1a6d6bc26 --- /dev/null +++ b/jahsbench201afoundationforresearchonjointarchitectureandhyperparametersearch/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:62c997ca4d9c72cb3625fc37e2832e3915dbfcdffb0a98fb4a9449dc877e7b2e +size 338283 diff --git a/jawsauditingpredictiveuncertaintyundercovariateshift/0e134b8c-2fd5-4b31-9b64-58e9dfd9bed1_content_list.json b/jawsauditingpredictiveuncertaintyundercovariateshift/0e134b8c-2fd5-4b31-9b64-58e9dfd9bed1_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..01a0d76f61a5ad3e480d3b10033afe91c0d8c798 --- /dev/null +++ b/jawsauditingpredictiveuncertaintyundercovariateshift/0e134b8c-2fd5-4b31-9b64-58e9dfd9bed1_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eea44813a85b5907a51e2610faac23ba58ad45cb116909399b37dc810eda12e5 +size 88032 diff --git a/jawsauditingpredictiveuncertaintyundercovariateshift/0e134b8c-2fd5-4b31-9b64-58e9dfd9bed1_model.json b/jawsauditingpredictiveuncertaintyundercovariateshift/0e134b8c-2fd5-4b31-9b64-58e9dfd9bed1_model.json new file mode 100644 index 0000000000000000000000000000000000000000..0c9ceedaa5e2d2d091d4f876456d026bfc81ff77 --- /dev/null +++ b/jawsauditingpredictiveuncertaintyundercovariateshift/0e134b8c-2fd5-4b31-9b64-58e9dfd9bed1_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a91a7ff755128f4d3b5e9ff1a41bcf257468823f634c9e331b21760f93163633 +size 112487 diff --git a/jawsauditingpredictiveuncertaintyundercovariateshift/0e134b8c-2fd5-4b31-9b64-58e9dfd9bed1_origin.pdf b/jawsauditingpredictiveuncertaintyundercovariateshift/0e134b8c-2fd5-4b31-9b64-58e9dfd9bed1_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c262b3954ed1a49a6c13ac1e2a8fe0fd759b877a --- /dev/null +++ b/jawsauditingpredictiveuncertaintyundercovariateshift/0e134b8c-2fd5-4b31-9b64-58e9dfd9bed1_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cc17ef82397cfa95b358c8b2b1212426bf5af4fba53251695f9e4932db37c586 +size 2077166 diff --git a/jawsauditingpredictiveuncertaintyundercovariateshift/full.md b/jawsauditingpredictiveuncertaintyundercovariateshift/full.md new file mode 100644 index 0000000000000000000000000000000000000000..fad56cf72e09f498746df7452e61da5cbc0eceec --- /dev/null +++ b/jawsauditingpredictiveuncertaintyundercovariateshift/full.md @@ -0,0 +1,379 @@ +# JAWS: Auditing Predictive Uncertainty Under Covariate Shift + +Drew Prinster + +Department of Computer Science + +Johns Hopkins University + +Baltimore, MD 21211 + +drew@cs.jhu.edu + +Anqi Liu + +Department of Computer Science + +Johns Hopkins University + +Baltimore, MD 21211 + +aliu@cs.jhu.edu + +Suchi Saria + +Department of Computer Science + +Johns Hopkins University + +Baltimore, MD 21211 + +ssaria@cs.jhu.edu + +# Abstract + +We propose JAWS, a series of wrapper methods for distribution-free uncertainty quantification tasks under covariate shift, centered on the core method JAW, the JAckknife+ Weighted with data-dependent likelihood-ratio weights. JAWS also includes computationally efficient Approximations of JAW using higher-order influence functions: JAWA. Theoretically, we show that JAW relaxes the jackknife+’s assumption of data exchangeability to achieve the same finite-sample coverage guarantee even under covariate shift. JAWA further approaches the JAW guarantee in the limit of the sample size or the influence function order under common regularity assumptions. Moreover, we propose a general approach to repurposing predictive interval-generating methods and their guarantees to the reverse task: estimating the probability that a prediction is erroneous, based on user-specified error criteria such as a safe or acceptable tolerance threshold around the true label. We then propose JAW-E and JAWA-E as the repurposed proposed methods for this Error assessment task. Practically, JAWS outperform state-of-the-art predictive inference baselines in a variety of biased real world data sets for interval-generation and error-assessment predictive uncertainty auditing tasks. + +# 1 Introduction + +Auditing the uncertainty under data shift Principled quantification of predictive uncertainty is crucial for enabling users to calibrate how much they should or should not trust a given prediction [Thiebes et al., 2021; Ghosh et al., 2021; Tomsett et al., 2020; Bhatt et al., 2021]. Uncertainty-based predictor auditing can be considered a type of uncertainty quantification performed post-hoc, for example by a regulator without detailed knowledge of a predictor's architecture and with limited resources [Schulam and Saria, 2019]. Data shift poses a major challenge to uncertainty quantification due to violation of the common assumption that the training and test data are exchangeable, or more specifically independent and identically distributed (i.i.d.) [Ovadia et al., 2019; Ulmer et al., 2020; Zhou and Levine, 2021; Chan et al., 2020]. Therefore, it is essential to develop convenient tools for users or regulators to audit the uncertainty of a given prediction even when training data is biased. + +Predictor auditing: Interval generation In this work we distinguish between two types of predictive uncertainty auditing. We describe the first type as interval generation, which refers to a common + +goal in the distribution-free uncertainty quantification literature: to generate a predictive confidence interval (or set) that covers the true label with at least a user-specified probability. For instance, an auditor might ask for predictive intervals that contain the true label with at least, say $90\%$ frequency. + +Predictor auditing: Error assessment While predictive interval generation has been a central focus of the distribution-free uncertainty quantification literature [Angelopoulos and Bates, 2021], in some applications the reverse computation may be more actionable: estimating the probability that a prediction is erroneous or not, based on user-specified error criteria such as a safe or acceptable tolerance region around the true label. We thus refer to this task as error assessment. For instance, take the setting of chemical or radiation therapy dose prediction for cancer treatment, where administering a dose within approximately $\pm 10\%$ of the optimal dose is considered safety-critical (see Appendix A.1 for details). Whereas predictive interval generation could fail to provide safety assurance (e.g., if the predictive confidence interval is larger than the safe tolerance region), error assessment would give a worst-case probability of the prediction being safe. Similar examples could be formulated in other applications, such as incision planning in surgical robotics and autonomous vehicle navigation. + +**Coverage** We assume a standard regression setup with a multiset of training data $\{(X_1, Y_1), \ldots, (X_n, Y_n)\}$ and a test point $(X_{n+1}, Y_{n+1})$ with unknown label $Y_{n+1}$ , where $(X_i, Y_i) \in \mathbb{R}^d \times \mathbb{R}$ for all $i \in \{1, \ldots, n+1\}$ . Also, we denote a predictor as $\widehat{\mu} = \mathcal{A}(\{(X_1, Y_1), \ldots, (X_n, Y_n)\})$ , where $\mathcal{A}$ is a model-fitting algorithm. For a predictive interval (or set) $\widehat{C}_{n,\alpha}^{\mathrm{audit}}: \mathbb{R}^d \to \{\text{subsets of } \mathbb{R}\}$ , a coverage guarantee gives a lower bound to the probability that the interval covers the true test label: + +$$ +\mathbb {P} \left\{Y _ {n + 1} \in \widehat {C} _ {n, \alpha} ^ {\text {a u d i t}} \left(X _ {n + 1}\right) \right\} \geq 1 - \alpha . \tag {1} +$$ + +The coverage guarantee provides the basis for both interval-generation and error-assessment auditing, though it is important to note that in this work we focus on marginal rather than conditional coverage (see [Foygel Barber et al., 2021] for more details on this distinction). Standard conformal prediction methods [Vovk et al., 2005, Shafer and Vovk, 2008, Vovk, 2013] along with the jackknife+ and related methods [Barber et al., 2021], which we refer to together as "predictive inference" methods, provide a framework for generating predictive intervals with finite-sample guaranteed coverage. + +Exchangeability Standard conformal prediction and the jackknife+ rely on two crucial notions of exchangeability: data exchangeability, that is that the training and test data are all exchangeable (e.g., i.i.d.); and secondly that the model-fitting algorithm $\mathcal{A}$ treats the data symmetrically [Barber et al., 2022]. In common situations of dataset shift, however, the data exchangeability assumption is violated. Empirically, the coverage performance of standard conformal prediction methods can suffer under data shift [Tibshirani et al., 2019, Podkopaev and Ramdas, 2021]. + +![](images/b6d12b6cba14600fa944ed63cf1d5adf22bad67c15a046eadd336fd402f0ed6a.jpg) +Figure 1: Jackknife+ loses coverage on the airfoil dataset under covariate shift (details in Section 4). + +![](images/0965619138766c523a782fcbe46e65b14ec5aae0b5578b22b05dcf75e59df87d.jpg) + +In this work, we build on the jackknife+ method due to its beneficial compromise between the statistical and computational limitations of other conformal prediction methods [Barber et al., 2021]. However, jackknife+ coverage performance can still degrade under data shift, such as shown in Figure 1, and in some applications its computational requirements can still be limiting. To address these concerns and make extensions to error assessment, we develop JAWS, a series of wrapper methods for distribution-free uncertainty quantification under covariate shift (see Table 1 for key properties). + +Table 1: Summary of key properties for JAWS methods (details in Section 3). + +
MethodTaskGuarantee (under covariate shift)Avoids retraining
Finite sampleAsymptotic
JAWInterval generation✓✓X
JAWAInterval generationX✓✓
JAW-EError assessment✓✓X
JAWA-EError assessmentX✓✓
+ +# Our contributions can be summarized as follows: + +1. We develop JAW: a jackknife+ method with data-dependent likelihood-ratio weights for predictive interval generation under covariate shift. We show that JAW achieves the same rigorous, finite-sample coverage guarantee as jackknife+ [Barber et al., 2021] while relaxing the data exchangeability assumption to allow for covariate shift. +2. We develop JAWA: a sequence of computationally efficient approximations to JAW that uses higher-order influence functions to avoid retraining. Under assumptions outlined in Giordano et al. [2019a] regarding the regularity of the data, Hessian of the objective (local strong convexity), and the existence and boundedness of higher order derivatives, we provide an asymptotic guarantee for the JAWA coverage in the limit of the sample size or influence function order. +3. We propose a general approach to repurposing any distribution-free predictive inference method to the error assessment task, with rigorous guarantees for the coverage probability estimation. Our approach applies to methods that assume exchangeable data and to methods like JAW and JAWA that allow for covariate shift—JAW-E and JAWA-E refer to the error assessment versions. +4. We demonstrate superior empirical performance of JAWS over other distribution-free predictive inference baselines on a variety of benchmark datasets under covariate shift. + +# 2 Background and related work + +# 2.1 Standard conformal prediction + +Conformal prediction has grown into a broad research field since arising in the 1990s [Vovk et al., 2005; Shafer and Vovk, 2008; Balasubramanian et al., 2014; Angelopoulos and Bates, 2021]. Standard conformal prediction methods generate a prediction interval (or set) with a finite-sample coverage guarantee as in (II), which is distribution-free in the sense that the guarantee applies to any exchangeable data distribution [Lei and Wasserman, 2014; Lei et al., 2018]. With the exchangeability assumptions in Section I, standard conformal prediction methods rely on a pre-fit score function $\widehat{S}:\mathbb{R}^d\times \mathbb{R}\to \mathbb{R}$ (in regression, the absolute-value residual score $\widehat{S} (x,y) = |y - \widehat{\mu} (x)|$ is commonly used). A conformal prediction interval at confidence level $1 - \alpha$ is then determined by a corresponding quantile on a multiset of (exchangeable) score values. + +Split conformal and full conformal are two main types of standard conformal prediction, and each bears its own limitation [Vovk et al., 2005; Shafer and Vovk, 2008]. Split conformal generates scores on labeled holdout data and is computationally efficient due to not requiring retraining, but sample splitting to obtain the holdout set can reduce model accuracy [Papadopoulos, 2008; Lei et al., 2018; Vovk, 2012]. On the other hand, full conformal prediction avoids the holdout set requirement, but at the heavy computational cost of retraining the model on every possible target value (or, in practice, on a fine grid of target values) [Ndiaye and Takeuchi, 2019; Zeni et al., 2020]. + +# 2.2 Covariate shift + +Under the covariate shift assumption, the $Y|X$ distribution is assumed to be the same between training and test data but the marginal $X$ distributions may change [Sugiyama et al., 2007, Shimodaira, 2000]: + +$$ +\left(X _ {i}, Y _ {i}\right) \stackrel {\text {i . i . d .}} {\sim} P _ {X} \times P _ {Y | X}, i = 1, \dots , n; \quad \left(X _ {n + 1}, Y _ {n + 1}\right) \sim \tilde {P} _ {X} \times P _ {Y | X}, \text {i n d e p e n d e n t l y}. \tag {2} +$$ + +Rich literature exist in this domain—see Appendix A.2 for more details. Uncertainty quantification is relatively less explored under covariate shift, though recent work [Ovadia et al., 2019; Zhou and Levine, 2021; Chan et al., 2020] emphasizes its importance, especially in deep learning. + +# 2.3 Conformal prediction under covariate shift and beyond exchangeability + +Tibshirani et al. [2019] develop the idea of weighted exchangeability for adapting conformal prediction to the covariate shift setting. Random variables $V_{1}, \ldots, V_{n}$ are weighted exchangeable with weight functions $w_{1}, \ldots, w_{n}$ if their joint density $f$ can be factorized as $f(v_{1}, \ldots, v_{n}) = \prod_{i=1}^{n} w_{i}(v_{i}) \cdot g(v_{1}, \ldots, v_{n})$ , where $g$ is independent of ordering on its inputs. For covariate shift as in [2], if $\widetilde{P}_{X}$ is absolutely continuous with respect to $P_{X}$ , then the data $\{(X_{i}, Y_{i})\}$ are weighted exchangeable with weight functions $w_{1} = \ldots = w_{n} = 1$ and $w_{n+1} = w = \mathrm{d}\widetilde{P}_{X} / \mathrm{d}P_{X}$ [Tibshirani et al., 2019]. + +If $\{v_{i}\}$ represents a set of scores for standard conformal prediction, then we can represent the empirical distribution of $\{v_{i}\}$ as $\frac{1}{n + 1}\sum_{i = 1}^{n}\delta_{v_i} + \frac{1}{n + 1}\delta_\infty$ , where $\delta_{v_i}$ denotes a point mass at $v_{i}$ [Barber et al., 2022]. By extension, weighted conformal prediction uses the weighted empirical distribution defined as $\sum_{i = 1}^{n}p_{i}^{w}(x)\delta_{v_{i}} + p_{n + 1}^{w}(x)\delta_{\infty}$ , with weights given by + +$$ +p _ {i} ^ {w} (x) = \frac {w \left(X _ {i}\right)}{\sum_ {j = 1} ^ {n} w \left(X _ {j}\right) + w (x)}, i = 1, \dots , n; \quad \text {a n d} \quad p _ {n + 1} ^ {w} (x) = \frac {w (x)}{\sum_ {j = 1} ^ {n} w \left(X _ {j}\right) + w (x)}, \tag {3} +$$ + +where $w = \mathrm{d}\widetilde{P}_X / \mathrm{d}P_X$ , so $p_i^w (X_{n + 1})$ can be thought of as a normalized likelihood ratio weight for each $i\in \{1,\ldots ,n + 1\}$ . Corollary 1 in [Tibshirani et al., 2019] provides the coverage guarantee of weighted conformal prediction that takes the form of (1) but relaxes the exchangeable data assumption to allow for covariate shift. However, weighted split and weighted full conformal inherit the same statistical and computational limitations, respectively, from their standard (exchangeable) variants. + +The recent work of [Barber et al., 2022] provides a novel extension of conformal prediction and the jackknife+ to unknown violations of the exchangeability assumption, including a "nonexchangeable jackknife+ defined with fixed weights. The key difference between the nonexchangeable jackknife+ in Barber et al. [2022] and our proposed JAW method is that Barber et al. [2022] use fixed weights to compensate for unknown exchangeability violations (not limited to covariate shift) but at the expense of a bounded but generally nonzero "coverage gap" (drop in guaranteed coverage relative to if the data were exchangeable), whereas our JAW method with data-dependent weights assumes covariate shift but does not suffer from any similar coverage gap. See Appendix A.3 for more details. + +# 2.4 Jackknife+ + +The jackknife+ [Barber et al., 2021], which is closely related to cross conformal prediction [Vovk et al., 2018], offers a compromise between the statistical limitation of split conformal and the computational limitation of full conformal, at the cost of a slightly weaker coverage guarantee. The jackknife+ predictive interval can most easily be understood as a modification to a predictive interval from the classic jackknife resampling method [Miller, 1974, Steinberger and Leeb, 2018, 2016]. For a set of point masses $\{\delta_{v_i}\}$ at values $v_1, \ldots, v_n$ , let $Q_{\beta}^{-}\left\{\frac{1}{n + 1}\delta_{v_i}\right\}$ denote the level $\beta$ quantile on the empirical distribution $\sum_{i = 1}^{n}\frac{1}{n + 1}\delta_{v_i} + \frac{1}{n + 1}\delta_{-\infty}$ and let $Q_{\beta}^{+}\left\{\frac{1}{n + 1}\delta_{v_i}\right\}$ denote the level $\beta$ quantile on the empirical distribution $\sum_{i = 1}^{n}\frac{1}{n + 1}\delta_{v_i} + \frac{1}{n + 1}\delta_{\infty}$ . Then, denoting the model trained without the $i$ th point as $\widehat{\mu}_{-i} = \mathcal{A}\big(\big(X_1,Y_1\big), \ldots, \big(X_{i - 1}, Y_{i - 1}\big), \big(X_{i + 1}, Y_{i + 1}\big), \ldots, \big(X_n,Y_n\big)\big)$ and the leave-one-out residual $R_i^{LOO} = |Y_i - \widehat{\mu}_{-i}(X_i)|$ , the jackknife prediction interval can be written as + +$$ +\widehat {C} _ {n, \alpha} ^ {\text {j a c k k n i f e}} \left(X _ {n + 1}\right) = \left[ Q _ {\alpha} ^ {-} \left\{\frac {1}{n + 1} \delta_ {\widehat {\mu} \left(X _ {n + 1}\right) - R _ {i} ^ {L O O}} \right\}, Q _ {1 - \alpha} ^ {+} \left\{\frac {1}{n + 1} \delta_ {\widehat {\mu} \left(X _ {n + 1}\right) + R _ {i} ^ {L O O}} \right\} \right]. \tag {4} +$$ + +In contrast, we obtain the jackknife+ predictive interval in [Barber et al. 2021] by replacing the full model prediction $\hat{\mu}(X_{n+1})$ in (4) with $\hat{\mu}_{-i}(X_{n+1})$ : + +$$ +\widehat {C} _ {n, \alpha} ^ {\text {j a c k k n i f e} +} \left(X _ {n + 1}\right) = \left[ Q _ {\alpha} ^ {-} \left\{\frac {1}{n + 1} \delta_ {\widehat {\mu} _ {- i} \left(X _ {n + 1}\right) - R _ {i} ^ {L O O}} \right\}, Q _ {1 - \alpha} ^ {+} \left\{\frac {1}{n + 1} \delta_ {\widehat {\mu} _ {- i} \left(X _ {n + 1}\right) + R _ {i} ^ {L O O}} \right\} \right]. \tag {5} +$$ + +[Barber et al., 2021] prove that, with the same exchangeability assumptions as in standard conformal prediction, the jackknife+ prediction interval satisfies + +$$ +\mathbb {P} \left\{Y _ {n + 1} \in \widehat {C} _ {n, \alpha} ^ {\text {j a c k k n i f e} +} \left(X _ {n + 1}\right) \right\} \geq 1 - 2 \alpha . \tag {6} +$$ + +# 2.5 Approximating leave-one-out models with higher-order influence functions + +Influence functions (IFs) [Cook, 1977] have a long history in robust statistics for estimating the dependence of parameters on sample data. Recently, IFs have become more widespread in machine learning for uses including model interpretability Koh and Liang [2017] and approximating classic resampling-based uncertainty quantification methods including bootstrap [Schulam and Saria, 2019], jackknife, and leave- $k$ -out cross validation [Giordano et al., 2019b]. In each of these cases, IFs enable approximation of the parameters that would be obtained if the model were retrained on resampled data by instead estimating the effect of a corresponding reweighting. In prior work, Alaa and Van Der Schaar [2020] proposed approximating the leave-one-out models required by the jackknife+ with higher-order IFs, but their work assumes exchangeable or i.i.d. train and test data. + +Let $\hat{\theta}$ denote the fitted parameters for predictor $\widehat{\mu}$ trained on the full training data. Given Assumptions 1-4 in Giordano et al. [2019a]—which require that $\hat{\theta}$ is a local minimum of the objective function, that the objective is $k + 1$ times continuously differentiable with bounded norms, and that the objective is strongly convex in the neighborhood of $\hat{\theta}$ —then the $k$ -th order leave-one-out IF refers to the $k$ -th order directional derivative of the model parameters $\hat{\theta}$ with respect to the data weights, in the direction of the leave-one-out change in weights (See A.4 for more details). With each of these $k$ -th order leave-one-out IFs for $k \in \{1, \dots, K\}$ , denoted with condensed notation $\delta_{-i}^{k} \hat{\theta}$ , we can construct a $K$ -th order Taylor series approximation to estimate the leave-one-out model parameters $\hat{\theta}_{-i}$ : + +$$ +\hat {\theta} _ {- i} ^ {\mathrm {I F} - K} := \hat {\theta} + \sum_ {k = 1} ^ {K} \frac {1}{k !} \delta_ {- i} ^ {k} \hat {\theta}. \tag {7} +$$ + +In this work we implement the algorithm proposed by Giordano et al. [2019a] to compute higher-order IFs, a recursive procedure based on forward-mode automatic differentiation [Maclaurin et al., 2015] for memory efficiency in computing higher-order directional derivatives. Our introduction of IFs is highly simplified—we refer to Appendix A.4 and to Giordano et al. [2019a] for more details. + +# 2.6 Error assessment + +Whereas conformal prediction and related methods generate prediction intervals that control the error probability (miscoverage level $\alpha$ ) at a user-specified level, we refer to the reverse task as error assessment: estimating the probability that a prediction is erroneous or not, based on user-specified error criteria. For instance, a user might define an error as any deviation between the prediction $\widehat{\mu}(X_{n+1})$ and the true label $Y_{n+1}$ greater than some acceptable tolerance threshold $\tau$ : that is, when $|Y_{n+1} - \widehat{\mu}(X_{n+1})| > \tau$ . In Section 3.3 we present a general approach to repurposing predictive inference methods with validity under covariate shift to error assessment. + +We note that for score functions that are monotonic in $y$ , such as $\widehat{S}(x, y) = y - \widehat{\mu}(x)$ , guarantees for this error assessment task can be obtained using conformal predictive distributions as described by Vovk et al. [2017] (also see Vovk et al. [2020], Vovk and Bendtsen [2018], Xie and Zheng [2022]). In regression tasks assuming exchangeable data, CPDs generate a probability distribution for the label over $\mathbb{R}$ . However, CPDs require that score functions be monotonic in $y$ , whereas we allow for certain non-monotone conformity scores such as the commonly used absolute-value residual $|y - \widehat{\mu}(x)|$ ; Moreover, CPDs assume exchangeable data, whereas our approach extends to covariate shift. + +# 3 Proposed approach and theoretical results + +# 3.1 JAW: Jackknife+ weighted with data-dependent weights + +We present JAW, the JAckknife+ Weighted with data-dependent likelihood-ratio weights, defined by the following predictive interval: + +$$ +\widehat {C} _ {n, \alpha} ^ {\mathrm {J A W}} \left(X _ {n + 1}\right) = \left[ Q _ {\alpha} ^ {-} \left\{p _ {i} ^ {w} \left(X _ {n + 1}\right) \cdot \delta_ {\widehat {\mu} _ {- i} \left(X _ {n + 1}\right) - R _ {i} ^ {L O O}} \right\}, Q _ {1 - \alpha} ^ {+} \left\{p _ {i} ^ {w} \left(X _ {n + 1}\right) \cdot \delta_ {\widehat {\mu} _ {- i} \left(X _ {n + 1}\right) + R _ {i} ^ {L O O}} \right\} \right], \tag {8} +$$ + +where $R_{i}^{LOO} = \left|\widehat{\mu}_{-i}(X_{i}) - Y_{i}\right|$ , with $p_i^w (x)$ for $i\in \{1,\dots,n + 1\}$ as in (3), where $Q_{\alpha}^{-}\left\{p_{i}^{w}(X_{n + 1})\cdot \delta_{\widehat{\mu}_{-i}(X_{n + 1}) - R_{i}^{LOO}}\right\}$ denotes the level $\alpha$ quantile of the empirical distribution $\sum_{i = 1}^{n}\left[p_i^w (X_{n + 1})\cdot \delta_{\widehat{\mu}_{-i}(X_{n + 1}) - R_i^{LOO}}\right] + p_{n + 1}^w (X_{n + 1})\cdot \delta_{-\infty}$ , and where $Q_{1 - \alpha}^{+}\left\{p_{i}^{w}(X_{n + 1})\cdot \delta_{\widehat{\mu}_{-i}(X_{n + 1}) + R_i^{LOO}}\right\}$ is the level $1 - \alpha$ quantile for $\sum_{i = 1}^{n}\left[p_i^w (X_{n + 1})\cdot \delta_{\widehat{\mu}_{-i}(X_{n + 1}) + R_i^{LOO}}\right] + p_{n + 1}^w (X_{n + 1})\cdot \delta_\infty$ . + +We choose to define JAW using likelihood-ratio weights $w(X_{i}) = \mathrm{d}\widetilde{P}_{X}(X_{i}) / \mathrm{d}P_{X}(X_{i})$ in the $p_i^w (x)$ to address covariate shift, but a similar result holds for other instances of weighted exchangeability and corresponding data-dependent weight functions (see Appendix B.1). We show that $\widehat{C}_{n,\alpha}^{\mathrm{JAW}}(X_{n + 1})$ satisfies the same coverage guarantee as the jackknife+ except relaxing the data exchangeability assumption to allow for covariate shift, which we state formally in the following theorem. + +Theorem 1. Assume data under covariate shift from (2). If $\bar{P}_X$ is absolutely continuous with respect to $P_X$ , then the JAW interval in (8) satisfies + +$$ +\mathbb {P} \left\{Y _ {n + 1} \in \widehat {C} _ {n, \alpha} ^ {J A W} \left(X _ {n + 1}\right) \right\} \geq 1 - 2 \alpha . \tag {9} +$$ + +Remark 1. The results from Tibshirani et al. [2019] do not directly imply Theorem [1]. The approach in Tibshirani et al. [2019] relies on leveraging the weighted exchangeability of the data to reweight the nonconformity scores $\{V_1, \dots, V_{n+1}\}$ so they can be treated as exchangeable, and for the jackknife+ this approach would entail treating $\widehat{\mu}_{-i}(X_{n+1}) \pm R_i^{LOO}$ as implicit nonconformity scores. But, observe that for $i \in \{1, \dots, n\}$ , $\widehat{\mu}_{-i}$ is trained on $n-1$ datapoints, whereas $\widehat{\mu}_{-(n+1)} = \widehat{\mu}$ is trained on $n$ datapoints. Thus, no reweighting can make $\widehat{\mu}_{-i}$ equivalent in distribution to $\widehat{\mu}$ and thereby allow us to treat the reweighted $\widehat{\mu}_{-i}(X_{n+1}) \pm R_i^{LOO}$ and $\widehat{\mu}(X_{n+1}) \pm R_{n+1}^{LOO}$ as exchangeable. + +Proof sketch: Our proof technique for Theorem 1 extends the jackknife+ coverage guarantee proof in Barber et al. [2021] to the covariate shift setting for JAW using likelihood ratio weights as in Tibshirani et al. [2019]. The full proof is given in Appendix C.1 but the outline is as follows: + +Setup: Following Barber et al. [2021], we define a set of leave-two-out models $\{\tilde{\mu}_{-(i,j)}\}$ . We then generalize the notion of "strange" points described in Barber et al. [2021] to covariate shift. + +1. Bounding the total normalized weight of strange points: We establish deterministically that the total normalized weight of strange points cannot exceed $2\alpha$ +2. Weighted exchangeability using the leave-two-out models: Using the leave-two-out model construction, we leverage weighted exchangeability to show that the probability that a test point $n + 1$ is strange is thus bounded by $2\alpha$ . +3. Connection to JAW: Lastly, we show that the JAW interval can only fail to cover the test label value $Y_{n + 1}$ if $n + 1$ is a strange point. + +While JAW assumes access to oracle likelihood ratio weights, in practice this information often has to be estimated. See Appendix D.5 for a discussion and experiments of JAW with estimated weights. + +# 3.2 JAWA: Using higher-order influence functions to approximate JAW without retraining + +For computationally efficient JAW Approximations that avoid retraining $n$ leave-one-out models, we propose the JAWA sequence, which approximates the leave-one-out models required by JAW using higher-order influence functions. For each training point $i \in \{1, \dots, n\}$ , define the $K$ -th order influence function approximation to the leave-one-out refit parameters $\hat{\theta}_{-i}$ , obtained from Algorithm 4 in Giordano et al. [2019a], as given by equation (7), and let $\hat{\mu}_{-i}^{\mathrm{IF}-K}$ be the model with these approximated parameters $\hat{\theta}_{-i}^{\mathrm{IF}-K}$ for each $i \in \{1, \dots, n\}$ . Then, the prediction interval for the $K$ -th order JAWA (i.e., for JAWA- $K$ ) is given by + +$$ +\begin{array}{l} \widehat {C} _ {n, \alpha} ^ {\mathrm {J A W A - K}} (X _ {n + 1}) = \left[ Q _ {\alpha} ^ {-} \left\{p _ {i} ^ {w} (X _ {n + 1}) \cdot \delta_ {\widehat {\mu} _ {- i} ^ {\mathrm {I F - K}} (X _ {n + 1}) - R _ {i} ^ {\mathrm {I F - K , L O O}}} \right\}, \right. \\ \left. Q _ {1 - \alpha} ^ {+} \left\{p _ {i} ^ {w} \left(X _ {n + 1}\right) \cdot \delta_ {\widehat {\mu} _ {- i} ^ {\mathrm {I F} \cdot K} \left(X _ {n + 1}\right) + R _ {i} ^ {\mathrm {I F} \cdot K, L O O}} \right\} \right], \tag {10} \\ \end{array} +$$ + +with $R_{i}^{\mathrm{IF - K,LOO}} = \left|\widehat{\mu}_{-i}^{\mathrm{IF - K}}(X_{i}) - Y_{i}\right|$ , $p_i^w (x)$ as in (3), and quantiles defined analogously to JAW. + +We now provide an asymptotic coverage guarantee for $\widehat{C}_{n,\alpha}^{\mathrm{JWA - K}}(X_{n + 1})$ that holds either in the limit of the sample size or in the limit of the influence function order, under regularity conditions formally described in Giordano et al. [2019a]. These assumptions concern the regularity and continuity of the training data, local convexity of the objective (or that the Hessian is strongly positive definite), and the existence and boundedness of the objective's 1st through $K + 1$ th order directional derivatives. + +Theorem 2. Assume data under covariate shift from [2] and that $\widetilde{P}_X$ is absolutely continuous with respect to $P_X$ . Let Assumptions 1 - 4 and either Condition 2 or Condition 4 from Giordano et al. [2019a] hold uniformly for all $n$ . Then, in the limit of the training sample size $n \to \infty$ or in the limit of the influence function order $K \to \infty$ , the JAWA- $K$ interval in [10] satisfies + +$$ +\mathbb {P} \left\{Y _ {n + 1} \in \hat {C} _ {n, \alpha} ^ {\text {J A W A - K}} \left(X _ {n + 1}\right) \right\} \geq 1 - 2 \alpha \tag {11} +$$ + +We leave the proof to Appendix C.2, but we note that the result follows by combining Propositions 1 and 3 in Giordano et al. [2019a] with the JAW coverage guarantee that we present in Theorem 1. + +# 3.3 Error assessment under covariate shift + +We now propose a general approach to repurposing predictive inference methods with validity under covariate shift from predictive interval generation to the reverse task: estimating the probability that a + +prediction is erroneous or not, based on user-specified error criteria. For example, consider a user that defines a prediction $\widehat{\mu}(X_{n+1})$ as erroneous, relative to the true label $Y_{n+1}$ , if it is farther than some acceptable tolerance threshold $\tau$ from $Y_{n+1}$ : i.e., if $|Y_{n+1} - \widehat{\mu}(X_{n+1})| > \tau$ . For this common regression error criterion, our approach to adapting a method such as JAW (8) or weighted split conformal prediction [Tibshirani et al., 2019] to error assessment reduces to first defining the set of labels that would not be considered erroneous, $\overline{E} = [\widehat{\mu}(X_{n+1}) - \tau, \widehat{\mu}(X_{n+1}) + \tau]$ , and then finding the method's largest predictive interval contained within $\overline{E}$ , call it $\widehat{C}_{n,\alpha_E}^{\mathrm{w-audit}}(X_{n+1})$ . The coverage guarantee for $\widehat{C}_{n,\alpha_E}^{\mathrm{w-audit}}(X_{n+1})$ then yields a lower bound on $\mathbb{P}\{Y_{n+1} \in \overline{E}\}$ , the probability of no error (or an upper bound on the error probability). See Figure 2 for an illustration of this example. + +![](images/efb10199d62550174905c557afd420cc834cf4e756ad9c1fe14f88ccf30d8eae.jpg) +Figure 2: Illustration of approach to repurposing a predictive inference method "w-audit" to error assessment. The interval $\overline{E} = [\widehat{\mu}(X_{n+1}) - \tau, \widehat{\mu}(X_{n+1}) + \tau]$ is shown in violet, the lower score values $\{V_i^L\}$ in blue, the upper score values $\{V_i^U\}$ in red, and the interval $\widehat{C}_{n,\alpha_E}^{\mathrm{w-audit}}(X_{n+1})$ in green. Each vertical line at a location $V_i$ on the real line represents a point mass $\delta_{V_i}$ with height corresponding to the normalized likelihood ratio weight $p_i^w(X_{n+1})$ . + +Generally, a user must specify error criteria by a test point score function $\widehat{S}:\mathbb{R}^d\times \mathbb{R}\to \mathbb{R}$ (for conformal prediction, a nonconformity score), as well as minimum and maximum acceptable score values $\tau^{-}$ and $\tau^{+}$ , where $\tau^{-} < \tau^{+}$ ; i.e., $\widehat{\mu} (X_{n + 1})$ is considered erroneous if $\widehat{S} (X_{n + 1},Y_{n + 1}) < \tau^{-}$ or if $\tau^{+} < \widehat{S} (X_{n + 1},Y_{n + 1})$ . (For nonnegative $\widehat{S}$ , we might let $\tau^{-} = 0$ .) Then, the values of $y$ for which observing $Y_{n + 1} = y$ would not imply $\widehat{\mu} (X_{n + 1})$ is erroneous are: + +$$ +\bar {E} = \left\{y \in \mathbb {R}: \tau^ {-} \leq \hat {S} \left(X _ {n + 1}, y\right) \leq \tau^ {+} \right\}. \tag {12} +$$ + +Now, assume a predictive inference method with predictive sets that can be written in the form + +$$ +\widehat {C} _ {n, \alpha} ^ {\mathrm {w - a u d i t}} \left(X _ {n + 1}\right) = \left\{y \in \mathbb {R}: \widehat {Q} _ {\alpha} ^ {-} \left\{p _ {i} ^ {w} \left(X _ {n + 1}\right) \delta_ {V _ {i} ^ {L}} \right\} \leq \widehat {S} \left(X _ {n + 1}, y\right) \leq \widehat {Q} _ {1 - \alpha} ^ {+} \left\{p _ {i} ^ {w} \left(X _ {n + 1}\right) \delta_ {V _ {i} ^ {U}} \right\} \right\} \tag {13} +$$ + +with valid coverage guaranteed under covariate shift. (Note, [13] gives the JAW interval [8] by setting $\widehat{S}(x,y) = y - \widehat{\mu}(x)$ , $V_{i}^{L} = \widehat{\mu}_{-i}(X_{n+1}) - \widehat{\mu}(X_{n+1}) - R_{i}^{LOO}$ , and $V_{i}^{U} = \widehat{\mu}_{-i}(X_{n+1}) - \widehat{\mu}(X_{n+1}) + R_{i}^{LOO}$ ; see Appendix B.3. Similarly, [13] gives the prediction interval for weighted split conformal prediction [Tibshirani et al., 2019] for absolute value residual scores when $\widehat{S}(x,y) = |y - \widehat{\mu}(x)|$ , and for all calibration data $i$ we let $V_{i}^{U} = |Y_{i} - \widehat{\mu}(X_{i})|$ and $V_{i}^{L} = 0$ .) Then, defining + +$$ +\alpha_ {E} ^ {\mathrm {w - a u d i t}} = \min \left(\left\{\alpha^ {\prime}: \tau^ {-} \leq \widehat {Q} _ {\alpha^ {\prime}} ^ {-} \left\{p _ {i} ^ {w} \left(X _ {n + 1}\right) \delta_ {V _ {i} ^ {L}} \right\}, \widehat {Q} _ {1 - \alpha^ {\prime}} ^ {+} \left\{p _ {i} ^ {w} \left(X _ {n + 1}\right) \delta_ {V _ {i} ^ {U}} \right\} \leq \tau^ {+} \right\}\right), \tag {14} +$$ + +we can estimate the probability of $\widehat{\mu} (X_{n + 1})$ not resulting in an error as in [12] as: + +$$ +\widehat {p} \left\{Y _ {n + 1} \in \bar {E} \right\} = \left\{ \begin{array}{l l} 1 - \alpha_ {E} ^ {\mathrm {w} - \mathrm {a u d i t}} & \text {i f} \alpha_ {E} ^ {\mathrm {w} - \mathrm {a u d i t}} \text {e x i s t s} \\ 0 & \text {o t h e r w i s e .} \end{array} \right. \tag {15} +$$ + +While the target coverage for $\widehat{C}_{n,\alpha_E}^{\mathrm{w - audit}}(X_{n + 1})$ is used in (15), the following theorem gives the worst-case error assessment guarantee for covariate shift (proof in Appendix C.3). Corollary 1 in Appendix B.3 and Corollary 2 in Appendix B.4 give the error assessment guarantees for JAW-E and JAWA-E respectively. Appendix B.2 gives the analogous guarantee for exchangeable data. + +Theorem 3. Assume a predictive inference method of the form (13) has coverage guarantee $\mathbb{P}\{Y_{n + 1}\in \widehat{C}_{n,\alpha}^{w\text{-audit}}(X_{n + 1})\} \geq 1 - c_1\alpha -c_2$ , with $c_{1},c_{2}\in \mathbb{R}$ , under covariate shift (2) where $\widetilde{P}_X$ is absolutely continuous with respect to $P_{X}$ . Define $\overline{E}$ as in (12) and $\alpha_{E}^{w\text{-audit}}$ as in (14). Then, + +$$ +\mathbb {P} \left\{Y _ {n + 1} \in \overline {{E}} \right\} \geq \left\{ \begin{array}{l l} 1 - c _ {1} \alpha_ {E} ^ {w - a u d i t} - c _ {2} & \text {i f} \alpha_ {E} ^ {w - a u d i t} \text {e x i s t s a n d} \alpha_ {E} ^ {w - a u d i t} < \frac {1 - c _ {2}}{c _ {1}} \\ 0 & \text {o t h e r w i s e .} \end{array} \right. \tag {16} +$$ + +# 4 Experiments + +# 4.1 Datasets and creation of covariate shift + +We conduct experiments on five UCI datasets Dua and Graff [2017] with various dimensionality (Table 2): airfoil self-noise, red wine quality prediction [Cortez et al., 2009], wave energy converters, superconductivity [Hamidieh, 2018], and communities and crime [Redmond and Baveja, 2002]. + +Table 2: Statistics for the UCI datasets. Only the first 2000 samples were used for the wave and superconductivity datasets (for wave, the first 2000 samples of Adelaide data). + +
Dataset# of samples# of featuresLabel range
Airfoil self-noise (airfoil)15035[103.38, 140.987]
Red wine quality (wine)159911[3, 8]
Wave energy converters (wave)200048[1226969, 1449349]
Superconductivity (superconduct)200081[0.2, 136.0]
Communities and crime (communities)199499[0, 1]
+ +We use exponential tilting to induce covariate shift on the test data, based on the approach used in Tibshirani et al. [2019]. We first randomly sample 200 points for the training data, and then sample the biased test data from the remaining datapoints that are not used for training with probabilities proportional to exponential tilting weights. See Appendix D.1 for additional details. + +# 4.2Baselines + +Baselines for comparison to JAW We compared JAW to the following baselines: + +1. Naive estimates are based on training data residuals $|Y_{i} - \widehat{\mu}(X_{i})|$ , which suffers from overfitting. +2. Jackknife uses the classic Jackknife resampling as in (4). +3. Jackknife+ follows (5), which replaces the prediction $\widehat{\mu}(X_{n+1})$ in jackknife with $\widehat{\mu}_{-i}(X_{n+1})$ . +4. Jackknife-mm [Barber et al., 2021] is a more conservative alternative to jackknife+ that guarantees coverage at the $1 - \alpha$ level with exchangeable data, but usually with overly-wide intervals. + +$$ +\widehat {C} _ {n, \alpha} ^ {\text {j a c k k n i f e - m m}} (X _ {n + 1}) = \left[ \min _ {i = 1, \dots , n} \widehat {\mu} _ {- i} (X _ {n + 1}) - Q _ {1 - \alpha} ^ {+} \{R _ {i} ^ {L O O} \}, \max _ {i = 1, \dots , n} \widehat {\mu} _ {- i} (X _ {n + 1}) + Q _ {1 - \alpha} ^ {+} \{R _ {i} ^ {L O O} \} \right] +$$ + +5. Cross validation+ (CV+) [Barber et al., 2021] is similar to jackknife+ but splits data into $K$ folds and replaces the $\widehat{\mu}_{-i}(X_{n + 1})$ with $\widehat{\mu}_{-k}(X_{n + 1})$ , the model trained with the $k$ th subset removed. +6. Split method follows split conformal prediction, which uses half the data for training and the other half for generating the nonconformity scores. +7. Weighted split is a version of split conformal with likelihood ratio weights to maintain coverage under covariate shift, as in [Tibshirani et al. 2019]. + +Baselines for comparison to JAWA For influence function orders $K \in \{1,2,3\}$ , we compared the proposed JAWA- $K$ method with $K$ -th order influence function approximations of the jackknife-based baselines that we used as comparisons to JAW—we thus refer to these approximations as IF- $K$ jackknife, IF- $K$ jackknife+, and IF- $K$ jackknife-mm. Each baseline compared to JAWA- $K$ is thus also approximated with the same $K$ -th order leave-one-out influence function models. + +# 4.3 Experimental results + +We report experimental results on the predictive interval-generation task for both JAW and JAWA and on the error assessment task for JAW, compared to baselines. Additional experimental details and supplementary experiments can be found in Appendix D, including for estimated likelihood ratio weights in D.5, ablation study with shift magnitudes in D.6 and coverage histograms in D.9. + +# 4.3.1 Interval generation results for JAW: Coverage and interval width + +Figure 3 compares JAW and its baselines, firstly regarding mean coverage and secondarily regarding median interval width, on all five UCI datasets for both neural network and random forest predictors, + +averaged over 1000 experimental replicates. See Appendix D.2 for predictor function details. Meeting the target coverage level of $1 - \alpha$ is the primary goal of the interval-generation audit task, but for methods that meet or nearly meet the target coverage level, smaller interval widths are more informative. Additionally, smaller variance in coverage indicates a more reliable or consistent method. + +As seen in Figure 3, the JAW predictive interval coverage is above the target level of 0.9 across all datasets, for both random forest and neural network $\widehat{\mu}$ functions, along with the jackknife-mm and weighted split methods. However, JAW's interval widths are generally smaller and thus more informative than those of jackknife-mm (which are often overly large, as noted in [Barber et al. 2021]). Weighted split and JAW perform similarly on mean coverage and median interval width (both methods have coverage guarantees under covariate shift), but JAW avoids sample splitting and as a result has lower coverage variance than weighted split for all dataset and predictor conditions (see Appendix D.3), which suggests that JAW's predictive intervals are more reliable. + +![](images/9aa1a1c8d7b3b5d0d9a0fd9b10202f746158296d4bc3fbffa51405b319623793.jpg) +Figure 3: Mean coverage (first row) and median interval width (second row) for neural network and random forest predictors on UCI datasets. Dashed line is the target coverage level $(1 - \alpha = 0.9)$ . Error bars show the standard error of 1000 repeated experiments. JAW maintains target coverage under covariate shift for all predictor and dataset conditions along with jackknife-mm and weighted split—however, JAW's intervals are generally smaller and thus more informative than jackknife-mm's, and JAW's coverage variance is smaller and thus more reliable than weighted split's (Appendix D.3). + +# 4.3.2 Interval generation results for JAWA: Coverage and interval width + +Figure 4 evaluates JAWA coverage and interval width compared to baselines for IF orders $K \in \{1,2,3\}$ with a neural network predictor (see Appendix D.2 for predictor details). As with the JAW experiments, coverage at the target level of $1 - \alpha = 0.9$ is the primary goal, while secondarily, smaller intervals are more informative for methods that meet or nearly meet target coverage. For three of the five datasets (airfoil, wine, and communities), JAWA is the only method that consistently reaches or nearly reaches the target coverage level. JAWA and all the baselines perform well on the wave datasets, and in the superconduct dataset JAWA still outperforms approximations of jackknife and jackknife+ for all IF orders. Appendix D.7 provides an example empirical comparison of JAWA and JAW runtimes, which demonstrates that JAWA can be orders of magnitude faster to compute. + +# 4.3.3 Error assessment results for JAW-E: AUC + +We now turn to an error-assessment audit task where the goal is to evaluate a method's ability to estimate the probability that a given prediction is erroneous or not, based on the error criterion $|Y_{n + 1} - \widehat{\mu}(X_{n + 1})| > \tau$ . Let $\overline{E} = [\widehat{\mu}(X_{n + 1}) - \tau, \widehat{\mu}(X_{n + 1}) + \tau]$ . Then, the goal is to estimate the probability that $\widehat{\mu}(X_{n + 1})$ is correct, i.e., $Y_{n + 1} \in \overline{E}$ ; or an error, i.e., $Y_{n + 1} \notin \overline{E}$ . For five predictive interval-generation methods repurposed to the error assessment task (JAW-E, jackknife+E, cross validation+E, split conformal-E, and weighted split conformal-E), Figure 5 reports the area under the receiver operating characteristic curve (AUROC) for 50 repeated experiments with a neural network predictor, with dataset-specific values of $\tau$ (see Appendix D.4 for details and additional experiments with random forest predictor). Better performing methods have higher AUROC values for all values $\tau$ . For most tolerance levels and datasets, JAW achieves AUROC values comparable to jackknife+ and CV+ as well as higher AUROC values than split and weighted split conformal prediction. The + +![](images/9dda99b5ef9c913dc86689504e9abd5fd9e7813f31e6b965b8b3be8c685b5b24.jpg) +Figure 4: Mean coverage (first row) and median interval width (second row) for JAWA and baselines for influence function orders $K \in \{1,2,3\}$ . Dashed line is the target coverage level ( $1 - \alpha = 0.9$ ). Error bar shows the standard error of 200 repeated experiments. JAWA is more consistent than baselines in reaching or nearly reaching the target coverage level across datasets and influence function orders, and it is more computationally efficient than JAW (Appendix D.7). + +![](images/9cdb82ab063e95a8a03f2de21359de9d179583588d8ec320c752a758388cdfbe.jpg) +Figure 5: AUROC values for tolerance levels $\tau$ across the three datasets for the neural net predictor, averaged across 50 experiment replicates. Results for random forest predictor in Appendix D.4. + +comparable performance of JAW and jackknife+ is likely due to a tradeoff between the benefit of JAW's validity under covariate shift and its reduced effective sample size inherent to likelihood-ratio weighting, as jackknife+’s and $\mathrm{CV + }$ ’s AUROC degrades with reduced sample size (Appendix D.6). + +# 5 Conclusion + +In this paper, we develop JAWS, a series of wrapper methods for distribution-free predictive uncertainty auditing tasks when the data exchangeability assumption is violated due to covariate shift. We also propose a general approach to repurposing any distribution-free predictive inference method to the error assessment task. We provide rigorous finite-sample guarantees for JAW and JAW-E on the interval generation and error assessment tasks respectively, and analogous asymptotic guarantees for the computationally efficient JAWA and JAW-A-E. We moreover demonstrate superior performance of the JAWS series on a variety of datasets. In supplementary experiments we investigate a number of JAWS' limitations: weight estimation can address the assumed access to oracle weights with similar empirical performance (Appendix D.5), and JAW's increased coverage variance with covariate shift can be explained by reduced effective sample size due to importance weighting (Appendix D.6). Additionally, we note that JAW and JAWA share a limitation with weighted conformal prediction [Tibshirani et al., 2019] of potentially producing overly large intervals in extreme covariate shift cases where a test point's normalized likelihood ratio approaches or exceeds $\alpha$ . In the future, we aim to address the problems of reducing coverage variance and improving predictive interval sharpness. + +# Acknowledgments + +This work was supported by the National Science Foundation grant IIS-1840088. We thank Yoav Wald for helpful discussions and advice, as well as Peter Schulam for sharing code that facilitated our influence function approximation implementation and AUC experiments. + +# References + +Scott Thiebes, Sebastian Lins, and Ali Sunyaev. Trustworthy artificial intelligence. Electronic Markets, 31(2):447-464, 2021. +Soumya Ghosh, Q Vera Liao, Karthikeyan Natesan Ramamurthy, Jiri Navratil, Prasanna Sattigeri, Kush R Varshney, and Yunfeng Zhang. Uncertainty quantification 360: A holistic toolkit for quantifying and communicating the uncertainty of ai. arXiv preprint arXiv:2106.01410, 2021. +Richard Tomsett, Alun Preece, Dave Braines, Federico Cerutti, Supriyo Chakraborty, Mani Srivastava, Gavin Pearson, and Lance Kaplan. Rapid trust calibration through interpretable and uncertainty-aware ai. Patterns, 1(4):100049, 2020. +Umang Bhatt, Javier Antorán, Yunfeng Zhang, Q Vera Liao, Prasanna Sattigeri, Riccardo Fogliato, Gabrielle Melançon, Ranganath Krishnan, Jason Stanley, Omesh Tickoo, et al. Uncertainty as a form of transparency: Measuring, communicating, and using uncertainty. In Proceedings of the 2021 AAAI/ACM Conference on AI, Ethics, and Society, pages 401-413, 2021. +Peter Schulam and Suchi Saria. Can you trust this prediction? auditing pointwise reliability after learning. In The 22nd International Conference on Artificial Intelligence and Statistics, pages 1022-1031. PMLR, 2019. +Yaniv Ovadia, Emily Fertig, Jie Ren, Zachary Nado, David Sculley, Sebastian Nowozin, Joshua Dillon, Balaji Lakshminarayanan, and Jasper Snoek. Can you trust your model's uncertainty? evaluating predictive uncertainty under dataset shift. Advances in neural information processing systems, 32, 2019. +Dennis Ulmer, Lotta Meijerink, and Giovanni Cina. Trust issues: Uncertainty estimation does not enable reliable ood detection on medical tabular data. In Machine Learning for Health, pages 341-354. PMLR, 2020. +Aurick Zhou and Sergey Levine. Amortized conditional normalized maximum likelihood: Reliable out of distribution uncertainty estimation. In International Conference on Machine Learning, pages 12803-12812. PMLR, 2021. +Alex Chan, Ahmed Alaa, Zhaozhi Qian, and Mihaela Van Der Schaar. Unlabelled data improves bayesian uncertainty calibration under covariate shift. In International Conference on Machine Learning, pages 1392-1402. PMLR, 2020. +Anastasios N Angelopoulos and Stephen Bates. A gentle introduction to conformal prediction and distribution-free uncertainty quantification. arXiv preprint arXiv:2107.07511, 2021. +Rina Foygel Barber, Emmanuel J Candes, Aaditya Ramdas, and Ryan J Tibshirani. The limits of distribution-free conditional predictive inference. Information and Inference: A Journal of the IMA, 10(2):455-482, 2021. +Vladimir Vovk, Alexander Gammerman, and Glenn Shafer. Algorithmic learning in a random world. Springer Science & Business Media, 2005. +Glenn Shafer and Vladimir Vovk. A tutorial on conformal prediction. Journal of Machine Learning Research, 9(3), 2008. +Vladimir Vovk. Transductive conformal predictors. In IFIP International Conference on Artificial Intelligence Applications and Innovations, pages 348-360. Springer, 2013. +Rina Foygel Barber, Emmanuel J Candes, Aaditya Ramdas, and Ryan J Tibshirani. Predictive inference with the jackknife+. The Annals of Statistics, 49(1):486-507, 2021. +Rina Foygel Barber, Emmanuel J Candes, Aaditya Ramdas, and Ryan J Tibshirani. Conformal prediction beyond exchangeability. arXiv preprint arXiv:2202.13415, 2022. +Ryan J Tibshirani, Rina Foygel Barber, Emmanuel Candes, and Aaditya Ramdas. Conformal prediction under covariate shift. Advances in neural information processing systems, 32, 2019. + +Aleksandr Podkopaev and Aaditya Ramdas. Distribution-free uncertainty quantification for classification under label shift. In Uncertainty in Artificial Intelligence, pages 844-853. PMLR, 2021. +Ryan Giordano, Michael I Jordan, and Tamara Broderick. A higher-order swiss army infinitesimal jackknife. arXiv preprint arXiv:1907.12116, 2019a. +Vineeth Balasubramanian, Shen-Shyang Ho, and Vladimir Vovk. Conformal prediction for reliable machine learning: theory, adaptations and applications. Newnes, 2014. +Jing Lei and Larry Wasserman. Distribution-free prediction bands for non-parametric regression. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 76(1):71-96, 2014. +Jing Lei, Max G'Sell, Alessandro Rinaldo, Ryan J Tibshirani, and Larry Wasserman. Distribution-free predictive inference for regression. Journal of the American Statistical Association, 113(523): 1094-1111, 2018. +Harris Papadopoulos. Inductive conformal prediction: Theory and application to neural networks. INTECH Open Access Publisher Rijeka, 2008. +Vladimir Vovk. Conditional validity of inductive conformal predictors. In *Asian conference on machine learning*, pages 475-490. PMLR, 2012. +Eugene Ndiaye and Ichiro Takeuchi. Computing full conformal prediction set with approximate homotopy. Advances in Neural Information Processing Systems, 32, 2019. +Gianluca Zeni, Matteo Fontana, and Simone Vantini. Conformal prediction: a unified review of theory and new challenges. arXiv preprint arXiv:2005.07972, 2020. +Masashi Sugiyama, Matthias Krauledat, and Klaus-Robert Müller. Covariate shift adaptation by importance weighted cross validation. Journal of Machine Learning Research, 8(5), 2007. +Hidetoshi Shimodaira. Improving predictive inference under covariate shift by weighting the log-likelihood function. Journal of statistical planning and inference, 90(2):227-244, 2000. +Vladimir Vovk, Ilia Nouretdinov, Valery Manokhin, and Alexander Gammerman. Cross-conformal predictive distributions. In Conformal and Probabilistic Prediction and Applications, pages 37-51. PMLR, 2018. +Rupert G Miller. The jackknife-a review. Biometrika, 61(1):1-15, 1974. +Lukas Steinberger and Hannes Leeb. Conditional predictive inference for high-dimensional stable algorithms. arXiv preprint arXiv:1809.01412, 2018. +Lukas Steinberger and Hannes Leeb. Leave-one-out prediction intervals in linear regression models with many variables. arXiv preprint arXiv:1602.05801, 2016. +R Dennis Cook. Detection of influential observation in linear regression. Technometrics, 19(1):15-18, 1977. +Pang Wei Koh and Percy Liang. Understanding black-box predictions via influence functions. In International conference on machine learning, pages 1885-1894. PMLR, 2017. +Ryan Giordano, William Stephenson, Runjing Liu, Michael Jordan, and Tamara Broderick. A swiss army infinitesimal jackknife. In The 22nd International Conference on Artificial Intelligence and Statistics, pages 1139-1147. PMLR, 2019b. +Ahmed Alaa and Mihaela Van Der Schaar. Discriminative jackknife: Quantifying uncertainty in deep learning via higher-order influence functions. In International Conference on Machine Learning, pages 165-174. PMLR, 2020. +Dougal Maclaurin, David Duvenaud, and Ryan P Adams. Autograd: Effortless gradients in numpy. In ICML 2015 AutoML workshop, volume 238, 2015. + +Vladimir Vovk, Jieli Shen, Valery Manokhin, and Min-ge Xie. Nonparametric predictive distributions based on conformal prediction. In Conformal and Probabilistic Prediction and Applications, pages 82-102. PMLR, 2017. +Vladimir Vovk, Ivan Petej, Ilia Nouretdinov, Valery Manokhin, and Alexander Gammerman. Computationally efficient versions of conformal predictive distributions. Neurocomputing, 397:292-308, 2020. +Vladimir Vovk and Claus Bendtsen. Conformal predictive decision making. In Conformal and Probabilistic Prediction and Applications, pages 52-62. PMLR, 2018. +Min-ge Xie and Zheshi Zheng. Homeostasis phenomenon in conformal prediction and predictive distribution functions. International Journal of Approximate Reasoning, 141:131-145, 2022. +Dheeru Dua and Casey Graff. UCI machine learning repository, 2017. URL http://archive.ics.uci.edu/ml +Paulo Cortez, António Cerdeira, Fernando Almeida, Telmo Matos, and José Reis. Modeling wine preferences by data mining from physicochemical properties. Decision support systems, 47(4): 547-553, 2009. +Kam Hamidieh. A data-driven statistical model for predicting the critical temperature of a superconductor. Computational Materials Science, 154:346-354, 2018. +Michael Redmond and Alok Baveja. A data-driven software tool for enabling cooperative information sharing among police departments. European Journal of Operational Research, 141(3):660-678, 2002. +Mary Feng, Gilmer Valdes, Nayha Dixit, and Timothy D Solberg. Machine learning in radiation oncology: opportunities, requirements, and needs. Frontiers in oncology, 8:110, 2018. +Elizabeth Huynh, Ahmed Hosny, Christian Guthier, Danielle S Bitterman, Steven F Petit, Daphne A Haas-Kogan, Benjamin Kann, Hugo JWL Aerts, and Raymond H Mak. Artificial intelligence in radiation oncology. Nature Reviews Clinical Oncology, 17(12):771-781, 2020. +Saul N Weingart, Lulu Zhang, Megan Sweeney, and Michael Hassett. Chemotherapy medication errors. The Lancet Oncology, 19(4):e191-e199, 2018. +Marcel Van Herk. Errors and margins in radiotherapy. In *Seminars in radiation oncology*, volume 14, pages 52-64. Elsevier, 2004. +Howard Gurney. How to calculate the dose of chemotherapy. British journal of cancer, 86(8): 1297-1302, 2002. +Michael R Cohen, Roger W Anderson, Richard M Attilio, Laurence Green, Raymond J Muller, and Jane M Pruemer. Preventing medication errors in cancer chemotherapy. American Journal of Health-System Pharmacy, 53(7):737-746, 1996. +Steffen Bickel, Michael Brückner, and Tobias Scheffer. Discriminative learning under covariate shift. Journal of Machine Learning Research, 10(9), 2009. +Masashi Sugiyama, Taiji Suzuki, and Takafumi Kanamori. Density ratio estimation in machine learning. Cambridge University Press, 2012. +Arthur Gretton, Alex Smola, Jiayuan Huang, Marcel Schmittfull, Karsten Borgwardt, and Bernhard Schölkopf. Covariate shift by kernel mean matching. *Dataset shift in machine learning*, 3(4):5, 2009. +Yaoliang Yu and Csaba Szepesvári. Analysis of kernel mean matching under covariate shift. arXiv preprint arXiv:1206.4650, 2012. +Kai Zhang, Vincent Zheng, Qiaojun Wang, James Kwok, Qiang Yang, and Ivan Marsic. Covariate shift in hilbert space: A solution via sorrogate kernels. In International Conference on Machine Learning, pages 388-395. PMLR, 2013. + +Yin Zhao, Longjun Cai, et al. Reducing the covariate shift by mirror samples in cross domain alignment. Advances in Neural Information Processing Systems, 34, 2021. +Anqi Liu and Brian Ziebart. Robust classification under sample selection bias. Advances in neural information processing systems, 27, 2014. +Xiangli Chen, Mathew Monfort, Anqi Liu, and Brian D Ziebart. Robust covariate shift regression. In Artificial Intelligence and Statistics, pages 1270-1279. PMLR, 2016. +John C Duchi, Tatsunori Hashimoto, and Hongseok Namkoong. Distributionally robust losses against mixture covariate shifts. Under review, 2, 2019. +Ashkan Rezaei, Anqi Liu, Omid Memarrast, and Brian D Ziebart. Robust fairness under covariate shift. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 9419-9427, 2021. +Luisa Turrin Fernholz. Von Mises calculus for statistical functionals, volume 19. Springer Science & Business Media, 2012. +HG Landau. On dominance relations and the structure of animal societies: Iii the condition for a score structure. The bulletin of mathematical biophysics, 15(2):143-148, 1953. +Sashank Reddi, Barnabas Poczos, and Alex Smola. Doubly robust covariate shift correction. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 29, 2015. +Samyadeep Basu, Philip Pope, and Soheil Feizi. Influence functions in deep learning are fragile. arXiv preprint arXiv:2006.14651, 2020. +Fengpei Li, Henry Lam, and Siddharth Prusty. Robust importance weighting for covariate shift. In International Conference on Artificial Intelligence and Statistics, pages 352-362. PMLR, 2020. +Anastasios Angelopoulos, Stephen Bates, Jitendra Malik, and Michael I Jordan. Uncertainty sets for image classifiers using conformal prediction. arXiv preprint arXiv:2009.14193, 2020. \ No newline at end of file diff --git a/jawsauditingpredictiveuncertaintyundercovariateshift/images.zip b/jawsauditingpredictiveuncertaintyundercovariateshift/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..c2a58edc43b4ce89db8d241074886092b892c7eb --- /dev/null +++ b/jawsauditingpredictiveuncertaintyundercovariateshift/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8f68a414c22544a871b6ba09ccb04655f046bdc589e9123191b6d645b79c1cdb +size 416881 diff --git a/jawsauditingpredictiveuncertaintyundercovariateshift/layout.json b/jawsauditingpredictiveuncertaintyundercovariateshift/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..d492ec35ed9cd7d26863e612cdd348ab5d73b8ce --- /dev/null +++ b/jawsauditingpredictiveuncertaintyundercovariateshift/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6952b0314998e415ce2b379c709f49f0a5015da88f1a125c674b7d688b8297fb +size 529943 diff --git a/jointentropysearchformaximallyinformedbayesianoptimization/b822ea4f-b3a5-40ad-9564-998548737f14_content_list.json b/jointentropysearchformaximallyinformedbayesianoptimization/b822ea4f-b3a5-40ad-9564-998548737f14_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..e0dca6ed94c823af37814bad170d53ca634d407d --- /dev/null +++ b/jointentropysearchformaximallyinformedbayesianoptimization/b822ea4f-b3a5-40ad-9564-998548737f14_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:070253b969a7dd1b952acc1f68e304a350273422fb7a9ce016ae373a1b49c3f7 +size 82889 diff --git a/jointentropysearchformaximallyinformedbayesianoptimization/b822ea4f-b3a5-40ad-9564-998548737f14_model.json b/jointentropysearchformaximallyinformedbayesianoptimization/b822ea4f-b3a5-40ad-9564-998548737f14_model.json new file mode 100644 index 0000000000000000000000000000000000000000..a46f5fbb63ed7fea0f1a7c3fcd6dcca04bc85c86 --- /dev/null +++ b/jointentropysearchformaximallyinformedbayesianoptimization/b822ea4f-b3a5-40ad-9564-998548737f14_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5bc45e2a939b2eee26f5ece85803e3f3ac3846fba936d6f836e0be81f8b1670c +size 99223 diff --git a/jointentropysearchformaximallyinformedbayesianoptimization/b822ea4f-b3a5-40ad-9564-998548737f14_origin.pdf b/jointentropysearchformaximallyinformedbayesianoptimization/b822ea4f-b3a5-40ad-9564-998548737f14_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..dfe8fe5c74d959069381390c1512a57865d19509 --- /dev/null +++ b/jointentropysearchformaximallyinformedbayesianoptimization/b822ea4f-b3a5-40ad-9564-998548737f14_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3b4b3494e09dcd06ab440f566a5573ec7d6fcd430e1e53f8b5c2266fca89bd59 +size 1512663 diff --git a/jointentropysearchformaximallyinformedbayesianoptimization/full.md b/jointentropysearchformaximallyinformedbayesianoptimization/full.md new file mode 100644 index 0000000000000000000000000000000000000000..3e4dbe7330ba18177b3d20c25542e5cb6ae98e1c --- /dev/null +++ b/jointentropysearchformaximallyinformedbayesianoptimization/full.md @@ -0,0 +1,331 @@ +# Joint Entropy Search for Maximally-Informed Bayesian Optimization + +Carl Hvarfner + +carl.hvarfner@cs.lth.se + +Lund University + +Frank Hutter + +fh@cs.uni-freiburg.de + +University of Freiburg + +Bosch Center for Artificial Intelligence + +Luigi Nardi + +luigi.nardi@cs.lth.se + +Lund University + +Stanford University + +DBtune + +# Abstract + +Information-theoretic Bayesian optimization techniques have become popular for optimizing expensive-to-evaluate black-box functions due to their non-myopic qualities. Entropy Search and Predictive Entropy Search both consider the entropy over the optimum in the input space, while the recent Max-value Entropy Search considers the entropy over the optimal value in the output space. We propose Joint Entropy Search (JES), a novel information-theoretic acquisition function that considers an entirely new quantity, namely the entropy over the joint optimal probability density over both input and output space. To incorporate this information, we consider the reduction in entropy from conditioning on fantasized optimal input/output pairs. The resulting approach primarily relies on standard GP machinery and removes complex approximations typically associated with information-theoretic methods. With minimal computational overhead, JES shows superior decision-making, and yields state-of-the-art performance for information-theoretic approaches across a wide suite of tasks. As a light-weight approach with superior results, JES provides a new go-to acquisition function for Bayesian optimization. + +# 1 Introduction + +The optimization of expensive black-box functions is a prominent task, arising across a wide range of applications. Bayesian optimization (BO) [25, 35] is a sample-efficient approach, and has been successfully applied to various problems, including machine learning hyperparameter optimization [2, 20, 33, 37], robotics [3, 6, 23, 24], hardware design [11, 27], and tuning reinforcement learning agents like AlphaGo [7]. In BO, a probabilistic surrogate model is used for modeling the (unknown) objective. The selection policy employed by the BO algorithm is dictated by an acquisition function, which draws on the uncertainty of the surrogate to guide the selection of the next query. + +The choice of acquisition function is significant for the success of the BO algorithm. A popular line of acquisition functions takes an information-theoretic angle, and considers the expected information gain regarding the location of the optimum that is obtained from an upcoming query. Entropy Search (ES) [15], Predictive Entropy Search (PES) [16] and the earlier work of IAGO [46] select queries by maximizing this quantity. While ES and PES are efficient in the number of queries to optimize the objective, they both require significant computational effort and complex approximations of the expected information gain, which impacts their performance and practical use [16, 47]. + +A related information-theoretic family of approaches considers the information gain on the optimal objective value [18, 31, 47]. Max-value Entropy Search (MES) [47] was the first information-theoretic approach to have a proven convergence rate, albeit only in a noiseless problem setting. Moreover, its consideration of a one-dimensional density over the output space as opposed to a $D$ -dimensional input space and a reduction in intricate approximations yielded a computationally efficient alternative to the ES/PES line of approaches. Despite its empirical success, some crucial shortcomings of MES have been highlighted in recent works. Its convergence rate has been disputed [42], and crucially, it does not differentiate between the (unobserved) maximal objective value $f^{*}$ and the observed noisy maximum $y_{max}$ [26, 28, 41, 42]. As such, its assumption on the posterior distribution of the output $p(y|\mathcal{D},\boldsymbol{x})$ does not hold in any setting where noise is present, and several follow-ups have been proposed to address the noisy problem setting [26, 28, 41, 42]. + +We propose an approach which merges the ES/PES and MES lines of work, and provides an all-encompassing perspective on information gain regarding optimality. We introduce Joint Entropy Search (JES), a novel acquisition function which has the following advantages over existing information-theoretic approaches: + +1. It utilizes two sources of information, by considering the entropy over both the optimum and the noiseless optimal value; +2. It utilizes the full optimal observation, allowing it to rely primarily on exact computation through standard GP machinery instead of complex approximations; and +3. It is computationally light-weight, requiring minimal pre-computation relative to other information-theoretic approaches which consider the input space. + +Simultaneously to our work, a similar approach aimed at the multi-objective setting, was proposed by Tu et al. [44]. The authors independently came up with the same JES acquisition function, with a subtly different approximation scheme to the one we present. We see our work as being complementary to theirs because we both demonstrate the effectiveness of this new acquisition function in different settings - theirs being multi-objective and batch evaluations, ours being single-objective and large levels of output noise. Our code for reproducing the experiments is available at https://github.com/hvarfner/JointEntropySearch. + +# 2 Background and related work + +Bayesian optimization. We consider the problem of optimizing a black-box function $f$ across a set of feasible inputs $\mathcal{X} \subset \mathbb{R}^d$ : + +$$ +\boldsymbol {x} ^ {*} \in \underset {\boldsymbol {x} \in \mathcal {X}} {\arg \max } f (\boldsymbol {x}). \tag {1} +$$ + +We assume that $f(\pmb{x})$ is expensive to evaluate, and can potentially only be observed through a noise-corrupted estimate, $y$ , where $y = f(\pmb{x}) + \epsilon, \epsilon \sim \mathcal{N}(0, \sigma_{\epsilon}^{2})$ for some noise level $\sigma_{\epsilon}^{2}$ . In this setting, we wish to maximize $f$ in an efficient manner, typically while adhering to a budget which sets a cap on the number of points that can be evaluated. BO aims to globally maximize $f$ by an initial design and thereafter sequentially choosing new points $\pmb{x}_n$ for some iteration $n$ , creating the data $\mathcal{D}_n = \mathcal{D}_{n-1} \cup \{(\pmb{x}_n, y_n)\}$ . After each new observation, BO constructs a probabilistic surrogate model $p(f|\mathcal{D}_n)$ and uses that surrogate to build an acquisition function $\alpha(\pmb{x}, \mathcal{D}_n)$ . The combination of surrogate model and acquisition function encodes the strategy for selecting the next point $\pmb{x}_{n+1}$ . After the full budget of $N$ iterations is exhausted, a best configuration $\pmb{x}_N^*$ is returned as either the arg max of the observed values, or the optimum as predicted by the surrogate model. + +Gaussian processes. When constructing the surrogate, the most common choice is Gaussian processes (GPs) [30]. Formally, a GP is an infinite collection of random variables, such that every finite subset of those variables follows a multivariate Gaussian distribution. The GP utilizes a covariance function $k$ , which encodes a prior belief for the smoothness of $f$ , and determines how previous observations influence prediction. Given observations $\mathcal{D}_n$ at iteration $n$ , the posterior $p(f|\mathcal{D}_n)$ over the objective is characterized by the posterior mean $m_n$ and variance $s_n$ of the GP: + +$$ +m _ {n} (\pmb {x}) = \mathbf {k} _ {n} (\pmb {x}) ^ {\top} (\mathbf {K} _ {n} + \sigma_ {\epsilon} ^ {2} \mathbf {I}) ^ {- 1} \mathbf {y}, \quad s _ {n} (\pmb {x}) = k (\pmb {x}, \pmb {x}) - \mathbf {k} _ {n} (\pmb {x}) ^ {\top} (\mathbf {K} _ {n} + \sigma_ {\epsilon} ^ {2} \mathbf {I}) ^ {- 1} \mathbf {k} _ {n} (\pmb {x}), \quad (2) +$$ + +where $(\mathbf{K}_n)_{ij} = k(\pmb{x}_i,\pmb{x}_j)$ , $\mathbf{k}_n(\pmb{x}) = [k(\pmb{x},\pmb{x}_1),\dots,k(\pmb{x},\pmb{x}_n)]^\top$ and $\sigma_{\epsilon}^{2}$ is the noise variance. Alternative surrogate models include random forests [19] and Bayesian neural networks [38, 39]. + +Acquisition functions. The acquisition function acts on the surrogate model to quantify the attractiveness of a point in the search space. Acquisition functions employ a trade-off between exploration and exploitation, typically using a greedy heuristic to do so. Simple, computationally cheap heuristics are Expected Improvement (EI) [5, 21]. For a noiseless function, EI selects the next point $\pmb{x}_{n+1}$ as + +$$ +\boldsymbol {x} _ {n + 1} \in \underset {\boldsymbol {x} \in \mathcal {X}} {\arg \max } \mathbb {E} \left[ \left(y _ {n} ^ {*} - y _ {n + 1} ^ {*}\right) ^ {+} \right] = \underset {\boldsymbol {x} \in \mathcal {X}} {\arg \max } Z s _ {n} (\boldsymbol {x}) \Phi (Z) + s _ {n} (\boldsymbol {x}) \phi (Z), \tag {3} +$$ + +where $Z = (y_{n}^{*} - m_{n}(\pmb{x})) / s_{n}(\pmb{x})$ . Other acquisition functions which use similar heuristics are the Upper Confidence Bound (UCB) [40], and Probability of Improvement (PI) [22]. A more sophisticated approach related to EI is Knowledge Gradient (KG) [12]. + +Information-theoretic acquisition functions. Information-theoretic acquisition functions [15, 16, 32, 47] and their various adaptations [1, 17, 34] seek to maximize the expected information gain $I$ from observing a subsequent query $(\pmb{x},y)$ regarding the optimum, $\pmb{x}^*$ . This equates to reducing the uncertainty of the density over the optimum, $p(\pmb{x}^*|\mathcal{D}) = \mathbb{P}(\pmb{x} = \arg \max_{\pmb{x}'\in \mathcal{X}}f(\pmb{x}')|\mathcal{D})$ , using the information obtained through $(\pmb{x},y)$ . By quantifying uncertainty through the differential entropy H, design points are selected based on the expected reduction in this quantity over $p(\pmb{x}^*|\mathcal{D})$ . Formally, this is expressed as the difference between the current entropy over $p(\pmb{x}^*|\mathcal{D})$ , and the expected entropy of that density after observing the next query: + +$$ +\alpha_ {\mathbf {E S}} (\boldsymbol {x}) = I \left(\left(\boldsymbol {x}, y\right); \boldsymbol {x} ^ {*} | \mathcal {D}\right) = \mathrm {H} \left[ p \left(\boldsymbol {x} ^ {*} | \mathcal {D}\right) \right] - \mathbb {E} _ {y} \left[ \mathrm {H} \left[ p \left(\boldsymbol {x} ^ {*} | \mathcal {D} \cup (\boldsymbol {x}, y) \right] \right]. \right. \tag {4} +$$ + +By utilizing the symmetric property of the mutual information, one can arrive at an equivalent expression, where the entropy is computed with regard to the density over the output $y$ , + +$$ +\alpha_ {\mathrm {P E S}} (\boldsymbol {x}) = I (y; (\boldsymbol {x}, \boldsymbol {x} ^ {*}) | \mathcal {D}) = \mathrm {H} [ p (y | \mathcal {D}, \boldsymbol {x}) ] - \mathbb {E} _ {\boldsymbol {x} ^ {*}} \left[ \mathrm {H} [ p (y | \mathcal {D}, \boldsymbol {x}, \boldsymbol {x} ^ {*}) ] \right]. \tag {5} +$$ + +Eq. 4 is the original formulation used in ES [15] and Eq. 5 is the formulation introduced with PES [16]. Both formulations require a series of approximations and expensive computational steps to compute the entropy in the second term. For PES specifically, with $n$ data points of dimension $d$ , the second term is estimated through Monte Carlo (MC) methods by computing Cholesky decompositions of size $\mathcal{O}(n + d^2 / 2)^3$ , and approximating the Hessian at the optimum for each MC sample. + +MES [47] avoids this computational hurdle by considering the information gain $I((\boldsymbol{x}, y); y^*|\mathcal{D})$ regarding the optimal value $y^*$ . As such, it computes the entropy reduction for a one-dimensional density: + +$$ +\alpha_ {\mathrm {M E S}} (\boldsymbol {x}) = I (y; (\boldsymbol {x}, y ^ {*}) | \mathcal {D}) = \mathrm {H} [ p (y | \mathcal {D}, \boldsymbol {x}) ] - \mathbb {E} _ {y ^ {*}} \left[ \mathrm {H} [ p (y | \mathcal {D}, \boldsymbol {x}, y ^ {*}) ] \right]. \tag {6} +$$ + +Here, it is assumed that the posterior predictive distribution $p(y|\mathcal{D},\boldsymbol {x},y^{*})$ is a truncated Gaussian distribution, for which the entropy can be computed in closed form. However, $p(y|\mathcal{D},\boldsymbol {x},y^{*})$ takes this form only in a strictly noiseless setting [28, 41], where it holds true that $f^{*} = y_{max}$ , i.e. when the maximal observation and the optimal value of the objective function coincide. For noisy applications, this assumption leads to an overestimation of the entropy reduction [28]. + +# 3 Joint Entropy Search + +We now present Joint Entropy Search (JES), a novel information-theoretic approach for Bayesian optimization. As for other information-theoretic acquisition functions, JES considers a mutual information quantity. However, unlike its predecessors, JES adds an additional piece of information: compared to ES/PES, it adds the density over the noiseless optimal value $f^{*}$ , and compared to MES, it adds the density over $x^{*}$ . It utilizes a novel two-step reduction in the predictive entropy from conditioning on sampled optima and their associated values. Throughout the section, we will refer to a sampled optimum and its associated value, $(x^{*}, f^{*})$ , as an optimal pair. + +# 3.1 Joint density over the optimum and optimal value: pictorial + +JES considers the joint probability density $p(\pmb{x}^*, f^*)$ over both the optimum $\pmb{x}^*$ and the true, noiseless optimal value $f^*$ . Fig. 1 visualizes the densities $p(\pmb{x}^*)$ and $p(f^*)$ , considered by ES/PES and MES, respectively, and the joint density $p(\pmb{x}^*, f^*)$ , considered by JES. As highlighted by the vertical dashed lines for the point selection of each strategy (bottom), PES chooses strictly to reduce the + +![](images/fc2585c6d4d1878362c06fa35f601e417a9ac20b9f464a3f2ecd0beef1b80aad.jpg) +Distribution over optimum and optimal value +Figure 1: The densities considered by ES/PES (top), MES (right) and JES (center) on a one-dimensional toy example. The multimodal density $p(\pmb{x}^*, f^*)$ is reduced to a heavy-tailed density over $f^*$ for the density used by MES (right), which does not capture the multi-modality of the density over the optimum. The density over $\pmb{x}^*$ used by PES (top) does not capture the apparent exploration/exploitation trade-off that exists between the modes. The acquisition functions and their next point selections are highlighted with dashed lines (bottom). + +uncertainty over $\boldsymbol{x}^*$ , and as such, considers a region where the uncertainty over the optimal value is low. However, it can effectively determine that the right side of the local optimum is more promising to query next. MES seeks to reduce the tail of the probability density over $f^*$ (right), which in this case leads to an exploratory query. JES' joint probability density over optimum and optimal value captures uncertainties over both "where" and "how large" the optimum will be. As such, it selects a point which is uncertain under both measures. As such, JES will learn about likely locations for the optimum, while simultaneously learning probable lower and upper bounds for the optimal value, which by itself yields an effective query strategy [47] and provides valuable knowledge for future queries. For the selected query in Fig. 1, JES will learn substantially about both $\boldsymbol{x}^*$ and $f^*$ by querying it, whereas PES and MES learn only about one of them. + +# 3.2 The Joint Entropy Search acquisition function + +We consider the mutual information between the random variables $(\pmb{x}^{*},f^{*})$ and a future query $(x,y)$ .. + +$$ +\begin{array}{l} \alpha_ {\mathrm {J E S}} (\boldsymbol {x}) = I \left(\left(\boldsymbol {x}, y\right); \left(\boldsymbol {x} ^ {*}, f ^ {*}\right) \mid \mathcal {D} _ {n}\right) (7) \\ = \mathrm {H} [ p (y | \mathcal {D}, \boldsymbol {x}) ] - \mathbb {E} _ {\left(\boldsymbol {x} ^ {*}, f ^ {*}\right)} \left[ \mathrm {H} [ p (y | \mathcal {D}, \boldsymbol {x}, \boldsymbol {x} ^ {*}, f ^ {*}) ] \right] (8) \\ = \mathrm {H} [ p (y | \mathcal {D}, \boldsymbol {x}) ] - \mathbb {E} _ {\left(\boldsymbol {x} ^ {*}, f ^ {*}\right)} \left[ \mathrm {H} [ p (y | \mathcal {D} \cup \left(\boldsymbol {x} ^ {*}, f ^ {*}\right), \boldsymbol {x}, f ^ {*}) ] \right]. (9) \\ \end{array} +$$ + +Eq. 8 is similar to Eq. 6 but with the addition of $x^{*}$ and the replacement of $y^{*}$ with $f^{*}$ in the conditioning of the second term. The expectation is computed with respect to a $D + 1$ -dimensional joint probability density over $x^{*}$ and $f^{*}$ . In Eq. 9, we make it explicit that the conditional density inside the expectation is obtained after 1. Conditioning the GP on the previous data $\mathcal{D}$ , plus one additional noiseless optimal pair $(x^{*}, f^{*})$ , and 2. knowing that the noiseless optimal value is in fact $f^{*}$ . By utilizing the complete observation $(x^{*}, f^{*})$ , we can treat it like any (noiseless) observation. As such, we quantify much of the entropy reduction by utilizing standard GP conditioning functionality. For 2., we cannot globally condition on $f(x') \leq f^{*}, \forall x'$ . As such, we follow previous work [26, 28, 42, 47] and enforce the condition locally at the current query $x$ . The resulting effect is to truncate the GP's posterior over $f$ locally at $x$ , upper bounding it to $f^{*}$ . Notably, utilizing the fantasized observation $(x^{*}, f^{*})$ guarantees that the conditioned optimal value $f^{*}$ in JES is actually obtained, rather than serving as a possibly unattained upper bound, which is typical in the MES family of acquisition functions. The expectation in Eq. 9 is approximated through MC by sampling $L$ optimal pairs $\{(x_{\ell}^{*}, f_{\ell}^{*})\}_{\ell = 1}^{L}$ from $p(x^{*}, f^{*})$ using an approximate version of Thompson Sampling (TS) [43], as explained in Sec. 3.3. In Fig. 2, the resulting posterior distribution of the two-step conditioning is shown in greater detail. As pointed out in [28, 41], after conditioning on $f^{*}$ , the posterior predictive density over $y$ is a sum of a truncated Gaussian distribution over $f$ and the Gaussian noise $\epsilon$ . The entropy reduction from the two-step conditioning yields two separate variance reduction steps over $p(y|D, x)$ : a conditioning term and a truncation term. The former is computed exactly, while the latter, generally smaller term, requires approximation, as shown in Sec. 3.4. + +![](images/e977e2b52daf9fa93179d4650fd2b830157b46191680179af739072745fba520.jpg) +Figure 2: Step-by-step modeling when conditioning on one optimal pair $(\pmb{x}^{*},f^{*})$ . The posterior with noise $p(y|\mathcal{D})$ and without noise $p(f|\mathcal{D})$ are illustrated in blue and yellow, respectively. The GP after 5 (noisy) observations, before conditioning on $(\pmb{x}^{*},f^{*})$ is shown on the left. In the middle panel, we draw $(\pmb{x}^{*},f^{*})$ and condition on it, making $p(f|\mathcal{D}\cup (\pmb{x}^{*},f^{*}))$ a delta distribution at the conditioning point as the fantasized observation $f^{*}$ is noiseless. Since $f^{*}$ is also the presumed noiseless maximum, we truncate its posterior $p(f|\mathcal{D}\cup (\pmb{x}^{*},f^{*}),f^{*})$ globally in the right panel. The observation noise allows for non-zero density on $p(y > f^{*}|\mathcal{D}\cup (\pmb{x}^{*},f^{*}),f^{*})$ . We note that, while the noise is homoscedastic, its relative contribution to the total variance differs over the input space. As such, and since we're plotting standard deviations (not variances), the blue region is wider near observed data, where $p(f|\mathcal{D})$ has lower variance. + +![](images/f5a9623b36edd0b871395d0afd71816d07d7157ce7b60f6e10832129c0ed05ef.jpg) + +![](images/ffa25cdf5a4fe3fe8265106db501b6d2f6af833f11f16275339fbcbf8549a648.jpg) + +![](images/7bf5be35b6337ee478f64b06188224c23b26d021a97f8f5f69377fd901c22909.jpg) +Fig. 3 shows the difference in log variance over $p(y|\mathcal{D},\boldsymbol{x})$ resulting from conditioning (in blue) and truncation (in orange) for the scenario in Fig. 2. The overall reduction is largest close to the point of conditioning, and the truncation term mainly contributes at uncertain regions far away from the conditioned point. Moreover, the magnitude of the conditioning term will rely on the prior variance at the conditioned point, as a larger prior variance will lead to a larger reduction in entropy from conditioning. As we average over optimal pairs, many such entropy reduction terms accumulate. +Figure 3: Reduction in log variance from the conditioning step and the truncation step as visualized in Fig. 2. The local conditioning term (blue), and the globally variance-reducing truncation term (orange). + +# 3.3 Incorporating optimal pairs + +To obtain samples $(\pmb{x}^{*},f^{*})$ , we utilize an approximate variant of TS [43], originally proposed in PES [16]. We utilize Bochner's theorem [4], which, for any stationary kernel $k$ , asserts the existence of its Fourier dual $s(\pmb {w})$ . By normalizing $s(\pmb {w})$ , we obtain the spectral density $p(\pmb {w}) = s(\pmb {w}) / \alpha$ where $\alpha$ is a normalization constant. We can then write the kernel as an expectation, + +$$ +k \left(\boldsymbol {x}, \boldsymbol {x} ^ {\prime}\right) = \alpha \mathbb {E} _ {\boldsymbol {w}} \left[ e ^ {i \boldsymbol {w} ^ {\intercal} \left(\boldsymbol {x} - \boldsymbol {x} ^ {\prime}\right)} \right] = 2 \alpha \mathbb {E} _ {\boldsymbol {w}, \boldsymbol {b}} \left[ \cos \left(\boldsymbol {w} ^ {\intercal} \boldsymbol {x} + \boldsymbol {b}\right) \cos \left(\boldsymbol {w} ^ {\intercal} \boldsymbol {x} ^ {\prime} + \boldsymbol {b}\right) \right], \tag {10} +$$ + +where $\pmb{b} \sim \mathcal{U}(\mathbf{0}, 2\pi \pmb{I})$ . Following Rahimi and Recht [29], we sample $\pmb{b}$ and $\pmb{w}$ to obtain an unbiased estimate of the kernel $k$ . From this approximation, approximate sample paths can be drawn as a weighted sum of basis functions. This form allows for fast and dense querying of the sample paths - the arg max and max of which is an approximate draw from $p(x^{*}, f^{*})$ . In PES, each sample $\pmb{x}_{\ell}^{*}$ along with its inverted Hessian is required for computing the acquisition function. To obtain the Hessian, each sample needs to be thoroughly optimized through gradient-based optimization. JES on the other hand, only requires $(x^{*}, f^{*})$ . As such, it can rely on cheap, approximate optimization of these samples, e.g., by densely querying sample points on a non-uniform grid. + +After obtaining a set of optimal pairs $\{(\pmb{x}_{\ell}^{*},y_{\ell}^{*})\}_{\ell = 1}^{L}$ , JES computes the conditional entropy quantity over the output $y$ . Concretely, we generate $L$ GPs, each modeling a posterior density $\{p(y|\mathcal{D}\cup (\pmb{x}_{\ell}^{*},f_{\ell}^{*}),\pmb {x})\}_{\ell = 1}^{L}$ conditioned on an optimal pair and previously observed data $\mathcal{D}$ . Since each optimal pair is drawn from the current GP hyperparameter set, we know that the current hyperparameter set is the correct one even after adding the optimal pair to the data. By consequence, JES can compute the updated inverse Gram matrix, $(K + \sigma_{\epsilon}^{2})^{-1}$ , through a rank-1 update, instead of solving a linear system + +of equations. Utilizing the Sherman-Morrison formula [36], we obtain updated Gram matrices in $\mathcal{O}(n^2)$ for each sample, as opposed to $\mathcal{O}(n^3)$ for solving the linear system of equations. + +# 3.4 Approximating the truncated entropy + +As highlighted in the right panel of Fig. 2, conditioning on $f^*$ yields a truncated normal distribution $p(f|\mathcal{D} \cup (\pmb{x}^*, f^*), \pmb{x}, f^*)$ after having locally enforced the inequality $f(\pmb{x}) \leq f^*$ . The entropy, however, is computed with regard to the density over noisy observations, $y = f + \epsilon$ , which follows an Extended Skew distribution [28] and as such, does not have tractable entropy. We approximate this quantity through moment matching [26] of the truncated Gaussian distribution over $f$ , which yields a valid lower bound on the information gain [26]. Consequently, we obtain two Gaussian densities $\hat{p}(f|\mathcal{D} \cup (\pmb{x}^*, f^*), \pmb{x}, f^*) \sim \mathcal{N}(m_{f|f^*}, \sigma_{f|f^*}^2)$ and $p(\epsilon) \sim \mathcal{N}(0, \sigma_{\epsilon}^{2})$ , where $m_{f|f^*}$ and $\sigma_{f|f^*}^2$ are the mean and variance of the truncated Gaussian posterior $p(f|\mathcal{D} \cup (\pmb{x}^*, f^*), \pmb{x}, f^*)$ . Due to independence between $f$ and $\epsilon$ and the linearity of Gaussian distributions, we can then compute the entropy of the approximate density $\hat{p}_y$ exactly as $H[\hat{p}(y|\mathcal{D} \cup (\pmb{x}^*, f^*), \pmb{x}, f^*)] = \log(2\pi(\sigma_{\epsilon}^2 + \sigma_{f|f^*}^2))$ . Moreover, the variance of the truncated Gaussian $\sigma_{f|f^*}^2$ is computed as + +$$ +\sigma_ {f \mid f ^ {*}} ^ {2} (\boldsymbol {x}; \mathcal {D} \cup \left(\boldsymbol {x} _ {\ell} ^ {*}, f _ {\ell} ^ {*}\right)) = \sigma_ {T} ^ {2} \left(f ^ {*}; m _ {n} ^ {\ell} (\boldsymbol {x}), s _ {n} ^ {\ell} (\boldsymbol {x})\right) \tag {11} +$$ + +where $\sigma_T^2 (\alpha ;\mu ,\sigma^2)$ is the variance of an upper truncated Gaussian distribution with parameters $(\mu ,\sigma^2)$ , truncated at $\alpha$ , and $m_{n}^{\ell}(\pmb {x})$ and $s_n^\ell (\pmb {x})$ are the mean and covariance functions of the GP which is conditioned on the optimal pair $(\pmb{x}_{\ell}^{*},f_{\ell}^{*})$ . The quality of the moment matching approximation is studied in greater detail in Appendix E. + +# 3.5 Exploitative selection to guard against model misspecification + +As with all information-theoretic approaches, JES aims to reduce the uncertainty over the location of the optimum. With this strategy, the incentive to query the perceived optimum is often lower than for heuristic approaches, such as E.I. In cases where the surrogate model is misspecified, information-theoretic approaches risk reducing the entropy based on a faulty belief of the optimum, which can drastically impact their performance. As a remedy, we utilize a $\gamma$ -exploit approach inspired by the parallel context of AEGIS [9]: with probability $\gamma$ , JES will query the arg max of the posterior mean to confirm its belief of the location of the optimum. If the model is misspecified, these exploitative steps enable the algorithm to reconsider its beliefs, rather than continuing to act based on faulty ones. In Appendix C.2, we show how this approach can substantially improve performance in cases of surrogate model misspecification, while having negligible impact on performance in the worst case. + +# 3.6 Putting it all together: The JES algorithm + +For a sampled set of size $L$ , containing optimal pairs $\{(x_{\ell}^{*},y_{\ell}^{*})\}_{\ell = 1}^{L}$ and GPs with mean and covariance functions $\{m_n^\ell (\pmb {x}),s_n^\ell (\pmb {x})\}_{\ell = 1}^L$ , the expression for the JES acquisition function is + +$$ +\begin{array}{l} \alpha (\boldsymbol {x}) _ {\mathrm {J E S}} = \mathrm {H} [ p (y | \mathcal {D}, \boldsymbol {x}) ] - \mathbb {E} _ {(\boldsymbol {x} ^ {*}, f ^ {*})} \left[ \mathrm {H} [ p (y | \mathcal {D} \cup (\boldsymbol {x} ^ {*}, f ^ {*}), \boldsymbol {x}, f ^ {*}) ] \right] (12) \\ \approx \log \left(2 \pi \left(s _ {n} (\boldsymbol {x}) + \sigma_ {\epsilon} ^ {2}\right)\right) - \frac {1}{L} \sum_ {\ell = 1} ^ {L} \log \left(2 \pi \left(\sigma_ {\epsilon} ^ {2} + \sigma_ {f | f ^ {*}} ^ {2} (\boldsymbol {x}; \mathcal {D} \cup \left(\boldsymbol {x} _ {\ell} ^ {*}, f _ {\ell} ^ {*}\right))\right), \right. (13) \\ \end{array} +$$ + +The first term in 13 is simply the entropy of a Gaussian that can be computed in closed form. The second term contains both the conditioning term, which is exact, and the truncation, which is approximated as described in Sec. 3.4. Algorithm 1 outlines pseudocode for JES in its entirety. + +# 4 Experimental evaluation + +**Benchmarks.** We now evaluate JES on a suite of diverse tasks. We consider three different types of benchmarks: samples drawn from a GP prior, commonly used synthetic test functions [16], and a collection of classification tasks on tabular data using an MLP, provided through HPOBench [10]. For the GP prior tasks, the hyperparameters are known for all methods to evaluate the effect of the acquisition function in isolation. Consequently, we do not use the $\gamma$ -exploit approach from Sec. 3.5 + +# Algorithm 1 JES Algorithm + +1: Input: Black-box function $f$ , input space $\mathcal{X}$ , size $M$ of the initial design, max number of optimization iterations $N$ , number of posterior MC samples $L$ , fraction of exploit samples $\gamma$ . +2: Output: Optimized design $\boldsymbol{x}^*$ . +3: $\mathcal{D}_M \gets \{(\boldsymbol{x}_i, y_i)\}_{i=1}^M$ +4: for $\{n = M + 1, \dots, M + N\}$ do +5: $m(\boldsymbol{x}), s^2(\boldsymbol{x}) \gets \mathrm{FITGP}(\mathcal{D}_{n-1})$ +6: if $\mathrm{RAND}(0,1) < \gamma$ then $\boldsymbol{x}_n \gets \arg \max_{\boldsymbol{x} \in \mathcal{X}} m_n(\boldsymbol{x})$ +7: else +8: for $\{\ell = 1, \dots, L\}$ do +9: $(\boldsymbol{x}_\ell^*, y_\ell^*) \gets \mathrm{TS}(f)$ +10: $p(y|\mathcal{D}_{n-1} \cup (\boldsymbol{x}_\ell^*, f_\ell^*), \boldsymbol{x}) \gets \mathrm{UPDATEGP}(\boldsymbol{x}_\ell^*, f_\ell^*)$ +11: end for +12: $\boldsymbol{x}_n = \arg \max_{\mathcal{X}} \alpha_{\mathrm{JES}}(\boldsymbol{x})$ +13: end if +14: $y_n = f(\boldsymbol{x}_n) + \epsilon$ , $\mathcal{D}_n \gets \mathcal{D}_{n-1} \cup \{(\boldsymbol{x}_n, y_n)\}$ +15: end for +16: return $\boldsymbol{x}^* \gets \arg \max_{\boldsymbol{x} \in \mathcal{X}} m_n(\boldsymbol{x})$ + +in this case (i.e., we set $\gamma = 0$ in Algorithm 1). For the synthetic and MLP tasks, we marginalize over the GP hyperparameters, and set $\gamma = 0.1$ . The hyperparameters of the GP prior experiments can be found in Appendix B, and ablation studies on $\gamma$ in Appendix C. + +Evaluation criteria. We use two types of evaluation criteria as in [47]: simple regret and inference regret. The simple regret $r_n = \max_{\boldsymbol{x} \in \mathcal{X}} f(\boldsymbol{x}) - \max_{t \in [1, n]} f(\boldsymbol{x}_t)$ measures the value of the best queried point so far. After a query, we may infer an arg max of the function, which is chosen as $\boldsymbol{x}_n^* = \arg \max_{\boldsymbol{x} \in \mathcal{X}} m_n(\boldsymbol{x})$ [15, 16, 47]. We denote the inference regret as $r_n = \max_{\boldsymbol{x} \in \mathcal{X}} f(\boldsymbol{x}) - f(\boldsymbol{x}_n^*)$ . Since information-theoretic approaches do not necessarily seek to query the optimum, but only to know its location, inference regret characterizes how satisfying our belief of the arg max is. Notably, this metric is non-monotonic, meaning that the best guess can worsen with time. We use this metric in the ideal model benchmarking setting, when we sample tasks from a GP with known hyperparameters. We use simple regret for the synthetic test functions, as it constitutes a metric that is more robust to surrogate model misspecification. Inference regret for these tasks can be found in Appendix F. For the HPOBench tasks, inference regret is unobtainable. + +The experimental setup. We compare against other state-of-the-art information-theoretic approaches: PES [16] and MES [47], as well as EI [21]. The acquisition functions are all run in the same framework written in MATLAB, created for the original PES implementation by Hernández-Lobato et al. [16]. All synthetic experiments were run for $50D$ iterations. In the main paper, we fix the number of MC samples for MES, PES and JES to 100 each. In Appendix D we assess the sensitivity of JES to this number and quantify the computational expense. In Appendix B, we provide all details on our experimental setup, including the runtime tests. + +# 4.1 GP prior samples + +We consider samples from a GP prior for four different dimensionalities: 2D, 4D, 6D, and 12D, with a noise standard deviation of 0.1 for a range of outputs spanning roughly $[-10, 10]$ . These tasks constitute an optimal setting for each algorithm, as the surrogate perfectly models the task at hand. In Fig. 5, JES demonstrates empirically the value of the additional source of information, substantially outperforming PES and MES on all tasks. + +Fig. 4 compares JES (top left) against PES, MES and EI in terms of point selection for one repetition on a two-dimensional sample task, where all runs are initialized with $D + 1$ identical random samples. We observe that JES succeeds in finding all attractive regions of the search space, and queries the region around the optimum densely, which is sensible in a noisy setting. We further notice that EI (bottom right) fails to query the two circled local optima. PES (bottom left) also ignores two local optima to various degrees, and tends to circle the (perceived) optimum densely, which is expensive in terms of number of evaluations. We believe this showcases a shortcoming of only + +![](images/c5c2e17167909f6a1b5e487e6c05939e82fbe8501c56f2b3288974927a2c16ca.jpg) + +![](images/3e7824f0dead7a631a23226c000acbb885a46d8c7ab07fd8502ded696cfa3652.jpg) + +![](images/da593b1b9b8066120d9f3f995290b8501f67cab44a225db5e70b06200609ffbd.jpg) +Figure 4: Comparison of queries for JES (top left), MES (top right), PES (bottom left) and EI (bottom right) on a sample of a 2D GP after a 100 function evaluations. The global optimum is circled in white, and four local optima in grey. Earlier queries are colored yellow, and later queries red. + +![](images/b2e535f91d3ea55cb01e64bfc2c5832076baf3d08e796cee7ea4f39faa590a62.jpg) +Figure 5: Comparison of JES, MES, PES and EI on GP prior samples. We run 1000 repetitions each for 2, 4 and 6D, and 250 on 12D. Mean and 2 standard errors of log regret are displayed for each acquisition function. The vertical dashed line shows the end of the initial design phase. + +![](images/04e20d43993b0936b65ba4d8521d533f9f334eb4a41421868617ac6ed83a3397.jpg) + +![](images/8d27f68fefeb6fa2fc3bc51f748c8d675125b14c2db7b174b284ddb1278eb7e7.jpg) + +![](images/4fda7c1f6f18021e83f19b8b77b61ff25dc8ed2915b3f5a5a251975c306686b3.jpg) + +![](images/c83e5864b044bef0791f732fe1be90c56cad00909e79e584d6ae1abefe47964e.jpg) + +considering the density over the optimum: PES circles the optimum, but does not query its value. Lastly, MES (top right) successfully queries all attractive regions of the space, but also samples regions that are evidently poor the most densely out of the four approaches, despite information given by earlier (brighter) samples. Since JES considers the information conveyed by both MES and PES, it successfully excludes the apparent suboptimal regions of the space, finds all relevant optima, and queries these optima in a desirable manner. + +We additionally evaluate the performance of all approaches on GP sample tasks that have a substantial amount of noise - its standard deviation roughly accounting for $10\%$ of the total output range. We run these tasks with the GP hyperparameters fixed a priori for a larger number of iterations, 125D, to display the stagnation of some approaches. While MES and PES slow down approximately at the halfway point for both tasks, JES steadily improves for the entire length of the run. This robustness to large noise magnitudes highlights the importance of intrinsically handling noisy objectives in JES. + +![](images/47a8e9e0841b613a76804ad5a3c0b65349e862b1472dbc97ecd38fdfb4adea9a.jpg) +Figure 6: Evaluation of JES, MES, PES and EI on noisy $(\sigma_{\epsilon}^{2} = 4$ orange) GP sample tasks across 100 repetitions. Mean and 2 standard errors of log regret are displayed for each acquisition function. + +![](images/dd437679495ac6088681c519a273aea4f681f08048de680e1a7b483550004bf9.jpg) + +
TaskJES-100MES-100PES-100EI
2D1.40 ± 0.321.03 ± 0.1917.39 ± 4.950.23 ± 0.13
4D1.50 ± 0.371.21 ± 0.334.53 ± 8.30.3 ± 0.17
6D1.56 ± 0.391.26 ± 0.3762.92 ± 13.540.35 ± 0.2
+ +Table 1: Runtime of JES, MES, PES and EI on GP sample tasks of varying dimensionalities. JES is only marginally slower than MES, and orders of magnitude faster than PES. + +In Table 1, we display the runtime of each acquisition function on these tasks when marginalizing over 10 sets hyperparameters, and sampling 10 optima per set. We time each iteration from after hyperparameters have been sampled, up until (but excluding) the query of the black-box function. Thus, acquisition function pre-computation and optimization are included. The runtime of JES is only marginally slower than that of MES with Gumbel sampling, while being at least an order of magnitude faster than PES for all displayed dimensionalities. + +# 4.2 Synthetic test functions + +Next, in Fig. 7, we study the performance of JES on three optimization test functions: Branin (2D), Hartmann (3D) and Hartmann (6D). For these tasks, we follow convention [16, 31] and marginalize over GP hyperparameters. On Branin, JES starts out slightly slower than MES but reaches the same performance in 100 iterations; and on the two Hartmann functions, JES performs amongst the best in the beginning and clearly best in the end. We note that PES experienced numerical issues on Branin, and as such, we acknowledge that its performance should be better than what is reported. + +![](images/f0dd77e48ce8fe12e4c677da7634afd62728071e0c53f17bd36f35dbce07792e.jpg) +Figure 7: Comparison of JES, MES, PES and EI on Branin and Hartmann-6, $\sigma_{n}^{2} = 0.10$ . Mean and 2 standard errors of log regret are displayed for each acquisition function across 100 repetitions. The vertical dashed line represents the end of the initial design phase. + +![](images/e0879d1015e83010c948a32c8372e8b4da2b97ab8d76b4ad3287c92570560ebf.jpg) + +![](images/b9448622b23fe558d732b4cbc9188e07641d4cfd0b1099aedc92245c562ac26f.jpg) + +# 4.3 MLP tasks + +Lastly, we evaluate the performance of JES on the tuning an MLP model's 4 hyperparameters for 20D iterations on six datasets. These tasks are part of the OpenML library of tasks, and the HPO benchmark is provided through the HPOBench [10] suite. We measure the best observed classification accuracy. Notably, these tasks have a large amount of noise, which causes the performance to fluctuate substantially between repetitions. We observe that JES performs substantially better on two tasks, and is approximately equal in performance to EI on three, with EI being superior in one task. JES displays superior or equal performance to MES on all tasks, with PES lagging behind. + +![](images/5c48ba582280e2fd84ee0b709188b5bdcec54e3aeb6c1a376652feafd1079af9.jpg) + +![](images/8b851dda799644548cc3abd2905574d21f82da15fe725ab157717f76f71dac1c.jpg) + +![](images/bf095072fc8858436e0c5cab71b7009bb111d8412a68f02a0ed232467ceec7c4.jpg) + +![](images/1709f62b1db0d90a318d72808a1612e1c1acb804c6be11c53ed832a2b6a4447b.jpg) +Figure 8: Comparison of JES, MES, PES and EI on six different MLP tuning tasks from the HPOBench suite. Mean and 1 standard error of best observed accuracy are displayed for each acquisition function across 100 repetitions. The vertical dashed line represents the end of the initial design phase. + +![](images/30520697d83f8588badc6db789cc6f001eefa999caca8717e8f5bbca2f954bd8.jpg) + +![](images/76285c3d1f1a3973864edc26e3afebb5587bad817a0e4e69a644ed16c552d4fd.jpg) + +# 5 Conclusions + +We have presented Joint Entropy Search, an information-theoretic acquisition function that considers an entirely new quantity, namely the joint density over the optimum and optimal value. By utilizing the entropy reduction from fantasized optimal observations, JES obtains a simple form for the entropy reduction regarding the joint distribution. As such, the additional information considered comes with minimal computational overhead, avoids restrictive assumptions on the objective, and yields state-of-the-art performance along with superior decision-making. We believe JES to be a new go-to acquisition function for BO, and to establish a new standard for subsequent information-theoretic techniques. + +# 6 Limitations and Future Work + +The main contribution of this paper is to provide a novel information-theoretic acquisition function which, given a sufficiently accurate model, yields impressive results. However, the non-myopic, speculative nature of information-theoretic approaches lend them to be susceptible to model misspecification, such as a poor choice of GP kernel or GP hyperparameters. In our view, information-theoretic approaches are possibly more susceptible to this issue than their myopic counterparts (EI, UCB, TS). While we propose a remedy to stabilize and improve the acquisition function under model misspecification with the $\gamma$ -exploit approach, this technique only serves to discover misspecification and adjust accordingly, but not to inherently fix the misspecification. We believe misspecification can only be remedied by altering the surrogate model. It is thus very promising to combine advanced modelling techniques with information-theoretic acquisition functions, as already done with the additive GP approach utilized in conjunction with MES by Wang and Jegelka [47]; further promising additions would be to tackle heterogeneous noise and input warping as done by HEBO [8]. + +We also note that, since JES computes the entropy reduction from conditioning on the optimal pair, it relies on some level of noise in the objective. A surrogate model with zero noise will result in an infinite information gain for every optimal pair, which (by utilizing some random tie-breaking strategy) would make JES equivalent to TS. However, if JES is to be used in a completely noiseless setting, we argue that a small noise term should be added as a remedy. As this is done by default in many prominent GP frameworks [13, 14, 45], we do not view this as a major limitation of our approach. Nevertheless, improving upon this strategy would be interesting in future work. + +For future work, we also envision work on the adaptation of JES to various different domains, such as multi-fidelity [48] and multi-objective optimization [1], as well as the integration of user prior knowledge over the location of the optimum [20] to accelerate optimization. + +# Acknowledgments and Disclosure of Funding + +Luigi Nardi was supported in part by affiliate members and other supporters of the Stanford DAWN project — Ant Financial, Facebook, Google, Intel, Microsoft, NEC, SAP, Teradata, and VMware. Carl Hvarfner and Luigi Nardi were partially supported by the Wallenberg AI, Autonomous Systems and Software Program (WASP) funded by the Knut and Alice Wallenberg Foundation. Luigi Nardi was partially supported by the Wallenberg Launch Pad (WALP) grant Dnr 2021.0348. Frank Hutter acknowledges support through TAILOR, a project funded by the EU Horizon 2020 research and innovation programme under GA No 952215, by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under grant number 417962828, by the state of Baden-Württemberg through bwHPC and the German Research Foundation (DFG) through grant no INST 39/963-1 FUGG, and by the European Research Council (ERC) Consolidator Grant “Deep Learning 2.0” (grant no. 101045765). The computations were also enabled by resources provided by the Swedish National Infrastructure for Computing (SNIC) at LUNARC partially funded by the Swedish Research Council through grant agreement no. 2018-05973. Funded by the European Union. Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or the ERC. Neither the European Union nor the ERC can be held responsible for them. + +# References + +[1] S. Belakaria, A. Deshwal, and J. R. Doppa. Max-value entropy search for multi-objective bayesian optimization. Advances in neural information processing systems, 32, 2019. +[2] J. Bergstra, R. Bardenet, Y. Bengio, and B. Kégl. Algorithms for Hyper-Parameter Optimization. In Advances in Neural Information Processing Systems (NeurIPS), volume 24. Curran Associates, Inc., 2011. +[3] F. Berkenkamp, A. Krause, and A. Schoellig. Bayesian optimization with safety constraints: Safe and automatic parameter tuning in robotics. Machine Learning, 06 2021. doi: 10.1007/s10994-021-06019-1. +[4] S. Bochner et al. Lectures on Fourier integrals, volume 42. Princeton University Press, 1959. +[5] A. D. Bull. Convergence rates of efficient global optimization algorithms. 12:2879-2904, 2011. +[6] R. Calandra, N. Gopalan, A. Seyfarth, J. Peters, and M. Deisenroth. Bayesian gait optimization for bipedal locomotion. In P. Pardalos and M. Resende, editors, Proceedings of the Eighth International Conference on Learning and Intelligent Optimization (LION'14), 2014. +[7] Y. Chen, A. Huang, Z. Wang, I. Antonoglou, J. Schrittwieser, D. Silver, and N. de Freitas. Bayesian optimization in alphago. CoRR, abs/1812.06855, 2018. URL http://arxiv.org/abs/1812.06855. +[8] A. I. Cowen-Rivers, W. Lyu, Z. Wang, R. Tutunov, J. Hao, J. Wang, and H. Bou-Ammar. HEBO: heteroscedastic evolutionary bayesian optimisation. CoRR, abs/2012.03826, 2020. URL https://arxiv.org/abs/2012.03826. +[9] G. De Ath, R. M. Everson, and J. E. Fieldsend. Asynchronous $\epsilon$ -greedy bayesian optimisation. In C. de Campos and M. H. Maathuis, editors, Proceedings of the Thirty-Seventh Conference on Uncertainty in Artificial Intelligence, volume 161 of Proceedings of Machine Learning Research, pages 578-588, 27-30 Jul 2021. +[10] K. Eggensperger, P. Müller, N. Mallik, M. Feurer, R. Sass, A. Klein, N. Awad, M. Lindauer, and F. Hutter. HPOBench: A collection of reproducible multi-fidelity benchmark problems for HPO. In Thirty-fifth Conference on Neural Information Processing Systems Datasets and Benchmarks Track (Round 2), 2021. URL https://openreview.net/forum?id=1k4rJYEwda-. +[11] A. Ejjeh, L. Medvinsky, A. Councilman, H. Nehra, S. Sharma, V. Adve, L. Nardi, E. Nurvitadhi, and R. A. Rutenbar. Hpvm2fpga: Enabling true hardware-agnostic fpga programming. In Proceedings of the 33rd IEEE International Conference on Application-specific Systems, Architectures, and Processors, 2022. +[12] P. I. Frazier. A tutorial on bayesian optimization. arXiv preprint arXiv:1807.02811, 2018. +[13] J. R. Gardner, G. Pleiss, D. Bindel, K. Q. Weinberger, and A. G. Wilson. Gpytorch: Black-box matrix-matrix gaussian process inference withgpu acceleration. In Advances in Neural Information Processing Systems, 2018. +[14] GPy. GPy: A gaussian process framework in python. http://github.com/SheffieldML/GPy, since 2012. +[15] P. Hennig and C. J. Schuler. Entropy search for information-efficient global optimization. Journal of Machine Learning Research, 13(1):1809-1837, June 2012. ISSN 1532-4435. +[16] J. M. Hernández-Lobato, M. W. Hoffman, and Z. Ghahramani. Predictive entropy search for efficient global optimization of black-box functions. In Advances in Neural Information Processing Systems, 2014. URL https://proceedings.neurips.cc/paper/2014/file/069d3bb002acd8d7dd095917f9efe4cb-Paper.pdf. +[17] J. M. Hernández-Lobato, M. Gelbart, M. Hoffman, R. Adams, and Z. Ghahramani. Predictive entropy search for bayesian optimization with unknown constraints. In International conference on machine learning, pages 1699-1707. PMLR, 2015. + +[18] M. W. Hoffman and Z. Ghahramani. Output-space predictive entropy search for flexible global optimization. 2016. +[19] F. Hutter, H. H. Hoos, and K. Leyton-Brown. Sequential model-based optimization for general algorithm configuration. In Learning and Intelligent Optimization, 2011. +[20] C. Hvarfner, D. Stoll, A. Souza, L. Nardi, M. Lindauer, and F. Hutter. PiBO: Augmenting Acquisition Functions with User Beliefs for Bayesian Optimization. In International Conference on Learning Representations, 2022. +[21] D. Jones, M. Schonlau, and W. Welch. Efficient global optimization of expensive black box functions. 13:455-492, 1998. +[22] H. J. Kushner. A New Method of Locating the Maximum Point of an Arbitrary Multipeak Curve in the Presence of Noise. Journal of Basic Engineering, 86(1):97-106, 03 1964. ISSN 0021-9223. doi: 10.1115/1.3653121. URL https://doi.org/10.1115/1.3653121. +[23] M. Mayr, F. Ahmad, K. I. Chatzilygeroudis, L. Nardi, and V. Krüger. Skill-based Multi-objective Reinforcement Learning of Industrial Robot Tasks with Planning and Knowledge Integration. CoRR, abs/2203.10033, 2022. URL https://doi.org/10.48550/arXiv.2203.10033. +[24] M. Mayr, C. Hvarfner, K. Chatzilygeroudis, L. Nardi, and V. Krueger. Learning skill-based industrial robot tasks with user priors. IEEE 18th International Conference on Automation Science and Engineering, 2022. URL https://arxiv.org/abs/2208.01605. +[25] J. Mockus, V. Tiesis, and A. Zilinskas. The application of Bayesian methods for seeking the extremum. Towards Global Optimization, 2(117-129):2, 1978. +[26] H. B. Moss, D. S. Leslie, J. Gonzalez, and P. Rayson. Gibbon: General-purpose information-based bayesian optimisation. Journal of Machine Learning Research, 22(235):1-49, 2021. URL http://jmlr.org/papers/v22/21-0120.html. +[27] L. Nardi, D. Koeplinger, and K. Olukotun. Practical design space exploration. In 2019 IEEE 27th International Symposium on Modeling, Analysis, and Simulation of Computer and Telecommunication Systems (MASCOTS), pages 347-358. IEEE, 2019. +[28] Q. P. Nguyen, B. K. H. Low, and P. Jaillet. Rectified max-value entropy search for bayesian optimization, 2022. URL https://arxiv.org/abs/2202.13597. +[29] A. Rahimi and B. Recht. Random features for large-scale kernel machines. In Proceedings of the 20th International Conference on Neural Information Processing Systems, Advances in Neural Information Processing Systems, page 1177-1184, Red Hook, NY, USA, 2007. Curran Associates Inc. ISBN 9781605603520. +[30] C. Rasmussen and C. Williams. Gaussian Processes for Machine Learning. The MIT Press, 2006. +[31] B. Ru, M. A. Osborne, M. Mcleod, and D. Granziol. Fast information-theoretic Bayesian optimisation. In J. Dy and A. Krause, editors, Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pages 4384-4392. PMLR, 10-15 Jul 2018. URL https://proceedings.mlr.press/v80/ru18a.htm1. +[32] D. Russo and B. Van Roy. Learning to optimize via information-directed sampling. Advances in Neural Information Processing Systems, 27, 2014. +[33] K. Šehić, A. Gramfort, J. Salmon, and L. Nardi. LassoBench: A High-Dimensional Hyperparameter Optimization Benchmark Suite for Lasso. arXiv preprint arXiv:2111.02790, 2021. +[34] A. Shah and Z. Ghahramani. Parallel predictive entropy search for batch global optimization of expensive objective functions. Advances in neural information processing systems, 28, 2015. +[35] B. Shahriari, K. Swersky, Z. Wang, R. Adams, and N. de Freitas. Taking the human out of the loop: A review of Bayesian optimization. Proceedings of the IEEE, 104(1):148-175, 2016. + +[36] J. Sherman and W. J. Morrison. Adjustment of an Inverse Matrix Corresponding to a Change in One Element of a Given Matrix. The Annals of Mathematical Statistics, 21(1):124 - 127, 1950. doi: 10.1214/aoms/1177729893. URL https://doi.org/10.1214/aoms/1177729893. +[37] J. Snoek, H. Larochelle, and R. Adams. Practical Bayesian optimization of machine learning algorithms. In P. Bartlett, F. Pereira, C. Burges, L. Bottou, and K. Weinberger, editors, Proceedings of the 26th International Conference on Advances in Neural Information Processing Systems (NeurIPS'12), pages 2960-2968, 2012. +[38] J. Snoek, O. Rippel, K. Swersky, R. Kiros, N. Satish, N. Sundaram, M. Patwary, Prabhat, and R. Adams. Scalable Bayesian optimization using deep neural networks. In F. Bach and D. Blei, editors, Proceedings of the 32nd International Conference on Machine Learning (ICML'15), volume 37, pages 2171-2180. Omnipress, 2015. +[39] J. Springenberg, A. Klein, S. Falkner, and F. Hutter. Bayesian optimization with robust Bayesian neural networks. In D. Lee, M. Sugiyama, U. von Luxburg, I. Guyon, and R. Garnett, editors, Proceedings of the 30th International Conference on Advances in Neural Information Processing Systems (NeurIPS'16), 2016. +[40] N. Srinivas, A. Krause, S. M. Kakade, and M. W. Seeger. Information-theoretic regret bounds for gaussian process optimization in the bandit setting. IEEE Transactions on Information Theory, 58(5):3250-3265, May 2012. ISSN 1557-9654. doi: 10.1109/tit.2011.2182033. URL http://dx.doi.org/10.1109/TIT.2011.2182033. +[41] S. Takeno, H. Fukuoka, Y. Tsukada, T. Koyama, M. Shiga, I. Takeuchi, and M. Karasuyama. Multi-fidelity Bayesian optimization with max-value entropy search and its parallelization. In H. D. III and A. Singh, editors, Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pages 9334-9345. PMLR, 13-18 Jul 2020. URL https://proceedings.mlr.press/v119/takeno20a.html. +[42] S. Takeno, T. Tamura, K. Shitara, and M. Karasuyama. Sequential and parallel constrained max-value entropy search via information lower bound. In K. Chaudhuri, S. Jegelka, L. Song, C. Szepesvari, G. Niu, and S. Sabato, editors, Proceedings of the 39th International Conference on Machine Learning, volume 162 of Proceedings of Machine Learning Research, pages 20960-20986. PMLR, 17-23 Jul 2022. URL https://proceedings.mlr.press/v162/takeno22a.html. +[43] W. Thompson. On the likelihood that one unknown probability exceeds another in view of the evidence of two samples. Biometrika, 25(3/4):285-294, 1933. +[44] B. Tu, A. Gandy, N. Kantas, and B. Shafei. Joint entropy search for multi-objective bayesian optimization. arXiv preprint arXiv:2210.02905, 2022. +[45] J. Vanhatalo, J. Riihimäki, J. Hartikainen, P. Jylänki, V. Tolvanen, and A. Vehtari. Gpstuff: Bayesian modeling with gaussian processes. Journal of Machine Learning Research, 14: 1175-1179, Apr. 2013. ISSN 1532-4435. +[46] J. Villemonteix, E. Vazquez, and E. Walter. An informational approach to the global optimization of expensive-to-evaluate functions. Journal of Global Optimization, 44, 12 2006. doi: 10.1007/s10898-008-9354-2. +[47] Z. Wang and S. Jegelka. Max-value entropy search for efficient bayesian optimization. In International Conference on Machine Learning (ICML), 2017. +[48] Y. Zhang, T. N. Hoang, B. K. H. Low, and M. Kankanhalli. Information-based multi-fidelity bayesian optimization. In NeurIPS Workshop on Bayesian Optimization, 2017. \ No newline at end of file diff --git a/jointentropysearchformaximallyinformedbayesianoptimization/images.zip b/jointentropysearchformaximallyinformedbayesianoptimization/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..123e7b195fc1f7beeabc67125b61c6781fbc1fa7 --- /dev/null +++ b/jointentropysearchformaximallyinformedbayesianoptimization/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce9bf9b6d9a070ada8396f6c6073593525c13c88858c91f184a4f6ec1a1a5cc9 +size 515299 diff --git a/jointentropysearchformaximallyinformedbayesianoptimization/layout.json b/jointentropysearchformaximallyinformedbayesianoptimization/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..7942a5383cd3ec7b8051cc2ee8e6a3c6efac0ab9 --- /dev/null +++ b/jointentropysearchformaximallyinformedbayesianoptimization/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f551f8f055ad8227e9a292565c68b87f0ec466a098a77c5cda061616e9b1fa0f +size 477805 diff --git a/jointentropysearchformultiobjectivebayesianoptimization/2b1c010f-13fe-4936-83f3-5f4d71cbcdb8_content_list.json b/jointentropysearchformultiobjectivebayesianoptimization/2b1c010f-13fe-4936-83f3-5f4d71cbcdb8_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..71bf1df0e3e4a30f6d5d82eb5f59bd2acb6281be --- /dev/null +++ b/jointentropysearchformultiobjectivebayesianoptimization/2b1c010f-13fe-4936-83f3-5f4d71cbcdb8_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:196aacbb29407e062aeaef16c727b6e25ca0db3b9c7c4388c531d8bf99f1b7f3 +size 107880 diff --git a/jointentropysearchformultiobjectivebayesianoptimization/2b1c010f-13fe-4936-83f3-5f4d71cbcdb8_model.json b/jointentropysearchformultiobjectivebayesianoptimization/2b1c010f-13fe-4936-83f3-5f4d71cbcdb8_model.json new file mode 100644 index 0000000000000000000000000000000000000000..1bbeb7e8cf61c44419ce87b0dd8a3769da7db2b0 --- /dev/null +++ b/jointentropysearchformultiobjectivebayesianoptimization/2b1c010f-13fe-4936-83f3-5f4d71cbcdb8_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce337c2519b38817679f93edb4b11bf3898f13702540947683276f76dafc6353 +size 138164 diff --git a/jointentropysearchformultiobjectivebayesianoptimization/2b1c010f-13fe-4936-83f3-5f4d71cbcdb8_origin.pdf b/jointentropysearchformultiobjectivebayesianoptimization/2b1c010f-13fe-4936-83f3-5f4d71cbcdb8_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..6e726064a78c8c9b6900817544b7328556ce8cd2 --- /dev/null +++ b/jointentropysearchformultiobjectivebayesianoptimization/2b1c010f-13fe-4936-83f3-5f4d71cbcdb8_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47e06654a6296de33dcb331835b39edf9656756e495694c4356b4f42069463b2 +size 4120792 diff --git a/jointentropysearchformultiobjectivebayesianoptimization/full.md b/jointentropysearchformultiobjectivebayesianoptimization/full.md new file mode 100644 index 0000000000000000000000000000000000000000..97b9001711dc710906367e6b7b466239576a0748 --- /dev/null +++ b/jointentropysearchformultiobjectivebayesianoptimization/full.md @@ -0,0 +1,471 @@ +# Joint Entropy Search for Multi-Objective Bayesian Optimization + +Ben Tu† Axel Gandy† Nikolas Kantas† Behrang Shafei‡ + +†Imperial College London + +$\ddagger$ BASF SE + +ben.tu16@imperial.ac.uk + +# Abstract + +Many real-world problems can be phrased as a multi-objective optimization problem, where the goal is to identify the best set of compromises between the competing objectives. Multi-objective Bayesian optimization (BO) is a sample efficient strategy that can be deployed to solve these vector-valued optimization problems where access is limited to a number of noisy objective function evaluations. In this paper, we propose a novel information-theoretic acquisition function for BO called Joint Entropy Search (JES), which considers the joint information gain for the optimal set of inputs and outputs. We present several analytical approximations to the JES acquisition function and also introduce an extension to the batch setting. We showcase the effectiveness of this new approach on a range of synthetic and real-world problems in terms of the hypervolume and its weighted variants. + +# 1 Introduction + +Bayesian optimization (BO) has demonstrated a lot of success in solving black-box optimization problems in various domains such as machine learning [76, 77, 91], chemistry [27, 35], robotics [7, 14] and clinical trials [63, 79]. The procedure works by maintaining a probabilistic model of the observed data in order to guide the optimization procedure into regions of interest. Specifically, at each iteration the black-box function is evaluated at one or more input locations that maximizes an acquisition function on the model. Implicitly, this function strikes a balance between exploring new areas and exploiting areas that have been shown to be promising. In this work, we consider the more general problem, where the black-box function of interest is vector-valued. This increases the difficulty of the problem because there are now many directions in which the objectives can be improved, in contrast to the single-objective setting where there is only one. Informally, the end goal of multi-objective optimization is to identify a collection of points that describe the best trade-offs between the different objectives. + +There are several ways to define an acquisition function for multi-objective BO. A popular strategy is random scalarization [51, 64], which works by transforming the multi-objective problem into a distribution of single-objective problems. These approaches are appealing because they enable the use of standard single-objective acquisition functions. A weakness of this approach is that it relies on random sampling to encourage exploration and therefore the performance of this method might suffer early on when the scale of the objectives is unknown or when either the input space or the objective space is high-dimensional [21, 64]. Another popular class of multi-objective acquisition functions are improvement-based. These strategies focus on improving a performance metric over sets, for example the hypervolume indicator [18, 19, 26, 93] or the R2 indicator [24]. The main drawback of these approaches is that the performance of these methods can be biased towards a single performance metric, which can be inadequate to assess the multi-objective aspects of the problem [98]. There are also many other multi-objective acquisition functions discussed in the litera + +ture, which mainly differ by how they navigate the exploration-exploitation trade-off [8, 9, 52, 68, 69]. + +Instead of relying on scalarizations or an improvement-based criterion, this paper considers the perspective where the goal of interest is to improve the posterior distribution over the optimal points. We propose a novel information-theoretic acquisition function called the Joint Entropy Search (JES), which assesses how informative an observation will be in learning more about the joint distribution of the optimal inputs and outputs. This acquisition function combines the advantages of existing information-theoretic methods, which focus solely on improving the posterior of either the optimal inputs [31, 33, 39] or the optimal outputs [4, 6, 80]. We connect JES with the existing information-theoretic acquisition functions by showing that it is an upper bound to these utilities. + +After acceptance of this work, we learnt of a parallel line of inquiry by Hvarfner et al. [46], who independently came up with the same JES acquisition function (3). Their work focussed on the single-objective setting and the approximation scheme they devised is subtly different to the ones we present. We see our work as being complementary to theirs because we both demonstrate the effectiveness of this new acquisition function in different settings. + +Contributions and organization. In Section 2, we set up the problem and introduce the novel JES acquisition function. In Section 3, we present a catalogue of conditional entropy estimates to approximate this utility and present a simple extension to the batch setting. These approximations are analytically tractable and differentiable, which means that we can take advantage of gradient-based optimization. The main results that we developed here can be viewed as direct extensions to the recent work in the Bayesian optimization literature by Suzuki et al. [80] and Moss et al. [59]. In Section 4, we present a discussion on the hypervolume indicator and explain how it can be a misleading performance criterion because it is sensitive to the scale of the objectives. We show that information-theoretic approaches are naturally invariant to reparameterization of the objectives, which make them well-suited for multi-objective black-box optimization. For a more complete picture of performance, we propose a novel weighted hypervolume strategy (Appendix K), which allows us to assess the performance of a multi-objective algorithm over different parts of the objective space. In Section 5, we demonstrate the effectiveness of JES on some synthetic and real-life multi-objective problems. Finally in Section 6, we provide some concluding remarks. Additional results and proofs are presented in the Appendix. + +# 2 Preliminaries + +We consider the problem of maximizing a vector-valued function $f: \mathbb{X} \to \mathbb{R}^M$ over a bounded space of inputs $\mathbb{X} \subset \mathbb{R}^D$ . To define the maximum $\max_{\mathbf{x} \in \mathbb{X}} f(\mathbf{x})$ , we appeal to the Pareto partial ordering in $\mathbb{R}^M$ . For the rest of this paper, we will denote vectors by $\mathbf{y} = (y^{(1)}, \ldots, y^{(M)}) \in \mathbb{R}^M$ , the non-negative real numbers by $\mathbb{R}_{\geq 0}$ and diagonal matrices by $\mathrm{diag}(\cdot)$ . + +Pareto domination. We say a vector $\mathbf{y} \in \mathbb{R}^M$ weakly Pareto dominates another vector $\mathbf{y}' \in \mathbb{R}^M$ if it performs just as well in all objectives if not better: $\mathbf{y} \succeq \mathbf{y}' \Longleftrightarrow \mathbf{y} - \mathbf{y}' \in \mathbb{R}_{\geq 0}^M$ . Additionally, if the vectors are not equivalent, $\mathbf{y} \neq \mathbf{y}'$ , then we say strict Pareto domination holds: $\mathbf{y} \succ \mathbf{y}' \Longleftrightarrow \mathbf{y} - \mathbf{y}' \in \mathbb{R}_{\geq 0}^M \setminus \{\mathbf{0}_M\}$ , where $\mathbf{0}_M$ is the $M$ -dimensional zero vector. This binary relation can be further extended to define domination among sets. Let $A, B \subset \mathbb{R}^M$ be sets, if the set $B$ lies in the weakly dominated region of $A$ , namely $B \subseteq \mathbb{D}_{\preceq}(A) = \cup_{\mathbf{a} \in A} \{\mathbf{y} \in \mathbb{R}^M : \mathbf{y} \preceq \mathbf{a}\}$ , then we say $A$ weakly dominates $B$ , denoted by $A \succeq B$ . In addition, if it also holds that the dominated regions are not equal, $\mathbb{D}_{\preceq}(A) \neq \mathbb{D}_{\preceq}(B)$ , we say strict Pareto domination holds, denoted by $A \succ B$ . + +Multi-objective optimization. The goal of multi-objective optimization is to identify the Pareto optimal set of inputs $\mathbb{X}^* = \arg \max_{\mathbf{x} \in \mathbb{X}} f(\mathbf{x}) \subseteq \mathbb{X}$ . The Pareto set is defined as the set of inputs whose objective vectors are not strictly Pareto dominated by another: $\mathbf{x}^* \in \mathbb{X}^* \iff \mathbf{x}^* \in \mathbb{X}$ and $\# \mathbf{x} \in \mathbb{X}$ such that $f(\mathbf{x}) \succ f(\mathbf{x}^*)$ . The image of the Pareto set in the objective space $\mathbb{Y}^* = f(\mathbb{X}^*) = \max_{\mathbf{x} \in \mathbb{X}} f(\mathbf{x})$ is called the Pareto front. For convenience of notation, we will denote the set of Pareto optimal input-output pairs by $(\mathbb{X}^*, \mathbb{Y}^*)$ . + +Bayesian Optimization is a sample efficient global optimization strategy, which relies on a probabilistic model in order to decide which points to query. In Appendix A.1, we present the pseudo-code + +![](images/1129f257e3ac961cefcacd00f4e01b511fcd592d3095940bec5dc027c553e568.jpg) + +![](images/17eab19430749988b6852144a4c6992671986ec259679de8e3f5c54ddfc89e76.jpg) + +![](images/29a4aec31e501eb299cc05672964bf5192be1a263de13ba3cda9ad9995fb1e11.jpg) + +![](images/352464f3758b95975eec31af5524e596211c4ba5ae75eb95d960008cc2fcf1f7.jpg) + +![](images/173ae06d22f9429aa71d3b39a8450591b60b0708d31b13b77fbb7cd465bfe47c.jpg) +Figure 1: Comparison of the samples (top) and change in entropy (bottom) for the posterior and conditional distributions. The red line in the posterior plots denotes the reference sample that is used to obtain the maximizer $x^{*}$ and maximum $y^{*}$ , whilst the shaded blue region is the $95\%$ credible interval of the posterior $p(f(x)|x, D_n)$ . Conditioning on $x^{*}$ reduces the entropy for all inputs according to how correlated it is with $x^{*}$ . Conditioning on $y^{*}$ reduces the entropy for all inputs according to the posterior probability that the objective surpasses $y^{*}$ . Conditioning on $(x^{*}, y^{*})$ leads to a drop in entropy based on both the input correlation with $x^{*}$ and the posterior probability of exceeding $y^{*}$ . + +![](images/ee8cb7920071e2fcfdbe36515b745b2fd4ff27dd16dfdc15fdded0a35e47ab62.jpg) + +![](images/093c94f59c19a051665baf51c01372ac2210296522f117032c96e9ca0f16fe96.jpg) + +![](images/9ed44b98d1346ab29645a6203e7cb970f6131bff95a8f5dd0f4c36104c840183.jpg) + +for the standard BO procedure—for more details see [13, 29, 75]. In this work, we will use independent Gaussian process priors [71] on each objective, $f^{(m)} \sim \mathrm{GP}(\mu_0^{(m)}, \Sigma_0^{(m)})$ , where $\mu^{(m)} : \mathbb{X} \to \mathbb{R}$ is the mean function and $\Sigma^{(m)} : \mathbb{X} \times \mathbb{X} \to \mathbb{R}$ is the covariance function for objective $m$ . The observations at location $\mathbf{x} \in \mathbb{X}$ will be assumed to be corrupted with additive Gaussian noise, $\mathbf{y} = f(\mathbf{x}) + \epsilon$ where $\epsilon \sim \mathcal{N}(0, \mathrm{diag}(\sigma(\mathbf{x}))$ denotes the observation noise with variance $\sigma(\mathbf{x}) \in \mathbb{R}_{\geq 0}^M$ . After $n$ evaluations, we have a data set $D_n = \{(x_t, y_t)\}_{t=1,\dots,n}$ . The posterior model $p(f|D_n)$ is a collection of independent Gaussian processes $f^{(m)}|D_n \sim \mathrm{GP}(\mu_n^{(m)}, \Sigma_n^{(m)})$ . The explicit expressions for the mean and covariance are presented in Appendix A.2. The main focus of this work is on designing the acquisition function, $\alpha : \mathbb{X} \to \mathbb{R}$ , which is used to select the inputs: $x_{n+1} = \arg \max_{\mathbf{x} \in \mathbb{X}} \alpha(\mathbf{x}|D_n)$ . + +Information-theoretic acquisition functions focus on maximizing the gain in information from the next observation and a function of the probabilistic model. Initial work in BO focussed on picking points to learn more about the distribution of the maximizer $p(\mathbb{X}^* | D_n)$ . Specifically, the goal of interest was to maximize the mutual information between the observation $\mathbf{y}$ and the Pareto set $\mathbb{X}^*$ conditional on the current data set $D_n$ : + +$$ +\alpha^ {\mathrm {P E S}} (\mathbf {x} \mid D _ {n}) = \mathbf {M I} (\mathbf {y}; \mathbb {X} ^ {*} \mid \mathbf {x}, D _ {n}) = H [ p (\mathbf {y} \mid \mathbf {x}, D _ {n}) ] - \mathbb {E} _ {p \left(\mathbb {X} ^ {*} \mid D _ {n}\right)} [ H [ p (\mathbf {y} \mid \mathbf {x}, D _ {n}, \mathbb {X} ^ {*}) ] ] \tag {1} +$$ + +where $H[p(\mathbf{x})] = -\int p(\mathbf{x}) \log p(\mathbf{x}) d\mathbf{x}$ represents the differential entropy. This acquisition function is commonly referred to as predictive entropy search (PES) [39, 40, 74], but it was formerly known as entropy search (ES) [38, 84]. Despite the importance of obtaining more information about the maximizer, the PES acquisition function is heavily dependent on the approximation of $p(\mathbf{y}|\mathbf{x}, D_n, \mathbb{X}^*)$ , which is both computationally difficult to implement and optimize. This motivated researchers to consider a simpler scheme that focuses on learning more about the distribution of the maximum $p(\mathbb{Y}^*|D_n)$ . The resulting acquisition function is known as the max-value entropy search (MES) [4, 44, 80, 86]: + +$$ +\alpha^ {\mathrm {M E S}} (\mathbf {x} \mid D _ {n}) = \operatorname {M I} (\mathbf {y}; \mathbb {Y} ^ {*} \mid \mathbf {x}, D _ {n}) = H [ p (\mathbf {y} \mid \mathbf {x}, D _ {n}) ] - \mathbb {E} _ {p \left(\mathbb {Y} ^ {*} \mid D _ {n}\right)} [ H [ p (\mathbf {y} \mid \mathbf {x}, D _ {n}, \mathbb {Y} ^ {*}) ] ]. \tag {2} +$$ + +Unlike PES, the conditional probability $p(\mathbf{y}|\mathbf{x},D_n,\mathbb{Y}^*)$ arising in MES can be approximated and optimized more easily because some approximations lead to closed-form expressions. Despite the favourable properties of MES, the primary goal of interest is to identify the location of the maximizer $\mathbb{X}^*$ and not necessarily the value of the maximum $\mathbb{Y}^*$ . To combine the advantages of both of these approaches, we propose the joint entropy search acquisition function, which focuses on learning more about the joint distribution of the optimal points $p((\mathbb{X}^*,\mathbb{Y}^*)|D_n)$ : + +$$ +\begin{array}{l} \alpha^ {\mathrm {J E S}} (\mathbf {x} | D _ {n}) = \operatorname {M I} (\mathbf {y}; (\mathbb {X} ^ {*}, \mathbb {Y} ^ {*}) | \mathbf {x}, D _ {n}) \\ \begin{array}{l} = \mathbf {M} (\mathbf {y}, (\mathbb {X}, \mathbb {I}) | \mathbf {x}, D _ {n}) \\ = H [ p (\mathbf {y} | \mathbf {x}, D _ {n}) ] - \mathbb {E} _ {p ((\mathbb {X} ^ {*}, \mathbb {Y} ^ {*}) | D _ {n})} [ H [ p (\mathbf {y} | \mathbf {x}, D _ {n}, (\mathbb {X} ^ {*}, \mathbb {Y} ^ {*})) ] ]. \end{array} \tag {3} \\ \end{array} +$$ + +The JES acquisition function inherits the advantages of the PES and MES acquisition functions because it considers the knowledge learnt about the optimal points and is also simple to implement—more details in the next section. The following proposition shows that we can also interpret JES as an upper bound to both the PES and MES acquisition function. + +Proposition 1. The JES is an upper bound to any convex combination of the PES and MES acquisition functions: $\alpha^{\mathrm{JES}}(\mathbf{x}|D_n)\geq \beta \alpha^{\mathrm{PES}}(\mathbf{x}|D_n) + (1 - \beta)\alpha^{\mathrm{MES}}(\mathbf{x}|D_n)$ , for any $\beta \in [0,1]$ . + +In Figure 1, we illustrate the subtle differences between the different information-theoretic acquisition functions. More specifically, we visualise the difference between the conditional distributions arising in each acquisition function for a single-objective problem using one sample of the optimal points. + +Remark. In the BO literature it is common to distinguish between single-objective and multi-objective acquisition functions by appending 'MO' to the end of the acronym. For notational simplicity, we opt against this convention in this paper. In Appendix C, we emphasize the main differences that arise when computing the information-theoretic algorithms in both settings. + +# 3 Approximating JES + +In this section, we present several approximations to the JES acquisition function (3) and a simple extension to the batch setting. The first term in the JES criterion (3) is the entropy of a multivariate normal distribution: + +$$ +H [ p (\mathbf {y} | \mathbf {x}, D _ {n}) ] = \frac {M}{2} \log (2 \pi e) + \frac {1}{2} \sum_ {m = 1} ^ {M} \log \left(\Sigma_ {n} ^ {(m)} (\mathbf {x}, \mathbf {x}) + \sigma^ {(m)} (\mathbf {x})\right). \tag {4} +$$ + +The second term is an intractable expectation which is approximated by drawing Monte Carlo samples from $p((\mathbb{X}^*, \mathbb{Y}^*) | D_n)$ . The conditional entropy $H[p(\mathbf{y} | \mathbf{x}, D_n, (\mathbb{X}^*, \mathbb{Y}^*))]$ is also an intractable quantity which has to be estimated. The overall approximation of (3) will take the form + +$$ +\hat {\alpha} ^ {\mathrm {J E S}} (\mathbf {x} \mid D _ {n}) = H [ p (\mathbf {y} \mid \mathbf {x}, D _ {n}) ] - \frac {1}{S} \sum_ {s = 1} ^ {S} h \left(\left(\mathbb {X} _ {s} ^ {*}, \mathbb {Y} _ {s} ^ {*}\right); \mathbf {x}, D _ {n}\right), \tag {5} +$$ + +where $h$ denotes the conditional entropy estimate and $(\mathbb{X}_s^*,\mathbb{Y}_s^*)\sim p((\mathbb{X}^*,\mathbb{Y}^*)|D_n)$ are the Monte Carlo samples. The distribution $p(\mathbf{y}|\mathbf{x},D_n,(\mathbb{X}^*,\mathbb{Y}^*))$ is very challenging to work with because it enforces the global optimality condition that the function lies below the Pareto front $f(\mathbb{X})\preceq \mathbb{Y}^{*}$ . Instead of enforcing global optimality, we make the common simplifying assumption as in [59, 80, 86] and only enforce the optimality condition at the considered location: $f(\mathbf{x})\preceq \mathbb{Y}^{*}$ . By applying Bayes' theorem, the resulting density of interest becomes + +$$ +p (\mathbf {y} | \mathbf {x}, D _ {n *}, f (\mathbf {x}) \preceq \mathbb {Y} ^ {*}) = \frac {p (f (\mathbf {x}) \preceq \mathbb {Y} ^ {*} | \mathbf {x} , D _ {n +})}{p (f (\mathbf {x}) \preceq \mathbb {Y} ^ {*} | \mathbf {x} , D _ {n *})} p (\mathbf {y} | \mathbf {x}, D _ {n *}), \tag {6} +$$ + +where we have denoted the augmented data sets by $D_{n*} = D_n \cup (\mathbb{X}^*, \mathbb{Y}^*)$ and $D_{n+} = D_{n*} \cup \{(\mathbf{x}, \mathbf{y})\}$ . We will refer to the quantity $p(f(\mathbf{x}) \preceq \mathbb{Y}^*)$ as the cumulative distribution function (CDF). The following lemma shows that this CDF can be computed analytically when the set $\mathbb{Y}^* \subset \mathbb{R}^M$ is discrete. This is a standard result [16, 50, 68, 80] which can be derived by first partitioning the region of integration, $\mathbb{D}_{\preceq}(\mathbb{Y}^*) = \cup_{\mathbf{y}^* \in \mathbb{Y}^*} \{\mathbf{z} \in \mathbb{R}^M : \mathbf{z} \preceq \mathbf{y}^*\}$ , into a collection of hyperrectangle subsets and then summing up the individual contributions—see Figure 2 for a visual. This partition can be computed using an incremental approach (Algorithm 1 of [55]), which has a cost of $O(|\mathbb{Y}^*|^{[M/2] + 1})$ . In the single-objective setting, the maximum is a single point $y^* \in \mathbb{R}$ and the box-decomposition is simply the interval $\mathbb{D}_{\preceq}(\{y^*\}) = (-\infty, y^*]$ . + +Lemma 1. Let $\mathbb{Y}^* \subset \mathbb{R}^M$ be a finite set and $\mathbf{z} \sim N(\mathbf{a}, \mathrm{diag}(\mathbf{b}))$ be an $M$ -dimensional multivariate normal with mean $\mathbf{a} \in \mathbb{R}^M$ and variances $\mathbf{b} \in \mathbb{R}_{\geq 0}^M$ . Let $\mathbb{D}_{\preceq}(\mathbb{Y}^*) = \bigcup_{j=1}^{J} B_j = \bigcup_{j=1}^{J} \prod_{m=1}^{M} (l_j^{(m)}, u_j^{(m)})$ be the box decomposition of the dominated space, then + +$$ +p \left(\mathbf {z} \preceq \mathbb {Y} ^ {*}\right) = \sum_ {j = 1} ^ {J} \prod_ {m = 1} ^ {M} \left[ \Phi \left(\frac {u _ {j} ^ {(m)} - a ^ {(m)}}{\sqrt {b ^ {(m)}}}\right) - \Phi \left(\frac {l _ {j} ^ {(m)} - a ^ {(m)}}{\sqrt {b ^ {(m)}}}\right) \right]. \tag {7} +$$ + +![](images/593ec31eecf5ce278d0c794c4b31bb86d2ce976ac892421b71f7720ce7bed174.jpg) +Figure 2: Box decompositions for a two-dimensional and three-dimensional Pareto front. + +![](images/48575686463304840179dc4cb4b0997adf155a80cd613dda09eb133c87e6008c.jpg) + +In Algorithm 1, we present the pseudo-code for the estimation of the JES acquisition function at a single candidate input. Several variables that calculated within the algorithm are independent of the input (coloured in blue). For computational efficiency, we only compute these variables once and then save them to memory for later use. + +Algorithm 1: Joint Entropy Search (JES). +Input:A candidate $\mathbf{x}$ ; the data set $D_{n}$ //Cached variables are coloured in blue. +1 Compute the initial entropy $h_0 = H[p(\mathbf{y}|\mathbf{x},D_n)]$ +2 for $s = 1,\ldots ,S$ do +3 Sample a path $f_{s}\sim p(f|D_{n})$ +4 Compute the Pareto optimal points $\mathbb{X}_s^* = \arg \max_{\mathbf{x}'\in \mathbb{X}}f_s(\mathbf{x}')$ and $\mathbb{Y}_s^* = f_s(\mathbb{X}_s^*)$ +5 Compute the box decomposition $\mathbb{D}_{\preceq}(\mathbb{Y}_s^*) = \bigcup_{j = 1}^{J}B_{j}$ +6 Compute the conditional $p(f|D_n\cup (\mathbb{X}_s^*,\mathbb{Y}_s^*))$ +7 Compute the estimate $h_s = h((\mathbb{X}_s^*,\mathbb{Y}_s^*);\mathbf{x},D_n)$ +8 end +9 return $\hat{\alpha}^{\mathrm{JES}}(\mathbf{x}|D_n) = h_0 - \frac{1}{S}\sum_{s = 1}^{S}h_s.$ + +# 3.1 Estimating the conditional entropy + +The entropy of (6) can be written as an $M$ -dimensional expectation over the multivariate normal distribution $p(\mathbf{y}|\mathbf{x},D_{n*}) = \mathcal{N}(\mathbf{y};\boldsymbol{\mu}_{n*}(\mathbf{x}),\boldsymbol{\Sigma}_{n*}(\mathbf{x},\mathbf{x}))$ : + +$$ +\begin{array}{l} H [ p (\mathbf {y} | \mathbf {x}, D _ {n *}, f (\mathbf {x}) \preceq \mathbb {Y} ^ {*}) ] \\ = - \mathbb {E} _ {p (\mathbf {y} | \mathbf {x}, D _ {n *})} \left[ \frac {p (f (\mathbf {x}) \preceq \mathbb {Y} ^ {*} | \mathbf {x} , D _ {n +})}{p (f (\mathbf {x}) \preceq \mathbb {Y} ^ {*} | \mathbf {x} , D _ {n *})} \log \left(\frac {p (f (\mathbf {x}) \preceq \mathbb {Y} ^ {*} | \mathbf {x} , D _ {n +})}{p (f (\mathbf {x}) \preceq \mathbb {Y} ^ {*} | \mathbf {x} , D _ {n *})} p (\mathbf {y} | \mathbf {x}, D _ {n *})\right) \right]. \tag {8} \\ \end{array} +$$ + +To simplify the notation, we define the $m$ -th standardized value by + +$$ +\gamma_ {m} (z) = \left(z - \mu_ {n *} ^ {(m)} (\mathbf {x})\right) / \sqrt {\Sigma_ {n *} ^ {(m)} (\mathbf {x} , \mathbf {x})} \tag {9} +$$ + +for any scalar $z \in \mathbb{R}$ . Using this function together with Lemma 1, we denote the cumulative distribution $p(f(\mathbf{x}) \preceq \mathbb{Y}^* | \mathbf{x}, D_{n*})$ by $W = \sum_{j=1}^{J} W_j = \sum_{j=1}^{J} \prod_{m=1}^{M} W_{j,m}$ , where + +$$ +W _ {j, m} = \Phi \left(\gamma_ {m} \left(u _ {j} ^ {(m)}\right)\right) - \Phi \left(\gamma_ {m} \left(l _ {j} ^ {(m)}\right)\right) \tag {10} +$$ + +are the differences appearing in (7). Moreover, we denote the differences of the first derivative of $W_{j,m}$ and the negative of the second derivative (with respect to $\gamma_{m}$ ) by + +$$ +G _ {j, m} = \phi \left(\gamma_ {m} \left(u _ {j} ^ {(m)}\right)\right) - \phi \left(\gamma_ {m} \left(l _ {j} ^ {(m)}\right)\right), \tag {11} +$$ + +$$ +V _ {j, m} = \gamma_ {m} \left(u _ {j} ^ {(m)}\right) \phi \left(\gamma_ {m} \left(u _ {j} ^ {(m)}\right)\right) - \gamma_ {m} \left(l _ {j} ^ {(m)}\right) \phi \left(\gamma_ {m} \left(l _ {j} ^ {(m)}\right)\right), \tag {12} +$$ + +where $\phi$ is the probability density function of a standard normal distribution. In the setting where the observation noise is zero, the conditional distribution is a truncated multivariate normal, which is known to have an analytical equation formula for the entropy (Theorem 3.1. in [80]). In Appendix E, + +we construct an ad hoc extension to this expression when the observation noise is non-zero. + +In the noisy setting, the distribution of interest is a type of multivariate skew normal distribution, which is known to not have an analytical form for the entropy [1]. As a result, we propose two approximation strategies to estimate this entropy. The first strategy is to approximate the integral using Monte Carlo. The details of the Monte Carlo estimate $h^{\mathrm{JES - MC}}$ is described in Appendix F. The second strategy is to directly approximate the distribution with one that exhibits an analytical entropy. We consider the most obvious choice, which is a multivariate normal distribution with the same first two moments. The same strategy was proposed in [59] for the single-objective multi-fidelity MES acquisition function. By a standard result (Chapter 12 of [17]), the entropy of this approximating distribution is actually an upper bound for the entropy of interest: $H[p(\mathbf{y}|\mathbf{x},D_{n*},f(\mathbf{x})\preceq \mathbb{Y}^{*})]\leq \frac{M}{2}\log (2\pi e) + \frac{1}{2}\log \det \mathbb{Var}(\mathbf{y}|\mathbf{x},D_{n*},f(\mathbf{x})\preceq \mathbb{Y}^{*})$ . The following result shows that the these central moments can be computed analytically. + +Proposition 2. Under the modelling set-up outlined in Section 2, for an input $\mathbf{x} \in \mathbb{X}$ the first and second central moment of $p(\mathbf{y}|\mathbf{x}, D_{n*}, f(\mathbf{x}) \preceq \mathbb{Y}^*)$ are + +$$ +\mathbb {E} [ y ^ {(m)} | \mathbf {x}, D _ {n *}, f (\mathbf {x}) \preceq \mathbb {Y} ^ {*} ] = \mu_ {n *} ^ {(m)} (\mathbf {x}) - \frac {\sqrt {\Sigma_ {n *} ^ {(m)} (\mathbf {x} , \mathbf {x})}}{W} \sum_ {j = 1} ^ {J} W _ {j} \frac {G _ {j , m}}{W _ {j , m}} +$$ + +and + +$$ +\begin{array}{l} \operatorname {C o v} \left(y ^ {(m)}, y ^ {(m ^ {\prime})} \mid \mathbf {x}, D _ {n *}, f (\mathbf {x}) \preceq \mathbb {Y} ^ {*}\right) \\ = \left\{ \begin{array}{l l} \frac {\sqrt {\sum_ {n *} ^ {(m)} (\mathbf {x} , \mathbf {x})} \sqrt {\sum_ {n *} ^ {(m ^ {\prime})} (\mathbf {x} , \mathbf {x})}}{W} \sum_ {j = 1} ^ {J} W _ {j} \frac {G _ {j , m}}{W _ {j , m}} \left(\frac {G _ {j , m ^ {\prime}}}{W _ {j , m ^ {\prime}}} - \frac {1}{W} \sum_ {j ^ {\prime} = 1} ^ {J} W _ {j ^ {\prime}} \frac {G _ {j ^ {\prime} , m ^ {\prime}}}{W _ {j ^ {\prime} , m ^ {\prime}}}\right), & m \neq m ^ {\prime}; \\ \sum_ {n *} ^ {(m)} (\mathbf {x}, \mathbf {x}) + \sigma^ {(m)} (\mathbf {x}) - \frac {\sum_ {n *} ^ {(m)} (\mathbf {x} , \mathbf {x})}{W} \left(\sum_ {j = 1} ^ {J} W _ {j} \frac {V _ {j , m}}{W _ {j , m}} + \frac {1}{W} \left(\sum_ {j = 1} ^ {J} W _ {j} \frac {G _ {j , m}}{W _ {j , m}}\right) ^ {2}\right), & m = m ^ {\prime}. \end{array} \right. \\ \end{array} +$$ + +As an upper bound on the conditional entropy leads to a lower bound on the mutual information, we will refer to the resulting conditional entropy estimate as the JES-LB estimate: + +$$ +h ^ {\mathrm {J E S - L B}} \left(\left(\mathbb {X} ^ {*}, \mathbb {Y} ^ {*}\right); \mathbf {x}, D _ {n}\right) = \frac {M}{2} \log (2 \pi e) + \frac {1}{2} \log \det \mathbb {V a r} (\mathbf {y} | \mathbf {x}, D _ {n *}, f (\mathbf {x}) \preceq \mathbb {Y} ^ {*}). \tag {13} +$$ + +We could obtain a further lower bound by ignoring the off-diagonal terms in the covariance matrix. We dub the resulting approximation as the JES-LB2 entropy estimate: + +$$ +h ^ {\mathrm {J E S - L B 2}} \left(\left(\mathbb {X} ^ {*}, \mathbb {Y} ^ {*}\right); \mathbf {x}, D _ {n}\right) = \frac {M}{2} \log (2 \pi e) + \frac {1}{2} \sum_ {m = 1} ^ {M} \log \mathbb {V a r} \left(y ^ {(m)} \mid \mathbf {x}, D _ {n *}, f (\mathbf {x}) \preceq \mathbb {Y} ^ {*}\right). \tag {14} +$$ + +Figure 3 presents an illustration of the different density approximations that are used within the various conditional entropy estimates. An important remark is that all the conditional entropy estimates that we have developed here can also be applied to estimate MES. The only difference in the MES algorithm is that we no longer apply the conditioning step (line 6 of Algorithm 1) because we are interested in estimating $H[p(\mathbf{y}|\mathbf{x},D_n,f(\mathbf{x})\preceq \mathbb{Y}^*)]$ as opposed to (8). Consequently, the MES acquisition function is cheaper to evaluate because the cost of evaluating the posterior variance at a single input is $O(n^{2})$ , whereas JES incurs a cost of $O((n + |\mathbb{Y}^{*}|)^{2})$ more details are presented in the cost analysis in Appendix H. + +# 3.2 Batch evaluations + +Evaluating the JES acquisition functions for a batch of points $\mathbf{x}^{[1:q]} = (\mathbf{x}^{[1]},\dots,\mathbf{x}^{[q]})\in \mathbb{X}^q$ is expensive because the entropy estimates now depends on the $q$ -dimensional normal CDF and its derivatives. To circumvent this issue, we follow the example of [59] and propose a suboptimal batch approach by upper bounding the expensive joint conditional entropy term by the sum of the individual entropies: $H[p(\mathbf{y}^{[1:q]}\vert \mathbf{x}^{[1:q]},D_{n*},f(\mathbb{X})\preceq \mathbb{Y}^{*})]\leq \sum_{i = 1}^{q}H[p(\mathbf{y}^{[i]}\vert \mathbf{x}^{[i]},D_{n*},f(\mathbb{X})\preceq \mathbb{Y}^{*})]$ . The resulting $q$ -batch lower bound JES estimate is given by + +$$ +\hat {\alpha} ^ {q \mathrm {L B - J E S}} (\mathbf {x} ^ {[ 1: q ]} | D _ {n}) = H [ p (\mathbf {y} ^ {[ 1: q ]} | \mathbf {x}, D _ {n}) ] - \frac {1}{S} \sum_ {s = 1} ^ {S} \sum_ {i = 1} ^ {q} h \left(\left(\mathbb {X} _ {s} ^ {*}, \mathbb {Y} _ {s} ^ {*}\right); \mathbf {x} ^ {[ i ]}, D _ {n}\right), \tag {15} +$$ + +![](images/80946993740a0abe13419b7cb10bc9da82d0e2b0966ee297b0e233b5c849ae23.jpg) +(a) + +![](images/91e8c041907dfa69f5806afde4177da68890597037131baba6bb7a6d9171f1b0.jpg) +(b) + +![](images/3b14d1e41b3d75edfff38ae62158ab66e7d510b1a8141873bd1c06c69658664e.jpg) +(c) +Figure 3: Comparison of the density approximations to the skew multivariate normal distribution $p(\mathbf{y}|\mathbf{x},D_{n*},f(\mathbf{x})\preceq \mathbb{Y}^*)$ shown in (a) for a single input $\mathbf{x}\in \mathbb{X}$ and sample Pareto front $\mathbb{Y}^*$ . A zero noise assumption leads to the truncated multivariate normal approximation shown (b), whilst a moment matching approach leads to the multivariate normal approximations in (c) and (d). + +![](images/235c24fae9b0558691ce6ea9a95fbe3643c5550b6fd7d8d1ddf1aac03bc9083e.jpg) +(d) + +where $h$ is the conditional entropy estimate and + +$$ +H [ p (\mathbf {y} ^ {[ 1: q ]} | \mathbf {x}, D _ {n}) ] = \frac {M}{2} \log (2 \pi e) + \frac {1}{2} \sum_ {m = 1} ^ {M} \log \det \left(\Sigma_ {n} ^ {(m)} \left(\mathbf {x} ^ {[ 1: q ]}, \mathbf {x} ^ {[ 1: q ]}\right) + \operatorname {d i a g} \left(\sigma^ {(m)} \left(\mathbf {x} ^ {[ 1: q ]}\right)\right)\right) \tag {16} +$$ + +is the initial entropy. This acquisition function is defined over a $qD$ -dimensional space, which becomes more difficult to optimize as $q$ increases. Alternatively, we can maximize this function greedily by sequentially selecting the best input conditioned on the previously chosen points. This greedy procedure turns out to be an effective strategy when the acquisition function is submodular [88]. In Appendix G, we show that this batch acquisition function is indeed submodular. + +# 4 Performance criteria + +In multi-objective optimization, the most common way to measure performance is by comparing the approximate Pareto set $\hat{\mathbb{X}}^*$ against the optimal Pareto set $\mathbb{X}^*$ in the objective space: $d(f(\hat{\mathbb{X}}^*), f(\mathbb{X}^*))$ where $d: 2^{\mathbb{R}^M} \times 2^{\mathbb{R}^M} \rightarrow \mathbb{R}$ is a function that measures the discrepancy between the sets of objective vectors. Existing work in multi-objective BO mainly focuses on the hypervolume (HV) discrepancy, $d_{\mathrm{HV}}(A, B) = |U_{\mathrm{HV}}(A) - U_{\mathrm{HV}}(B)|$ , where the HV indicator, $U_{\mathrm{HV}}(A) = \int_{\mathbb{R}^M} \mathbb{I}[\mathbf{r} \preceq \mathbf{z} \preceq A] d\mathbf{z}$ , is defined as the volume between a reference point $\mathbf{r} \in \mathbb{R}^M$ and a set $A \subset \mathbb{R}^M$ . The general guidance is to set reference points to be slightly worse than the nadir, which is the vector consisting of the worst possible points, $\min_{\mathbf{x} \in \mathbb{X}} f^{(m)}(\mathbf{x})$ , for objectives $m = 1, \ldots, M$ —see [47] for more details. + +An attractive feature of the HV indicator is that it is Pareto complete (or compliant) in the sense that a better set will lead to a larger HV [98]: $A \succ B \Rightarrow U_{\mathrm{HV}}(A) > U_{\mathrm{HV}}(B)$ , if we assume the sets $A$ and $B$ are finite. The reverse implication known as Pareto compatibility does not hold for the HV indicator [98]. In other words, the HV can be used to discriminate between sets where one dominates another, but it cannot be relied upon when the sets are incomparable. Not all incomparable sets are treated equally by the HV indicator [96]. For instance Figure 4a shows an example where the HV indicator places more emphasis on the end points of the Pareto front. On other hand, if we apply a monotonically increasing transformation $g_m: \mathbb{R} \rightarrow \mathbb{R}$ to each objective, the Pareto set will not change, whereas the HV comparison will (Figure 4b). Implicitly, the HV indicator assumes that a linear change in one objective is equivalent to a linear change in another. This assumption might not necessarily reflect the decision maker's outlook and this is something that is typically overlooked when designing and benchmarking multi-objective optimization algorithms. The following result shows that information-theoretic acquisitions function are in fact agnostic to the choice of parameterization. + +Proposition 3. The information-theoretic acquisition functions $\alpha^{\mathrm{PES}}$ , $\alpha^{\mathrm{MES}}$ and $\alpha^{\mathrm{JES}}$ are invariant to reparameterization of the objective space that are consistent with the Pareto ordering relations. For example, $\alpha^{\mathrm{JES}}(\mathbf{x}|D_n) = \mathbf{MI}(\mathbf{y};(\mathbb{X}^*,\mathbb{Y}^*)|D_n) = \mathbf{MI}(g(\mathbf{y});(\mathbb{X}^*,g(\mathbb{Y}^*))|D_n)$ , where the $g_m:\mathbb{R}\rightarrow \mathbb{R}$ is a strictly monotonically increasing function acting only on the $m$ -th objective. + +To benchmark the algorithms, we use both the standard HV discrepancy (Section 5) and the HV discrepancy under different parameterizations (Appendix L). To easily obtain a family of parameteri + +![](images/ce0d2fbe058adad993d75304174fe1419541963ba78aa3a7d0f87c38fbdcea5a.jpg) +(a) + +![](images/cf6bab6b3f76137540b04a3c54e5e4498b0c332e11cc111b57789b45f81d20b4.jpg) +Figure 4: Comparison of the HV of two sample Pareto fronts in (a) the standard objective space $\mathbf{y} = (y^{(1)}, y^{(2)})$ and (b) the transformed objective space $g(\mathbf{y}) = (g_1(y^{(1)}), g_2(y^{(2)}))$ described in Appendix K. The HV indicator prefers a different set depending on the choice of parameterization. + +![](images/fc63a3aa78e713168780b93ad262d6582230c7f8cfabdc488a12f055ac503ad5.jpg) +(b) + +![](images/d9673588cb063f3e31ad78a0cb306e3094a944cc3959e0d8cf86019971157fdb.jpg) + +zations, we devise a novel weighting approach in Appendix K, which exploits the fact that the HV indicator can be written as an expectation over a uniform distribution on the $(M - 1)$ -dimensional hypercube [23, 94]. We observe that it is possible to assess the performance at different locations of the objective space by using alternate distributions over the hypercube. We call the resulting metric the generalized hypervolume (GHV). In our experiments, we found that the performance of each algorithm changed with regards to the choice of parameterization, but the JES approaches tended to be one of the strongest performers throughout. + +# 5 Experiments + +We empirically evaluate the JES acquisition function on a range of synthetic and real-world benchmark problems. We compare this approach with some popular acquisition functions in multi-objective BO: TSEMO [12], ParEGO [51], NParEGO [19], EHVI [18], NEHVI [19], PES [31, 33] and MES-0 [80]. We have also included the MES-LB, MES-LB2 and MES-MC acquisition functions, which can be easily derived from the conditional entropy estimates that we developed here. All algorithms are based on the open source Python library BoTorch [3], which uses features from GPyTorch [30] for Gaussian process regression and PyTorch [66] for automatic differentiation. All experiments are repeated using 100 different initial seeds and we generate the Pareto set recommendation $\hat{\mathbb{X}}^*$ of 50 points by maximizing the posterior mean using a multi-objective solver (NSGA2 [22] from the Pymoo library [10]). The complete details of the experiments are outlined in Appendix L, whilst the code is available at https://github.com/benmltu/JES. + +# 5.1 Benchmarks + +Synthetic benchmark. We consider the ZDT2 [22] benchmark with $D = 6$ inputs and $M = 2$ objectives. We corrupt the observations with additive Gaussian noise with zero-mean and standard deviation set to approximately $10\%$ of the objective ranges. + +Chemical reaction. This benchmark considers a nucleophilic aromatic substitution reaction (SnAr) between 2,4-difluoronitrobenzene and pyrrolidine in ethanol to produce a mixture of a desired product and two side-products [45]. The design space comprises of $D = 4$ components relating to the initial conditions. The goal is to optimize $M = 2$ objectives, namely the space time yield and the environmental impact. We apply a logarithm transform to the objectives and contaminate the observations with additive Gaussian noise with zero-mean and standard deviation set to approximately $3\%$ of the resulting objective ranges in order to emulate a potential real-world scenario. + +Pharmaceutical manufacturing. This problem is concerned with optimizing the Penicillin production process outlined in [56]. The design space is made up of $D = 7$ elements that control the initial condition of the reactions. The goal is to optimize $M = 3$ objectives, which relates to the yield, the amount of carbon dioxide released and the time to ferment. We include additive zero-mean Gaussian noise with a standard deviation set to approximately $1\%$ of the objective ranges. + +![](images/0b857e77f46e099d2b062a5839ad5f16e1a8a35921b39f7013e17122ffde71b8.jpg) + +![](images/dfe5eaeed19cc44c2d257ee014853f8b0a4d13de500efa7cab1cd3a2a8e6948c.jpg) + +![](images/25511ead65be2462c7ddacea7523e81a757b7a7f738e8cb45a7bd5151b2014bd.jpg) + +![](images/deda1ad0c100b7567a1551a98a460318b27a46c69d5ea3e7d503f9e3ed26b909.jpg) + +![](images/8b2eccaeca84b058f4ccaf430e5e998e424b4290d51d292b56349cd0ae0767f4.jpg) + +![](images/4f265434d26d6462f4308d44059c59515beecb6c9ae7518b8526749cce69505a.jpg) +Figure 5: A comparison of the mean logarithm HV discrepancy with two standard errors over one hundred runs for the four benchmark problems on a subset of the algorithms. We present the sequential and batch results on the top and bottom, respectively. + +![](images/e576e4f35474b5a4673cbc2b8bbb42676c479414d1c224d1c457549f5682f020.jpg) + +![](images/8802cb5620560e3adf075f03d29a952017a2e15f12a348d158e222ac38535968.jpg) + +![](images/1cb8e08e676af2dc0b651d9ffcc3d473a95433ba1741c168e932fdd786cfd42b.jpg) + +![](images/8bc66f41d812949fa461f73bfbbffff03359aca9edde4132d254912734c5b457.jpg) + +Marine design. This problem considers optimizing a family of bulk carriers subject to the constraints imposed for ships travelling through the Panama Canal [65, 73]. The design space is made up of $D = 6$ variables that determine the architecture of the carriers. The goal of this problem is to maximize the annual cargo, whilst minimizing the transportation cost and the ship weight subject to some design constraints. We consider the reformulation in [83], which converts the constraints into another objective. For this reformulated $M = 4$ objective problem, we corrupt the observations with additive zero-mean Gaussian noise with standard deviation set to approximately $0.5\%$ of the objective ranges. + +# 5.2 Results and discussion + +We present the log HV discrepancy results for both the sequential and batch experiments in Figure 5. The JES approach is consistently one of the stronger performing algorithms for these set of experiments. A similar conclusion is reached when we consider the weighted variant of the hypervolume in Appendix L.8. + +Conditional entropy estimates. We compared the performance of the different conditional entropy estimates for both the JES and MES acquisition function in Appendix L.6. We observed that in the majority of cases all the estimates exhibit similar performance. As a result, we recommend using the cheapest approximation, which is usually the lower bound estimates, judging from the wall times presented in Appendix L.9. + +Acquisition wall times. The wall times in Appendix L.9 indicate that the cost of acquiring a new point with JES is comparable with NEHVI, slightly more expensive than MES, but cheaper than PES. We note that the wall times for all methods can be improved by taking advantage of parallelization. In particular, for entropy based methods we used a gradient-free optimizer to sequentially optimize the multi-objective samples (line 4 in Algorithm 1), whereas in practice we should of ideally solved these problems in parallel using a gradient-based optimizer such as [57]. + +Querying high performing points. In certain domains it might be useful to directly query high-performing points because the final decision will be restricted to only the sampled locations $X_{N}$ . In Appendix L.5, we investigated the performance when such a restriction was made. In this setting, we observed that the information-theoretic approaches were occasionally outperformed by the improvement and scalarization based acquisition functions, which picked points more greedily. We observed that the entropy-based approaches had a tendency to pick points that are more informative for the posterior over the optimal points as opposed to directly selecting a point that is known to + +![](images/8089cb965c6df74d622db01e6fc94038aeca4b4d962614063f030e288157dd25.jpg) + +![](images/31fb57fd4d00f0d6a5cff811c8a6f9c5913c01e6502957d8faba5b043859e559.jpg) + +![](images/c5a48d015b1cd3c2be913ef38e408429b319e1a218671d18e560a6d414fa3906.jpg) + +![](images/a042d4953560987a971b7c89ede1d1ff15e8f3a373acb6d6c7d5d6adac3ef983.jpg) + +![](images/df88406a55e7eb0aa385ae858f995ed05100f5a2c7f2fb6a79c6b61d6320a45d.jpg) + +![](images/51918021ef6f86a751e59ceb0e2f8891a8187955940f81a5afe4ff02dbf936ec.jpg) + +![](images/83b405bbce9925b4d04641b6ea7f1bd9bc1fe81ee40f9b3a2a8619669e7a9f79.jpg) + +![](images/c3adebe6a7e0bde474fef3e714a57eddabd636c7c4f0672054b1b0fc297ef6be.jpg) + +![](images/93e796d61e45d032fcbb7511964648b15c929ecdcf44ac66be2be28a992f74c7.jpg) + +![](images/c1a0febc11b634ab1512c60234136575d2e79fe59041c40f269f630ca7b121d4.jpg) + +![](images/d43faf6df67cd4a07c503e046ac18e0e4196d471fbef505b7b7939432e8235e8.jpg) + +![](images/85bbea8114abbb69967fa054570f023dbf3202331e8264a4c21d52e7cbc6c6e6.jpg) + +![](images/a5d44ce1f9ed2f453b4e0e0ccdeab2630dea11716df589e539a93992b020486c.jpg) +Figure 6: An example of the generalized hypervolume on the ZDT2 benchmark. On the top plot we present the mean logarithm GHV discrepancy results for three different regions. On the bottom plot, we present the Pareto front and its approximation at the final time for the run which achieved the top 20th percentile on the standard hypervolume. + +perform well. To address this setting, we recommend combining information-theoretic acquisition functions with an epsilon greedy approach, where points are occasionally picked according to a greedy strategy such as maximizing a function of the posterior mean. + +Assessing local performance. Using the generalized hypervolume, we can target different parts of the objective space in order to get a much better picture of performance. We demonstrate this on a simple bi-objective example in Figure 6, where we assess that quality of the approximations at three different regions of the objective space. We observe that all of the BO algorithms were quickly able to identify the right section of the Pareto front. Evidently, the main source of difficulty for this problem arises from approximating the points in the left section of the Pareto front, which favours the second objective. This observation would not be apparent if we focussed solely on the standard HV. + +General guidance. The ideal acquisition functions is problem dependent and strongly depends on the decision maker's plans and goals. In a completely black-box setting, where there is no immediate preferences, Proposition 3 and the empirical results motivate the usage of information-theoretic acquisition functions, which treats all points on the Pareto front as equally desirable a priori. + +# 6 Conclusion + +We introduced JES, a novel information-theoretic acquisition function for multi-objective BO. To approximate this acquisition function, we presented several approximations to the conditional entropy and also a simple extension for the batch setting. Experimental results suggest that JES is very competitive with existing acquisition functions in terms of the HV discrepancy and its weighted variants. The main limitation of the JES acquisition function is that it relies on routines such as box decompositions and multi-objective optimization of function samples, which can be expensive to execute for very large problems. Future work could focus on improving the scalability of these information-theoretic methods and extending it to more general settings, which include constrained, decoupled and multi-fidelity optimization—see Appendix M for more details. + +# Acknowledgments and Disclosure of Funding + +BT was supported by the EPSRC StatML CDT programme EP/S023151/1 and BASF SE, Ludwigshafen am Rhein. NK was partially funded by JPMorgan Chase & Co. under J.P. Morgan A.I. Faculty Research Awards 2021. + +# References + +[1] Reinaldo B. Arellano-Valle, Javier E. Contreras-Reyes, and Marc G. Genton. Shannon Entropy and Mutual Information for Multivariate Skew-Elliptical Distributions. Scandinavian Journal of Statistics, 2013. Cited on page 6. +[2] Adelchi Azzalini. A Class of Distributions Which Includes the Normal Ones. Scandinavian Journal of Statistics, 1985. Cited on page 22. +[3] Maximilian Balandat, Brian Karrer, Daniel Jiang, Samuel Daulton, Ben Letham, Andrew G Wilson, and Eytan Bakshy. BoTorch: A Framework for Efficient Monte-Carlo Bayesian Optimization. In Advances in Neural Information Processing Systems. 2020. Cited on pages 8, 33, and 36. +[4] Syrine Belakaria, Aryan Deshwal, and Janardhan Rao Doppa. Max-value Entropy Search for Multi-Objective Bayesian Optimization. In Advances in Neural Information Processing Systems, 2019. Cited on pages 2, 3, 19, 20, and 37. +[5] Syrine Belakaria, Aryan Deshwal, and Janardhan Rao Doppa. Multi-Fidelity Multi-Objective Bayesian Optimization: An Output Space Entropy Search Approach. Proceedings of the AAAI Conference on Artificial Intelligence, 2020. Cited on page 49. +[6] Syrine Belakaria, Aryan Deshwal, and Janardhan Rao Doppa. Output Space Entropy Search Framework for Multi-Objective Bayesian Optimization. Journal of Artificial Intelligence Research, 2021. Cited on pages 2 and 49. +[7] Felix Berkenkamp, Andreas Krause, and Angela P. Schoellig. Bayesian optimization with safety Constraints: Safe and automatic parameter tuning in robotics. Machine Learning, 2021. Cited on page 1. +[8] Mickael Binois, Victor Picheny, Patrick Taillandier, and Abderrahmane Habbal. The Kalai-Smorodinsky solution for many-objective Bayesian optimization. Journal of Machine Learning Research, 2020. Cited on page 2. +[9] Mickael Binois, Abderrahmane Habbal, and Victor Picheny. A game theoretic perspective on Bayesian multi-objective optimization. arXiv:2104.14456, 2021. Cited on page 2. +[10] Julian Blank and Kalyanmoy Deb. Pymoo: Multi-Objective Optimization in Python. IEEE Access, 2020. Cited on pages 8 and 33. +[11] Salomon Bochner, Monotonic Functions, Stieltjes Integrals, Harmonic Analysis, Morris Tenenbaum, and Harry Pollard. Lectures on Fourier Integrals. Princeton University Press, 1959. Cited on page 18. +[12] Eric Bradford, Artur M. Schweidtmann, and Alexei Lapkin. Efficient multiobjective optimization employing Gaussian processes, spectral sampling and a genetic algorithm. Journal of Global Optimization, 2018. Cited on pages 8, 18, and 35. +[13] Eric Brochu, Vlad M. Cora, and Nando de Freitas. A Tutorial on Bayesian Optimization of Expensive Cost Functions, with Application to Active User Modeling and Hierarchical Reinforcement Learning. arXiv:1012.2599, 2010. Cited on pages 3 and 18. +[14] Roberto Calandra, André Seyfarth, Jan Peters, and Marc Peter Deisenroth. Bayesian optimization for learning gaits under uncertainty. Annals of Mathematics and Artificial Intelligence, 2016. Cited on page 1. +[15] Emile Contal, David Buffoni, Alexandre Robicquet, and Nicolas Vayatis. Parallel Gaussian Process Optimization with Upper Confidence Bound and Pure Exploration. In Machine Learning and Knowledge Discovery in Databases, Lecture Notes in Computer Science, 2013. Cited on page 30. +[16] Ivo Couckuyt, Dirk Deschrijver, and Tom Dhaene. Fast calculation of multiobjective probability of improvement and expected improvement criteria for Pareto optimization. Journal of Global Optimization, 2014. Cited on page 4. +[17] Thomas M. Cover and Joy A. Thomas. Elements of Information Theory. Wiley-Interscience, 2nd edition, 2006. Cited on pages 6, 19, and 21. +[18] Samuel Daulton, Maximilian Balandat, and Eytan Bakshy. Differentiable Expected Hypervolume Improvement for Parallel Multi-Objective Bayesian Optimization. In Advances in Neural Information Processing Systems. 2020. Cited on pages 1, 8, 34, and 35. +[19] Samuel Daulton, Maximilian Balandat, and Eytan Bakshy. Parallel Bayesian Optimization of Multiple Noisy Objectives with Expected Hypervolume Improvement. In Advances in Neural Information Processing Systems, 2021. Cited on pages 1, 8, and 35. + +[20] Samuel Daulton, Sait Cakmak, Maximilian Balandat, Michael A. Osborne, Enlu Zhou, and Eytan Bakshy. Robust Multi-Objective Bayesian Optimization Under Input Noise. In International Conference on Machine Learning. 2022. Cited on page 36. +[21] Samuel Daulton, David Eriksson, Maximilian Balandat, and Eytan Bakshy. Multi-Objective Bayesian Optimization over High-Dimensional Search Spaces. In Uncertainty in Artificial Intelligence, 2022. Cited on page 1. +[22] Kalyanmoy Deb, Amrit Pratap, Sameer Agarwal, and T. Meyarivan. A Fast and Elitist Multiobjective Genetic Algorithm: NSGA-II. IEEE Transactions on Evolutionary Computation, 2002. Cited on pages 8, 28, and 34. +[23] Jingda Deng and Qingfu Zhang. Approximating Hypervolume and Hypervolume Contributions Using Polar Coordinate. IEEE Transactions on Evolutionary Computation, 2019. Cited on pages 8 and 32. +[24] André Deutz, Michael Emmerich, and Kaifeng Yang. The Expected R2-Indicator Improvement for Multi-objective Bayesian Optimization. In Evolutionary Multi-Criterion Optimization, Lecture Notes in Computer Science, 2019. Cited on page 1. +[25] Kun Dong, David Eriksson, Hannes Nickisch, David Bindel, and Andrew G Wilson. Scalable Log Determinants for Gaussian Process Kernel Learning. In Advances in Neural Information Processing Systems. 2017. Cited on page 28. +[26] Michael T. M. Emmerich, Kyriakos C. Giannakoglou, and Boris Naujoks. Single- and Multiobjective Evolutionary Optimization Assisted by Gaussian Random Field Metamodels. IEEE Transactions on Evolutionary Computation, 2006. Cited on page 1. +[27] Kobi C. Felton, Jan G. Rittig, and Alexei A. Lapkin. Summit: Benchmarking Machine Learning Methods for Reaction Optimisation. Chemistry-Methods, 2021. Cited on pages 1 and 36. +[28] Daniel Fernández-Sánchez, Eduardo C. Garrido-Merchán, and Daniel Hernández-Lobato. Improved Max-value Entropy Search for Multi-objective Bayesian Optimization with Constraints. arXiv:2011.01150, 2021. Cited on page 49. +[29] Peter I. Frazier. A Tutorial on Bayesian Optimization. arXiv:1807.02811, 2018. Cited on pages 3 and 18. +[30] Jacob Gardner, Geoff Pleiss, Kilian Q Weinberger, David Bindel, and Andrew G Wilson. GPyTorch: Blackbox Matrix-Matrix Gaussian Process Inference with GPU Acceleration. In Advances in Neural Information Processing Systems. 2018. Cited on pages 8, 28, and 33. +[31] Eduardo C. Garrido-Merchan and Daniel Hernandez-Lobato. Predictive Entropy Search for Multi-objective Bayesian Optimization with Constraints. Neurocomputing, 2019. Cited on pages 2, 8, 20, 28, 29, 34, 35, 37, and 49. +[32] Eduardo C. Garrido-Merchán and Daniel Hernández-Lobato. Dealing with categorical and integer-valued variables in Bayesian Optimization with Gaussian processes. Neurocomputing, 2020. Cited on page 49. +[33] Eduardo C. Garrido-Merchan and Daniel Hernández-Lobato. Parallel Predictive Entropy Search for Multi-objective Bayesian Optimization with Constraints. arXiv:2004.00601, 2021. Cited on pages 2, 8, 29, 35, and 49. +[34] Michael A. Gelbart, Jasper Snoek, and Ryan P. Adams. Bayesian Optimization with Unknown Constraints. In Uncertainty in Artificial Intelligence, 2014. Cited on page 49. +[35] Rafael Gómez-Bombarelli, Jennifer N. Wei, David Duvenaud, José Miguel Hernández-Lobato, Benjamin Sánchez-Lengeling, Dennis Sheberla, Jorge Aguilera-Iparraguirre, Timothy D. Hirzel, Ryan P. Adams, and Alán Aspuru-Guzik. Automatic Chemical Design Using a Data-Driven Continuous Representation of Molecules. ACS Central Science, 2018. Cited on page 1. +[36] Robert B. Gramacy, Annie Sauer, and Nathan Wycoff. Triangulation candidates for Bayesian optimization. arXiv:2112.07457, 2021. Cited on page 18. +[37] Charles R. Harris, K. Jarrod Millman, Stefan J. van der Walt, Ralf Gommers, Pauli Virtanen, David Cournaepau, Eric Wieser, Julian Taylor, Sebastian Berg, Nathaniel J. Smith, Robert Kern, Matti Picus, Stephan Hoyer, Marten H. van Kerkwijk, Matthew Brett, Allan Haldane, Jaime Fernandez del Río, Mark Wiebe, Pearu Peterson, Pierre Gérard-Marchant, Kevin Sheppard, Tyler Reddy, Warren Weckesser, Hameer Abbasi, Christoph Gohlke, and Travis E. Oliphant. Array programming with NumPy. Nature, 2020. Cited on page 33. + +[38] Philipp Hennig and Christian J. Schuler. Entropy Search for Information-Efficient Global Optimization. Journal of Machine Learning Research, 2012. Cited on page 3. +[39] Daniel Hernandez-Lobato, Jose Hernandez-Lobato, Amar Shah, and Ryan Adams. Predictive Entropy Search for Multi-objective Bayesian Optimization. In International Conference on Machine Learning. 2016. Cited on pages 2, 3, 35, and 49. +[40] José Miguel Hernández-Lobato, Matthew W Hoffman, and Zoubin Ghahramani. Predictive Entropy Search for Efficient Global Optimization of Black-box Functions. In Advances in Neural Information Processing Systems. 2014. Cited on pages 3, 18, 30, and 35. +[41] Jose Miguel Hernandez-Lobato, Michael Gelbart, Matthew Hoffman, Ryan Adams, and Zoubin Ghahramani. Predictive Entropy Search for Bayesian Optimization with Unknown Constraints. In International Conference on Machine Learning. 2015. Cited on page 49. +[42] José Miguel Hernández-Lobato, Michael A. Gelbart, Ryan P. Adams, Matthew W. Hoffman, and Zoubin Ghahramani. A General Framework for Constrained Bayesian Optimization using Information-based Search. Journal of Machine Learning Research, 2016. Cited on page 49. +[43] Fred J. Hickernell, Christiane Lemieux, and Art B. Owen. Control variates for Quasi-Monte Carlo. Statistical Science, 2005. Cited on page 26. +[44] Matthew W Hoffman and Zoubin Ghahramani. Output-Space Predictive Entropy Search for Flexible Global Optimization. In NIPS Workshop on Bayesian Optimization, 2015. Cited on page 3. +[45] Christopher A. Hone, Nicholas Holmes, Geoffrey R. Akien, Richard A. Bourne, and Frans L. Muller. Rapid multistep kinetic model generation from transient flow data. Reaction Chemistry & Engineering, 2017. Cited on pages 8 and 36. +[46] Carl Hvarfner, Frank Hutter, and Luigi Nardi. Joint Entropy Search For Maximally-Informed Bayesian Optimization. arXiv:2206.04771, 2022. Cited on page 2. +[47] Hisao Ishibuchi, Ryo Imada, Yu Setoguchi, and Yusuke Nojima. How to Specify a Reference Point in Hypervolume Calculation for Fair Performance Comparison. Evolutionary Computation, 2018. Cited on page 7. +[48] Kirthevasan Kandasamy, Gautam Dasarathy, Jeff Schneider, and Barnabás Póczos. Multi-fidelity Bayesian Optimisation with Continuous Approximations. In International Conference on Machine Learning. 2017. Cited on page 49. +[49] Tarun Kathuria, Amit Deshpande, and Pushmeet Kohli. Batched Gaussian Process Bandit Optimization via Determinantal Point Processes. In Advances in Neural Information Processing Systems. 2016. Cited on page 30. +[50] Andy J. Keane. Statistical Improvement Criteria for Use in Multiobjective Design Optimization. AIAA Journal, 2012. Cited on page 4. +[51] Joshua Knowles. ParEGO: A Hybrid Algorithm With On-Line Landscape Approximation for Expensive Multiobjective Optimization Problems. IEEE Transactions on Evolutionary Computation, 2006. Cited on pages 1, 8, and 35. +[52] Mina Konakovic Lukovic, Yunsheng Tian, and Wojciech Matusik. Diversity-Guided Multi-Objective Bayesian Optimization With Batch Evaluations. In Advances in Neural Information Processing Systems. 2020. Cited on page 2. +[53] Andreas Krause and Daniel Golovin. Submodular Function Maximization. In *Tractability*, pages 71–104. Cambridge University Press, Cambridge, 2013. Cited on page 27. +[54] Alex Kulesza and Ben Taskar. Determinantal point processes for machine learning. Foundations and Trends® in Machine Learning, 2012. Cited on pages 27 and 30. +[55] Renaud Lacour, Kathrin Klamroth, and Carlos M. Fonseca. A box decomposition algorithm to compute the hypervolume indicator. Computers & Operations Research, 2017. Cited on pages 4, 28, and 34. +[56] Qiaohao Liang and Lipeng Lai. Scalable Bayesian Optimization Accelerates Process Optimization of Penicillin Production. In NeurIPS 2021 AI for Science Workshop, 2021. Cited on pages 8 and 36. +[57] Xingchao Liu, Xin Tong, and Qiang Liu. Profiling pareto front with multi-objective stein variational gradient descent. In Advances in Neural Information Processing Systems. 2021. Cited on page 9. + +[58] Thomas P. Minka. Expectation Propagation for Approximate Bayesian Inference. In Uncertainty in Artificial Intelligence, 2001. Cited on pages 3 and 28. +[59] Henry B. Moss, David S. Leslie, Javier Gonzalez, and Paul Rayson. GIBBON: General-purpose Information-Based Bayesian Optimisation. Journal of Machine Learning Research, 2021. Cited on pages 2, 4, 6, 19, 27, and 49. +[60] Henry B. Moss, David S. Leslie, and Paul Rayson. MUMBO: MUlti-task Max-Value Bayesian Optimization. In Machine Learning and Knowledge Discovery in Databases, Lecture Notes in Computer Science, 2021. Cited on pages 19 and 49. +[61] Willie Neiswanger, Ke Alexander Wang, and Stefano Ermon. Bayesian Algorithm Execution: Estimating Computable Properties of Black-box Functions Using Mutual Information. In International Conference on Machine Learning. 2021. Cited on page 19. +[62] Dang Nguyen, Sunil Gupta, Santu Rana, Alistair Shilton, and Svetha Venkatesh. Bayesian Optimization for Categorical and Category-Specific Continuous Inputs. Proceedings of the AAAI Conference on Artificial Intelligence, 2020. Cited on page 49. +[63] Majid Nour, Zafer Comert, and Kemal Polat. A Novel Medical Diagnosis model for COVID-19 infection detection based on Deep Features and Bayesian Optimization. Applied Soft Computing, 2020. Cited on page 1. +[64] Biswajit Paria, Kirthevasan Kandasamy, and Barnabás Póczos. A Flexible Framework for Multi-Objective Bayesian Optimization using Random Scalarizations. In Uncertainty in Artificial Intelligence. 2020. Cited on page 1. +[65] Michael G. Parsons and Randall L. Scott. Formulation of Multicriterion Design Optimization Problems for Solution With Scalar Numerical Optimization Methods. Journal of Ship Research, 2004. Cited on pages 9, 36, and 37. +[66] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. PyTorch: An Imperative Style, High-Performance Deep Learning Library. In Advances in Neural Information Processing Systems. 2019. Cited on pages 8, 33, and 34. +[67] Valerio Perrone, Iaroslav Shcherbatyi, Rodolphe Jenatton, Cedric Archambeau, and Matthias Seeger. Constrained Bayesian Optimization with Max-Value Entropy Search. NeurIPS Workshop on Meta-Learning, 2019. Cited on page 49. +[68] Victor Picheny. Multiobjective optimization using Gaussian process emulators via stepwise uncertainty reduction. Statistics and Computing, 2015. Cited on pages 2 and 4. +[69] Victor Picheny, Mickael Binois, and Abderrahmane Habbal. A Bayesian optimization approach to find Nash equilibria. Journal of Global Optimization, 2019. Cited on page 2. +[70] Ali Rahimi and Benjamin Recht. Random Features for Large-Scale Kernel Machines. In Advances in Neural Information Processing Systems. 2008. Cited on page 18. +[71] Carl Edward Rasmussen and Christopher K. I. Williams. Gaussian Processes for Machine Learning. Adaptive Computation and Machine Learning. MIT Press, 2006. Cited on pages 3 and 18. +[72] Binxin Ru, Ahsan Alvi, Vu Nguyen, Michael A. Osborne, and Stephen Roberts. Bayesian Optimisation over Multiple Continuous and Categorical Inputs. In International Conference on Machine Learning. 2020. Cited on page 49. +[73] Pratyush Sen and Jian-Bo Yang. Multiple Criteria Decision Support in Engineering Design. Springer London, 1998. Cited on pages 9, 36, and 37. +[74] Amar Shah and Zoubin Ghahramani. Parallel predictive entropy search for batch global optimization of expensive objective functions. In Advances in Neural Information Processing Systems. 2015. Cited on page 3. +[75] Bobak Shahriari, Kevin Swersky, Ziyu Wang, Ryan P. Adams, and Nando de Freitas. Taking the Human Out of the Loop: A Review of Bayesian Optimization. Proceedings of the IEEE, 2016. Cited on pages 3 and 18. + +[76] Jasper Snoek, Hugo Larochelle, and Ryan P Adams. Practical Bayesian Optimization of Machine Learning Algorithms. In Advances in Neural Information Processing Systems. 2012. Cited on page 1. +[77] Jasper Snoek, Oren Rippel, Kevin Swersky, Ryan Kiros, Nadathur Satish, Narayanan Sundaram, Mostofa Patwary, Mr Prabhat, and Ryan Adams. Scalable Bayesian Optimization Using Deep Neural Networks. In International Conference on Machine Learning. 2015. Cited on page 1. +[78] Jialin Song, Yuxin Chen, and Yisong Yue. A General Framework for Multi-fidelity Bayesian Optimization with Gaussian Processes. In International Conference on Artificial Intelligence and Statistics. 2019. Cited on page 49. +[79] Yanan Sui, Vincent Zhuang, Joel Burdick, and Yisong Yue. Stagewise Safe Bayesian Optimization with Gaussian Processes. In International Conference on Machine Learning. 2018. Cited on page 1. +[80] Shinya Suzuki, Shion Takeno, Tomoyuki Tamura, Kazuki Shitara, and Masayuki Karasuyama. Multi-objective Bayesian Optimization using Pareto-frontier Entropy. In International Conference on Machine Learning. 2020. Cited on pages 2, 3, 4, 5, 8, 19, 20, 25, 35, 37, and 49. +[81] Shion Takeno, Hitoshi Fukuoka, Yuhki Tsukada, Toshiyuki Koyama, Motoki Shiga, Ichiro Takeuchi, and Masayuki Karasuyama. Multi-fidelity Bayesian Optimization with Max-value Entropy Search and its Parallelization. In International Conference on Machine Learning, 37. 2020. Cited on pages 19 and 49. +[82] Shion Takeno, Tomoyuki Tamura, Kazuki Shitara, and Masayuki Karasuyama. Sequential- and Parallel-Constrained Max-value Entropy Search via Information Lower Bound. arXiv:2102.09788, 2021. Cited on page 49. +[83] Ryoji Tanabe and Hisao Ishibuchi. An Easy-to-use Real-world Multi-objective Optimization Problem Suite. Applied Soft Computing, 2020. Cited on pages 9, 36, and 37. +[84] Julien Vilelmonteix, Emmanuel Vazquez, and Eric Walter. An informational approach to the global optimization of expensive-to-evaluate functions. Journal of Global Optimization, 2008. Cited on page 3. +[85] Pauli Virtanen, Ralf Gommers, Travis E. Oliphant, Matt Haberland, Tyler Reddy, David Cournapeau, Evgeni Burovski, Pearu Peterson, Warren Weckesser, Jonathan Bright, Stefan J. van der Walt, Matthew Brett, Joshua Wilson, K. Jarrod Millman, Nikolay Mayorov, Andrew R. J. Nelson, Eric Jones, Robert Kern, Eric Larson, C. J. Carey, Ilhan Polat, Yu Feng, Eric W. Moore, Jake VanderPlas, Denis Laxalde, Josef Perktold, Robert Cirmrnan, Ian Henriksen, E. A. Quintero, Charles R. Harris, Anne M. Archibald, Antonio H. Ribeiro, Fabian Pedregosa, and Paul van Mulbregt. SciPy 1.0: Fundamental algorithms for scientific computing in Python. Nature Methods, 2020. Cited on pages 33 and 34. +[86] Zi Wang and Stefanie Jegelka. Max-value Entropy Search for Efficient Bayesian Optimization. In International Conference on Machine Learning. 2017. Cited on pages 3, 4, 18, 20, 35, and 37. +[87] Zi Wang, Chengtao Li, Stefanie Jegelka, and Pushmeet Kohli. Batched High-dimensional Bayesian Optimization via Structural Kernel Learning. In International Conference on Machine Learning. 2017. Cited on page 30. +[88] James Wilson, Frank Hutter, and Marc Deisenroth. Maximizing acquisition functions for Bayesian optimization. In Advances in Neural Information Processing Systems. 2018. Cited on pages 7, 26, and 28. +[89] James Wilson, Viacheslav Borovitskiy, Alexander Terenin, Peter Mostowsky, and Marc Deisenroth. Efficiently Sampling Functions from Gaussian Process Posteriors. In International Conference on Machine Learning. 2020. Cited on pages 18, 19, and 27. +[90] James T. Wilson, Viacheslav Borovitskiy, Alexander Terenin, Peter Mostowsky, and Marc Peter Deisenroth. Pathwise Conditioning of Gaussian Processes. Journal of Machine Learning Research, 2021. Cited on pages 18 and 19. +[91] Jia Wu, Xiu-Yun Chen, Hao Zhang, Li-Dong Xiong, Hang Lei, and Si-Hao Deng. Hyperparameter Optimization for Machine Learning Models Based on Bayesian Optimization. Journal of Electronic Science and Technology, 2019. Cited on page 1. +[92] Jian Wu, Saul Toscano-Palmerin, Peter I. Frazier, and Andrew Gordon Wilson. Practical Multi-fidelity Bayesian Optimization for Hyperparameter Tuning. In Uncertainty in Artificial Intelligence. 2020. Cited on page 49. +[93] Kaifeng Yang, Michael Emmerich, André Deutz, and Thomas Bäck. Efficient computation of expected hypervolume improvement using box decomposition algorithms. Journal of Global Optimization, 2019. Cited on page 1. + +[94] Richard Zhang and Daniel Golovin. Random Hypervolume Scalarizations for Provable Multi-Objective Black Box Optimization. In International Conference on Machine Learning. 2020. Cited on pages 8 and 32. +[95] Yehong Zhang, Trong Nghia Hoang, Bryan Kian Hsiang Low, and Mohan Kankanhalli. Information-Based Multi-Fidelity Bayesian Optimization. NIPS Workshop on Bayesian Optimization, 2017. Cited on page 49. +[96] Eckart Zitzler and Lothar Thiele. Multiobjective Optimization Using Evolutionary Algorithms - A Comparative Case Study. In Parallel Problem Solving from Nature, Lecture Notes in Computer Science, 1998. Cited on page 7. +[97] Eckart Zitzler, Kalyanmoy Deb, and Lothar Thiele. Comparison of Multiobjective Evolutionary Algorithms: Empirical Results. Evolutionary Computation, 2000. Cited on page 36. +[98] Eckart Zitzler, Lothar Thiele, Marco Laumanns, Carlos M. Fonseca, and Viviane Grunert da Fonseca. Performance Assessment of Multiobjective Optimizers: An Analysis and Review. IEEE Transactions on Evolutionary Computation, 2003. Cited on pages 1 and 7. +[99] Eckart Zitzler, Dimo Brockhoff, and Lothar Thiele. The Hypervolume Indicator Revisited: On the Design of Pareto-compliant Indicators Via Weighted Integration. In Evolutionary Multi-Criterion Optimization, Lecture Notes in Computer Science, 2007. Cited on page 33. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] +(c) Did you discuss any potential negative societal impacts of your work? [N/A] +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] +(b) Did you include complete proofs of all theoretical results? [Yes] The proofs for the main results are in the appendix. + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] The code is available at https://github.com/benmltu/JES. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] The experimental set-up is described in Appendix L. +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] The computing resources are described in the caption of the wall times plots e.g. Appendix L.9. + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] +(b) Did you mention the license of the assets? [No] We only cited the original code and corresponding manuscript in Appendix L. +(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/jointentropysearchformultiobjectivebayesianoptimization/images.zip b/jointentropysearchformultiobjectivebayesianoptimization/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..a8a9a4df51c0a0c0be9a8147d0fe749f13fc2d7b --- /dev/null +++ b/jointentropysearchformultiobjectivebayesianoptimization/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6525741a7972a288a2160ca2209e46d00ee22ed0a9a1d52b2862db6cccda96c +size 546146 diff --git a/jointentropysearchformultiobjectivebayesianoptimization/layout.json b/jointentropysearchformultiobjectivebayesianoptimization/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..13526eedf8e11feb15957f1a9c7cdf3c586e99a2 --- /dev/null +++ b/jointentropysearchformultiobjectivebayesianoptimization/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e841782831485c77a68241d5000da10210f94c4a557af99f15512bc8e737c8a9 +size 618541 diff --git a/jointlearningof2d3dweaklysupervisedsemanticsegmentation/343e8beb-568e-44b6-816c-4e72ce7882c5_content_list.json b/jointlearningof2d3dweaklysupervisedsemanticsegmentation/343e8beb-568e-44b6-816c-4e72ce7882c5_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..85b31693393277683aa00a5044084d275fd37562 --- /dev/null +++ b/jointlearningof2d3dweaklysupervisedsemanticsegmentation/343e8beb-568e-44b6-816c-4e72ce7882c5_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:42c7887825667d40ba1d1b37e8e7cea1993c7cd2e33cad716d1c3a7bccd03959 +size 77214 diff --git a/jointlearningof2d3dweaklysupervisedsemanticsegmentation/343e8beb-568e-44b6-816c-4e72ce7882c5_model.json b/jointlearningof2d3dweaklysupervisedsemanticsegmentation/343e8beb-568e-44b6-816c-4e72ce7882c5_model.json new file mode 100644 index 0000000000000000000000000000000000000000..3511355317c45dc81b2831b25a98803ef5c515fe --- /dev/null +++ b/jointlearningof2d3dweaklysupervisedsemanticsegmentation/343e8beb-568e-44b6-816c-4e72ce7882c5_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:777105b59586898e9a9ff9f625bd24c107f9b643455fb617ade17e9a3c987c4f +size 96512 diff --git a/jointlearningof2d3dweaklysupervisedsemanticsegmentation/343e8beb-568e-44b6-816c-4e72ce7882c5_origin.pdf b/jointlearningof2d3dweaklysupervisedsemanticsegmentation/343e8beb-568e-44b6-816c-4e72ce7882c5_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b3f14fde2872e0255c751fbd1b1dac53ff263e7a --- /dev/null +++ b/jointlearningof2d3dweaklysupervisedsemanticsegmentation/343e8beb-568e-44b6-816c-4e72ce7882c5_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5471e8d1be6437e49bfc7dd5c0a0ca1af487e7f5e4f2cbcde95025bda1224a83 +size 13185150 diff --git a/jointlearningof2d3dweaklysupervisedsemanticsegmentation/full.md b/jointlearningof2d3dweaklysupervisedsemanticsegmentation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..b62a6a125cf9ff848f9b439a302c4dfba87f3435 --- /dev/null +++ b/jointlearningof2d3dweaklysupervisedsemanticsegmentation/full.md @@ -0,0 +1,322 @@ +# Joint Learning of 2D-3D Weakly Supervised Semantic Segmentation + +Hyeokjun Kweon KAIST + +0327june@kaist.ac.kr + +Kuk-Jin Yoon KAIST + +kjyoon@kaist.ac.kr + +# Abstract + +The aim of weakly supervised semantic segmentation (WSSS) is to learn semantic segmentation without using dense annotations. WSSS has been intensively studied for 2D images and 3D point clouds. However, the existing WSSS studies have focused on a single domain, i.e. 2D or 3D, even when multi-domain data is available. In this paper, we propose a novel joint 2D-3D WSSS framework taking advantage of WSSS in different domains, using classification labels only. Via projection, we leverage the 2D class activation map as self-supervision to enhance the 3D semantic perception. Conversely, we exploit the similarity matrix of point cloud features for training the image classifier to achieve more precise 2D segmentation. In both directions, we devise a confidence-based scoring method to reduce the effect of inaccurate self-supervision. With extensive quantitative and qualitative experiments, we verify that the proposed joint WSSS framework effectively transfers the benefit of each domain to the other domain, and the resulting semantic segmentation performance is remarkably improved in both 2D and 3D domains. On the ScanNetV2 benchmark, our framework significantly outperforms the prior WSSS approaches, suggesting a new research direction for WSSS. + +# 1 Introduction + +Semantic segmentation is a fundamental problem in the field of computer vision. Recently, learning-based semantic segmentation methods have achieved remarkable performance. However, they usually rely on strong supervision such as pixel-wise (2D) or point-wise (3D) dense semantic labels. Since dense labels are time-consuming and labor-intensive to annotate, the labeling process has remained the main obstacle to applying semantic segmentation to real problems. Weakly supervised semantic segmentation (WSSS) has flourished to learn semantic segmentation by using inexpensive weak labels (e.g. bounding boxes or class labels). + +WSSS using class labels has been widely studied in the 2D domain (image) and has recently also been scaled into the 3D domain (point cloud). For acquiring pixel- or point-wise class predictions without any spatial supervision, the existing 2D and 3D WSSS studies have employed Class Activation Maps (CAM) [35] extracted from a classifier. Since CAM usually localizes the discriminative regions of each class (which be used as cues for classification by classifier), one can acquire pseudo-labels for semantic segmentation from the CAM. While the studies have shown promising results, they focus on using the data of a single domain and place less emphasis on the information of other domains that might have complementary properties. + +Fig. 1 visualizes the complementary advantages of 2D and 3D WSSS. With rich and dense features from a CNN-based architecture, 2D WSSS succeeds in the semantic perception of images. However, the 2D CAM is usually not sharp at the object boundary and the segmentation result tends to be imprecise as shown in (b3). On the other hand, 3D WSSS is advantageous in terms of segmentation, since the input point cloud contains the 3D geometry of the scene. However, due to the severe class + +![](images/883a11f1bfd22a6f3dec9b0a9f7da65496091b0365b481e69912e760d3d29f47.jpg) +Input +(a1) Point cloud + +![](images/c43ba6f46e6d99c2f0278fbab40b6a0c4d86b9b12b02ef4928ab1fcf70f874df.jpg) +Baselines (2D WSSS and 3D WSSS) +(b1) 3D WSSS result + +![](images/ca9a602b53a88935086ab779cd8558c15149ac8f7fe994506e927314ed968e8c.jpg) +Ours (2D-3D joint WSSS) +(c1) Ours result (3D) + +![](images/67c9bdadce819c5c8781e5a33a6c8be6c343fc3a5d29c2d1f2cd56b102fdcc15.jpg) +Ground truths +(d1) 3D GT + +![](images/3117925c834972b1ca08d2f09c517382cd709528212d133b78b4a439e6d8d3a1.jpg) +(a2) Projected point cloud + +![](images/f8d08f9aaa32bcaf63ee4e0d4a341482165beb7005dd73174a2ecfbd7632d8f7.jpg) +(b2) Proj. 3D WSSS result + +![](images/0d46dea316315b2f903da2c78d3f13f67c9dcd3512f3bee923a7e018ebb95763.jpg) +(c2) Proj. ours result (3D) + +![](images/e095951117f63f478afc0195ad617e1e2e534b1462fbc3bffebb89a2b421edcd.jpg) +(d2) Proj. 3D GT + +![](images/3a5e98b19a11c339be29044572ce8ccad362e4c42029eb06a73393ab6d389b00.jpg) +(a3) RGB image +Figure 1: Comparison of results from single 2D or 3D domain WSSS and the proposed multi-domain WSSS. The second column shows the results of 3D WSSS (b1, b2) and 2D WSSS (b3). 3D WSSS misclassifies the semantics of the objects (red boxes), while the 2D WSSS generates imprecise prediction at object boundaries (yellow boxes). Compared to the uni-domain results, the proposed 2D-3D joint WSSS framework achieves much more precise and complete semantic segmentation results in both domains (c1-c3), by unifying the benefits of multi-domain data. + +![](images/6b1f51479c1892e660d190e9dfa35dec3504acb49b76ea31a9743ca76d1d60c7.jpg) +(b3) 2D WSSS Result + +![](images/f8f09393a54f21f37c5db4b01b28d9cff2c7933049dc85d7948f133e1c84c888.jpg) +(c3) Ours result (2D) + +![](images/69d47c82bbe6ee6e78d20159f88f9c255ff54ac697889945c89ac86f216cff84.jpg) +(d3) 2D GT + +imbalance in 3D data (e.g. wall or floor exist in almost every scene) and the sparse nature of the point cloud, 3D WSSS difficulty in predicting the semantics as in (b1) and (b2). The results of 2D and 3D WSSS show different tendencies originating from the distinct domains, and they are complementary for achieving semantic segmentation of the scene. + +Upon this background, we propose a novel 2D-3D WSSS framework that jointly targets both domains of image and point cloud. For unifying the complementary strengths of both domains, we propagate the benefit of one domain to the other domain via self-supervision, and vice versa. It enables our framework to individually perform 2D and 3D WSSS, without requiring the paired input data in the inference phase. We obtain a 2D pseudo-label from the 2D CAM of the image classifier and make 3D CAM follow it, which enhances the semantic perception of the point cloud classifier. On the other hand, to transfer the segmentation capability of 3D CAM to 2D, we construct a correlation matrix between the 3D features. The image classifier is then trained to generate 2D features having a similar correlation matrix to that of the 3D, which relieves the imprecision problem of 2D CAM. In both directions, to prevent the networks from being spoiled by inaccurate self-supervision, the framework obtains a confidence score for each region and rejects erroneous predictions. + +With extensive qualitative and quantitative experiments, we verify that the proposed joint framework effectively transfers the benefit of each domain to the other domain as visualized in (c1-c3) of Fig. 1. As a result, in both image and point cloud domains, the semantic segmentation performance is remarkably enhanced simultaneously. For example, on the ScanNetV2 [5] benchmark, our method significantly outperforms the existing WSSS studies, demonstrating its superiority. Further, with an experiment on generalization capability to the S3DIS dataset, we verify that the gain of our joint framework could be extended to the unobserved data. The proposed framework is the first multi-domain approach for the field of WSSS, which is not only effective for learning both semantics and segmentation but also practical for being applied in real cases. We strongly believe that 2D-3D joint learning is a promising direction for conquering semantic segmentation with class labels only. + +Table 1: Summary of related works in the field of WSSS. Compared to the prior single 2D or 3D domain works, our method targets both 2D and 3D domains by using image-level and scene-level class labels only. CLS and SS denote class labels and semantic segmentation labels, respectively. + +
Domains2D3D2D+3D
Methods[11, 13, 1, 32, 24, 16, 3, 7, 25][20, 31, 8, 33, 34]MPRM[29]WyPR[22]Proposed
Weak LabelsCLS(image)SS(few points)CLS(subcloud)CLS(scene)CLS(image and scene)
+ +# 2 Related works + +In this section, we introduce the existing studies on 2D/3D WSSS and clarify the uniqueness of the proposed WSSS method that targets both domains in a simultaneous manner. Table 1 shows the setting of the weak labels we used and those of existing studies. Note that the proposed framework is the first method that exploits the complementary strengths of WSSS in the 2D and 3D domains, using image- and scene-level class labels only. + +WSSS in 2D domain 2D WSSS with image-level class labels only [11, 13, 1, 32, 24, 16, 3, 7, 25] has been widely studied for the last decade. Since the class labels do not provide any spatial supervision, most WSSS studies have exploited a CAM for localizing the regions of each class. Although the CAM can serve as an acceptable estimate for localization, they are usually activated in the most discriminative regions only, rather than capturing whole object regions. Moreover, the CAM is sensitive to the scale variance of the input image and less precise at the boundary of the objects. To relieve these issues, existing works have proposed various techniques such as refining [11, 13, 1], adversarial erasing [32, 24, 16], sub-categorical classification [3], and cross-image attention [7, 25]. However, their problem definition and benchmark dataset [6, 18] mainly focus on the 2D domain and less consider 3D structures of the scene, which are valuable for solving the aforementioned issues. + +WSSS in 3D domain Point-wise dense semantic segmentation labeling for a 3D point cloud is notorious for being difficult to annotate (22.3 min) [29]. To resolve this, several studies [20, 31, 8, 33, 34] have been conducted to learn semantic segmentation with only partially labeled points. However, since acquiring partial point-wise annotation is still expensive even under the "One Thing One Click" setting (2 min) [20], a few studies have been conducted for exploiting less expensive class labels (15 sec) [29]. MPRM [29] samples subclouds from the full scene and annotates them, since using subcloud-level class labels can relieve the class imbalance issue (e.g. wall or floor) commonly appearing in almost every scene). Recently, WyPR [22] jointly targets semantic segmentation and object detection of a point cloud with scene-level class labels only. The studies have shown the feasibility of WSSS in the 3D domain; however, due to the sparse and irregular nature of the point cloud, the performance of 3D WSSS is limited compared to the 2D WSSS. + +Semantic segmentation in combined 2D-3D domains To exploit both 2D and 3D data for semantic segmentation, several semantic segmentation studies have been conducted for uni-directional[12, 4] or bi-directional[10] feature projection between the 2D and 3D domains, in a fully-supervised setting. [28, 15] leveraged the 2D semantic segmentation for learning the 3D semantic segmentation with multi-view or virtual-view settings; however, they still require a dense 2D GT. [26] proposed to use 3D information as guidance for enhancing 2D WSSS using bounding boxes. Recently, [9, 17] incorporated 3D priors for self-supervised learning of 2D networks to achieve 3D-aware scene recognition. Unlike the existing studies, our framework is the first WSSS approach that jointly unifies the complementary benefits of 2D and 3D domains, by using the image-level and scene-level class labels only. + +# 3 Method + +In this section, we introduce the proposed 2D-3D joint framework for learning WSSS in both domains. Figure 2 shows our overall framework. + +![](images/f0afb27223770f19a654af6d66588d611eb8df88f1a275aa284254d72968da85.jpg) +Figure 2: Our overall framework. As inputs, we use a point cloud $\mathbf{P}$ and an image $\mathbf{I}^k$ sampled from a set of images corresponding to the point cloud, where the projection for the image is given as $\mathbf{V}^k$ . Note that the image is captured from the real scene. An image classifier $\mathcal{F}$ and a point cloud classifier $\mathcal{G}$ are trained to extract 2D outputs ( $\mathbf{Z}^{2d}$ and $\mathbf{A}^{2d}$ ) and 3D outputs ( $\mathbf{Z}^{3d}$ and $\mathbf{A}^{3d}$ ), respectively. To bridge the 2D and 3D domains, the 3D outputs are projected onto the image plane by using $\mathbf{V}^k$ . For 3D-to-2D, we construct a correlation matrix of 2D features ( $\mathbf{S}^{2d}$ ) and make it to follow that of the projected 3D features ( $\mathbf{S}^{3d,p}$ ). For 2D-to-3D, we generate 2D pseudo-label $\mathbf{M}^{2d}$ from 2D CAM and make projected 3D CAM follow it. Note that blue dashed lines denote back-propagation of the losses. + +# 3.1 Acquiring CAM of each dimension + +Following the prior works with the class labels only, we exploit a CAM to localize the class regions from the image or point cloud. We assume that a set of $K$ images $\mathbf{I} = \{\mathbf{I}^1,\dots ,\mathbf{I}^K\}$ and a point cloud $\mathbf{P}$ are obtained from a certain scene. $\mathbf{I}^k$ is an RGB image with a size of $H\times W$ , and $\mathbf{P}$ is a set of $N$ points where each point is represented by its 3D coordinate (XYZ) and color (RGB), as in [22]. A view matrix $\mathbf{V}^k$ (perspective projection matrix) of the camera for the image $\mathbf{I}^k$ is also given, as in many point cloud datasets [5, 2]. As weak supervision, we use the image-level class label $\mathfrak{t}^{2d}$ and scene-level class label $\mathfrak{t}^{3d}$ , where both labels are represented as $C$ -dimensional binary vectors. $C$ denotes the total number of classes, and the classes are non-exclusive since multiple classes can co-exist in a single image (or point cloud). + +As visualized in Fig. 2, we train an image classifier $\mathcal{F}$ to extract a 2D feature map $\mathbf{Z}^{2d} \in \mathbb{R}^{D \times H \times W}$ . A single linear layer having $D$ input channels and $C$ output channels then serves as a classification head for making pixel-wise class prediction $\mathbf{A}^{2d} \in \mathbb{R}^{C \times H \times W}$ . Similarly, a point cloud classifier $\mathcal{G}$ is trained to provide point-wise features $\mathbf{Z}^{3d} \in \mathbb{R}^{D \times N}$ and point-wise class prediction $\mathbf{A}^{3d} \in \mathbb{R}^{C \times N}$ . Here, we directly employ $\mathbf{A}^{2d}$ and $\mathbf{A}^{3d}$ as the CAM of each domain, and refer to them as 2D CAM and 3D CAM throughout this paper. For both networks, we use the GAP (Global Average Pooling) layer to average the pixel- or point-wise predictions along the spatial dimension as follows: + +$$ +\mathbf {y} ^ {2 d} = \frac {1}{H W} \sum_ {i = 1} ^ {H} \sum_ {j = 1} ^ {W} \mathbf {A} _ {:, i, j} ^ {2 d} \quad \text {a n d} \quad \mathbf {y} ^ {3 d} = \frac {1}{N} \sum_ {n = 1} ^ {N} \mathbf {A} _ {:, n} ^ {3 d}, \tag {1} +$$ + +where $\mathbf{y}^{2d}\in \mathbb{R}^C$ and $\mathbf{y}^{3d}\in \mathbb{R}^C$ denote image-level and scene-level class prediction, respectively. To promote the 2D and 3D CAMs to be activated on the corresponding regions of classes, the classifiers are trained with classification loss as following, where $\ell_{bce}$ denotes the binary cross entropy loss. + +$$ +\mathcal {L} _ {c l s} ^ {2 d} = \ell_ {b c e} (\mathbf {y} ^ {2 d}, \mathbf {t} ^ {2 d}) \quad \text {a n d} \quad \mathcal {L} _ {c l s} ^ {3 d} = \ell_ {b c e} (\mathbf {y} ^ {3 d}, \mathbf {t} ^ {3 d}). \tag {2} +$$ + +# 3.2 From 2D to 3D: Transferring semantic capability + +We are inspired by an observation that the information contained in 2D and 3D data is not only distinct but also complementary. The proposed framework aims to jointly learn WSSS in both domains and unify their strengths. For joint learning of both domains, we could directly provide information from one domain to the other domain via feature paths using projection, as in [10]. However, in the inference phase, a model including the feature path requires the paired set of data of both domains, which greatly limits the practical use case. + +Therefore, instead of directly swapping the features, we devise our framework to provide information from one domain to the other domain as a form of self-supervision during the training process only. It enables the proposed 2D-3D framework to separately process the data of each domain – our framework can perform 2D WSSS and 3D WSSS individually in the inference phase, without using the input data from the other domain. + +We use the view matrices of images for bridging the 2D and 3D domains, as visualized in Fig. 2. The projection from 3D homogeneous coordinates to the 2D pixel coordinates in $\mathbf{I}^k$ is formulated as follows: + +$$ +\left[ u _ {n} ^ {k}, v _ {n} ^ {k}, 1 \right] ^ {T} = \mathbf {V} ^ {k} \left[ x _ {n}, y _ {n}, z _ {n}, 1 \right] ^ {T}, \tag {3} +$$ + +where $(x_{n},y_{n},z_{n})$ is the coordinate of the $n$ th point in the point cloud $\mathbf{P}$ and $(u_n^k,v_n^k)$ is the destination of the projected point in $\mathbf{I}^k$ . We denote the projection function with the view matrix $\mathbf{V}^k$ as $proj(\cdot ,\mathbf{V}^k)$ . For simplicity, we omit $k$ throughout this paper. + +With a given $\mathbf{V}$ , the 3D point features $\mathbf{Z}^{3d}$ and 3D CAM $\mathbf{A}^{3d}$ are projected onto the image plane. Here, we discard the points located outside of the image grid. Also, we filter the points of the occluded object which should not exist on the image. The projected 3D features $\mathbf{Z}^{3d,p} \in \mathbb{R}^{D \times N_v}$ and 3D CAM $\mathbf{A}^{3d,p} \in \mathbb{R}^{C \times N_v}$ can be obtained as follows: + +$$ +\mathbf {Z} ^ {3 d, p} = \operatorname {p r o j} \left(\mathbf {Z} ^ {3 d}, \mathbf {V}\right) \quad \text {a n d} \quad \mathbf {A} ^ {3 d, p} = \operatorname {p r o j} \left(\mathbf {A} ^ {3 d}, \mathbf {V}\right), \tag {4} +$$ + +where $N_{v}$ denotes the number of preserved points. Note that the projection process is differentiable, and therefore the gradients can be back-propagated (see blue dashed lines in Fig. 2). + +Once the projected 3D CAM is acquired, we bridge the 2D CAM and 3D CAM at the pixels where the projected points exist. To leverage the semantic advantages of the 2D domain for improving 3D CAM, we obtain a pseudo-label map $\mathbf{M}^{2d}$ from the 2D CAM. Since there is usually no explicit background class in indoor scenes, we regard the class with maximum prediction score as a predicted class at each pixel as follows: + +$$ +\mathbf {M} _ {i, j} ^ {2 d} = \underset {c \in \{1, \dots , C \}} {\operatorname {a r g m a x}} \left(\mathbf {t} _ {c} ^ {2 d} \cdot \mathbf {A} _ {c, i, j} ^ {2 d}\right), \tag {5} +$$ + +where the non-existing classes are ignored by using the given image-level class label $\mathbf{t}^{2d}$ . + +We apply point-wise classification loss to the 3D CAM to follow the acquired 2D pseudo-label. However, unlike GT supervision, the predicted 2D pseudo-labels may include inaccurate signals and cannot be fully trusted. To address this, we regard the maximum score of class prediction of each pixel as a metric for the confidence of that pixel. The confidence map $\mathbf{W}^{2d}$ is defined as follows: + +$$ +\mathbf {W} _ {i, j} ^ {2 d} = \max \left(\mathbf {A} _ {:, i, j} ^ {2 d}\right). \tag {6} +$$ + +We define the 2D-to-3D loss that transfers 2D semantic capability to 3D network as + +$$ +\mathcal {L} _ {\text {j o i n t}} ^ {2 d \rightarrow 3 d} = \frac {1}{N _ {v}} \sum_ {n = 1} ^ {N _ {v}} \mathbf {W} _ {u _ {n}, v _ {n}} ^ {2 d} \ell_ {b c e} \left(\mathbf {A} _ {:, n} ^ {3 d, p}, \mathbf {M} _ {u _ {n}, v _ {n}} ^ {2 d}\right), \tag {7} +$$ + +where the $(u_{n},v_{n})$ is a pixel coordinate of the nth projected point as we denoted. Using maximum logit as a confidence score can reduce the contributions of such less confident pixels to the loss, and prevent 3D CAM from learning with erroneous self-supervision. We verify that this confidence-based scoring method brings actually increases the WSSS performance by a large gap, which will be demonstrated in Section 4. + +# 3.3 From 3D to 2D: Transferring segmentation capability + +Thanks to the well-preserved geometrical structures of the point cloud, the 3D WSSS can be advantageous for segmenting the scenes compared with 2D WSSS. However, unlike 2D-to-3D loss utilizing 2D pseudo-labels, this benefit cannot be directly leveraged to mitigate the impreciseness of 2D CAM due to the class imbalance issue and low semantic perception capability of the 3D CAM. In this paper, to unlock the segmentation potentials of the point cloud classifier, we train the image classifier to generate 2D features having a similar correlation matrix with that of the 3D features. + +Motivated by [19], we construct a correlation matrix $\mathbf{S}^{3d,p}$ from the projected 3D features $\mathbf{Z}^{3d,p}$ , by using the following equation: + +$$ +\mathbf {S} _ {a, b} ^ {3 d, p} = \mathbf {Z} _ {:, a} ^ {3 d, p} \cdot \mathbf {Z} _ {:, b} ^ {3 d, p}, \tag {8} +$$ + +where $(a,b)$ denotes a pair of the projected points. Similarly, for the pixels corresponding to the projected points, $\mathbf{S}^{2d}$ is computed from 2D features $\mathbf{Z}^{2d}$ as follows: + +$$ +\mathbf {S} _ {a, b} ^ {2 d} = \mathbf {Z} _ {:, u _ {a}, v _ {a}} ^ {2 d} \cdot \mathbf {Z} _ {:, u _ {b}, v _ {b}} ^ {2 d}, \tag {9} +$$ + +where the $(u_{a},v_{a})$ and $(u_{b},v_{b})$ denote pixel coordinates of the $a$ th and $b$ th projected point, respectively. Note that we map the features on a unit hypersphere by normalization, before computing the correlation matrices. Similar to the 2D-to-3D loss, we construct $\mathbf{W}^{3d,p}$ , the confidence of the correlation matrix of projected 3D features, by multiplying the confidence at each point as follows: + +$$ +\mathbf {W} _ {a, b} ^ {3 d, p} = \max \left(\mathbf {A} _ {:, a} ^ {3 d, p}\right) \cdot \max \left(\mathbf {A} _ {:, b} ^ {3 d, p}\right). \tag {10} +$$ + +The confidence-based 3D-to-2D loss is then defined as follows: + +$$ +\mathcal {L} _ {\text {j o i n t}} ^ {3 d \rightarrow 2 d} = \frac {1}{N _ {v} ^ {2}} \sum_ {a = 1} ^ {N _ {v}} \sum_ {b = 1} ^ {N _ {v}} \mathbf {W} _ {a, b} ^ {3 d, p} | \mathbf {S} _ {a, b} ^ {2 d} - \mathbf {S} _ {a, b} ^ {3 d, p} | _ {1}. \tag {11} +$$ + +In summary, we apply the sum of the classification and the joint loss functions for training our framework as following equation, where $\lambda$ is a weighting parameter. + +$$ +\mathcal {L} _ {\text {t o t a l}} = \mathcal {L} _ {\text {c l s}} ^ {2 d} + \mathcal {L} _ {\text {c l s}} ^ {3 d} + \mathcal {L} _ {\text {j o i n t}} ^ {2 d \rightarrow 3 d} + \lambda \mathcal {L} _ {\text {j o i n t}} ^ {3 d \rightarrow 2 d}. \tag {12} +$$ + +# 4 Experiments + +# 4.1 Implementation details + +**Framework** The proposed framework is implemented with PyTorch. ResNet38 [30] and PointNet++ [21] are employed as backbones for the image classifier and point cloud classifier, respectively. The image classifier is initialized with the weights pre-trained on ImageNet [23]. We augment the input point cloud with sub-sampling, random flipping, and random rotation. For the image, random resizing/cropping, horizontal flipping, and color jittering [14] are applied. We set $\lambda = 1$ in Eq. 12. The model is trained on two Tesla V100 GPUs with batch size 16 for 200 epochs. The initial learning rate is set to 0.003, and be decayed by 0.1 at epoch 120, 160, 180 as in [22]. More details can be found in Supplementary Material. + +Dataset and metric Following the existing 3D WSSS studies [29, 22], we conduct experiments on ScanNetV2 [5] dataset (MIT license, we agreed to the terms of use), which contains indoor scenes such as offices or bathrooms. ScanNetV2 is composed of 1513 scans with annotations (semantic segmentation GT, camera poses, etc.) and 100 test scans serving as a benchmark. We follow the official split, where there exist 1201 train scans and 312 val scans. For the 2D data, we use the provided RGB frames and the corresponding camera view matrices. We sample only $1\%$ of all provided frames, which is equivalent to using around 17 frames per scene on average. Note that the proposed label setting is less expensive than that of MPRM [29] (using around 17 class-labeled subclouds per scene), since annotating class-level labels is even easier on images than on point clouds. For evaluating the semantic segmentation performance, we use the mean intersection over union (mIoU) as a metric on both the 2D and 3D domains. Since the GT for the test set is not publicly available, test performance is evaluated on the ScanNet evaluation server. + +Table 2: Ablation study of the proposed framework. The semantic segmentation performance (mIoU, %) is evaluated on the official train and val splits of the ScanNetV2 [5]. From left to the right, each loss term denotes image-level 2D classification loss ( $\mathcal{L}_{cls}^{2d}$ ), scene-level 3D classification loss ( $\mathcal{L}_{cls}^{3d}$ ), 2D-to-3D loss ( $\mathcal{L}_{joint}^{2d\rightarrow 3d}$ ), and 3D-to-2D loss ( $\mathcal{L}_{joint}^{3d\rightarrow 2d}$ ). Confidence-based scoring denotes using W (in Eq. 6 and Eq. 10). Bold numbers represent the best results. + +
Domain\( \mathcal{L}_{cls}^{2d} \)\( \mathcal{L}_{cls}^{3d} \)\( \mathcal{L}_{joint}^{2d\rightarrow 3d} \)\( \mathcal{L}_{joint}^{3d\rightarrow 2d} \)Confidence-based scoringTrainVal
2D✓38.033.3
✓✓✓47.839.2
✓✓✓✓50.041.6
✓✓✓✓✓54.444.5
3D✓17.916.2
✓✓✓51.343.8
✓✓✓✓53.545.6
✓✓✓✓✓59.149.6
+ +![](images/ad96db9afb4ecdb0ef3a4ea2ab2582ef3214bb50fc24e85606e1180919e4bc4f.jpg) +Figure 3: Qualitative comparison of 2D/3D CAMs. 3D CAMs - (a1) uses scene-level classification loss $(\mathcal{L}_{cls}^{3d})$ only, (a2) uses 2D-to-3D loss $(\mathcal{L}_{joint}^{2d\rightarrow 3d})$ , and (a3) uses bidirectional (2D-to-3D and 3D-to-2D, i.e., $\mathcal{L}_{joint}^{2d\rightarrow 3d} + \mathcal{L}_{joint}^{3d\rightarrow 2d}$ ) joint loss. 2D CAMs - (b1) uses image-level classification loss $(\mathcal{L}_{cls}^{2d})$ only, (b2) uses 3D-to-2D loss $(\mathcal{L}_{joint}^{3d\rightarrow 2d})$ , and (b3) uses bidirectional joint loss. More qualitative comparison and samples of 2D and 3D CAMs can be found in Supplementary Material. + +# 4.2 Ablation studies + +To demonstrate the advantage of the proposed joint learning framework, we conduct an ablation study, as shown in Table 2. For each domain, the first row shows the result of our baseline setting, where only the image- or scene-level classification loss of each domain $(\mathcal{L}_{cls}^{2d}$ or $\mathcal{L}_{cls}^{3d})$ is applied. As reported in prior works [29, 22], we also observe that the 3D WSSS suffers from the class imbalance of scene-level class labels and thereby completely fails to understand the semantics of the objects, as visualized in (a1) of Fig. 3. On the other hand, as shown in (b1), 2D WSSS shows the capability to roughly localize the region of each class on the image. However, due to the lack of geometrical 3D information, the 2D CAM fails to be precise at the object boundary. This illustrates the motivation of the proposed 2D-3D joint framework. + +A benefit of the 2D-to-3D loss $(\mathcal{L}_{joint}^{3d\rightarrow 2d})$ is shown in the second row of the 3D domain in Table 2. The train and val performance of 3D CAM are significantly increased from $17.9\%$ and $16.2\%$ to $51.3\%$ and $43.8\%$ , respectively. The 3D CAMs in Fig. 3 (a2) show much more accurate results with the help of the 2D-to-3D joint loss. Here, to clarify the benefit of the 2D-to-3D loss, we also conduct an additional experiment. In this experiment, instead of the joint loss, we apply an additional classification loss to the point cloud classifier by using the image-level class labels. This setting is similar to that of PCAM [29]; however, the classification is done on the image level, not on the subcloud level. It achieves $43.9\%$ and $39.8\%$ on train and val split respectively, which are the almost equivalent performance to PCAM $(43.1\%$ and $38.1\%)$ but clearly lower than using our 2D-to-3D loss $(51.3\%$ and $43.8\%)$ . The result indicates that the performance gain of the proposed 2D-to-3D loss not only comes from relieving the class imbalance problem of the 3D domain but also effectively transferring the better semantics of the 2D domain to the 3D domain. + +Table 3: Performance (mIoU, %) comparison with other state-of-the-art 3D WSSS methods [29, 22] on ScannetV2 [5] train, val, and test split. Class-wise IoUs can be found in Supplementary Material. Bold numbers represent the best results, while underlined numbers are the second best results. + +
MethodsBackbonesWeak LabelsTrainValTest
PCAM[29]KPCConv [27]Scene22.1--
Subcloud43.138.1-
MPRM[29]Scene24.4--
Subcloud47.443.241.1
MIL-seg[22]PointNet++ [21]Scene-20.7-
WyPR[22]30.729.624.0
proposedPointNet++Scene+Image59.149.647.4
+ +The results also show that the 3D-to-2D loss $(\mathcal{L}_{joint}^{3d\rightarrow 2d})$ enhances the performance of 2D WSSS, from $38.0\%$ and $33.3\%$ to $47.8\%$ and $39.2\%$ , respectively. Thanks to the geometrical information provided by the 3D domain in the form of a correlation matrix, as visualized in Fig. 3 (b2), the generated 2D CAMs are much more precise at the object boundary when being trained with the 3D-to-2D loss. The results strongly support our design intentions: the 2D-to-3D loss provides rich semantics from 2D to 3D, while the 3D-to-2D loss transfers the segmentation capability of 3D to 2D. + +Further, we quantitatively verify that the confidence-based scoring strategy is effective in both the 2D-to-3D and 3D-to-2D directions, by suppressing the self-supervision at inaccurate regions while preserving reliable guidance. Finally, by using the bidirectional (2D-to-3D and 3D-to-2D) joint losses, we even further improve the semantic segmentation performance in both domains (the fourth row of each domain in Table 2 and (a3)/(b3) in Fig. 3). It shows the superiority of the proposed joint framework, which unlocks the complementary potential of 2D and 3D domains and unifies them. + +Here, we can observe that the performance of 2D WSSS is quite lower than that of 3D WSSS after we apply joint losses. One of the main reasons is the limited FoV (Field of View) of the perspective camera that captures the images. When only the corner of an object is captured in the image, it is almost impossible to correctly perceive the object. Therefore, classification results and corresponding 2D CAMs could be also inaccurate. To relieve the issue, during the training process, we filter 2D CAM with ground truth image-level class labels and suppress confusing regions. However, misclassification that occurred in the inference phase is difficult to be addressed in our framework. Extending the proposed framework using the cameras with large FoV (e.g. omnidirectional camera) can be an interesting future direction. + +# 4.3 Segmentation results + +In Table. 3, we compare the point cloud semantic segmentation performance of the proposed framework with that of the other 3D WSSS methods [29, 22]. This shows the superiority of the proposed 2D-3D joint framework, surpassing the other methods by more than $6\%$ in every split. Although we use additional 2D image data and image-level class labels compared to WyPR [22], annotating additional image-level class labels is not very expensive, particularly when we consider the significant performance gain. Compared with MPRM [29] using subcloud-level labels, the annotating cost is rather inexpensive at the image-level compared to the subcloud-level, while the proposed framework outperforms MPRM by a significant margin. It is also noteworthy that the proposed framework does not employ the two-stage retraining technique or dense conditional random field (CRF), unlike MPRM. In summary, the proposed 2D-3D joint learning method outperforms the existing 3D WSSS methods in both terms of label efficiency and performance. + +Figure 4 visualizes qualitative comparisons of the proposed framework and baselines, in both 2D and 3D domains. Compared with the result learned with a single 2D or 3D domain, our framework shows significantly better results in terms of accuracy of semantics and preciseness of segmentation. With our 2D-3D joint framework for WSSS, the complementary advantages of both domains are effectively combined. We can observe that the unified benefits of multi-domains achieve substantial semantic segmentation results, compared to uni-domain baselines. There are a few limitations such as thin objects (e.g. legs of a table) in the 3D domain, fine details in the 2D domain, and sensitivity to the pose quality. Nevertheless, our framework achieves a strong baseline for the 2D-3D joint learning of WSSS. Additional semantic segmentation results are provided in Supplementary Material. + +![](images/da4f5115e59f587ccf9171035eb71ec4f80b6475855af23017efcec1c1d72db6.jpg) +Figure 4: Qualitative comparison of 2D/3D semantic segmentation results of uni-domain baselines and the proposed 2D-3D joint framework. From left to right: input (projected) point clouds and images, results of uni-domain 2D WSSS and 3D WSSS, our joint WSSS results, and ground truths. We visualize the region of the point cloud corresponding to the images by red or blue circles. A color map of the 20 classes of ScanNetV2 [5] is provided at the top of the figure, where the black color denotes the ignore index. + +# 4.4 Generalization Capability + +Most of the existing (indoor) point cloud datasets [5, 2] have obtained the point cloud from a sequence of RGBD frames, using 3D reconstruction techniques such as Structure from Motion (SfM). Therefore, in addition to the 3D point clouds, such datasets usually provide 2D images and the poses of the 2D images. The proposed joint learning framework targets such paired multi-domain datasets. Throughout Sec 4, we demonstrated that unifying the complementary advantages of multi-domain data could bring remarkable improvements in both 2D and 3D WSSS. + +Nevertheless, we agree that the paired multi-domain data is not trivial to acquire in usual, especially when we want to apply our framework to the novel data of the unobserved scene domains. Compared to the existing 2D or 3D WSSS methods which require single-domain data (e.g. images only or point cloud only), the difficulty to acquire the multi-domain dataset is one of the limitations of the proposed joint WSSS framework. + +Table 4: Quantitative comparisons of the generalization capability between the proposed joint learning framework and our baselines. The semantic segmentation performance (mIoU, %) is evaluated on the official val splits of the S3DIS [2] dataset. The loss terms follow the denotation of Table 2. We use confidence-based scoring by default. Bold numbers represent the best results. + +
Domain\( \mathcal{L}_{cls}^{2d} \)\( \mathcal{L}_{cls}^{3d} \)\( \mathcal{L}_{joint}^{2d\rightarrow 3d} \)\( \mathcal{L}_{joint}^{3d\rightarrow 2d} \)Val
2D✓36.9
✓✓✓43.3
✓✓✓✓49.5
3D✓17.5
✓✓✓48.0
✓✓✓✓54.4
+ +To relieve this issue, we experimentally verify the generalization capability of the proposed method using the S3DIS [2] dataset, as in WyPR [22]. In this experiment, we first train our model on the ScanNetV2 dataset only and then test the trained model on validation set of the S3DIS dataset. We evaluate the performance only on the overlapped class between the ScanNetV2 and S3DIS datasets. Here, it is noteworthy that we perform 2D WSSS and 3D WSSS individually, without using the input data from the other domain. Thanks to our practical design philosophy, we could feed the 3D point clouds only for the 3D branch and 2D images only for the 2D. + +Table 4 shows the generalization capability of our method by comparing it with our baselines. Similar to the tendency in Table 2, the proposed 2D-3D joint loss provides significant performance gain in both 2D and 3D domains, even on the dataset unobserved during the training. Especially, the proposed framework still outperforms the 3D WSSS performance of WyPR [22] on the S3DIS dataset $(22.3\%)$ by a large gap. The results strongly support that the complementary advantages of 2D and 3D domains are preserved on the other dataset, even without any further fine-tuning or domain-specific adaptation. + +Although the proposed joint framework requires paired multi-domain data during training, thanks to the demonstrated generalization capability, our framework could be scaled into processing the unobserved general data. From a practical perspective, this generalizability of the proposed method is a strong contribution to the field of WSSS. + +# 5 Conclusion + +WSSS has been widely studied for relieving the annotation cost of semantic segmentation in both 2D and 3D domains. However, the existing studies have been focused on domain-specific methods. In this paper, we propose a novel 2D-3D joint framework for WSSS in both 2D and 3D domains. Motivated by the complementary nature of the 2D and 3D domains, we devise our framework to effectively transfer the benefit of one domain to the other domain in a simultaneous manner. We bridge the 2D pixels and 3D points via projection and leverage the 2D CAM as self-supervision for improving the semantic perception of the 3D CAM. To transfer the geometrical structure of the 3D scene to the 2D domain, we exploit a correlation matrix of 3D features for training the 2D features. For both directions, we propose a confidence-based scoring strategy to suppress less accurate self-supervision and make the framework learn from the reliable regions only. With extensive experiments, we verify that the proposed 2D-to-3D and 3D-to-2D joint loss effectively unifies the distinct benefits of both domains, while relieving the disadvantages. On the ScanNetV2 dataset, the proposed framework significantly outperforms the single-domain baselines and the other state-of-the-art methods. Further, with an experiment on the S3DIS dataset, we demonstrate the generalization capability of our method, which supports its practicality. We believe that 2D-3D joint learning is a new and promising research direction for WSSS, and this paper provides a strong baseline for it. + +# Acknowledgments and Disclosure of Funding + +This work was supported by the National Research Foundation of Korea(NRF) grant funded by the Korea government(MSIT) (NRF2022R1A2B5B03002636). + +# References + +[1] J. Ahn and S. Kwak. Learning pixel-level semantic affinity with image-level supervision for weakly supervised semantic segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 4981-4990, 2018. +[2] I. Armeni, O. Sener, A. R. Zamir, H. Jiang, I. Brilakis, M. Fischer, and S. Savarese. 3d semantic parsing of large-scale indoor spaces. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1534-1543, 2016. +[3] Y.-T. Chang, Q. Wang, W.-C. Hung, R. Piramuthu, Y.-H. Tsai, and M.-H. Yang. Weakly-supervised semantic segmentation via sub-category exploration. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8991-9000, 2020. +[4] A. Dai and M. Nießner. 3dmv: Joint 3d-multi-view prediction for 3d semantic scene segmentation. In Proceedings of the European Conference on Computer Vision (ECCV), pages 452-468, 2018. +[5] A. Dai, A. X. Chang, M. Savva, M. Halber, T. Funkhouser, and M. Nießner. Scannet: Richly-annotated 3d reconstructions of indoor scenes. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 5828-5839, 2017. +[6] M. Everingham, L. Van Gool, C. K. Williams, J. Winn, and A. Zisserman. The pascal visual object classes (voc) challenge. International journal of computer vision, 88(2):303-338, 2010. +[7] J. Fan, Z. Zhang, T. Tan, C. Song, and J. Xiao. Cian: Cross-image affinity net for weakly supervised semantic segmentation. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 10762-10769, 2020. +[8] J. Hou, B. Graham, M. Nießner, and S. Xie. Exploring data-efficient 3d scene understanding with contrastive scene contexts. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 15587-15597, 2021. +[9] J. Hou, S. Xie, B. Graham, A. Dai, and M. Nießner. Pri3d: Can 3d priors help 2d representation learning? In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 5693-5702, 2021. +[10] W. Hu, H. Zhao, L. Jiang, J. Jia, and T.-T. Wong. Bidirectional projection network for cross dimension scene understanding. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 14373-14382, 2021. +[11] Z. Huang, X. Wang, J. Wang, W. Liu, and J. Wang. Weakly-supervised semantic segmentation network with deep seeded region growing. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 7014-7023, 2018. +[12] M. Jaritz, J. Gu, and H. Su. Multi-view pointnet for 3d scene understanding. In Proceedings of the IEEE/CVF International Conference on Computer Vision Workshops, pages 0–0, 2019. +[13] A. Kolesnikov and C. H. Lampert. Seed, expand and constrain: Three principles for weakly-supervised image segmentation. In European conference on computer vision, pages 695-711. Springer, 2016. +[14] A. Krizhevsky, I. Sutskever, and G. E. Hinton. Imagenet classification with deep convolutional neural networks. Communications of the ACM, 60(6):84-90, 2017. +[15] A. Kundu, X. Yin, A. Fathi, D. Ross, B. Brewington, T. Funkhouser, and C. Pantofaru. Virtual multi-view fusion for 3d semantic segmentation. In European Conference on Computer Vision, pages 518-535. Springer, 2020. +[16] H. Kweon, S.-H. Yoon, H. Kim, D. Park, and K.-J. Yoon. Unlocking the potential of ordinary classifier: Class-specific adversarial erasing framework for weakly supervised semantic segmentation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 6994-7003, 2021. +[17] Z. Li, Z. Chen, A. Li, L. Fang, Q. Jiang, X. Liu, J. Jiang, B. Zhou, and H. Zhao. Simipu: Simple 2d image and 3d point cloud unsupervised pre-training for spatial-aware visual representations. arXiv preprint arXiv:2112.04680, 2021. +[18] T.-Y. Lin, M. Maire, S. Belongie, J. Hays, P. Perona, D. Ramanan, P. Dollár, and C. L. Zitnick. Microsoft coco: Common objects in context. In European conference on computer vision, pages 740-755. Springer, 2014. + +[19] Y. Liu, K. Chen, C. Liu, Z. Qin, Z. Luo, and J. Wang. Structured knowledge distillation for semantic segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 2604-2613, 2019. +[20] Z. Liu, X. Qi, and C.-W. Fu. One thing one click: A self-training approach for weakly supervised 3d semantic segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1726-1736, 2021. +[21] C. R. Qi, L. Yi, H. Su, and L. J. Guibas. Pointnet++: Deep hierarchical feature learning on point sets in a metric space. Advances in neural information processing systems, 30, 2017. +[22] Z. Ren, I. Misra, A. G. Schwing, and R. Girdhar. 3d spatial recognition without spatially labeled 3d. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 13204-13213, 2021. +[23] O. Russakovsky, J. Deng, H. Su, J. Krause, S. Satheesh, S. Ma, Z. Huang, A. Karpathy, A. Khosla, M. Bernstein, et al. Imagenet large scale visual recognition challenge. International journal of computer vision, 115(3):211-252, 2015. +[24] K. K. Singh and Y. J. Lee. Hide-and-seek: Forcing a network to be meticulous for weakly-supervised object and action localization. In 2017 IEEE international conference on computer vision (ICCV), pages 3544-3553. IEEE, 2017. +[25] G. Sun, W. Wang, J. Dai, and L. Van Gool. Mining cross-image semantics for weakly supervised semantic segmentation. arXiv preprint arXiv:2007.01947, 2020. +[26] W. Sun, J. Zhang, and N. Barnes. 3d guided weakly supervised semantic segmentation. In Proceedings of the Asian Conference on Computer Vision, 2020. +[27] H. Thomas, C. R. Qi, J.-E. Deschaud, B. Marcotegui, F. Goulette, and L. J. Guibas. Kpconv: Flexible and deformable convolution for point clouds. In Proceedings of the IEEE/CVF international conference on computer vision, pages 6411-6420, 2019. +[28] H. Wang, X. Rong, L. Yang, S. Wang, and Y. Tian. Towards weakly supervised semantic segmentation in 3d graph-structured point clouds of wild scenes. In BMVC, page 284, 2019. +[29] J. Wei, G. Lin, K.-H. Yap, T.-Y. Hung, and L. Xie. Multi-path region mining for weakly supervised 3d semantic segmentation on point clouds. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 4384-4393, 2020. +[30] Z. Wu, C. Shen, and A. Van Den Hengel. Wider or deeper: Revisiting the resnet model for visual recognition. Pattern Recognition, 90:119-133, 2019. +[31] X. Xu and G. H. Lee. Weakly supervised semantic point cloud segmentation: Towards 10x fewer labels. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 13706-13715, 2020. +[32] X. Zhang, Y. Wei, J. Feng, Y. Yang, and T. S. Huang. Adversarial complementary learning for weakly supervised object localization. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 1325-1334, 2018. +[33] Y. Zhang, Z. Li, Y. Xie, Y. Qu, C. Li, and T. Mei. Weakly supervised semantic segmentation for large-scale point cloud. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 3421-3429, 2021. +[34] Y. Zhang, Y. Qu, Y. Xie, Z. Li, S. Zheng, and C. Li. Perturbed self-distillation: Weakly supervised large-scale point cloud semantic segmentation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 15520-15528, 2021. +[35] B. Zhou, A. Khosla, A. Lapedriza, A. Oliva, and A. Torralba. Learning deep features for discriminative localization. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2921-2929, 2016. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] We clarify our contributions in Section 1, and they are experimentally verified in Section 4. +(b) Did you describe the limitations of your work? [Yes] See Section 4.3. +(c) Did you discuss any potential negative societal impacts of your work? [No] As far as we know, WSSS would not make meaningful negative societal impacts. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] We carefully read the guidelines and ensure it. + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [N/A] +(b) Did you include complete proofs of all theoretical results? [N/A] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [No] But all the code and instructions will be publicly available, soon. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 4.1. +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] But we empirically check that the proposed method is robust to random seed, and we are willing to provide the results regarding it if required. +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Section 4.1. + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] We use ScanNetV2 dataset, and cite the paper. +(b) Did you mention the license of the assets? [Yes] See Section 4.1. +(c) Did you include any new assets either in the supplemental material or as a URL? [N/A] + +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [Yes] See Section 4.1. +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [Yes] See Section 4.1. + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/jointlearningof2d3dweaklysupervisedsemanticsegmentation/images.zip b/jointlearningof2d3dweaklysupervisedsemanticsegmentation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..51621a9cec69fa66e40b21f57253adbd27cbfdde --- /dev/null +++ b/jointlearningof2d3dweaklysupervisedsemanticsegmentation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:11bb9f8698157ade4142c1b5899d8657f134c2d5b29b83b746915272a1e08c7a +size 695691 diff --git a/jointlearningof2d3dweaklysupervisedsemanticsegmentation/layout.json b/jointlearningof2d3dweaklysupervisedsemanticsegmentation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..06943639b4a93cac088be5a57a34db8a8dfcaed4 --- /dev/null +++ b/jointlearningof2d3dweaklysupervisedsemanticsegmentation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e88b0984ad814c68743775efc232b1cca5c72a70f3ca87e84652327230c2ecb8 +size 401550 diff --git a/jumpselfattentioncapturinghighorderstatisticsintransformers/bd40cf5e-ea24-4b4e-8977-0d8672912df5_content_list.json b/jumpselfattentioncapturinghighorderstatisticsintransformers/bd40cf5e-ea24-4b4e-8977-0d8672912df5_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..b582c9a5b15b0188e4e57b34c3524da182877a84 --- /dev/null +++ b/jumpselfattentioncapturinghighorderstatisticsintransformers/bd40cf5e-ea24-4b4e-8977-0d8672912df5_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2e77f345969dafeaf6ec909703ff16084211e09034c7667ee43363a156290ee5 +size 88992 diff --git a/jumpselfattentioncapturinghighorderstatisticsintransformers/bd40cf5e-ea24-4b4e-8977-0d8672912df5_model.json b/jumpselfattentioncapturinghighorderstatisticsintransformers/bd40cf5e-ea24-4b4e-8977-0d8672912df5_model.json new file mode 100644 index 0000000000000000000000000000000000000000..4244203cc9e7157f6bc0070863a2b29094e31cad --- /dev/null +++ b/jumpselfattentioncapturinghighorderstatisticsintransformers/bd40cf5e-ea24-4b4e-8977-0d8672912df5_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dffe6a976c02a0fed12b89fad8dea417941fb97a63b422340fc1737c66c9fd1b +size 110017 diff --git a/jumpselfattentioncapturinghighorderstatisticsintransformers/bd40cf5e-ea24-4b4e-8977-0d8672912df5_origin.pdf b/jumpselfattentioncapturinghighorderstatisticsintransformers/bd40cf5e-ea24-4b4e-8977-0d8672912df5_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..5bd43c717254ef56d72a06e8e66ee19925e3fa13 --- /dev/null +++ b/jumpselfattentioncapturinghighorderstatisticsintransformers/bd40cf5e-ea24-4b4e-8977-0d8672912df5_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56235d9fd256c4f8f9c9ce272b31d24be2399db5ef9fa4783b666a93759f8088 +size 582898 diff --git a/jumpselfattentioncapturinghighorderstatisticsintransformers/full.md b/jumpselfattentioncapturinghighorderstatisticsintransformers/full.md new file mode 100644 index 0000000000000000000000000000000000000000..b464610019cac8b41544e5a8d26c40e77509115f --- /dev/null +++ b/jumpselfattentioncapturinghighorderstatisticsintransformers/full.md @@ -0,0 +1,407 @@ +# Jump Self-attention: Capturing High-order Statistics in Transformers + +Haoyi Zhou + +BDBC + +Beihang University + +Beijing, China 100191 + +haoyi@buaa.edu.cn + +Siyang Xiao + +BDBC + +Beihang University + +Beijing, China 100191 + +xiaosy@act.buaa.edu.cn + +Shanghang Zhang + +School of Computer Science + +Peking University + +Beijing, China 100871 + +shanghang@pku.edu.cn + +Jieqi Peng + +BDBC + +Beihang University + +Beijing, China 100191 + +pengjq@act.buaa.edu.cn + +Shuai Zhang + +BDBC + +Beihang University + +Beijing, China 100191 + +zhangs@act.buaa.edu.cn + +Jianxin Li* + +BDBC† + +Beihang University + +Beijing, China 100191 + +lijx@buaa.edu.cn + +# Abstract + +The recent success of Transformer has benefited many real-world applications, with its capability of building long dependency through pairwise dot-products. However, the strong assumption that elements are directly attentive to each other limits the performance of tasks with high-order dependencies such as natural language understanding and Image captioning. To solve such problems, we are the first to define the Jump Self-attention (JAT) to build Transformers. Inspired by the pieces moving of English Draughts, we introduce the spectral convolutional technique to calculate JAT on the dot-product feature map. This technique allows JAT's propagation in each self-attention head and is interchangeable with the canonical self-attention. We further develop the higher-order variants under the multi-hop assumption to increase the generality. Moreover, the proposed architecture is compatible with the pre-trained models. With extensive experiments, we empirically show that our methods significantly increase the performance on ten different tasks. + +# 1 Introduction + +Transformers have made great success in many domains, such as NLP, Vision, Time-series, and Speech. However, the giant model GPT-3 [2] and switch Transformer [7], with their massive layers and over-parameterized architectures, have not further achieved significant performance improvements since the BERT model [5] beat the Human Performance in GLUE [21] and SQuAD [12]. Recently two visualization works [19, 3] reveal that the self-attention mechanism mainly learns superficial connections among inputs. The principle of direct accessing among inputs in the dot-product self-attention lies as the core of above models, which solely relies on their mutual similarity in the vector space. However, as "every coin has two sides", while the dot-product is simple and effective in capturing long-range dependencies, it has limited capability in learning high-order dependencies. + +To solve this problem, we are inspired by the pieces moving of English Draughts, a checker game spread to Great Britain in about 1100. It allows two moving rules: one is the simple move from the + +![](images/7382bb7af7c98b575c05cca5773f0fe138793e14d8ef4b508dc507a70bd9cf25.jpg) +(a) Dot-product attention with direct connections. + +![](images/c27bee0dd5f37a2aaaf61817067589a8fee5e8ee16df2d21be0427bf2d5a6c2a.jpg) +Figure 1: (a) The dot-product self-attention: Left side: The direct connections (the blue lines with arrows) are established between the input A (the red node) and other inputs via the dot-product self-attention. Right side: The nodes with different shades of blue represent the corresponding attention of the feature map. (b) The high-order self-attention: Left side: We build "jump" connections from input A (the red node) to previous unattended nodes at the corner, which is conditioned on the direct connections on "stepping stones" (the green circled nodes). Thus the dot-product feature map is enhanced with high-order connections as shown on the right side. + +![](images/65c18e34a0aae055a67dbb27848de205e5639c15205d8237c3571d2efc629e88.jpg) +(b) High-order attention with "jump" connections. + +![](images/7b500c7b909933b96767d0a45827263e1d21351d29501f74af0b50a1c309eba5.jpg) + +current position to an adjacent position; and the other is the capture move jumping over the “stepping stones” (opponent's pieces) from front to back. Multiple jumps are possible and forced in this game. As shown in Fig.(1), we can employ the high-order self-attention connections, like the capture moves in English Draughts, to enhance the feature map of dot-product self-attention. It helps to align high-order global dependencies in Transformer models. As a more concrete example in natural language understanding, we are given two sentences “Book costs more than pencil” and “Book costs less than computer”. “Computer” never attends to “pencil” until they were both compared with “Book”, thus “Book” is the “stepping stones” in creating high-order attention between “computer” and “pencil” in Fig(1b). More specifically, they forms a soft triadic closure. We will discuss this example in detail in Section 3.1 and clarify the definition of Jump Self-attention. + +In this work, we find that the high-order self-attention exists in the dot-product computation but it is too weak to contribute much to the attention layer's output. Only a few heads in Transformers can capture such high-order dependencies, which is shown in Fig.(2) with further discussions. Instead of finding such "miracle" heads, we reformulate them to enhance the high-order dependencies with the feature propagation technique in graph learning. Meanwhile, we build an efficient variant in computing-sensitive situations based on the sparsity measurement [25], and build higher-order variants in comprehensive situations using MixHop [1]. + +To the best of our knowledge, we are the first to define the Jump Self-attention (JAT) in Transformer models, where we formulate the high-order statistics calculation into a graph propagation problem. It can be used interchangeably with the canonical self-attention [18]. The JAT-enhanced Transformer allows for fine-tuning on the popular pre-trained models and achieves superior performance on various tasks, such as Natural Language Understanding and Question Answering. Our main contributions can be summarized as: + +- We discover the existence of JAT in the Transformers' dot-product computation and derive its formal definition to facilitate further analysis. +- We propose JAT through the jump aggregation and high-order dependencies' propagation without additional network parameters, and the efficient variant alleviates the extra computation cost. +- We propose the higher-order variants of JAT and masking strategy to allow its interchangeable usage with the canonical self-attention on the pre-trained models. +- We conduct experiments on fifteen different tasks to examine the effectiveness of the proposed methods. Results demonstrate the success of JAT in achieving state-of-the-art performance. + +# 2 Preliminary + +The self-attention was introduced by Transformer [18] model for the encoder-decoder architecture in NLP to build long-range dependencies from a variable-length source sentence. The alignment ability of self-attention to learn to acquire direct access between important items has made it an efficient component in many applications [5, 11, 25, 23]. For an input $\mathbf{X} \in \mathbb{R}^{L \times d}$ , we define the single-headed self-attention in the following form: + +$$ +\operatorname {A t t e n t i o n} (\mathbf {Q}, \mathbf {K}, \mathbf {V}) = \operatorname {s o f t m a x} \left(\frac {\mathbf {Q} \mathbf {K} ^ {\top}}{\sqrt {d}}\right) \mathbf {V}, \tag {1} +$$ + +![](images/196239a20e1e4977d2fd61a9c9abab822406ef90875654d72b25f063e0240915.jpg) +(a) AttnVis{layer7, head5}. + +![](images/24ac81f189e4d018e5a45cb9d04353f2fbd0f209666dfeac834292b89d3e5a4f.jpg) +Figure 2: A case study of sentence "Book cost more than pencil. Book cost less than computer." on the pre-trained BERT model [5]. (a) Attention Visualization: We specifically select the third layer and draw the attention score of two words "book" and one word "computer" at the fifth head in the multi-head self-attention. It is an extraordinary example to show that the word "computer" in the second sentence has established a moderate connection with the word "pencil" in the first sentence. The visualization tool is available online3. (b) Statistic of self-attention for significant connections across all heads: We first calculate the mean value and standard deviation over all the pairwise self-attention scores. And we select the $15.2\%$ of the self-attention connections among the three words "book", "pencil", and "computer" that their scores are greater than the threshold (mean + 0.5 std). The previous example in (a) is the miracle attention connection at the third layer, and it works by acquiring more connections than other layers. (c) Statistic of self-attention for major connections across all heads: We lower the threshold to (mean - 0.5 std) and it covers $70.5\%$ self-attention connections. It shows that the dot-product self-attention attempts to build the "computer-pencil" connections, but they are a few weak ones and contribute little to layer output. + +![](images/f6fbc769363a13d4c2449458508d06024b49f0aeec8d5f351740381048371861.jpg) +(b) Significant connections $(15.2\%)$ . +(c) Major connections $(70.5\%)$ . + +where the layer output is the linear combination of values $\mathbf{V}$ weighted by the attention scores between queries $\mathbf{Q}$ and keys $\mathbf{K}$ . Note that the queries, keys and values are projected by different linear transformations $\{\mathbf{W}_Q,\mathbf{W}_K,\mathbf{W}_V\}$ respectively. In practice, multiple attention heads are used to learn robust patterns [3, 19] among different transformations. It divides the inputs into $H$ groups and computes the single-head attention on each group separately. We concatenate the feature map of all groups as the attention layer output. + +# 3 Methods + +In this section, we first introduce the necessity of acquiring the high-order connections in the Transformer model. Then, we describe the proposed Jump Self-attention. + +# 3.1 What is the High-order Statistics? + +The BERT [5] model and its pre-trained successors utilize the self-attention, like GPT-3 [2] and switch Transformer [7], and they achieve distinct performance improvements on various NLP tasks. However, what the self-attention mechanism has learned remains to be a challenging problem for architecture optimization in Transformer. Recent visualization techniques on self-attention mechanism have shed light on the further explanation for this problem. In the BERT model, Vig [19] pointed out that different heads of the same layer highlight coarse positional patterns, such as 'CLS' or 'SEP' tokens, more frequently than lexical patterns, even though they are trained with separate random projections. Clark et al. [3] claimed that BERT's attention heads often exhibit similar behaviors within the same layer, such as attending to delimiter and positional tokens and broadly attending the entire sentence, whereas a few deviating heads hold an eye on linguistic pairs. Due to the space limit, a more comprehensive related work will be provided in the Appendix A. This paper investigates whether it is worth enhancing lexical patterns in self-attention. + +To motivate our approach, we perform an individual case study on investigating the lexical patterns of self-attention heads. Based on the pre-trained model on BERT [5], we consider logical reasoning questions on two continuous sentences "Book cost more than pencil" and "Book cost less than computer". It seeks to find the price between entities that have not been compared, like "pencil" + +and "computer". Note that the articles are omitted to avoid interference. In Fig.(2a), we present the visualization of three words' self-attention scores at the third layer and fifth head. The darker line color denotes a higher self-attention score, namely stronger connections. The word "book" shows strong attention connections (deeper blue lines) to the positional token 'SEP' in the first and second sentences, meanwhile, they also attend to the entity words "pencil" and "computer" (lighter blue lines). While the attention scores between the word "computer" and token 'SEP' are striking, we note that the word "computer" builds a mild attention connection to the word "pencil" crossing two sentences. From the entity extraction perspective, the mutual attention connections among three words "book", "pencil" and "computer" seem trivial. + +However, the concrete finding in Fig.(2b) undermines this emotional thinking and it reveals the potential value of attention connections between "computer" and "pencil". We first calculate the mean value and standard deviation over all the pairwise self-attention scores. And we select the attention connections that their scores are greater than the threshold (mean + 0.5 std). We only draw the local connections among the three words and it covers $15.2\%$ of the total as the significant local connections. The stronger "Computer-Pencil" attention connection, as it in Fig(2b), is the rare self-attention computation that happens at the third layer, which distinguishes it from the trivial "Book-pencil" and "Book-Computer" attention connections. As we discussed above, there are many connections from three words to the delimiter 'CLS' and positional tokens 'SEP' but they did not form the "Computer-Pencil" connection. Furthermore, in Fig.(2b), there are many "Book-Pencil" connections and "Book-Computer" connections that exist in other layers but they all fail to capture the "Computer-Pencil" connection. The fifth head in the third layer is the miracle head that can establish the strong linguistic connection between "computer" and "Pencil" and it forms lexical self-attention patterns across different sentences. We call this an exact example of the High-order Statistics, and it is formulated on input pairs which satisfy the following definition: + +Definition 3.1. $(\delta, p, \mathbf{W}_Q, \mathbf{W}_K)$ -similar For vector inputs $\mathbf{x}_i$ , $\mathbf{x}_j$ and $\mathbf{x}_k$ , there exists a single head self-attention with query transformations $\mathbf{W}_Q$ and key transformations $\mathbf{W}_K$ , and the self-attention computation forms the feature map score as $\mathbf{S}_{ij} = (\mathbf{x}_i \mathbf{W}_Q)(\mathbf{x}_j \mathbf{W}_K)^\top$ such that, under the $\delta$ -significant threshold $p$ , + +$$ +i f \mathbf {S} _ {i k} \geq p a n d \mathbf {S} _ {j k} \geq p, t h e n \Pr [ \mathbf {S} _ {i j} \geq p ] > \delta +$$ + +$$ +o t h e r w i s e, t h e n \Pr [ \mathbf {S} _ {i j} \geq p ] \leq 1 - \delta +$$ + +Thus the inputs $\mathbf{x}_i$ and $\mathbf{x}_j$ are called $(\delta, p, \mathbf{W}_Q, \mathbf{W}_K)$ -similar w.r.t the input $\mathbf{x}_k$ . + +In Fig.(2c), we relax the restriction on significant connections and select the major connections covering $70.5\%$ local connections among the three words. As a natural result of decreasing the significance $\delta$ and threshold $p$ in Definition 3.1, it emerges more high-order self-attention, i.e., connections between "Computer" and "Pencil". This implies that weak high-order self-attention exist in the canonical self-attention but these connections are too delicate to contribute to self-attention's layer out. + +# 3.2 Calculate the Jump Self-attention + +The Jump Self-attention (JAT) is based on the vanilla Transformer architecture to be consistent with the latest improvement on it. Inspired by the pieces moving in Fig.(1), we build a transaction graph on the self-attention feature map. Then JAT utilizes the GCN operator to allow "jump" connections to traverse through different queries and key pairs, and the weak connections under the similar condition are enhanced to help enforces the desired triadic closure property. + +Let the attention score of single-headed self-attention in Eq.(1) be $\mathbf{S} = \mathbf{Q}\mathbf{K}^{\top}$ , we notice that the softmax $(\cdot)$ function on $\mathbf{S} / \sqrt{d}$ is row-wise, which makes the self-attention layer output the correct representation of value $\mathbf{V}$ . To understand the underlying meaning of high-order statistics in attention computation, we can take a column view of $\mathbf{S}$ in Fig.(3a). Different from the row view where each row reflects one query's scores on all keys, in the column view, each key column represents a similarity measurement of all queries against itself. + +Consider an intuitive example from the previous case study, we draw the attention feature map with five queries and keys in Fig.(3b). We firstly present the dot-product self-attention scores on the left side. The self-attention scores $\mathbf{S}_{31} = \mathbf{Q}_3(\mathbf{K}_1)^\top$ and $\mathbf{S}_{41} = \mathbf{Q}_4(\mathbf{K}_1)^\top$ highlight in the column vector of the first key, as we can see the crosshatch under the column view (the red shade), which indicates that inputs $\mathbf{x}_3$ and $\mathbf{x}_4$ attend to the input $\mathbf{x}_1$ from the $\mathbf{K}_1$ 's observation. The connection between $\mathbf{x}_3$ + +![](images/6ddcf685913abf2d52e6ad1d67a1e3d743f2691ac360cc041fd78e4b58866783.jpg) +(a) The different views. + +![](images/a349e944cc49ce52d6fc069528e694f4ab662645ee84d4f81a1dc538b6f22399.jpg) +(b) The overview of the high-order self-attention. +Figure 3: (a) Two different views on self-attention scores: We present the row view of self-attention scores at the top and the column view at the bottom. The solid blue line denotes the second query's self-attention distribution over all the keys, and the single apex indicates focused attention. The solid green line represents the self-attention distribution between all queries and one key, and the multi-peak reveals three stronger attention connections for that key. (b) An example of finding the "jump" connection: We can utilize the "Pencil" and "Computer" attention to "Book" to enhance a closer similarity between them, namely, from the crosshatch to the red marked squares. + +and $\mathbf{x}_4$ are weak (the blank square). Based on the high-order statistics, we have a high probability $\delta$ that the inputs $\mathbf{x}_3$ "Pencil" and $\mathbf{x}_4$ "Computer" becomes $(\delta, p, \mathbf{W}_Q, \mathbf{W}_K)$ -similar w.r.t the input $\mathbf{x}_1$ "Book". But the dot-product self-attention can not capture this kind of similarity for $\mathbf{x}_3$ and $\mathbf{x}_4$ . If we could modify the linear transformation $\mathbf{W}_Q$ and $\mathbf{W}_K$ such that the red marked square attains larger attention scores while others maintains, and the attention score between $\mathbf{x}_3$ and $\mathbf{x}_4$ grows larger enough than the significance threshold $p$ . We call this attention adjustment a successful "jump", and it could happen for the individual key. + +We assume that there exists a "miracle head", whose self-attention feature map contains both dot-product similarity and high-order statistics. Instead of modifying the linear transformation $\mathbf{W}_Q$ and $\mathbf{W}_K$ , we can direct "correct" the self-attention feature map by running thorough all triplets and adjusting the scores by specific keys. However, this direct operation will introduce an extra computation of attention combination $\mathcal{O}(L^3)$ w.r.t the input length $L$ . And it is hard to acquire a back-propagation friendly implementation. + +To formulate the modification of feature map, we relax the objective of finding the miracle heads to enhance the weak "jump" connection in canonical self-attention computation. Under the row view, we build a graph $G = (V, E)$ from the self-attention scores, where the queries compose the node set $V$ with the row vector of $\mathbf{S}$ as node features and each edge is defined by a adjacency matrix $\mathbf{A}$ . Then, we introduce $\mathbf{A}$ 's computation. Subscribing the matrix with $i^{\top}$ returns the $i$ -th column as a vector. We select the $j$ -th key as the current column, then the sub-adjacency matrix under the $\mathbf{K}_j$ is defined: + +$$ +\mathbf {A} ^ {\left(\mathbf {K} _ {j}\right)} = \left[ \mathbf {U} _ {j} - \operatorname {d i a g} (\mathbf {U}) _ {j} \right] _ {\rho}, \quad \text {w h e r e} \quad \mathbf {U} _ {j} = \frac {\mathbf {S} _ {j ^ {\top}} \otimes \mathbf {S} _ {j ^ {\top}}}{d}. \tag {2} +$$ + +The operation $\otimes$ denotes the tensor product and we use the similar $d$ -dimension normalization in the canonical self-attention [18]. $\mathbf{U}_j$ is a symmetric matrix containing input pairs with $(\delta, p, \mathbf{W}_Q, \mathbf{W}_K)$ -similarity, like $\mathbf{x}_3$ and $\mathbf{x}_4$ in the previous example. $[\cdot]_{\rho}$ is an indicator function for each matrix item that returns 1 if the item is greater than the $\rho$ , otherwise return 0. Here, we break the "both" requirements in Definition 3.1. Thus, the threshold $\rho$ becomes a hyperparameter reflecting the magnitude of $\delta$ and $p$ . We go through all keys, the $j$ -th sub-adjacency matrix reflects the similarity between different queries w.r.t $\mathbf{K}_j$ . + +Inspired by the layer aggregation [17, 10], the summation of weighted adjacency matrix yield larger gap between isolated values and bulk eigenvalues, which has been widely used in helping the community detection task [14, 4]. The sub-adjacency matrices are describing the connections between all the queries, i.e., different layers in a multiplex network, we can also leverage the same operation for a better edge probability recovery - similarity detection. Then, we can add up all the sub-adjacency matrix into the weighted one: + +$$ +\mathbf {A} = \frac {1}{L} \sum_ {j} \mathbf {A} ^ {\left(\mathbf {K} _ {j}\right)} \quad . \tag {3} +$$ + +Our next question is to enhance the "jump" connection for individual inputs. The Graph Convolutional Neural network (GCN) could perform local aggregate operators over the graph adjacency matrix, + +which is proposed by Scarselli et al. [15] and is further simplified by Duvenaud et al. [6] and Sukhbaatar et al. [16]. We employ it as a specific architecture for encouraging the attended items to become similar in both queries and keys. Then we have: + +$$ +\mathbf {Q} ^ {\prime} = \hat {\mathbf {A}} \mathbf {Q} \mathcal {W} _ {Q}, \quad \mathbf {K} ^ {\prime} = \hat {\mathbf {A}} \mathbf {K} \mathcal {W} _ {K} \tag {4} +$$ + +where $\hat{\mathbf{A}} = \tilde{\mathbf{D}}^{-\frac{1}{2}}\tilde{\mathbf{A}}\tilde{\mathbf{D}}^{-\frac{1}{2}}$ , $\tilde{\mathbf{A}} = \mathbf{A} + \mathbf{I}$ and $\tilde{\mathbf{D}}$ is a diagonal matrix from the column-sum of $\mathbf{A}$ , where every node can only attend to its nearest neighborhood with the learnable graph filter $\mathcal{W}$ . The GCN will make the selected queries/keys propagate its features, which causes a higher score when encountering each other in self-attention computation. In other words, GCN encourages high-order self-attention's propagation through individual keys' similarity measurement. Thanks to this property, the self-attention score will be updated as: + +$$ +\mathbf {S} ^ {\prime} = \mathbf {Q} ^ {\prime} \mathbf {K} ^ {\prime \top} = \hat {\mathbf {A}} \mathbf {X} \mathbf {W} _ {Q} \mathcal {W} _ {Q} \mathcal {W} _ {K} ^ {\top} \mathbf {W} _ {K} ^ {\top} \mathbf {X} ^ {\top} \hat {\mathbf {A}} ^ {\top} = \hat {\mathbf {A}} \mathbf {X} \left(\mathbf {W} _ {Q} \mathcal {W} _ {Q}\right) \left(\mathbf {W} _ {K} \mathcal {W} _ {K}\right) ^ {\top} \mathbf {X} ^ {\top} \hat {\mathbf {A}} ^ {\top}. \tag {5} +$$ + +If we aggregate the graph filter $\mathcal{W}$ into the random projection $\mathbf{W}$ as a new projection $\mathbf{W}'$ , the score $\mathbf{S}'$ becomes $\hat{\mathbf{A}} (\mathbf{X}\mathbf{W}_Q')(\mathbf{X}\mathbf{W}_K')^\top \hat{\mathbf{A}}^\top$ . This could be considered as a way to modify the original learnable matrix $\mathbf{W}_Q$ into the new projection $\mathbf{W}_Q'$ . Note that the proposed method maintains the same parameter scale. Immediately, we could derive the self-attention score after applying the GCN operator on both queries and keys, namely the "jump" operation: + +$$ +\Phi (\mathbf {S}) = \hat {\mathbf {A}} \mathbf {S} \hat {\mathbf {A}} ^ {\top}, \tag {6} +$$ + +which forms an approximated graph operator repeating propagation over the graph to enforce the desired triadic closure, like SGC [22]. The original GCN activation operation is omitted to avoid interfering with later self-attention calculations, which is merged into the following Feed-Forward Net. In this way, we are able to propose the Jump Self-attention: + +$$ +\mathcal {A} (\mathbf {Q}, \mathbf {K}, \mathbf {V}) = \operatorname {s o f t m a x} \left(\frac {\Phi (\mathbf {Q} \mathbf {K} ^ {\top})}{\sqrt {d}}\right) \mathbf {V}. \tag {7} +$$ + +To better take advantage of the pre-trained model, we suggest to split H heads in canonical self-attention into two groups of $H_{c}$ heads and $H_{j}$ heads. The $H_{c}$ heads perform the canonical self-attention operation and the $H_{j}$ heads perform jump self-attention, then we concatenate their results as the complete layer output. The use of high-order self-attention enables acquiring high-order dependencies over the superficial ones. Overview of JAT's whole process is given in Appendix. The JAT and canonical self-attention can be used interchangeably in Transformer models. + +# 3.2.1 Masking tricks + +The mask of self-attention [18] plays an important role in avoiding the auto-regressive during the inference phase. The GCN operations may cause leftward information to leak between queries. If JAT is applied in the decoder, we have to prevent this in building the adjacency matrix, where we reduce the edges from afterward queries to previous queries. We implement this inside of JAT by forcing the upper triangular of adjacency matrix to 0 in Eq.(3). The canonical self-attention's masking operation on the feature map is preserved after applying GCN in Eq.(5) such that we can eschew the information leakage in softmax( $\cdot$ ) function. + +# 3.2.2 Efficient variants + +The computation complexity of JAT remains $\mathcal{O}(L^3)$ w.r.t the input length $L$ , because we have to traverse all keys in the adjacency matrix aggregation of Eq.(3). We previously designed a sparsity measurement [25] to find the most significant queries in self-attention, which motivates us to employ it in selecting the primary keys: + +$$ +M ^ {(\mathbf {K} _ {j})} (\mathbf {S}) = \max _ {i} \left(\mathbf {S} _ {j \top}\right) - \operatorname {m e a n} _ {i} \left(\mathbf {S} _ {j \top}\right). \tag {8} +$$ + +We follow the sampling strategy and choose Top- $u$ Keys. Thus, the original self-attention $\mathbf{S}$ reduces to $\tilde{\mathbf{S}}\in \mathbb{R}^{L\times u}$ and we acquire the efficient variant $\mathrm{JAT}^{\dagger}$ in the $\mathcal{O}(L^2)$ . Recalling that the JAT shares the same parameter scale, and the $\mathrm{JAT}^{\dagger}$ holds the same computation complexity when compared with the canonical self-attention. + +Table 1: The performance comparison on the GLUE benchmark (dev sets). + +
ModelCoLA 8.5kMRPC 3.5kRTE 2.5kSTS-B 5.7kQNLI 108kQQP 363kSST-2 67kWNLI 0.64kMNLI 392kAverage -
ELMo44.176.653.470.471.186.291.556.368.668.7
BERTbase56.388.669.389.091.989.692.753.586.779.7
BERT-A362.390.273.990.191.190.692.955.687.381.5
BERT-JAT (ours)61.689.173.390.593.291.693.557.385.681.7
BERT-JAT† (ours)61.789.672.890.492.991.393.356.885.581.6
RoBERTa_base63.690.278.791.292.891.994.8-87.686.4
RoBERTa-JAT (ours)65.991.480.291.393.291.795.4-87.787.1
RoBERTa-JAT† (ours)66.791.780.992.392.991.794.9-87.587.1
+ +$^{1}$ JAT† represents the efficient variant of JAT. And the ‘-’ indicates abandoned experiments. + +# 3.2.3 Higher-order variants + +Without loss of generality, we can extend the similar in Definition 3.1 to a higher order case, where the similarity depends on more than one input. Instead of performing analogical derivations, we can introduce the Mix-hop [1] GCN to capture the multi-hop propagation on the graph of queries. If we refer the canonical self-attention [18] to the first order self-attention and our JAT to the second order one, then we can define the $j$ -th order self-attention as: + +$$ +\Phi^ {j} (\mathbf {S}) = \left\{ \begin{array}{c l} \mathbf {S} & , \text {i f} j = 1 \\ \hat {\mathbf {A}} ^ {j - 1} \mathbf {S} \left(\hat {\mathbf {A}} ^ {j - 1}\right) ^ {\top} & , \text {i f} j > 1 \end{array} \right. \tag {9} +$$ + +where $\hat{\mathbf{A}}^{j - 1}$ represents the adjacency matrix $\hat{\mathbf{A}}$ multiplied by itself $(j - 1)$ times. It's trivial to substitute the $\Phi^j (\mathbf{S})$ in Eq.(7) for higher-order self-attention variants $\mathcal{A}^2,\mathcal{A}^3$ and etc. We can split the heads into more groups when concatenating multiple self-attention with different orders. + +# 4 Experiments + +In this section, we empirically demonstrate JAT's effectiveness on the pre-trained $\mathrm{BERT}_{\mathrm{base}}$ model with 12 layers, and perform BERT-JAT fine-tuning and evaluation on ten NLP tasks. + +# 4.1 Setup + +(a) GLUE. We conduct JAT's experiments of the language understanding and generalization capabilities on the General Language Understanding Evaluation (GLUE) benchmark [21], a collection of diverse natural language understanding tasks. We also perform additional experiments on SuperGLUE benchmark [20]. Settings: We use a batch size of 32 and fine-tune for 5 epochs over the data for nine GLUE tasks. The threshold $\rho$ is selected from $\{4.0, 4.5, \ldots, 10.0\}$ . The other settings follow the recommendation of the original paper. Since the proposed JAT can be used interchangeably with canonical self-attention, we perform a grid search on the layer replacement. There are two sets of layer deployment, where the first combination is chosen from $\{L_{\text{Layer}_{1-4}}$ , $L_{\text{Layer}_{5-8}}$ , $L_{\text{Layer}_{9-12}}\}$ and the alternative is $\{L_{\text{Layer}_{1-6}}$ , $L_{\text{Layer}_{7-12}}\}$ . Another important selection is the multi-heads grouping, we employ the "side-by-side" strategy as replacing the heads $\{2, 4, 6, 8, 10\}$ with JAT. And we do not use any ensembling strategy or multi-tasking scheme in this fine-tuning. The evaluation is performed on the Dev set. Metric: We use three different evaluation metrics on the 9 tasks. Matthews correlation coefficient ( $MCC = \frac{TP \times TN - FP \times FN}{\sqrt{(TP + FP)(TP + FN)(TN + FP)(TN + FN)}}$ ) is used for CoLA, Pearson ( $PCC = \frac{N \sum y_i \hat{y}_i - \sum y_i \sum \hat{y}_i}{\sqrt{N \sum y_i^2 - (\sum y_i)^2} \sqrt{N \sum \hat{y}_i^2 - (\sum \hat{y}_i)^2}}$ ) is used for STS-B, and accuracy is used for others. Platform: Intel Xeon 3.2GHz + The Nvidia V100 GPU (32 GB) X 4. The code is available at https://github.com/zhouhaoyi/JAT2022. + +(b) SQuAD. We also evaluate on the SQuAD v1.1/v2.0 [12, 13]. The settings is in Appendix D. + +# 4.2 Main results + +The result of the GLUE experiment is summarized in Table 1. We compare ELMo [8] the baseline of GLUE, $\mathrm{BERT}_{\text {base }}$ [5], and RoBERTa [9], the pre-trained model where we build JAT varints. Our model BERT/RoBERTa-JAT outperform base models on eight tasks without introducing more + +Table 2: The performance comparison on the SuperGLUE benchmark (dev sets). + +
ModelCB Acc/F1BoolQ AccCOPA AccMultiRC F1/EMWiC AccWSC AccRTE AccAverage
CBOW71.4/49.662.463.020.3/0.355.361.554.255.4
M.F.C50.0/22.262.255.059.9/0.850.063.552.756.2
BERTbase94.6/93.777.769.070.5/24.774.968.375.875.8
RoBERTa base92.8/93.781.574.070.7/28.469.164.478.775.9
RoBERTa-JAT××82.0×70.265.480.2-
RoBERTa-JAT†98.2/98.582.379.071.6/29.570.567.380.978.5
+ +$^{1}$ JAT represents the efficient variant of JAT. +2 The $\cdot$ indicates abandoned experiments, and $\times$ happens when reaching out-of-memory. + +Table 3: The performance on the SQuAD. + +
ModelSQuAD v1.1SQuAD v2.0
EMF1EMF1
BiDAF-ELMo-85.663.466.2
XLNetbase89.795.187.990.6
BERTbase81.287.975.979.3
BERT-A381.889.375.979.3
BERT-JAT82.189.376.482.0
RoBERTa base88.994.686.589.4
RoBERTa-A389.294.886.689.7
RoBERTa-JAT90.195.287.090.2
+ +parameters, which shows that JAT can capture higher-order dependencies than canonical self-attention. More specifically, BERT-JAT achieve $9.4\%$ score rising on the CoLA dataset and $7.1\%$ on the WNLI dataset as a remarkable improvement, which shows that JAT shows the better alignment ability on a smaller dataset. When it applies to RoBERTa, the average gain is larger and the most significant rising $4.9\%$ happens on the CoLA dataset, which demonstrates a stable performance gain on SOTA models. + +We have also show that JAT beats the competitor $\mathbf{A}^3$ [24] generally. The $\mathbf{A}^3$ introduces the triplet attention measuring dissimilarity to diversify the self-attention, while our proposed JAT tried to enhance similarity by building connections between unrelated pairs from a different perspective. These two works are orthogonal and can be performed together to improve self-attention mechanism. Meanwhile, the efficient variant $\mathrm{JAT}^\dagger$ also shows competitive performance than competitor $A^3$ . + +Results of evaluating JAT on the more challenging SuperGLUE benchmark are presented in Table 2, we have selected RoBERTa as a more efficient basic model. With more extended tokens on complicated tasks, the JAT fails on three tasks for OOM, but it still acquires better results than vanilla RoBERTa on others. The efficient variant RoBERTa-JAT† achieves the best average scores. + +The result of the SQuAD experiment is summarized in Table 3. Our model BERT-JAT achieves better performance than all baselines in both EM and F1 scores, which is aligned with the above results. + +# 4.3 Ablation Study + +# 4.3.1 Effect of JAT's Layer Deployment + +In this experiment, we explore the JAT layer's effect on acquiring the high-order connections. We set the layers at a different position in RoBERTabase model to use JAT heads, where the RoBERTa-JATi,j represents that the layers from $i$ to $j$ in RoBERTabase model have four JAT heads. We report the scores on the selected GLUE tasks, including CoLA, MRPC, RTE, and STS-B in Table 4. We can conclude that using JAT heads in lower or middle layers leads to better scores. This is consistent with the findings in Fig.(2), middle layers possess more weak high-order connections to be easily enhanced. Applying JAT at lower layers can effectively enhance the diversity of lower layers and improve the high-order connections to force the desired triadic closure. + +# 4.3.2 Effect of JAT's Head Grouping + +To evaluate the effect of JAT's head grouping (different splits) on general language understanding task accuracy, we trained many RoBERTa-JAT models with different JAT head numbers in layer 1-6. Results on the selected GLUE tasks are shown in Table 5. With the number of JAT head increasing, we can find that almost all the tasks' scores first increase then decrease. The scores increase because adding JAT heads enhance the high-order global dependencies in the vanilla RoBERTa model. They decrease when the number of heads is greater than 6, which probably is caused by too strong high-order inductive bias suppressing the canonical self-attention. But the CoLA dataset seems fitting the JAT assumption very well, which may explain why it reaches the highest performance gain in Table 1. + +# 4.3.3 Effect of Higher Order in JAT + +We perform this experiment to evaluate the effects of higher-order variants. Following the similar settings as the previous ablation study, where the RoBERTa-JAT $^{oi}$ stands for the $i$ -th order self-attention defined in Eq.(9). We show the selected GLUE results in Table 6. And it reveals that for most natural language understanding tasks, the second-order self-attention is sufficient to discover + +Table 4: The scores of different JAT's layer deployment. + +
ModelCoLAMRPCRTESTS-B
RoBERTa base63.690.278.791.2
RoBERTa-JATl[1,4]63.990.978.891.2
RoBERTa-JATl[5,8]63.690.478.790.9
RoBERTa-JATl[9,12]63.690.276.190.9
RoBERTa-JATl[1,6]64.690.479.491.1
RoBERTa-JATl[7,12]63.889.778.491.0
+ +Table 5: The scores of different JAT's heads grouping. + +
ModelCoLAMRPCRTESTS-B
RoBERTa base63.690.278.791.2
RoBERTa-JATh263.791.480.291.1
RoBERTa-JATh463.991.280.290.6
RoBERTa-JATh663.690.479.790.8
RoBERTa-JATh863.890.278.990.7
RoBERTa-JATh1064.190.277.290.5
RoBERTa-JATh1264.790.077.890.5
+ +Table 6: The scores of JAT's increasing order. + +
ModelCoLAMRPCRTESTS-B
RoBERTa \( _{base} \)63.690.278.791.2
RoBERTa-JAT \( ^{o1} \)65.491.479.991.3
RoBERTa-JAT \( ^{o2} \)64.490.780.290.8
RoBERTa-JAT \( ^{o3} \)64.091.278.790.9
+ +![](images/af70b9041612b45d6b946db2ee81a8c60507e5cb2db9b59875f20a52d65fb08b.jpg) +Figure 4: The performance decreases when the overall layers degrade from 12 to 2. + +![](images/7cc1b2c0c0fb35e452b0f58e976bbebb440f77c9e756ff9b7957b8a5d2c86c66.jpg) + +more higher-order connections and improve the expression ability of the model, which leads to better results. For example, using the second order JAT on RTE dataset significantly improves the scores. + +# 4.3.4 Effect of Layer Stacking Degradation in JAT + +Similar to the evaluation in $A^3$ [24], we conduct layer stacking degradation experiments on both CoLA and RTE downstream tasks. Firstly, we reduce the simpler BERTbase model by one layer at a time, which makes the overall layers degrade from 12 to 2. Fig.(4) shows that the BERT-JAT consistently outperforms BERTbase. In the RTE task, the BERT-JAT even achieves the highest accuracy with eight layers. Secondly, we have extended the BERTbase model from 12 layers to 15 layers, which matches the comparable extra computation brought by the JAT mechanism (refer to Sec 4.6). It reveals that the deeper baseline lags behind the JAT-enhanced ones. + +# 4.4 Visualization + +We conduct a visualization in Fig.(5) to show the self-attention feature map changing in JAT. To avoid repetition, we construct a new sentence. The line between words represents their attention scores: the darker, the larger. The Fig.(5a) shows heads of layer 6 in $\mathrm{BERT}_{\mathrm{base}}$ , and it indicates that the "Kate" has stronger connections to the words in the second sentence. The Fig.(5b) shows heads of the same layer in BERT-JAT, the "Kate" attends to the first sentence's "hit" through a "jump" connection with the blue head. This example shows that 'Kate' never gets a strong connection with the action 'hit' in vanilla self-attention, but JAT provides this conditional connection (may through 'bite'), which indicates the two actions may be sequentially related. This JAT-inspired attention change also applies to the 'SEP' token, which implies that 'Kate' are the last few words. Although this result differs from the previous examples on the noun exchanging, it reveals that the Jump Self-attention can enhance connections with various lexical patterns. + +# 4.5 Case Study + +We conduct an experiment on Named-Entity Recognition (NER) task using the standard CoNLL-2003 dataset, which concentrates on four types of named entities: persons, locations, organizations and names of miscellaneous entities that do not belong to the previous three groups. The settings are included in Appendix E. We select the major connections in the attention feature map where their scores are greater than (mean + std). We use 'CROSS' to represent connections of tokens with different named-entities. The visualization is showed in Fig.(7). From Fig.(7a) we find there are not many 'CROSS' connections in the attention of BERTbase, and most of the connections are between tokens belong to person entity. From Fig.(7b), we observe JAT significantly increases the number of connections between tokens with different named-entities at the layers {1,2,3,8,9,10} having JAT heads, which enhances the model's ability to discover high-order information and makes the model's expression more diverse. + +![](images/5d00194c0810e373986bd72cecd09c1ad2b0b7ebdf88bb385be94f87099c130d.jpg) +(a) $\mathrm{BERT}_{\mathrm{base}}$ + +![](images/833f141abb31e7607251576d258ffe5929d3856142cc044af60c04ae10a1b3e2.jpg) +(b) BERT-JAT. + +![](images/76455747826b2e089ca8c12e7d1870bde3fabe3b9c57e5df06c4d6f453bccbc4.jpg) +(a) The faster group. + +![](images/c13507a20a05ee6e38d6d877fa70972caaee7049c89000b353f2c8030c281637.jpg) +(b) The slower group. + +![](images/532e8ea3825e07918189db005c6932158ff6c576ce90934b7d75b49072fbc63c.jpg) +Figure 5: The sentence is "A friend of John hit the dog, then the dog bite Kate," our BERT-JAT finds the "jump" connection between word "hit" and word "Kate" in 6-th Layer. +(a) $\mathrm{BERT}_{\mathrm{base}}$ +Figure 7: The pair-wise attention connections of $\mathrm{BERT}_{base}$ and BERT-JAT on dataset CoNLL2003, our model BERT-JAT improve the connection between tokens with different named-entities (the 'CROSS' connections in orange). + +![](images/f32a13f8a5dd7fcd101373697e9abf8126e422944a4a5597a0c27b1b17344403.jpg) +Figure 6: The run-time of the proposed Jump Self-attention (JAT, JAT†) on the RoBERTa model. We divided eight tasks into a faster (< 100 min) and a slower group for clarity. Each bar stands for the training process on individual downstream tasks (running 10 epochs). +(b) BERT-JATl{1,2,3,8,9,10}. + +# 4.6 Run-time Comparison + +With the same setting, we evaluate the iterative efficiency of JAT on eight downstream task, which has no learnable parameters. The Fig.(6) shows that JAT mostly brings about $30\%$ extra computation than the vanilla Transformer, where RTE achieves $75\%$ at most. This variance is caused by the different input lengths $L$ when calculating the adjacency matrix in Eq.(3). It could be further improved by utilizing the Keys' sparsity [25], then $\mathrm{JAT}^{\dagger}$ achieves no more than $15\%$ extra computation time. + +# 5 Conclusions + +In this paper, we discovered the existence of Jump Self-attention (JAT) in the Transformers' dot-product computation. Drawing inspirations from the pieces moving of English Draughts, we define JAT from the canonical self-attention and propose a tangible framework to formalize JAT into the graph learning problem and leverage it to encourage JAT's propagation in attention feature map. We further develop the higher-order variants under multi-hop assumption to increase the generality. The proposed architecture is compatible with the pre-trained models. Experiments on two tasks demonstrate JAT's superior performance on capturing high-order dependencies. We also want to use JAT on MindSpore (https://www.mindspore.cn/), which is a new deep learning computing framework. + +# Acknowledgments + +This work was supported by grants from the Natural Science Foundation of China (62202029 and U20B2053). Thanks for the computing infrastructure provided by Beijing Advanced Innovation Center for Big Data and Brain Computing. This work was also sponsored by CAAI-Huawei MindSpore Open Fund. We gratefully acknowledge the support of MindSpore, CANN (Compute Architecture for Neural Networks) and Ascend AI Processor used for this research. + +# References + +[1] Sami Abu-El-Haija, Bryan Perozzi, Amol Kapoor, Nazanin Alipourfard, Kristina Lerman, Hrayr Harutyunyan, Greg Ver Steeg, and Aram Galstyan. Mixhop: Higher-order graph convolutional architectures via sparsified neighborhood mixing. In ICML, volume 97, pages 21–29, 2019. +[2] Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In NIPS, 2020. +[3] Kevin Clark, Urvashi Khandelwal, Omer Levy, and Christopher D. Manning. What does BERT look at? an analysis of bert's attention. pages 276-286, 2019. +[4] Aurelien Decelle, Florent Krzakala, Christopher Moore, and Lenka Zdeborova. Inference and phase transitions in the detection of modules in sparse networks. Physical Review Letters, 107(6):065701, 2011. +[5] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: pre-training of deep bidirectional transformers for language understanding. In ACL, pages 4171–4186, 2019. +[6] David Duvenaud, Dougal Maclaurin, Jorge Aguilera-Iparraguirre, Rafael Gomez-Bombarelli, Timothy Hirzel, Alán Aspuru-Guzik, and Ryan P. Adams. Convolutional networks on graphs for learning molecular fingerprints. In NIPS, pages 2224-2232, 2015. +[7] William Fedus, Barret Zoph, and Noam Shazeer. Switch transformers: Scaling to trillion parameter models with simple and efficient sparsity. arXiv:2101.03961, 2021. +[8] Vidur Joshi, Matthew E. Peters, and Mark Hopkins. Extending a parser to distant domains using a few dozen partially annotated examples. In ACL, pages 1190-1199, 2018. +[9] Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized BERT pretraining approach. arXiv:1907.11692, 2019. +[10] Raj Rao Nadakuditi and M. E. J. Newman. Graph spectra and the detectability of community structure in networks. arXiv:1205.1813, 2012. +[11] Niki Parmar, Ashish Vaswani, Jakob Uszkoreit, Lukasz Kaiser, Noam Shazeer, Alexander Ku, and Dustin Tran. Image transformer. In ICML, volume 80, pages 4052-4061, 2018. +[12] Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: 100, 000+ questions for machine comprehension of text. In EMNLP, pages 2383-2392, 2016. +[13] Pranav Rajpurkar, Robin Jia, and Percy Liang. Know what you don't know: Unanswerable questions for squad. In ACL, pages 784-789, 2018. +[14] Joerg Reichardt and Michele Leone. (un) detectable cluster structure in sparse networks. Physical review letters, 101(7):078701, 2008. +[15] Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE Trans. Neural Networks, 20(1):61-80, 2009. +[16] Sainbayar Sukhbaatar, Arthur Szlam, and Rob Fergus. Learning multiagent communication with backpropagation. In NIPS, pages 2244-2252, 2016. +[17] Dane Taylor, Saray Shai, Natalie Stanley, and Peter J. Mucha. Enhanced detectability of community structure in multilayer networks through layer aggregation. arXiv:1511.05271, 2015. +[18] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NIPS, pages 5998-6008, 2017. +[19] Jesse Vig. A multiscale visualization of attention in the transformer model. In ACL, pages 37-42, 2019. +[20] Alex Wang, Yada Pruksachatkun, Nikita Nangia, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. Superglue: A stickier benchmark for general-purpose language understanding systems. In NIPS, pages 3261-3275, 2019. + +[21] Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In ICLR, 2019. +[22] Felix Wu, Amauri H. Souza Jr., Tianyi Zhang, Christopher Fifty, Tao Yu, and Kilian Q. Weinberger. Simplifying graph convolutional networks. In ICML, volume 97, pages 6861-6871. PMLR, 2019. +[23] Yang Yang, Jia-Qi Yang, Ran Bao, De-Chuan Zhan, Hengshu Zhu, Xiao-Ru Gao, Hui Xiong, and Jian Yang. Corporate relative valuation using heterogeneous multi-modal graph neural network. IEEE TKDE, 2021. +[24] Haoyi Zhou, Jianxin Li, Jieqi Peng, Shuai Zhang, and Shanghang Zhang. Triplet attention: Rethinking the similarity in transformers. In KDD, pages 2378-2388, 2021. +[25] Haoyi Zhou, Shanghang Zhang, Jieqi Peng, Shuai Zhang, Jianxin Li, Hui Xiong, and Wancai Zhang. Informer: Beyond efficient transformer for long sequence time-series forecasting. In AAAI, pages 11106-11115, 2021. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] We have include a complete Introduction section. Please refer to Sec.1. +(b) Did you describe the limitations of your work? [Yes] We include that in the Limitations / Broad Impact Section. Please refer to Sec.Appendix G. +(c) Did you discuss any potential negative societal impacts of your work? [Yes] We include that in the Limitations / Broad Impact Section. Please refer to Sec.Appendix G. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] We have clarified it in the Sec.3 +(b) Did you include complete proofs of all theoretical results? [N/A] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] We provide all of them in the supplemental material and URL. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] Please refer to Sec.4.1. +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A] +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] Please refer to Sec.4.1. + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] +(b) Did you mention the license of the assets? [Yes] +(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [Yes] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] All the dataset are public. + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/jumpselfattentioncapturinghighorderstatisticsintransformers/images.zip b/jumpselfattentioncapturinghighorderstatisticsintransformers/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..4bca6ecdb6bc6b2b8a70901096dc5367a7cc82ad --- /dev/null +++ b/jumpselfattentioncapturinghighorderstatisticsintransformers/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:23d89d7d7b91d04dd19148eef8936e8ff52bff89c5494689032a9e787914850e +size 485657 diff --git a/jumpselfattentioncapturinghighorderstatisticsintransformers/layout.json b/jumpselfattentioncapturinghighorderstatisticsintransformers/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..9f8320a4d23b4326d7c8f8ca81d270fe87a31d68 --- /dev/null +++ b/jumpselfattentioncapturinghighorderstatisticsintransformers/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a2436f929cc264db70c44a2e3b33d1f3cdabe4fc1df31d6095cfb1a8dce9fb87 +size 492756 diff --git a/kantorovichstrikesbackwassersteingansarenotoptimaltransport/3b406d6f-818e-4570-9bc1-512d1c283db0_content_list.json b/kantorovichstrikesbackwassersteingansarenotoptimaltransport/3b406d6f-818e-4570-9bc1-512d1c283db0_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..fe0d3e513c5cdc580a4de93751fcd6421c6dff83 --- /dev/null +++ b/kantorovichstrikesbackwassersteingansarenotoptimaltransport/3b406d6f-818e-4570-9bc1-512d1c283db0_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7af9773e50f8e38db76c403b75bd59ac09fc3884b43b1584acc627447ddb142c +size 100282 diff --git a/kantorovichstrikesbackwassersteingansarenotoptimaltransport/3b406d6f-818e-4570-9bc1-512d1c283db0_model.json b/kantorovichstrikesbackwassersteingansarenotoptimaltransport/3b406d6f-818e-4570-9bc1-512d1c283db0_model.json new file mode 100644 index 0000000000000000000000000000000000000000..621775ab89595351ee1d04dcc73279d4847ab003 --- /dev/null +++ b/kantorovichstrikesbackwassersteingansarenotoptimaltransport/3b406d6f-818e-4570-9bc1-512d1c283db0_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c5a4222c8dc0552d3aef6130d8b38a0d1129019282ba660ca20471dbc518b20 +size 131737 diff --git a/kantorovichstrikesbackwassersteingansarenotoptimaltransport/3b406d6f-818e-4570-9bc1-512d1c283db0_origin.pdf b/kantorovichstrikesbackwassersteingansarenotoptimaltransport/3b406d6f-818e-4570-9bc1-512d1c283db0_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..14eaaffc9ed6448d28e5191d88c5e3ab8fed81be --- /dev/null +++ b/kantorovichstrikesbackwassersteingansarenotoptimaltransport/3b406d6f-818e-4570-9bc1-512d1c283db0_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9543a0f8c9a2af1cd44884692e0e21dc25f7fac5b0aa210add78ad6509c29823 +size 2520806 diff --git a/kantorovichstrikesbackwassersteingansarenotoptimaltransport/full.md b/kantorovichstrikesbackwassersteingansarenotoptimaltransport/full.md new file mode 100644 index 0000000000000000000000000000000000000000..e84eb95e7af599e97f861c4e3bbb33ee40cc1f81 --- /dev/null +++ b/kantorovichstrikesbackwassersteingansarenotoptimaltransport/full.md @@ -0,0 +1,490 @@ +# Kantorovich Strikes Back! Wasserstein GANs are not Optimal Transport? + +Alexander Korotin* + +Skolkovo Institute of Science and Technology + +Artificial Intelligence Research Institute + +Moscow, Russia + +a.korotin@skoltech.ru + +Alexander Kolesov* + +Skolkovo Institute of Science and Technology + +Moscow, Russia + +a.kolesov@skoltech.ru + +# Evgeny Burnaev + +Skolkovo Institute of Science and Technology + +Artificial Intelligence Research Institute + +Moscow, Russia + +e.burnaev@skoltech.ru + +# Abstract + +Wasserstein Generative Adversarial Networks (WGANs) are the popular generative models built on the theory of Optimal Transport (OT) and the Kantorovich duality. Despite the success of WGANs, it is still unclear how well the underlying OT dual solvers approximate the OT cost (Wasserstein-1 distance, $\mathbb{W}_1$ ) and the OT gradient needed to update the generator. In this paper, we address these questions. We construct 1-Lipschitz functions and use them to build ray monotone transport plans. This strategy yields pairs of continuous benchmark distributions with the analytically known OT plan, OT cost and OT gradient in high-dimensional spaces such as spaces of images. We thoroughly evaluate popular WGAN dual form solvers (gradient penalty, spectral normalization, entropic regularization, etc.) using these benchmark pairs. Even though these solvers perform well in WGANs, none of them faithfully compute $\mathbb{W}_1$ in high dimensions. Nevertheless, many provide a meaningful approximation of the OT gradient. These observations suggest that these solvers should not be treated as good estimators of $\mathbb{W}_1$ , but to some extent they indeed can be used in variational problems requiring the minimization of $\mathbb{W}_1$ . + +The Wasserstein-1 distance [3] $(\mathbb{W}_1)$ is a popular loss function to learn generative models. It has numerous advantages compared to the vanilla GAN loss [15]. For example, $\mathbb{W}_1$ is correctly defined if the distributions' supports differ [2]. Besides, it correlates with the sample quality, provides improved stability of the optimization process and does not suffer from the vanishing gradients issue [3, §4]. + +Generative models which employ $\mathbb{W}_1$ as the loss to update the generator are called the Wasserstein GANs (WGANs). To compute $\mathbb{W}_1$ , they use its variational approximation based on the Kantorovich duality [20] and the Optimal Transport (OT) theory [52, 47]. Since the introduction of the original WGANs with the weight clipping method [3], a lot of alternative techniques (neural dual OT solvers) to compute $\mathbb{W}_1$ have been proposed: gradient penalties [17, 39, 54], entropic regularization [46], architectural constraints [35, 1], batch-based methods [31, 29], maximin methods [38, 23], etc. + +Despite the popularity of WGANs, it still remains unclear to what extent their success is connected to OT and $\mathbb{W}_1$ rather than, e.g., to a good choice of regularization [49, §7]. Due to the limited amount of pairs of distributions with known $\mathbb{W}_1$ , it is challenging to evaluate existing dual OT solvers. + +Contributions. We develop a generic methodology based on the transport rays (§3.1) to evaluate dual OT solvers for the Wasserstein-1 distance $(\mathbb{W}_1)$ . Our main contributions are as follows: + +- We use 1-Lipschitz functions to construct pairs of continuous distributions that we use as a benchmark with analytically-known OT cost, map and gradient for $\mathbb{W}_1$ transport (§3.2, §3.3). +- We use these benchmark distributions to evaluate (§4) popular WGAN dual OT solvers (§2) in high-dimensional spaces, including the spaces of $32 \times 32$ CIFAR-10 images, $64 \times 64$ CelebA faces. + +Related works [32, 49] consider discrete distributions and show that some solvers fail to estimate $\mathbb{W}_1$ . In contrast to them, we study how well the solvers compute the gradient of $\mathbb{W}_1$ (OT gradient), as it is the OT gradient which is used to update the generator in WGANs, not the value of $\mathbb{W}_1$ . We use continuous distributions since in the discrete case the OT gradient may be ill-defined (§1). + +Notation. We work in the $\mathbb{R}^D$ space that is endowed with the Euclidean norm $||\cdot ||_2$ . We use $\mu_L$ to denote the Lesbegue measure on $\mathbb{R}^D$ . For a measurable map $T:\mathbb{R}^D\to \mathbb{R}^D$ , we denote the associated pushforward operator by $T\sharp$ . We consider Borel probability distributions $\mathbb{P},\mathbb{Q}$ on $\mathbb{R}^D$ with finite first moments. We use $\Pi (\mathbb{P},\mathbb{Q})$ to denote the set of probability distributions on $\mathbb{R}^D\times \mathbb{R}^D$ with marginals $\mathbb{P}$ and $\mathbb{Q}$ (transport plans). All the integrals are computed over $\mathbb{R}^D$ , if not stated otherwise. We write $||f||_L\leq C$ if $f:\mathbb{R}^D\to \mathbb{R}$ is $C$ -Lipschitz. + +# 1 Background on Optimal Transport + +Primal Formulation. For distributions $\mathbb{P},\mathbb{Q}$ , the Monge's formulation of the Wasserstein-1 $(\mathbb{W}_1)$ distance, i.e., OT with the distance cost function $\| x - y\| _2$ , is given by (Figure 1a) + +$$ +\mathbb {W} _ {1} (\mathbb {P}, \mathbb {Q}) \stackrel {\text {d e f}} {=} \min _ {T \sharp \mathbb {P} = \mathbb {Q}} \int | | x - T (x) | | _ {2} d \mathbb {P} (x), \tag {1} +$$ + +where min is taken over measurable functions $T:\mathbb{R}^D\to \mathbb{R}^D$ (transport maps) that map $\mathbb{P}$ to $\mathbb{Q}$ . The optimal $T^{*}$ is called the optimal transport map (OT map). Note that (1) is not symmetric, and this formulation does not allow for mass splitting, i.e., for some $\mathbb{P},\mathbb{Q}$ , there is no map $T$ that satisfies $T\nparallel \mathbb{P} = \mathbb{Q}$ [40, Remark 2.4]. Thus, Kantorovich [20] proposed the following relaxation (Figure 1b): + +$$ +\mathbb {W} _ {1} (\mathbb {P}, \mathbb {Q}) \stackrel {\text {d e f}} {=} \min _ {\pi \in \Pi (\mathbb {P}, \mathbb {Q})} \int_ {\mathbb {R} ^ {D} \times \mathbb {R} ^ {D}} | | x - y | | _ {2} d \pi (x, y), \tag {2} +$$ + +where $\min$ is taken over transport plans $\pi \in \Pi (\mathbb{P},\mathbb{Q})$ . The optimal $\pi^{*}\in \Pi (\mathbb{P},\mathbb{Q})$ is called the optimal transport plan (OT plan). If $\pi^{*} = [\mathrm{id}_{\mathbb{R}^{D}},T^{*}]\sharp \mathbb{P}$ for some map $T^{*}:\mathbb{R}^{D}\to \mathbb{R}^{D}$ , then $T^{*}$ minimizes formulation (1). In general, there might exist more than one OT plan $\pi^{*}$ or OT map $T^{*}$ . + +![](images/6821d9689a0082691bd0ef71ce20058c02de1d94934e935b6ddcf4326e9714d3.jpg) +(a) Monge's OT formulation (1). + +![](images/b7af19084048bd1d6aa5a94e3ed862380a41c221680efb4359633963d5184772.jpg) +(b) Kantorovich's OT formulation (2). +Figure 1: Monge's and Kantorovich's OT formulations of the Wasserstein-1 distance $(\mathbb{W}_1)$ . + +Dual formulation. For distributions $\mathbb{P},\mathbb{Q}$ , the dual formulation of $\mathbb{W}_1$ is given by [52, Thm. 5.10]: + +$$ +\mathbb {W} _ {1} (\mathbb {P}, \mathbb {Q}) = \max _ {f \oplus g \leq | | \cdot | | _ {2}} \int f (x) d \mathbb {P} (x) + \int g (y) d \mathbb {Q} (y), \tag {3} +$$ + +where $\max$ is taken over $f, g: \mathbb{R}^D \to \mathbb{R}$ satisfying $f(x) + g(y) \leq \| x - y \|_2$ for all $x, y \in \mathbb{R}^D$ . By using the $c$ -transform $f^c(y) \stackrel{\text{def}}{=} \min_{x \in \mathbb{R}^D} \{ \| x - y \|_2 - f(x) \}$ [52, §5], one rewrites (3) as + +$$ +\mathbb {W} _ {1} (\mathbb {P}, \mathbb {Q}) = \max _ {f} \int f (x) d \mathbb {P} (x) + \int f ^ {c} (y) d \mathbb {Q} (y). \tag {4} +$$ + +In accordance with [52, Case 5.16], dual form (4) can be further restricted to 1-Lipschitz functions. In this case, it holds $f^c(y) = -f(y)$ [52, Case 5.4], and the alternative duality formula for $\mathbb{W}_1$ is + +$$ +\mathbb {W} _ {1} (\mathbb {P}, \mathbb {Q}) = \max _ {| | f | | _ {L} \leq 1} \int f (x) d \mathbb {P} (x) - \int f (y) d \mathbb {Q} (y). \tag {5} +$$ + +In WGAN literature [17, 2], function $f$ is typically called the critic (or discriminator). In OT literature [52, 47, 51], functions $f, f^c, g$ are commonly referred as the (Kantorovich) potentials. + +Optimal transport in GANs. Derivatives of $\mathbb{W}_1$ are used implicitly in generative modeling [3, 39, 35, 17, 38, 46, 48, 28] that incorporates $\mathbb{W}_1$ loss, in which case $\mathbb{P} = \mathbb{P}_{\alpha}$ is a parametric distribution and $\mathbb{Q}$ is the data distribution. Typically, $\mathbb{P}_{\alpha} = G_{\alpha}\sharp \mathbb{S}$ is the distribution generated from a fixed latent distribution $\mathbb{S}$ by a generator network $G_{\alpha}$ . The goal is to find parameters $\alpha$ that minimize $\mathbb{W}_1(\mathbb{P}_{\alpha},\mathbb{Q})$ via gradient descent. The loss function for the generator is: + +$$ +\mathbb {W} _ {1} (\mathbb {P} _ {\alpha}, \mathbb {Q}) = \int_ {z} f ^ {*} (G _ {\alpha} (z)) d \mathbb {S} (z) - \int f ^ {*} (y) d \mathbb {Q} (y), +$$ + +where $f^{*}$ is the optimal potential in (5). The loss derivative (Figure 2) is given by [13, Eq. 3]: + +$$ +\frac {\partial \mathbb {W} _ {1} (\mathbb {P} _ {\alpha} , \mathbb {Q})}{\partial \alpha} = \int_ {z} \mathbf {J} _ {\alpha} G _ {\alpha} (z) ^ {T} \nabla f ^ {*} \left(G _ {\alpha} (z)\right) d \mathbb {S} (z), +$$ + +![](images/0d4f0af98f0ed75ae0ed7e10c8c54bb1ee699faccfb7ca2b66a4e22a5e5c23b3.jpg) +Figure 2: The anti-gradient $-\nabla f^{*}(x)$ shows where to move the mass of each $x = G_{\alpha}(z)$ to make the generated $\mathbb{P}_{\alpha}$ closer to $\mathbb{Q}$ in $\mathbb{W}_1$ + +where $\mathbf{J}_{\alpha}G_{\alpha}(z)^T$ is the transpose of the Jacobian matrix of $G_{\alpha}(z)$ w.r.t. parameters $\alpha$ . This result still holds without assuming the potentials are fixed [3, Theorem 3] by the envelope theorem [33]. + +In practice, the optimal potential $f^{*}$ is unknown. Therefore, WGANs approximate it with a network $f_{\theta}: \mathbb{R}^{D} \to \mathbb{R}$ (potential) by maximizing (5), (4) or (3) via the stochastic gradient ascent (SGA). This is usually associated with evaluating the $\mathbb{W}_1$ loss. However, note that the loss value plays no role in generator updates. Only the gradient $\nabla f^{*}$ of the potential is needed. We call it the $OT$ gradient. We use a generic phrase $OT$ solver to refer to any algorithm which is capable of recovering $\nabla f^{*}$ . + +Quantitative evaluation of OT solvers. Existing solvers are typically tested as the loss in WGANs without evaluating the actual OT performance. The quality of the generated samples is evaluated by standard metrics such as FID [18] or IS [45]. These metrics do not provide understanding about the quality of the solver itself since they depend on components of the model that are not related to OT. + +In [41, 32, 49], the authors use discrete $\mathbb{P}$ , $\mathbb{Q}$ to show that some solvers imprecisely compute $\mathbb{W}_1$ . Their approach is not applicable to evaluation of the OT gradient, as $\nabla f^*$ is ill-defined in the discrete case. For example, when $\mathbb{P} = \delta_0$ , $\mathbb{Q} = \delta_1$ , it holds that $f^* = -[x]_+$ is an optimal potential, but it is not even differentiable at $x = 0 = \mathrm{Supp}(\mathbb{P})$ . The existence of the OT gradient is studied, e.g., in [19]. + +# 2 Neural Dual Solvers for the Wasserstein-1 Distance + +Our proposed benchmark is useful for testing any OT solver that computes $\nabla f^{*}$ or $\mathbb{W}_1$ . We evaluate only neural solvers which are based on (5), (4), or (3) and used in WGANs. We provide an overview of these methods below. We group them by the dual formulations which they use. + +Most solvers approximate the potential by a network $f_{\theta}:\mathbb{R}^{D}\to \mathbb{R}$ and learn it via maximizing (5) with SGA on batches from $\mathbb{P},\mathbb{Q}$ . The main challenge is to enforce the 1-Lipschitz constraint for $f_{\theta}$ . + +$\lfloor \mathbf{WC}\rfloor$ In [3], the space $\Theta$ of parameters is restricted to a compact, e.g., to a hypercube $[-c,c]^{\dim \theta}$ . With mild assumptions on the architecture, $f_{\theta}$ is provably Lipschitz continuous with some unknown constant $C$ , i.e., $\| f_{\theta}\|_{L}\leq C$ . The main practical issue is tuning the boundary $c$ of the set. + +$\left|\mathbf{GP}\right\rceil$ The authors of [17] prove that with mild assumptions on the OT plan $\pi^{*}$ , the equation $\left\| \nabla f^{*}(z)\right\|_{2} = 1$ holds almost surely for $z = tx + (1 - t)y$ with $(x,y)$ distributed as the OT plan $\pi^{*}$ and $t\sim$ Uniform[0, 1]. Thus, they softly penalize $f$ for being not 1-Lipschitz and optimize + +$$ +\mathbb {W} _ {1} (\mathbb {P}, \mathbb {Q}) \approx \max _ {f} \left\{\int f (x) d \mathbb {P} (x) - \int f (y) d \mathbb {Q} (y) - \lambda \mathcal {R} (f) \right\}, \quad \lambda > 0. \tag {6} +$$ + +The gradient penalty $\mathcal{R}_{\mathrm{GP}}(f)$ equals $\int (||\nabla f(r)||_2 - 1)^2 d\mu (r)$ , where $\mu$ is the distribution of a random variable $r = xt + (1 - t)y$ with $t\sim \mathrm{Uniform}[0,1]$ and $(x,y)\sim \mathbb{P}\times \mathbb{Q}$ (as $\pi^*$ is unknown). In [34], it is proved that (6) with $\mathcal{R} = \mathcal{R}_{\mathrm{GP}}$ is a specific OT formulation called congested OT. + +$\lfloor \mathbf{LP}\rfloor$ In [39], the authors show that $\mathcal{R}_{\mathrm{GP}}(f)$ suffers from instabilities and high magnitudes. They introduce the Lipschitz penalty $\mathcal{R}_{\mathrm{LP}}(f) = \int (\max \{0,||\nabla f(r)||_2 - 1\})^2 d\mu (r)$ resolving the issues. + +$\lfloor \mathbf{SN}\rfloor$ In [35], the authors optimize (5) and use the power iteration method [14] to normalize the weight matrices of linear layers of net $f_{\theta}$ by their spectral norms. This provably makes $f$ globally Lipschitz continuous, which does not hold for [17, 39] which are based on the soft penalization (6). +[SO] The authors of [1] claim that spectral normalization negatively affects the expressiveness of the network. They propose to ortho-normalize weight matrices and use GroupSort activations [5]. Such networks $f_{\theta}$ are 1-Lipschitz and universally approximate 1-Lipschitz functions [1, §4]. + +Below we overview methods based on (4) or (3) which do not require enforcing 1-Lipschitz continuity for the potential. Unlike the above-mentioned methods, they mostly require 2 neural networks. + +LS] In [46, 48, 12, 6], the authors optimize the following unconstrained regularized form (3): + +$$ +\mathbb {W} _ {1} (\mathbb {P}, \mathbb {Q}) \approx \max _ {f, g} \left\{\int f (x) d \mathbb {P} (x) + \int g (y) d \mathbb {Q} (y) - \mathcal {R} (f, g) \right\}, \tag {7} +$$ + +where $\mathcal{R}(f,g)$ is the entropic or quadratic regularizer [46, Eq.5] which softly penalizes the potentials $f,g$ for disobeying $f\oplus g\leq ||\cdot ||_2$ . In practice, $f,g$ are neural networks $f_{\theta},g_{\omega}:\mathbb{R}^{D}\to \mathbb{R}$ + +$\lfloor \mathbf{MM}:\mathbf{B}\rfloor$ The authors of [31, 32] expand the dual formulation (4) with the $c$ -transform: + +$$ +\mathbb {W} _ {1} (\mathbb {P}, \mathbb {Q}) = \max _ {f} \left\{\int f (x) d \mathbb {P} (x) + \int \min _ {x \in \mathbb {R} ^ {D}} [ \| x - y \| _ {2} - f (y) ] d \mathbb {Q} (y) \right\}. \tag {8} +$$ + +During optimization, they restrict the inner minimization to the current mini-batch from $\mathbb{P}$ . This leads to overestimation of the inner problem's solution since the minimum is taken over a restricted subset. Recently, a more tricky version of this approach appeared [27, §3]. We call it $\lfloor \mathbf{MM}:\mathbf{Bv2}\rfloor$ . + +[MM] In [38], the authors use a saddle point formulation equivalent to (8): + +$$ +\mathbb {W} _ {1} (\mathbb {P}, \mathbb {Q}) = \max _ {f} \int f (x) d \mathbb {P} (x) + \min _ {H} \int [ \| H (y) - y \| _ {2} - f (H (y)) ] d \mathbb {Q} (y), \tag {9} +$$ + +where the minimization is performed over functions $H:\mathbb{R}^D\to \mathbb{R}^D$ . The authors use neural networks $f_{\theta}$ and $H_{\omega}$ to parametrize the potential and the minimizer of the inner problem (mover). To train $\theta, \omega$ , the authors apply stochastic gradient ascent/descent (SGAD) over mini-batches from $\mathbb{P}, \mathbb{Q}$ . + +$\lfloor \mathbf{MM}:\mathbf{R}\rfloor$ One may also recover the OT gradient $\nabla f^{*}$ from the OT map $T^{*}$ . Consider the form + +$$ +\mathbb {W} _ {1} (\mathbb {P}, \mathbb {Q}) = \max _ {g} \min _ {T} \int \left[ \| T (x) - x \| _ {2} - g (T (x)) \right] d \mathbb {P} (x) + \int g (y) d \mathbb {Q} (y), \tag {10} +$$ + +which is a reversed [23] version of (9), i.e., the roles of $\mathbb{P},\mathbb{Q}$ are swapped and $T:\mathbb{R}^D\to \mathbb{R}^D$ . For some optimal saddle points $(g^{*},T^{*})$ of (10) it holds that mover $T^{*}$ is an OT map [25, Lemma 4], [11, Lemma 2], [50], [8]. With mild assumptions on $\mathbb{P},\mathbb{Q}$ , one may recover $T^{*}$ and use the identity $\nabla f^{*}(x) = \frac{x - T^{*}(x)}{\|x - T^{*}(x)\|_{2}}$ [7, §1] to obtain the OT gradient from $T^{*}$ . + +# 3 Constructing Benchmark Distributions for Dual Solvers + +In this section, we develop a generic methodology to construct pairs $(\mathbb{P},\mathbb{Q})$ with computable ground truth OT plan, OT cost and OT gradient. Our approach is inspired by the insights about OT plans in [47, §3.1], [16], [7, §3-7]. In §3.1, we give the required preliminaries. In §3.2, we provide our method to build benchmark pairs. We construct them in §3.3. The proofs are given in Appendix A. + +# 3.1 Ray Monotone Transport Plans and 1-Lipschitz Functions + +Let $u: \mathbb{R}^D \to \mathbb{R}$ be a 1-Lipschitz function. Recall that due to the Rademacher's theorem, $u$ is differentiable $\mu_L$ -almost everywhere. For every $x, y \in \mathbb{R}^D$ satisfying $u(x) - u(y) = \| x - y\|_2$ it holds that $u$ is affine on the segment $[x, y]$ , i.e., $u(z) = tu(x) + (1 - t)u(y)$ for $z = tx + (1 - t)y$ with $t \in [0,1]$ [47, Lemma 3.5]. Moreover, $u$ is differentiable at all $z \in (x,y)$ and $\nabla u(z) = \frac{x - y}{\|x - y\|_2}$ [47, Lemma 3.6]. Following [47, Definition 3.7], we call a transport ray any non-trivial (different from a singleton) segment $[x,y]$ such that $u(x) - u(y) = \| x - y\|_2$ , which is maximal for the inclusion among segments of this form. The unit vector $\frac{x - y}{\|x - y\|_2}$ is called the direction of a transport ray. Two transport rays can only intersect at their boundary points [46, Corollary 3.8]. In general, not all points + +![](images/4bc3091572497ed3b51a579bb9ed4ebe8935356e316ddefeaed1d44eda98e7e3.jpg) +(a) Samples $x\sim \mathbb{P}$ + +![](images/546d4eccd12daa0d2251e6c88da94479d5eabd015374e12330ce22da6b7b2cd3.jpg) +(b) 1-Lipshitz potential $u:\mathbb{R}^D\to \mathbb{R}$ + +![](images/2874ffa01d73db7926c5242ee22408564c4a11e67bcd2e2410f3304341fdda38.jpg) +(c) Transport rays for: and map $y = T(x)$ +Figure 3: Our methodology to construct benchmark pairs $(\mathbb{P},\mathbb{Q})$ . An example with $(D,N) = (2,4)$ . We pick a distribution $\mathbb{P}$ and a MinFunnel function $u:\mathbb{R}^D\to \mathbb{R}$ (11). To sample $y\sim \mathbb{Q}$ , we get $x\sim \mathbb{P}$ , compute its transport ray and move $x$ along the ray with the $u$ -ray monotone map $T$ (12). + +![](images/6f0472ef74425265a9a2761131d4f1fe27259d57e2c42e7573c25b53d0a7c6f3.jpg) +(d) Pushforward samples $y = T(x)\sim \mathbb{Q}$ + +belong to transport rays. For example, for the function $u(x) = \frac{1}{2} x$ there are no transport rays at all. In Figures 3c and 9, we provide examples of transport rays for 1-Lipschitz functions $u$ in $D = 2$ . + +For a 1-Lipschitz function $u: \mathbb{R}^D \to \mathbb{R}$ , we say that a transport plan $\pi \in \Pi(\mathbb{P}, \mathbb{Q})$ is $u$ -ray monotone (decreasing) if $u(x) - u(y) = \|x - y\|_2$ holds $\pi$ -almost surely for $x, y \in \mathbb{R}^D$ . The idea of the definition is that such plans distribute the probability mass of $x \sim \mathbb{P}$ among $y \in \mathbb{R}^D$ such that $y = x$ (no mass movement) and/or $y$ which lie on the same transport ray as $x$ but below $x$ , i.e., $u(y) < u(x)$ . If $x$ is not contained in a transport ray, then $\pi(y|x) = \delta_x$ , i.e., $\pi$ necessarily does not move $x$ . + +Proposition 1 (Ray monotone transport plans are optimal). Let $\pi \in \Pi (\mathbb{P},\mathbb{Q})$ be a $u$ -ray monotone transport plan for a 1-Lipschitz function $u$ . Then it is an optimal plan between $\mathbb{P}$ , $\mathbb{Q}$ . Besides, $u$ is an optimal potential, i.e., it attains the maximum in dual formulation (5). + +For a distribution $\mathbb{P}$ , we say that distribution $\mathbb{Q}$ is a $u$ -ray-forward of $\mathbb{P}$ if there exists a measurable function $T: \mathbb{R}^D \to \mathbb{R}^D$ satisfying $T \sharp \mathbb{P} = \mathbb{Q}$ and $u(x) - u(T(x)) = \|x - T(x)\|_2$ holds $\mathbb{P}$ -almost surely for all $x \in \mathbb{R}^D$ . We say that such a $T$ is a $u$ -ray-monotone transport map from $\mathbb{P}$ to $\mathbb{Q}$ . Note that the deterministic plan $\pi = [\mathrm{id}_{\mathbb{R}^D}, T] \sharp \mathbb{P}$ is $u$ -ray monotone. We have the following corollary: + +Corollary 1 (Ray monotone transport maps are optimal). Let $T$ be a $u$ -ray monotone transport map from $\mathbb{P}$ to $\mathbb{Q}$ . Then the plan $\pi = [\mathrm{id}_{\mathbb{R}^D}, T] \sharp \mathbb{P}$ is optimal and $T$ is an OT map from $\mathbb{P}$ to $\mathbb{Q}$ . + +In §3.2 below, we derive our recipe to construct benchmark pairs $(\mathbb{P}, \mathbb{Q})$ such that $\mathbb{Q}$ is a $u$ -ray-forward of $\mathbb{P}$ with user-defined $u$ and analytically known $T$ . In such pairs $\mathbb{P}$ is accessible by samples and is also possible to sample from $\mathbb{Q}$ by pushing $x \sim \mathbb{P}$ forward by $T$ . Since $T$ is an OT map, the ground truth OT cost is $\mathbb{W}_1(\mathbb{P}, \mathbb{Q}) = \int \| x - T(x) \|_2 d\mathbb{P}(x)$ . It admits unbiased Monte Carlo estimates from samples $x \sim \mathbb{P}$ . Moreover, with mild assumptions (§3.3), $\nabla u$ is the unique OT gradient. Our benchmark pairs can be used to test how well OT solvers recover $\mathbb{W}_1$ and the OT gradient. + +# 3.2 Method to Construct Benchmark Pairs + +Let $u$ be a known 1-Lipschitz function. We aim to find its transport rays and construct a $u$ -ray-forward map $T$ and distribution $\mathbb{Q} = T\sharp \mathbb{P}$ (for a given $\mathbb{P}$ ) for testing dual OT solvers. First, we describe the parametric class of 1-Lipschitz functions $u$ which we employ in our benchmark. Second, we explain how to compute the transport rays of $u$ . Finally, we explain how to define $u$ -ray monotone maps. + +Part 1. Parameterizing 1-Lipschitz functions. Inspired by the distance representation of optimal potentials [16], as $u: \mathbb{R}^D \to \mathbb{R}$ , we employ the following 1-Lipschitz MinFunnel functions: + +$$ +u (x) \stackrel {\text {d e f}} {=} \min _ {n} \left\{u _ {n} (x) \right\} = \min _ {n} \left\{\| x - a _ {n} \| _ {2} + b _ {n} \right\}, \tag {11} +$$ + +where $a_{n} \in \mathbb{R}^{D}$ and $b_{n} \in \mathbb{R}$ are the parameters. Each funnel $u_{n}(x) = \| x - a_{n}\|_{2} + b_{n}$ has $\|\nabla u_{n}(x)\|_{2} = 1$ when $x \neq a_{n}$ . Thus, $u$ is also 1-Lipschitz as it is their minimum. Note that for $\mu_{L}$ -almost every $x$ it holds that $u$ is differentiable at $x$ and $\|\nabla u(x)\|_{2} = 1$ . + +Proposition 2 (MinFunnels are universal approximators of 1-Lipschitz functions on compact sets). Let $\mathcal{S} \subset \mathbb{R}^D$ be a compact set and $f^{*}: \mathcal{S} \to \mathbb{R}$ be a 1-Lipschitz function. Then for every $\epsilon > 0$ there exists $N$ and $\{a_n, b_n\}_{n=1}^N$ such that function (11) satisfies $\sup_{x \in \mathcal{S}} |u(x) - f^{*}(x)| \leq \epsilon$ . + +![](images/d5a3ddd165028284188544faf9f6b79af68c84350596d8aee58f794f719bfe43.jpg) +(a) The pair with $N = 64$ , $D = 4$ + +![](images/a99f878be305fdd11f28c0041c605265138bcf1bf696f3eb7be82bf90f85b1ac.jpg) +Figure 4: Visualization of constructed high-dimensional benchmark pairs. + +![](images/d5bb5ee6a615c4c5c1c099e53df5a73d8063949181b181a3c1df863dec2075c6.jpg) +In each pair, we show random samples projected onto 2 principal components of $\mathbb{Q}$ . + +![](images/cd3eb995a275eeeee4cbe2459cb6440e0c798ec26484188bd7286fe839daaa99.jpg) +(b) The pair with $N = 4$ , $D = 32$ + +The proposition is included only for completeness of the exposition and is not principal for our construction. We do not aim to approximate a specific $f^*$ by $u$ . In practice, we found that simply picking a random MinFunnel $u$ and using it to construct a benchmark pair is reasonable (§3.3). + +Part 2. Computing the transport rays. MinFunnels are practically very convenient as the transport ray for a given $x \in \mathbb{R}^D$ can be analytically computed in $O(ND)$ time, see our proposition below. + +Proposition 3 (Transport rays of a MinFunnel). Consider MinFunnel (11) function $u: \mathbb{R}^D \to \mathbb{R}$ with $n$ distinct centers $a_n$ such that for all $n_1 \neq n_2$ it holds that $\| a_{n_1} - a_{n_2} \|_2 \neq |b_{n_1} - b_{n_2}|$ . Let $x \in \mathbb{R}^D$ be a point such that $u$ is differentiable at $x$ . Then $\text{ray}(x) = [a_m, x + r \cdot v]$ , where + +$$ +m \stackrel {d e f} {=} \underset {n} {\arg \min} \left\{u _ {n} (x) \right\}; \qquad v \stackrel {d e f} {=} \frac {x - a _ {m}}{\| x - a _ {m} \| _ {2}}; \qquad r \stackrel {d e f} {=} \underset {n} {\min} r _ {n} \in \mathbb {R} \cup \{+ \infty \}, +$$ + +and $r_n \stackrel{\text{def}}{=} \frac{1}{2} \left[ \frac{\|a_n - x\|_2^2 - |u(x) - b_n|^2}{\left( u(x) - b_n \right) - \langle v, x - a_n \rangle} \right]$ for $n \neq m$ and $r_m \stackrel{\text{def}}{=} +\infty$ . Here in the definition of $r$ the min is taken only over $n$ for which $r_n > 0$ and $r_n \geq b_n - u_m(x)$ . Also, for $c \in \mathbb{R}$ we define $c/0 = +\infty$ . + +The condition on $a_{n}, b_{n}$ is imposed to avoid inconvenient cases when the center of a funnel lies on some another funnel. In practice, we compute the transport rays for a batch of points $x$ with tensor operations. We provide an example of transport rays of a random MinFunnel $u$ in Figure 9. + +Part 3. Defining the ray monotone map. Let $\mathbb{P}$ be a distribution on $\mathbb{R}^D$ and $u$ be a MinFunnel. We aim to construct a $u$ -ray monotone map $T: \mathbb{R}^D \to \mathbb{R}^D$ and define a distribution $\mathbb{Q} = T\sharp \mathbb{P}$ . + +If $\nabla u(x)$ does not exist, we define $T(x) = x$ (the set of such points is $\mu_L$ -negligible). Otherwise, since $u$ is a MinFunnel, we have $\| \nabla u(x)\| _2 = 1$ . Thus, the $u$ -ray forward map $T$ may take any value $T(x)\in [x_0,x]$ , where $x_0$ is the left (lower) endpoint of $\mathrm{ray}(x) = [x_0,x_1]$ . According to the analysis in §3.1, any (measurable) map $T$ defined by this principle is $u$ -ray monotone. For such a map $T$ one may put $\mathbb{Q} = T\sharp \mathbb{P}$ . As a result, for the pair $(\mathbb{P},\mathbb{Q})$ , function $T$ is an OT map (Corollary 1), possibly non-unique. Thus, the ground truth $\mathbb{W}_1(\mathbb{P},\mathbb{Q})$ can be estimated from samples $x\sim \mathbb{P}$ . + +As we are also interested in testing how well OT dual solvers recover the OT gradient $\nabla f^{*}$ , we need this gradient to exist and be $\mathbb{P}$ -unique. From Proposition 1 we know that $f^{*} = u$ is an optimal potential. However, it is not necessarily unique (up to a constant). For example, in the trivial case $T(x) \equiv x$ and $\mathbb{P} = \mathbb{Q}$ , any 1-Lipschitz $f^{*}$ is optimal and $\nabla f^{*}$ is not unique. We show that with mild assumptions on $\mathbb{P}, T, u$ , the gradient can be designed to be unique and match $\nabla u(x)$ . + +Proposition 4 (Uniqueness of the OT gradient). Let $\mathbb{P}$ be absolutely continuous and let $u: \mathbb{R}^D \to \mathbb{R}$ be 1-Lipschitz. Let $T$ be a $u$ -ray-monotone map for which $T(x) \neq x$ holds $\mathbb{P}$ -almost surely, i.e., it moves every piece of mass of $\mathbb{P}$ . Define $\mathbb{Q} = T\sharp \mathbb{P}$ . Then for every optimal $f^*$ which maximizes (5) the equality $\nabla f^{*}(x) = \nabla u(x)$ holds $\mathbb{P}$ -almost surely, i.e., the OT gradient $\nabla u$ is $\mathbb{P}$ -unique. + +# 3.3 Benchmark Pairs + +We use our methodology (§3.2) to construct high-dimensional $(D = 2,2^{2},\ldots ,2^{7})$ benchmark pairs and benchmark pairs on the space of $64\times 64$ RGB images of celebrity faces $(D = 12288)$ . + +For convenience, we use absolutely continuous $\mathbb{P}$ supported on a hypercube $S = [-B,B]^D\subset \mathbb{R}^D$ In particular, for points $x\in S$ , we consider transport rays truncated to $S$ , i.e., $\mathrm{ray}(x)\cap S$ . We + +![](images/9390626e7c3ce619103223c5bda35c7d128f8ee7341832c31891d1cf1db82851.jpg) +(a) Samples from the pair with $(N,p) = (1,10)$ . + +![](images/a5e159f8ed67e88aa1b68778e0de91a6ee771809960f4044a408f15758530481.jpg) +(b) Samples from the pair with $(N,p) = (16,100)$ . + +![](images/32d43015bada87c9859236405eea7ed314c69ee69cb6e27bb027fecc449b2dd9.jpg) +(c) Samples $x\sim \mathbb{P}$ +(synthetic celebrity faces). +Figure 5: Visualization of random samples from our constructed Celeba images benchmark pairs. In the last three plots, we show distributions projected to 2 principal components of $\mathbb{P}$ . + +![](images/67f5bec6154a5c17b24e484f32e9e7f749f82a4c02b87ea40284bf5a36e00a68.jpg) +(d) Samples $y\sim \mathbb{Q} = T\sharp \mathbb{P}$ +$(N = 1$ funnel). + +![](images/3065f669c74012fc8d381d2bea6eb210dc175f8bd6a53e3594f0c8a51d447124.jpg) +(e) Samples $y\sim \mathbb{Q} = T\sharp \mathbb{P}$ +$(N = 16$ funnels). + +construct the $u$ -ray monotone map $T: \mathbb{R}^D \to \mathbb{R}^D$ by the following principle. Let $[x_0, x_1] \subset S$ be the truncated transport ray of $u$ for $x \in S$ . We pick a parameter $p > 1$ and define the map $T$ as follows: + +$$ +T (x) \stackrel {\text {d e f}} {=} \left[ \frac {\| x - x _ {0} \| _ {2}}{\| x _ {0} - x _ {1} \| _ {2}} \right] ^ {p} x _ {0} + \left(1 - \left[ \frac {\| x - x _ {0} \| _ {2}}{\| x _ {0} - x _ {1} \| _ {2}} \right] ^ {p}\right) x _ {1}. \tag {12} +$$ + +This is a power function, i.e., if a ray is parametrized as $[0,1]$ , it moves the mass along the ray by $t\mapsto t^p$ . Since $\mathbb{P}$ -almost all the points in $\mathcal{S}$ belong to (truncated) rays, we have $T(x)\neq x$ on $\mathcal{S}$ . + +High-dimensional benchmark pairs. In dimensions $D = 2, 2^2, \ldots, 2^7$ , we put $\mathbb{P}$ to be the standard uniform distribution on $S = [-2.5, 2.5]^D$ . In each dimension $D$ , we consider $N = 4, 16, 64, 256$ funnels and pick random parameters $a_n \sim \mathrm{Uniform}([ -2.5, 2.5]^D)$ and $b_n \sim \mathcal{N}(0, 0.1)$ . For this initialization of $a_n, b_n$ , the assumptions of Proposition 3 hold with probability 1. The random seed is hardcoded. We use $p = 8$ . For the case $D = 2$ , $N = 4$ , we visualize the input distribution $\mathbb{P}$ , the function $u$ , the constructed map $T$ and the output distribution $\mathbb{Q} = T\sharp \mathbb{P}$ in Figure 3. We show examples of constructed $(\mathbb{P}, \mathbb{Q})$ for higher dimensions in Figure 4. + +Images benchmark pairs for CIFAR-10 and Celeba. As $\mathbb{P}$ we consider the synthetic distributions of generated $32\times 32$ RGB images $(D = 3072)$ and $64\times 64$ RGB images $(D = 12288)$ . To generate these images, we use the WGAN-QC [28] generator model trained on CIFAR-10 [26] and Celeba [30] datasets, respectively. For CIFAR-10, we train WGAN-QC by using its publicly available code. For Celeba, we pick a readily available pre-trained generator from the related Wasserstein-2 benchmark [23, §4.1]. To make $\mathbb{P}$ absolutely continuous, we add the Gaussian noise with axis-wise $\sigma = 0.01$ . Then we truncate the distribution to $\mathcal{S} = [-1.1,1.1]^D$ , i.e., we reject samples which are out of $\mathcal{S}$ . We construct two benchmark pairs per each dataset (Figures 5, 6) with $(N,p) = (1,10)$ , (16, 100) and $a_{n}\sim \mathrm{Uniform}([-1.,1.^{D})$ , $b_{n}\sim \mathcal{N}(0,0.1)$ . + +In both high-dimensional and images pairs $(\mathbb{P},\mathbb{Q})$ , the input $\mathbb{P}$ is an absolutely continuous distribution supported on a hypercube $S$ . By the design, the distribution $\mathbb{P}$ is accessible by random samples. To sample from $\mathbb{Q}$ , we first sample $x\sim \mathbb{P}$ , then compute its transport ray (Proposition 3), truncate it to $S$ , and produce $y = T(x)\sim \mathbb{Q}$ by (12). The sampler for $\mathbb{Q}$ outputs only $y$ , i.e., information about $u$ , $T$ , $x$ is hidden from the user and employed only when estimating the ground truth $\mathbb{W}_1(\mathbb{P},\mathbb{Q})$ or $\nabla u$ . + +![](images/ce7a7001d7174b3e33749d83ca15d78cdb30f2a7544fd8bcce01ea1b48bcb39c.jpg) +(a) Samples from the pair with $(N,p) = (1,10)$ . + +![](images/17458d697ab3de6c167b70354466fbccad9f3f58c67185b8995d4de3aa609b65.jpg) + +![](images/458e90e0f7ec5a27c6fead8b8202c33143ec58bf871f8bc1f6ce73ab5bdb0ddf.jpg) +(c) Samples $x\sim \mathbb{P}$ (synthetic CIFAR-10 images). + +![](images/95ed0ae49ab4223e9383348a474dc6794222cb9e08a1a0d74e6462e0bdcb0b61.jpg) +(b) Samples from the pair with $(N,p) = (16,100)$ . +(d) Samples $y\sim \mathbb{Q} = T\sharp \mathbb{P}$ $(N = 1$ funnel). + +![](images/59fdc64f04a49ab1d7351d7a41f11c9401c7cdd61bedf6c693de6e23627679c2.jpg) +(e) Samples $y\sim \mathbb{Q} = T\sharp \mathbb{P}$ $(N = 16$ funnels). +Figure 6: Visualization of random samples from our constructed CIFAR-10 images benchmark pairs. In the last three plots, we show distributions projected to 2 principal components of $\mathbb{P}$ . + +Reversed pairs. Doing preliminary tests, we found that for solvers it is more challenging to compute the OT gradient for pair $(\mathbb{Q},\mathbb{P})$ rather than $(\mathbb{P},\mathbb{Q})$ . In particular, in our images benchmark, the pair $(\mathbb{Q},\mathbb{P})$ reflects the practical WGAN scenario better. Indeed, in WGANs, the solvers move the generated distribution (bad images, $\mathbb{Q}$ in our construction) to the real distribution (good images, $\mathbb{P}$ ). Recall that $\mathbb{Q} = T\sharp \mathbb{P}$ , where $T$ is a differentiable bijection (12) along the (truncated) transport rays of a MinFunnel $u$ . As a result, $\mathbb{Q}$ is absolutely continuous and the OT gradient for the reverse $(\mathbb{Q},\mathbb{P})$ is $\mathbb{Q}$ -unique (Proposition 4). For this pair, the optimal potential is $-u$ and its gradient is $-\nabla u$ . To conclude, in all the experiments, we feed the reverse pair $(\mathbb{P},\mathbb{Q}):= (\mathbb{Q},\mathbb{P})$ to OT solvers in view. + +# 4 Evaluation of Dual Solvers and Discussion + +In this section, we evaluate WGAN dual OT solvers (§2) on our constructed benchmark (§3). Technical details of the implementation are given in Appendix B. The code is written in PyTorch framework and is publicly available together with all the constructed benchmark distributions at + +https://github.com/justkolesov/Wasserstein1Benchmark + +Metrics. For $\mathbb{W}_1$ , we do not use any specific metric but simply report obtained $\widehat{\mathbb{W}}_1$ and the ground truth $\mathbb{W}_1$ . To quantify the recovered gradient $\nabla \hat{f}$ , we use $\mathcal{L}^2$ and cosine similarity metrics [23, §4.2]: + +$$ +\mathcal {L} ^ {2} \left(\nabla \hat {f}, \nabla f ^ {*}\right) \stackrel {\text {d e f}} {=} \| \nabla \hat {f} - \nabla f ^ {*} \| _ {\mathcal {L} ^ {2}} ^ {2}; \quad \cos \left(\nabla \hat {f}, \nabla f ^ {*}\right) \stackrel {\text {d e f}} {=} \frac {\left\langle \nabla \hat {f} , \nabla f ^ {*} \right\rangle_ {\mathcal {L} ^ {2}}}{\| \nabla \hat {f} \| _ {\mathcal {L} ^ {2}} \cdot \| \nabla f ^ {*} \| _ {\mathcal {L} ^ {2}}}, \tag {13} +$$ + +where $\langle \nabla f_1, \nabla f_2 \rangle_{\mathcal{L}^2} \stackrel{\text{def}}{=} \int \langle \nabla f_1(x), \nabla f_2(x) \rangle d\mathbb{P}(x)$ , $\| \nabla f \|_{\mathcal{L}^2}^2 \stackrel{\text{def}}{=} \langle \nabla f_1, \nabla f_2 \rangle_{\mathcal{L}^2}$ and $\nabla f^*$ is the ground truth OT gradient. The $\mathcal{L}^2$ metric compares the gradients $\nabla \hat{f}, \nabla f^*$ as elements of the space $\mathcal{L}^2(\mathbb{P})$ of quadratically integrable w.r.t. $\mathbb{P}$ functions. The cosine compares their directions regardless of the magnitude (Figure 13). To estimate the metrics, we use $2^{13}$ samples $x \sim \mathbb{P}$ . + +$\lfloor \mathbf{DOT}\rfloor$ For completeness, we add the empirical (batched) OT [9, 10, 36, 37] to evaluation. For batches $X\sim \mathbb{P},Y\sim \mathbb{Q}$ , we use $\widehat{\mathbb{W}}_1(X,Y)$ computed by a discrete solver as an estimate of $\mathbb{W}_1(\mathbb{P},\mathbb{Q})$ . The solver can be combined with the automatic differentiation to approximate $\nabla f^{*}$ on the batch $X$ . + +High-dimensional pairs. We test the solvers and report the estimated $\mathbb{W}_1$ value and metrics (13) in Tables 9, 10, 11 (Appendix C). We use fully-connected nets as potentials $f_{\theta}, g_{\omega}$ and movers $T_{\theta}, H_{\omega}$ (in the maximin solvers). In Figure 7, we show the potentials learned by solvers for $D = 2$ , $N = 4$ . + +![](images/139dd36a05f50c2f3c442c1c8d7c4179f7a81b2df3373e82c7e917942a674292.jpg) +(a) $\lfloor \mathbf{WC}\rfloor$ + +![](images/1075219d2f198e20ebff0e9aac304b8c9173097bd6ee497442f1698937066510.jpg) +(b) $\lfloor \mathbf{GP}\rfloor$ + +![](images/2f44a0c19b71168e18b4bee30c38951b82213e47f8c9f013a623cc5b5b10a29f.jpg) +(c) $\lfloor \mathbf{LP}\rfloor$ + +![](images/bea105048ba1314bf0ef3aaa1f687b04b22d5116f07f8ecb206c7bdd852d3218.jpg) +(d) $\lfloor \mathbf{SN}\rfloor$ + +![](images/95637655be75a9ea5bfa130622c774e4fa775de242fb959f94da8dd9a50032d6.jpg) +(e) $\lfloor \mathbf{SO}\rfloor$ + +(f) $\lfloor \mathbf{LS}\rfloor$ +![](images/fc446c84437710dbb24ec5ad64bf08971d5f360a7358ddcc57cfff495b141ed8.jpg) +For $\left[\mathbf{MM}:\mathbf{R}\right]$ we plot (minus) second potential $-g_{\omega}$ as the solver does not compute the first one. + +(g) $\lfloor \mathbf{MM}:\mathbf{B}\rfloor$ +![](images/721957df753f5c361096ad35b279a117d259c9fcfde453db6549089936ac431f.jpg) +The ground truth optimal potential is in Figure 3b. + +![](images/ef6fdc9abfb3ea97d97ffc462b990986cd77a3c3cfcb887c7ab11054383aae4d.jpg) +(h) $\lfloor \mathbf{MM}:\mathbf{B}\mathbf{v}2\rfloor$ + +![](images/8e453229cb5fa9fae47431cfb5835d81055f27fa2f6d45e957770bebe7dbe8ac.jpg) +(i) $\lfloor \mathbf{MM}\rfloor$ +Figure 7: Surfaces of potentials $f_{\theta}$ learned by OT solvers on the pair with $D = 2, N = N$ . + +![](images/775d13d0ba2098bed03bbc05555d42d605508eccff3bf05fe3ae51706daeda6c.jpg) +(j) [MM:R]. + +As Table 11 shows, all the solvers randomly over/underestimate $\mathbb{W}_1$ , typically with notable error. Consequently, none of the solvers can be viewed as precise estimators of the OT cost. Thus, our discussion below primarily focuses on the estimation of the OT gradient needed in WGANs. + +Original $\lfloor \mathbf{WC}\rfloor$ leads to a pathological value surface of the learned potential (Figure 7a), which is far from the ground truth. This agrees with the claims of [17, §3]. Despite this, even in high dimensions the cos metric is positive (Table 9a), i.e., the recovered gradient correlates with the OT gradient. Popular $\lfloor \mathbf{GP}\rfloor$ notably improves upon $\lfloor \mathbf{WC}\rfloor$ and provides higher cos values (Table 9b). According to the results, its modification $\lfloor \mathbf{LP}\rfloor$ does not provide any major improvement (Table 9c). + +Surprisingly, $\lfloor \mathbf{SN}\rfloor$ performs worse than $\lfloor \mathbf{GP}\rfloor$ and is comparable to $\lfloor \mathbf{WC}\rfloor$ in cos metric (Table 9d). We presume that this happens since the spectral norm negatively affects the expressive power of the neural net [1]. Even when $D = 2$ (Figure 7d), $\lfloor \mathbf{SN}\rfloor$ fails to recover the optimal potential. $\lfloor \mathbf{SO}\rfloor$ replaces spectral norm with orthogonalization and uses GroupSort activations which improve performance. The solver scores higher cos values (Table 9e) which are comparable to $\lfloor \mathbf{GP}\rfloor$ . + +Solver [LS] recovers biased potential since (7) is the duality formula for regularized OT which yields biased optimal potentials (Table 9f). The bias is huge for large $D, N$ when the benchmark pairs are complex. This is analogous to results for the same solver in the Wasserstein-2 $(\mathbb{W}_2)$ benchmark [23]. + +Batch-based $\lfloor \mathbf{MM}:\mathbf{B}\rfloor$ suffers from the bias in high dimensions (Table 9g) due to overestimation of the value of the inner problem in (8). Note that cos metric values are even negative in high dimensions. The same is reported in the $\mathbb{W}_2$ benchmark [23]. $\lfloor \mathbf{MM - Bv2}\rfloor$ uses a more tricky optimization scheme and yields high cos values (Table 9h). It captures the direction of the OT gradient but extremely overestimates its magnitude, see high values of $\mathcal{L}^2$ in Table 10h. + +Maximin solvers $\lfloor \mathbf{MM}\rfloor$ , $\lfloor \mathbf{MM}:\mathbf{R}\rfloor$ perform comparably to $\lfloor \mathbf{GP}\rfloor$ , $\lfloor \mathbf{SO}\rfloor$ , $\lfloor \mathbf{LP}\rfloor$ , see Tables 9i, 9j. However, their training takes longer and sometimes diverges as it solves a saddle point problem. This agrees with the $\mathbb{W}_2$ benchmark [23, §4.3]. Using these solvers in GANs is not easy as it yields a challenging min-max-min optimization problem. Importantly, $\lfloor \mathbf{MM}:\mathbf{R}\rfloor$ recovers the OT map which can itself be used as a generative model (outside the context of GANs) in computer vision tasks. Here we refer the reader to the recent neural optimal transport (NOT) methods [25, 24, 4, 22, 11, 44, 8]. + +Empirical $\lfloor \mathbf{DOT}\rfloor$ provides precise estimates of $\mathbb{W}_1$ (Table 11k) and the OT gradient (Table 9k) only in small dimensions. In high dimensions, it intolerably overestimates $\mathbb{W}_1$ ; its gradient is almost orthogonal to the ground truth ( $\cos \lesssim 0$ ). This is due to the exponential (in $D$ ) sample complexity of DOT [53]. Thus, (unregularized) DOT is an imprecise estimator of $\mathbb{W}_1$ or the OT gradient in high $D$ . + +Images pairs. Here we do not consider $\lfloor \mathbf{SO}\rfloor$ as its authors do not provide convolutional architectures with GroupSort and orthonormalization. We use DCGAN [42] as potentials $f_{\theta},g_{\omega}$ . In $\lfloor \mathbf{MM}\rfloor$ and $\lfloor \mathbf{MM}:\mathbf{R}\rfloor$ , the movers $T_{\theta},H_{\omega}$ are UNets [43]. The evaluation results on Celeba benchmark pairs are given in Tables 6, 7, 8 and on CIFAR-10 benchmark pairs - in Tables 3, 4, 5 (Appendix C). + +
[WC][GP][LP][SN][SO][LS][MM:B][MM:Bv2][MM][MM:R][DOT]
cosHD
IMG-
L2HD
IMG-
W1HD
IMG-
+ +Table 1: The summary of WGAN dual OT solvers' performance in $\cos, \mathcal{L}^2$ and $\mathbb{W}_1$ metrics on our high-dimensional (HD) and images (IMG) benchmark pairs. For details, see Appendix C. + +Surprisingly, our images benchmark pairs turned to be simpler than some high-dimensional benchmark pairs. Although $(\mathbb{P},\mathbb{Q})$ are absolutely continuous and supported on $[-1.1,1.1]^D$ , their actual probability mass is still concentrated around small low-dimensional sub-manifold of data. We suppose that this is one of the causes for the reasonable performance of most solvers. In particular, we see that even $\lfloor \mathbf{DOT}\rfloor$ , $\lfloor \mathbf{LS}\rfloor$ , $\lfloor \mathbf{MM}:\mathbf{B}\rfloor$ score $\cos >0$ in images benchmark pairs, although they struggled to produce good results on high-dimensional pairs. + +Solvers $\lfloor \mathbf{GP}\rfloor$ , $\lfloor \mathbf{LP}\rfloor$ , $\lfloor \mathbf{MM}:\mathbf{R}\rfloor$ provide very high $\cos >0.9$ (Table 6). However, only $\lfloor \mathbf{MM}:\mathbf{R}\rfloor$ provides precise approximation of $\nabla f^{*}$ in $\mathcal{L}^2$ norm (Table 7). Interestingly, maximin $\lfloor \mathbf{MM}\rfloor$ diverges on our images benchmark pairs (tuning the hyper-parameters did not help). Similar to the evaluation in high-dimensional pairs, $\lfloor \mathbf{WC}\rfloor$ and $\lfloor \mathbf{SN}\rfloor$ show moderate $\cos >0$ , but its value is notably smaller than that of the top-performing methods. Solver $\lfloor \mathbf{MM}:\mathbf{Bv2}\rfloor$ demonstrates meaningful estimate of $\mathbb{W}_1$ (Table 8). Nevertheless, its recovered gradient is almost orthogonal to the ground truth ( $\cos \approx 0$ , see Table 6), and the values of $\mathcal{L}^2$ metric are extremely high (Table 7). + +# 5 Discussion + +Our methodology creates pairs of continuous distributions with known ground truth OT cost and gradient, filling the missing gap of benchmarking $\mathbb{W}_1$ dual solvers. This development allows us to evaluate the OT performance of WGAN dual methods. The experimental results are summarized in Table 1. Our evaluation shows that these solvers should not be considered as meaningful estimators of $\mathbb{W}_1$ as they exhibit large error. However, the OT gradient recovered by these solvers shows positive cos with ground truth. This suggests that most methods could still be used to minimize $\mathbb{W}_1$ in variational problems, e.g., Wasserstein GANs. + +Computational complexity. Evaluation of all the OT solvers on our high-dimensional and images benchmark pairs takes less than 50 hours on a single GPU GTX 1080ti (11 GB VRAM). + +Potential Impact. Our benchmark distributions can be used to evaluate future dual OT solvers in high-dimensional spaces, a crucial step to improve the transparency and replicability of OT and WGAN-related research. We expect our benchmark to become a standard benchmark for $\mathbb{W}_1$ optimal transport as part of the ongoing effort of advancing computational OT. + +Limitations (benchmark). We rely on MinFunnels as optimal Kantorovich potentials to generate benchmark pairs. Also, we limit our pairs to be absolutely continuous distributions. It is unclear whether our benchmark sufficiently reflects the real-world scenarios in which the WGAN solvers are used. Nevertheless, our methodology is generic and can be used to construct new benchmark pairs. + +Limitations (evaluation). We evaluate how well the OT solvers compute OT cost and gradient but do not assess their performance in GAN settings. Studying this question is a promising future research avenue which could help to develop new OT-based methods for generative modeling. + +ACKNOWLEDGEMENTS. The work was supported by the Analytical center under the RF Government (subsidy agreement 000000D730321P5Q0002, Grant No. 70-2021-00145 02.11.2021). + +# References + +[1] Cem Anil, James Lucas, and Roger Grosse. Sorting out lipschitz function approximation. In International Conference on Machine Learning, pages 291-301. PMLR, 2019. +[2] Martin Arjovsky and Léon Bottou. Towards principled methods for training generative adversarial networks. arXiv preprint arXiv:1701.04862, 2017. +[3] Martin Arjovsky, Soumith Chintala, and Léon Bottou. Wasserstein GAN. arXiv preprint arXiv:1701.07875, 2017. +[4] Arip Asadulaev, Alexander Korotin, Vage Egiazarian, and Evgeny Burnaev. Neural optimal transport with general cost functionals. arXiv preprint arXiv:2205.15403, 2022. +[5] Artem Chernodub and Dimitri Nowicki. Norm-preserving orthogonal permutation linear unit activation functions (oplu). arXiv preprint arXiv:1604.02313, 2016. +[6] Grady Daniels, Tyler Maunu, and Paul Hand. Score-based generative neural networks for large-scale optimal transport. Advances in Neural Information Processing Systems, 34, 2021. +[7] Lawrence C Evans and Wilfrid Gangbo. Differential equations methods for the Monge-Kantorovich mass transfer problem. Number 653. American Mathematical Soc., 1999. +[8] Jiaojiao Fan, Shu Liu, Shaojun Ma, Yongxin Chen, and Haomin Zhou. Scalable computation of monge maps with general costs. arXiv preprint arXiv:2106.03812, 2021. +[9] Kilian Fatras, Younes Zine, Rémi Flamary, Rémi Gribonval, and Nicolas Courty. Learning with minibatch wasserstein: asymptotic and gradient properties. arXiv preprint arXiv:1910.04091, 2019. +[10] Kilian Fatras, Younes Zine, Szymon Majewski, Rémi Flamary, Rémi Gribonval, and Nicolas Courty. Minibatch optimal transport distances; analysis and applications. arXiv preprint arXiv:2101.01792, 2021. +[11] Milena Gazdieva, Litu Rout, Alexander Korotin, Andrey Kravchenko, Alexander Filippov, and Evgeny Burnaev. An optimal transport perspective on unpaired image super-resolution. arXiv preprint arXiv:2202.01116, 2022. +[12] Aude Geneva, Marco Cuturi, Gabriel Peyre, and Francis Bach. Stochastic optimization for large-scale optimal transport. In Advances in neural information processing systems, pages 3440-3448, 2016. +[13] Aude Geneva, Gabriel Peyré, and Marco Cuturi. Gan and vae from an optimal transport point of view. arXiv preprint arXiv:1706.01807, 2017. +[14] Gene H Golub and Henk A Van der Vorst. Eigenvalue computation in the 20th century. Journal of Computational and Applied Mathematics, 123(1-2):35-65, 2000. +[15] Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in neural information processing systems, pages 2672–2680, 2014. +[16] Luca Granieri. On a distance representation of kantorovich potentials. Applied mathematics letters, 22(4):605-610, 2009. +[17] Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron C Courville. Improved training of Wasserstein GANs. In Advances in Neural Information Processing Systems, pages 5767-5777, 2017. +[18] Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. GANs trained by a two time-scale update rule converge to a local nash equilibrium. In Advances in neural information processing systems, pages 6626-6637, 2017. +[19] Antoine Houdard, Arthur Leclaire, Nicolas Papadakis, and Julien Rabin. On the existence of optimal transport gradient for learning generative models. arXiv preprint arXiv:2102.05542, 2021. + +[20] Leonid Kantorovitch. On the translocation of masses. Management Science, 5(1):1-4, 1958. +[21] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. +[22] Alexander Korotin, Vage Egiazarian, Lingxiao Li, and Evgeny Burnaev. Wasserstein iterative networks for barycenter estimation. arXiv preprint arXiv:2201.12245, 2022. +[23] Alexander Korotin, Lingxiao Li, Aude Geneva, Justin M Solomon, Alexander Filippov, and Evgeny Burnaev. Do neural optimal transport solvers work? a continuous wasserstein-2 benchmark. Advances in Neural Information Processing Systems, 34:14593-14605, 2021. +[24] Alexander Korotin, Daniil Selikhanovych, and Evgeny Burnaev. Kernel neural optimal transport. arXiv preprint arXiv:2205.15269, 2022. +[25] Alexander Korotin, Daniil Selikhanovych, and Evgeny Burnaev. Neural optimal transport. arXiv preprint arXiv:2201.12220, 2022. +[26] Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009. +[27] Dohyun Kwon, Yeoneung Kim, Guido Montúfar, and Insoon Yang. Training wasserstein gans without gradient penalties. arXiv preprint arXiv:2110.14150, 2021. +[28] Huidong Liu, Xianfeng Gu, and Dimitris Samaras. Wasserstein GAN with quadratic transport cost. In Proceedings of the IEEE International Conference on Computer Vision, pages 4832-4841, 2019. +[29] Huidong Liu, GU Xianfeng, and Dimitris Samaras. A two-step computation of the exact gan wasserstein distance. In International Conference on Machine Learning, pages 3159-3168. PMLR, 2018. +[30] Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaou Tang. Deep learning face attributes in the wild. In Proceedings of International Conference on Computer Vision (ICCV), December 2015. +[31] Anton Mallasto, Jes Frellsen, Wouter Boomsma, and Aasa Feragen. (q, p)-Wasserstein GANs: Comparing ground metrics for Wasserstein GANs. arXiv preprint arXiv:1902.03642, 2019. +[32] Anton Mallasto, Guido Montúfar, and Augusto Gerolin. How well do WGANs estimate the Wasserstein metric? arXiv preprint arXiv:1910.03875, 2019. +[33] Paul Milgrom and Ilya Segal. Envelope theorems for arbitrary choice sets. Econometrica, 70(2):583-601, 2002. +[34] Tristan Milne and Adrian Nachman. Wasserstein gans with gradient penalty compute congested transport. arXiv preprint arXiv:2109.00528, 2021. +[35] Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. arXiv preprint arXiv:1802.05957, 2018. +[36] Khai Nguyen, Dang Nguyen, Tung Pham, and Nhat Ho. Improving mini-batch optimal transport via partial transportation. arXiv preprint arXiv:2108.09645, 2021. +[37] Khai Nguyen, Quoc Nguyen, Nhat Ho, Tung Pham, Hung Bui, Dinh Phung, and Trung Le. Bomb-ot: On batch of mini-batches optimal transport. arXiv e-prints, pages arXiv-2102, 2021. +[38] Quan Hoang Nhan Dam, Trung Le, Tu Dinh Nguyen, Hung Bui, and Dinh Phung. Threeplayer Wasserstein GAN via amortised duality. In Proc. of the 28th Int. Joint Conf. on Artificial Intelligence (IJCAI), 2019. +[39] Henning Petzka, Asja Fischer, and Denis Lukovnicov. On the regularization of wasserstein gans. arXiv preprint arXiv:1709.08894, 2017. +[40] Gabriel Peyré, Marco Cuturi, et al. Computational optimal transport. Foundations and Trends® in Machine Learning, 11(5-6):355–607, 2019. + +[41] Thomas Pinetz, Daniel Soukup, and Thomas Pock. On the estimation of the Wasserstein distance in generative models. In German Conference on Pattern Recognition, pages 156-170. Springer, 2019. +[42] Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015. +[43] Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 234-241. Springer, 2015. +[44] Litu Rout, Alexander Korotin, and Evgeny Burnaev. Generative modeling with optimal transport maps. In International Conference on Learning Representations, 2021. +[45] Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training GANs. In Advances in neural information processing systems, pages 2234-2242, 2016. +[46] Maziar Sanjabi, Jimmy Ba, Meisam Razaviyayn, and Jason D Lee. On the convergence and robustness of training GANs with regularized optimal transport. arXiv preprint arXiv:1802.08249, 2018. +[47] Filippo Santambrogio. Optimal transport for applied mathematicians. Birkhäuser, NY, 55(58-63):94, 2015. +[48] Vivien Seguy, Bharath Bhushan Damodaran, Rémi Flamary, Nicolas Courty, Antoine Rolet, and Mathieu Blondel. Large-scale optimal transport and mapping estimation. arXiv preprint arXiv:1711.02283, 2017. +[49] Jan Stanczuk, Christian Etmann, Lisa Maria Kreusser, and Carola-Bibiane Schonlieb. Wasserstein gans work because they fail (to approximate the wasserstein distance). arXiv preprint arXiv:2103.01678, 2021. +[50] Akinori Tanaka. Discriminator optimal transport. Advances in Neural Information Processing Systems, 32, 2019. +[51] Cédric Villani. Topics in optimal transportation. Number 58. American Mathematical Soc., 2003. +[52] Cédric Villani. Optimal transport: old and new, volume 338. Springer Science & Business Media, 2008. +[53] Jonathan Weed, Francis Bach, et al. Sharp asymptotic and finite-sample rates of convergence of empirical measures in Wasserstein distance. Bernoulli, 25(4A):2620-2648, 2019. +[54] Xiang Wei, Boqing Gong, Zixia Liu, Wei Lu, and Liqiang Wang. Improving the improved training of Wasserstein gans: A consistency term and its dual effect. arXiv preprint arXiv:1803.01541, 2018. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] +(c) Did you discuss any potential negative societal impacts of your work? [N/A] +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] All the assumptions are stated in the main text. +(b) Did you include complete proofs of all theoretical results? [Yes] All the proofs are given in the appendices. + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] The code and the instructions are included in the supplementary material. The datasets and assets that we use are publicly available. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See the supplementary material (appendices + code). +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See the Appendix. + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] See the discussion in section §3.3. +(b) Did you mention the license of the assets? [No] We refer to the datasets' and assets' public pages. +(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] See the supplementary material +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] For CelebA faces dataset, we refer to the original authors publication. + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/kantorovichstrikesbackwassersteingansarenotoptimaltransport/images.zip b/kantorovichstrikesbackwassersteingansarenotoptimaltransport/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..6cc47cc04de3095f1a13e0b800deaae2cdbfc561 --- /dev/null +++ b/kantorovichstrikesbackwassersteingansarenotoptimaltransport/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:16707e55fbb86e80f2532522e332624d71bb130b89f639cfa5a68deb1973653e +size 638276 diff --git a/kantorovichstrikesbackwassersteingansarenotoptimaltransport/layout.json b/kantorovichstrikesbackwassersteingansarenotoptimaltransport/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..0d01f8fc87db61e47bb6082c5f5b621021126604 --- /dev/null +++ b/kantorovichstrikesbackwassersteingansarenotoptimaltransport/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:32c2cf6ec1813c5e0a6a468bf655eebd7ac0eac807677f1ae90b6528b4a70b49 +size 937817 diff --git a/kernelinterpolationwithsparsegrids/2b211c51-69f2-47a6-b6c2-e0c030f07ae7_content_list.json b/kernelinterpolationwithsparsegrids/2b211c51-69f2-47a6-b6c2-e0c030f07ae7_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..b55cd53d9d48c16d92481d4a0e770710723fd2ec --- /dev/null +++ b/kernelinterpolationwithsparsegrids/2b211c51-69f2-47a6-b6c2-e0c030f07ae7_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:77d681823f4e51b77fa0036c3472e55cc0190c1ed577ca442b4e789152868eb9 +size 69684 diff --git a/kernelinterpolationwithsparsegrids/2b211c51-69f2-47a6-b6c2-e0c030f07ae7_model.json b/kernelinterpolationwithsparsegrids/2b211c51-69f2-47a6-b6c2-e0c030f07ae7_model.json new file mode 100644 index 0000000000000000000000000000000000000000..d89b282730fd23ccb6be9a6191421392413dea92 --- /dev/null +++ b/kernelinterpolationwithsparsegrids/2b211c51-69f2-47a6-b6c2-e0c030f07ae7_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e7d815ef6087ff21450b41f47b3cc867241a987d23f27da66bb5430faf1d668 +size 88764 diff --git a/kernelinterpolationwithsparsegrids/2b211c51-69f2-47a6-b6c2-e0c030f07ae7_origin.pdf b/kernelinterpolationwithsparsegrids/2b211c51-69f2-47a6-b6c2-e0c030f07ae7_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c2f578602978a8979bee848592e0c742a63b5379 --- /dev/null +++ b/kernelinterpolationwithsparsegrids/2b211c51-69f2-47a6-b6c2-e0c030f07ae7_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0fb91354450a04c6a4c83e2c5b64e2516b73dc7318e785274253a354a26d045f +size 556684 diff --git a/kernelinterpolationwithsparsegrids/full.md b/kernelinterpolationwithsparsegrids/full.md new file mode 100644 index 0000000000000000000000000000000000000000..f4e50b348e2bf673c84e941b4141b05967fea562 --- /dev/null +++ b/kernelinterpolationwithsparsegrids/full.md @@ -0,0 +1,258 @@ +# Kernel Interpolation with Sparse Grids + +Mohit Yadav +University of Massachusetts Amherst +ymohit@cs.umass.edu + +Daniel Sheldon +University of Massachusetts Amherst +sheldon@cs.umass.edu + +Cameron Musco +University of Massachusetts Amherst +cmusco@cs.umass.edu + +# Abstract + +Structured kernel interpolation (SKI) accelerates Gaussian process (GP) inference by interpolating the kernel covariance function using a dense grid of inducing points, whose corresponding kernel matrix is highly structured and thus amenable to fast linear algebra. Unfortunately, SKI scales poorly in the dimension of the input points, since the dense grid size grows exponentially with the dimension. To mitigate this issue, we propose the use of sparse grids within the SKI framework. These grids enable accurate interpolation, but with a number of points growing more slowly with dimension. We contribute a novel nearly linear time matrix-vector multiplication algorithm for the sparse grid kernel matrix. We also describe how sparse grids can be combined with an efficient interpolation scheme based on simplices. With these modifications, we demonstrate that SKI can be scaled to higher dimensions while maintaining accuracy. + +# 1 Introduction + +Gaussian processes (GPs) are popular prior distributions over continuous functions for use in Bayesian inference [14]. Due to their simple mathematical structure, closed form expressions can be given for posterior inference [20]. Unfortunately, a well-established limitation of GPs is that they are difficult to scale to large datasets. In particular, for both exact posterior inference and the exact log-likelihood computation for hyperparameter learning, one must invert a dense kernel covariance matrix $K \in \mathbb{R}^{n \times n}$ , where $n$ is the number of training points. Naively, this operation requires $\mathcal{O}(n^3)$ time and $\mathcal{O}(n^2)$ memory. + +Structured Kernel Interpolation. Many techniques have been proposed to mitigate this scalability issue [23, 19, 24, 9]. Recently, structured kernel interpolation (SKI) has emerged as a promising approach [9]. In SKI, the kernel matrix is approximated via interpolation onto a dense rectilinear grid of $m$ inducing points. In particular, $K$ is approximated as $WK_{G}W^{T}$ , where $K_{G} \in \mathbb{R}^{m \times m}$ is the kernel matrix on the inducing points and $W \in \mathbb{R}^{n \times m}$ is an interpolation weight matrix mapping training points to nearby grid points. Typically, $W$ is sparse, and $K_{G}$ is highly structured — e.g., for shift invariant kernels, $K_{G}$ is multi-level Toeplitz. Thus, $W$ , $K_{G}$ , and in turn the approximate kernel matrix $WK_{G}W^{T}$ admit fast matrix-vector multiplication. This allows fast approximate inference and log-likelihood computation via the use of iterative methods, e.g., the conjugate gradient algorithm. + +SKI's Curse of Dimensionality. Unfortunately, SKI does not scale well to high-dimensional input data: the number of points in the dense grid, and hence the size of $K_{G}$ , grows exponentially in the dimension $d$ . Moreover, SKI typically employs local cubic interpolation, which leads to an interpolation weight matrix $W$ with row sparsity that also scales exponentially in $d$ . This curse of + +dimensionality is a well-known issue with the use of dense grid interpolation. It has been studied extensively, e.g., in the context of high-dimensional interpolation and numerical integration [17, 5]. + +In the computational mathematics community, an important technique for interpolating functions in high dimensions is sparse grids [2]. Roughly a sparse grid is a union of rectilinear grids with different resolutions in each dimension. In particular, it is a union of all $2^{\ell_1} \times 2^{\ell_2} \times \ldots \times 2^{\ell_d}$ sized grids, where $\sum_{i=1}^{d} \ell_i \leq \ell$ , for some maximum total resolution $\ell$ . This upper bound on the total resolution limits the number of points in each grid — while a grid can be dense in a few dimensions, no grid can be dense in all dimensions. See Figure 1 for an illustration. Sparse grids have interpolation accuracy comparable to dense grids under certain smoothness assumptions on the interpolated function [22], while using significantly fewer points. Concretely, for any function $f: \mathbb{R}^d \to \mathbb{R}$ with bounded mixed partial derivatives, a sparse grid containing $\mathcal{O}(2^\ell \ell^{d-1})$ points can interpolate as accurately as a dense grid with $\mathcal{O}(2^{\ell d})$ points, where $\ell$ is the maximum grid resolution [21]. + +Combining Sparse Grids with SKI. Our main contribution is to demonstrate that sparse grids can be used within the SKI framework to significantly improve scaling with dimension. Doing so requires several algorithmic developments. When the inducing point grid is sparse, the kernel matrix on the grid, $K_{G}$ , no longer has simple structure. E.g., it is not Toeplitz when the kernel is shift invariant. Thus, naive matrix-vector multiplications with $K_{G}$ require time that scales quadratically, rather than near-linearly in the grid size. This would significantly limit the scope of performance improvement from using a sparse grid. To handle this issue, we develop a near-linear time matrix-vector multiplication (MVM) algorithm for any sparse grid kernel matrix. Our algorithm is recursive, and critically leverages the fact that sparse grids can be constructed from smaller dense grids and that they have tensor product structure across dimensions. For an illustration of our algorithm's complexity versus that of naive quadratic time MVMs, see Figure 1 (c). + +![](images/896a4a612fbde41388a8cb98eedc008427a995fe091b26710ba38df89f5a2d85.jpg) +Figure 1: Illustration of sparse grid construction for $d = 2$ and maximum resolution $\ell = 2$ . (a) A dense grid with resolution $(l_1, l_2)$ has $2^{l_1}$ and $2^{l_2}$ points in each dimension; the grids with red square points have total resolution $l_1 + l_2 \leq 2$ . (b) The sparse grid $\mathcal{G}_{2,2}$ is the union of rectilinear grids with total resolution at most 2. The 17 points with red squares belong to the sparse grid. The dense grid includes the additional points with blue dots, for a total of 49 points. (c) The asymptotic order of growth in performing a single kernel MVM operation for both grids with $2^8$ unique points in each dimension, ignoring constants. For sparse grids, Ours-MVM (i.e., the proposed MVM algorithm) improves significantly over the naive implementation (Sparse-MVM). + +![](images/6395fba85f225de8fde082025cb9591e72f09c9f9ab1fec7eacb6bc7aef7e933.jpg) + +A second key challenge is that, while sparse grids allow for a grid size that grows as a much more mild exponential function of the dimension $d$ , the bottleneck for applying SKI on large datasets can come in computing MVMs with the interpolation weight matrix $W \in \mathbb{R}^{n \times m}$ . For classic high-dimensional interpolation schemes, like cubic interpolation, each row of $W$ has $\mathcal{O}(2^d)$ non-zero entries, i.e., the kernel covariance for each training point is approximated by a weighted sum of the covariance at $\mathcal{O}(2^d)$ grid points. When the number of training points $n$ is large, storing $W$ in + +memory, and multiplying by it, can become prohibitively expensive. To handle this issue, we take an approach similar to that of Kapoor et al. [13] and employ simplicial basis functions for interpolation, whose support grows linearly with $d$ . Combined with our fast MVM algorithm for sparse grid kernel matrices, this interpolation scheme lets us scale SKI to higher dimensions. + +In summary, we propose the use of sparse grids to improve the scalability of kernel interpolation for GP inference relative to the number of dimensions. To this end, we develop an efficient nearly linear time matrix-vector multiplication algorithm for the sparse grid kernel matrix. Furthermore, we also propose the use of simplicial interpolation to improve scalability of SKI for both dense and sparse grids. We show empirically that these ideas allow SKI to scale to at least 10 dimensions and perform competitively with state-of-the-art GP regression methods. We provide an efficient GPU implementation of the proposed algorithm compatible with GPyTorch [9], which is available at https://github.com/ymohit/skisg and licensed under the MIT license. + +# 2 Background + +Notation. We let $\mathbb{N}$ and $\mathbb{N}_0$ denote the natural numbers and $\mathbb{N} \cup \{0\}$ respectively. Matrices are represented by capital letters, and vectors by bold letters. $I$ denotes the identity matrix, with dimensions apparent from context. For a matrix $M$ , $\mathrm{mvm}(M)$ denotes the number of operations required to multiply $M$ by any admissible vector. + +In GP regression, the training data are modeled as noisy measurements of a random function $f$ drawn from a GP prior, denoted $f \sim \mathcal{N}(0, k(\cdot, \cdot))$ , where $k: \mathbb{R}^d \times \mathbb{R}^d \to \mathbb{R}$ is a covariance kernel. For an input $\mathbf{x}_i$ , the observed value is modeled as $\mathbf{y}_i = f(\mathbf{x}_i) + \epsilon_i$ , with $\epsilon_i \sim \mathcal{N}(0, \sigma^2)$ . Observed training pairs $(\mathbf{x}_i, y_i)$ are collected as $X = [\mathbf{x}_1, \dots, \mathbf{x}_n] \in \mathbb{R}^{n \times d}$ and $\mathbf{y} = [y_1, \dots, y_n] \in \mathbb{R}^n$ . The kernel matrix (on training data) is $K_X = [k(\mathbf{x}_i, \mathbf{x}_j)]_{i,j=1}^n \in \mathbb{R}^{n \times n}$ . The GP inference tasks are to compute the posterior distribution of $f$ given $(X, \mathbf{y})$ , which itself is a Gaussian process, and to compute the marginal log-likelihood $\log p(\mathbf{y})$ . Naive approaches rely on the Cholesky decomposition of the matrix $\overline{K}_X = K_X + \sigma^2 I$ , which takes $\Theta(n^3)$ time; see Rasmussen [20] for more details. + +To avoid the $\Theta (n^3)$ running time of naive inference, many modern methods use iterative algorithms such as the conjugate gradient (CG) algorithm to perform GP inference in a way that accesses the kernel matrix only through matrix vector multiplication (MVM), i.e., the mapping $\mathbf{v}\mapsto \overline{K}_X\mathbf{v}$ [9]. These methods support highly accurate approximate solutions to GP posterior inference task as well as hyper-parameter optimization. The complexity of posterior inference and one step of hyper-parameter optimization is $\Theta (pn^{2})$ for $p$ CG iterations, as $\mathrm{mvm}(\overline{K}_X) = n^2$ . In practice, $p\ll n$ suffices [27, 9]. + +# 2.1 SKI: Structured Kernel Interpolation + +SKI further accelerates iterative GP inference by approximating the kernel matrix in a way that makes matrix-vector multiplications faster [27]. Given a set of inducing points $U \subset \mathbb{R}^d$ , SKI approximates the kernel function as $\tilde{k}(\mathbf{x}, \mathbf{x}') \triangleq \mathbf{w}_{\mathbf{x}}^T K_U \mathbf{w}_{\mathbf{x}'}$ , where $K_U \in \mathbb{R}^{|U| \times |U|}$ is the kernel matrix for the set of inducing points $U$ , and the vector $\mathbf{w}_{\mathbf{x}} \in \mathbb{R}^{|U|}$ contains interpolation weights to interpolate from $U$ to any $\mathbf{x}$ . The SKI approximate kernel matrix is $\tilde{K}_X = W K_U W^T$ , where $W \in \mathbb{R}^{n \times |U|}$ is the matrix with $i^{th}$ row equal to $\mathbf{w}_{\mathbf{x}_i}$ . + +To accelerate matrix-vector multiplications with the approximate kernel matrix, SKI places inducing points on a regular grid and uses grid-based interpolation. This leads to a sparse interpolation weight matrix $W$ — for example, with cubic interpolation there are $O(4^d)$ entries per row, so that $\mathrm{mvm}(W) = O(n4^d)$ — and to a kernel matrix $K_U$ that is multi-level Toeplitz (if $k$ is stationary) [27], so that $\mathrm{mvm}(K_U) = O(|U| \log |U|)$ . Overall, $\mathrm{mvm}(\tilde{K}_X) = O(n4^d + |U| \log |U|)$ , which is much faster than $n^2$ for small $d$ . However, SKI quickly becomes infeasible in higher dimensions due to the $4^d$ entries per row of $W$ and curse of dimensionality for the number of points in a high-dimensional grid: specifically, $|U| = m^d$ for a grid with $m$ points in each dimension. + +# 2.2 Sparse Grids + +Rectilinear grids. We first give a formal construction of rectilinear grids, which will later be the foundation for sparse grids [7]. For a resolution index $l \in \mathbb{N}_0$ , define the 1-d grid $\Omega_l$ as the centers + +of $2^l$ equal partitions of the interval $[0,1]$ , which gives $\Omega_l \coloneqq \{i / 2^{l + 1} \mid 1 \leq i \leq 2^{l + 1}$ and $i$ is odd. The fact that the position index $i$ must be odd implies that grids for any two different resolutions are disjoint. Moreover, resolution-position index pairs $(l,i)$ uniquely specify grid points in the union $\bigcup_{l \in \mathbb{N}_0} \Omega_l$ of 1-d rectilinear grids. + +To extend rectilinear grids to $d$ dimensions, let $\mathbf{l} \in \mathbb{N}_0^d$ denote a resolution vector. The corresponding rectilinear grid is given by $\Omega_1 \coloneqq \otimes_{j=1}^{d} \Omega_{\mathbf{l}_j}$ , where $\otimes$ denotes the Cartesian product. A grid point in $\Omega_1$ is indexed by the pair $(\mathbf{l}, \mathbf{i})$ of a resolution vector $\mathbf{l}$ and position vector $\mathbf{i}$ , where $(l_j, i_j)$ gives the position in the 1-d grid $\Omega_j$ for dimension $j$ . This construction of rectilinear grids yields three essential properties that will facilitate formalizing sparse grids: (1) a grid $\Omega_1$ is uniquely determined by its resolution vector $\mathbf{l}$ , (2) grids $\Omega_1$ and $\Omega_{1'}$ with different resolution vectors are disjoint, (3) the size $|\Omega_1| = 2^{\|\mathbf{l}\|_1}$ of a grid is determined by the $L_1$ norm of its resolution vector. + +Construction of Sparse Grids. Sparse grids use rectilinear grids as their fundamental building block [22] and exploit the fact that resolution vectors uniquely identify different rectilinear grids. Larger grids are formed as the union of rectilinear grids with different resolution vectors. Sparse grids use all rectilinear grids with resolution vector having $L_{1}$ norm below a specified threshold. Formally, for a resolution index $\ell \in \mathbb{N}_0$ , the sparse grid $\mathcal{G}_{\ell,d}$ in $d$ dimensions is $\mathcal{G}_{\ell,d} \coloneqq \bigcup_{1: \| \mathbf{l} \|_1 \leq \ell} \Omega_1$ . Figure 1 illustrates the construction of the sparse grid $\mathcal{G}_{2,2}$ from smaller 2-d rectilinear grids with maximum resolution 2, i.e., $\{\Omega_1 | \| \mathbf{l} \|_1 \leq 2\}$ . The figure also illustrates another important fact: the sparse grid $\mathcal{G}_{\ell,d}$ has a total of $\Theta(2^\ell)$ distinct and equally spaced coordinates in each dimension, but many fewer total points than a dense $d$ -fold Cartesian product of such 1-d grids, which would have $\Theta(2^{\ell d})$ points. + +Sparse grids have a number of formal properties that are useful in algorithms and applications [22, 7]. Proposition 1 below summarizes the most relevant ones for our work. For completeness, a proof appears in appendix A. For more details, see Valentin [25]. + +Proposition 1 (Properties of Sparse Grid). Let $\mathcal{G}_{\ell, d} \subset [0,1]^d$ be a sparse grid with any resolution $\ell \in \mathbb{N}_0$ and dimension $d \in \mathbb{N}$ . Then the following properties hold: + +(P1) $|\mathcal{G}_{\ell}^{d}| = \mathcal{O}(2^{\ell}\ell^{d - 1})$ +(P2) $\forall \ell^{\prime}\in \mathbb{N},0\leq \ell^{\prime}\leq \ell \Rightarrow \mathcal{G}_{\ell^{\prime},d}\subseteq \mathcal{G}_{\ell ,d},$ +(P3) $\mathcal{G}_{\ell ,d} = \bigcup_{i = 0}^{\ell}\bigl (\Omega_{i}\otimes \mathcal{G}_{\ell -i,d - 1}\bigr)$ and $\mathcal{G}_{\ell ,1} = \bigcup_{i = 0}^{\ell}\Omega_{i}$ + +Property P1 shows that the size of sparse grid with $\Theta(2^{\ell})$ points in each dimension grows more slowly than a dense grid with the same number of points in each dimension, since $\mathcal{O}(2^{\ell}\ell^{d-1}) \ll \mathcal{O}(2^{\ell d})$ . Properties P2 and P3 are consequences of the structure of the set $\{\|\mathbf{1}\|_1 \leq \ell\}$ and the sparse grid construction. Property P2 says that a sparse grid with smaller resolution is contained in one with higher resolution. Property P3 is a crucial property, and says that a $d$ -dimensional sparse grid can be constructed via Cartesian products of 1-dimensional dense grids with sparse grids in $d-1$ dimensions. + +# 3 Structured Kernel Interpolation on Sparse Grids + +To scale kernel interpolation to higher dimensions, we propose to select inducing points $U = \mathcal{G}_{\ell ,d}$ on a sparse grid and approximate the kernel matrix as $WK_{\mathcal{G}_{\ell ,d}}W^T$ for a suitable interpolation matrix $W$ adapted to sparse grids. This will require fast matrix-vector multiplications with the sparse grid kernel matrix $K_{\mathcal{G}_{\ell ,d}}$ and the interpolation matrix $W$ . We show how to accomplish these two tasks in Sections 3.1 and 3.2 for the important case of stationary product kernels [10]. + +# 3.1 Fast Multiplication with the Sparse Grid Kernel Matrix + +Algorithm 1 is an algorithm to compute $K_{\mathcal{G}_{\ell, a}} \mathbf{v}$ for any vector $\mathbf{v}$ . The algorithm uses the following definitions. For any finite set $U$ , let $K_U = \left[k(\mathbf{x}, \mathbf{x}')\right]_{\mathbf{x}, \mathbf{x}' \in U}$ . The rows and columns of $K_U$ are "U-indexed", meaning the entries correspond to elements of $U$ under some arbitrary fixed ordering. + +For $U \subseteq V$ , we introduce a selection matrix $\mathcal{S}_{U,V}$ to map between $U$ -indexed and $V$ -indexed vectors. It has entries $(\mathcal{S}_{U,V})_{ij}$ equal to one if the $i$ th element of $U$ is equal to the $j$ th element of $V$ , and zero otherwise. Also, $\mathcal{S}_{V,U} \coloneqq \mathcal{S}_{U,V}^T$ . For a $V$ -indexed vector $\mathbf{z}_V$ , the multiplication $\mathcal{S}_{U,V}\mathbf{z}_V$ produces a $U$ -indexed vector by selecting entries corresponding to elements in $U$ , and for a $U$ -indexed vector $\mathbf{z}_U$ , the multiplication $\mathcal{S}_{V,U}\mathbf{z}_U$ produces a $V$ -indexed vector by inserting zeros for elements not in $U$ . + +# Algorithm 1 Sparse Grid Kernel-MVM Algorithm + +Input: $\mathbf{v} \in \mathbb{R}^{|\mathcal{G}_{\ell, d}|}$ and $K_{\mathcal{G}_{\ell, d}} \in \mathbb{R}^{|\mathcal{G}_{\ell, d}| \times |\mathcal{G}_{\ell, d}|}$ + +Output: $\mathbf{u} = \mathbf{m}\mathbf{v}\mathbf{m}\left(K_{\mathcal{G}_{\ell ,d}},\mathbf{v}\right)$ , where, $\mathbf{m}\mathbf{v}\mathbf{m}(K,\mathbf{v})$ denotes $K\mathbf{v}$ obtained using this algorithm. + +1: Let $V_{i}$ be the result of reshaping $S_{\Omega_i \otimes \mathcal{G}_{\ell - i, d - 1}, \mathcal{G}_{\ell, d}} \mathbf{v}$ into a $|\Omega_i| \times |\mathcal{G}_{\ell - i, d - 1}|$ matrix; this contains entries of $\mathbf{v}$ corresponding to the $i$ th grid in the decomposition of P3. + +2: if $d = 1$ then +3: return $\mathbf{u} = K_{\mathcal{G}_{\ell,1}}\mathbf{v}$ ▷ Base case +4: end if +5: $\triangleright$ Pre-computation +6: for $i = 0$ to $\ell$ do +7: $\overline{A}_i = K_{\mathcal{G}_{i,1}}S_{\mathcal{G}_{i,1},\Omega_i}V_i$ +8: $\overline{B}_i^T = \mathbf{m}\mathbf{v}\mathbf{m}\left(K_{\mathcal{G}_{\ell -i,d - 1}},V_i^T\right)$ $\triangleright$ Recursively multiply $K_{\mathcal{G}_{\ell -i,d - 1}}$ with columns of $V_{i}^{T}$ +9: end for +10: $\triangleright$ Main loop +11: for $i = 0$ to $\ell$ do +12: $A_{i}^{T} = \mathbf{m}\mathbf{v}\mathbf{m}\left(K_{\mathcal{G}_{\ell -i,d - 1}},\left(\sum_{j > i}\mathcal{S}_{\Omega_{i},\mathcal{G}_{j,1}}\overline{A}_{j}\mathcal{S}_{\mathcal{G}_{\ell -j,d - 1},\mathcal{G}_{\ell -i,d - 1}}\right)^{T}\right)\triangleright$ Recurse like line 8. +13: $B_{i} = \mathcal{S}_{\Omega_{i},\mathcal{G}_{i,1}}K_{\mathcal{G}_{i,1}}\left(\sum_{j\leq i}\mathcal{S}_{\mathcal{G}_{i,1},\Omega_{j}}\overline{B}_{j}\mathcal{S}_{\mathcal{G}_{\ell -j,d - 1},\mathcal{G}_{\ell -i,d - 1}}\right)$ +14: $\mathbf{u}_i = \operatorname{vec}[A_i] + \operatorname{vec}[B_i]$ +15: end for + +Theorem 1. Let $K_{\mathcal{G}_{\ell, d}}$ be the kernel matrix for a $d$ -dimensional sparse grid with resolution $\ell$ for a stationary product kernel. For any $\mathbf{v} \in \mathbb{R}^{|\mathcal{G}_{\ell, d}|}$ , Algorithm 1 computes $K_{\mathcal{G}_{\ell, d}} \mathbf{v}$ in $\mathcal{O}(\ell^d 2^\ell)$ time. + +The formal analysis and proof of Theorem 1 appears in Appendix $B$ . The running time of $\mathcal{O}(\ell^{d}2^{\ell})$ is nearly linear in $|\mathcal{G}_{\ell ,d}|$ and much faster asymptotically than the naive MVM algorithm that materializes the full matrix and has running time quadratic in $|\mathcal{G}_{\ell ,d}|$ . + +Algorithm 1 is built on two high-level observations. First, the decomposition of Property P3 from Proposition 1 and the fact that the kernel follows product structure across dimensions are used to decompose the MVM into blocks, each of which is between sub-grids which are the product of a 1-dimensional rectilinear grid and a sparse grid in $d - 1$ dimensions. Therefore, the overall MVM computation can be recursively decomposed into MVMs with sparse grid kernel matrices in $d - 1$ dimensions. This observation is in part inspired by Zeiser [28], which also decomposes computation with the matrix on sparse grids by the resolution of first dimension. The base case occurs when $d = 1$ . We assume that Toeplitz structure, which arises due to the kernel being stationary, is leveraged to perform this base case MVM in $O(\ell 2^{\ell})$ time. Algorithm 1 can also be extended to non-stationary product kernels by using a standard MVM routine for the base case, which changes the overall running-time analysis but is still more efficient than the naive algorithm. + +Secondly, by Property P2, the kernel matrix multiplication for any grid of resolution $\ell$ also includes the result of the multiplication for grids of lower resolution and the same number of dimensions. Thus, the results of the multiplications for many individual blocks can be obtained by using the appropriate selection operators with the result of the multiplication with the kernel matrix $K_{\mathcal{G}_{\ell -i,d - 1}}$ in Line 12 of the algorithm. Further intuition and explanation are provided in the Appendix B.1. + +Improving batching efficiency. The recursions in Lines 8 and 12 can be batched for efficiency, since both are multiplications with the same symmetric kernel matrix $K_{\mathcal{G}_{\ell,d}}$ . Similarly, the recursion spawns many recursive multiplications with kernel matrices of the form $\mathcal{G}_{\ell',d'}$ for $0 \leq \ell' < \ell$ and $1 \leq d' < d$ , and the calculation can be reorganized to batch all multiplications with each $K_{\mathcal{G}_{\ell',d'}}$ . This is a significant savings, because there are only $d(\ell + 1)$ distinct kernel matrices, but the recursion has a branching factor of $(\ell + 1)$ , so spawns many recursive calls with the same kernel matrices. + +# 3.2 Sparse Interpolation For Sparse Grids + +We now seek to construct the matrix $W$ , which interpolates function values from the sparse grid $\mathcal{G}_{\ell,d}$ to training points $\mathbf{x}_i \in \mathbb{R}^d$ , while ensuring that each row of $W$ is sparse enough to preserve efficiency of matrix-vector multiplications with $W$ . This requires a sparse interpolation rule for sparse grids. + +To set up the problem, we consider interpolating a function $f$ observed at points in a generic set $U$ . Let $\mathbf{f}_U = (f(\mathbf{x}))_{u \in U}$ . A linear interpolation rule for $U$ is a mapping $\mathbf{x} \mapsto \mathbf{w}_{\mathbf{x}} \in \mathbb{R}^{|U|}$ used to approximate $f(\mathbf{x})$ at an arbitrary point as $f(\mathbf{x}) \approx \mathbf{w}_{\mathbf{x}}^T \mathbf{f}_U$ . The density of an interpolation rule is the maximum number of non-zeros in $\mathbf{w}_{\mathbf{x}}$ for any $\mathbf{x}$ . + +The combination technique for sparse grids constructs an interpolation rule by combining interpolation rules for the constituent rectilinear grids. + +Proposition 2. For each $l$ , let $\mathbf{w}_{\mathbf{x}}^{1}$ be an interpolation rule for the rectilinear grid $\Omega_{1}$ with maximum density $c$ . The combination technique gives an interpolation rule $\mathbf{w}_{\mathbf{x}}$ for the sparse grid $\mathcal{G}_{\ell, d}$ with density at most $c \times \binom{\ell + d - 1}{d - 1}$ . The factor $\binom{\ell + d - 1}{d - 1}$ is the number of rectilinear grids included in $\mathcal{G}_{\ell, d}$ . + +We use the combination technique to construct the sparse-grid interpolation coefficients $\mathbf{w}_{\mathbf{x}_i}$ for each training point $\mathbf{x}_i$ and stack them in the rows of $W$ , which can be done in time proportional to the number of nonzeros. Details are given in Appendix A. The combination technique can use any base interpolation rule for the rectilinear grids, such as multilinear, cubic, or simplicial interpolation. + +# 3.3 Simplicial Interpolation + +The density of the interpolation rule is a critical consideration for kernel interpolation techniques with or without sparse grids. Linear and cubic interpolation in $d$ dimensions have density $\Theta(2^d)$ and $\Theta(4^d)$ , respectively. This "second curse of dimensionality" makes computations with $W$ intractable in higher dimensions independently of operations with the grid kernel matrix. For sparse grids, the density of $W$ increases by an additional factor of $\binom{\ell+d-1}{d-1}$ . + +We propose to use simplicial interpolation [11] for the underlying interpolation rule to avoid exponential growth of the density. Simplicial interpolation refers to a scheme where $\mathbb{R}^d$ is partitioned into simplices and a point $\mathbf{x}$ is interpolated using only the $d + 1$ extreme points of the enclosing simplex, so the density of the interpolation rule is exactly $d + 1$ . Simplicial interpolation was previously proposed for sparse grid classifiers in [8]. In work closely related to ours, Kapoor et al. [13] used simplicial interpolation for GP kernel interpolation, with the key difference that they use the permutohedral lattice as the underlying grid, which has a number of nice properties but does not come equipped with fast specialized routines for kernel matrix multiplication. + +In contrast to Kapoor et al. [13], we maintain rectilinear and/or sparse underlying grids, which preserve structure that enables fast kernel matrix multiplication. For rectilinear grids, this requires partitioning each hyper-rectangle into simplices, so the entire space is partitioned by simplices whose extreme points belong to the rectilinear grid. Then, within each simplex, the values at the extreme points are interpolated linearly. In general, there are different ways to partition hyper-rectangles into simplices—we use the specific scheme detailed in [11]. For sparse grids, we then use the combination technique, leading to overall density of $(d + 1)\binom{\ell + d - 1}{d - 1}$ . Table 1 provides the MVM complexities of $W$ and kernel matrices for different interpolation schemes and both grids. More details on how to perform simplicial interpolation with rectilinear and sparse grids are given in the Appendix B.2. + +Table 1: The MVM complexities (i.e., $\mathrm{mvm}(\cdot)$ ) of the interpolation matrix $W$ and the kernel matrix $K_{G}$ for different interpolation bases and $d$ -dimensional grids with $2^{\ell}$ unique points in each dimension and $n$ data points. A star indicates approaches proposed in this work. 'Dense' denotes a rectilinear grid. + +
GridBasismvm(W)mvm(KG)
DenseCubicO(n·4d)O(ℓ·d·2ℓ·d)
LinearO(n·2d)O(ℓ·d·2ℓ·d)
Simplicial*O(n·d2)O(ℓ·d·2ℓ·d)
SparseCubic*O(n·4d·(ℓ+d-1)d-1)O(ℓd·2ℓ)
Linear*O(n·2d·(ℓ+d-1)d-1)O(ℓd·2ℓ)
Simplicial*O(n·d2·(ℓ+d-1)d-1)O(ℓd·2ℓ)
+ +# 4 Experiments + +In this section, we empirically evaluate the time and memory taken by Algorithm 1 for matrix-vector multiplication with the sparse grid kernel matrix, the accuracy of sparse grid interpolation and GP regression as the data dimension $d$ increases, and the accuracy of sparse grid kernel interpolation for GP regression on real higher-dimensional datasets from UCI. Hyper-parameters, data processing steps, and optimization details are given in Appendix C.1. + +![](images/4cc7ddec5a8e96054b0a1013f5339e7876a6744132c21f1d1def11d16426e83b.jpg) + +![](images/6fac53808aba405e9abfd6a3104e5ba6b08a0f31625f81f7b6f2cf0f37cb959d.jpg) + +![](images/5e5ba2fe6611684d2f70ec8e4ef509efb7d7c2bfe5dd8733867346c9f5ae48d0.jpg) +Figure 2: Matrix-vector multiplication (MVM) resource usage relative to sparse grid size for $d = 6$ and increasing resolution $\ell$ . From top-left to bottom-right: time for one MVM operation, build (pre-processing) time for the kernel matrix, peak memory usage, and typical time to solve a linear system using CG (time for build plus 50 MVMs). Each plot shows the naive quadratic MVM algorithm (Sparse-MVM), the recursive implementation of Algorithm 1 (Ours-MVM-R), and the efficiently batched iterative implementation of Algorithm 1 (Ours-MVM-I). All measurements are averaged over 8 trials; error bars represent twice the standard error. + +![](images/f4f8434bc75148024e36afc0778e924279a889f7e3f3932b4d3b028a0cd7c8ab.jpg) + +Sparse grid kernel MVM complexity. First, we evaluate the efficiency of MVM algorithms. We compare the basic and efficient implementations of Algorithm 1 to the naive algorithm, which constructs the full kernel matrix and scales quadratically with the sparse grid size. Algorithm 1 has a significant theoretical advantage in terms of both time and memory requirements as the grid size grows. Figure 2 illustrates this for $d = 6$ by comparing MVM time and memory requirements for sparse grids with resolutions $\ell \in \{2,\dots ,9\}$ (roughly 100 to 1M grid points). The MVM time, preprocessing time, and memory consumption of Algorithm 1 all grow more slowly than the naive + +algorithm, and the efficient implementation of Algorithm 1 is faster for $|\mathcal{G}|$ larger than about $10^{4}$ , after which the naive algorithm also exceeds the 10 GB memory limit. For comparison, at $\ell = 6$ (about 40K grid points), Algorithm 1 uses only 0.05 GB of memory. These results indicate that the proposed algorithm is crucial for enabling sparse grid kernel interpolation in higher dimensions. Figure 2 also depicts the typical time to run GP inference (i.e., preprocessing time plus 50 MVM operations). + +Sparse grid interpolation and GP inference accuracy on synthetic data. A significant advantage of sparse grids over dense rectilinear grids is their ability to perform accurate interpolation in higher dimensions. We demonstrate this for $d = 6$ by interpolating the function $f(\mathbf{x}) = \cos (\| \mathbf{x}\| _1)$ from observation locations on sparse grids of increasing resolution onto 200 random points sampled uniformly from $[0,1]^d$ . Figure 3, left, shows the interpolation error for dense and sparse grids with both cubic and simplicial interpolation. Sparse (cubic) is significantly more accurate than Dense (cubic), and Sparse (simplicial) is more accurate than Dense (simplicial). + +We next evaluate the accuracy of GP inference in increasing dimensions. We keep the same function $f(\mathbf{x})$ and generate observations as $y = f(\mathbf{x}) + \mathcal{N}(0,0.05)$ . For all $d$ , we use $\ell = 4$ for the sparse grid and compare to the dense grid with the closest possible total number of grid points (i.e., $\lceil \mathcal{G}_{4,d}^{1/d} \rceil$ points in each dimension) $^3$ . For $d \geq 8$ , performance is better with sparse grids than dense grids for both interpolation schemes. Remarkably, our proposal to use simplicial interpolation with dense grids allows SKI to scale to $d = 10$ , which is a significant improvement over prior work, in which SKI is typically infeasible for $d \geq 4$ . + +![](images/aec819c6b00a83abe9d480db6404b1fa5a920a462c4232623ee16f9e04401dfc.jpg) +Figure 3: Comparing dense and sparse grids with cubic and simplicial interpolation schemes on synthetic data. Dense (cubic/simplicial) are dense grid methods with cubic/simplicial interpolation schemes; similarly, sparse (cubic/simplicial) are for sparse grids. Left: Function interpolation error vs. the grid size for $d = 6$ . Right: Test root-mean-square error (RMSE) for GP regression for increasing dimensions. For both tasks, sparse grid methods outperform dense grids. For $d = 10$ , both methods with cubic interpolation run out of GPU memory, which is 48 GB for this experiment. + +![](images/364f6b6035e259d082d32f9963ad49049dee8330adbdc1f915142a17354cde60.jpg) + +GP regression performance on UCI datasets. To evaluate the effectiveness of our proposed methods for scaling GP kernel interpolation to higher dimensions, we consider all UCI [4] data sets with dimension $8 \leq d \leq 10$ . We compare our proposed methods, Dense-grid (dense SKI with simplicial interpolation) and Sparse-grid (sparse-grid SKI with simplicial interpolation) to SGPR [24], SKIP [10], and Simplex-GP [13]. For SGPR, we report the best results using 256 or 512 inducing points. For SKIP, 100 points per dimension are used. For Simplex-GP [13], the blur stencil order is set to 1. Table 3 shows the root mean squared error (RMSE) for all methods. Our methods have performance comparable to and often better than SGPR and prior methods for scaling kernel interpolation to higher dimensions. This shows that sparse grids and simplicial interpolation can effectively scale SKI to higher dimensions to give a GP regression framework that is competitive with state-of-the-art approaches. We report additional results and analysis in Appendix C. + +Table 2: Test root-mean-square-error (RMSE) on UCI regression datasets with dimensions (i.e., $8 \leq d \leq 10$ ). See text for algorithm descriptions and settings. All mean and standard deviations are computed over 3 trials. Pendulum is abbreviated as Pendu to accommodate table horizontally. + +
Datasets (d)SGPRSKIPSimplex-GPDense-gridSparse-grid
Energy (8)1.509 ± 0.0035.762 ± 0.0003.076 ± 0.0121.333 ± 0.0090.715 ± 0.004
Energy (8)1.509 ± 0.0035.762 ± 0.0003.076 ± 0.0121.333 ± 0.0090.715 ± 0.004
Concrete (8)12.727 ± 0.01812.727 ± 0.00112.727 ± 0.00012.191 ± 0.0018.655 ± 0.002
Kin40k (8)0.168 ± 0.0090.174 ± 0.0010.287 ± 0.0030.205 ± 0.0030.483 ± 0.000
Fertility (9)0.197 ± 0.0160.183 ± 0.0000.187 ± 0.0010.182 ± 0.0000.194 ± 0.002
Pendu (9)1.948 ± 0.0212.947 ± 0.0002.577 ± 0.0092.053 ± 0.0102.103 ± 0.015
Protein (9)0.605 ± 0.0010.778 ± 0.0000.582 ± 0.0180.736 ± 0.0020.595 ± 0.001
Solar (10)0.790 ± 0.0260.780 ± 0.0020.792 ± 0.0000.775 ± 0.0020.748 ± 0.006
+ +# 5 Related Works + +Beyond SKI and its variants, a number scalable GP approximations have been investigated. Most notable are the different variants of sparse GP approximations [26, 23, 18]. For $m$ inducing points, these methods require either $\Omega (nm^2)$ time for direct solves or $\Omega (nm)$ time for approximate kernel MVMs in iterative solvers. While these methods generally do not leverage structured matrix algebra like the SKI framework, and thus have worse scaling in terms of the number of inducing points $m$ , they may achieve comparable accuracy with smaller $m$ , especially in higher dimensions. Some work utilizes the SKI framework to further boost the performance of sparse GP approximations [12]. + +A closely related work to ours is on improving the dimension scaling of SKI through the use of low-rank approximation and product structure [10]. In another very closely related work, Kapoor et al. [13] recently proposed to scale SKI to higher dimensions via interpolation on a permutohedral lattice. Like our work, they use simplicial interpolation. Unlike our work, the kernel matrix on the permutohedral lattice does not have special structure that admits fast exact multiplications; they instead use a locality-based approximation that takes into account the length scale of the kernel function by only considering pairs of grid points within a certain distance. Another related direction of research is the adaptation of sparse grid techniques for machine learning problems, e.g., classification and regression [16] and data mining [1]. These methods construct feature representations using sparse grid points [3], often by selecting a subset of grid points relevant for the dataset [6, 3]. + +# 6 Discussion + +This work demonstrates that two classic numerical techniques, namely, sparse grids and simplicial interpolation, can be used to scale GP kernel interpolation to higher dimensions. SKI with sparse grids and simplicial interpolation has better or competitive regression accuracy compared to state-of-the-art GP regression approaches on several UCI benchmarking datasets with 8 to 10 dimensions. + +Limitations and future work. Sparse grids and simplicial interpolation address two important bottlenecks when scaling kernel interpolation to higher dimensions. Sparse grids allow scalable matrix-vector multiplications with the grid kernel matrix, and simplicial interpolation allows scalable multiplications with the interpolation matrix $W$ . The relatively large number of rectilinear grids used to form a sparse grid—i.e., the factor of $\binom{\ell+d-1}{d-1}$ in Proposition 2—is one limiting factor that makes multiplication by $W$ more costly. Future research could investigate methods to mitigate this extra cost, and explore the limits of scaling to even higher dimensions with sparse grids. + +# Acknowledgments + +This material is based upon work supported by the National Science Foundation under Grant Nos. 1661259, 1749854, 2046235 and 1763618, along with Adobe and Google Research Grants. We thank Javier Burroni, Abhinav Agarwal, Shiv Shankar and Shreyas Chaudhari for their feedback. + +# References + +[1] H-J Bungartz, Dirk Pflüger, and Stefan Zimmer. Adaptive sparse grid techniques for data mining. In Modeling, simulation and optimization of complex processes, pages 121-130. Springer, 2008. +[2] Hans-Joachim Bungartz and Michael Griebel. Sparse grids. Acta Numerica, 13:147-269, 2004. +[3] Tri Dao, Christopher De Sa, and Christopher Ré. Gaussian quadrature for kernel features. In Advances in Neural Information Processing Systems 30 (NeurIPS), page 6109-6119, 2017. +[4] Dheeru Dua and Casey Graff. Uci machine learning repository, 2017. URL http://archive.ics.uci.edu/ml. +[5] A. Dutt, Miao Gu, and Vladimir Rokhlin. Fast algorithms for polynomial interpolation, integration, and differentiation. SIAM Journal on Numerical Analysis, 33:1689-1711, 1996. +[6] Jochen Garcke. A dimension adaptive sparse grid combination technique for machine learning. *Anziam Journal*, 48:C725-C740, 2006. +[7] Jochen Garcke. Sparse grids in a nutshell. In *Sparse grids and applications*, pages 57-80. Springer, 2012. +[8] Jochen Garcke and Michael Griebel. Classification with sparse grids using simplicial basis functions. Intelligent data analysis, 6(6):483-502, 2002. +[9] Jacob R. Gardner, Geoff Pleiss, David Bindel, Kilian Q. Weinberger, and Andrew Gordon Wilson. GPyTorch: Blackbox matrix-matrix Gaussian process inference with GPU acceleration. In Advances in Neural Information Processing Systems 31 (NeurIPS), pages 7576-7586, 2018. +[10] Jacob R Gardner, Geoff Pleiss, Ruihan Wu, Kilian Q Weinberger, and Andrew Gordon Wilson. Product kernel interpolation for scalable Gaussian processes. arXiv:1802.08903, 2018. +[11] John H Halton. Simplicial multivariable linear interpolation. Tehcnical Report 91-002, University of North Carolina at Chapel Hill Department of Computer Science, 1991. +[12] Pavel Izmailov, Alexander Novikov, and Dmitry Kropotov. Scalable gaussian processes with billions of inducing inputs via tensor train decomposition. In *In Proceedings of the 21st International Conference on Artificial Intelligence and Statistics (AISTATS)*, volume 84 of Proceedings of Machine Learning Research, pages 726-735. PMLR, 2018. +[13] Sanyam Kapoor, Marc Finzi, Ke Alexander Wang, and Andrew Gordon Gordon Wilson. Skiing on simplices: Kernel interpolation on the permutohedral lattice for scalable gaussian processes. In Proceedings of the 38th International Conference on Machine Learning (ICML), pages 5279-5289, 2021. +[14] Radford M. Neal. Bayesian Learning for Neural Networks. Springer-Verlag, 1996. +[15] Michael Obersteiner and Hans-Joachim Bungartz. A generalized spatially adaptive sparse grid combination technique with dimension-wise refinement. SIAM Journal on Scientific Computing, 43(4):A2381-A2403, 2021. +[16] Dirk Michael Pflüger. Spatially adaptive sparse grids for high-dimensional problems. PhD thesis, Technische Universität München, 2010. +[17] George M Phillips and Peter J Taylor. Theory and applications of numerical analysis. Elsevier, 1996. +[18] Joaquin Quinonero-Candela and Carl Edward Rasmussen. A unifying view of sparse approximate Gaussian process regression. Journal of Machine Learning Research, 6(Dec):1939-1959, 2005. +[19] Ali Rahimi and Benjamin Recht. Random features for large-scale kernel machines. In Advances in Neural Information Processing Systems 20 (NeurIPS), pages 1177-1184, 2007. +[20] Carl Edward Rasmussen. Gaussian Processes in Machine Learning. Springer, 2004. +[21] Winfried Sickel and Tino Ullrich. Spline interpolation on sparse grids. Applicable Analysis, 90 (3-4):337-383, 2011. +[22] Sergei Abramovich Smolyak. Quadrature and interpolation formulas for tensor products of certain classes of functions. In Doklady Akademii Nauk, volume 148, pages 1042-1045. Russian Academy of Sciences, 1963. + +[23] Edward Snelson and Zoubin Ghahramani. Sparse Gaussian processes using pseudo-inputs. In Advances in Neural Information Processing Systems 18 (NeurIPS), pages 1257-1264, 2005. +[24] Michalis Titsias. Variational learning of inducing variables in sparse gaussian processes. In In Proceedings of the 12th International Conference on Artificial Intelligence and Statistics (AISTATS), pages 567-574. PMLR, 2009. +[25] Julian Valentin. B-splines for sparse grids: Algorithms and application to higher-dimensional optimization. arXiv:1910.05379, 2019. +[26] Christopher KI Williams and Matthias Seeger. Using the Nyström method to speed up kernel machines. In Advances in Neural Information Processing Systems 14 (NeurIPS), pages 682-688, 2001. +[27] Andrew Wilson and Hannes Nickisch. Kernel interpolation for scalable structured Gaussian processes (KISS-GP). In Proceedings of the 32nd International Conference on Machine Learning (ICML), pages 1775-1784, 2015. +[28] Andreas Zeiser. Fast matrix-vector multiplication in the sparse-grid galerkin method. Journal of Scientific Computing, 47(3):328-346, 2011. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] See Section 6. +(c) Did you discuss any potential negative societal impacts of your work? [N/A] As our method is an improvement on existing methods therefore it doesn't have any direct negative consequences. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] +(b) Did you include complete proofs of all theoretical results? [Yes] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] See Section C. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section C.1. +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] See Figures 2 and 3. +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See C. + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] +(b) Did you mention the license of the assets? [Yes] +(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] See Section 1. +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] We use only publicly available datasets. +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] We use only publicly available datasets. + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/kernelinterpolationwithsparsegrids/images.zip b/kernelinterpolationwithsparsegrids/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..9ede3e70bc78f09b13f8f6475dd75c6383642e7a --- /dev/null +++ b/kernelinterpolationwithsparsegrids/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e567f109f7b3d154538bfdab0e06195841b01d2060850a5d78ace336a527568 +size 257408 diff --git a/kernelinterpolationwithsparsegrids/layout.json b/kernelinterpolationwithsparsegrids/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..bf990cfe9813d5075535dbf1c7b3a4f42609bf8a --- /dev/null +++ b/kernelinterpolationwithsparsegrids/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c346f37098fb2381ed8ffd9435b2b9ccbfa04c47ddea6acede493b5cead0fb4 +size 540022 diff --git a/kernelmemorynetworksaunifyingframeworkformemorymodeling/e29d2b91-e885-49ee-a94a-21342734c409_content_list.json b/kernelmemorynetworksaunifyingframeworkformemorymodeling/e29d2b91-e885-49ee-a94a-21342734c409_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..3b84eae784e4afd4a761c56799eb2a3f284d735c --- /dev/null +++ b/kernelmemorynetworksaunifyingframeworkformemorymodeling/e29d2b91-e885-49ee-a94a-21342734c409_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1f97e71a2f3bfcca378fc72b3c306c0e1a41d3c627051fb0dc1c64c8af564434 +size 86135 diff --git a/kernelmemorynetworksaunifyingframeworkformemorymodeling/e29d2b91-e885-49ee-a94a-21342734c409_model.json b/kernelmemorynetworksaunifyingframeworkformemorymodeling/e29d2b91-e885-49ee-a94a-21342734c409_model.json new file mode 100644 index 0000000000000000000000000000000000000000..960ccb304a8d0948b640647a44e810951c230787 --- /dev/null +++ b/kernelmemorynetworksaunifyingframeworkformemorymodeling/e29d2b91-e885-49ee-a94a-21342734c409_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4c03c272ecb99d70d0916577d1a9da56e6ee0ea1755898f6b67a2693746a6846 +size 108077 diff --git a/kernelmemorynetworksaunifyingframeworkformemorymodeling/e29d2b91-e885-49ee-a94a-21342734c409_origin.pdf b/kernelmemorynetworksaunifyingframeworkformemorymodeling/e29d2b91-e885-49ee-a94a-21342734c409_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..0f6f38362adcd40a1f21f02985d871b2a45135c0 --- /dev/null +++ b/kernelmemorynetworksaunifyingframeworkformemorymodeling/e29d2b91-e885-49ee-a94a-21342734c409_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f41140a8628a0fc546c91379ac8bdd17d4cf7178f12896acc6a5d521e8f5da34 +size 874796 diff --git a/kernelmemorynetworksaunifyingframeworkformemorymodeling/full.md b/kernelmemorynetworksaunifyingframeworkformemorymodeling/full.md new file mode 100644 index 0000000000000000000000000000000000000000..e3f950c50f02e429709b141bff7612b9309e423a --- /dev/null +++ b/kernelmemorynetworksaunifyingframeworkformemorymodeling/full.md @@ -0,0 +1,367 @@ +# Kernel Memory Networks: A Unifying Framework for Memory Modeling + +Georgios Iatropoulos1,2 + +Johanni Brea $^{1,*}$ + +Wulfram Gerstner $^{1,*}$ + +{firstname_lastname}@epfl.ch + +$^{1}$ Laboratory of Computational Neuroscience, $^{2}$ Blue Brain Project + +École Polytechnique Fédérale de Lausanne + +Switzerland + +# Abstract + +We consider the problem of training a neural network to store a set of patterns with maximal noise robustness. A solution, in terms of optimal weights and state update rules, is derived by training each individual neuron to perform either kernel classification or interpolation with a minimum weight norm. By applying this method to feed-forward and recurrent networks, we derive optimal models, termed kernel memory networks, that include, as special cases, many of the hetero- and auto-associative memory models that have been proposed over the past years, such as modern Hopfield networks and Kanerva's sparse distributed memory. We modify Kanerva's model and demonstrate a simple way to design a kernel memory network that can store an exponential number of continuous-valued patterns with a finite basin of attraction. The framework of kernel memory networks offers a simple and intuitive way to understand the storage capacity of previous memory models, and allows for new biological interpretations in terms of dendritic non-linearities and synaptic cross-talk. + +# 1 Introduction + +Although the classical work on attractor neural networks reached its peak in the late 1980's, with the publication of a number of seminal works [e.g., 2, 20, 22, 26], recent years have seen a renewed interest in the topic, motivated by the popularity of the attention mechanism [65], external memory-augmented neural networks [24, 66], as well as a new generation of energy-based attractor networks models, termed modern Hopfield networks (MHNs), capable of vastly increased memory storage [17, 35]. Recent efforts to understand the theoretical foundation of the attention mechanism have, in fact, shown that it can be linked to Hopfield networks [36, 57], but also to Kanerva's sparse distributed memory (SDM) [8, 30], and to the field of kernel machines [63, 68]. The last connection is particularly intriguing, in light of the many theoretical commonalities between neural networks and kernel methods [10, 11, 28, 47, 67]. Overall, these results suggest that a unified view can offer new insights into memory modeling and new tools for leveraging memory in machine learning. + +In this work, we aim to clarify some of the overlap between the fields of memory modeling and statistical learning, by integrating and formalizing a set of theoretical connections between Hopfield networks, the SDM, kernel machines, and neuron models with non-linear dendritic processing. + +# 1.1 Our contribution + +- We derive a set of normative kernel-based models that describe the general mathematical structure of feed-forward (i.e., hetero-associative) and recurrent (i.e., auto-associative) memory networks that can perform error-free recall of a given set of patterns with maximal robustness to noise. +- We show that the normative models include, as special cases, the classical and modern Hopfield network, as well as the SDM. +- We derive a simple attractor network model for storing an exponential number of continuous-valued patterns with a finite basin of attraction. We discuss its similarity to attention. + +Furthermore, we explain how classifiers with non-linear kernels can be interpreted as general forms of neuron models with non-linear dendritic activation functions and synaptic cross-talk. + +# 1.2 Related work + +Our work is primarily related to [8, 9, 35, 36, 45, 57]. While MHNs are extensively analyzed in [35, 36, 45, 57], the approach is energy-based and makes no statements about the relation between MHNs and kernel methods; a brief comment in [57] mentions some similarity to SVMs, but this is not further explained. The work by [8] focuses on the SDM and its connection to attention. It observes that the classical Hopfield network is a special case of the SDM, but no further generalization is made, and kernel methods are not mentioned. In our work, we place MHNs and the SDM in a broader theoretical context by showing that both models are special suboptimal cases of a family of memory networks that can be derived with a normative kernel-based approach. + +# 2 Background + +Consider the following simple model of hetero-associative memory: a single-layer feed-forward network consisting of a single output neuron connected to $N_{\mathrm{in}}$ inputs with the weights $\mathbf{w} \in \mathbb{R}^{N_{\phi}}$ . The output $s_{\mathrm{out}} \in \{\pm 1\}$ is given by + +$$ +s _ {\text {o u t}} = \operatorname {s g n} \left[ \mathbf {w} ^ {\top} \phi \left(\mathbf {s} _ {\text {i n}}\right) - \theta \right] \tag {1} +$$ + +where $\mathbf{s}_{\mathrm{in}}$ is the input vector (also called query), $\theta$ the threshold, and $\phi$ a function that maps the "raw" input to a $N_{\phi}$ -dimensional feature space, where typically $N_{\phi} \gg N_{\mathrm{in}}$ . Suppose that we are given a set of $M$ input-output patterns $\{\pmb{\xi}_{\mathrm{in}}^{\mu}, \pmb{\xi}_{\mathrm{out}}^{\mu}\}_{\mu=1}^{M}$ , in which every entry $\xi$ is randomly drawn from $\{\pm 1\}$ with sparseness $f := \mathbb{P}(\xi = 1)$ . In order for the neuron to store the patterns in a way that maximizes the amount of noise it can tolerate while still being able to recall all patterns without errors, one needs to find the weights that produce the output $\xi_{\mathrm{out}}^{\mu}$ in response to the input $\pmb{\xi}_{\mathrm{in}}^{\mu}, \forall \mu$ , and that maximize the smallest Euclidean distance between the inputs and the neuron's decision boundary. Using Gardner's formalism [20, 22], this problem can be expressed as + +$$ +\underset {\mathbf {w}} {\arg \max } \kappa \quad \text {s . t .} \quad \xi_ {\text {o u t}} ^ {\mu} \left(\mathbf {w} ^ {\top} \phi \left(\boldsymbol {\xi} _ {\text {i n}} ^ {\mu}\right) - \theta\right) \geq \kappa , \forall \mu \\ \| \mathbf {w} \| _ {2} = \bar {w} \tag {2} +$$ + +where $\bar{w} > 0$ is a constant. This is equivalent to solving + +$$ +\min _ {\mathbf {w}} \| \mathbf {w} \| _ {2} \quad \text {s . t .} \quad \xi_ {\text {o u t}} ^ {\mu} \left(\mathbf {w} ^ {\top} \phi \left(\boldsymbol {\xi} _ {\text {i n}} ^ {\mu}\right) - \theta\right) \geq 1, \forall \mu \tag {3} +$$ + +which can be directly identified as the support vector machine (SVM) problem for separable data [13]. The solution to Eq. 3 can today be found in any textbook on basic machine learning methods, and yields an optimal output rule that can be written in a feature and kernel form + +$$ +s _ {\text {o u t}} = \operatorname {s g n} \left[ \sum_ {\mu} ^ {M} \alpha^ {\mu} \xi_ {\text {o u t}} ^ {\mu} \phi \left(\boldsymbol {\xi} _ {\text {i n}} ^ {\mu}\right) ^ {\top} \phi \left(\mathbf {s} _ {\text {i n}}\right) - \theta \right] = \operatorname {s g n} \left[ \sum_ {\mu} ^ {M} \alpha^ {\mu} \xi_ {\text {o u t}} ^ {\mu} K \left(\boldsymbol {\xi} _ {\text {i n}} ^ {\mu}, \mathbf {s} _ {\text {i n}}\right) - \theta \right] \tag {4} +$$ + +where we, in the latter expression, have used the "kernel-trick" $K(\mathbf{x}_i,\mathbf{x}_j) = \phi (\mathbf{x}_i)^\top \phi (\mathbf{x}_j)$ . The solution depends on the Lagrange coefficients $\alpha^{\mu}\geq 0$ , many of which are typically zero. Patterns with $\alpha^{\mu} > 0$ are called support vectors. + +# 3 Kernel memory networks for binary patterns + +# 3.1 Hetero-associative memory as a feed-forward SVM network + +We begin by considering a hetero-associative memory network with an arbitrary number $N_{\mathrm{out}}$ output neurons, whose combined state we denote $\mathbf{s}_{\mathrm{out}}$ . In order for the network as a whole to be able to tolerate a maximal level of noise and still successfully recall its stored memories, we solve Eq. 3 for each neuron independently. As each neuron can have a different classification boundary along with a different set of support vectors, its weights will, in general, be characterized by an independent set of $M$ Lagrange coefficients. To simplify the notation, we represent these coefficients $\alpha_{i}^{\mu}$ , across neurons $i$ and patterns $\mu$ , as entries in the matrix $\mathbf{A}$ , where $(\mathbf{A})_{i\mu} = \alpha_{i}^{\mu}$ . We also combine all thresholds in the vector $\pmb{\theta} = (\theta_{1},\dots,\theta_{N_{\mathrm{out}}})$ , and all input and output patterns as columns in the matrices $\mathbf{X}_{\mathrm{in}} = (\pmb{\xi}_{\mathrm{in}}^{1},\dots,\pmb{\xi}_{\mathrm{in}}^{M})$ and $\mathbf{X}_{\mathrm{out}} = (\pmb{\xi}_{\mathrm{out}}^{1},\dots,\pmb{\xi}_{\mathrm{out}}^{M})$ . Finally, we assume that all neurons have the same feature map, so that $\phi_{i} = \phi$ , $\forall i$ (see Fig. 1). All functions are applied column-wise when the argument is a matrix, for example $\phi(\mathbf{X}_{\mathrm{in}}) = (\phi(\pmb{\xi}_{\mathrm{in}}^{1}),\dots,\phi(\pmb{\xi}_{\mathrm{in}}^{M}))$ . The optimal response of the network can now be compactly summarized as follows. + +Property 1 (Robust hetero-associative memory network). A single-layer hetero-associative memory network trained to recall the patterns $\mathbf{X}_{\mathrm{out}}$ in response to the inputs $\mathbf{X}_{\mathrm{in}}$ with maximal noise robustness, has an optimal output rule that can be written as + +$$ +\begin{array}{l} \mathbf {s} _ {\text {o u t}} = \operatorname {s g n} \left[ \left(\mathbf {A} \odot \mathbf {X} _ {\text {o u t}}\right) \phi \left(\mathbf {X} _ {\text {i n}}\right) ^ {\top} \phi \left(\mathbf {s} _ {\text {i n}}\right) - \boldsymbol {\theta} \right] \quad \text {(f e a t u r e f o r m)} (5) \\ = \operatorname {s g n} \left[ \left(\mathbf {A} \odot \mathbf {X} _ {\text {o u t}}\right) K \left(\mathbf {X} _ {\text {i n}}, \mathbf {s} _ {\text {i n}}\right) - \boldsymbol {\theta} \right] \quad \text {(k e r n e l f o r m)} (6) \\ \end{array} +$$ + +where $\odot$ denotes the Hadamard product. + +# 3.2 Auto-associative memory as a recurrent SVM network + +The hetero-associative network can be made auto-associative by setting $N_{\mathrm{out}} = N_{\mathrm{in}}$ and $\mathbf{X}_{\mathrm{out}} = \mathbf{X}_{\mathrm{in}}$ . The network is now effectively recurrent, as each neuron can serve both as an input and output simultaneously (see Fig. 1). Consider a recurrent network with $N$ neurons, whose state at time point $t$ is denoted $\mathbf{s}^{(t)} \in \{\pm 1\}^N$ , and whose dynamics evolve according to the update rule + +$$ +s _ {i} ^ {(t + 1)} = \operatorname {s g n} \left[ \mathbf {w} _ {i} ^ {\top} \phi (\mathbf {s} ^ {(t)}) - \theta_ {i} \right] \tag {7} +$$ + +where $\mathbf{w}_i\in \mathbb{R}^{N_\phi}$ is the weight vector to neuron $i = 1,\dots ,N$ . In order to make the patterns $\{\pmb {\xi}^{\mu}\}_{\mu = 1}^{M}$ fixed points of the network dynamics, we train each neuron $i$ independently on every pattern $\mu$ to, again, produce the response $\xi_i^\mu$ when the rest of the network is initialized in $\pmb{\xi}^{\mu}$ . Moreover, we maximize the amount of noise that can be tolerated by the network while maintaining error-free recall by maximizing the smallest Euclidean distance between each neuron's decision boundary and its inputs. This maximizes the size of the attractor basins [18, 32]. The problem of training the entire network is, in this way, transformed into the problem of training $N$ separate classifiers according to + +$$ +\min _ {\mathbf {w} _ {i}} \| \mathbf {w} _ {i} \| _ {2} \quad \text {s . t .} \quad \xi_ {i} ^ {\mu} \left(\mathbf {w} _ {i} ^ {\top} \phi (\boldsymbol {\xi} ^ {\mu}) - \theta_ {i}\right) \geq 1, \forall \mu , i. \tag {8} +$$ + +The solution can be obtained by slightly modifying Property 1, and is stated below. + +Property 2.1 (Robust auto-associative memory). A recurrent auto-associative memory network trained to recall the patterns $\mathbf{X}$ with maximal noise robustness has an optimal synchronous update rule that can be written as + +$$ +\begin{array}{l} \mathbf {s} ^ {(t + 1)} = \operatorname {s g n} \left[ (\mathbf {A} \odot \mathbf {X}) \phi (\mathbf {X}) ^ {\top} \phi (\mathbf {s} ^ {(t)}) - \boldsymbol {\theta} \right] \quad (f e a t u r e f o r m) (9) \\ = \operatorname {s g n} \left[ (\mathbf {A} \odot \mathbf {X}) K (\mathbf {X}, \mathbf {s} ^ {(t)}) - \boldsymbol {\theta} \right] \quad \text {(k e r n e l f o r m)} (10) \\ \end{array} +$$ + +Remark. With a linear feature map $\phi (\mathbf{x}) = \mathbf{x}$ , the optimal update is reduced to + +$$ +\mathbf {s} ^ {(t + 1)} = \operatorname {s g n} \left[ (\mathbf {A} \odot \mathbf {X}) \mathbf {X} ^ {\top} \mathbf {s} ^ {(t)} - \boldsymbol {\theta} \right] \tag {11} +$$ + +where $(\mathbf{A} \odot \mathbf{X})\mathbf{X}^{\top}$ can be identified as the general form of the optimal weight matrix. + +The solution described by Property 2.1 does not, in general, prohibit a neuron from having self-connections. Applying this constraint yields the following result. + +Property 2.2 (Robust auto-associative memory without self-connections). A recurrent autoassociative memory network without self-connections, with the inner-product kernel $K(\mathbf{x}_i, \mathbf{x}_j) = k(\mathbf{x}_i^\top \mathbf{x}_j)$ , that has been trained to recall the patterns $\mathbf{X}$ with maximal noise robustness, has an optimal asynchronous update rule that can be written in the kernel form + +$$ +s _ {i} ^ {(t + 1)} = \operatorname {s g n} \left[ \sum_ {\mu} ^ {M} \alpha_ {i} ^ {\mu} \xi_ {i} ^ {\mu} k \left(\sum_ {j \neq i} ^ {N} \xi_ {j} ^ {\mu} s _ {j} ^ {(t)}\right) - \theta_ {i} \right]. \tag {12} +$$ + +Storage capacity. An intuition for the storage capacity scaling of the hetero- and auto-associative memory networks can be gained by observing that the network as a whole will be able to successfully recall patterns as long as each neuron is able to correctly classify its inputs (or is very unlikely to produce an error). The capacity of the network can thereby be derived from the capacity of each individual neuron. It is well-known that a linear binary classifier can learn to correctly discriminate a maximum of $M_{\mathrm{max}} \approx 2D_{\mathrm{VC}}$ random patterns, where $D_{\mathrm{VC}}$ is the Vapnik-Chervonenkis dimension of the classifier [15, 20, 40, ch. 40]. For a neuron with $N$ inputs and a linear feature map $\phi(\mathbf{x}) = \mathbf{x}$ , this results in $D_{\mathrm{VC}} = N$ and, thus, the capacity $M_{\mathrm{max}} \approx 2N$ . Suppose, on the other hand, that the kernel is a homogeneous polynomial of degree $p$ , so that $K(\mathbf{x}_i, \mathbf{x}_j) = (\mathbf{x}_i^\top \mathbf{x}_j)^p$ . In this case, $\phi$ will contain all monomials of degree $p$ composed of the entries in $\mathbf{x}$ . As there are $\mathcal{O}(N^p)$ unique $p$ -degree monomials (see Appendix A.1), the input dimensionality and $M_{\mathrm{max}}$ will be $\mathcal{O}(N^p)$ . For the exponential kernel, which we can write as $K(\mathbf{x}_i, \mathbf{x}_j) = \exp(\mathbf{x}_i^\top \mathbf{x}_j) = \sum_{p=0}^{\infty} (\mathbf{x}_i^\top \mathbf{x}_j)^p / p!$ , the dimensionality of $\phi$ will be $\sum_{p=0}^{N} \binom{N}{p} = 2^N$ , which yields $M_{\mathrm{max}} \sim \mathcal{O}(e^N)$ . + +Special cases. In the following sections, we will show that many of the models of hetero- and auto-associative memory that have been proposed over the past years are special cases of the solutions in Properties 1, 2.1, and 2.2, characterized by specific choices of $\mathbf{A}$ , $\phi$ , and $K$ . + +# 3.3 Kanerva's sparse distributed memory is a feed-forward SVM network + +The sparse distributed memory (SDM), developed by Kanerva [30], is one of the most famous examples of a hetero-associative memory model. It has lately received much attention in the context of generative memory models [69] and attention layers in transformers [8]. + +The SDM consists of a register of $N_{\phi}$ memory slots, each associated with an address $\mathbf{z}_i \in \{\pm 1\}^{N_{\mathrm{in}}}$ , $i = 1, \dots, N_{\phi}$ . All addresses are listed as rows in the matrix $\mathbf{Z} = (\mathbf{z}_1, \dots, \mathbf{z}_{N_{\phi}})^\top$ . The content of each slot is represented by an $N_{\mathrm{out}}$ -dimensional vector, initialized at zero. Suppose that we wish to store the $M$ patterns $\mathbf{X}_{\mathrm{out}} = (\pmb{\xi}_{\mathrm{out}}^1, \dots, \pmb{\xi}_{\mathrm{out}}^M)$ in the addresses $\mathbf{X}_{\mathrm{in}} = (\pmb{\xi}_{\mathrm{in}}^1, \dots, \pmb{\xi}_{\mathrm{in}}^M)$ , where all entries are random and bipolar. The basic idea of the SDM is to write the data to, and later read it from, multiple memory slots at once (hence the distributed storage); this ensures a degree of noise-robustness. In mathematical terms, the read-out of the SDM provided with a query $\mathbf{s}_{\mathrm{in}}$ , is given by + +$$ +\mathbf {s} _ {\text {o u t}} = \operatorname {s g n} \left[ \mathbf {X} _ {\text {o u t}} \Theta \left(\mathbf {Z} \mathbf {X} _ {\text {i n}} - b\right) ^ {\top} \Theta \left(\mathbf {Z} \mathbf {s} _ {\text {i n}} - b\right) \right] \tag {13} +$$ + +where $\Theta$ the Heaviside function with bias $b = N_{\mathrm{in}} - 2r$ , and $r$ is a parameter that determines the precision of the writing and reading process. Upon comparing Eqs. 13 and 5, the SDM can be directly identified as a special case of a suboptimal feed-forward SVM network in the feature form, with $\mathbf{A} = \mathbf{1}$ , $\theta = \mathbf{0}$ , and the feature map $\phi_{\mathrm{SDM}}(\mathbf{x}) = \Theta (\mathbf{Zx} - b)$ . When viewed as a kernel method, the function of the SDM is to store the dense addresses $\mathbf{X}_{\mathrm{in}}$ as sparse high-dimensional representations $\phi_{\mathrm{SDM}}$ , to make it easier to later determine the slots closest to a query $\mathbf{s}_{\mathrm{in}}$ , and retrieve the relevant data. + +Capacity. As the SDM is linear in $\phi_{\mathrm{SDM}}$ , with $D_{\mathrm{VC}} \approx N_{\phi}$ , it follows from the analysis in Sec. 3.2 that one should expect the capacity to scale as $M_{\max} \sim \mathcal{O}(N_{\phi})$ . Moreover, one should expect a proportionality constant $\sim 0.1$ , since the SDM is suboptimal relative to the feed-forward SVM network, analogously to how the classical Hopfield network is suboptimal relative to the recurrent SVM network (see Sec. 3.4). This is consistent with earlier proofs [12, 31]. + +![](images/75e8aca7eae62131e7bdc724c9b95c758d263f12ea0f56f2856020e10ceb5641.jpg) + +![](images/b19100f007aa95db999e49214df1ea21b6255122041ef35da6ff5746b48f842e.jpg) + +![](images/a53400522c888695ed07a088bb692537022926cb142facd63489e988c40fbe99.jpg) + +![](images/3a70606fcafe79be20ae0e50f52d1bb22b856251e8420dc30f0beb1d9a14b216.jpg) +Figure 1: Graphical representation of (A1-A2) the feed-forward SVM network, (A3) the SDM, (B1-B2) the recurrent SVM network, and (C) an SVM mapped to the anatomy of a pyramidal cell (see Sec. 5). Circles represent neurons, while boxes represent the input transformation by the feature map $\phi$ , which can be dependent (A1, B1) or independent (A2, B2) of neuron index $i$ . + +![](images/61f496e020990949d942e5de95e8aa035d104ffe0ddbf1a738909a51da500a78.jpg) + +![](images/4969ef73670a4da2c6af106d2a1dff4debb1d2599c70121dbc4d4754ab7a1ece.jpg) + +Kernel of an infinite SDM. In practice, an SDM with a large number of memory slots $N_{\phi}$ requires calculations involving a large address matrix $\mathbf{Z}$ . This can be avoided by applying the kernel-trick to Eq. 13 in the limit $N_{\phi} \to \infty$ , which allows for the output to be computed with + +$$ +\mathbf {s} _ {\text {o u t}} = \operatorname {s g n} \left[ \mathbf {X} _ {\text {o u t}} K _ {\mathrm {S D M}} \left(\mathbf {X} _ {\text {i n}}, \mathbf {s} _ {\text {i n}}\right) \right] \tag {14} +$$ + +where we have defined the kernel as + +$$ +K _ {\mathrm {S D M}} (\mathbf {x} _ {i}, \mathbf {x} _ {j}) = \lim _ {N _ {\phi} \rightarrow \infty} \frac {\phi_ {\mathrm {S D M}} (\mathbf {x} _ {i}) ^ {\top} \phi_ {\mathrm {S D M}} (\mathbf {x} _ {j})}{N _ {\phi}} \tag {15} +$$ + +in order to ensure convergence. In this section, we will derive this kernel for two different variants of the SDM and demonstrate that both are translation-invariant. It is interesting to note here that $\phi_{\mathrm{SDM}}$ is equivalent to a single-layer neural network with $N_{\phi}$ neurons, weights $\mathbf{Z}$ , and bias $b$ . This means that $K_{\mathrm{SDM}}$ is equivalent to the kernel of an infinitely wide neural network [11, 47, 67]. + +We begin by noticing that $\phi_{\mathrm{SDM}}(\mathbf{x})$ has a geometrical interpretation [8, 31]. It is a binary vector that indicates those memory addresses in $\mathbf{Z}$ that differ by at most $r$ bits compared to $\mathbf{x}$ . For any two bipolar vectors $\mathbf{z}$ and $\mathbf{x}$ , the bit-wise difference can be computed as $\frac{1}{2} |\mathbf{z} - \mathbf{x}| = \frac{1}{4} \| \mathbf{z} - \mathbf{x} \|_2^2$ . This means that $\phi_{\mathrm{SDM}}(\mathbf{x})$ indicates all addresses that lie within a sphere centered at $\mathbf{x}$ with radius $2\sqrt{r}$ . Consequently, the inner product $\phi_{\mathrm{SDM}}(\mathbf{x}_i)^\top \phi_{\mathrm{SDM}}(\mathbf{x}_j)$ is the number of addresses located in the overlapping volume of two spheres centered at $\mathbf{x}_i$ and $\mathbf{x}_j$ . Although an exact calculation of this quantity can be found in [8, 30], its connection to the SDM kernel has, to the best of our knowledge, not previously been made. We therefore modify the previously published expression with a normalization factor $1/2^{N_{\mathrm{in}}}$ and state the following property. + +Property 3.1 (Kernel of an infinite SDM on the hypercube). In the limit $N_{\phi} \to \infty$ , the kernel of an SDM with $N_{\phi}$ memory slots, whose addresses are randomly drawn from $\{\pm 1\}^{N_{\mathrm{in}}}$ , is given by + +$$ +K _ {\mathrm {S D M}} \left(\mathbf {x} _ {i}, \mathbf {x} _ {j}\right) = \frac {1}{2 ^ {N _ {\mathrm {i n}}}} \sum_ {i = N _ {\mathrm {i n}} - r - \lfloor \frac {\Delta}{2} \rfloor} ^ {N _ {\mathrm {i n}} - \Delta} \sum_ {j = [ N _ {\mathrm {i n}} - r - i ] _ {+}} ^ {\Delta - (N _ {\mathrm {i n}} - r - i)} \binom {N _ {\mathrm {i n}} - \Delta} {i} \cdot \binom {\Delta} {j} \tag {16} +$$ + +where $r$ is the bit-wise error threshold and $\Delta$ is the bit-wise difference between $\mathbf{x}_i$ and $\mathbf{x}_j$ , given by $\Delta = \frac{1}{2} |\mathbf{x}_i - \mathbf{x}_j| = \frac{1}{4} \| \mathbf{x}_i - \mathbf{x}_j\|_2^2$ . + +The SDM can also be implemented with continuous addresses, randomly placed on a unit hypersphere of $(N_{\mathrm{in}} - 1)$ dimensions, denoted $\mathbb{S}^{N_{\mathrm{in}} - 1}$ . The vector $\phi_{\mathrm{SDM}}(\mathbf{x})$ now indicates all addresses that lie within a hyperspherical cap centered at $\mathbf{x}$ with an angle $\arccos(b)$ between its central axis and the rim. The inner product $\phi_{\mathrm{SDM}}(\mathbf{x}_i)^\top \phi_{\mathrm{SDM}}(\mathbf{x}_j)$ is the number of addresses located in the overlapping area of two spherical caps centered at $\mathbf{x}_i$ and $\mathbf{x}_j$ . While a calculation of this quantity, again, can be found in [8], it has not previously been connected to the kernel of an SDM. We simplify the previously published result and also derive a closed-form approximation, valid for highly sparse $\phi_{\mathrm{SDM}}$ (see Appendix B for details). The results are summarized below. + +Property 3.2 (Kernel of an infinite SDM on the hypersphere). In the limit $N_{\phi} \to \infty$ , the kernel of an SDM with $N_{\phi}$ memory slots, whose addresses are randomly drawn from $\mathbb{S}^{N_{\mathrm{in}} - 1}$ , is given by + +$$ +K _ {\mathrm {S D M}} (\mathbf {x} _ {i}, \mathbf {x} _ {j}) = \frac {N _ {\mathrm {i n}} - 2}{2 \pi} \int_ {\alpha_ {x}} ^ {\alpha_ {b}} \sin (\varphi) ^ {N _ {\mathrm {i n}} - 2} B \left[ 1 - \frac {\tan^ {2} (\alpha_ {x})}{\tan^ {2} (\varphi)}; \frac {N _ {\mathrm {i n}} - 2}{2}, \frac {1}{2} \right] \mathrm {d} \varphi \tag {17} +$$ + +where $\alpha_{x} = \frac{1}{2}\arccos (\mathbf{x}_{i}^{\top}\mathbf{x}_{j})$ , $\alpha_{b} = \arccos (b)$ , and $B$ is the incomplete Beta function. In the highly sparse regime, when $0.9\lesssim b < 1$ and $\frac{1}{N_{\phi}}\| \phi_{\mathrm{SDM}}\| _0\ll 1$ , the kernel can be approximated with + +$$ +K _ {\mathrm {S D M}} \left(\mathbf {x} _ {i}, \mathbf {x} _ {j}\right) \approx \frac {\hat {b} ^ {N _ {\mathrm {i n}} - 1}}{2 \pi} B \left[ 1 - \left(\frac {\Delta}{\hat {b}}\right) ^ {2}; \frac {N _ {\mathrm {i n}}}{2}, \frac {1}{2} \right] \tag {18} +$$ + +where $\Delta = \frac{1}{2}\| \mathbf{x}_i - \mathbf{x}_j\| _2$ and $\hat{b} = \sin (\arccos (b))$ + +In conclusion, an infinitely large SDM with sparse internal representations $\phi_{\mathrm{SDM}}$ , can be represented as a suboptimal case of a feed-forward SVM network with a translation-invariant kernel. + +# 3.4 The modern Hopfield network is a recurrent SVM network + +The Hopfield network [26] is, arguably, the most well-known model of auto-associative memory. In its modern form [35], it is a recurrent network of $N$ neurons with the state $\mathbf{s}^{(t)}$ , whose dynamics are governed by the energy and state update rule + +$$ +E = - \sum_ {\mu} ^ {M} F \left(\sum_ {i} ^ {N} \xi_ {i} ^ {\mu} s _ {i} ^ {(t)}\right), \quad s _ {i} ^ {(t + 1)} = \operatorname {s g n} \left[ \sum_ {\mu} ^ {M} \xi_ {i} ^ {\mu} F ^ {\prime} \left(\sum_ {j \neq i} ^ {N} \xi_ {j} ^ {\mu} s _ {j} ^ {(t)}\right) \right] \tag {19} +$$ + +where $F$ is a smooth function, typically a sigmoid, polynomial, or exponential. This "generalized" Hopfield model has a long history [see, e.g., 1, 21, 25, 37] but has received renewed attention in recent years under the name modern Hopfield network (MHN) or dense associative memory [17, 35]. By comparing Eq. 19 with Eq. 12, the state update of the MHN can be identified as a special case of a suboptimal recurrent SVM network in the kernel form, with $k = F'$ , $\mathbf{A} = \mathbf{1}$ , and $\pmb{\theta} = \mathbf{0}$ (since $f = 0.5$ ). With a linear $F'(x) = x$ , the MHN reduces to the classical Hopfield network, which is a special case of the recurrent SVM network with the linear kernel $k(\mathbf{x}_i^\top \mathbf{x}_j) = \mathbf{x}_i^\top \mathbf{x}_j$ . + +Capacity. The storage capacity of the MHN has been shown to depend on the shape of $F'$ . In the linear case, the capacity is famously limited to $\sim 0.1N$ patterns, depending on the precision of retrieval [2, 42]. If, on the other hand, $F'$ is polynomial with degree $p$ , the capacity scales as $M_{\mathrm{max}} \sim \mathcal{O}(N^p)$ [35], while an exponential $F'$ endows the network with a capacity $M_{\mathrm{max}} \sim \mathcal{O}(e^{N})$ [17]. From the perspective of the kernel memory framework, this scaling directly follows from the analysis in Sec. 3.2 with $k = F'$ . In fact, in the regime of low errors, the kernel memory framework can also be used to derive a more precise capacity scaling for the classical Hopfield network. We first note that any one-shot learning rule that implies $\mathbf{A} > 0$ is equivalent to an SVM network where every stored pattern is a support vector. Such a heuristic is only likely to be close to the optimal solution and perform well in large networks with very few patterns, as high-dimensional linear SVMs trained on few patterns are highly likely to find solutions where all patterns are support vectors; this effect has been termed support vector proliferation [4]. Restricting the network to this regime limits the capacity to $M_{\mathrm{max}} \sim \mathcal{O}\left(\frac{N}{2\log N}\right)$ , consistent with the result in [42] (see Appendix A.2). + +Iterative learning rules. The problem of iteratively training MHNs with biologically plausible online learning rules has recently been studied [64], with a resulting storage capacity ranging from $\sim 0.16N$ to $\sim N$ , depending on the exact implementation. The aim, in general, of such studies is to find a learning rule capable of producing a capacity close to the theoretical maximum $\sim 2N$ . For this purpose, the perspective of kernel memory networks can be particularly helpful, as many of the algorithms that have been developed over the past two decades to optimize SVMs can be utilized for MHNs as well. For example, a network formulated in the feature form can be trained with the stochastic batch perceptron rule [14, 34], the passive aggressive rules [16], the minnorm rule [5], as well as with likelihood maximization applied to logistic regression [29, 46, 59]. In the kernel form, two of the most well-known online algorithms for training linear and non-linear SVMs are the Adatron [3] and the Kernel-Adatron [19]. A performance comparison between iterative learning and the modern Hopfield learning rule can be found in Appendix C. + +Generalization. Viewing the MHN as a recurrent network of SVMs can also facilitate a more intuitive understanding of its ability to generalize, when used as a conventional classifier. In this setting, one designates a subset of the neurons as input units, and the remaining neurons as outputs. Given a set of input-output associations, one optimizes the memory patterns $\xi^{\mu}$ using, for example, gradient descent. Such an experiment was performed by Krotov and Hopfield [35] on the MNIST data set, using a polynomial non-linearity $F(x) = x^{p}$ . Results showed that the test error first improved as $p$ increased from 2 to 3, but later deteriorated for high degrees, like $p = 20$ . While it may be difficult to explain this behavior within an energy-based framework, it is entirely expected when viewed from the SVM perspective: a kernel of low polynomial degree has too few degrees of freedom to fit the classification boundary in the training set, causing underfitting, while a polynomial of too high degree grants the model too much flexibility, which results in overfitting. + +The pseudoinverse learning rule. The coefficients in $\mathbf{A}$ are, in general, computed numerically, and cannot be written in closed form. However, in the special case when Eq. 8 is underdetermined, meaning $M < N_{\phi}$ , a closed-form (but suboptimal) solution can be obtained using the least-squares SVM method [60]. The result is a generalized form of the pseudoinverse learning rule [50]. See Appendix D for details. + +# 4 Kernel memory networks for continuous patterns + +# 4.1 Auto-associative memory as a recurrent interpolation network + +So far, we have considered memory models designed to store only bipolar patterns. We now relax this constraint and allow patterns to be continuous-valued. We first observe that any set of patterns $\mathbf{X} \in \mathbb{R}^{N \times M}$ can be made fixed points of the dynamics by training each neuron $i$ to interpolate $\xi_i^\mu$ when the rest of the network is initialized in $\xi^\mu$ , for every pattern $\mu$ . Assuming that the model is equipped with a kernel that allows for each fixed point to also be attracting, we can ensure that a lower bounding estimate of the size of the attractor basin is maximized by finding the interpolation with minimum weight norm (see Appendix E.1 for proof). These results are summarized below. + +Property 4 (Robust auto-associative memory with continuous patterns). Suppose that the dynamics of a recurrent auto-associative memory network evolve according to the synchronous update rule + +$$ +\mathbf {s} ^ {(t + 1)} = \mathbf {X} \mathbf {K} ^ {\dagger} K (\mathbf {X}, \mathbf {s} ^ {(t)}) \tag {20} +$$ + +where $\mathbf{K} = K(\mathbf{X},\mathbf{X}) = \phi (\mathbf{X})^{\top}\phi (\mathbf{X})$ is the kernel matrix and $\mathbf{K}^{\dagger}$ its Moore-Penrose pseudoinverse, where $\mathbf{K}^{\dagger} = \mathbf{K}^{-1}$ if $\phi (\mathbf{X})$ is full column rank. Then, the dynamics of the network is guaranteed to have the fixed points $\mathbf{X}$ . Moreover, if the points are attracting, Eq. 20 maximizes a lower bound of the attractor basin sizes. + +# 4.2 A recurrent interpolation network with exponential capacity + +Memory models for continuous data [e.g., 27, 33, 48] have generally received less attention than their binary counterparts. Recently, however, Ramsauer et al. [57] proposed an energy-based model capable of storing an exponential number of continuous-valued patterns (we will refer to this model as the softmax network). While the structure of this model is similar to Eq. 20, it cannot be analyzed within + +the framework of Property 4, as it involves a kernel that is neither symmetric nor positive-definite [68]. + +Nonetheless, we will in this section demonstrate that it is possible to use conventional kernel methods to design an attractor network with exponential capacity for continuous patterns. We utilize the properties of the SDM by using a translation-invariant kernel with a fixed spatial scale $r$ . For the sake of simplicity, we choose the exponential power kernel $(\mathrm{Exp}_{\beta})$ + +$$ +K _ {\exp_ {\beta}} \left(\mathbf {x} _ {i}, \mathbf {x} _ {j}\right) = \exp \left[ - \left(\frac {1}{r} \| \mathbf {x} _ {i} - \mathbf {x} _ {j} \| _ {2}\right) ^ {\beta} \right] \tag {21} +$$ + +where $\beta, r > 0$ . These parameters determine the shape of the attractor basin that surrounds each pattern. While $r$ roughly sets the radius of attraction, $\beta$ represents an inverse temperature which changes the steepness of the boundary of the attractor basin. Moreover, as long as the patterns are unique, the kernel matrix is invertible and we have $\mathbf{K}_{\exp \beta}^{\dagger} = \mathbf{K}_{\exp \beta}^{-1}$ [44]. + +We will now analyze the noise robustness and storage capacity of this model. To make the analysis tractable, we will operate in the regime of low temperatures, meaning the limit $\beta \rightarrow \infty$ . We first establish the following three properties. + +Property 5.1 (The $\mathrm{Exp}_{\beta}$ network at zero temperature). Given a set of unique patterns $\{\pmb {\xi}^{\mu}\}_{\mu = 1}^{M}$ with $\min_{\mu ,\nu \neq \mu}\| \pmb {\xi}^{\mu} - \pmb{\xi}^{\nu}\| _2 > r$ the state update rule for the Exp network at $\beta \to \infty$ reduces to + +$$ +\mathbf {s} ^ {(t + 1)} = \mathbf {X} \Theta (r - \| \mathbf {X} - \mathbf {s} ^ {(t)} \| _ {2}) \tag {22} +$$ + +where $\Theta (\cdot)$ is the Heaviside function with $\Theta (0) = e^{-1}$ (see Appendix E.2.1). + +Remark. In geometrical terms, Property 5.1 states that the boundary of the basin of attraction surrounding each pattern becomes a sharp $(N - 1)$ -dimensional hypersphere with radius $r$ in the limit $\beta \to \infty$ . For lower, finite $\beta$ , the spherical boundary becomes increasingly fuzzy. From the perspective of an energy landscape, each pattern lies in an $N$ -dimensional energy minimum with infinitely steep walls when $\beta \to \infty$ . As $\beta$ is lowered, the barriers become progressively smoother. + +Property 5.2 (Convergence in one step). Given a set of unique patterns $\{\pmb{\xi}^{\mu}\}_{\mu = 1}^{M}$ with $\min_{\mu ,\nu \neq \mu}\| \pmb{\xi}^{\mu} - \pmb{\xi}^{\nu}\| _2 > 2r$ , the $Exp_{\beta}$ network at $\beta \to \infty$ , initialized at $\mathbf{s}^{(0)} = \pmb{\xi}^{\mu} + \Delta \pmb{\xi}$ , will converge to $\pmb{\xi}^{\mu}$ in one step if $\| \Delta \pmb {\xi}\| _2 < r$ . + +Property 5.3 (No spurious attractors). Given a set of unique patterns $\{\pmb{\xi}^{\mu}\}_{\mu=1}^{M}$ with $\min_{\mu,\nu \neq \mu} \|\pmb{\xi}^{\mu}-\pmb{\xi}^{\nu}\|_2 > 2r$ and $\not\exists \mu: \|\pmb{\xi}^{\mu}\|_2 = r/(1 - e^{-1})$ , the only attractors of the dynamics of the Exp $_\beta$ network at $\beta \to \infty$ are the points $\{\pmb{\xi}^{\mu}\}_{\mu=1}^{M}$ , together with $\mathbf{0}$ if $\not\exists \mu: \|\pmb{\xi}^{\mu}\|_2 \leq r$ . + +Remark. Properties 5.2 and 5.3 can be shown to be true simply by inserting the expression $\mathbf{s}^{(0)} = \pmb{\xi}^{\mu} + \Delta \pmb{\xi}$ in Eq. 22. Assuming no overlaps between the basins of attraction, a quick calculation shows that $\mathbf{s}^{(1)} = \pmb{\xi}^{\mu}$ if $\| \Delta \pmb{\xi}\|_2 < r$ . If, on the other hand, the network is initialized such that $\| \mathbf{s}^{(0)} - \pmb{\xi}^{\mu}\|_2 > r$ , $\forall \mu$ , one always obtains $\mathbf{s}^{(2)} = \pmb{\xi}^0$ , where $\pmb{\xi}^0$ is either $\mathbf{0}$ or the pattern closest to $\mathbf{0}$ . In other words, the network recalls a pattern only if the initialization is close enough to it. If located far from all patterns, the network assumes an "agnostic" state, represented either by the origin or the pattern closest to the origin (if the origin happens to be located within a basin of attraction). + +In the following two properties, we evaluate how the radius of attraction $r$ determines the maximum input noise tolerance and storage capacity. + +Property 6 (Robustness to white noise). Assume that we are given a set of unique patterns $\pmb{\xi}^1, \dots, \pmb{\xi}^M \sim \mathcal{N}(\mathbf{0}, \mathbf{I}_N)$ with $\min_{\mu, \nu \neq \mu} \| \pmb{\xi}^\mu - \pmb{\xi}^\nu \|_2 > 2r$ , and that the Exp $_\beta$ network is initialized in a distorted pattern $\mathbf{s}^{(0)} = \pmb{\xi}^\mu + \pmb{\epsilon}$ , where $\epsilon \sim \mathcal{N}(\mathbf{0}, \sigma^2 \mathbf{I}_N)$ . Then, at $\beta \to \infty$ , the maximum noise variance $\sigma_{\max}^2$ with which $\pmb{\xi}^\mu$ can be recovered in at least $50\%$ of trials is + +$$ +\sigma_ {\max } ^ {2} = r ^ {2} / N. \tag {23} +$$ + +Property 7 (Exponential storage capacity). At $\beta \to \infty$ , and for $N \gg 1$ , the average maximum number of patterns sampled from $\mathcal{N}(\mathbf{0}, \mathbf{I}_N)$ that the $\mathrm{Exp}_{\beta}$ network can store and recall without errors is lower-bounded according to + +$$ +M _ {\max } \geq \sqrt {2 \sqrt {\pi N} \left(1 - 2 \sigma_ {\max } ^ {2}\right)} \exp \left[ \frac {N \left(1 - 2 \sigma_ {\max } ^ {2}\right) ^ {2}}{8} \right] \tag {24} +$$ + +where $\sigma_{\mathrm{max}}^2$ is the maximum white noise variance tolerated by the network. + +Remark. Proofs can be found in Appendices E.2.2 and E.2.3. Note that Property 7 is valid in the range $\sigma_{\mathrm{max}}^2 \lesssim 1/2$ . While the bounds are fairly tight at the upper end of the range, they become loose when $\sigma_{\mathrm{max}}^2 \to 0$ . In this limit, which is equivalent to $r \to 0$ , the storage capacity tends to infinity, as the risk of interference between patterns vanishes when their radius of attraction becomes infinitesimal. + +Comparison to the softmax network. If patterns are randomly placed on a hypersphere instead of being normally distributed, the state update rule in Eq. 22 reduces to the form $\mathbf{s}^{(t + 1)} = \mathbf{X}\Theta (\mathbf{X}^\top \mathbf{s}^{(t)} - \theta)$ , where $\theta$ is a fixed threshold. While the capacity remains exponential (see Appendix E.3.1), the basin of attraction surrounding each pattern now forms a spherical cap instead of a ball. We can compare this to the softmax network at zero temperature, given by $\mathbf{s}^{(t + 1)} = \lim_{\beta \to \infty}\mathbf{X}$ softmax $(\beta \mathbf{X}^{\top}\mathbf{s}^{(t)}) = \mathbf{X}$ arg max $(\mathbf{X}^{\top}\mathbf{s}^{(t)})$ . This model differs from the Exp $_\beta$ only in a replacement of $\Theta$ with arg max. This changes the shape of the attractor basins from spherical caps to Voronoi cells, which parcellate the entire surface of the hypersphere into a Voronoi diagram (see Fig. 2). The boundary of each basin is now no longer radially symmetric around a pattern, but instead extends as far as possible in all directions. Consequently, at $\beta \to \infty$ , the softmax network has larger attractor basins and always converges to one of the stored patterns, regardless of the initialization point (assuming this is not precisely on a boundary). In contrast, the Exp $_\beta$ network may converge to the origin if initialized far from all patterns. This can be interpreted as an agnostic response, which indicates that the model cannot associate the input query with any of its stored patterns. + +# 5 Discussion + +Biological interpretation. Kernel memory networks can be mapped to the anatomical properties of biological neurons. Consider an individual neuron in the feature form of the recurrent network (Eq. 9). The state of neighboring neurons $\mathbf{s}$ is first transformed through $\phi(\mathbf{s})$ and thereafter projected to the neuron through the weight matrix $(\mathbf{A} \odot \mathbf{X})\phi(\mathbf{X})^\top$ . When the kernel is polynomial of degree $p$ , so that $K(\mathbf{x}_i, \mathbf{x}_j) = (\mathbf{x}_i^\top \mathbf{x}_j + 1)^p$ , the transformation $\phi(\mathbf{s})$ consists of all elements in $\mathbf{s}$ and their cross-terms, up to degree $p$ . The input to each neuron, in other words, consists of the states of all other neurons, as well as all possible combinations of their multiplicative interactions. This neuron model can be viewed as a generalized form of, for example, the multiconnected neuron [49], the clusteron [43], or the sigma-pi unit [58, p. 73]. These are all perceptrons that include multiplicative input interactions as a means to model synaptic cross-talk and cluster-sensitivity on non-linear dendrites [55] (see Fig. 1). + +In the kernel form (Eq. 10), each neuron is, again, implicitly comprised of a two-stage process, whereby the raw input $\mathbf{s}$ is first transformed through the function $K(\mathbf{X},\mathbf{s})$ and then projected through the weight matrix $\mathbf{A} \odot \mathbf{X}$ . For any inner-product kernel $K = k(\mathbf{x}_i^\top \mathbf{x}_j)$ , this representation can be directly identified as a two-layer neural network, where the hidden layer is defined by the weights $\mathbf{X}$ and the activation function $k$ . This interpretation of the recurrent network was recently proposed in [35, 36] and discussed in relation to hippocampal-cortical interactions involved in memory storage and recall; it is particularly reminiscent of the hippocampal indexing theory [6, 61]. However, the kernel form can also be viewed as a network in which each individual neuron is a generalized form of the two-layered pyramidal cell model [53, 54]. This was originally proposed as an abstract neuron model augmented with non-linear dendritic processing [41]. It should be noted, however, that the idea of interpreting kernel methods as neural networks has a longer history, and has been extensively analyzed in the case of, for example, radial basis functions [51, 52]. For further details, see Appendix F. + +Summary. We have shown that conventional kernel methods can be used to derive the weights for hetero- and auto-associative memory networks storing binary or continuous-valued patterns with maximal noise tolerance. The result is a family of optimal memory models, which we call kernel memory networks, which includes the SDM and MHN as special cases. This unifying framework facilitates an intuitive understanding of the storage capacity of memory models and offers new ways to biologically interpret these in terms of non-linear dendritic integration. This work formalizes the links between kernel methods, attractor networks, and models of dendritic processing. + +![](images/6fa06b04c3a86218b8e1a3cb895356ec794763ca752eec29010918caefb970b1.jpg) +Figure 2: Plot of random patterns on $\mathbb{S}^2$ together with attractor basins at $\beta \rightarrow \infty$ . Dots represent patterns ( $M = 17$ ) while thick and thin red lines correspond to the boundaries of the attractor basins according to the $\mathrm{Exp}_{\beta}$ network and the softmax network, respectively. The radius of the circular boundaries has been set to half the minimum pairwise distance between the patterns. + +Future work. A unifying theoretical framework for memory modeling can be useful for the development of both improved bio-plausible memory models and for machine learning applications. First, recognizing that there exists algorithms for training optimally noise-robust classifiers and adapting these to biological constraints can aid in the development of normative synaptic three-factor learning rules [23]. Second, the theoretical link between neuron models, kernel functions, and storage capacity enables one to fit kernel memory networks to neurophysiological data and to analyze the computational properties of biophysically informed memory models. Finally, our unifying framework reveals that most memory models differ only in the choice of kernel (model complexity) and Lagrange parameters (model precision). This categorization simplifies the tailoring of memory models to their application, and allows for the design of models whose properties fundamentally can depart from kernel memory networks, by, for example, choosing kernels not associated with a reproducing kernel Hilbert space. + +# Acknowledgments and Disclosure of Funding + +This study was supported by funding from the Swiss government's ETH Board of the Swiss Federal Institutes of Technology to the Blue Brain Project, a research center of the École Polytechnique Fédérale de Lausanne (EPFL). + +# References + +[1] Abbott, L. F. and Arian, Y. (1987). "Storage capacity of generalized networks". *Physical Review A* 36, pp. 5091-5094. +[2] Amit, D. J., Gutfreund, H., and Sompolinsky, H. (1985). "Storing infinite numbers of patterns in a spin-glass model of neural networks". Physical Review Letters 55, pp. 1530-1533. +[3] Anlauf, J. K. and Biehl, M. (1989). "The AdaTron: an adaptive perceptron algorithm". *Europhysics Letters* 10, pp. 687-692. +[4] Ardeshir, N., Sanford, C., and Hsu, D. (2021). "Support vector machines and linear regression coincide with very high-dimensional features". Advances in Neural Information Processing Systems 35. +[5] Bansal, Y., Advani, M., Cox, D. D., and Saxe, A. M. (2018). "Minnorm training: an algorithm for training over-parameterized deep neural networks". Preprint. arXiv: 1806.00730. +[6] Barry, D. N. and Maguire, E. A. (2019). "Remote memory and the hippocampus: a constructive critique". Trends in Cognitive Sciences 23, pp. 128-142. +[7] Boros, G. and Moll, V. (2004). Irresistible integrals: symbolics, analysis and experiments in the evaluation of integrals. Cambridge University Press. +[8] Bricken, T. and Pehlevan, C. (2021). "Attention approximates sparse distributed memory". Advances in Neural Information Processing Systems 34. + +[9] Casali, D., Costantini, G., Perfetti, R., and Ricci, E. (2006). "Associative memory design using support vector machines". IEEE Transactions on Neural Networks 17, pp. 1165-1174. +[10] Chen, L. and Xu, S. (2020). "Deep neural tangent kernel and Laplace kernel have the same RKHS". Proceedings of the 2021 International Conference on Learning Representations. +[11] Cho, Y. and Saul, L. (2009). "Kernel methods for deep learning". Advances in Neural Information Processing Systems 22. +[12] Chou, P. A. (1989). "The capacity of the Kanerva associative memory". IEEE Transactions on Information Theory 35, pp. 281-298. +[13] Cortes, C. and Vapnik, V. (1995). "Support-vector networks". Machine Learning 20, pp. 273-297. +[14] Cotter, A., Shalev-Shwartz, S., and Srebro, N. (2012). "The kernelized stochastic batch perceptron". Proceedings of the 29th International Conference on Machine Learning, pp. 739-746. +[15] Cover, T. M. (1965). "Geometrical and statistical properties of systems of linear inequalities with applications in pattern recognition". IEEE Transactions on Electronic Computers EC-14, pp. 326-334. +[16] Crammer, K., Dekel, O., Keshet, J., Shalev-Shwartz, S., and Singer, Y. (2006). "Online passive-aggressive algorithms". Journal of Machine Learning Research 7, pp. 551-585. +[17] Demircigil, M., Heusel, J., Löwe, M., Upgang, S., and Vermet, F. (2017). "On a model of associative memory with huge storage capacity". Journal of Statistical Physics 168, pp. 288-299. +[18] Forrest, B. M. (1988). "Content-addressability and learning in neural networks". Journal of Physics A: Mathematical and General 21, pp. 245-255. +[19] Frieß, T.-T., Cristianini, N., and Campbell, C. (1998). "The Kernel-Adatron algorithm: a fast and simple learning procedure for support vector machines". Proceedings of the 15th International Conference on Machine Learning, pp. 188-196. +[20] Gardner, E. (1987a). "Maximum storage capacity in neural networks". *Europhysics Letters* 4, pp. 481-485. +[21] Gardner, E. (1987b). "Multiconnected neural network models". Journal of Physics A: Mathematical and General 20, pp. 3453-3464. +[22] Gardner, E. (1988). "The space of interactions in neural network models". Journal of Physics A: Mathematical and General 21, pp. 257-270. +[23] Gerstner, W., Lehmann, M., Liakoni, V., Corneil, D., and Brea, J. (2018). "Eligibility traces and plasticity on behavioral time scales: experimental support of neohebbian three-factor learning rules". Frontiers in Neural Circuits 12. +[24] Graves, A., Wayne, G., and Danihelka, I. (2014). "Neural Turing machines". Preprint. arXiv:1410.5401. +[25] Hintzman, D. L. (1984). "MINERVA 2: A simulation model of human memory". Behavior Research Methods, Instruments, & Computers 16, pp. 96-101. +[26] Hopfield, J. J. (1982). "Neural networks and physical systems with emergent collective computational abilities". Proceedings of the National Academy of Sciences 79, pp. 2554-2558. +[27] Hopfield, J. J. (1984). "Neurons with graded response have collective computational properties like those of two-state neurons". Proceedings of the National Academy of Sciences 81, pp. 3088-3092. +[28] Jacot, A., Gabriel, F., and Hongler, C. (2018). "Neural tangent kernel: convergence and generalization in neural networks". Advances in Neural Information Processing Systems 31. +[29] Ji, Z., Srebro, N., and Telgarsky, M. (2021). "Fast margin maximization via dual acceleration". Proceedings of the 38th International Conference on Machine Learning, pp. 4860-4869. +[30] Kanerva, P. (1988). Sparse distributed memory. MIT Press. +[31] Keeler, J. D. (1988). "Comparison between Kanerva's SDM and Hopfield-type neural networks". Cognitive Science 12, pp. 299-329. +[32] Kepler, T. B. and Abbott, L. F. (1988). "Domains of attraction in neural networks". Journal de Physique 49, pp. 1657-1662. +[33] Koiran, P. (1994). "Dynamics of discrete time, continuous state Hopfield networks". Neural Computation 6, pp. 459-468. +[34] Krauth, W. and Mezard, M. (1987). "Learning algorithms with optimal stability in neural networks". Journal of Physics A: Mathematical and General 20, pp. L745-L752. +[35] Krotov, D. and Hopfield, J. J. (2016). "Dense associative memory for pattern recognition". Advances in Neural Information Processing Systems 29, pp. 1172-1180. +[36] Krotov, D. and Hopfield, J. J. (2020). "Large associative memory problem in neurobiology and machine learning". Proceedings of the 9th International Conference on Learning Representations. + +[37] Lee, Y. C., Doolen, G., Chen, H. H., Sun, G. Z., Maxwell, T., Lee, H. Y., and Giles, C. L. (1986). "Machine learning using a higher order correlation network". Physica D: Nonlinear Phenomena 22, pp. 276-306. +[38] Lee, Y. and Kim, W. C. (2014). Concise formulas for the surface area of the intersection of two hyperspherical caps. Technical Report. Department of Industrial and Systems Engineering, KAIST. +[39] Li, S. (2011). "Concise formulas for the area and volume of a hyperspherical cap". *Asian Journal of Mathematics and Statistics* 4, pp. 66-70. +[40] MacKay, D. J. C. (2003). Information theory, inference and learning algorithms. Cambridge University Press. +[41] Major, G., Larkum, M. E., and Schiller, J. (2013). "Active properties of neocortical pyramidal neuron dendrites". Annual Review of Neuroscience 36, pp. 1-24. +[42] McEliece, R., Posner, E., Rodemich, E., and Venkatesh, S. (1987). "The capacity of the Hopfield associative memory". IEEE Transactions on Information Theory 33, pp. 461-482. +[43] Mel, B. W. (1991). "The clusteron: toward a simple abstraction for a complex neuron". Advances in Neural Information Processing Systems 4, pp. 35-42. +[44] Micchelli, C. A. (1986). "Interpolation of scattered data: distance matrices and conditionally positive definite functions". Constructive Approximation 2, pp. 11-22. +[45] Millidge, B., Salvatori, T., Song, Y., Lukasiewicz, T., and Bogacz, R. (2022). "Universal Hopfield networks: a general framework for single-shot associative memory models". Proceedings of the 39th International Conference on Machine Learning, pp. 15561-15583. +[46] Nacson, M. S., Lee, J., Gunasekar, S., Savarese, P. H. P., Srebro, N., and Soudry, D. (2019). "Convergence of gradient descent on separable data". Proceedings of the 22nd International Conference on Artificial Intelligence and Statistics, pp. 3420-3428. +[47] Neal, R. M. (1996). “Priors for infinite networks”. Bayesian Learning for Neural Networks. Ed. by Neal, R. M. Vol. 118. Lecture Notes in Statistics. Springer, pp. 29-53. +[48] Nowicki, D. and Siegelmann, H. (2010). "Flexible kernel memory". PLOS ONE 5, e10955. +[49] Peretto, P. and Niez, J. J. (1986). "Long term memory storage capacity of multiconnected neural networks". Biological Cybernetics 54, pp. 53-63. +[50] Personnaz, L., Guyon, I., and Dreyfus, G. (1986). "Collective computational properties of neural networks: New learning mechanisms". Physical Review A 34, pp. 4217-4228. +[51] Poggio, T. and Girosi, F. (1990a). "Networks for approximation and learning". Proceedings of the IEEE 78, pp. 1481-1497. +[52] Poggio, T. and Girosi, F. (1990b). "Regularization algorithms for learning that are equivalent to multilayer networks". Science 247, pp. 978-982. +[53] Poirazi, P., Brannon, T., and Mel, B. W. (2003). "Pyramidal neuron as two-layer neural network". Neuron 37, pp. 989-999. +[54] Poirazi, P. and Mel, B. W. (2001). "Impact of active dendrites and structural plasticity on the memory capacity of neural tissue". Neuron 29, pp. 779-796. +[55] Polsky, A., Mel, B. W., and Schiller, J. (2004). "Computational subunits in thin dendrites of pyramidal cells". Nature Neuroscience 7, pp. 621-627. +[56] Radhakrishnan, A., Belkin, M., and Uhler, C. (2020). "Overparameterized neural networks implement associative memory". Proceedings of the National Academy of Sciences 117, pp. 27162-27170. +[57] Ramsauer, H., Schäfl, B., Lehner, J., Seidl, P., Widrich, M., Gruber, L., Holzleitner, M., Adler, T., Kreil, D., Kopp, M. K., Klambauer, G., Brandstetter, J., and Hochreiter, S. (2021). "Hopfield networks is all you need". Proceedings of the 9th International Conference on Learning Representations. +[58] Rumelhart, D. E. and McClelland, J. L. (1986). Parallel distributed processing: explorations in the microstructure of cognition. Vol. 1. MIT Press. +[59] Soudry, D., Hoffer, E., Nacson, M. S., Gunasekar, S., and Srebro, N. (2018). "The implicit bias of gradient descent on separable data". The Journal of Machine Learning Research 19, pp. 2822-2878. +[60] Suykens, J. and Vandewalle, J. (1999). "Least squares support vector machine classifiers". Neural Processing Letters 9, pp. 293-300. +[61] Teyler, T. J. and Rudy, J. W. (2007). "The hippocampal indexing theory and episodic memory: updating the index". Hippocampus 17, pp. 1158-1169. +[62] Tony Cai, T. and Jiang, T. (2012). "Phase transition in limiting distributions of coherence of high-dimensional random matrices". Journal of Multivariate Analysis 107, pp. 24-39. +[63] Tsai, Y.-H. H., Bai, S., Yamada, M., Morency, L.-P., and Salakhutdinov, R. (2019). "Transformer dissection: an unified understanding for transformer's attention via the lens of kernel". Proceedings of the + +2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 4344-4353. +[64] Tyulmankov, D., Fang, C., Vadaparty, A., and Yang, G. R. (2021). "Biological learning in key-value memory networks". Advances in Neural Information Processing Systems 34. +[65] Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., and Polosukhin, I. (2017). "Attention is all you need". Advances in Neural Information Processing Systems 30. +[66] Weston, J., Chopra, S., and Bordes, A. (2015). "Memory networks". Proceedings of the 2015 International Conference on Learning Representations. +[67] Williams, C. (1996). "Computing with infinite networks". Advances in Neural Information Processing Systems 9. +[68] Wright, M. A. and Gonzalez, J. E. (2021). "Transformers are deep infinite-dimensional non-Mercer binary kernel machines". Preprint. arXiv: 2106.01506. +[69] Wu, Y., Wayne, G., Graves, A., and Lillicrap, T. (2018). "The Kanerva machine: a generative distributed memory". Proceedings of the 2018 International Conference on Learning Representations. \ No newline at end of file diff --git a/kernelmemorynetworksaunifyingframeworkformemorymodeling/images.zip b/kernelmemorynetworksaunifyingframeworkformemorymodeling/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..ceabf56aab701483c0493f0917c2b8d0dd280234 --- /dev/null +++ b/kernelmemorynetworksaunifyingframeworkformemorymodeling/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df5a992c3f5e2e07264bb9433897338a8a69470032d9295cbd04b0b3030dd9b4 +size 272574 diff --git a/kernelmemorynetworksaunifyingframeworkformemorymodeling/layout.json b/kernelmemorynetworksaunifyingframeworkformemorymodeling/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..6ea2580cdcc4e09fee8ea8e94da40d442e71301b --- /dev/null +++ b/kernelmemorynetworksaunifyingframeworkformemorymodeling/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:060111143feb92a3caed257369355418e774082339bd5ed1f4564cd354f0dd7a +size 574034 diff --git a/kernelmultimodalcontinuousattention/98c6fe4b-b520-456d-a160-8fa65d198373_content_list.json b/kernelmultimodalcontinuousattention/98c6fe4b-b520-456d-a160-8fa65d198373_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..23b23ee382400e2d1b51fa20ea7a59ddf1d4d636 --- /dev/null +++ b/kernelmultimodalcontinuousattention/98c6fe4b-b520-456d-a160-8fa65d198373_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb9dbc91fecfa4ff38a0e603e560d1b094259b676ab38178ad9dc2195f9114b1 +size 88585 diff --git a/kernelmultimodalcontinuousattention/98c6fe4b-b520-456d-a160-8fa65d198373_model.json b/kernelmultimodalcontinuousattention/98c6fe4b-b520-456d-a160-8fa65d198373_model.json new file mode 100644 index 0000000000000000000000000000000000000000..51e8bdfd026091eb7ac8b813a9595244d00be0b8 --- /dev/null +++ b/kernelmultimodalcontinuousattention/98c6fe4b-b520-456d-a160-8fa65d198373_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a748926330ac89eb5a9f6a03ac78be72463eb5066be889edc4f2688a3f354796 +size 109948 diff --git a/kernelmultimodalcontinuousattention/98c6fe4b-b520-456d-a160-8fa65d198373_origin.pdf b/kernelmultimodalcontinuousattention/98c6fe4b-b520-456d-a160-8fa65d198373_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..751400c07caee2a597fed34aff1bfeac5ab31e09 --- /dev/null +++ b/kernelmultimodalcontinuousattention/98c6fe4b-b520-456d-a160-8fa65d198373_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3d372ed241b80ff7e991b06722a2ea785b945a56d700913825f91b96f4c2240d +size 595906 diff --git a/kernelmultimodalcontinuousattention/full.md b/kernelmultimodalcontinuousattention/full.md new file mode 100644 index 0000000000000000000000000000000000000000..577b315400d4e48b6d009cc191187e17afc662aa --- /dev/null +++ b/kernelmultimodalcontinuousattention/full.md @@ -0,0 +1,397 @@ +# Kernel Multimodal Continuous Attention + +Alexander Moreno* Luminous Computing + +Zhenke Wu +University of Michigan + +Supriya Nagesh Georgia Tech + +Walter Dempsey +University of Michigan + +James M. Rehg +Georgia Tech + +# Abstract + +Attention mechanisms average a data representation with respect to probability weights. Recently, [23-25] proposed continuous attention, focusing on unimodal exponential and deformed exponential family attention densities: the latter can have sparse support. [8] extended to multimodality via Gaussian mixture attention densities. In this paper, we propose using kernel exponential families [4] and our new sparse counterpart, kernel deformed exponential families. Theoretically, we show new existence results for both families, and approximation capabilities for the deformed case. Lacking closed form expressions for the context vector, we use numerical integration: we prove exponential convergence for both families. Experiments show that kernel continuous attention often outperforms unimodal continuous attention, and the sparse variant tends to highlight time series peaks. + +# 1 Introduction + +Attention mechanisms [3] are weighted averages of data representations used to make predictions. Discrete attention 1) cannot easily handle irregularly spaced observations, and 2) attention maps may be scattered, lacking focus. [23,24] proposed continuous attention, showing that attention densities maximize the regularized expectation of a function of the data location (i.e. time). Special cases lead to exponential and deformed exponential families: the latter has sparse support. They form a continuous data representation and take expectations with respect to attention densities. In [25] they apply this to a transformer architecture. + +[23-25] used unimodal attention densities, giving importance to one data region. [8] extended this to multimodal Gaussian mixture attention densities. However 1) Gaussian mixtures lie in neither the exponential nor deformed exponential families, and are difficult to study in the context of [23,24]; and 2) they have dense support. Sparse support can say that certain regions of data do not matter: a region of time has no effect on class probabilities, or a region of an image is not some object. We would like to use multimodal exponential and deformed exponential family attention densities, and understand how [8] relates to the framework of [23,24]. + +This paper makes three contributions: 1) we introduce kernel deformed exponential families, a sparse multimodal density class, and apply it along with the multimodal kernel exponential families [4] as attention densities. The latter have been used for density estimation, but not weighting data importance; 2) we theoretically analyze kernel exponential and deformed exponential family i) normalization, ii) approximation and iii) context vector numerical integration properties; 3) we apply + +them to real world datasets, showing that multimodal continuous attention outperforms unimodal, and that kernel deformed exponential family densities often highlight the peaks of time series. Approximation properties for the kernel deformed case are challenging: similar kernel exponential family results [33] relied on exponential and logarithm properties to bound the difference of the log-partition functional at two functions: these do not hold for deformed analogues. We provide similar bounds by using a mean value inequality and bounding a functional derivative. + +We first review unimodal continuous attention [23][24]. We motivate multimodal continuous attention via time warping. We next describe kernel exponential families and give a novel normalization condition relating kernel growth to the base density's tail decay. We then propose kernel deformed exponential families, new densities with support over potentially disjoint regions. We describe normalization and approximation capabilities. Next we describe using these densities for continuous attention, including numerical integration convergence analysis. We show experiments comparing unimodal and multimodal attention, and conclude with limitations and future work. + +# 2 Related Work + +Attention Mechanisms closely related are [23-25, 8]. [23, 24] frame continuous attention as an expectation of a value function with respect to a density, where the density solves an optimization problem. They only used unimodal (deformed) exponential family densities: we extend this to the multimodal setting by leveraging kernel exponential families and proposing a deformed counterpart. [8] proposed a multimodal continuous attention mechanism via a Gaussian mixture. We show in Appendix A that this solves a slightly different optimization problem from [23, 24]. A limitation of Gaussian mixtures is lack of flexible tail decay. Finally, [25] apply continuous attention within a transformer architecture to model long context. This is a new application of continuous attention rather than an extension of specific continuous attention mechanisms. + +Also relevant are [40, 30, 31]. [30] provide an attention mechanism for irregularly sampled time series by use of a continuous-time kernel regression framework, but do not take an expectation of a data representation over time with respect to a continuous pdf. Instead they evaluate the kernel regression model at fixed time points. This describes importance of data at a set of points rather than over continuous regions. [31] extend this to incorporate uncertainty quantification. Other papers connect attention and kernels, but focus on discrete attention [40, 5]. Also relevant are temporal transformer papers, including [45, 15, 17, 32]. However, none have continuous attention densities. + +Kernel Exponential Families [4] proposed kernel exponential families: [33] analyzed theory for density estimation. [44] parametrized the kernel with a deep neural network. Other density estimation papers include [1636]. We apply kernel exponential families as attention densities to weight a value function which represents the data, rather than for density estimation. Further, [44] showed a condition for an unnormalized kernel exponential family density to have a finite normalizer. However, they used exponential power base densities. We instead relate kernel growth rates to the base density tail decay, allowing non-symmetric base densities. + +To summarize our theoretical contributions: 1) showing that multimodal continuous attention is required to represent time warping 2) introducing kernel deformed exponential families with approximation and normalization analysis 3) improved kernel exponential family normalization results 4) stability and convergence analysis of numerical integration for kernel-based continuous attention 5) characterizing [8] in terms of the framework of [23,24]. + +# 3 Continuous Attention Mechanisms + +An attention mechanism has: 1) a value function: a raw or learned data representation 2) an attention density chosen to be 'similar' to another data representation, encoding it into a density 3) a context $c$ taking an expectation of the value function with respect to the attention density: + +$$ +c = \mathbb {E} _ {T \sim p} [ V (T) ]. \tag {1} +$$ + +The value function $V: S \to \mathbb{R}^D$ is a data representation, $T \sim p(t)$ is the random variable or vector for locations (temporal, spatial, etc) in domain $S$ , and $p(t)$ is the attention density (potentially with respect to a discrete measure). For discrete attention, one could have $V(t)$ be a time series where $t \in S$ a finite set of time points. One then weights the time series with a probability vector to + +obtain the context vector. An example of this for irregularly sampled time series is [30]. For each attention mechanism (eqn. 3 in their paper), $S$ is the set of observed time points, the value function maps the observed time points to their respective observation values, and the attention probability mass function is the output of normalized kernel evaluations between observation time points and a reference time point. + +In the continuous setting $V(t)$ could be a curve or realization of a continuous-time stochastic process, and $S$ could be $[0, \tau]$ where $\tau$ is a study end time. One then weights it with a continuous probability density. If $S$ is a set of spatial locations and one has image data, then the value function could be a raw image or learned representation of an image. Finally, for self-attention [18,42], $V$ is a linear transformation of a sequence, and the expectation is conditional on a transformation of a specific token (query). + +To choose $p$ , one takes a data representation $f$ and finds $p$ 'similar' to $f$ , but regularizing $p$ . [23][24] did this, formalizing attention mechanisms. Given a measure space $(S, \mathcal{A}, Q)$ , let $\mathcal{M}_{+}^{1}(S)$ be the set of probability densities with respect to $Q$ . Assume $Q$ is dominated by a $\sigma$ -finite measure $\nu$ (i.e. Lebesgue) and that it has Radon Nikodym derivative $q_{0} = \frac{dQ}{d\nu}$ with respect to $\nu$ . Let $S \subseteq \mathbb{R}^{D}$ , $\mathcal{F}$ be a function class, and $\Omega: \mathcal{M}_{+}^{1}(S) \to \mathbb{R}$ be a lower semi-continuous, proper, strictly convex functional. Given $f \in \mathcal{F}$ , an attention density [23] $\hat{p}: S \to \mathbb{R}_{\geq 0}$ solves + +$$ +\hat {p} [ f ] = \arg \max _ {p \in \mathcal {M} _ {+} ^ {1} (S)} \int_ {S} p (t) f (t) d Q (t) - \Omega (p). \tag {2} +$$ + +This maximizes regularized $L^2$ similarity between $p$ and a data representation $f$ . If $\Omega(p) = \int_{S} p(t) \log p(t) dQ(t)$ is the negative differential entropy, the attention density is Boltzmann Gibbs + +$$ +\hat {p} [ f ] (t) = \exp (f (t) - A (f)), \tag {3} +$$ + +where $A(f)$ ensures $\int_{S}\hat{p} [f](t)dQ = 1$ (see [23] for proof). If $f(t) = \theta^T\phi (t)$ for parameters and statistics $\theta \in \mathbb{R}^{M},\phi (t)\in \mathbb{R}^{M}$ respectively, Eqn. becomes an exponential family density. For $f$ in a reproducing kernel Hilbert space (RKHS) $\mathcal{H}$ , it becomes a kernel exponential family density [4], which we propose as an alternative attention density. + +One desirable class would be heavy or thin tailed exponential family like densities. In exponential families, the support, or non-zero region of the density, is controlled by the measure $Q$ . Letting $\Omega(p)$ be the $\alpha$ -Tsallis negative entropy $\Omega_{\alpha}(p)$ [41], + +$$ +\Omega_ {\alpha} (p) = \left\{ \begin{array}{l} \frac {1}{\alpha (\alpha - 1)} \left(\int_ {S} p (t) ^ {\alpha} d Q - 1\right), \alpha \neq 1; \\ \int_ {S} p (t) \log p (t) d Q, \alpha = 1, \end{array} \right. +$$ + +then $\hat{p}[f]$ for $f(t) = \theta^T\phi(t)$ lies in the deformed exponential family [41, 27]. + +$$ +\hat {p} _ {\Omega_ {\alpha}} [ f ] (t) = \exp_ {2 - \alpha} \left(\theta^ {T} \phi (t) - A _ {\alpha} (f)\right), \tag {4} +$$ + +where $A_{\alpha}(f)$ again ensures normalization and the density uses the $\beta$ -exponential + +$$ +\exp_ {\beta} (t) = \left\{ \begin{array}{l} {[ 1 + (1 - \beta) t ] _ {+} ^ {1 / (1 - \beta)}, \beta \neq 1;} \\ \exp (t), \beta = 1. \end{array} \right. \tag {5} +$$ + +For $\beta < 1$ , Eqn. [5] and thus deformed exponential family densities for $1 < \alpha \leq 2$ can return 0 values. Values $\alpha > 1$ (and thus $\beta < 1$ ) give thinner tails than the exponential family, while $\alpha < 1$ gives fatter tails. Setting $\beta = 0$ is called sparsemax [22]. In this paper, we assume $1 < \alpha \leq 2$ , which is the sparse case studied in [23]. We again propose to replace $f(t) = \theta^T\phi(t)$ with $f \in \mathcal{H}$ , which leads to the novel kernel deformed exponential families. + +Computing Eqn. $\boxed{1}$ s context vector requires parametrizing $V(t)$ . $\boxed{23}$ parametrize $V: S \to \mathbb{R}^{D}$ with $\mathbf{B} \in \mathbb{R}^{D \times N}$ as $V(t; \mathbf{B}) = \mathbf{B} \Psi(t)$ and estimate $\mathbf{B} \in \mathbb{R}^{D \times N}$ via regularized multivariate linear regression. Here $\Psi = \{\psi_{n}\}_{n=1}^{N}$ is a set of basis functions. Let $L$ be the number of observation locations (times in a temporal setting), $D$ be the observation dimension, and $N$ be the number of basis functions. Using Frobenius norm $\|\cdot\|_{F}$ , this involves regressing the observation matrix $\mathbf{H} \in \mathbb{R}^{D \times L}$ on a matrix $\mathbf{F} \in \mathbb{R}^{N \times L}$ of basis functions $\{\psi_{n}\}_{n=1}^{N}$ evaluated at observation locations $\{t_{l}\}_{l=1}^{L}$ + +$$ +\mathbf {B} ^ {*} = \arg \min _ {\mathbf {B}} \| \mathbf {B F} - \mathbf {H} \| _ {F} ^ {2} + \lambda \| \mathbf {B} \| _ {F} ^ {2}, \tag {6} +$$ + +# 4 Time Warping + +We now draw a connection to time warping [28] to show an advantage of our method. One summary statistic for classification is a global weighted average pooling: an expectation of temporal features. However in many processes features may not be aligned in time, and we only observe unaligned curves due to a discrepancy between individual system times and clock time: this is known as phase variation [21]. For instance, electrocardiogram (ECG) heartbeat curves have a P-wave, a QRS complex and a T-wave. These have similar patterns between heartbeats, but may have different durations and peak locations. Here we show that the expectation of a temporally aligned curve with respect to a global density is equivalent to the expectation of the unaligned curve with respect to an individualized density. However even if the global density is unimodal, the individualized density may not be. We first define the function that aligns a set of features to common reference times. + +Definition 4.1. (Time Warping Function) Given references times $\{t_{0k}\}_{k = 1}^{K}$ and individualized times $\{t_{ik}\}_{k = 1}^{K}$ , both in $[0,\tau]$ , a time warping function $h_i:S\to \mathbb{R}$ for $S\subseteq \mathbb{R}_{\geq 0}$ is a strictly increasing, differentiable, invertible function where + +$$ +h _ {i} (0) = 0, h _ {i} (\tau) = \tau +$$ + +$$ +h _ {i} \left(t _ {0 k}\right) = t _ {i k}, k = 1, \dots , K +$$ + +$$ +h _ {i} (t) = t \text {i f} t \notin [ 0, \tau ] +$$ + +Let $\{X_i\}_{i=1}^n$ , $X_i: S \to \mathbb{R}$ be observed curves, each with $K$ features occurring at individualized times $\{t_{ik}\}_{k=1}^K \subset [0, \tau]$ increasing in $k$ . A set of time warping functions $\{h_i\}_{i=1}^n$ map reference times to individualized feature times. One can then compute aligned $X_i^*(t) = X_i(h_i(t))$ . Each $X_i^*$ has relevant features at the same times $\{t_{0k}\}_{k=1}^K$ . Classically, this requires handcrafting and locating important features and estimating a warping function. We could then compute an expectation of the time warped curve with respect to a global fixed density $p(t)$ to obtain a summary statistic $\mathbb{E}_{T \sim p} X_i^*(T)$ of the aligned curve. The following states that multimodal continuous attention can represent such an expectation with an attention density $p_i$ , avoiding computing $X_i^*(t)$ . + +Lemma 4.2. (Continuous Attention can Represent Time Warping) Let $h$ be a time warping function, $g = h^{-1}$ and $X_{i}:\mathbb{R}\to \mathbb{R}$ with support on $[0,\tau ]$ . Assume that $Q$ is dominated by Lebesgue measure $\nu$ and let $q_0 = \frac{dQ}{d\nu}$ . Then for any fixed density $p$ wrt $Q$ , if $g,X_{i},q_{0},p$ are continuous almost everywhere we have + +$$ +\mathbb {E} _ {U \sim p} X _ {i} ^ {*} (U) = \mathbb {E} _ {T \sim p _ {i}} X _ {i} (T) \tag {7} +$$ + +where $p_i(t) = p(g_i(t)) \frac{q_0(g_i(t))}{q_0(t)} g_i'(t)$ and $p_i(t)$ is a valid probability density function. + +See Appendix B.1 for proof. Even if $p(t)$ is unimodal, $p_i(t)$ may not be: see Appendix B.2 for an example. Thus we require multimodal continuous attention to represent such statistics. + +# 5 Kernel Exponential and Deformed Exponential Families + +We use kernel exponential families and a new deformed counterpart to obtain flexible attention densities solving Eqn. 2 with the same regularizers. We first review kernel exponential families. We then give a novel theoretical result describing when an unnormalized kernel exponential family density can be normalized. This says that the normalizing constant exists when the base density has fast enough tail decay relative to kernel growth. This result allows us to verify that a choice of base measure and kernel lead to a valid attention density and thus attention mechanism. Next we introduce kernel deformed exponential families, extending kernel exponential families to have either sparse support, our focus, or fatter tails. These can attend to non-overlapping time intervals. We show similar normalization results based on kernel choice and base density. The normalizing constant exists when the unnormalized density has compact support and the kernel grows sufficiently slowly. Following this we show approximation theory. We conclude by showing how to compute attention densities in practice. + +Kernel exponential families [4] extend exponential families, replacing $f(t) = \theta^T\phi (t)$ with $f\in \mathcal{H}$ a reproducing kernel Hilbert space $\mathcal{H}$ [2]. Densities can be written + +$$ +\begin{array}{l} p (t) = \exp (f (t) - A (f)) \\ = \exp (\langle f, k (\cdot , t) \rangle_ {\mathcal {H}} \rangle - A (f)). \tag {8} \\ \end{array} +$$ + +![](images/ddf00abcfe33abf2070d597b786923bb4e7cf18ff5668991366d5281b8d951a8.jpg) +Figure 1: Rescaled continuous attention densities for a) kernel deformed exponential families on an engine noise example b) kernel deformed exponential families on an ECG example. Both examples are multimodal and highlight salient features of a signal, and the ECG example in particular highlights the waves, which describe the electrical signal passing through the heart conduction system. It first highlights the R wave, the largest peak, then the T wave, and next the R wave again. + +![](images/fb2d0b7a363697449ee15c643e093a1f1b8abdece9c9107311fcf6a8f599d482.jpg) + +Eqn. ⑧ follows from the reproducing property. A challenge is to choose $\mathcal{H}, Q$ so that a normalizing constant exists, i.e., $\int_{S} \exp(f(t)) dQ < \infty$ . These densities can approximate any continuous density over a compact domain arbitrarily well in KL divergence, Hellinger, and $L^p$ distance [33]. However relevant integrals including the normalizing constant require numerical integration. + +To avoid infinite dimensionality one generally assumes a representation of the form $f = \sum_{i=1}^{I} \gamma_i k(\cdot, t_i)$ , where for density estimation [33] the $t_i$ are the observation locations and this is the solution to a regularized empirical risk minimization problem. This requires using one parameter per observation value. This model complexity may not be necessary, and often one chooses a set of inducing points [38] $\{t_i\}_{i=1}^I$ where $I$ is less than the number of observation locations. + +For a given pair $\mathcal{H}, k$ , how can we choose $Q$ to ensure that the normalization constant exists? We first give a simple example of $\mathcal{H}$ , $f$ and $Q$ where it does not. + +Example 1. Let $Q$ be the law of a $\mathcal{N}(0,1)$ distribution and $S = \mathbb{R}$ . Let $\mathcal{H} = \operatorname{span}\{t^3, t^4\}$ with $k(t,s) = t^3 s^3 + t^4 s^4$ and $f(t) = t^3 + t^4 = k(t,1)$ . Then the following integral diverges. + +$$ +\int_ {S} \exp (f (t)) d Q = \int_ {\mathbb {R}} \frac {1}{\sqrt {2 \pi}} \exp \left(- \frac {t ^ {2}}{2} + t ^ {3} + t ^ {4}\right) d t +$$ + +# 5.1 Theory for Kernel Exponential Families + +We provide sufficient conditions for $Q$ and $\mathcal{H}$ so that $A(f)$ the log-partition functional exists. We relate $\mathcal{H}$ 's kernel growth rate to the tail decay of the random variable or vector $T_{Q}$ with law $Q$ . + +Proposition 5.1. Let $\tilde{p}(t) = \exp(f(t))$ where $f \in \mathcal{H}$ an RKHS with kernel $k$ . Assume $k(t,t) \leq L_k \|t\|_2^\xi + C_k$ for constants $L_k, C_k, \xi > 0$ . Let $Q$ be the law of a random vector $T_Q$ , so that $Q(A) = P(T_Q \in A)$ . Assume $\forall u \text{s.t.} \|u\|_2 = 1, z > 0$ + +$$ +P \left(\left| u ^ {T} T _ {Q} \right| \geq z\right) \leq C _ {q} \exp \left(- v z ^ {\eta}\right) \tag {9} +$$ + +for some constants $\eta >\frac{\xi}{2},C_Q,v > 0$ .Then + +$$ +\int_ {S} \tilde {p} (t) d Q < \infty . +$$ + +See Appendix C.1 for proof. Based on $k(t,t)$ 's growth, we can vary what tail decay rate for $T_{Q}$ ensures we can normalize $\tilde{p}(t)$ . [44] also proved normalization conditions, but focused on exponential power density for a specific growth rate of $k(t,t)$ rather than relating tail decay to growth rate. By focusing on tail decay, our result can be applied to non-symmetric base densities. Specific kernel bound growth rate terms $\xi$ lead to allowing different tail decay rates. + +Corollary 5.2. For $\xi = 4$ , $T_{Q}$ can be any sub-Gaussian random vector. For $\xi = 2$ it can be any sub-exponential. For $\xi = 0$ it can be any probability density. + +See Appendix C.2 for proof. + +# 5.2 Kernel Deformed Exponential Families + +We now propose kernel deformed exponential families, which are flexible sparse non-parametric densities: these can be multimodal. They take deformed exponential families and extend them to use kernels in the deformed exponential term. This mirrors kernel exponential families. We write + +$$ +p (t) = \exp_ {2 - \alpha} (f (t) - A _ {\alpha} (f)), +$$ + +where $f \in \mathcal{H}$ with kernel $k$ . Fig. 1 shows that they can have support over disjoint intervals. + +# 5.2.1 Normalization Theory + +We construct a valid kernel deformed exponential family density from $Q$ and $f \in \mathcal{H}$ . We first discuss the deformed log-normalizer. In exponential family densities, the log-normalizer is the log of the normalizer. For deformed exponentials, the following holds. + +Lemma 5.3. Let $Z > 0$ be a constant. Then for $1 < \alpha \leq 2$ , + +$$ +\frac {1}{Z} \exp_ {2 - \alpha} (Z ^ {\alpha - 1} f (t)) = \exp_ {2 - \alpha} (f (t) - \log_ {\alpha} Z) +$$ + +where + +$$ +\log_ {\beta} t = \left\{ \begin{array}{l} \frac {t ^ {1 - \beta} - 1}{1 - \beta} i f t > 0, \beta \neq 1; \\ \log (t) i f t > 0, \beta = 1; \\ \text {u n d e f i n e d} i f t \leq 0. \end{array} \right. +$$ + +See Appendix D.1 for proof. We now describe a normalization sufficient condition analogous to Proposition 5.1 for deformed kernel exponential families. With Lemma 5.3 and an unnormalized $\exp_{2 - \alpha}(\tilde{f}(t))$ we derive a valid normalized kernel deformed exponential family density. We only require that an affine function of the terms in the deformed-exponential is negative for large $\|t\|_2$ . + +Proposition 5.4. For $1 < \alpha \leq 2$ assume $\tilde{p}(t) = \exp_{2 - \alpha}(\tilde{f}(t))$ with $\tilde{f} \in \mathcal{H}$ , $\mathcal{H}$ is a RKHS with kernel $k$ . If $\exists C_t > 0$ s.t. for $\|t\|_2 > C_t$ , $(\alpha - 1)\tilde{f}(t) + 1 \leq 0$ and $k(t, t) \leq L_k \|t\|_2^\xi + C_k$ for some $\xi > 0$ , then $\int_S \exp_{2 - \alpha}(\tilde{f}(t)) dQ < \infty$ . + +See Appendix D.2 for proof. We now construct a valid kernel deformed exponential family density using the finite integral. + +Corollary 5.5. Under proposition 5.4's conditions, assume $\exp_{2 - \alpha}(\tilde{f}(t)) > 0$ on a set $A \subseteq S$ where $Q(A) > 0$ , then $\exists \text{constants } Z > 0, A_{\alpha}(f) \in \mathbb{R}$ such that for $f(t) = \frac{1}{Z^{\alpha - 1}}\tilde{f}(t)$ , the following holds + +$$ +\int_ {S} \exp_ {2 - \alpha} (f (t) - A _ {\alpha} (f)) d Q = 1. +$$ + +See Appendix D.3 for proof. We thus estimate $\tilde{f}(t) = Z^{\alpha - 1} f(t)$ and normalize to obtain a density of the desired form. + +# 5.2.2 Approximation Theory + +Kernel deformed exponential families can approximate continuous densities satisfying a tail condition on compact domains arbitrarily well in $L^p$ norm, Hellinger distance, and Bregman divergence. + +Theorem 5.6. Let $q_0 \in C(S)$ , such that $q_0(t) > 0$ for all $t \in S$ , where $S \subseteq \mathbb{R}^d$ is locally compact Hausdorff and $q_0$ is the Radon Nikodym derivative of measure $Q$ with respect to a dominating measure $\nu$ . Suppose there exists $l > 0$ such that for any $\epsilon > 0$ , $\exists R > 0$ satisfying $|p(t) - l| \leq \epsilon$ for any $t$ with $\| t \|_2 > R$ . Define + +$$ +\mathcal {P} _ {c} = \{p \in C (S): \int_ {S} p (t) d Q = 1, p (t) \geq 0, \forall t \in S a n d p - l \in C _ {0} (S) \}. +$$ + +Suppose $k(t,\cdot)\in C_0(S)\forall t\in S$ and the kernel integration condition (Eqn. [12] holds. Then kernel deformed exponential families are dense in $\mathcal{P}_c$ wrt $L^r$ norm, Hellinger distance and Bregman divergence for the $\alpha$ -Tsallis negative entropy functional. + +The proof (Appendix D.4) idea is that under a kernel integrability condition, deformed exponential families parametrized by $f \in \mathcal{H}$ are dense in those parametrized by $f \in C_0(S)$ . (we denote those parametrized by $f \in C_0(S)$ as $\mathcal{P}_0$ ). We can approximate $C(S)$ densities satisfying the tail condition with $\mathcal{P}_0$ densities, and thus with deformed exponential family densities. This extends [33] 's approximation to the deformed case: standard log and exponential rules cannot be applied. It requires bounding functional derivatives and applying a mean value inequality. + +# 5.3 Using Kernels for Continuous Attention + +Here we describe how to compute continuous attention mechanisms with attention densities parametrized by functions in an RKHS $\mathcal{H}$ in practice. Algorithm $\boxed{1}$ shows the kernel deformed exponential family case: the kernel exponential family case involves a similar algorithm. Given a base measure, kernel, and inducing point locations, we start by computing kernel weights $\tilde{\gamma}_i$ for $\tilde{f}(t) = Z^{\alpha-1} f(t) = \sum_{i=1}^{I} \tilde{\gamma}_i k(t, t_i)$ and estimating the matrix $\mathbf{B}$ for basis weights for the value function $V(t) = \mathbf{B} \Psi(t)$ . Unlike density estimation, this form for $f$ is simply a practical way to obtain $f$ in an RKHS, rather than a solution to an empirical risk minimization problem. We then compute the normalizing constant $Z = \int_S \exp_{2-\alpha}(\tilde{f}(t)) dQ$ via numerical integration and use it to normalize $\tilde{f}(t)$ to obtain the attention density $p(t)$ . Finally we compute the context $c = \mathbb{E}_{T \sim p}[V(T)] = \mathbf{B} \mathbb{E}_p[\Psi(t)]$ by taking the expectation of $\Psi(T)$ with respect to a deformed kernel exponential family density $p$ . Unlike [23, 24], we lack closed form expressions and use numerical integration. In the backwards pass we use automatic differentiation. Note that in some cases we have numerical underflow when computing the normalizing constant. We also found that using FP16 precision, the default on some newer GPUs for Pytorch up to 1.11, leads to worse performance, sometimes dramatically so, and thus recommend using FP32. We discuss solutions for the underflow issue in Appendix E.1. + +# Algorithm 1 Continuous Attention Mechanism via Kernel Deformed Exponential Families + +Choose $q_{0}(t)$ and kernel $k$ . Inducing point locations $\{t_i\}_{i=1}^I$ + +Parameters $\{\tilde{\gamma}_i\}_{i=1}^I$ the weights for $\tilde{f}(t) = (Z)^{\alpha-1} f(t) = \sum_{i=1}^I \tilde{\gamma}_i k(t, t_i)$ , matrix $\mathbf{B}$ for basis weights for value function $V(t) = \mathbf{B} \Psi(t)$ . $I$ is number of inducing points. + +Forward Pass + +Compute $Z = \int \exp_{2 - \alpha}(\tilde{f}(t)) dQ(t)$ to obtain $p(t) = \frac{1}{Z} \exp_{2 - \alpha}(\tilde{f}(t))$ via numerical integration. Compute $\mathbb{E}_{T \sim p}[\Psi(T)]$ via numerical integration + +Compute $c = \mathbb{E}_{T\sim p}[V(T)] = \mathbf{B}\mathbb{E}_p[\Psi (T)]$ + +Backwards Pass use automatic differentiation + +# 5.3.1 Numerical Integration Convergence + +The trapezoidal rule's standard one-dimensional convergence rate is $O\left(\frac{1}{N^2}\right)$ for an integral over a fixed interval, where $N$ is the number of grid points. We would like better convergence guarantees. We can achieve exponential convergence for the numerical integrals of kernel exponential and deformed exponential family attention. We focus on numerical integration over the real line, leaving truncation analysis and higher dimensions to future work. We let $h > 0$ be the grid size. + +For functions holomorphic in a strip with rapid decay, the trapezoidal rule has exponential convergence. For kernel exponential family attention, this gives us $O(\exp(-C / h))$ or exponential convergence for some $C > 0$ with appropriate choice of $q_0$ , $V$ , and $k$ . Technical details are in E.2, and are based on extending real-valued analytic functions to complex functions analytic/holomorphic on a strip. + +Kernel deformed exponential families, however, are not even differentiable, but we can construct a sequence of differentiable approximations by replacing the positive part/ReLU function in the deformed exponential with softplus for increasing values of the softplus parameter. Each differentiable approximation has exponential convergence, and by taking limits as the softplus parameter tends to infinity we can show that the numerical integral for kernel deformed exponential family attention itself has exponential convergence. Technical details are in E.3 + +We also show empirical convergence analysis in Appendix E.4 and figure 2 in that appendix. Both kernel exponential and deformed exponential families see rapid convergence for 1d attention, pro + +
AttentionAccuracy
Cts Softmax77.72±14.20
Cts Sparsemax77.96±9.64
Kernel Softmax (ours)85.71 ± 11.98
Kernel Sparsemax (ours)88.1 ± 1.50
+ +Table 1: Results for 100 runs each of synthetic time warping classification experiment, $N = 64$ . This involves generating 10,000 trajectories, each of length 95 of unaligned curves. + +viding excellent integral approximations with only 5-10 grid points. Further, the numerical integral using softplus is a very close approximation to that using ReLU for softplus parameters 5 and 10. + +# 6 Experiments + +We investigate how often multimodal continuous attention outperforms unimodal, given the same architecture. We also investigate whether these methods learn rich multimodal densities. We denote kernel exponential family attention as kernel softmax and the deformed case as kernel sparsemax. Our architectures have: 1) an encoder maps a discrete time series representation to attention density parameters. 2) The value function $V(t; \mathbf{B})$ expresses an embedding of a time series as a linear transformation of basis functions. 3) The context is $c = \mathbb{E}_p[V(T)]$ , which is used in 4) a classifier. Fig. 3 in the Appendices visualizes this. For kernel softmax/sparsemax the encoder outputs are the weights for the kernel evaluations. For the Gaussian mixture case, the encoder's outputs are the mixture weights and components means and variances. Here we describe one synthetic and three real data experiments. In Appendix E we provide an additional ECG classification experiment. We provide confidence intervals for our three smaller experiments (at most 10,000 samples). Our UWave and ECG experiments were done on a Titan X GPU, IMDB on a 1080, and FordA on an A40. We found that the A40 provides very different results out of the box for both accuracy/F1 and attention densities. As an example, Figure 8 was done on a Titan X with an older version of Pytorch, while Figure 7 was done with an A40 with Pytorch 1.12. Code is in our repository where we discuss the flags used to control precision on recent GPUs and Pytorch versions. We discuss computational/memory complexity in Appendix F and give a summary in Table 5. We provide wall clock times in Table 6 + +# 6.1 Synthetic Experiment: Time Warping + +We simulate time warping and do prediction for unimodal vs multimodal attention densities. Details of the original time aligned stochastic process and inverse warping function are in Appendix B.3. Given global densities for classes $p_1, p_2$ and aligned $X^*$ , the class is arg max $(\langle p_1, X^* \rangle, \langle p_2, X^* \rangle)$ . We generate 10,000 trajectories of length 95 observed at evenly spaced time points in the interval [0, 1]. We use two attention mechanisms (heads), one for each class. Letting $V$ be the value function fit to observed data, the classifier is softmax $([\langle p_{i1}, V \rangle_{L^2}, \langle p_{i2} V \rangle_{L^2}]$ where $p_{i1}$ and $p_{i2}$ are the attention densities for the first and second class. Table I shows prediction results from 100 runs along with 1.96 standard deviation intervals. Kernel methods outperform by $7 - 10\%$ . + +# 6.2 FordA Dataset + +This is a binary classification dataset for whether a symptom exists in an automotive subsystem. Each time series has 500 sensor observations, and there are 3601 training samples and 1320 test samples. Table 2 shows results. Kernel sparsemax outperforms most baselines while kernel softmax also does well. We use the same methods and architecture as the previous section, although hyperparameters are slightly different. Several methods, including discrete softmax, continuous softmax and the transformer, have very poor performance. To sanity check we fit SVM with a Gaussian kernel, logistic regression, and a decision tree: accuracies are under $55\%$ for these, and we conclude that + +
MethodAccuracyF1
Discrete Softmax51.27 ± 1.8633.89 ± 0.82
Cts Softmax74.88 ± 21.3674.56 ± 21.84
Cts Sparsemax90.95 ± 1.7790.94 ± 1.77
Gaussian Mixture69.56 ± 35.9460.75 ± 52.88
Kernel Softmax (ours)92.44 ± 1.9692.43 ± 2.00
Kernel Sparsemax (ours)92.61 ± 1.6292.60 ± 1.62
LSTM FCN93.41 ± 0.4393.40 ± 0.43
TST (Transformer)49.48 ± 1.0449.46 ± 1.02
+ +Table 2: FordA accuracy, 1.96 SD intervals over 10 runs. Our methods outperform most baselines. Several methods have very poor performance. To sanity check we fit three classical methods: kernel SVM, logistic regression, and a decision tree. All have under $55\%$ accuracy, suggesting that this dataset is problematic for some methods. + +
AttentionN=64N=128
Cts Softmax67.78±1.6467.70± 2.49
Cts Sparsemax74.20±2.7274.69±3.78
Gaussian Mixture81.13±1.7680.99±2.79
Kernel Softmax (ours)93.85±0.6094.26±0.75
Kernel Sparsemax (ours)92.32 ± 1.0992.15 ± 0.79
+ +Table 3: Accuracy results on uWave gesture classification dataset for the irregularly sampled case. Again over 10 runs. Due to the irregular sampling, this is only comparable to [16,29]. Kernel based attention substantially outperforms unimodal and mixture models. All methods use 100 attention heads. Gaussian mixture uses 100 components (and thus 300 parameters per head), and kernel methods use 256 inducing points. + +this data poses difficulty for some classifiers. Appendix G provides some additional details, along with attention density plots. The kernel softmax plots often highlight zero crossings. The kernel sparsemax plots often select peaks of a signal while learning rich sparsity patterns. + +# 6.3 uWave Experiment: Gesture Classification + +We investigate: 1) Does a large number of unimodal attention heads, as suggested in [23, 24], perform well when multimodality is needed? 2) Can this method work well for irregularly sampled time series? 3) Can we learn interesting multimodal attention densities? + +We analyze uWave [19]: accelerometer time series with eight gesture classes. We follow [16]s split into 3,582 training observations and 896 test observations: sequences have length 945. We do synthetic irregular sampling and uniformly sample $10\%$ of the observations. Because of this our results are comparable to other uWave irregular sampling papers [16, 29], but not to results using the full time series. + +Table 3 shows the results. Our highest accuracy is $94.26\%$ , the multi-head unimodal case's best is $74.69\%$ , and the mixture's best is $81.13\%$ . We outperform the results of [16], who report a highest accuracy of $91.41\%$ , and perform similarly to [29] (their figure suggests approximately $94\%$ accuracy). Fig. 10 shows attention densities for one of the attention heads for the first three classes. This takes one attention density for each time series of each class and plots it. Within the same class, all attention densities for the head (one for each time series) are plotted. The plot shows two things: firstly, attention densities have support over non-overlapping time intervals. This cannot be done with Gaussian mixtures, and the intervals would be the same for each density in the exponential family case. Secondly, there is high similarity of attention densities within each class, but low similarity between classes. Appendix H describes additional details. + +
AttentionN=32N=64N=128Mean
Cts Softmax89.5690.3291.0890.32
Cts Sparsemax89.5090.3989.9689.95
Kernel Softmax91.3091.0890.4490.94
Kernel Sparsemax90.5690.2090.4190.39
+ +Table 4: IMDB sentiment classification dataset accuracy. Continuous softmax uses Gaussian attention, continuous sparsemax truncated parabola, and kernel softmax and sparsemax use kernel exponential and deformed exponential family with a Gaussian kernel. The latter has $\alpha = 2$ in exponential and multiplication terms. $N$ : basis functions, $I = 10$ inducing points, bandwidth 0.01. + +# 6.4 IMBD Sentiment Classification + +We extend [23]'s code for IMDB sentiment classification [20]. This uses a document representation $v$ from a convolutional network and an LSTM attention model. We use a Gaussian base density and kernel, and divide the interval [0, 1] into $I = 10$ inducing points where we evaluate the kernel in $f(t) = \sum_{i=1}^{I} \gamma_i k(t, t_i)$ . Table shows results. On average, kernel exponential and deformed exponential family slightly outperforms the continuous softmax and sparsemax. The continuous softmax/sparsemax results are from running their code. + +# 7 Discussion + +In this paper we extend continuous attention mechanisms to use kernel exponential and deformed exponential family densities. The latter is a new flexible class of non-parametric densities with sparse support. We show novel existence properties for kernel exponential and deformed exponential families, prove approximation properties for the latter, and show exponential convergence of numerical integration for both attention mechanisms. We then apply these to the continuous attention framework described in [23, 24]. We show results on several datasets. Kernel attention mechanisms tend to outperform unimodal attention, sometimes by a large margin. We also see that in many cases they exhibit multimodality. Kernel sparsemax in particular learns rich sparsity patterns while highlighting peaks of a signal. This was evident in Figure 1. The engine noise example mimicked certain parts of the signal, while in the ECG example, it tends to give very high weight to R waves in a signal. While this paper is more focused on general methods than a specific potentially dangerous application, potential application areas include wearable sensors and NLP, and general negative societal impacts in those application areas could apply to this work. + +# 7.1 Limitations + +A limitation was the use of numerical integration, which scales poorly with location dimensionality. While we achieve 1D exponential convergence, we still must investigate whether we can extend this to higher dimensions. This still allows for multiple observation dimensions at a given 1d location, i.e. multivariate time series or language tasks. + +# 8 Funding and Other Acknowledgments + +Alexander Moreno is supported by Luminous Computing, and was previously supported by NIH 1-P41-EB028242-01A1, U01CA229437, and a Google CMD-IT Flip-Alliance fellowship. Zhenke Wu is partly supported by NIH U01CA229437 and an investigator grant from Precision Health Initiative at University of Michigan, Ann Arbor. Supriya Nagesh is supported by NSF CNS1823201. Walter Dempsey is supported by P50 DA054039. We thank Marcos Treviso and André Martins for helpful discussions about their prior work and help with understanding their code. + +# References + +[1] Michael Arbel and Arthur Gretton. Kernel conditional exponential family. In International Conference on Artificial Intelligence and Statistics, pages 1337-1346. PMLR, 2018. +[2] Nachman Aronszajn. Theory of reproducing kernels. Transactions of the American mathematical society, 68(3):337-404, 1950. +[3] Dzmitry Bahdanau, Kyung Hyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In 3rd International Conference on Learning Representations, ICLR 2015, 2015. +[4] Stéphane Canu and Alex Smola. Kernel methods and the exponential family. Neurocomputing, 69(7-9):714-720, 2006. +[5] Krzysztof Marcin Choromanski, Valerii Likhosherstov, David Dohan, Xingyou Song, Andreea Gane, Tamas Sarlos, Peter Hawkins, Jared Quincy Davis, Afroz Mohiuddin, Lukasz Kaiser, et al. Rethinking attention with performers. In International Conference on Learning Representations, 2020. +[6] Bo Dai, Hanjun Dai, Arthur Gretton, Le Song, Dale Schuurmans, and Niao He. Kernel exponential family estimation via doubly dual embedding. In The 22nd International Conference on Artificial Intelligence and Statistics, pages 2321-2330. PMLR, 2019. +[7] Hoang Anh Dau, Anthony Bagnall, Kaveh Kamgar, Chin-Chia Michael Yeh, Yan Zhu, Shaghayegh Gharghabi, Chotirat Ann Ratanamahatana, and Eamonn Keogh. The ucr time series archive. IEEE/CAA Journal of Automatica Sinica, 6(6):1293-1305, 2019. +[8] António Farinhas, André FT Martins, and Pedro MQ Aguiar. Multimodal continuous visual attention mechanisms. In 2021 IEEE/CVF International Conference on Computer Vision Workshops (ICCVW), pages 1047-1056. IEEE, 2021. +[9] Ary L Goldberger, Luis AN Amaral, Leon Glass, Jeffrey M Hausdorff, Plamen Ch Ivanov, Roger G Mark, Joseph E Mietus, George B Moody, Chung-Kang Peng, and H Eugene Stanley. Physiobank, physioto toolkit, and physionet: components of a new research resource for complex physiologic signals. circulation, 101(23):e215–e220, 2000. +[10] Ian Goodfellow, *Yoshua Bengio*, and Aaron Courville. *Deep learning*. MIT press, 2016. +[11] Robert Israel (https://math.stackexchange.com/users/8508/robert_israel). Determine if $f(z) = \log(e^z + 1)$ is analytic and where. Mathematics Stack Exchange. URL: https://math.stackexchange.com/q/3060260, URL: https://math.stackexchange.com/q/3060260 (version: 2019-01-03). +[12] Mohammad Kachuee, Shayan Fazeli, and Majid Sarrafzadeh. Ecg heartbeat classification: A deep transferable representation. In 2018 IEEE International Conference on Healthcare Informatics (ICHI), pages 443-444. IEEE, 2018. +[13] Fazle Karim, Somshubra Majumdar, Houshang Darabi, and Shun Chen. Lstm fully convolutional networks for time series classification. IEEE access, 6:1662-1669, 2017. +[14] Yin Tat Lee. Lecture 19: Exponentially convergent trapezoidal rule. URL https://yintat.com/teaching/cse599-winter18/19.pdf +[15] Shiyang Li, Xiaoyong Jin, Yao Xuan, Xiyou Zhou, Wenhu Chen, Yu-Xiang Wang, and Xifeng Yan. Enhancing the locality and breaking the memory bottleneck of transformer on time series forecasting. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 32, pages 5243-5253. Curran Associates, Inc., 2019. URL https://proceedings.neurips.cc/paper/2019/file/6775a0635c302542da2c32aa19d86be0-Paper.pdf + +[16] Steven Cheng-Xian Li and Benjamin M Marlin. A scalable end-to-end gaussian process adapter for irregularly sampled time series classification. In D. Lee, M. Sugiyama, U. Luxburg, I. Guyon, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 29, pages 1804-1812. Curran Associates, Inc., 2016. URL https://proceedings.neurips.cc/paper/2016/file/9c01802ddb981e6bcfbec0f0516b8e35-Paper.pdf +[17] Yikuan Li, Shishir Rao, José Roberto Ayala Solares, Abdelaali Hassaine, Rema Ramakrishnan, Dexter Canoy, Yajie Zhu, Kazem Rahimi, and Gholamreza Salimi-Khorshidi. Behrt: transformer for electronic health records. Scientific reports, 10(1):1-12, 2020. +[18] Zhouhan Lin, Minwei Feng, Cicero Nogueira dos Santos, Mo Yu, Bing Xiang, Bowen Zhou, and Yoshua Bengio. A structured self-attentive sentence embedding. In International Conference on Learning Representations, 2017. URL https://openreview.net/forum?id=BJC_jUqxe. +[19] Jiayang Liu, Lin Zhong, Jehan Wickramasuriya, and Venu Vasudevan. uwave: Accelerometer-based personalized gesture recognition and its applications. Pervasive and Mobile Computing, 5(6):657-675, 2009. +[20] Andrew Maas, Raymond E Daly, Peter T Pham, Dan Huang, Andrew Y Ng, and Christopher Potts. Learning word vectors for sentiment analysis. In Proceedings of the 49th annual meeting of the association for computational linguistics: Human language technologies, pages 142-150, 2011. +[21] James Stephen Marron, James O Ramsay, Laura M Sangalli, and Anuj Srivastava. Functional data analysis of amplitude and phase variation. Statistical Science, pages 468-484, 2015. +[22] Andre Martins and Ramon Astudillo. From softmax to sparsemax: A sparse model of attention and multi-label classification. In International Conference on Machine Learning, pages 1614-1623. PMLR, 2016. +[23] André Martins, António Farinhas, Marcos Treviso, Vlad Niculae, Pedro Aguiar, and Mario Figueiredo. Sparse and continuous attention mechanisms. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 20989-21001. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper/2020/file/f0b76267fbe12b936bd65e203dc675c1-Paper.pdf +[24] André FT Martins, Marcos Treviso, António Farinhas, Pedro MQ Aguiar, Mário AT Figueiredo, Mathieu Blondel, and Vlad Niculae. Sparse continuous distributions and fenchel-young losses. Journal of Machine Learning Research, 23:1-74, 2022. +[25] Pedro Henrique Martins, Zita Marinho, and André FT Martins. $\infty$ -former: Infinite memory transformer-former: Infinite memory transformer. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 5468-5485, 2022. +[26] Sajad Mousavi and Fatemeh Afghah. Inter-and intra-patient ecg heartbeat classification for arrhythmia detection: a sequence to sequence deep learning approach. In ICASSP 2019-2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 1308-1312. IEEE, 2019. +[27] Jan Naudts. Estimators, escort probabilities, and-exponential families in statistical physics. JIPAM. Journal of Inequalities in Pure & Applied Mathematics [electronic only], 5(4):Paper-No, 2004. +[28] James O Ramsay and Xiaochun Li. Curve registration. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 60(2):351-363, 1998. +[29] Satya Narayan Shukla and Benjamin Marlin. Interpolation-prediction networks for irregularly sampled time series. In International Conference on Learning Representations, 2019. +[30] Satya Narayan Shukla and Benjamin Marlin. Multi-time attention networks for irregularly sampled time series. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=4c0J6lwQ4_ + +[31] Satya Narayan Shukla and Benjamin M Marlin. Heteroscedastic temporal variational autoencoder for irregularly sampled time series. International Conference on Learning Representations, 2022. +[32] Huan Song, Deepta Rajan, Jayaraman Thiagarajan, and Andreas Spanias. Attend and diagnose: Clinical time series analysis using attention models. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32, 2018. +[33] Bharath Sriperumbudur, Kenji Fukumizu, Arthur Gretton, Aapo Hyvarinen, and Revant Kumar. Density estimation in infinite dimensional exponential families. The Journal of Machine Learning Research, 18(1):1830-1888, 2017. +[34] Bharath K, Striperumbudur, Kenji Fukumizu, and Gert RG Lanckriet. Universality, characteristic kernels and rkhs embedding of measures. Journal of Machine Learning Research, 12(7), 2011. +[35] Elias M Stein and Rami Shakarchi. Complex analysis, volume 2. Princeton University Press, 2010. +[36] Dougal Sutherland, Heiko Strathmann, Michael Arbel, and Arthur Gretton. Efficient and principled score estimation with nystrom kernel exponential families. In International Conference on Artificial Intelligence and Statistics, pages 652-660. PMLR, 2018. +[37] Hiroki Suyari, M Tsukada, and Y Uesaka. Mathematical structure derived from tsallis entropy. In Proc. 4th Asia-Eur. Workshop Inf. Theory (AEW), pages 1-4, 2004. +[38] Michalis Titsias. Variational learning of inducing variables in sparse gaussian processes. In Artificial intelligence and statistics, pages 567-574. PMLR, 2009. +[39] Lloyd N Trefethen and JAC Weideman. The exponentially convergent trapezoidal rule. siam REVIEW, 56(3):385-458, 2014. +[40] Yao-Hung Hubert Tsai, Shaojie Bai, Makoto Yamada, Louis-Philippe Morency, and Ruslan Salakhutdinov. Transformer dissection: An unified understanding for transformer's attention via the lens of kernel. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 4344–4353, 2019. +[41] Constantino Tsallis. Possible generalization of boltzmann-gibbs statistics. Journal of statistical physics, 52(1):479-487, 1988. +[42] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pages 6000–6010, 2017. +[43] Shaojun Wang, Dale Schuurmans, and Yunxin Zhao. The latent maximum entropy principle. ACM Transactions on Knowledge Discovery from Data (TKDD), 6(2):1-42, 2012. +[44] Li Wenliang, Dougal Sutherland, Heiko Strathmann, and Arthur Gretton. Learning deep kernels for exponential family densities. In International Conference on Machine Learning, pages 6737-6746. PMLR, 2019. +[45] Da Xu, Chuanwei Ruan, Evren Korpeoglu, Sushant Kumar, and Kannan Achan. Self-attention with functional time representation learning. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 32, pages 15915–15925. Curran Associates, Inc., 2019. URL https://proceedings.neurips.cc/paper/2019/file/cf34645d98a7630e2bcca98b3e29c8f2-Paper.pdf +[46] George Zerveas, Srideepika Jayaraman, Dhaval Patel, Anuradha Bhamidipaty, and Carsten Eickhoff. A transformer-based framework for multivariate time series representation learning. In Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining, pages 2114-2124, 2021. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] +(c) Did you discuss any potential negative societal impacts of your work? [Yes] +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] +(b) Did you include complete proofs of all theoretical results? [Yes] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] We did it for three of our five experiments, where the datasets were small and sequence lengths were short: the synthetic time warping experiment, the FordA experiment and the uWave experiment. +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] We mention the type of resources used. These are relatively small scale experiments so we don't need to discuss total compute as environmental impacts are negligible. + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] +(b) Did you mention the license of the assets? [Yes] +(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [No] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/kernelmultimodalcontinuousattention/images.zip b/kernelmultimodalcontinuousattention/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..2c58fad548a1b6e7328991098b860532b84e2b17 --- /dev/null +++ b/kernelmultimodalcontinuousattention/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ad00b08906744274f80f7243e432efb1b593799a0e1a31150442147513e351c +size 264244 diff --git a/kernelmultimodalcontinuousattention/layout.json b/kernelmultimodalcontinuousattention/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..5c1d39a98db5cc2781b18e1b6979c864611e4e5f --- /dev/null +++ b/kernelmultimodalcontinuousattention/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:664f31c0d7d2fbedfa04602a0bd3cb73fea3bd6a2061b04793ee968bad64188d +size 571875 diff --git a/kernelsimilaritymatchingwithhebbiannetworks/21f8100a-86f1-4662-8d04-cf69c1d33b1d_content_list.json b/kernelsimilaritymatchingwithhebbiannetworks/21f8100a-86f1-4662-8d04-cf69c1d33b1d_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..c309f8af3576d10bf226bd37e7d2fb91f1324147 --- /dev/null +++ b/kernelsimilaritymatchingwithhebbiannetworks/21f8100a-86f1-4662-8d04-cf69c1d33b1d_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:37a8f3152ea283d2fb9a734f63e10753232b25ccf9567dbb24e3e7d5dba2fbde +size 77465 diff --git a/kernelsimilaritymatchingwithhebbiannetworks/21f8100a-86f1-4662-8d04-cf69c1d33b1d_model.json b/kernelsimilaritymatchingwithhebbiannetworks/21f8100a-86f1-4662-8d04-cf69c1d33b1d_model.json new file mode 100644 index 0000000000000000000000000000000000000000..63d32fcffbc9697c1eb764da42abcff7b68c1729 --- /dev/null +++ b/kernelsimilaritymatchingwithhebbiannetworks/21f8100a-86f1-4662-8d04-cf69c1d33b1d_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1461c8c53ece3d3720ea165ae0f74df9dee49d953b9928c1beb9178b826cdff2 +size 91091 diff --git a/kernelsimilaritymatchingwithhebbiannetworks/21f8100a-86f1-4662-8d04-cf69c1d33b1d_origin.pdf b/kernelsimilaritymatchingwithhebbiannetworks/21f8100a-86f1-4662-8d04-cf69c1d33b1d_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..46eb49917877841d1849d19ec0ed7731d90b9839 --- /dev/null +++ b/kernelsimilaritymatchingwithhebbiannetworks/21f8100a-86f1-4662-8d04-cf69c1d33b1d_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:381adfce19345ba948992996df39d7d514e9ad7f7b686c0c4bc328b52bdc4cd8 +size 1583684 diff --git a/kernelsimilaritymatchingwithhebbiannetworks/full.md b/kernelsimilaritymatchingwithhebbiannetworks/full.md new file mode 100644 index 0000000000000000000000000000000000000000..7a4c569ef93f7fd5d90ea1547a93efacc0279cdc --- /dev/null +++ b/kernelsimilaritymatchingwithhebbiannetworks/full.md @@ -0,0 +1,358 @@ +# Kernel similarity matching with Hebbian Networks + +Kyle Luther + +Princeton Neuroscience Institute kluther@princeton.edu + +H. Sebastian Seung + +Princeton Neuroscience Institute +Princeton Computer Science Department +sseung@princeton.edu + +# Abstract + +Recent works have derived neural networks with online correlation-based learning rules to perform kernel similarity matching. These works applied existing linear similarity matching algorithms to nonlinear features generated with random Fourier methods. In this paper we attempt to perform kernel similarity matching by directly learning the nonlinear features. Our algorithm proceeds by deriving and then minimizing an upper bound for the sum of squared errors between output and input kernel similarities. The construction of our upper bound leads to online correlation-based learning rules which can be implemented with a 1 layer recurrent neural network. In addition to generating high-dimensional linearly separable representations, we show that our upper bound naturally yields representations which are sparse and selective for specific input patterns. We compare the approximation quality of our method to neural random Fourier method and variants of the popular but non-biological "Nyström" method for approximating the kernel matrix. Our method appears to be comparable or better than randomly sampled Nyström methods when the outputs are relatively low dimensional (although still potentially higher dimensional than the inputs) but less faithful when the outputs are very high dimensional. + +# 1 Introduction + +Brain inspired learning algorithms have a long history in the field of neural networks and machine learning [Rosenblatt, 1958, Olshausen and Field, 1996, Lee and Seung, Riesenhuber and Poggio, 1999, Hinton, 2007, Lillicrap et al., 2016]. While many algorithms have diverged from their biological roots, the motivation to study biology remains clear: the human brain is such a powerful learning agent, there must be insights to be gained by making our algorithms look "brain-like". This paper is focused on merging biological constraints with the well-established field of kernel-based machine learning. + +A common assumption in brain-inspired models of learning is that synaptic update rules should be a) online, meaning the algorithm only has access to a single input pattern at a time and b) local, meaning synapses should only be modified using information immediately available to the synapse, often just the pre- and post-firing rates of the neurons to which it is connected. Learning rules with these properties are commonly referred to as Hebbian learning rules [Chklovskii, 2016]. + +Recent works have devised neural networks with Hebbian learning rules that perform linear similarity matching. These networks map every input $\mathbf{x}_t$ to a representation $\mathbf{y}_t$ such that linear output similarities match linear input similarities $\mathbf{y}_s\cdot \mathbf{y}_t\approx \mathbf{x}_s\cdot \mathbf{x}_t$ . These networks are interesting as models for real brains because they display a number of interesting biological properties: they are recurrent networks with correlation-based learning rules [Pehlevan et al., 2018] and can be modified to include non-negativity [Pehlevan and Chklovskii, 2014], sparsity, and convolutional structure [Obeid et al., 2019]. + +However there is a problem if one believes these networks should ultimately generate representations which are useful for downstream tasks. If similarities are actually matched, that is if $\mathbf{y}_s\cdot \mathbf{y}_t = \mathbf{x}_s\cdot \mathbf{x}_t$ + +then the outputs are simply an orthogonal transformation of the inputs, $\mathbf{y}_t = \mathbf{Q}\mathbf{x}_t$ , which is unlikely to have significant impact on downstream tasks. Bahroun et al. [2017] identified this problem and proposed a solution: instead of matching linear input similarities, one can match nonlinear input similarities: $\mathbf{y}_s \cdot \mathbf{y}_t \approx f(\mathbf{x}_s, \mathbf{x}_t)$ . The authors provided a method that can be applied to any shift-invariant kernel. They applied the random Fourier feature method of Rahimi et al. [2007] to map inputs to nonlinear feature vectors $\mathbf{x} \rightarrow \boldsymbol{\psi}$ and then applied the linear similarity matching framework of Pehlevan et al. [2018] to these nonlinear features. + +In this paper, we tackle the same neural kernel similarity matching problem with a different approach. Instead of using random nonlinear features, we directly optimize for the features with Hebbian learning rules that resemble the learning rules derived in the original works on linear similarity matching. To derive our learning rules, we show that for any kernel we can upper bound the sum of squared errors $|\mathbf{y}_s \cdot \mathbf{y}_t - f(\mathbf{x}_s, \mathbf{x}_t)|^2$ with a correlation-based energy. Gradient-based optimization of our upper bound with will lead to a neural network with correlation-based learning rules. + +# 2 Correlation-based bound for kernel similarity matching + +Roadmap for this section We first define the kernel similarity matching problem (Eq. 1). We then derive a correlation-based optimization (Eq. 6) which is an upper bound for to Eq. 1 (up to a constant that does not depend on the representations). We then use a Legendre transform to derive an equivalent (except for the numerical stability parameter $\lambda$ ) optimization problem in Eq. 9 that will lend itself towards online updates. + +Kernel similarity matching Assume we are given a set of input vectors $\{\mathbf{x}^t\in \mathbb{R}^M\}_{t = 1}^T$ and a positive semi-definite kernel function $f:\mathbb{R}^{M}\times \mathbb{R}^{M}\to \mathbb{R}$ which defines the similarity between input vectors. The goal is to find a corresponding set of representations $\{\mathbf{y}^t\in \mathbb{R}^N\}_{t = 1}^T$ such that for all pairs $(s,t)$ we have $\mathbf{y}^s\cdot \mathbf{y}^t\approx f(\mathbf{x}^s,\mathbf{x}^t)$ . We will assume that $T\gg N > M$ : the dimensionalities of $\mathbf{x},\mathbf{y}$ are much lower than the number of samples $T$ , but $\mathbf{y}$ are still higher dimensional than the inputs. This is formalized by minimizing the sum of squared errors: + +$$ +\min _ {\left\{\mathbf {y} ^ {t} \right\}} \frac {1}{T ^ {2}} \sum_ {s, t} ^ {T} \left[ f \left(\mathbf {x} ^ {s}, \mathbf {x} ^ {t}\right) - \mathbf {y} ^ {s} \cdot \mathbf {y} ^ {t} \right] ^ {2} \tag {1} +$$ + +This is known as the classical multidimensional scaling objective [Borg and Groenen, 2005]. For arbitrary nonlinearity $f$ this can be solved exactly by finding the top $N$ eigenvectors of the $T \times T$ input similarity matrix [Borg and Groenen, 2005], and is therefore closely related to kernel PCA [Scholkopf et al., 1997]. However, this requires computing and storing similarities for all pairs of input vectors which breaks the online constraint that we require for biological realism. The purpose of this paper is to find an online algorithm, with correlation-based computations, that can at least approximately minimize Eq. 1. + +Correlation based upper bound In this section we provide an upper bound to Eq. 1 which does not require computing $f(\mathbf{x}_s, \mathbf{x}_t)$ for any $(s, t)$ . The first step is to expand the square in Eq (1) to yield: + +$$ +\frac {1}{T ^ {2}} \sum_ {s, t} ^ {T} [ f (\mathbf {x} ^ {s}, \mathbf {x} ^ {t}) - \mathbf {y} ^ {s} \cdot \mathbf {y} ^ {t} ] ^ {2} = - \frac {2}{T ^ {2}} \sum_ {s, t} f (\mathbf {x} ^ {s}, \mathbf {x} ^ {t}) \mathbf {y} ^ {s} \cdot \mathbf {y} ^ {t} + \frac {1}{T ^ {2}} \sum_ {s, t} (\mathbf {y} ^ {s} \cdot \mathbf {y} ^ {t}) ^ {2} + \text {c o n s t} \tag {2} +$$ + +We will now show how to bound the first term on the right hand side. + +Theorem 1. If $f$ is a positive semidefinite kernel function, then + +$$ +\frac {1}{2 T ^ {2}} \sum_ {s, t} y ^ {s} y ^ {t} f \left(\mathbf {x} ^ {s}, \mathbf {x} ^ {t}\right) \geq \frac {1}{T} \sum_ {t} q y ^ {t} f \left(\mathbf {x} ^ {t}, \mathbf {w}\right) - \frac {1}{2} q ^ {2} f (\mathbf {w}, \mathbf {w}) \tag {3} +$$ + +for all $q$ and $\mathbf{w}$ + +Proof. Because $f$ is a positive semi-definite kernel, we can assign to any set of $M$ -dimensional vectors $\{\mathbf{w},\mathbf{x}_1,\dots ,\mathbf{x}_T\}$ , a corresponding set of (at most) $T + 1$ -dimensional vectors $\{\phi_{\mathbf{w}},\phi_1,\ldots ,\phi_T\}$ whose inner products yield the similarity defined by $f$ : + +$$ +\phi_ {t} \cdot \phi_ {t ^ {\prime}} = f (\mathbf {x} _ {t}, \mathbf {x} _ {t ^ {\prime}}) \quad \phi_ {t} \cdot \phi_ {\mathbf {w}} = f (\mathbf {x} _ {t}, \mathbf {w}) \quad \phi_ {\mathbf {w}} \cdot \phi_ {\mathbf {w}} = f (\mathbf {w}, \mathbf {w}) \tag {4} +$$ + +![](images/10daa12d01434d9c2575456c257c65ba2fdfa8e48da2b8e80b8dac6236d8c9dc.jpg) +(a) network architecture +(b) recurrent network dynamics +(c) steady state network output +Figure 1: Neural network implementation of the optimization in Eq. 9 (a) network architecture (b) recurrent network dynamics (c) steady state network response (d) Hebbian update rules for the special case of Gaussian kernels (the precise form of these updates will be depend on the kernel) + +$$ +\dot {y _ {i} ^ {t}} = q _ {i} f (\boldsymbol {w} _ {i}, \boldsymbol {x} ^ {t}) - \sum_ {j} L _ {i j} y _ {j} ^ {t} - \lambda y _ {i} ^ {t} +$$ + +$$ +y _ {i} ^ {t} = \sum_ {j} f (\boldsymbol {w} _ {i}, \boldsymbol {x} ^ {t}) q _ {j} [ (\boldsymbol {L} + \lambda \boldsymbol {I}) ^ {- 1} ] _ {i j} +$$ + +$$ +f (\boldsymbol {u}, \boldsymbol {v}) = e ^ {- \gamma \| \boldsymbol {u} - \boldsymbol {v} \| ^ {2}} +$$ + +![](images/66ac84a1015c74b240cf3817176b5d163f71daa760102bcc65b88ab8e8684561.jpg) +(d) Hebbian update rules for Gaussian kernel + +$$ +\dot {W} _ {i a} \propto [ y _ {i} f _ {i} ^ {\prime} ] x _ {a} - [ y _ {i} f _ {i} ^ {\prime} ] W _ {i a} +$$ + +$$ +\dot {q} _ {i} \propto y _ {i} f _ {i} - q _ {i} +$$ + +$$ +\dot {L} _ {i j} \propto y _ {i} y _ {j} - L _ {i j} +$$ + +Now consider the vector difference $\frac{1}{T}\sum_{t}y_{t}\phi_{t} - q\phi_{w}$ . The squared norm of this difference is of course non-negative. Additionally we can expand out this square: + +$$ +0 \leq \frac {1}{2} \left\| \frac {1}{T} \sum_ {t} y _ {t} \phi_ {t} - q \phi_ {\mathbf {w}} \right\| ^ {2} = \frac {1}{2 T ^ {2}} \sum_ {s, t} y _ {s} y _ {t} \phi_ {s} \cdot \phi_ {t} - \frac {1}{T} \sum_ {t} q y _ {t} \phi_ {t} \cdot \phi_ {\mathbf {w}} + \frac {1}{2} q ^ {2} \phi_ {\mathbf {w}} \cdot \phi_ {\mathbf {w}} \tag {5} +$$ + +At this point we can simply replace all dot products with the equivalent nonlinear similarities $f(\cdot, \cdot)$ in Equation 4 and rearrange the terms to yield our key inequality (Eq. 3). + +Our inequality (Eq. 3) still holds if we maximize the right hand side with respect to $q$ and $\mathbf{w}$ . For every index $i$ of $\mathbf{y}$ , we find the optimal $\mathbf{w}_i, q_i$ , and then replace the first pairwise sum in Eq. (2) with our upper bounds. Additionally we rearrange the order of the summations in second term on the right hand side of Eq. (2) to yield the following upper bound for the $y$ -dependent terms in Eq. (2): + +$$ +\min _ {\mathbf {y} ^ {t}} \min _ {q _ {i}, \mathbf {w} _ {i}} - \frac {1}{T} \sum_ {t = 1} ^ {T} \sum_ {i = 1} ^ {N} \left[ q _ {i} y _ {i} ^ {t} f \left(\mathbf {w} _ {i}, \mathbf {x} ^ {t}\right) - \frac {1}{2} q _ {i} ^ {2} f \left(\mathbf {w} _ {i}, \mathbf {w} _ {i}\right) \right] + \frac {1}{4} \sum_ {i, j = 1} ^ {N} \left(\frac {1}{T} \sum_ {t = 1} ^ {T} y _ {i} ^ {t} y _ {j} ^ {t}\right) ^ {2} \tag {6} +$$ + +Online focused reformulation We can further remove the square of the correlation matrix $\frac{1}{T}\sum_{t}y_{i}^{t}y_{j}^{t}$ (another impediment to online learning) by introducing a Legendre transformation: $\frac{1}{2} C_{ij}^2\rightarrow \max_{L_{ij}}C_{ij}L_{ij} - \frac{1}{2} L_{ij}^2$ + +$$ +\min _ {\mathbf {W}, \mathbf {Y}, \mathbf {q}} \max _ {\mathbf {L}} \frac {1}{T} \sum_ {t = 1} ^ {T} \left[ - \sum_ {i = 1} ^ {N} \left[ q _ {i} y _ {i} ^ {t} f \left(\mathbf {w} _ {i}, \mathbf {x} ^ {t}\right) - \frac {1}{2} q _ {i} ^ {2} f \left(\mathbf {w} _ {i}, \mathbf {w} _ {i}\right) \right] + \frac {1}{2} \sum_ {i, j = 1} ^ {N} \left[ L _ {i j} y _ {i} ^ {t} y _ {j} ^ {t} - \frac {1}{2} L _ {i j} ^ {2} \right] \right] \tag {7} +$$ + +We can swap the order of the $y$ and $L$ optimizations, because the objective obeys the strong min-max property with $\mathbf{W}$ , $\mathbf{q}$ fixed (Appendix Section A of Pehlevan et al. [2018]). We add one final term $\frac{\lambda}{NT} \sum_{t=1}^{T} \sum_{i=1}^{N} (y_i^t)^2$ to the objective, which can be important for numerical stability of our resulting algorithm. In our experiments $\lambda = 0.001$ . Finally, to better motivate our online algorithm, we define the "per-sample-energy": + +$$ +e ^ {t} := \sum_ {i = 1} ^ {N} - \left[ q _ {i} y _ {i} ^ {t} f \left(\mathbf {w} _ {i}, \mathbf {x} ^ {t}\right) - \frac {1}{2} q _ {i} ^ {2} f \left(\mathbf {w} _ {i}, \mathbf {w} _ {i}\right) \right] + \frac {1}{2} \sum_ {i, j = 1} ^ {N} \left[ L _ {i j} y _ {i} ^ {t} y _ {j} ^ {t} - \frac {1}{2} L _ {i j} ^ {2} \right] + \frac {\lambda}{2} \sum_ {i = 1} ^ {N} (y _ {i} ^ {t}) ^ {2} \tag {8} +$$ + +where $e^t \coloneqq e(\mathbf{y}^t, \mathbf{x}^t; \mathbf{W}, \mathbf{q}, \mathbf{L})$ . The final optimization we will perform, which is equivalent to the optimization in Eq. 6, and is derived as an upper bound to Eq. 1, is thus: + +$$ +\min _ {\mathbf {W}, \mathbf {q}} \max _ {\mathbf {L}} \min _ {\mathbf {Y}} \frac {1}{T} \sum_ {t = 1} ^ {T} e \left(\mathbf {y} ^ {t}, \mathbf {x} ^ {t}; \mathbf {W}, \mathbf {q}, \mathbf {L}\right) \tag {9} +$$ + +# 3 Neural network optimization + +Applying a stochastic gradient descent-ascent algorithm to Eq. (9) yields a neural network (Fig. 1) in which $y_{i}^{t}$ is the response of neuron $i$ to input pattern $t$ , $\mathbf{w}_{i}$ is the vector of incoming connections to + +neuron $i$ from the input layer, $q_{i}$ is a term which modulates the strength of these incoming connections, and $L_{ij}$ is a matrix of lateral recurrent connections between outputs. + +Specifically for the neural algorithm we initialize $W_{ia} \gets \mathcal{N}(0,1)$ , $q_i \gets 1$ and $L_{ij} \gets \mathbf{I}_{ij}$ . At each iteration sample a minibatch of inputs $\{\mathbf{x}^b\}$ . Using Eq.12 we compute the $\{\mathbf{y}^b\}$ which minimize Eq. 9 for fixed synapses. Using these optimal $\{\mathbf{y}^b\}$ , we compute the minibatch energy $e = \frac{1}{B}\sum_{b}e(\mathbf{x}^{b},\mathbf{y}^{b};\mathbf{W},\mathbf{q},\mathbf{L})$ and take a gradient descent step for $\mathbf{q}$ , a rescaled gradient descent step for $\mathbf{w}$ and a gradient ascent step for $\mathbf{L}$ : + +$$ +\mathbf {w} _ {i} \leftarrow \mathbf {w} _ {i} - \frac {\eta_ {w}}{q _ {i} ^ {2}} \frac {\partial e}{\partial \mathbf {w} _ {i}} \quad q _ {i} \leftarrow q _ {i} - \eta_ {q} \frac {\partial e}{\partial q _ {i}} \quad L _ {i j} \leftarrow L _ {i j} + \eta_ {l} \frac {\partial e}{\partial L _ {i j}} \tag {10} +$$ + +Convergence of the neural algorithm We treat convergence of this gradient descent ascent algorithm as an empirical issue. We adopt the "two time scale" strategy that has shown empirical successes for training generative adversarial networks [Heusel et al., 2017]. We choose the learning rates such that $\eta_q, \eta_w \ll \eta_l$ . Intuitively when choosing $\eta_l$ to be large, the $L_{ij}$ can approximately maximize Eq. 9 for any particular $\mathbf{q}$ , $\mathbf{W}$ so that the min-max ordering is roughly preserved. In practice this ratio is important for convergence. We do not observe convergence when the ratios $\eta_w / \eta_l$ or $\eta_q / \eta_l$ are large. Unfortunately it is an empirical question of what is "too large". If we could show that the objective were concave in $L$ , it can be gradient descent ascent with smaller learning rates for $W$ , $q$ would indeed converge to a saddle point [Lin et al., 2020, Seung, 2019]. However, this question will have to be left for future work. + +Empirically it is sometimes observed that $q_{i}$ quickly shrinks to a small value early in training, which subsequently leads to small gradients for $\mathbf{w}$ . The rescaling of the $\mathbf{w}_{i}$ updates provides an adaptive learning rate that appeared to improve training times in practice. We have attached the main portion of the training code, written using PyTorch, in the appendix. + +# 3.1 Network dynamics + +Assuming fixed parameters $\mathbf{q},\mathbf{W},\mathbf{L}$ , the gradient for $\mathbf{y}$ can be computed for any input pattern $\mathbf{x}$ . Gradient descent can be used to perform the inner loop minimization in Equation 9: + +$$ +\dot {y} _ {i} = \eta_ {y} \left[ q _ {i} f \left(\mathbf {w} _ {i}, \mathbf {x}\right) - \sum_ {j = 1} ^ {N} L _ {i j} y _ {j} - \lambda y _ {i} \right] \tag {11} +$$ + +Like previous works on linear similarity matching, these dynamics can be interpreted as the dynamics of a one-layer recurrent neural network with all-to-all inhibition $\sum_{j=1}^{N} L_{ij} y_j$ between units. A diagram of this network is shown in Figure 1. Note that we can analytically perform the inner loop minimization with a non-neural algorithm: + +$$ +y _ {i} \leftarrow \sum_ {j} \left[ \mathbf {L} + \lambda \mathbf {I} \right] _ {i j} ^ {- 1} q _ {j} f (\mathbf {w} _ {j}, \mathbf {x}) \tag {12} +$$ + +This is useful both conceptually and for speeding up the training process in our experiments. This formula shows us that $\mathbf{y}$ is a linear function of the non-linear feedforward input $f(\mathbf{w}_i, \mathbf{x}_t)$ . This is different from Seung and Zung [2017], Pehlevan and Chklovskii [2014] where the neurons are non-linear functions (due to non-negativity constraints) of linear feedforward input $\mathbf{w}_i \cdot \mathbf{x}_t$ . + +# 3.2 Synaptic learning rules: arbitrary kernel + +In the previous section we saw how the $\mathbf{W}$ could be interpreted as feedforward synapses, $\mathbf{q}$ as feedforward regulatory terms, $\mathbf{L}$ as inhibitory synapses. Gradient descent on $\mathbf{W},\mathbf{q}$ and gradient ascent on $\mathbf{L}$ provides an algorithm for performing the optimization in Equation 9. At each step, we compute the optimal $\mathbf{y}$ . For simplicity, we consider the case with a single input, in which case we drop the index $b$ on $\mathbf{x}^b,\mathbf{y}^b$ . The stochastic gradients for $\mathbf{W}$ lead to the update: + +$$ +\Delta \mathbf {w} _ {i} \propto y _ {i} \partial f (\mathbf {w} _ {i}, \mathbf {x}) / \partial \mathbf {w} _ {i} - q _ {i} \partial f (\mathbf {w} _ {i}, \mathbf {w} _ {i}) / \partial \mathbf {w} _ {i} \tag {13} +$$ + +Classically Hebbian rules have been defined so that the update is linear in the input $\mathbf{x}$ (although they can be nonlinear in the output $\mathbf{y}$ which is a function of $\mathbf{x}$ ) (Eq. 1 of Brito and Gerstner [2016]). This + +![](images/7d6defdf763c9c54a97b3d0febb09f01d40f4c624026b0e9c0306868b8b8ee29.jpg) +Figure 2: Overview of our Hebbian radial basis function network on the half moons dataset (a) dataset, (b) features $\{\mathbf{w}_i\}_{i=1}^{16}$ (c,d,e) response profiles of 3 neurons. + +![](images/d718c82ff37a0d2d6912a2768760b4c1ec89c92b288016cfa26aaed03ac3f533.jpg) + +![](images/c7a8c8e63d48fc9f187ab66fd765272228d2755e0e92a308f5c721a35a2668e9.jpg) + +![](images/fe7e0d245f8f259eca936104edb4d7a20118727e88d8b3a10a94ed4cf007b31d.jpg) + +![](images/b9914232f07f8e74c851c0dc650d2b4bfbc42b3a7f828b3af955ffbcabb5595d.jpg) + +rule is more general as it is a nonlinear function of the input vector $\partial f(\mathbf{w}_i,\mathbf{x}) / \partial \mathbf{w}_i = h(\mathbf{x},\mathbf{w}_i)$ . However we note that the spirit of Hebb is still here as this is an online, local, correlation-based learning rule. + +The regulatory terms (essentially controlling the magnitude of the strength of feedforward input) can be updated with: + +$$ +\Delta q _ {i} \propto y _ {i} f (\mathbf {w} _ {i}, \mathbf {x}) - f (\mathbf {w} _ {i}, \mathbf {w} _ {i}) q _ {i} \tag {14} +$$ + +Here we have the correlation between the feedforward input and the neurons response. Finally gradients for the inhibitory synapses are: + +$$ +\Delta L _ {i j} \propto y _ {i} y _ {j} - L _ {i j} \tag {15} +$$ + +This is exactly the same "anti-hebbian" update seen in previous linear similarity matching works. Pehlevan et al. [2018]. The inhibition grows in strength as the correlation between neurons grows. + +# 3.3 Synaptic learning rules: radial basis function kernel + +Before moving on, we'll consider the form of the update rules in Eq. 13,14 when the kernel is a radial basis function, i.e. when the kernel is a function of the Euclidean distance. For simplicity we'll also assume the kernel is normalized so that $f(\mathbf{v},\mathbf{v}) = 1$ : + +$$ +f (\mathbf {u}, \mathbf {v}) := g \left(\left\| \mathbf {u} - \mathbf {v} \right\|\right) \quad \text {a n d} \quad g (0) = 1 \tag {16} +$$ + +In this case we get the gradient updates for $\mathbf{w}_i, q_i$ : + +$$ +\Delta \mathbf {w} _ {i} \propto \left[ y _ {i} g _ {i} ^ {\prime} \right] \mathbf {x} - \left[ y _ {i} g _ {i} ^ {\prime} \right] \mathbf {w} \quad \Delta q _ {i} \propto y _ {i} g _ {i} - q _ {i} \tag {17} +$$ + +The update for $\mathbf{w}_i$ is proportional to the input $\mathbf{x}$ , but modulated by the output response $(y_i)$ and a function of the feedforward input $(g_i')$ . The updates for $L_{ij}$ do not depend on the form of the kernel. + +# 4 Experiments + +We train networks using a Gaussian kernel for the half moons dataset and a "power-cosine" kernel (defined in section 4.2) for the MNIST dataset. We compare the approximation error (Eq. 1) of our method to the approximation error given by a) the optimal eigenvector-based solution (which we label as kernel PCA) b) Nyström approximation with uniformly sampled landmarks c) Nyström approximation using KMeans to generate the landmarks d) Nyström approximation using our generated features $(w_{i})$ as the landmarks and e) random Fourier feature method (This method is not applicable to the cosine-based kernel we use for the MNIST dataset). The "dimensionality" refers to the number of components for the PCA method, the number of landmarks for the Nyström methods, and the number of Fourier features for the Fourier method. See the appendix for more details regarding each of these 5 methods. Method (e) is the only other explicitly neural method. + +# 4.1 Half Moons Dataset + +We train our algorithm on a simple half moons dataset (which can be generated with Pedregosa et al. [2011]), shown in Figure 2. It consists of 1600 input vectors $\mathbf{x} = [x_1, x_2]$ drawn from a distribution of two noisy interleaving half circles. We use a Gaussian kernel with $\sigma = 0.3$ to measure input + +![](images/b64ec8ce9adac1eac9f70310375f30baa72fb0c06bf3312c0e648b6061ffaadd.jpg) +Figure 3: Approximation error vs. dimensionality for the half moons dataset with the Gaussian kernel (a) learned features for $n = 4, 16, 64$ (b) input-output similarities for 16 dimensional networks (c) normalized root-mean-square error between true kernel matrix and various approximation methods. The neural method (dashed blue) that we derive in Section 3 performs well for $n <= 16$ , but the approximation actually gets worse as we increase the dimensionality. + +![](images/06729350e8cfc6fd678b4c9b6c805b668ca183fb68e5c0ab748c14f9ce4bc198.jpg) + +![](images/cb1af8f990c5119cd63cbf8763f4e0701f6bb29d8efb4e84a4467cbb58bd4db8.jpg) + +similarities: $f(\mathbf{u}, \mathbf{v}) = e^{-\frac{\|\mathbf{u} - \mathbf{v}\|^2}{2\sigma^2}}$ . We vary the number of neurons $n \in \{2, 4, 8, 16, 32, 64\}$ . See the appendix for training details. + +Emergence of sparse, template-tuned neurons In Fig. 2 we show the learned features $\{\mathbf{w}_i\}$ when we train our algorithm with 16 neurons. We observe that the features appear to tile the input space. We also show the tuning properties of 3 of the output neurons over the dataset. To generate these figures, we color code each sample in the dataset with the response of neuron $y_{i}$ . Gray indicates zero response, red indicates a positive response and blue indicates a negative response. We observe that neurons appear to respond with large positive values centered around a small localized region of the input dataset. The features closely resemble the cluster centers returned by KMeans. + +Kernel approximation error In panel (a) of Fig. 3 we show the learned features for $n = \{4,16,64\}$ . In panel (b) we plot the input similarities vs. output similarities generated by our neural algorithm with 16 dimensional outputs. In panel (c), we plot the normalized mean squared error for our method compared to random Fourier features Rahimi et al. [2007], orthogonal Fourier features Yu et al. [2016], Nyström methods, and kernel PCA. The neural method of Bahroun et al. [2017] gives equivalent results to the random Fourier method. Kernel PCA is optimal, but non-neural. + +We observe that for small dimensionality ( $n \leq 16$ ) our method actually seems to marginally outperform the Nyström+KMeans method, which outperforms the Nyström+randomly sampled landmarks method. Additionally, using the Nyström approximation with our features seems to be uniformly better than the representations we generate with the neural net. Essentially, our algorithm learns useful landmarks, but for most faithful representation, it is better to just throw away the neural responses and simply use the Nyström approximation with our landmarks. It is worth mentioning that as you increase the dimensionality higher, the Random Fourier method ultimately does converge to zero error, unlike our method. + +Utility of representations evaluated by KMeans clustering In Fig. 4 we visualize the principle components of the inputs $\mathbf{x}$ and 16D representations $\mathbf{y}$ . Of course, the principle components of $\mathbf{x}$ are not too interesting, they are just a reflected version of the original 2D dataset. The top two components of $\mathbf{y}$ are more linearly separable than the inputs and this indicates that a strong nonlinear transformation has been applied to the inputs. Additionally, we run KMeans on $\mathbf{x}$ and on $\mathbf{y}$ (we use the implementation of scikit-learn, and take the lowest energy solution using 100 inits). We observe that the clustering yields the nearly perfect labels when performed on $\mathbf{y}$ . The kernel similarity matching vectors appear to be better suited for downstream learning tasks than the original inputs. + +# 4.2 MNIST Dataset + +We train our algorithm on the MNIST handwritten digits dataset LeCun [1998]. The dataset consists of 70,000 images of $28 \times 28$ handwritten digits, which we cropped by 4 pixels on each side to yield $20 \times 20$ images (which become 400 dimensional inputs). We use kernels of the form $f(\mathbf{u},\mathbf{v}) = \|\mathbf{u}\| \|\mathbf{v}\| (\hat{\mathbf{u}} \cdot \hat{\mathbf{v}})^{\alpha}$ and varying number of neurons. Training details are provided in the appendix. + +![](images/8daf1c43e21ab8d6c49af687a73f69bc2efb26b70a03c3f1508b86f98c4d72ee.jpg) +Figure 4: Utility of kernel similarity matching for downstream tasks. (a) principle components of the input vectors $\mathbf{x}$ (b) principle components of the 16 dimensional neural representations $\mathbf{y}$ (c) clustering generated by kmeans on $\mathbf{x}$ (d) clustering generated by kmeans on $\mathbf{y}$ . For (a,b) the colors are given by ground truth labels while in (c,d) the colors are given by the KMeans clustering. + +![](images/376fe7f7c95c38d71d795fae765995523567d061cc590d858d282bf1441a16d3.jpg) + +![](images/3269c0a88ffe17f1c339c93530dc550827afda458966c44830977df0d6bf4ee5.jpg) + +![](images/8799461d42e03d8f745aba1d494fd8d5d21ee9ec9b9c173ed22004d5dd4e1e7c.jpg) + +![](images/185610ee5780713f9c691c5920a7a93cc47781dad3f4e08d4e25a79fe3dc548e.jpg) +MNIST approximation error vs. dimensionality + +![](images/610b7bf6c14d42bbe1572cd7e7414645e181ee592a201e1b6b6e0668bc730595.jpg) +Figure 5: Approximation error vs. dimensionality for the MNIST dataset. (a) $f(\mathbf{u}, \mathbf{v}) = \mathbf{u} \cdot \mathbf{v}$ (linear kernel) (b) $f(\mathbf{u}, \mathbf{v}) = \| \mathbf{u} \| \| \mathbf{v} \| (\hat{\mathbf{u}} \cdot \hat{\mathbf{v}})^3$ (a nonlinear kernel). For the linear kernel all methods give relatively small approximation error once $n > 100$ . Although yet again we see that the neural method does not continue to decrease as the dimensionality increases beyond 200, even in the linear setting. + +The linear kernel is recovered by setting $\alpha = 1$ . We are not aware of other works using this exact "power-cosine" kernel before, however it is motivated by the *arccosine* kernel studied in the context of wide random ReLU networks [Cho and Saul, 2009]. An important property of our kernel network is the linear input-output scaling, meaning that rescaling an input $\mathbf{x}' \gets a\mathbf{x}$ will cause the corresponding representation to also be rescaled by the same factor $\mathbf{y}' \gets a\mathbf{y}$ . This will allow our nonlinear networks to have the same "contrast-invariant-tuning" properties that are thought to be displayed by simple cells in cat visual cortex [Skottun et al., 1987]. + +Approximation error We display the normalized approximation errors for $\alpha = 1$ and $\alpha = 3$ in Fig. 5. For the linear kernel $(\alpha = 1)$ all methods yield a relatively small error even for low dimensionality. An error of 0.01 is hard to see by eye when plotting input-output similarity scatter plots as done in Fig. 3. For both $\alpha = 1, 3$ we observe again a strange behavior of our method: it seems to "bottom out" and the error stops decreasing and even begins to increase as the dimensionality increases. This may be related to unstable convergence properties of gradient descent ascent. + +For $\alpha = 3$ we observe that the kernel PCA method largely outperforms all methods. We observe that Nyström with either our features or KMeans appears to outperform sampled Nyström methods. The sampled Nyström method is worse than our representations for low dimensionality but eventually catches up and surpasses ours neural representations. + +Emergence of sparse representations We train networks with $\alpha = \{1,2,3,4\}$ and $n = 800$ neurons (so the output dimensionality is exactly $2x$ the input dimensionality). There is a sign degeneracy when $\alpha$ is odd: we can multiply both $\mathbf{w}_i$ and $y_i$ by $-1$ and the objective is unchanged. When we look at the response histogram for single neurons, we observe that for $\alpha = 3$ , the response tends to be heavily skewed so that when the response has a high magnitude, it is either always positive or + +![](images/3012c84974a655fc548ae2c5239451167f444039c7cc30ae14c9dc9ee98898f6.jpg) +Figure 6: (a) response distribution (after the procedure we describe in the text for removing the sign degeneracy). The nonlinear kernels $(\alpha = 2,3,4)$ naturally give rise to sparse distributions. (b) test set accuracy of a linear classifier classification for MNIST (c) train set accuracy of the corresponding linear classifier. Interestingly all nonlinear kernels give nearly identical train and test set results. The linear kernel gives nearly identical results to simply training the classifier directly on the pixels. + +![](images/12f066722f834c7c2df0296cb9880ddbf7d2ea812c49957205d55b983ca78723.jpg) + +![](images/ccea6d1f4210acd4b2d52ca5118db028aa9d0fdc8a10401d5bd819e2d523e97a.jpg) + +always negative. We remove this degeneracy by multiplying both $\mathbf{w}_i$ and $y_{i}$ by the sign of $\langle y_i\rangle$ . After removing this degeneracy we plot the neuron responses over all patterns in Figure 6. + +For $\alpha = 1$ (linear neurons), neuron responses are roughly centered around zero: neuron responses are neither sparse nor skewed. For $\alpha = 2,3,4$ , neurons appear to have a heavy tailed distribution, they frequently have small responses, but occasionally have large positive responses. Neurons become increasingly sparse and heavy tailed as we increase $\alpha$ , although this effect is not that strong. + +Evaluating the representations via linear classification We train a linear classifier on the inputs $(\mathbf{x})$ and the outputs $(\mathbf{y})$ for $\alpha = 1,2,3,4$ and $n = 800$ . We train every configuration using $k \in \{1,3,10,30,100,300,1000,3000\}$ labels per class. We train all configurations with a weight decay parameter $\lambda \in \{1e - 5,1e - 4,1e - 3,1e - 2,1e - 1,1\}$ which yields the highest test accuracy. We average the accuracy for every configuration over 5 random seeds. The results are shown in Fig. 6. + +As expected, the performance of the inputs and $\alpha = 1$ (linear similarity matching) is nearly identical on both test and train sets. Surprisingly, the test performance of $\alpha = 2, 3, 4$ is nearly identical. Perhaps these curves can be partially explained by the spectra of the output similarity matrix which we show in Figure ?? of the Appendix. While the shapes of the spectra are different in every case, $\alpha = 1$ has roughly 200 nonzero eigenvalues while $\alpha = 2, 3, 4$ all have nearly 800 nonzero eigenvalues. Perhaps the number of nonzero eigenvalues is more influential for the linear classification performance than the detailed shapes of these spectra. + +# 5 Related work + +Kernel similarity matching with random Fourier features The most closely related work to ours is kernel similarity matching with random Fourier features [Bahroun et al., 2017]. The key difference between our methods is that instead of learning the features $\mathbf{w}$ , they use random Fourier features to directly generate nonlinear feature vectors $\phi^t = \sqrt{2 / n} \cos(\mathbf{W} \mathbf{x}^t + \mathbf{b})$ which they then feed into a standard linear similarity matching network. This leads them to a different architecture (one feedforward layer + one recurrent layer, instead of our single recurrent layer net) and a different set of learning rules. A benefit of the random feature approach is that it will theoretically lead to perfect matching, so long as the number of random features is sufficiently large. + +However, the feature learning aspect of our algorithm naturally led to a sparse set of responses which lends our model an added degree of biological plausibility. Additionally, our method generalizes to non-shift invariant kernels and empirically it yields better approximation error when the dimensionality of the output is sufficiently low. Our method can be seen as a biased method for approximation, which can be useful when the dimensionality is low, but ultimately will underperform compared to non-biased methods such as random Fourier methods or Nyström methods. + +Nyström Approximation While not obviously biological, Nyström methods are perhaps the most commonly used methods for approximating kernel matrices. The Nyström approximation uses a set of landmarks $\{\mathbf{w}_i : i = 1, 2, \dots, N\}$ to construct a low rank approximation of the original kernel matrix [Williams and Seeger, 2001]. To more clearly see the relationship between this method to ours, one can slightly modify the original formulation to generate "Nyström features": + +$$ +\text {‘ N y s t r o m f e a t u r e s ”} \quad y _ {j} ^ {t} = \sum_ {i} f \left(\mathbf {x} ^ {t}, \mathbf {w} _ {i}\right) M _ {i j} \text {w h e r e} M _ {i j} = \left[ \left(\mathbf {B} ^ {\dagger}\right) ^ {1 / 2} \right] _ {i j} \text {a n d} B _ {i j} = f \left(\mathbf {w} _ {i}, \mathbf {w} _ {j}\right) \tag {18} +$$ + +$\mathbf{B}^{\dagger}$ indicates the pseudo-inverse. Multiplying two such vectors togethers yields the Nyström approximation $\hat{F}_{st} = \mathbf{y}^{s}\cdot \mathbf{y}^{t} = \sum_{ij}f(\mathbf{x}^{s},\mathbf{w}_{i})[\mathbf{B}^{\dagger}]_{ij}f(\mathbf{x}^{t},\mathbf{w}_{j})$ . Our method produces representations of the same functional form but our $M$ matrix is derived from parameters learned by the correlations: + +$$ +\text {O u r f e a t u r e s} y _ {j} ^ {t} = \sum_ {i} f \left(\mathbf {x} ^ {t}, \mathbf {w} _ {i}\right) M _ {i j} \text {w h e r e} M _ {i j} = \left[ \mathbf {L} + \lambda \mathbf {I} \right] _ {i j} ^ {- 1} q _ {j} \tag {19} +$$ + +As measured by squared error, the Nyström approximation was actually a better approximation than our representations, when we used the same set of landmarks (Figs. 3, 5). The variation in Nyström methods primarily come from the method used to generate the landmarks. Two broad categories of landmark selection can be defined: template vs. pseudo-landmark. Template based approaches choose landmarks as a subset of the inputs $\mathbf{w} \in \{\mathbf{x}_1, \mathbf{x}_w, \dots, \mathbf{x}_T\}$ typically chosen via sampling schemes [Williams and Seeger, 2001, Drineas et al., 2005, Musco and Musco, 2017]. Pseudo-landmark approaches do not require the landmarks to be inputs. Zhang et al. [2008] used the cluster centers generated by KMeans as the landmarks. Fu [2014] formulate landmark selection as an optimization problem in the reproducing Hilbert space. Our method can be seen as a pseudo-template approach as our landmarks are directly generated via Hebbian learning rules and in general will not be exactly equal to any particular input pattern. Our method is similar in spirit to the approach of Fu [2014]. A key difference is that we use a different objective, a correlation-based upper bound to the sum of squared errors, which gives rise to correlation-based learning rules. + +# 6 Discussion + +We have extended the neural random Fourier feature method of Bahroun et al. [2017] for kernel similarity matching to instead be applicable to arbitrary differentiable kernels. Rather than using random nonlinear features, we learned the features with Hebbian learning rules. Both this work and that of Bahroun et al. [2017] can be seen as extensions of the linear similarity matching works written in Hu et al. [2014], Pehlevan and Chklovskii [2014], Pehlevan et al. [2015, 2018]. By using a nonlinear input similarity, the representations learned by our network are capable of learning high-dimensional nonlinear functions of the input, without requiring any constraints such as non-negativity. + +To our knowledge this is the first work that attempts to directly optimize the sum of squared errors in Eq. 1 without relying on sampling schemes or direct computation of the input similarity matrix. It would be interesting to relax the correlation-based constraint we have imposed on ourselves. This might allow for a variety of different types of bounds (Eq. 3) to be derived which in turn could lead to more faithful approximations than the one presented in our paper. + +Our work falls in line with an increasing body of literature that derives nonlinear Hebbian/local learning rules by starting with kernel/similarity matching measures Pogodin and Latham [2020], Nokland and Eidnes [2019]. A key contribution of our work is the use of an unsupervised objective, rather than a supervised objective, and a purely bottom up flow of information from pixels to features. + +The computational complexity of our method (after learning) is comparable to Nyström methods. Let $d$ be the input dimensionality and $D$ be the feature dimensionality. Then Nyström methods require computing the computational complexity of $Dd + D^3$ and random Fourier methods only require $Dd$ . Like Nyström, our proposed method requires $Dd + D^3$ if using the fast inverse method (eqn 12). Implementation of the proposed method with a recurrent network (Eq. 11) requires $Dd + D^3 K$ where $K$ is number of recurrent network iterations. + +A key obstacle faced by users of this algorithm is the stochastic gradient descent-ascent procedure. Empirically the convergence of our algorithm is quite sensitive to the learning rates. This method does not provide the same sorts of theoretical guarantees or empirically observed robustness of sampling + +based methods. Use of more robust descent-ascent optimization methods could be useful for making this class of algorithms more accessible for the practitioner. + +# Acknowledgements and Funding + +We would like to thank Lawrence Saul and Runzhe Yang for their helpful insights and discussions. + +This research was supported by the Intelligence Advanced Research Projects Activity (IARPA) via Department of Interior/ Interior Business Center (DoI/IBC) contract number D16PC0005, NIH/NIMH RF1MH117815, RF1MH123400. The U.S. Government is authorized to reproduce and distribute reprints for Governmental purposes notwithstanding any copyright annotation thereon. Disclaimer: The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of IARPA, DoI/IBC, or the U.S. Government. + +# References + +Yanis Bahroun, Eugénie Hunsicker, and Andrea Soltoggio. Neural networks for efficient nonlinear online clustering. In International Conference on Neural Information Processing, pages 316-324. Springer, 2017. +I. Borg and P. J. F. Groenen. Classical Scaling, pages 261-267. Springer New York, New York, NY, 2005. ISBN 978-0-387-28981-6. doi: 10.1007/0-387-28981-X_12. URL https://doi.org/10.1007/0-387-28981-X_12. +Carlos SN Brito and Wulfram Gerstner. Nonlinear hebbian learning as a unifying principle in receptive field formation. PLoS computational biology, 12(9):e1005070, 2016. +Dmitri Chklovskii. The search for biologically plausible neural computation: The conventional approach, 2016. URL http://www.offconvex.org/2016/11/03/MityaNN1/. +Youngmin Cho and Lawrence Saul. Kernel methods for deep learning. In Y. Bengio, D. Schuurmans, J. Lafferty, C. Williams, and A. Culotta, editors, Advances in Neural Information Processing Systems, volume 22. Curran Associates, Inc., 2009. URL https://proceedings.neurips.cc/paper/2009/file/5751ec3e9a4feab575962e78e006250d-Paper.pdf. +Petros Drineas, Michael W Mahoney, and Nello Cristianini. On the nyström method for approximating a gram matrix for improved kernel-based learning. *journal of machine learning research*, 6(12), 2005. +Zhouyu Fu. Optimal landmark selection for nystrom approximation. In Chu Kiong Loo, Keem Siah Yap, Kok Wai Wong, Andrew Teoh, and Kaizhu Huang, editors, Neural Information Processing, pages 311-318, Cham, 2014. Springer International Publishing. ISBN 978-3-319-12640-1. +Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. Advances in neural information processing systems, 30, 2017. +Geoffrey E Hinton. Boltzmann machine. Scholarpedia, 2(5):1668, 2007. +Tao Hu, Cengiz Pehlevan, and Dmitri B. Chklovskii. A hebbian/anti-hebbian network for online sparse dictionary learning derived from symmetric matrix factorization. In 2014 48th Asilomar Conference on Signals, Systems and Computers, pages 613-619, 2014. doi: 10.1109/ACSSC.2014.7094519. +Yann LeCun. The mnist database of handwritten digits. http://yann.lecun.com/exdb/mnist/, 1998. +Daniel D. Lee and H. Sebastian Seung. Learning the parts of objects by nonnegative matrix factorization. Nature, 401:788-791, 1999. +Timothy P Lillicrap, Daniel Cownden, Douglas B Tweed, and Colin J Akerman. Random synaptic feedback weights support error backpropagation for deep learning. Nature communications, 7(1): 1-10, 2016. + +Tianyi Lin, Chi Jin, and Michael Jordan. On gradient descent ascent for nonconvex-concave minimax problems. In International Conference on Machine Learning, pages 6083-6093. PMLR, 2020. +Cameron Musco and Christopher Musco. Recursive sampling for the nystrom method. In I. Guyon, U. Von Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017. URL https://proceedings.neurips.cc/paper/2017/file/a03fa30821986cff10fc66647c84c9c3-Paper.pdf. +Arild Nøkland and Lars Hiller Eidnes. Training neural networks with local error signals. In International conference on machine learning, pages 4839-4850. PMLR, 2019. +Dina Obeid, Hugo Ramambason, and Cengiz Pehlevan. Structured and deep similarity matching via structured and deep hebbian networks. In Proceedings of the 33rd International Conference on Neural Information Processing Systems, Red Hook, NY, USA, 2019. Curran Associates Inc. +B.A. Olshausen and D.J. Field. Emergence of simple-cell receptive field properties by learning a sparse code for natural images. Nature, 381:607-609, June 1996. +F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011. +Cengiz Pehlevan and Dmitri B. Chklovskii. A hebbian/anti-hebbian network derived from online non-negative matrix factorization can cluster and discover sparse features. In 2014 48th Asilomar Conference on Signals, Systems and Computers, pages 769-775, 2014. doi: 10.1109/ACSSC.2014.7094553. +Cengiz Pehlevan, Tao Hu, and Dmitri B. Chklovskii. A hebbian/anti-hebbian neural network for linear subspace learning: A derivation from multidimensional scaling of streaming data. Neural Computation, 27(7):1461-1495, 2015. doi: 10.1162/NECO_a_00745. +Cengiz Pehlevan, Anirvan M. Sengupta, and Dmitri B. Chklovskii. Why do similarity matching objectives lead to hebbian/anti-hebbian networks? Neural Computation, 30(1):84-124, 2018. doi: 10.1162/neco_a_01018. +Roman Pogodin and Peter Latham. Kernelized information bottleneck leads to biologically plausible 3-factor hebbian learning in deep networks. Advances in Neural Information Processing Systems, 33:7296-7307, 2020. +Ali Rahimi, Benjamin Recht, et al. Random features for large-scale kernel machines. In NIPS, volume 3, page 5. CiteSeer, 2007. +Maximilian Riesenhuber and Tomaso Poggio. Hierarchical models of object recognition in cortex. Nature neuroscience, 2(11):1019-1025, 1999. +Frank Rosenblatt. The perceptron: a probabilistic model for information storage and organization in the brain. Psychological review, 65(6):386, 1958. +Bernhard Scholkopf, Alexander Smola, and Klaus-Robert Müller. Kernel principal component analysis. In International conference on artificial neural networks, pages 583-588. Springer, 1997. +H. Sebastian Seung. Convergence of gradient descent-ascent analyzed as a newtonian dynamical system with dissipation, 2019. +H. Sebastian Seung and Jonathan Zung. A correlation game for unsupervised learning yields computational interpretations of hebbian excitation, anti-hebbian inhibition, and synapse elimination. CoRR, abs/1704.00646, 2017. URL http://arxiv.org/abs/1704.00646. +Bernt C Skottun, Arthur Bradley, Gary Sclar, Izumi Ohzawa, and Ralph D Freeman. The effects of contrast on visual orientation and spatial frequency discrimination: a comparison of single cells and behavior. Journal of neurophysiology, 57(3):773-786, 1987. + +Christopher Williams and Matthias Seeger. Using the nystrom method to speed up kernel machines. In T. Leen, T. Dietterich, and V. Tresp, editors, Advances in Neural Information Processing Systems, volume 13. MIT Press, 2001. URL https://proceedings.neurips.cc/paper/2000/file/19de10adbaa1b2ee13f77f679fa1483a-Paper.pdf. +Felix Xinnan X Yu, Ananda Theertha Suresh, Krzysztof M Choromanski, Daniel N Holtmann-Rice, and Sanjiv Kumar. Orthogonal random features. Advances in neural information processing systems, 29, 2016. +Kai Zhang, Ivor W Tsang, and James T Kwok. Improved nystrom low-rank approximation and error analysis. In Proceedings of the 25th international conference on Machine learning, pages 1232-1239, 2008. \ No newline at end of file diff --git a/kernelsimilaritymatchingwithhebbiannetworks/images.zip b/kernelsimilaritymatchingwithhebbiannetworks/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..c626e922b0641672a85aa121223da2d1f2ef97ef --- /dev/null +++ b/kernelsimilaritymatchingwithhebbiannetworks/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aeda205101d289eb13a1960bd3cbb84788d6971ecf40a18f0b341b8ffe6c2d84 +size 384897 diff --git a/kernelsimilaritymatchingwithhebbiannetworks/layout.json b/kernelsimilaritymatchingwithhebbiannetworks/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..e70d0b98457dc3eaf131255edba2cff673765fec --- /dev/null +++ b/kernelsimilaritymatchingwithhebbiannetworks/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6cf81519a38b4276cca1f47242b5eee78a456bb67f66b541984e34d57708a1c8 +size 448779 diff --git a/kerplekernelizedrelativepositionalembeddingforlengthextrapolation/7b4651c7-88bf-4ad1-8d4b-af4f5adc7837_content_list.json b/kerplekernelizedrelativepositionalembeddingforlengthextrapolation/7b4651c7-88bf-4ad1-8d4b-af4f5adc7837_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..1fb2dcf65cdf1998d32fa735e64a2768543bfaf9 --- /dev/null +++ b/kerplekernelizedrelativepositionalembeddingforlengthextrapolation/7b4651c7-88bf-4ad1-8d4b-af4f5adc7837_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1188f0cbef34b5133cacfbf828b441b1f1111b18d80e1e14ee9a206777440db7 +size 80473 diff --git a/kerplekernelizedrelativepositionalembeddingforlengthextrapolation/7b4651c7-88bf-4ad1-8d4b-af4f5adc7837_model.json b/kerplekernelizedrelativepositionalembeddingforlengthextrapolation/7b4651c7-88bf-4ad1-8d4b-af4f5adc7837_model.json new file mode 100644 index 0000000000000000000000000000000000000000..32d5749f0380959095807f1beea74c3176a00817 --- /dev/null +++ b/kerplekernelizedrelativepositionalembeddingforlengthextrapolation/7b4651c7-88bf-4ad1-8d4b-af4f5adc7837_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e44c7042f5b96882d9f00c36cf2852c1079da54121f66655bfe583b987026c56 +size 99298 diff --git a/kerplekernelizedrelativepositionalembeddingforlengthextrapolation/7b4651c7-88bf-4ad1-8d4b-af4f5adc7837_origin.pdf b/kerplekernelizedrelativepositionalembeddingforlengthextrapolation/7b4651c7-88bf-4ad1-8d4b-af4f5adc7837_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..e0a1ba8d3127c85d51218a2a9a4c3f4aef30984a --- /dev/null +++ b/kerplekernelizedrelativepositionalembeddingforlengthextrapolation/7b4651c7-88bf-4ad1-8d4b-af4f5adc7837_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a467588d4c082c2578c0ea3ee218ede1ac4d73db253c12ebd3e88cf33a8370e +size 587212 diff --git a/kerplekernelizedrelativepositionalembeddingforlengthextrapolation/full.md b/kerplekernelizedrelativepositionalembeddingforlengthextrapolation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..be13d7073caa8081997e39b8757b6a5127caaf51 --- /dev/null +++ b/kerplekernelizedrelativepositionalembeddingforlengthextrapolation/full.md @@ -0,0 +1,335 @@ +# KERPLE: Kernelized Relative Positional Embedding for Length Extrapolation + +Ta-Chung Chi* + +Carnegie Mellon University + +tachungc@andrew.cmu.edu + +Ting-Han Fan* + +Princeton University + +tinghanf@princeton.edu + +Peter J. Ramadge + +Princeton University + +ramadge@princeton.edu + +Alexander I. Rudnicky + +Carnegie Mellon University + +air@cs.cmu.edu + +# Abstract + +Relative positional embeddings (RPE) have received considerable attention since RPEs effectively model the relative distance among tokens and enable length extrapolation. We propose KERPLE, a framework that generalizes relative position embedding for extrapolation by kernelizing positional differences. We achieve this goal using conditionally positive definite (CPD) kernels, a class of functions known for generalizing distance metrics. To maintain the inner product interpretation of self-attention, we show that a CPD kernel can be transformed into a PD kernel by adding a constant offset. This offset is implicitly absorbed in the Softmax normalization during self-attention. The diversity of CPD kernels allows us to derive various RPEs that enable length extrapolation in a principled way. Experiments demonstrate that the logarithmic variant achieves excellent extrapolation performance on three large language modeling datasets. Our implementation and pretrained checkpoints are released at https://github.com/chijames/KERPLE.git. + +# 1 Introduction + +Transformer-based models have excelled in various natural language processing tasks such as chatbot [Roller et al., 2021], code completion [Chen et al., 2021a], and paper abstract summarization [Zhang et al., 2020]. These sequence modeling tasks often require the model to operate well on significantly longer text sequences than the fixed maximum length $L$ used at training time. Training (or retraining) the model using a substantially larger value of $L$ is often infeasible since the transformer training cost is $O(L^2)$ . Hence, one desires a transformer that continues to perform well on longer sequences than those used during training; i.e., perform length extrapolation at inference time. Most transformer designs do not have this property [Press et al., 2022]. While recent work on absolute positional embeddings demonstrated the extrapolation ability [Kiyono et al., 2021, Likhomanenko et al., 2021], it is believed that relative positional embeddings are more robust to input length change [Likhomanenko et al., 2021], for example, ALiBi [Press et al., 2022] and T5 [Raffel et al., 2020]. Hence, we are motivated to study the inner workings of relative positional embeddings. + +Relative positional embeddings (RPE) encode the idea of shift-invariance: for any shift $p$ , $(m + p) - (n + p) = m - n$ . It is often added directly to the self-attention matrix before Softmax normalization [Chen et al., 2021b]. Inspired by shift-invariance and the ability of a kernel to define a similarity function, there have been studies on shift-invariant kernels for RPE [Wennberg and Henter, 2021] with a focus on Gaussian kernel. However, in our preliminary experiments, the Gaussian kernel + +![](images/f9eb0a4c3224515e9307d5668dfe152a59a60d13f827581f3d2a19e36d14bc5d.jpg) +Figure 1: The 3-Para-Log Variant of Our KERPLE Framework. $a$ , $b$ , and $p$ are learnable parameters in each attention head shared across layers. Since $\#$ of heads is $H$ , there are $3 \cdot H$ learnable parameters. The learnable parameters are trained with length-3 sequences. At the inference time, the last row (in dashed squares) becomes active, and the model extrapolates to length-4 sequences. Note we focus on causal language modeling following ALiBi, so the matrices are triangular. + +demonstrates limited length extrapolation ability (see Appendix A.3). Hence, a distinct class of shift-invariant kernels is needed to achieve adequate length extrapolation. + +To this end, we note a set of well-established conditionally positive definite (CPD) kernels suitable for modeling distance metrics [Scholkopf, 2000]. However, CPD kernels do not conform to an inner product. We can remedy this issue by transforming a CPD kernel into a PD kernel by adding a sufficiently large constant. This constant offset is subsequently absorbed implicitly in the Softmax normalization (see the discussion below Eq. (2)). For example, ALiBi implicitly admits a PD kernel of the form $c - |m - n|$ (see the end of section 4), which is reduced to a CPD kernel $-|m - n|$ . The CPD kernel and Softmax normalization combination opens the door to a sea of possible CPD kernels. We investigate structures from this class that exhibit a strong length extrapolation ability, like ALiBi. + +Our main result is a framework for KErnelize Relative Positional Embedding for Length Extrapolation (KERPLE). The framework elucidates key principles that encourage the length extrapolation property. We show that ALiBi is a particular instance within our framework. Our subsequent experiments suggest that the proposed method yields better length extrapolation on large datasets such as OpenWebText2, GitHub, and ArXiv. + +# 2 Background and Related Work + +# 2.1 Preliminary + +Let $\{w_{m}\}_{m = 1}^{L}$ be the input tokens to a transformer model, where $L$ is the total number of tokens. Each $w_{m}$ is a scalar and is used to index the embedding vector $\pmb {e}_m\in \mathbb{R}^d$ as the input to the transformer. A transformer converts each $\pmb{e}_{m}$ into query, key, and value vectors in $\mathbb{R}^d$ : $\pmb {q}_m = \pmb {W}_q\pmb {e}_m,\pmb {k}_m = \pmb {W}_k\pmb {e}_m,$ $\pmb{v}_{m} = \pmb{W}_{v}\pmb{e}_{m}$ , where $\pmb{W}_{q},\pmb{W}_{k},\pmb{W}_{v}\in \mathbb{R}^{d\times d}$ are learnable matrices. Then, the self-attention module computes the scaled attention scores and generates the output vector $\pmb{o}_m$ at position $m$ as: + +$$ +a _ {m, n} = \frac {\exp \left(\boldsymbol {q} _ {m} ^ {\top} \boldsymbol {k} _ {n} / \sqrt {d}\right)}{\sum_ {i = 1} ^ {L} \exp \left(\boldsymbol {q} _ {m} ^ {\top} \boldsymbol {k} _ {i} / \sqrt {d}\right)}, \quad \boldsymbol {o} _ {m} = \sum_ {n = 1} ^ {L} a _ {m, n} \boldsymbol {v} _ {n}. +$$ + +Since the operation is position-agnostic, it is believed that positional information helps model token interactions [Vaswani et al., 2017], which we survey in the next subsection. + +# 2.2 Positional Embedding + +Absolute. Absolute positional embeddings assign a positional vector $\pmb{p}_m$ to each position $m$ and adds $\pmb{p}_m$ to the embedding vector $\pmb{e}_m$ . The very first version of which is the predefined sinusoidal function [Vaswani et al., 2017]. Followed by the success of BERT [Devlin et al., 2019], learnable absolute positional embeddings have been applied to the task of masked language modeling [Devlin et al., 2019, Liu et al., 2019, Clark et al., 2020, Lan et al., 2020], Autoregressive-decoding [Radford et al., 2018, 2019], and sequence-to-sequence [Gehring et al., 2017, Lewis et al., 2019] settings. Recent work studied ways to extrapolate sinusoidal positional embeddings to longer sequences by randomly shifting absolute positions during training [Kiyono et al., 2021] or augmenting with continuous signals [Likhomanenko et al., 2021]. + +Relative. As opposed to the modeling of absolute position $m$ , relative positional embeddings (RPE) that model the positional difference $m - n$ has become popular in the literature [Shaw et al., 2018, Huang et al., 2019, Dai et al., 2019, Yang et al., 2019, Huang et al., 2020, He et al., 2021, Ke et al., 2021, Chen et al., 2021b]. In particular, the T5 model that considers bucketed relative distances and log-binning has been shown to perform well on various transformer architectures [Raffel et al., 2020]. Rotary positional embedding [Su et al., 2021] encodes the position with rotations: $f(\pmb{q}_m, m) = R_m \pmb{q}_m$ where $R_m$ is a rotation matrix with angles proportional to $m$ . With the rotation's property, the query-key product exhibits a positional difference: $f(\pmb{q}_m, m)^\top f(\pmb{k}_n, n) = \pmb{q}_m^\top R_{n-m} \pmb{k}_n$ . + +We note that the overview above focuses on the NLP domain. Recent work has applied positional embeddings to other domains such as vision [Wu et al., 2021a] and speech [Likhomanenko et al., 2021]. A survey can be found in [Dufter et al., 2022]. + +# 2.3 Kernel and its Application in Transformer + +The kernel trick is a classic approach to generalize the inner product to high dimensional spaces [Mika et al., 1998, Scholkopf, 2000, Leslie et al., 2001, Dhillon et al., 2004, Takeda et al., 2007]. In the context of transformers, there has been interest in applying kernels to the self-attention structure to enhance the performance. Examples of such work include kernel for positional embeddings [Tsai et al., 2019, Wu et al., 2021b, Wennberg and Henter, 2021, Luo et al., 2021]. Another line of research leverages the kernel's feature map [Rahimi and Recht, 2007] to linearize the self-attention module and reduce the computational cost [Katharopoulos et al., 2020, Chen et al., 2021c, Xiong et al., 2021, Peng et al., 2021, Choromanski et al., 2021, Qin et al., 2022]. + +# 3 Theoretical Foundations of CPD Kernels + +# 3.1 PD and CPD Kernels + +In this work, we use shift-invariant conditionally positive definite (CPD) kernels to model the effect of relative positional differences. We propose this formulation because the notion of relative is modeled by a shift-invariant function: a bivariate function $k$ over two positions $(m,n)$ such that $k(m,n) = f(m - n)$ for some univariate $f$ . The notion of positional difference $m - n$ is generalized by the CPD kernel. We review the definitions of PD and CPD kernels below. + +Definition 1 (PD Kernel). A (real) symmetric function $k: \mathcal{X} \times \mathcal{X} \to \mathbb{R}$ is a positive definite kernel if for any integer $N$ and any $\{x_i \in \mathcal{X}\}_{i=1}^N$ , $\{c_i \in \mathbb{R}\}_{i=1}^N$ , the quadratic form is nonnegative: $\sum_{i=1}^{N} \sum_{j=1}^{N} c_i c_j k(x_i, x_j) \geq 0$ . + +Definition 2 (CPD Kernel). A (real) symmetric function $\tilde{k}:\mathcal{X}\times \mathcal{X}\to \mathbb{R}$ is a conditionally positive definite kernel if for any integer $N$ and any $\{x_{i}\in \mathcal{X}\}_{i = 1}^{N}$ , the quadratic form is conditionally nonnegative: $\sum_{i = 1}^{N}\sum_{j = 1}^{N}c_{i}c_{j}\tilde{k} (x_{i},x_{j})\geq 0$ for $\{c_i\in \mathbb{R}\}_{i = 1}^N$ with $\sum_{i = 1}^{N}c_{i} = 0$ . + +Fact 1 (Berg et al. [1984] and Prop. 5 of Schölkopf [2000]). Let $\tilde{k}:\mathcal{X}\times \mathcal{X}\to (-\infty ,0]$ be a CPD kernel with $\tilde{k} (x,x) = 0\forall x\in \mathcal{X}$ . Then, there exists a Hilbert space $\mathcal{H}$ and a mapping $\phi :\mathcal{X}\rightarrow \mathcal{H}$ such that $\| \phi (x) - \phi (x^{\prime})\|^{2} = -\tilde{k} (x,x^{\prime})$ + +Fact 1 suggests that CPD kernels generalize distance metrics to high dimensional spaces. Since we are interested in positional differences, we examine modeling the distance between positions using CPD kernels. + +However, Fact 1 also implies that CPD kernels do not encode inner products as required by self-attention for the computation of pairwise relations. PD kernels represent inner products. To better understand the effect of CPD kernels on self-attention, we need to establish relations between CPD and PD kernels. As noted in Scholkopf [2000], if one takes any PD kernel and offsets it by a constant, the result is at least a CPD kernel. In the next subsection, we show that the converse is nearly true: if $\tilde{k}$ is CPD, so is $c + \tilde{k}$ for large enough $c\in \mathbb{R}$ (Lemma 1). Therefore, we may generate the CPD kernels of interest and transform them into PD kernels if needed. + +# 3.2 Constructing PD Kernels From CPD Kernels via Constant Shifts + +In this subsection, we review a few properties of CPD kernels and use these to generate a variety of CPD kernels. Then, we present a lemma that transforms CPD kernels into PD kernels via constant shifts. This enables the production of a family of PD kernels from CPD kernels. Finally, we present our critical observation that the exact value of the constant shift is not needed, thanks to a nice property of Softmax normalization. + +Below are some important facts about CPD kernels. + +Fact 2 (Scaling and Summation). If $\tilde{k}_1$ and $\tilde{k}_2$ are CPD, then so are $a \cdot \tilde{k}_1$ (for $a > 0$ ) and $\tilde{k}_1 + \tilde{k}_2$ . + +Fact 3 (Berg et al. [1984] and Prop. 4 of Scholkopf [2000]). If $\tilde{k}:\mathcal{X}\times \mathcal{X}\to (-\infty ,0]$ is CPD, then so are $-(-\tilde{k})^{\alpha}$ for $0 < \alpha < 1$ and $-\log (1 - \tilde{k})$ + +Fact 4 (Page 3 of Schölkopf [2000]). The negative squared distance $-\| x - x' \|^2$ is CPD. + +The three Facts above jointly yield a rich family of CPD kernels as shown below. + +Corollary 1. The following are CPD kernels. + +(a) $\tilde{k} (x,x^{\prime}) = -a\| x - x^{\prime}\|^{p}$ with $0 < p\leq 2$ and $a > 0$ +(b) $\tilde{k} (x,x^{\prime}) = -b\cdot \log (1 + a\| x - x^{\prime}\|^{p})$ with $0 < p\leq 2$ and $a,b > 0$ + +We note that it is possible to keep iterating between Fact 2 and 3 and generate more complicated examples, e.g., $-a\| x - x' \|^{p} - b \cdot \log(1 + a \| x - x' \|^{p})$ or $-b \cdot \log(1 + a \| x - x' \|^{p})^{c}$ for $0 < c < 1$ . However, since relative positional embeddings are of our interest, we only consider simple CPD kernels. Those with complicated forms are deferred to future work. + +Now that Corollary 1 has presented a few class of CPD kernels, we prove a lemma (in Appendix A.1) that constructs PD kernels from CPD kernels through shifting. Later in Eq. (2), we will see that the shifting construction is combined neatly with the Softmax normalization of self-attention. + +Lemma 1 (CPD Shift Lemma. Proof in Appendix A.1). Let $\tilde{k}:\mathcal{X}\times \mathcal{X}\to \mathbb{R}$ be a CPD kernel. There exists $c\geq 0$ such that $c + \tilde{k}$ is a PD kernel. + +Lemma 1 implies the CPD kernels in Corollary 1 can be made PD if a large enough constant is added. For example, $c - \| x - x' \|^p$ for large enough $c$ . Although Lemma 1 does not have an explicit construction of $c$ , thanks to the shift-invariant property of the Softmax normalization, we can leave it as an under-determined constant in our positional embedding design (Eq. (1) in section 4). Given a set of test points $\{x_i\}_{i=1}^N$ , one can do a geometric sequence search1 to search for a $c$ such that the $N \times N$ matrix $[c + k(x_i, x_j)]_{i,j=1}^N \succeq 0$ . Hence, we do not need the value of $c$ , but we can compute it if needed, e.g., deriving the feature map of $c + \tilde{k}$ . + +Alternative Proof of $c - \| x - x' \|^p$ . While the CPD shift lemma is convenient, one can prove $c - \| x - x' \|^p$ is PD for large enough $c$ using a kernel representation theorem in Schoenberg [1938]. See Appendix A.2 for details. + +# 4 Kernelized Relative Positional Embedding + +Let $\{\pmb{q}_m\}_{m=1}^L$ and $\{\pmb{k}_n\}_{n=1}^L$ be the input queries and keys. Let $(r_1, \dots, r_\ell)$ be learnable parameters. We propose a kernelized relative positional embedding as follows. + +$$ +a _ {m, n} = \frac {\exp \left(\left(\boldsymbol {q} _ {m} ^ {\top} \boldsymbol {k} _ {n} + \tilde {k} _ {r _ {1} , \dots , r _ {\ell}} (m , n)\right) / \sqrt {d}\right)}{\sum_ {i = 1} ^ {L} \exp \left(\left(\boldsymbol {q} _ {m} ^ {\top} \boldsymbol {k} _ {i} + \tilde {k} _ {r _ {1} , \dots , r _ {\ell}} (m , i)\right) / \sqrt {d}\right)}, \tag {1} +$$ + +where $\tilde{k}_{r_1,\dots,r_\ell}(m,n)$ is any shift-invariant CPD kernel with $\ell$ parameters. Due to Lemma 1, Eq. (1) can be reformulated into its kernel form as follows. + +$$ +a _ {m, n} \stackrel {(*)} {=} \frac {\exp \left(\left(\boldsymbol {q} _ {m} ^ {\top} \boldsymbol {k} _ {n} + c + \tilde {k} _ {r _ {1} , \dots , r _ {\ell}} (m , n)\right) / \sqrt {d}\right)}{\sum_ {i = 1} ^ {L} \exp \left(\left(\boldsymbol {q} _ {m} ^ {\top} \boldsymbol {k} _ {i} + c + \tilde {k} _ {r _ {1} , \dots , r _ {\ell}} (m , i)\right) / \sqrt {d}\right)} +$$ + +$$ +\stackrel {\text {L e m m a 1}} {=} \frac {\exp \left(\boldsymbol {q} _ {m} ^ {\top} \boldsymbol {k} _ {n} + k _ {r _ {1} , \dots , r _ {\ell}} (m , n)\right) / \sqrt {d})}{\sum_ {i = 1} ^ {L} \exp \left(\boldsymbol {q} _ {m} ^ {\top} \boldsymbol {k} _ {i} + k _ {r _ {1} , \dots , r _ {\ell}} (m , i)\right) / \sqrt {d})} = \frac {\exp \left(k ^ {\operatorname {c o m p}} \left([ \boldsymbol {q} _ {m} , m ], [ \boldsymbol {k} _ {n} , n ]\right) / \sqrt {d}\right)}{\sum_ {i = 1} ^ {L} \exp \left(k ^ {\operatorname {c o m p}} \left([ \boldsymbol {q} _ {m} , m ], [ \boldsymbol {k} _ {i} , i ]\right) / \sqrt {d}\right)}. \tag {2} +$$ + +(*) is due to the shift-invariant property of the Softmax normalization: $\frac{\exp(x_i)}{\sum_j\exp(x_j)} = \frac{\exp(x_i + c)}{\sum_j\exp(x_j + c)}$ for any $c\in \mathbb{R}$ . The second equality defines a bias kernel which is positive definite using Lemma 1: + +$$ +k _ {r _ {1}, \dots , r _ {\ell}} = c + \tilde {k} _ {r _ {1}, \dots , r _ {\ell}}. \tag {3} +$$ + +The last equality introduces a composite kernel $k^{\mathrm{comp}}:\mathbb{R}^{d + 1}\times \mathbb{R}^{d + 1}\to \mathbb{R}$ as + +$$ +k ^ {\operatorname {c o m p}} \left(\left[ \boldsymbol {q} _ {m}, m \right], \left[ \boldsymbol {k} _ {n}, n \right]\right) = \boldsymbol {q} _ {m} ^ {\top} \boldsymbol {k} _ {n} + k _ {r _ {1}, \dots , r _ {\ell}} (m, n). \tag {4} +$$ + +Interpretation. The proposed method can be interpreted as applying a composite kernel to self-attention. The composite kernel combines the information from query $\mathbf{q}_m$ , key $\mathbf{k}_n$ , and positions $(m,n)$ in a way that augments the original self-attention structure by multiplicative and additive position embeddings. The augmentation allows $k^{\mathrm{comp}}$ to not only retain the original $\mathbf{q}_m^\top \mathbf{k}_n$ but also include positional information from the bias kernel $k_{r_1,\dots,r_\ell}$ . + +Practical Choice. In section 5.2, we fix $\ell = 2$ and experiment on two variants of the composite kernel, Eq. (4), where we call these the power variant and the logarithmic variant of our proposed KERPLE framework, Eq. (2). These are from a combination of Corollary 1 and Eq. (3). + +(power) $k^{\mathrm{comp}}([q_m,m],[k_n,n]) = q_m^\top k_n + c - r_1|m - n|^{r_2}$ with $r_1 > 0$ and $0 < r_{2}\leq 2$ (logarithmic) $k^{\mathrm{comp}}([q_m,m],[k_n,n]) = q_m^\top k_n + c - r_1\cdot \log (1 + r_2|m - n|)$ with $r_1,r_2 > 0$ + +We note that these are not the only variants of the composite kernel. In section 5.3, we experiment with two more complicated variants, but only find lower training speeds and marginal improvement in perplexities (e.g., logarithmic variant vs. 3-para-log). Thus, based on our study, the choices above hold advantages in both performance and speed. + +Connection to Prior Work. When the bias kernel, Eq. (3), is a triangle kernel: $c - |m - n|$ , our model reduces to ALiBi [Press et al., 2022]. Wennberg and Henter [2021] discuss the situation where the bias kernel is a Gaussian kernel. Tsai et al. [2019] is the case where there is no bias kernel and the attention product $\pmb{q}_m^\top \pmb{k}_n$ is multiplied by an exponentiated inner product kernel, $\exp (\pmb{x}^{\top}\pmb{y})$ . Since ALiBi is the state-of-the-art and has great input length extrapolation, we will focus on comparison with ALiBi in our experiments. + +The logarithmic variant has an implicit connection to T5 positional bias [Raffel et al., 2020]. According to the official GitHub repository https://github.com/google-research/text-to-text-transfer-transformer and the HuggingFace Transformer [Wolf et al., 2020], T5 bias is implemented with a log-binning strategy. For each head of the transformer, they maintain a bucket of 32 learnable parameters and assign the relative positional bias $b_{m-n}$ to these parameters as + +$$ +b _ {m - n} = \left\{ \begin{array}{l l} \operatorname {b u c k e t} [ m - n ] & \text {i f} 0 \leq m - n < 1 6 \\ \operatorname {b u c k e t} [ \min (3 1, 1 6 + \lfloor \frac {\log ((m - n) / 1 6)}{\log (1 2 8 / 1 6)} \cdot 1 6 \rfloor ] & \text {i f} m - n \geq 1 6, \end{array} \right. +$$ + +where $\lfloor \cdot \rfloor$ is the floor function. Note that the log factor is approximately $7.7\log \frac{m - n}{16}$ . Therefore, T5 is using a logarithmic bucket assignment, which turns out to extrapolate to different input lengths. Compared with T5, our logarithmic variant uses less parameters (2x12 vs. 32x12) but cannot learn non-monotonic relations (the log function is monotonic). We will conduct more comparisons with T5 bias in our experiments. + +# 5 Experiments + +# 5.1 Dataset and Implementation Description + +Dataset. We conduct experiments on OpenText2, GitHub, and ArXiv datasets gathered in Gao et al. [2020]. OpenText2 includes recent content from Reddit submissions until 2020, + +content from multiple languages, document metadata, multiple dataset versions, and open-source replication code. GitHub includes open-source repositories written in primary coding languages such as Java, C/C++, Python, and Go. ArXiv includes papers written in LaTeX in Math, Computer Science, Physics, and some related fields. These tasks are motivated by the downstream applications such as online chatting [Roller et al., 2021], code completion [Chen et al., 2021a], and academic paper summarization [Zhang et al., 2020]. + +Table 1: Dataset Overview. Raw Size is the size before any up- or down-sampling. + +
OpenText2GitHubArXiv
Raw Size66.77 GB95.16 GB56.21 GB
TypeInternetCodingAcademic
+ +Implementation. We adapt our model from GPT-NeoX [Black et al., 2021], a transformer implementation by the EleutherAI team. The codebase is based on NVIDIA Megatron Language Model [Shoeybi et al., 2019] and further accelerated using Microsoft DeepSpeed library [Rasley et al., 2020]. + +Our model is trained on a machine with one NVIDIA A100 GPU with 40 GB of memory. We adopt almost all configurations of small GPT-NeoX², except that we change the train-micro-batch-size to 32, seq-length to 512, and max-position-embeddings to 512. Table 2 summarizes the important configurations fixed throughout our experiments. In particular, the floating-point encoding is set as + +Table 2: 162M Model Configurations. + +
# Layers +12Hidden Size +64# Attention Heads +12Train Seq. Len. +512# Trainable Params. +162M
Optimizer +Adam (lr 6e-4)Batch Size +32Train Steps +50,000Precision +bfloat16# Trainable Params. for RPEs at most 36
+ +bfloat16 (Brain Floating Point, developed by Google Brain) so that the training can be accelerated by half-precision computation with reliable stability [Kalamkar et al., 2019]. Hidden size 64 means that $d = 64$ in Eq. (1). + +# 5.2 Experimental Results (Also c.f. Appendix A.4 to A.7) + +We conduct experiments to cover aspects such as input length extrapolation, application on different domains, and comparison with the prior work. These are elaborated on below. (i) Motivated by the input length extrapolation demonstrated in [Press et al., 2022], we train our model with length 512 and test on lengths ranging from 512 to 16384. We hope that the emphasis on extrapolation enables the application of transformers to longer sequences. (ii) To evaluate the applicability of the model in different domains, we conduct experiments on OpenWebText2, GitHub, and ArXiv datasets. (iii) To validate the effectiveness of our method, we compare KERPLE with Sinusoidal [Vaswani et al., 2017], Rotary [Su et al., 2021], T5 [Raffel et al., 2020], and ALiBi [Press et al., 2022]. + +Table 3 reports the perplexities at different extrapolation lengths. We perform non-overlapping evaluation: Suppose text is segmented in a different manner for 512 and 1024 tokens, we have N sentences and N/2 correspondingly to evaluate. We also perform a paired two-sided t-test to validate the statistical significance (significance level=0.05). We compare each candidate RPE with our proposed logarithmic variant and mark the candidate with a $\dagger$ if the log variant is statistically significantly better. Table 4 reports the training speeds. These tables yield three conclusions. First, within the KERPLE framework, the logarithmic variant is better than the power variant. Secondly, the logarithmic variant is $9.7\%$ faster than T5. In terms of extrapolation, the logarithmic variant generally does better than T5 but could be slightly worse than T5 at shorter lengths. Third, the logarithmic variant is slightly slower than some prior work (ALiBi, Rotary, and Sinusoidal) but consistently outperform these methods at all extrapolation lengths. More details are given below. + +Logarithmic Variant vs. Power Variant. In our proposed KERPLE framework, the logarithmic variant is better than the power variant. Precisely, the logarithmic variant is $4.4\%$ faster and has lower perplexities across all extrapolation lengths and all tasks. + +Logarithmic Variant vs. T5. In terms of speed, the logarithmic variant is $9.7\%$ faster than T5. In terms of extrapolation perplexity, the logarithmic variant is close to or slightly worse than T5 when the extrapolation length is shorter than 2048, and consistently excels T5 at longer extrapolation lengths. The tendency of extrapolation holds for all datasets evaluated in this work. + +Logarithmic Variant vs. ALiBi, Rotary, and Sinusoidal. The logarithmic variant is $1.6\%$ slower, $7.5\%$ faster, and $3.0\%$ slower than ALiBi, Rotary, and Sinusoidal. The speed comparison makes sense because we require only a limited amount of learnable parameters for RPEs (at most $3 \cdot H$ ). Also, the logarithmic variant consistently outperforms prior work at all extrapolation lengths and tasks. + +Table 3: Perplexity Comparison on OpenWebText2, GitHub, and ArXiv. All models are trained for 50k steps with training length 512 and five random seeds. $x^{\dagger}$ means our log variant is statistically significantly better than $x$ . The test used is paired two-sided t-test with $\alpha = 0.05$ . + +
OpenText2
Extrp.KERPLEALiBiT5RotarySinusoidal
(log)(power)
51223.9 ± 0.623.9 ± 0.623.9 ± 0.623.7 ± 0.624.2 ± 0.6†33 ± 1†
102422.0 ± 0.622.1 ± 0.722.4 ± 0.5†21.9 ± 0.632.8 ± 1.7†750 ± 346†
204821.6 ± 0.321.9 ± 0.2†22.5 ± 0.2†21.7 ± 0.262.4 ± 6.1†5507 ± 2607†
409621.2 ± 0.421.5 ± 0.5†22.2 ± 0.4†22.5 ± 0.6†111 ± 13.8†14039 ± 2325†
819221.3 ± 0.421.6 ± 0.4†22.3 ± 0.3†25.5 ± 1.3†185 ± 18.9†22621 ± 1927†
1638421.4 ± 0.621.6 ± 0.622.5 ± 0.5†31.4 ± 3.1†269 ± 33.0†30046 ± 4824†
GitHub
Extrp.KERPLEALiBiT5RotarySinusoidal
(log)(power)
5123.40 ± 0.203.42 ± 0.203.42 ± 0.213.38 ± 0.213.44 ± 0.20†4 ± 0.2†
10243.04 ± 0.143.07 ± 0.163.15 ± 0.17†3.02 ± 0.143.86 ± 0.25†105 ± 39†
20482.86 ± 0.102.90 ± 0.08†3.13 ± 0.10†2.84 ± 0.095.94 ± 0.64†1380 ± 404†
40962.74 ± 0.052.79 ± 0.063.04 ± 0.08†2.78 ± 0.04†11.1 ± 1.55†5217 ± 1118†
81922.71 ± 0.052.76 ± 0.053.04 ± 0.03†2.95 ± 0.13†20.2 ± 2.75†10081 ± 3583†
163842.75 ± 0.162.76 ± 0.133.02 ± 0.13†3.35 ± 0.27†31.3 ± 5.20†16443 ± 8503†
ArXiv
Extrp.KERPLEALiBiT5RotarySinusoidal
(log)(power)
5126.07 ± 0.266.10 ± 0.266.12 ± 0.26†6.03 ± 0.266.07 ± 0.2743 ± 44
10245.61 ± 0.105.65 ± 0.10†5.82 ± 0.09†5.58 ± 0.097.49 ± 0.34†221 ± 136†
20485.22 ± 0.125.26 ± 0.13†5.71 ± 0.14†5.21 ± 0.1414.2 ± 1.81†730 ± 343†
40965.20 ± 0.105.25 ± 0.095.87 ± 0.08†5.32 ± 0.16†30.1 ± 4.32†1998 ± 497†
81925.01 ± 0.105.06 ± 0.155.74 ± 0.13†5.54 ± 0.39†54.3 ± 6.22†4228 ± 2645†
163845.07 ± 0.165.07 ± 0.195.78 ± 0.15†6.25 ± 0.61†85.4 ± 7.40†6674 ± 5696
+ +Table 4: Training Time Comparison on GitHub + +
KERPLEALiBiT5RotarySinusoidal
(log)(power)
sec/step0.3070.3210.3020.3400.3320.298
+ +# 5.3 Experiments on Complicated Kernels + +In addition to the practical variants (power & logarithmic) in section 4, we consider two complicated versions of the composite kernel, Eq. (4), as follows. + +(bias+wht) bias + weight: + +$$ +k ^ {\mathrm {c o m p}} \left(\left[ \boldsymbol {q} _ {m}, m \right], \left[ \boldsymbol {k} _ {n}, n \right]\right) = \boldsymbol {q} _ {m} ^ {\top} \boldsymbol {k} _ {n} \cdot \exp \left(- r _ {3} | m - n | ^ {r _ {4}}\right) + c - r _ {1} | m - n | ^ {r _ {2}} +$$ + +with $r_1, r_3 > 0$ and $0 < r_2, r_4 \leq 2$ . + +(3-para-log) 3-parameter-logarithmic: + +$$ +k ^ {\mathrm {c o m p}} \left(\left[ \boldsymbol {q} _ {m}, m \right], \left[ \boldsymbol {k} _ {n}, n \right]\right) = \boldsymbol {q} _ {m} ^ {\top} \boldsymbol {k} _ {n} + c - r _ {1} \cdot \log \left(1 + r _ {2} | m - n | ^ {r _ {3}}\right) +$$ + +with $r_1, r_2 > 0$ and $0 < r_3 \leq 2$ . + +Recall the tensor product property of a kernel: if $k_{1}$ is a kernel on $\mathcal{X}$ and $k_{2}$ is a kernel on $\mathcal{Y}$ , then $k((x,y),(x',y')) = k_{1}(x,x')k_{2}(y,y')$ is a kernel on $\mathcal{X} \times \mathcal{Y}$ . Therefore, (bias+wht) is the setting where we train a weight $\exp(-r_{3}|m - n|^{r_{4}})$ and a bias kernel $c - r_{1}|m - n|^{r_{2}}$ . $\pmb{q}_{m}^{\top}\pmb{k}_{n}$ is multiplied by the weight kernel and then added with the bias kernel. (3-para-log) is the setting where we consider $|m - n|^{r_3}$ in the log. When $r_{3} = 1$ , it is reduced to the logarithmic variant proposed in section 4. + +We plug in these composite kernel $k^{\mathrm{comp}}$ into our KERPLE framework, Eq. (2), and test the performance of these RPE. Compared with section 5.2, Table 5 suggests that these variants do not have clear advantage in extrapolation performance, e.g., 3-para-log is slightly better in perplexity than the (two-parameter) logarithmic variant. Thus, enlarging the complexity of kernels does not necessarily give better performance in the context of RPE. + +Table 5: Perplexity Comparison for KERPLE with Complicated Kernels on OpenWebText2, GitHub, and ArXiv. All models are trained for 50k steps with training length 512 and five seeds random. OOM means out of memory. + +
Extrp.OpenText2GitHubArXiv
(bias+wht)(3-para-log)(bias+wht)(3-para-log)(bias+wht)(3-para-log)
51224.1 ± 0.623.8 ± 0.63.44 ± 0.213.40 ± 0.206.11 ± 0.276.06 ± 0.27
102422.2 ± 0.622.0 ± 0.73.08 ± 0.153.04 ± 0.135.66 ± 0.095.61 ± 0.10
204821.9 ± 0.421.6 ± 0.22.90 ± 0.122.85 ± 0.105.28 ± 0.125.21 ± 0.12
409621.5 ± 0.521.2 ± 0.42.79 ± 0.062.73 ± 0.055.31 ± 0.085.18 ± 0.09
819221.4 ± 0.521.3 ± 0.42.76 ± 0.032.68 ± 0.045.16 ± 0.185.00 ± 0.11
16384OOMOOMOOMOOMOOMOOM
+ +# 5.4 Plots of Kernel Functions + +We plot kernel functions including the power, log variants, and ALiBi for different heads to see their contributions to softmax. We use the GitHub dataset for demonstration. Please see Figure 2, 3, and 4. Both ALiBi and its generalized power variant quickly reach a very negative value. In contrast, the log variant successfully discovers several flat kernels, effectively extending the window attention. This corroborates our previous observation that KERPLE-log can utilize more distant token information. + +![](images/496dee7dfe731757fdb3452d7b18e60f72b47b0101fd5b4dd1f4f7dd052a93c1.jpg) +Figure 2: Kernel Functions of Learned by the Log Variant. + +![](images/bea5f2fac19f023d975de7ee481ba57dce9d2d536534e621caeefda6225836e3.jpg) +Figure 3: Kernel Functions Learned by the Power Variant. Note the y-axis should be multiplied by $1e8$ , which is a very negative value. + +![](images/0cc92c3d54ae2fa91a4bb7591f75c532f1b8e8428c470c2aa94c98d458bb8a19.jpg) +Figure 4: Kernel Functions Learned by ALiBi. + +# 5.5 Position-wise Perplexity Evaluation + +We plot the position-wise perplexity with evaluation length $= 4096$ in Figure 5. Please see Appendix A.6 for similar length $= 16384$ result. The evaluation is done by measuring the loss at each position in each sequence and averaging over the sequences. + +We note that PPL@512 of KERPLE-log is the lowest among all model variants. We can derive several critical observations for evaluation length=4096 in Figure 5: First, KERPLE-log lies below KERPLE-log-windowed@512, indicating its usage of more distant information than window attention: If our model does not use more information other than a fixed-window=512, the y-values after position=512 should overlap with the line windowed at 512. This is clearly not the case. In addition, the PPL of KERPLE-log continues to decrease till the end of 4096 positions (Not plateauing). Second, T5 lies below KERPLE-log-windowed@512 most of the time and fluctuates around KERPLE-log-windowed@512 after length=3000. It is still worse than KERPLE-log. Third, ALiBi lies above KERPLE-log-windowed@512 for almost all the positions, indicating that window attention might be a better choice than ALiBi. + +Although window attention is a strong baseline, our KERPLE-log is almost like a free lunch compared to window attention: With only 24 additional learnable parameters (2 para. for each head), the almost same training speed, and the same train length=512 as window attention, it is able to achieve lower PPLs across different positions. + +# 6 Conclusion and Future Work + +A general framework, KERPLE, is proposed to kernelize relative positional embeddings for length extrapolation. At the core of this framework is the application of CPD kernels and the derivation of practical variants. We show that these CPD kernels can be implicitly converted to PD kernels, which + +![](images/2694591ba49f461797a9d8bdddbd40df4384826891cb746ac21611fe1f25f3be.jpg) +Figure 5: Position-wise Perplexity on GitHub at Evaluation Length=4096 Compared to Window Attention@512. + +keep the inner product interpretation of self-attention. We also demonstrate that the logarithmic variant achieves exceptional extrapolation performance on three large language modeling datasets. We believe our work paves the way for some interesting future directions that resolve our limitations. For instance, we can consider general kernel families and model non-monotonic effects due to positional differences. In addition, the use of learnable parameters in KERPLE might enable better generalization to inputs higher than one-dimensional. Last but not least, there is always room for improving memory efficiency by adjusting the model architecture and training procedure. + +# 7 Broader Impact + +Our work develops a better understanding of relative positional embedding for transformers based on expressive kernel classes that adapt well to various datasets. The results apply to domains where the positional information is helpful in the modeling, e.g., natural language, programming language, and DNA/protein sequences for biology/medicine. The studies of transformers may have positive economic effects by enabling new tasks which cannot be done by humans or enhancing accuracy and efficiency. But inappropriate use can have negative societal impacts. These include job loss due to automation, the ethical challenges from improper text generation, and the privacy issues in the data collection process. These implications apply to any research on natural language processing and are not associated with any specific work. + +# 8 Acknowledgement + +We thank the anonymous reviewers for their insightful feedback and suggestions. We thank Princeton Research Computing for the technical support on the Della and the Adroit clusters. The third author acknowledges support from NSF MRI Award: 1919452. + +# References + +Stephen Roller, Emily Dinan, Naman Goyal, Da Ju, Mary Williamson, Yinhan Liu, Jing Xu, Myle Ott, Eric Michael Smith, Y-Lan Boureau, and Jason Weston. Recipes for building an open-domain chatbot. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, pages 300-325, Online, April 2021. Association for Computational Linguistics. +Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, et al. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374, 2021a. +Jingqing Zhang, Yao Zhao, Mohammad Saleh, and Peter Liu. Pegasus: Pre-training with extracted gap-sentences for abstractive summarization. In International Conference on Machine Learning, pages 11328-11339. PMLR, 2020. +Ofir Press, Noah Smith, and Mike Lewis. Train short, test long: Attention with linear biases enables input length extrapolation. In International Conference on Learning Representations, 2022. +Shun Kiyono, Sosuke Kobayashi, Jun Suzuki, and Kentaro Inui. SHAPE: Shifted absolute position embedding for transformers. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 3309-3321, Online and Punta Cana, Dominican Republic, November 2021. Association for Computational Linguistics. +Tatiana Likhomanenko, Qiantong Xu, Gabriel Synnaeve, Ronan Collobert, and Alex Rogozhnikov. Cape: Encoding relative positions with continuous augmented positional embeddings. In M. Ranzato, A. Beygelzimer, Y. Dauphin, P.S. Liang, and J. Wortman Vaughan, editors, Advances in Neural Information Processing Systems, volume 34, pages 16079-16092. Curran Associates, Inc., 2021. +Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21(140):1-67, 2020. +Pu-Chin Chen, Henry Tsai, Srinadh Bhojanapalli, Hyung Won Chung, Yin-Wen Chang, and Chun-Sung Ferng. A simple and effective positional encoding for transformers. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 2974-2988, 2021b. +Ulme Wennberg and Gustav Eje Henter. The case for translation-invariant self-attention in transformer-based language models. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 2: Short Papers), pages 130–140, Online, August 2021. Association for Computational Linguistics. +Bernhard Schölkopf. The kernel trick for distances. In T. Leen, T. Dietterich, and V. Tresp, editors, Advances in Neural Information Processing Systems, volume 13. MIT Press, 2000. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171–4186, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019. + +Kevin Clark, Minh-Thang Luong, Quoc V. Le, and Christopher D. Manning. Electra: Pre-training text encoders as discriminators rather than generators. In International Conference on Learning Representations, 2020. +Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. Albert: A lite bert for self-supervised learning of language representations. In International Conference on Learning Representations, 2020. +Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. OpenAI blog, 2018. +Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019. +Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N. Dauphin. Convolutional sequence to sequence learning. In Proceedings of the 34th International Conference on Machine Learning - Volume 70, ICML'17, page 1243-1252. JMLR.org, 2017. +Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov, and Luke Zettlemoyer. Bart: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. arXiv preprint arXiv:1910.13461, 2019. +Peter Shaw, Jakob Uszkoreit, and Ashish Vaswani. Self-attention with relative position representations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers), pages 464-468, New Orleans, Louisiana, June 2018. Association for Computational Linguistics. +Cheng-Zhi Anna Huang, Ashish Vaswani, Jakob Uszkoreit, Ian Simon, Curtis Hawthorne, Noam Shazeer, Andrew M. Dai, Matthew D. Hoffman, Monica Dinculescu, and Douglas Eck. Music transformer. In International Conference on Learning Representations, 2019. +Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc Le, and Ruslan Salakhutdinov. Transformer-XL: Attentive language models beyond a fixed-length context. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 2978-2988, Florence, Italy, July 2019. Association for Computational Linguistics. +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. Xlnet: Generalized autoregressive pretraining for language understanding. In Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. +Zhiheng Huang, Davis Liang, Peng Xu, and Bing Xiang. Improve transformer models with better relative position embeddings. In Findings of the Association for Computational Linguistics: EMNLP 2020, pages 3327-3335, Online, November 2020. Association for Computational Linguistics. +Pengcheng He, Xiaodong Liu, Jianfeng Gao, and Weizhu Chen. {DEBERTA}: {DECODING} {enhanced} {bert} {with} {disentangled} {attention}. In International Conference on Learning Representations, 2021. +Guolin Ke, Di He, and Tie-Yan Liu. Rethinking positional encoding in language pre-training. In International Conference on Learning Representations, 2021. +Jianlin Su, Yu Lu, Shengfeng Pan, Bo Wen, and Yunfeng Liu. Roformer: Enhanced transformer with rotary position embedding. arXiv preprint arXiv:2104.09864, 2021. +Kan Wu, Houwen Peng, Minghao Chen, Jianlong Fu, and Hongyang Chao. Rethinking and improving relative position encoding for vision transformer. In 2021 IEEE/CVF International Conference on Computer Vision (ICCV), pages 10013-10021, 2021a. +Philipp Dufter, Martin Schmitt, and Hinrich Schütze. Position Information in Transformers: An Overview. Computational Linguistics, pages 1-31, 07 2022. +Sebastian Mika, Bernhard Scholkopf, Alex Smola, Klaus-Robert Müller, Matthias Scholz, and Gunnar Ratsch. Kernel pca and de-noising in feature spaces. Advances in neural information processing systems, 11, 1998. + +Christina Leslie, Eleazar Eskin, and William Stafford Noble. The spectrum kernel: A string kernel forsvm protein classification. In Biocomputing 2002, pages 564-575. World Scientific, 2001. +Inderjit S Dhillon, Yuqiang Guan, and Brian Kulis. Kernel k-means: spectral clustering and normalized cuts. In Proceedings of the tenth ACM SIGKDD international conference on Knowledge discovery and data mining, pages 551-556, 2004. +Hiroyuki Takeda, Sina Farsiu, and Peyman Milanfar. Kernel regression for image processing and reconstruction. IEEE Transactions on image processing, 16(2):349-366, 2007. +Yao-Hung Hubert Tsai, Shaojie Bai, Makoto Yamada, Louis-Philippe Morency, and Ruslan Salakhutdinov. Transformer dissection: An unified understanding for transformer's attention via the lens of kernel. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 4344–4353, Hong Kong, China, November 2019. Association for Computational Linguistics. +Chuhan Wu, Fangzhao Wu, and Yongfeng Huang. DA-transformer: Distance-aware transformer. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 2059-2068, Online, June 2021b. Association for Computational Linguistics. +Shengjie Luo, Shanda Li, Tianle Cai, Di He, Dinglan Peng, Shuxin Zheng, Guolin Ke, Liwei Wang, and Tie-Yan Liu. Stable, fast and accurate: Kernelized attention with relative positional encoding. Advances in Neural Information Processing Systems, 34, 2021. +Ali Rahimi and Benjamin Recht. Random features for large-scale kernel machines. In J. Platt, D. Koller, Y. Singer, and S. Roweis, editors, Advances in Neural Information Processing Systems, volume 20. Curran Associates, Inc., 2007. +Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, and François Fleuret. Transformers are RNNs: Fast autoregressive transformers with linear attention. In Hal Daumé III and Aarti Singh, editors, Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pages 5156-5165. PMLR, 13-18 Jul 2020. +Yifan Chen, Qi Zeng, Heng Ji, and Yun Yang. Skyformer: Remodel self-attention with gaussian kernel and nystr\`" om method. Advances in Neural Information Processing Systems, 34, 2021c. +Yunyang Xiong, Zhanpeng Zeng, Rudrasis Chakraborty, Mingxing Tan, Glenn Fung, Yin Li, and Vikas Singh. Nystromformer: A nystom-based algorithm for approximating self-attention. In Proceedings of the... AAAI Conference on Artificial Intelligence. AAAI Conference on Artificial Intelligence, volume 35, page 14138. NIH Public Access, 2021. +Hao Peng, Nikolaos Pappas, Dani Yogatama, Roy Schwartz, Noah Smith, and Lingpeng Kong. Random feature attention. In International Conference on Learning Representations, 2021. +Krzysztof Marcin Choromanski, Valerii Likhosherstov, David Dohan, Xingyou Song, Andreea Gane, Tamas Sarlos, Peter Hawkins, Jared Quincy Davis, Afroz Mohiuddin, Lukasz Kaiser, David Benjamin Belanger, Lucy J Colwell, and Adrian Weller. Rethinking attention with performers. In International Conference on Learning Representations, 2021. +Zhen Qin, Weixuan Sun, Hui Deng, Dongxu Li, Yunshen Wei, Baohong Lv, Junjie Yan, Lingpeng Kong, and Yiran Zhong. cosformer: Rethinking softmax in attention. In International Conference on Learning Representations, 2022. +Christian Berg, Jens Peter Reus Christensen, and Paul Ressel. Harmonic analysis on semigroups: theory of positive definite and related functions, volume 100. Springer, 1984. +Isaac J Schoenberg. Metric spaces and positive definite functions. Transactions of the American Mathematical Society, 44(3):522-536, 1938. + +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierrick Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander Rush. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 38-45, Online, October 2020. Association for Computational Linguistics. +Leo Gao, Stella Biderman, Sid Black, Laurence Golding, Travis Hoppe, Charles Foster, Jason Phang, Horace He, Anish Thite, Noa Nabeshima, et al. The pile: An 800gb dataset of diverse text for language modeling. arXiv preprint arXiv:2101.00027, 2020. +Sid Black, Stella Biderman, Alex Andonian, Quentin Anthony, Preetham Gali, Leo Gao, Eric Hallahan, Josh Levy-Kramer, Connor Leahy, Lucas Nestler, Kip Parker, Jason Phang, Michael Pieler, Shivanshu Purohit, Tri Songz, Phil Wang, and Samuel Weinbach. GPT-NeoX: Large scale autoregressive language modeling in pytorch, 2021. URL http://github.com/eleutherai/gpt-neox. +Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper, and Bryan Catanzaro. Megatron-lm: Training multi-billion parameter language models using model parallelism. arXiv preprint arXiv:1909.08053, 2019. +Jeff Rasley, Samyam Rajbhandari, Olatunji Ruwase, and Yuxiong He. Deepspeed: System optimizations enable training deep learning models with over 100 billion parameters. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 3505-3506, 2020. +Dhiraj Kalamkar, Dheevatsa Mudigere, Naveen Mellempudi, Dipankar Das, Kunal Banerjee, Sasikanth Avancha, Dharma Teja Vooturi, Nataraj Jammalamadaka, Jianyu Huang, Hector Yuen, et al. A study of bfloat16 for deep learning training. arXiv preprint arXiv:1905.12322, 2019. \ No newline at end of file diff --git a/kerplekernelizedrelativepositionalembeddingforlengthextrapolation/images.zip b/kerplekernelizedrelativepositionalembeddingforlengthextrapolation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..0cc917250aa6ba148c0724538702b93144609307 --- /dev/null +++ b/kerplekernelizedrelativepositionalembeddingforlengthextrapolation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd74b1085131525e76be18fa8d9374792d94062646d8d0145a7f252559d6dbeb +size 517084 diff --git a/kerplekernelizedrelativepositionalembeddingforlengthextrapolation/layout.json b/kerplekernelizedrelativepositionalembeddingforlengthextrapolation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..5db1fbe4379d08a1a25844fa543e6491dc41d550 --- /dev/null +++ b/kerplekernelizedrelativepositionalembeddingforlengthextrapolation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e38572a7c56e49c03c3bfa81f69d5146471b952f3e96363e42b43274e32d9557 +size 437908 diff --git a/keypointguidedoptimaltransportwithapplicationsinheterogeneousdomainadaptation/33068a0c-51d5-42c0-bc5d-91751a717768_content_list.json b/keypointguidedoptimaltransportwithapplicationsinheterogeneousdomainadaptation/33068a0c-51d5-42c0-bc5d-91751a717768_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..fe847129fc10f82b5695b30fdccff1b6eac169b5 --- /dev/null +++ b/keypointguidedoptimaltransportwithapplicationsinheterogeneousdomainadaptation/33068a0c-51d5-42c0-bc5d-91751a717768_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a8f228b34a5776425438dc6a93763334dfd29ac984453c7d242106900ae2871 +size 91041 diff --git a/keypointguidedoptimaltransportwithapplicationsinheterogeneousdomainadaptation/33068a0c-51d5-42c0-bc5d-91751a717768_model.json b/keypointguidedoptimaltransportwithapplicationsinheterogeneousdomainadaptation/33068a0c-51d5-42c0-bc5d-91751a717768_model.json new file mode 100644 index 0000000000000000000000000000000000000000..8f2215bf0c1c797d88882d7f9647589d1cf7535a --- /dev/null +++ b/keypointguidedoptimaltransportwithapplicationsinheterogeneousdomainadaptation/33068a0c-51d5-42c0-bc5d-91751a717768_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ceb9fdf4ec82a5e14e055db77d98218c42d7f67f332eb66aac01b7158a78dae7 +size 117521 diff --git a/keypointguidedoptimaltransportwithapplicationsinheterogeneousdomainadaptation/33068a0c-51d5-42c0-bc5d-91751a717768_origin.pdf b/keypointguidedoptimaltransportwithapplicationsinheterogeneousdomainadaptation/33068a0c-51d5-42c0-bc5d-91751a717768_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..ef0f95be38472aaeeb1a9525efab1d151f82cc57 --- /dev/null +++ b/keypointguidedoptimaltransportwithapplicationsinheterogeneousdomainadaptation/33068a0c-51d5-42c0-bc5d-91751a717768_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5b23beb49db2dff286c098a90db3dc376ed7d06d82243cc4aefe96231b1e49e2 +size 2934651 diff --git a/keypointguidedoptimaltransportwithapplicationsinheterogeneousdomainadaptation/full.md b/keypointguidedoptimaltransportwithapplicationsinheterogeneousdomainadaptation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..67172618068a4536d218cd60ff273c2ee3c6ba1c --- /dev/null +++ b/keypointguidedoptimaltransportwithapplicationsinheterogeneousdomainadaptation/full.md @@ -0,0 +1,368 @@ +# Keypoint-Guided Optimal Transport with Applications in Heterogeneous Domain Adaptation + +Xiang Gu $^{1}$ , Yucheng Yang $^{1}$ , Wei Zeng $^{1}$ , Jian Sun $(\boxtimes)^{123}$ , Zongben Xu $^{123}$ + +1 School of Mathematics and Statistics, Xi'an Jiaotong University, Xi'an, China + +$^{2}$ Pazhou Laboratory (Huangpu), Guangzhou, China + +3 Peng Cheng Laboratory, Shenzhen, China + +{xianggu,ycyang}@stu.xjtu.edu.cn{wz,jiangsun,zbxu}@xjtu.edu.cn + +# Abstract + +Existing Optimal Transport (OT) methods mainly derive the optimal transport plan/matching under the criterion of transport cost/distance minimization, which may cause incorrect matching in some cases. In many applications, annotating a few matched keypoints across domains is reasonable or even effortless in annotation burden. It is valuable to investigate how to leverage the annotated keypoints to guide the correct matching in OT. In this paper, we propose a novel KeyPoint-Guided model by ReLation preservation (KPG-RL) that searches for the matching guided by the keypoints in OT. To impose the keypoints in OT, first, we propose a mask-based constraint of the transport plan that preserves the matching of keypoint pairs. Second, we propose to preserve the relation of each data point to the keypoints to guide the matching. The proposed KPG-RL model can be solved by the Sinkhorn's algorithm and is applicable even when distributions are supported in different spaces. We further utilize the relation preservation constraint in the Kantorovich Problem and Gromov-Wasserstein model to impose the guidance of keypoints in them. Meanwhile, the proposed KPG-RL model is extended to partial OT setting. As an application, we apply the proposed KPG-RL model to the heterogeneous domain adaptation. Experiments verified the effectiveness of the KPG-RL model. Code is available at https://github.com/XJTU-XGU/KPG-RL. + +# 1 Introduction + +As a mathematical tool for distribution alignment, mass transport, etc., Optimal Transport (OT) [1] has gained increasing attention in the machine learning community. OT aims to derive a transport map or plan between a source and a target distribution, such that the transport cost is minimized. Due to its capacity to exploit the geometric property of data, OT has been employed in many applications, e.g., computer vision [2, 3], natural language processing [4, 5, 6, 7], generative adversarial network [8], domain adaptation [9], clustering [10], anomaly detection [11], etc. OT has two typical formulations, i.e., the Monge's formulation [12] and the Kantorovich's formulation [13]. The Kantorovich's formulation [13] relaxes the Monge's formulation and attracts broader studies in applications. Unless otherwise stated, by OT, we refer to the Kantorovich's formulation in this paper. The original OT model, i.e., the Kantorovich Problem [13] (KP), is a linear program that is computationally expensive. The entropy-regularized OT [14] introduces the entropy of the transport plan as regularization to the OT model which is solved by the computationally cheaper Sinkhorn-Knopp algorithm [15] allowing to use automatic differentiation [16]. + +KP needs to transport all the mass of source distribution to exactly match the mass of target distribution. But in some cases, only partial mass of source and target distributions should be matched, e.g., the source or target samples contain outliers. To overcome this limitation, the partial OT [17, 18, 19, 20], + +![](images/43a922ad23d857bce7a38a55ca0906cbae6cdf4853bc93b4dbf7a578bdf0dba2.jpg) +(a) Samples + +![](images/20bf302077fc0ad62f8d1386fc30864cf9fdaf2dc25fcd30cb1e719f071451bd.jpg) +(b) KP +Figure 1: (a) Positive (cross) and negative (circle) samples of source (in blue) and target (in green) distributions. (b) KP distorts the data structure, leading to mismatch of some positive and negative samples. (c) GW model better preserves the data structure, but completely mismatches the samples. (d) Our proposed KPG-RL model utilizes some keypoints (red pairs) to guide the transport and produce correct matching. + +![](images/6aec33462c0fecbb30b28fb38ed29d4ba91b98a837ec499833014e32b0c52a8c.jpg) +(c) GW + +![](images/5eda82b0f93b4fca4d65146fad8a9acca6b253967ac84f6f6592cdf36853e0ff.jpg) +(d) KPG-RL (ours) + +unbalanced OT [21, 22], and robust OT [23, 24, 25] models are presented, that allow to transport only partial mass of distribution. Another extension of KP is the Gromov-Wasserstein (GW) model [26, 27] that computes the distance between metrics defined within each domain rather than between samples across domains as in KP. + +In most of the above models, the main criterion for the optimal transport plan/matching is by the minimization of total transport distance or distortion over all samples. Though having achieved promising results in many applications, without any additional guidance, the OT models may lead to incorrect matching of samples. Figures 1(b) and 1(c) illustrate examples of incorrect matching produced by KP and GW models. In many applications, it is reasonable to annotate some paired keypoints across domains for guiding the matching in OT. For instance, in non-rigid point set or image registration [28, 29], a few keypoint pairs that should be matched are annotated in two point sets/images. In semi-supervised domain adaptation [30] and heterogeneous domain adaptation [31], there are a few labeled target domain data and large amount of labeled source domain data available, that could be directly taken as keypoints. Therefore, it is valuable and important to investigate how to take advantage of those keypoints to guide the correct matching in OT. Figure 1(d) shows an example that with the guidance of a few keypoints, the correctness of matching can be improved. + +In this paper, we propose a novel KeyPoint-Guided model by ReLation preservation (KPG-RL) for leveraging the annotated keypoints to guide the matching in OT. In KPG-RL, we first preserve the matching of keypoint pairs in OT using a mask-based constraint of the transport plan. We then propose to preserve the relation of each data point to the keypoints in transport, enforcing the matching of the data points near paired keypoints across domains. The proposed KPG-RL model is applicable even when distributions lie in different spaces, and can be solved by Sinkhorn's algorithm. We further enforce the relation preservation constraint in KP and GW to impose the guidance of keypoints in them. To tackle the problems that only partial mass should be transported, we extend the KPG-RL model to partial OT setting, forming partial-KPG-RL model. + +As an application, we apply the KPG-RL model to the heterogeneous domain adaptation (HDA) [31]. HDA is a transfer learning task that aims to transfer the knowledge of large-scale labeled source domain data to the target domain where a few labeled and larger amounts of unlabeled data are available for training. The "heterogeneity" implies that the source and target domain data are in heterogeneous feature spaces, e.g., generated by different deep networks. This heterogeneity poses a major obstacle in adapting the source trained model to the target domain. We take the labeled target domain data and source class centers as keypoints and transport source domain data to target domain by our KPG-RL model. Upon the transported source domain data and the labeled target domain data, a classification model is trained that is transferable to the target domain. Experiments show that the KPG-RL model is effective for HDA. + +In the following sections, we discuss the related works in Sect. 2, and introduce the background of OT in Sect. 3. In Sect. 4, we discuss the details of the proposed KPG-RL model. In Sect. 5, we apply the KPG-RL model to HDA. Section 6 concludes this paper. + +Notations. $\Sigma_{m} = \{\pmb{p}\in \mathbb{R}_{+}^{m}|\sum_{i}\pmb{p}_{i} = 1\}$ is the probability simplex. $\langle \cdot ,\cdot \rangle_F$ is the Frobenius dot product of two matrices. $\odot$ stands for the Hadamard product. $\mathbb{1}_m$ denotes $m$ -dimensional all-one vector. $\pi_{i,:}$ and $\pi_{:,j}$ are respectively the $i$ -th row and $j$ -th column of matrix $\pi$ + +# 2 Related Works + +We review below the most related OT models and HDA methods to our work. + +OT models. The GW model [27] seeks a "distance-preserving" transport plan such that the distance between transported points in target domain is the same as the distance between the original points in source domain. Our KPG-RL model aims to use keypoint pairs to guide the matching in OT by preserving the relation of each point to the keypoints. Our "relation-preserving" scheme preserves the relation of data w.r.t. the given keypoints, different from the pairwise distance-preserving constraint in GW. We experimentally verified the effectiveness of relation-preserving scheme for introducing the guidance of keypoints in OT. From the computational point of view, GW is a non-convex quadratic program, while KPG-RL is a linear program. Lin et al. [32] use the anchors to encourage clustering of data and to impose rank constraints on the transport plan to improve its robustness to outliers. The "anchors" in [32] are intermediate points in computation for improving robustness, different from the "keypoints" in this paper, which are the annotated paired data for guiding the matching in OT. Hierarchical OT [7, 33, 34] transports points by dividing them into some subgroups and then derives the transportation of these subgroups using OT. Different in goal and methodology from Hierarchical OT, we impose the guidance of keypoints for pursuing correct matching in OT by preserving the relation to the keypoints. We do not explicitly divide the points into subgroups, and there is no hierarchy in our method. TLB [27, 35] is a lower bound of GW that can be computed faster. TLB takes the ordered distance of each point to all the points in the same domain as features, and then performs the Kantorovich formulation of OT using such features. Differently, our method uses a carefully designed relation of each point to the keypoints to impose the guidance of keypoints to the other points. Courty et al. [9] constrain the cost function to encourage the matching of labeled data across source and target domains that share the same class labels for domain adaptation. They use the Laplacian regularization to preserve the data structure. Differently, we explicitly model the guidance of keypoints matching to the other data points in our OT formulation. The matching of paired keypoints is enforced by our mask-based constraint on the transport plan. Zhang et al. [36] propose Masked OT model as a regularization term to preserve the local feature invariances between finetuned and pretrained graph neural network (GNN) for the fine-tuning of GNNs. Though the Masked OT [36] shares similar spirits to the mask-based modeling in our method, our main contribution is the relation preservation for imposing the guidance of keypoints, different from [36] in methodology. For our mask-based modeling, it is utilized to impose the matching of keypoints which is theoretically guaranteed. While the mask in [36] aims to preserve the local information of finetuned network from pretrained models. The motivation and design of our mask are different from those in [36]. + +HDA methods. HDA methods could be roughly categorized into cross-domain mapping and common subspace learning methods. The cross-domain mapping approaches [31, 37, 38, 39, 40] learn a transform to map the source features or model parameters to target domain to achieve adaptation. The common subspace learning approaches [41, 42, 43, 44, 45, 46] learn domain-specific projections to map source and target domain data into a common subspace such that their distributions are aligned. Our method for HDA belongs to the first category, and could be mostly related to [37]. The method in [37] transports source samples to target domain using GW model regularized by the distance between the center of transported source samples and the center of labeled target samples having the same class labels. Different from [37], we take each labeled target domain data and its corresponding source domain class center as a paired keypoint and preserve the relation of each data to the set of keypoints in each domain when conducting OT. + +# 3 Background on Optimal Transport + +Kantorovich Problem (KP). We consider two sets of data points, i.e., the source data $\mathbf{X} = \{x_{i}\}_{i=1}^{m}$ and the target data $\mathbf{Y} = \{y_{j}\}_{j=1}^{n}$ , of which the empirical distributions are $\pmb{p} = \sum_{i=1}^{m} p_{i} \delta_{x_{i}}$ and $\pmb{q} = \sum_{j=1}^{n} q_{j} \delta_{y_{j}}$ . With a slight abuse of notations, we may also denote $\pmb{p} = (p_{1}, p_{2}, \dots, p_{m})^{\top} \in \Sigma_{m}$ and $\pmb{q} = (q_{1}, q_{2}, \dots, q_{n})^{\top} \in \Sigma_{n}$ as the mass supported on $\mathbf{X}$ and $\mathbf{Y}$ respectively. We define the cost matrix between $\mathbf{X}$ and $\mathbf{Y}$ as $C = (C_{i,j}) \in \mathbb{R}^{m \times n}$ with $C_{i,j} = c(x_{i}, y_{j})$ , where $c$ is a cost function, which is set to the squared $L_{2}$ -distance of $x_{i}$ and $y_{j}$ in our experiments. OT aims to optimally transport $\pmb{p}$ towards $\pmb{q}$ at the smallest cost, formulated as the following Kantorovich Problem (KP): + +$$ +\min _ {\pi \in \Pi (\boldsymbol {p}, \boldsymbol {q})} L _ {k p} (\pi) \triangleq \langle \pi , C \rangle_ {F}, \text {s . t .} \Pi (\boldsymbol {p}, \boldsymbol {q}) = \left\{\pi \in \mathbb {R} _ {+} ^ {m \times n} | \pi \mathbb {1} _ {n} = \boldsymbol {p}, \pi^ {\top} \mathbb {1} _ {m} = \boldsymbol {q} \right\}. \tag {1} +$$ + +![](images/c59012ee3360ac84145ad95f816b929d15ab6596ce19e6aa3c372f5f1e05b7f8.jpg) +Figure 2: Example of modeling the matching of keypoints (red) using mask. The left part illustrates the matching of data points with keypoint pairs $\mathcal{K} = \{(3,2),(6,5)\}$ . To preserve the matching of keypoint index pair $(i,j)$ , e.g., $(3,2)$ , the $i$ -th row and $j$ -th column of transport plan $\tilde{\pi}$ must be zeros except $\tilde{\pi}_{i,j}$ . Therefore, we can model $\tilde{\pi}$ by $\tilde{\pi} = M \odot \pi$ , where $M$ is the mask determined by the keypoints, and $\pi$ is to be optimized. + +When $c$ is taken as a distance metric (aka. ground metric), the minimum value of objective function in Eq. (1) is a distance between $p$ and $q$ , named Wasserstein distance. + +Partial OT model. The KP in Eq. (1) takes the mass preserving assumption that all the mass of $\pmb{p}$ is transported to exactly match the mass of $\pmb{q}$ . In many applications, only partial mass should be transported. The partial OT model [18, 19] seeks the minimal cost of transporting only $s$ unit mass from $\pmb{p}$ to $\pmb{q}$ , where $0 \leqslant s \leqslant \min(\| \pmb{p} \|_1, \| \pmb{q} \|_1)$ , formulated as + +$$ +\min _ {\pi \in \Pi^ {s} (\boldsymbol {p}, \boldsymbol {q})} L _ {k p} (\pi), \text {s . t .} \Pi^ {s} (\boldsymbol {p}, \boldsymbol {q}) = \left\{\pi \in \mathbb {R} _ {+} ^ {m \times n} | \pi \mathbb {1} _ {n} \leqslant \boldsymbol {p}, \pi^ {\top} \mathbb {1} _ {m} \leqslant \boldsymbol {q}, \mathbb {1} _ {m} ^ {\top} \pi \mathbb {1} _ {n} = s \right\}. \tag {2} +$$ + +Note that in partial OT, the total mass $\| \pmb{p} \|_1$ and $\| \pmb{q} \|_1$ are not necessarily equal. In the definition of $\Pi(\pmb{p}, \pmb{q})$ and $\Pi^s(\pmb{p}, \pmb{q})$ , $m$ and $n$ are respectively the length of $\pmb{p}$ and $\pmb{q}$ . + +Gromov-Wasserstein (GW) model. If the data points $x_{i}$ and $y_{j}$ lie in different spaces, the distance between $x_{i}$ and $y_{j}$ may not be computed. The GW [27] model then minimizes the distortion when transporting the whole set of points from one space to another. The GW model relies on the intra-domain distance of source domain as $C^{s} = (C_{i,k}^{s}) \in \mathbb{R}^{m \times m}$ and target domain as $C^{t} = (C_{j,l}^{t}) \in \mathbb{R}^{n \times n}$ where $C_{i,k}^{s}$ is the distance between source domain data $x_{i}$ and $x_{k}$ , and $C_{j,l}^{t}$ is the distance between target domain data $y_{j}$ and $y_{l}$ . The GW model is given by + +$$ +\min _ {\pi \in \Pi (\boldsymbol {p}, \boldsymbol {q})} L _ {g w} (\pi) \triangleq \sum_ {i, k = 1} ^ {m} \sum_ {j, l = 1} ^ {n} \pi_ {i, j} \pi_ {k, l} \left| C _ {i, k} ^ {s} - C _ {j, l} ^ {t} \right| ^ {2}. \tag {3} +$$ + +# 4 Keypoint-Guided Optimal Transport + +This section details our proposed keypoint-guided model that leverages the keypoints to guide the matching in OT. The guidance is imposed by preserving the matching of keypoint pairs and the relation of each data point to the keypoints. We first discuss the preservation of matching of keypoints, then introduce the modeling of relation, and finally present the keypoint-guided OT models. + +Preservation of matching of keypoints in transport. We denote the set of keypoint index pairs as $\mathcal{K} = \{(i_u,j_u)\}_{u = 1}^U$ with $U$ denoting the number of paired keypoints. We respectively denote $\mathcal{I} = \{i_u\}_{u = 1}^U$ and $\mathcal{J} = \{j_u\}_{u = 1}^U$ as the sets of source and target keypoint indexes. For the example illustrated in Fig. 2, $\mathcal{K} = \{(3,2),(6,5)\}$ , $\mathcal{I} = \{3,6\}$ , and $\mathcal{J} = \{2,5\}$ . To impose the guidance of these keypoints with indexes in $\mathcal{K}$ in deriving the matching in OT, we first guarantee the matching of the keypoint pairs. As illustrated in Fig. 2, we preserve the matching of keypoints in transport using a mask-based constraint of the transport plan, which is motivated by the following observation. If the paired keypoints $(i,j) \in \mathcal{K}$ are matched, the optimal transport plan $\tilde{\pi}$ satisfies that the $i$ -th row and $j$ -th column of $\tilde{\pi}$ must be zeros except $\tilde{\pi}_{i,j}$ , which means that the all mass of source keypoint $x_i$ must be transported to target keypoint $y_j$ and $y_j$ can only receive the mass from $x_i$ . For the example in Fig. 2, the 3-th row and 2-th column are zeros except that $\tilde{\pi}_{3,2} > 0$ . This sparsity of $\tilde{\pi}$ motivates us to model it as the Hadamard product of a mask matrix $M = (M_{i,j}) \in \mathbb{R}^{m \times n}$ and a matrix $\pi \in \mathbb{R}_+^{m \times n}$ with positive entries, i.e., + +$$ +\tilde {\pi} = M \odot \pi , \text {w i t h} \tilde {\pi} _ {i, j} = M _ {i, j} \pi_ {i, j}. \tag {4} +$$ + +With Eq. (4), we define the admissible solution set for our keypoint-guided OT model as + +$$ +\Pi (\boldsymbol {p}, \boldsymbol {q}; M) = \left\{\pi \in \mathbb {R} _ {+} ^ {m \times n} | (M \odot \pi) \mathbb {1} _ {n} = \boldsymbol {p}, (M \odot \pi) ^ {\top} \mathbb {1} _ {m} = \boldsymbol {q} \right\}. \tag {5} +$$ + +Note that the $\pi$ in Eq. (5) is not necessarily a coupling. The entry $M_{i,j}$ of the mask matrix $M$ is set to 0 if $\tilde{\pi}_{i,j}$ needs to be 0, otherwise $M_{i,j}$ is set to 1. Figure 2 illustrates the mask-based modeling of Eq. (4). $M$ is constructed as in Proposition 1. + +Proposition 1. Suppose that the mask matrix $M$ satisfies that + +$$ +M _ {i, j} = \left\{ \begin{array}{l l} 1, & \text {i f} (i, j) \in \mathcal {K}, \\ 0, & \text {i f} i \in \mathcal {I} \text {a n d} (i, j) \notin \mathcal {K}, \\ 0, & \text {i f} j \in \mathcal {J} \text {a n d} (i, j) \notin \mathcal {K}, \\ 1, & \text {o t h e r w i s e} (i. e., i \notin \mathcal {I} \text {a n d} j \notin \mathcal {J}). \end{array} \right. \tag {6} +$$ + +and $p_i = q_j$ , for $(i,j) \in \mathcal{K}$ . Then, the transport plan $\tilde{\pi} = M \odot \pi$ with $\pi \in \Pi(\pmb{p},\pmb{q};M)$ preserves the matching of paired keypoints with index pairs in $\mathcal{K}$ . + +More explanations of the construction of $M$ and the proof of Proposition 1 are provided in Appendix A.1. Proposition 1 indicates that if $p_i = q_j$ , for $(i,j) \in \mathcal{K}$ , the matching of keypoint pairs is preserved by the mask-based constraint. This mask-based modeling in Eq. (4) is also applicable even for the case that there exist some $(i,j) \in \mathcal{K}$ such that $p_i \neq q_j$ . For this case, we shall use different mask matrices. Please refer to Appendix A.1 for the details. + +Modeling the relation to keypoints. To use the keypoints to guide the matching in transport, we propose to preserve the relation of each point to the set of keypoints in transport. Figure 3 illustrates the relation within points of each distribution. For the data point $x_{k} \in X$ , its relation score + +to the keypoint $x_{i_u}$ for $i_u\in \mathcal{I}$ (illustrated by red circle in the left of Fig. 3) is defined as + +$$ +R _ {k, i _ {u}} ^ {s} = \frac {e ^ {- C _ {k , i _ {u}} ^ {s} / \tau}}{\sum_ {u ^ {\prime} = 1} ^ {U} e ^ {- C _ {k , i _ {u}} ^ {s} / \tau}}, \forall i _ {u} \in \mathcal {I}, \tag {7} +$$ + +where $C_{k,i_u}^s$ is the $l_2$ -distance between $x_{k}$ and $x_{i_u}$ , and $\tau$ is temperature set as $\tau = \rho * \max_{i,k} \{C_{i,k}^s\}$ in experiments. Similarly, for $y_l \in Y$ , its relation score to the keypoint $y_{j_u}$ for $j_u \in \mathcal{J}$ is defined as + +$$ +R _ {l, j _ {u}} ^ {t} = \frac {e ^ {- C _ {l , j _ {u}} ^ {t} / \tau^ {\prime}}}{\sum_ {u ^ {\prime} = 1} ^ {U} e ^ {- C _ {l , j _ {u}} ^ {t} / \tau^ {\prime}}}, \forall j _ {u} \in \mathcal {J}, \tag {8} +$$ + +where $C_{l,j_u}^t$ is the distance between $y_{l}$ and $y_{j_u}$ , $\tau'$ is temperature set to $\rho * \max_{j,l} \{C_{j,l}^t\}$ . The setting of $\tau$ and $\tau'$ implies that the distances + +are divided by their maximum value, and normalized to [0, 1], which increases the robustness of the relation score to the scale of the distances. $\rho$ is a tunable parameter and set to 0.1 in our experiments, since 0.1 is a commonly used temperature in the softmax function [47, 48]. We denote $R_{k}^{s} = (R_{k,i_{1}}^{s}, R_{k,i_{2}}^{s}, \dots, R_{k,i_{U}}^{s})$ and $R_{l}^{t} = (R_{l,j_{1}}^{t}, R_{l,j_{2}}^{t}, \dots, R_{l,j_{U}}^{t})$ that represent the relation of data points $x_{k}$ and $y_{l}$ to the keypoints in source and target domains respectively. From the definition of the relation, the cross domain points near to a paired keypoints share similar relation to the keypoints in corresponding domain. For instance, in Fig. 3, $x_{k}$ and $y_{l}$ near to the paired keypoints with indexes $(i_{2}, j_{2})$ have similar relation $R_{k}^{s}$ and $R_{l}^{t}$ . Meanwhile, if $x_{k}$ is distant from all the keypoints, $R_{k}^{s}$ is close to a uniform probability vector. + +Keypoint-guided model. Based on the relation given above, we define the guiding matrix $G = (G_{k,l}) \in \mathbb{R}^{m \times n}$ by $G_{k,l} = d(R_k^s, R_l^t)$ where $d$ measures the dissimilarity of $R_k^s$ and $R_l^t$ . Then, $G_{k,l}$ is with small and even near to 0 if $R_k^s$ and $R_l^t$ are similar. $d$ is taken as the Jensen-Shannon divergence in this paper. We will study the effect of $d$ in Appendix B.5. By using the mask-based constraint of transport plan, the KeyPoint-Guided model by ReLation preservation (KPG-RL) is defined as + +$$ +\min _ {\pi \in \Pi (\boldsymbol {p}, \boldsymbol {q}; M)} L _ {k p g} (\pi) \triangleq \langle M \odot \pi , G \rangle_ {F}. \tag {9} +$$ + +![](images/efec5479e07136406b8439eedacd8f219e93773714d657b56b472ae3cb34f3b7.jpg) +Figure 3: Illustration of relation of each point to the keypoints (red). In the keypoint-guided OT model, the relation of each point to keypoints should be preserved after transport. + +![](images/0f8a986a8cdb1ef63330304eb7329ce2e023544fef835b364a756e8da0a4b4fc.jpg) + +$$ +\pi) \triangleq \langle M \odot \pi , G \rangle_ {F}. \tag {9} +$$ + +By the KPG-RL model in Eq. (9), first, the matching of keypoint pairs is enforced by the mask-based constraint of the transport plan. Second, the minimization of the objective function enforces that the optimal transport plan has larger entries in the locations where the entries of $G$ are smaller. Hence the cross-domain points corresponding to these locations (e.g., $k$ and $l$ shown in Fig. 3) that are near to a paired keypoints tend to be matched. Based on the softmax-based formulations in Eqs. (7) and (8), $d(R_k^s, R_l^t)$ is mainly determined by the relation score to the closest keypoint(s), since relation scores to the distant keypoints are small or close to 0. This implies that the points are mainly guided by the closest keypoints in our KPG-RL model in Eq. (9). For the points distant from all the keypoints, their corresponding entries of $G$ are close to zeros according to the definition of $G$ . Therefore, the guidance of keypoints to these points is limited. To achieve correct matching of these points, additional information, e.g., point-wise cost or more keypoints, is needed. + +Equation (9) is a linear program and can be solved by linear programming algorithms, e.g., the Simplex algorithm. We give the details for reformulating Eq. (9) as the standard form of linear programming in Appendix A.2. Since Sinkhorn's algorithm offers a lightspeed computation of the entropy-regularized OT [14], a natural question is that, can Sinkhorn's algorithm be applied to the KPG-RL model with entropy regularization? We give the positive answer, and the details of the deduction are given in Appendix A.3. The iterative formulas are + +$$ +\boldsymbol {u} ^ {(l + 1)} = \frac {\boldsymbol {p}}{K \boldsymbol {v} ^ {l}}, \quad \boldsymbol {v} ^ {(l + 1)} = \frac {\boldsymbol {q}}{K ^ {\top} \boldsymbol {u} ^ {(l + 1)}}, \tag {10} +$$ + +where $K = M \odot e^{-G / \epsilon}$ , $\epsilon$ is the coefficient of entropy regularization. The division operator used above is entry-wise. After iteration, the optimal transport plan is $\mathrm{diag}(\pmb{u}) K \mathrm{diag}(\pmb{v})$ . + +Note that in this KPG-RL model in Eq. (9), the points in $\mathbf{X}$ and $\mathbf{Y}$ do not necessarily lie in the same space because we only need to compute the distance within each one of $\mathbf{X}$ and $\mathbf{Y}$ . Therefore the proposed KPG-RL model in Eq. (9) is applicable even when $\mathbf{p}$ and $\mathbf{q}$ are supported in different spaces. As mentioned in Sect. 1, the GW model is applicable for transport across different spaces. However, GW is a non-convex quadratic program and is often solved by the Frank-Walfe algorithm in which a KP-like problem needs to be solved at each iteration by Sinkhorn's algorithm or linear programming. Surprisingly, our KPG-RL model can be directly solved using Sinkhorn's algorithm or linear programming without additional iteration, as discussed above. + +Imposing keypoint guidance in KP/GW. We can impose the keypoint guidance in KP by adding $L_{kpg}(\pi)$ as a regularization term to KP, obtaining the following KPG-RL-KP model: + +$$ +\min _ {\pi \in \Pi (\boldsymbol {p}, \boldsymbol {q}; M)} \left\{\alpha L _ {k p} (M \odot \pi) + (1 - \alpha) L _ {k p g} (\pi) = \langle M \odot \pi , \alpha C + (1 - \alpha) G \rangle_ {F} \right\}, \alpha \in (0, 1). \tag {11} +$$ + +The KPG-RL-KP can be solved by Sinkhorn's algorithm or linear programming, the same as the solution of KPG-RL model. Similarly, we define the KPG-RL-GW model in GW by + +$$ +\min _ {\pi \in \Pi (\boldsymbol {p}, \boldsymbol {q}; M)} \alpha L _ {g w} (M \odot \pi) + (1 - \alpha) L _ {k p g} (\pi), \alpha \in (0, 1). \tag {12} +$$ + +The KPG-RL-GW model is solved using the Frank-Walfe algorithm of which the details are given in Appendix A.4. The KPG-RL-KP/KPG-RL-GW models take both advantages of KP/GW and KPG-RL models, and could be helpful especially when the number of paired keypoints is small. We show in Appendix A.5 that the KPG-RL-KP and KPG-RL-GW provide a proper metric and a divergence under mild conditions. $\alpha$ is simply set to 0.5 in our experiments. + +Extension to partial OT. We now extend the above KPG-RL model to the more practical partial OT setting that only partial mass is transported. To do this, we first apply the above mask-based constraint of transport plan to the partial OT model in Eq. (2). We then add more constraints to enforce that all the mass of keypoints is transported to preserve the matching of keypoints. Finally, we define the partial-KPG-RL model as + +$$ +\min _ {\pi \in \Pi^ {s} (\boldsymbol {p}, \boldsymbol {q}; M)} \left\{L _ {k p g} (M \odot \pi) = \langle M \odot \pi , G \rangle_ {F} \right\}, \tag {13} +$$ + +where $\Pi^s (\pmb {p},\pmb {q};M) = \{\pi \in \mathbb{R}_+^{m\times n}|(M\odot \pi)\mathbb{1}_n\leqslant \pmb {p},(M\odot \pi)^\top \mathbb{1}_m\leqslant \pmb {q},\mathbb{1}_m^\top (M\odot \pi)\mathbb{1}_n = s;(M\odot \pi)_{i,:}\mathbb{1}_n = p_i,\forall i\in \mathcal{I};\mathbb{1}_m^\top (M\odot \pi)_{.,j} = q_j,\forall j\in \mathcal{J}\}$ . Chapel et al. [20] propose a compelling method to solve the original partial OT problem in Eq. (2) by transforming the partial OT problem into an OT-like problem. Inspired by Chapel et al. [20], to solve our partial-KPG-RL model + +![](images/7cae16b72a12d1efe0559ba7adcae361f2a63e47add581a1648bd84ad68d4e1e.jpg) +(a) KP + +![](images/16ab31f499efc803ac922bd24de9fd7f08af93e220fce33d0845079c8f4309f8.jpg) +(b) KPG-RL-KP (w/ 2 keypoints) + +![](images/307c313345615c525fc61b118c30ec8b9651f9e99e9af82f210e2238776c1c7f.jpg) +(c) KPG-RL-KP (w/ 3 keypoints) + +![](images/bd3a5faf20b35e9833d481f8d60875a6b5900054af5a8cd99b8c39b852a3b2a6.jpg) +(d) GW + +![](images/33b48e630716f6eeb98eb23b5020ffe3feb57aa1f7aac71a19a6b7790ff8015b.jpg) +(e) KPG-RL-GW (w/ 2 keypoints) + +![](images/98bee3f436de496b0a59bcae7bf0465a53e760cb1a11747c5c1b59fa01991036.jpg) +(f) KPG-RL-GW (w/ 3 keypoints) +Figure 4: Matching produced by (a) KP, (b) KPG-RL-KP model given 2 keypoint pairs, (c) KPG-RL-KP model given 3 keypoint pairs, (d) GW model, (e) KPG-RL-GW model given 2 keypoint pairs, and (f) KPG-RL-GW model given 3 keypoint pairs. + +in Eq. (13), we add a dummy point to each of the marginal distributions to transform Eq. (13) into a KPG-RL-like problem. To do this, we extend $\pmb{p}, \pmb{q}, G, M$ by + +$$ +\bar {\boldsymbol {p}} = \left[ \begin{array}{c} \boldsymbol {p} \\ \| \boldsymbol {q} \| _ {1} - s \end{array} \right], \bar {\boldsymbol {q}} = \left[ \begin{array}{c} \boldsymbol {q} \\ \| \boldsymbol {p} \| _ {1} - s \end{array} \right], \bar {G} = \left[ \begin{array}{c c} G & \xi \mathbb {1} _ {n} \\ \xi \mathbb {1} _ {m} ^ {\top} & 2 \xi + A \end{array} \right], \bar {M} = \left[ \begin{array}{c c} M & \boldsymbol {a} \\ \boldsymbol {b} ^ {\top} & 1 \end{array} \right], +$$ + +where $A > 0, \xi > 0$ , $\pmb{a} \in \mathbb{R}^m$ , $\pmb{b} \in \mathbb{R}^n$ . The element $a_i$ of $\pmb{a}$ is 0 if $i \in \mathcal{I}$ , otherwise 1. The element $b_j$ of $\pmb{b}$ is 0 if $j \in \mathcal{J}$ , and 1 otherwise. For more motivations of this extension, please refer to Appendix A.6. By the following theorem, solving the optimal transport plan of problem (13) boils down to solving the problem $\min_{\bar{\pi} \in \Pi(\bar{p}, \bar{q}; \bar{M})} \langle \bar{M} \odot \bar{\pi}, \bar{G} \rangle_F$ . + +Theorem 1. Suppose $A > 0$ , $\xi > 0$ , $\sum_{i\in I}p_i < s$ , and $\sum_{j\in J}q_j < s$ , then the optimal transport plan $M\odot \pi^{*}$ of problem (13) is the $m$ -by- $n$ block in the upper left corner of the optimal transport plan $\bar{M}\odot \bar{\pi}^{*}$ of problem $\min_{\bar{\pi}\in \Pi (\bar{p},\bar{q};\bar{M})}\langle \bar{M}\odot \bar{\pi},\bar{G}\rangle_F$ . + +Please refer to Appendix A.7 for the proof of Theorem 1. + +# 5 Experiments + +We evaluate the keypoint-guided models on toy data, and apply them to HDA and open-set HDA. + +# 5.1 Toy Data + +As illustrated in Fig. 4, in this toy data experiment, each of the source (blue) and target (green) distributions is a Gaussian mixture composed of three distinct Gaussian components indicated by different shapes where the same shapes indicate points of the same class. In Fig. 4, we have the following observations. In Fig. 4(a), in the KP model, the points in each component of target distribution are mismatched to points in different classes of source distributions, and only a small fraction of target points are correctly matched to source points belonging to the same class. In Fig. 4(b), given 2 keypoint pairs (from distinct classes), the KPG-RL-KP model apparently improves the correctness of matching. In Fig. 4(c), the KPG-RL-KP model mainly matches the source points to the target points belonging to the same class, thanks to the given 3 keypoint pairs. This implies that our proposed keypoint-guided model does help to produce correct matching in OT by leveraging the + +Table 1: Accuracy on Office-31 for HDA. "A", "W", and "D" are respectively the domains of amazon, webcam, and dslr. " $\cdot \rightarrow *$ " denotes a heterogeneous adaptation task where $\cdot$ and $*$ are respectively source domain using DeCAF $_6$ feature and target domain using ResNet-50 feature. + +
MethodA→AA→DA→WD→AD→DD→WW→AW→DW→WAvg
Labeled-target-only45.369.267.345.369.267.345.369.267.360.6
STN [50]58.784.880.051.291.083.852.895.287.476.1
SSAN [51]56.889.787.154.282.690.350.085.885.875.8
DDACL [52]44.263.264.243.977.470.639.864.573.260.1
CDSPP [45]55.579.776.543.280.684.247.478.784.570.0
SGW [37]49.777.773.649.478.473.648.780.374.567.3
GW [27]33.641.635.539.740.031.734.834.529.035.6
GW (w/ mask)41.371.669.741.971.269.840.371.669.760.8
HOT [33]39.044.840.031.352.644.829.760.056.544.3
HOT (w/ mask)45.260.357.448.963.559.240.367.161.455.9
TLB [27]29.436.543.224.531.351.023.631.949.735.7
TLB (w/ mask)42.566.364.738.568.565.943.168.267.358.3
KPG (w/ dist)55.260.771.651.371.977.148.770.077.764.9
KPG-RL-GW58.792.984.257.495.587.155.595.590.079.6
KPG-RL (LP)56.593.683.258.194.586.855.895.289.779.3
KPG-RL (SH)60.091.683.657.495.887.759.195.288.479.9
+ +given a few keypoint pairs. In Figs. 4(d), 4(e) and 4(f), the proposed KPG-RL-GW model improves the correctness of matching of GW model by leveraging the guidance of given keypoints pairs. Please refer to Appendix B.1 for the toy experiment for evaluating the partial-KPG-RL model. + +# 5.2 Heterogeneous Domain Adaptation + +In HDA, we are given a large amount of labeled source domain data $\{(x_i,t_i)\}_{i = 1}^m$ , a few labeled target domain data $\{y_j,\bar{t}_j\}_{j = 1}^{n_l}$ , and large number of unlabeled target domain data $\{y_j\}_{j = n_l + 1}^n$ , where $m\gg n_l,n\gg n_l,x_i$ and $y_{j}$ are features, and $t_i$ and $\bar{t}_j$ are respectively the class labels of $x_{i}$ and $y_{j}$ . The heterogeneity means that $x_{i}$ and $y_{j}$ are from different spaces/modalities. The goal of HDA is to train a classification model using the given data to predict the label of unlabeled target domain data, leveraging the knowledge of large-scale labeled source domain data. The main challenge is that the domain gap between heterogeneous source and target distributions supported in distinct spaces hinders the direct employment of the source domain trained model in the target domain. + +We tackle the problem of HDA using our proposed KPG-RL model as follows. We first transport the source domain data using our KPG-RL model to the target domain. More concretely, in KPG-RL, each labeled target domain data and the source domain class center of the same class are taken as a matched keypoint pair. The KPG-RL model is then performed between empirical distributions of the source domain data along with class centers and the target domain data (including labeled and unlabeled data). Based on the produced optimal transport plan, we transport the source domain data using the barycentric mapping [49] to the target domain. Finally, we train the classification model (taken as a kernel SVM) on the transported source domain data (using their class label before transport) and the labeled target domain data, which is applied to the target domain test data. $\epsilon$ is set to 0.005. More details of the barycentric mapping, the kernel SVM, etc, are given in Appendix B.4. + +We compare our method with the following baseline methods, including 1) "Labeled-target-only" that trains the kernel SVM using the labeled target data; 2) the OT methods of "GW", "HOT", and "TLB" that transport source domain data using barycentric mapping induced by the transport plan of GW [27], Hierarchical OT [33], and TLB [27], and then train the kernel SVM on the transported data and labeled target domain data; 3) the typical HDA methods of "SGW" [37] and "STN" [50], and the recent HDA methods of "SSAN" [51], "DDACL" [52] and "CDSPP" [45]. We conduct experiments on Office-31 [53] dataset. On Office-31, we use the $\mathrm{DeCAF_6}$ [54] features and the features extracted by ResNet-50 [55] pretrained on ImageNet [56] to respectively build source and target domains for constructing heterogeneous adaptation tasks. In each task, one labeled data (1-shot) for each class is + +Table 2: Results of methods of Labeled-target-only and KPG given different shots (1, 2, and 3) of labeled target domain data (keypoints) per-class under five distinct samplings (S1,S2,S3,S4, and S5). + +
Method1-shot2-shot3-shot
S1S2S3S4S5AvgS1S2S3S4S5AvgS1S2S3S4S5Avg
Labeled-target-only61.258.464.160.658.760.677.876.378.375.074.276.380.776.681.083.482.780.9
KPG-RL (SH)77.676.282.182.980.779.986.586.586.884.482.685.486.588.587.088.388.287.7
+ +given in target domain. Note all the methods use the same training data (including labeled source and target domain data, and unlabeled target domain data) and test data. + +Table 1 reports the results on Office-31 dataset. In Table 1, "KPG-RL (SH)" and "KPG-RL (LP)" denote our KPG-RL model solved using Sinkhorn's algorithm and linear programming respectively. KPG-RL (SH) achieves marginal better average accuracy than KPG-RL (LP), which could be because the barycentric mapping based on the more dense transport plan optimized by Sinkhorn's algorithm is more robust to wrong matching. We also observe that KPG-RL-GW achieves slightly lower average accuracy than KPG-RL (SH), and KPG-RL (SH) is more computationally efficient as discussed in Sect. 4. "KPG (w/ dist)" is the approach that imposes the guidance of keypoints using distance preservation in our framework, i.e., $R_{k,i_u}^s$ and $R_{l,j_u}^t$ in Eqs. (7) and (8) are taken as $C_{k,i_u}^s$ and $C_{l,j_u}^t$ respectively. KPG-RL (SH) improves the accuracy of KPG (w/ dist) by $15\%$ , implying that our relation-preserving scheme is more effective for imposing the guidance of keypoints than the distance-preserving scheme. Table 1 shows that the results of GW, HOT, and TLB are inferior to that of Labeled-target-only, indicating that GW, HOT, and TLB cause negative transfer. This is reasonable because GW, HOT, and TLB do not take advantage of the guidance of keypoints and can cause wrong matching. We also use our mask-based constraint on the transport plan in GW, HOT, and TLB, of which the corresponding approach are denoted as GW (w/ mask), HOT (w/ mask), TLB (w/ mask). We can observe that with the mask-based constraint, the performances of GW, HOT, and TLB are improved but worse than KPG-RL (SH) and KPG-RL (LP), verifying the importance of the relation preservation scheme in KPG-RL. SGW [37] aligns the class centers of labeled target domain data and transported source domain data in the GW model, and realizes positive transfer. Our proposed KPG-RL (SH) outperforms SGW by $12.2\%$ , confirming that our KPG-RL model preserving relation is more effective than SGW preserving class centers for HDA. Compared with the other HDA methods, KPG-RL (SH) achieves the best average accuracy. + +The keypoints are important to KPG-RL, since they are used to guide the matching. We show the results with varying keypoints by giving different numbers and sampling of labeled target domain data, in Table 2. It can be observed in Table 2 that under different numbers and samplings of labeled target domain data, our approach KPG-RL (SH) consistently outperforms the baseline Labeled-target-only, achieving positive transfer. We also find that as the number of labeled target domain data increases, the margin between the accuracy of Labeled-target-only and KPG-RL (SH) decreases. This indicates that given more labeled target domain data, the necessity of knowledge transferred from source domain becomes smaller. Please refer to Appendix B.5 for the effect of source keypoints. + +# 5.3 Open-Set Heterogeneous Domain Adaptation + +We conduct open-set HDA experiments to evaluate our proposed partial-KPG-RL model. The problem setting of open-set HDA is the same as HDA, except that the unlabeled target domain data contain samples of unknown classes absent in the categories of labeled data. The goal of open-set HDA is to correctly classify the common class samples and to detect the unknown class samples. We consider the case that the proportion $\eta$ of unknown class samples in the unlabeled target domain data is given. For applying partial-KPG-RL to open-set HDA, the keypoint pairs are constructed using labeled target domain data and their corresponding source class centers, same as KPG-RL for HDA in Sect. 5.2. We use the partial-KPG-RL model in Eq. (13) to transport all the labeled source domain data to partially match the target domain data. The unmatched target domain data are detected as unknown class. We then train a kernel SVM on the transported source domain data and labeled target domain data to classify the common class samples detected by partial-KPG-RL. The natural Baseline for open-set HDA is the approach that rejects the $\eta$ -proportion unlabeled samples with largest distance to labeled target domain data as unknown, and trains a kernel SVM on the labeled target domain data to classify common class data. We also evaluate the HDA methods STN [50] and SSAN [51] in the + +Table 3: Accuracy of common class sample $(\mathrm{OS}^{*})$ , Accuracy of unknown class sample (UNK), and their harmonic mean (HOS) on Office-31 for open-set HDA $(\eta = 0.67)$ . + +
MethodA→AA→DA→WD→AD→D
OS*UNKHOSOS*UNKHOSOS*UNKHOSOS*UNKHOSOS*UNKHOS
Baseline40.071.051.237.385.351.929.182.743.040.071.051.237.385.351.9
STN [50]48.280.660.367.386.675.754.678.464.346.376.657.863.684.472.6
SSAN [51]25.466.736.829.168.440.864.583.172.734.670.646.422.764.133.6
Partial-KPG-RL41.877.154.248.274.958.638.273.250.252.782.364.380.092.685.9
MethodD→WW→AW→DW→WAvg
OS*UNKHOSOS*UNKHOSOS*UNKHOSOS*UNKHOSOS*UNKHOS
Baseline29.182.743.040.071.051.237.385.351.929.182.743.035.579.748.7
STN [50]54.679.264.649.978.460.460.082.669.555.579.265.255.680.765.6
SSAN [51]29.166.440.431.868.443.319.164.529.426.467.937.931.468.942.4
Partial-KPG-RL73.689.280.752.782.764.478.290.984.171.888.379.259.783.569.1
+ +open-set HDA task. For STN [50] and SSAN [51], we reject the $\eta$ -proportion unlabeled samples with lowest prediction confidence as unknown class. Table 3 reports the results. We use the open-set evaluation metrics [57] including accuracy of common class sample $(\mathrm{OS}^*)$ , accuracy of unknown class sample (UNK), and their harmonic mean $\mathrm{HOS} = 2\frac{\mathrm{OS}^* \times \mathrm{UNK}}{\mathrm{OS}^* + \mathrm{UNK}}$ . We can observe in Table 3 that our proposed partial-KPG-RL achieves the best results in terms of average $\mathrm{OS}^*$ , UNK, and HOS, indicating that the partial-KPG-RL is effective for both classifying common class data and identifying unknown class data. Compared with the Baseline, partial-KPG-RL outperforms it by $20.4\%$ in terms of average HOS, confirming the positive transfer achieved by our method. More implementation details and the solution for Open-Set HDA with unknown $\eta$ are given in Appendix B.2. + +Due to space limit, we include the experiment of our approach for deep unsupervised domain adaptation in Appendix B.3. More empirical analysis and ablation studies, e.g., sensitivity to hyperparameters, the effect of $d$ , the discussion on how to define the keypoints in more general practical applications, the time and memory cost, etc., are given in Appendix B.5. + +# 6 Conclusion + +In this paper, we propose a novel KPG-RL model that leverages keypoints to guide the correct matching in OT. We devise a mask-based constraint to preserve the matching of keypoints pairs, and propose to preserve the relation of each point to the keypoints to impose the guidance of these keypoints in OT. The effectiveness of the proposed KPG-RL model is verified in the application of HDA. The keypoint-guided OT model could be possibly applied to more applications, e.g., cross-domain data generation/translation [58, 59], and point-set or image registration. + +Acknowledgements. This work was supported by National Key R&D Program 2021YFA1003002 and NSFC (12125104, U1811461, U20B2075, 11971373, 12026605). + +# References + +[1] Cédric Villani. Optimal transport: old and new, volume 338. Springer, 2009. +[2] Nicolas Bonneel, Michiel Van De Panne, Sylvain Paris, and Wolfgang Heidrich. Displacement interpolation using lagrangian mass transport. In SIGGRAPH Asia, 2011. +[3] Justin Solomon, Fernando De Goes, Gabriel Peyre, Marco Cuturi, Adrian Butscher, Andy Nguyen, Tao Du, and Leonidas Guibas. Convolutional wasserstein distances: Efficient optimal transportation on geometric domains. ACM ToG, 34(4):1-11, 2015. +[4] Matt Kusner, Yu Sun, Nicholas Kolkin, and Kilian Weinberger. From word embeddings to document distances. In ICML, 2015. + +[5] Gao Huang, Chuan Guo, Matt J Kusner, Yu Sun, Fei Sha, and Kilian Q Weinberger. Supervised word mover's distance. In NeurIPS, 2016. +[6] David Alvarez-Melis and Tommi S Jaakkola. Gromov-wasserstein alignment of word embedding spaces. In EMNLP, 2018. +[7] Mikhail Yurochkin, Sebastian Claici, Edward Chien, Farzaneh Mirzazadeh, and Justin M. Solomon. Hierarchical optimal transport for document representation. In NeurIPS, 2019. +[8] Martin Arjovsky, Soumith Chintala, and Léon Bottou. Wasserstein generative adversarial networks. In ICML, 2017. +[9] Nicolas Courty, Rémi Flamary, Devis Tuia, and Alain Rakotomamonjy. Optimal transport for domain adaptation. IEEE Trans. PAMI, 39(9):1853-1865, 2017. +[10] Nhat Ho, XuanLong Nguyen, Mikhail Yurochkin, Hung Hai Bui, Viet Huynh, and Dinh Phung. Multilevel clustering via wasserstein means. In ICML, 2017. +[11] Alexander Tong, Guy Wolf, and Smita Krishnaswamy. Fixing bias in reconstruction-based anomaly detection with lipschitz discriminators. JSPS, 94(2):229-243, 2022. +[12] Gaspard Monge. Mémoire sur la théorie des déblais et des remblais. Histoire de l'Académie Royale des Sciences de Paris, pages 666-704, 1781. +[13] Leonid V Kantorovich. On the translocation of masses. In Dokl. Akad. Nauk. USSR (NS), 1942. +[14] Marco Cuturi. Sinkhorn distances: Lightspeed computation of optimal transport. In NeurIPS, 2013. +[15] Richard Sinkhorn and Paul Knopp. Concerning nonnegative matrices and doubly stochastic matrices. *PJM*, 21(2):343–348, 1967. +[16] Aude Geneva, Gabriel Peyré, and Marco Cuturi. Learning generative models with sinkhorn divergences. In AISTATS, 2018. +[17] Kevin Guittet. Extended Kantorovich norms: a tool for optimization. PhD thesis, INRIA, 2002. +[18] Alessio Figalli. The optimal partial transport problem. Arch Ration Mech Anal, 195(2):533-560, 2010. +[19] Luis A Caffarelli and Robert J McCann. Free boundaries in optimal transport and monge-ampere obstacle problems. Ann Math, 171:673-730, 2010. +[20] Laetitia Chapel, Mokhtar Z Alaya, and Gilles Gasso. Partial optimal transport with applications on positive-unlabeled learning. In NeurIPS, 2020. +[21] Lenaic Chizat, Gabriel Peyré, Bernhard Schmitzer, and François-Xavier Vialard. An interpolating distance between optimal transport and fisher-rao metrics. *FoCM*, 18(1):1-44, 2018. +[22] Matthias Liero, Alexander Mielke, and Giuseppe Savaré. Optimal entropy-transport problems and a new hellinger-kantorovich distance between positive measures. Invent Math, 211(3):969-1117, 2018. +[23] Yogesh Balaji, Rama Chellappa, and Soheil Feizi. Robust optimal transport with applications in generative modeling and domain adaptation. In NeurIPS, 2020. +[24] Debarghya Mukherjee, Aritra Guha, Justin M Solomon, Yuekai Sun, and Mikhail Yurochkin. Outlier-robust optimal transport. In ICML, 2021. +[25] Khang Le, Huy Nguyen, Quang M Nguyen, Tung Pham, Hung Bui, and Nhat Ho. On robust optimal transport: Computational complexity and barycenter computation. In NeurIPS, 2021. +[26] Karl-Theodor Sturm. On the geometry of metric measure spaces. Acta Math, 196(1):65-131, 2006. + +[27] Facundo Memoli. Gromov-wasserstein distances and the metric approach to object matching. *FoCM*, 11(4):417-487, 2011. +[28] Andriy Myronenko and Xubo Song. Point set registration: Coherent point drift. IEEE Trans. PAMI, 32(12):2262-2275, 2010. +[29] William R Crum, Thomas Hartkens, and DLG Hill. Non-rigid image registration: theory and practice. Br J Radiol, 77(suppl_2):S140-S153, 2004. +[30] Kuniaki Saito, Donghyun Kim, Stan Sclaroff, Trevor Darrell, and Kate Saenko. Semi-supervised domain adaptation via minimax entropy. In ICCV, 2019. +[31] Yao-Hung Hubert Tsai, Yi-Ren Yeh, and Yu-Chiang Frank Wang. Learning cross-domain landmarks for heterogeneous domain adaptation. In CVPR, 2016. +[32] Chi-Heng Lin, Mehdi Azabou, and Eva L Dyer. Making transport more robust and interpretable by moving data through a small number of anchor points. In ICML, 2021. +[33] John Lee, Max Dabagia, Eva Dyer, and Christopher Rozell. Hierarchical optimal transport for multimodal distribution alignment. In NeurIPS, 2019. +[34] Hongteng Xu, Dixin Luo, Ricardo Henao, Svati Shah, and Lawrence Carin. Learning autoencoders with relational regularization. In ICML, 2020. +[35] Ryoma Sato, Marco Cuturi, Makoto Yamada, and Hisashi Kashima. Fast and robust comparison of probability measures in heterogeneous spaces. arXiv preprint arXiv:2002.01615, 2020. +[36] Jiying Zhang, Xi Xiao, Long-Kai Huang, Yu Rong, and Yatao Bian. Fine-tuning graph neural networks via graph topology induced optimal transport. In IJCAI, 2022. +[37] Yuguang Yan, Wen Li, Hanrui Wu, Huaqing Min, Mingkui Tan, and Qingyao Wu. Semi-supervised optimal transport for heterogeneous domain adaptation. In *IJCAI*, 2018. +[38] Chen Shen and Yuhong Guo. Unsupervised heterogeneous domain adaptation with sparse feature transformation. In ACML, 2018. +[39] Azadeh Sadat Mozafari and Mansour Jamzad. A sym-based model-transferring method for heterogeneous domain adaptation. PR, 56:142-158, 2016. +[40] Joey Tianyi Zhou, Ivor W Tsang, Sinno Jialin Pan, and Mingkui Tan. Multi-class heterogeneous domain adaptation. JMLR, 2019. +[41] Chang Wang and Sridhar Mahadevan. Heterogeneous domain adaptation using manifold alignment. In *IJCAI*, 2011. +[42] Hanrui Wu, Hong Zhu, Yuguang Yan, Jiaju Wu, Yifan Zhang, and Michael K Ng. Heterogeneous domain adaptation by information capturing and distribution matching. IEEE Trans. IP, 30:6364-6376, 2021. +[43] Yuguang Yan, Wen Li, Michael KP Ng, Mingkui Tan, Hanrui Wu, Huaqing Min, and Qingyao Wu. Learning discriminative correlation subspace for heterogeneous domain adaptation. In IJCAI, 2017. +[44] Joey Tianyi Zhou, Sinno Jialin Pan, and Ivor W Tsang. A deep learning framework for hybrid heterogeneous transfer learning. AI, 275:310-328, 2019. +[45] Qian Wang and Toby P Breckon. Cross-domain structure preserving projection for heterogeneous domain adaptation. PR, 123:108362, 2022. +[46] Zhen Fang, Jie Lu, Feng Liu, and Guangquan Zhang. Semi-supervised heterogeneous domain adaptation: Theory and algorithms. IEEE Trans. PAMI, In press, 2022. +[47] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In ICML, pages 1597-1607, 2020. + +[48] Prannay Khosla, Piotr Teterwak, Chen Wang, Aaron Sarna, Yonglong Tian, Phillip Isola, Aaron Maschinot, Ce Liu, and Dilip Krishnan. Supervised contrastive learning. In NeurIPS, 2020. +[49] Sebastian Reich. A nonparametric ensemble transform method for bayesian inference. SIAM JSC, 35(4):A2013-A2024, 2013. +[50] Yuan Yao, Yu Zhang, Xutao Li, and Yunming Ye. Heterogeneous domain adaptation via soft transfer network. In ACM MM, 2019. +[51] Shuang Li, Binhui Xie, Jiashu Wu, Ying Zhao, Chi Harold Liu, and Zhengming Ding. Simultaneous semantic alignment network for heterogeneous domain adaptation. In ACM MM, pages 3866-3874, 2020. +[52] Yuan Yao, Yu Zhang, Xutao Li, and Yunming Ye. Discriminative distribution alignment: A unified framework for heterogeneous domain adaptation. PR, 101:107165, 2020. +[53] Kate Saenko, Brian Kulis, Mario Fritz, and Trevor Darrell. Adapting visual category models to new domains. In ECCV, 2010. +[54] Jeff Donahue, Yangqing Jia, Oriol Vinyals, Judy Hoffman, Ning Zhang, Eric Tzeng, and Trevor Darrell. Decaf: A deep convolutional activation feature for generic visual recognition. In ICML, 2014. +[55] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016. +[56] Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al. Imagenet large scale visual recognition challenge. IJCV, 115(3):211-252, 2015. +[57] Silvia Bucci, Mohammad Reza Loghmani, and Tatiana Tommasi. On the effectiveness of image rotation for open set domain adaptation. In ECCV, pages 422-438, 2020. +[58] Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In ICCV, 2017. +[59] Heran Yang, Jian Sun, Aaron Carass, Can Zhao, Junghoon Lee, Jerry L Prince, and Zongben Xu. Unsupervised mr-to-ct synthesis using structure-constrained cyclegan. IEEE Trans. MI, 39(12):4249–4261, 2020. +[60] Morgan A Schmitz, Matthieu Heitz, Nicolas Bonneel, Fred Ngole, David Coeurjolly, Marco Cuturi, Gabriel Peyré, and Jean-Luc Starck. Wasserstein dictionary learning: Optimal transport-based unsupervised nonlinear dictionary learning. SIAM JIS, 11(1):643-678, 2018. +[61] Vayer Titouan, Nicolas Courty, Romain Tavenard, and Rémi Flamary. Optimal transport for structured data with application on graphs. In ICML, 2019. +[62] Gabriel Peyré, Marco Cuturi, et al. Computational optimal transport: With applications to data science. Foundations and Trends® in Machine Learning, 11(5-6):355–607, 2019. +[63] Jessa Bekker and Jesse Davis. Learning from positive and unlabeled data: A survey. ML, 109(4):719-760, 2020. +[64] Daniel Zeiberg, Shantanu Jain, and Predrag Radivojac. Fast nonparametric estimation of class proportions in the positive-unlabeled classification setting. In AAAI, 2020. +[65] Khai Nguyen, Dang Nguyen, Tung Pham, Nhat Ho, et al. Improving mini-batch optimal transport via partial transportation. In ICML, 2022. +[66] Bharath Bhushan Damodaran, Benjamin Kellenberger, Rémi Flamary, Devis Tuia, and Nicolas Courty. Deepjdot: Deep joint distribution optimal transport for unsupervised domain adaptation. In ECCV, 2018. +[67] Hemanth Venkateswara, Jose Eusebio, Shayok Chakraborty, and Sethuraman Panchanathan. Deep hashing network for unsupervised domain adaptation. In CVPR, 2017. + +[68] Shaoan Xie, Zibin Zheng, Liang Chen, and Chuan Chen. Learning semantic representations for unsupervised domain adaptation. In ICML, 2018. +[69] Kilian Fatras, Thibault Séjourné, Rémi Flamary, and Nicolas Courty. Unbalanced minibatch optimal transport; applications to domain adaptation. In ICML, 2021. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] See Abstract and Introduction. +(b) Did you describe the limitations of your work? [Yes] See the end of the first paragraph on page 6. +(c) Did you discuss any potential negative societal impacts of your work? [N/A] This work does not present any significant societal consequence. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] We have read them. + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] See Propositions 1 and A-1, and Theorems 1, A-1, A-2, A-3. +(b) Did you include complete proofs of all theoretical results? [Yes] See Appendix A. + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] See Sect. 5. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Sect. 5 and Appendix B. +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] We have reported the results for different samples in Table 2. +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [N/A] The experiments are conducted on CPU. + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] See Sect. 5. +(b) Did you mention the license of the assets? [N/A] The datasets are public. +(c) Did you include any new assets either in the supplemental material or as a URL? [No] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/keypointguidedoptimaltransportwithapplicationsinheterogeneousdomainadaptation/images.zip b/keypointguidedoptimaltransportwithapplicationsinheterogeneousdomainadaptation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..d4346932a05cd9ec88c5d70828a2dd24db92584d --- /dev/null +++ b/keypointguidedoptimaltransportwithapplicationsinheterogeneousdomainadaptation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:12a7118a3e9a38bc089afc2323de478d7e5487b07dcf64bafbefd3f7cfc8fe4d +size 539330 diff --git a/keypointguidedoptimaltransportwithapplicationsinheterogeneousdomainadaptation/layout.json b/keypointguidedoptimaltransportwithapplicationsinheterogeneousdomainadaptation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..f9846f2a52d655510813713de1da6951b21411a1 --- /dev/null +++ b/keypointguidedoptimaltransportwithapplicationsinheterogeneousdomainadaptation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:868d6b7dcd382e4ce1f132e7ce9e2aa2c5f14039355f1d78f4bbebd41be265fa +size 568162 diff --git a/klitelearningtransferablevisualmodelswithexternalknowledge/667c1999-1901-48a7-b6c4-0a9d0bb5ab22_content_list.json b/klitelearningtransferablevisualmodelswithexternalknowledge/667c1999-1901-48a7-b6c4-0a9d0bb5ab22_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..2346b291782e413402a200e05f19f1bb005e3c36 --- /dev/null +++ b/klitelearningtransferablevisualmodelswithexternalknowledge/667c1999-1901-48a7-b6c4-0a9d0bb5ab22_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c48ded2af46f931057aa356b4f7e59c24e6514b78a8c828a24e2e60aa4d47b5 +size 97400 diff --git a/klitelearningtransferablevisualmodelswithexternalknowledge/667c1999-1901-48a7-b6c4-0a9d0bb5ab22_model.json b/klitelearningtransferablevisualmodelswithexternalknowledge/667c1999-1901-48a7-b6c4-0a9d0bb5ab22_model.json new file mode 100644 index 0000000000000000000000000000000000000000..29990fca028f2c21e0d02648a09e521145b32240 --- /dev/null +++ b/klitelearningtransferablevisualmodelswithexternalknowledge/667c1999-1901-48a7-b6c4-0a9d0bb5ab22_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ee2af832cb930eac7583f68c8700cf57a373cb5c3400ebb7c1b697e84a926ad9 +size 133302 diff --git a/klitelearningtransferablevisualmodelswithexternalknowledge/667c1999-1901-48a7-b6c4-0a9d0bb5ab22_origin.pdf b/klitelearningtransferablevisualmodelswithexternalknowledge/667c1999-1901-48a7-b6c4-0a9d0bb5ab22_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..d6f660a18f4607e9113bea0f6d4bd8f57eda5327 --- /dev/null +++ b/klitelearningtransferablevisualmodelswithexternalknowledge/667c1999-1901-48a7-b6c4-0a9d0bb5ab22_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d56374ec21da0d08061a3cbed9544150627d9c23da511009f6ab63c8ca997799 +size 2563734 diff --git a/klitelearningtransferablevisualmodelswithexternalknowledge/full.md b/klitelearningtransferablevisualmodelswithexternalknowledge/full.md new file mode 100644 index 0000000000000000000000000000000000000000..3f52e6f0064096da692461098bdd9c0f438be2d4 --- /dev/null +++ b/klitelearningtransferablevisualmodelswithexternalknowledge/full.md @@ -0,0 +1,370 @@ +# K-LITE: Learning Transferable Visual Models with External Knowledge + +Sheng Shen\*, Chunyuan Li\*, Xiaowei Hu\*, Jianwei Yang†, Yujia Xie†, Pengchuan Zhang†, Zhe Gan†, Lijuan Wang†, Lu Yuan† +Ce Liu†, Kurt Keutzer‡, Trevor Darrell‡, Anna Rohrbach‡, Jianfeng Gao† +†Microsoft University of California, Berkeley + +# Abstract + +The new generation of state-of-the-art computer vision systems are trained from natural language supervision, ranging from simple object category names to descriptive captions. This form of supervision ensures high generality and usability of the learned visual models, due to the broad concept coverage achieved via large-scale data collection process. Alternatively, we argue that learning with external knowledge is a promising way which leverages a much more structured source of supervision and offers sample efficiency. We propose K-LITE [1] a simple strategy to leverage external knowledge for building transferable visual systems: In training, it enriches entities in text with WordNet and Wiktionary knowledge, leading to an efficient and scalable approach to learning image representations that uses knowledge about the visual concepts. In evaluation, the text is also augmented with external knowledge and then used to reference learned visual concepts (or describe new ones) to enable zero-shot and few-shot transfer of the pre-trained models. We study the performance of K-LITE on two important computer vision problems, image classification and object detection, benchmarking on 20 and 13 different existing datasets, respectively. The proposed knowledge-augmented models show significant improvement in transfer learning performance over existing methods. [2] + +# 1 Introduction + +One of the core aspirations in computer vision (CV) is to develop systems that endow computers with the ability to effectively learn general visual representations, which can be transferred to a variety of downstream recognition datasets with arbitrary visual concepts in the wild. Though excellent performance has been achieved on standard benchmarks, the traditional supervised approaches are limited to learning a fixed set of concepts, e.g., 22K concepts on ImageNet [15] or 18K concepts on JFT-300M [82]. This leads to a few issues: $(i)$ Annotating each individual vision dataset is not only labor intensive, but also results in a narrow set of visual concepts; $(ii)$ Visual models trained on such datasets are good at one task (with the given concept set) and this task only, and show poor transfer learning performance to customized datasets that usually come with a different set of concepts [27]. + +To tackle this problem, recent large-scale language-augmented visual models, such as CLIP [71], ALIGN [36] and Florence [101], are trained on a wide variety of images with natural language supervision that is abundantly available on the Internet. These models demonstrate strong zero-shot transfer capabilities, since they acquire open-set recognition abilities through problem reformulation from classification to retrieval. Moreover, model generalization is improved as natural language + +supervision typically contains rich semantics. While these models usually perform well on recognizing common objects, they still struggle on visual concepts that are absent or rare in the pre-training stage. To ensure good transfer performance, it is required to train such models on huge datasets with sufficient concept coverage(e.g., $>400\mathrm{M}$ image-text pairs), which is both labor and compute expensive. + +Instead of scaling the number of image-text pairs to increase concept coverage, we propose to leverage structured external knowledge to augment language supervision. The inspiration comes from how humans generalize to novel concepts: instead of trying to memorize all concepts, humans leverage the structured knowledge such as definitions and concept hierarchy. For example, when we visit a Japanese restaurant for the first time, we may struggle to understand the menu by only looking at the dish names (e.g., Takoyaki, Sashimi), as it is hard to imagine what they are. However, it becomes much clearer once a waiter introduces these concepts (Figure 1), leading to success in ordering food (i.e., matching content to a name). Similar intuitions have been exploited in computer vision for class-level transfer [94, 12], but not yet for task-level transfer settings (similar to that of CLIP). + +To this end, we explore a systematic approach to acquire and learn with external knowledge sources from databases such as WordNet [63] and Wiktionary [62] to train more transferable and sample-efficient visual models. The concept descriptions and concept hierarchies are purely textual, and the process of collecting external knowledge is fully automatic without extra human annotation. The acquired knowledge typically provides information that is shared between seen and unseen concepts to facilitate effective transfer. Specifically, rare concepts, e.g., Takoyaki, Sashimi in Figure I, are explained with more common concepts. Such knowledge sources are generally available for a variety of domains and datasets, making it possible to build a generic approach for task-level transfer. + +![](images/77bd8035836e2b9f8b387dab3e3de95da13eda2e35907bb9c642baa2815cd025.jpg) + +# Takoyaki + +A ball-shaped Japanese dumpling made of batter, filled with diced octopus, tempura scraps, pickled ginger, and green onion. + +![](images/b65e4e8f7b0d319fc97be69e8f08bf1396c18321d77ff7a5e0bc5c1d817fad66.jpg) +Figure 1: Motivating examples: knowledge explains the content of the rare dish concepts. + +# Sashimi + +A dish consisting of thin slices or pieces of raw fish or meat. + +Our main findings and contributions can be summarized as follows: + +- We present the first strong evidence that external knowledge can benefit large-scale task-level transfer for two core CV problems, image classification (IC) and object detection (OD), by exploring external knowledge sources, including WordNet and Wiktionary. +- A simple and effective strategy K-LITE (Knowledge-augmented Language Image Training and Evaluation) is proposed: The acquired knowledge is appended to the original textual concepts as model input during pre-training and evaluation. It can be viewed as an automatic knowledge-aware language prompting, which makes it easier for the model to access relevant information shared between the training and evaluation data. A modularized approach is also developed to enable efficient adaptation from vanilla visual models to their knowledge-augmented versions. +- To demonstrate the generality of the K-LITE, we instantiate it with two recent visual models and develop our knowledge-augmented counterparts: UniCL [95] for IC and GLIP [50] for OD. Extensive experiments in zero-shot and few-shot learning settings demonstrate that knowledge-augmented models can significantly improve over prior work. Notably, our model can achieve similar zero-shot performance to previous methods using only half of pre-training image-text pairs in some scenarios, demonstrating sample efficiency of the proposed approach. + +# 2 Related Work + +Zero-shot Visual Recognition: Zero-shot learning, i.e., classifying images where there is a lack of labeled training data, has been studied for decades [21], and its popularity has recently increased further [94]. Based on the technique evolution, it can be broadly categorized into two generations: the traditional class-level zero-shot and recently popular task-level zero-shot setting. + +Class-level Transfer. Class-level zero-shot learning aims to recognize object classes whose instances have not been observed during training. The goal for the zero-shot learning methods is to associate observed and non-observed classes through some form of auxiliary information, which can be either implicit such as pre-trained semantic embeddings [92, 78, 10], or explicit such as attributes [21, 43]. + +[35], text [18, 19, 72, 70], knowledge graphs [91, 74], or rules and ontologies [23]. Please, refer to the recent survey on knowledge-aware zero-shot learning for a more detailed review [12]. Recently, it has been suggested to move away from the restricted nature of standard zero-shot evaluation and make the task more practical by including training classes at test time, i.e., generalized zero-shot learning setting [94]. Despite the progress in this area, the traditional setting is typically limited to studying zero-shot transfer across classes in a single domain with manually defined splits, such as Animal with Attributes (AwA) [44], Birds-200 [89], SUN attributes [67], and ZS-ImageNet [73, 26]. Concurrently, [85] explore leveraging external knowledge to improve long-tailed visual recognition within individual domains, which falls into the category of class-level transfer. + +Task-level Transfer: Another line of work focuses on task-level zero-shot transfer [52, 46, 64, 71, 36, 97]. They pre-train visual models on hundreds of millions of web-crawled image-caption or image-tags pairs, and evaluate their transfer ability by directly performing inference in a wide range of downstream datasets, without tuning the model weights. We argue that the task-level transfer is more practical and attractive than class-level transfer, as it is more relevant to real-world scenarios, where we may want to develop models that can serve many visual recognition applications. + +Our work bridges the gap between the two lines of works above: it borrows the spirit of exploring knowledge in class-level transfer, and generalizes it for task-level transfer, leveraging the best of both worlds. To summarize, our work is different in two major aspects: (i) Settings. We focus on the task-level transfer learning across domains, i.e., from large publicly available datasets to a diverse set of downstream datasets in different domains, and demonstrate that external knowledge benefits task-level transfer. (ii) Modeling. Existing class-level transfer works are built upon pre-trained visual features/backbones and shallow word embeddings or tfidf scores, and only train the classifiers. One representative example is DeViSE [25], where a skip-gram word embedding model and an image classifier are fine-tuned jointly. In contrast, we are training large Transformer-based models in an end-to-end manner from scratch as in CLIP/ALIGN, providing the first empirical evidence that external knowledge can help train a general visual backbone. + +Knowledge-Intensive Models: In natural language processing (NLP), with the increase of model capacity via pre-trained language models [17], there emerges the need for more knowledgeable models [55] with advanced functionalities such as making use of encyclopedic [88, 4, 6] and commonsense knowledge [79, 102]. To address this, a large number of language models augmented with external knowledge sources have been proposed [68, 29, 45, 56, 100, 7], achieving strong performance on a variety of NLP tasks [69, 42]. Please refer to a recent survey [98] for a comprehensive review. + +In vision-and-language (V+L) domain, researchers have also started exploring knowledge-intensive tasks, e.g., OK-VQA [61] and WebQA [9]. They often require additional information sources (e.g., factual and commonsense knowledge) beyond the QA pairs, compared to the established tasks such as VQA [3, 34] and image captioning [54, 2]. Hence, existing pre-trained models [49, 83, 58, 51, 81, 103, 38, 48, 30, 99, 77] would perform poorly on these knowledge-intensive V+L tasks [9]. To address the problem, acquiring external knowledge becomes an essential component for success [93, 60, 96]. + +The success of knowledge in NLP and $\mathrm{V + L}$ tasks inspires us to ask a natural question: Can we learn a transferable visual backbone model with external knowledge? Thus, we dissect and borrow the vital elements such as knowledge sources [63, 62] and modeling techniques [90, 100], and carry out studies for core computer vision tasks. + +# 3 Knowledge-Augmented Visual Models + +Problem setup. Computer vision systems have achieved strong transfer performance, when learning with large-scale image-label data [39] and image-caption data [71]. Recently, it has been demonstrated in [95, 101] that the unification of image-label and image-text formats into image-text-label achieves superior performance over either of them. We follow the setting in [95], and define a unified triplet-wise data format $\mathcal{D} = \{(x_n, t_n, y_n)\}_{n=1}^N$ , where $x \in \mathcal{X}$ is an image, $t \in \mathcal{T}$ is its language description, and $y \in \mathcal{Y}$ is a label indicating the index of the unique language description in the dataset. In a general form, the language description is a text sequence $\pmb{t} = [t_1, \dots, t_L]$ . It ranges from simple category names representing visual concepts when $L$ is small, to more free-form and semantic-rich sentences such as captions when $L$ is relatively large. + +In this paper, we assume there exists an external knowledge source $S$ , where one may use the language description $\pmb{t}$ as a query to seek additional knowledge description $\pmb{s} \in S$ for $\pmb{t}$ . Given these triplet data instances $\mathcal{D}$ and an external knowledge source $S$ , our goal is to learn generic visual- + +![](images/3babea527c9cefe24140c57623029dd8ed45e13679061838132c7a9e81ca2e57.jpg) +Figure 2: Left: Illustration of data construction process of the proposed knowledge-augmented language-image learning, in contrast to the baseline language-image learning. The query $q$ is constructed from Eq.(1). The same process is performed for both pre-training and downstream tasks. Right: The proposed strategy is applied to IC and OD for task-level transfer. + +semantic representations, which are readily transferable to a wide range of downstream datasets, whose category names are not necessarily observed during training. In Figure 2 we visually illustrate the proposed knowledge-augmentation process and two considered application scenarios. + +# 3.1 External Knowledge + +Query Construction. For a text sequence associated with an image, different tokens may play different roles in contributing to describing the main semantics of the image. Humans leverage this prior inherently in parsing the sentences to understand the image. Further, it is infeasible to employ the entire sequence as a query, as this may lead to the lack of coverage in the knowledge bases. Instead, we propose to construct a query $\mathbf{q} \in \mathcal{Q}$ as a compact form of original language description $\mathbf{t}$ , represented with the words that convey the main concepts of the image. + +Specifically, we consider a divide-and-conquer approach. For short text sequences $t$ such as category names in image-tag/label datasets (e.g., ImageNet [15]), we directly use the category name as the query. For long text sequences $t$ such as captions (e.g., YFCC [84]), we first parse the sentence to extract the noun- phrases, among which the most rare noun-phrase over the corpus is used as a query for this sentence. The intuition is to convert the rare concepts into "explanations" represented in common words using external knowledge. Noun phrases are useful for summarizing the sentence and thus inferring what is being talked about in the image. For example, in "professional boxer is introduced to the crowd", the noun- phrases are "boxer", "professional boxer", and "the crowd". We summarize the query construction process $g_{query}$ below for clarity: + +$$ +\boldsymbol {q} = g _ {\text {q u e r y}} (\boldsymbol {t}) = \left\{ \begin{array}{c l} \boldsymbol {t}, & \text {w h e n} \boldsymbol {t} \text {i s a c a t e g o r y , c l a s s o r t a g n a m e ,} \\ \text {T h e m o s t r a r e n o u n - p h r a s e} (\boldsymbol {t}), & \text {w h e n} \boldsymbol {t} \text {i s a c a p t i o n .} \end{array} \right. \tag {1} +$$ + +Knowledge Acquisition from External Sources. We consider three knowledge sources $S$ to enrich the language descriptions $t$ . They are constructed based on the two knowledge bases: WordNet [63] and Wiktionary [62]. To measure the breadth of a knowledge base, we define the concept coverage as the percentage of non-empty knowledge items retrieved for a given set of issued queries.(i) WordNet [63] is a lexical database which links words into semantic relations including synonyms, hyponyms, and meronyms. Both nouns and verbs are organized into hierarchies, defined by hypernym relationships. The synonyms in WordNet are grouped into synsets, expressing the same distinct concept. The synsets serve as a natural link between language and vision domains. For example, ImageNet is an image database organized according to the WordNet hierarchy, where each node is depicted by hundreds/thousands of images. (ii) Wiktionary [62] is a web-based content dictionary of terms (including words, phrases, proverbs, linguistic reconstructions). These entries may contain definitions, illustrations, usage examples etc.. Next, we provide our knowledge retrieval process $s = g_{\text{retrieve}}(q)$ for each source $S$ , followed by an example result for the query "boxer": + +- WordNet Hierarchy $S_{\mathrm{wn\_path}}$ . A WordNet node of the query is located, then we repeatedly search its parent node. The words along the traversal path are recorded as the knowledge. - [boxer, combatant, person, causal_agent, physical-entity, entity] +- WordNet Definition $S_{\mathrm{wn\_def}}$ . The definition from the synsets is used to explain the query. - someone who fights with his fists for sport +- Wiktionary Definition $S_{\mathrm{wiki\_defh}}$ . The query is used for dictionary look-up in Wiktionary, and the corresponding definition is used. +- a fighter in a boxing match + +When multiple meanings (senses) exist for a given query, we simply consider the first one for simplicity, and leave more sophisticated designs as future work. After querying each knowledge source, we represent the external knowledge for each language description $t$ in the form of concatenation of its query and the corresponding retrieved result: $[q, s]$ . This external knowledge introduces additional supervision signals to guide visual models to learn better aligned visual-semantic representations, as we explain later. We next describe how to encode knowledge in multimodal models to improve transfer in the image-level task of image classification and the region-level task of object detection. + +# 3.2 Image Classification + +Recent works that learn visual models with language supervision [71] often employ a dual-encoder architecture. For each image $\pmb{x}$ , an image encoder model $f_{\theta}$ parameterized by $\pmb{\theta}$ first represents $\pmb{x}$ as a visual feature vector $\tilde{\pmb{v}} \in \mathbb{R}^{P \times 1}$ : $\tilde{\pmb{v}} = f_{\theta}(\pmb{x})$ . For each language description $t \in \mathcal{T}$ , we encode it with a text encoder $f_{\phi}(t)$ parameterized by $\phi$ , and get the [E0S] feature as the vector representation of the sentence $\tilde{\pmb{u}} \in \mathbb{R}^{P \times 1}$ : $\tilde{\pmb{u}} = f_{\phi}(t)$ . In this paper, we further leverage this text encoder to encode the external knowledge. First, the query $\pmb{q}$ is represented in natural language $p = g_{prompt}(\pmb{q})$ using the language prompt as in [71]. Depending on the language input $t$ and our augmentation scheme, the knowledge-augmented text sequence $t^k \in T^k$ ( $k$ stands for knowledge) is represented as: + +$$ +\boldsymbol {t} ^ {k} = \left\{ \begin{array}{l l} \boldsymbol {t} _ {e} ^ {k} = [ \boldsymbol {p}, \boldsymbol {q}, \boldsymbol {s} ], & \text {w h e n} \boldsymbol {t} \text {i s a c a t e g o r y , c l a s s o r t a g n a m e ,} \\ \boldsymbol {t} _ {c} ^ {k} = [ \boldsymbol {t}, \boldsymbol {q}, \boldsymbol {s} ], & \text {w h e n} \boldsymbol {t} \text {i s a c a p t i o n , a n d a c o n c a t s c h e m e i s u s e d ,} \\ \{\boldsymbol {t} _ {c} ^ {k}, \boldsymbol {t} _ {e} ^ {k} \}, & \text {w h e n} \boldsymbol {t} \text {i s a c a p t i o n , a n d a c o m b i n e s c h e m e i s u s e d .} \end{array} \right. \tag {2} +$$ + +For example, for category name $t =$ boxer or for caption $t =$ professional boxer is introduced to the crowd, we have $q =$ boxer, and the corresponding language description are: + +- $t_{e}^{k} =$ a photo of a cool boxer; boxer, a fighter in a boxing match +- $t_{c}^{k}$ = professional boxer is introduced to the crowd; boxer, a fighter in a boxing match + +We re-use the same text encoder $f_{\phi}$ to encode $t^k$ as the original $t$ as supervision for image $x$ . + +Training. For $i$ -th image $\pmb{x}_i$ and $j$ -th language description $\pmb{t}_j$ in a batch $\mathcal{B}$ , we normalize their feature vectors in a hyper-sphere using $\pmb{u}_i = \frac{f_\theta(\pmb{x}_i)}{\|f_\theta(\pmb{x}_i)\|}$ and $\pmb{v}_j = \frac{f_\phi(\pmb{t}_j)}{\|f_\phi(\pmb{t}_j)\|}$ , and their similarity is calculated as $\pmb{u}_i^\top \pmb{v}_j$ . A bidirectional supervised contrastive objective is considered to train the model: + +$$ +\min _ {\{\theta , \phi \}} \mathcal {L} _ {\mathrm {I C}} = \mathcal {L} _ {i 2 t} + \mathcal {L} _ {t 2 i}, \text {w i t h} \tag {3} +$$ + +$$ +\mathcal {L} _ {i 2 t} = - \sum_ {i \in \mathcal {B}} \frac {1}{| \mathcal {P} (i) |} \sum_ {k \in \mathcal {P} (i)} \log \frac {\exp (\tau \boldsymbol {u} _ {i} ^ {\top} \boldsymbol {v} _ {k})}{\sum_ {j \in \mathcal {B}} \exp (\tau \boldsymbol {u} _ {i} ^ {\top} \boldsymbol {v} _ {j})} \text {a n d} \mathcal {L} _ {t 2 i} = - \sum_ {j \in \mathcal {B}} \frac {1}{| \mathcal {Q} (j) |} \sum_ {k \in \mathcal {Q} (j)} \log \frac {\exp (\tau \boldsymbol {u} _ {k} ^ {\top} \boldsymbol {v} _ {j})}{\sum_ {i \in \mathcal {B}} \exp (\tau \boldsymbol {u} _ {i} ^ {\top} \boldsymbol {v} _ {j})} +$$ + +where $\mathcal{P}(i) = \{k|k\in \mathcal{B},y_k = y_i\}$ , $\mathcal{Q}(j) = \{k|k\in \mathcal{B},y_k = y_j\}$ , and $\tau$ is a temperature hyperparameter controlling the strength of penalties on hard negative samples. Note (3) is a general form; it reduces to the training objective of CLIP [7] or ALIGN [36] when there is a one-to-one mapping between an image and its paired caption in a batch, i.e., $\mathcal{P}(i) = \{i\}$ and $\mathcal{Q}(j) = \{j\}$ . + +Evaluation. Given a downstream image classification task with a custom set of category names, we represent them with the knowledge-augmented prompt form in (2); they are fed into the pre-trained text encoder $f_{\phi}$ to obtain the class embedding. The test image $x$ is encoded with $f_{\theta}(x)$ , and compared to all class embeddings to get its label from the best matching class. + +Extensions with Modularized Modeling. In our study, we found it is key to ensure consistency between training and evaluation stages: if a model is trained with knowledge, it performs well when + +also evaluated with knowledge. Similarly, if a model is trained without knowledge (e.g., CLIP/UniCL), adding knowledge directly in the evaluation stage results in performance drop. However, due to the limited knowledge coverage in existing knowledge bases, $s$ could be empty for a large number of queries $q$ . When the low coverage happens for a downstream evaluation dataset, it may result in a training-evaluation inconsistency for our knowledge-augmented models, and thus lower performance. + +It is desired to have a modularized model that can switch between "with" and "without" knowledge settings. Inspired by [90], we propose to employ adapters [33] to build the network branch to encode knowledge-augmented language $t^k$ , where serial MLP adapters are inserted after each self-attention and MLP modules for all Transformer layers of the text encoder, and $t^k$ is passed through $f_{\phi}$ and adapters. Meanwhile, the original $f_{\phi}$ is reserved as the branch to encode vanilla natural language $t$ . The proposed adapter-modularized architecture can also be used for efficient stage-wise continual pre-training: one may start with a vanilla language-image model pre-trained on $\mathcal{D}$ , and continue pre-train the adapters with knowledge-augmented data $(\mathcal{D}, \mathcal{S})$ to build its knowledge version. + +# 3.3 Object Detection + +Object detection (OD) typically involves two tasks: $\mathcal{L}_{\mathrm{OD}} = \mathcal{L}_{\mathrm{cls}} + \mathcal{L}_{\mathrm{loc}}$ , where the localization task $\mathcal{L}_{\mathrm{loc}}$ aims to locate the presence of objects in an image with a bounding box, and classification task $\mathcal{L}_{\mathrm{cls}}$ determines what object categories are present in that box. Similar to the IC task above, we improve the categorization task of individual boxes $\mathcal{L}_{\mathrm{cls}}$ in OD with external knowledge, and keep $\mathcal{L}_{\mathrm{loc}}$ the same. Specifically, we leverage GLIP [50] to reformulate OD as a phrase grounding task, by grounding each region proposed by $\mathcal{L}_{\mathrm{loc}}$ [53] to phrases in a text sequence. For language encoding, we first augment a category name $t$ into its knowledge-augmented form $t^k = [q,s]$ ; this is different from IC in that $p$ is excluded, as no prompt engineering is used in OD, as in [50]. In the original GLIP, a sequential text encoding scheme is used: a concatenated long sequence $[q_1,\dots ,q_K]$ over category names is considered as the text encoder input. In our case, simple concatenation $[q_{1},s_{1}\dots ,q_{K},s_{K}]$ will quickly break the max length requirement of the language encoder. + +To resolve the issue, we propose a parallel text encoding scheme: each $\pmb{t}^k$ is passed through language encoder independently, we use the top-layer feature of [CLS] token as the contextual vector representation $\tilde{\pmb{u}}\in \mathbb{R}^{P\times 1}$ of $\pmb{t}^k$ : $\tilde{\pmb{u}} = f_{\phi}(\pmb{t}^k)$ . Given $K$ categories, they can be encoded in parallel in a batch; the encoded phrase feature sequence is the concatenation $\mathbf{U}\in \mathbb{R}^{P\times K}$ : $\mathbf{U} = [\tilde{\pmb{u}}_1,\dots ,\tilde{\pmb{u}}_K]$ . The region encoding is the same as in GLIP. The feature pyramid is $\mathbf{V}\in \mathbb{R}^{M\times P}:\mathbf{V} = f_{\theta}(\mathbf{x})$ , where $M$ is the number of box features. The alignment scores $\mathbf{S}_{\mathrm{ground}}$ are computed: + +$$ +\mathbf {S} _ {\text {g r o u n d}} = \mathbf {V U}, \quad \mathcal {L} _ {\mathrm {c l s}} = \mathcal {M} (\mathbf {S} _ {\text {g r o u n d}}; \mathbf {T}), \tag {4} +$$ + +where $\mathbf{T} \in \{0,1\}^{M \times K}$ is the target indicating match or no match, and $\mathcal{M}(\mathbf{S};\mathbf{T})$ is the focal loss [53]. The grounding model, consisting of the image encoder $f_{\theta}$ , the language encoder $f_{\phi}$ and a cross-modal interaction head introduced in [50], is trained end-to-end by minimizing the loss defined in (4). In the evaluation stage, the external knowledge is also retrieved, and encoded in the same parallel encoding manner to enrich the category names in the downstream OD tasks. + +# 4 Experimental Results + +In this section, we examine our knowledge-augmented approach to answer two research questions. Q1: To what extent external knowledge benefits visual transfer learning, including sample-efficiency in pre-training and downstream? Q2: Why does external knowledge help zero-shot transfer (illustrated with success and failure case studies)? + +# 4.1 Settings + +Evaluation benchmark. We apply the proposed knowledge-augmented models to two task-level transfer settings defined in ELEVATER benchmark [47], which evaluates the transferability of the learned visual representations in the wild. We study our models based on the datasets described in Table 1. The license, PII, and consent details of each dataset are in the respective papers. Due to the limited computational resources, the pre-training datasets are constrained to the large publicly available datasets used in [95, 50]. This setting is defined as the "Academic Track" in [47], which friendly to the academic community to allow reproducibility of the results. The number of visual concepts is identical to the number of categories for datasets with category names (e.g., ImageNet + +
TaskPre-trainingDownstream
#Instances#ConceptsVocab. Size#Ins/#C.Concept Overlap (%)
ICDatasetImageNet-1K20-datasets
ImageNet-21K [15]13M19.2K / 18.4K13.5K / 12.9K591 ± 53711.8213.26
GCC-3M [76]3.3M681K / 64.5K29.6K / 13.0K9.5 ±30335.9719.73
GCC-12M [11]12M10.2M / 728K1.24M / 264K5.6 ± 35361.0231.34
YFCC-14M [84]14M14.2M / 1.25M2.41M / 473K8.3 ± 135465.2334.65
ODDatasetLVIS13-datasets
Object-365 [75]9.6M365 / 365452 / 45226.3K ± 12.4K13.4621.26
+ +Table 1: Statistics of training and test datasets used in our experiments. #Instances indicates #Image for IC and #Regions for OD, respectively. For #Concept and Vocabulary size, we report numbers for the full set and for items with frequency larger than 5. #Ins/C. reports the mean and standard derivation for the numbers of instances per concept. + +
Training MethodKnowledge SImageNet-1KICinW (20 datasets)
1-branch, from scratch-28.164.9327.1517.10
Swn_hier27.4329.0328.1528.69
Swn_def22.8729.3126.9729.14
Swiki_def22.0530.2329.0333.44
2-branch, continue pre-trainingSwiki_def28.1628.40/28.9027.1530.73/30.91
2-branch, from scratchSwiki_def28.1632.52/32.4427.1532.46/33.49
+ +Table 2: Zero-shot task transfer performance after pre-training on ImageNet-21K dataset. The top block studies the effectiveness of knowledge sources $S$ , and the bottom block studies the modularized approach. For each downstream task, the 1st and 2nd column reports the results without and with knowledge, namely green cells indicate “a match”, orange cells indicate “a mismatch” w.r.t. adding knowledge in training and evaluation. In the bottom block, we report two numbers when evaluated with knowledge: using the knowledge branch only, and using two branches selectively. + +and Object-365). For image-text data (bottom 3 rows of the IC block), we use Spacy [32] to extract the noun phrases. We also use a merged version of GCC-3M and GCC-12M denoted as GCC-15M. Given the pool of concepts, we calculate the number of unique words and report it as the vocabulary size. For Concepts and Vocabulary Size, we report 2 numbers: first for the full set, second for items with frequency larger than 5. The latter provides a sense of "long-tailness". The statistics (e.g., ratio of #Instance / #Concept) illustrates the varied trade-off over different datasets: image diversity, semantic richness and long-tailness. For example, YFCC is the most long-tail dataset in IC, as it has low mean value and the largest standard derivation value in #Instance / #Concept. The concept overlap is computed as the percentage of concepts in a downstream dataset that are covered by the pre-training dataset. For 20-datasets and 13-datasets, the averaged overlap across individual datasets is reported. It measures the gap (or difficulty) in concept transfer between the pre-training and the downstream data. The dataset statistics are detailed in Section B.1 in Appendix. + +Zero/Few-shot image classification. Following UniCL [95], this task evaluates to what extent a model understands novel concepts. We pre-train on ImageNet-21K [15] and GCC [76, 11]/YFCC [84] datasets, and report results on ImageNet-1K [15] and a suite of 20 datasets (ICinW) proposed in [47]. We use the same text prompts as in [71, 95], and report scores averaged over 20 datasets. UniCL/Florence [101] show superior performance to CLIP or ALIGN counterparts; UniCL is Florence in a controlled academic setting, trained on the large publicly available datasets [95]. + +Zero-shot object detection. Following GLIP [50], we pre-train on Object365 [75], and transfer the learned visual representations for object detection on LVIS [28] and a suite of 13 small OD datasets (ODinW) proposed in [50, 47], to check the generalization ability. The box mAP is reported. + +# 4.2 Image Classification + +ImageNet-21K pre-training. We start by pre-training on ImageNet-21K, where all ImageNet-1K images are excluded. We still see a small amount of concept overlap in Table ① and hypothesize that some category names are given based on different level of WordNet hierarchy. The benefits of this setting are two-fold: it ensures distinctively less concept overlap, and all concepts can find their full WordNet knowledge. We report the results in Table ② For each checkpoint, we report the results without and with knowledge in the evaluation stage. We confirm two major findings below. + +
Training DataMethodImageNet-1KICinW (20 datasets)
Dataset# SamplesZero-shotZero-shotLinear ProbingFine-tuning
ImageNet-21K13M (full)UniCL28.1627.1553.07 ± 4.1555.96 ± 2.50
13M (full)K-LITE30.2333.4453.92 ± 1.0557.81 ± 1.48
YFCC-14M + ImageNet-21K14M (half)UniCL34.4334.3053.50 ± 2.2256.45 ± 2.48
14M (half)K-LITE36.6736.5049.48 ± 2.2355.88 ± 1.64
14M (half)K-LITE◇42.3636.5054.28 ± 3.6652.11 ± 4.90
27M (full)UniCL43.0635.9955.96 ± 3.3858.25 ± 2.98
27M (full)K-LITE45.6738.8957.06 ± 1.4858.24 ± 2.36
GCC-15M + ImageNet-21K15M (half)UniCL41.6436.3153.86 ± 2.7359.04 ± 3.13
15M (half)K-LITE44.2639.5355.91 ± 2.5358.20 ± 3.39
15M (half)K-LITE◇47.3040.3257.38 ± 2.7060.72 ± 2.29
28M (full)UniCL46.8338.9057.92 ± 3.3160.99 ± 2.74
28M (full)K-LITE48.7641.3458.56 ± 3.1263.39 ± 1.74
+ +Table 3: Overall comparisons of our knowledge-augmented models. Each model is pre-trained with 32 epochs following CLIP [71]/UniCL [95]. $\diamond$ It indicates that the Combine scheme is used for the image-caption data, otherwise the default is the Concat scheme described in Section 3.2 The linear probing and fine-tuning results are reported for 5-shot settings over 3 random seeds. + +F1: All three knowledge sources are beneficial. In Section 3.1 we have introduced WordNet hierarchy $S_{\mathrm{wn\_path}}$ , WordNet definition $S_{\mathrm{wn\_def}}$ , and Wiktionary definition $S_{\mathrm{wiki\_def}}$ as external knowledge sources. It is shown that all three of them are effective, improving the zero-shot accuracy by absolute gain $1 - 2\%$ on ImageNet-1K (from $28.16\%$ to $30.23\%$ ) and $2 - 6\%$ on the dataset suite in average (from $27.15\%$ to $33.44\%$ ), respectively. Among them, Wiktionary definition $S_{\mathrm{wiki\_def}}$ turns out to be the most effective, therefore, we use it as the default knowledge source throughout the remaining experiments. + +F2: The modularized approach is effective. Our results in Table2 reveal that training/test inconsistency in terms of involving knowledge can dramatically degrade the model performance. For example in the 1st row, the baseline UniCL is pre-trained without knowledge, its performance decreases from $28.16\%$ to $4.93\%$ when knowledge is added in the test stage. In contrast, in the 4th row, our K-LITE is pre-trained with knowledge, its performance decreases from $33.44\%$ to $29.03\%$ if knowledge is excluded in the evaluation stage. Therefore, we consider a modularized approach with 2-branch in the model. First, we continue pre-train our modularized model from a 32-epoch knowledge-free checkpoint by only updating the Adapters on knowledge-augmented image-text pairs for 10 epochs. It already shows a performance gain from $27.61\%$ to $28.40\%$ . This suggests a more affordable solution to obtain knowledge-augmented models from existing models. We can further boost the performance to $28.90\%$ if we evaluate with two branches, each of which only passes its corresponding language version. Finally, we also train the modularized model from scratch, and it demonstrates a significant gain (absolute $4\%$ ) on ImageNet-1K, and over $5\%$ improvement on the 20 datasets. For fair comparisons with knowledge-free models, we train our models with one branch in the rest of experiments. + +To demonstrate the performance of K-LITE in the extreme large-scale settings, we leverage the largest checkpoint of Florence [101] trained on 800M image-text pairs, and continue pre-training the model on ImageNet-21K with external knowledge. It improves the zero-shot ImageNet-1K accuracy of Florence from $83.74\%$ to $85.80\%$ . As an ablation baseline, continuing pre-training without knowledge yields $85.35\%$ . The absolute $0.45\%$ performance gain shows that external knowledge can still benefit transfer learning, though a huge amount of pre-training data is employed. + +Pre-training on image-text-label data. The unification of image-label and image-caption as image-text-label has been demonstrated superior over either one of them [95]. Therefore, we report overall results on the combined data in Table3. The few-shot learning results are reported with 5 training examples, using two model adaptation method: linear probing and full model fine-tuning. The average numbers over 3 random seeds are reported. K-LITE improves its knowledge-free counterpart UniCL in almost all the cases. Importantly, K-LITE can outperform UniCL using only half of the pre-training image-text pairs in several cases. It demonstrate the high sample-efficiency of K-LITE, and that external knowledge is an effective source to consider, when collecting large-scale image-text pairs to develop language-augmented visual models at scale. We also compare K-LITE and UniCL with Swin-Base on the joint data including ImageNet-21K, GCC15M and YFCC15M. K-LITE + +![](images/111e2e78df18c63086604739a29be40563024dd31cd257c40ecd37c53d098afe.jpg) + +Figure 3: Performance improvement analysis with external knowledge. External knowledge can largely improve concept overlap between pre-training and evaluation stages, hence usually yields higher recognition scores. Knowledge coverage indicates the percentage of concepts that exist in the knowledge base for each downstream dataset. +![](images/877245ce45a04e2b761f15cf17ac3e169e47615b1f7d60aa73dda7d942aa7ed2.jpg) +English marigold: Any of the Old World plants, of the genus Calendula, with orange, yellow or reddish flowers. +Wallflower: Any of several short-lived herbs or shrubs of the Erysimum genus with bright yellow to red flowers. + +![](images/6eab943d1113e369c022cb840f977b72653d57ec1a0ffc9d6190e9cbdc9a9a8d.jpg) +(a) Success examples. The two datasets with largest improvement in Fig. 3 Flowers102 and Food101. The description of the parent concept, material, shape, color etc. clarifies the concepts, boosting performance for the fine-grained classification tasks. + +![](images/ebea643b918611f103de5a8f6e0ec896fa691ced4a180ff340cd3e8c903c684d.jpg) +Lobster bisque: A thick creamy soup made from fish, shellfish, meat or vegetables. +Hot and sour soup: Any one of seven soups, served in various Asian cuisine which are both spicy and sour + +![](images/fbed6620178818fbfc3b756a81ef6796dba909975450f93ca86ae50b0f20da0c.jpg) +(b) Failure examples. The two datasets with the largest performance loss in Fig. 3 Left (EuroSat): both class names have the same knowledge. Middle & Right (VOC2007): The knowledge contains spurious words that confuse the models. + +Figure 4: Success and failure cases on image classification. For each image, the top row is the knowledge-based prediction, and the bottom row is the baseline prediction (no knowledge). +![](images/4dab7213810fe92252395e4c905075462a25aa08a3a1304ffa0c75a0087b1f08.jpg) +bus: A motor vehicle for transporting large numbers of people along roads. +car: A wheeled vehicle that moves independently, with at least three wheels + +![](images/13f83fae7a2091c2a19a8537c9adca88865969453fb96c3246ace7aeb5a034a7.jpg) +sofa: A raised area of a building's floor, usually covered with carpeting, used for sitting +chair: An item of furniture used to sit on or in, comprising a seat, legs or wheels, back... + +improve the zero-shot performance of UniCL from $52.18\%$ to $57.78\%$ on ImageNet-1K, and from $43.20\%$ to $45.47\%$ on ICinW. + +Breakdown Analysis. Next, we ask why does external knowledge improve the zero-shot task transfer performance on a broad range of datasets? To answer this question, we compare the breakdown performance on all 20 dataset in Figure 3 for the ImageNet-21K checkpoints trained with and without Wiki knowledge. Out of 20 datasets, external knowledge shows superior/comparable/inferior performance to the baseline on 16/1/3 datasets, respectively. One prominent observation is that Wiki knowledge improves concept overlap for train-evaluation from $13.26\%$ to $51.24\%$ by average. It is easy to understand, concepts are explained in more commonly used words in Wikitionary, providing a bridge for train and evaluation. This is reflected by the increased height of blue bar for most datasets in Figure 3. Interestingly, for all datasets with increased accuracy scores, there shows an increase of the concept overlap. In summary, knowledge is an effective approach to improve concept overlap, a prerequisite for good task transfer performance. In Figure 4(a), we provide success examples after adding knowledge; more examples are shown in Appendix. + +Limitations. The failure cases where knowledge-augmented approach does not help mainly belong to two scenarios: (i) No external knowledge was extracted from the given knowledge base (i.e., Wiktionary in this case), e.g., StanfordCars and FGVC Aircraft. They often require domain-specific knowledge explanations to define a car brand (e.g., Volvo C30 Hatchback 2012) or an aircraft model type (e.g., 737-200), while Wiktionary can hardly provide such professional definitions. (ii) While knowledge is available, the quality is too low to provide useful information. In Figure 4(b), we provide failure examples from two datasets with the biggest performance loss after adding + +
MethodLVISODinW (13 datasets)
APrAPcAPf-SLVISSwn_pathSwn_defSwiki_def-Swn_pathSwn_defSwiki_def
GLIP-A [50]14.213.923.418.5----28.8---
Baseline GLIP♥8.614.023.117.917.617.117.215.027.526.821.018.5
K-LITE14.818.624.816.921.318.721.420.525.030.328.431.7
+ +Table 4: Zero-shot task transfer performance on OD. APr/APc/APf indicates the AP values for rare, common, frequent groups of categories on LVIS. Cell coloring follows the same protocol as in Table2. $\diamondsuit$ GLIP is implemented with parallel text encoding in Section 3.3 without external knowledge. + +knowledge. In Figure 6 in the Appendix, we show more examples where knowledge only yields slight improvement. To summarize, a promising future research direction is to improve the knowledge quality to be more related to the given classification tasks. + +# 4.3 Object detection + +We evaluate the model's ability to recognize diverse objects on LVIS [28] and 13 downstream datasets used in [50] in a zero-shot setting. We report on MiniVal containing 5,000 images on LVIS. Our K-LITE GLIP is trained with Wiktionary definitions. The results are presented in Table 4. The 1st row are the original numbers reported in [50], using the sequential text encoding. The 2nd row is our implementation of GLIP using parallel text encoding, whose effectiveness is validated by the comparable numbers with 1st row. The 3rd row is our knowledge-augmented GLIP, i.e., K-LITE. The benefit of using external knowledge is evident. On LVIS, the categories are divided into rare, common, frequent groups, based on the number of training images per category. K-LITE improves the detection performance for all three groups with an average of 2.8 points on LVIS, and particularly brings a 4.7 points improvement on MiniVal APc over the GLIP-A reported in [50]. We conclude that the enriched semantics of external knowledge significantly helps the model recognize concepts with a decent number of instances. Since LVIS has its own knowledge source $S_{\mathrm{LVIS}}$ , mostly built upon WordNet definitions [28], we evaluate our model with $S_{\mathrm{LVIS}}$ . We alter the external knowledge source to $S_{\mathrm{wn\_path}}$ , $S_{\mathrm{wn\_def}}$ , and $S_{\mathrm{wiki\_def}}$ in evaluation, which yields mAP 18.7, 21.4, 20.5, respectively. It verifies that our knowledge source extraction process is reliable. Similarly, K-LITE improve the 13 downstream OD datasets from 28.8 (or 27.5 with its own knowledge-free counterpart) to 31.7. The success and failure examples of OD are shown in Section B.5 in Appendix. + +# 5 Conclusions + +In this paper, we have presented a knowledge-augmented approach K-LITE to learn a generic visual model for task-level transfer. General external knowledge sources including WordNet and Wiktionary are explored to enrich the natural language supervision, which is then used in both the language-image pre-training stage and the prompt-based evaluation stage. We have demonstrated the generality and effectiveness of K-LITE in two core computer vision problems: image classification and object detection. Extensive experimental results show that our method can achieve superior performance over existing methods on 20 IC datasets and 13 OD datasets, respectively. K-LITE also outperforms its knowledge-free counterpart UniCL using half of the pre-training data in the large-scale academic data setting, demonstrating that leveraging external knowledge is a promising direction in improving pre-training sample-efficiency for learning transferable visual models. + +# Acknowledgments + +The authors gratefully acknowledge Chenguang Zhu, Wenhao Yu, Yuwei Fang for the early insightful discussions on the use of dictionary for rare concepts in NLP task, Hao Cheng for the inspirations of external knowledge in open-domain QA. The project is partly done in the MSR-Berkeley collaboration program. The work depends on publicly available knowledge databases; we acknowledge all the original authors and contributors who made their "knowledge" public. Sheng Shen and Kurt Keutzer are supported by Samsung SAIT, Intel corporation, Intel VLAB team, Intel One-API center of excellence, as well as funding through BDD and BAIR. The work of Sheng Shen, Anna Rohrbach and Trevor Darrell was supported in part by DoD including DARPA's LwLL, PTG and/or SemaFor programs, as well as BAIR's industrial alliance programs. + +3https://www.microsoft.com/en-us/research/collaboration/bair + +# References + +[1] FER 2013: Kaggle challenges in representation learning facial expression recognition. https://www.kaggle.com/. +[2] Harsh Agrawal, Karan Desai, Yufei Wang, Xinlei Chen, Rishabh Jain, Mark Johnson, Dhruv Batra, Devi Parikh, Stefan Lee, and Peter Anderson. nocaps: novel object captioning at scale. In ICCV, 2019. +[3] Stanislaw Antol, Aishwarya Agrawal, Jiasen Lu, Margaret Mitchell, Dhruv Batra, C Lawrence Zitnick, and Devi Parikh. Vqa: Visual question answering. In ICCV, 2015. +[4] Soren Auer, Christian Bizer, Georgi Kobilarov, Jens Lehmann, Richard Cyganiak, and Zachary Ives. Dbpedia: A nucleus for a web of open data. In The semantic web, pages 722-735. Springer, 2007. +[5] Sven Bambach, Stefan Lee, David Crandall, and Chen Yu. Lending a hand: Detecting hands and recognizing activities in complex egocentric interactions. In ICCV, 2015. +[6] Kurt Bollacker, Colin Evans, Praveen Paritosh, Tim Sturge, and Jamie Taylor. Freebase: a collaboratively created graph database for structuring human knowledge. In ACM SIGMOD, 2008. +[7] Sebastian Borgeaud, Arthur Mensch, Jordan Hoffmann, Trevor Cai, Eliza Rutherford, Katie Millican, George van den Driessche, Jean-Baptiste Lespiau, Bogdan Damoc, Aidan Clark, et al. Improving language models by retrieving from trillions of tokens. arXiv preprint arXiv:2112.04426, 2021. +[8] Lukas Bossard, Matthieu Guillaumin, and Luc Van Gool. Food-101-mining discriminative components with random forests. In ECCV, 2014. +[9] Yingshan Chang, Mridu Narang, Hisami Suzuki, Guihong Cao, Jianfeng Gao, and Yonatan Bisk. Webqa: Multihop and multimodal qa. arXiv preprint arXiv:2109.00590, 2021. +[10] Soravit Changpinyo, Wei-Lun Chao, and Fei Sha. Predicting visual exemplars of unseen classes for zero-shot learning. In ICCV, 2017. +[11] Soravit Changpinyo, Piyush Sharma, Nan Ding, and Radu Soricut. Conceptual 12m: Pushing web-scale image-text pre-training to recognize long-tail visual concepts. In CVPR, 2021. +[12] Jiaoyan Chen, Yuxia Geng, Zhuo Chen, Ian Horrocks, Jeff Z Pan, and Huajun Chen. Knowledge-aware zero-shot learning: Survey and perspective. *IJCAI*, 2021. +[13] Gong Cheng, Junwei Han, and Xiaoqiang Lu. Remote sensing image scene classification: Benchmark and state of the art. Proceedings of the IEEE, 2017. +[14] Mircea Cimpoi, Subhransu Maji, Iasonas Kokkinos, Sammy Mohamed, and Andrea Vedaldi. Describing textures in the wild. In CVPR, 2014. +[15] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, 2009. +[16] Li Deng. The MNIST database of handwritten digit images for machine learning research. IEEE signal processing magazine, 2012. +[17] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018. +[18] Mohamed Elhoseiny, Babak Saleh, and Ahmed Elgammal. Write a classifier: Zero-shot learning using purely textual descriptions. In ICCV, 2013. +[19] Mohamed Elhoseiny, Yizhe Zhu, Han Zhang, and Ahmed Elgammal. Link the head to the "beak": Zero shot learning from noisy text description at part precision. In CVPR, 2017. +[20] Mark Everingham, Luc Van Gool, Christopher KI Williams, John Winn, and Andrew Zisserman. The pascal visual object classes (VOC) challenge. IJCV, 2010. +[21] Ali Farhadi, Ian Endres, Derek Hoiem, and David Forsyth. Describing objects by their attributes. In CVPR, 2009. +[22] Li Fei-Fei, Rob Fergus, and Pietro Perona. Learning generative visual models from few training examples: An incremental Bayesian approach tested on 101 object categories. In CVPR workshop, 2004. + +[23] Rob Fergus, Hector Bernal, Yair Weiss, and Antonio Torralba. Semantic label sharing for learning with many categories. In ECCV, 2010. +[24] Jannik Fritsch, Tobias Kuehl, and Andreas Geiger. A new performance measure and evaluation benchmark for road detection algorithms. In ITSC. IEEE, 2013. +[25] Andrea Frome, Greg S Corrado, Jon Shlens, Samy Bengio, Jeff Dean, Marc'Aurelio Ranzato, and Tomas Mikolov. Devise: A deep visual-semantic embedding model. NeurIPS, 2013. +[26] Yanwei Fu and Leonid Sigal. Semi-supervised vocabulary-informed learning. In CVPR, 2016. +[27] Robert Geirhos, Patricia Rubisch, Claudio Michaelis, Matthias Bethge, Felix A Wichmann, and Wieland Brendel. Imagenet-trained cnns are biased towards texture; increasing shape bias improves accuracy and robustness. arXiv preprint arXiv:1811.12231, 2018. +[28] Agrim Gupta, Piotr Dollar, and Ross Girshick. Lvis: A dataset for large vocabulary instance segmentation. In CVPR, 2019. +[29] Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Ming-Wei Chang. Realm: Retrieval-augmented language model pre-training. arXiv preprint arXiv:2002.08909, 2020. +[30] Weituo Hao, Chunyuan Li, Xiujun Li, Lawrence Carin, and Jianfeng Gao. Towards learning a generic agent for vision-and-language navigation via pre-training. In CVPR, 2020. +[31] Patrick Helber, Benjamin Bischke, Andreas Dengel, and Damian Borth. EuroSat: A novel dataset and deep learning benchmark for land use and land cover classification. IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing, 2019. +[32] Matthew Honnibal and Ines Montani. spaCy 2: Natural language understanding with Bloom embeddings, convolutional neural networks and incremental parsing. To appear, 2017. +[33] Neil Houlsby, Andrei Giurgiu, Stanislaw Jastrzebski, Bruna Morrone, Quentin De Laroussilhe, Andrea Gesmundo, Mona Attariyan, and Sylvain Gelly. Parameter-efficient transfer learning for nlp. In ICML, 2019. +[34] Drew A Hudson and Christopher D Manning. Gqa: A new dataset for real-world visual reasoning and compositional question answering. In CVPR, 2019. +[35] Dinesh Jayaraman and Kristen Grauman. Zero shot recognition with unreliable attributes. arXiv preprint arXiv:1409.4327, 2014. +[36] Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc V Le, Yunhsuan Sung, Zhen Li, and Tom Duerig. Scaling up visual and vision-language representation learning with noisy text supervision. arXiv preprint arXiv:2102.05918, 2021. +[37] Douwe Kiela, Hamed Firooz, Aravind Mohan, Vedanuj Goswami, Amanpreet Singh, Pratik Ringshia, and Davide Testuggine. The hateful memes challenge: Detecting hate speech in multimodal memes. NeurIPS, 2020. +[38] Wonjae Kim, Bokyung Son, and Ildoo Kim. Vilt: Vision-and-language transformer without convolution or region supervision. arXiv preprint arXiv:2102.03334, 2021. +[39] Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, and Neil Houlsby. Big transfer (bit): General visual representation learning. In ECCV, 2020. +[40] Jonathan Krause, Michael Stark, Jia Deng, and Li Fei-Fei. 3d object representations for fine-grained categorization. In ICCV workshops, 2013. +[41] Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009. +[42] Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, et al. Natural questions: a benchmark for question answering research. TACL, 2019. +[43] Christoph H Lampert, Hannes Nickisch, and Stefan Harmeling. Learning to detect unseen object classes by between-class attribute transfer. In CVPR, 2009. +[44] Christoph H Lampert, Hannes Nickisch, and Stefan Harmeling. Attribute-based classification for zero-shot visual object categorization. PAMI, 2013. + +[45] Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Kuttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, et al. Retrieval-augmented generation for knowledge-intensive NLP tasks. NeurIPS, 2020. +[46] Ang Li, Allan Jabri, Armand Joulin, and Laurens Van Der Maaten. Learning visual n-grams from web data. In ICCV, 2017. +[47] Chunyuan Li, Haotian Liu, Lianian Harold Li, Pengchuan Zhang, Jyoti Aneja, Jianwei Yang, Ping Jin, Houdong Hu, Zicheng Liu, Yong Jae Lee, and Jianfeng Gao. ELEVATER: A benchmark and toolkit for evaluating language-augmented visual models. In NeurIPS Track on Datasets and Benchmarks, 2022. +[48] Junnan Li, Ramprasaath R Selvaraju, Akhilesh Deepak Gotmare, Shafiq Joty, Caiming Xiong, and Steven Hoi. Align before fuse: Vision and language representation learning with momentum distillation. arXiv preprint arXiv:2107.07651, 2021. +[49] Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, and Kai-Wei Chang. Visualbert: A simple and performant baseline for vision and language. arXiv preprint arXiv:1908.03557, 2019. +[50] Liunian Harold Li, Pengchuan Zhang, Haotian Zhang, Jianwei Yang, Chunyuan Li, Yiwu Zhong, Lijuan Wang, Lu Yuan, Lei Zhang, Jenq-Neng Hwang, et al. Grounded language-image pre-training. CVPR, 2022. +[51] Xiujun Li, Xi Yin, Chunyuan Li, Pengchuan Zhang, Xiaowei Hu, Lei Zhang, Lijuan Wang, Houdong Hu, Li Dong, Furu Wei, et al. Oscar: Object-semantics aligned pre-training for vision-language tasks. In ECCV, 2020. +[52] Yangguang Li, Feng Liang, Lichen Zhao, Yufeng Cui, Wanli Ouyang, Jing Shao, Fengwei Yu, and Junjie Yan. Supervision exists everywhere: A data efficient contrastive language-image pre-training paradigm. arXiv preprint arXiv:2110.05208, 2021. +[53] Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dólar. Focal loss for dense object detection. In ICCV, 2017. +[54] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dólar, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ECCV, 2014. +[55] Angli Liu, Jingfei Du, and Veselin Stoyanov. Knowledge-augmented language model and its application to unsupervised named-entity recognition. arXiv preprint arXiv:1904.04458, 2019. +[56] Weijie Liu, Peng Zhou, Zhe Zhao, Zhiruo Wang, Qi Ju, Haotang Deng, and Ping Wang. K-BERT: Enabling language representation with knowledge graph. In AAAI, 2020. +[57] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. ICCV, 2021. +[58] Jiasen Lu, Dhruv Batra, Devi Parikh, and Stefan Lee. Vilbert: Pretraining task-agnostic visiolinguistic representations for vision-and-language tasks. arXiv preprint arXiv:1908.02265, 2019. +[59] Subhransu Maji, Esa Rahtu, Juho Kannala, Matthew Blaschko, and Andrea Vedaldi. Fine-grained visual classification of aircraft. arXiv preprint arXiv:1306.5151, 2013. +[60] Kenneth Marino, Xinlei Chen, Devi Parikh, Abhinav Gupta, and Marcus Rohrbach. Krisp: Integrating implicit and symbolic knowledge for open-domain knowledge-based VQA. In CVPR, 2021. +[61] Kenneth Marino, Mohammad Rastegari, Ali Farhadi, and Roozbeh Mottaghi. OK-VQA: A visual question answering benchmark requiring external knowledge. In CVPR, 2019. +[62] Christian M Meyer and Iryna Gurevych. Wiktionary: A new rival for expert-built lexicons? Exploring the possibilities of collaborative lexicography. na, 2012. +[63] George A Miller. WordNet: An electronic lexical database. MIT press, 1998. +[64] Norman Mu, Alexander Kirillov, David Wagner, and Saining Xie. Slip: Self-supervision meets language-image pre-training. arXiv preprint arXiv:2112.12750, 2021. +[65] Maria-Elena Nilsback and Andrew Zisserman. Automated flower classification over a large number of classes. In Indian Conference on Computer Vision, Graphics & Image Processing. IEEE, 2008. +[66] Omkar M Parkhi, Andrea Vedaldi, Andrew Zisserman, and CV Jawahar. Cats and dogs. In CVPR, 2012. + +[67] Genevieve Patterson and James Hays. SUN attribute database: Discovering, annotating, and recognizing scene attributes. In CVPR, 2012. +[68] Matthew E Peters, Mark Neumann, Robert L Logan IV, Roy Schwartz, Vidur Joshi, Sameer Singh, and Noah A Smith. Knowledge enhanced contextual word representations. arXiv preprint arXiv:1909.04164, 2019. +[69] Fabio Petroni, Aleksandra Piktus, Angela Fan, Patrick Lewis, Majid Yazdani, Nicola De Cao, James Thorne, Yacine Jernite, Vladimir Karpukhin, Jean Maillard, et al. KILT: a benchmark for knowledge intensive language tasks. arXiv preprint arXiv:2009.02252, 2020. +[70] Ruizhi Qiao, Lingqiao Liu, Chunhua Shen, and Anton Van Den Hengel. Less is more: zero-shot learning from online textual documents with noise suppression. In CVPR, 2016. +[71] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. arXiv preprint arXiv:2103.00020, 2021. +[72] Scott Reed, Zeynep Akata, Honglak Lee, and Bernt Schiele. Learning deep representations of fine-grained visual descriptions. In CVPR, 2016. +[73] Marcus Rohrbach, Michael Stark, and Bernt Schiele. Evaluating knowledge transfer and zero-shot learning in a large-scale setting. In CVPR, 2011. +[74] Ruslan Salakhutdinov, Antonio Torralba, and Josh Tenenbaum. Learning to share visual appearance for multiclass object detection. In CVPR, 2011. +[75] Shuai Shao, Zeming Li, Tianyuan Zhang, Chao Peng, Gang Yu, Xiangyu Zhang, Jing Li, and Jian Sun. Objects365: A large-scale, high-quality dataset for object detection. In ICCV, 2019. +[76] Piyush Sharma, Nan Ding, Sebastian Goodman, and Radu Soricut. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In ACL, 2018. +[77] Sheng Shen, Liunian Harold Li, Hao Tan, Mohit Bansal, Anna Rohrbach, Kai-Wei Chang, Zhewei Yao, and Kurt Keutzer. How much can clip benefit vision-and-language tasks? ICLR, 2022. +[78] Richard Socher, Milind Ganjoo, Christopher D Manning, and Andrew Ng. Zero-shot learning through cross-modal transfer. NeurIPS, 2013. +[79] Robyn Speer, Joshua Chin, and Catherine Havasi. Conceptnet 5.5: An open multilingual graph of general knowledge. In AAAI, 2017. +[80] Johannes Stallkamp, Marc Schlipsing, Jan Salmen, and Christian Igel. The german traffic sign recognition benchmark: a multi-class classification competition. In IJCNN, 2011. +[81] Weijie Su, Xizhou Zhu, Yue Cao, Bin Li, Lewei Lu, Furu Wei, and Jifeng Dai. Vl-bert: Pre-training of generic visual-linguistic representations. arXiv preprint arXiv:1908.08530, 2019. +[82] Chen Sun, Abhinav Shrivastava, Saurabh Singh, and Abhinav Gupta. Revisiting unreasonable effectiveness of data in deep learning era. In ICCV, 2017. +[83] Hao Tan and Mohit Bansal. Lxmert: Learning cross-modality encoder representations from transformers. In EMNLP, 2019. +[84] Bart Thomee, David A Shamma, Gerald Friedland, Benjamin Elizalde, Karl Ni, Douglas Poland, Damian Borth, and Li-Jia Li. Yfcc100m: The new data in multimedia research. Communications of the ACM, 2016. +[85] Changyao Tian, Wenhai Wang, Xizhou Zhu, Xiaogang Wang, Jifeng Dai, and Yu Qiao. Vl-ltr: Learning class-wise visual-linguistic representation for long-tailed visual recognition. arXiv preprint arXiv:2111.13579, 2021. +[86] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NeurIPS, 2017. +[87] Bastiaan S Veeling, Jasper Linmans, Jim Winkens, Taco Cohen, and Max Welling. Rotation equivariant cnns for digital pathology. In MICCAI, 2018. +[88] Denny Vrandecic. Wikidata: A new platform for collaborative data collection. In WWW, 2012. + +[89] Catherine Wah, Steve Branson, Peter Welinder, Pietro Perona, and Serge Belongie. The caltech-ucsd birds-200-2011 dataset, 2011. +[90] Ruize Wang, Duyu Tang, Nan Duan, Zhongyu Wei, Xuanjing Huang, Guihong Cao, Daxin Jiang, Ming Zhou, et al. K-adapter: Infusing knowledge into pre-trained models with adapters. arXiv preprint arXiv:2002.01808, 2020. +[91] Xiaolong Wang, Yufei Ye, and Abhinav Gupta. Zero-shot recognition via semantic embeddings and knowledge graphs. In CVPR, 2018. +[92] Jason Weston, Samy Bengio, and Nicolas Usunier. Large scale image annotation: learning to rank with joint word-image embeddings. Machine learning, 2010. +[93] Jialin Wu, Jiasen Lu, Ashish Sabharwal, and Roozbeh Mottaghi. Multi-modal answer validation for knowledge-based VQA. arXiv preprint arXiv:2103.12248, 2021. +[94] Yongqin Xian, Christoph H Lampert, Bernt Schiele, and Zeynep Akata. Zero-shot learning—a comprehensive evaluation of the good, the bad and the ugly. PAMI, 2018. +[95] Jianwei Yang, Chunyuan Li, Pengchuan Zhang, Bin Xiao, Lu Yuan, Ce Liu, and Jianfeng Gao. Unified contrastive learning in image-text-label space. CVPR, 2022. +[96] Zhengyuan Yang, Zhe Gan, Jianfeng Wang, Xiaowei Hu, Yumao Lu, Zicheng Liu, and Lijuan Wang. An empirical study of GPT-3 for few-shot knowledge-based VQA. arXiv preprint arXiv:2109.05014, 2021. +[97] Lewei Yao, Runhui Huang, Lu Hou, Guansong Lu, Minzhe Niu, Hang Xu, Xiaodan Liang, Zhenguo Li, Xin Jiang, and Chunjing Xu. Filip: Fine-grained interactive language-image pre-training. arXiv preprint arXiv:2111.07783, 2021. +[98] Da Yin, Li Dong, Hao Cheng, Xiaodong Liu, Kai-Wei Chang, Furu Wei, and Jianfeng Gao. A survey of knowledge-intensive nlp with pre-trained language models. arXiv preprint arXiv:2202.08772, 2022. +[99] Fei Yu, Jiji Tang, Weichong Yin, Yu Sun, Hao Tian, Hua Wu, and Haifeng Wang. Ernie-vil: Knowledge enhanced vision-language representations through scene graph. arXiv preprint arXiv:2006.16934, 2020. +[100] Wenhao Yu, Chenguang Zhu, Yuwei Fang, Donghan Yu, Shuohang Wang, Yichong Xu, Michael Zeng, and Meng Jiang. Dict-bert: Enhancing language model pre-training with dictionary. arXiv preprint arXiv:2110.06490, 2021. +[101] Lu Yuan, Dongdong Chen, Yi-Ling Chen, Noel Codella, Xiyang Dai, Jianfeng Gao, Houdong Hu, Xuedong Huang, Boxin Li, Chunyuan Li, et al. Florence: A new foundation model for computer vision. arXiv preprint arXiv:2111.11432, 2021. +[102] Hongming Zhang, Daniel Khashabi, Yangqiu Song, and Dan Roth. Transomics: From linguistic graphs to commonsense knowledge. arXiv preprint arXiv:2005.00206, 2020. +[103] Pengchuan Zhang, Xiujun Li, Xiaowei Hu, Jianwei Yang, Lei Zhang, Lijuan Wang, Yejin Choi, and Jianfeng Gao. Vinvl: Revisiting visual representations in vision-language models. In CVPR, 2021. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] +(c) Did you discuss any potential negative societal impacts of your work? [Yes] in Appendix +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [N/A] +(b) Did you include complete proofs of all theoretical results? [N/A] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [No] +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] in Appendix +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] in Table 3 +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] in Appendix + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] +(b) Did you mention the license of the assets? [Yes] in Appendix +(c) Did you include any new assets either in the supplemental material or as a URL? [No] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/klitelearningtransferablevisualmodelswithexternalknowledge/images.zip b/klitelearningtransferablevisualmodelswithexternalknowledge/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..aca5c89af0db846b87aaf1c44b175ab62a1ec19b --- /dev/null +++ b/klitelearningtransferablevisualmodelswithexternalknowledge/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b00022a7cd9faef1cc5b8c3fc3a0741294780cf249eff79942df89d5e9276a3c +size 405070 diff --git a/klitelearningtransferablevisualmodelswithexternalknowledge/layout.json b/klitelearningtransferablevisualmodelswithexternalknowledge/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..8bfddd33a0164e26d425ca3faf212e47c7ad7fe1 --- /dev/null +++ b/klitelearningtransferablevisualmodelswithexternalknowledge/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c8e9cf7ddca2ea61f3963c28add2e0c11434e0a4b7d7bca2117bf6d50c5681d0 +size 548640 diff --git a/knowledgeawarebayesiandeeptopicmodel/fa18d8e8-ec9a-429f-9aeb-87a408cc00d6_content_list.json b/knowledgeawarebayesiandeeptopicmodel/fa18d8e8-ec9a-429f-9aeb-87a408cc00d6_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..e6295ee9f4021035a050edb6f89fc6e5f8cfa1d3 --- /dev/null +++ b/knowledgeawarebayesiandeeptopicmodel/fa18d8e8-ec9a-429f-9aeb-87a408cc00d6_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3018e19816ba68f7392cecda401cc5a0e0b4d678136f00a68054ac9d470d1bcd +size 76606 diff --git a/knowledgeawarebayesiandeeptopicmodel/fa18d8e8-ec9a-429f-9aeb-87a408cc00d6_model.json b/knowledgeawarebayesiandeeptopicmodel/fa18d8e8-ec9a-429f-9aeb-87a408cc00d6_model.json new file mode 100644 index 0000000000000000000000000000000000000000..a630b81430be7c8a33781ee000f5c3b069790a44 --- /dev/null +++ b/knowledgeawarebayesiandeeptopicmodel/fa18d8e8-ec9a-429f-9aeb-87a408cc00d6_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:62ac1736ade2368483ff4275f464e484094f334965ab4f52fedd18970ee5ef69 +size 95066 diff --git a/knowledgeawarebayesiandeeptopicmodel/fa18d8e8-ec9a-429f-9aeb-87a408cc00d6_origin.pdf b/knowledgeawarebayesiandeeptopicmodel/fa18d8e8-ec9a-429f-9aeb-87a408cc00d6_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..80d6c659cf30fb72d8ba7e45b3f245ac63356d78 --- /dev/null +++ b/knowledgeawarebayesiandeeptopicmodel/fa18d8e8-ec9a-429f-9aeb-87a408cc00d6_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8bac68ae46228fcf5a951d68747314248f511f5d60e6e3c04f00ede52b7ae4f0 +size 880049 diff --git a/knowledgeawarebayesiandeeptopicmodel/full.md b/knowledgeawarebayesiandeeptopicmodel/full.md new file mode 100644 index 0000000000000000000000000000000000000000..8199e0943e89af4272f332279c0dbbe47748fb75 --- /dev/null +++ b/knowledgeawarebayesiandeeptopicmodel/full.md @@ -0,0 +1,292 @@ +# Knowledge-Aware Bayesian Deep Topic Model + +Dongsheng Wang, Yishi Xu, Miaoge Li, Zhibin Duan, Chaojie Wang, Bo Chen* +National Laboratory of Radar Signal Processing +Xidian University, Xi'an, Shanxi 710071, China +{wds,xuyishi,limiaoge,zhibinduan}@stu.xidian.edu.cn +xd_silly@163.com, bchen@mail.xidian.edu.cn + +Mingyuan Zhou +McCombs School of Business +The University of Texas at Austin, Austin, TX 78712, USA +mingyuan.zhou@mccombs.utexas.edu + +# Abstract + +We propose a Bayesian generative model for incorporating prior domain knowledge into hierarchical topic modeling. Although embedded topic models (ETMs) and its variants have gained promising performance in text analysis, they mainly focus on mining word co-occurrence patterns, ignoring potentially easy-to-obtain prior topic hierarchies that could help enhance topic coherence. While several knowledge-based topic models have recently been proposed, they are either only applicable to shallow hierarchies or sensitive to the quality of the provided prior knowledge. To this end, we develop a novel deep ETM that jointly models the documents and the given prior knowledge by embedding the words and topics into the same space. Guided by the provided domain knowledge, the proposed model tends to discover topic hierarchies that are organized into interpretable taxonomies. Moreover, with a technique for adapting a given graph, our extended version allows the structure of the prior knowledge to be fine-tuned to match the target corpus. Extensive experiments show that our proposed model efficiently integrates the prior knowledge and improves both hierarchical topic discovery and document representation. + +# 1 Introduction + +Topic models (TMs) such as latent Dirichlet allocation (LDA) have enjoyed success in text mining and analysis in an unsupervised manner [4]. Typically, the goal of TMs is to infer per-document topic proportions and a set of latent topics from the target corpus using word co-occurrences within each document. The extracted topics are widely used in various machine learning tasks [20, 19, 33, 39]. However, the objective function of most TMs is to maximize the likelihood of the observed data, which causes an over-concentration on high-frequency words. Moreover, the infrequent words might be assigned to irrelevant topics due to the lack of side information. Those two drawbacks could lead to human-unfriendly topics that fail to make sense to end users in practice. This issue is further exacerbated in hierarchical cases where a large number of topics and their relevance need to be modeled [27, 12]. + +In many cases, users with prior domain knowledge are concerned with a specific topic structure, as shown in Fig. 1. Such a topic hierarchy provides semantic common sense among topics and words, which can guide high-quality topic discovery. Therefore, several researches have attempted to exploit + +![](images/4c89b339b4d4f668ef4ef1460ebec9e164ed86dc6f34786177a675b9ef8e895c.jpg) +Figure 1: Motivation of the proposed model. We use the pre-specified topic hierarchy as the knowledge graph (left), where topics (colored nodes) and words (gray nodes) are organized into a tree-like taxonomy, and each topic is associated with a brief definition. Given the topic tree and the target corpus, our proposed model aims to $I$ retrieve a set of coherent words for each topic node (right); 2) explore new topic hierarchies that are missed in the provided topic tree, e.g., the dashed boxes (right). + +various prior knowledge into topic modeling to improve topic representation. For example, word correlation-based topic models [1, 30] use must-links and cannot-links to improve the interpretability of learned topics. Word semantic methods [18, 11] allow users to predefine a set of seed words that could appear together in a certain topic to improve topic modeling. Furthermore, knowledge graph-based topic models [17, 34] combine LDA with entity vectors to inject multi-relational knowledge, achieving better semantic coherence. Although the above mentioned methods improve topic coherence in different ways, they only work with shallow topic models and ignore the relationships between topics. + +More recently, embedded topic models (ETMs) and their hierarchical variants [10, 38, 32, 12] employ distributed embedding vectors to encode semantic relationship, which have gained growing research interest due to their effectiveness and better flexibility. Viewing words and topics as embeddings in a shared latent space makes it possible for ETMs to integrate prior knowledge in the forms of pretrained word embeddings or semantic regularities [10, 27, 13]. The main idea behind those models is to constrain the topic embeddings under the predefined topic structure. Those models however are built on a strong assumption that the given topic hierarchy is well defined and matched to the target corpus, which is often unavailable in practice. Such mismatched structure might hinder the learning process and lead to sub-optimal results. + +To address the above shortcomings, in this paper, we first propose TopicKG, a knowledge graph-guided deep ETM that views topics and words as nodes in the predefined topic tree. As a Bayesian probabilistic model, TopicKG aims to model the document Bag-of-Word (BoW) vector and the given topic tree jointly by sharing the embedding vectors. Specifically, we first adopt a deep document generation model to discover multi-layer document representations and topics. To incorporate the human knowledge in the topic tree and guide the learning of topic hierarchy, a graph generative model is employed, which refines the node embeddings by exploring the belonging relations hidden in topic tree, resulting in more interpretable topics. Besides, to address the mismatch between the given topic tree and target corpus, we further extend TopicKG to TopicKGA, which adopts the graph Adaptive technique to explore the missing links in topic tree from the target corpora, achieving better document representation. The final revised topic tree is obtained by combining the prior structure of the given topic tree with the added structures learned from the current corpus. Thus the topic tree in our TopicKGA has the ability to reinforce itself constantly according to the given corpus. Finally, both the proposed models are based on variational autoencoders (VAEs) [21] and can be trained by maximizing the evidence lower bound (ELBO), enjoying promising flexibility and scalability. + +The main contributions of this paper can be summarized as follows: 1), A novel knowledge-aware deep ETM named TopicKG is proposed to incorporate prior domain knowledge into hierarchical topic modeling by accounting for the document and the given topic tree in a Bayesian generative framework. 2), To overcome the drawback of the mismatch issue between the prior structure of the provided topic tree and the current corpus, TopicKG is further extended to TopicKGA, which allows to revise the prior structure to better represent the current corpus. 3), Besides achieving promising performance on hierarchical topic discovery and document classification task, the proposed models give good flexibility and efficiency, providing a strong baseline for knowledge-based deep TMs. + +# 2 Related Work + +Embedded Topic Models: The recent developed ETM is a new topic-modeling framework in embedding space. Dieng et al. [10] first proposed ETM with the goal of marrying traditional topic models with word embeddings. In particular, ETM regards words and topics as continue embedding vectors and the topic's distribution over words is calculated using the inner product of the topic's embedding and each word's embedding, which provides a natural way to incorporate word meanings into TMs. In contrast to LDA, ETM employs the logistic-normal distribution to estimate the posterior of per-document topic proportion, making it easier to reparameterization in the inference step. All parameters in ETM are optimized by maximizing its evidence lower bound (ELBO). To explore hierarchical document topical representations, ETM is extended to SawETM [12] with the gamma belief network [42]. SawETM designs the sawtooth connection (SC) to capture the relations between topics at two adjacent layers in the embedding space, resulting in more efficient algorithm for hierarchical topic mining. Note that our proposed TopicKG is built upon SawETM, but different from SawETM that only considers the BoW representation, which may fail to discover high quality topic hierarchies when a large of topics and their relations need to be modeled [27, 13], TopicKG introduces a novel Bayesian generative model where both document and the pre-specific domain knowledge are considered to integrate human knowledge into NTMs, resulting in a new knowledge-aware topic modeling framework. + +Topic Models With Various Knowledge: Pre-trained language models such as BERT [9] and GPT [6] have been successful in various natural language processing tasks. Pre-trained on huge text, such models can serve as a powerful encoder that outputs contextual semantic embeddings. Behind this idea, combining a TM with BERT via knowledge distillation [16] treats BERT as the teacher model to improve the representation of topic models. CombinedTM [3] concatenates the Bag-of-Word (BoW) vector with the BERT contextual embedding as the final input of a TM, and performs a consistent increase in topic coherence. Despite their improvement, those BERT-based TMs focus on the document latent representation, they ignore the relationship between words and topics. Moreover they require a large amount of memory to load the pre-trained BERT. On the other hand, incorporating knowledge graph (e.g., WordNet [28]) to improve existing NTMs becomes an interesting direction recently. For example, [27] use the category tree (usually with simple and shallow structure) as the supervised information and preserve such relative hierarchical structure in the spherical embedding space. to explore user interested topic structure. [13] view words and topics as the Gaussian distributions and employ the asymmetrical Kullback-Leibler (KL) divergence to measure the directional similarity in the given topic hierarchy. However, computing such KL divergence for each pair is time-consuming that limits its application to large-scale knowledge. Moreover, those knowledge-based models ignore the mismatch problem between the given topic tree and the current corpus, leading to sub-optimal results in practice. + +# 3 The Proposed Model + +To incorporate human knowledge into deep TMs, we first propose TopicKG that generates the target corpus and the given topic tree in the Bayesian manner. We further extend TopicKG to its adaptive version TopicKGA that allows the topic structure to be refined according to the current corpus, resulting in a better document representation. Below we introduce the details of our proposed model. + +# 3.1 Problem Formulation + +Consider a corpus containing $J$ documents with a vocabulary of $V$ unique tokens. Each document is represented by a BoW vector $\pmb{x} \in R_{+}^{V}$ , where $x_{v}$ denotes the number of occurrences of the $v^{th}$ word. Unlike other TMs that are purely data-driven, TopicKG intends to inject the knowledge graph to improve topic quality. Specifically, we introduce a topic tree $\mathcal{T}$ as our prior knowledge, where each node $e_i \in \mathcal{T}$ denotes a word or a topic. For each topic node, there is a corresponding definition as shown in Fig. 1. Suppose there are $L + 1$ layers in the topic tree with the bottom word layer and $L$ topic layers, and there are $K_l$ nodes $\mathcal{T}_l: \{e_1^{(l)}, \dots, e_{K_l}^{(l)}\}$ at the $l$ -th layer, where $K_0 = V$ . Generally, for the $k$ -th topic node at the $l$ -th layer $e_k^{(l)}$ , we use $\mathcal{S}(e_k^{(l)})$ to denote the set of its child nodes, and use $\mathcal{C}(e_k^{(l)})$ to denote its key words extracted from the definition sentence. Mathematically, we adopt the binary matrix $\pmb{S}^{(l)} \in \{0,1\}^{K_{l-1} \times K_l}$ and $\pmb{C}^{(l)} \in \{0,1\}^{V \times K_l}$ , $l = 1, \dots, L$ , to denote + +the belonging relations between two adjacent layers and the links between topics and their concept words, respectively. Guided by this pre-specified topic tree, TopicKG expects to retrieve hierarchical topics from the target corpus that provide a clear taxonomy for the end users. + +# 3.2 Knowledge-Aware Bayesian Deep Topic Model + +Given the corpus $\mathcal{D}$ and topic tree $\mathcal{T}$ , we aim to discover hierarchical document representations and topic hierarchy by jointly modeling the BoW vector $\pmb{x}$ , $S^{(l)}$ and $C^{(l)}$ , $l = 1, \dots, L$ in a Bayesian framework. Specifically, we employ the gamma belief network (GBN) of [40] to model the count-value vector $\pmb{x}$ , and use the semantic similarity between two node embeddings to generate the topic tree $\mathcal{T}$ . The whole generative model with $L$ layers can be expressed as: + +$$ +\begin{array}{l} \boldsymbol {\theta} _ {j} ^ {(L)} \sim \operatorname {G a m} (\gamma , 1 / c _ {j} ^ {(L + 1)}), \quad \left\{\boldsymbol {\theta} _ {j} ^ {(l)} \sim \operatorname {G a m} (\Phi^ {(l + 1)} \boldsymbol {\theta} _ {j} ^ {(l + 1)}, 1 / c _ {j} ^ {(l + 1)}) \right\} _ {l = 1} ^ {L - 1}, \\ \boldsymbol {x} _ {j} \sim \operatorname {P o i s} (\boldsymbol {\Phi} ^ {(1)} \boldsymbol {\theta} _ {j} ^ {(1)}) \quad \left\{\boldsymbol {\Phi} _ {k} ^ {(l)} = \operatorname {S o f t m a x} (\boldsymbol {\Psi} _ {k} ^ {(l)}) \right\} _ {l = 1} ^ {L}, \quad \left\{\boldsymbol {\Psi} _ {k _ {1} k _ {2}} ^ {(l)} = \boldsymbol {e} _ {k _ {1}} ^ {(l - 1) ^ {T}} \boldsymbol {e} _ {k _ {2}} ^ {(l)} \right\} _ {k _ {1} = 1, k _ {2} = 1, l = 1} ^ {K _ {l - 1}, K _ {l}, L}, \\ \left. \left\{S _ {k _ {1}, k _ {2}} ^ {(l)} \sim \operatorname {B e r n} \left(\sigma \left(\boldsymbol {e} _ {k _ {1}} ^ {(l - 1) ^ {T}} \boldsymbol {W} \boldsymbol {e} _ {k _ {2}} ^ {(l)}\right)\right) \right\} _ {k _ {1} = 1, k _ {2} = 1, l = 1} ^ {K _ {l - 1}, K _ {l}, L}, \left\{C _ {v k} ^ {(l)} \sim \operatorname {B e r n} \left(\sigma \left(\boldsymbol {e} _ {v} ^ {(0) ^ {T}} \boldsymbol {e} _ {k} ^ {(l)}\right)\right) \right\} _ {v = 1, k = 1, l = 1} ^ {V, K _ {l}, L}, \right. \tag {1} \\ \end{array} +$$ + +where $\boldsymbol{x}_j$ is generated as in Poisson factor analysis [41], in which $\boldsymbol{x}_j$ is factorized as the product of the factor loading matrix (topics) $\Phi^{(1)} \in \mathbb{R}_{+}^{K_0 \times K_1}$ and the gamma distributed factor scores (topic proportions) $\theta_{j}^{(1)} \in \mathbb{R}_{+}^{K_{1}}$ under the Poisson likelihood; Then the GBN [42] is applied to explore multi-layer document representations by stacking hierarchical prior in the topic proportions $\theta_{j}$ . The topics at each layer $\Phi^{(l)}, l = 1, \dots, L$ is calculated by the semantic similarity (e.g., the inner product) between corresponding topic embeddings, followed by a Softmax layer to satisfy the probability simplex: $\sum_{k_{l-1}=1}^{K_{l-1}} \Phi_{k_{l-1}k}^{(l)} = 1$ . $e_k^{(l)} \in R^d$ is the embedding vector of $k$ -th topic at $l$ -th layer ( $k$ -th node at $l$ -th layer $e_k^l$ in $\mathcal{T}$ ), $d$ is the embedding dimension. $e_v^{(0)}$ is the embedding vector for $v$ -th word in vocabulary. $\sigma(\cdot)$ is the sigmoid function and $\mathrm{Bern}(\cdot)$ denotes the Bernoulli distribution that is employed to model the two edge types $S^{(l)}$ and $C^{(l)}$ . As suggested in [27] and [13], we use asymmetry to capture the directed relations in $S^{(l)}$ , while use symmetry to capture the semantic similarity between topics and their concept words. $W$ is a learnable parameter to guarantee the directed structure. Under the Bernoulli likelihood, our TopicKG has the ability to incorporate the topic hierarchical relations in $\mathcal{T}$ into topic modeling by sharing word and topic embeddings with $\Phi$ . In particular, for a node pair in $\mathcal{T}$ , the embedding semantics of the source and destination nodes need to be similar enough to determine whether there is an edge, which will guide the learning of $\Phi$ , resulting in more coherent topics and some appealing model properties as described below. + +The Flexibility of Human Knowledge Incorporation: As mentioned above, guided by the predefined topic tree, TopicKG models $\boldsymbol{x}$ , $S^{(l)}$ and $C^{(l)}$ , $l = 1, \dots L$ jointly, making it possible for the learned hierarchical topics that not only satisfy the interpretable taxonomy structure but also prevent incoherent issues with the help of side information. Besides, the incorporation of topic tree $\mathcal{T}$ is simple and flexible. Firstly, as shown in Eq. 1 and Sec. 4, the plug-and-play module of $S^{(l)}$ and $C^{(lk)}$ can be applied to most of ETMs without changing their model structures, which provides a convenient alternative for introducing side information to TMs. Secondly, the pre-defined $\mathcal{T}$ can be constructed in various ways to encode our beliefs about the graph structure, e.g., the knowledge graph, taxonomy, and hierarchical label tree [34, 17, 27]. + +The Relationship Between $\{\Phi^{(l)}\}_{l = 1}^{L}$ and $\{S^{(l)}\}_{l = 1}^{L}$ : The topic distribution matrix $\Phi^{(l)}$ and the symmetry matrix $S^{(l)}$ are related but play different roles. The sparse structure matrix $S^{(l)}$ is constructed from the topic tree which will be used to guide the learning of the hierarchy of topics, while the learned topics $\Phi^{(l)}$ contains more specific knowledge extracted from the text corpus, and can be viewed as the dense version of $S^{(l)}$ . In other words, the topics learned from TopicKG retain the semantic structure of $S^{(l)}$ and enriches itself by the current corpora. + +![](images/f7235bc21047bbd6d78377bec43af2affd4ca5c4fbf54864d9a0b21fe4421022.jpg) +Figure 2: Overview of the proposed framework. It jointly models the topic tree and document via the shared node embeddings $\pmb{E}^{(T)}$ . The proposed two models TopicKG (a) and TopicKGA (b) share the same document generative module (left part) while with different graph modelings. + +# 3.3 Inference Network of TopicKG + +The inference network of the proposed model is built around two main components: Weibull upward-downward variational encoder and the GCN-based topic aggregation module. The former aims to infer the topic proportions given the document, and the latter updates the node embedding by aggregating the neighbor information via the GCN layer. + +Weibull Upward-Downward Variational Encoder: To approximate the posterior of the topic proportions $\{\theta_j^{(l)}\}$ , like most of VAE-based methods, we define the variational distribution $q(\pmb{\theta}_j|\pmb{x}_j)$ which can be further factorized as [31]: + +$$ +q \left(\boldsymbol {\theta} _ {j} \mid \boldsymbol {x} _ {j}\right) = q \left(\boldsymbol {\theta} _ {j} ^ {(L)} \mid \boldsymbol {x} _ {j}\right) \prod_ {l = 1} ^ {L - 1} q \left(\boldsymbol {\theta} _ {j} ^ {(l)} \mid \boldsymbol {\theta} _ {j} ^ {(l + 1)}, \boldsymbol {x} _ {j}\right). +$$ + +In practice, it first obtains the latent feature by feeding the input $\boldsymbol{x}_j$ into a residual upward neural networks: $\boldsymbol{h}_j^{(l)} = \boldsymbol{h}_j^{(l-1)} + f_{\boldsymbol{W}_h^{(l)}}^{(l)}(\boldsymbol{h}_j^{(l-1)})$ , where $l = 1, \dots, L$ , $\boldsymbol{h}_j^{(0)} = \boldsymbol{x}_j$ , $f_{\boldsymbol{W}_h^{(l)}}^{(l)}(\cdot)$ is a two layer fully connected network parameterized by $\boldsymbol{W}_h^{(l)}$ . To complete the variational distribution, we adopt the Weibull downward stochastic path [37]: + +$$ +q \left(\boldsymbol {\theta} _ {j} ^ {(l)} \mid \Phi^ {(l + 1)}, \boldsymbol {h} _ {j} ^ {(l)}, \boldsymbol {\theta} _ {j} ^ {(l + 1)}\right) = \operatorname {W e i b u l l} \left(\boldsymbol {k} _ {j} ^ {(l)}, \boldsymbol {\lambda} _ {j} ^ {(l)}\right) +$$ + +$$ +\boldsymbol {k} _ {j} ^ {(l)} = \operatorname {S o f t p l u s} \left(f _ {k} ^ {(l)} \left(\boldsymbol {\Phi} ^ {(l + 1)} \boldsymbol {\theta} _ {j} ^ {(l + 1)} \oplus \hat {\boldsymbol {k}} _ {j} ^ {(l)}\right)\right), \quad \boldsymbol {\lambda} _ {j} ^ {(l)} = \operatorname {S o f t p l u s} \left(f _ {\lambda} ^ {(l)} \left(\boldsymbol {\Phi} ^ {(l + 1)} \boldsymbol {\theta} _ {j} ^ {(l + 1)} \oplus \hat {\boldsymbol {\lambda}} _ {j} ^ {(l)}\right)\right) \tag {2} +$$ + +$$ +\hat {\boldsymbol {k}} _ {j} ^ {(l)} = \operatorname {R e l u} \left(\boldsymbol {W} _ {k} ^ {(l)} \boldsymbol {h} _ {j} + \boldsymbol {b} _ {k} ^ {(l)}\right), \quad \hat {\boldsymbol {\lambda}} _ {j} ^ {(l)} = \operatorname {R e l u} \left(\boldsymbol {W} _ {k} ^ {(l)} \boldsymbol {h} _ {j} + \boldsymbol {b} _ {k} ^ {(l)}\right), +$$ + +where $\oplus$ denotes the concatenation at topic dimension, and we use the Softplus to make sure the positive Weibull shape and scale parameters. $f$ is a single layer fully connected network, correspondingly. The Weibull distribution is chosen mainly because it is reparameterizable and the KL divergence from the gamma to Weibull distributions has an analytic expression [37, 15]. + +GCN-Based Topic Aggregation: Attracted by the excellent ability of graph neural network (GCN) [22, 23] in propagating graph structure information, and the predefined topic tree can be viewed as a directed graph. We thus construct a deterministic aggregating module for node embeddings with GCN: + +$$ +\boldsymbol {E} ^ {(t)} = \operatorname {G C N} \left(\tilde {\boldsymbol {A}}, \boldsymbol {E} ^ {(t - 1)}\right), t = 1, \dots , T \tag {3} +$$ + +where $T$ is the number of GCN layer, $\pmb{E}^{(0)}\in R^{d\times N}$ is the node embedding matrix, and $N = \sum_{l = 0}^{L}K_{l}$ . $\tilde{\pmb{A}} = \pmb{D}^{-\frac{1}{2}}\pmb {A}\pmb{D}^{-\frac{1}{2}}$ is the normalized adjacent matrix with degree matrix $\pmb{D}$ , e.g., $\pmb{D}_{ii} = \sum_{j = 1}^{N}\pmb{A}_{ij}$ , $\pmb{A}\in \{0,1\}^{N\times N}$ is the adjacent matrix of the topic tree $\mathcal{T}$ . Unlike previous ETMs that view embeddings as independent learnable parameters, the GCN module in TopicKG updates the node embeddings by considering their child-level topics and related words, resulting in more meaningful topic embeddings. We calculate $\{\Phi^{(l)}\}_{l = 1}^{L}$ via the updated node embeddings: + +$$ +\boldsymbol {\Phi} _ {k} ^ {(l)} = \operatorname {S o f t m a x} \left(\boldsymbol {e} ^ {(T) ^ {(l - 1) ^ {T}}} \boldsymbol {e} _ {k} ^ {(T) ^ {(l)}}\right) \tag {4} +$$ + +# 3.4 TopicKG With Adaptive Structure + +One of the main assumptions in the previous section is that the pre-defined topic tree is helpful for the current corpus and the corresponding edges are highly reliable. However, this is generally unrealistic in practical applications, as $\mathcal{T}$ may be (i) noisy, (ii) built on an ad hoc basis, (iii) not closely related to the topic discovering task [14, 8]. Consequently, we further propose TopicKGA that overcomes the above mismatching issue and revises the structure of the given topic tree based on the corpus at hand. + +In detail, TopicKGA first randomly initializes a learnable node embedding dictionaries $\mathbf{E}_A \in R^{d \times N}$ for all nodes in $\mathcal{T}$ . Then an adaptive graph $\mathbf{A}^{\mathrm{ada}}$ is generated based on $\mathbf{E}_A$ using the certain kernel function $k: R^d \times R^d \longrightarrow R$ : + +$$ +\tilde {\boldsymbol {A}} ^ {\mathrm {a d a}} = \operatorname {S o f t m a x} (k (\boldsymbol {E} _ {A}, \boldsymbol {E} _ {A})) \tag {5} +$$ + +Here, we choose the consine similarity to define our kernel function: $k(\pmb{E}_A, \pmb{E}_A) = \frac{\pmb{E}_A \pmb{E}_A^T}{||\pmb{E}_A|| || \pmb{E}_A||}$ , and Softmax function is used to normalize the adaptive matrix. Note that, instead of generating $A^{\mathrm{ada}}$ , we directly generate its normalized version to avoid unnecessary calculations [2]. During training, $\pmb{E}_A$ will be updated automatically to learn the hidden dependencies which are ignored by $\pmb{A}$ . Following [36], the final revised adjacency matrix is formed as (here we still use $\tilde{\pmb{A}}$ to denote the revised graph for convenience): + +$$ +\tilde {\boldsymbol {A}} = \tilde {\boldsymbol {A}} + \tilde {\boldsymbol {A}} ^ {\mathrm {a d a}} \tag {6} +$$ + +which will enhance the GCN in Eq. 3 by replacing the adjacency matrix with the revised one. + +# 4 Training + +As a deep ETM, TopicKG intends to learn the latent document-topic distribution and the deterministic hierarchical topic embeddings. Like other ETMs, the posterior of the topic proportions and topic embeddings are intractable to compute. We thus derive an efficient algorithm for approximating the posterior with amortized variational inference [5], which makes the proposed model flexible for downstream task. The resulting algorithm can either use pre-trained word embeddings, or train them from scratch. The ELBO of the proposed model can be expressed as: + +$$ +\begin{array}{l} \mathcal {L} = \sum_ {j = 1} ^ {J} \mathrm {E} _ {q (\boldsymbol {\theta} | \boldsymbol {x} _ {j})} [ \log p (\boldsymbol {x} _ {j} | \boldsymbol {\Phi} ^ {(1)}, \boldsymbol {\theta} _ {j} ^ {(1)}) ] + \beta \sum_ {l = 1} ^ {L} \sum_ {k _ {2} = 1} ^ {K _ {l}} (\sum_ {k _ {1} = 1} ^ {K _ {l - 1}} \log p (S _ {k _ {1} k _ {2}} ^ {(l)}) | \boldsymbol {e} _ {k _ {1}} ^ {(l - 1)}, \boldsymbol {e} _ {k _ {2}} ^ {(l)}) \\ + \sum_ {v = 1} ^ {V} \log p \left(C _ {v k _ {2}} ^ {(l)} \left| \boldsymbol {e} _ {v} ^ {(0)}, \boldsymbol {e} _ {k _ {2}} ^ {(l)}\right)\right) - \sum_ {j = 1} ^ {J} \sum_ {l = 1} ^ {L} \mathrm {K L} \left(q \left(\boldsymbol {\theta} _ {j} ^ {(l)}\right) \mid \mid p \left(\boldsymbol {\theta} _ {j} ^ {(l)} \mid \boldsymbol {\Phi} ^ {(l + 1)}, \boldsymbol {\theta} _ {j} ^ {(l + 1)}\right)\right)) \\ \end{array} +$$ + +It consists of three main parts: the expected log-likelihood of $\pmb{x}$ (first term), the concept structure log-likelihood (the two middle terms), and the KL divergence from prior $p(\pmb{\theta}_j^{(l)})$ to $q(\pmb{\theta}_j^{(l)})$ . The graph weight $\beta$ denotes the belief about the predefined topic tree. Notably, the two middle terms distinguish the proposed models from previous deep ETMs. On the one hand, it acts as a regularization that constrains the embedding vectors to conform to the provided prior structure, and on the other hand, it provides an alternative for ETM to introduce side information to improve its interpretability. + +Annealed Training for TopicKGA: In TopicKGA, the structure of the revised graph changes during the training. To incorporate the new edges that are inferred from the target corpus, we develop an + +annealed training algorithm for TopicKGA. Specifically, we update $S^{(l)}$ and $C^{(l)}$ in Eq. 7 every $M$ iterations: + +$$ +S _ {k _ {1} k _ {2}} ^ {(l)} = \left\{ \begin{array}{l l} 1, & \text {i f} \tilde {A} _ {k _ {1} k _ {2}} ^ {(l)} > s; \\ 0, & \text {e l s e} \end{array} \quad C _ {v k _ {2}} ^ {(l)} = \left\{ \begin{array}{l l} 1, & \text {i f} \tilde {A} _ {v k _ {2}} ^ {(l)} > s; \\ 0, & \text {e l s e} \end{array} \right. \right. \tag {8} +$$ + +where $s$ is the threshold, and $\tilde{\pmb{A}}^{(l)}$ is the corresponding sub-block in $\tilde{\pmb{A}}$ . As $\pmb{E}_{A}$ becomes stable, the structure of the graph will converge to a good blueprint that balances the prior graph and the current corpus. We summarize all training algorithm in Appendix. + +# 5 Experiment + +In this section, we conduct extensive experiments on several benchmark text datasets to evaluate the performance of the proposed models against other knowledge-based TMs, in terms of topic interpretability and document representations. The code is available at https://github.com/wds2014/TopicKG. + +# 5.1 Corpora + +Our experiments are conducted on four widely used benchmark text datasets, varying in scale. The datasets include 20 Newsgroups (20NG) [24], Reuters extracted from the Reuters-21578 dataset, R8, and Reuters Corpus Volume 2 (RCV2) [25]. R8 is a subset of Reuters that collected from 8 different classes. For the multi-label RCV2 dataset, we follow previous works [29] in which documents with a single label at the second level topics are left, resulting in 0.1M documents totally. Both R8 and RCV2 are already pre-processed. For other two datasets, we tokenize and clean text by excluding standard stop words and low-frequency words appearing less than 20 times [35]. The statistics of the preprocessed datasets are summarized in Appendix. + +# 5.2Baselines + +To demonstrate the effectiveness of incorporating human knowledge into deep TMs, we consider several baselines for a fair comparison, including representative ETMs and recent knowledge-based topic models, described as follows: 1), ETM [10], the first neural embedded topic model that assumes topics and words live in the same embedding space. The topic distributions in ETM are calculated by the inner product of the word embedding matrix and the topic embedding. 2), CombinedTM [3], a BERT-based neural topic model that uses the pre-trained BERT as its contextual encoder. We use it as our BERT baseline. 3), SawETM [12], a hierarchical ETM that employs the Poisson and gamma distributions to model the BoW vector and the latent representation, respectively. 4), JoSH [27], a knowledge-based hierarchical topic mining method that uses category hierarchy as the side information and employs the EM algorithm to learn the spherical tree and text embedding. 5), TopicNet [13], a semantic graph guided topic model that views the words and topics as the Gaussian distributions and uses the KL divergence to regularize the structure of the pre-defined tree. For all baselines, we employ their official codes and default settings obtained from their release repositories. + +# 5.3 External Knowledge + +Since the learning of TopicKG involves a pre-defined topic tree, some generic knowledge graphs such as WordNet [28] provide a convenient way to bring in external knowledge. WordNet is a large lexical database that groups semantically similar words into synonym sets, these sets are further linked by the hyponymy relation. For example, in WordNet the category furniture includes bed, which in turn includes bunkbed. With these relations, the topic structure can be easily defined according to certain heuristic rules. Specifically, for each dataset we first get the word intersection of the vocabulary and WordNet, the chosen words are then considered as leaf nodes of the topic hierarchy. Afterwards, each leaf node can continuously find its ancestor nodes based on hyponymy relations and finally all leaf nodes converge to the same root node, resulting in an adaptive topic structure. + +# 5.4 Settings + +For all experiments, we set the embedding dimension as $d = 50$ , the knowledge confidence hyperparameter as $\beta = 50.0$ , the threshold as $s = 0.4$ . Empirically, we find that the above settings work + +![](images/08977f36b390ec7f5eceebd34f4e4de217eaefa10ca16576a0b2dcd4baf28427.jpg) +Figure 3: Topic coherence (TC, top row), topic diversity (TD, middle row), and word embedding coherence (WE, bottom row) results for various deep topic models on four datasets. In each subfigure, the horizontal axis indicates the layer index of the topics. For all metrics, higher is better. + +well for all datasets, we refer readers to the appendix for more detailed analysis. We initialize the node embedding from the Gaussian distribution $\mathcal{N}(0,0.02)$ . We set the batch size as 200 and use the AdamW [26] optimizer with learning rate 0.01. We generate a 7-layer topic hierarchy for each dataset with the method described in Sec. 5.3. From the top to bottom, the number of topics at each layer are: 20NG: [1,2,11,66,185,277,270]; R8: [1,2,11,77,287,501,547]; RCV2: [1,2,11,68,263,469,562]; Reuters: [1,2,11,78,300,526,584]. For the single-layer methods (ETM and CombinedTM), we set the number of topics as the same of the first layer of deep models. For all methods, we run the algorithms in comparison five times by modifying only the random seeds and calculate the mean and standard deviation. All experiments are performed on an Nvidia RTX 3090-Ti GPU and our proposed models are implemented with PyTorch. + +Table 1: Micro F1 and Macro F1 score of different models on three datasets. The digits in brackets indicate the number of layers. Micro F1 /Macro F1. + +
Model20NGR8RCV2
ETM50.25 ±0.42 / 47.44 ±0.2188.10 ±0.45 / 59.67 ±0.2468.63 ±0.15 / 24.40 ±0.11
CombinedTM56.43 ±0.14 / 54.95 ±0.1193.69 ±0.09 /84.14 ±0.1084.85 ±0.11 / 51.47 ±0.21
Sawtooth(3)52.41 ±0.08 / 51.53 ±0.1090.04 ±0.15 / 78.84 ±0.2182.54 ±0.11 / 49.25 ±0.10
TopicNet(3)55.16 ±0.22 / 54.78 ±0.3489.95 ±0.17 / 64.15 ±0.1684.15 ±0.25 / 50.37 ±0.22
TopicKG(3)55.73 ±0.15 / 54.48 ±0.0893.6 ±0.05 / 83.32 ±0.0784.75 ±0.16 / 50.51 ±0.41
TopicKGA(3)58.63 ±0.15 / 57.90 ±0.1093.70 ±0.52 / 84.50 ±0.1185.34 ±0.14 / 52.35 ±1.10
ETM47.79 ±0.12 / 44.19 ±1.0186.54 ±0.84 / 59.88 ±1.1163.77 ±0.14 / 21.44 ±1.04
CombinedTM58.16 ±0.15 / 58.10 ±0.1093.50 ±0.13 /84.84 pm0.1182.91 ±0.11 / 48.17 ±0.05
Sawtooth(7)53.71 ±0.11 / 53.02 ±0.4792.86 ±0.07 / 82.54 ±0.4182.46 ±0.15 / 49.34 ±0.34
TopicNet(7)56.13 ±0.19 / 55.41 ±0.3990.65 ±0.00 / 66.57 ±0.0082.81 ±0.00 / 49.44 ±0.00
TopicKG(7)56.32 ±0.12 / 57.35 ±0.0494.04 ±0.12 / 85.04 ±0.1182.48 ±0.11 / 48.24 ±0.09
TopicKGA(7)60.04 ±0.34 / 59.12 ±0.1394.10 ±0.08 / 85.50 ±0.1083.08 ±0.23 / 50.50 ±0.08
+ +# 5.5 Topic Interpretability + +Generally, topic models are evaluated based on perplexity. However, perplexity on the held-out test is not an appropriate measure of the topic quality and sometimes can even be contrary to human judgements [7, 34]. To this end, we instead adopt three common metrics, including Topic coherence (TC), Topic diversity (TD) and word embedding topic coherence (WE), to evaluate the learned topics from various aspects [10, 3]. TC measures the average Normalized Pointwise Mutual Information + +(NPMI) over the top 10 words of each topic, and a higher score indicates more interpretable topics. TD denotes the percentage of unique words in the top 25 words of the selected topics. WE, as its name implies, provides an embedded measure of how similar the words in a topic are. WE is calculated by the average pairwise cosine similarity of the word embeddings of the top-10 words in a topic. We report the topic quality results at the first five layer in Fig. $3^{2}$ . We here focus on topic hierarchy and ignore the single layer methods. We find that: 1), Knowledge-based methods including JoSH, CombinedTM, TopicNet and our proposed models are generally better than other likelihood-based ETMs, which illustrates the benefit of incorporating side information; 2), Our proposed TopicKG and TopicKGA achieve higher performance than other knowledge-based models in most cases, especially on TC and WE tasks, which means our proposed model prefer to mine more coherent topics while achieving comparable TD. We attribute this to the joint topic tree likelihood that provides an efficient alternative to integrate human knowledge into ETMs. 3), Compared to TopicKG, its adaptive version TopicKGA discovers better topics at higher layers. It is not surprise that TopicKGA gives greater robustness and flexibility by refining the topic structure according to the current corpus. + +![](images/ca7411821866dffb34085eba9fafcd4b5d1505fda71b379b32e33efa331aa672.jpg) +Figure 4: The learned hierarchical topic structure from TopicKG (a) and TopicKGA(b) on 20NG. Each topic box contains its concept name and the corresponding keywords. Topics in dashed box (free topics) are newly added by TopicKGA from the target corpus. The thickness of the arrow represents the relation weight and different colors denote different layers. + +# 5.6 Document Classification + +Besides the topic quality evaluation, we also use document classification to compare the extrinsic predictive performance. In detail, we collect the inferred topic proportions, $e.g., \theta^{(1)}$ , and then apply logistic regression to predict the document label. We report the Micro F1 and Macro F1 score on 20NG, R8 and RCV2 datasets in Table. 1. Overall, the proposed models outperform the baselines on all corpora, which confirms the effectiveness of our innovation of combining human knowledge and ETMs in improving document latent representations. Moreover, with the revised topic structure fine-tuned to the current corpus, TopicKGA surpasses other knowledge graph fixation methods with significant gaps. This conclusion is consistent with one of our motivations that the predefined concept tree may not match the target corpus, leading to suboptimal document representations. + +# 5.7 Qualitative Analysis + +We visualize the learned topic hierarchies of TopicKG and TopicKGA on 20NG in Fig. 4(a-b), respectively. Each topic box consists of the pre-specified concept name on the top bar and its keywords listed in the bottom content. We can observe that 1), The mined keywords are highly relevant to the corresponding topics, providing a clean description of their concepts. 2), Guided by human knowledge, the connections between topics at two adjacent layers are highly interpretable, resulting in human-friendly topic taxonomies. 3), More interestingly, to further verify the adaptive ability of our proposed TopicKG, we manually added several free topics (dashed boxes in Fig. 4(b)) to each layer of the given topic tree, which can be viewed as the missing topics in the predefined + +knowledge and need to be learned from the target corpus. We find that our TopicKGA indeed has the ability to capture the missing concepts, and revise the prior graph to match the current corpus. + +# 5.8 Time Efficiency + +To demonstrate the time efficiency of incorporating human knowledge into TMs, we run TopicKG, TopicKGA and TopicNet (as they are implemented in PyTorch, JoSH is in C) on RCV2 and 20NG dataset with a 7-layer topic tree. Fig. 5 shows the Negative log-likelihood of documents $\mathbf{x}$ , which shows that the proposed models not only have faster learning speed than TopicNet, but also achieve better reconstruction performance on both small and large corpus. This result illustrates the efficiency of the introduced graph likelihood which is important in real-time applications. + +# 6 Conclusion + +We develop an efficient Bayesian probabilistic model that integrates pre-specified domain knowledge into hierarchical ETMs. The core idea is the joint document and topic tree modeling with the shared word and topic embeddings. Besides, with the graph adaptive technique, TopicKGA has the ability to revise the given prior structure according to the target corpus, enjoying robustness and flexibility in practice. Extensive experiments show that the proposed models outperform competitive methods in term of both + +topic quality and document classification task. Moreover, thanks to the efficient knowledge incorporation algorithm, our proposed models achieve faster learning speed than other knowledge-base models. + +![](images/6abf326232c42400b9175b0c31ebbae89a96192b4a15c51e7c92ee414acc84f0.jpg) + +![](images/4ee052daae1aa314eb52419ddf4ac4bcdf5225de2c476d82016276ce9fcc21ea.jpg) +Figure 5: Negative log-likelihood (NLL) curves of various methods on RCV2 and 20NG datasets. + +# Acknowledgements + +This work was supported in part by the National Natural Science Foundation of China under Grant U21B2006; in part by Shaanxi Youth Innovation Team Project; in part by the 111 Project under Grant B18039; in part by the Fundamental Research Funds for the Central Universities QTZX22160. + +# References + +[1] D. Andrzejewski, X. Zhu, and M. Craven. Incorporating domain knowledge into topic modeling via dirichlet forest priors. In Proceedings of the 26th annual international conference on machine learning, pages 25-32, 2009. +[2] L. Bai, L. Yao, C. Li, X. Wang, and C. Wang. Adaptive graph convolutional recurrent network for traffic forecasting. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020. +[3] F. Bianchi, S. Terragni, and D. Hovy. Pre-training is a hot topic: Contextualized document embeddings improve topic coherence. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing, ACL/IJCNLP 2021, (Volume 2: Short Papers), Virtual Event, August 1-6, 2021, pages 759-766. +[4] D. M. Blei, A. Y. Ng, and M. I. Jordan. Latent dirichlet allocation. the Journal of machine Learning research, 3:993-1022, 2003. +[5] D. M. Blei, A. Kucukelbir, and J. D. McAuliffe. Variational inference: A review for statisticians. Journal of the American statistical Association, 112(518):859-877, 2017. + +[6] T. B. Brown, B. Mann, N. Ryder, M. Subbiah, J. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry, A. Askell, S. Agarwal, A. Herbert-Voss, G. Krueger, T. Henighan, R. Child, A. Ramesh, D. M. Ziegler, J. Wu, C. Winter, C. Hesse, M. Chen, E. Sigler, M. Litwin, S. Gray, B. Chess, J. Clark, C. Berner, S. McCandlish, A. Radford, I. Sutskever, and D. Amodei. Language models are few-shot learners. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual. +[7] J. Chang, S. Gerrish, C. Wang, J. L. Boyd-Graber, and D. M. Blei. Reading tea leaves: How humans interpret topic models. In Advances in neural information processing systems, pages 288–296, 2009. +[8] Y. Chen, L. Wu, and M. Zaki. Iterative deep graph learning for graph neural networks: Better and robust node embeddings. Advances in Neural Information Processing Systems, 33, 2020. +[9] J. Devlin, M. Chang, K. Lee, and K. Toutanova. BERT: pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL-HLT 2019, Minneapolis, MN, USA, June 2-7, 2019, Volume 1 (Long and Short Papers), pages 4171-4186. +[10] A. B. Dieng, F. J. Ruiz, and D. M. Blei. Topic modeling in embedding spaces. Transactions of the Association for Computational Linguistics, 8:439-453, 2020. +[11] F. Doshi-Velez, B. Wallace, and R. Adams. Graph-sparse lda: a topic model with structured sparsity. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 29, 2015. +[12] Z. Duan, D. Wang, B. Chen, C. Wang, W. Chen, Y. Li, J. Ren, and M. Zhou. Sawtooth factorial topic embeddings guided gamma belief network. In International Conference on Machine Learning, pages 2903-2913. PMLR, 2021. +[13] Z. Duan, Y. Xu, B. Chen, dongsheng wang, C. Wang, and M. Zhou. Topicnet: Semantic graph-guided topic discovery. In Advances in Neural Information Processing Systems, 2021. +[14] P. Elinas, E. V. Bonilla, and L. C. Tiao. Variational inference for graph convolutional networks in the absence of graph data and adversarial settings. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020. +[15] X. Fan, S. Zhang, B. Chen, and M. Zhou. Bayesian attention modules. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual. +[16] A. M. Hoyle, P. Goel, and P. Resnik. Improving neural topic models using knowledge distillation. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, EMNLP 2020, Online, November 16-20, 2020, pages 1752-1771. +[17] Z. Hu, G. Luo, M. Sachan, E. P. Xing, and Z. Nie. Grounding topic models with knowledge bases. In *IJCAI*, volume 16, pages 1578–1584, 2016. +[18] J. Jagarlamudi, H. Daume III, and R. Udupa. Incorporating lexical priors into topic models. In Proceedings of the 13th Conference of the European Chapter of the Association for Computational Linguistics, pages 204-213, 2012. +[19] M. Jin, X. Luo, H. Zhu, and H. H. Zhuo. Combining deep learning and topic modeling for review understanding in context-aware recommendation. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 1605–1614, 2018. +[20] S. S. Kataria, K. S. Kumar, R. R. Rastogi, P. Sen, and S. H. Sengamedu. Entity disambiguation with hierarchical topic models. In Proceedings of the 17th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 1037-1045, 2011. + +[21] D. P. Kingma and M. Welling. Auto-encoding variational bayes. In 2nd International Conference on Learning Representations, ICLR 2014, Banff, AB, Canada, April 14-16, 2014, Conference Track Proceedings. +[22] T. N. Kipf and M. Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016. +[23] T. N. Kipf and M. Welling. Variational graph auto-encoders. arXiv preprint arXiv:1611.07308, 2016. +[24] K. Lang. Newsweeder: Learning to filter netnews. In Machine Learning Proceedings 1995, pages 331-339. Elsevier, 1995. +[25] D. D. Lewis, Y. Yang, T. G. Rose, and F. Li. Rcv1: A new benchmark collection for text categorization research. Journal of Machine Learning Research, 5:361-397, 2004. +[26] I. Loshchilov and F. Hutter. Decoupled weight decay regularization. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net. +[27] Y. Meng, Y. Zhang, J. Huang, Y. Zhang, C. Zhang, and J. Han. Hierarchical topic mining via joint spherical tree and text embedding. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, 2020. +[28] G. A. Miller. Wordnet: a lexical database for english. Communications of the ACM, 38(11): 39-41, 1995. +[29] T. Miyato, A. M. Dai, and I. J. Goodfellow. Adversarial training methods for semi-supervised text classification. In 5th International Conference on Learning Representations, ICLR 2017, Toulouse, France, April 24-26, 2017, Conference Track Proceedings. +[30] D. Newman, E. V. Bonilla, and W. Buntine. Improving topic coherence with regularized topic models. Advances in neural information processing systems, 24:496-504, 2011. +[31] A. Vahdat and J. Kautz. NVAE: A deep hierarchical variational autoencoder. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual. +[32] D. Wang, D. Guo, H. Zhao, H. Zheng, K. Tanwisuth, B. Chen, and M. Zhou. Representing mixtures of word embeddings with mixtures of topic embeddings. In The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022. +[33] H. Xu, W. Wang, W. Liu, and L. Carin. Distilled wasserstein learning for word embedding and topic modeling. In Advances in Neural Information Processing Systems 31: Annual Conference on Neural Information Processing Systems 2018, NeurIPS 2018, December 3-8, 2018, Montreal, Canada, pages 1723-1732. +[34] L. Yao, Y. Zhang, B. Wei, Z. Jin, R. Zhang, Y. Zhang, and Q. Chen. Incorporating knowledge graph embeddings into topic modeling. In Thirty-first AAAI conference on artificial intelligence, 2017. +[35] L. Yao, C. Mao, and Y. Luo. Graph convolutional networks for text classification. In Proceedings of the AAAI conference on artificial intelligence, volume 33, pages 7370-7377, 2019. +[36] D. Yu, R. Zhang, Z. Jiang, Y. Wu, and Y. Yang. Graph-revised convolutional network. In Machine Learning and Knowledge Discovery in Databases - European Conference, ECML PKDD 2020, Ghent, Belgium, September 14-18, 2020, Proceedings, Part III, volume 12459 of Lecture Notes in Computer Science, pages 378-393. +[37] H. Zhang, B. Chen, D. Guo, and M. Zhou. WHAI: weibull hybrid autoencoding inference for deep topic modeling. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings. OpenReview.net. + +[38] H. Zhao, D. Phung, V. Huynh, T. Le, and W. L. Buntine. Neural topic model via optimal transport. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. +[39] H. Zhao, L. Du, W. Buntine, and M. Zhou. Dirichlet belief networks for topic structure learning. Advances in neural information processing systems, 31, 2018. +[40] M. Zhou, Y. Cong, and B. Chen. The poisson gamma belief network. In Advances in Neural Information Processing Systems 28: Annual Conference on Neural Information Processing Systems 2015, December 7-12, 2015, Montreal, Quebec, Canada, pages 3043-3051. +[41] M. Zhou, L. Hannah, D. Dunson, and L. Carin. Beta-negative binomial process and poisson factor analysis. In Artificial Intelligence and Statistics, pages 1462-1471. PMLR, 2012. +[42] M. Zhou, Y. Cong, and B. Chen. The poisson gamma belief network. Advances in Neural Information Processing Systems, 28, 2015. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] Please refer to the appendix +(c) Did you discuss any potential negative societal impacts of your work? [Yes] Please refer to the appendix +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] +(b) Did you include complete proofs of all theoretical results? [N/A] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] The code and data are included in the supplementary material. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] +(b) Did you mention the license of the assets? [N/A] +(c) Did you include any new assets either in the supplemental material or as a URL? [No] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/knowledgeawarebayesiandeeptopicmodel/images.zip b/knowledgeawarebayesiandeeptopicmodel/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..2cbf833ea4534b53407c894ae856f371a70dc8ba --- /dev/null +++ b/knowledgeawarebayesiandeeptopicmodel/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:73bd15ca49589e2b22e4712590a7d1a3a9591f634411477e71159b46a27daabd +size 539426 diff --git a/knowledgeawarebayesiandeeptopicmodel/layout.json b/knowledgeawarebayesiandeeptopicmodel/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..2635e4bd649a129d69f85085404cbe0a733bce42 --- /dev/null +++ b/knowledgeawarebayesiandeeptopicmodel/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8187800f1502978cc0eeb44fd7f1542d529bdf3a7a21b63549731903a6d2bfd1 +size 389859 diff --git a/knowledgedistillationbadmodelscanbegoodrolemodels/1c68b6f8-af01-40ec-a43d-d99630e089ca_content_list.json b/knowledgedistillationbadmodelscanbegoodrolemodels/1c68b6f8-af01-40ec-a43d-d99630e089ca_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..f0a66e863b25e6483ec5eb966389a994f0765821 --- /dev/null +++ b/knowledgedistillationbadmodelscanbegoodrolemodels/1c68b6f8-af01-40ec-a43d-d99630e089ca_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:91d890229ee795899ce59db3594ea8203c3ce01688a75d6a393c0fc92df665d2 +size 79630 diff --git a/knowledgedistillationbadmodelscanbegoodrolemodels/1c68b6f8-af01-40ec-a43d-d99630e089ca_model.json b/knowledgedistillationbadmodelscanbegoodrolemodels/1c68b6f8-af01-40ec-a43d-d99630e089ca_model.json new file mode 100644 index 0000000000000000000000000000000000000000..3e9eaff1e100fd9af2186ee23a77201a9dd275c7 --- /dev/null +++ b/knowledgedistillationbadmodelscanbegoodrolemodels/1c68b6f8-af01-40ec-a43d-d99630e089ca_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c6f9dfc21ae871a0e20d0903e1668bf993e4890127fd6ef41cf0b64f74ce1bf1 +size 94822 diff --git a/knowledgedistillationbadmodelscanbegoodrolemodels/1c68b6f8-af01-40ec-a43d-d99630e089ca_origin.pdf b/knowledgedistillationbadmodelscanbegoodrolemodels/1c68b6f8-af01-40ec-a43d-d99630e089ca_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..fc63c3f4fb060395de5e0757c42a2e532092049a --- /dev/null +++ b/knowledgedistillationbadmodelscanbegoodrolemodels/1c68b6f8-af01-40ec-a43d-d99630e089ca_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6eaf9a6ce20a13398063145afaf97c8b4ccb6eb79f1b416b6144794875d6d587 +size 674354 diff --git a/knowledgedistillationbadmodelscanbegoodrolemodels/full.md b/knowledgedistillationbadmodelscanbegoodrolemodels/full.md new file mode 100644 index 0000000000000000000000000000000000000000..7d0823fc3e69a8b46f606b2a2944e0811eff5950 --- /dev/null +++ b/knowledgedistillationbadmodelscanbegoodrolemodels/full.md @@ -0,0 +1,294 @@ +# Knowledge Distillation: Bad Models Can Be Good Role Models + +Gal Kaplun + +Harvard University & Mobileye galkaplun@g.harvard.edu + +Eran Malach + +Hebrew University & Mobileyeeran.malach@mail.huji.ac.il + +Preetum Nakkiran + +University of California San Diego +preetum@ucsd.edu + +Shai Shalev-Shwartz + +Hebrew University & Mobileye shais@cs.huji.ac.il + +# Abstract + +Large neural networks trained in the overparameterized regime are able to fit noise to zero train error. Recent work of Nakkiran and Bansal [20] has empirically observed that such networks behave as "conditional samplers" from the noisy distribution. That is, they replicate the noise in the train data to unseen examples. We give a theoretical framework for studying this conditional sampling behavior in the context of learning theory. We relate the notion of such samplers to knowledge distillation, where a student network imitates the outputs of a teacher on unlabeled data. We show that samplers, while being bad classifiers, can be good teachers. Concretely, we prove that distillation from samplers is guaranteed to produce a student which approximates the Bayes optimal classifier. Finally, we show that some common learning algorithms (e.g., Nearest-Neighbours and Kernel Machines) can often generate samplers when applied in the overparameterized regime. + +# 1 Introduction + +Recently, the field of supervised learning has witnessed the success of overparameterized methods: models, such as deep neural networks, which are large enough to fit their train sets but still achieve good test performance. A core theoretical concern is to understand why such models are able to fit even noisy training data without catastrophically overfitting [31] despite no explicit regularization. The seminal work of Bartlett et al. [2] proposed the theoretical framework of benign overfitting to capture this empirical behavior. Briefly, benign overfitting studies statistically consistent methods—where models approach the Bayes optimal classifier, even in presence of noise. + +However, recent empirical work shows that when training deep neural networks on noisy data, overfitting is neither catastrophic nor benign [20]. Specifically, they propose that overfitting leads not to a good classifier, but to a good conditional sampler. For example, suppose we train a model on a set of images sampled from some distribution $\mathcal{D}$ , where $20\%$ of the images of cats are wrongly labeled as dogs. We now train an overparameterized network to fit samples from $\mathcal{D}$ . Note that for the distribution $\mathcal{D}$ , the Bayes-optimal classifier, namely $f_{\mathcal{D}}^{*}(\mathbf{x}) \coloneqq \operatorname{argmax}_{y} \mathbb{P}_{\mathcal{D}}(y|\mathbf{x})$ , returns the "correct" class of every image. We can hope that if overfitting is truly "benign" in the sense of [2], the overparameterized model will be close to this optimal $f_{\mathcal{D}}^{*}$ . However, this is not what occurs in practice: as [20] point out, the trained model $f$ reproduces noise in the training set at test time, labeling up to $20\%$ of the cats in the test data as dogs. In a sense, the trained model $f$ behaves as a conditional sample: $f(\mathbf{x}) \sim \mathbb{P}_{\mathcal{D}}(y|\mathbf{x})$ (see the leftmost confusion matrix in Figure 1). + +The above example indicates that thinking about classifiers in the overparameterized regime as approximating the Bayes optimal predictor might be misleading. Therefore, it is essential to develop + +![](images/795a9c2e5fec72458df2e49571ee91f3fa60cd2c991b62626dc9e1fee9b54dbb.jpg) +Figure 1: From Samplers to Good Models. Class confusion matrices for ResNet-18 trained on CIFAR-10 with $20\%$ fixed and class dependent label noise (e.g., $20\%$ of cats are labeled as dogs). Left. A ResNet-18 trained on this data replicates the noise to the test distribution. Middle. When assembling 10 such models, the noise virtually disappears, at the cost of high price at inference. Right. Distilling a single model via unlabeled examples from the CIFAR-5m dataset by randomly selected a teacher for each example from a 10 teacher pool eliminates the noise as well as the inference cost. For further details on random teacher distillation see Section 3.3 + +![](images/0ab3d5c7640e0f8cee01c69cc700a77050f298cf8a48ff7fe9e93a13a2dc0130.jpg) + +![](images/842c1ca702c447b8b7f8dd4bcc971de28c1ee0fade0cefbc2f6235af7ffe9354.jpg) + +the appropriate theoretical framework for describing the behavior of samplers from the conditional distribution. While the learning-theoretic aspects of supervised classification are well-studied, the theory of supervised conditional sampling has, to the best of our knowledge, not been systematically explored. In this work, we take the first steps towards addressing this gap. We initiate the study of conditional sampling as a learning problem, and explore its relations to other kinds of learning. + +Interestingly, we relate the notion of samplers to knowledge distillation methods. In short, knowledge distillation is the process of training a teacher network on a small labeled dataset and using its predictions to label a large unlabeled dataset, on which a student network is trained to imitate the output of the teacher. We find that taking an ensemble of samplers as a teacher for knowledge distillation produces a student network with minimal error with respect to the Bayes optimal classifier. Finally, our theory leads to a new algorithm for knowledge distillation, where we randomly choose a teacher from a fixed pool, to label each example, which accelerates the training process in practice. We show that this new algorithm is guaranteed to find a student with low error. + +# 1.1 Our Contributions + +Learning Theory of Conditional Samplers. (Section 2) We initiate the study of conditional sampling in the context of computational learning theory. We formally introduce the problem of conditional-sampling, and define the sample complexity of learning a sampler. We then present positive and negative results in this new setting. For example, we show that there exist distributions where sampling is much easier than classification, requiring far fewer samples. However, if we allow polynomial blowup in sample-size and runtime, a sampler can be "boosted" to a good classifier, showing that if finding a classifier is computationally hard then sampling is also hard. + +Theory of Knowledge Distillation. (Section 3) One way to boost a sampler into a good classifier is to run an ensemble of samplers at inference time (see middle panel of Figure 1), which is costly. We show that by performing distillation from an ensemble of teachers, it is possible to find a student with low error w.r.t. the Bayes optimal. This shows that teacher networks in ensemble-distillation need not be good classifiers, but just good samplers. Finally we propose a new algorithm for distillation, where each example is labeled by a random teacher from a fixed pool (see right panel of Figure 1). We study quantitative bounds on the sample complexity of teaching and learning in our setting, for both ensemble-distillation and distillation from a random teacher. + +Theory of Sampler Algorithms. (Section 4) We show that several classical learning algorithms provably produce good conditional samplers, and analyze their sample complexity in terms of standard problem parameters (e.g., distributional smoothness). Specifically we show that the 1-Nearest-Neighbour algorithm is a sampler, and extend our analysis to k-Nearest-Neighbour as well. + +Furthermore, we show that under some distributional assumptions, Lipschitz classes such as linear methods, kernels and neural networks may also behave like samplers. + +# 1.2 Related Work + +Knowledge Distillation Knowledge Distillation for deep learning was proposed in [14]. Since then, a large body of work showed its practical benefits for various machine learning tasks [29, 23, 30, 6, 10, 27]. Nonetheless, from a theoretical perspective, understanding why and when distillation works remains a mystery. Hinton et al. [14], attribute the success of distillation to the fact that the soft labels of the teacher passing additional information on the input. In a recent paper, Menon et al. [18], claim that when the teacher approximates the Bayes class-probabilities, distillation is possible. Our results show that even when the teachers are far from the Bayes optimal prediction (i.e., when teachers are noisy samplers from the distribution), we can find a student with low levels of noise through distillation. Another work by Wei et al. [28], shows that, assuming the data distribution has good continuity within each class, self-distillation is possible. However, it is not clear when such assumption is actually satisfied. The work of Lopez-Paz et al. [17], relates the notion of privileged information to knowledge distillation. A work by Frei et al. [8], shows that self-training can boost weak learners, when the target is a linear classifier over a mixture model distribution. Other works [19, 32, 7] study distillation as a regularization method, forcing the student to learn under a "smoother" loss landscape. + +Learning with Noise Learning under corrupted labels is a well-studied research area in the literature (e.g., [1,9]). A notable examples are the works of Blum et al., and Kearns et al. [5,15], showing how statistical query algorithms can be leveraged to learn under noisy labels. A growing number of works study the effects of noise on deep learning, as well as methods to learn under label noise (see [26] for a survey). However, most of these works do not leverage distillation for label noise robustness, as we suggest in our work. More related to our work is [12], showing that an iterative process of training and re-labeling can combat label noise. However, this work focuses on empirical study of distillation. + +# 2 Sampling as a Learning Problem + +Let $\mathcal{X}$ be the input space and $\mathcal{Y} = \{\pm 1\}$ be the label space (for simplicity, under appropriate assumptions we can extend most of our results to multiclass). A hypothesis class $\mathcal{H}$ is some class of functions from $\mathcal{X}$ to $\mathcal{Y}$ . A learning algorithm $\mathcal{A}$ takes a sequence of $m$ samples $S \in (\mathcal{X} \times \mathcal{Y})^m$ and outputs some hypothesis $h: \mathcal{X} \to \mathcal{Y}$ . We denote by $\mathcal{A}(S)$ the hypothesis that $\mathcal{A}$ outputs when observing the sample $S$ . For some distribution $\mathcal{D}$ over $\mathcal{X} \times \mathcal{Y}$ , we denote its $\mathcal{X}$ marginal as $\mathcal{D}_{\mathcal{X}}$ and denote the Bayes optimal classifier by $f_{\mathcal{D}}^{*}(\mathbf{x}) := \arg \max_{y \in \mathcal{Y}} \mathbb{P}_{\mathcal{D}}[y|\mathbf{x}]^2$ + +When $\mathcal{D}$ is a distribution where the label is not a deterministic function of the input, we think of $\mathcal{D}$ as a noisy version of some clean distribution $\mathcal{D}^*$ , where each input is correctly labeled. Naturally, we assume that the probability of seeing the right label is greater than seeing a wrong one. In other words, $\mathcal{D}^*$ has the same marginal distribution over $\mathcal{X}$ (i.e., $\mathcal{D}_{\mathcal{X}} = \mathcal{D}_{\mathcal{X}}^*$ ), and is labeled by the Bayes optimal classifier of $\mathcal{D}$ . That is, sampling $(\mathbf{x}, y) \sim \mathcal{D}^*$ is given by $\mathbf{x} \sim \mathcal{D}_{\mathcal{X}}$ and $y = f_{\mathcal{D}}^*(\mathbf{x})$ . + +We denote the "noise" of the distribution $\mathcal{D}$ by $\eta (\mathcal{D})\coloneqq \mathbb{P}_{(\mathbf{x},y)\sim \mathcal{D}}[y\neq f_{\mathcal{D}}^{*}(\mathbf{x})]$ . We also consider the margin of the distribution, which defines the difference in probability between correct and wrong label for each example. Namely, for some $\delta \geq 0$ , let $\gamma_{\delta}(\mathcal{D})$ be the supremum over $\gamma >0$ s.t., + +$$ +\underset {\mathbf {x} \sim \mathcal {D} _ {\mathcal {X}}} {\mathbb {P}} \left[ \underset {\mathcal {D}} {\mathbb {P}} \left(f _ {\mathcal {D}} ^ {*} (\mathbf {x}) | \mathbf {x}\right) < \underset {y \neq f _ {\mathcal {D}} ^ {*} (\mathbf {x})} {\max } \underset {\mathcal {D}} {\mathbb {P}} (y | \mathbf {x}) + \gamma \right] \leq \delta +$$ + +Specifically, we denote $\gamma (\mathcal{D})\coloneqq \gamma_0(\mathcal{D})$ . We typically assume that the input distribution has a strictly positive margin $\gamma (\mathcal{D}) > 0$ , so for every example the probability to see the correct label is greater by $\gamma$ than the probability to see a wrong label. + +Our objective in this setting is to approximate the Bayes optimal classifier of $\mathcal{D}$ . In other words, we want to minimize the 0-1 loss on the clean distribution $\mathcal{D}^*$ : + +$$ +L _ {\mathcal {D} ^ {*}} (h) := \mathbb {P} _ {(\mathbf {x}, y) \sim \mathcal {D}} [ h (\mathbf {x}) \neq f _ {\mathcal {D}} ^ {*} (\mathbf {x}) ] = \mathbb {P} _ {(\mathbf {x}, y) \sim \mathcal {D} ^ {*}} [ h (\mathbf {x}) \neq y ] \tag {1} +$$ + +So, the learning algorithm has access to samples from the noisy distribution $\mathcal{D}$ , but needs to achieve good loss on the clean distribution $\mathcal{D}^*$ . We define a learner in this setting to be an algorithm that minimizes $\boxed{1}$ using a finite number of samples: + +Definition 1. For some learning algorithm $\mathcal{A}$ and some distribution $\mathcal{D}$ over $\mathcal{X} \times \mathcal{Y}$ , we say that $\mathcal{A}$ is a learner for $\mathcal{D}$ if there exists a function $m: (0,1) \to \mathbb{N}$ s.t. for every $\epsilon \in (0,1)$ , taking $m \geq m(\epsilon)$ we get, $\mathbb{E}_{S \sim \mathcal{D}^m} L_{\mathcal{D}^*}(\mathcal{A}(S)) \leq \epsilon$ . + +In this case, we call $m(\cdot)$ the sample complexity of $\mathcal{A}$ w.r.t. $\mathcal{D}$ . Additionally, for some class $\mathcal{P}$ of distributions over $\mathcal{X} \times \mathcal{Y}$ , we say that $\mathcal{A}$ is a learner for $\mathcal{P}$ if there is some $m(\cdot)$ s.t. $\mathcal{A}$ is a learner with sample complexity $m(\cdot)$ for every $\mathcal{D} \in \mathcal{P}$ . + +Note that this definition of learner is similar to the notion of asymptotically consistent estimator. However, our definition explicitly accounts for the sample complexity. To give a concrete example, let us consider agnostic learning using the ERM rule, namely: $\mathrm{ERM}_{\mathcal{H}}(S) = \arg \min_{h\in \mathcal{H}}L_S(h)$ . + +For some hypothesis class $\mathcal{H}$ and some margin $\gamma > 0$ , let $\mathcal{P}(\mathcal{H}, \gamma)$ be the class of distributions such that for every $\mathcal{D} \in \mathcal{P}(\mathcal{H}, \gamma)$ we have $\gamma(\mathcal{D}) \geq \gamma$ and $f_{\mathcal{D}}^{*} \in \mathcal{H}$ . Namely, $\mathcal{P}(\mathcal{H}, \gamma)$ is the class of distributions with margin $\gamma$ for which the Bayes optimal classifier comes from $\mathcal{H}$ . The following theorem states that finite VC-dimension and a non-zero margin form a sufficient condition for learnability with noise. + +Theorem 2. There exists a constant $C > 0$ s.t. for every hypothesis class $\mathcal{H}$ with $\mathrm{VC}(\mathcal{H}) < \infty$ , $\mathrm{ERM}_{\mathcal{H}}$ is a learner for $\mathcal{P}(\mathcal{H},\gamma)$ with sample complexity $m(\epsilon) = C\frac{\mathrm{VC}(\mathcal{H}) + \log(1 / \epsilon)}{\epsilon^2\gamma^2}$ . + +The proof of Theorem2 is given in the appendix. The main idea is the following lemma (whose proof is also in the appendix), which shows that the margin assumption connects a small relative error w.r.t. $\mathcal{D}$ to a small absolute error w.r.t. $\mathcal{D}^*$ . + +Lemma 3. Fix some distribution $\mathcal{D}$ , and let $h^*$ be the Bayes optimal classifier for $\mathcal{D}$ . Assume that $\gamma_{\delta}(\mathcal{D}) > 0$ . Then, for every $h$ such that $L_{\mathcal{D}}(h) \leq L_{\mathcal{D}}(h^*) + \epsilon$ it holds that $L_{\mathcal{D}^*}(h) \leq \frac{\epsilon}{\gamma_{\delta}(\mathcal{D})} + \delta$ . + +Combining this lemma with the Fundamental Theorem of Learning Theory (see [25]) yields Theorem 2. From this theorem, we see that given more samples than the VC-dimension (often corresponding to the number of parameters), learning is possible. However, complex classifiers with large VC-dimension such as neural networks are often trained in the overparameterized regime, when the number of parameters exceeds the number of samples. In this regime, the bound of Theorem 2 becomes vacuous. That said, this does not rule out the possibility of distribution-dependent sample complexity bounds using other measures of complexity (e.g., Rademacher complexity). + +# 2.1 Samplers + +As previously mentioned, neural networks trained on noisy data replicate the noise to unseen samples as well, behaving like samplers from the noisy distribution. We next define formally a sampler for some distribution $\mathcal{D}$ , giving a similar definition as in [20]. + +For some learning algorithm $\mathcal{A}$ , some number $m \in \mathbb{N}$ and some distribution $\mathcal{D}$ over $\mathcal{X} \times \mathcal{Y}$ , define the distribution $\mathcal{A}(\mathcal{D}^m)$ over $\mathcal{X} \times \mathcal{Y}$ , where $(\mathbf{x}, y) \sim \mathcal{A}(\mathcal{D}^m)$ is given by sampling $S \sim \mathcal{D}^m$ , sampling $\mathbf{x} \sim \mathcal{D}_{\mathcal{X}}$ and setting $y = \mathcal{A}(S)(\mathbf{x})$ . Namely, $\mathcal{A}(\mathcal{D}^m)$ is the distribution given by (re)-labeling $\mathcal{D}$ using a hypothesis generated by $\mathcal{A}$ when observing a random sample of size $m$ . Using these notations, we define a sampler algorithm for the distribution $\mathcal{D}$ as follows: + +Definition 4. For some learning algorithm $\mathcal{A}$ and some distribution $\mathcal{D}$ over $\mathcal{X} \times \mathcal{Y}$ , we say that $\mathcal{A}$ is a sampler for $\mathcal{D}$ if there exists $\widetilde{m} : (0,1) \to \mathbb{N}$ s.t. for every $\epsilon \in (0,1)$ , taking $m \geq \widetilde{m}(\epsilon)$ we get, + +$$ +\operatorname {T V} (\mathcal {A} (\mathcal {D} ^ {m}), \mathcal {D}) \leq \epsilon +$$ + +where TV is the Total Variation Distance. Then, we call $\widetilde{m}$ the sample complexity of $\mathcal{A}$ w.r.t. $\mathcal{D}$ . Additionally, for some class $\mathcal{P}$ of distributions over $\mathcal{X} \times \mathcal{Y}$ , we say that $\mathcal{A}$ is a sampler for $\mathcal{P}$ if there exists $\widetilde{m}(\cdot)$ s.t. $\mathcal{A}$ is a sampler with sample complexity $\widetilde{m}(\cdot)$ for each $\mathcal{D} \in \mathcal{P}$ . + +So, a sampler for $\mathcal{D}$ is an algorithm that generates a distribution similar to $\mathcal{D}$ (the noisy input distribution) when labeling new examples. A primary example for a sampler is the 1-Nearest-Neighbour algorithm: since 1-NN outputs the (possibly corrupted) label of the closest neighbour, its prediction behaves like sampling from $\mathbb{P}_{\mathcal{D}}(y|\mathbf{x})$ (see Section4). Figure1 shows that neural networks behave similarly to samplers when trained on a noisy version of the CIFAR-10 dataset. + +Given the above definition, it can be easily shown that, instead of approximating the Bayes optimal prediction, a sampler preserves the noise rate of the original distribution. + +Lemma 5. Let $\mathcal{A}$ be a sampler $\mathcal{D}$ with sample complexity $\tilde{m}$ . Then, for $m \geq \tilde{m}(\varepsilon)$ , + +$$ +\eta (\mathcal {D}) - \varepsilon \leq \underset {S \sim \mathcal {D} ^ {m}} {\mathbb {E}} L _ {\mathcal {D} ^ {*}} (\mathcal {A} (S)) \leq \eta (\mathcal {D}) + \varepsilon +$$ + +While a sampler for $\mathcal{D}$ is not a good learner (in the sense of Definition 1), it does have some favorable properties. Primarily, it can take significantly fewer samples to get a sampler than it would take to get a learner, hence making the study of samplers more suitable for the overparameterized regime. In fact, in the extreme case one could get a sampler using only a single example from the distribution, while getting a learner for the same distribution would require an arbitrarily large number of examples. Indeed, fix $b \in \{\pm 1\}$ and $\gamma \in (0,1)$ , and let $\mathcal{D}_b$ be the distributions concentrated on a single example $\mathbf{x} \in \mathcal{X}$ , with label $y \in \{\pm 1\}$ s.t. $\mathbb{P}_{\mathcal{D}_b}(y = 1) = \frac{1 + b\gamma}{2}$ . To get a sampler from $\mathcal{D}_b$ it clearly suffices to take a single example $(\mathbf{x}, y)$ , and return the constant function $y$ . To find the Bayes optimal for the distribution $\mathcal{D}_b$ , on the other hand, any algorithm needs $\Omega(1/\gamma^2)$ examples. Using this observation, we show the following result: + +Theorem 6. For every $M > 0$ , there exists a class of distributions $\mathcal{P}_M$ such that: a) there exists a sampler for $\mathcal{P}_M$ with sample complexity $\widetilde{m} \equiv 1$ , and b) any learner for $\mathcal{P}_M$ has sample complexity satisfying $m(1/8) \geq M$ . + +# 2.2 Teachers + +Motivated by the observed behavior of neural networks in the overparameterized regime, we defined the notion of samplers. We showed that samplers can be much more sample efficient than learners, at the cost of giving noisy predictions. Next, we will show that while samplers are in and of themselves bad classifiers, they can still be good teachers. That is, we can use samplers to label a large unlabeled dataset and train a student classifier on this new dataset. This process is often referred to as knowledge distillation, and it has been shown to work remarkably well in practice [29, 23]. The following definition captures the notion of a (good) teacher: + +Definition 7. For some learning algorithm $\mathcal{A}$ , some distribution $\mathcal{D}$ over $\mathcal{X} \times \mathcal{Y}$ , we say that $\mathcal{A}$ is a teacher for $\mathcal{D}$ if there exists a function $\widetilde{m} : (0,1)^2 \to \mathbb{N}$ s.t. for every $\epsilon, \tau \in (0,1)$ , taking $m \geq \widetilde{m}(\epsilon, \tau)$ the following holds: + +1. $L_{\mathcal{D}^*}\left(f_{\mathcal{A}(\mathcal{D}^m)}^*\right) = \mathbb{P}_{\mathbf{x}\sim \mathcal{D}}\left[f_{\mathcal{D}}^* (\mathbf{x})\neq f_{\mathcal{A}(\mathcal{D}^m)}^* (\mathbf{x})\right]\leq \epsilon$ +2. $\gamma_{\epsilon}(\mathcal{A}(\mathcal{D}^{m}))\geq \gamma (\mathcal{D}) - \tau$ + +Additionally, for some class $\mathcal{P}$ of distributions over $\mathcal{X} \times \mathcal{Y}$ , we say that $\mathcal{A}$ is a teacher for $\mathcal{P}$ if there is some $\widetilde{m}(\cdot, \cdot)$ s.t. $\mathcal{A}$ is a teacher with sample complexity $m(\cdot, \cdot)$ for every $\mathcal{D} \in \mathcal{P}$ . + +The first condition in the above definition means that the Bayes optimal of the original distribution and the distribution induced by the teacher are close. The second condition means that the probability mass of low margin samples from the distribution labeled by the teacher is small. Intuitively, an algorithm satisfying Definition 7 is a good teacher since the distribution it induces is "similar" to the original distribution. Hence, if the student finds a good hypothesis on the teacher-induced distribution, its hypothesis is also good w.r.t. the original distribution. + +In Section 3 we formally study when and how teachers can be used for distillation, giving guarantees for getting students with small error with respect to the clean distribution $\mathcal{D}^*$ . Before that, let us first show that samplers are indeed good teachers. + +Theorem 8. Let $\mathcal{A}$ be a sampler for $\mathcal{D}$ with sample complexity $m(\cdot)$ and margin $\gamma$ . Then, $\mathcal{A}$ is a teacher for $\mathcal{D}$ with sample complexity $\widetilde{m}(\epsilon, \tau) = m(\varepsilon \cdot \min(\tau/2, \gamma))$ . + +The main idea behind the proof of Theorem 8 is that, given an example with probability mass $p$ , the "cost" (in terms of TV) of flipping the example's label w.r.t. the Bayes optimal $f_{\mathcal{D}}^{*}$ is at least $p \cdot \gamma$ . Since our TV "budget" is limited by $\varepsilon \gamma$ we can only flip a probability mass of $\varepsilon$ of the distribution. + +Finally, before moving on to discuss the implication of our results, we show that learners are also good teachers. This is almost immediate, since learners approximate the Bayes optimal classifier, and hence can be used to train students to similarly imitate the Bayes classifier. + +Theorem 9. Let $\mathcal{A}$ be a learner for $\mathcal{D}$ with sample complexity $m(\cdot)$ . Then, $\mathcal{A}$ is a teacher for $\mathcal{D}$ with sample complexity $\widetilde{m}(\epsilon, \tau) = m\left(\frac{\epsilon(1 - \gamma(\mathcal{D}) + \tau)}{2}\right)$ . + +To conclude, Theorem 8 and Theorem 9 show that, to some extent, a teacher is an "interpolation" between a sampler and a learner. + +# 3 Distillation from Teachers + +We defined the notion of a teacher, and showed that both samplers and learners are teachers. Now, we show how teachers (and in particular, samplers) can be used to find good learners. First, we show that an ensemble of teachers can be used to get a good learner by simply outputting the majority vote of the ensemble. Next, we show that using the ensemble to label a new set of unlabeled examples (i.e., performing knowledge distillation) guarantees finding a student with small loss, assuming the Bayes optimal classifier comes from the hypothesis class learned by the student. Such process is favorable, since it reduces the computational cost of running the ensemble at inference time, and also allows using a different hypothesis class for the student (for example when using a student network of smaller size, e.g., [1]). Finally, we show that distillation can also be achieved by labeling examples using a teacher that is randomly chosen from a fixed set of teachers, a method that has some computational benefits at training time. To the best of our knowledge, this is a novel technique for distillation that has not been previously suggested in prior work. + +# 3.1 Ensembles of Teachers + +We now show how an ensemble of teachers can be used to get accurate predictions with respect to the Bayes optimal predictor. Given some $k$ samples $S_{1},\ldots ,S_{k}\sim \mathcal{D}^{m}$ , each one of size $m$ , we can use a learning algorithm $\mathcal{A}$ to get $k$ different hypothesis $h_1,\dots,h_k$ , where $h_i\coloneqq \mathcal{A}(S_i)$ . Observe the ensemble hypothesis, which outputs the majority vote of the ensemble members: + +$$ +h _ {\mathrm {e n s}} (\mathbf {x}) = \arg \max _ {y \in \mathcal {Y}} \sum_ {i} \mathbf {1} \{h _ {i} (\mathbf {x}) = y \} +$$ + +We use the notation $\mathcal{A}_{\mathrm{ens}}(S_1,\ldots ,S_k)\coloneqq h_{\mathrm{ens}}$ to denote this ensemble hypotheses. The following Theorem states that the ensemble hypothesis has a good loss on average, when using a large enough ensemble of teachers: + +Theorem 10. Assume that $\mathcal{A}$ is a teacher for some distribution $\mathcal{D}$ with complexity $\widetilde{m}$ . Then, for all $\epsilon \in (0,1)$ , taking $m \geq \widetilde{m}\left(\frac{\epsilon}{3},\frac{\gamma(\mathcal{D})}{2}\right)$ and $k \geq \frac{16\log(3 / \epsilon)}{\gamma(\mathcal{D})^2}$ we get, + +$$ +\underset {S _ {1}, \dots , S _ {k} \sim \mathcal {D} ^ {m}} {\mathbb {E}} L _ {\mathcal {D} ^ {*}} \left(\mathcal {A} _ {\mathrm {e n s}} \left(S _ {1}, \dots , S _ {k}\right)\right) \leq \epsilon +$$ + +We now give a sketch of the proof. For some $\mathbf{x} \in \mathcal{X}$ , let $y_i$ be the prediction of the $i$ -th teacher, and let $\bar{y}$ be the average of the predictions, namely $\bar{y} = \frac{1}{k} \sum_{i} y_i$ . Observe that $h_{\mathrm{ens}}(\mathbf{x}) = \mathrm{sign}(\bar{y})$ , and additionally $\mathbb{E}[\bar{y}] = \mathbb{E}_{\mathcal{A}(\mathcal{D}^m)}[y|\mathbf{x}]$ . Now, since $\mathcal{A}$ is a teacher we get $\mathbb{E}_{\mathcal{A}(\mathcal{D}^m)}[y|\mathbf{x}] \approx \mathbb{E}_\mathcal{D}[y|\mathbf{x}]$ (with high probability over the choice of $\mathbf{x}$ ), and by concentration bounds this implies that w.h.p. $h_{\mathrm{ens}}(\mathbf{x})$ gives the Bayes optimal prediction (i.e., $h_{\mathrm{ens}}(\mathbf{x}) = f_{\mathcal{D}}^{*}(\mathbf{x})$ ). + +So, Theorem 10 shows that if $\mathcal{A}$ is a teacher for $\mathcal{D}$ , then $\mathcal{A}_{\mathrm{ens}}$ with $k \geq \widetilde{\Omega} \left(1 / \gamma (\mathcal{D})^2\right)^3$ is a learner for $\mathcal{D}$ . More generally, if we have a teacher for some distribution $\mathcal{D}$ with positive margin, this implies that there exists a learner for the same distribution. The inverse of this statement gives another interesting result—if no algorithm can learn some problem, then getting a teacher (or sampler) is also hard. Formally, let $\mathcal{P}$ be a class of distributions over $\mathcal{X} \times \mathcal{Y}$ s.t. for all $\mathcal{D} \in \mathcal{P}$ it holds that $\gamma (\mathcal{D}) \geq \gamma$ . Then, if there is no learner for $\mathcal{P}$ , there is no teacher or sampler for $\mathcal{P}$ . Additionally, a similar result holds for problems which are computationally hard to learn. That is, if there is no learner for $\mathcal{P}$ that runs in polynomial time, then there is no poly-time teacher or sampler for $\mathcal{P}$ . Observe that the condition that $\gamma (\mathcal{D}) \geq \gamma$ for all $\mathcal{D} \in \mathcal{P}$ in the previous statement is necessary. Indeed, taking $\mathcal{P} = \cup_{M=1}^{\infty}$ , where $\mathcal{P}_M$ is the distribution class guaranteed by Theorem 6, gives a class $\mathcal{P}$ s.t. there is a sampler for $\mathcal{P}$ with sample complexity $\widetilde{m} \equiv 1$ , but there is no learner for $\mathcal{P}$ . + +# 3.2 Distillation from Ensembles + +We showed that an ensemble of $k = \tilde{\Omega} (\gamma^{-2})$ teachers gives a classifier that approximates the Bayes optimal predictor. This, however, incurs a $k$ factor in computational cost at inference time. To prevent + +this, we can instead use the ensemble to label new unlabeled data, and train a new classifier to imitate the ensemble. This moves the computational burden from inference time to training time. + +Fix some class $\mathcal{H}$ , and define the Ensemble-Pseudo-Labeling (EPL) algorithm as follows: + +1. For some $k, m \in \mathbb{N}$ , sample $S_1, \ldots, S_k \sim \mathcal{D}^m$ . +2. Run $\mathcal{A}$ on $S_{1},\ldots ,S_{k}$ , and let $h_\mathrm{ens} = \mathcal{A}_\mathrm{ens}(S_1,\dots,S_k)$ . +3. Take $S'$ to be a set of $m'$ unlabeled examples sampled from $\mathcal{D}_{\mathcal{X}}$ , and label it using $h_{\mathrm{ens}}$ . +4. Denote by $\widetilde{S}$ the pseudo-labeled set. Run $\mathrm{ERM}_{\mathcal{H}}$ on the set $\widetilde{S}$ and return $h := \mathrm{ERM}_{\mathcal{H}}(\widetilde{S})$ . + +Intuitively, since $h_{\mathrm{ens}}$ approximates the Bayes optimal classifier (see Theorem 10), the labels for the new dataset $S'$ are mostly correct. In other words, the pseudo-labeled set $\widetilde{S}$ comes from a distribution that is close to the clean distribution $\mathcal{D}^*$ . When using pseudo-labels, it is enough to use unlabeled data, which is often abundant, so $\widetilde{S}$ can be much larger than our original labeled dataset. In this case, we no longer need to work in the overparameterized regime, so $\mathrm{ERM}_{\mathcal{H}}$ is guaranteed to achieve good performance by standard VC bounds. This argument is captured in Theorem 11: + +Theorem 11. For hypothesis class $\mathcal{H}$ with $\mathrm{VC}(\mathcal{H}) < \infty$ , and let $\mathcal{D} \in \overline{\mathcal{P}(\mathcal{H},\gamma)}$ for some $\gamma > 0$ . Let $\mathcal{A}$ be a teacher for $\mathcal{D}$ with distributional sample complexity $\widetilde{m}$ . Then, there exists a constant $C > 0$ s.t. for every $\epsilon \in (0,1)$ , running the EPL algorithm with parameters $m \geq \widetilde{m}\left(\frac{\epsilon}{12},\frac{\gamma}{2}\right)$ , $m' \geq C\frac{\mathrm{VC}(\mathcal{H}) + \log(1 / \epsilon)}{\epsilon^2}$ and $k \geq \frac{16\log(12 / \epsilon)}{\gamma^2}$ returns a hypothesis $h$ satisfying $\mathbb{E}_{S_1,\ldots,S_k,\widetilde{S}}L_{\mathcal{D}^*}(h) \leq \epsilon$ . + +# 3.3 Distillation from Random Teachers + +While the EPL algorithm moves the computation cost from inference to training, we still suffer a $k$ factor for labeling each example. Instead, a possible solution is to label examples by choosing a random classifier from the ensemble. Then, we only run one classifier per example. So, we define the Random-Pseudo-Labeling (RPL) similarly to EPL, except that for each example $\mathbf{x}$ in the unlabeled dataset $S^{\prime}$ , we pick $h\sim \{h_1,\ldots ,h_k\}$ and label $\mathbf{x}$ by $h(\mathbf{x})$ . + +To understand why this method works, we can think of $\widetilde{S}$ as coming from a distribution $\widetilde{\mathcal{D}}$ , defined by sampling $\mathbf{x} \sim \mathcal{D}_{\mathcal{X}}$ and sampling $y$ s.t. $\mathbb{E}_{\widetilde{\mathcal{D}}} [y|\mathbf{x}] = \mathbb{E}_{i \sim [k]} [h_i(\mathbf{x})]$ . By the properties of the teacher, using concentration arguments as in Theorem 10 the distribution $\widetilde{\mathcal{D}}$ is close to the noisy distribution $\mathcal{D}$ . However, as mentioned before, the advantage of using $\widetilde{S} \sim \widetilde{\mathcal{D}}$ is that we can use a much larger set of unlabeled data, in which case the result of Theorem 2 can be applied to show that the above algorithm finds a hypothesis with good error. This is stated in the following result: + +Theorem 12. For hypothesis class $\mathcal{H}$ with $\mathrm{VC}(\mathcal{H}) < \infty$ , let $\mathcal{D} \in \mathcal{P}(\mathcal{H}, \gamma)$ for $\gamma > 0$ . Let $\mathcal{A}$ be a teacher for $\mathcal{D}$ with distributional sample complexity $\widetilde{m}$ . Then, there exists a constant $C > 0$ s.t. for every $\epsilon \in (0,1)$ , running the RPL algorithm with parameters $m \geq \widetilde{m}\left(\frac{\epsilon\gamma}{54}, \frac{\gamma}{2}\right)$ , $m' \geq C \frac{\mathrm{VC}(\mathcal{H}) + \log\left(\epsilon^{-1}\gamma^{-1}\right)}{\epsilon^2\gamma^2}$ and $k \geq \frac{128\log\left(36\epsilon^{-1}\gamma^{-1}\right)}{\gamma^2}$ returns $h$ satisfying $\mathbb{E}_{S_1,\ldots,S_k,\widetilde{S}}L_{\mathcal{D}^*}(h) \leq \epsilon$ . + +Compare the sample complexity of the above theorem with the sample complexity achieved by the EPL algorithm, stated in Theorem [1]. At first glance, it seems that the gain from using the RPL algorithm is not clear, as it increases the number of unlabeled data by a factor of $1 / \gamma (\mathcal{D})^2$ (and also might increase the number of labeled examples). This is not surprising, because a dataset labeled by a random classifier can be much more noisy than a dataset labeled by the ensemble, and hence more examples are required in order to learn. Note, that since $k \geq \tilde{\Omega}(1 / \gamma (\mathcal{D})^2)$ , the randomized labeling takes $1 / k$ compute per example relative to the ensemble labeling, it will, however, need to label an order of $k$ times more examples. + +We do note that there might still be computational benefits to using the random approach, as it allows the training and labeling to happen in parallel without a significant increase in compute (e.g., 2 GPU cores are enough to train in parallel without any loss of time). On the other hand, labeling a dataset using the ensemble requires one to either increase the compute by $k$ (applying parallelism), or otherwise wait until the full dataset is labeled, and only then start the distillation process. Finally, our experiments show that the gain from ensemble labeling over random labeling, as captured by the final accuracy of the trained student, is not so significant (see Table 1). This suggests that in + +some particular cases (e.g., under further assumptions on the data distribution and/or the optimization algorithm), it is preferable to use the RPL algorithm. + +# 4 Samplers Exist + +So far, we showed that samplers can be good teachers. These can then be used for knowledge distillation, generating students which approximate the Bayes optimal prediction. To complete the picture, we now show that some well-known algorithms can be used as samplers or teachers. We start by studying the k-Nearest-Neighbour algorithm, and show that it is a teacher when the underlying distribution has some Lipschitz property. We then show that bounded-norm ReLU networks with scalar input exhibit similar behavior. In Appendix C.1 we further analyze Lipschitz classes of functions (e.g., linear functions, kernels and neural networks), and show that when the data is well-clustered, these algorithms can be teachers as well. In all cases, the sample complexity needed for the samplers or teachers is lower than the complexity required for learning. + +# Nearest Neighbour Algorithm + +For some set $S = \{(\mathbf{x}_1, y_1), \ldots, (\mathbf{x}_m, y_m)\} \subseteq \mathcal{X} \times \mathcal{Y}$ we denote $S_{\mathcal{X}} = \{\mathbf{x}_1, \ldots, \mathbf{x}_m\}$ . Fix some metric $d$ over the space $\mathcal{X}$ . In this section, we assume that the metric space $(\mathcal{X}, d)$ satisfies the Heine-Borel property—that is, every closed and bounded set in $\mathcal{X}$ is compact. For some finite set $S \subseteq \mathcal{X} \times \mathcal{Y}$ , and some $\mathbf{x} \in \mathcal{X}$ , denote $d(\mathbf{x}, S) := \min_{\mathbf{x}' \in S_{\mathcal{X}}} d(\mathbf{x}, \mathbf{x}')$ and $\pi(\mathbf{x}, S) := \arg \min_{(\mathbf{x}', y') \in S} d(\mathbf{x}, \mathbf{x}')$ . Additionally, we define the set $\mathrm{k} - \pi(\mathbf{x}, S_{\mathcal{X}}) \subseteq S$ to be the set of $k$ points in $S$ that are closest to $\mathbf{x}$ . That is, $\mathrm{k} - \pi(\mathbf{x}, S)$ is a set of size $k$ s.t. for any $(\mathbf{x}', y') \in \mathrm{k} - \pi(\mathbf{x}, S)$ and $(\tilde{\mathbf{x}}, \tilde{y}) \in S \setminus \mathrm{k} - \pi(\mathbf{x}, S)$ it holds that $d(\mathbf{x}, \mathbf{x}') \leq d(\mathbf{x}, \tilde{\mathbf{x}})$ . For some distribution $\mathcal{D}$ , we say that $\mathcal{D}$ is $\lambda$ -Lipschitz if for all $\mathbf{x}, \mathbf{x}' \in \operatorname{supp}(\mathcal{D}_{\mathcal{X}})$ and $y \in \mathcal{Y}$ it holds that $|\mathbb{P}_{\mathcal{D}}[y|\mathbf{x}] - \mathbb{P}_{\mathcal{D}}[y|\mathbf{x}')| \leq \lambda d(\mathbf{x}, \mathbf{x}')$ . + +For some odd $k \geq 1$ , define $\mathcal{A}_{\mathrm{k - NN}}(S)(\mathbf{x}) \coloneqq \arg \max_{\hat{y} \in \mathcal{Y}} |(\mathbf{x}', y') \in \mathrm{k - }\pi(\mathbf{x}, S), y' = \hat{y}|$ , i.e., $\mathcal{A}_{\mathrm{k - NN}}(S)$ is the k-NN algorithm over sample $S$ . We start by showing that the $\mathcal{A}_{1 - \mathrm{NN}}$ is a sampler. The distributional sample complexity of $\mathcal{A}_{1 - \mathrm{NN}}$ depends on the number of $\epsilon$ -balls that can cover a $1 - \delta$ mass of the distribution (Lemma 23 in the Appendix shows that this number is always finite). Given such cover, we can guarantee that with a large enough sample, we find a candidate example in each of the balls that have non-negligible mass. In that case, if the distribution of labels does not change significantly in each ball, $\mathcal{A}_{1 - \mathrm{NN}}$ is indeed a sampler: + +Theorem 13. Let $\mathcal{D}$ be some $\lambda$ -Lipschitz distribution. Then, $\mathcal{A}_{1-NN}$ is a sampler for $\mathcal{D}$ . + +Next, we study the k-NN algorithm for any odd $k \geq 1$ . Similarly to the analysis of the 1-NN case, we show that a large enough sample guarantees at least $k$ candidates in each of the $\epsilon$ -ball covering the distribution. In this case, the prediction of the k-NN algorithm is the majority vote over the $k$ neighbours in each ball. This will get closer to the Bayes optimal prediction as $k$ grows, and therefore the k-NN algorithm is not a sampler for $k > 1$ . However, we show that it is always a teacher: + +Theorem 14. Let $\mathcal{D}$ be some $\lambda$ -Lipschitz distribution. Then, $\mathcal{A}_{\mathrm{k - NN}}$ is a teacher for $\mathcal{D}$ . + +The core argument for proving Theorem14 relies on using a variant of Condorcet's Jury Theorem (CJT). Roughly speaking, CJT states that the accuracy of the majority vote of a set of predictors is better than the average accuracy of the individual predictors. In the k-NN case, each of the $k$ candidates casts a "vote", and using CJT we show that this improves over the 1-NN prediction, which is already a sampler (and hence a teacher). Notice that this works for any $k \geq 1$ , and we do not need to require $k$ to be large enough, as would be required in order to get a learner. + +# Bounded-Norm Infinite-Width ReLU Networks + +We continue with investigating infinite-widths neural-network with weights of bounded norm, following the setting studied in [24 22]. We define a ReLU network of width $k$ and depth 2 by $h_{\theta}(\mathbf{x}) = \sum_{i = 1}^{k}w_{i}^{(2)}\sigma \left(\left\langle \mathbf{w}_{i}^{(1)},\mathbf{x}\right\rangle +b_{i}^{(1)}\right) + b^{(2)}$ , where $\theta = (k,W^{(1)},W^{(2)},b^{(1)},b^{(2)})$ , and $\sigma$ is the ReLU activation. As in [24], we consider the Euclidean norm of non-biased weights: $C(\theta) = \frac{1}{2}\sum_{i = 1}^{k}\left(\left(w_{i}^{(2)}\right)^{2} + \left\| \mathbf{w}_{i}^{(1)}\right\|_{2}^{2}\right)$ . Now, consider fitting a sample $S\subseteq \mathcal{X}\times \mathcal{Y}$ with a network + +![](images/22803ca701af6a9ddc51e0ea61c8cc0c71b42c8063c213843bf142f3d92725d9.jpg) +Figure 2: The effect of the number of teachers on the performance of the student. We also include the teacher's accuracy marked as 0 teachers. + +
ExperimentTest Accuracy ± std
One Teacher0.868 ±5e-3
5 Random Teachers0.898 ±2e-3
10 Random Teachers0.900 ±2e-3
5 Teacher Ensemble0.899 ±2e-3
10 Teacher Ensemble0.902 ±1e-3
10-Ensemble Inference0.878
10-Teacher Clean Ens.0.934 ±0.8e-3
Teacher Accuracy0.813 ±4.7e-2
+ +Table 1: Comparison of teachers, students and ensembles test performance. Note that both ensembling and distillation reduce the effect of noise. + +$h_{\theta}$ with $C(\theta)$ acting as regularization. Namely, observe the following objective function: + +$$ +R (S) = \inf _ {\theta} C (\theta) \mathrm {s . t .} h _ {\theta} (\mathbf {x}) = y \mathrm {f o r a l l} (\mathbf {x}, y) \in S +$$ + +In the one-dimensional case, i.e. when $\mathcal{X} = \mathbb{R}$ , [24] shows that $R(S)$ gives the linear spline interpolation of the data points. Using this, we show that ReLU networks in this setting are samplers: + +Theorem 15. For algorithm $\mathcal{A}$ that takes a sample $S$ and returns h s.t. $h(x) = \mathrm{sign}\left(h_{\hat{\theta}}(x)\right)$ , for $\hat{\theta} = R(S)$ . Let $\mathcal{D}$ be some continuous $\lambda$ -Lipschitz distribution. Then, $\mathcal{A}$ is a sampler for $\mathcal{D}$ . + +The above shows that when we don't limit the size of the network and use the regularization $C(\theta)$ , the resulting algorithm is a sampler. Observe that if we do not introduce regularization, one can construct a ReLU network $h_\theta$ that outputs a constant value (e.g., 1) for all $x \in \mathbb{R}$ , outside of infinitesimally small neighbourhoods of the points of $S$ , where $h_\theta$ interpolates the data (namely, $h_\theta$ is constant with very narrow "spikes" towards the correct labels of the examples in the sample). Thus, on new points $h_\theta$ evaluates to 1 with high probability, so it does not behave like a sampler. + +Admittedly, going beyond the one-dimensional case is more challenging, as it requires understanding the high-dimensional geometry of the function returned by $R(S)$ . While we defer this case for future work, we note that the analysis of [22] gives some technical tools for understanding the multivariate version of the above problem. Specifically, [22] show that solving $R(S)$ is equivalent to minimizing a specific norm in function-space, which controls the complexity of the learned function. Among other things, the authors show that controlling this norm prevents a "spiking" behavior as described above. + +# 5 Experiments + +To this point, we saw that getting a sampler (and thus a teacher) from a noisy distribution can be more sample efficient than getting a learner. Furthermore, we showed that we can leverage multiple independent teachers to approximate the Bayes optimal classifier either via ensembling at inference time or via distillation on unlabeled data. We now complement our theoretical results with an experimental evaluation, showing the benefit of using distillation when training on noisy data. While in our theoretical setting we studied teachers that are trained on entirely disjoint training sets, in practice we find it more effective to train the teachers on overlapping datasets, as well as training on same dataset with different random initialization. + +To get the teachers, we train a ResNet-18 [13] on CIFAR-10 with $20\%$ -fixed and non-uniform label noise (see full details in D). We see that our teachers achieve $81.3\%$ test accuracy (see Table 1) and behave closely to samplers (see Figure 1) reproducing the results of [20]. We now compare the three methods considered before for using teachers to get learners: 1) Test time Ensembling; 2) Ensemble as distillation teacher and; 3) Random teacher distillation. For distillation, we train a student network on the CIFAR-5m, a large (5-million examples) dataset that resembles the CIFAR-10 dataset [21], where the labels are provided by the previously trained teachers. We report our results + +in Table① where the reported accuracies are on the CIFAR-10 test data. Observe that using an ensemble for inference reduces the noise significantly, and achieves test accuracy of $87.8\%$ (versus $81.3\%$ for a single teacher). When applying distillation, both random pseudo-labeling and ensemble pseudo-labeling further increase the test accuracy to about $90\%$ . In addition, we study how the number of teachers affects performance (see Figure②). We observe that both random pseudo-labeling and ensemble majority improve in performance when the number of teachers grow. + +# 6 Acknowledgements + +This work supported by Simons Investigator Fellowship, NSF grants DMS-2134157 and CCF-1565264, DARPA grant W911NF2010021, and DOE grant DE-SC0022199. + +# References + +[1] Dana Angluin and Philip Laird. Learning from noisy examples. Machine Learning, 2(4):343-370, 1988. +[2] Peter L Bartlett, Philip M Long, Gabor Lugosi, and Alexander Tsigler. Benign overfitting in linear regression. Proceedings of the National Academy of Sciences, 117(48):30063-30070, 2020. +[3] Ruth Ben-Yashar and Jacob Paroush. A nonasymptotic condorcet jury theorem. Social Choice and Welfare, 17(2):189-199, 2000. +[4] Daniel Berend and Luba Sapir. Monotonicity in condorcet jury theorem. Social Choice and Welfare, 24(1):83-92, 2005. +[5] Avrim Blum, Adam Kalai, and Hal Wasserman. Noise-tolerant learning, the parity problem, and the statistical query model. Journal of the ACM (JACM), 50(4):506-519, 2003. +[6] Ting Chen, Simon Kornblith, Kevin Swersky, Mohammad Norouzi, and Geoffrey E. Hinton. Big self-supervised models are strong semi-supervised learners. CoRR, abs/2006.10029, 2020. +[7] Bin Dong, Jikai Hou, Yiping Lu, and Zhihua Zhang. Distillation early stopping? harvesting dark knowledge utilizing anisotropic information retrieval for overparameterized neural network. arXiv preprint arXiv:1910.01255, 2019. +[8] Spencer Frei, Difan Zou, Zixiang Chen, and Quanquan Gu. Self-training converts weak learners to strong learners in mixture models. arXiv preprint arXiv:2106.13805, 2021. +[9] Benoit Frénay and Michel Verleysen. Classification in the presence of label noise: a survey. IEEE transactions on neural networks and learning systems, 25(5):845-869, 2013. +[10] Tommaso Furlanello, Zachary C. Lipton, Michael Tschannen, Laurent Itti, and Anima Anandkumar. Born again neural networks, 2018. +[11] Jianping Gou, Baosheng Yu, Stephen J Maybank, and Dacheng Tao. Knowledge distillation: A survey. International Journal of Computer Vision, 129(6):1789-1819, 2021. +[12] Christian Haase-Schütz, Rainer Stal, Heinz Hertlein, and Bernhard Sick. Iterative label improvement: Robust training by confidence based filtering and dataset partitioning. In 2020 25th International Conference on Pattern Recognition (ICPR), pages 9483-9490. IEEE, 2021. +[13] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. CoRR, abs/1512.03385, 2015. +[14] Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network, 2015. +[15] Michael Kearns. Efficient noise-tolerant learning from statistical queries. Journal of the ACM (JACM), 45(6):983-1006, 1998. +[16] Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. CoRR, 2009. +[17] David Lopez-Paz, Léon Bottou, Bernhard Schölkopf, and Vladimir Vapnik. Unifying distillation and privileged information. arXiv preprint arXiv:1511.03643, 2015. +[18] Aditya Krishna Menon, Ankit Singh Rawat, Sashank J. Reddi, Seungyeon Kim, and Sanjiv Kumar. Why distillation helps: a statistical perspective. CoRR, abs/2005.10419, 2020. +[19] Hossein Mobahi, Mehrdad Farajtabar, and Peter Bartlett. Self-distillation amplifies regularization in hilbert space. Advances in Neural Information Processing Systems, 33:3351-3361, 2020. +[20] Preetum Nakkiran and Yamini Bansal. Distributional generalization: A new kind of generalization. arXiv preprint arXiv:2009.08092, 2020. + +[21] Preetum Nakkiran, Behnam Neyshabur, and Hanie Sedghi. The deep bootstrap: Good online learners are good offline generalizers. CoRR, abs/2010.08127, 2020. +[22] Greg Ongie, Rebecca Willett, Daniel Soudry, and Nathan Srebro. A function space view of bounded norm infinite width relu nets: The multivariate case. arXiv preprint arXiv:1910.01635, 2019. +[23] Hieu Pham, Qizhe Xie, Zihang Dai, and Quoc V. Le. Meta pseudo labels. CoRR, abs/2003.10580, 2020. +[24] Pedro Savarese, Itay Evron, Daniel Soudry, and Nathan Srebro. How do infinite width bounded norm networks look in function space? In Conference on Learning Theory, pages 2667-2690. PMLR, 2019. +[25] Shai Shalev-Shwartz and Shai Ben-David. Understanding machine learning: From theory to algorithms. Cambridge university press, 2014. +[26] Hwanjun Song, Minseok Kim, Dongmin Park, Yooju Shin, and Jae-Gil Lee. Learning from noisy labels with deep neural networks: A survey. arXiv preprint arXiv:2007.08199, 2020. +[27] Siqi Sun, Yu Cheng, Zhe Gan, and Jingjing Liu. Patient knowledge distillation for BERT model compression. CoRR, abs/1908.09355, 2019. +[28] Colin Wei, Kendrick Shen, Yining Chen, and Tengyu Ma. Theoretical analysis of self-training with deep networks on unlabeled data. arXiv preprint arXiv:2010.03622, 2020. +[29] Qizhe Xie, Eduard H. Hovy, Minh-Thang Luong, and Quoc V. Le. Self-training with noisy student improves imagenet classification. CoRR, abs/1911.04252, 2019. +[30] I. Zeki Yalniz, Hervé Jégou, Kan Chen, Manohar Paluri, and Dhruv Mahajan. Billion-scale semi-supervised learning for image classification, 2019. +[31] Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. CoRR, abs/1611.03530, 2016. +[32] Shuai Zhang, Meng Wang, Sijia Liu, Pin-Yu Chen, and Jinjun Xiong. How does unlabeled data improve generalization in self-training? a one-hidden-layer theoretical analysis. arXiv preprint arXiv:2201.08514, 2022. \ No newline at end of file diff --git a/knowledgedistillationbadmodelscanbegoodrolemodels/images.zip b/knowledgedistillationbadmodelscanbegoodrolemodels/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..4dc31f16901f5083decef4b695b729eb010d363d --- /dev/null +++ b/knowledgedistillationbadmodelscanbegoodrolemodels/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b000dfd430c6b88898fcf9e660cb2b7d07b136ca308a261fa854b33030177104 +size 164797 diff --git a/knowledgedistillationbadmodelscanbegoodrolemodels/layout.json b/knowledgedistillationbadmodelscanbegoodrolemodels/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..cea7c55b1c2584922a2a0ba9794c1a9700058517 --- /dev/null +++ b/knowledgedistillationbadmodelscanbegoodrolemodels/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0ebd415cf80275621e9f4bd24a4f1427bf73c4597dec2c6bc9e76507fc978fbb +size 618028 diff --git a/knowledgedistillationfromastrongerteacher/b1aea3f4-3438-449e-809c-f9eaf1ae1b2a_content_list.json b/knowledgedistillationfromastrongerteacher/b1aea3f4-3438-449e-809c-f9eaf1ae1b2a_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..fdeedee197b716408f4e6a3f2d1fa4bc9ec3cea3 --- /dev/null +++ b/knowledgedistillationfromastrongerteacher/b1aea3f4-3438-449e-809c-f9eaf1ae1b2a_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fa5da4d57ac30b0a9db8ac6928e05423cc023bea8df9e31fe1542e28ebc2c6ba +size 79035 diff --git a/knowledgedistillationfromastrongerteacher/b1aea3f4-3438-449e-809c-f9eaf1ae1b2a_model.json b/knowledgedistillationfromastrongerteacher/b1aea3f4-3438-449e-809c-f9eaf1ae1b2a_model.json new file mode 100644 index 0000000000000000000000000000000000000000..a1f282108df44d18d32a5e878c102684a30a02a1 --- /dev/null +++ b/knowledgedistillationfromastrongerteacher/b1aea3f4-3438-449e-809c-f9eaf1ae1b2a_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:991a3c68b9d64b2ffee91a6fa3ddd47edf3be3c4073bac6ba215b41a8c8c8aeb +size 102982 diff --git a/knowledgedistillationfromastrongerteacher/b1aea3f4-3438-449e-809c-f9eaf1ae1b2a_origin.pdf b/knowledgedistillationfromastrongerteacher/b1aea3f4-3438-449e-809c-f9eaf1ae1b2a_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..6c790c4d67e986a1c3e604c7e6bf1cb014392244 --- /dev/null +++ b/knowledgedistillationfromastrongerteacher/b1aea3f4-3438-449e-809c-f9eaf1ae1b2a_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c16e7e893002cc409bd5c7a16fdea7126445abe13908bc4d5f59946eba886564 +size 597693 diff --git a/knowledgedistillationfromastrongerteacher/full.md b/knowledgedistillationfromastrongerteacher/full.md new file mode 100644 index 0000000000000000000000000000000000000000..a3d9526a93d7b72de4712032ff9f66a40946c88e --- /dev/null +++ b/knowledgedistillationfromastrongerteacher/full.md @@ -0,0 +1,344 @@ +# Knowledge Distillation from A Stronger Teacher + +Tao Huang $^{1,2}$ Shan You $^{1*}$ Fei Wang $^{3}$ Chen Qian $^{1}$ Chang Xu $^{2}$ + +$^{1}$ SenseTime Research + +$^{2}$ School of Computer Science, Faculty of Engineering, The University of Sydney + +3University of Science and Technology of China + +# Abstract + +Unlike existing knowledge distillation methods focus on the baseline settings, where the teacher models and training strategies are not that strong and competing as state-of-the-art approaches, this paper presents a method dubbed DIST to distill better from a stronger teacher. We empirically find that the discrepancy of predictions between the student and a stronger teacher may tend to be fairly severer. As a result, the exact match of predictions in KL divergence would disturb the training and make existing methods perform poorly. In this paper, we show that simply preserving the relations between the predictions of teacher and student would suffice, and propose a correlation-based loss to capture the intrinsic inter-class relations from the teacher explicitly. Besides, considering that different instances have different semantic similarities to each class, we also extend this relational match to the intra-class level. Our method is simple yet practical, and extensive experiments demonstrate that it adapts well to various architectures, model sizes and training strategies, and can achieve state-of-the-art performance consistently on image classification, object detection, and semantic segmentation tasks. Code is available at: https://github.com/hunto/DIST_KD. + +# 1 Introduction + +The advent of automatic feature engineering fuels deep neural networks to achieve remarkable success in a plethora of computer vision tasks, such as image classification [17, 19, 38, 48, 53], object detection [2, 23], and semantic segmentation [5, 54]. In the path of pursuing better performance, current deep learning models generally grow deeper and wider [13, 45]. However, such heavy models are clumsy to deploy in practice due to the limitations of computational and memory resources. For an efficient model with competitive performance to those larger models, knowledge distillation (KD) [16] has been proposed to boost the performance of the efficient model (student) by distilling the knowledge of a larger model (teacher) during training. + +The essence of knowledge distillation relies on how to formulate and transfer the knowledge from teacher to student. The most intuitive yet effective approach is to match the probabilistic prediction (response) scores between the teacher and student via Kullback-Leibler (KL) divergence [16]. In this way, the student can be guided with more informative signals during training, and is thus expected to have more promising performance than that being trained stand-alone. Besides this vanilla prediction match, other works [11, 14, 34, 41] also investigate the knowledge within intermediate representations to further boost the distillation performance, but this usually induces additional training cost as a consequence. For example, OFD [14] proposes to distill the information via multiple intermediate layers, but requires additional convolutions for feature alignments; CRD [41] introduces a contrastive loss to transfer pair-wise relationships, but it needs to hold a memory bank for all 128-d features of ImageNet images, and produces additional 260M FLOPs of computation cost. + +![](images/ba80e767e3a62253c273170644dcaf008f4cc01165d6659cdbf7c02c04a23bd4.jpg) +(a) Stronger model sizes + +![](images/4c45f073b7b100c5782fe20947f4ee17e0b7842f019593e16218581555afb24f.jpg) +(b) Stronger strategies +Figure 1: Comparisons of KD and our proposed DIST on ImageNet with different teachers. (a) The ResNet-18 students are trained using baseline strategy with different model sizes of the teacher. (b) The ResNet-18 students are trained using different strategies with ResNet-50 teachers. + +Recently, a few studies [8, 29, 39] have been performed to address the poor learning issue of the student network when the student and teacher model sizes significantly differ. For example, TAKD [29] proposes to reduce the discrepancy of teacher and student by resorting to an additional teaching assistant of moderate model size; DGKD [39] further improves TAKD by densely gathering all the assistant models to guide the student. However, increasing the model size is only one of the popular approaches to have a stronger teacher. There lacks a thorough analysis on the training strategies to derive a stronger teacher and their effect on KD. Most importantly, a generic enough solution is preferred to address the difficulty of KD brought by stronger teachers, rather than struggling to deal with different types of stronger teachers (with larger model size or stronger training strategy) individually. + +To understand what makes a stronger teacher and their effect on KD, we systematically study the prevalent strategies for designing and training deep neural networks, and show that: + +- Beyond scaling up the model size, a stronger teacher can also be derived through advanced training strategies, e.g., label smoothing and data augmentation [51]. However, given a stronger teacher, the student's performance on the vanilla KD could be dropped, even worse than training from scratch without KD, as shown in Figure 1. +- The discrepancy between teacher and student tends to get fairly larger when we switch their training strategy to a stronger one (see Figure 2). In this case, an exact recovery of predictions via KL divergence could be challenging and lead to the failure of vanilla KD. +- Preserving the relation of predictions between teacher and student is sufficient and effective. When transferring the knowledge from teacher to student, what we really care about is preserving the preference (relative ranks of predictions) by the teacher, instead of recovering the absolute values accurately. Correlation between teacher and student predictions could be favored to relax the exact match of KL divergence and distill the intrinsic relations. + +In this paper, we thus leverage the Pearson correlation coefficient [33] as a new match manner to replace the KL divergence. In addition, besides the inter-class relations in prediction vector (see Figure 3), with the intuition that different instances have different spectrum of similarities with respect to each class, we also propose to distill the intra-class relations for further boosting the performance as Figure 3. Concretely, for each class, we gather its corresponding predicted probabilities of all instances in a batch, then transfer this relation from teacher to student. Our proposed method (dubbed DIST) is super simple, efficient, and practical, which can be implemented with only several lines of code (see Appendix A.1) and has almost the same training cost as the vanilla KD. As a result, the student can be liberated from the burden of matching the exact output of a strong teacher, but only be guided appropriately to distill those truly informative relations. + +Extensive experiments are conducted on benchmark datasets to verify our effectiveness on various tasks, including image classification, object detection, and semantic segmentation. Experimental results show that our DIST significantly outperforms vanilla KD and those sophisticatedly-designed state-of-the-art KD methods. For example, with the same baseline settings on ImageNet, our DIST + +![](images/1b2bb368d3589c2aaa587e5ee9e56eab616f2b316f463db00509dd5612398e6e.jpg) +(a) KL div. $(\tau = 1)$ + +![](images/8108c4ee7ebb703f3b43c80ff172f6c22b7896ad780a078cd640313e72bb1cd9.jpg) +(b) KL div. $(\tau = 4)$ +Figure 2: Discrepancy between the predictions of models trained standalone with different strategies on ImageNet validation set. $R18B1$ represents ResNet-18 trained with strategy B1 for instance. Details of training strategies B1 and B2 refer to Table 1. + +achieves the highest $72.07\%$ accuracy on ResNet-18. With the stronger strategy, our method obtains $82.3\%$ accuracy on the recent transformer Swin-T [27], improving KD by $1\%$ . + +# 2 Revisiting Prediction Match of KD + +In vanilla knowledge distillation [16], the knowledge is transferred from a pre-trained teacher model to a student model by minimizing the discrepancy between the prediction scores of the teacher and student models. + +Formally, with the logits $Z^{(\mathrm{s})} \in \mathbb{R}^{B \times C}$ and $Z^{(\mathrm{t})} \in \mathbb{R}^{B \times C}$ of student and teacher networks, where $B$ and $C$ denote batch size and the number of classes, respectively, the vanilla KD loss [16] is represented as + +$$ +\mathcal {L} _ {\mathrm {K D}} := \frac {\tau^ {2}}{B} \sum_ {i = 1} ^ {B} \operatorname {K L} \left(\boldsymbol {Y} _ {i,:} ^ {(t)}, \boldsymbol {Y} _ {i,:} ^ {(s)}\right) = \frac {\tau^ {2}}{B} \sum_ {i = 1} ^ {B} \sum_ {j = 1} ^ {C} Y _ {i, j} ^ {(t)} \log \left(\frac {Y _ {i , j} ^ {(t)}}{Y _ {i , j} ^ {(s)}}\right), \tag {1} +$$ + +where KL refers to Kullback-Leibler divergence with + +$$ +\boldsymbol {Y} _ {i,:} ^ {\mathrm {(s)}} = \operatorname {s o f t m a x} \left(\boldsymbol {Z} _ {i,:} ^ {\mathrm {(s)}} / \tau\right), \quad \boldsymbol {Y} _ {i,:} ^ {\mathrm {(t)}} = \operatorname {s o f t m a x} \left(\boldsymbol {Z} _ {i,:} ^ {\mathrm {(t)}} / \tau\right), \tag {2} +$$ + +being the probabilistic prediction vectors, and $\tau$ is the temperature factor to control the softness of logits. + +In addition to the teacher's soft targets in Eq.(1), KD [16] stated that it is beneficial to train the student together with ground-truth labels, and the overall training loss is composed of the original classification loss $\mathcal{L}_{\mathrm{cls}}$ and KD loss $\mathcal{L}_{\mathrm{KD}}$ , i.e., + +$$ +\mathcal {L} _ {\mathrm {t r}} = \alpha \mathcal {L} _ {\mathrm {c l s}} + \beta \mathcal {L} _ {\mathrm {K D}}, \tag {3} +$$ + +where $\mathcal{L}_{\mathrm{cls}}$ is usually the cross-entropy loss between the predictions of student network and ground-truth labels, $\alpha$ and $\beta$ are factors for balancing the losses. + +# 2.1 Catastrophic discrepancy with a stronger teacher + +As illustrated in Section 1, the effect of a teacher on KD has not been sufficiently investigated, especially when the performance of pre-trained teacher grows stronger, such as with larger model size or being trained with more advanced and competing strategies, e.g., label smoothing, mix-up [51], auto augmentations [9], etc. With this regard, as Figure 2, we train ResNet-18 and ResNet-50 standalone with strategy B1 and strategy $\mathrm{B}2^{2}$ , and obtain 4 trained models (R18B1, R18B2, R50B1, and R50B2 with accuracies $69.76\%$ , $73.4\%$ , $76.13\%$ , and $78.5\%$ , respectively), then compare their discrepancy using KL divergence ( $\tau = 1$ and $\tau = 4$ ) on the predicted probabilities $\mathbf{Y}$ . We have the following observations: + +![](images/24b6d5b102f22703c8922dc1529e503af435dce074b4c43a1c29e92f937c8768.jpg) + +![](images/e2c710e0daeb5498e048c92fca9cc39c38d4d9023cde7f4f8e2bf081ef85a68a.jpg) +Figure 3: Difference between our DIST and existing KD methods. Conventional KD matches the outputs of student $(s\in \mathbb{R}^5)$ to teacher $(t\in \mathbb{R}^5)$ point-wisely; instance relation methods operate on the feature level and measure the internal correlations (corr.) between instances in student and teacher separately, then transfer the teacher's correlations to student. Our DIST proposes to maintain the inter-class and intra-class relations between student and teacher. Inter-class relation: correlation between the predicted probabilistic distributions on each instance of teacher and student. Intra-class relation: correlation of the probabilities of all the instances on each class. + +![](images/844834fd0188414cf44b1a4dcfc768ef68ccf5ed126a70288099f4a41a54fad7.jpg) +Conventional KD + +![](images/2a35c647ed98fc799df337c5fc02d3c752f4dbd43e83113c0aeafac3c525bead.jpg) +Instance Relation + +![](images/2e5e658d4018b585544e1cc2d7f6f397219378c1cdc6b9808507fcd954847b55.jpg) +Our DIST +Inter-class Relation + +![](images/5c0c95ca077d51547fc1bf94347fd62ced3ffb5646736e67d53673d454ae7895.jpg) +Intra-class Relation + +- The outputs of ResNet-18 do not change much with the stronger strategy compared to ResNet-50. This implies that the representational capacity limits the student's performance, and it tends to be fairly challenging for the student to exactly match the teacher's outputs as their discrepancy becomes larger. +- When the teacher and student models are trained with a stronger strategy, the discrepancy between teacher and student would be larger. This indicates that when we adopt KD with a stronger training strategy, the misalignment between KD loss and classification loss would be severer, thus disturbing the student's training. + +As a result, the exact match (i.e., the loss reaches the minimal if and only if the teacher and student outputs are exactly identical) with KL divergence seems way too overambitious and demanding since the discrepancy between student and teacher can be considerably huge. Since the exact match can be detrimental with a stronger teacher, our intuition is to develop a relaxed manner for matching the predictions between the teacher and student. + +# 3 DIST: Distillation from A Stronger Teacher + +# 3.1 Relaxed match with relations + +The prediction scores indicate the teacher's confidence (or preference) over all classes. For a relaxed match of predictions between the teacher and student, we are motivated to consider what we really care about for the teacher's output. Instead of the exact probabilistic values, actually, during inference, we are only concerned about their relations, i.e., relative ranks of predictions of teacher. + +In this way, for some metric $d(\cdot ,\cdot)$ with $\mathbb{R}^C\times \mathbb{R}^C\to \mathbb{R}^+$ , the exact match can be formulated that $d(\pmb {a},\pmb {b}) = 0$ if $\pmb {a} = \pmb{b}$ for any two prediction vectors as $\mathbf{Y}_{i,:}^{(\mathrm{s})}$ and $\mathbf{Y}_{i,:}^{(\mathrm{t})}$ in the KL divergence of Eq.(1). Then as a relaxed match, we can introduce additional mappings $\phi (\cdot)$ and $\psi (\cdot)$ with $\mathbb{R}^C\rightarrow \mathbb{R}^C$ such that + +$$ +d (\phi (\boldsymbol {a}), \psi (\boldsymbol {b})) = d (\boldsymbol {a}, \boldsymbol {b}), \forall \boldsymbol {a}, \boldsymbol {b} \tag {4} +$$ + +Therefore, $d(\pmb{a}, \pmb{b}) = 0$ does not necessarily require $\pmb{a}$ and $\pmb{b}$ should be exactly the same. Nevertheless, since we care about the relation within $\pmb{a}$ or $\pmb{b}$ , the mappings $\phi$ and $\psi$ should be isotone and do not affect the semantic information and inference result of the prediction vector. + +With this regard, a simple yet effective choice for the isotone mapping is the positive linear transformation, namely, + +$$ +d \left(m _ {1} \boldsymbol {a} + n _ {1}, m _ {2} \boldsymbol {b} + n _ {2}\right) = d (\boldsymbol {a}, \boldsymbol {b}), \tag {5} +$$ + +where $m_{1}, m_{2}, n_{1}$ , and $n_{2}$ are constants with $m_{1} \times m_{2} > 0$ . As a result, this match could be invariant under separate changes in scale and shift for the predictions. Actually, to satisfy the property Eq.(5), we can thus adopt the widely-used Pearson's distance as the metric, i.e., + +$$ +d _ {\mathrm {p}} (\boldsymbol {u}, \boldsymbol {v}) := 1 - \rho_ {\mathrm {p}} (\boldsymbol {u}, \boldsymbol {v}). \tag {6} +$$ + +$\rho_{\mathrm{p}}(\boldsymbol {u},\boldsymbol {v})$ is the Pearson correlation coefficient between two random variables $\boldsymbol{u}$ and $\boldsymbol{v}$ , + +$$ +\rho_ {\mathrm {p}} (\boldsymbol {u}, \boldsymbol {v}) := \frac {\operatorname {C o v} (\boldsymbol {u} , \boldsymbol {v})}{\operatorname {S t d} (\boldsymbol {u}) \operatorname {S t d} (\boldsymbol {v})} = \frac {\sum_ {i = 1} ^ {C} \left(u _ {i} - \bar {u}\right) \left(v _ {i} - \bar {v}\right)}{\sqrt {\sum_ {i = 1} ^ {C} \left(u _ {i} - \bar {u}\right) ^ {2} \sum_ {i = 1} ^ {C} \left(v _ {i} - \bar {v}\right) ^ {2}}} \tag {7} +$$ + +where $\operatorname{Cov}(\pmb{u},\pmb{v})$ is the covariance of $\pmb{u}$ and $\pmb{v}$ , $\bar{u}$ and $\operatorname{Std}(\pmb{u})$ denote the mean and standard derivation of $\pmb{u}$ , respectively. + +In this way, we can define the relation as correlation. More specifically, and the original exact match in vanilla KD [16] can thus be relaxed and replaced by maximizing the linear correlation to preserve the relation of teacher and student on the probabilistic distribution of each instance, which we call inter-class relation. Formally, for each pair of prediction vector $\mathbf{Y}_{i,:}^{(\mathrm{s})}$ and $\mathbf{Y}_{i,:}^{(\mathrm{t})}$ , the inter-relation loss can be formulated as + +$$ +\mathcal {L} _ {\text {i n t e r}} := \frac {1}{B} \sum_ {i = 1} ^ {B} d _ {\mathrm {p}} \left(\boldsymbol {Y} _ {i,:} ^ {(\mathrm {s})}, \boldsymbol {Y} _ {i,:} ^ {(\mathrm {t})}\right). \tag {8} +$$ + +Some isotone mappings or metrics can also be used to relax the match as Eq.(4), such as cosine similarity investigated empirically in Section 4.5; other more advanced and delicate choices could be left as future work. + +# 3.2 Better distillation with intra-relations + +Besides the inter-class relation, where we transfer the relation of multiple classes in each instance, the prediction scores of multiple instances in each class are also informative and useful. This scores indicate the similarities of multiple instances to one class. For instance, suppose we have three images containing "cat", "dog", and "plane", respectively, and they have three prediction scores on the 'cat' class, denoted as $e$ , $f$ , and $g$ . Generally, the picture "cat" should have the largest score to the "cat" class, while the "plane" should have the smallest score since it is inanimate. This relation of " $e > f > g$ " could also be transferred to the student. Besides, even for the images from the same class, the intrinsic intra-class variance of the semantic similarities is actually also informative. It indicates the prior from the teacher that which one is more reliable to cast in this class. + +Therefore, we also encourage to distill this intra-relation for better performance. Actually, define prediction matrix $\mathbf{Y}^{(\mathrm{s})}$ and $\mathbf{Y}^{(\mathrm{t})}$ with each row as $\mathbf{Y}_{i,:}^{(\mathrm{s})}$ and $\mathbf{Y}_{i,:}^{(\mathrm{t})}$ , then the above inter-relation is to maximize the correlation row-wisely (see Figure 3). In contrast, for intra-relation, the corresponding loss is thus to maximize the correlation column-wisely, i.e., + +$$ +\mathcal {L} _ {\text {i n t r a}} := \frac {1}{C} \sum_ {j = 1} ^ {C} d _ {\mathrm {p}} \left(\boldsymbol {Y} _ {:, j} ^ {(\mathrm {s})}, \boldsymbol {Y} _ {:, j} ^ {(\mathrm {t})}\right). \tag {9} +$$ + +As a result, the overall training loss $\mathcal{L}_{\mathrm{tr}}$ can be composed of the classification loss, inter-class KD loss, and intra-class KD loss, i.e., + +$$ +\mathcal {L} _ {\mathrm {t r}} = \alpha \mathcal {L} _ {\mathrm {c l s}} + \beta \mathcal {L} _ {\text {i n t e r}} + \gamma \mathcal {L} _ {\text {i n t r a}}, \tag {10} +$$ + +where $\alpha$ , $\beta$ , and $\gamma$ are factors for balancing the losses. In this way, via the relation loss, we have endowed the student with freedom more or less to match the teacher network's output adaptively, thus boosting the distillation performance to a great extent. + +Table 1: Training strategies on image classification tasks. BS: batch size; LR: learning rate; WD: weight decay; LS: label smoothing; EMA: model exponential moving average; RA: RandAugment [9]; RE: random erasing; CJ: color jitter. + +
StrategyDatasetEpochsTotal BSInitial LROptimizerWDLSEMALR schedulerData augmentation
A1CIFAR-100240640.05SGD5 × 10-4--×0.1 at 150,180,210 epochscrop + flip
B1ImageNet1002560.1SGD1 × 10-4--×0.1 every 30 epochscrop + flip
B2ImageNet4507680.048RMSProp1 × 10-50.10.9999×0.97 every 2.4 epochs{B1} + RA + RE
B3ImageNet30010245e-4AdamW5 × 10-20.1-cosine{B2} + CJ + Mixup + CutMix
+ +Table 2: Evaluation results of baseline settings on ImageNet. We use ResNet-34 and ResNet-50 released by Torchvision [28] as our teacher networks, and follow the standard training strategy (B1). + +
Student (teacher)TeacherStudentKD [16]OFD [14]CRD [41]SRRL [47]Review [7]DIST
ResNet-18 (ResNet-34)Top-173.3169.7670.6671.0871.1771.7371.6172.07
Top-591.4289.0889.8890.0790.1390.6090.5190.42
MobileNet (ResNet-50)Top-176.1670.1370.6871.2571.3772.4972.5673.24
Top-592.8689.4990.3090.3490.4190.9291.0091.12
+ +# 4 Experiments + +# 4.1 Experimental settings + +Training strategies. The training strategies of image classification task are summarized in Table 1. CIFAR-100. For fair comparisons, we use the same training strategies (referred to $AI$ in Table 1) and pretrained models following CRD [41]. ImageNet. B1: for comparisons with previous KD methods, we train our baselines with the same simple training strategy as CRD [41]. B2: to validate the effectiveness of KD methods on modern training strategies, we follow EfficientNet [40] and design a training strategy B2, which can significantly improve the performance compared to B1. B3: the strategy B3 is used for training Swin-Transformers [27], and contains even more stronger data augmentations and regularization. + +Loss weights. On CIFAR-100 and ImageNet, we set $\alpha = 1$ , $\beta = 2$ , and $\gamma = 2$ in Eq.(10). On object detection and semantic segmentation, these three factors are all equal to 1. For KD [16], we set $\alpha = 0.9$ , $\beta = 1$ in Eq.(3), and use a default temperature $\tau = 4$ . Specifically, instead of using $\tau = 1$ on ImageNet, we choose a larger temperature $\tau = 4$ on CIFAR-100, as it is easy to get overfit and the learned probabilistic distribution is sharp on CIFAR-100. + +# 4.2 Image Classification + +Baseline results on ImageNet. We first compare our method with prior works using the baseline settings. As shown in Table 2, our DIST significantly outperforms prior KD methods. Note that our method is only conducted on the outputs of models, and has a similar computational cost as KD [16]. Nevertheless, it even achieves better performance compared to those sophisticatedly-designed methods. For example, CRD [41] needs to preserve a memory bank for all 128-d features of ImageNet images, and produces additional 260M FLOPs of computation cost; SRRL [47] and Review [7] require additional convolutions for feature alignments. The implementation of DIST can be found in Appendix A.1, which is quite simple compared to these methods. + +Distillation from stronger teacher models. As the stronger teachers come from larger model sizes and stronger strategies, we here first conduct experiments to compare our DIST with the vanilla KD on different scales (model sizes) of ResNets with baseline strategy B1. As shown in Table 3, when the teacher goes larger, the ResNet-18 students perform even worse than that with a medium-sized ResNet-50 teacher. Nevertheless, our DIST shows an upward trend with larger teachers, and the improvements compared to KD also become more significant, indicating that our DIST tackles better on the large discrepancy between the student and larger teacher. + +Distillation from stronger training strategies. Recently, the performance of models on ImageNet has been significantly improved by the sophisticated training strategies and strong data augmentations + +Table 3: Performance of ResNet-18 and ResNet-34 on ImageNet with different sizes of teachers. + +
StudentTeacherTop-1 ACC (%)
studentteacherKDDIST
ResNet-18ResNet-3469.7673.3171.2172.07 (+0.86)
ResNet-5076.1371.3572.12 (+0.77)
ResNet-10177.3771.0972.08 (+0.99)
ResNet-15278.3171.1272.24 (+1.12)
ResNet-34ResNet-5073.3176.1374.7375.06 (+0.33)
ResNet-10177.3774.8975.36 (+0.47)
ResNet-15278.3174.8775.42 (+0.55)
+ +Table 4: Performance of students trained with strong strategies on ImageNet. The Swin- $T$ is trained with strategy B3 in Table 1, others are trained with B2. $\dagger$ : trained by [44]. $\ddagger$ : Pretrained on ImageNet-22K. + +
TeacherStudentTop-1 ACC (%)
teacherstudentKD [16]RKD [30]SRRL [47]DIST
ResNet-50†ResNet-1880.173.472.672.971.274.5
ResNet-3476.877.276.676.777.8
MobileNetV273.671.773.169.274.4
EfficientNet-B078.077.477.577.378.6
Swin-L‡ResNet-5086.378.580.078.978.680.2
Swin-T81.381.581.281.582.3
+ +(e.g., TIMM [44] achieves $80.4\%$ accuracy on ResNet-50 while the baseline strategy B1 only obtains $76.1\%$ ). However, most of the KD methods still conduct experiments with simple training settings. It is seldomly investigated whether the KD methods are suitable to the advanced strategies. In this way, we conduct experiments with advanced training strategies and compare our method with vanilla KD, instance relation-based RKD [30], and SRRL [47]. + +We first train traditional CNNs with strong strategies, and also use a strong ResNet-50 with $80.1\%$ accuracy trained by [44] as the teacher. As results shown in Table 4, on both similar architectures (ResNet-18, ResNet-34) and dissimilar architectures (MobileNetV2, EfficientNet-B0), our DIST can achieve the best performance. Note that RKD and SRRL can perform worse than training from scratch, especially when the students are small (ResNet-18 and MobileNet) or the architectures of teacher and student are fairly different (ResNet-50 and Swin-L), this might be because they focus on the intermediate features, which can be more challenging for the student to recover teacher's features compared to predictions. + +Furthermore, we experiment on the recent state-of-the-art Swin-Transformer [27]. The results show that our DIST gains improvements on even more stronger models and strategies. For example, with Swin-L teacher, our method improves ResNet-50 and Swin-T by $1.7\%$ and $1.0\%$ , respectively. + +CIFAR-100. The results on CIFAR-100 dataset in Table 5 show that, by distilling on the predicted logits, our method even outperforms those sophisticatedly-designed feature distillation methods. + +# 4.3 Object Detection + +We further investigate the effectiveness of DIST on downstream tasks. We conduct experiments on MS COCO object detection dataset [25], and simply leverage our DIST as an additional supervision on the final predictions of classes. Following [37, 52], we use the same standard training strategies and utilize Cascade Mask R-CNN [2] with ResNeXt-101 backbone as the teacher for two-stage student of Faster R-CNN [23] with ResNet-50 backbone; while for one-stage RetinaNet [24] with ResNet-50 backbone, the RetinaNet with ResNeXt-101 backbone is utilized as the teacher. + +As shown in Table 6, our DIST achieves competitive results on COCO validation set. For comparisons, we train the vanilla KD under the same settings as our DIST, the results show that our DIST significantly outperforms vanilla KD by simply replacing the loss functions. Moreover, by combining + +Table 5: Evaluation results on CIFAR-100 dataset. The upper and lower models denote teacher and student, respectively. + +
MethodSame architecture styleDifferent architecture style
WRN-40-2ResNet-56ResNet-32x4ResNet-50ResNet-32x4ResNet-32x4
WRN-40-1ResNet-20ResNet-8x4MobileNetV2ShuffleNetV1ShuffleNetV2
Teacher75.6172.3479.4279.3479.4279.42
Student71.9869.0672.5064.670.571.82
Feature-based methods
FitNet [35]72.24±0.2469.21±0.3673.50±0.2863.16±0.4773.59±0.1573.54±0.22
VID [1]73.30±0.1370.38±0.1473.09±0.2167.57±0.2873.38±0.0973.40±0.17
RKD [30]72.22±0.2069.61±0.0671.90±0.1164.43±0.4272.28±0.3973.21±0.28
PKT [31]73.45±0.1970.34±0.0473.64±0.1866.52±0.3374.10±0.2574.69±0.34
CRD [41]74.14±0.2271.16±0.1775.51±0.1869.11±0.2875.11±0.3275.65±0.10
Logits-based methods
KD [16]73.54±0.2070.66±0.2473.33±0.2567.35±0.3274.07±0.1974.45±0.27
DIST74.73±0.2471.75±0.3076.31±0.1968.66±0.2376.34±0.1877.35±0.25
+ +Table 6: Results on COCO validation set. T: teacher; S: student. $\ast$ : We implement KD using $\tau = 1$ and other settings are the same as DIST. + +
MethodAP\( AP_{50} \)\( AP_{75} \)\( AP_S \)\( AP_M \)\( AP_L \)
Two-stage detectors
T: Cascade Mask RCNN-X10145.664.149.726.249.660.0
S: Faster RCNN-R5038.459.042.021.542.150.3
KD [16]*39.761.243.023.243.351.7
FKD [52]41.562.245.123.545.055.3
CWD [37]41.762.045.523.345.555.5
DIST40.461.743.823.944.652.6
DIST + mimic41.862.445.623.446.155.0
One-stage detectors
T: RetinaNet-X10141.060.944.023.945.254.0
S: RetinaNet-R5037.456.739.620.040.749.7
KD [16]*37.256.539.320.440.449.5
FKD [52]39.658.842.122.743.352.5
CWD [37]40.860.443.422.744.555.3
DIST39.859.542.522.043.753.0
DIST + mimic40.159.443.023.244.053.6
+ +Table 7: Results on Cityscapes val dataset. All models are pretrained on ImageNet. + +
MethodmIoU (%)
T: DeepLabV3-R10178.07
S: DeepLabV3-R1874.21
SKD [26]75.42
IFVD [43]75.59
CWD [37]75.55
CIRKD [46]76.38
DIST77.10
S: PSPNet-R1872.55
SKD [26]73.29
IFVD [43]73.71
CWD [37]74.36
CIRKD [46]74.73
DIST76.31
+ +DIST with mimic, which minimizes the mean square error between FPN features of teacher and student, we can even outperform the state-of-the-art KD methods designed for object detection. + +# 4.4 Semantic Segmentation + +We also perform experiments on semantic segmentation, a challenging dense prediction task. Following [37, 43, 46], we train DeepLabV3 [6] and PSPNet [54] with ResNet-18 backbone on Cityscapes dataset, and adopt our DIST on the predictions of classification head using a teacher with ResNet-101 backbone of DeepLabV3. As the results summarized in Table 7, with only the supervision of class predictions, our DIST can significantly outperform existing knowledge distillation methods on semantic segmentation task. For example, our DIST outperforms recent state-of-the-art method CIRKD [46] by $1.58\%$ on PSPNet-R18. This demonstrate our effectiveness on relation modeling. + +# 4.5 Ablation studies + +Effects of inter-class and intra-class correlations. This paper proposes two types of relations: inter-class and intra-class relations. To validate the effectiveness of each relation, we conduct experiments to train students with these relations separately. The results on Table 8 verify that, both inter-class and intra-class relations can outperform the vanilla KD; also, the performance could be further boosted by combining them together. + +Table 8: Ablation of inter-class and intra-class relations on ImageNet. The student and teacher models are ResNet-18 and ResNet-34, respectively. + +
MethodInterIntraACC (%)
KD--71.21
DIST (KL div.)×✓70.61
DIST (KL div.)✓✓71.62
DIST✓×71.63
DIST×✓71.55
DIST✓✓72.07
+ +Effect of intra-class relation in vanilla KD. To investigate the effectiveness of intra-class relation in vanilla KD, we adopt experiments to train our DIST using KL divergence as the relation metric, denoted as $\text{DIST}(\text{KL div.})^3$ . As the results summarized in Table 8, adding intra-class relation in the vanilla KD can also improve the performance (from $71.21\%$ to $71.62\%$ ). However, when the student is trained with intra-class relation only, the improvement of using KL divergence is less significant than using Pearson correlation (70.61% vs. 71.55%), since the means and variances of intra-class distributions could be varied. + +Effect of training students with KD loss only. Training student with only the KD loss can better reflect the distillation ability and the information richness of supervision signals. As results in Table 9 show that, when the student is trained with only the KD loss, our DIST significantly outperforms the vanilla KD. Without using the ground-truth labels, it can even outperform the standalone training accuracy, which indicates the effectiveness of our DIST in distilling those truly-beneficial relations. + +Table 9: Comparisons of training KD with or without the classification loss on ImageNet. The student and teacher models are ResNet-18 and ResNet-34, respectively. The original accuracy of ResNet-18 without KD is $69.76\%$ . + +
Methodw/ cls. lossw/o cls. loss
KD71.2168.12
DIST72.0770.65
+ +More ablation studies can be found in Section A.3. + +# 5 Conclusion + +This paper presents a new knowledge distillation (KD) method named DIST to implement better distillation from a stronger teacher. We empirically study the catastrophic discrepancy problem between the student and a stronger teacher, and propose a relation-based loss to relax the exact match of KL divergence in a linear sense. Our method DIST is simple yet effective in handling strong teachers. Extensive experiments show our superiority in various benchmark tasks. For example, DIST even outperforms state-of-the-art KD methods designed specifically for object detection and semantic segmentation. + +# Acknowledgements + +This work was supported in part by the Australian Research Council under Project DP210101859 and the University of Sydney Research Accelerator (SOAR) Prize. + +# References + +[1] S. Ahn, S. X. Hu, A. Damianou, N. D. Lawrence, and Z. Dai. Variational information distillation for knowledge transfer. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9163-9171, 2019. 8 +[2] Z. Cai and N. Vasconcelos. Cascade r-cnn: High quality object detection and instance segmentation. IEEE Transactions on Pattern Analysis and Machine Intelligence, page 1-1, 2019. 1, 7 +[3] K. Chandrasegaran, N.-T. Tran, Y. ZHAO, and N. man Cheung. To smooth or not to smooth? on compatibility between label smoothing and knowledge distillation, 2022. 14 +[4] H. Chen, Y. Wang, C. Xu, C. Xu, and D. Tao. Learning student networks via feature embedding. IEEE Transactions on Neural Networks and Learning Systems, 32(1):25-35, 2020. 13 +[5] L.-C. Chen, G. Papandreou, F. Schroff, and H. Adam. Rethinking atrous convolution for semantic image segmentation. arXiv preprint arXiv:1706.05587, 2017. 1 +[6] L.-C. Chen, Y. Zhu, G. Papandreou, F. Schroff, and H. Adam. Encoder-decoder with atrous separable convolution for semantic image segmentation. In Proceedings of the European conference on computer vision (ECCV), pages 801-818, 2018. 8 +[7] P. Chen, S. Liu, H. Zhao, and J. Jia. Distilling knowledge via knowledge review. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 5008-5017, 2021. 6 +[8] J. H. Cho and B. Hariharan. On the efficacy of knowledge distillation. In Proceedings of the IEEE/CVF international conference on computer vision, pages 4794-4802, 2019. 2 +[9] E. D. Cubuk, B. Zoph, J. Shiens, and Q. V. Le. Randaugment: Practical automated data augmentation with a reduced search space. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops, pages 702-703, 2020. 3, 6 +[10] Y. Dodge. The concise encyclopedia of statistics. Springer Science & Business Media, 2008. 13 +[11] S. Du, S. You, X. Li, J. Wu, F. Wang, C. Qian, and C. Zhang. Agree to disagree: Adaptive ensemble knowledge distillation in gradient space. advances in neural information processing systems, 33:12345-12355, 2020. 1 +[12] J. Gou, B. Yu, S. J. Maybank, and D. Tao. Knowledge distillation: A survey. International Journal of Computer Vision, 129(6):1789-1819, 2021. +[13] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770-778, 2016. 1 +[14] B. Heo, J. Kim, S. Yun, H. Park, N. Kwak, and J. Y. Choi. A comprehensive overhaul of feature distillation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 1921-1930, 2019. 1, 6 +[15] B. Heo, M. Lee, S. Yun, and J. Y. Choi. Knowledge transfer via distillation of activation boundaries formed by hidden neurons. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 3779-3787, 2019. +[16] G. Hinton, O. Vinyals, and J. Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015. 1, 3, 5, 6, 7, 8, 14 +[17] A. G. Howard, M. Zhu, B. Chen, D. Kalenichenko, W. Wang, T. Weyand, M. Andreetto, and H. Adam. Mobilenets: Efficient convolutional neural networks for mobile vision applications. arXiv preprint arXiv:1704.04861, 2017. 1 +[18] T. Huang, Z. Li, H. Lu, Y. Shan, S. Yang, Y. Feng, F. Wang, S. You, and C. Xu. Relational surrogate loss learning. In International Conference on Learning Representations, 2022. +[19] T. Huang, S. You, B. Zhang, Y. Du, F. Wang, C. Qian, and C. Xu. Dyrep: Bootstrapping training with dynamic re-parameterization. arXiv preprint arXiv:2203.12868, 2022. 1 +[20] M. G. Kendall. A new measure of rank correlation. Biometrika, 30(1/2):81-93, 1938. 13 +[21] J. Kim, S. Park, and N. Kwak. Paraphrasing complex network: Network compression via factor transfer. arXiv preprint arXiv:1802.04977, 2018. +[22] S. Kong, T. Guo, S. You, and C. Xu. Learning student networks with few data. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 4469-4476, 2020. +[23] T.-Y. Lin, P. Dólár, R. Girshick, K. He, B. Hariharan, and S. Belongie. Feature pyramid networks for object detection. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2117-2125, 2017. 1, 7 +[24] T.-Y. Lin, P. Goyal, R. Girshick, K. He, and P. Dollar. Focal loss for dense object detection. In Proceedings of the IEEE international conference on computer vision, pages 2980-2988, 2017. 7 + +[25] T.-Y. Lin, M. Maire, S. Belongie, J. Hays, P. Perona, D. Ramanan, P. Dollár, and C. L. Zitnick. Microsoft coco: Common objects in context. In European conference on computer vision, pages 740-755. Springer, 2014. 7 +[26] Y. Liu, C. Shu, J. Wang, and C. Shen. Structured knowledge distillation for dense prediction. IEEE transactions on pattern analysis and machine intelligence, 2020. 8 +[27] Z. Liu, Y. Lin, Y. Cao, H. Hu, Y. Wei, Z. Zhang, S. Lin, and B. Guo. Swin transformer: Hierarchical vision transformer using shifted windows. arXiv preprint arXiv:2103.14030, 2021. 3, 6, 7 +[28] S. Marcel and Y. Rodriguez. Torchvision the machine-vision package of torch. In Proceedings of the 18th ACM international conference on Multimedia, pages 1485-1488, 2010. 6 +[29] S. I. Mirzadeh, M. Farajtabar, A. Li, N. Levine, A. Matsukawa, and H. Ghasemzadeh. Improved knowledge distillation via teacher assistant. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 5191-5198, 2020. 2 +[30] W. Park, D. Kim, Y. Lu, and M. Cho. Relational knowledge distillation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 3967-3976, 2019. 7, 8, 13, 14 +[31] N. Passalis, M. Tzelepi, and A. Tefas. Probabilistic knowledge transfer for lightweight deep representation learning. IEEE Transactions on Neural Networks and Learning Systems, 32(5):2030-2039, 2020. 8 +[32] A. Paszke, S. Gross, F. Massa, A. Lerer, J. Bradbury, G. Chanan, T. Killeen, Z. Lin, N. Gimelshein, L. Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems, 32:8026-8037, 2019. 13 +[33] K. Pearson. VII. mathematical contributions to the theory of evolution.—iii. regression, heredity, and panmixia. Philosophical Transactions of the Royal Society of London. Series A, containing papers of a mathematical or physical character, (187):253-318, 1896. 2 +[34] B. Peng, X. Jin, J. Liu, D. Li, Y. Wu, Y. Liu, S. Zhou, and Z. Zhang. Correlation congruence for knowledge distillation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 5007-5016, 2019. 1, 13 +[35] A. Romero, N. Ballas, S. E. Kahou, A. Chassang, C. Gatta, and Y. Bengio. Fitnets: Hints for thin deep nets. arXiv preprint arXiv:1412.6550, 2014. 8 +[36] Z. Shen, Z. Liu, D. Xu, Z. Chen, K.-T. Cheng, and M. Savvides. Is label smoothing truly incompatible with knowledge distillation: An empirical study. In International Conference on Learning Representations, 2020. 14 +[37] C. Shu, Y. Liu, J. Gao, Z. Yan, and C. Shen. Channel-wise knowledge distillation for dense prediction. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 5311-5320, 2021. 7, 8 +[38] K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014. 1 +[39] W. Son, J. Na, J. Choi, and W. Hwang. Densely guided knowledge distillation using multiple teacher assistants. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 9395–9404, 2021. 2 +[40] M. Tan and Q. Le. Efficientnet: Rethinking model scaling for convolutional neural networks. In International Conference on Machine Learning, pages 6105-6114. PMLR, 2019. 6 +[41] Y. Tian, D. Krishnan, and P. Isola. Contrastive representation distillation. In International Conference on Learning Representations, 2019. 1, 6, 8, 14 +[42] F. Tung and G. Mori. Similarity-preserving knowledge distillation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 1365-1374, 2019. +[43] Y. Wang, W. Zhou, T. Jiang, X. Bai, and Y. Xu. Intra-class feature variation distillation for semantic segmentation. In European Conference on Computer Vision, pages 346-362. Springer, 2020. 8 +[44] R. Wightman, H. Touvron, and H. Jégou. Resnet strikes back: An improved training procedure in timm. arXiv preprint arXiv:2110.00476, 2021. 7 +[45] S. Xie, R. Girshick, P. Dollar, Z. Tu, and K. He. Aggregated residual transformations for deep neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1492-1500, 2017. 1 +[46] C. Yang, H. Zhou, Z. An, X. Jiang, Y. Xu, and Q. Zhang. Cross-image relational knowledge distillation for semantic segmentation. arXiv preprint arXiv:2204.06986, 2022. 8 +[47] J. Yang, B. Martinez, A. Bulat, and G. Tzimiropoulos. Knowledge distillation via softmax regression representation learning. In International Conference on Learning Representations, 2020. 6, 7, 14 +[48] S. You, T. Huang, M. Yang, F. Wang, C. Qian, and C. Zhang. Greedynas: Towards fast one-shot nas with greedy supernet. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1999-2008, 2020. 1 + +[49] S. You, C. Xu, C. Xu, and D. Tao. Learning from multiple teacher networks. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pages 1285–1294, 2017. +[50] S. Zagoruyko and N. Komodakis. Paying more attention to attention: Improving the performance of convolutional neural networks via attention transfer. arXiv preprint arXiv:1612.03928, 2016. +[51] H. Zhang, M. Cisse, Y. N. Dauphin, and D. Lopez-Paz. mixup: Beyond empirical risk minimization. In International Conference on Learning Representations, 2018. 2, 3 +[52] L. Zhang and K. Ma. Improve object detection with feature-based knowledge distillation: Towards accurate and efficient detectors. In International Conference on Learning Representations, 2020. 7, 8 +[53] X. Zhang, X. Zhou, M. Lin, and J. Sun. Shufflenet: An extremely efficient convolutional neural network for mobile devices. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 6848-6856, 2018. 1 +[54] H. Zhao, J. Shi, X. Qi, X. Wang, and J. Jia. Pyramid scene parsing network. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2881-2890, 2017. 1, 8 + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] See Appendix. +(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Appendix. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [N/A] +(b) Did you include complete proofs of all theoretical results? [N/A] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] Training details are provided in the paper. Training code and logs are released at GitHub: https://github.com/hunto/DIST_KD. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] Standard deviations on CIFAR-100 are reported. +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] +(b) Did you mention the license of the assets? [Yes] +(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] Code and training logs are included. +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/knowledgedistillationfromastrongerteacher/images.zip b/knowledgedistillationfromastrongerteacher/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..1e416a6be99af282b785a64662e44ba99536696b --- /dev/null +++ b/knowledgedistillationfromastrongerteacher/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:007e866b91f12284948a89bb561999623eba118ab6fd646786a5a1fe60a6c8ef +size 562644 diff --git a/knowledgedistillationfromastrongerteacher/layout.json b/knowledgedistillationfromastrongerteacher/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..76ef66854fa8214a3a24efc485a4f9a51ffeed7c --- /dev/null +++ b/knowledgedistillationfromastrongerteacher/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a46d1ef07372c13280eca0af78be21f5417105072fe400a9b708d047b7e41d8a +size 429959 diff --git a/knowledgedistillationimprovesgraphstructureaugmentationforgraphneuralnetworks/8c77516e-c444-4907-b474-5e6712cb233c_content_list.json b/knowledgedistillationimprovesgraphstructureaugmentationforgraphneuralnetworks/8c77516e-c444-4907-b474-5e6712cb233c_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..448563821c852726352679b2d8be23b9c696554e --- /dev/null +++ b/knowledgedistillationimprovesgraphstructureaugmentationforgraphneuralnetworks/8c77516e-c444-4907-b474-5e6712cb233c_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1d4413b2492d0e909daa632841bc9468b069aa1f2a6bc5116a095422e43a67a7 +size 81604 diff --git a/knowledgedistillationimprovesgraphstructureaugmentationforgraphneuralnetworks/8c77516e-c444-4907-b474-5e6712cb233c_model.json b/knowledgedistillationimprovesgraphstructureaugmentationforgraphneuralnetworks/8c77516e-c444-4907-b474-5e6712cb233c_model.json new file mode 100644 index 0000000000000000000000000000000000000000..bea6f1a1b9ab5b333078edd5ec46d2cc14f7c58a --- /dev/null +++ b/knowledgedistillationimprovesgraphstructureaugmentationforgraphneuralnetworks/8c77516e-c444-4907-b474-5e6712cb233c_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4bac85b039f9044d7445f8041a17dea14a8aa6439b6d6b2df221f13c7d33b6ea +size 101790 diff --git a/knowledgedistillationimprovesgraphstructureaugmentationforgraphneuralnetworks/8c77516e-c444-4907-b474-5e6712cb233c_origin.pdf b/knowledgedistillationimprovesgraphstructureaugmentationforgraphneuralnetworks/8c77516e-c444-4907-b474-5e6712cb233c_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..97ec7d19cddb13e1129da00487cb3914d008e016 --- /dev/null +++ b/knowledgedistillationimprovesgraphstructureaugmentationforgraphneuralnetworks/8c77516e-c444-4907-b474-5e6712cb233c_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0aa4b68cd81d6802a57a1d5e956da86909cd3e8173190b1a956c29821bf99ba8 +size 1165388 diff --git a/knowledgedistillationimprovesgraphstructureaugmentationforgraphneuralnetworks/full.md b/knowledgedistillationimprovesgraphstructureaugmentationforgraphneuralnetworks/full.md new file mode 100644 index 0000000000000000000000000000000000000000..b27ae90e0a7c77ff303f11cf55c86b366de4231e --- /dev/null +++ b/knowledgedistillationimprovesgraphstructureaugmentationforgraphneuralnetworks/full.md @@ -0,0 +1,298 @@ +# Knowledge Distillation Improves Graph Structure Augmentation for Graph Neural Networks + +Lirong Wu $^{1,2}$ , Haitao Lin $^{1,2}$ , Yufei Huang $^{1,2}$ , and Stan Z. Li + +$^{1}$ AI Lab, School of Engineering, Westlake University + +2 College of Computer Science and Technology, Zhejiang University + +{wulirong,lin Haitao,huangyufei,stan.zq.li}@westlake.edu.cn + +# Abstract + +Graph (structure) augmentation aims to perturb the graph structure through heuristic or probabilistic rules, enabling the nodes to capture richer contextual information and thus improving generalization performance. While there have been a few graph structure augmentation methods proposed recently, none of them are aware of a potential negative augmentation problem, which may be caused by overly severe distribution shifts between the original and augmented graphs. In this paper, we take an important graph property, namely graph homophily, to analyze the distribution shifts between the two graphs and thus measure the severity of an augmentation algorithm suffering from negative augmentation. To tackle this problem, we propose a novel Knowledge Distillation for Graph Augmentation (KDGA) framework, which helps to reduce the potential negative effects of distribution shifts, i.e., negative augmentation problem. Specifically, KDGA extracts the knowledge of any GNN teacher model trained on the augmented graphs and injects it into a partially parameter-shared student model that is tested on the original graph. As a simple but efficient framework, KDGA is applicable to a variety of existing graph augmentation methods and can significantly improve the performance of various GNN architectures. For three popular graph augmentation methods, namely GAUG, MH-Aug, and GraphAug, the experimental results show that the learned student models outperform their vanilla implementations by an average accuracy of $4.6\%$ (GAUG), $4.2\%$ (MH-Aug), and $4.6\%$ (GraphAug) on eight graph datasets. + +Codes are available at: https://github.com/LirongWu/KDGA. + +# 1 Introduction + +In many real-world applications, including social networks, chemical molecules, and citation networks, data can be naturally modeled as graphs. Recently, the emerging Graph Neural Networks (GNNs) [4, 13, 48, 47, 22, 24, 28, 29] have demonstrated their powerful capability due to their superior performance in various graph-related tasks, including link prediction [59], node classification [21, 50], and graph classification [7]. Despite their great success, GNNs usually suffer from weak generalization due to its heavy reliance on the quantity of annotated labels and the quality of the graph structure. To boost generalization capabilities, a natural solution is to increase the amount of training data by creating plausible variations of existing data, which have been widely adopted in fields such as computer vision [33, 30, 9, 39, 25, 31, 26, 27] and natural language processing [46, 1, 36, 5, 34]. + +The data augmentation on graphs can be mainly divided into two branches: node feature augmentation and graph structure augmentation. While the former has been well studied by directly extending existing approaches for image and text data to graph data [56, 19, 15], comparatively little work has been done to study graph structure augmentation [35, 2, 62, 32]. Following the nomenclature of existing works [62, 32], we directly abbreviate graph (structure) augmentation to graph augmentation + +for the sake of brevity in this paper. The purpose of graph augmentation is to reasonably perturb the graph structure through heuristic or probabilistic rules, enabling the nodes to capture richer contextual information and thus improving generalization performance. For example, $DropEdge$ [35] randomly removes a fraction of edges before each training epoch, in an approach reminiscent of dropout [40]. Besides, $AdaEdge$ [2] iteratively adds (removes) edges between nodes predicted to have the same (different) labels with high confidence. In contrast to these heuristic methods, GAUG [62] proposes to optimize the graph augmentation and GNN parameters in an end-to-end manner. Similarly, $MH-Aug$ [32] proposes a novel framework that draws a sequence of augmented graphs from an explicit target distribution, which enables flexible control of the strength and diversity of augmentation. + +In this paper, we identify a potential negative augmentation problem for existing graph augmentation methods, i.e., the augmentation may cause overly severe distribution shift between the augmented graphs used for training and the original graph used for testing, which leads to suboptimal generalization. Moreover, we conduct extensive experiments to demonstrate the existence and hazard of distribution shifts and find that the direction of distribution shifts may be opposed on homophily and heterophily graphs. We propose a solution to the identified problem by adopting a Knowledge Distillation for Graph Augmentation (KDGA) framework, which helps to reduce the potential negative effects of distribution shifts. Specifically, it extracts the knowledge of any GNN teacher model trained on the augmented graphs and injects it into a partially parameter-shared student model that is tested on the original graph. As a general framework, KDGA can significantly improve the vanilla implementations of various popular graph augmentation methods and GNN architectures. + +Our contributions are summarized as follows: (1) We are the first to identify a potential negative augmentation problem for graph augmentation, and more importantly, we have described in detail what it represents, how it arises, what impact it has, and how to deal with it. (2) We proposes a novel Knowledge Distillation for Graph Augmentation (KDGA) framework for the identified problem by directly distilling contextual information from augmented graphs. (3) We provide comprehensive experimental results showing that KDGA is applicable to a variety of graph augmentation methods and GNN models; it substantially outperforms the vanilla implementations across various datasets. + +# 2 Background and Related Work + +Structure Augmentation for Graphs. Data augmentation is an effective technique to improve generalization. Despite the great progress on node feature augmentation [56, 19, 15], comparatively little work study graph (structure) augmentation [35, 2, 62, 32, 6] due to the non-Euclidean property of structures. For graph data, the mainstream algorithms for structure augmentation are divided into two categories: heuristic and learning-based. As a typical heuristic algorithm, $DropEdge$ [35] randomly remove edges according to the hand-crafted probability. In a similar way, $AdaEdge$ [2] iteratively adds (removes) edges between nodes predicted to have the same (different) labels. Different from the above heuristic methods, GAUG [62] propose to optimize the graph augmentation and learnable GNN parameters in an end-to-end manner. Instead, $MH-Aug$ [32] proposes a sampling-based augmentation, where a sequence of augmented graphs are directly drawn from an explicit target distribution. + +Graph Structure Learning and Graph Contrastive Learning. Two closely related topics to graph augmentation are Graph Structure Learning [18, 23, 58, 20, 3] and Graph Contrastive Learning [19, 15, 57, 51, 63, 52], but they are quite different in terms of learning objectives and evaluation protocols. The learning goal of structure learning is to estimate a new structure with high quality [10, 8]. Instead, graph augmentation aims to reasonably perturb the graph structure during training to produce a set of augmented graphs, enabling nodes to receive richer contextual information; such augmentations allow the model to generalize better across those variations. As for the evaluation protocol, the augmented graphs are only used during training and are not available during testing. In contrast, for graph structure learning, the learned structure is used during both training and testing. + +There are also some recent works [41, 65, 55] exploring how to perform data augmentation for graph contrastive learning, but they focus on automatically selecting the most appropriate transformations from a given pool to improve contrastive learning, rather than learning customized augmentation strategies for GNNs. More importantly, graph contrastive learning aims to learn transferable knowledge from abundant unlabeled data in an unsupervised setting and then generalize the learned knowledge to downstream tasks. Instead, graph augmentation usually works in a semi-supervised + +setting, i.e., the label information is available during training. The graph structure learning and contrastive learning are not newly born topics, and we refer readers to the recent surveys [49, 64]. + +# 3 Preliminaries + +Notions. Given a graph $\mathcal{G} = (\mathcal{V},\mathcal{E})$ , where $\mathcal{V}$ is the set of $N = |\mathcal{V}|$ nodes with features $\mathbf{X} = [\mathbf{x}_1,\mathbf{x}_2,\dots ,\mathbf{x}_N]\in \mathbb{R}^{N\times d}$ and $\mathcal{E}$ denotes the edge set. Each node $v_{i}\in \mathcal{V}$ is associated with a $d$ -dimensional features vector $\mathbf{x}_i$ , and each edge $e_{i,j}\in \mathcal{E}$ denotes a connection between node $v_{i}$ and $v_{j}$ . The graph structure can also be denoted by an adjacency matrix $\mathbf{A}\in [0,1]^{N\times N}$ with $\mathbf{A}_{i,j} = 1$ if $e_{i,j}\in \mathcal{E}$ and $\mathbf{A}_{i,j} = 0$ if $e_{i,j}\notin \mathcal{E}$ . Consider a semi-supervised node classification task where only a subset of node $\nu_{L}$ with corresponding labels $\nu_{L}$ are known, we denote the labeled set as $\mathcal{D}_L = (\mathcal{V}_L,\mathcal{V}_L)$ and unlabeled set as $\mathcal{D}_U = (\mathcal{V}_U,\mathcal{V}_U)$ , where $\nu_{U} = \nu \backslash \nu_{L}$ . The node classification task aims to learn a mapping $\Phi :\mathcal{V}\to \mathcal{V}$ on labeled data $\mathcal{D}_L$ , so that it can be used to infer labels $\nu_{U}$ . + +Background on Graph Homophily Ratio. The homophily ratio is an important graph property that reflects the extent to which the graph structure adheres to the "label smoothness" criterion. The graph homophily ratio $r$ can be defined as the fraction of intra-class edges in the graph, as follows + +$$ +r = \frac {\left| \left\{\left(i , j\right) : (i , j) \in \mathcal {E} \wedge y _ {i} = y _ {j} \right\} \right|}{\left| \mathcal {E} \right|} \tag {1} +$$ + +where $y_{i}$ and $y_{j}$ are the ground-truth labels of node $v_{i}$ and $v_{j}$ . In practice, the distribution space size of a discrete graph structure $\mathbf{A} \in [0,1]^{N \times N}$ is $2^{N^2}$ , making it tractable to directly estimate the distribution differences between two discrete graph structures. In this paper, we take the graph homophily as a desirable option to analyze the distribution shifts between the original and augmented graphs, thus measuring the severity of an algorithm suffering from the negative augmentation problem. + +# 4 Methodology + +In this section, we first make problem statements for graph augmentation in Sec. 4.1, highlight our motivations by analyzing the distribution shift between the original and augmented graphs in Sec. 4.2, then present a novel teacher-student Knowledge Distillation for Graph Augmentation (KDGA) framework in Sec. 4.3, and finally provide one of its specific instantiations in Sec. 4.4. + +# 4.1 Problem Statement + +Graph Representation Learning. From the perspective of statistical learning, the key of node classification is to learn a mapping $p(Y \mid \mathbf{X}, \mathbf{A})$ based on node features $\mathbf{X}$ and graph structure $\mathbf{A}$ . The learned mapping can be used to infer labels $\mathcal{Y}_U$ on the graph structure $\mathbf{A}$ as shown in Fig. 1(a). + +Graph Structure Learning. The goal of graph structure learning is to estimate a more accurate structure $\widehat{\mathbf{A}}$ by another mapping $p(\widehat{\mathbf{A}}\mid \mathbf{X},\mathbf{A})$ and then feed it into the mapping $p(Y\mid \mathbf{X},\widehat{\mathbf{A}})$ along with node features $\mathbf{X}$ . Finally, the learned mapping $p(Y\mid \mathbf{X},\widehat{\mathbf{A}})$ can be used to infer labels $\mathcal{V}_U$ on the estimated (high-quality) structure $\widehat{\mathbf{A}}$ instead of the original strucute $\mathbf{A}$ as shown in Fig. 1(b). + +Graph Augmentation. Instead of directly working with the original graph, we would like to leverage graph augmentation to reasonably perturb the graph structure and learn more generalizable representations. In other words, we are interested in the following variant, as follows + +$$ +p (Y \mid \mathbf {X}, \mathbf {A}) = \sum_ {\widehat {\mathbf {A}} \in [ 0, 1 ] ^ {N \times N}} p (Y \mid \mathbf {X}, \widehat {\mathbf {A}}) p (\widehat {\mathbf {A}} \mid \mathbf {X}, \mathbf {A}) \tag {2} +$$ + +where $\widehat{\mathbf{A}}\in [0,1]^{N\times N}$ is the augmented graph (structure). In practice, the distribution space size of $\widehat{\mathbf{A}}$ is $2^{N^2}$ , and it is intractable to enumerate all possible $\widehat{\mathbf{A}}$ as well as estimate the exact values of the mappings $p(Y\mid \mathbf{X},\widehat{\mathbf{A}})$ and $p(\widehat{\mathbf{A}}\mid \mathbf{X},\mathbf{A})$ . Therefore, we approximate them by tractable functions as + +$$ +p (Y \mid \mathbf {X}, \mathbf {A}) = \sum_ {\widehat {\mathbf {A}} \in [ 0, 1 ] ^ {N \times N}} q _ {\theta} (Y \mid \mathbf {X}, \widehat {\mathbf {A}}) q _ {\phi} (\widehat {\mathbf {A}} \mid \mathbf {X}, \mathbf {A}) \tag {3} +$$ + +where $q_{\theta}(\cdot)$ and $q_{\phi}(\cdot)$ are approximation functions for $p(Y \mid \mathbf{X}, \widehat{\mathbf{A}})$ and $p(\widehat{\mathbf{A}} \mid \mathbf{X}, \mathbf{A})$ parameterized by $\theta$ and $\phi$ , respectively. In practice, the function $q_{\theta}(Y \mid \mathbf{X}, \widehat{\mathbf{A}})$ can be generally implemented by + +![](images/950aeb03b34cee8ef9fcd295449a651194b40aa1b287ce59a6d17a88fdab963b.jpg) +(a) Graph Representation Learning + +![](images/e68f6a63c13ff6e62a2178785001f6a08c7cc8adfd219cd9286fb02dc4797b6d.jpg) +(b) Graph Structure Learning + +![](images/fa698ef074d9e4d79b457b4a64b4b9ab9ca01abccca57a997f0c1b20175422f4.jpg) +(c) Graph Augmentation + +![](images/8ad39fa66c0b9dba7c23148b33f9bc463db137cd332b60be0272aa3c7ca7ec09.jpg) +(d) Knowledge Distillation for Graph Augmentation (KDGA) +Figure 1: Illustrations of graph representation learning, graph structure learning, graph augmentation, and the proposed KDGA framework. For the sake of chart brevity, we omitted the node features $\mathbf{X}$ . + +GNNs, and the function $q_{\phi}(\hat{\mathbf{A}} \mid \mathbf{X}, \mathbf{A})$ can be implemented by graph augmentation methods to model the distributions of augmented graph structures. Once the model training is finished, the mapping $q_{\theta}(Y \mid \mathbf{X}, \mathbf{A})$ can be used to infer labels $\mathcal{V}_U$ on the original structure $\mathbf{A}$ as shown in Fig. 1(c). + +In summary, unlike graph representation and graph structure learning that leverage the same structure (A or $\widehat{\mathbf{A}}$ ) for both training and testing, the graph structures for training and testing in graph augmentation are completely different, which may lead to a potential negative augmentation problem. + +# 4.2 Motivation: Potential Negative Augmentation Problem + +One may create a model by specifying specific implementations for functions $q_{\theta}(Y \mid \mathbf{X}, \widehat{\mathbf{A}})$ and $q_{\phi}(\widehat{\mathbf{A}} \mid \mathbf{X}, \mathbf{A})$ and then optimize it by maximizing the posterior $p(Y \mid \mathbf{X}, \mathbf{A})$ defined in Eq. (3). As we will explain here, however, this model may suffer from a potential negative augmentation problem caused by overly severe distribution shifts between the original and augmented graphs. + +![](images/ad6afe1e63b7f0d5062784b143cc358de9fbc1c5ac62bf913358230975b55e88.jpg) +(a) Distribution shift on the real-world Wisconsin dataset +Figure 2: Illustrations of how the distribution shift is arising and how it behaves on different datasets. + +![](images/3a8b7ee4628a4ee83ffe056517b0906d14c13dfaf70f5e1258591f15c9422164.jpg) +(b) Statistics of homophily ratios + +The distribution shift itself is not necessarily harmful; it is actually a neutral phenomenon. A proper distribution shift helps the model "see" more different graphs, enabling the nodes to receive more contextual information, thus improving generalization; however, an overly severe distribution shift can lead to a potential negative augmentation problem. To illustrate it, we consider a node $v_{i}$ (id 129) of class $C_1$ from the real-world Wisconsin dataset in Fig. 2(a), it is initially connected to a node with the same class $C_1$ and three nodes from another class $C_2$ in the original structure $\mathbf{A}$ . During the training process, the original structure $\mathbf{A}$ and node features $\mathbf{X}$ are fed together into $q_{\phi}(\widehat{\mathbf{A}} \mid \mathbf{X}, \mathbf{A})$ to generate an augmented structure $\widehat{\mathbf{A}}$ . Under the downstream supervision, it disconnects from three nodes from class $C_2$ and reconnects with three nodes from the same class $C_1$ , resulting in an + +augmented structure $\widehat{\mathbf{A}}$ with a much higher homophily ratio, that is, an overly severe distribution shift between the original and augmented graphs from the perspective of graph homophily property. As a result, a model trained on the augmented structure $\widehat{\mathbf{A}}$ can successfully predict node $i$ as class $C_1$ , but make a wrong prediction $C_2$ for node $i$ when tested on the original structure $\mathbf{A}$ , which is termed as "negative augmentation". Furthermore, we plot the homophily ratios of the original structure $\mathbf{A}$ and augmented structure $\widehat{\mathbf{A}}$ on eight datasets in Fig. 2(b), from which we can observe significant distribution shifts between the two graphs. Moreover, while the above analysis is developed on a heterophily (Wisconsin) graph, we find that the identified distributional shift also exists in homophily graphs, only in a different direction. Please see Sec. 5.3 for detailed experimental settings and results. + +# 4.3 Knowledge Distillation for Graph Augmentation (KDGA) + +The distribution shift is essentially a trade-off between better generalizability and higher risks of negative augmentation. However, the optimal distribution shift may vary from dataset to dataset, or even from node to node, making it challenging to directly control the levels of distribution shifts. In this paper, we have not attempted to control or prevent distribution shifts. Instead, we allow for the existence of any level of distribution shifts, but we reduce their negative impact, i.e., the potential negative augmentation problem, by the proposed KDGA framework, which gradually distills the contextual information from the augmented graphs into a student model tested on the original graph. The idea of KDGA is straightforward, yet as we will see, extremely effective. In our case, we first generate soft distributions $\mathbf{z}_i^T$ and $\mathbf{z}_i^S$ for node $v_i$ with the teacher and student models, respectively. The knowledge distillation is first introduced in [14], where knowledge was transferred from a cumbersome teacher to a simpler student by optimizing the following objective function, as follows + +$$ +\mathcal {L} _ {\mathrm {K D}} = \frac {1}{| \mathcal {V} |} \sum_ {i \in \mathcal {V}} \mathcal {D} _ {K L} \left(\operatorname {s o f t m a x} \left(\mathbf {z} _ {i} ^ {T}\right), \operatorname {s o f t m a x} \left(\mathbf {z} _ {i} ^ {S}\right)\right) \tag {4} +$$ + +In this paper, not to get a simpler student model, we adopt the knowledge distillation framework to address the identified negative augmentation problem caused by overly severe distribution shifts between the two graphs. In short, we extract the knowledge of any teacher model trained on the augmented graphs and inject it into a student model tested on the original graph as in Fig. 1(d). + +Teacher Model. The teacher model can be implemented by any GNN, which takes node features $\mathbf{X}$ and augmented structure $\widehat{\mathbf{A}}$ as input and learn latent node representations via neighborhood feature aggregation. Considering a $L$ -layer GNN $f_{\theta}(\mathbf{X},\widehat{\mathbf{A}})$ , the formulation of the $l$ -th layer is as follows + +$$ +\mathbf {h} _ {i, T} ^ {(l + 1)} = \operatorname {U P D A T E} ^ {(l)} \left(\mathbf {h} _ {i, T} ^ {(l)}, \operatorname {A G G R E G A T E} ^ {(l)} \left(\left\{\mathbf {h} _ {j, T} ^ {(l)}: v _ {j} \in \mathcal {N} _ {i} ^ {\widehat {\mathbf {A}}} \right\}\right)\right) \tag {5} +$$ + +where $0 \leq l \leq L - 1$ , $\mathbf{h}_{i,T}^{(0)} = \mathbf{x}_i$ is the input feature, and $\mathcal{N}_i^{\hat{\mathbf{A}}}$ is the neighborhood of node $v_i$ in the augmented structure $\widehat{\mathbf{A}}$ . After $L$ message-passing layers, the final node embedding $\mathbf{h}_{i,T}^{(L)}$ is passed to a linear prediction head $g^{T}(\cdot)$ to obtain logits $\mathbf{z}_i^T = g^T (\mathbf{h}_{i,T}^{(L)})$ , and the model is trained by a cross-entropy loss $\mathcal{H}(\cdot)$ with ground-truth labels $\mathcal{V}_L$ , given by $\mathcal{L}_{SUP}^T = \sum_{i\in \mathcal{V}_L}\mathcal{H}\left(y_i;\mathrm{softmax}\left(\mathbf{z}_i^T\right)\right)$ . + +Student Model. The student model $f_{\theta}(\mathbf{X}, \mathbf{A})$ shares the parameters $\theta$ with the teacher model, but differs in that it takes the original structure $\mathbf{A}$ as input, as shown in Fig. 3(c). Besides, an additional linear prediction head $g^{S}(\cdot)$ is used to map the node embedding $\mathbf{h}_{i,S}^{(L)}$ to logits $\mathbf{z}_i^S = g^S (\mathbf{h}_{i,S}^{(L)})$ . As already explained earlier, the augmented graphs enable the teacher model to receive richer contextual information, which helps to improve model generalization. To allow the student model tested on the original structure to also benefit from it, we consider the contextual neighborhood information from both original and augmented structures and distill them into the student model, defined as + +$$ +\mathcal {L} _ {\mathrm {G K D}} = \frac {\tau_ {1} ^ {2}}{| \mathcal {V} |} \sum_ {i \in \mathcal {V}} \sum_ {j \in \left(\mathcal {N} _ {i} ^ {\mathbf {A}} \cap \mathcal {N} _ {i} ^ {\hat {\mathbf {A}}}\right) \cup i} \mathcal {D} _ {K L} \left(\operatorname {s o f t m a x} \left(\mathbf {z} _ {j} ^ {T} / \tau_ {1}\right), \operatorname {s o f t m a x} \left(\mathbf {z} _ {i} ^ {S} / \tau_ {1}\right)\right) \tag {6} +$$ + +where $\tau_{1}$ is the distillation temperature, and $\tau_{1}^{2}$ is used to keep the gradient stability of this loss [14]. + +Discussions. While a large number of methods on graph knowledge distillation [61, 53, 60] have been proposed, most of them adopt the standard teacher-student knowledge distillation framework + +as shown in Fig. 3(a), where the inputs to both teacher and student models are the same (structure). Despite many progresses, their contributions have mostly focused on the special design of the teacher or student models. For example, CPF [54] proposes to distill knowledge from a teacher GNN to a student MLP, but it specifically incorporates label propagation [16] into the student model to improve performance. In contrast, GDK [11] utilizes label propagation in the teacher model to fully exploit both feature and topological information. In our proposed KDGA framework, the graph structures fed to the teacher and student models are completely different. Moreover, unlike the scheme in Fig. 3(b) where two parameter-independent teacher and student models are used, we adopt the architecture shown in Fig. 3(c) where the GNN parameters are shared but with two independent prediction heads to increase discriminability. The behind motivation is that a parameter-independent student model has the risk of quickly fitting with the original structure under the optimization of downstream supervision, while failing to take full advantage of rich contextual information from the augmented graphs. A detailed comparison of parameter-independent and parameter-shared schemes is reported in Table. 2. + +![](images/aff1583bb64b7621b1424a9677ce7a0a8dedcfb582465d22f50f5ff9d535a506.jpg) +(a) Standard Scheme + +![](images/21be035bd2f9f30988525f39b69338fbccffbfd1d9dc4055d36965b2e38488b0.jpg) +(b) Parameter-Independent (Param-I) + +![](images/af5327bb31934ae3e122e556ef801524c4355348e96d66301928c292ae01fe4e.jpg) +(c) Parameter-Shared (Param-S) +Figure 3: (a) standard teacher-student distillation; (b) distillation with parameter-independent teacher and student models; (c) distillation with parameter-shared teacher and student models. + +# 4.4 Instantiating KDGA with GraphAug + +In practice, any existing graph augmentation method can be used to instantiate the proposed KDGA framework and achieve consistent improvements over the vanilla implementations, as shown in Table. 1. In this subsection, we adopt a probabilistic generative-based graph augmentation method to model the function $q_{\phi}(\widehat{\mathbf{A}} \mid \mathbf{X}, \mathbf{A})$ , termed GraphAug, and use it to instantiate our KDGA framework. Specifically, we introduce a set of discrete variables $\Lambda = \{\lambda_{i,j}\}_{i,j=1}^{N}$ to model the distribution of the augmented graph, where $\lambda_{i,j} \in \{0,1\}$ denotes the augmentation probability between node $v_i$ and $v_j$ . Moreover, we avoid estimating the probability $p(\lambda_{i,j} \mid \mu_{i,j})$ using independent local parameter $\mu_{i,j}$ and instead fits a shared neural network to estimate it. Specifically, we first transform the input to a low-dimensional hidden space, done by multiplying the node features with a parameter matrix $\mathbf{W} \in \mathbb{R}^{F \times d}$ , that is, $\mathbf{e}_i = \mathbf{W}x_i$ . Then, we directly parameterize the probability $\lambda_{i,j}$ as + +$$ +p \left(\lambda_ {i, j} \mid \mathbf {X}, \mathbf {A}\right) = \sigma \left(\mathbf {e} _ {i} \mathbf {e} _ {j} ^ {T}\right) \tag {7} +$$ + +where $\sigma (\cdot)$ is an element-wise sigmoid function. Next, to sample discrete augmented graphs from the learned augmentation distribution and make the sampling process differentiable, we adopt Gumbel-Softmax sampling [17]. Specifically, the sampling process can be formulated as + +$$ +\widehat {\mathbf {A}} _ {i, j} = \left\lfloor \frac {1}{1 + \exp^ {- (\log \mathbf {M} _ {i , j} + G) / \tau_ {2}}} + \frac {1}{2} \right\rfloor , \text {w h e r e} \quad \mathbf {M} _ {i, j} = \alpha p (\lambda_ {i, j} | \mathbf {X}, \mathbf {A}) + (1 - \alpha) \mathbf {A} _ {i, j} \tag {8} +$$ + +where $\alpha \in [0,1]$ is the fusion factor to control the intensity of the graph augmentation, $\tau_{2}$ is the augmentation temperature, and $G\sim Gumbel(0,1)$ is a gumbel random variate. + +To warm-up the proposed GraphAug module, we first pre-train it with loss $\mathcal{L}_{Aug} = \frac{1}{N^2}\mathcal{H}(\mathbf{A}_{i,j},\widehat{\mathbf{A}}_{i,j})$ where $\mathcal{H}(\cdot)$ denotes the cross-entropy loss. Besides, we use classification loss $\mathcal{L}_{Cla} = \frac{1}{|\mathcal{V}_L|}\sum_{i\in \mathcal{V}_L}\left(\mathcal{H}\left(y_i,\mathrm{softmax}(\mathbf{z}_i^T)\right) + \mathcal{H}\left(y_i,\mathrm{softmax}(\mathbf{z}_i^S)\right)\right)$ to pre-train the teacher and student models until it converges. Finally, the total loss to train the whole framework is defined as follows + +$$ +\mathcal {L} _ {\text {t o t a l}} = \mathcal {L} _ {\text {C l a}} + \lambda \mathcal {L} _ {\text {A u g}} + \kappa \mathcal {L} _ {\text {G K D}} \tag {9} +$$ + +where $\lambda$ and $\kappa$ are the weights to balance the influence of the two losses $\mathcal{L}_{Aug}$ and $\mathcal{L}_{GKD}$ . + +Table 1: Accuracy ± std (%) on eight datasets (as well as their homophily ratios), with three GNN architectures and five graph augmentation methods considered. The best metrics are marked by bold. + +
BaseGNNMethodCoraCiteseerCornellChameleonSquirrelActorWisconsinTexas
0.810.740.300.230.220.220.210.11
GCNVanilla81.5±0.871.6±0.357.0±4.759.8±2.636.9±1.330.3±0.859.8±7.059.5±5.3
DropEdge [35]82.2±0.771.9±0.359.3±3.961.2±1.838.1±1.530.9±1.061.8±5.462.3±4.6
AdaEdge [2]82.3±0.869.7±0.957.8±4.359.5±2.337.6±1.431.4±1.260.4±4.758.8±4.0
SSL [63]83.8±0.772.9±0.658.8±3.260.4±2.139.5±1.930.5±1.262.8±4.563.3±4.6
GraphMix [44]83.9±0.674.7±0.660.5±3.761.2±2.341.1±1.531.4±0.962.4±5.062.3±4.6
GAUG [62]83.6±0.573.3±1.155.8±4.059.3±1.436.3±0.829.7±0.957.5±5.158.0±4.2
GAUG (w/ KDGA)85.4±0.773.6±0.663.2±3.663.0±1.246.2±0.933.3±0.865.0±2.567.4±3.8
ΔAcc1.80.37.43.79.93.67.59.4
MH-Aug [32]83.6±0.373.0±0.558.4±3.559.2±2.035.9±1.031.2±0.758.1±5.358.9±3.9
MH-Aug (w/ KDGA)85.0±0.573.8±0.863.5±2.763.3±1.745.4±1.134.8±1.065.7±2.767.2±2.6
ΔAcc1.40.85.14.19.53.67.68.3
GraphAug83.2±0.973.2±0.856.6±2.458.8±1.837.2±1.228.8±0.959.3±2.659.4±3.3
GraphAug (w/ KDGA)85.2±0.773.9±0.763.8±3.262.7±1.546.9±0.632.5±0.666.3±1.968.0±2.3
ΔAcc2.00.77.23.99.73.76.98.6
SAGEVanilla79.8±0.771.1±0.676.0±5.058.7±1.741.6±0.734.2±1.081.2±5.682.4±6.1
DropEdge [35]80.4±0.871.5±0.677.4±3.660.2±2.042.5±1.336.4±1.382.7±4.483.0±4.8
AdaEdge [2]80.2±1.269.4±0.876.5±4.659.5±1.640.3±1.634.9±0.882.0±5.381.6±5.3
SSL [63]82.5±0.871.2±0.576.8±3.459.1±1.842.0±1.535.2±1.282.4±3.682.6±4.4
GraphMix [44]82.3±0.669.6±0.478.0±4.259.9±2.042.6±1.635.8±1.083.1±4.183.5±3.9
GAUG [62]82.0±0.572.7±0.774.8±4.258.2±1.340.5±0.934.4±1.180.7±4.682.0±4.5
GAUG (w/ KDGA)84.5±0.873.4±0.780.6±3.561.8±1.646.4±1.136.4±0.785.5±3.284.5±3.6
ΔAcc2.50.75.83.65.92.04.82.5
MH-Aug [32]82.6±0.772.1±1.075.3±3.959.4±1.541.0±0.833.8±0.880.5±5.081.2±5.2
MH-Aug (w/ KDGA)84.3±0.773.7±0.880.3±3.262.1±1.345.9±1.435.9±0.784.9±4.083.8±4.4
ΔAcc1.71.65.02.74.92.14.42.6
GraphAug82.4±1.072.4±0.975.8±3.058.8±1.440.2±1.333.2±0.779.9±4.281.9±4.6
GraphAug (w/ KDGA)84.8±0.873.5±0.581.4±2.861.0±1.845.6±0.936.9±1.484.5±3.384.8±3.8
ΔAcc2.41.15.62.25.43.74.62.9
GATVanilla82.2±0.571.4±0.958.9±3.354.7±2.030.6±2.126.3±1.755.3±8.758.4±4.5
DropEdge [35]83.0±0.472.2±0.960.2±3.855.6±2.534.1±1.728.2±1.557.8±5.560.5±3.8
DropEdge [35]77.9±2.069.1±0.857.7±4.554.0±2.232.8±2.027.5±1.456.4±6.157.8±4.2
SSL [63]83.7±0.672.7±0.760.6±3.255.8±2.235.0±1.327.6±1.357.2±5.160.5±3.3
GraphMix [44]83.3±0.273.1±0.261.0±4.156.4±1.735.6±1.028.7±0.958.5±4.561.1±2.8
GAUG [62]82.2±0.871.6±1.157.6±3.853.4±1.430.1±1.525.8±1.054.8±5.756.9±3.6
GAUG (w/ KDGA)84.2±1.173.0±0.762.2±3.458.2±1.139.1±1.331.3±1.260.9±5.363.1±3.2
ΔAcc2.01.44.64.89.05.56.16.2
MH-Aug [32]83.5±0.772.8±1.058.0±4.055.3±1.829.5±1.125.7±1.255.8±4.057.8±4.0
MH-Aug (w/ KDGA)84.5±0.973.4±0.862.7±2.859.5±1.637.3±0.830.8±0.961.4±5.064.4±2.8
ΔAcc1.00.64.74.27.85.15.66.6
GraphAug83.2±0.872.5±0.758.6±3.454.0±1.729.8±1.624.8±1.354.4±3.657.1±4.4
GraphAug (w/ KDGA)84.7±0.773.2±0.863.1±2.558.8±1.338.9±1.430.0±1.061.8±4.762.7±2.0
ΔAcc1.50.74.54.89.15.27.45.6
+ +# 5 Experiments + +Datasets. The effectiveness of the proposed KDGA framework is evaluated on eight datasets. We use two commonly used homophily graph datasets, namely Cora [38] and Citeseer [12] as well as six heterophily graph datasets: Cornell, Texas, Wisconsin, Aactor [42], Chameleon and Squirrel [37]. A statistical overview of these datasets is available in Appendix A. We defer the implementation details and the best hyperparameter settings for each dataset to Appendix B and supplementary material. + +Baselines. As a general framework, KDGA can be combined with any GNN architecture and existing graph augmentation methods. In this paper, we consider three GNN architectures, GCN [21], GraphSAGE [13], and GAT [43]. Besides, to demonstrate the applicability of KDGA to various graph augmentation methods in addition to the proposed GraphAug, we also consider two state-of-the-art learning-based baselines, GAUG [62] and MH-Aug [32]. In particular, two heuristics methods, DropEdge and AdaEdge, are also included in the comparison as baselines. Moreover, we also compare KDGA with two semi-supervised methods: (1) GraphMix [44], a regularization method that performs linear interpolation between two data on graphs, and (2) SSL [63], that proposes two self-supervised tasks to fully exploit available information embedded in the graph structure. Each set of experiments is run five times with different random seeds, and the average performance is reported. + +# 5.1 Comparative Results + +To evaluate the powerful capabilities of the proposed KDGA framework, we instantiate it with three learning-based graph augmentation methods, GAUG, MH-Aug, and GraphAug. The experiments are conducted on eight datasets with three different GNN architectures. From the experimental results shown in Table. 1, we can make the following observations: (1) Two heuristic graph augmentation methods, DropEdge and AdaEdge, can improve the performance of the vanilla GNNs overall. However, such improvements are usually very limited and do not work for all datasets and GNN architectures. For example, on the CiteSeer dataset, the performance of AdaEdge drops over the vanilla GNNs by $1.9\%$ (GCN), $1.7\%$ (GraphSAGE), and $2.3\%$ (GAT), respectively. (2) There are huge gaps in the effectiveness of three learning-based augmentation methods on homophily and heterophily graphs. While these methods can significantly improve performance on homophily graphs, their performance gains on heterophily graphs are greatly reduced and even detrimental. For example, with GCN as the GNN architecture, the performance of GAUG improves by $2.1\%$ on Cora, but drops by $1.5\%$ and $1.2\%$ on Texas and Cornell. Such negative augmentation is mainly caused by the overly severe distribution shift between the original and augmented graphs as analyzed in Sec. 4.2. (3) The proposed KDGA framework can consistently improve the performance of vanilla graph augmentation methods across three GNN architectures on all eight datasets, especially for those heterophily graphs. For example, with GCN as the GNN architecture, the performance of GraphAug can be improved by $9.7\%$ and $8.6\%$ on the Squirrel and Texas datasets. (4) Two semi-supervised approaches, SSL and GraphMix, can achieve comparable or even better performance than learning-based graph augmentation, especially on heterophily graphs. However, by combining with KDGA, GAUG, MH-Aug, and GraphAug outperform both SSL and GraphMix by a large margin overall. + +![](images/8fc410132aea151a657f4da4b540f9f501cd63bdedce29c25c566fc908339520.jpg) +Figure 4: Case studies for each dataset, where we pick a node with the most drastic neighborhood variations and visualize its neighborhood on the original graph structure (top) and augmented graph structure (bottom), where each node is colored according to its ground-truth label. + +# 5.2 Analysis on the Distribution Shift and Negative Augmentation + +Next, we qualitatively and quantitatively analyze the distribution shift between the original and augmented graphs and explain how it can cause a potential negative augmentation. Without loss of generality, we consider GCN as the GNN architecture and GraphAug as the augmentation method. + +Visualizations of Neighborhood Variations. First, we pick a node with the most drastic neighborhood variations and visualize its neighborhood of the original and augmented graphs in Fig. 4, where each node is colored according to its ground-truth label. The visualizations show that there would be a huge gap between the neighborhoods of the original and augmented graphs, which causes a model that is well trained on the augmented graph to predict poorly on the original graph during testing. Taking the Wisconsin dataset as an example, the selected node is connected to four nodes from the same class in the augmented graph, so it can be well trained to make correct predictions. However, its neighborhood context is completely changed in the original graph, where the node is connected to three nodes from different classes, so it will be predicted with high confidence to an incorrect class. + +Training Curves of Homophily Ratios. We plot in Fig. 5 the training curves (w/o GKD Loss) of the homophily ratios of the original and augmented graphs during training. It can be seen that their gaps are enlarged as training proceeds, which indicates that the distribution of the augmented graphs is gradually shifting from the original graph. This shift may even reach 0.5 for some datasets (e.g., Texas), in which case the graph homophily property is completely reversed. More importantly, we find that the direction of distribution shifts may be completely opposite for homophily and heterophily graphs, which makes it more challenging to solve the negative augmentation problem. + +![](images/725d1b6a5504169fa9399e71eed0b2fa6614f01325a1b93e84389fb947c31169.jpg) + +![](images/fbcef5ce05455e116229eece19e10de4ff7b5ababd21328c70a80b4f4f0c21f0.jpg) + +![](images/054ab820bfc6a8902a5c958f684e1938a288f50add699213f0fac5bbbdcc66ca.jpg) + +![](images/76285a03965ac2884ea04e89835d409412661a3aad89427ccac4ba47c365d8be.jpg) + +![](images/317411e85f1db80c02968d9f9937eadbecba4415422be38c69de5a5a1b0a1952.jpg) +Figure 5: Training curves (w/o GKD Loss) of homophily ratios in the original and augmented graphs. + +![](images/e7ea115d030aeb9e692f477f39cdc99eb20684e8946bf20b430ad21149a4b1c3.jpg) + +![](images/2864c51a372e5476bf6013e23aa5ae01cb79f2afd43a1044075fd7200f507ba0.jpg) + +![](images/7f706542c2ed94a7f36df9159d5827798a4a252f4ea50842c018040d929b9df9.jpg) + +# 5.3 Ablation Study and Parameter Sensitivity + +Ablation on Student Model Designs. The parameter-shared GNN shown in Fig. 3(c) is adopted as the student model by default in this paper for a fair comparison. In this subsection, we delve into the applicability of the proposed KDGA framework to different student model designs. Specifically, with the vanilla GCN as the base architecture and GraphAug as the graph augmentation method, we compare the performance of the + +parameter-shared model (w/ Param-S) in Fig. 3(c) and the parameter-independent model (w/ Param-I) in Fig. 3(b) on five datasets. It can be seen from Table. 2 that although the Param-I model can also improve the performance of GraphAug overall, it may fail on a few datasets, such as a $0.5\%$ accuracy drop on Citeseer; more importantly, its performance gain falls far behind the Param-S model on all five datasets. The reason behind this may be that a parameter-independent model may be quickly fitted with the original graph structure while failing to take full advantage of the rich contextual information embedded in the augmented graphs. Moreover, we also consider a variant of the Param-I model by directly taking a parameter-independent MLP (w/ MLP) as the student mode. We find from Table. 2 that even with a simple MLP, it can still benefit from the augmented graphs and achieves performance beyond that of its vanilla implementations. + +Sensitivity Analysis on Hyperparameters. We have evaluated the parameter sensitivity w.r.t two key hyperparameters: fusion factor $\alpha$ and loss weight $\kappa$ . However, due to space limitations, we have placed the corresponding results of sensitivity analysis in Appendix C. + +# 6 Conclusion + +In this paper, we identified a potential negative augmentation problem for graph augmentation, which is caused by overly severe distribution shifts between the original and augmented graphs. To address this problem, we propose a novel Knowledge Distillation for Graph Augmentation (KDGA) framework by directly distilling contextual information from a teacher model trained on the augmented graphs into a partially parameter-shared student model. Extensive experiments show that KDGA outperforms the vanilla implementations of existing augmentation methods and GNN architectures. Limitations still exist, such as KDGA requires an initial raw graph structure for augmentation and cannot be applied to those structure-unknown scenarios, which will be left for future work. + +# 7 Acknowledgement + +This work is supported in part by Ministry of Science and Technology of the People's Republic of China (No. 2021YFA1301603) and National Natural Science Foundation of China (No. U21A20427). + +# References + +[1] Markus Bayer, Marc-Andre Kaufhold, and Christian Reuter. A survey on data augmentation for text classification. arXiv preprint arXiv:2107.03158, 2021. +[2] Deli Chen, Yankai Lin, Wei Li, Peng Li, Jie Zhou, and Xu Sun. Measuring and relieving the over-smoothing problem for graph neural networks from the topological view. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 3438-3445, 2020. +[3] Yu Chen, Lingfei Wu, and Mohammed Zaki. Iterative deep graph learning for graph neural networks: Better and robust node embeddings. Advances in Neural Information Processing Systems, 33:19314-19326, 2020. +[4] Michael Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks on graphs with fast localized spectral filtering. arXiv preprint arXiv:1606.09375, 2016. +[5] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018. +[6] Kaize Ding, Zhe Xu, Hanghang Tong, and Huan Liu. Data augmentation for deep graph learning: A survey. arXiv preprint arXiv:2202.08235, 2022. +[7] Federico Errica, Marco Podda, Davide Bacciu, and Alessio Micheli. A fair comparison of graph neural networks for graph classification. arXiv preprint arXiv:1912.09893, 2019. +[8] Bahare Fatemi, Layla El Asri, and Seyed Mehran Kazemi. Slaps: Self-supervision improves structure learning for graph neural networks. arXiv preprint arXiv:2102.05034, 2021. +[9] Alhussein Fawzi, Horst Samulowitz, Deepak Turaga, and Pascal Frossard. Adaptive data augmentation for image classification. In 2016 IEEE international conference on image processing (ICIP), pages 3688-3692. IEEE, 2016. +[10] Luca Franceschi, Mathias Niepert, Massimiliano Pontil, and Xiao He. Learning discrete structures for graph neural networks. In International conference on machine learning, pages 1972-1982. PMLR, 2019. +[11] Mahsa Ghorbani, Mojtaba Bahrami, Anees Kazi, Mahdieh Soleymani Baghshah, Hamid R Rabiee, and Nassir Navab. Gkd: Semi-supervised graph knowledge distillation for graph-independent inference. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pages 709-718. Springer, 2021. +[12] C Lee Giles, Kurt D Bollacker, and Steve Lawrence. Citeseer: An automatic citation indexing system. In Proceedings of the third ACM conference on Digital libraries, pages 89-98, 1998. +[13] Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. In Advances in neural information processing systems, pages 1024-1034, 2017. +[14] Geoffrey Hinton, Oriol Vinyls, Jeff Dean, et al. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2(7), 2015. +[15] Weihua Hu, Bowen Liu, Joseph Gomes, Marinka Zitnik, Percy Liang, Vijay Pande, and Jure Leskovec. Strategies for pre-training graph neural networks. arXiv preprint arXiv:1905.12265, 2019. +[16] Ahmet Iscen, Giorgos Tolias, Yannis Avrithis, and Ondrej Chum. Label propagation for deep semi-supervised learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 5070-5079, 2019. +[17] Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with gumbel-softmax. arXiv preprint arXiv:1611.01144, 2016. +[18] Bo Jiang, Ziyan Zhang, Doudou Lin, Jin Tang, and Bin Luo. Semi-supervised learning with graph learning-convolutional networks. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 11313–11320, 2019. +[19] Wei Jin, Tyler Derr, Haochen Liu, Yiqi Wang, Suhang Wang, Zitao Liu, and Jiliang Tang. Self-supervised learning on graphs: Deep insights and new direction. arXiv preprint arXiv:2006.10141, 2020. +[20] Wei Jin, Yao Ma, Xiaorui Liu, Xianfeng Tang, Suhang Wang, and Jiliang Tang. Graph structure learning for robust graph neural networks. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 66-74, 2020. + +[21] Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016. +[22] Johannes Klicpera, Aleksandar Bojchevski, and Stephan Gunnemann. Predict then propagate: Graph neural networks meet personalized pagerank. arXiv preprint arXiv:1810.05997, 2018. +[23] Johannes Klicpera, Stefan Weißenberger, and Stephan Gunnemann. Diffusion improves graph learning. Advances in Neural Information Processing Systems, 32, 2019. +[24] Meng Liu, Hongyang Gao, and Shuiwang Ji. Towards deeper graph neural networks. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 338-348, 2020. +[25] Xiaofeng Liu, Yang Zou, Lingsheng Kong, Zhihui Diao, Junliang Yan, Jun Wang, Site Li, Ping Jia, and Jane You. Data augmentation via latent space interpolation for image classification. In 2018 24th International Conference on Pattern Recognition (ICPR), pages 728-733. IEEE, 2018. +[26] Zicheng Liu, Siyuan Li, Ge Wang, Cheng Tan, Lirong Wu, and Stan Z Li. Decoupled mixup for data-efficient learning. arXiv preprint arXiv:2203.10761, 2022. +[27] Zicheng Liu, Siyuan Li, Di Wu, Zhiyuan Chen, Lirong Wu, Jianzhu Guo, and Stan Z Li. Unveiling the power of mixup for stronger classifiers. arXiv preprint arXiv:2103.13027, 2021. +[28] Zihan Liu, Yun Luo, Lirong Wu, Siyuan Li, Zicheng Liu, and Stan Z Li. Are gradients on graph structure reliable in gray-box attacks? arXiv preprint arXiv:2208.05514, 2022. +[29] Zihan Liu, Yun Luo, Zelin Zang, and Stan Z Li. Surrogate representation learning with isometric mapping for gray-box graph adversarial attacks. In Proceedings of the Fifteenth ACM International Conference on Web Search and Data Mining, pages 591-598, 2022. +[30] Agnieszka Mikołajczyk and Michal Grochowski. Data augmentation for improving deep learning in image classification problem. In 2018 international interdisciplinary PhD workshop (IIPhDW), pages 117-122. IEEE, 2018. +[31] Sarah O'Gara and Kevin McGuinness. Comparing data augmentation strategies for deep image classification. 2019. +[32] Hyeonjin Park, Seunghun Lee, Sihyeon Kim, Jinyoung Park, Jisu Jeong, Kyung-Min Kim, Jung-Woo Ha, and Hyunwoo J Kim. Metropolis-hastings data augmentation for graph neural networks. Advances in Neural Information Processing Systems, 34, 2021. +[33] Luis Perez and Jason Wang. The effectiveness of data augmentation in image classification using deep learning. arXiv preprint arXiv:1712.04621, 2017. +[34] Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019. +[35] Yu Rong, Wenbing Huang, Tingyang Xu, and Junzhou Huang. Droppedge: Towards deep graph convolutional networks on node classification. arXiv preprint arXiv:1907.10903, 2019. +[36] Ryan Robert Rosario. A data augmentation approach to short text classification. University of California, Los Angeles, 2017. +[37] Benedek Rozemberczki, Carl Allen, and Rik Sarkar. Multi-scale attributed node embedding. arXiv preprint arXiv:1909.13021, 2019. +[38] Prithviraj Sen, Galileo Namata, Mustafa Bilgic, Lise Getoor, Brian Galligher, and Tina Eliassi-Rad. Collective classification in network data. AI magazine, 29(3):93-93, 2008. +[39] Jia Shijie, Wang Ping, Jia Peiyi, and Hu Siping. Research on data augmentation for image classification based on convolution neural networks. In 2017 Chinese automation congress (CAC), pages 4165-4170. IEEE, 2017. +[40] Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. The journal of machine learning research, 15(1):1929-1958, 2014. +[41] Susheel Suresh, Pan Li, Cong Hao, and Jennifer Neville. Adversarial graph augmentation to improve graph contrastive learning. Advances in Neural Information Processing Systems, 34, 2021. + +[42] Jie Tang, Jimeng Sun, Chi Wang, and Zi Yang. Social influence analysis in large-scale networks. In Proceedings of the 15th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 807-816, 2009. +[43] Petar Velicković, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua Bengio. Graph attention networks. arXiv preprint arXiv:1710.10903, 2017. +[44] Vikas Verma, Meng Qu, Kenji Kawaguchi, Alex Lamb, Yoshua Bengio, Juho Kannala, and Jian Tang. Graphmix: Improved training of gnns for semi-supervised learning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 10024–10032, 2021. +[45] Minjie Wang, Da Zheng, Zihao Ye, Quan Gan, Mufei Li, Xiang Song, Jinjing Zhou, Chao Ma, Lingfan Yu, Yu Gai, Tong He, George Karypis, Jinyang Li, and Zheng Zhang. Deep graph library: A graph-centric, highly-performant package for graph neural networks. arXiv preprint arXiv:1909.01315, 2019. +[46] Jason Wei and Kai Zou. Eda: Easy data augmentation techniques for boosting performance on text classification tasks. arXiv preprint arXiv:1901.11196, 2019. +[47] Felix Wu, Amauri Souza, Tianyi Zhang, Christopher Fifty, Tao Yu, and Kilian Weinberger. Simplifying graph convolutional networks. In International conference on machine learning, pages 6861-6871. PMLR, 2019. +[48] Lirong Wu, Haitao Lin, Zhangyang Gao, Cheng Tan, Stan Li, et al. Graphmixup: Improving class-imbalanced node classification on graphs by self-supervised context prediction. arXiv preprint arXiv:2106.11133, 2021. +[49] Lirong Wu, Haitao Lin, Cheng Tan, Zhangyang Gao, and Stan Z Li. Self-supervised learning on graphs: Contrastive, generative, or predictive. IEEE Transactions on Knowledge and Data Engineering, 2021. +[50] Lirong Wu, Haitao Lin, Jun Xia, Cheng Tan, and Stan Z Li. Multi-level disentanglement graph neural network. Neural Computing and Applications, 34(11):9087-9101, 2022. +[51] Jun Xia, Lirong Wu, Jintao Chen, Bozhen Hu, and Stan Z Li. Simgrace: A simple framework for graph contrastive learning without data augmentation. In Proceedings of the ACM Web Conference 2022, pages 1070–1079, 2022. +[52] Jun Xia, Lirong Wu, Ge Wang, Jintao Chen, and Stan Z Li. Progcl: Rethinking hard negative mining in graph contrastive learning. In International Conference on Machine Learning, pages 24332-24346. PMLR, 2022. +[53] Bencheng Yan, Chaokun Wang, Gaoyang Guo, and Yunkai Lou. Tinygnn: Learning efficient graph neural networks. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 1848-1856, 2020. +[54] Cheng Yang, Jiawei Liu, and Chuan Shi. Extract the knowledge of graph neural networks and go beyond it: An effective knowledge distillation framework. In Proceedings of the Web Conference 2021, pages 1227-1237, 2021. +[55] Yuning You, Tianlong Chen, Yang Shen, and Zhangyang Wang. Graph contrastive learning automated. In International Conference on Machine Learning, pages 12121-12132. PMLR, 2021. +[56] Yuning You, Tianlong Chen, Yongduo Sui, Ting Chen, Zhangyang Wang, and Yang Shen. Graph contrastive learning with augmentations. Advances in Neural Information Processing Systems, 33, 2020. +[57] Yuning You, Tianlong Chen, Zhangyang Wang, and Yang Shen. When does self-supervision help graph convolutional networks? In International Conference on Machine Learning, pages 10871-10880. PMLR, 2020. +[58] Donghan Yu, Ruohong Zhang, Zhengbao Jiang, Yuexin Wu, and Yiming Yang. Graph-revised convolutional network. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pages 378-393. Springer, 2020. +[59] Muhan Zhang and Yixin Chen. Link prediction based on graph neural networks. arXiv preprint arXiv:1802.09691, 2018. +[60] Shichang Zhang, Yozen Liu, Yizhou Sun, and Neil Shah. Graph-less neural networks: Teaching old mlps new tricks via distillation. arXiv preprint arXiv:2110.08727, 2021. + +[61] Wentao Zhang, Xupeng Miao, Yingxia Shao, Jiawei Jiang, Lei Chen, Olivier Ruas, and Bin Cui. Reliable data distillation on graph convolutional network. In Proceedings of the 2020 ACM SIGMOD International Conference on Management of Data, pages 1399-1414, 2020. +[62] Tong Zhao, Yozen Liu, Leonardo Neves, Oliver Woodford, Meng Jiang, and Neil Shah. Data augmentation for graph neural networks. arXiv preprint arXiv:2006.06830, 2020. +[63] Qikui Zhu, Bo Du, and Pingkun Yan. Self-supervised training of graph convolutional networks. arXiv preprint arXiv:2006.02380, 2020. +[64] Yanqiao Zhu, Weizhi Xu, Jinghao Zhang, Qiang Liu, Shu Wu, and Liang Wang. Deep graph structure learning for robust representations: A survey. arXiv preprint arXiv:2103.03036, 2021. +[65] Yanqiao Zhu, Yichen Xu, Feng Yu, Qiang Liu, Shu Wu, and Liang Wang. Graph contrastive learning with adaptive augmentation. In Proceedings of the Web Conference 2021, pages 2069-2080, 2021. \ No newline at end of file diff --git a/knowledgedistillationimprovesgraphstructureaugmentationforgraphneuralnetworks/images.zip b/knowledgedistillationimprovesgraphstructureaugmentationforgraphneuralnetworks/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..535024db88a4b68875727779b8823b6d638ca243 --- /dev/null +++ b/knowledgedistillationimprovesgraphstructureaugmentationforgraphneuralnetworks/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ceaa53c875acbfd2e593d1c15524ac369b57ce3c6d83a8b506976322bb2efdf6 +size 570008 diff --git a/knowledgedistillationimprovesgraphstructureaugmentationforgraphneuralnetworks/layout.json b/knowledgedistillationimprovesgraphstructureaugmentationforgraphneuralnetworks/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..a949908e42b84e5cca1ddaf7aeae58d84fe9f232 --- /dev/null +++ b/knowledgedistillationimprovesgraphstructureaugmentationforgraphneuralnetworks/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07f97ee46dbc20576d2706d9518a87f3ea4900f07e2a5e11420be96c5430dd6c +size 451373 diff --git a/kradar4dradarobjectdetectionforautonomousdrivinginvariousweatherconditions/848f1d53-ac5d-4933-96c4-06450b437bbc_content_list.json b/kradar4dradarobjectdetectionforautonomousdrivinginvariousweatherconditions/848f1d53-ac5d-4933-96c4-06450b437bbc_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..bf9feb3e2108f9401b53f2085241981ae6c24161 --- /dev/null +++ b/kradar4dradarobjectdetectionforautonomousdrivinginvariousweatherconditions/848f1d53-ac5d-4933-96c4-06450b437bbc_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:542b8418c5c1ae43335090b9e7f4f03e1b549efe008decc29b516bb5f389b2e5 +size 61487 diff --git a/kradar4dradarobjectdetectionforautonomousdrivinginvariousweatherconditions/848f1d53-ac5d-4933-96c4-06450b437bbc_model.json b/kradar4dradarobjectdetectionforautonomousdrivinginvariousweatherconditions/848f1d53-ac5d-4933-96c4-06450b437bbc_model.json new file mode 100644 index 0000000000000000000000000000000000000000..0918477997268fe2a7878f03e5b0bd4daea83efb --- /dev/null +++ b/kradar4dradarobjectdetectionforautonomousdrivinginvariousweatherconditions/848f1d53-ac5d-4933-96c4-06450b437bbc_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b278730334a44dff7c4fbe9be71df8b2381bd941f1c4fe14f03f807df652e5d0 +size 72162 diff --git a/kradar4dradarobjectdetectionforautonomousdrivinginvariousweatherconditions/848f1d53-ac5d-4933-96c4-06450b437bbc_origin.pdf b/kradar4dradarobjectdetectionforautonomousdrivinginvariousweatherconditions/848f1d53-ac5d-4933-96c4-06450b437bbc_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..e1f84fff22f882228231ac76b576d68988eb897b --- /dev/null +++ b/kradar4dradarobjectdetectionforautonomousdrivinginvariousweatherconditions/848f1d53-ac5d-4933-96c4-06450b437bbc_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9161ec9673e1b04a19ed035caa014450be74c805a1760ada45d8c88f014d6af3 +size 4208775 diff --git a/kradar4dradarobjectdetectionforautonomousdrivinginvariousweatherconditions/full.md b/kradar4dradarobjectdetectionforautonomousdrivinginvariousweatherconditions/full.md new file mode 100644 index 0000000000000000000000000000000000000000..e888b57fa64fff0eb84e571b18d29213a57cd77d --- /dev/null +++ b/kradar4dradarobjectdetectionforautonomousdrivinginvariousweatherconditions/full.md @@ -0,0 +1,214 @@ +# K-Radar: 4D Radar Object Detection for Autonomous Driving in Various Weather Conditions + +Dong-Hee Paek $^{1*}$ Seung-Hyun Kong $^{1*†}$ Kevin Tirta Wijaya $^{2}$ + +$^{1}$ CCS Graduate School of Mobility $^{2}$ Robotics Program + +KAIST + +{donghee.paek, skong, kevin.tirta}@kaist.ac.kr + +# Abstract + +Unlike RGB cameras that use visible light bands (384~769 THz) and Lidars that use infrared bands (361~331 THz), Radars use relatively longer wavelength radio bands (77~81 GHz), resulting in robust measurements in adverse weathers. Unfortunately, existing Radar datasets only contain a relatively small number of samples compared to the existing camera and Lidar datasets. This may hinder the development of sophisticated data-driven deep learning techniques for Radar-based perception. Moreover, most of the existing Radar datasets only provide 3D Radar tensor (3DRT) data that contain power measurements along the Doppler, range, and azimuth dimensions. As there is no elevation information, it is challenging to estimate the 3D bounding box of an object from 3DRT. In this work, we introduce KAIST-Radar (K-Radar), a novel large-scale object detection dataset and benchmark that contains 35K frames of 4D Radar tensor (4DRT) data with power measurements along the Doppler, range, azimuth, and elevation dimensions, together with carefully annotated 3D bounding box labels of objects on the roads. K-Radar includes challenging driving conditions such as adverse weathers (fog, rain, and snow) on various road structures (urban, suburban roads, alleyways, and highways). In addition to the 4DRT, we provide auxiliary measurements from carefully calibrated high-resolution Lidars, surround stereo cameras, and RTK-GPS. We also provide 4DRT-based object detection baseline neural networks (baseline NNs) and show that the height information is crucial for 3D object detection. And by comparing the baseline NN with a similarly-structured Lidar-based neural network, we demonstrate that 4D Radar is a more robust sensor for adverse weather conditions. All codes are available at https://github.com/kaist-avelab/k-radar. + +# 1 Introduction + +An autonomous driving system generally consists of sequential modules of perception, planning, and control. As the planning and control modules rely on the output of the perception module, it is crucial for the perception module to be robust even under adverse driving conditions. + +Recently, various works have proposed deep learning-based autonomous driving perception modules that demonstrate remarkable performances in lane detection (Paek et al., 2022; Liu et al., 2021), object detection (Wang et al., 2021a; Lang et al., 2019; Major et al., 2019), and other tasks (Ranftl et al., 2021; Teed and Deng, 2021). These works often use RGB images as the inputs to the neural networks due to the availability of numerous public large-scale datasets for camera-based perception. Moreover, an RGB image has a relatively simple data structure, where the data dimensionality is + +relatively low and neighboring pixels often have high correlation. Such a simplicity enables deep neural networks to learn the underlying representations of images and recognize objects on the image. + +Unfortunately, camera is prone to poor illumination, can easily be obscured by raindrops and snowflakes, and cannot preserve depth information that is crucial for accurate 3D scene understanding of the environment. On the other hand, Lidar actively emits measuring signals in the infrared spectrum, therefore, the measurements are hardly affected by illumination conditions. Lidar can also provide accurate depth measurements within centimeters resolution. However, Lidar measurements are still affected by adverse weathers since the wavelength of the signals $(\lambda = 850\mathrm{nm}\sim 1550\mathrm{nm})$ is not long enough to pass through raindrops or snowflakes (Kurup and Bos, 2021). + +![](images/14121e344938cf5da755acab6ffa2af31d18d55e8759fccd450631a2fd211fef.jpg) +Figure 1: An overview of the signal processing of the FMCW Radar and a visualization of the two main data types (i.e., Radar tensor (RT) and Radar point cloud (RPC)). The RT is a dense data matrix with power measurements in all elements along the dimensions through a Fast Fourier Transform (FFT) operation applied to FMCW signals. Since all elements are non-zero values, the RT provides dense information regarding the environment with minimal loss, at a cost of high memory requirement. On the other hand, the RPC is a data type in which target (i.e., object candidate group) information is extracted in the form of a point cloud with a small amount of memory by applying Constant False Alarm Rate (CFAR) algorithm to the RT. Due to the ease of implementing FFT and CFAR directly on the hardware, many Radar sensors provide RPCs as output. However, the RPC may lose a significant amount of information regarding the environment due to the CFAR algorithm. + +Similar to Lidar, a Radar sensor actively emits waves and measures the reflection. However, Radar emits radio waves $(\lambda \approx 4\mathrm{mm})$ that can pass through raindrops and snowflakes. As a result, Radar measurements are robust to both poor illumination and adverse weather conditions. This robustness is demonstrated in (Abdu et al., 2021), where a Frequency Modulated Continuous Wave (FMCW) Radar-based perception module is shown to be accurate even in adverse weather conditions and can be easily implemented directly on the hardware. + +As FMCW Radars with dense Radar tensor (RT) outputs become readily available, numerous works (Dong et al., 2020; Mostajabi et al., 2020; Sheeny et al., 2021) propose RT-based object detection networks with comparable detection performance to camera + +and Lidar-based object detection networks. However, these works are limited to 2D bird-eyeview (BEV) object detection, since FMCW Radars utilized in existing works only provide 3D Radar tensor (3DRT) with power measurements along the Doppler, range, and azimuth dimensions. + +In this work, we introduce KAIST-Radar (K-Radar), a novel 4D Radar tensor (4DRT)-based 3D object detection dataset and benchmark. Unlike the conventional 3DRT, 4DRT contains power measurements along the Doppler, range, azimuth, and elevation dimensions so that the 3D spatial information can be preserved, which could enable accurate 3D perception such as 3D object detection with Lidar. To the best of our knowledge, K-Radar is the first large-scale 4DRT-based dataset and benchmark, with 35k frames collected from various road structures (e.g. urban, suburban, highways), time (e.g. day, night), and weather conditions (e.g. clear, fog, rain, snow). In addition to the 4DRT, K-Radar also provides high-resolution Lidar point clouds (LPCs), surround RGB images from four stereo cameras, and RTK-GPS and IMU data of the ego-vehicle. + +Since the 4DRT high-dimensional representation is unintuitive to human, we leverage the high-resolution LPC so that the annotators can accurately label the 3D bounding boxes of objects on the road in the visualized point clouds. The 3D bounding boxes can be easily transformed from the Lidar to the Radar coordinate frame since we provide both spatial and temporal calibration parameters to correct offsets due to the separations of the sensors and the asynchronous measurements, respectively. K-Radar also provides a unique tracking ID for each annotated object that is useful for tracking + +![](images/8ba2cb754d51047deec206821ad1ea7f9613e2a8b6f193ecfd826606478a5447.jpg) +Figure 2: Samples of K-Radar datasets for various weather conditions. Each column shows (1) 4DRTs, (2) front view camera images, and (3) Lidar point clouds (LPCs) of different weather conditions. 4DRTs are represented in a two-dimensional (BEV) Cartesian coordinate system using a series of visualization processes that are described in Section 3.3. In this example, yellow and red bounding boxes represent the sedan and bus or truck classes, respectively. Appendix A contains further samples of K-Radar datasets for each weather condition. + +![](images/ec68dfab9c0f13bbda7e6a44ffa52bd82ff2951f443ff0216839a5b193a6d4cf.jpg) + +![](images/98f0f858a1c744fd7fcff43e4e04d2671fa699b63f877456166e5595798d30cd.jpg) + +![](images/f2ed77018b88c60607d52a73bb33a9d51d4916b4c57e29d4f73396d1a09d799d.jpg) + +![](images/f3ad100337f00716da01d4467ea6906ab554244755917366fc8b355c641c028b.jpg) + +![](images/4251f74a794cc3a0edcda045b874dffa770493dfd0aa2efd2a5e0f5c6b19d280.jpg) + +an object along a sequence of frames. Examples of information regarding tracking are shown in Appendix I.7. + +To demonstrate the necessity of 4DRT-based perception module, we present a 3D object detection baseline neural network (baseline NN) that directly consumes 4DRT as an input. From the experimental results on K-Radar, we observe that the 4DRT-based baseline NN outperforms the Lidar-based network in the 3D object detection task, especially in adverse weather conditions. We also show that the 4DRT-based baseline NN utilizing height information significantly outperforms network that only utilizes BEV information. Additionally, we publish the complete development kits (devkits) that include: (1) training / evaluation codes for 4DRT-based neural networks, (2) labeling / calibration tools, and (3) visualization tools to accelerate research in the field of 4DRT-based perception. + +In a summary, our contributions are as follow, + +- We present a novel 4DRT-based dataset and benchmark, K-Radar, for 3D object detection. To the best of our knowledge, K-Radar is the first large-scale 4DRT-based dataset and benchmark with diverse and challenging illumination, time, and weather conditions. With the carefully annotated 3D bounding box labels and multimodal sensors, K-Radar can also be used for other autonomous driving tasks such as object tracking and odometry. +- We propose a 3D object detection baseline NN that directly consumes 4DRT as an input and verify that the height information of 4DRT is essential for 3D object detection. We also demonstrate the robustness of 4DRT-based perception for autonomous driving, especially under adverse weather conditions. +- We provide devkits that include: (1) training/evaluation, (2) labeling/calibration, and (3) visualization tools to accelerate 4DRT-based perception for autonomous driving research. + +The remaining of this paper is organized as follows. Section 2 introduces existing datasets and benchmarks that are related to perception for autonomous driving. Section 3 explains the K-Radar dataset and baseline NNs. Section 4 discusses the experimental results of the baseline NN on the K-Radar dataset. Section 5 concludes the paper with a summary and discussion on the limitations of this study. + +# 2 Related Works + +Deep neural networks generally require a large amount of training samples collected from diverse conditions so that they can achieve remarkable performance with excellent generalization. In autonomous driving, there are numerous object detection datasets that provide large-scale data of various sensor modalities, shown in Table 1. + +Table 1: Comparison of object detection datasets and benchmarks for autonomous driving. HR and LR refer to High Resolution Lidar with more than 64 channels and Low Resolution with less than 32 channels, respectively. Bbox., Tr.ID, and Odom. refer to bounding box annotation, tracking ID, and odometry, respectively. Bold text indicates the best entry in each category. + +
Data -setNum. dataSensorsBbox.Label Tr. IDOdom.
RTRPCLPCCameraGPS
K-Radar (ours)35K4D4DHR.360.RTK3DOO
VoD8.7KX4DHR.FrontRTK3DOO
Astyx0.5KX4DLR.FrontX3DXX
RADDet10K3D3DXFrontX2DXX
Zendar4.8K3D3DLR.FrontGPS2DOO
RADIATE44K3D3DLR.FrontGPS2DOO
CARRADA12.6K3D3DXFrontX2DOX
CRUW396K3D3DXFrontXPointOX
NuScenes40KX3DLR.360.RTK3DOO
Waymo230KXXHR.360.X3DOX
KITTI15KXXHR.FrontRTK3DOO
BDD100k120MXXXFrontRTK2DOO
+ +KITTI (Geiger et al., 2012) is one of the earliest and widely-used datasets for autonomous driving object detection that provide camera and Lidar measurements along with accurate calibration parameters and 3D bounding box labels. However, the number of samples and the diversity of the dataset is relatively limited since the 15K frames of the dataset are collected mostly in urban areas during daytime. Waymo (Sun et al., 2020) and NuScenes (Caesar et al., 2020) on the other hand provide a significantly larger number of samples with 230K and 40K frames, respectively. In both datasets, the frames are collected during both daytime and nighttime, increasing the diversity of the datasets. Additionally, NuScenes provides 3D Radar point clouds (RPC), and Nabati and Qi (2021) demonstrates that utilizing Radar as an auxiliary input to the neural network can improve the detection performance of the network. However, RPC lose a substantial amount of information due to the CFAR thresholding operation and result in inferior detection performance when being used as the primary input to the network. For example, the state-of-the-art performance of Lidar-based 3D object detection on NuScenes dataset is $69.7\%$ mAP, whereas for Radar-based is only $4.9\%$ mAP. + +In the literature, there are several 3DRT-based object detection datasets for autonomous driving. CARRADA (Ouaknine et al., 2021) provides Radar tensors in the range-azimuth and range-Doppler dimensions with labels of up to two objects in a controlled environment (wide flat surface). Zenar (Mostajabi et al., 2020), RADIATE (Sheeny et al., 2021), and RADDet (Zhang et al., 2021) on the other hand provide Radar tensors collected on real road environments, but can only provide 2D BEV bounding box labels due to the lack of height information in 3DRTs. CRUW (Wang et al., 2021b) provides a large number of 3DRTs, but annotations only provide 2D point locations of objects. VoD (Palffy et al., 2022) and Asytx (Meyer and Kuschk, 2019) provide 3D bounding box labels with 4DRPCs. However, the dense 4DRTs are not made available, and the number of samples in the datasets is relatively small (i.e., $8.7\mathrm{K}$ and $0.5\mathrm{K}$ frames). To the best of our knowledge, the proposed K-Radar is the first large-scale dataset that provide 4DRT measurements on diverse conditions along with 3D bounding box labels. + +Table 2: Comparison of object detection datasets and benchmarks for autonomous driving. d/n refers to day and night. Bold text indicates the best entry in each category. + +
DatasetWeather conditionsTime
K-Radar (ours)overcast, fog, rain, sleet, snowd/n
VoDXday
AstyxXday
RADDetXday
ZendarXday
RADIATEovercast, fog, rain, snowd/n
CARRADAXday
CRUWXday
NuScenesovercast, raind/n
Waymoovercastd/n
KITTIXday
BDD100kovercast, fog, rain, snowd/n
+ +Autonomous cars should be capable to operate safely even under adverse weather conditions, therefore, the availability of adverse weather data in an autonomous driving dataset is crucial. In the literature, the BDD100K (Yu et al., 2020) and RADIATE datasets contain frames acquired under adverse weather conditions, as shown in Table 2. However, BDD100K only provides RGB front images, while RADIATE only provides 32-channel low-resolution LPC. Meanwhile, the proposed K-Radar provides 4DRT, 64-channel and 128-channel high-resolution LPC, and 360-degree RGB stereo images, which enables the development of multi-modal approaches using Radar, Lidar, and camera for various perception problems for autonomous driving under adverse weather conditions. + +# 3 K-Radar + +In this section, we describe the configuration of the sensors used to construct the K-Radar dataset, the data collection process, and the distribution of the data. Then, we explain the data structure of a 4DRT, along with the visualization, calibration, and labelling processes. Finally, we present 3D object detection baseline networks that can directly consume 4DRT as the input. + +# 3.1 Sensor specification for K-Radar + +To collect data under adverse weathers, we install five types of waterproofed sensors (listed in Appendix B) with IP66 rating, according to the configuration shown in Figure 3. First, a 4D Radar is attached to the front grill of the car to prevent multi-path phenomenon due to the bonnet or ceiling of the car. Second, a 64-channel Long Range Lidar and a 128-channel High Resolution Lidar are positioned at the centre of the car's roof with different heights (Figure 3-(a)). The Long-Range LPCs are used for accurately labelling objects of various distances, while the High-Resolution LPCs provide dense information with a wide (i.e., 44.5 degree) vertical field of view (FOV). Third, a stereo camera is placed on the front, rear, left, and right side of the vehicle, which results in four stereo RGB images that cover 360-degree FOV from the ego-vehicle perspective. Last, an RTK-GPS antenna and two IMU sensors are set on the rear side of the vehicle to enable accurate positioning of the ego-vehicle. + +# 3.2 Data collection and distribution + +The majority of frames with adverse weather conditions are collected in Gangwon-do of the Republic of Korea, a province that has the highest annual snowfall nationally. On the other hand, frames with + +![](images/eb01e82d610cb21902f9465aaa2d06e240c5c3b739948e2b710d7d181e1578e5.jpg) +Figure 3: Sensor suite for K-Radar and coordinate system of each sensor. (a) shows the condition of the sensors after a 5 minute drive in heavy snow. Since the car drives forward, snow accumulates heavily in front of the sensors and covers the front camera lens, Lidar and Radar surfaces as shown in (a). As a result, during heavy snow, most of the information regarding the environment cannot be acquired by the front-facing camera and the Lidar. In contrast, Radar sensors are robust to adverse weathers, since the emitted waves can pass through raindrops and snowflakes. This figure emphasizes (1) the importance of Radar in adverse weather conditions, especially in heavy snowy conditions, and (2) the need for sensor placement and additional design (e.g., installation of wipers in front of the Lidar) considering the adverse weather conditions. (b) shows the installation location of each sensor and the coordinate system of each sensor. + +![](images/1125dd997bca84cd03311503b1de541380cddc0b7b52e7fdd80d684222c5f9b4.jpg) +Figure 4: Distribution of data over collection time (night/day), weather conditions, and road types. The central pie chart shows the distribution of data over collection time, while the left and right pie charts show the distribution of data over weather conditions and road types for the train and test sets, respectively. At the outer edges of each pie chart, we state the collection time, weather conditions, and road types, and at the inner part, we state the number of frames in each distribution. + +![](images/7f16274065e7a4cb072baccda7b64d4c359dee7015f863240bfe89b0d7fea7bf.jpg) + +![](images/262a79cda55113abc3e6b6c9a03ba88e2946fa38bb565facd276fb9c82805e81.jpg) + +urban environments are mostly collected in Daejeon of the Republic of Korea. The data collection process results in 35K frames of multi-modal sensor measurements that constitute the K-Radar dataset. We classify the collected data into several categories according to the criteria listed on Appendix C. In addition, we split the dataset into training and test sets in a way that each condition appears in both sets in a balanced manner, as shown in Figure 4. + +In total, there are 93.3K 3D bounding box labels for objects (i.e., sedan, bus or truck, pedestrian, bicycle, and motorcycle) on the road within the longitudinal radius of $120\mathrm{m}$ and lateral radius of $80\mathrm{m}$ from the ego-vehicle. Note that we only annotate objects that appear in the positive longitudinal axis, i.e., in front of the ego-vehicle. + +In Figure 5, we show the distribution of object classes and object distances from the ego-vehicle in the K-Radar dataset. The majority of objects lie within $60\mathrm{m}$ distance from the ego-vehicle, with $10\mathrm{K} \sim 15\mathrm{K}$ objects appearing in each of the $0\mathrm{m} \sim 20\mathrm{m}$ , $20\mathrm{m} \sim 40\mathrm{m}$ , and $40\mathrm{m} \sim 60\mathrm{m}$ distance categories, and around $7\mathrm{K}$ objects appearing in over $60\mathrm{m}$ distance category. As a result, K-Radar can be used to evaluate the performance of a 3D object detection networks for objects on various distances. + +# 3.3 Data visualization, calibration, and annotation processes + +![](images/522f66bda4d9f40b9fee8cb2d56bce6caebba01bd060ce9a317a04463524b690.jpg) +Figure 5: Objects classes and distance-to-ego-vehicle distribution for the training/test splits provided in the K-Radar dataset. We state the object class name and distance to the ego-vehicle in the outer part of the piechart, and the number of objects in each distribution in the inner part of the pie chart. + +Contrary to the 3D Radar tensor (3DRT) that lacks height information, 4D Radar tensor + +(4DRT) is a dense data tensor filled with power measurements in four dimensions: Doppler, range, azimuth, and elevation. However, the additional dimensionality of dense data imposes a challenge in visualizing 4DRT as a sparse data such as a point cloud (Figure 2). To cope with the problem, we visualize 4DRT as a two-dimensional heat map in the Cartesian coordinate system through heuristic processing as shown in Figure 6-(a), which results in 2D heatmap visualizations in the bird-eye-view (BEV-2D), front-view (FV-2D), and side-view (SV-2D). We refer to these 2D heatmaps collectively as BFS-2D. + +Through the BEV-2D, we can intuitively verify the robustness of 4D Radars to adverse weather conditions as shown in Figure 2. As mentioned earlier, camera and Lidar measurements can deteriorate under adverse weather conditions such as rain, sleet, and snow. In Figure 2-(e,f), we show that the measurements of a Lidar for a long-distance object are lost in heavy snow conditions. However, the + +![](images/31b3c67de713a78f8e92ff03be3ea93c611e783cb6af0895666b49b407e7c618.jpg) +(a) Visualization process of 4D Radar tensor (4DRT) + +![](images/879309db786633d911b8be5be5de5af0f480d21ab203d1637adc6eddca0508e7.jpg) +(b) Example scene of visualizing object in 4D Radar tensor (4DRT) +Figure 6: (a) A 4DRT visualization process and (b) the 4DRT visualization results. (a) is the process of visualizing 4DRT (polar coordinate) into BFS-2D (Cartesian coordinate) through a three-step process: (1) extracting the 3D Radar tensor that contains measurements along the range, azimuth, and elevation dimensions (3DRT-RAE) by reducing the Doppler dimension of the 4DRT through dimension-wise averaging, (2) transforming the 3DRT-RAE (polar coordinate) into 3DRT-XYZ (Cartesian coordinate), (3) by removing one of the three dimensions of 3DRT-XYZ, the 4DRT is finally visualized as a two-dimensional Cartesian coordinate system. (b) is an example in which 4DRT-3D information is visualized as BFS-2D through the process of (a). We also show the front view camera image and the LPC of the same frame on the upper side of (b), and the bounding box of the car is marked in red. As shown in (b), the 4DRT is represented by three types of views (i.e., BEV, side view, and front view). We note that high power measurements are observed on wheels rather than the body of the vehicle when compared to the actual vehicle model picture with the side view and front view of the object. This is because radio wave reflection occurs mainly in wheels made of metal (Brisken et al., 2018), not in the body of a vehicle made of reinforced plastic. + +BEV-2D of the 4DRT clearly indicate the object with high-power measurements on the edge of the bounding box of the objects. + +Even with the BFS-2D, it is still challenging for a human annotator to recognize the shape of objects appearing on the frame and accurately annotate the corresponding 3D bounding boxes. Therefore, we create a tool that enables 3D bounding boxes annotation in LPCs where object shapes are more recognizable. In addition, we use the BEV-2D to help the annotators in the case of lost Lidar measurements due to adverse weather conditions. The details are covered in Appendix D.1. + +We also present a tool for frame-by-frame calibration of the BEV-2D and the LPC to transform the 3D bounding box labels from the Lidar coordinate frame to the 4D Radar coordinate frame. The calibration tool supports a resolution of $1\mathrm{cm}$ per pixel with a maximum error of $0.5\mathrm{cm}$ . The details of calibration between 4D Radar and Lidar are covered in Appendix D.2. + +Additionally, we precisely obtain the calibration parameter between Lidar and the camera through a series of processes detailed in Appendix D.3. The calibration process between Lidar and camera enables the 3D bounding boxes and LPCs to be projected accurately onto camera images, which is crucial for multi-modal sensor fusion study, and can be used to produce dense depth maps for monocular depth estimation study. + +# 3.4 Baseline NNs for K-Radar + +We provide two baseline NNs to demonstrate the importance of height information for 3D object detection: (1) Radar Tensor Network with Height (RTNH) that extracts feature maps (FMs) from RT with 3D Sparse CNN so that height information is utilized, and (2) Radar Tensor Network without Height (RTN) that extracts FMs from RT with 2D CNN that does not utilize height information. + +As shown in Figure 7, both RTNH and RTN consist of pre-processing, backbone, neck, and head. The pre-processing transforms the 4DRT from polar to Cartesian coordinate frame and extracts a 3DRT-XYZ within the region of interest (RoI). Note that we reduce the Doppler dimension by taking the mean value along the dimension. The backbone then extracts FMs that contain important features for the bounding box predictions. And the head predicts 3D bounding boxes from the concatenated FM produced by the neck. + +![](images/27fa1e123e33e473e20f2091724e89c818d529bdfa1372757f8f80a10d059fef.jpg) +Figure 7: Two baseline NNs for verifying 4DRT-based 3D object detection performance. + +The network structure of RTNH and RTN, described in details in Appendix E, is similar except the backbone. We construct the backbones of RTNH and RTN with 3D Sparse Conv Backbone (3D-SCB) and 2D Dense Conv Backbone (2D-DCB), respectively. 3D-SCB utilizes 3D sparse convolution (Liu et al., 2015) so that the three-dimensional spatial information $(\mathrm{X},\mathrm{Y},\mathrm{Z})$ can be encoded into the final FM. We opt to use the sparse convolution on sparse RT (top- $10\%$ power measurements in the RT) since dense convolution on the original RT requires a prohibitively large amount of memory and computations that are unsuitable for real-time autonomous driving applications. Unlike 3D-SCB, 2D-DCB uses 2D convolution so that only two-dimensional spatial information $(\mathrm{X},\mathrm{Y})$ is encoded into the final FM. As a result, the final FM produced by 3D-SCB contains 3D information (with height), whilst the final FM produced by 2D-DCB only contains 2D information (without height). + +# 4 Experiment + +In this section, we demonstrate the robustness of 4DRT-based perception for autonomous driving under various weatherers in order to find 3D object detection performance comparison between the baseline NN and a similarly-structured Lidar-based NN, PointPillars (Lang et al., 2019). We also discuss the importance of height information by comparing 3D object detection performance between baseline NN with 3D-SCB backbone (RTNH) and baseline NN with 2D-DCB backbone (RTN). + +# 4.1 Experiment Setup and Metric + +Implementation Detail We implement the baseline NNs and PointPillars using PyTorch 1.11.0 on Ubuntu machines with a RTX3090 GPU. We set the batch size to 4 and train the networks for 11 epochs using Adam optimizer with a learning rate of 0.001. Note that we set the detection target to the sedan class, which has the largest number of samples in K-Radar dataset. + +Metric In the experiments, we utilize the widely-used Intersection Over Union (IOU)-based Average Precision (AP) metric to evaluate the 3D object detection performance. We provide APs for BEV $(AP_{BEV})$ and 3D $(AP_{3D})$ bounding boxes predictions as in (Geiger et al., 2012), where a prediction is considered to be a true positive if the IoU is over 0.3. + +Table 3: Performance comparison of baseline NNs with or without height Information. + +
Baseline NNsAP3D [%]APBEV [%]GPU RAM [MB]
RTNH47.4458.39421
RTN40.1250.67520
+ +# 4.2 Comparison between RTN and RTNH + +We show the detection performance comparison between RTNH and RTN on Table 3. We can observe that RTNH has $7.32\%$ and $7.72\%$ higher performance in $AP_{3D}$ and $AP_{BEV}$ , respectively, compared to RTN. RTNH significantly surpasses RTN in terms of both $AP_{3D}$ and $AP_{BEV}$ , indicating the importance of height information available in the 4DRT for 3D object detection. Furthermore, RTNH requires less GPU memory compared to RTN since it utilizes the memory-efficient sparse convolutions as mentioned in Section 3.4. + +# 4.3 Comparison between RTNH and PointPillars + +Table 4: Performance comparison of NNs of Radar and Lidar under various weather conditions + +
NetworksMetricTotalnor-malover-castfograinsleetlight snowheavy snow
RTNH (4D Radar)AP3D[%]47.449.956.752.842.041.550.644.5
APBEV[%]58.458.564.276.258.460.357.656.6
PointPillars (Lidar)AP3D[%]45.452.356.042.244.522.740.629.7
APBEV[%]49.356.661.052.057.823.151.630.8
+ +We show the detection performance comparison between RTNH and a similarly-structured Lidar-based detection network, PointPillars, in Table 4. The Lidar-based network suffers significant BEV and 3D detection performance drops of $33.5\%$ and $29.6\%$ or $25.8\%$ and $22.6\%$ , respectively, in sleet or heavy snow condition compared to the normal condition. In contrast, the 4D radar-based RTNH detection performance is hardly affected by adverse weathers, where the BEV and 3D object detection performances in sleet or heavy snow condition are better or similar compared to the normal condition. The results testify the robustness of 4D radar-based perception in adverse weathers. We provide qualitative results and additional discussions for other weather conditions in Appendix F. + +# 5 Limitation and Conclusion + +In this section, we discuss the limitations of K-Radar and provide a summary of this work, along with suggestions on the future research directions. + +# 5.1 Limitation of the FOV coverage of 4DRTs + +As mentioned in Section 3.1, K-Radar provides 4D radar measurements in the forward direction, with an FOV of 107 degree. The measurement coverage is more limited compared to the 360 degree FOV of Lidar and camera. This limitation is originated from the size of a 4DRT with dense measurements in four dimensions, which require significantly larger memory to store the data compared to a camera image with two dimensions or a LPC with three dimensions. Specifically, the size of the 4DRT data in K-Radar is roughly 12TB, while the size of surround camera images data is about 0.4TB, and the size of LPCs data is about 0.6TB. Since providing 360 degrees 4DRT measurements requires a prohibitively large amount of memory, we opt to record 4DRT data only in the forward direction, which could provide the most relevant information for autonomous driving. + +# 5.2 Conclusion + +In this paper, we have introduced a 4DRT-based 3D object detection dataset and benchmark, K-Radar. The K-Radar dataset consists of 35K frames with 4DRT, LPC, surround camera images, and RTK-IMU data, all of which are collected in various time and weather conditions. K-Radar provides 3D bounding box labels and tracking ID for 93.3K objects of five classes with distance of up to $120\mathrm{m}$ . To verify the robustness of 4D radar-based object detection, we introduce baseline NNs that uses 4DRT as the input. From experimental results, we demonstrate the importance of height information that is not available in the conventional 3DRT and the robustness of 4D radar under adverse weathers for 3D object detection. While the experiments in this work are focused on 4DRT-based 3D object detection, K-Radar can be used for 4DRT-based object tracking, SLAM, and various other perception tasks. Therefore, we hope that K-Radar can accelerate works in 4DRT-based perception for autonomous driving. + +# Acknowledgment + +This work was partly supported by Institute of Information & communications Technology Planning & Evaluation (IITP) grant funded by the Korea government (MSIT) (No. 01210790) and the National Research Foundation of Korea (NRF) grant funded by the Korea government (MSIT) (No. 2021R1A2C3008370). + +# References + +Dong-Hee Paek, Seung-Hyun Kong, and Kevin Tirta Wijaya. K-lane: Lidar lane dataset and benchmark for urban roads and highways. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops, June 2022. +Lizhe Liu, Xiaohao Chen, Siyu Zhu, and Ping Tan. Condlanenet: a top-to-down lane detection framework based on conditional convolution. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 3773-3782, 2021. +Chien-Yao Wang, Alexey Bochkovskiy, and Hong-Yuan Mark Liao. Scaled-yolov4: Scaling cross stage partial network. In Proceedings of the IEEE/cvf conference on computer vision and pattern recognition, pages 13029-13038, 2021a. +Alex H Lang, Sourabh Vora, Holger Caesar, Lubing Zhou, Jiong Yang, and Oscar Beijbom. Pointpillars: Fast encoders for object detection from point clouds. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 12697-12705, 2019. +Bence Major, Daniel Fontijne, Amin Ansari, Ravi Teja Sukhavasi, Radhika Gowaikar, Michael Hamilton, Sean Lee, Slawomir Grzechnik, and Sundar Subramanian. Vehicle detection with automotive radar using deep learning on range-azimuth-doppler tensors. In 2019 IEEE/CVF International Conference on Computer Vision Workshop (ICCVW), pages 924-932, 2019. doi: 10.1109/ICCVW.2019.00121. +René Ranftl, Alexey Bochkovskiy, and Vladlen Koltun. Vision transformers for dense prediction. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 12179-12188, 2021. +Zachary Teed and Jia Deng. Droid-slam: Deep visual slam for monocular, stereo, and rgb-d cameras. Advances in Neural Information Processing Systems, 34, 2021. +Akhil Kurup and Jeremy Bos. Dsor: A scalable statistical filter for removing falling snow from lidar point clouds in severe winter weather. arXiv preprint arXiv:2109.07078, 2021. +Fahad Jibrin Abdu, Yixiong Zhang, Maozhong Fu, Yuhan Li, and Zhenmiao Deng. Application of deep learning on millimeter-wave radar signals: A review. Sensors, 21(6), 2021. ISSN 1424-8220. doi: 10.3390/s21061951. +Xu Dong, Pengluo Wang, Pengyue Zhang, and Langechuan Liu. Probabilistic oriented object detection in automotive radar. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops, June 2020. +Mohammadreza Mostajabi, Ching Ming Wang, Darsh Ranjan, and Gilbert Hsyu. High resolution radar dataset for semi-supervised learning of dynamic objects. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), pages 450-457, 2020. doi: 10.1109/CVPRW50498.2020.00058. +Marcel Sheeny, Emanuele De Pellegrin, Saptarshi Mukherjee, Alireza Ahrabian, Sen Wang, and Andrew Wallace. Radiate: A radar dataset for automotive perception in bad weather. In 2021 IEEE International Conference on Robotics and Automation (ICRA), pages 1-7. IEEE, 2021. +Andreas Geiger, Philip Lenz, and Raquel Urtasun. Are we ready for autonomous driving? the kitti vision benchmark suite. In 2012 IEEE Conference on Computer Vision and Pattern Recognition, pages 3354-3361, 2012. doi: 10.1109/CVPR.2012.6248074. +Pei Sun, Henrik Kretzschmar, Xerxes Dotiwalla, Aurelien Chouard, Vijaysai Patnaik, Paul Tsui, James Guo, Yin Zhou, Yuning Chai, Benjamin Caine, et al. Scalability in perception for autonomous driving: Waymo open dataset. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 2446-2454, 2020. +Holger Caesar, Varun Bankiti, Alex H. Lang, Sourabh Vora, Venice Erin Liong, Qiang Xu, Anush Krishnan, Yu Pan, Giancarlo Baldan, and Oscar Beijbom. nuscenes: A multimodal dataset for autonomous driving. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020. +Ramin Nabati and Hairong Qi. Centerfusion: Center-based radar and camera fusion for 3d object detection. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pages 1527-1536, 2021. +Arthur Ouaknine, Alasdair Newson, Julien Rebut, Florence Tupin, and Patrick Perez. Carrada dataset: Camera and automotive radar with range-angle-doppler annotations. In 2020 25th International Conference on Pattern Recognition (ICPR), pages 5068-5075. IEEE, 2021. + +Ao Zhang, Farzan Erlik Nowruzi, and Robert Laganiere. Raddet: Range-azimuth-doppler based radar object detection for dynamic road users. In 2021 18th Conference on Robots and Vision (CRV), pages 95-102. IEEE, 2021. +Yizhou Wang, Gaoang Wang, Hung-Min Hsu, Hui Liu, and Jenq-Neng Hwang. Rethinking of radar's role: A camera-radar dataset and systematic annotator via coordinate alignment. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops, pages 2815-2824, June 2021b. +Andras Palffy, Ewoud Pool, Srimannarayana Baratam, Julian F. P. Kooij, and Dariu M. Gavrila. Multi-class road user detection with 3+1d radar in the view-of-delft dataset. IEEE Robotics and Automation Letters, 7(2): 4961-4968, 2022. doi: 10.1109/LRA.2022.3147324. +Michael Meyer and Georg Kuschk. Automotive radar dataset for deep learning based 3d object detection. In 2019 16th European Radar Conference (EuRAD), pages 129-132, 2019. +Fisher Yu, Haofeng Chen, Xin Wang, Wenqi Xian, Yingying Chen, Fangchen Liu, Vashisht Madhavan, and Trevor Darrell. Bdd100k: A diverse driving dataset for heterogeneous multitask learning. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 2636-2645, 2020. +Stefan Briske, Florian Ruf, and Felix Hohne. The recent evolution of automotive imaging radar and its information content. IET Radar, Sonar, Navigation, 12, 04 2018. doi: 10.1049/iet-rsn.2018.0026. +Baoyuan Liu, Min Wang, Hassan Foroosh, Marshall Tappen, and Marianna Penksy. Sparse convolutional neural networks. In 2015 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 806-814, 2015. doi: 10.1109/CVPR.2015.7298681. \ No newline at end of file diff --git a/kradar4dradarobjectdetectionforautonomousdrivinginvariousweatherconditions/images.zip b/kradar4dradarobjectdetectionforautonomousdrivinginvariousweatherconditions/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..ae6b9aeb9956ea0c3d9a36eddf5ccb1697477925 --- /dev/null +++ b/kradar4dradarobjectdetectionforautonomousdrivinginvariousweatherconditions/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:833bc7f400b61a8ee6a6aeb6a2caf6f63f4374d407f5893d354aa21bc2d5abcf +size 580065 diff --git a/kradar4dradarobjectdetectionforautonomousdrivinginvariousweatherconditions/layout.json b/kradar4dradarobjectdetectionforautonomousdrivinginvariousweatherconditions/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..95f406cd44387fdef966bca0f1120f18adaa5c65 --- /dev/null +++ b/kradar4dradarobjectdetectionforautonomousdrivinginvariousweatherconditions/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3add4dfae39b310cc96964a707c7d9a814f8b79cdd8ca2a7f51b598815d5f62e +size 254453 diff --git a/ksdaggregatedgoodnessoffittest/4118e8b8-7447-4efb-a526-bb87d5234b8d_content_list.json b/ksdaggregatedgoodnessoffittest/4118e8b8-7447-4efb-a526-bb87d5234b8d_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..109beacbd44b8b16f322d0e4bd1a4509c4b8b4c0 --- /dev/null +++ b/ksdaggregatedgoodnessoffittest/4118e8b8-7447-4efb-a526-bb87d5234b8d_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:76242cc4b969b534ead0801196b36ab3681fe616bb10a803af8d37fda825ff1b +size 98057 diff --git a/ksdaggregatedgoodnessoffittest/4118e8b8-7447-4efb-a526-bb87d5234b8d_model.json b/ksdaggregatedgoodnessoffittest/4118e8b8-7447-4efb-a526-bb87d5234b8d_model.json new file mode 100644 index 0000000000000000000000000000000000000000..93475d77c34f299c15732cf3aca68620ed229ff6 --- /dev/null +++ b/ksdaggregatedgoodnessoffittest/4118e8b8-7447-4efb-a526-bb87d5234b8d_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a75941ed25cd7c87a02a3044f9a94a17c674b98826a44cd35f8ce6cb9223c20 +size 127963 diff --git a/ksdaggregatedgoodnessoffittest/4118e8b8-7447-4efb-a526-bb87d5234b8d_origin.pdf b/ksdaggregatedgoodnessoffittest/4118e8b8-7447-4efb-a526-bb87d5234b8d_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..72b79c19ef5bdf6db3c51be744ff9205cf2b52dc --- /dev/null +++ b/ksdaggregatedgoodnessoffittest/4118e8b8-7447-4efb-a526-bb87d5234b8d_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b7a88c715b13a7a232257a47646415744192056799aa3b45eb107a3142eb563d +size 1203070 diff --git a/ksdaggregatedgoodnessoffittest/full.md b/ksdaggregatedgoodnessoffittest/full.md new file mode 100644 index 0000000000000000000000000000000000000000..748085ab98391f8035885bf695a0e5c261d80aaa --- /dev/null +++ b/ksdaggregatedgoodnessoffittest/full.md @@ -0,0 +1,491 @@ +# KSD Aggregated Goodness-of-fit Test + +# Antonin Schrab + +Centre for Artificial Intelligence Gatsby Computational Neuroscience Unit University College London & Inria London a.schrab@ucl.ac.uk + +# Benjamin Guedj + +Centre for Artificial Intelligence +University College London & Inria London +b.guedj@ucl.ac.uk + +# Arthur Gretton + +Gatsby Computational Neuroscience Unit +University College London +arthur.gretton@gmail.com + +# Abstract + +We investigate properties of goodness-of-fit tests based on the Kernel Stein Discrepancy (KSD). We introduce a strategy to construct a test, called KSDAGG, which aggregates multiple tests with different kernels. KSDAGG avoids splitting the data to perform kernel selection (which leads to a loss in test power), and rather maximises the test power over a collection of kernels. We provide non-asymptotic guarantees on the power of KSDAGG: we show it achieves the smallest uniform separation rate of the collection, up to a logarithmic term. For compactly supported densities with bounded model score function, we derive the rate for KSDAGG over restricted Sobolev balls; this rate corresponds to the minimax optimal rate over unrestricted Sobolev balls, up to an iterated logarithmic term. KSDAGG can be computed exactly in practice as it relies either on a parametric bootstrap or on a wild bootstrap to estimate the quantiles and the level corrections. In particular, for the crucial choice of bandwidth of a fixed kernel, it avoids resorting to arbitrary heuristics (such as median or standard deviation) or to data splitting. We find on both synthetic and real-world data that KSDAGG outperforms other state-of-the-art quadratic-time adaptive KSD-based goodness-of-fit testing procedures. + +# 1 Introduction + +Kernel selection remains a fundamental problem in kernel-based nonparametric hypothesis testing, as it significantly impacts the test power. Kernel selection has attracted a significant interest in the literature, and a number of methods have been proposed in the two-sample, independence and goodness-of-fit testing frameworks, such as using heuristics (Gretton et al., 2012a), relying on data splitting (Gretton et al., 2012b; Sutherland et al., 2017; Kübler et al., 2022), learning deep kernels (Grathwohl et al., 2020; Liu et al., 2020), working in the post-selection inference framework (Yamada et al., 2019; Lim et al., 2019; 2020; Kübler et al., 2020; Freidling et al., 2021), to name but a few. + +In this work, we focus on aggregated tests, which have been investigated for the two-sample problem by Fromont et al. (2013), Kim et al. (2022) and Schrab et al. (2021) using the Maximum Mean Discrepancy (MMD; Gretton et al., 2012a), and for the independence problem by Albert et al. (2022) and Kim et al. (2022) using the Hilbert Schmidt Independence Criterion (HSIC; Gretton et al., 2005). We extend the use of aggregated tests to the goodness-of-fit setting, where we are given a model and some samples, and test whether the samples have been drawn from the model. We employ the Kernel Stein Discrepancy (KSD; Chwialkowski et al., 2016; Liu et al., 2016) as our test statistic, which is an ideal measure of distance for this setting: it admits an estimator which can be computed without + +requiring samples from the model, and does not require the model to be normalised. To the best of our knowledge, ours represents the first aggregation procedure for the KSD test in the literature. + +Related work. Fromont et al. (2012, 2013) introduced non-asymptotic aggregated tests for the two-sample problem with sample sizes following a Poisson process, using an unscaled version of the MMD. Using a wild bootstrap, they derived uniform separation rates (Ingster, 1987; Ingster, 1989; 1993a,b; Baraud, 2002). Albert et al. (2022) then proposed an independence aggregated test using the HSIC, with guarantees using a theoretical quantile, but relying on permutations to obtain the test threshold in practice. Kim et al. (2022) then extended those theoretical results to also hold for the quantile estimated using permutations, however, they did not obtain the desired level dependency in their HSIC bound. All those aforementioned results were proved for the Gaussian kernel only. Schrab et al. (2021) generalised the two-sample results to hold for the usual MMD estimator and for a wide range of kernels using either a wild bootstrap or permutations, and provided optimality results which hold with fewer restrictions. Our work builds and extends on the above non-asymptotic results: we consider the goodness-of-fit framework, where we have samples from only one of the two densities. The main challenges arise from working with the Stein kernel which defines the KSD test statistic: for example, we lose the transition-invariant property of the kernel which is crucial to work in the Fourier domain. Balasubramanian et al. (2021) considered adaptive MMD-based goodness-of-fit tests and obtained their uniform separation rates over Sobolev balls in the asymptotic regime. More generally, Li and Yuan (2019) studied asymptotic adaptive kernel-based tests for the three testing frameworks. Tolstikhin et al. (2016) derived minimax rates for MMD estimators using radial universal kernel (Sriperumbudur et al., 2011). Schrab et al. (2022) extends this work, together with those of Albert et al. (2022) and Schrab et al. (2021), to construct efficient aggregated tests for the three testing frameworks using incomplete $U$ -statistics. They quantify the cost in the minimax rate over Sobolev balls incurred for computational efficiency, and prove minimax optimality of the quadratic-time HSIC permuted aggregated test by improving the bound of Kim et al. (2022). See Appendix C for details. + +Contributions. We propose a solution to the fundamental kernel selection problem for the widely-used KSD goodness-of-fit tests: we construct an adaptive test KSDAGG which aggregates multiple tests with different kernels. Our contribution is in showing, both theoretically and experimentally, that the aggregation procedure works in this novel setting in which it has never been considered before. We work in the kernel selection framework; this general setting has many applications including the one of kernel bandwidth selection. Our aggregated test allows for two numerical methods for estimating the test thresholds: the wild bootstrap and the parametric bootstrap (a procedure unique to the goodness-of-fit framework). We conduct a theoretical analysis: we derive a general condition which guarantees test power for KSDAGG in terms of its uniform separation rate, with extra assumptions including regularity over restricted Sobolev balls we prove that KSDAGG attains the minimax rate over (unrestricted) Sobolev balls. We discuss the implementation of KSDAGG and experimentally validate our proposed approach on benchmark problems, not only on datasets classically used in the literature but also on original data obtained using state-of-the-art generative models (i.e. Normalizing Flows). We observe, both on synthetic and real-world data, that KSDAGG obtains higher power than other KSD-based adaptive state-of-the-art tests. Contributing to the real-world applications of these goodness-of-fit tests, we provide publicly available code to allow practitioners to employ our method: https://github.com/antoninschrab/ksdagg-paper + +# 2 Notation + +We consider the goodness-of-fit problem where given access to a known model probability density $p$ (which can be unnormalised since we actually only need access to its score function $\nabla \log p(\cdot)$ ) and to some i.i.d. $d$ -dimensional samples $\mathbb{X}_N \coloneqq (X_i)_{i=1}^N$ drawn from an unknown data density $q$ , we want to decide whether $p \neq q$ holds. This can be expressed as a statistical hypothesis testing problem with null hypothesis $\mathcal{H}_0: p = q$ and alternative $\mathcal{H}_a: p \neq q$ . + +As a measure of distance between $p$ and $q$ , we use the Kernel Stein Discrepancy (KSD) introduced by Chwialkowski et al. (2016) and Liu et al. (2016). For a kernel $k$ , the KSD is the Maximum Mean Discrepancy (MMD; Gretton et al., 2012a) between $p$ and $q$ using the Stein kernel associated to $k$ + +$$ +\begin{array}{l} \mathrm {K S D} _ {p, k} ^ {2} (q) := \mathrm {M M D} _ {h _ {p, k}} ^ {2} (p, q) := \mathbb {E} _ {q, q} [ h _ {p, k} (X, Y) ] - 2 \mathbb {E} _ {p, q} [ h _ {p, k} (X, Y) ] + \mathbb {E} _ {p, p} [ h _ {p, k} (X, Y) ] \\ = \mathbb {E} _ {q, q} [ h _ {p, k} (X, Y) ] \\ \end{array} +$$ + +where the Stein kernel $h_{p,k}\colon \mathbb{R}^d\times \mathbb{R}^d\to \mathbb{R}$ is defined as + +$$ +\begin{array}{l} h _ {p, k} (x, y) := \left(\nabla \log p (x) ^ {\top} \nabla \log p (y)\right) k (x, y) + \nabla \log p (y) ^ {\top} \nabla_ {x} k (x, y) \\ + \nabla \log p (x) ^ {\top} \nabla_ {y} k (x, y) + \sum_ {i = 1} ^ {d} \frac {\partial}{\partial x _ {i} \partial y _ {i}} k (x, y) \\ \end{array} +$$ + +and satisfies the Stein identity $\mathbb{E}_p[h_{p,k}(X,\cdot)] = 0$ . Additional background details on the KSD are presented in Appendix C. A quadratic-time KSD estimator can be computed as the $U$ -statistic (Hoeffding, 1992) + +$$ +\widehat {\mathrm {K S D}} _ {p, k} ^ {2} \left(\mathbb {X} _ {N}\right) := \frac {1}{N (N - 1)} \sum_ {1 \leq i \neq j \leq N} h _ {p, k} \left(X _ {i}, X _ {j}\right). \tag {1} +$$ + +In this work, the score of the model density $p$ is always known, we do not always explicitly write the dependence on $p$ of all the variables we consider. We assume that the kernel $k$ is such that + +$$ +\mathrm {K S D} _ {p, k} ^ {2} (q) = \mathbb {E} _ {q, q} [ h _ {p, k} (X, Y) ] < \infty \quad \text {a n d} \quad C _ {k} := \mathbb {E} _ {q, q} [ h _ {p, k} (X, Y) ^ {2} ] < \infty . \tag {2} +$$ + +We now address the requirements for consistency (i.e. test power converges to 1 as the sample size goes to $\infty$ ) of the Stein test (Chwialkowski et al., 2016, Theorem 2.2): we assume that the kernel $k$ is $C_0$ -universal (Carmeli et al., 2010, Definition 4.1) and that $\mathbb{E}_q\left[\left\|\nabla\left(\log\frac{p(X)}{q(X)}\right)\right\|_2^2\right] < \infty$ . + +We use the notations $\mathbb{P}_p$ and $\mathbb{P}_q$ to denote the probability under the model distribution $p$ and under the data distribution $q$ , respectively. Given a kernel $\kappa \colon \mathbb{R}^d \times \mathbb{R}^d \to \mathbb{R}$ and a function $f \colon \mathbb{R}^d \to \mathbb{R}$ in $L^2(\mathbb{R}^d)$ , we consider the integral transform $T_\kappa$ defined as + +$$ +\left(T _ {\kappa} f\right) (y) := \int_ {\mathbb {R} ^ {d}} \kappa (x, y) f (x) d x +$$ + +for $y \in \mathbb{R}^d$ . When the kernel $\kappa$ is translation-invariant, the integral transform corresponds to a convolution. However, the lack of translation invariance of the Stein kernel introduces new challenging problems. First, working the integral transform of the Stein kernel is more complicated since it does not correspond to a simple convolution. Second, for the expectation of the Stein kernel squared, $C_k \coloneqq \mathbb{E}_{q,q}[h_{p,k}(X,Y)^2]$ , it is not possible to extract the bandwidth parameter $\lambda$ outside of the expectation as it is the case when using the usual kernel directly as for the MMD and HSIC. + +# 3 Construction of tests and bounds + +We now introduce the single and aggregated KSD tests. We show that these control the probability of type I error as desired, and provide conditions for the control of the probability of type II error. + +# 3.1 Single test + +We first construct a KSD test for a fixed kernel $k$ as proposed by Chwialkowski et al. (2016) and Liu et al. (2016). To estimate the test threshold, we can either use a wild bootstrap (Shao, 2010; Leucht and Neumann, 2013; Fromont et al., 2012; Chwialkowski et al., 2014) or a parametric bootstrap (Stute et al., 1993). Both methods work by simulating sampling values $(\bar{K}_k^1, \dots, \bar{K}_k^{B_1})$ from the (asymptotic) distribution of $\widehat{\mathrm{KSD}}_{p,k}^2$ under the null hypothesis and estimating the $(1 - \alpha)$ -quantile for $\alpha \in (0,1)$ using a Monte Carlo approximation + +$$ +\widehat {q} _ {1 - \alpha} ^ {k} := \inf \left\{u \in \mathbb {R}: 1 - \alpha \leq \frac {1}{B _ {1} + 1} \sum_ {b = 1} ^ {B _ {1} + 1} \mathbb {1} \left(\bar {K} _ {k} ^ {b} \leq u\right) \right\} = \bar {K} _ {k} ^ {\bullet \lceil (B _ {1} + 1) (1 - \alpha) \rceil} \tag {3} +$$ + +where $\bar{K}_k^{\bullet 1} \leq \dots \leq \bar{K}_k^{\bullet B_1 + 1}$ are the sorted elements $(\bar{K}_k^1, \ldots, \bar{K}_k^{B_1 + 1})$ with $\bar{K}_k^{B_1 + 1} := \widehat{\mathrm{KSD}}_{p,k}^2(\mathbb{X}_N)$ . The single test is then defined as (a test function outputs 1 when the null is rejected and 0 otherwise) + +$$ +\Delta_ {\alpha} ^ {k} (\mathbb {X} _ {N}) := \mathbb {1} \left(\widehat {\mathrm {K S D}} _ {p, k} ^ {2} (\mathbb {X} _ {N}) > \widehat {q} _ {1 - \alpha} ^ {k}\right). +$$ + +For the parametric bootstrap, we directly draw new samples $(X_{i}^{\prime})_{i = 1}^{N}$ from the model distribution $p$ (it might not always be possible to so) and compute the KSD + +$$ +\bar {K} _ {k} := \frac {1}{N (N - 1)} \sum_ {1 \leq i \neq j \leq N} h _ {p, k} \left(X _ {i} ^ {\prime}, X _ {j} ^ {\prime}\right). \tag {4} +$$ + +For the wild bootstrap, we first generate $n$ i.i.d. Rademacher random variables $\epsilon_1, \ldots, \epsilon_n$ , each taking value in $\{-1, 1\}$ , and then compute + +$$ +\bar {K} _ {k} := \frac {1}{N (N - 1)} \sum_ {1 \leq i \neq j \leq N} \epsilon_ {i} \epsilon_ {j} h _ {p, k} \left(X _ {i}, X _ {j}\right). \tag {5} +$$ + +By repeating either procedure $B_{1}$ times, we obtain the bootstrapped samples $\bar{K}_k^1,\dots ,\bar{K}_k^{B_1}$ . + +Since it uses samples from the model $p$ , the parametric bootstrap (Stute et al., 1993) results in a test with non-asymptotic level $\alpha$ . This comes at the cost of being computationally more expensive and assuming that we are able to sample from $p$ (which may be out of reach in some settings). Conversely, the wild bootstrap has the advantage of not requiring to sample from $p$ , which makes it computationally more efficient as only one kernel matrix needs to be computed, but it only achieves the desired level $\alpha$ asymptotically (Shao, 2010; Leucht and Neumann, 2013; Leucht, 2012; Chwialkowski et al., 2014; 2016) assuming Lipschitz continuity of $h_{p,k}$ (see Appendix D for details). Note that we cannot obtain a non-asymptotic level for the wild bootstrap by relying on the result of Romano and Wolf (2005, Lemma 1) as done in the two-sample framework by Fromont et al. (2013) and Schrab et al. (2021). This is because in our case $\bar{K}_k$ and $\widehat{\mathrm{KSD}}_{p,k}^2(\mathbb{X}_N)$ are not exchangeable variables under the null hypothesis, due to the asymmetry of the KSD statistic with respect to $p$ and $q$ . + +Having discussed control of the probability of type I error of the single test $\Delta_{\alpha}^{k}$ , we now provide a condition on $\| p - q \|_2$ which ensures that the probability of type II error is controlled by some $\beta \in (0,1)$ . The smallest such value of $\| p - q \|_2$ , provided that $p - q$ lies in some given class of regular functions, is called the uniform separation rate (Ingster, 1987, 1989, 1993a,b; Baraud, 2002). + +Theorem 3.1. Suppose the assumptions listed in Appendix A.2 hold, and let $\psi \coloneqq p - q$ . There exists a positive constant $C$ such that the condition + +$$ +\| \psi \| _ {2} ^ {2} \geq \left\| \psi - T _ {h _ {p, k}} \psi \right\| _ {2} ^ {2} + C \log \left(\frac {1}{\alpha}\right) \frac {\sqrt {C _ {k}}}{\beta N} +$$ + +guarantees control over the probability of type II error, such that $\mathbb{P}_q\big(\Delta_\alpha^k (\mathbb{X}_N) = 0\big)\leq \beta$ + +Theorem 3.1, which is proved in Appendix 1.1 provides a power guaranteeing condition consisting of two terms. The first term $\| \psi - T_{h_{p,k}} \psi \|_2^2$ indicates the size of the effect of the Stein integral transform operator on the difference in densities $\psi \coloneqq p - q$ , it is a measure of distance from the null (where this quantity is zero). The second term $C \log \left(1 / \alpha\right) (\beta N)^{-1} \sqrt{C_k}$ is obtained from upper bounding the variance of the KSD $U$ -statistic, it depends on the expectation of the squared Stein kernel $C_k \coloneqq \mathbb{E}_{q,q} [h_{p,k}(X,Y)^2]$ . This second term also controls the quantile of the test. + +# 3.2 Aggregated test + +We can now introduce our aggregated test, which is motivated by the earlier works of Fromont et al. (2012, 2013), Albert et al. (2022), and Schrab et al. (2021) for two-sample and independence testing. + +We compute $\widetilde{K}_k^1,\ldots ,\widetilde{K}_k^{B_2}$ further KSD values simulated from the null hypothesis obtained using either a parametric bootstrap or a wild bootstrap as in Equations (4) or (5), respectively. We consider a finite collection $\mathcal{K}$ of kernels satisfying the properties presented in Section 2. We construct an aggregated test $\Delta_{\alpha}^{\mathcal{K}}$ called KSDAGG, which rejects the null hypothesis if one of the single tests $\left(\Delta_{u_{\alpha}w_k}^k\right)_{k\in \mathcal{K}}$ rejects it, that is + +$$ +\Delta_ {\alpha} ^ {\mathcal {K}} \left(\mathbb {X} _ {N}\right) := \mathbb {1} \left(\Delta_ {u _ {\alpha} w _ {k}} ^ {k} \left(\mathbb {X} _ {N}\right) = 1 \text {f o r s o m e} k \in \mathcal {K}\right). +$$ + +The levels of the single tests are adjusted to ensure the aggregated test has the prescribed level $\alpha$ . This adjustment is performed by introducing positive weights $(w_{k})_{k\in \mathcal{K}}$ satisfying $\sum_{k\in \mathcal{K}}w_k\leq 1$ and some correction + +$$ +u _ {\alpha} := \sup \left\{u \in \left(0, \min _ {k \in \mathcal {K}} w _ {k} ^ {- 1}\right): \widehat {P} _ {u} \leq \alpha \right\} \tag {6} +$$ + +# Algorithm 1 KSDAGG + +Inputs: samples $\mathbb{X}_N = (x_i)_{i=1}^N$ , density $p$ or score $\nabla \log p(\cdot)$ , finite kernel collection $\mathcal{K}$ , weights $(w_k)_{k \in \mathcal{K}}$ , level $\alpha \in (0, e^{-1})$ , estimation parameters $B_1, B_2, B_3 \in \mathbb{N}$ , parametric or wild bootstrap Output: 0 (fail to reject $\mathcal{H}_0$ ) or 1 (reject $\mathcal{H}_0$ ) + +# Algorithm: + +for $k\in \mathcal{K}$ do + +compute $\bar{K}_k^{B_1 + 1} \coloneqq \widehat{\mathrm{KSD}}_{p,k}^2(\mathbb{X}_N)$ as in Equation (1) + +compute $\left(\bar{K}_k^b\right)_{1 < b < B_1}$ as in Equations (4) or (5) + +$\begin{array}{r}\mathrm{sort}\left(\bar{K}_k^b\right)_{1\leq b\leq B_1 + 1} \end{array}$ in ascending order to obtain $\left(\bar{K}_k^{\bullet b}\right)_{1\leq b\leq B_1 + 1}$ + +compute $\left(\widetilde{K}_k^b\right)_{1 < b < B_2}$ as in Equations (4) or (5). + +$u_{\min} = 0$ $u_{\max} = \min_{k\in \mathcal{K}}w_k^{-1}$ + +for $t = 1,\dots ,B_3$ do + +$$ +u = \frac {1}{2} \left(u _ {\min } + u _ {\max }\right), \widehat {P} _ {u} = \frac {1}{B _ {2}} \sum_ {b = 1} ^ {B _ {2}} \mathbb {I} \left(\max _ {k \in \mathcal {K}} \left(\widetilde {K} _ {k} ^ {b} - \bar {K} _ {k} ^ {\bullet \lceil (B _ {1} + 1) (1 - u w _ {k}) \rceil}\right) > 0\right) +$$ + +if $\widehat{P}_u\leq \alpha$ then $u_{\mathrm{min}} = u$ else $u_{\mathrm{max}} = u$ + +$u_{\alpha} = u_{\min}$ + +if $\max_{k\in \mathcal{K}}\left(\widehat{\mathrm{KSD}}^{2}_{p,k}(\mathbb{X}_{N}) - \bar{K}_{k}^{\bullet \lceil (B_{1} + 1)(1 - u_{\alpha}w_{k})\rceil}\right) > 0$ then return 1 else return 0 + +Time complexity: $\mathcal{O}\big(|\mathcal{K}|(B_1 + B_2)N^2\big)$ + +where + +$$ +\widehat {P} _ {u} := \frac {1}{B _ {2}} \sum_ {b = 1} ^ {B _ {2}} \mathbb {1} \left(\max _ {k \in \mathcal {K}} \left(\widetilde {K} _ {k} ^ {b} - \bar {K} _ {k} ^ {\bullet^ {\lceil (B _ {1} + 1) (1 - u w _ {k}) \rceil}}\right) > 0\right) +$$ + +is a Monte Carlo approximation of the type I error probability of the aggregated test with correction $u$ + +$$ +P _ {u} := \mathbb {P} _ {p} \left(\max _ {k \in \mathcal {K}} \left(\widehat {\mathrm {K S D}} _ {p, k} ^ {2} (\mathbb {X} _ {N}) - \widehat {q} _ {1 - u w _ {k}} ^ {k}\right) > 0\right). +$$ + +To compute $u_{\alpha}$ , we estimate the supremum in Equation (6) by performing $B_{3}$ steps of the bisection method, the theoretical results account for this extra approximation. Detailed pseudocode for KSDAGG is provided in Algorithm 1 and details regarding our aggregation procedure are provided in Appendix G. We discuss potential limitations of KSDAgg in Appendix H. + +We verify in the next proposition that performing this correction indeed ensures that our aggregated test $\Delta_{\alpha}^{\mathcal{K}}$ has the prescribed level $\alpha$ . + +Proposition 3.2. For $\alpha \in (0,1)$ and a collection of kernels $\mathcal{K}$ , the aggregated test $\Delta_{\alpha}^{\mathcal{K}}$ satisfies + +$$ +\mathbb {P} _ {p} \left(\Delta_ {\alpha} ^ {\kappa} (\mathbb {X} _ {N}) = 1\right) \leq \alpha +$$ + +asymptotically using a wild bootstrap (with Lipschitz continuity of $h_{p,k}$ required) and non-asymptotically using a parametric bootstrap. + +The proof of Proposition 3.2 is presented in Appendix 1.2 Details about the asymptotic result for the wild bootstrap case are reported in Appendix D. We now provide guarantees for the power of our aggregated test KSDAGG in terms of its uniform separation rate. + +Theorem 3.3. Suppose the assumptions listed in Appendix A.3 hold, and let $\psi \coloneqq p - q$ . There exists a positive constant $C$ such that if + +$$ +\| \psi \| _ {2} ^ {2} \geq \min _ {k \in \mathcal {K}} \left(\left\| \psi - T _ {h _ {p, k}} \psi \right\| _ {2} ^ {2} + C \log \left(\frac {1}{\alpha w _ {k}}\right) \frac {\sqrt {C _ {k}}}{\beta N}\right) +$$ + +then the probability of type II error of $\Delta_{\alpha}^{\mathcal{K}}$ is controlled by $\beta$ , that is, $\mathbb{P}_q\big(\Delta_\alpha^\mathcal{K}(\mathbb{X}_N) = 0\big)\leq \beta$ . + +The proof Theorem 3.3 can be found in Appendix I.3 it relies on upper bounding the probability of the intersection of some events by the minimum of the probabilities of each event, and on applying Theorem 3.1 after having verified that its assumptions are satisfied for the tests with adjusted levels. We observe that the aggregation procedure allows to achieve the smallest uniform separation rate of the single tests $\left(\Delta_{\alpha}^{k}\right)_{k\in \mathcal{K}}$ up to some logarithmic weighting term $\log (1 / w_k)$ . + +# 3.3 Bandwidth selection + +A specific application of the setting we have considered is the problem of bandwidth selection for a fixed kernel. Given a kernel $k:\mathbb{R}^d\times \mathbb{R}^d\to \mathbb{R}$ , the function + +$$ +k _ {\lambda} (x, y) := k \left(\frac {x}{\lambda}, \frac {y}{\lambda}\right) +$$ + +is also a kernel for any bandwidth $\lambda > 0$ . A common example is the Gaussian kernel, for which we have $k(x,y) = \exp(-\|x - y\|_2^2)$ and $k_\lambda(x,y) = \exp\left(-\|x - y\|_2^2/\lambda^2\right)$ . As shown by Gorham and Mackey (2017), a more appropriate kernel for goodness-of-fit testing using the KSD is the IMQ (inverse multiquadric) kernel, which is defined with $k(x,y) = \left(1 + \|x - y\|_2^2\right)^{-\beta_k}$ for a fixed parameter $\beta_k \in (0,1)$ as + +$$ +k _ {\lambda} (x, y) = \left(1 + \frac {\| x - y \| _ {2} ^ {2}}{\lambda^ {2}}\right) ^ {- \beta_ {k}} = \lambda^ {2 \beta_ {k}} \left(\lambda^ {2} + \| x - y \| _ {2} ^ {2}\right) ^ {- \beta_ {k}} \propto \left(\lambda^ {2} + \| x - y \| _ {2} ^ {2}\right) ^ {- \beta_ {k}} \tag {7} +$$ + +which is the well-known form of the IMQ kernel with parameters $\lambda > 0$ and $\beta_{k} \in (0,1)$ . Note that it is justified to consider the kernel up to a multiplicative constant because the single and aggregated tests are invariant under this kernel transformation. + +In practice, as suggested by Gretton et al. (2012a), the bandwidth is often set to a heuristic such as the median or the standard deviation of the $L^2$ -distances between the samples $(X_i)_{i=1}^N$ , however, these are arbitrary choices with no theoretical guarantees. Another common approach proposed by Gretton et al. (2012b) for the linear-time setting, and extended to the quadratic-time setting by Liu et al. (2020), is to resort to data splitting in order to select a bandwidth on held-out data, by maximising for a proxy for asymptotic power (see Section 4.1 for details). Both methods were originally proposed for the two-sample problem, but extend straightforwardly to the goodness-of-fit setting. + +By considering a kernel collection $\mathcal{K}_{\Lambda} = \{k_{\lambda} : \lambda \in \Lambda\}$ for a collection of bandwidths $\Lambda$ , we can use our aggregated test KSDAGG to test multiple bandwidths using all the data and without resorting to arbitrary heuristics. We now obtain an expression for the uniform separation rate of $\Delta_{\alpha}^{\mathcal{K}_{\Lambda}}$ in terms of the bandwidths $\lambda \in \Lambda$ . + +Corollary 3.4. Suppose the assumptions listed in Appendix [A.3] hold for $\mathcal{K} = \mathcal{K}_{\Lambda} = \{k_{\lambda} : \lambda \in \Lambda\}$ , and let $\psi \coloneqq p - q$ . There exists a positive constant $C$ such that the condition + +$$ +\| \psi \| _ {2} ^ {2} \geq \min _ {\lambda \in \Lambda} \left(\left\| \psi - T _ {h _ {p, k _ {\lambda}}} \psi \right\| _ {2} ^ {2} + C \log \left(\frac {1}{\alpha w _ {\lambda}}\right) \frac {\sqrt {C _ {k _ {\lambda}}}}{\beta N}\right) +$$ + +ensures control over the probability of type II error of the aggregated test $\mathbb{P}_q\big(\Delta_\alpha^{\mathcal{K}_\Lambda}(\mathbb{X}_N) = 0\big)\leq \beta$ + +Corollary 3.4 follows from applying Theorem 3.3 to the collection of kernels $\mathcal{K}_{\Lambda}$ . Our results hold with great generality as we have not imposed any restrictions on $\psi \coloneqq p - q$ such as assuming it belongs to a specific regularity class. For this reason, the dependence on $\lambda$ in the terms $\| \psi - T_{h_{p,k_{\lambda}}} \psi \|_2^2$ and $\log \left(1 / (\alpha w_{\lambda})\right) (\beta N)^{-1} \sqrt{C_{k_{\lambda}}}$ is not explicit. In Section 3.4 we characterise this dependence with regularity assumptions on $\psi \coloneqq p - q$ , and derive uniform seperation rates in terms of the sample size. + +# 3.4 Uniform separation rates over restricted Sobolev balls + +In this section, we derive uniform separation rates with stronger assumptions on $p$ and $q$ . This provides settings in which the power guaranteeing conditions of Theorems 3.1 and 3.3 are satisfied, and illustrates the interactions between the two terms in those conditions. We make the following assumptions. + +- The model density $p$ is strictly positive on its connected and compact support $S \subseteq \mathbb{R}^d$ . +- The score function $\nabla \log p(x)$ is continuous and bounded on $S$ . +- The support of the density $q$ is a connected and compact subset of $S$ . +- The kernel used is a scaled Gaussian kernel $k_{\lambda}(x,y) \coloneqq \lambda^{2 - d}\exp \left(-\| x - y\| _2^2 /\lambda^2\right)$ . + +In particular, any strictly positive twice-differentiable density on $\mathbb{R}^d$ truncated to some $d$ -dimensional interval will satisfy the assumptions for the model $p$ . Any density truncated to the same $d$ -dimensional interval will satisfy the assumption for the density $q$ . As an example, one can consider truncated normal densities. + +Given some smoothness parameter $s > 0$ , radius $R > 0$ and dimension $d \in \mathbb{N} \setminus \{0\}$ , the Sobolev ball $S_d^s (R)$ is defined as the function space + +$$ +\mathcal {S} _ {d} ^ {s} (R) := \left\{f \in L ^ {1} (\mathbb {R} ^ {d}) \cap L ^ {2} (\mathbb {R} ^ {d}): \int_ {\mathbb {R} ^ {d}} \| \xi \| _ {2} ^ {2 s} \left| \widehat {f} (\xi) \right| ^ {2} \mathrm {d} \xi \leq (2 \pi) ^ {d} R ^ {2} \right\}, +$$ + +where $\widehat{f}$ denotes the Fourier transform of $f$ . For $s, t, d, R, L$ all strictly positive, we define the restricted Sobolev ball $\mathcal{S}_d^{s,t}(R,L)$ as containing all functions $f \in \mathcal{S}_d^s (R)$ satisfying + +$$ +\int_ {\| \xi \| _ {2} \leq t} \left| \widehat {f} (\xi) \right| ^ {2} \mathrm {d} \xi \leq \frac {1}{L} \int_ {\mathbb {R} ^ {d}} \left| \widehat {f} (\xi) \right| ^ {2} \mathrm {d} \xi . \tag {8} +$$ + +With the Sobolev assumption $p - q \in S_d^s (R)$ , the densities $p$ and $q$ can differ at any frequencies. The restricted Sobolev assumption $p - q \in S_d^{s,t}(R,L)$ does not include the case in which the densities $p$ and $q$ differ only at low frequencies due to the additional restriction in Equation (8). + +Theorem 3.5. Suppose the assumptions listed in Appendix A.4 hold for $\mathcal{K}_{\Lambda} = \{k_{\lambda} : \lambda \in \Lambda\}$ . Let $\psi := p - q$ . We show that there exists some $L > 0$ such that if $p - q \in S_d^{s,t}(R, L)$ then (i) & (ii) hold. + +(i) Under the assumptions of Theorem 3.1 for the KSD test with bandwidth $\lambda \coloneqq N^{-2 / (4s + d)}$ , the condition + +$$ +\| \psi \| _ {2} ^ {2} \geq C N ^ {- 4 s / (4 s + d)} +$$ + +for some $C > 0$ guarantees control over the probability of type II error $\mathbb{P}_q\big(\Delta_\alpha^\lambda (\mathbb{X}_N) = 0\big)\leq \beta$ + +(ii) Under the assumptions of Theorem [3.3] for KSDAGG with the collection + +$$ +\Lambda := \left\{2 ^ {- \ell}: \ell \in \left\{1, \dots , \left\lceil \frac {2}{d} \log_ {2} \left(\frac {N}{\ln (\ln (N))}\right)\right\rceil \right\}\right\} +$$ + +and weights $w_{\lambda} \coloneqq 6 / \pi^{2}\ell^{2}$ , we have $\mathbb{P}_q\big(\Delta_\alpha^\Lambda (\mathbb{X}_N) = 0\big)\leq \beta$ provided that, for some $C > 0$ + +$$ +\| \psi \| _ {2} ^ {2} \geq C \left(\frac {N}{\ln (\ln (N))}\right) ^ {- 4 s / (4 s + d)}. +$$ + +The proof of Theorem 3.5 is presented in Appendix 1.4. The uniform separation rate $N^{-4s/(4s+d)}$ in Theorem 3.5 is known to be optimal in the minimax sense over (unrestricted) Sobolev balls $S_d^s(R)$ (Li and Yuan, 2019; Balasubramanian et al., 2021; Albert et al., 2022; Schrab et al., 2021). However, this rate is for the KSD test with bandwidth depending on the smoothness parameter $s > 0$ which is unknown in practice. Note that even methods which split the data to perform kernel selection are not able to select this bandwidth depending on $s$ and cannot achieve the minimax rate. The aggregation procedure is adaptive to this unknown parameter $s$ : crucially, the collection of bandwidths $\Lambda$ does not depend on $s$ , and so, the aggregated KSDAGG test of Theorem 3.5(ii) can be implemented in practice, unlike the single KSD test of Theorem 3.5(i). The price to pay for this adaptivity is only an iterated logarithmic factor in the minimax rate over Sobolev balls $S_d^s(R)$ . The uniform separation rates presented in Theorem 3.5 are over the restricted Sobolev balls $S_d^{s,t}(R,L)$ . Whether those rates can also be derived under less restrictive assumptions and in the more general setting of (unrestricted) Sobolev balls $S_d^s(R)$ , is a challenging problem, which is left for future work. + +# 4 Implementation and experiments + +We consider three different experiments based on a Gamma one-dimensional distribution, a Gaussian-Bernoulli Restricted Boltzmann Machine, and a Normalizing Flow for the MNIST dataset. We compare our proposed aggregated test KSDAGG against three alternatives: the KSD test which uses the median bandwidth, a test which splits the data to select an 'optimal' bandwidth according to a proxy for asymptotic test power, and a test which uses extra data for bandwidth selection. The 'extra data' test is designed simply to provide a best-case scenario for the bandwidth selection procedure which maximises asymptotic test power, but it cannot be used in practice as it has access to extra data compared to the other tests. In order to ensure that our tests always have correct levels for all bandwidth values, dimensions and sample sizes, we use the parametric bootstrap in our experiments. + +# 4.1 Alternative bandwidth selection approaches + +Gretton et al. (2012a) proposed to use the median heuristic as kernel bandwidth, it consists in the median of the $L^2$ -distances between the samples given by + +$$ +\lambda_ {\text {m e d}} := \operatorname {m e d i a n} \left\{\left\| x _ {i} - x _ {j} \right\| _ {2}: 0 \leq i < j \leq N \right\}. +$$ + +Gretton et al. (2012b) first proposed, for the two-sample problem using a linear-time MMD estimator, to split the data and to use half of it to select an 'optimal' bandwidth which maximises a proxy for asymptotic power. This procedure was extended to quadratic-time estimators and to the goodness-of-fit framework by Jitkrittum et al. (2017), Sutherland et al. (2017) and Liu et al. (2020). These strategies rely on the asymptotic normality of the test statistic under $\mathcal{H}_a$ . In our setting, the asymptotic power proxy to maximise is the ratio + +$$ +\widehat {\mathrm {K S D}} _ {p, k} ^ {2} \left(\mathbb {X} _ {N}\right) / \widehat {\sigma} _ {\mathcal {H} _ {a}} \tag {9} +$$ + +where $\widehat{\sigma}_{\mathcal{H}_a}^2$ is a closed-form regularised positive estimator of the asymptotic variance of $\widehat{\mathrm{KSD}}_{p,k}^2$ under $\mathcal{H}_a$ (Liu et al., 2020, Equation 5). In our experiments, we also consider a test which has access to $N$ extra samples drawn from $q$ to select an 'optimal' bandwidth to run the KSD test on the original $N$ samples $\mathbb{X}_N$ . This test is interesting to compare to because it uses an 'optimal' bandwidth without being detrimental to power (as it uses all $N$ samples $\mathbb{X}_N$ to run the test with the selected bandwidth). + +# 4.2 Experimental details + +Inspired from Theorem 3.5, in each experiments, we use KSDAGG with different collections of bandwidths of the form $\Lambda (\ell_{-},\ell_{+})\coloneqq \{2^{i}\lambda_{\mathrm{med}}:i = \ell_{-},\ldots ,\ell_{+}\}$ for the median bandwidth $\lambda_{\mathrm{med}}$ and integers $\ell_{-} < \ell_{+}$ with uniform weights $w_{\lambda}\coloneqq 1 / (\ell_{+} - \ell_{-} + 1)$ . For the tests which split the data, we select the bandwidth, out of the collection $\Lambda (\ell_{-},\ell_{+})$ , which maximises the power proxy discussed in Section 4.1. All our experiments are run with level $\alpha = 0.05$ using the IMQ kernel defined in Equation (7) with parameter $\beta_{k} = 0.5$ . We use a parametric bootstrap with $B_{1} = B_{2} = 500$ bootstrapped KSD values to compute the adjusted test thresholds, and $B_{3} = 50$ steps of bisection method to estimate the correction $u_{\alpha}$ in Equation (6). For our aggregated test, we have also designed another collection which is parameter-free (no varying parameters across experiments) and performs as well as the previous variant whose parameters are chosen appropriately for each experiments. The collection is obtained using the maximal inter-sample distance normalised by the dimension (see details in Appendix B). We denote the resulting robust test by KSDAGG for which we use either a wild or parametric bootstrap with $B_{1} = B_{2} = 2000$ and $B_{3} = 50$ , this is the variant we recommend using in practice. To estimate the probability of rejecting the null hypothesis, we average the test outputs across 200 repetitions. All experiments have been run on an AMD Ryzen Threadripper 3960X 24 Cores 128Gb RAM CPU at $3.8\mathrm{GHz}$ , the runtime is of the order of a couple of hours (significant speedup can be obtained by using parallel computing). We have used the implementation of Jitkrittum et al. (2017) to sample from a Gaussian-Bernoulli Restricted Boltzmann Machine, and Phillip Lippe's implementation of MNIST Normalizing Flows, both under the MIT license. + +# 4.3 Gamma distribution + +For our first experiment, we consider a one-dimensional Gamma distribution with shape parameter 5 and scale parameter 5 as the model $p$ . For $q$ , we draw 500 samples from a Gamma distribution with the same scale parameter 5 and with a shifted shape parameter $5 + s$ for $s \in \{0, 0.1, 0.2, 0.3, 0.4\}$ . We consider the collection of bandwidths $\Lambda(0, 10)$ . + +The results we obtained are presented in Figure 1a. We observe that all tests have the prescribed level 0.05 under the null hypothesis, which corresponds to the case $s = 0$ . As the shift parameter $s$ increases, the two densities $p$ and $q$ become more different and rejection of the null becomes an easier task, thus the test power increases. Our aggregated test KSDAGG achieves the same power as the KSD test with an 'optimal' bandwidth selected using extra data by maximizing the proxy for asymptotic power. The median test obtains only slightly lower power, this closeness in power can be explained by the fact that this one-dimensional problem is a simple one. All four tests KSDAGG $\Lambda(0,10)$ , KSDAGG*, KSD median, and KSD split, all achieve very similar power. We note that the normal splitting test has significantly lower power: this is because, even though it uses an 'optimal' bandwidth, it is then run on only half the data, which results in a loss of power. + +![](images/f59d2942977ae5d1a9205d40ff05deaa64c7c297e8ed495ef7dc6448e4fac367.jpg) +(a) +Figure 1: (a) Gamma distribution. (b) Gaussian-Bernoulli Restricted Boltzmann Machine. + +![](images/35d1079e7d72c5d60401647cbef47287e3b3aa5993c05d60003c2e1e713dc8c3.jpg) +(b) + +# 4.4 Gaussian-Bernoulli Restricted Boltzmann Machine + +As first considered by Liu et al. (2016) for goodness-of-fit testing using the KSD, we consider a Gaussian-Bernoulli Restricted Boltzmann Machine. It is a graphical model with a binary hidden variable $h \in \{-1, 1\}^{d_h}$ and a continuous observable variable $x \in \mathbb{R}^d$ . Those variables have joint density + +$$ +p (x, h) = \frac {1}{Z} \exp \left(\frac {1}{2} x ^ {\top} B h + b ^ {\top} x + c ^ {\top} h - \frac {1}{2} \| x \| _ {2} ^ {2}\right) +$$ + +where $Z$ is an unknown normalizing constant. By marginalising over $h$ , we obtain the density $p$ of $x$ + +$$ +p (x) = \sum_ {h \in \{- 1, 1 \} ^ {d _ {h}}} p (x, h). +$$ + +We can sample from it using a Gibbs sampler with 2000 burn-in iterations. We use the dimensions $d = 50$ and $d_h = 40$ as considered by Jitkrittum et al. (2017) and Grathwohl et al. (2020). Even though computing $p$ is intractable for large dimension $d_h$ , the score function admits a convenient closed-form expression + +$$ +\nabla \log p (x) = b - x + B \frac {\exp \left(2 \left(B ^ {\top} x + c\right)\right) - 1}{\exp \left(2 \left(B ^ {\top} x + c\right)\right) + 1}. +$$ + +We draw the components of $b$ and $c$ from Gaussian standard distributions and sample Rademacher variables taking values in $\{-1, 1\}$ for the elements of $B$ for the model $p$ . We draw 1000 samples from a distribution $q$ which is constructed in a similar way as $p$ but with the difference that some Gaussian noise $\mathcal{N}(0, \sigma)$ is injected into each of the elements of $B$ . For the standard deviations of the perturbations, we consider $\sigma \in \{0, 0.01, 0.02, 0.03\}$ . We use the collection $\Lambda(-20, 0)$ (different from Section 4.3), for KSDAGG* we use a wild bootstrap, the results are provided in Figure 1b. + +Again, we observe that our aggregated tests KSDAGG $\Lambda(0,20)$ and KSDAGG\* match the power obtained by the test which uses extra data to select an 'optimal' bandwidth. This means that, in this experiment, the aggregated tests obtain the same power as the 'best' single test. The difference with the median heuristic test is significant in this experiment, and the splitting test obtains the lowest power of the four tests. Again, all tests have well-calibrated levels (case $\sigma = 0$ ) and increasing the noise level $\sigma$ results in more power for all the tests. + +# 4.5 MNIST Normalizing Flow + +Finally, we consider a high-dimensional problem working with images in dimensions $28^{2} = 784$ . We consider a multi-scale Normalizing Flow (Dinh et al., 2017; Kingma and Dhariwal, 2018) which has been trained on the MNIST dataset (LeCun et al., 1998, 2010), it is a generative model which has a + +![](images/912bc48c6eb59f1e841e85623972e7ea2471f1d43df562ecdfc853de3039e627.jpg) +(a) + +![](images/68e4036c231b37843bd0e350eaad0d53a1e66069683e1f38238fdc6170e6f142.jpg) +(b) +Figure 2: (a) Digits from the MNIST dataset. (b, c) Digits sampled from the Normalizing Flow. + +![](images/473a6607d67b3a0c97701e4336e2bb13f8e4550e1894cbd45d32f59290a4eb51.jpg) +(c) + +probability density $p$ . As observed in Figure 2, some samples produced by the model can look exactly like MNIST digits, while others do not resemble digits. This Normalizing Flow has been trained to 'ideally' produce samples from the MNIST dataset. We are interested in whether or not we can detect the difference in densities. Given some images of digits, are we able to tell if those were sampled from the Normalizing Flow model? We consider the case where the samples from $q$ are drawn from the true MNIST dataset (power experiment), and the case where the images from $q$ are sampled from the Normalizing Flow model (level experiment, confirming performance for the power experiment). The experiments are run with the collection of bandwidths $\Lambda(-20,0)$ . The results are displayed in Figure 3a and Figure 3b. We use a parametric bootstrap for KSDAGG*. + +In Figure 3a we observe that the four tests have correct levels (around 0.05) for the five different sample sizes considered (the small fluctuations about the designed test level can be explained by the fact that we are averaging 200 test outputs to estimate these levels). The well-calibrated levels obtained in Figure 3a demonstrate the validity of the power results presented in Figure 3b. + +As seen in Figure 3b, only our aggregated tests KSDAGG and KSDAGG* obtain high power; they are able to detect that MNIST samples are not drawn from the Normalizing Flow. The power of the other tests increases only marginally as the sample size increases. The test which uses extra data to select an 'optimal' bandwidth performs poorly when compared to the aggregated tests. This could be explained by the fact that this test selects the bandwidth using a proxy for the asymptotic power, and that in this high-dimensional setting, the asymptotic regime is not attained with sample sizes below 500. See Appendices E and F for details regarding selected bandwidths and for reported runtimes. + +
Sample sizeKSDAGG Λ(-20, 0)KSDAGG*KSD medianKSD splitKSD split extra data
1000.050.0350.040.050.04
2000.060.030.0550.050.055
3000.0450.0550.0850.050.085
4000.040.030.0550.030.055
5000.0350.0350.0450.040.045
+ +(a) + +![](images/2bfb448eca18922854bb625a8505fb740e72b829b0e1be2ccfba774fe75a8179.jpg) + +![](images/55f948fc8a3782f3e26bef97d1aa38a8ea433231318327f4ccd69998ee52f819.jpg) +(b) +Figure 3: Normalizing Flow MNIST. (a) Level experiment. (b) Power experiment. + +# 5 Acknowledgements + +Antonin Schrab acknowledges support from the U.K. Research and Innovation (EP/S021566/1). Benjamin Guedj acknowledges partial support by the U.S. Army Research Laboratory and the U.S. Army Research Office, and by the U.K. Ministry of Defence and the U.K. Engineering and Physical Sciences Research Council (EP/R013616/1), and by the French National Agency for Research (ANR-18-CE40-0016-01 & ANR-18-CE23-0015-02). Arthur Gretton acknowledges support from the Gatsby Charitable Foundation. + +# References + +Albert, M., Laurent, B., Marrel, A., and Meynaoui, A. (2022). Adaptive test of independence based on HSIC measures. The Annals of Statistics, 50(2):858-879. +Anastasiou, A., Barp, A., Briol, F.-X., Ebner, B., Gaunt, R. E., Ghaderinezhad, F., Gorham, J., Gretton, A., Ley, C., Liu, Q., et al. (2021). Stein's method meets statistics: A review of some recent developments. arXiv preprint arXiv:2105.03481. +Aronszajn, N. (1950). Theory of reproducing kernels. Transactions of the American Mathematical Society, 68(3):337-404. +Balasubramanian, K., Li, T., and Yuan, M. (2021). On the optimality of kernel-embedding based goodness-of-fit tests. Journal of Machine Learning Research, 22(1). +Baraud, Y. (2002). Non-asymptotic minimax rates of testing in signal detection. Bernoulli, 1(8(5):577-606). +Barp, A., Briol, F., Duncan, A. B., Girolami, M. A., and Mackey, L. W. (2019). Minimum Stein discrepancy estimators. In Wallach, H. M., Larochelle, H., Beygelzimer, A., d'Alché-Buc, F., Fox, E. B., and Garnett, R., editors, Advances in Neural Information Processing Systems. +Carmeli, C., De Vito, E., Toigo, A., and Umanita, V. (2010). Vector valued reproducing kernel Hilbert spaces and universality. Analysis and Applications, 8(01):19-61. +Chebyshev, P. L. (1899). Oeuvres. Commissionaires de l'Académie Imperiale des Sciences, 1. +Chwialkowski, K., Sejdinovic, D., and Gretton, A. (2014). A wild bootstrap for degenerate kernel tests. In Advances in neural information processing systems, pages 3608-3616. +Chwialkowski, K., Strathmann, H., and Gretton, A. (2016). A kernel test of goodness of fit. In International Conference on Machine Learning, pages 2606-2615. PMLR. +de la Peña, V. H. and Giné, E. (1999). Decoupling: From Dependence to Independence. Springer Science & Business Media. +Dinh, L., Sohl-Dickstein, J., and Bengio, S. (2017). Density estimation using real NVP. In International Conference on Learning Representations. +Dvoretzky, A., Kiefer, J., and Wolfowitz, J. (1956). Asymptotic minimax character of the sample distribution function and of the classical multinomial estimator. The Annals of Mathematical Statistics, pages 642-669. +Fernandez, T. and Gretton, A. (2019). A maximum-mean-discrepancy goodness-of-fit test for censored data. In Proceedings of the Twenty-Second International Conference on Artificial Intelligence and Statistics, volume 89 of Proceedings of Machine Learning Research, pages 2966-2975. PMLR. +Fernandez, T. and Rivera, N. (2022). A general framework for the analysis of kernel-based tests. arXiv preprint arXiv:2209.00124. +Fernandez, T., Rivera, N., Xu, W., and Gretton, A. (2020). Kernelized Stein discrepancy tests of goodness-of-fit for time-to-event data. In Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pages 3112-3122. PMLR. +Freidling, T., Poinard, B., Climente-González, H., and Yamada, M. (2021). Post-selection inference with HSIC-Lasso. In International Conference on Machine Learning, pages 3439-3448. PMLR. +Fromont, M., Laurent, B., Lerasle, M., and Reynaud-Bouret, P. (2012). Kernels based tests with non-asymptotic bootstrap approaches for two-sample problems. In Conference on Learning Theory, PMLR. +Fromont, M., Laurent, B., and Reynaud-Bouret, P. (2013). The two-sample problem for Poisson processes: Adaptive tests with a nonasymptotic wild bootstrap approach. The Annals of Statistics, 41(3):1431-1461. + +Gorham, J. and Mackey, L. (2017). Measuring sample quality with kernels. In International Conference on Machine Learning, pages 1292-1301. PMLR. +Gorham, J. and Mackey, L. W. (2015). Measuring sample quality with Stein's method. In Cortes, C., Lawrence, N. D., Lee, D. D., Sugiyama, M., and Garnett, R., editors, Advances in Neural Information Processing Systems 28: Annual Conference on Neural Information Processing Systems 2015, December 7-12, 2015, Montreal, Quebec, Canada, pages 226-234. +Grathwohl, W., Wang, K.-C., Jacobsen, J.-H., Duvenaud, D., and Zemel, R. (2020). Learning the Stein discrepancy for training and evaluating energy-based models without sampling. In International Conference on Machine Learning, pages 3732-3747. PMLR. +Gretton, A., Borgwardt, K. M., Rasch, M. J., Scholkopf, B., and Smola, A. (2012a). A kernel two-sample test. Journal of Machine Learning Research, 13:723-773. +Gretton, A., Bousquet, O., Smola, A., and Scholkopf, B. (2005). Measuring statistical dependence with Hilbert-Schmidt norms. In International Conference on Algorithmic Learning Theory. Springer. +Gretton, A., Sejdinovic, D., Strathmann, H., Balakrishnan, S., Pontil, M., Fukumizu, K., and Sriperumbudur, B. K. (2012b). Optimal kernel choice for large-scale two-sample tests. In Advances in Neural Information Processing Systems, volume 1, pages 1205-1213. +Hoeffding, W. (1992). A class of statistics with asymptotically normal distribution. In *Breakthroughs in Statistics*, pages 308-334. Springer. +Huggins, J. and Mackey, L. (2018). Random feature Stein discrepancies. Advances in Neural Information Processing Systems, 31. +Ingster, Y. I. (1987). Minimax testing of nonparametric hypotheses on a distribution density in the $L_{p}$ metrics. Theory of Probability & its Applications, 31(2):333-337. +Ingster, Y. I. (1989). An asymptotically minimax test of the hypothesis of independence. Journal of Soviet Mathematics, 1(44:466-476). +Ingster, Y. I. (1993a). Asymptotically minimax hypothesis testing for nonparametric alternatives. Journal of Soviet Mathematics, 1(44:466-476). +Ingster, Y. I. (1993b). Minimax testing of the hypothesis of independence for ellipsoids in $l_p$ . Zapiski Nauchnykh Seminarov POMI, 1(207:77-97). +Jitkrittum, W., Kanagawa, H., and Scholkopf, B. (2020). Testing goodness of fit of conditional density models with kernels. In Peters, J. and Sontag, D., editors, Proceedings of the 36th Conference on Uncertainty in Artificial Intelligence (UAI), volume 124 of Proceedings of Machine Learning Research, pages 221-230. PMLR. +Jitkrittum, W., Xu, W., Szabó, Z., Fukumizu, K., and Gretton, A. (2017). A linear-time kernel goodness-of-fit test. In Advances in Neural Information Processing Systems, pages 262-271. +Kanagawa, H., Jitkrittum, W., Mackey, L., Fukumizu, K., and Gretton, A. (2019). A kernel Stein test for comparing latent variable models. arXiv:1907.00586 [cs, stat]. arXiv: 1907.00586. +Key, O., Fernandez, T., Gretton, A., and Briol, F.-X. (2021). Composite goodness-of-fit tests with kernels. arXiv preprint arXiv:2111.10275. +Kim, I., Balakrishnan, S., and Wasserman, L. (2022). Minimax optimality of permutation tests. The Annals of Statistics, 50(1):225-251. +Kingma, D. P. and Dhariwal, P. (2018). Glow: Generative flow with invertible 1x1 convolutions. In Advances in Neural Information Processing Systems, pages 10236-10245. +Korba, A., Aubin-Frankowski, P., Majewski, S., and Ablin, P. (2021). Kernel Stein discrepancy descent. In Meila, M. and Zhang, T., editors, Proceedings of the 38th International Conference on Machine Learning, ICML 2021, 18-24 July 2021, volume 139 of Proceedings of Machine Learning Research, pages 5719-5730. PMLR. + +Kübler, J. M., Jitkrittum, W., Schölkopf, B., and Muandet, K. (2020). Learning kernel tests without data splitting. In Advances in Neural Information Processing Systems 33, pages 6245-6255. Curran Associates, Inc. +Kübler, J. M., Jitkrittum, W., Schölkopf, B., and Muandet, K. (2022). A witness two-sample test. In International Conference on Artificial Intelligence and Statistics, pages 1403-1419. PMLR. +LeCun, Y., Bottou, L., Bengio, Y., and Haffner, P. (1998). Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278-2324. +LeCun, Y., Cortes, C., and Burges, C. (2010). MNIST handwritten digit database. AT&T Labs. +Leucht, A. (2012). Degenerate $U$ - and $V$ -statistics under weak dependence: Asymptotic theory and bootstrap consistency. Bernoulli, 18(2):552 - 585. +Leucht, A. and Neumann, M. H. (2013). Dependent wild bootstrap for degenerate U- and V-statistics. Journal of Multivariate Analysis, 117:257-280. +Li, T. and Yuan, M. (2019). On the optimality of gaussian kernel based nonparametric tests against smooth alternatives. arXiv preprint arXiv:1909.03302. +Lim, J. N., Yamada, M., Jitkrittum, W., Terada, Y., Matsui, S., and Shimodaira, H. (2020). More powerful selective kernel tests for feature selection. In International Conference on Artificial Intelligence and Statistics, pages 820-830. PMLR. +Lim, J. N., Yamada, M., Schölkopf, B., and JITkrittum, W. (2019). Kernel Stein tests for multiple model comparison. In Advances in Neural Information Processing Systems, pages 2240-2250. +Liu, F., Xu, W., Lu, J., Zhang, G., Gretton, A., and Sutherland, D. J. (2020). Learning deep kernels for non-parametric two-sample tests. In International Conference on Machine Learning. +Liu, Q., Lee, J., and Jordan, M. (2016). A kernelized Stein discrepancy for goodness-of-fit tests. In International Conference on Machine Learning, pages 276-284. PMLR. +Massart, P. (1990). The tight constant in the Dvoretzky-Kiefer-Wolffowitz inequality. The Annals of Probability, 18(3):1269-1283. +Oates, C. J., Cockayne, J., Briol, F.-X., and Girolami, M. (2019). Convergence rates for a class of estimators based on Stein's method. Bernoulli, 25(2):1141 - 1159. +Oates, C. J. and Girolami, M. A. (2016). Control functionals for quasi-Monte Carlo integration. In Gretton, A. and Robert, C. C., editors, Proceedings of the 19th International Conference on Artificial Intelligence and Statistics, AISTATS 2016, Cadiz, Spain, May 9-11, 2016, volume 51 of JMLR Workshop and Conference Proceedings, pages 56-65. JMLR.org. +Romano, J. P. and Wolf, M. (2005). Exact and approximate stepdown methods for multiple hypothesis testing. Journal of the American Statistical Association, 100(469):94-108. +Schrab, A., Kim, I., Albert, M., Laurent, B., Guedj, B., and Gretton, A. (2021). MMD Aggregated two-sample test. arXiv preprint arXiv:2110.15073. +Schrab, A., Kim, I., Guedj, B., and Gretton, A. (2022). Efficient aggregated kernel tests using incomplete $U$ -statistics. In Advances in Neural Information Processing Systems 35: Annual Conference on Neural Information Processing Systems 2022, NeurIPS 2022. +Shao, X. (2010). The dependent wild bootstrap. Journal of the American Statistical Association, 105(489):218-235. +Sriperumbudur, B. K., Fukumizu, K., and Lanckriet, G. R. (2011). Universality, characteristic kernels and RKHS embedding of measures. Journal of Machine Learning Research, 12(7). +Stein, C. (1972). A bound for the error in the normal approximation to the distribution of a sum of dependent random variables. In Proceedings of the sixth Berkeley symposium on mathematical statistics and probability, volume 6, pages 583-603. University of California Press. + +Stein, C., Diaconis, P., Holmes, S., and Reinert, G. (2004). Use of exchangeable pairs in the analysis of simulations. Lecture Notes-Monograph Series, pages 1-26. +Stute, W., Manteiga, W. G., and Quindimil, M. P. (1993). Bootstrap based goodness-of-fit-tests. *Metrika*, 40(1):243-256. +Sutherland, D. J., Tung, H.-Y., Strathmann, H., De, S., Ramdas, A., Smola, A., and Gretton, A. (2017). Generative models and model criticism via optimized maximum mean discrepancy. In International Conference on Learning Representations. +Tolstikhin, I., Sriperumbudur, B. K., and Scholkopf, B. (2016). Minimax estimation of maximum mean discrepancy with radial kernels. Advances in Neural Information Processing Systems, 29. +Weckbecker, M., Xu, W., and Reinert, G. (2022). On RKHS choices for assessing graph generators via kernel Stein statistics. arXiv preprint arXiv:2210.05746. +Wenliang, L. K. and Kanagawa, H. (2020). Blindness of score-based methods to isolated components and mixing proportions. arXiv preprint arXiv:2008.10087. +Wynne, G. and Duncan, A. B. (2022). A kernel two-sample test for functional data. Journal of Machine Learning Research, 23(73):1-51. +Wynne, G., Kasprzak, M., and Duncan, A. B. (2022). A spectral representation of kernel stein discrepancy with application to goodness-of-fit tests for measures on infinite dimensional hilbert spaces. arXiv preprint arXiv:2206.04552. +Xu, W. (2021). Generalised kernel Stein discrepancy (GKSD): A unifying approach for non-parametric goodness-of-fit testing. arXiv preprint arXiv:2106.12105. +Xu, W. (2022). Standardisation-function kernel Stein discrepancy: A unifying view on kernel Stein discrepancy tests for goodness-of-fit. In Camps-Valls, G., Ruiz, F. J. R., and Valera, I., editors, Proceedings of The 25th International Conference on Artificial Intelligence and Statistics, volume 151 of Proceedings of Machine Learning Research, pages 1575-1597. PMLR. +Xu, W. and Matsuda, T. (2020). A Stein goodness-of-fit test for directional distributions. In Chiappa, S. and Calandra, R., editors, Proceedings of the Twenty Third International Conference on Artificial Intelligence and Statistics, volume 108 of Proceedings of Machine Learning Research, pages 320-330. PMLR. +Xu, W. and Matsuda, T. (2021). Interpretable Stein goodness-of-fit tests on Riemannian manifold. In Meila, M. and Zhang, T., editors, Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pages 11502-11513. PMLR. +Xu, W. and Reinert, G. (2021). A Stein goodness-of-test for exponential random graph models. In Banerjee, A. and Fukumizu, K., editors, Proceedings of The 24th International Conference on Artificial Intelligence and Statistics, volume 130 of Proceedings of Machine Learning Research, pages 415-423. PMLR. +Xu, W. and Reinert, G. (2022a). AgraSSt: Approximate graph Stein statistics for interpretable assessment of implicit graph generators. arXiv preprint arXiv:2203.03673. +Xu, W. and Reinert, G. (2022b). A kernelised Stein statistic for assessing implicit generative models. arXiv preprint arXiv:2206.00149. +Yamada, M., Wu, D., Tsai, Y. H., Ohta, H., Salakhutdinov, R., Takeuchi, I., and Fukumizu, K. (2019). Post selection inference with incomplete maximum mean discrepancy estimator. In International Conference on Learning Representations. +Zhang, M., Key, O., Hayes, P., Barber, D., Paige, B., and Briol, F.-X. (2022). Towards healing the blindness of score matching. arXiv preprint arXiv:2209.07396. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] See Appendix H. +(c) Did you discuss any potential negative societal impacts of your work? [N/A] +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] +(b) Did you include complete proofs of all theoretical results? [Yes] See Appendices. + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] See link in Section 1: https://github.com/antoninschrab/ksdagg-paper. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 4.2 +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A] Since the test outputs are binary (0 or 1), there is no need to include error bars since these are deterministic given the average which is plotted. +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Section 4.2 + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] See Section 4.2 +(b) Did you mention the license of the assets? [Yes] See Section 4.2. +(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] See link in Section 1: https://github.com/antoninschrab/ksdagg-paper +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/ksdaggregatedgoodnessoffittest/images.zip b/ksdaggregatedgoodnessoffittest/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..d076c0451b5e5cec16984fc9f2504422904a67fb --- /dev/null +++ b/ksdaggregatedgoodnessoffittest/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a4ac7b7926705dfa3759757aff61439a33feb83ef3a8483e35fc42c0d977c744 +size 336457 diff --git a/ksdaggregatedgoodnessoffittest/layout.json b/ksdaggregatedgoodnessoffittest/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..e894c9a6bc4350e8f8affd2965148923cdeb7d86 --- /dev/null +++ b/ksdaggregatedgoodnessoffittest/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a30e8f9d702cbc24c57181f16090d7208c2defb40df197f4ae4744bfbabf6852 +size 646910 diff --git a/laion5banopenlargescaledatasetfortrainingnextgenerationimagetextmodels/9883160d-9cc6-4948-930b-238f9a965653_content_list.json b/laion5banopenlargescaledatasetfortrainingnextgenerationimagetextmodels/9883160d-9cc6-4948-930b-238f9a965653_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..af954053c69e602c1f92a891b191993944bf774b --- /dev/null +++ b/laion5banopenlargescaledatasetfortrainingnextgenerationimagetextmodels/9883160d-9cc6-4948-930b-238f9a965653_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e7275c1f99b56ee9c943f76938155c872115115da47a26326fdfe95ecaac935 +size 92974 diff --git a/laion5banopenlargescaledatasetfortrainingnextgenerationimagetextmodels/9883160d-9cc6-4948-930b-238f9a965653_model.json b/laion5banopenlargescaledatasetfortrainingnextgenerationimagetextmodels/9883160d-9cc6-4948-930b-238f9a965653_model.json new file mode 100644 index 0000000000000000000000000000000000000000..6d63a0ff685cb69aabee47eb7253979f7e5d4c71 --- /dev/null +++ b/laion5banopenlargescaledatasetfortrainingnextgenerationimagetextmodels/9883160d-9cc6-4948-930b-238f9a965653_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e5dc086d6680719a0afd694cff834172ae47afd8875e205f66ef13cbaa2d9f3b +size 124330 diff --git a/laion5banopenlargescaledatasetfortrainingnextgenerationimagetextmodels/9883160d-9cc6-4948-930b-238f9a965653_origin.pdf b/laion5banopenlargescaledatasetfortrainingnextgenerationimagetextmodels/9883160d-9cc6-4948-930b-238f9a965653_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..e03ea2214bfa93e05bd8ecdbd3523a6dd13f39da --- /dev/null +++ b/laion5banopenlargescaledatasetfortrainingnextgenerationimagetextmodels/9883160d-9cc6-4948-930b-238f9a965653_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c807639698b2c9c7b9509a49c364d4a295e7a169d7a2c85f71e9fe62e44f8bd0 +size 1306203 diff --git a/laion5banopenlargescaledatasetfortrainingnextgenerationimagetextmodels/full.md b/laion5banopenlargescaledatasetfortrainingnextgenerationimagetextmodels/full.md new file mode 100644 index 0000000000000000000000000000000000000000..705e0574553882511fa7daa567248364b381e8cb --- /dev/null +++ b/laion5banopenlargescaledatasetfortrainingnextgenerationimagetextmodels/full.md @@ -0,0 +1,329 @@ +# LAION-5B: An open large-scale dataset for training next generation image-text models + +Christoph Schuhmann $^{1}$ §§ $^{00}$ +Cade Gordon $^{2}$ §§ $^{00}$ +Ross Wightman $^{1}$ §§ +Mehdi Cherti $^{1,10}$ §§ +Theo Coombes $^{1}$ Aarush Katta $^{1}$ Clayton Mullis $^{1}$ +Mitchell Wortsman $^{6}$ +Patrick Schramowski $^{1,4,5}$ +Srivatsa Kundurthy $^{1}$ +Katherine Crowson $^{1,8,9}$ +Ludwig Schmidt $^{6}$ +Robert Kaczmarczyk $^{1,7}$ +Jenia Jitsev $^{1,10}$ +LAION $^{1}$ UC Berkeley $^{2}$ +Gentec Data $^{3}$ TU Darmstadt $^{4}$ +Hessian.AI $^{5}$ +University of Washington, Seattle $^{6}$ Technical University of Munich $^{7}$ Stability AI $^{8}$ +EleutherAI $^{9}$ Juelich Supercomputing Center (JSC), Research Center Juelich (FZJ) $^{10}$ +contact@laion.ai +§§ Equal first contributions, † equal senior contributions + +# Abstract + +Groundbreaking language-vision architectures like CLIP and DALL-E proved the utility of training on large amounts of noisy image-text data, without relying on expensive accurate labels used in standard vision unimodal supervised learning. The resulting models showed capabilities of strong text-guided image generation and transfer to downstream tasks, while performing remarkably at zero-shot classification with noteworthy out-of-distribution robustness. Since then, large-scale language-vision models like ALIGN, BASIC, GLIDE, Flamingo and Imagen made further improvements. Studying the training and capabilities of such models requires datasets containing billions of image-text pairs. Until now, no datasets of this size have been made openly available for the broader research community. To address this problem and democratize research on large-scale multi-modal models, we present LAION-5B - a dataset consisting of 5.85 billion CLIP-filtered image-text pairs, of which 2.32B contain English language. We show successful replication and fine-tuning of foundational models like CLIP, GLIDE and Stable Diffusion using the dataset, and discuss further experiments enabled with an openly available dataset of this scale. Additionally we provide several nearest neighbor indices, an improved web-interface for dataset exploration and subset generation, and detection scores for watermark, NSFW, and toxic content detection. $^{1}$ + +# 1 Introduction + +Learning from multimodal data such as text, images, and audio is a longstanding research challenge in machine learning [31, 51, 56, 83, 86]. Recently, contrastive loss functions combined with large neural networks have led to breakthroughs in the generalization capabilities of vision and language models [58, 59, 66]. For instance, OpenAI's CLIP models [58] achieved large gains in zero-shot classification on ImageNet [65], improving from the prior top-1 accuracy of $11.5\%$ [41] to $76.2\%$ . In addition, CLIP achieved unprecedented performance gains on multiple challenging distribution shifts [3, 23, 61, 70, 78, 82]. Inspired by CLIP's performance, numerous groups have further improved image-text models by increasing the amount of computation and the training set size [28, 54, 89, 94]. Another recent success of multimodal learning is in image generation, where DALL-E [59] and later + +models [52, 60, 64, 66, 90] demonstrated the potential of text-guided image generation by producing high-quality images specific to the provided text. + +A critical ingredient in this new generation of image-text models is the pre-training dataset. All of the aforementioned advances rely on large datasets containing hundreds of millions or even billions of image-text pairs, e.g., 400 million for CLIP [58] and 6.6 billion for BASIC [54]. However, none of these datasets are publicly available. While OpenAI still released the CLIP models publicly [58], later papers made neither the pre-training dataset nor the resulting models available to the wider research community [2, 28, 52, 54, 66, 89, 90]. As a result, research in this area has pooled into a small number of industrial research labs, limiting transparency and impeding research progress. + +In this work, we address this challenge and make multimodal training more accessible by assembling a public dataset that is suitable for training large image-text models. Specifically, we introduce LAION-5B, the largest public image-text dataset containing over 5.8 billion examples (see Table 1 for a comparison). By starting from Common Crawl [1] and filtering this data source with an existing CLIP model, we derive a dataset consisting of three parts: 2.32 billion English image-text examples, 2.26 billion multilingual examples, and 1.27 billion examples that are not specific to a particular language (e.g., places, products, etc.). Beyond assembling the dataset, we also explore its ethical implications and flaws that emerge with large-scale data collection. By releasing LAION-5B publicly, we offer the first opportunity for the community to audit and refine a dataset of this magnitude. + +![](images/13de35446eaffb20dadfe3e3f691edbde3cbd54474bd7318cc232138da76efd8.jpg) +Figure 1: Zero-Shot Accuracy. CLIP models trained on LAION-400M (ours) [69], a previously released subset of LAION-5B, show competitive zero-shot accuracy compared to CLIP models trained on OpenAI's original training set WIT when evaluated on ImageNet1k. + +
Dataset# English Img-Txt Pairs
Public Datasets
MS-COCO330K
CC3M3M
Visual Genome5.4M
WIT5.5M
CC12M12M
RedCaps12M
YFCC100M100M2
LAION-5B (Ours)2.3B
Private Datasets
CLIP WIT (OpenAI)400M
ALIGN1.8B
BASIC6.6B
+ +Table 1: Dataset Size. LAION-5B is more than 20 times larger than other public English image-text datasets. We extend the analysis from Desai et al. [14] and compare the sizes of public and private image-text datasets. + +To validate that LAION-5B is indeed suitable for training large image-text models, we conduct multiple experiments. We focus on matching the performance of OpenAI's CLIP models because they are the largest publicly released image-text models. OpenAI's CLIP models were trained on 400 million image-text pairs, and hence we also train CLIP models on a subset of LAION-5B containing the same number of examples ("LAION-400M"). Across a diverse range of problem settings including ImageNet (zero-shot), distribution shifts, VTAB, retrieval, and fine-tuning, our models trained on LAION-400M match or come close to the performance of OpenAI's CLIP models. Our ViT-L/14 models trained with OpenCLIP are the first open source reproductions of the largest CLIP models released by OpenAI. + +Despite these validation results, LAION-5B is not a finished data product. Due to the immense size of current image-text pre-training datasets, curating LAION-5B for widespread use goes beyond the scope of a single research paper. Hence we do not only release our dataset, but also our software stack we built for assembling LAION-5B. We view our initial data release and this paper as a first step on the way towards a widely applicable pre-training dataset for multimodal models. As a result, + +we strongly recommend that LAION-5B should only be used for academic research purposes in its current form. We advise against any applications in deployed systems without carefully investigating behavior and possible biases of models trained on LAION-5B. + +The remainder of the paper proceeds as follows. After reviewing related work, we present our data collection process for LAION-5B in Section 3. Section 4 then describes LAION-5B's composition including its various subsets. To validate LAION-5B, we reproduce and evaluate different image-text models in Section 5. Before concluding, we discuss the technical limitations of LAION-5B in Section 6 and safety and ethics concerns in Section 7. + +# 2 Related Work + +Vision-Language Models. Radford et al. [58] made a large step forward in multimodal learning for image-text data with their CLIP (Contrastive Language-Image Pre-training) model. The authors proposed a contrastive learning scheme to embed both images and text into a shared representation space, which enabled unparalleled performance in zero-shot image classification. Moreover, CLIP made large progress on multiple challenging distribution shifts [78, 84]. + +After CLIP's initial success, ALIGN and BASIC improved contrastive multimodal learning by increasing the training set size and the batch size used for training [28, 54]. LiT also increased training scale and experimented with a combination of pre-trained image representations and contrastive fine-tuning to connect frozen image representations to text [94]. Flamingo introduced the first large vision-language model with in-context learning [2]. Other papers have combined contrastive losses with image captioning to further improve performance [43, 89]. Beyond image classification and retrieval, the community later adapted CLIP to further vision tasks such as object navigation and visual question answering [17, 32, 50, 72]. + +Another direction that has recently seen large progress in multimodal learning is text-guided image generation [47, 62, 95]. Specifically, DALL-E demonstrated diverse image generation capabilities for text prompts combining multiple concepts [59]. GLIDE, DALL-E 2, Imagen, Parti, and Stable Diffusion then improved visual fidelity and text-prompt correspondence [52, 60, 64, 66, 90]. + +Image-Text Datasets. Earlier dataset creation efforts such as MS-COCO and Visual Genome curated image and region labels through human annotation [36, 44]. While this resulted in high-quality labels, it also limited the scale of the datasets to only $330\mathrm{K}$ and 5M examples, respectively. The webharvested YFCC-100M dataset is substantially larger with about 99 million images and one million videos from Flickr, but only contains the user-generated metadata without additional annotations collected specifically for training computer vision models [79]. As a result, the text associated with an image sometimes has little to no correspondence with the actual image content. + +To address this shortcoming of web-harvested image-text data, the Conceptual Captions dataset (CC3M) started with images and alt-text collected from the web, but then performed additional data cleaning procedures [71]. To increase the size of the dataset, researchers later relaxed the filtering protocol to arrive at the subsequent CC12M dataset [11]. Building datasets from alt-text continued with ALT200M [26] and ALIGN [28], which increased the dataset size up to 1.8 billion image-text pairs. In contrast to relying on alt-text, RedCaps used the captions provided by Reddit users to collect higher quality captions [14]. + +Datasets with non-English image-text pairs are less common. As a result, researchers translated English captioning datasets to other languages such as Farsi, Korean, and Japanese [67, 73, 74]. To the best of our knowledge, the largest multilingual dataset before LAION-5B has around 36 million samples from Wikipedia Image Text [75]. With the release of LAION-5B, researchers now have access to roughly two orders of magnitude more multilingual samples, which provides new opportunities for research on low-resource languages and multilingual models. + +Scaling Behavior. Improving model performance by increasing data scale has been a theme in machine learning since at least the ImageNet dataset [13]. In the following decade, computer vision benefited from growth in model, data, and compute scale, in addition to advances in both convolutional and transformer architectures [15, 33, 81, 92]. Industrial research labs assembled large internal datasets such as Instagram-1B, JFT300M, and JFT3B to support image pre-training [46, 77, 93]. Natural language processing (NLP) demonstrated the beneficial effect of model, data, and compute scale on generalization through large language models such as GPT-3 [8] and associated + +![](images/cc1bb7b2eaade26efd56d440bd3b6228109c85330c25288927721284e905027a.jpg) +Figure 2: Overview of the acquisition pipeline: Files are downloaded, tracked, and undergo distributed inference to determine inclusion. Those above the specified CLIP threshold are saved. + +experiments on scaling behavior [30]. Community efforts like the The Pile [18] and BigScience ROOTS [40] made large text datasets more accessible. + +# 3 Collection Methodology + +We constructed LAION-5B starting from Common crawl, a public web archive [1]. The Common crawl organization crawls the web since 2008 and publishes the results in snapshots approximately every month. Recent snapshots each contain about 300 TiB of data for around 3 billion web pages. In the following, we introduce our pipeline to assemble and filter a vision-language dataset from images in Common crawl and their associated HTML alt-text. + +# 3.1 Dataset Assembly Pipeline + +Our dataset assembly pipeline follows the flowchart of Figure 2. At a high level, the pipeline consists of three main components: (i) distributed filtering of the Common crawl web pages, (ii) distributed downloading of image-text pairs, and (iii) content filtering. The code used for the dataset pipeline may be found on GitHub3. We now describe each component in more detail. + +Web page filtering. To extract image-text pairs from Common crawl, we parse the HTML IMG (image) tags from Common crawl's WAT metadata files. Specifically, we focus on images with an alt-text so we can create image-text pairs. The alt-text is an HTML attribute of IMG tags containing alternative text for situations where the corresponding image cannot be rendered. For instance, screen reader software for a visually impaired person may read the alt-text in place of an image, or a search engine may use the alt-text to better index a web page without analyzing the actual image content. + +After extracting the alt-text, we perform language detection using CLD3 [53] with three possible outputs: English, another language, or no detected language (i.e., all detections are below a confidence threshold [69]). Based on a manual inspection of a random sample, the "no language" set contains language-agnostic short form text such as the names of products and places. + +We stored the resulting data in a PostgreSQL server for processing in the next stages of the pipeline. We maintained about 500M image URLs in the server at all times. + +**Loading and Retrieving Images** In order to maximize resource utilization, we downloaded the raw images from the parsed URLs with asynchronous requests using the Trio and Asks Python libraries. To limit costs, we chose a small cloud node with 2 vCPUs, 1GB of RAM, and 10Mbps download bandwidth as a worker instance. Such a worker can process 10,000 links in about 10 - 15 minutes. We utilized roughly 300 workers in parallel and batched the workload into chunks of 10,000 links taken from the aforementioned PostgreSQL server. + +Post-Processing. After downloading the WAT files from Common Crawl, we removed data with less than 5 characters of text, less than $5\mathrm{KB}$ of image data, and potentially malicious, large, or redundant images. To conclude the pipeline, we filtered image-text pairs based on their content. Specifically, + +![](images/86c5749f1ca0760a38ef59c63d63979ce6991a34f068f1fd8d048cf68dc80c5e.jpg) +Q: An armchair that looks like an apple +C: Green Apple Chair + +![](images/594efa4cf96ed79c3820fb30fd101700ee3cf32d547219e8a81f6f100bdadb7d.jpg) +Q: A dog rolling in the snow at sunset +C: sun snow dog + +![](images/f33d7c210f46ac8417a1dde72093cc413d83acb6f5060e79c2b01d1accb22222.jpg) +Q: A graphic design color palette +C:Color Palettes +Figure 3: LAION-5B examples. Sample images from a nearest neighbor search in LAION-5B using CLIP embeddings. The image and caption (C) are the first results for the query (Q). + +![](images/cfbdc24f7a162f323fed0a3380f2520914fac75e3e5697d2054fffe7d02f0568.jpg) +Q: pink photo of Tokyo +C: pink, japan, aesthetic image + +we computed cosine similarities between the image and text encodings with OpenAI's ViT-B/32 CLIP model. For languages other than English, we utilized the multi-lingual CLIP ViT-B/32 from Carlsson et al. [10]. While OpenAI also released larger CLIP models later, these models were not available when we began to assemble LAION-5B. For consistency, we therefore relied on ViT-B/32 CLIP models for the entire dataset. We removed all English image-text pairs with cosine similarity below 0.28, and all other pairs with similarity below 0.26. This step removed around $90\%$ of the original 50 billion images, leaving just short of 6 billion examples. + +# 3.2 Safety During Collection + +Current automated filtering techniques are far from perfect: harmful images are likely to pass, and others are likely to be falsely removed. We make a best effort to identify, document, and tag such content. In the case of illegal content, we computed CLIP embeddings to filter out such samples. Furthermore, these images and texts could amplify the social bias of machine learning models, especially ones trained with no or weak supervision [76]. It is important to note that the above mentioned classifiers are not perfect, especially keeping the complexity of these tasks and the diverse opinions of different cultures in mind. Therefore, we advocate using these tags responsibly, not relying on them to create a truly safe, "production-ready" subset after removing all potentially problematic samples. For a detailed discussion in this regard, we refer to Sec. 7. + +To encourage research in fields such as dataset curation, we refrain from removing potentially offensive samples and tag them instead. The user can decide whether to include content depending on their task. To this end, we also encourage model developers to state, e.g., in their model card [49] which subsets and tagged images are used. + +We apply Q16 [68] and our own specialized pornographic and sexualized content classifier (here referred to as NSFW) to identify and document a broad range of inappropriate concepts displaying not only persons but also objects, symbols, and text, see cf. [68] and Appendix Sec. C.5 and Sec. C.6 for details. Both classifiers are based on CLIP embeddings. Following our main intention of a publicly available dataset, these two approaches, as with all other implementations related to LAION 5B, are open-sourced. + +We separate pornographic content and otherwise inappropriate content (e.g. harm, exploitation and degradation). Both can be dis- and enabled in the publicly available dataset exploration UI. With both together, the UI and the openly accessible code, we encourage users to explore and, subsequently, report further not yet detected content and thus contribute to the improvement of our and other existing approaches. + +# 4 Dataset Composition + +We release LAION-5B as the following three subsets: + +- 2.32 billion English image-text pairs. We refer to this subset as LAION-2B-en or LAION-2B if the language is clear from context. + +- 2.26 billion image-text pairs from over 100 other languages. In the multilingual subset, the top-5 most frequent languages are Russian (10.6%), French (7.4%), German (6.6%), Spanish (6.6%), and Chinese (6.3%). +- 1.27 billion samples where a language could not be clearly detected. Based on visually inspecting a random subset of these low-confidence language samples, the corresponding images often depict products or places. The captions contain language with clear semantics, but might also include noise such as keywords for search engine optimization or product tags. + +We provide metadata files in the Apache Parquet format that consist of the following attributes for each image-text pair: + +A 64-bit integer identifier +- The URL of the image. +The text string. +- Height and width of the image. +- Cosine similarity between the text and image embeddings. +- The output from our NSFW and watermark detectors (one score between 0 and 1 each). + +$3\%$ of images were detected as NSFW, which can be filtered out by a user with the NSFW tag. + +# 5 Experiments Validating LAION-5B + +In this section, we showcase prior work using the LAION-400M [69] and other subsets as well as our CLIP reproduction studies to give quantitative and qualitative evidence of the dataset's utility for training SOTA large scale language-vision models. + +# 5.1 Usage Examples + +Subdataset Generation. LAION-5B's scale enables novel dataset curation for computer vision related tasks. Recently, researchers have utilized both LAION-5B and a subset, LAION-400M, as a data source in vision related tasks such as facial representation learning [96] and invasive species mitigation [38]. Within LAION, we have compiled from LAION-5B both LAION-High-Resolution $^{6}$ , a 170M subset for superresolution models, and LAION-Aesthetic $^{7}$ , a 120M subset of aesthetic images, as determined by a linear estimator on top of CLIP. + +CLIP Reproduction and Improvements. Gao et al. [19], trained an enhanced CLIP architecture on the LAION-400M subset, outperforming OpenAI's CLIP on ImageNet zero-shot classification top-1 accuracy. See Sec. 5.2 for our CLIP reproduction experiments using models of different scales. Training on a LAION-5B subset, Li et al. [42] developed BLIP to unify understanding and generation for vision-language tasks via a novel Vision-Language Pretraining (VLP) framework. It has been shown that BLIP matched or outperformed comparable models as per CIDEr, SPICE, and BLEU@4 metrics. Eichenberg et al. [16] used a LAION subset for MAGMA, a model generating text "answers" for image-question pairs; MAGMA achieves state of the art results on OKVQA metrics and outperforming Frozen [80]. + +Image Generation. Rombach et al. [63] utilized a subset of LAION-5B in training latent diffusion models (LDM) that achieved state-of-the-art results on image inpainting and class-conditional image synthesis. The work was further extended into stable diffusion project that used subsets of LAION-5B (LAION-2B-en, laion-high-resolution and laion-aesthetics $^8$ ) for training a publicly available SOTA text-to-image generative model (see Appendix Sec. F.2). Furthermore, Gu et al. [21] used LAION-400M to train VQ diffusion text-to-image generation models, which have been shown to be more efficient, and are able to generate higher quality images. Moreover, Sahara et al. [66] showed an improved architecture of a diffusion model that was trained on a subset of LAION-400M that outperforms OpenAI's recent DALLE-2 and achieves a new state-of-the-art COCO FID of 7.27. + +# 5.2 Experiments on CLIP Reproduction + +In an effort to reproduce the results of CLIP [58], and to validate the data collection pipeline we describe in Sec. 3, we trained several models on LAION-400M [69] and a model on LAION-2B-en, datasets which are both subsets of LAION-5B. As training such models require large compute due to dataset and model sizes that are considered in the experiments, the usage of supercomputers and large compute clusters is necessary in order to train the models efficiently. + +We used OpenCLIP [27], an open source software for training CLIP-like models. After adapting OpenCLIP for distributed training and execution on JUWELS Booster supercomputer [29], we reproduced CLIP models of different size on the LAION-400M subset. We trained ViT-B/32, ViT-B/16, and ViT-L/14 following CLIP [58], and an additional model that we call ViT-B/16+, a slightly larger version of ViT-B/16. We followed the same hyper-parameter choices of the original CLIP models. We used between 128 and 400 NVIDIA A100 GPUs to train the models. All trained models may be found in the OpenCLIP repository9. For more information about hyper-parameters and training details, see Appendix Sec. E.1. + +# 5.2.1 Zero-Shot Classification and Robustness Performance + +Following CLIP [58] and subsequent works, we evaluate the models on zero-shot classification. For each downstream dataset, we use a set of pre-defined prompts for each class, which we collected from prior works [58, 94]. We compute the embeddings of each class by averaging over the embedding of the prompts, computed each using the text encoder. For each image, and for each class, we compute the cosine similarity between their embeddings, and classify each image as the class that have the largest cosine similarity with the image embedding. We evaluate the models using top-1 accuracy. + +In Tab. 2, we show a comparison between models trained on LAION (400M, 2B) and original CLIP from [58]. We follow [94] and evaluate robustness performance on ImageNet distribution shift datasets [3, 23, 25, 61, 82]. Additionally, we construct a benchmark we call VTAB+, a superset of VTAB [91], on which we compute the average top-1 accuracy over 35 tasks $^{10}$ . We can see that on ImageNet-1k (noted "INet" on the table), performance of LAION-400M models and original CLIP models (trained on a 400M private dataset) is matched well. On the four ImageNet distribution shift datasets, we observe some larger differences, notably on ObjNet (CLIP WIT is better) and INet-S (LAION is better), which allows us to conclude that in overall, CLIP models trained on LAION match in their robustness original CLIP. With ViT-B/32 and ViT-L/14, training on the larger LAION-2B-en improves over LAION-400M model everywhere. Overall, on VTAB+, performance of LAION and CLIP WIT models are similar, except on ViT-L/14, where we observe an advantage of CLIP WIT. + +To obtain an idea about how the zero-shot performance improves with scale, we show the relationship between the total compute and accuracy on VTAB+ on models trained on LAION (400M, 2B-en). In Figure 4, we see that accuracy on VTAB+ improves with compute (log-log plot). It would be interesting to study in future work if the relationship between compute and accuracy keeps showing the same trend or whether we start to see saturation, like it was observed in [93]. Here, we can report that increasing either model or data scale for CLIP pre-training results in improvement of zero-shot classification performance on various downstream transfer targets. For a full overview of zero-shot classification and retrieval results, view Sec. E.3 of the Appendix. + +To show that larger dataset scale matters for the performance of pre-trained models, we perform additional experiments using ViT-B/32 and ViT-L/14 on different LAION-5B and LAION-400M subsets, while varying the amount of training compute (samples seen). Our findings confirm that the effect of dataset scale is significant, given sufficient compute for training. For instance, for the same amount of compute (34B images seen), training ViT-L/14 on LAION-2B-en $(75.4\%)$ outperforms LAION-400M $(73.9\%)$ on ImageNet-1k zero-shot classification. Same effect is observed for smaller ViT-B/32 model. For more detailed results, see Fig. 12 and Tab. 6 in the Appendix. + +![](images/641e5a6f5924d414c3c8e0d5798f1623f925eac505bd2103bef7bcd09401706c.jpg) +Figure 4: The relationship between total compute (giga multiply-accumulates (GMACS)) and zero-shot top-1 classification accuracy (\%) of models trained on LAION (400M, 2B-en). The dashed line in each figure is a linear fit in log-log space. Each point corresponds to a model trained on either the 400M or 2B-en LAION subsets. We show results on ImageNet-1k (left) and VTAB+ (right) where we average the accuracy over 35 tasks (see Appendix E.3 for details). Clear effect of model, data and compute training scale is evident on zero-shot performance that increases following scale power law. + +![](images/7642e784ab72274d38fa193c07e8d709847901dcefe700d52274992cab1f9ed1.jpg) + +
ModelPre-trainingINetINet-v2INet-RINet-SObjNetVTab+
B/32CLIP WIT63.356.069.442.344.245.4
LAION-400M62.9*0.455.1*0.973.4*4.049.4*7.143.9*0.345.6*0.2
LAION-2B-en65.7*2.457.4*1.475.9*6.552.9*10.648.7*4.547.9*2.5
B/16CLIP WIT68.361.977.748.255.347.5
LAION-400M67.0*1.359.6*2.377.9*0.252.4*4.251.5*3.848.3*0.8
B/16+LAION-400M69.261.580.554.453.949.2
L/14CLIP WIT75.669.887.959.669.055.7
LAION-400M72.8*2.865.4*4.484.7*3.259.659.9*9.151.8*3.9
LAION-2B-en75.2*0.367.7*2.087.4*0.563.3*3.765.5*3.654.6*1.2
+ +Table 2: Comparison between CLIP models trained on LAION (400M, 2B) and the original CLIP models [58] trained on OpenAI's WebImageText (WIT) dataset. We show zero-shot top-1 classification accuracy (\%) on various datasets including ImageNet, four ImageNet distribution shift datasets, and a benchmark we call VTAB+, where we average performance over 35 tasks. See Appendix E.3 for more details about the datasets used for evaluation and the results. + +# 5.3 Experiments with Generative Models + +To validate LAION-5B as a dataset for training strong text-to-image generation models, we fine-tuned OpenAI's GLIDE [52] on LAION-5B data. The obtained results comparing generated samples from original OpenAI GLIDE and from our reproduction (LAIONIDE) are compiled into an interactive web demo11. See Appendix Sec F for more technical details on experiments with GLIDE (F.1) and Stable Diffusion (F.2). + +# 6 Technical Limitations + +The large scale of current image-text datasets makes it infeasible to thoroughly investigate all aspects of a dataset in a single publication. Hence we now outline some potential technical limitations specifically affecting LAION-5B. These potential limitations are starting points for future work on analyzing and improving image-text datasets. + +Data Overlap. Our experiments in Section 5.2 show that models trained on LAION-5B achieve good performance on a variety of downstream tasks. However, the LAION-5B training set may overlap with some of the downstream test sets if these test sets are also included in Common CWEl. If overlap is present, it may lead to incorrectly large test set accuracies that overstate the true generalization capabilities of models trained on LAION-5B. + +Overall, we do not consider potential test set overlap to be a serious threat for the validity of results obtained with LAION-5B. OpenAI encountered the same question in the context of their pre-training dataset for CLIP and found only few examples of substantial performance difference due to data overlap on downstream target datasets [58]. Some datasets such as ObjectNet [3] are likely not contained in Common Crawl because ObjectNet was not assembled from web images. Instead, the authors of ObjectNet tasked MTurk workers to take new pictures in their own homes. Nevertheless, measuring the degree of overlap between LAION-5B and popular computer vision benchmarks is an important question for future work, which will include further de-duplication efforts. + +Other text sources. Birhane et al. [6] described the shortcomings of alt-text and noted that alt-text is not necessarily a good description of the corresponding image. For instance, the alt-text may be search engine optimization (SEO) spam, an incoherent list of keywords, or overly corrupted otherwise. In such cases, the language in the text annotations may become less informative or entirely useless for training. For ImageNet zero-shot classification, BASIC [54] has demonstrated strong results when turning 5 billion of the 6.6 billion captions into the form of CLASS_1 and CLASS_2 and . . . and CLASS_K, by using an internal multi-label classification dataset (JFT-3B). Thus, image captions formed by just concatenating class names may also serve as meaningful alternative of otherwise corrupted text. Such a finding adds a possibility of employing generated together with existing natural language captions for training contrastive image-language models with strong zero-shot performance. + +Filtering with CLIP. CLIP allows the curation and collection of this dataset to be low-cost and scalable. Such an automated process reduces dramatically necessity for the human control which would be otherwise intractable for such large scale collection. However, through curating with CLIP, we also incur its flaws and model biases. For additional discussion of CLIP filtering related to safety and ethics, see Appendix Sec. G.2. + +Filtering by a small scale CLIP ViT-B/32 may leave more image-text pairs with weak or no semantic connection in the dataset while also accidentally removing some high quality image-text pairs than filtering with stronger, larger scale models that were not available in the time of our experiments. The larger CLIP ViT-L/14 model may create a less noisy version of LAION datasets than what was possible with smaller scale CLIP ViT-B/32. We hypothesize that filtering Common Crawl with a CLIP ViT-L model will further increase the quality of our dataset. It is subject to our future work to create a CLIP ViT L/14 filtered version of LAION-400M and LAION-5B to test how this affects model training and downstream transfer performance. + +# 7 Safety and Ethical Discussion + +Recent developments in large-scale models, such as GPT-3 [9], CLIP [57], ALIGN [28], GLIDE [52], and DALLE-2 [60] have potential for far-reaching impact on society, both positive and negative, when deployed in applications such as image classification and generation, recommendation systems, or search engines. Besides model parameter scaling, the advances made so far also rely on the underlying large-scale datasets. Recent research [4, 5] described many potential negative societal implications that may arise due to careless use of vision-language models, e.g., the models perform worse for certain groups of users or reproduce discriminatory behavior. + +Unfortunately, only a minority of these models are publicly released, most of them are only accessible by an "input to output" interface. Importantly, the underlying large-scale datasets are also not often publicly available. While open-source efforts exist to re-implement model architectures and + +training, the closed nature of large-scale datasets used for model training makes any proper systematic investigation of model training and model behavior very hard or even impossible. Studying full training, comparison of different model architectures and progress in large-scale multi-modal learning becomes restricted to those institutions that were able to obtain their closed large-scale datasets. It also results in safety issues of creating and using such models, as broad research community does not get to test both model and the dataset used for its training for causes underlying undesired behaviours. + +LAION-5B as an open large-scale dataset provides here not only a chance to make progress in careful studies of the trained models' capabilities and replication but also to investigate how uncurated large-scale datasets impact various model biases and under which circumstances their usage may result in undesired safety issues. Such research can help to design automated ways to curate and create datasets from uncurated ones that alleviate the bias and safety issues. To this end, LAION also created a number of tools to aid researchers and other users in large-scale data handling and exploration. One such a tool uses pre-computed image embeddings to enable search of images guided either by text or image input via an easily and publically accessible web interface (CLIP retrieval tool $^{12}$ , see Appendix Sec. C.4). LAION made also source code for the tool and routines necessary to build an own version of it publicly available $^{13}$ (see Appendix Sec C, C.2, C.3 for more details). + +After the release of LAION-400M, several groups (e.g., [6]) already used such tools and investigated potential problems arising from an unfiltered dataset. Motivated by these findings, with LAION-5B, we introduced an improved inappropriate content tagging (cf. Sec. 3.2) as well as a watermark filter, which can improve the safety and quality of the text-to-image models trained on the dataset. + +Such development indicates that this dataset acts as a starting point, and is not the final endpoint, for creating further improved datasets to train models for various tasks. In our opinion, this process is not supposed to be a non-transparent closed-door avenue. It should be approached by broad research community, resulting in open and transparent datasets and procedures for model training. Towards meeting this challenge, the large-scale public image-text dataset of over 5.8 billion pairs and further annotations introduced here provides diversity that can be a starting point for ensuring balance and for selecting safe, curated subsets for corresponding target applications. We encourage everybody to participate in this exciting and important future journey. + +In the current form, we consider this dataset a research artefact and strongly advocate academic use-only and advise careful investigation of downstream model biases (Appendix Sec. G.2). Additionally, we encourage users to use the described tools and to transparently explore and, subsequently, report further not yet detected content and model behaviour to our dataset repository14, and help to further advance existing approaches for data curation using the real-world large dataset introduced here. + +Privacy. We comment on privacy issues arising from Common Crawl as source of links in LAION-5B and measures undertaken to handle those in the Appendix Sec. G.1 + +# 8 Conclusion + +By releasing LAION-5B, a larger updated version of an openly available dataset that contains over 5 billion image-text pairs, we have further pushed the scale of open datasets for training and studying state-of-the-art language-vision models. This scale gives strong increases to zero-shot transfer and robustness. + +To validate the utility of LAION-5B, we demonstrated that a subset of our dataset can be used to train SOTA CLIP models of various scale that match the strong zero-shot and robustness performance of the original models trained on closed curated data, or to fine-tune generative models like GLIDE, producing samples of good quality. The dataset thus provides opportunities in multi-language large-scale training and research of language-vision models, that were previously restricted to those having access to proprietary large datasets, to the broader research community. Finally, thanks to its large scale, even a rather strict subset filtering (driven by various criterion like NSFW, watermark presence, resolution) provides high-quality datasets that are still large enough to provide sufficient scale for the training or fine-tuning of strong specialized language-vision models. + +# Acknowledgments + +We thank Phil Wang, the creator of the DALLE-pytorch github repository $^{15}$ , who inspired us and helped creating our open community. We also want to thank Aran Komatsuzaki, Andreas Köpf, Bokai Yu, John David Pressman, Natalie Parde, Gabriel Ilharco, Fredde Frallan (see also Appendix) and all the members of the LAION discord server $^{16}$ for helping crawling image-text-pairs and run inference on their private computers. We want to thank Hugging Face and Stability AI for their continuous financial support and providing hosting space for open datasets and models. We would also like to thank openAI for making their pre-trained CLIP models publicly available, which allowed us to filter the LAION datasets. We would like to express gratitude to all the people who are working on making code, models and data publicly available, advancing community based research and making research more reproducible. + +The authors gratefully acknowledge the Gauss Centre for Supercomputing e.V. $^{17}$ for funding this work by providing computing time through the John von Neumann Institute for Computing (NIC) on the GCS Supercomputer JUWELS Booster [29] at Jülich Supercomputing Centre (JSC). We also acknowledge storage resources on JUST [20] granted and operated by JSC. Patrick Schramowski acknowledges the support by the Hessian Ministry of Higher Education, Research, Science and the Arts (HMWK) cluster project "The Third Wave of AI". + +# References + +[1] URL https://commoncrawl.org/. +[2] Jean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech, Iain Barr, Yana Hasson, Karel Lenc, Arthur Mensch, Katie Millican, Malcolm Reynolds, et al. Flamingo: a visual language model for few-shot learning. arXiv preprint arXiv:2204.14198, 2022. +[3] Andrei Barbu, David Mayo, Julian Alverio, William Luo, Christopher Wang, Dan Gutfreund, Josh Tenenbaum, and Boris Katz. Objectnet: A large-scale bias-controlled dataset for pushing the limits of object recognition models. In Advances in Neural Information Processing Systems (NeurIPS), 2019. URL https://proceedings.neurips.cc/paper/2019/file/97af07a14cacba681feacf3012730892-Paper.pdf. +[4] Emily M. Bender, Timnit Gebru, Angelina McMillan-Major, and Shmargaret Shmitchell. On the dangers of stochastic parrots: Can language models be too big? In Proceedings of ACM Conference on Fairness, Accountability, and Transparency (FAccT), pages 610-623, 2021. +[5] Abeba Birhane and Vinay Uday Prabhu. Large image datasets: A pyrrhic win for computer vision? In Proceedings of IEEE Winter Conference on Applications of Computer Vision (WACV), pages 1536-1546. IEEE, 2021. +[6] Abeba Birhane, Vinay Uday Prabhu, and Emmanuel Kahembwe. Multimodal datasets: misogyny, pornography, and malignant stereotypes. October 2021. +[7] Lukas Bossard, Matthieu Guillaumin, and Luc Van Gool. Food-101-mining discriminative components with random forests. In European Conference on Computer Vision (ECCV), 2014. https://data.vision.ee.ethz.ch/cvl/datasetsextra/food-101/. +[8] Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877-1901, 2020. +[9] Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec + +Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners, 2020. URL https://arxiv.org/abs/2005.14165. +[10] Fredrik Carlsson, Philipp Eisen, Faton Rekathati, and Magnus Sahlgren. Cross-lingual and multilingual clip. In Proceedings of the Language Resources and Evaluation Conference, pages 6848–6854, Marseille, France, June 2022. European Language Resources Association. URL https://aclanthology.org/2022.lrec-1.739. +[11] Soravit Changpinyo, Piyush Sharma, Nan Ding, and Radu Soricut. Conceptual 12m: Pushing web-scale image-text pre-training to recognize long-tail visual concepts. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 3558-3568, 2021. +[12] Mircea Cimpoi, Subhransu Maji, Iasonas Kokkinos, Sammy Mohamed, and Andrea Vedaldi. Describing textures in the wild. In Conference on Computer Vision and Pattern Recognition (CVPR), 2014. https://arxiv.org/abs/1311.3618. +[13] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pages 248–255. IEEE, 2009. +[14] Karan Desai, Gaurav Kaul, Zubin Aysola, and Justin Johnson. Redcaps: Web-curated image-text data created by the people, for the people. arXiv preprint arXiv:2111.11431, 2021. +[15] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020. +[16] Constantin Eichenberg, Sidney Black, Samuel Weinbach, Letitia Parcalabescu, and Anette Frank. MAGMA - multimodal augmentation of generative models through adapter-based finetuning. CoRR, abs/2112.05253, 2021. URL https://arxiv.org/abs/2112.05253. +[17] Samir Yitzhak Gadre, Mitchell Wortsman, Gabriel Ilharco, Ludwig Schmidt, and Shuran Song. CLIP on wheels: Zero-shot object navigation as object localization and exploration, 2022. +[18] Leo Gao, Stella Biderman, Sid Black, Laurence Golding, Travis Hoppe, Charles Foster, Jason Phang, Horace He, Anish Thite, Noa Nabeshima, et al. The pile: An 800gb dataset of diverse text for language modeling. arXiv preprint arXiv:2101.00027, 2020. +[19] Yuting Gao, Jinfeng Liu, Zihan Xu, Jun Zhang, Ke Li, and Chunhua Shen. Pyramidclip: Hierarchical feature alignment for vision-language model pretraining, 2022. URL https://arxiv.org/abs/2204.14095. +[20] Stephan Graf and Olaf Mextorf. Just: Large-scale multi-tier storage infrastructure at the jülich supercomputing centre. Journal of large-scale research facilities JLSRF, 7:180, 2021. +[21] Shuyang Gu, Dong Chen, Jianmin Bao, Fang Wen, Bo Zhang, Dongdong Chen, Lu Yuan, and Baining Guo. Vector quantized diffusion model for text-to-image synthesis. CoRR, abs/2111.14822, 2021. URL https://arxiv.org/abs/2111.14822. +[22] Varun Gulshan, Lily Peng, Marc Coram, Martin C. Stumpe, Derek Wu, Arunachalam Narayanaswamy, Subhashini Venugopalan, Kasumi Widner, Tom Madams, Jorge Cuadros, Ramasamy Kim, Rajiv Raman, Philip C. Nelson, Jessica L. Mega, and Dale R. Webster. Development and Validation of a Deep Learning Algorithm for Detection of Diabetic Retinopathy in Retinal Fundus Photographs. JAMA, 316(22):2402-2410, 12 2016. ISSN 0098-7484. doi: 10.1001/jama.2016.17216. URL https://doi.org/10.1001/jama.2016.17216. +[23] Dan Hendrycks, Steven Basart, Norman Mu, Saurav Kadavath, Frank Wang, Evan Dorundo, Rahul Desai, Tyler Zhu, Samyak Parajuli, Mike Guo, Dawn Song, Jacob Steinhardt, and Justin Gilmer. The many faces of robustness: A critical analysis of out-of-distribution generalization. International Conference on Computer Vision (ICCV), 2021. https://arxiv.org/abs/2006.16241. + +[24] Dan Hendrycks, Kevin Zhao, Steven Basart, Jacob Steinhardt, and Dawn Song. Natural adversarial examples. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 15262-15271, 2021. +[25] Dan Hendrycks, Kevin Zhao, Steven Basart, Jacob Steinhardt, and Dawn Song. Natural adversarial examples. Conference on Computer Vision and Pattern Recognition (CVPR), 2021. https://arxiv.org/abs/1907.07174. +[26] Xiaowei Hu, Zhe Gan, Jianfeng Wang, Zhengyuan Yang, Zicheng Liu, Yumao Lu, and Li-juan Wang. Scaling up vision-language pre-training for image captioning. arXiv preprint arXiv:2111.12233, 2021. +[27] Gabriel Ilharco, Mitchell Wortsman, Ross Wightman, Cade Gordon, Nicholas Carlini, Rohan Taori, Achal Dave, Vaishaal Shankar, Hongseok Namkoong, John Miller, Hannaneh Hajishirzi, Ali Farhadi, and Ludwig Schmidt. Openclip, July 2021. URL https://doi.org/10.5281/ zenodo.5143773. +[28] Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc V. Le, Yun-Hsuan Sung, Zhen Li, and Tom Duerig. Scaling up visual and vision-language representation learning with noisy text supervision. CoRR, abs/2102.05918, 2021. URL https://arxiv.org/abs/2102.05918. +[29] Juelich Supercomputing Center. JUWELS Booster Supercomputer, 2020. https://apps.fz-juelich.de/jsc/hps/juwels/configuration.html#hardware-configuration-of-the-system-name-booster-module. +[30] Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020. +[31] Andrej Karpathy and Li Fei-Fei. Deep visual-semantic alignments for generating image descriptions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 3128-3137, 2015. +[32] Apoorv Khandelwal, Luca Weihs, Roozbeh Mottaghi, and Aniruddha Kembhavi. Simple but effective: Clip embeddings for embodied ai. arXiv preprint arXiv:2111.09888, 2021. +[33] Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, and Neil Houlsby. Big transfer (bit): General visual representation learning. In European conference on computer vision, pages 491-507. Springer, 2020. +[34] Simon Kornblith, Jonathon Shlens, and Quoc V Le. Do better imagenet models transfer better? In Conference on Computer Vision and Pattern Recognition (CVPR), 2019. https://arxiv.org/abs/1805.08974. +[35] Jonathan Krause, Michael Stark, Jia Deng, and Li Fei-Fei. 3d object representations for fine-grained categorization. In International Conference on Computer Vision (ICCV) Workshops, 2013. https://ieeexplore.ieee.org/document/6755945. +[36] Ranjay Krishna, Yuke Zhu, Oliver Groth, Justin Johnson, Kenji Hata, Joshua Kravitz, Stephanie Chen, Yannis Kalantidis, Li-Jia Li, David A Shamma, et al. Visual genome: Connecting language and vision using crowdsourced dense image annotations. International journal of computer vision, 123(1):32-73, 2017. +[37] Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images, 2009. https://www.cs.toronto.edu/\~kriz/learning-features-2009-TR.pdf. +[38] Srivatsa Kundurthy. *Lantern-rd: Enabling deep learning for mitigation of the invasive spotted lanternfly*, 2022. URL https://arxiv.org/abs/2205.06397. +[39] Alina Kuznetsova, Hassan Rom, Neil Alldrin, Jasper Uijlings, Ivan Krasin, Jordi Pont-Tuset, Shahab Kamali, Stefan Popov, Matteo Malloci, Alexander Kolesnikov, Tom Duerig, and Vittorio Ferrari. The open images dataset v4: Unified image classification, object detection, and visual relationship detection at scale. IJCV, 2020. + +[40] Hugo Laurençon, Lucile Saulnier, Thomas Wang, Christopher Akiki, Albert Villanova del Moral, Teven Le Scao, Leandro Von Werra, Chenghao Mou, Eduardo González Ponferrada, Huu Nguyen, et al. The bigscience roots corpus: A 1.6 tb composite multilingual dataset. In Thirty-sixth Conference on Neural Information Processing Systems Datasets and Benchmarks Track. +[41] Ang Li, Allan Jabri, Armand Joulin, and Laurens Van Der Maaten. Learning visual n-grams from web data. In Proceedings of the IEEE International Conference on Computer Vision, pages 4183–4192, 2017. +[42] Junnan Li, Dongxu Li, Caiming Xiong, and Steven Hoi. Blip: Bootstrapping language-image pre-training for unified vision-language understanding and generation, 2022. URL https://arxiv.org/abs/2201.12086. +[43] Junnan Li, Dongxu Li, Caiming Xiong, and Steven Hoi. Blip: Bootstrapping language-image pre-training for unified vision-language understanding and generation. arXiv preprint arXiv:2201.12086, 2022. +[44] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dólár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In European conference on computer vision, pages 740-755. Springer, 2014. +[45] Luping Liu, Yi Ren, Zhijie Lin, and Zhou Zhao. Pseudo numerical methods for diffusion models on manifolds. arXiv preprint arXiv:2202.09778, 2022. +[46] Dhruv Mahajan, Ross Girshick, Vignesh Ramanathan, Kaiming He, Manohar Paluri, Yixuan Li, Ashwin Bharambe, and Laurens Van Der Maaten. Exploring the limits of weakly supervised pretraining. In Proceedings of the European conference on computer vision (ECCV), pages 181-196, 2018. +[47] Elman Mansimov, Emilio Parisotto, Jimmy Lei Ba, and Ruslan Salakhutdinov. Generating images from captions with attention. arXiv preprint arXiv:1511.02793, 2015. +[48] Maxim Maximov, Ismail Elezi, and Laura Leal-Taixe. Ciagan: Conditional identity anonymization generative adversarial networks. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 5447-5456, 2020. +[49] Margaret Mitchell, Simone Wu, Andrew Zaldivar, Parker Barnes, Lucy Vasserman, Ben Hutchinson, Elena Spitzer, Inioluwa Deborah Raji, and Timnit Gebru. Model cards for model reporting. In Proceedings of the Conference on Fairness, Accountability, and Transparency (FAT). ACM, 2019. +[50] Ron Mokady, Amir Hertz, and Amit H Bermano. Clipcap: Clip prefix for image captioning. arXiv preprint arXiv:2111.09734, 2021. +[51] Yasuhide Mori, Hironobu Takahashi, and Ryuichi Oka. Image-to-word transformation based on dividing and vector quantizing images with words. In First international workshop on multimedia intelligent storage and retrieval management, pages 1-9. CiteSeer, 1999. +[52] Alex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew, Ilya Sutskever, and Mark Chen. Glide: Towards photorealistic image generation and editing with text-guided diffusion models, 2021. URL https://arxiv.org/abs/2112.10741. +[53] Jeroen Ooms. cld3: Google's Compact Language Detector 3, 2022. https://docs.ropensci.org/cld3/, https://github.com/ropensci/cld3 (devel) https://github.com/google/cld3 (upstream). +[54] Hieu Pham, Zihang Dai, Golnaz Ghiasi, Hanxiao Liu, Adams Wei Yu, Minh-Thang Luong, Mingxing Tan, and Quoc V Le. Combined scaling for zero-shot transfer learning. arXiv preprint arXiv:2111.10050, 2021. +[55] Jordi Pont-Tuset, Jasper Uijlings, Soravit Changpinyo, Radu Soricut, and Vittorio Ferrari. Connecting vision and language with localized narratives. In ECCV, 2020. + +[56] Ariadna Quattoni, Michael Collins, and Trevor Darrell. Learning visual representations using images with captions. In 2007 IEEE Conference on Computer Vision and Pattern Recognition, pages 1-8. IEEE, 2007. +[57] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language supervision, 2021. URL https://arxiv.org/abs/2103.00020. +[58] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International Conference on Machine Learning, pages 8748-8763. PMLR, 2021. +[59] Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. CoRR, abs/2102.12092, 2021. URL https://arxiv.org/abs/2102.12092. +[60] Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image generation with clip latents, 2022. URL https://arxiv.org/abs/2204.06125. +[61] Benjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. Do ImageNet classifiers generalize to ImageNet? In International Conference on Machine Learning (ICML), 2019. https://arxiv.org/abs/1902.10811. +[62] Scott Reed, Zeynep Akata, Xinchen Yan, Lajanugen Logeswaran, Bernt Schiele, and Honglak Lee. Generative adversarial text to image synthesis. In International conference on machine learning, pages 1060-1069. PMLR, 2016. +[63] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-resolution image synthesis with latent diffusion models. CoRR, abs/2112.10752, 2021. URL https://arxiv.org/abs/2112.10752. +[64] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-resolution image synthesis with latent diffusion models, 2021. +[65] Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision (IJCV), 115(3):211-252, 2015. doi: 10.1007/s11263-015-0816-y. +[66] Chitwan Sahara, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily Denton, Seyed Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, S. Sara Mahdavi, Rapha Gontijo Lopes, Tim Salimans, Jonathan Ho, David J Fleet, and Mohammad Norouzi. Photorealistic text-to-image diffusion models with deep language understanding, 2022. URL https://arxiv.org/abs/2205.11487. +[67] Navid Kanaani Sajjad Ayoubi. Clipfa: Connecting farsi text and images. https://github.com/SajjjadAyobi/CLIPfa, 2021. +[68] Patrick Schramowski, Christopher Tauchmann, and Kristian Kersting. Can machines help us answering question 16 in datasheets, and in turn reflecting on inappropriate content? In Proceedings of the ACM Conference on Fairness, Accountability, and Transparency (FAccT). ACM, 2022. +[69] Christoph Schuhmann, Richard Vencu, Romain Beaumont, Robert Kaczmarczyk, Clayton Mullis, Aarush Katta, Theo Coombes, Jenia Jitsev, and Aran Komatsuzaki. Laion-400m: Open dataset of clip-filtered 400 million image-text pairs. arXiv preprint arXiv:2111.02114, 2021. +[70] Vaishaal Shankar, Achal Dave, Rebecca Roelofs, Deva Ramanan, Benjamin Recht, and Ludwig Schmidt. Do image classifiers generalize across time?, 2019. https://arxiv.org/abs/1906.02168. + +[71] Piyush Sharma, Nan Ding, Sebastian Goodman, and Radu Soricut. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2556-2565, Melbourne, Australia, July 2018. Association for Computational Linguistics. doi: 10.18653/v1/P18-1238. URL https://aclanthology.org/P18-1238. +[72] Sheng Shen, Liunian Harold Li, Hao Tan, Mohit Bansal, Anna Rohrbach, Kai-Wei Chang, Zhewei Yao, and Kurt Keutzer. How much can clip benefit vision-and-language tasks? arXiv preprint arXiv:2107.06383, 2021. +[73] Makoto Shing. Japanese clip. https://github.com/rinnakk/japanese-clip, May 2022. +[74] Guijin Son, Hansol Park, Jake Tae, and Trent Oh. Koclip. https://github.com/jaketae/koclip, 20201. +[75] Krishna Srinivasan, Karthik Raman, Jiecao Chen, Michael Bendersky, and Marc Najork. Wit: Wikipedia-based image text dataset for multimodal multilingual machine learning. In Proceedings of the 44th International ACM SIGIR Conference on Research and Development in Information Retrieval, pages 2443-2449, 2021. +[76] Ryan Steed and Aylin Caliskan. Image representations learned with unsupervised pre-training contain human-like biases. In Proceedings of ACM Conference on Fairness, Accountability, and Transparency (FAccT), pages 701-713, 2021. +[77] Chen Sun, Abhinav Shrivastava, Saurabh Singh, and Abhinav Gupta. Revisiting unreasonable effectiveness of data in deep learning era. In Proceedings of the IEEE international conference on computer vision, pages 843-852, 2017. +[78] Rohan Taori, Achal Dave, Vaishaal Shankar, Nicholas Carlini, Benjamin Recht, and Ludwig Schmidt. Measuring robustness to natural distribution shifts in image classification. Advances in Neural Information Processing Systems, 33:18583-18599, 2020. +[79] Bart Thomee, David A Shamma, Gerald Friedland, Benjamin Elizalde, Karl Ni, Douglas Poland, Damian Borth, and Li-Jia Li. Yfcc100m: The new data in multimedia research. Communications of the ACM, 59(2):64-73, 2016. +[80] Maria Tsimpoukelli, Jacob L Menick, Serkan Cabi, SM Eslami, Oriol Vinyals, and Felix Hill. Multimodal few-shot learning with frozen language models. Advances in Neural Information Processing Systems, 34:200-212, 2021. +[81] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017. +[82] Haohan Wang, Songwei Ge, Zachary Lipton, and Eric P Xing. Learning robust global representations by penalizing local predictive power. In Advances in Neural Information Processing Systems (NeurIPS), 2019. https://arxiv.org/abs/1905.13549. +[83] Jason Weston, Samy Bengio, and Nicolas Usunier. Large scale image annotation: learning to rank with joint word-image embeddings. Machine learning, 81(1):21-35, 2010. +[84] Mitchell Wortsman, Gabriel Ilharco, Mike Li, Jong Wook Kim, Hannaneh Hajishirzi, Ali Farhadi, Hongseok Namkoong, and Ludwig Schmidt. Robust fine-tuning of zero-shot models. arXiv preprint arXiv:2109.01903, 2021. +[85] Jianxiong Xiao, Krista A Ehinger, James Hays, Antonio Torralba, and Aude Oliva. Sun database: Exploring a large collection of scene categories. International Journal of Computer Vision, 2016. https://link.springer.com/article/10.1007/s11263-014-0748-y. +[86] Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron Courville, Ruslan Salakhudinov, Rich Zemel, and Yoshua Bengio. Show, attend and tell: Neural image caption generation with visual attention. In International conference on machine learning, pages 2048-2057. PMLR, 2015. + +[87] Kaiyu Yang, Jacqueline H Yau, Li Fei-Fei, Jia Deng, and Olga Russakovsky. A study of face obfuscation in imagenet. In International Conference on Machine Learning, pages 25313–25330. PMLR, 2022. +[88] Peter Young, Alice Lai, Micah Hodosh, and Julia Hockenmaier. From image descriptions to visual denotations: New similarity metrics for semantic inference over event descriptions. Transactions of the Association for Computational Linguistics, 2:67-78, 2014. doi: 10.1162/tacl_a_00166. URL https://aclanthology.org/Q14-1006. +[89] Jiahui Yu, Zirui Wang, Vijay Vasudevan, Legg Yeung, Mojtaba Seyedhosseini, and Yonghui Wu. Coca: Contrastive captioners are image-text foundation models. arXiv preprint arXiv:2205.01917, 2022. +[90] Jiahui Yu, Yuanzhong Xu, Jing Yu Koh, Thang Luong, Gunjan Baid, Zirui Wang, Vijay Vasudevan, Alexander Ku, Yinfei Yang, Burcu Karagol Ayan, et al. Scaling autoregressive models for content-rich text-to-image generation. arXiv preprint arXiv:2206.10789, 2022. +[91] Xiaohua Zhai, Joan Puigcerver, Alexander Kolesnikov, Pierre Ruyssen, Carlos Riquelme, Mario Lucic, Josip Djolonga, Andre Susano Pinto, Maxim Neumann, Alexey Dosovitskiy, et al. A large-scale study of representation learning with the visual task adaptation benchmark. arXiv preprint arXiv:1910.04867, 2019. +[92] Xiaohua Zhai, Alexander Kolesnikov, Neil Houlsby, and Lucas Beyer. Scaling vision transformers. 2021. doi: 10.48550/ARXIV.2106.04560. URL https://arxiv.org/abs/2106.04560. +[93] Xiaohua Zhai, Alexander Kolesnikov, Neil Houlsby, and Lucas Beyer. Scaling vision transformers. arXiv preprint arXiv:2106.04560, 2021. +[94] Xiaohua Zhai, Xiao Wang, Basil Mustafa, Andreas Steiner, Daniel Keysers, Alexander Kolesnikov, and Lucas Beyer. Lit: Zero-shot transfer with locked-image text tuning. arXiv preprint arXiv:2111.07991, 2021. +[95] Han Zhang, Tao Xu, Hongsheng Li, Shaoting Zhang, Xiaogang Wang, Xiaolei Huang, and Dimitris N Metaxas. Stackgan: Text to photo-realistic image synthesis with stacked generative adversarial networks. In Proceedings of the IEEE international conference on computer vision, pages 5907-5915, 2017. +[96] Yinglin Zheng, Hao Yang, Ting Zhang, Jianmin Bao, Dongdong Chen, Yangyu Huang, Lu Yuan, Dong Chen, Ming Zeng, and Fang Wen. General facial representation learning in a visual-linguistic manner. CoRR, abs/2112.03109, 2021. URL https://arxiv.org/abs/2112.03109. \ No newline at end of file diff --git a/laion5banopenlargescaledatasetfortrainingnextgenerationimagetextmodels/images.zip b/laion5banopenlargescaledatasetfortrainingnextgenerationimagetextmodels/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..bba73281bf5834a12ee8b27abaf6d984f519f17f --- /dev/null +++ b/laion5banopenlargescaledatasetfortrainingnextgenerationimagetextmodels/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e40f546aad72e4991a0b38c6e4cd822aa427fe71893a2e0637960a64d1bab9b6 +size 208127 diff --git a/laion5banopenlargescaledatasetfortrainingnextgenerationimagetextmodels/layout.json b/laion5banopenlargescaledatasetfortrainingnextgenerationimagetextmodels/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..279b9760f1765cd65a9560e641300ab423cc9b1c --- /dev/null +++ b/laion5banopenlargescaledatasetfortrainingnextgenerationimagetextmodels/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:513fb0fb351471a439ca5ac56e4271a25cc5f9d0e2317ecc94f90acb5d1bfa3e +size 425965 diff --git a/lampextractingtextfromgradientswithlanguagemodelpriors/eb4ac3b5-c4eb-413b-86d8-ca95db393407_content_list.json b/lampextractingtextfromgradientswithlanguagemodelpriors/eb4ac3b5-c4eb-413b-86d8-ca95db393407_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..875271c28421ce380f9a973d99ea280334e5f2e5 --- /dev/null +++ b/lampextractingtextfromgradientswithlanguagemodelpriors/eb4ac3b5-c4eb-413b-86d8-ca95db393407_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6db9f60e2eae1be87ab8d6c94dae5bb1174b271c8dce4cc91fae2b3b3dfbf067 +size 87494 diff --git a/lampextractingtextfromgradientswithlanguagemodelpriors/eb4ac3b5-c4eb-413b-86d8-ca95db393407_model.json b/lampextractingtextfromgradientswithlanguagemodelpriors/eb4ac3b5-c4eb-413b-86d8-ca95db393407_model.json new file mode 100644 index 0000000000000000000000000000000000000000..6311f9c84f7823a6c135264ed90c32dab004fe32 --- /dev/null +++ b/lampextractingtextfromgradientswithlanguagemodelpriors/eb4ac3b5-c4eb-413b-86d8-ca95db393407_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ec783994d4e4f4e522d4464c39f1430da37a9b356205e8a0c72e071cc56ced85 +size 108200 diff --git a/lampextractingtextfromgradientswithlanguagemodelpriors/eb4ac3b5-c4eb-413b-86d8-ca95db393407_origin.pdf b/lampextractingtextfromgradientswithlanguagemodelpriors/eb4ac3b5-c4eb-413b-86d8-ca95db393407_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..a6b7a79e261ef04cc463e490743b46441297c2f1 --- /dev/null +++ b/lampextractingtextfromgradientswithlanguagemodelpriors/eb4ac3b5-c4eb-413b-86d8-ca95db393407_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f50a55bb646902a0d695d7d24493d6c5fa24b2927a46b753654c747a9590ba82 +size 429722 diff --git a/lampextractingtextfromgradientswithlanguagemodelpriors/full.md b/lampextractingtextfromgradientswithlanguagemodelpriors/full.md new file mode 100644 index 0000000000000000000000000000000000000000..d1d2dfa045710f7601374063ec94a1763dc445d1 --- /dev/null +++ b/lampextractingtextfromgradientswithlanguagemodelpriors/full.md @@ -0,0 +1,322 @@ +# LAMP: Extracting Text from Gradients with Language Model Priors + +Mislav Balunović; Dimitar I. Dimitrov; Nikola Jovanović, Martin Vechev + +{mislav.balunovic,dimitar.iliev.dimitrov, nikola.jovanovic,martin.vechev}@inf.ethz.ch Department of Computer Science ETH Zurich + +# Abstract + +Recent work shows that sensitive user data can be reconstructed from gradient updates, breaking the key privacy promise of federated learning. While success was demonstrated primarily on image data, these methods do not directly transfer to other domains such as text. In this work, we propose LAMP, a novel attack tailored to textual data, that successfully reconstructs original text from gradients. Our attack is based on two key insights: (i) modeling prior text probability with an auxiliary language model, guiding the search towards more natural text, and (ii) alternating continuous and discrete optimization, which minimizes reconstruction loss on embeddings, while avoiding local minima by applying discrete text transformations. Our experiments demonstrate that LAMP is significantly more effective than prior work: it reconstructs 5x more bigrams and $23\%$ longer subsequences on average. Moreover, we are the first to recover inputs from batch sizes larger than 1 for textual models. These findings indicate that gradient updates of models operating on textual data leak more information than previously thought. + +# 1 Introduction + +Federated learning [24] (FL) is a widely adopted framework for training machine learning models in a decentralized way. Conceptually, FL aims to enable training of highly accurate models without compromising client data privacy, as the raw data never leaves client machines. However, recent work [28, 43, 41] has shown that the server can in fact recover the client data, by applying a reconstruction attack on the gradient updates sent from the client during training. Such attacks typically start from a randomly sampled input and modify it such that its corresponding gradients match the gradient update originally sent by the client. While most works focus on reconstruction attacks in computer vision, there has comparatively been little work in the text domain, despite the fact that some of the most prominent applications of FL involve learning over textual data, e.g., next-word prediction on mobile phones [30]. A key component of successful attacks in vision has been the use of image priors such as total variation [7]. These priors guide the reconstruction towards natural images, which are more likely to correspond to client data. However, the use of priors has so far been missing from attacks on text [43, 3], limiting their ability to reconstruct real client data. + +This work: private text reconstruction with priors In this work, we propose LAMP, a new reconstruction attack which leverages language model priors to extract private text from gradients. The overview of our attack is given in Fig. 1. The attacker has access to a snapshot of the transformer network being trained in a federated manner (e.g., BERT), and a gradient $\nabla_{\theta}\mathcal{L}(\boldsymbol{x}^{*},y^{*})$ which the client has computed on that snapshot, using their private data. The attack starts by sampling token + +![](images/0db77b164d81e437550156bcfe926678c2e91cd868ddb6da75b9710b1430f73a.jpg) +Figure 1: An overview of LAMP. We initialize the reconstruction by sampling from a Gaussian distribution, and alternate between continuous and discrete optimization. Continuous optimization minimizes the reconstruction loss with an embedding regularization term. Discrete optimization forms candidates by applying transformations, and chooses the best candidate based on a combination of reconstruction loss and perplexity, as measured by an auxiliary language model (e.g., GPT-2). + +embeddings from a Gaussian distribution to create the initial reconstruction. Then, at each step, we improve the reconstruction (shown in yellow) by alternating between continuous (blue) and discrete optimization (green). The continuous part minimizes the reconstruction loss, which measures how close the gradients of the current reconstruction are to the observed client gradients, together with an embedding regularization term. However, this is insufficient as the gradient descent can get stuck in a local optimum due to its inability to make discrete changes to the reconstruction. We address this issue by introducing a discrete step—namely, we generate a list of candidate sentences using several transformations on the sequence of tokens (e.g., moving a token) and select a candidate that minimizes the combined reconstruction loss and perplexity, which measures the likelihood of observing the text in a natural distribution. We use GPT-2 [29] as an auxiliary language model to measure the perplexity of each candidate (however, our method allows using other models). Our final reconstruction is computed by setting each embedding to its nearest neighbor from the vocabulary. + +Key component of our reconstruction attack is the use of a language model prior combined with a search that alternates continuous and discrete optimization steps. Our experimental evaluation demonstrates the effectiveness of this approach—LAMP is able to extract text from state-of-the-art transformer models on several common datasets, reconstructing up to 5 times more bigrams than prior work. Moreover, we are the first to perform text reconstruction in more complex settings such as batch sizes larger than 1, fine-tuned models, and defended models. Overall, across all settings we demonstrate that LAMP is effective in reconstructing large portions of private text. + +# Main contributions Our main contributions are: + +- LAMP, a novel attack for recovering input text from gradients, which leverages an auxiliary language model to guide the search towards natural text, and a search procedure which alternates continuous and discrete optimization. +- An implementation of LAMP and its extensive experimental evaluation, demonstrating that it can reconstruct significantly more private text than prior work. We make our code publicly available at https://github.com/eth-sri/lamp. +- The first thorough experimental evaluation of text attacks in more complex settings such as larger batch sizes, fine-tuned models and defended models. + +# 2 Related Work + +Federated learning [24, 18] has attracted substantial interest [16] due to its ability to train deep learning models in a decentralized way, such that individual user data is not shared during training. Instead, individual clients calculate local gradient updates on their private data, and share them with a centralized server, which aggregates them to update the model [24]. The underlying assumption is that user data cannot be recovered from gradient updates. Recently, several works [28, 43, 41, 42] + +demonstrated that gradients can in fact still leak information, invalidating the fundamental privacy assumption. Moreover, recent work achieved near-perfect image reconstruction from gradients [7, 40, 14]. Interestingly, prior work showed that an auxiliary model [14] or prior information [2] can significantly improve reconstruction quality. Finally, Huang et al. [12] noticed that gradient leakage attacks often make strong assumptions, namely that batch normalization statistics and ground truth labels are known. In our work, we do not assume knowledge of batch normalization statistics and as we focus on binary classification tasks, we can simply enumerate all possible labels. + +Despite substantial progress on image reconstruction, attacks in other domains remain challenging, as the techniques used for images rely extensively on domain specific knowledge. In the domain of text, in particular, where federated learning is often applied [32], only a handful of works exist [43, 3, 22]. DLG [43] was first to attempt reconstruction from gradients coming from a transformer; TAG [3] extended DLG by adding an $L_{1}$ term to the reconstruction loss; finally, unlike TAG and DLG which are optimization-based techniques, APRIL [22] recently demonstrated an exact gradient leakage technique applicable to transformer networks. However, APRIL assumes batch size of 1 and learnable positional embeddings, which makes it simple to defend against. Another attack on NLP is given in Fowl et al. [6], but they use stronger assumption that the server can send malicious updates to the clients. Furthermore, there is a concurrent work [11] on reconstructing text from transformers, but it is limited to the case when token embeddings are trained together with the network. + +Finally, there have been several works attempting to protect against gradient leakage. Works based on heuristics [34, 31] lack privacy guarantees and have been shown ineffective against stronger attacks [2], while those based on differential privacy do train models with formal guarantees [1], but typically hurt the accuracy of the trained models as they require adding noise to the gradients. We remark that we also evaluate LAMP on defended networks. + +# 3 Background + +In this section, we introduce the background necessary to understand our work. + +# 3.1 Federated Learning + +In federated learning, $C$ clients aim to jointly optimize a neural network $f$ with parameters $\theta$ on their private data. At iteration $k$ , the parameters $\theta^k$ are sent to all clients, where each client $c$ executes a gradient update $\nabla_{\theta^k} \mathcal{L}(\boldsymbol{x}_c^*, y_c^*)$ on a sample $(\boldsymbol{x}_c^*, y_c^*)$ from their dataset $(\mathcal{X}_c, \mathcal{Y}_c)$ . The updates are sent back to the server and aggregated. While in Sec. 5 we experiment with both FedSGD [24] and FedAvg [19] client updates, throughout the text we assume that clients use FedSGD updates: + +$$ +\boldsymbol {\theta} ^ {k + 1} = \boldsymbol {\theta} ^ {k} - \frac {\lambda}{C} \sum_ {c = 1} ^ {C} \nabla_ {\boldsymbol {\theta} ^ {k}} \mathcal {L} \left(\boldsymbol {x} _ {c} ^ {*}, y _ {c} ^ {*}\right). +$$ + +Gradient leakage attacks A gradient leakage attack is an attack executed by the server (or a party which compromised it) that tries to obtain the private data $(\pmb{x}_c^*, y_c^*)$ of a client using the gradient updates $\nabla_{\theta^k} \mathcal{L}(\pmb{x}_c^*, y_c^*)$ sent to the server. Gradient leakage attacks usually assume honest-but-curious servers which are not allowed to modify the federated training protocol outlined above. A common approach, adopted by Zhu et al. [43], Zhao et al. [41], Deng et al. [3] as well as our work, is to obtain the private data by solving the optimization problem: + +$$ +\operatorname * {a r g m i n} _ {\left(\boldsymbol {x} _ {c}, y _ {c}\right)} \delta \left(\nabla_ {\boldsymbol {\theta} ^ {k}} \mathcal {L} \left(\boldsymbol {x} _ {c} ^ {*}, y _ {c} ^ {*}\right), \nabla_ {\boldsymbol {\theta} ^ {k}} \mathcal {L} \left(\boldsymbol {x} _ {c}, y _ {c}\right)\right), +$$ + +where $\delta$ is some distance measure and $(\pmb{x}_c, y_c)$ denotes dummy data optimized using gradient descent to have similar gradients $\nabla_{\pmb{\theta}^k} \mathcal{L}(\pmb{x}_c, y_c)$ to true data $(\pmb{x}_c^*, y_c^*)$ . Common choices for $\delta$ are $L_2$ [43], $L_1$ [3] and cosine distances [7]. When the true label $y_c^*$ is known, the problem reduces to + +$$ +\underset {\boldsymbol {x} _ {c}} {\arg \min} \delta \left(\nabla_ {\boldsymbol {\theta} ^ {k}} \mathcal {L} \left(\boldsymbol {x} _ {c} ^ {*}, y _ {c} ^ {*}\right), \nabla_ {\boldsymbol {\theta} ^ {k}} \mathcal {L} \left(\boldsymbol {x} _ {c}, y _ {c} ^ {*}\right)\right), +$$ + +which was shown [41, 12] to be simpler to solve with gradient descent approaches. + +# 3.2 Transformer Networks + +In this paper, we focus on the problem of gradient leakage of text on transformers [35]. Given some input text, the first step is tockenize it into tokens from some fixed vocabulary of size $V$ . Each token is then converted to a 1-hot vector denoted $\pmb{t}_1,\pmb{t}_2,\dots,\pmb{t}_n\in \mathbb{R}^V$ , where $n$ is the number of tokens in the text. The tokens are then converted to embedding vectors $\pmb{x}_1,\pmb{x}_2,\dots,\pmb{x}_n\in \mathbb{R}^d$ , where $d$ is a chosen embedding size, by multiplying by a trained embedding matrix $\pmb{W}_{\mathrm{embed}}\in \mathbb{R}^{V\times d}$ [4]. The rows of $\pmb{W}_{\mathrm{embed}}$ represent the embeddings of the tokens, and we denote them as $e_1,e_2,\ldots ,e_V\in \mathbb{R}^d$ . In addition to tokens, their positions in the sequence are also encoded using the positional embedding matrix $\pmb{W}_{\mathrm{pos}}\in \mathbb{R}^{P\times d}$ , where $P$ is the longest allowed token sequence. The resulting positional embeddings are denoted $\pmb{p}_1,\pmb{p}_2,\dots,\pmb{p}_n$ . For notational simplicity, we denote $e = e_{1},e_{2},\dots,e_{V}$ , $\pmb {x} = \pmb {x}_1,\pmb {x}_2,\dots,\pmb {x}_n$ and $\pmb {p} = \pmb {p}_1,\pmb {p}_2,\dots,\pmb {p}_n$ . We use the token-wise sum of the embeddings $\pmb{x}$ and $\pmb{p}$ as an input to a sequence of self-attention layers [35]. The final classification output is given by the first output of the last self-attention layer that undergoes a final linear layer, followed by a tanh. + +# 3.3 Calculating Perplexity on Pretrained Models + +In this work, we rely on large pretrained language models, such as GPT-2 [29], to assess the quality of the text produced by the continuous part of our optimization. Such models are typically trained to calculate the probability $P(\pmb{t}_n \mid \pmb{t}_1, \pmb{t}_2, \dots, \pmb{t}_{n-1})$ of inserting a token $\pmb{t}_n$ from the vocabulary of tokens to the end of the sequence of tokens $\pmb{t}_1, \pmb{t}_2, \dots, \pmb{t}_{n-1}$ . Therefore, such models can be leveraged to calculate the likelihood of a sequence of tokens $\pmb{t}_1, \pmb{t}_2, \dots, \pmb{t}_n$ , as follows: + +$$ +P \left(\boldsymbol {t} _ {1}, \boldsymbol {t} _ {2}, \dots , \boldsymbol {t} _ {n}\right) = \prod_ {l = 0} ^ {n - 1} P \left(\boldsymbol {t} _ {l + 1} \mid \boldsymbol {t} _ {1}, \boldsymbol {t} _ {2}, \dots , \boldsymbol {t} _ {l}\right). +$$ + +One can use the likelihood, or the closely-related negative log-likelihood, as a measure of the quality of a produced sequence. However, the likelihood depends on the length of the sequence, as probability decreases with length. To this end, we use the perplexity measure [13], defined as: + +$$ +\mathcal {L} _ {\mathrm {l m}} \left(\boldsymbol {t} _ {1}, \boldsymbol {t} _ {2}, \dots , \boldsymbol {t} _ {n}\right) = - \frac {1}{n} \sum_ {l = 0} ^ {n - 1} \log P \left(\boldsymbol {t} _ {l + 1} \mid \boldsymbol {t} _ {1}, \boldsymbol {t} _ {2}, \dots , \boldsymbol {t} _ {l}\right). +$$ + +In the discrete part of our optimization, we rely on this measure to assess the quality of reconstructed sequences produced by the continuous part. + +# 4 Extracting Text with LAMP + +In this section we describe the details of our attack which alternates between continuous optimization using gradient descent, presented in Sec. 4.2, and discrete optimization using language models to guide the search towards more natural text reconstruction, presented in Sec. 4.3. + +# 4.1 Notation + +We denote the attacked neural network and its parameters with $f$ and $\theta$ , respectively. Further, we denote the client token sequence and its label as $(t^{*},y^{*})$ , and our reconstructions as $(t,y)$ . For each token $t_i^*$ in $t^*$ and $t_i$ in $t$ , we denote their embeddings with $x_{i}^{*}\in \mathbb{R}^{d}$ and $x_{i}\in \mathbb{R}^{d}$ , respectively. Moreover, for each token in our vocabulary, we denote the embedding with $e_i\in \mathbb{R}^d$ . We collect the individual embeddings $x_{i},x_{i}^{*}$ , and $e_i$ into the matrices $x\in \mathbb{R}^{d\times n}$ , $x^{*}\in \mathbb{R}^{d\times n}$ and $e\in \mathbb{R}^{d\times V}$ , where $n$ is the number of tokens in $t^*$ and $V$ is the size of the vocabulary. + +# 4.2 Continuous Optimization + +We now describe the continuous part of our attack (blue in Fig. 1). Throughout the paper, we assume knowledge of the ground truth label $y^{*}$ of the client token sequence we aim to reconstruct, meaning $y = y^{*}$ . This assumption is not a significant restriction as we mainly focus on binary classification, with batch sizes such that trying all possible combinations of labels is feasible. Moreover, prior work [9, 40] has demonstrated that labels can easily be recovered for basic network architectures, which can be adapted for transformers in future work. We initialize our reconstruction candidate by sampling embeddings from a Gaussian and pick the one with the smallest reconstruction loss. + +Reconstruction loss A key component of our attack is a loss measuring how close the reconstructed gradient is to the true gradient. Assuming an $l$ -layer network, where $\theta_{i}$ denotes the parameters of layer $i$ , an option is to use the combination of $L_{2}$ and $L_{1}$ loss proposed by Deng et al. [3], + +$$ +\mathcal {L} _ {\mathrm {t a g}} (\boldsymbol {x}) = \sum_ {i = 1} ^ {l} | | \nabla_ {\boldsymbol {\theta} _ {i}} f (\boldsymbol {x} ^ {*}, y ^ {*}) - \nabla_ {\boldsymbol {\theta} _ {i}} f (\boldsymbol {x}, y) | | _ {2} + \alpha_ {\mathrm {t a g}} | | \nabla_ {\boldsymbol {\theta} _ {i}} f (\boldsymbol {x} ^ {*}, y ^ {*}) - \nabla_ {\boldsymbol {\theta} _ {i}} f (\boldsymbol {x}, y) | | _ {1}. +$$ + +where $\alpha_{\mathrm{tag}}$ is a hyperparameter. Another option is to use the cosine reconstruction loss proposed by Geiping et al. [7] in the image domain: + +$$ +\mathcal {L} _ {\cos} (\boldsymbol {x}) = 1 - \frac {1}{l} \sum_ {i = 1} ^ {l} \frac {\nabla_ {\boldsymbol {\theta} _ {i}} f (\boldsymbol {x} ^ {*} , y ^ {*}) \cdot \nabla_ {\boldsymbol {\theta} _ {i}} f (\boldsymbol {x} , y)}{\| \nabla_ {\boldsymbol {\theta} _ {i}} f (\boldsymbol {x} ^ {*} , y ^ {*}) \| _ {2} \| \nabla_ {\boldsymbol {\theta} _ {i}} f (\boldsymbol {x} , y) \| _ {2}}. +$$ + +Naturally, LAMP can also be instantiated using any other loss. Interestingly, we find that there is no loss that is universally better, and the effectiveness is dataset dependent. Intuitively, $L_{1}$ loss is less sensitive to outliers, while cosine loss is independent of the gradient norm, so it works well for small gradients. Thus, we set the gradient loss $\mathcal{L}_{\mathrm{grad}}$ to either $\mathcal{L}_{\mathrm{tag}}$ or $\mathcal{L}_{\mathrm{cos}}$ , depending on the setting. + +**Embedding regularization** In the process of optimizing the reconstruction loss, we observe the resulting embedding vectors $\boldsymbol{x}_i$ often steadily grow in length. We believe this behavior is due to the self-attention layers in transformer networks that rely predominantly on dot product operations. As a result, the optimization process focuses on optimizing the direction of individual embeddings $\boldsymbol{x}_i$ , disregarding their length. To address this, we propose an embedding length regularization term: + +$$ +\mathcal {L} _ {\mathrm {r e g}} (\boldsymbol {x}) = \left(\frac {1}{n} \sum_ {i = 1} ^ {n} \| \boldsymbol {x} _ {i} \| _ {2} - \frac {1}{V} \sum_ {j = 1} ^ {V} \| \boldsymbol {e} _ {j} \| _ {2}\right) ^ {2}. +$$ + +The regularizer forces the mean length of the embeddings of the reconstructed sequence to be close to the mean length of the embeddings in the vocabulary. The final gradient reconstruction error optimized in LAMP is given by: + +$$ +\mathcal {L} _ {\operatorname {r e c}} (\boldsymbol {x}) = \mathcal {L} _ {\operatorname {g r a d}} (\boldsymbol {x}) + \alpha_ {\operatorname {r e g}} \mathcal {L} _ {\operatorname {r e g}} (\boldsymbol {x}), +$$ + +where $\alpha_{\mathrm{reg}}$ is a regularization weighting factor. + +**Optimization** We summarize how described components work together in the setting of continuous optimization. To reconstruct the token sequence $\pmb{t}^*$ , we first randomly initialize a sequence of dummy token embeddings $\pmb{x} = \pmb{x}_0\pmb{x}_1\ldots \pmb{x}_n$ , with $\pmb{x}_i \in \mathbb{R}^d$ . Following prior work on text reconstruction from gradients [3, 43], we apply gradient descent on $\pmb{x}$ to minimize the reconstruction loss $\mathcal{L}_{\mathrm{rec}}(\pmb{x})$ . To this end, a second-order derivative needs to be computed, as $\mathcal{L}_{\mathrm{rec}}(\pmb{x})$ depends on the network gradient at $\pmb{x}$ . Similar to prior work [3, 43], we achieve this using automatic differentiation in Pytorch [27]. + +# 4.3 Discrete Optimization + +Next, we describe the discrete part of our optimization (green in Fig. 1). While continuous optimization can often successfully recover token embeddings close to the original, they can be in the wrong order, depending on how much positional embeddings influence the output. For example, reconstructions corresponding to sentences "weather is nice" and "nice weather is." might result in a similar reconstruction loss, though the first reconstruction has a higher likelihood of being natural text. To address this issue, we perform several discrete sequence transformations, and choose the one with both a low reconstruction loss and a low perplexity under the auxiliary language model. + +Generating candidates Given the current reconstruction $\pmb{x} = \pmb{x}_1\pmb{x}_2\dots \pmb{x}_n$ , we generate candidates for the new reconstruction $\pmb{x}'$ using one of the following transformations: + +- Swap: We select two positions $i$ and $j$ in the sequence uniformly at random, and swap the tokens $\pmb{x}_i$ and $\pmb{x}_j$ at these two positions to obtain a new candidate sequence $\pmb{x}' = \pmb{x}_1\pmb{x}_2\ldots \pmb{x}_{i - 1}\pmb{x}_j\pmb{x}_{i + 1}\ldots \pmb{x}_{j - 1}\pmb{x}_i\pmb{x}_{j + 1}\ldots \pmb{x}_n$ . + +- MoveToken: Similarly, we select two positions $i$ and $j$ in the sequence uniformly at random, and move the token $\pmb{x}_i$ after the position $j$ in the sequence, thus obtaining $\pmb{x}' = \pmb{x}_1\pmb{x}_2\ldots \pmb{x}_{i - 1}\pmb{x}_{i + 1}\ldots \pmb{x}_{j - 1}\pmb{x}_j\pmb{x}_i\pmb{x}_{j + 1}\ldots \pmb{x}_n$ . +- MoveSubseq: We select three positions $i, j$ and $p$ (where $i < j$ ) uniformly at random, and move the subsequence of tokens between $i$ and $j$ after position $p$ . The new sequence is thus $\pmb{x}' = \pmb{x}_1\pmb{x}_2 \dots \pmb{x}_{i-1}\pmb{x}_{j+1} \dots \pmb{x}_p\pmb{x}_i \dots \pmb{x}_j\pmb{x}_{p+1} \dots \pmb{x}_n$ . +- MovePrefix: We select a position $i$ uniformly at random, and move the prefix of the sequence ending at position $i$ to the end of the sequence. The modified sequence then is $\pmb{x}^{\prime} = \pmb{x}_{i + 1}\dots \pmb{x}_{n}\pmb{x}_{1}\pmb{x}_{2}\dots \pmb{x}_{i}$ + +Next, we use a language model to check if generated candidates improve over the current sequence. + +Using a language model to select candidates We accept the new reconstruction $x^{\prime}$ if it improves the combination of the reconstruction loss and perplexity: + +$$ +\mathcal {L} _ {\operatorname {r e c}} \left(\boldsymbol {x} ^ {\prime}\right) + \alpha_ {\mathrm {l m}} \mathcal {L} _ {\mathrm {l m}} \left(\boldsymbol {t} ^ {\prime}\right) < \mathcal {L} _ {\operatorname {r e c}} (\boldsymbol {x}) + \alpha_ {\mathrm {l m}} \mathcal {L} _ {\mathrm {l m}} (\boldsymbol {t}) +$$ + +Here $t$ and $t'$ denote sequences of tokens obtained by mapping each embedding of $x$ and $x'$ to the nearest neighbor in the vocabulary according to the cosine distance. The term $\mathcal{L}_{\mathrm{rec}}$ is the reconstruction loss introduced in Sec. 4.2, while $\mathcal{L}_{\mathrm{lm}}$ denotes the perplexity measured by an auxiliary language model, such as GPT-2. The parameter $\alpha_{\mathrm{lm}}$ determines the trade-off between $\mathcal{L}_{\mathrm{rec}}$ and $\mathcal{L}_{\mathrm{lm}}$ : if it is too low then the attack will not utilize the language model, and if it is too high then the attack will disregard the reconstruction loss and only focus on the perplexity. Going back to our example, assume that our reconstruction equals the second sequence "nice weather is." Then, at some point, we might use the MoveToken transformation to move the word "nice" behind the word "is" which would presumably keep the reconstruction loss similar, but drastically improve perplexity. + +# 4.4 Complete Reconstruction Attack + +We present our end-to-end attack in Algorithm 1. We initialize the reconstruction $\pmb{x}$ by sampling + +from a Gaussian distribution $n_{\mathrm{init}}$ times, and choose the sample with minimal reconstruction loss as our initial reconstruction. Then, at each step we alternate between continuous and discrete optimization. We first perform $n_c$ steps of continuous optimization to minimize the reconstruction loss (Lines 4-6, see Sec. 4.2). Then, we perform $n_d$ steps of discrete optimization to minimize the combination of reconstruction loss and perplexity (Lines 10-17, see Sec. 4.3). Finally, in Line 20 we project the continuous embeddings $x$ to respective nearest tokens, according to cosine similarity. + +Algorithm 1 Extracting text with LAMP +1: $\pmb{x}^{(k)} \sim \mathcal{N}(0, I)$ , where $k = 1, \dots, n_{\mathrm{init}}$ +2: $\pmb{x} \gets \arg \min_{\pmb{x}^{(k)}} \mathcal{L}_{\mathrm{rec}}(\pmb{x}^{(k)})$ +3: for $i = 1$ to $it$ do +4: for $j = 1$ to $n_c$ do +5: $\pmb{x} \gets \pmb{x} - \lambda \nabla_{\pmb{x}} \mathcal{L}_{\mathrm{rec}}(\pmb{x})$ +6: end for +7: $\pmb{x}_{\mathrm{best}} \gets \pmb{x}$ +8: $t_{\mathrm{best}} \gets \mathrm{PROJECTTOVOCAB}(\pmb{x}_{\mathrm{best}})$ +9: $L_{\mathrm{best}} \gets \mathcal{L}_{\mathrm{rec}}(\pmb{x}_{\mathrm{best}}) + \alpha_{\mathrm{lm}} \mathcal{L}_{\mathrm{lm}}(\pmb{t}_{\mathrm{best}})$ +10: for $j = 1$ to $n_d$ do +11: $\pmb{x}' \gets \mathrm{TRANSFORM}(\pmb{x})$ +12: $t' \gets \mathrm{PROJECTTOVOCAB}(\pmb{x}')$ +13: $L' \gets \mathcal{L}_{\mathrm{rec}}(\pmb{x}') + \alpha_{\mathrm{lm}} \mathcal{L}_{\mathrm{lm}}(\pmb{t}')$ +14: if $L' < L_{\mathrm{best}}$ then +15: $\pmb{x}_{\mathrm{best}}, t_{\mathrm{best}}, L_{\mathrm{best}} \gets \pmb{x}', t', L'$ +16: end if +17: end for +18: $\pmb{x} \gets \pmb{x}_{\mathrm{best}}$ +19: end for +20: return PROJECTTOVOCAB(x) + +# 5 Experimental Evaluation + +We now discuss our experimental results, demonstrating the effectiveness of LAMP compared to prior work in a wide range of settings. We present reconstruction results on several datasets, architectures, and batch sizes, together with the additional ablation study and evaluation of different defenses and training methods. + +Datasets Prior work [3] has demonstrated that text length is a key factor for the success of reconstruction from gradients. To this end, in our experiments we consider three binary classification datasets of increasing complexity: CoLA [37] and SST-2 [33] from GLUE [36] with typical sequence + +lengths between 5 and 9 words, and 3 and 13 words, respectively, and RottenTomatoes [26] with typical sequence lengths between 14 and 27 words. The CoLA dataset contains English sentences from language books annotated with binary labels describing if the sentences are grammatically correct, while SST-2 and RottenTomatoes contain movie reviews annotated with a binary sentiment. For all experiments, we evaluate the methods on 100 random sequences from the respective training sets. We remark that attacking in binary classification setting is a more difficult task than in the masking setting considered by prior work [43], where the attacker can utilize strictly more information. + +Models Our experiments are performed on different target models based on the BERT [4] architecture. The main model we consider is $\mathrm{BERT}_{\mathrm{BASE}}$ , which has 12 layers, 768 hidden units, 3072 feed-forward filter size, and 12 attention heads. To illustrate the generality of our approach with respect to model size, we additionally consider a larger model $\mathrm{BERT}_{\mathrm{LARGE}}$ , which has 24 layers, 1024 hidden units, 4096 feed-forward filter size, and 16 attention heads as well as a smaller model $\mathrm{TinyBERT}_6$ from Jiao et al. [15] with 6 layers, 768 hidden units, feed-forward filter size of 3072 and 12 attention heads. All models were taken from Hugging Face [39]. The $\mathrm{BERT}_{\mathrm{BASE}}$ and $\mathrm{BERT}_{\mathrm{LARGE}}$ were pretrained on Wikipedia [5] and BookCorpus [44] datasets, while $\mathrm{TinyBERT}_6$ was distilled from $\mathrm{BERT}_{\mathrm{BASE}}$ . We perform our main experiments on pretrained models, as this is the most common setting for training classification models from text [25]. For the auxiliary language model we use the pretrained GPT-2 provided by Guo et al. [10], trained on the same tokenizer used to pretrain our target BERT models. + +Metrics Following TAG [3], we measure the success of our methods based on the ROUGE family of metrics [20]. In particular, we report the aggregated F-scores on ROUGE-1, ROUGE-2 and ROUGE-L, which measure the recovered unigrams, recovered bigrams and the ratio of the length of the longest matching subsequence to the length of whole sequence. When evaluating batch sizes greater than 1, we exclude the padding tokens, used to pad shorter sequences, from the reconstruction and the ROUGE metric computation. + +Experimental setup In all settings we consider, we compare our method with baselines DLG [43] and TAG [3] discussed in Sec. 2. As TAG does not have public code, we use our own implementation, and remark that the results obtained using our implementation are similar or better than those reported in Deng et al. [3]. We consider two variants of our attack, $\mathrm{LAMP_{\mathrm{cos}}}$ and $\mathrm{LAMP}_{L_2 + L_1}$ , that use the $\mathcal{L}_{\mathrm{cos}}$ and $\mathcal{L}_{\mathrm{tag}}$ gradient matching losses for the continuous optimization. For the $\mathrm{BERT}_{\mathrm{BASE}}$ and $\mathrm{TinyBERT}_6$ experiments, we run our attack with $it = 30$ , $n_c = 75$ and $n_d = 200$ , and stop the optimization early once we reach a total of 2000 continuous optimization steps. For the $\mathrm{BERT}_{\mathrm{LARGE}}$ model, whose number of parameters make the optimization harder, we use $it = 25$ and $n_c = 200$ instead, resulting in 5000 continuous optimization steps. We run DLG and TAG for 10000 optimization steps on $\mathrm{BERT}_{\mathrm{LARGE}}$ and 2500 on all other models. For the continuous optimization, we use Adam [17] with a learning rate decay factor $\gamma$ applied every 50 steps for all methods and experiments, except for $\mathrm{BERT}_{\mathrm{LARGE}}$ ones where, following Geiping et al. [8], we use AdamW [21] and linear learning rate decay schedule applied every step. We picked the hyperparameters for TAG, $\mathrm{LAMP_{\mathrm{cos}}}$ and $\mathrm{LAMP}_{L_2 + L_1}$ , separately on CoLA and RottenTomatoes using grid search on $\mathrm{BERT}_{\mathrm{BASE}}$ and applied them to all networks. As the optimal hyperparameters for RottenTomatoes exactly matched the ones on CoLA, we used the same hyperparameters on SST-2, as well. To account for the different optimizer used for $\mathrm{BERT}_{\mathrm{LARGE}}$ models, we further tuned the learning rate $\lambda$ for $\mathrm{BERT}_{\mathrm{LARGE}}$ experiments separately, keeping the other hyperparameters fixed. Additionally, for our methods we applied a two-step initialization procedure. We first initialized the embedding vectors with 500 random samples from a standard Gaussian distribution and picked the best one according to $\mathcal{L}_{\mathrm{grad}}(\boldsymbol{x})$ . We then computed 500 permutations on the best initialization and chose the best one in the same way. The effect of this procedure is investigated in App. C.3. Further details on our experimental setup are shown in App. D. + +Main experiments We evaluate the two variants of LAMP against DLG [43] and TAG [3] on BERTBASE, BERTLARGE, and TinyBERT6. Additionally, we evaluate attacks after BERTBASE has already been fine-tuned for 2 epochs on each task (following Devlin et al. [4]), as Balunović et al. [2] showed that in the vision domain it is significantly more difficult to attack already trained networks. For both baselines and our attacks, for simplicity we assume the lengths of sequences are known, as otherwise an adversary can simply run the attack for all possible lengths. In the first experiment we consider setting where batch size is equal to 1. The results are shown in Table 1. From the ROUGE-1 + +Table 1: Main results of text reconstruction from gradients with LAMP, for various datasets and architectures in the setting with batch size equal to 1. FT denotes a fine-tuned model. R-1, R-2, and R-L, denote ROUGE-1, ROUGE-2 and ROUGE-L scores respectively. + +
BERTBASEBERTBASE-FTTinyBERT6BERTLARGE
R-1R-2R-LR-1R-2R-LR-1R-2R-LR-1R-2R-L
CoLADLG59.37.746.236.22.030.437.73.033.782.710.555.8
TAG78.910.253.340.23.132.343.93.837.482.914.655.5
LAMPcos89.651.976.285.846.273.193.959.380.292.056.078.8
LAMPL2+L187.547.573.240.39.335.294.552.176.091.247.875.4
SST-2DLG65.417.754.236.02.733.942.05.439.678.418.159.0
TAG75.618.957.440.05.736.643.59.440.980.816.859.1
LAMPcos88.856.977.787.654.176.191.658.279.788.555.976.5
LAMPL2+L188.657.475.741.610.939.389.753.275.489.355.575.9
Rotten TomatoesDLG38.61.426.020.10.415.220.41.117.766.83.135.4
TAG60.33.533.626.70.918.225.81.520.273.64.436.8
LAMPcos64.716.343.163.413.842.676.028.655.873.415.745.4
LAMPL2+L151.410.234.317.21.014.774.019.446.777.616.645.8
+ +metric, we can observe that we recover more tokens than the baselines in all settings. Moreover, the main advantage of LAMP is that the order of tokens in the reconstructed sequences matches the order in target sequences much more closely, as evidenced by the large increase in ROUGE-2 ( $5 \times$ on CoLA). This observation is further backed by the ROUGE-L metric that shows we are on average able to reconstruct up to $23\%$ longer subsequences on the BERTBASE model compared to the baselines. These results confirm our intuition that guiding the search with GPT-2 allows us to reconstruct sequences that are a much closer match to the original sequences. We point out that Table 1 reaffirms the observations first made in Deng et al. [3], that DLG is consistently worse in all metrics compared to both TAG and LAMP, and that the significantly longer sequences in RottenTomatoes still pose challenges to good reconstruction. + +Our results show that smaller and fine-tuned models also leak significant amount of client information. In particular, $\mathrm{TinyBERT}_6$ is even more vulnerable than $\mathrm{BERT}_{\mathrm{BASE}}$ and $\mathrm{BERT}_{\mathrm{BASE}}$ -FT is shown to be only slightly worse in reconstruction compared to $\mathrm{BERT}_{\mathrm{BASE}}$ , which is surprising given the prior image domain results. This shows that smaller models can not resolve the privacy issue, despite previous suggestions in Deng et al. [3]. Additionally, our $\mathrm{BERT}_{\mathrm{LARGE}}$ experiments reaffirm the observation in Deng et al. [3] that the model is highly vulnerable to all attacks. + +Further, we examine the variability of our $\mathrm{LAMP}_{\mathrm{Cos}}$ method with respect to random initialization. To this end, we ran the $\mathrm{BERT}_{\mathrm{BASE}}$ experiment on CoLA with 10 random seeds, which produced R-1, R-2 and R-L of $88.2 \pm 1.02$ , $50.0 \pm 2.37$ , $75.0 \pm 1.21$ , respectively, which suggests that our results are consistent. Further, we assess the variability with respect to sentence choice in App. C.1. + +Larger batch sizes Unlike prior work, we also evaluate the different attacks on updates computed on batch sizes greater than 1 on the $\mathrm{BERT}_{\mathrm{BASE}}$ model to investigate whether we can reconstruct some sequences in this more challenging setting. The results are shown in Table 2. Similarly to the results in Table 1, we observe that we obtain better results than the baselines on all ROUGE metrics in all experiments, except on RottenTomatoes with batch size 2, where TAG obtains slightly better ROGUE-1. Our experiments show that for larger batch sizes we can also reconstruct significant portions of text (see experiments on CoLA and SST-2). To the best of our knowledge, we are the first to show this, suggesting that gradient leakage can be a realistic security threat in practice. Comparing the results for $\mathrm{LAMP}_{L_2 + L_1}$ and $\mathrm{LAMP}_{\mathrm{Cos}}$ , we observe that $\mathcal{L}_{\mathrm{cos}}$ is better than $\mathcal{L}_{\mathrm{tag}}$ in almost all metrics on batch size 1, across models, but the trend reverses as batch size is increased. + +Sample reconstructions We show sample sequence reconstructions from both LAMP and the TAG baseline on CoLA with $B = 1$ in Table 3, marking the correctly reconstructed bigrams with green and correct unigrams with yellow. We can observe that our reconstruction is more coherent, and that it qualitatively outperforms the baseline. In App. B, we show the convergence rate of our method compared to the baselines on an example sequence, suggesting that LAMP can often converges faster. + +Table 2: Text reconstruction from gradients for different batch sizes $B$ on the $\mathrm{BERT}_{\mathrm{BASE}}$ model. R-1, R-2, and R-L, denote ROUGE-1, ROUGE-2 and ROUGE-L scores respectively. + +
B=1B=2B=4
R-1R-2R-LR-1R-2R-LR-1R-2R-L
CoLADLG59.37.746.249.75.741.037.61.734.0
TAG78.910.253.368.87.649.056.26.744.0
LAMPcos89.651.976.274.429.561.955.214.548.0
LAMPL2+L187.547.573.278.031.463.766.221.855.2
SST-2DLG65.417.754.257.711.748.243.16.839.4
TAG75.618.957.471.816.154.461.012.348.4
LAMPcos88.856.977.772.237.063.657.923.452.3
LAMPL2+L188.657.475.782.545.870.869.532.559.9
Rotten TomatoesDLG38.61.426.029.21.123.021.20.518.6
TAG60.33.533.647.42.729.532.31.423.5
LAMPcos64.716.343.137.45.629.025.71.822.1
LAMPL2+L151.410.234.346.37.632.735.14.227.2
+ +Table 3: The result of text reconstruction on several examples from the dataset (for BERTBASE with $B = 1$ ). We show only TAG (better baseline) and LAMPcos as it is superior in these cases. + +
Sequence
CoLAReferencemary has never kissed a man who is taller than john.
TAGman seem taller than mary . . kissed has john mph never
LAMPcosmary has never kissed a man who is taller than john.
SST-2Referencei also believe that resident evil is not it.
TAGresident . or. is pack down believe i evil
LAMPcosi also believe that resident resident evil not it.
Rotten TomatoesReferencea well - made and often lovely depiction of the mysteries of friendship.
TAG- the friendship taken and lovely a made often depiction of well mysteries .
LAMPcosa well often made - and lovely depiction mysteries of mysteries of friendship .
+ +Ablation studies In the next experiment, we perform ablation studies to examine the influence of each proposed component of our method. We compare the following variants of LAMP: (i) with cosine loss, (ii) with $L_{1} + L_{2}$ loss, (iii) with $L_{2}$ loss, (iv) without the language model $(\alpha_{\mathrm{lm}} = 0)$ , (v) without embedding regularization $(\alpha_{\mathrm{reg}} = 0)$ , (vi) without alternating of the discrete and continuous optimization steps—executing $it \cdot n_c$ continuous optimization steps first, followed by $it$ discrete optimizations with $n_d$ steps each, (vii) without discrete transformations $(n_d = 0)$ . For this experiment, we use the CoLA dataset and BERTBASE with $B = 1$ . We show the results in Table 4. We observe that LAMP achieves good results with both losses, though cosine is generally better for batch size 1. More importantly, dropping any of the proposed features makes ROUGE-1 and ROUGE-2 significantly worse. We note the most significant drop in ROUGE-2 reconstruction quality happens when using transformations without using the language model $(\mathrm{LAMP}_{\alpha_{\mathrm{lm}}} = 0)$ , which performs even worse than doing no transformations $(\mathrm{LAMP}_{\mathrm{NoDiscrete}})$ at all. This suggests that the use of the language model is crucial to obtaining good results. Further, we observe that our proposed scheme for alternating the continuous and discrete optimization steps is important, as doing the discrete optimization at the end $(\mathrm{LAMP}_{\mathrm{DiscreteAtEnd}})$ for the same number of steps results in reconstructions only marginally better (in ROUGE-2) compared to the reconstructions obtained without any discrete optimization $(\mathrm{LAMP}_{\mathrm{NoDiscrete}})$ . The experiments also confirm usefulness of other features such as embedding regularization. + +Attacking defended networks So far, all experiments assumed that clients have not defended against data leakage. Following work on vision attacks [43, 38], we now consider the defense of adding Gaussian noise to gradients (with additional clipping this would correspond to DP-SGD [1]). Note that, as usual, there is a trade-off between privacy and accuracy: adding more noise will lead + +Table 4: An ablation study with the $\mathrm{BERT}_{\mathrm{BASE}}$ ( $B = 1$ ) model. We restate the results for $\mathrm{LAMP}_{\mathrm{Cos}}$ and $\mathrm{LAMP}_{L_2 + L_1}$ from Table 1 and introduce four ablations, done on the better of the two variants of $\mathrm{LAMP}$ , in these cases $\mathrm{LAMP}_{\mathrm{Cos}}$ . + +
CoLASST-2Rotten Tomatoes
R-1R-2R-LR-1R-2R-LR-1R-2R-L
LAMPcos89.651.976.288.856.977.764.716.343.1
LAMPL2+L187.547.573.288.657.475.751.410.234.3
LAMPL269.430.158.872.444.165.431.95.525.7
LAMPαlm=086.726.666.982.637.068.464.09.940.3
LAMPαreg=084.538.069.183.344.771.957.811.138.3
LAMPDiscreteAtEnd87.428.666.985.442.471.065.011.442.3
LAMPNoDiscrete86.629.667.484.140.070.061.510.240.8
+ +Table 5: Evaluation on gradients defended with Gaussian noise, with BERTBASE ( $B = 1$ ) on the CoLA dataset. + +
σ = 0.001 +MCC= 0.551σ = 0.002 +MCC= 0.526σ = 0.005 +MCC= 0.464σ = 0.01 +MCC= 0.364
R-1R-2R-LR-1R-2R-LR-1R-2R-LR-1R-2R-L
DLG60.07.246.361.37.547.058.88.046.456.46.344.8
TAG70.76.050.867.18.449.964.16.547.659.66.546.2
LAMPcos81.242.769.470.629.560.943.39.4539.727.72.027.6
LAMPL2+L179.232.864.174.331.061.973.529.760.969.629.460.6
+ +to better privacy, but make accuracy worse. We measure the performance of the fine-tuned models on CoLA using the MCC metric [23] for which higher values are better. The fine-tuning was done for 2 epochs with different Gaussian noise levels $\sigma$ , and we obtained the MCC scores depicted in Table 5. We did not explore noises $>0.01$ due to the significant drop in MCC from 0.557 for the undefended model to 0.364. The results of our experiments on these defended networks are presented in Table 5. While all methods' reconstruction metrics degrade, as expected, we see that most text is still recoverable for the chosen noise levels. Moreover, our method still outperforms the baselines, and thus shows the importance of evaluating defenses with strong reconstruction attacks. In App. C.2 we show that LAMP is also useful against a defense which masks some percentage of gradients. + +Attacking FedAvg So far, we have only considered attacking the FedSGD algorithm. In this experiment, we apply our attack on the commonly used FedAvg [19] algorithm. As NLP models are often fine-tuned using small learning rates (2e-5 to 5e-5 in the original BERT paper), we find that FedAvg reconstruction performance is close to FedSGD performance with batch size multiplied by the number of FedAvg steps. We experimented with attacking FedAvg with 4 steps using $B = 1$ per step, $lr = 5\mathrm{e - }5$ on CoLA and $\mathrm{BERT}_{\mathrm{BASE}}$ with $\mathrm{LAMP}_{L_2 + L_1}$ . We obtained R-1, R-2 and R-L of 66.5, 21.0, 55.1, respectively, comparable to the reported results on FedSGD with $B = 4$ . + +# 6 Conclusion + +In this paper, we presented LAMP, a new method for reconstructing private text data from gradients by leveraging language model priors and alternating discrete and continuous optimization. Our extensive experimental evaluation showed that LAMP consistently outperforms prior work on datasets of varying complexity and models of different sizes. Further, we established that LAMP is able to reconstruct private data in a number of challenging settings, including bigger batch sizes, noise-defended gradients, and fine-tuned models. Our work highlights that private text data is not sufficiently protected by federated learning algorithms and that more work is needed to alleviate this issue. + +# References + +[1] Martin Abadi, Andy Chu, Ian Goodfellow, H. Brendan McMahan, Ilya Mironov, Kunal Talwar, and Li Zhang. Deep learning with differential privacy. Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security (ACM CCS), pp. 308-318, 2016, 2016. doi: 10.1145/2976749.2978318. +[2] Mislav Balunović, Dimitar I Dimitrov, Robin Staab, and Martin Vechev. Bayesian framework for gradient leakage. arXiv preprint arXiv:2111.04706, 2021. +[3] Jieren Deng, Yijue Wang, Ji Li, Chenghong Wang, Chao Shang, Hang Liu, Sanguthevar Rajasekaran, and Caiwen Ding. TAG: Gradient attack on transformer-based language models. In Findings of the Association for Computational Linguistics: EMNLP 2021, pages 3600-3610, Punta Cana, Dominican Republic, November 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021-findings-emnlp.305. +[4] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018. +[5] Wikipedia Foundation. Wikipedia downloads. URL https://dumps.wikipedia.org. +[6] Liam Fowl, Jonas Geiping, Steven Reich, Yuxin Wen, Wojtek Czaja, Micah Goldblum, and Tom Goldstein. Decepticons: Corrupted transformers breach privacy in federated learning for language models. arXiv preprint arXiv:2201.12675, 2022. +[7] Jonas Geiping, Hartmut Bauermeister, Hannah Droge, and Michael Moeller. Inverting gradients - how easy is it to break privacy in federated learning? In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 16937-16947. Curran Associates, Inc., 2020. +[8] Jonas Geiping, Liam Fowl, and Yuxin Wen. Breaching - a framework for attacks against privacy in federated learning. 2022. URL https://github.com/JonasGeiping/breaching. +[9] Jiahui Geng, Yongli Mou, Feifei Li, Qing Li, Oya Bayan, Stefan Decker, and Chunming Rong. Towards general deep leakage in federated learning. arXiv preprint arXiv:2110.09074, 2021. +[10] Chuan Guo, Alexandre Sablayrolles, Hervé Jégou, and Douwe Kiela. Gradient-based adversarial attacks against text transformers. arXiv preprint arXiv:2104.13733, 2021. +[11] Samyak Gupta, Yangsibo Huang, Zexuan Zhong, Tianyu Gao, Kai Li, and Danqi Chen. Recovering private text in federated learning of language models. arXiv preprint arXiv:2205.08514, 2022. +[12] Yangsibo Huang, Samyak Gupta, Zhao Song, Kai Li, and Sanjeev Arora. Evaluating gradient inversion attacks and defenses in federated learning. Advances in Neural Information Processing Systems, 34, 2021. +[13] Fred Jelinek, Robert L Mercer, Lalit R Bahl, and James K Baker. Perplexity—a measure of the difficulty of speech recognition tasks. The Journal of the Acoustical Society of America, 62(S1): S63-S63, 1977. +[14] Jiwnoo Jeon, Kangwook Lee, Sewoong Oh, Jungseul Ok, et al. Gradient inversion with generative image prior. Advances in Neural Information Processing Systems, 34, 2021. +[15] Xiaoqi Jiao, Yichun Yin, Lifeng Shang, Xin Jiang, Xiao Chen, Linlin Li, Fang Wang, and Qun Liu. Tinybert: Distilling bert for natural language understanding. arXiv preprint arXiv:1909.10351, 2019. +[16] Peter Kairouz, H Brendan McMahan, Brendan Avent, Aurélien Bellet, Mehdi Bennis, Arjun Nitin Bhagoji, Keith Bonawitz, Zachary Charles, Graham Cormode, Rachel Cummings, et al. Advances and open problems in federated learning. arXiv preprint arXiv:1912.04977, 2019. + +[17] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. +[18] Jakub Konečný, H. Brendan McMahan, Daniel Ramage, and Peter Richtárik. Federated optimization: Distributed machine learning for on-device intelligence. arXiv preprint arXiv:1610.02527, 2016. +[19] Jakub Konečný, H Brendan McMahan, Felix X Yu, Peter Richtárik, Ananda Theertha Suresh, and Dave Bacon. Federated learning: Strategies for improving communication efficiency. arXiv preprint arXiv:1610.05492, 2016. +[20] Chin-Yew Lin. Rouge: A package for automatic evaluation of summaries. In Text summarization branches out, pages 74-81, 2004. +[21] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id=Bkg6RiCqY7. +[22] Jiahao Lu, Xi Sheryl Zhang, Tianli Zhao, Xiangyu He, and Jian Cheng. April: Finding the achilles' heel on privacy for vision transformers. arXiv preprint arXiv:2112.14087, 2021. +[23] Brian W Matthews. Comparison of the predicted and observed secondary structure of t4 phage lysozyme. Biochimica et Biophysica Acta (BBA)-Protein Structure, 405(2):442-451, 1975. +[24] Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Agüera y Arcas. Communication-efficient learning of deep networks from decentralized data. In AISTATS, 2017. +[25] Shervin Minaee, Nal Kalchbrenner, Erik Cambria, Narjes Nikzad, Meysam Chenaghlu, and Jianfeng Gao. Deep learning-based text classification: A comprehensive review. ACM Computing Surveys (CSUR), 54(3):1-40, 2021. +[26] Bo Pang and Lillian Lee. Seeing stars: Exploiting class relationships for sentiment categorization with respect to rating scales. In Proceedings of the ACL, 2005. +[27] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high-performance deep learning library. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems 32, pages 8024-8035. Curran Associates, Inc., 2019. URL http://papers.neurips.cc/paper/9015-pytorch-an-imperative-style-high-performance-deep-learning-library.pdf. +[28] Le Trieu Phong, Yoshinori Aono, Takuya Hayashi, Lihua Wang, and Shiho Moriai. Privacy-preserving deep learning: Revisited and enhanced. In ATIS, volume 719 of Communications in Computer and Information Science, pages 100-110. Springer, 2017. +[29] Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019. +[30] Swaroop Ramaswamy, Rajiv Mathews, Kanishka Rao, and Françoise Beaufays. Federated learning for emoji prediction in a mobile keyboard. CoRR, abs/1906.04329, 2019. +[31] Daniel Scheliga, Patrick Mäder, and Marco Seeland. Precode - a generic model extension to prevent deep gradient leakage, 2021. +[32] Virat Shejwalkar, Amir Houmansadr, Peter Kairouz, and Daniel Ramage. Back to the drawing board: A critical evaluation of poisoning attacks on federated learning. arXiv preprint arXiv:2108.10241, 2021. +[33] Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew Y Ng, and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 conference on empirical methods in natural language processing, pages 1631-1642, 2013. + +[34] Jingwei Sun, Ang Li, Binghui Wang, Huanrui Yang, Hai Li, and Yiran Chen. Soteria: Provable defense against privacy leakage in federated learning from representation perspective. In CVPR, pages 9311-9319. Computer Vision Foundation / IEEE, 2021. +[35] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pages 5998-6008, 2017. +[36] Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R Bowman. Glue: A multi-task benchmark and analysis platform for natural language understanding. arXiv preprint arXiv:1804.07461, 2018. +[37] Alex Warstadt, Amanpreet Singh, and Samuel R Bowman. Neural network acceptability judgments. Transactions of the Association for Computational Linguistics, 7:625-641, 2019. +[38] Wenqi Wei, Ling Liu, Margaret Loper, Ka-Ho Chow, Mehmet Emre Gursoy, Stacey Truex, and Yanzhao Wu. A framework for evaluating gradient leakage attacks in federated learning. arXiv preprint arXiv:2004.10397, 2020. +[39] Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierrick Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander M. Rush. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 38-45, Online, October 2020. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/2020.emnlp-demos.6. +[40] Hongxu Yin, Arun Mallya, Arash Vahdat, Jose M. Alvarez, Jan Kautz, and Pavlo Molchanov. See through gradients: Image batch recovery via grad inversion. In CVPR, 2021. +[41] Bo Zhao, Konda Reddy Mopuri, and Hakan Bilen. idlg: Improved deep leakage from gradients, 2020. +[42] Junyi Zhu and Matthew B. Blaschko. R-GAP: recursive gradient attack on privacy. In ICLR, 2021. +[43] Ligeng Zhu, Zhijian Liu, and Song Han. Deep leakage from gradients. In NeurIPS, 2019. +[44] Yukun Zhu, Ryan Kiros, Rich Zemel, Ruslan Salakhutdinov, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. Aligning books and movies: Towards story-like visual explanations by watching movies and reading books. In The IEEE International Conference on Computer Vision (ICCV), December 2015. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] We demonstrate the effectiveness of existing defenses against our attack in Sec. 5, further we outline that our work does not deal with reconstructing labels which is left for future work, as described in Sec. 4. +(c) Did you discuss any potential negative societal impacts of your work? [Yes] We provide a discussion in App. F. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [N/A] +(b) Did you include complete proofs of all theoretical results? [N/A] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] We have reported the type of resources used in the Sec. 5. We have reported the total amount of compute in App. E. + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] +(b) Did you mention the license of the assets? [No] We use standard datasets and cite the authors instead. +(c) Did you include any new assets either in the supplemental material or as a URL? [No] +(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] We use standard datasets. We refer the reader to the original authors of the dataset for this discussion. + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/lampextractingtextfromgradientswithlanguagemodelpriors/images.zip b/lampextractingtextfromgradientswithlanguagemodelpriors/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..2ca47c400404543838c50631a2e5e828f2b42358 --- /dev/null +++ b/lampextractingtextfromgradientswithlanguagemodelpriors/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:87e4a6207320e3aea0e5374e921d27c7bd0538abcf7af01e8763eb7b3a89c380 +size 408109 diff --git a/lampextractingtextfromgradientswithlanguagemodelpriors/layout.json b/lampextractingtextfromgradientswithlanguagemodelpriors/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..fbd33fd6041672e3150194256536fba663133e34 --- /dev/null +++ b/lampextractingtextfromgradientswithlanguagemodelpriors/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:11150b152aa23100e46b27c94620fa454a68888a404ce79a5c77a968d3512b42 +size 501235 diff --git a/lapolatentvariableadvantageweightedpolicyoptimizationforofflinereinforcementlearning/c03d8e73-75fd-43c8-a4f0-021d0892a546_content_list.json b/lapolatentvariableadvantageweightedpolicyoptimizationforofflinereinforcementlearning/c03d8e73-75fd-43c8-a4f0-021d0892a546_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..5139fecf5cd6b138fbe0f2c81c3c787037966037 --- /dev/null +++ b/lapolatentvariableadvantageweightedpolicyoptimizationforofflinereinforcementlearning/c03d8e73-75fd-43c8-a4f0-021d0892a546_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:030a2961601449a5c05ba1a09cd688b3f74b7aaaa18a0f9cdaf26e94ea7a2b58 +size 75281 diff --git a/lapolatentvariableadvantageweightedpolicyoptimizationforofflinereinforcementlearning/c03d8e73-75fd-43c8-a4f0-021d0892a546_model.json b/lapolatentvariableadvantageweightedpolicyoptimizationforofflinereinforcementlearning/c03d8e73-75fd-43c8-a4f0-021d0892a546_model.json new file mode 100644 index 0000000000000000000000000000000000000000..391674a620d1978c59c1cbd5db897ffbe99caf2f --- /dev/null +++ b/lapolatentvariableadvantageweightedpolicyoptimizationforofflinereinforcementlearning/c03d8e73-75fd-43c8-a4f0-021d0892a546_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fe0f4a1705c2f5f3d08c00bcf932c6c1e4cec07bbdf348c953bab9138eb1abee +size 94701 diff --git a/lapolatentvariableadvantageweightedpolicyoptimizationforofflinereinforcementlearning/c03d8e73-75fd-43c8-a4f0-021d0892a546_origin.pdf b/lapolatentvariableadvantageweightedpolicyoptimizationforofflinereinforcementlearning/c03d8e73-75fd-43c8-a4f0-021d0892a546_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..9b627f002945088b214bdae64f84e310eff06790 --- /dev/null +++ b/lapolatentvariableadvantageweightedpolicyoptimizationforofflinereinforcementlearning/c03d8e73-75fd-43c8-a4f0-021d0892a546_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fc795f7bfa63d83134a154c192c8647346183925fe22f9f89f85cc69443f1b26 +size 2078377 diff --git a/lapolatentvariableadvantageweightedpolicyoptimizationforofflinereinforcementlearning/full.md b/lapolatentvariableadvantageweightedpolicyoptimizationforofflinereinforcementlearning/full.md new file mode 100644 index 0000000000000000000000000000000000000000..1aa38806647bdbdc5d5027ae4ccdc1f425397bbb --- /dev/null +++ b/lapolatentvariableadvantageweightedpolicyoptimizationforofflinereinforcementlearning/full.md @@ -0,0 +1,299 @@ +# LAPO: Latent-Variable Advantage-Weighted Policy Optimization for Offline Reinforcement Learning + +Xi Chen $^{1}$ , Ali Ghadirzadeh $^{2}$ , Tianhe Yu $^{2}$ , Jianhao Wang $^{1}$ , Yuan Gao $^{3}$ , Wenzhe Li $^{1}$ , Bin Liang $^{1}$ , Chelsea Finn $^{2}$ , Chongjie Zhang $^{1}$ + +$^{1}$ Tsinghua University, China, $^{2}$ Stanford University, USA + +3Shenzhen Institute of Artificial Intelligence and Robotics for Society, China + +# Abstract + +Offline reinforcement learning methods hold the promise of learning policies from pre-collected datasets without the need to query the environment for new samples. This setting is particularly well-suited for continuous control robotic applications for which online data collection based on trial-and-error is costly and potentially unsafe. In practice, offline datasets are often heterogeneous, i.e., collected in a variety of scenarios, such as data from several human demonstrators or from policies that act with different purposes. Unfortunately, such datasets often contain action distributions with multiple modes and, in some cases, lack a sufficient number of high-reward trajectories, which render offline policy training inefficient. To address this challenge, we propose to leverage latent-variable generative model to represent high-advantage state-action pairs leading to better adherence to data distributions that contributes to solving the task, while maximizing reward via a policy over the latent variable. As we empirically show on a range of simulated locomotion, navigation, and manipulation tasks, our method referred to as latent-variable advantage-weighted policy optimization (LAPO), improves the average performance of the next best-performing offline reinforcement learning methods by $49\%$ on heterogeneous datasets, and by $8\%$ on datasets with narrow and biased distributions. + +# 1 Introduction + +Offline reinforcement learning (RL), also known as batch RL [26], addresses the problem of learning an effective policy from a static fixed-sized dataset without interacting with the environment to collect new data. This formulation is especially important for robotics, as it avoids costly and unsafe trial-and-error and provides an alternative way of leveraging a pre-collected dataset. However, in practical settings, such offline datasets are often heterogeneous and are collected using different policies, leading to a data distribution with multiple modes. These data-collection policies may aim to accomplish tasks that are not necessarily aligned with the target task or may accomplish the same task but provide conflicting solutions. In contrast to the prior works that have focused on the distributional shift problem [24, 9, 25], in this paper, we address the problem of learning from heterogeneous data. + +The main challenges in learning from heterogeneous settings are the existence of conflicting actions in the dataset, and the lack of sufficient high-return trajectories as the dataset is constructed by re-labeling state-action pairs from some different tasks. Learning from heterogeneous datasets with conflicting actions is particularly challenging for implicit policy constraint methods that formulate a supervised learning objective function based on the forward Kullback-Leibler (KL)-divergence between the parametric policy being learned and the closed-form optimal policy found through advantage-weighted behavior cloning [39, 41, 44]. Figure 1 illustrates an example of offline heterogeneous settings in which state-conditional distributions learned directly over the action space + +![](images/02f4364ba52d48b5799a82c0d30a55938eaa40ab1b2b3a713e80adf54f12e065.jpg) +- Task-irrelevant actions +- Task-relevant actions +Prior distribution +Task-irrelevant latent actions +Figure 1: An example scenario of learning from data with heterogeneous action distributions. (left) The dataset includes data from three different tasks, pushing, grasping, and opening boxes. (right) The learned task is to relocate an object to a goal position. (middle up) Learning policies directly in the action space can result in sampling from out-of-distribution actions which subsequently can fail the learning task. (middle bottom) LAPO constructs a state-conditional latent space and learns a latent policy to only select in distribution high-return actions. + +![](images/9ae48ae5cdb1c08bf72fbc6170314636be305528d5947450e980b589d093fae1.jpg) +Posterior distribution +Task-relevant latent actions +Target Task: Object relocation + +using the forward KL-divergence objective may assign high probability to out-of-distribution (OOD) actions which results in sub-optimal policies. Replacing the forward-KL-divergence with a reverse KL-divergence can avoid this issue in theory, as it forces the policy to only learn a single mode of the distribution. But in practice, it requires querying the behavior policy which is unknown, and using an erroneous approximation of the behavior policy can negatively affect the performance ([39]). A similar problem has been reported when explicitly constraining the policy on multi-modal distributions using maximum mean discrepancy (MMD) distances [57]. This problem however may seem to be solved by using more expressive policies such as variational auto-encoders (VAEs) or Gaussian mixture models (GMMs). However, in practice this does not help in heterogeneous settings with a low density of high-return trajectories. In such settings, adhering to the data distribution using policy constraint methods can result in sub-optimal performances. + +We illustrate this problem with a toy navigation task in which an agent navigates to a goal position while avoiding an obstacle. In this example, the demonstrated expert actions have two prominent modes at the initial state corresponding to moving to either the right or left side of the obstacle. We assume moving to the right leads to higher returns, but we have a lower density of such actions in the dataset. In Figure 2, we show the action distribution learned by different offline RL algorithms, and in Table 1, we present their averaged performance. Figure 2.a illustrates the histogram of actions sampled from a trained policy with AWAC [39], a policy constraint method. The method fails in this setting since the learned action distribution includes OOD actions which result in a collision with the obstacle. Learning a GMM policy with AWAC can avoid the OOD action problem but still assigns a high probability distribution over low-return actions (Figure 2.b). Other offline RL methods, including BCQ [9] and PLAS [57], which learn a VAE policy, also fail to represent the high-return actions in this setting. PLAS can only model the low-return but high-density samples in the dataset (Figure 2.c). + +Figure 1 also illustrates a potential solution to the problem of learning from heterogeneous datasets. The intuition is to construct a state-conditioned latent space that represents high-return actions. In this case, we can learn simple state-conditional distributions such as Gaussian distributions over the latent space which, as shown in Figure 2.d, can capture task-relevant and high-reward actions without including out-of-distribution samples. Based on this intuition, we propose to learn a latent-space policy by alternating between training the policy and maximizing the advantage-weighted log-likelihood of data. This biases the RL policy to choose actions supported by the training data while effectively solving the target task. + +The main contributions of this work is the introduction of a new method, which we refer to it as latent-variable advantage-weighted policy optimization (LAPO), that can efficiently solve heterogeneous offline RL tasks. LAPO learns an advantage function and a state-conditional latent space in which high-advantage action samples are generated by sampling from a prior distribution over the latent space. Furthermore, following a prior work, [57], we also train a latent policy that obtains state-conditioned latent values which result in higher reward outcomes compared to latent samples directly + +![](images/314e14c3c769b82ace5c3e60a57f94fb0a09334bd73e1a4a71c90bb3ea67dd86.jpg) +(a) + +![](images/9d5a8e9c4375300b9206eb66120fc34a9e58579210cae8e275e77b304fd86487.jpg) +(b) +Figure 2: The histogram of actions for the toy navigation task at the initial state in the offline dataset (in blue), and the histogram of actions sampled from (a) the AWAC Gaussian policy (in red), (b) the AWAC GMM policy (in red), (c) the PLAS generative model (in yellow) and the PLAS latent policy (in pink), and (d) the LAPO generative model (in green), and the LAPO latent policy (in pink). + +![](images/02a0301659a20e434ca23ac77bf46fc7af3c471f351333ec4b63cec7102a2598.jpg) +(c) + +![](images/ff7282f134ce59b42e445923760e0277232717a8d2f13d32857d3eeaf4e6b6af.jpg) +(d) + +Table 1: The performance of policies in the toy navigation task learned by AWAC, PLAS and LAPO. The return is averaged by 1,000 samples. The agent receives a reward of $+1$ to move left, $a \in [-1.5, -0.5]$ , $+10$ to move right, $a \in [0.5, 1.5]$ , and 0 otherwise. + +
AWACPLASLAPO
GaussianGMMVAEpolicyVAElatent_policy
Average return2.434.391.031.004.2410.00
+ +drawn from a prior distribution. We compare LAPO to vanilla behavior cloning, BCQ [9], PLAS [57], AWAC [39], IQL [23], and CQL [25] on a variety of simulated locomotion, navigation, and manipulation tasks, provided heterogeneous offline datasets and also biased datasets with narrow data distribution in standard offline RL benchmarks. LAPO is the only method that yields good performance across all of these tasks and on average improves by $49\%$ over the next best method for heterogeneous datasets, and by $8\%$ on other offline RL tasks with narrow data distributions. + +# 2 Preliminaries + +The goal of reinforcement learning is to obtain a policy that maximizes a notion of accumulated reward for a task as a Markov decision process (MDP). In offline RL settings, we assume that we are given a dataset of tuples $\mathcal{D} = \{(s_t,a_t,r_t,s_{t + 1})\}$ , where, $s_t\in S$ and $a_{t}\in \mathcal{A}$ denote the state and action at the time step $t$ , $r_t = r(s_t,a_t)$ is the reward given by a bounded reward function, and $s_{t + 1}$ is sampled from a fixed transition probability distribution $p(s_{t + 1}|s_t,a_t)$ . Note that actions can come from a mixture of policies which is referred to as the behavior policy. The policies may try to accomplish different tasks and hence generate trajectories unrelated to the target task. + +Given an initial state distribution $\mu_0(s)$ and a discount factor $\gamma \in (0,1)$ , the RL agent optimizes a policy $\pi(a|s)$ to maximize the expected cumulative reward + +$$ +J (\pi) = \mathbb {E} _ {s _ {0} \sim \mu_ {0}, s _ {t + 1} \sim p (\cdot | s _ {t}, \pi (s _ {t}))} \left[ \sum_ {t = 0} ^ {\infty} \gamma^ {t} r (s _ {t}, \pi (s _ {t})) \right]. \tag {1} +$$ + +The state action value function (Q function), of the policy is defined as $Q^{\pi}(s,a) = \mathbb{E}_{\pi}[\sum_{t=0}^{\infty}\gamma^{t}r_{t}|s_{0}=s,a_{0}=a]$ , which can be approximated with the Bellman equation: + +$$ +\phi^ {*} = \underset {\phi} {\operatorname {a r g m i n}} \mathbb {E} _ {(s _ {t}, a _ {t}, r _ {t}, s _ {t + 1}) \sim \mathcal {D}} \left[ r _ {t} + \gamma V (s _ {t + 1}) - Q _ {\phi} (s _ {t}, a _ {t}) ^ {2} \right], \tag {2} +$$ + +where, $\phi$ denotes the parameters of the Q-function, $V$ denotes the value function $V(s) = \mathbb{E}_{\pi (a|s)}[Q_{\phi '}(s,a)]$ and can be approximated by sampling actions from the policy distribution and averaging the corresponding Q value. $\phi^{\prime}$ denotes the parameters of the Q-function at the previous iteration. The advantage of a pair of state and action is then defined as $A(s,a) = Q_{\phi}(s,a) - V(s)$ . + +# 3 Implicit Policy Constraints with KL-divergence + +A central challenge for offline RL methods is to limit the state-conditional action distribution of the learned policy to the empirical conditional action distribution of the dataset. It is very likely for off-policy algorithms to have overly optimistic values, as they tend to query the Q-function for action + +inputs outside the training distribution. Policy constraints methods [24, 51] deal with this problem by keeping the learned policy close to the behavior policy using the following constrained policy optimization formulation: + +$$ +\underset {\pi} {\operatorname {a r g m a x}} \mathbb {E} _ {s \sim \mathcal {D}} \mathbb {E} _ {\pi (a | s)} [ A (s, a) ], \text {s . t .} \mathbb {E} _ {s \sim \mathcal {D}} [ D (\pi_ {\theta} (a | s), \pi_ {\beta} (a | s)) ] < \epsilon \tag {3} +$$ + +where, $\pi_{\beta}(a|s)$ denotes the unknown empirical conditional action distribution of the dataset, and $D$ denotes a distance measure such as KL-divergence [39, 44] or maximum mean discrepancy (MMD) [24], and $\epsilon$ is a threshold parameter. In case, we use the KL-divergence as the divergence in Equation 3, the optimal $\pi^{*}$ can be expressed as + +$$ +\pi^ {*} (a | s) \propto \pi_ {\beta} (a | s) \exp (A (s, a) / \lambda), \tag {4} +$$ + +where, $\lambda$ is a temperature parameter that depends on the $\epsilon$ . + +Prior work [39, 44, 41] suggested to incrementally solve Equation 4 by representing the optimal policy $\pi^{*}(a|s)$ as a non-parametric policy, and then project it onto the parametric policy $\pi_{\theta}(a|s)$ via supervised regression: + +$$ +\underset {\theta} {\operatorname {a r g m i n}} \mathbb {E} _ {\mathcal {D}} \left[ \mathrm {D} _ {\mathrm {K L}} \left(\pi^ {*} (a | s) \mid \mid \pi_ {\theta} (a | s)\right) \right] = \underset {\theta} {\operatorname {a r g m a x}} \mathbb {E} _ {\mathcal {D}} \left[ \mathbb {E} _ {\pi^ {*} (a | s)} \left[ \log \pi_ {\theta} (a | s) \right] \right], \tag {5} +$$ + +where, the expectation is estimated by sampling from the dataset. In practice, the non-parametric policy can be implemented by weighting samples from the dataset $\mathcal{D}$ using importance weights $\omega = \exp (A(s,a) / \lambda)$ , and the projection via KL-divergence can be done via weighted supervised learning using these weights [29]. + +# 4 Latent-Variable Advantage-Weighted Policy Optimization + +In this work, we aim to address the problem of learning from heterogeneous offline datasets collected by policies with different purposes. The challenge arises from the fact that the dataset contains conflicting actions distributed with multiple modes. Besides, the dataset often does not include a sufficient number of high-return trajectories to learn the task properly, as the dataset may be constructed by re-labeling rewards for state-action pairs collected for some other tasks that not necessarily aligned with the target task. We argue that in this setting we not only need a more expressive policy class to represent the multi-modal action distributions, but also need a mechanism that can select which samples to use for the given target task. + +We present a novel method, named latent-space advantage-weighted policy training (LAPO), which learns a policy by maximizing the Q function over a latent space that is trained to approach the distribution of actions that leads to higher returns in solving the task. The overall objective of the LAPO can be defined as follows: + +$$ +\operatorname {a r g m a x} _ {\vartheta , \theta} \mathbb {E} _ {\substack {z \sim \pi_ {\vartheta} (\cdot | s) \\ a \sim p _ {\theta^ {\prime}} (\cdot | s, z) \\ s \sim \mathcal {D}}} \left[ Q _ {\phi} (s, a) \right] + \mathbb {E} _ {(s, a) \sim \mathcal {D}} \left[ \omega * \log [ p _ {\theta} (a | s) ] \right]. \tag{6} +$$ + +The objective consists of two main components: (1) an advantage-weighted log-likelihood of the actions in the dataset and, (2) a state-action value function. This objective is optimized iteratively by alternating between maximizing each component separately. The weighted log-likelihood is maximized by training a latent-variable state-conditioned generative model $p_{\theta}(a|s) = \mathbb{E}_{z \sim p(z)}[p_{\theta}(a|s,z)]$ . Here, $z$ denotes a latent variable, $p(z)$ is the prior distribution, $p_{\theta}(a|s,z)$ is a generative model (decoder), and $\theta'$ denotes the parameters of the decoder in the previous iteration. This component extends advantage-weighted regression (AWR, Equation 5) [41] using more expressive policy classes. Also, as illustrated in Figure 2c and d, weighting by advantages allows the generative model to effectively represent high-return state-action transitions. The state-action value function $Q_{\phi}(s,a)$ is updated in every iteration, and is then improved by updating the latent policy $\pi_{\vartheta}(z|s)$ . The latent policy outputs a latent variable $z$ which is then mapped to an action $a \in \mathcal{A}$ by the decoder $p_{\theta}'(a|s,z)$ with the parameters updated in the previous iteration. The latent policy is trained with a standard actor-critical RL approach to maximize the state-action value function. Next, we will describe each of these components in detail. + +Maximizing the weighted log-likelihood: LAPO incrementally learns to maximize the weighted log-likelihood by alternating between two steps: (1) estimating the importance weight of each action, + +Algorithm 1 Latent-Variable Advantage-Weighted Policy Optimization +Input: $\mathcal{D} = \{(s_t,a_t,s_{t + 1})_i\} ,i = 1,\dots ,N.$ +Initialize: $\phi ,\theta ,\psi ,\vartheta$ randomly, $\theta^{\prime} = \theta$ , and $\omega = 1.0$ +repeat Update the decoder $p_\theta$ using Equation 7. Update the Q-function $Q_{\phi}$ using Equations 2 and 8. Estimate the advantage weights for every state-action pair. Update the latent policy $\pi_{\vartheta}$ using Equation 9 Update $\theta^\prime$ according to $\theta$ +until $M$ iterations completed + +and (2) regressing the actions in the dataset with the importance weight of each action. In practice, to characterize the importance of high-return trajectories, we can use the exponential advantages as the importance weight, $\omega = \exp (A(s,a) / \lambda)$ , where $\lambda$ is a temperature parameter. Following [21], we derive a weighted variational lower bound that maximizes the weighted log-likelihood of data: + +$$ +\max _ {\theta , \psi} \mathbb {E} _ {s, a \sim \mathcal {D}} [ \omega \mathbb {E} _ {q _ {\psi} (z | s, a)} [ \log (p _ {\theta} (a | s, z)) - \beta \mathrm {D} _ {\mathrm {K L}} (q _ {\psi} (z | s, a) | | p (z)) ] ], \tag {7} +$$ + +where $q_{\psi}(z|s,a)$ is the variational posterior distribution, $p(z)$ is the prior distribution over the latent variable and typically modelled by a standard normal distribution, and $\beta$ is a hyper-parameter to balance the two loss terms [17]. + +Policy evaluation: As explained earlier, the estimated advantage of each state-action pair is used to update the decoder. These advantage estimations are incrementally found through a policy evaluation process in which the overall policy, formed by combining the latent policy and the decoder, is being evaluated. The state-conditional action distribution of the overall policy $\pi_{\vartheta,\theta'}(a|s)$ , is found by first sampling a latent value from the latent policy $z \sim \pi_{\vartheta}(z|s)$ , and then feeding the latent value to the decoder to sample the action $a \sim p_{\theta'}(a|s,z)$ . In the policy evaluation step, we update the value function by minimizing the squared temporal difference error using Equation 2. To calculate the expected value of a state, we sample actions from the overall policy, i.e., + +$$ +V (s) = \mathbb {E} _ {a \sim p _ {\theta^ {\prime}} (\cdot | s, z), z \sim \pi_ {\vartheta} (\cdot | s)} \left[ Q _ {\phi^ {\prime}} (s, a) \right]. \tag {8} +$$ + +Since the latent values $z$ will be used as the input to the decoder, an unbounded $z$ can lead to generating out-of-distribution actions. Therefore, to better ensure sampling in-distribution actions, $\pi_{\vartheta}(z|s)$ can be modeled as a truncated Gaussian [5]. For deterministic versions of the latent policy, the policy output can be limited to $[-z_{\max}, z_{\max}]$ using a tanh function. + +Policy improvement: LAPO optimizes the latent policy $\pi_{\vartheta}(z|s)$ in every iteration to directly maximize the return. It is trained based on standard RL approaches such as DDPG [30] or TD3 [8] to maximize the RL objective in Equation 1, by learning latent actions which result in high returns after being converted to the original action space using the decoder. + +The latent policy is updated by maximizing the Q-function over states sampled from the dataset, latent variables from the latent policy, and actions from the decoder $p_{\theta'}$ : + +$$ +\underset {\pi_ {\vartheta}} {\operatorname {a r g m a x}} \mathbb {E} _ {a \sim p _ {\theta^ {\prime}} (\cdot | s, z), z \sim \pi_ {\vartheta} (\cdot | s), s \sim \mathcal {D}} [ Q _ {\phi} (a, s) ]. \tag {9} +$$ + +A summary of our method is presented in Algorithm 1. We randomly initialize the parameters of the state-action Q function, the decoder, the amortized variational distribution, and the latent policy. In every training iteration, we first update the decoder and the variational distribution $q$ using Equation 7 given the latest values of the advantage weights. Then, we update the Q function using Equations 2 and 8 provided the updated action and latent policies. Then, for every state-action pair in the dataset, we compute the advantage using the updated Q function, the latent policy and the decoder, and then estimate the weights. Finally, we update the latent policy using Equation 9. + +# 5 Related Works + +Offline Reinforcement Learning: Offline RL methods generally address the problem of distribution shift between the behavior policy and the policy being learned [9, 24], which can cause issues + +due to out-of-distribution actions sampled from the learned policy and passed into the learned critic. To address this issue, prior methods constrain the learned policy to stay close to the behavior policy via explicit policy regularization [32, 18, 51, 24, 22, 13], via implicit policy constraints [44, 49, 42, 41, 39, 22, 23, 53, 35], by regularizing based on importance sampling [37, 31, 50, 52], by learning of conservative value functions [25, 46], by leveraging auxiliary behavioral cloning losses [7, 38], and through model-based training with conservative penalties [56, 20, 3, 47, 36, 28, 55]. Compared to these prior works, we opt to develop a method that uses an implicit policy constraint. However, prior implicit policy constraint methods have been largely limited to Gaussian policies, leading to OOD action samplings and sub-optimal performance on heterogeneous datasets. We overcome this challenge by introducing a new method that leverages latent variable models. As we will find in Section 6, our method also outperforms state-of-the-art prior methods in other categories, particularly when learning from heterogeneous datasets. + +Prior works [1, 19, 54] also studied the problem of learning from heterogeneous dataset in the offline RL with heterogeneous dynamics setting [1] and multi-task offline RL with data sharing scenario [19, 54] respectively. Both settings require knowledge of the agent/task identifier. Here, we study a more general problem setting including datasets with conflicting actions without assuming access to the ground-truth identifier of the source of the heterogeneity. + +RL with Generative Models: Generative models have been used by prior works for improving training performance [45, 11, 12], enabling transfer learning [4, 10], implementing hierarchical RL [2, 33, 34, 40], avoiding distributional shift in offline RL settings [9, 57], and learning dynamics models [27, 16, 43, 15]. Our proposed method resembles PLAS [57], which learns a generative model and latent policy; but, unlike this prior work, our method trains an advantage-weighted generative model by alternating between learning the generative model, the advantage function, and the latent policy. This allows LAPO to capture different high-reward solutions using a simple Gaussian distribution in the latent space. As we will find in Section 6, this distinction is crucial, as LAPO significantly outperforms PLAS on heterogeneous datasets. + +# 6 Experiments + +Our experiments aim to answer the following questions: (1) How does LAPO compare to other offline RL methods on a set of standard offline RL tasks, including learning from heterogeneous and homogeneous offline datasets? (2) How does LAPO compare to prior methods implemented with GMM policies when learning behaviors offline from heterogeneous datasets? and (3) In which setting does LAPO benefit from the latent policy training, versus only using the generative model? Can LAPO learn without constraining the latent values? + +We study the first question by evaluating LAPO and comparing it to several prior methods on offline RL benchmarks with heterogeneous datasets. We consider a range of simulated robotic tasks, including navigation, locomotion, and manipulation, each with a corresponding static dataset with a heterogeneous data distribution. We also consider datasets with narrow and biased data distributions, containing near-optimal or random trajectories. To answer the second question, we include a comparison of AWAC [39] with a GMM policy, since AWAC trains using a similar advantage-weighted objective as the actor policy in LAPO. This comparison is only performed on heterogeneous datasets, since this is where we expect to see the most improvement from a multi-modal policy. Finally, the questions in (3), we conduct two ablation studies in which we train LAPO without learning the latent policy, i.e. evaluating only LAPO's action policy, and without limiting the latent values to the range $[-z_{\max}, z_{\max}]$ . We compare this version of the method to the original LAPO on four offline RL tasks that differ in the amount of high-performing task-relevant data contained in the offline dataset. Our implementation is available at https://github.com/pcchenxi/LAPO-offlienRL. + +# 6.1 Comparisons + +We compare LAPO to 7 offline RL approaches: (1) vanilla behavioral cloning (BC), (2) the BCQ method [9], which approximates the dataset distribution with a generative model and manually selects the action with the maximum Q value among a set of generated actions, (3) the PLAS method [57], which learns a generative model via maximum likelihood and a latent-space policy to maximize the RL objective in the latent space, (4) the AWAC method [39], which performs advantage-weighted imitation learning with a forward-KL objective for the policy projection step, (5) the IQL method + +![](images/830988bf36bcfbe3fc1e1477082a1adac7a7caa0f5394aa9afbc320598ae6635.jpg) +Figure 3: D4RL environments used in our evaluations: (from left to right) Walker 2D, Hopper, Halfcheetah, Antmaze, Maze2d, and Kitchen environments. + +[23], which learns the value function using expectile regression without an explicit policy, and then extracts the policy using advantage weighted regression (AWR), (6) the CQL method [25] which learns a conservative Q-function, and (7) AWAC $_{(\mathrm{GMM})}$ which trains GMM policies using AWAC. + +In our experiments, we train each method three times using three different random seeds each for one million steps, and report the return averaged over 10 test episodes from the trained policies. We used the implementation provided by [48] for the BCQ and AWAC, the original implementation for the PLAS, IQL and CQL, and our implementation for the BC method. We report the implementation details in the Appendix E. + +# 6.2 Tasks and Datasets + +We compare LAPO to the introduced prior methods on learning from both heterogeneous and homogeneous offline datasets. We evaluate the methods on three simulated task domains, locomotion, navigation, and manipulation domains (Figure 3), with heterogeneous data distributions, and also a locomotion task with random, narrow and biased data distribution. We consider two sources of heterogeneous datasets: (1) data collected by policies accomplishing different tasks, and (2) data collected by different policies that accomplish one task but in different ways. For (1), we use the multi-task heterogeneous datasets introduced by [54], and for (2), we leverage heterogeneous datasets from the standard D4RL benchmark [6]. More details about our tasks and datasets are provided in the Appendix F. + +# 6.3 Experimental Results + +Heterogeneous datasets: Table 2 reports the results of our experiments on heterogeneous datasets, and in Figure 6 (Appendix C), we present the learning performance of LAPO with $95\%$ confidence interval on Heterogeneous tasks. Among the 12 tasks introduced in the previous section, LAPO (our method) achieves the best performance on nine tasks and the second-best performance on one task. Besides, on average, LAPO improves by $49\%$ over the next best method on the heterogeneous datasets. + +The heterogeneous locomotion tasks can be accomplished more easily by the prior methods since still $33\%$ of the data comes from the target task. However, from the prior works, AWAC and CQL are the only methods that can accomplish the tasks. LAPO performs well on all tasks and on average yields the best performance on one out of the three tasks. This shows that LAPO is capable of learning from heterogeneity introduced by multi-task datasets. + +The navigation tasks are in general more challenging especially for those with medium and large map sizes. The main challenge is to learn policies for long-horizon planning from datasets that do not contain optimal trajectories, and there are only very few states with rewards. LAPO significantly outperforms all prior works for all of the navigation tasks. Similarly, the manipulation tasks are also challenging, as they require the assembly of sub-trajectories related to completing a given task consisting of multiple sub-tasks. In addition, the agent has access to fewer training samples while having to learn to interact with complicated dynamics. LAPO outperforms previous approaches by a large margin on Kitchen-partial and Kitchen-mixed for which only a few optimal trajectories are provided by the dataset. It also performs competitively on the Kitchen-complete task and yields the second-best performance. + +we observe that GMM policy training does not perform well on heterogeneous offline RL settings. The AWAC method with GMM policies yields similar or even worse performance compared to the original AWAC. These results suggest that the VAE is more robust to model the high-reward regions in heterogeneous data. + +Table 2: The normalized performance of all methods on tasks with heterogeneous dataset. 0 represents the performance of a random policy and 100 represents the performance of an expert policy. The scores are averaged over the final 10 evaluations and 3 seeds. LAPO achieves the best performance on 9 tasks and achieves competitive performance on the rest 3 tasks. Results with $95\%$ -confidence interval are reported in Appendix C.2 + +
Task IDBCBCQPLASAWACAWAC(GMM)IQLCQLLAPO(Ours)
Walker2d-mix-forward-v1-5.650.9122.9171.8978.0928.25102.7574.17
Walker2d-mix-backward-v1-84.56-1.37-27.58-7.9571.33-46.2566.6499.22
Walker2d-mix-jump-v1-72.92-41.430.5651.0828.01-46.4137.2843.20
Maze2d-umaze-v10.9918.9180.1294.5319.4551.0022.86118.86
Maze2d-medium-v13.3412.795.1931.4046.5333.2612.25142.75
Maze2d-large-v1-1.1427.1745.8043.859.0464.307.00200.56
Antmaze-umaze-diverse-v160.0062.007.0072.000.0069.3316.7191.33
Antmaze-medium-diverse-v10.0011.338.670.330.0073.001.0085.67
Antmaze-large-diverse-v10.000.671.330.000.0048.0011.8961.67
Kitchen-complete-v04.509.0838.083.831.0866.674.6753.17
Kitchen-partial-v031.6717.5827.000.250.4232.330.5553.67
Kitchen-mixed-v030.0011.5029.920.003.9249.921.8662.42
+ +Table 3: The normalized performance of all methods on locomotion tasks with random, narrow and biased dataset. 0 represents the performance of a random policy and 100 represents the performance of an expert policy. The scores are averaged over the final 10 evaluations and 3 seeds. LAPO achieves the best performance on 4 tasks and achieves competitive performance on the rest of the tasks. Results with $95\%$ -confidence interval are reported in Appendix C.2 + +
Task IDBCBCQPLASAWACIQLCQL\(LAPO_{(Ours)}\)
Hopper-random-v22.237.806.688.017.898.3323.46
Walker2d-random-v21.114.879.170.425.41-0.231.28
Halfcheetah-random-v22.252.2526.4515.1813.1122.2030.55
Hopper-medium-v249.2356.4450.9669.5565.7571.5951.63
Walker2d-medium-v247.1173.7276.4784.0277.8982.1080.75
Halfcheetah-medium-v237.8447.2244.5448.1347.4749.7645.97
Hopper-expert-v276.1668.86107.05109.32109.36102.27106.76
Walker2d-expert-v279.22110.51109.56110.46109.93108.76112.27
Halfcheetah-expert-v285.6393.1593.7914.0194.9887.4095.93
+ +Random/Narrow datasets: Table 3 reports the results of the locomotion tasks with random, narrow and biased datasets. Our method yields the best performance for four out of nine tasks. It also achieves competitive performance on the rest of the tasks, showing that LAPO is applicable to general offline RL settings and is not limited to learning from heterogeneous datasets. However, the most significant gain is when it is applied to offline settings with heterogeneous datasets. Learning curves and results with $95\%$ -confidence interval are reported in Appendix C. + +# 6.4 Ablations + +Latent Policy Training: To study the importance of the latent policy training in achieving good performances, we conduct an ablation study on 4 different tasks by eliminating the latent policy training from LAPO. The main motivation is that, as described in Section 4, the latent variable generative model is trained to incrementally learn the action distribution that lead to higher return, hence training the latent policy on top of that may seem redundant. In this case, another option for sampling latent variables is to sample from the prior distribution, which changes Equation 8 to: + +$$ +V (s) = \mathbb {E} _ {a \sim p _ {\theta^ {\prime}} (\cdot | s, z) z \sim p (z)} [ Q _ {\phi^ {\prime}} (s, a) ], +$$ + +where, the latent $z$ is now sampled from a fixed prior. + +As shown in Fig. 4, training a latent policy does not significantly contribute to higher performance for tasks such as the Walker2D-medium and Walker2d-mix-backward which contain sufficient task- + +![](images/3592464bb164c36637ec9c5b79281adac99b7f313575231950c4a5b7bb05e20e.jpg) +Figure 4: Comparison of LAPO with and without the latent policy on Maze2D-medium, Antmaze-medium-diverse, Walker2D-medium, and Walker2D-mix-backward task. The shaded area represents $\pm 95\%$ -confidence intervals, computed using 10 evaluations and 3 random seeds. For tasks with less optimal task-relevant data like Maze2D-medium, Antmaze-medium-diverse, the learned latent policy results in high-performance gains. + +![](images/915ee80123ce43fde62671ae517d9449b21954af9c4eb68743cdad05953f284e.jpg) + +![](images/8f1f4d4347bb013debe8497f51021fb1a5de1a6802e6c261f8aba0baaa8d5d6f.jpg) + +![](images/36c11e1b77208c7c253c9efe8279a995b4c447c339a71cf6630f39f1378e6227.jpg) + +![](images/779de84c7d6a990c04bb50518d30f20094c723f9c95b89d28c88e9816fe587b9.jpg) +Figure 5: Comparison of LAPO with and without limiting the latent values. The policy performance is significantly worse when the latent values are not limited to the range $[-z_{\max}, z_{\max}]$ . + +![](images/d6166a66718bdcd661ef37f03bd84b169240ffc3d667c2bb22640b4bbc6b26ce.jpg) + +![](images/980a600aed036889bf5b5f136504047688205de077661d779d04f1021f1fc67c.jpg) + +relevant data. However, latent policy training results in large performance gains when learning from datasets which contain fewer optimal task-related data such as Maze2D and Antmaze. LAPO overcomes this challenge by explicitly optimizing the RL objective through learning the latent policy. + +Limiting the latent values: We also study the importance of limiting the latent variable $z$ to be within the range $[-z_{\max}, z_{\max}]$ . This is important to understand the limits of using the latent variable decoder as a generative model of in-distribution actions. Figure 5 illustrates the result of LAPO policy training using unbounded latent actions on four tasks. The policy training performance is significantly worse when we do not limit the latent values. This suggests that the action policy can generate in-distribution actions only when in-distribution latent values (close to samples drawn from the prior distribution $p(z)$ ) are given as the input. + +# 7 Conclusion + +In this paper, we study an offline RL setup for learning from heterogeneous datasets where trajectories are collected using policies with different purposes, leading to a multi-modal data distribution, and in some cases, do not contain sufficient high-reward trajectories. Through empirical analysis, we find that in such cases, policies constrained methods may contain out-of-distribution actions and lead to suboptimal performance for continuous control tasks, especially for heterogeneous datasets. To address this challenge, we present the latent-variable advantage-weighted policy optimization (LAPO) algorithm, which learns a latent variable model that generates high-advantage actions when sampling from a prior distribution over the latent space. In addition, we train a latent policy that obtains state-conditioned latent actions which result in higher reward outcomes compared to sampling from the prior distribution. We compare our method to 6 prior methods on a variety of simulated locomotion, navigation, and manipulation tasks provided heterogeneous offline datasets, and also on standard offline RL benchmarks with narrow and biased datasets. We find that our proposed method consistently outperforms prior methods by a large margin on tasks with heterogeneous datasets, while being competitive on other offline RL tasks with narrow data distributions. For our future work, we will extend LAPO to multi-task offline RL settings in which an agent learns multiple RL tasks provided a heterogeneous dataset of diverse behaviors. + +# Acknowledgments + +This work is supported in part by Science and Technology Innovation 2030 – “New Generation Artificial Intelligence” Major Project (No. 2018AAA0100904) and National Natural Science Foundation of China (62176135). + +# References + +[1] Anish Agarwal, Abdullah Alomar, Varkey Alumootil, Devavrat Shah, Dennis Shen, Zhi Xu, and Cindy Yang. Persim: Data-efficient offline reinforcement learning with heterogeneous agents via personalized simulators. arXiv preprint arXiv:2102.06961, 2021. +[2] Anurag Ajay, Aviral Kumar, Pulkit Agrawal, Sergey Levine, and Ofir Nachum. Opal: Offline primitive discovery for accelerating offline reinforcement learning. arXiv preprint arXiv:2010.13611, 2020. +[3] Arthur Argenson and Gabriel Dulac-Arnold. Model-based offline planning. arXiv preprint arXiv:2008.05556, 2020. +[4] Karol Arndt, Murtaza Hazara, Ali Ghadirzadeh, and Ville Kyrki. Meta reinforcement learning for sim-to-real domain adaptation. In 2020 IEEE International Conference on Robotics and Automation (ICRA), pages 2725-2731. IEEE, 2020. +[5] Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale gan training for high fidelity natural image synthesis. arXiv preprint arXiv:1809.11096, 2018. +[6] Justin Fu, Aviral Kumar, Ofir Nachum, George Tucker, and Sergey Levine. D4rl: Datasets for deep data-driven reinforcement learning. arXiv preprint arXiv:2004.07219, 2020. +[7] Scott Fujimoto and Shixiang Shane Gu. A minimalist approach to offline reinforcement learning. arXiv preprint arXiv:2106.06860, 2021. +[8] Scott Fujimoto, Herke Hoof, and David Meger. Addressing function approximation error in actor-critic methods. In International Conference on Machine Learning, pages 1587-1596. PMLR, 2018. +[9] Scott Fujimoto, David Meger, and Doina Precup. Off-policy deep reinforcement learning without exploration. In International Conference on Machine Learning, pages 2052-2062. PMLR, 2019. +[10] Ali Ghadirzadeh, Xi Chen, Petra Poklukar, Chelsea Finn, Mårten Björkman, and Danica Kragic. Bayesian meta-learning for few-shot policy adaptation across robotic platforms. arXiv preprint arXiv:2103.03697, 2021. +[11] Ali Ghadirzadeh, Atsuto Maki, Danica Kragic, and Marten Björkman. Deep predictive policy training using reinforcement learning. In 2017 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pages 2351-2358. IEEE, 2017. +[12] Ali Ghadirzadeh, Petra Poklukar, Ville Kyrki, Danica Kragic, and Mårten Björkman. Data-efficient visuomotor policy training using reinforcement learning and generative models. arXiv preprint arXiv:2007.13134, 2020. +[13] Seyed Kamyar Seyed Ghasemipour, Dale Schuurmans, and Shixiang Shane Gu. Emaq: Expected-max q-learning operator for simple yet effective offline and online rl. In International Conference on Machine Learning, pages 3682-3691. PMLR, 2021. +[14] Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. In International conference on machine learning, pages 1861-1870. PMLR, 2018. +[15] Danijar Hafner, Timothy Lillicrap, Jimmy Ba, and Mohammad Norouzi. Dream to control: Learning behaviors by latent imagination. arXiv preprint arXiv:1912.01603, 2019. +[16] Danijar Hafner, Timothy Lillicrap, Ian Fischer, Ruben Villegas, David Ha, Honglak Lee, and James Davidson. Learning latent dynamics for planning from pixels. In International Conference on Machine Learning, pages 2555-2565. PMLR, 2019. +[17] Irina Higgins, Loic Matthew, Arka Pal, Christopher Burgess, Xavier Glorot, Matthew Botvinick, Shakir Mohamed, and Alexander Lerchner. beta-vae: Learning basic visual concepts with a constrained variational framework. 2016. + +[18] Natasha Jaques, Asma Ghandeharioun, Judy Hanwen Shen, Craig Ferguson, Agata Lapedriza, Noah Jones, Shixiang Gu, and Rosalind Picard. Way off-policy batch deep reinforcement learning of implicit human preferences in dialog. arXiv preprint arXiv:1907.00456, 2019. +[19] Dmitry Kalashnikov, Jacob Varley, Yevgen Chebotar, Benjamin Swanson, Rico Jonschkowski, Chelsea Finn, Sergey Levine, and Karol Hausman. Mt-opt: Continuous multi-task robotic reinforcement learning at scale. arXiv preprint arXiv:2104.08212, 2021. +[20] Rahul Kidambi, Aravind Rajeswaran, Praneeth Netrapalli, and Thorsten Joachims. Morel: Model-based offline reinforcement learning. arXiv preprint arXiv:2005.05951, 2020. +[21] Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013. +[22] Ilya Kostrikov, Rob Fergus, Jonathan Tompson, and Ofir Nachum. Offline reinforcement learning with fisher divergence critic regularization. In International Conference on Machine Learning, pages 5774-5783. PMLR, 2021. +[23] Ilya Kostrikov, Ashvin Nair, and Sergey Levine. Offline reinforcement learning with implicit q-learning. arXiv preprint arXiv:2110.06169, 2021. +[24] Aviral Kumar, Justin Fu, George Tucker, and Sergey Levine. Stabilizing off-policy q-learning via bootstrapping error reduction. arXiv preprint arXiv:1906.00949, 2019. +[25] Aviral Kumar, Aurick Zhou, George Tucker, and Sergey Levine. Conservative q-learning for offline reinforcement learning. arXiv preprint arXiv:2006.04779, 2020. +[26] Sascha Lange, Thomas Gabel, and Martin Riedmiller. Batch reinforcement learning. In Reinforcement learning, pages 45-73. Springer, 2012. +[27] Alex X Lee, Anusha Nagabandi, Pieter Abbeel, and Sergey Levine. Stochastic latent actor-critic: Deep reinforcement learning with a latent variable model. arXiv preprint arXiv:1907.00953, 2019. +[28] Byung-Jun Lee, Jongmin Lee, and Kee-Eung Kim. Representation balancing offline model-based reinforcement learning. In International Conference on Learning Representations, 2020. +[29] Sergey Levine, Aviral Kumar, George Tucker, and Justin Fu. Offline reinforcement learning: Tutorial, review, and perspectives on open problems. arXiv preprint arXiv:2005.01643, 2020. +[30] Timothy P Lillicrap, Jonathan J Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. arXiv preprint arXiv:1509.02971, 2015. +[31] Yao Liu, Adith Swaminathan, Alekh Agarwal, and Emma Brunskill. Off-policy policy gradient with state distribution correction. arXiv preprint arXiv:1904.08473, 2019. +[32] Yao Liu, Adith Swaminathan, Alekh Agarwal, and Emma Brunskill. Provably good batch reinforcement learning without great exploration. arXiv preprint arXiv:2007.08202, 2020. +[33] Ying-Sheng Luo, Jonathan Hans Soeseno, Trista Pei-Chun Chen, and Wei-Chao Chen. Carl: Controllable agent with reinforcement learning for quadruped locomotion. ACM Transactions on Graphics (TOG), 39(4):38-1, 2020. +[34] Corey Lynch, Mohi Khansari, Ted Xiao, Vikash Kumar, Jonathan Tompson, Sergey Levine, and Pierre Sermanet. Learning latent plans from play. In Conference on Robot Learning, pages 1113-1132. PMLR, 2020. +[35] Xiaoteng Ma, Yiqin Yang, Hao Hu, Qihan Liu, Jun Yang, Chongjie Zhang, Qianchuan Zhao, and Bin Liang. Offline reinforcement learning with value-based episodic memory. arXiv preprint arXiv:2110.09796, 2021. +[36] Tatsuya Matsushima, Hiroki Furuta, Yutaka Matsuo, Ofir Nachum, and Shixiang Gu. Deployment-efficient reinforcement learning via model-based offline optimization. arXiv preprint arXiv:2006.03647, 2020. +[37] Ofir Nachum, Yinlam Chow, Bo Dai, and Lihong Li. Dualdice: Behavior-agnostic estimation of discounted stationary distribution corrections. arXiv preprint arXiv:1906.04733, 2019. +[38] Ashvin Nair, Murtaza Dalal, Abhishek Gupta, and Sergey Levine. Accelerating online reinforcement learning with offline datasets. arXiv preprint arXiv:2006.09359, 2020. + +[39] Ashvin Nair, Murtaza Dalal, Abhishek Gupta, and Sergey Levine. Awac: Accelerating online reinforcement learning with offline datasets. 2020. +[40] Xue Bin Peng, Michael Chang, Grace Zhang, Pieter Abbeel, and Sergey Levine. Mcp: Learning composable hierarchical control with multiplicative compositional policies. Advances in Neural Information Processing Systems, 32:3686-3697, 2019. +[41] Xue Bin Peng, Aviral Kumar, Grace Zhang, and Sergey Levine. Advantage-weighted regression: Simple and scalable off-policy reinforcement learning. arXiv preprint arXiv:1910.00177, 2019. +[42] Jan Peters, Katharina Mulling, and Yasemin Altun. Relative entropy policy search. In Twenty-Fourth AAAI Conference on Artificial Intelligence, 2010. +[43] Rafael Rafailov, Tianhe Yu, Aravind Rajeswaran, and Chelsea Finn. Offline reinforcement learning from images with latent space models. In Learning for Dynamics and Control, pages 1154-1168. PMLR, 2021. +[44] Noah Y Siegel, Jost Tobias Springenberg, Felix Berkenkamp, Abbas Abdelmaleki, Michael Neunert, Thomas Lampe, Roland Hafner, Nicolas Heess, and Martin Riedmiller. Keep doing what worked: Behavioral modelling priors for offline reinforcement learning. arXiv preprint arXiv:2002.08396, 2020. +[45] Avi Singh, Huihan Liu, Gaoyue Zhou, Albert Yu, Nicholas Rhinehart, and Sergey Levine. Parrot: Data-driven behavioral priors for reinforcement learning. arXiv preprint arXiv:2011.10024, 2020. +[46] Samarth Sinha, Ajay Mandlekar, and Animesh Garg. S4rl: Surprisingly simple self-supervision for offline reinforcement learning. arXiv preprint arXiv:2103.06326, 2021. +[47] Phillip Swazinna, Steffen Udluft, and Thomas Runkler. Overcoming model bias for robust offline deep reinforcement learning. Engineering Applications of Artificial Intelligence, 104:104366, 2021. +[48] Michita Imai Takuma Seno. d3rply: An offline deep reinforcement library. In NeurIPS 2021 Offline Reinforcement Learning Workshop, December 2021. +[49] Qing Wang, Jiechao Xiong, Lei Han, Peng Sun, Han Liu, and Tong Zhang. Exponentially weighted imitation learning for batched historical data. In NeurIPS, pages 6291-6300, 2018. +[50] Yunke Wang, Chang Xu, Bo Du, and Honglak Lee. Learning to weight imperfect demonstrations. In International Conference on Machine Learning, pages 10961-10970. PMLR, 2021. +[51] Yifan Wu, George Tucker, and Ofir Nachum. Behavior regularized offline reinforcement learning. arXiv preprint arXiv:1911.11361, 2019. +[52] Yue Wu, Shuangfei Zhai, Nitish Srivastava, Joshua Susskind, Jian Zhang, Ruslan Salakhutdinov, and Hanlin Goh. Uncertainty weighted actor-critic for offline reinforcement learning. arXiv preprint arXiv:2105.08140, 2021. +[53] Yiqin Yang, Xiaoteng Ma, Li Chenghao, Zewu Zheng, Qiyuan Zhang, Gao Huang, Jun Yang, and Qianchuan Zhao. Believe what you see: Implicit constraint approach for offline multi-agent reinforcement learning. Advances in Neural Information Processing Systems, 34, 2021. +[54] Tianhe Yu, Aviral Kumar, Yevgen Chebotar, Karol Hausman, Sergey Levine, and Chelsea Finn. Conservative data sharing for multi-task offline reinforcement learning. Advances in Neural Information Processing Systems, 34, 2021. +[55] Tianhe Yu, Aviral Kumar, Rafael Rafailov, Aravind Rajeswaran, Sergey Levine, and Chelsea Finn. Combo: Conservative offline model-based policy optimization. arXiv preprint arXiv:2102.08363, 2021. +[56] Tianhe Yu, Garrett Thomas, Lantao Yu, Stefano Ermon, James Y Zou, Sergey Levine, Chelsea Finn, and Tengyu Ma. Mopo: Model-based offline policy optimization. Advances in Neural Information Processing Systems, 33:14129-14142, 2020. +[57] Wenxuan Zhou, Sujay Bajracharya, and David Held. Plas: Latent action space for offline reinforcement learning. arXiv preprint arXiv:2011.07213, 2020. \ No newline at end of file diff --git a/lapolatentvariableadvantageweightedpolicyoptimizationforofflinereinforcementlearning/images.zip b/lapolatentvariableadvantageweightedpolicyoptimizationforofflinereinforcementlearning/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..5f03c7159e987c13eb151d1901de5ce93392c7b9 --- /dev/null +++ b/lapolatentvariableadvantageweightedpolicyoptimizationforofflinereinforcementlearning/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d524fb126fa69ed48c7dfea3c174987e6e36cd7cd1bc33c0bad9adacd1658da4 +size 430029 diff --git a/lapolatentvariableadvantageweightedpolicyoptimizationforofflinereinforcementlearning/layout.json b/lapolatentvariableadvantageweightedpolicyoptimizationforofflinereinforcementlearning/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..774e328e0e4fbe4ae42df7154f37365aaf8da358 --- /dev/null +++ b/lapolatentvariableadvantageweightedpolicyoptimizationforofflinereinforcementlearning/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e49ae473c09d9db9e6b2b4608e51aedd96dcc4b08a4ed9f5dabf774feda7cbe +size 383632