diff --git a/understandingandpreventingcapacitylossinreinforcementlearning/78e042a6-627b-4e6e-8bce-398dd81324a1_content_list.json b/understandingandpreventingcapacitylossinreinforcementlearning/78e042a6-627b-4e6e-8bce-398dd81324a1_content_list.json
new file mode 100644
index 0000000000000000000000000000000000000000..5571781a97b93ef1466517ec49b7d60464a38272
--- /dev/null
+++ b/understandingandpreventingcapacitylossinreinforcementlearning/78e042a6-627b-4e6e-8bce-398dd81324a1_content_list.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:6e43137038b99a45936f9d58b83d44e9698c1b5213386a9caad987f021e38695
+size 129174
diff --git a/understandingandpreventingcapacitylossinreinforcementlearning/78e042a6-627b-4e6e-8bce-398dd81324a1_model.json b/understandingandpreventingcapacitylossinreinforcementlearning/78e042a6-627b-4e6e-8bce-398dd81324a1_model.json
new file mode 100644
index 0000000000000000000000000000000000000000..0fd847936870af0bc03d1a7a533cded50ed41160
--- /dev/null
+++ b/understandingandpreventingcapacitylossinreinforcementlearning/78e042a6-627b-4e6e-8bce-398dd81324a1_model.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:1c7192802073a489b982d837c445221807d8edec1a6d920d6cf4c2794772e32d
+size 146416
diff --git a/understandingandpreventingcapacitylossinreinforcementlearning/78e042a6-627b-4e6e-8bce-398dd81324a1_origin.pdf b/understandingandpreventingcapacitylossinreinforcementlearning/78e042a6-627b-4e6e-8bce-398dd81324a1_origin.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..7f9dff6d91ae3e4bd9b33adc13937f6863a19ac3
--- /dev/null
+++ b/understandingandpreventingcapacitylossinreinforcementlearning/78e042a6-627b-4e6e-8bce-398dd81324a1_origin.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f0dc3671c8ea54622200c0e7eff808c0cb72cc72dc2c97d80b08698cc86012a2
+size 3839217
diff --git a/understandingandpreventingcapacitylossinreinforcementlearning/full.md b/understandingandpreventingcapacitylossinreinforcementlearning/full.md
new file mode 100644
index 0000000000000000000000000000000000000000..aee46162d97f019fb9bd858f07b2dfd071bdefe8
--- /dev/null
+++ b/understandingandpreventingcapacitylossinreinforcementlearning/full.md
@@ -0,0 +1,560 @@
+# UNDERSTANDING AND PREVENTING CAPACITY LOSS IN REINFORCEMENT LEARNING
+
+Clare Lyle
+
+Department of Computer Science
+University of Oxford*
+
+Mark Rowland & Will Dabney
+
+DeepMind
+
+# ABSTRACT
+
+The reinforcement learning (RL) problem is rife with sources of non-stationarity, making it a notoriously difficult problem domain for the application of neural networks. We identify a mechanism by which non-stationary prediction targets can prevent learning progress in deep RL agents: capacity loss, whereby networks trained on a sequence of target values lose their ability to quickly update their predictions over time. We demonstrate that capacity loss occurs in a range of RL agents and environments, and is particularly damaging to performance in sparse-reward tasks. We then present a simple regularizer, Initial Feature Regularization (InFeR), that mitigates this phenomenon by regressing a subspace of features towards its value at initialization, leading to significant performance improvements in sparse-reward environments such as Montezuma's Revenge. We conclude that preventing capacity loss is crucial to enable agents to maximally benefit from the learning signals they obtain throughout training.
+
+# 1 INTRODUCTION
+
+Deep reinforcement learning has achieved remarkable successes in a variety of tasks (Mnih et al., 2015; Moravčík et al., 2017; Silver et al., 2017; Abreu et al., 2019), but its impressive performance is mirrored by its brittleness and sensitivity to seemingly innocuous design choices (Henderson et al., 2018). In sparse-reward environments in particular, even different random seeds of the same algorithm can attain dramatically different performance outcomes. This presents a stark contrast to supervised learning, where existing approaches are reasonably robust to small hyperparameter changes, random seed inputs, and GPU parallelisation libraries. Much of the brittleness of deep RL algorithms has been attributed to the non-stationary nature of the prediction problems to which deep neural networks are applied in RL tasks. Indeed, naive applications of supervised learning methods to the RL problem may require explicit correction for non-stationarity and bootstrapping in order to yield similar improvements (Bengio et al., 2020; Raileanu et al., 2020).
+
+We hypothesize that the non-stationary prediction problems agents face in RL may be a driving force in the challenges described above. RL agents must solve a sequence of similar prediction tasks as they iteratively improve their value function accuracy and their policy (Dabney et al., 2021). Solving each subproblem (at least to the extent that the agent's policy is improved) in this sequence is necessary to progress to the next subproblem. Ideally, features learned to solve one subproblem would enable forward transfer to future problems. However, prior work on both supervised and reinforcement learning (Ash & Adams, 2020; Igl et al., 2021; Fedus et al., 2020) suggests that the opposite is true: networks trained on a sequence of similar tasks are prone to overfitting, exhibiting negative transfer.
+
+The principal thesis of this paper is that over the course of training, deep RL agents lose some of their capacity to quickly fit new prediction tasks, and in extreme cases this capacity loss prevents the agent entirely from making learning progress. We present a rigorous empirical analysis of this
+
+phenomenon which considers both the ability of networks to learn new target functions via gradient-based optimization methods, and their ability to linearly disentangle states' feature representations. We confirm that agents' ability to fit new target functions declines over the course of training in several environments from the Atari suite (Bellemare et al., 2013) and non-stationary reward prediction tasks. We further find that the ability of representations to linearly distinguish different states, a proxy for their ability to represent certain functions, quickly diminishes in sparse-reward environments, leading to representation collapse, where the feature outputs for every state in the environment inhabit a low-dimensional – or possibly even zero – subspace. Crucially, we find evidence that sufficient capacity is a necessary condition in order for agents to make learning progress. Finally, we propose a simple regularization technique, Initial Feature Regularization (InFeR), to prevent representation collapse by regressing a set of auxiliary outputs towards their value under the network's initial parameters. We show that this regularization scheme mitigates capacity loss in a number of settings, and also enables significant performance improvements in a number of RL tasks.
+
+One striking take-away from our results is that agents trained on so-called 'hard exploration' games such as Montezuma's Revenge can attain significant improvements over existing competitive baselines without using smart exploration algorithms, given a suitable representation learning objective. This suggests that the poor performance of deep RL agents in sparse-reward environments is not solely due to inadequate exploration, but rather also in part due to poor representation learning. Investigation into the interplay between representation learning and exploration, particularly in sparse-reward settings, thus presents a particularly promising direction for future work.
+
+# 2 BACKGROUND
+
+We consider the reinforcement learning problem wherein an agent interacts with an environment formalized by a Markov Decision Process $\mathcal{M} = (\mathcal{X},\mathcal{A},R,\mathcal{P},\gamma)$ , where $\mathcal{X}$ denotes the state space, $\mathcal{A}$ the action space, $R$ the reward function, $\mathcal{P}$ the transition probability function, and $\gamma$ the discount factor. We will be primarily interested in value-based RL, where the objective is to learn the value function $Q^{\pi}:\mathcal{X}\times \mathcal{A}\to \mathbb{R}$ associated with some (possibly stochastic) policy $\pi :\mathcal{X}\rightarrow \mathcal{P}(\mathcal{A})$ , defined as $Q^{\pi}(x,a) = \mathbb{E}_{\pi ,\mathcal{P}}[\sum_{k = 0}^{\infty}\gamma^{k}R(x_{k},a_{k})|x_{0} = x,a_{0} = a]$ . In particular, we are interested in learning the value function associated with the optimal policy $\pi^{*}$ which maximizes the expected discounted sum of rewards from any state.
+
+In Q-Learning (Watkins & Dayan, 1992), the agent performs updates to minimize the distance between a predicted action-value function $Q$ and the bootstrap target defined as
+
+$$
+\mathcal {T} Q (x, a) = \mathbb {E} \left[ R \left(x _ {0}, a _ {0}\right) + \gamma \max _ {a ^ {\prime} \in \mathcal {A}} Q \left(x _ {1}, a ^ {\prime}\right) \mid x _ {0} = x, a _ {0} = a \right]. \tag {1}
+$$
+
+In most practical settings, updates are performed with respect to sampled transitions rather than on the entire state space. The target can be computed for a sampled transition $(x_{t},a_{t},r_{t},x_{t + 1})$ as $\hat{\mathcal{T}} Q(x_t,a_t) = r_t + \gamma \max_aQ(x_{t + 1},a)$ .
+
+When a deep neural network is used as a function approximator (the deep RL setting), $Q$ is defined to be the output of a neural network with parameters $\theta$ , and updates are performed by gradient descent on sampled transitions $\tau = (x_{t},a_{t},r_{t},x_{t + 1})$ . A number of tricks are often used to improve stability: the sample-based objective is minimized following stochastic gradient descent based on minibatches sampled from a replay buffer of stored transitions, and a separate set of parameters $\bar{\theta}$ is used to compute the targets $Q_{\bar{\theta}}(x_{t + 1},a_{t + 1})$ which is typically updated more slowly than the network's online parameters. This yields the following loss function, given a sampled transition $\tau$ :
+
+$$
+\ell_ {T D} \left(Q _ {\theta}, \tau\right) = \left(R _ {t + 1} + \gamma \max _ {a ^ {\prime}} Q _ {\bar {\theta}} \left(X _ {t + 1}, a ^ {\prime}\right) - Q _ {\theta} \left(X _ {t}, A _ {t}\right)\right) ^ {2}. \tag {2}
+$$
+
+In this work we will be interested in how common variations on this basic learning objective shape agents' learning dynamics, in particular the dynamics of the learned representation, or features. We will refer to the outputs of the final hidden layer of the network (i.e. the penultimate layer)
+
+
+Figure 1: Networks trained to fit a sequence of different targets on MNIST data see increasing error on new target functions with the number of tasks.
+
+
+Figure 2: Networks see reduced ability to fit new targets over the course of training in two demonstrative Atari environments.
+
+as its features, denoted $\phi_{\theta}(x)$ . Our choice of the penultimate layer is motivated by prior literature studying representations in RL (Ghosh & Bellemare, 2020; Kumar et al., 2021), although many works studying representation learning consider the outputs of earlier layers as well. In general, the features of a neural network are defined to be the outputs of whatever layer is used to compute additional representation learning objectives.
+
+# 3 CAPACITY LOSS
+
+Each time a value-based RL agent discovers a new source of reward in its environment or, in the case of temporal difference methods, updates its value estimate, the prediction problem it needs to solve changes. Over the course of learning, such an agent must solve a long sequence of target prediction problems as its value function and policy evolve. Studies of neural networks in supervised learning suggest that this sequential fitting of new targets may be harmful to a network's ability to adapt to new targets (Achille et al., 2018, see Section 5 for further details, e.g.). This presents a significant challenge to deep RL agents undergoing policy improvement, for which it is necessary to quickly make significant changes to the network's predictions even late in the training process. In this section, we show that training on a sequence of prediction targets can lead to a reduced ability to fit new targets in deep neural networks, a phenomenon that we term capacity loss. Further, we show that an agent's inability to quickly update its value function to distinguish states presents a barrier to performance improvement in deep RL agents.
+
+# 3.1 TARGET-FITTING CAPACITY
+
+The parameters of a neural network not only determine the network's current outputs, but also influence how these outputs will evolve over time. A network which outputs zero because its final-layer weights are zero will evolve differently from one whose ReLU units are fully saturated at zero despite both outputting the same function Maas et al. (2013) – in particular, it will have a much easier time adapting to new targets. It is this capacity to fit new targets that is crucial for RL agents to obtain performance improvements, and which frames our perspective on representation learning. We are interested in identifying when an agent's current parameters are flexible enough to allow it to perform gradient updates that meaningfully change its predictions based on new reward information in the environment or evolving bootstrap targets, a notion formalized in the following definition.
+
+Definition 1 (Target-fitting capacity). Let $P_X \in \mathcal{P}(X)$ be some distribution over inputs $X$ and $P_{\mathcal{F}}$ a distribution over a family of real-valued functions $\mathcal{F}$ with domain $X$ . Let $\mathcal{N} = (g_{\theta}, \theta_0)$ represent the pairing of a neural network architecture with some initial parameters $\theta_0$ , and $\mathcal{O}$ correspond to an optimization algorithm for supervised learning. We measure the target-fitting capacity of $\mathcal{N}$ under the optimizer $\mathcal{O}$ to fit the data-generating distribution $\mathcal{D} = (P_X, P_{\mathcal{F}})$ as follows:
+
+$$
+\mathcal {C} (\mathcal {N}, \mathcal {O}, \mathcal {D}) = \mathbb {E} _ {f \sim P _ {\mathcal {F}}} \left[ \mathbb {E} _ {x \sim P _ {X}} \left[ \left(g _ {\theta^ {\prime}} (x) - f (x)\right) ^ {2} \right] \right] \quad \text {w h e r e} \theta^ {\prime} = \mathcal {O} \left(\theta_ {0}, P _ {X}, f\right). \tag {3}
+$$
+
+Our definition of capacity measures the ability of a network to reach a new set of targets within a limited optimization budget from its current parameters and optimizer state. The choice of optimization budget and target distribution are left as hyperparameters, and different choices result in different notions of capacity. In reinforcement learning we ultimately care about the network's ability to fit its Bellman targets quickly, however the ability on its own will not necessarily be a useful measure: for example, a network which can only output the zero function will attain low Bellman error immediately on a sparse-reward environment, but will fail to produce useful updates to improve the policy. Our evaluations of this measure will use target functions that are independent of the current network parameters to avoid these pathologies; the effect of this choice is explored further in Appendix B.2.
+
+The process of training a neural network to fit a set of labels must by necessity change some properties of the network. Works studying the information bottleneck principle (Tishby & Zaslavsky, 2015), for example, identify a compression effect of training on the latent representation, where inputs with similar labels are mapped to similar feature vectors. This compression can benefit generalization on the current task, but in the face of the rapidly-changing nature of the targets used in value iteration algorithms may harm the learning process by impeding the network's ability to fit new targets. This motivates two hypotheses. First: that networks trained to iteratively fit a sequence of dissimilar targets will lose their capacity to fit new target functions (Hypothesis 1), and second: the non-stationary prediction problems in deep RL also result in capacity loss (Hypothesis 2).
+
+To evaluate Hypothesis 1, we construct a series of toy iterative prediction problems on the MNIST data set, a widely-used computer vision benchmark which consists of images of handwritten digits and corresponding labels. We first fit a series of labels computed by a randomly initialized neural network $f_{\theta}$ : we transform input-label pairs $(x,y)$ from the canonical MNIST dataset to $(x,f_{\theta}(x))$ , where $f_{\theta}(x)$ is the network output. To generate a new task, we simply reinitialize the network. Given a target function, we then train the network for a fixed budget from the parameters obtained at the end of the previous iteration, and repeat this procedure of target initialization and training 30 times. We use a subset of MNIST inputs of size 1000 to reduce computational cost. In Figure 1 we see that the networks trained on this task exhibit decreasing ability to fit later target functions under a fixed optimization budget. This effect is strongest in the smaller networks, matching the intuition that solving tasks which are more challenging for the network will result in greater capacity loss. We consider two other tasks in Appendix B.2, obtaining similar results, as well as a wider range of architectures. We find that sufficiently over-parameterized networks (on the order of one million parameters for a task with one thousand data points) exhibit positive forward transfer, however models which are not over-parameterized relative to the task difficulty consistently exhibit increasing error as the number of targets trained on grows. This raises a question concerning our second hypothesis: are the deep neural networks used by value-based RL agents on popular benchmarks in the over- or under-parameterized regime?
+
+To evaluate Hypothesis 2, we train an agent's network checkpoints sampled over the course of training to fit randomly generated target functions. We provide full details of this procedure in Appendix C. We generate target functions by randomly initializing neural networks with new parameters, and use the outputs of these networks as targets for regression. We then load initial parameters from an agent checkpoint at some time $t$ , sample inputs from the replay buffer, and regress on the random target function evaluated on these inputs. We then evaluate the mean squared error after training for fifty thousand steps. We consider a DQN (Mnih et al., 2015), a QR-DQN (Dabney et al., 2018), and a Rainbow agent (Hessel et al., 2018). We observe in all three cases that as training progresses agents' checkpoints on average get modestly worse at fitting these random targets in most environments; due to space limitations we only show two representative environments where this phenomenon occurs in Figure 2, and defer the full evaluation to Appendix C.3.
+
+# 3.2 REPRESENTATION COLLAPSE AND PERFORMANCE
+
+The notion of capacity in Definition 1 measures the ability of a network to eventually represent a given target function. This definition reflects the intuition that capacity should not increase over time.
+
+
+Figure 3: Feature rank and performance over the course of training for Montezuma's Revenge (left) and Pong (right). We observe that feature rank is higher for environments and auxiliary tasks which provide denser reward signals than for sparse reward problems.
+
+
+
+
+
+
+
+However, deep RL agents must quickly update their predictions in order to make efficient learning progress. We present an alternate measure of capacity that captures this property which we call the feature rank, as it corresponds to an approximation of the rank of a feature embedding. Intuitively, the feature rank measures how easily states can be distinguished by updating only the final layer of the network. This approximately captures a network's ability to quickly adapt to changes in the target function, while being significantly cheaper to estimate than Definition 1.
+
+Definition 2 (Feature rank). Let $\phi : X \to \mathbb{R}^d$ be a feature mapping. Let $\mathbf{X}_n \subset X$ be a set of $n$ states in $X$ sampled from some fixed distribution $P$ . Fix $\varepsilon \geq 0$ , and let $\phi(\mathbf{X}_n) \in \mathbb{R}^{n \times d}$ denote the matrix whose rows are the feature embeddings of states $x \in \mathbf{X}_n$ . Let $\mathrm{SVD}(M)$ denote the multiset of singular values of a matrix $M$ . The feature rank of $\phi$ given input distribution $P$ is defined to be
+
+$$
+\rho (\phi , P, \epsilon) = \lim _ {n \rightarrow \infty} \mathbb {E} _ {\mathbf {X} _ {n} \sim P} [ | \{\sigma \in \operatorname {S V D} \left(\frac {1}{\sqrt {n}} \phi \left(\mathbf {X} _ {n}\right)\right) | \sigma > \varepsilon \} | ] \tag {4}
+$$
+
+for which a consistent estimator can be constructed as follows, letting $\mathbf{X} \subseteq X$ , $|\mathbf{X}| = n$
+
+$$
+\hat {\rho} _ {n} (\phi , \mathbf {X}, \epsilon) = | \{\sigma \in \operatorname {S V D} \left(\frac {1}{\sqrt {n}} \phi (\mathbf {X})\right) | \sigma > \varepsilon \} |. \tag {5}
+$$
+
+The numerical feature rank (henceforth abbreviated to feature rank) is equal to the dimension of the subspace spanned by the features when $\varepsilon = 0$ and the state space $\mathcal{X}$ is finite, and its estimator is equal to the numerical rank (Golub et al., 1976; Meier & Nakatsukasa, 2021) of the sampled feature matrix. For $\epsilon > 0$ , it throws away small components of the feature matrix. We show that $\rho$ is well-defined and that $\hat{\rho}_n$ is a consistent estimator in Appendix A.1. Our analysis of the feature rank resembles that of Kumar et al. (2021), but differs in two important ways: first, our estimator does not normalize by the maximal singular value. This allows us to more cleanly capture representation collapse, where the network features, and thus also their singular values, converge to zero. Second, we are interested in the capacity of agents with unlimited opportunity to interact with the environment, rather than in the data-limited regime. We compare our findings on feature rank against the $srank$ used in prior work in Appendix B.2.
+
+In our empirical evaluations, we train a double DQN (DDQN) agent, a quantile regression (QRDQN) agent, and a double DQN agent with an auxiliary random cumulant prediction task (RC DQN) (Dabney et al., 2021), on environments from the Atari suite, then evaluate $\hat{\rho}_n$ with $n = 5000$ on agent checkpoints obtained during training. We consider two illustrative environments: Montezuma's Revenge (sparse reward), and Pong (dense reward), deferring two additional environments to Appendix C.3. We run 3 random seeds on each environment-agent combination.
+
+We visualize agents' feature rank and performance in Figure 3. Non-trivial prediction tasks, either value prediction in the presence of environment rewards or auxiliary tasks, lead to higher feature rank. In Montezuma's Revenge, the higher feature rank induced by RC DQN corresponds to higher performance, but this auxiliary loss can have a detrimental effect on learning progress in complex, dense-reward games presumably due to interference between the random rewards and the true learning objective. Unlike in target-fitting capacity, we only see a consistent downward trend in sparse-reward environments, where a number of agents, most dramatically QR-DQN, exhibit representation collapse. We discuss potential mechanisms behind this trend in Appendix A.2.
+
+
+Figure 4: (a): Agent capacity vs human-normalized score in games where Rainbow does not achieve superhuman performance. While feature rank does not appear to solely determine agent performance, there is a positive correlation between feature rank and human-normalized score. Bottom row contains Rainbow agents trained with the regularizer presented in Equation 6. (b) An 'unlucky' seed from our evaluations on the sparsified version of Pong, where learning progress occurs only after the agent recovers from representation collapse.
+
+
+
+Figure 4a reveals a correlation between learning progress and feature rank for the Rainbow agent (Hessel et al., 2018) trained on challenging games in the Atari 2600 suite where it fails to achieve human-level performance; this trend is also reflected for other agents described in the next section. The points on the scatterplot largely fall into two clusters: those with low feature rank, which attain less than half of the average human score, and those with high feature rank, which tend to attain higher scores. Having a sufficiently high feature rank thus appears to be a necessary condition for learning progress, as demonstrated by the learning curves shown in Figure 4b, which highlights an unlucky agent trained on a variant of Pong (described in Appendix C.2) which experienced representation collapse, and only solved the task after it had overcome this collapse. However, high feature rank does not appear to be sufficient for learning progress. Other properties of an agent, such as its ability to perform accurate credit assignment, the stability of its update rule, the suitability of its optimizer, its exploration policy, and countless others, must be appropriately tuned to a given task in order for progress to occur. Simply mapping inputs to a relatively uniform distribution in feature space will not overcome failures in other components of the RL problem. An agent must be able to both collect useful learning signals from the environment and effectively update its predictions in response to those signals in order to make learning progress. This section has shown that at least in some instances poor performance can be attributed to the latter property.
+
+# 4 INFER: MITIGATING CAPACITY LOSS WITH FEATURE REGULARIZATION
+
+The previous section showed that capacity loss occurs in deep RL agents trained with online data, and in some cases appears to be a bottleneck to performance. We now consider how it might be mitigated, and whether explicitly regularizing the network to preserve its initial capacity improves performance in environments where representation collapse occurs. Our approach involves a function-space perspective on regularization, encouraging networks to preserve their ability to output linear functions of their features at initialization.
+
+# 4.1 INFER: FEATURE-SPACE REGULARIZATION
+
+Much like parameter regularization schemes seek to keep parameters close to their initial values, we wish to keep a network's ability to fit new targets close to its initial value. We motivate our approach with the intuition that a network which has preserved the ability to output functions it could easily fit at initialization should be better able to adapt to new targets. To this end, we will regress a set of network outputs towards the values they took at initialization. Our method, Initial Feature Regularization (InFeR), applies an $\ell_2$ regularization penalty on the output-space level by regressing
+
+
+(a)
+
+
+(b)
+
+
+
+
+(c)
+
+
+
+
+Figure 5: (a) Visualization of InFeR. (b) Analysis of the effect of InFeR on capacity loss. (c) Effect of InFeR on performance in Montezuma's Revenge with respect to Rainbow and Double DQN baselines. (d) Performance of InFeR relative to Rainbow on all 57 Atari games.
+
+a set of auxiliary network output heads to match their values at initialization. Similar perspectives have been used to prevent catastrophic forgetting in continual learning (Benjamin et al., 2019).
+
+In our approach, illustrated in Figure 5, we begin with a fixed deep Q-learning neural network with parameters $\theta$ , and modify the network architecture by adding $k$ auxiliary linear prediction heads $g_{i}$ on top of the feature representation $\phi_{\theta}$ . We take a snapshot of the agent's parameters at initialization $\theta_0$ , and use the outputs of the $k$ auxiliary heads under these parameters as auxiliary prediction targets. We then compute the mean squared error between the outputs of the heads under the current parameters $g_{i}(x;\theta_{t})$ and their outputs at initialization $g_{i}(x;\theta_{0})$ . This approach has the interpretation of amplifying and preserving subspaces of the features that were present at initialization. In practice, we find that scaling the auxiliary head outputs by a constant $\beta$ increases this amplification effect. This results in the following form of our regularization objective, where we let $\mathcal{B}$ denote the replay buffer sampling scheme used by the agent:
+
+$$
+\mathcal {L} _ {\text {I n F e R}} \left(\theta , \theta_ {0}; \mathcal {B}, \beta\right) = \mathbb {E} _ {x \sim \mathcal {B}} \left[ \sum_ {i = 1} ^ {k} \left(g _ {i} (x; \theta) - \beta g _ {i} \left(x; \theta_ {0}\right)\right) ^ {2} \right]. \tag {6}
+$$
+
+We evaluate the effect of incorporating this loss in both DDQN (Van Hasselt et al., 2016) and Rainbow (Hessel et al., 2018) agents, and include the relative performance improvement obtained by the InFeR agents over Rainbow on 57 games from the Atari 2600 suite in Figure 5, deferring the comparison to DDQN, where the regularizer improved performance slightly on average but only yielded significant improvements on sparse-reward games, to the appendix. We observe a net improvement over the Rainbow baseline by incorporating the InFeR objective, with significant improvements in games where agents struggle to obtain human performance. The evaluations in Figure 5 are for $k = 10$ heads with $\beta = 100$ and $\alpha = 0.1$ , and we show the method's robustness to these hyperparameters in Appendix C.1. We further observe in Figure 5 that the InFeR loss reduces target-fitting error on the non-stationary MNIST prediction task described in the previous section. We show in Appendix C.2 that InFeR tends to increase the feature rank of agents trained on the Atari domain over the entire course of training; we study the early training period in Appendix C.3.
+
+The striking improvement obtained in the sparse-reward Montezuma's Revenge environment begs the question of whether such results can be replicated in other RL agents. We follow the same experimental procedure as before, but now use the DDQN agent; see Figure 5. We find that adding InFeR to the DDQN objective produces a similar improvement as does adding it to Rainbow, leading the DDQN agent, which only follows an extremely naive $\epsilon$ -greedy exploration strategy and obtains zero reward at all points in training, to exceed the performance of the noisy networks approach taken by Rainbow in the last 40 million training frames. This leads to two intriguing conclusions: first, that agents which are explicitly regularized to prevent representation collapse can make progress in sparse reward problems without the help of good exploration strategies; and second, that this form of regularization yields significantly larger performance improvements in the presence of additional algorithm design choices that are designed to speed up learning progress.
+
+# 4.2 UNDERSTANDING HOW INFER WORKS
+
+While InFeR improves performance on average across the Atari games, its improvements are concentrated principally on games where the baseline rainbow agent performs significantly below the human baseline. It further slows down progress in a subset of environments such as Asteroids and Jamesbond. We now investigate two hypothesized mechanisms by which this regularizer may shape the agent's representation, in the hopes of explaining this differential effect on performance. Hypothesis 1: InFeR improves performance by preserving a random subspace of the representation that the final linear layer can use to better predict the value function. The effect of the regularizer on other aspects of the representation learning dynamics does not influence performance. Hypothesis 2: The InFeR loss slows down the rate at which the learned features at every layer of the network can drift from their initialization in function space, improving the learning dynamics of the entire network to prevent feature collapse and over-fitting to past targets. The precise subspace spanned by the auxiliary weights is not directly useful to value function estimation.
+
+To evaluate Hypothesis 1, we concatenate the outputs of a randomly initialized network to the feature outputs of the network used to learn the Q-function, and train a linear layer on top of these joint learned and random features. If Hypothesis 1 were true, then we would expect this architecture to perform comparably to the InFeR agents, as the final linear layer has access to a randomly initialized feature subspace. Instead, Figure 6 shows that the performance of the agents with access to the random features to be comparable to that of the vanilla Rainbow agents, confirming that the effect of InFeR on earlier layers is crucial to its success.
+
+We now consider Hypothesis 2. InFeR limits the degrees of freedom with which a network can collapse its representation, which may reduce the flexibility of the network to make the changes necessary to fit new value functions, slowing down progress in environments where representation collapse is not a concern. In such cases, increasing the dimension of the layer to which we apply InFeR should give the network more degrees of freedom to fit its targets, and so reduce the performance gap induced by the regularization. We test this hypothesis by doubling the width of the penultimate network layer and comparing the performance of InFeR and Rainbow on games where
+
+
+Figure 6: Left: agent performance does not improve over baseline when random features are added to the representation. Right: doubling the width of the neural network narrows the performance gap in games on which InFeR under-performed relative to Rainbow.
+
+
+
+InFeR hurt performance in the original network. We refer to this agent as DoubleRainbow. We see in Figure 6 that increasing the network's size reduces, eliminates, or in some cases reverses the performance gap induced by InFeR in the smaller architecture. We therefore conclude that the principal mechanism by which InFeR affects performance is by regularizing the entire network's learning dynamics.
+
+# 5 RELATED WORK
+
+Suitably designed auxiliary tasks have been shown to improve performance and encourage learned representations to satisfy desirable properties in a wide range of settings (Jaderberg et al., 2017; Veeriah et al., 2019; Gelada et al., 2019; Machado et al., 2018), with further insight given by prior analysis of the geometry (Bellemare et al., 2019) and stability (Ghosh & Bellemare, 2020) of value functions in RL. Our analysis of linear algebraic properties of agents' representations is complemented by prior works which leverage similar ideas to analyze implicit under-parameterization (Kumar et al., 2021) and spectral normalization (Gogianu et al., 2021) in deep RL agents, and by the framework proposed by Lyle et al. (2021) to study learning dynamics in deep RL agents. In contrast to prior work, which treats the layers of the network which come before the features as a black box, we explicitly study the properties and learning dynamics of the whole network.
+
+A separate line of work has studied the effect of interference between sub-tasks in both reinforcement learning (Schaul et al., 2019; Teh et al., 2017; Igl et al., 2021) and supervised learning settings (Sharkey & Sharkey, 1995; Ash & Adams, 2020; Beck et al., 2021). Of particular interest has been catastrophic forgetting, with prior work proposing novel training algorithms using regularization (Kirkpatrick et al., 2017; Bengio et al., 2014; Lopez-Paz & Ranzato, 2017) or distillation (Schwarz et al., 2018; Silver & Mercer, 2002; Li & Hoiem, 2017) approaches. Methods which involve reinitializing a new network have seen particular success at reducing interference between tasks in deep reinforcement learning (Igl et al., 2021; Teh et al., 2017; Rusu et al., 2016; Fedus et al., 2020). A closer relative of our approach is that of Benjamin et al. (2019), which also applies a function-space regularization approach, but which involves saving input-output pairs into a memory bank with the goal of mitigating catastrophic forgetting. Unlike prior work, InFeR seeks to maximize performance on future tasks, works without task labels, and incurs a minimal, fixed computational cost independent of the number of prediction problems seen during training.
+
+# 6 CONCLUSIONS
+
+This paper has demonstrated a fundamental challenge facing deep RL agents: loss of the capacity to distinguish states and represent new target functions over the course of training. We have shown that this phenomenon is particularly salient in sparse-reward settings, in some cases leading to complete collapse of the representation and preventing the agent from making learning progress. Our analysis revealed a number of nuances to this phenomenon, showing that larger networks trained on rich learning signals are more robust to capacity loss than smaller networks trained to fit sparse targets. To address this challenge, we proposed a regularizer to preserve capacity, yielding improved performance across a number of settings in which deep RL agents have historically struggled to match human performance. Further investigation into this method suggests that it is performing a form of function-space regularization on the neural network, and that settings where it appears the task reduces performance are actually instances of under-parameterization relative to the difficulty of the environment. Particularly notable is the effect of incorporating InFeR in the hard exploration game of Montezuma's Revenge: its success here suggests that effective representation learning can allow agents to learn good policies in sparse-reward environments even under naive exploration strategies. Our findings open up a number of exciting avenues for future work in reinforcement learning and beyond to better understand how to preserve plasticity in non-stationary prediction tasks.
+
+# ACKNOWLEDGEMENTS
+
+Thanks to Georg Ostrovski, Michael Hutchinson, Joost van Amersfoort, Daniel Guo, Diana Borsa, Anna Harutyunyan, Razvan Pascanu, Caglar Gulcehre, Srivatsan Srvinivasan, and Remi Munos for helpful discussions and feedback on early versions of this paper. CL is supported by an Open Philanthropy AI Fellowship.
+
+# REFERENCES
+
+Miguel Abreu, Luis Paulo Reis, and Nuno Lau. Learning to run faster in a humanoid robot soccer environment through reinforcement learning. In *Robot World Cup*, pp. 3-15. Springer, 2019.
+Alessandro Achille, Matteo Rovere, and Stefano Soatto. Critical learning periods in deep networks. In International Conference on Learning Representations, 2018.
+Jordan Ash and Ryan P Adams. On warm-starting neural network training. In Neural Information Processing Systems (NeurIPS), 2020.
+Nathan Beck, Durga Sivasubramanian, Apurva Dani, Ganesh Ramakrishnan, and Rishabh Iyer. Effective evaluation of deep active learning on image classification tasks. arXiv, 2021.
+Marc Bellemare, Will Dabney, Robert Dadashi, Adrien Ali Taiga, Pablo Samuel Castro, Nicolas Le Roux, Dale Schuurmans, Tor Lattimore, and Clare Lyle. A geometric perspective on optimal representations for reinforcement learning. In Neural Information Processing Systems (NeurIPS), 2019.
+Marc G Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 47: 253-279, 2013.
+Emmanuel Bengio, Joelle Pineau, and Doina Precup. Correcting momentum in temporal difference learning. In NeurIPS Deep Reinforcement Learning Workshop, 2020.
+Yoshua Bengio, Mehdi Mirza, Ian Goodfellow, Aaron Courville, and Xia Da. An empirical investigation of catastrophic forgetting in gradient-based neural networks. In International Conference on Learning Representations (ICLR), 2014.
+Ari Benjamin, David Rolnick, and Konrad Kording. Measuring and regularizing networks in function space. In International Conference on Learning Representations (ICLR), 2019.
+Will Dabney, Mark Rowland, Marc Bellemare, and Rémi Munos. Distributional reinforcement learning with quantile regression. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32, 2018.
+Will Dabney, André Barreto, Mark Rowland, Robert Dadashi, John Quan, Marc G Bellemare, and David Silver. The value-improvement path: Towards better representations for reinforcement learning. In AAAI Conference on Artificial Intelligence, 2021.
+William Fedus, Dibya Ghosh, John D Martin, Marc G Bellemare, Yoshua Bengio, and Hugo Larochelle. On catastrophic interference in Atari 2600 games. arXiv, 2020.
+Carles Gelada, Saurabh Kumar, Jacob Buckman, Ofir Nachum, and Marc G Bellemare. DeepMDP: Learning continuous latent space models for representation learning. In International Conference on Machine Learning (ICML), 2019.
+Dibya Ghosh and Marc G Bellemare. Representations for stable off-policy reinforcement learning. In International Conference on Machine Learning (ICML), 2020.
+Florin Gogianu, Tudor Berariu, Mihaela Rosca, Claudia Clopath, Lucian Busoniu, and Razvan Pascanu. Spectral normalisation for deep reinforcement learning: an optimisation perspective. arXiv preprint arXiv:2105.05246, 2021.
+Gene Golub, Virginia Klema, and Gilbert W Stewart. Rank degeneracy and least squares problems. Technical report, STANFORD UNIV CA DEPT OF COMPUTER SCIENCE, 1976.
+Peter Henderson, Riashat Islam, Philip Bachman, Joelle Pineau, Doina Precup, and David Meger. Deep reinforcement learning that matters. In Proceedings of the AAAI conference on artificial intelligence, volume 32, 2018.
+
+Matteo Hessel, Joseph Modayil, Hado Van Hasselt, Tom Schaul, Georg Ostrovski, Will Dabney, Dan Horgan, Bilal Piot, Mohammad Azar, and David Silver. Rainbow: Combining improvements in deep reinforcement learning. In AAAI conference on artificial intelligence, 2018.
+Maximilian Igl, Gregory Farquhar, Jelena Luketina, Wendelin Boehmer, and Shimon Whiteson. Transient non-stationarity and generalisation in deep reinforcement learning. In International Conference on Learning Representations (ICLR), 2021.
+Max Jaderberg, Volodymyr Mnih, Wojciech Marian Czarnecki, Tom Schaul, Joel Z Leibo, David Silver, and Koray Kavukcuoglu. Reinforcement learning with unsupervised auxiliary tasks. In International Conference on Learning Representations (ICLR), 2017.
+Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In *ICLR (Poster)*, 2015.
+James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, Demis Hassabis, Claudia Clopath, Dharshan Kumaran, and Raia Hadsell. Overcoming catastrophic forgetting in neural networks. Proceedings of the National Academy of Sciences, 114(13):3521-3526, 2017.
+Aviral Kumar, Rishabh Agarwal, Dibya Ghosh, and Sergey Levine. Implicit under-parameterization inhibits data-efficient deep reinforcement learning. In International Conference on Learning Representations (ICLR), 2021.
+Zhizhong Li and Derek Hoiem. Learning without forgetting. IEEE transactions on pattern analysis and machine intelligence, 40(12):2935-2947, 2017.
+David Lopez-Paz and Marc'Aurelio Ranzato. Gradient episodic memory for continual learning. In Neural Information Processing Systems (NIPS), 2017.
+Clare Lyle, Mark Rowland, Georg Ostrovski, and Will Dabney. On the effect of auxiliary tasks on representation dynamics. In Artificial Intelligence and Statistics (AISTATS), 2021.
+Andrew L Maas, Awni Y Hannun, Andrew Y Ng, et al. Rectifier nonlinearities improve neural network acoustic models. In Proceedings of the International Conference on Machine Learning. CiteSeer, 2013.
+Marlos C. Machado, Clemens Rosenbaum, Xiaoxiao Guo, Miao Liu, Gerald Tesauro, and Murray Campbell. Eigenoption discovery through the deep successor representation. In International Conference on Learning Representations (ICLR), 2018.
+Maike Meier and Yuji Nakatsukasa. Fast randomized numerical rank estimation. arXiv e-prints, pp. arXiv-2105, 2021.
+Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, Stig Petersen, Charles Beattie, Amir Sadik, Ioannis Antonoglou, Helen King, Dharshan Kumaran, Daan Wierstra, Shane Legg, and Demis Hassabis. Human-level control through deep reinforcement learning. Nature, 518(7540):529-533, 2015.
+Matej Moravčík, Martin Schmid, Neil Burch, Viliam Lisý, Dustin Morrill, Nolan Bard, Trevor Davis, Kevin Waugh, Michael Johanson, and Michael Bowling. DeepStack: Expert-level artificial intelligence in heads-up no-limit poker. Science, 356(6337):508-513, 2017. ISSN 0036-8075.
+John Quan and Georg Ostrovski. DQN Zoo: Reference implementations of DQN-based agents, 2020. URL http://github.com/deepmind/dqn_zoo.
+Roberta Raileanu, Maxwell Goldstein, Denis Yarats, Ilya Kostrikov, and Rob Fergus. Automatic data augmentation for generalization in reinforcement learning. arXiv, 2020.
+
+Andrei A. Rusu, Sergio Gomez Colmenarejo, Caglar Gülçehre, Guillaume Desjardins, James Kirkpatrick, Razvan Pascanu, Volodymyr Mnih, Koray Kavukcuoglu, and Raia Hadsell. Policy distillation. In International Conference on Learning Representations (ICLR), 2016.
+Tom Schaul, Diana Borsa, Joseph Modayil, and Razvan Pascanu. Ray interference: a source of plateaus in deep reinforcement learning. arXiv, 2019.
+Jonathan Schwarz, Wojciech Czarnecki, Jelena Luketina, Agnieszka Grabska-Barwinska, Yee Whye Teh, Razvan Pascanu, and Raia Hadsell. Progress & compress: A scalable framework for continual learning. In International Conference on Machine Learning (ICML), 2018.
+Noel E Sharkey and Amanda JC Sharkey. An analysis of catastrophic interference. Connection Science, 1995.
+Daniel L Silver and Robert E Mercer. The task rehearsal method of life-long learning: Overcoming impoverished data. In Conference of the Canadian Society for Computational Studies of Intelligence, pp. 90-101, 2002.
+David Silver, Julian Schrittwieser, Karen Simonyan, Ioannis Antonoglou, Aja Huang, Arthur Guez, Thomas Hubert, Lucas Baker, Matthew Lai, Adrian Bolton, Yutian Chen, Timothy Lillicrap, Fan Hui, Laurent Sifre, George van den Driessche, Thore Graepel, and Demis Hassabis. Mastering the game of Go without human knowledge. Nature, 550(7676):354-359, 2017.
+Yee Whye Teh, Victor Bapst, Wojciech M Czarnecki, John Quan, James Kirkpatrick, Raia Hadsell, Nicolas Heess, and Razvan Pascanu. Distral: Robust multitask reinforcement learning. In Neural Information Processing Systems (NIPS), 2017.
+Naftali Tishby and Noga Zaslavsky. Deep learning and the information bottleneck principle. In 2015 IEEE information theory workshop (itw), pp. 1-5. IEEE, 2015.
+Hado Van Hasselt, Arthur Guez, and David Silver. Deep reinforcement learning with double Q-learning. In AAAI Conference on Artificial Intelligence, 2016.
+Vivek Veeriah, Matteo Hessel, Zhongwen Xu, Richard Lewis, Janarthanan Rajendran, Junhyuk Oh, Hado van Hasselt, David Silver, and Satinder Singh. Discovery of useful questions as auxiliary tasks. In Neural Information Processing Systems (NeurIPS), 2019.
+Christopher JCH Watkins and Peter Dayan. Q-learning. Machine learning, 8(3-4):279-292, 1992.
+
+# A THEORETICAL RESULTS
+
+# A.1 ESTIMATOR CONSISTENCY
+
+We here show that our estimator of the agent's feature rank is consistent. First recall
+
+$$
+\left(\frac {1}{\sqrt {n}} \Phi_ {n}\right) ^ {\top} \left(\frac {1}{\sqrt {n}} \Phi_ {n}\right) = \frac {1}{n} \sum_ {i = 1} ^ {n} \phi \left(x _ {i}\right) \phi \left(x _ {i}\right) ^ {\top}. \tag {7}
+$$
+
+The following property of the expected value holds
+
+$$
+\mathbb {E} _ {x \sim P} [ \phi (x) \phi (x) ^ {\top} ] = \mathbb {E} \left[ \frac {1}{n} \sum_ {i = 1} ^ {n} \phi \left(x _ {i}\right) \phi \left(x _ {i}\right) ^ {\top} \right]. \tag {8}
+$$
+
+It is then straightforward to apply the strong law of large numbers. To be explicit, we consider an element of $M = \mathbb{E}[\phi \phi^{\top}]$ , $M_{ij}$ .
+
+$$
+\mathbb {E} \left[\left(\phi (x) \phi (x) ^ {\top}\right) _ {i j} \right] = M _ {i j} = \mathbb {E} \left[ \phi_ {i} (x) \phi_ {j} (x) \right] \Rightarrow \sum_ {k = 1} ^ {n} \frac {1}{n} \phi_ {i} \left(x _ {k}\right) \phi_ {j} \left(x _ {k}\right) \stackrel {{a. s.}} {\rightarrow} M _ {i j}. \tag {9}
+$$
+
+Since we have convergence for any $M_{ij}$ , we get convergence of the resulting matrix to $M$ . Because the singular values of $\Phi$ are the eigenvalues of $M$ and the eigenvalues are continuous functions of that matrix, the eigenvalues of $M_{n}$ converge to those of $M$ almost surely. Then for almost all values of $\epsilon$ , the threshold estimator $N(\lambda_1,\ldots ,\lambda_k;\epsilon) = |\{\lambda_i > \epsilon \} |$ will converge to $N(\operatorname {spec}(M);\epsilon)$ . Specifically, the estimator will be convergent for all values of $\epsilon$ which are not eigenvalues of $M$ itself.
+
+# A.2 FEATURE DYNAMICS
+
+We apply similar analysis to that of Lyle et al. (2021) to better understand the effect of sparse-reward environments on representation collapse. To do so, we consider the setting where $\Phi_t$ are features and $w_t$ a linear function approximator which jointly parameterize a value function $V_t = \langle \Phi_t(x), w_t \rangle$ . We will be interested in studying a continuous-time approximation to TD learning, where the discrete-time expected updates
+
+$$
+\Phi_ {t} \leftarrow \Phi_ {t} + \alpha \nabla_ {\Phi} V _ {t} \left[ \left(\gamma P ^ {\pi} - I\right) V _ {t} + R ^ {\pi} \right] \tag {10}
+$$
+
+$$
+w _ {t} \leftarrow w _ {t} + \beta \nabla_ {w} V _ {t} \left(\gamma P ^ {\pi} - I\right) V _ {t} + R ^ {\pi} ] \tag {11}
+$$
+
+are translated into a continuous-time flow, described by the following equations.
+
+$$
+\partial_ {t} \Phi_ {t} = \alpha (\gamma P ^ {\pi} - I) \Phi_ {t} \left(w _ {t} w _ {t} ^ {\top}\right) + R ^ {\pi} w _ {t} ^ {\top} \tag {12}
+$$
+
+$$
+\partial_ {t} w _ {t} = \beta \Phi_ {t} ^ {\top} \left[ \left(\gamma P ^ {\pi} - I\right) \Phi_ {t} w _ {t} + R ^ {\pi} \right], \tag {13}
+$$
+
+where $P^{\pi} \in \mathbb{R}^{\mathcal{X} \times \mathcal{X}}$ is the matrix of state-transition probabilities under $\pi$ , and $R^{\pi} \in \mathbb{R}^{\mathcal{X}}$ is the vector of expected rewards.
+
+One of the key take-aways of prior works is that under certain assumptions, a tabular value function following continuous-time TD dynamics will converge to its limiting value $V^{\pi}$ along the principal components of the environment's transition matrix. In the function-approximation case described above, the dynamics of the features $\Phi_t$ are somewhat more complex. However, it turns out that under certain training regimes, we can obtain similar convergence results for the features. We therefore turn our attention to ensemble prediction, where $M$ linear prediction 'heads', each using a separate weight vector $w_{t}^{m}$ ( $m = 1, \dots, M$ ) are all trained to regress on the TD targets using the shared feature representation of the state as input, resulting in the following dynamics.
+
+$$
+\partial_ {t} \Phi_ {t} ^ {M} = \alpha \sum_ {m = 1} ^ {M} \left(R ^ {\pi} + \gamma P ^ {\pi} \Phi_ {t} ^ {M} w _ {t} ^ {m} - \Phi_ {t} ^ {M} w _ {t} ^ {m}\right) \left(w _ {t} ^ {m}\right) ^ {\top}, \tag {14}
+$$
+
+$$
+\partial_ {t} w _ {t} ^ {m} = \beta \left(\Phi_ {t} ^ {M}\right) ^ {\top} \left(R ^ {\pi} + \gamma P ^ {\pi} \Phi_ {t} ^ {M} w _ {t} ^ {m} - \Phi_ {t} w _ {t} ^ {m}\right). \tag {15}
+$$
+
+We now restate the result of Lyle et al. (2021) regarding the behaviour of the representation in the limit of many ensemble heads.
+
+Theorem 1 (Lyle et al., 2021). For $M \in \mathbb{N}$ , let $(\Phi_t^M)_{t \geq 0}$ be the solution to Equation 14, with each $w_t^m$ for $m = 1, \ldots, M$ initialised independently from $N(0, \sigma_M^2)$ , and fixed throughout training $(\beta = 0)$ . We consider two settings: first, where the learning rate $\alpha$ is scaled as $\frac{1}{M}$ and $\sigma_M^2 = 1$ for all $M$ , and second where $\sigma_M^2 = \frac{1}{M}$ and the learning rate $\alpha$ is equal to 1. These two settings yield the following dynamics, respectively:
+
+$$
+\lim _ {M \rightarrow \infty} \partial_ {t} \Phi_ {t} ^ {M} \stackrel {P} {=} - (I - \gamma P ^ {\pi}) \Phi_ {t} ^ {M}, a n d \tag {16}
+$$
+
+$$
+\lim _ {M \rightarrow \infty} \partial_ {t} \Phi_ {t} ^ {M} \stackrel {{D}} {{=}} - (I - \gamma P ^ {\pi}) \Phi_ {t} ^ {M} + R ^ {\pi} \epsilon^ {\top}, \epsilon \sim \mathcal {N} (0, I). \tag {17}
+$$
+
+The corresponding limiting trajectories for a fixed initialisation $\Phi_0\in \mathbb{R}^{\mathcal{X}\times d}$ , are therefore given respectively by
+
+$$
+\begin{array}{l} \lim _ {M \rightarrow \infty} \Phi_ {t} ^ {M} \stackrel {P} {=} \exp (- t (I - \gamma P ^ {\pi})) \Phi_ {0}, a n d (18) \\ \lim _ {M \to \infty} \Phi_ {t} ^ {M} \stackrel {D} {=} \exp (- t (I - \gamma P ^ {\pi})) (\Phi_ {0} - (I - \gamma P ^ {\pi}) ^ {- 1} R ^ {\pi} \varepsilon^ {\top}) \\ + \left(I - \gamma P ^ {\pi}\right) ^ {- 1} R ^ {\pi} \varepsilon^ {\top}, \epsilon \sim \mathcal {N} (0, I). (19) \\ \end{array}
+$$
+
+One important corollary of this result occurs in sparse-reward environments under sub-optimal policies, where $R^{\pi} = \mathbf{0}$ . In this case, we see that the representation converges precisely to the zero vector.
+
+Corollary 1. Let $\Phi_t^M$ , $(w)_{i=1}^M$ be defined as in Theorem 1. Then if $R^\pi = 0$ , the feature representation converges to the zero vector for every state, independent of whether the learning rate $\alpha$ is scaled as $\frac{1}{M}$ or the linear weight initialization variance scales as $\frac{1}{M}$ . In particular:
+
+$$
+\lim _ {t \rightarrow \infty} \lim _ {M \rightarrow \infty} \Phi_ {t} ^ {M} \stackrel {P} {=} \mathbf {0}. \tag {20}
+$$
+
+As a result, we have that the feature rank of $\Phi$ will also tend to zero
+
+$$
+\forall \epsilon > 0 \quad \lim _ {t \rightarrow \infty} \lim _ {M \rightarrow \infty} | \{\sigma \in S V D \left(\Phi_ {t} ^ {M}\right) | \sigma > \epsilon \} | \stackrel {P} {=} 0. \tag {21}
+$$
+
+Proof. The proof of this result follows from a straightforward application of Theorem 1, setting $R^{\pi} = 0$ and letting $t \to \infty$ . We can obtain an analogous result for the rank of $\Phi_t^M$ when $P^{\pi}$ is diagonalizable by noting that for any eigenvector $v_i$ of $P^{\pi}$ , the value of $v_i^\top \Phi_t^M v_i$ evolves as $c\exp (-t\lambda_i)$ for some constant $c$ that depends on $\Phi_0^M$ . In this case, we obtain a limiting value of 1 for the rank so long as $P^{\pi}$ corresponds to an ergodic Markov chain.
+
+The setting of this result is distinct from that of deep neural network representation dynamics, as neural networks use discrete optimization steps, finite learning rates, and typically do not leverage linear ensembles. However, we emphasize two crucial observations that suggest the intuition developed in this setting may be relevant: first, in sparse reward environments the representation will be pushed to zero along dimensions spanned by the linear weights used to compute outputs. Once sufficiently many independent weight vectors are being used to make predictions, this effectively forces every dimension of the representation to fit the zero vector output. We would therefore expect representation collapse to be particularly pronounced in the QR-DQN agents trained on sparse-reward environments, as in this setting we obtain many independently initialized heads all identically trying to fit the zero target.
+
+Second, in the presence of ReLU activations and stochastic optimization, the trajectories followed by the learned features in deep neural networks run the risk of getting 'trapped' in negative values. If these features would normally tend to small values close to zero (as we would expect in agents following similar dynamics to those obtained in Theorem 1), this increases the risk of unit saturation, where the representation may get trapped in bad local minima. This appears to be what happens in the QR-DQN agents trained on sparse-reward environments such as Montezuma's Revenge.
+
+# B SEQUENTIAL SUPERVISED LEARNING
+
+# B.1 DETAILS: TARGET-FITTING CAPACITY IN NON-STATIONARY MNIST
+
+In addition to our evaluations in the Atari domain, we also consider a variant of the MNIST dataset in which the labels change over the course of training.
+
+- Inputs and Labels: We use 1000 randomly sampled input digits from the MNIST dataset and assign either binary or random targets.
+- Distribution Shift: We divide training into $N = 30$ or $N = 10$ iterations depending on the structure of the target function. In each iteration, a target function is randomly sampled, and the network's parameters obtained at the end of the previous iteration are used the initial values for a new optimization run. We use the Adam (Kingma & Ba, 2015) optimizer with learning rate $1 \in -3$ , and train to minimize the mean squared error between the network outputs and the targets for either 3000 or 5000 steps depending on the nature of the target function.
+- Architecture: we use a standard fully-connected architecture with ReLU activations, and vary with width and depth of the network. The parameters at the start of the procedure are initialized following the defaults in the Jax Haiku library.
+
+We note that the dataset sizes, training budgets, and network sizes in the following experiments are all relatively small. This was chosen to enable short training times and decrease the computational budget necessary too replicate the experiments. The particular experiment parameters were selected to be the fastest and cheapest settings in which we could observe the capacity loss phenomenon, while still being nontrivial tasks. In general, we found that capacity loss is easiest to measure in a 'sweet spot' where the task for a given architecture is simple enough for a freshly-initialized network to attain low loss, but complex enough that the network cannot trivially solve the task. In the findings of the following section, we see how some of the larger architectures don't exhibit capacity loss on 'easier' target functions, but do on more challenging ones that exhibit less structure. This suggests that replicating these results in larger networks will be achievable, but will require re-tuning the task difficulty to the larger network's capacity.
+
+# B.2 ADDITIONAL EVALUATIONS
+
+We expand on the MNIST target-fitting task shown in the main paper by considering how network size and target function structure influences capacity loss.
+
+- Random-MNIST (smooth) this task uses the images from the MNIST dataset as inputs. The goal is to perform regression on the outputs of a randomly initialized, fixed neural network. We use a small network for this task, consisting of two width-30 fully connected hidden layers with ReLU activations which feed into a final linear layer which outputs a scalar. Because the network outputs are small, we scale them by 10 so that it is not possible to get a low loss by simply predicting the network's bias term. This task, while randomly generated, has some structure: neural networks tend to map similar inputs to similar outputs, and so the inductive bias of the targets will match that of the function approximator we train on them.
+- Hash-MNIST (non-smooth) uses the same neural network architecture as the previous task to generate targets, however rather than using the scaled network output as the target, we multiply the output by 1e3 and feed it into a sine function. The resulting targets no longer have the structure induced by the neural network. This task amounts to memorizing a set of labels for the input points.
+- Threshold-MNIST (sparse) replaces the label of an image with a binary indicator variable indicating whether the label is smaller than some threshold. To construct a sequence of tasks, we set the threshold at iteration $i$ to be equal to $i$ . This means that at the first iteration,
+
+# Target-fitting error: non-smooth
+
+
+
+
+
+
+
+Figure 7: Mean squared error at the end of training on each iteration of the hash-MNIST task. Target-fitting error increases over time in smaller networks, but increasing the depth or width of the network slows down capacity loss, enabling positive transfer in the largest networks we studied.
+
+Loss Feature num. rank Feature srank
+
+
+
+
+
+the labels are of the form $(x,0)$ for all inputs $x$ . At the second iteration, they are of the form $(x,\delta(y < 1))$ , where $y$ is the digit in the image $x$ , and so on.
+
+We consider MLP networks of varying widths and depths, noting that the network architecture used to generate the random targets is fixed and independent of the approximating architecture. We are interested in evaluating whether factors such as target function difficulty, network parameterization, and number of target functions previously fit influence the network's ability to fit future target functions. Our results are shown in Figure 7, 8, and 9. We visualize rank and feature rank of the features output at the network's penultimate layer, in addition to the loss obtained at the end of each iteration.
+
+# B.3 EFFECT OF INFER ON TARGET-FITTING CAPACITY IN MNIST
+
+In addition to our study of the Atari suite, we also study the effect of InFeR on the non-stationary MNIST reward prediction task with a fully-connected architecture; see Figure 10. We find that it significantly mitigates the decline in target-fitting capacity demonstrated in Figure 1.
+
+# C ATARI EVALUATIONS
+
+We now present full evaluations of many of the quantities described in the paper, along with a study of the sensitivity of InFeR to its hyperparameters. We use the same training procedure for all of the figures in this section, loading agent parameters from checkpoints to compute the quantities shown.
+
+# C.1 HYPERPARAMETER SENSITIVITY OF INFER IN DEEP REINFORCEMENT LEARNING AGENTS
+
+We report results of hyperparameter sweeps over the salient hyperparameters relating to InFeR, so as to assess the robustness of the method. For both the DDQN and Rainbow agents augmented with InFeR, we sweep over the number of auxiliary predictions (1, 5, 10, 20), the cumulant scale used in the predictions (10, 100, 200), and the scale of the auxiliary loss (0.01, 0.05, 0.1, 0.2). We consider
+
+# Target-fitting error: smooth
+
+
+
+
+
+
+
+Figure 8: Mean squared error after 2e3 training steps on the random-MNIST task. Target-fitting error increases over time in under-parameterized networks, but increasing the depth or width of the network slows down capacity loss, enabling positive transfer in the largest network we studied.
+
+Loss Feature num. rank Feature srank
+
+
+
+
+
+# Target-fitting error: sparse
+
+
+
+
+
+
+
+Figure 9: Mean squared error after 2e3 training steps on the threshold-MNIST task. Target-fitting error increases over time in under-parameterized networks, but increasing the depth or width of the network slows down capacity loss, enabling positive transfer in the largest network we studied.
+
+Loss Feature num. rank Feature srank
+
+
+
+
+
+
+
+
+Target-fitting error on hash prediction task over time
+
+
+
+
+
+
+
+
+
+
+
+
+Target-fitting error on threshold prediction task over time
+
+
+
+
+
+
+
+
+
+
+Figure 10: Effect of adding InFeR to the regression objective in a random reward prediction problem on the non-stationary MNIST environment studied previously. We see that the InFeR objective produces networks that can consistently outperform those trained with a standard regression objective, exhibiting minimal capacity loss in comparison to the same network architecture trained on the same sequence of targets.
+
+
+Target-fitting error on random prediction task over time
+
+
+
+
+
+
+
+
+
+
+Figure 11: Hyperparameter sweeps for the DDQN+InFeR agent. Each contour plot shows average capped human-normalized score at the end of training marginalized over all hyperparameters not shown on its axes.
+
+
+
+
+
+the capped human-normalized return across four games (Montezuma's Revenge, Hero, James Bond, and MsPacman), and run each hyperparameter configuration with 3 seeds. Results are shown in Figure 11 for the DDQN agent; we compare performance as each pair of hyperparameters varies (averaging across the other hyperparameter, games, and seeds, and the last five evaluation runs of each agent). Corresponding results for Rainbow are given in Figure 12.
+
+
+Figure 12: Hyperparameter sweeps for the Rainbow+InFeR agent. Each contour plot shows average capped human-normalized score at the end of training marginalized over all hyperparameters not shown on its axes.
+
+
+
+
+
+
+
+
+Figure 13: Feature rank and performance of RL agents on demonstrative Atari environments.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+- Agent: We train a Rainbow agent (Hessel et al., 2018) with the same architecture and hyperparameters as are described in the open-source implementation made available by Quan & Ostrovski (2020). We additionally add InFeR, as described in Section 4, with 10 heads, gradient weight 0.1 and scale 100.
+- Training: We follow the training procedure found in the Rainbow implementation mentioned above. We train for 200 million frames, with 500K evaluation frames interspersed every 1M training frames. We save the agent parameters and replay buffer every 10M frames to estimate feature dimension and target-fitting capacity.
+
+# C.2 FEATURE RANK
+
+We first extend the results shown in Figure 3 to two additional games: Seaquest, and a sparsified version of Pong in which the agent does not receive negative rewards when the opponent scores. In these settings, we stored agent checkpoints once every 10M frames in each 200M frame trajectory, and used 5000 sampled inputs from the agent's replay buffer to estimate the feature rank, using the cutoff $\epsilon = 0.01$ . Results are shown in Figure 13.
+
+We further evaluate the evolution of feature rank in agents trained on all 57 games in the arcade learning environment. We find that the decline in dimension after the first checkpoint at 10M frames shown across the different agents in the selected games also occurs more generally in Rainbow agents across most environments in the Atari benchmark. We also show that in most cases adding InFeR mitigates this phenomenon. Our observations here do not show a uniform decrease in feature rank or a uniformly beneficial effect of InFeR. The waters become particularly muddied in settings where neither the Rainbow nor Rainbow+InFeR agent consistently make learning progress such as in tennis, solaris, and private eye. It is outside the scope of this work to identify precisely why the agents do not make learning progress in these settings, but it does not appear to be due to the type of representation collapse that can be effectively prevented by InFeR.
+
+Procedure. We compute the feature rank by sampling $n = 50000$ transitions from the replay buffer and take the set of origin states as the input set. We then compute a $n \times d$ matrix whose row $i$ is given by the output of the penultimate layer of the neural network given input $S_{i}$ . We then take the singular value decomposition of this matrix and count the number of singular values greater than 0.01 to get an estimate of the dimension of the network's representation layer.
+
+In most games, we see a decline in feature rank after the first checkpoint at 10M frames. Strikingly, this decline in dimension holds even in the online RL setting where the agent's improving policy presumably leads it to observe a more diverse set of states over time, which under a fixed representation would tend to increase the numerical rank of the feature matrix. This indicates that even in the face of increasing state diversity, agents' representations face strong pressure towards degeneracy. It is worth noting, however, that the agents in dense-reward games do tend to see their feature rank increase significantly early in training; this is presumably due to the network initially learning to disentangle the visually similar states that yield different bootstrap targets.
+
+
+Figure 14: feature rank of agent representations over the course of training on all 57 games in the Atari benchmark. We compare Rainbow against Rainbow+InFeR. Rainbow+InFeR does not uniformly prevent decreases in feature rank across all games, but on average it has a beneficial effect on preserving representation dimension.
+
+# C.3 TARGET-FITTING CAPACITY
+
+In this section we examine the target-fitting capacity of neural networks trained with DQN, QR-DQN, and Rainbow over the course of 50 million environment frames on five games in the Atari benchmark (amidar, montezuma's revenge, pong, bowling, and hero). Every 1 million training frames we save a checkpoint of the neural network weights and replay buffer. For each checkpoint, we generate a random target network by initializing network weights with a new random seed. We then train the checkpoint network to predict the output of this random target network for 10000 mini-batch updates (batch size of 32) under a mean squared error loss, for states sampled from the first 100,000 frames in the checkpoint's replay buffer. Furthermore, we repeat this for 10 seeds used to initialize the random target network weights.
+
+The results of this experiment are shown in Figure 15 (in orange), where the solid lines show means and shaded regions indicate standard deviations over all seeds (both agent seeds (5) and target fitting seeds (10), for a total of 50 trials). We also show srank and feature rank of the features output at the network's penultimate layer for each of the checkpointed networks used for target fitting. These are computed using the network features generated from 1000 states sampled randomly from that checkpoint's replay buffer. For feature rank, averages and standard deviations are only over the 5 agent seeds.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Figure 15: Mean squared error, after 10000 training steps for the target-fitting on random network targets. We also show the corresponding feature rank of the pre-trained neural network (before target-fitting).
+
+
+Loss Feature num. rank Feature srank
+
+
+
+
+
+
+
+# C.4 PERFORMANCE
+
+We provide full training curves for both Rainbow and Rainbow+InFeR on all games in Figures 16 & 17 (capped human-normalized performance), and 18 & 19 (raw evaluation score). We also provide evaluation performance curves for DDQN and DDQN+InFeR agents in Figure 20.
+
+
+Figure 16: Full evaluation of capped human-normalized performance on Atari benchmarks for the default Rainbow architecture.
+
+
+Figure 17: Full evaluation of capped human-normalized performance on Atari benchmarks in the double-width Rainbow architecture.
+
+
+Figure 18: Full evaluation of raw scores on Atari benchmarks for the default Rainbow architecture.
+
+
+Figure 19: Full evaluation of raw scores on Atari benchmarks for the double-width Rainbow architecture.
+
+
+Figure 20: Evaluations of the effect of InFeR on performance of a Double DQN agent. Overall we do not see as pronounced an improvement as in Rainbow, but note that the average human-normalized score over the entire benchmark is nonetheless slightly higher for the InFeR agent, and that the performance improvement obtained by InFeR in Montezuma's Revenge is still significant in this agent.
\ No newline at end of file
diff --git a/understandingandpreventingcapacitylossinreinforcementlearning/images.zip b/understandingandpreventingcapacitylossinreinforcementlearning/images.zip
new file mode 100644
index 0000000000000000000000000000000000000000..8033f9d313680b82089a42f0c9d4f89351cf46c8
--- /dev/null
+++ b/understandingandpreventingcapacitylossinreinforcementlearning/images.zip
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:7594b106d08b5ce44726f8516aa14783e67a71a711031ebe0cff6f99852a7785
+size 2155547
diff --git a/understandingandpreventingcapacitylossinreinforcementlearning/layout.json b/understandingandpreventingcapacitylossinreinforcementlearning/layout.json
new file mode 100644
index 0000000000000000000000000000000000000000..8db35fe4cb0f4af5eb797a19bd1e366cf0d3eefd
--- /dev/null
+++ b/understandingandpreventingcapacitylossinreinforcementlearning/layout.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5dac9d4263b10da62c5e5dc7d3f522b54633295b71031287cbe078649323d05d
+size 657190
diff --git a/understandinglatentcorrelationbasedmultiviewlearningandselfsupervisionanidentifiabilityperspective/2d3fc944-401f-4422-a5dd-600a142ba32a_content_list.json b/understandinglatentcorrelationbasedmultiviewlearningandselfsupervisionanidentifiabilityperspective/2d3fc944-401f-4422-a5dd-600a142ba32a_content_list.json
new file mode 100644
index 0000000000000000000000000000000000000000..024731ebd20e56ef393230ddb50828e5d48cd07c
--- /dev/null
+++ b/understandinglatentcorrelationbasedmultiviewlearningandselfsupervisionanidentifiabilityperspective/2d3fc944-401f-4422-a5dd-600a142ba32a_content_list.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0d9a4d4b0cc7052a4c035154e3dede2986d96cd94eea0d2a0b00091177ad4a19
+size 272088
diff --git a/understandinglatentcorrelationbasedmultiviewlearningandselfsupervisionanidentifiabilityperspective/2d3fc944-401f-4422-a5dd-600a142ba32a_model.json b/understandinglatentcorrelationbasedmultiviewlearningandselfsupervisionanidentifiabilityperspective/2d3fc944-401f-4422-a5dd-600a142ba32a_model.json
new file mode 100644
index 0000000000000000000000000000000000000000..8b9217ba2884e4d3e8cdaec1d97c7bce3ec44b16
--- /dev/null
+++ b/understandinglatentcorrelationbasedmultiviewlearningandselfsupervisionanidentifiabilityperspective/2d3fc944-401f-4422-a5dd-600a142ba32a_model.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4906cff60302d9a41f10e185db86d1bbfba1ec7cef4d09c00e8cb5f09f19da21
+size 314620
diff --git a/understandinglatentcorrelationbasedmultiviewlearningandselfsupervisionanidentifiabilityperspective/2d3fc944-401f-4422-a5dd-600a142ba32a_origin.pdf b/understandinglatentcorrelationbasedmultiviewlearningandselfsupervisionanidentifiabilityperspective/2d3fc944-401f-4422-a5dd-600a142ba32a_origin.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..1b22410bfa2fd3160e7f8541903bd24e296db900
--- /dev/null
+++ b/understandinglatentcorrelationbasedmultiviewlearningandselfsupervisionanidentifiabilityperspective/2d3fc944-401f-4422-a5dd-600a142ba32a_origin.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:66f0287dd1cad2315dd04901d9385bf410cbcec47b003f17937691574bed1574
+size 1789389
diff --git a/understandinglatentcorrelationbasedmultiviewlearningandselfsupervisionanidentifiabilityperspective/full.md b/understandinglatentcorrelationbasedmultiviewlearningandselfsupervisionanidentifiabilityperspective/full.md
new file mode 100644
index 0000000000000000000000000000000000000000..8800162c9898d946dec9c1a4d50b1b9dd8f88036
--- /dev/null
+++ b/understandinglatentcorrelationbasedmultiviewlearningandselfsupervisionanidentifiabilityperspective/full.md
@@ -0,0 +1,1279 @@
+# UNDERSTANDING LATIVE CORRELATION-BASED MULTIVIEW LEARNING AND SELF-SUPERVISION: AN IDENTIFIABILITY PERSPECTIVE
+
+Qi Lyu
+
+School of EECS
+
+Oregon State Univ.
+
+Xiao Fu*
+
+School of EECS
+
+Oregon State Univ.
+
+Weiran Wang
+
+Google Inc.
+
+Mountain View
+
+Songtao Lu
+
+IBM Research
+
+Yorktown Heights
+
+# ABSTRACT
+
+Multiple views of data, both naturally acquired (e.g., image and audio) and artificially produced (e.g., via adding different noise to data samples), have proven useful in enhancing representation learning. Natural views are often handled by multiview analysis tools, e.g., (deep) canonical correlation analysis [(D)CCA], while the artificial ones are frequently used in self-supervised learning (SSL) paradigms, e.g., BYOL and Barlow Twins. Both types of approaches often involve learning neural feature extractors such that the embeddings of data exhibit high cross-view correlations. Although intuitive, the effectiveness of correlation-based neural embedding is mostly empirically validated. This work aims to understand latent correlation maximization-based deep multiview learning from a latent component identification viewpoint. An intuitive generative model of multiview data is adopted, where the views are different nonlinear mixtures of shared and private components. Since the shared components are view/distortion-invariant, representing the data using such components is believed to reveal the identity of the samples effectively and robustly. Under this model, latent correlation maximization is shown to guarantee the extraction of the shared components across views (up to certain ambiguities). In addition, it is further shown that the private information in each view can be provably disentangled from the shared using proper regularization design. A finite sample analysis, which has been rare in nonlinear mixture identifiability study, is also presented. The theoretical results and newly designed regularization are tested on a series of tasks.
+
+# 1 INTRODUCTION
+
+One pillar of unsupervised representation learning is multiview learning. Extracting shared information from multiple "views" (e.g., image and audio) of data entities has been considered a major means to fend against noise and data scarcity. A key computational tool for multiview learning is canonical correlation analysis (CCA) (Hotelling, 1936). The classic CCA seeks linear transformation matrices such that transformed views are maximally correlated. A number of works studied nonlinear extensions of CCA; see kernel CCA in (Lai & Fyfe, 2000) and deep learning-based CCA (DCCA) in (Andrew et al., 2013; Wang et al., 2015). DCCA and its variants were shown to largely outperform the classical linear CCA in many tasks.
+
+In recent years, a series of self-supervised learning (SSL) paradigms were proposed. These SSL approaches exhibit a lot of similarities with DCCA approaches, except that the "views" are noisy data "augmented" from the original clean data. To be specific, different views are generated by distorting data—e.g., using rotating, cropping, and/or adding noise to data samples (Dosovitskiy et al., 2015; Gidaris et al., 2018; Chen et al., 2020; Grill et al., 2020). Then, neural encoders are employed to map these artificial views to embeddings that are highly correlated across views. This genre—which will be referred to as artificial multiview SSL (AM-SSL)—includes some empirically successful frameworks, e.g., BYOL (Grill et al., 2020) and Barlow Twins (Zbontar et al., 2021).
+
+Notably, many DCCA and AM-SSL approaches involve (explicitly or implicitly) searching for highly correlated representations from multiple views, using neural feature extractors (encoders). The empirical success of DCCA and AM-SSL bears an important research question: How to understand the role of cross-view correlation in deep multiview learning? Furthermore, how to use such understanding to design theory-backed learning criteria to serve various purposes?
+
+Intuitively, it makes sense that many DCCA and AM-SSL paradigms involve latent correlation maximization in their loss functions, as such loss functions lead to similar/identical representations from different views—which identifies view-invariant essential information that is often identity-revealing. However, beyond intuition, theoretical support of latent correlation-based deep multiview learning had been less studied, until recent works started exploring this direction in both nonlinear CCA and AM-SSL (see, e.g., (Lyu & Fu, 2020; Von Kugelgen et al., 2021; Zimmermann et al., 2021; Tian et al., 2021; Saunshi et al., 2019; Tosh et al., 2021)), but more insights and theoretical underpinnings remain to be discovered under more realistic and challenging settings. In this work, we offer an understanding to the role of latent correlation maximization that is seen in a number of DCCA and AM-SSL systems from a nonlinear mixture learning viewpoint—and use such understanding to assist various learning tasks, e.g., clustering, cross-view translation, and cross-sample generation. Our detailed contributions are:
+
+(i) Understanding Latent Correlation Maximization - Shared Component Identification. We start with a concept that has been advocated in many multiview learning works. In particular, the views are nonlinear mixtures of shared and private latent components; see, e.g., (Huang et al., 2018; Lee et al., 2018; Wang et al., 2016). The shared components are distortion/view invariant and identity-revealing. The private components and view-specific nonlinear mixing processes determine the different appearances of the views. By assuming independence between the shared and private components and invertibility of the data generating process, we show that maximizing the correlation of latent representations extracted from different views leads to identification of the ground-truth shared components up to invertible transformations.
+
+(ii) Imposing Additional Constraints - Private Component Identification. Using the understanding to latent correlation maximization-type loss functions in DCCA and AM-SSL, we take a step further. We show that with carefully imposed constraints, the private components in the views can also be identified, under reasonable assumptions. Learning private components can facilitate tasks such as cross-view and cross-sample data generation (Huang et al., 2018; Lee et al., 2018).
+
+(iii) Finite-Sample Analysis. Most existing unsupervised nonlinear mixture identification works, e.g., those from the nonlinear independent component analysis (ICA) literature (Hyvarinen & Morioka, 2016; 2017; Hyvarinen et al., 2019; Khemakhem et al., 2020; Locatello et al., 2020; Gresele et al., 2020), are based on infinite data. This is perhaps because finite sample analysis for unsupervised learning is generally much more challenging relative to supervised cases—and there is no existing "universal" analytical tools. In this work, we provide sample complexity analysis for the proposed unsupervised multiview learning criterion. We come up with a success metric for characterizing the performance of latent component extraction, and integrate generalization analysis and numerical differentiation to quantify this metric. To our best knowledge, this is the first finite-sample analysis of nonlinear mixture model-based multiview unsupervised learning.
+
+(iv) Practical Implementation. Based on the theoretical understanding, we propose a latent correlation-maximization based multiview learning criterion for extracting both the shared components and private components. To realize the criterion, a notable innovation is a minimax neural regularizer that serves for extracting the private components. The regularizer shares the same purpose of some known independence promoters (e.g., Hilbert-Schmidt Independence Criterion (HSIC) (Gretton et al., 2007)) but is arguably easier to implement using stochastic gradient algorithms.
+
+Notation. The notations used in this work are summarized in the supplementary material.
+
+# 2 BACKGROUND: LATENT CORRELATION IN DCCA AND AM-SSL
+
+In this section, we briefly review some deep multiview learning paradigms that use latent correlation maximization and its close relatives.
+
+# 2.1 LATENT CORRELATION MAXIMIZATION IN DCCA
+
+DCCA methods aim at extracting common information from multiple views of data samples. Such information is expected to be informative and essential in representing the data.
+
+DCCA. The objective of DCCA can be summarized as follows (Andrew et al., 2013):
+
+$$
+\underset {\boldsymbol {f} ^ {(1)}, \boldsymbol {f} ^ {(2)}} {\text {m a x i m i z e}} \operatorname {T r} \left(\mathbb {E} \left[ \boldsymbol {f} ^ {(1)} \left(\boldsymbol {x} ^ {(1)}\right) \boldsymbol {f} ^ {(2)} \left(\boldsymbol {x} ^ {(2)}\right) ^ {\top} \right]\right), \quad \text {s . t .} \mathbb {E} \left[ \boldsymbol {f} ^ {(q)} \left(\boldsymbol {x} ^ {(q)}\right) \boldsymbol {f} ^ {(q)} \left(\boldsymbol {x} ^ {(q)}\right) ^ {\top} \right] = \boldsymbol {I}, \tag {1}
+$$
+
+where $\pmb{x}^{(q)}\in \mathbb{R}^{M_q}\sim \mathcal{D}_q$ is a data sample from view $q$ for $q = 1,2,\mathcal{D}_q$ is the underlying distribution of the qth view, $\pmb{f}^{(1)}:\mathbb{R}^{M_1}\to \mathbb{R}^D$ and $\pmb{f}^{(2)}:\mathbb{R}^{M_2}\to \mathbb{R}^D$ are two neural networks. CCA was found particularly useful in fending against unknown and strong view-specific (private) interference (see theoretical supports in (Bach & Jordan, 2005; Ibrahim & Sidiropoulos, 2020)). Such properties were also observed in DCCA research (Wang et al., 2015), while theoretical analysis is mostly elusive.
+
+An equivalent representation of (1) is as follows
+
+$$
+\underset {\boldsymbol {f} ^ {(1)}, \boldsymbol {f} ^ {(2)}} {\text {m i n i m i z e}} \mathbb {E} \left[ \left\| \boldsymbol {f} ^ {(1)} \left(\boldsymbol {x} ^ {(1)}\right) - \boldsymbol {f} ^ {(2)} \left(\boldsymbol {x} ^ {(2)}\right) \right\| _ {2} ^ {2} \right], \quad \text {s . t .} \mathbb {E} \left[ \boldsymbol {f} ^ {(q)} \left(\boldsymbol {x} ^ {(q)}\right) \boldsymbol {f} ^ {(q)} \left(\boldsymbol {x} ^ {(q)}\right) ^ {\top} \right] = \boldsymbol {I}, \tag {2}
+$$
+
+which is expressed from latent component matching perspective. Both the correlation maximization form in (1) and the component matching form in (2) are widely used in the literature. As we will see in our proofs, although the former is popular in the literature (Andrew et al., 2013; Wang et al., 2015; Chen et al., 2020), the latter is handier for theoretical analysis.
+
+- Slack Variable-Based DCCA. In (Benton et al., 2017) and (Lyu & Fu, 2020), a deep multiview learning criterion is used:
+
+$$
+\underset {\boldsymbol {f} ^ {(q)}} {\text {m i n i m i z e}} \sum_ {q = 1} ^ {2} \mathbb {E} \left[ \left\| \boldsymbol {f} ^ {(q)} \left(\boldsymbol {x} ^ {(q)}\right) - \boldsymbol {g} \right\| ^ {2} \right], \text {s . t .} \mathbb {E} [ | g _ {i} | ^ {2} ] = 1, \mathbb {E} [ g _ {i} g _ {j} ] = 0. \tag {3}
+$$
+
+The slack variable $\pmb{g}$ represents the common latent embedding learned from the two views. Conceptually, this is also latent correlation maximization (or latent component matching). To see this, assume that there exists $\pmb{f}^{(q)}(\pmb{x}^{(q)}) = \pmb{g}$ for all $\pmb{x}^{(q)}$ . The criterion amounts to learning $[f^{(1)}(\pmb{x}^{(1)})]_k = [f^{(2)}(\pmb{x}^{(2)})]_k$ which has the maximally attainable correlation.
+
+# 2.2 LATENT CORRELATION MAXIMIZATION/COMPONENT MATCHING IN AM-SSL
+
+Similar to DCCA, the goal of AM-SSL is also to find identity-revealing embeddings of data samples without using labels. The idea is often realized via intentionally distorting the data to create multiple artificial views. Then, the encoders are required to produce highly correlated (or closely matched) embeddings from such views. In AM-SSL, the views $\boldsymbol{x}^{(1)}$ and $\boldsymbol{x}^{(2)}$ are different augmentations (e.g., by adding noise, cropping, and rotation) of the sample $\boldsymbol{x}$ .
+
+- Barlow Twins. The most recent development, namely, the Barlow Twins network (Zbontar et al., 2021) is appealing since it entails a succinct implementation. Specifically, the Barlow Twins network aims to learn a single encoder $\pmb{f}:\mathbb{R}^{M}\to \mathbb{R}^{D}$ for two distorted views. The cost function is as follows:
+
+$$
+\underset {\boldsymbol {f}} {\text {m i n i m i z e}} \sum_ {i = 1} ^ {D} (1 - C _ {i i}) ^ {2} + \lambda \sum_ {i = 1} ^ {D} \sum_ {j \neq i} ^ {D} C _ {i j} ^ {2}, \text {w h e r e} C _ {i j} = \frac {\mathbb {E} \left[ [ \boldsymbol {f} (\boldsymbol {x} ^ {(1)}) ] _ {i} [ \boldsymbol {f} (\boldsymbol {x} ^ {(2)}) ] _ {j} \right]}{\sqrt {\mathbb {E} [ [ \boldsymbol {f} (\boldsymbol {x} ^ {(1)}) ] _ {i} ^ {2} ]} \sqrt {\mathbb {E} [ [ \boldsymbol {f} (\boldsymbol {x} ^ {(2)}) ] _ {j} ^ {2} ]}}.
+$$
+
+When the learned embeddings are constrained to have zero mean, i.e., $\mathbb{E}\left[\pmb {f}(\pmb{x}^{(q)})\right] = \mathbf{0}$ , $C_{ij}$ is the cross-correlation between $\pmb {f}(\pmb{x}^{(1)})$ and $\pmb {f}(\pmb{x}^{(2)})$ . Note that the normalized representation of cross-correlation in $C_{ij}$ is equivalent to the objective in (1) with the orthogonality constraints.
+
+- BYOL. The BYOL method (Grill et al., 2020) uses a cross-view matching criterion that can be distilled as follows:
+
+$$
+\underset {\boldsymbol {f} ^ {(1)}, \boldsymbol {f} ^ {(2)}} {\text {m i n i m i z e}} \mathbb {E} \left[ \left\| \overline {{\boldsymbol {f}}} ^ {(1)} (\boldsymbol {x} ^ {(1)}) - \overline {{\boldsymbol {f}}} ^ {(2)} (\boldsymbol {x} ^ {(2)}) \right\| _ {2} ^ {2} \right] \tag {4}
+$$
+
+where $\overline{\pmb{f}}^{(q)}(\cdot)$ means that the output of the network is normalized. In BYOL, the networks are constructed in a special way (e.g., part of $\pmb{f}^{(2)}$ 's weights are moving averages of the correspond part of $\pmb{f}^{(1)}$ 's weights). Nonetheless, the cross-view matching perspective is still very similar to that in latent component matching in (2).
+
+- SimSiam. The loss function of SimSiam (Chen & He, 2021) has a similar structure as that of BYOL, but with a Siamese network, which, essentially, is also latent component matching.
+
+# 3 UNDERSTANDING LATENT CORRELATION MAXIMIZATION
+
+In this section, we offer understandings to latent correlation maximization (and latent component matching) from an unsupervised nonlinear multiview mixture identification viewpoint. We will also show that such understanding can help improve multiview learning criteria to serve different purposes, e.g., cross-view and cross-sample data generation.
+
+# 3.1 MULTIVIEW AS NONLINEAR MIXTURES OF PRIVATE AND SHARED COMPONENTS
+
+We consider the following multiview generative model:
+
+$$
+\boldsymbol {x} _ {\ell} ^ {(1)} = \boldsymbol {g} ^ {(1)} \left(\left[ \begin{array}{l} \boldsymbol {z} _ {\ell} \\ \boldsymbol {c} _ {\ell} ^ {(1)} \end{array} \right]\right), \boldsymbol {x} _ {\ell} ^ {(2)} = \boldsymbol {g} ^ {(2)} \left(\left[ \begin{array}{l} \boldsymbol {z} _ {\ell} \\ \boldsymbol {c} _ {\ell} ^ {(2)} \end{array} \right]\right), \tag {5}
+$$
+
+where $\pmb{x}_{\ell}^{(q)} \in \mathbb{R}^{M_q}$ is the $\ell$ th sample of the $q$ th view for $q = 1,2$ , $\pmb{z}_{\ell} \in \mathbb{R}^{D}$ is the shared component across views, and $\pmb{c}_{\ell}^{(q)} \in \mathbb{R}^{D_q}$ represents the private information of the $q$ th view—which are the $\ell$ th samples of continuous random variables denoted by $z \in \mathbb{R}^{D}$ , $\pmb{c}^{(q)} \in \mathbb{R}^{D_q}$ , respectively. In addition, $g^{(q)}(\cdot): \mathbb{R}^{D + D_q} \to \mathbb{R}^{M_q}$ is an invertible and smooth nonlinear transformation, which is unknown. Additional notes on (5) and the shared-private component-based modeling idea in the literature can be found in the supplementary materials (Appendix H). We will use the following assumption:
+
+Assumption 1 (Group Independence) Under (5), the samples $\mathbf{z}_{\ell}$ and $\mathbf{c}_{\ell}^{(q)}$ are realizations of continuous latent random variables $\mathbf{z}$ , $\mathbf{c}^{(q)}$ for $q = 1,2$ , whose joint distributions satisfy the following:
+
+$$
+\boldsymbol {z} \sim p (\boldsymbol {z}), \boldsymbol {c} ^ {(q)} \sim p (\boldsymbol {c} ^ {(q)}), \boldsymbol {z} \in \mathcal {Z}, \boldsymbol {c} ^ {(q)} \in \mathcal {C} _ {q}, \quad p (\boldsymbol {z}, \boldsymbol {c} ^ {(1)}, \boldsymbol {c} ^ {(2)}) = p (\boldsymbol {z}) p (\boldsymbol {c} ^ {(1)}) p (\boldsymbol {c} ^ {(2)}), \tag {6}
+$$
+
+where $\mathcal{Z} \subseteq \mathbb{R}^D$ , $\mathcal{C}_q \subseteq \mathbb{R}^{D_q}$ are the continuous supports of $p(z)$ and $p(c^{(q)})$ , respectively.
+
+Assumption 1 is considered reasonable under both AM-SSL and DCCA settings. For AM-SSL, the private information can be understood as random data augmentation noise-induced components, and thus it makes sense to assume that such noise is independent with the shared information (which corresponds to the identity-revealing components of the data sample). In DCCA problems, the private style information can change drastically from view to view (e.g., audio, text, video) without changing the shared content information (e.g., identity of the entity)—which also shows independence between the two parts. In our analysis, we will assume that $D$ and $D_q$ are known to facilitate exposition. In practice, these parameters are often selected using a validation set.
+
+Learning Goals. Our interest lies in extracting $\boldsymbol{z}_{\ell}$ and $c_{\ell}^{(q)}$ (up to certain ambiguities) from the views in an unsupervised manner. In particular, we hope to answer under what conditions these latent components can be identified—and to what extent. As mentioned, $\boldsymbol{z}_{\ell}$ is view/distortion-invariant and thus should be identity-revealing. The ability of extracting it may explain DCCA and AM-SSL's effectiveness. In addition, the identification of $c_{\ell}^{(q)}$ and the mixing processes may help generate data in different views.
+
+# 3.2 A LATENT CORRELATION-BASED LEARNING CRITERION
+
+Given observations from both views $\{\pmb{x}_{\ell}^{(1)},\pmb{x}_{\ell}^{(2)}\}_{\ell = 1}^{N}$ generated from (5), we aim to understand how latent correlation maximization (or latent component matching) helps with our learning goals. To
+
+this end, we consider the following problem criterion:
+
+$$
+\underset {\boldsymbol {f} ^ {(1)}, \boldsymbol {f} ^ {(2)}} {\text {m a x i m i z e}} \operatorname {T r} \left(\frac {1}{N} \sum_ {\ell = 1} ^ {N} \boldsymbol {f} _ {\mathrm {S}} ^ {(1)} \left(\boldsymbol {x} _ {\ell} ^ {(1)}\right) \boldsymbol {f} _ {\mathrm {S}} ^ {(2)} \left(\boldsymbol {x} _ {\ell} ^ {(2)}\right) ^ {\top}\right) \tag {7a}
+$$
+
+subject to $\pmb{f}^{(q)}$ for $q = 1,2$ are invertible, (7b)
+
+$$
+\frac {1}{N} \sum_ {\ell = 1} ^ {N} \boldsymbol {f} _ {\mathrm {S}} ^ {(q)} \left(\boldsymbol {x} _ {\ell} ^ {(q)}\right) \boldsymbol {f} _ {\mathrm {S}} ^ {(q)} \left(\boldsymbol {x} _ {\ell} ^ {(q)}\right) ^ {\top} = \boldsymbol {I}, \frac {1}{N} \sum_ {\ell = 1} ^ {N} \boldsymbol {f} _ {\mathrm {S}} ^ {(q)} \left(\boldsymbol {x} _ {\ell} ^ {(q)}\right) = \mathbf {0}, q = 1, 2, \tag {7c}
+$$
+
+$$
+\boldsymbol {f} _ {\mathrm {S}} ^ {(q)} \left(\boldsymbol {x} _ {\ell} ^ {(q)}\right) \perp \boldsymbol {f} _ {\mathrm {P}} ^ {(q)} \left(\boldsymbol {x} _ {\ell} ^ {(q)}\right), q = 1, 2, \tag {7d}
+$$
+
+where $\pmb{f}^{(q)}: \mathbb{R}^{M_q} \to \mathbb{R}^{D + D_q}$ for $q = 1,2$ are the feature extractors of view $q$ . We use the notations
+
+$$
+\pmb {f} _ {\mathrm {S}} ^ {(q)} (\pmb {x} _ {\ell} ^ {(q)}) = [ \pmb {f} ^ {(q)} (\pmb {x} _ {\ell} ^ {(q)}) ] _ {1: D}, \pmb {f} _ {\mathrm {P}} ^ {(q)} (\pmb {x} _ {\ell} ^ {(q)}) = [ \pmb {f} ^ {(q)} (\pmb {x} _ {\ell} ^ {(q)}) ] _ {D + 1: D + D _ {q}}, q = 1, 2,
+$$
+
+to denote the encoder-extracted shared and private components for each view, respectively. Note that designating the first $D$ dimensions of the encoder outputs to represent the shared information is without loss of generality, since the permutation ambiguity is intrinsic.
+
+The correlation maximization objective is reminiscent of the criteria of learning paradigms such as DCCA and Barlow Twins. In addition, under the constraints in (7), the objective function is also equivalent to shared component matching that is similar to those used by BYOL and SimSiam, i.e.,
+
+$$
+\max _ {\boldsymbol {f} ^ {(q)}} \operatorname {T r} \left(\frac {1}{N} \sum_ {\ell = 1} ^ {N} \boldsymbol {f} _ {\mathrm {S}} ^ {(1)} (\boldsymbol {x} _ {\ell} ^ {(1)}) \boldsymbol {f} _ {\mathrm {S}} ^ {(2)} (\boldsymbol {x} _ {\ell} ^ {(2)}) ^ {\top}\right) \Longleftrightarrow \min _ {\boldsymbol {f} ^ {(q)}} \frac {1}{N} \sum_ {\ell = 1} ^ {N} \left\| \boldsymbol {f} _ {\mathrm {S}} ^ {(1)} (\boldsymbol {x} _ {\ell} ^ {(1)}) - \boldsymbol {f} _ {\mathrm {S}} ^ {(2)} (\boldsymbol {x} _ {\ell} ^ {(2)}) \right\| _ {2} ^ {2}.
+$$
+
+To explain the criterion, note that we have a couple of goals that we hope to achieve with $f_{\mathrm{S}}^{(q)}$ and $f_{\mathrm{P}}^{(q)}$ . First, the objective function aims to maximize the latent correlation of the learned shared components, i.e., $f_{\mathrm{S}}^{(q)}$ . This is similar to those in DCCA and AM-SSL, and is based on the belief that the shared information should be identical across views. Second, in (7d), we ask $f_{\mathrm{S}}^{(q)}$ and $f_{\mathrm{P}}^{(q)}$ to be statistically independent for $q = 1,2$ . This promotes the disentanglement of the shared and private parts of each encoder, following in Assumption 1. Third, the invertibility constraint in (7b) is to ensure that the latent and the ambient data can be constructed from each other—which is often important in unsupervised learning, for avoiding trivial solutions; see, e.g., (Hyvarinen et al., 2019; Von Kugelgen et al., 2021). The orthogonality and zero-mean constraints in (7c) are used to make the correlation metric meaningful. In particular, if the learned components are not zero-mean, the learned embeddings may not capture "co-variations" but dominated by some constant terms.
+
+# 3.3 THEORETICAL UNDERSTANDING
+
+We have the following theorem in terms of learning the shared components:
+
+Theorem 1 (Shared Component Extraction) Under the generative model in (5) and Assumption 1, consider the population form in (7) (i.e., $N = \infty$ ). Assume that the considered constraints hold over all $\pmb{x}^{(q)} \in \mathcal{X}_q$ for $q = 1,2$ , where $\mathcal{X}_q = \{\pmb{x}^{(q)} | \pmb{x}^{(q)} = \pmb{g}^{(q)}([z^\top, (\pmb{c}^{(q)})^\top]^\top), \forall z \in \mathcal{Z}, \forall \pmb{c}^{(q)} \in \mathcal{C}_q\}$ . Denote $\widehat{\pmb{f}}^{(q)}$ as any solution of (7). Also assume that the first-order derivative of $\widehat{\pmb{f}}^{(q)} \circ \pmb{g}^{(q)}$ exists. Then, we have $\widehat{\pmb{z}} = \widehat{\pmb{f}}_{\mathrm{S}}^{(q)}(\pmb{x}^{(q)}) = \gamma(\pmb{z})$ no matter if (7d) is enforced or not, where $\gamma(\cdot): \mathbb{R}^D \to \mathbb{R}^D$ is an unknown invertible function.
+
+A remark is that $\widehat{z} = \gamma(z)$ has all the information of $z$ due to the invertibility of $\gamma(\cdot)$ . Theorem 1 clearly indicates that latent correlation maximization/latent component matching can identify the view/distortion-invariant information contained in multiple views under unknown nonlinear distortions. This result may explain the reason why many DCCA and AM-SSL schemes use latent correlation maximization/latent component matching as part of their objectives. Theorem 1 also indicates that if one only aims to extract $z$ , the constraint in (7d) is not needed. In the next theorem, we show that our designed constraint in (7d) can help disentangle the shared and private components:
+
+Theorem 2 (Private Component Extraction) Under the same conditions as in Theorem 1, also assume that (7d) is enforced. Then, we further have $\widehat{\pmb{c}}^{(q)} = \widehat{\pmb{f}}_{\mathrm{P}}^{(q)}(\pmb{x}^{(q)}) = \pmb{\delta}^{(q)}(\pmb{c}^{(q)})$ , where $\pmb{\delta}^{(q)}(\cdot):\mathbb{R}^{D_q}\to \mathbb{R}^{D_q}$ is an unknown invertible function.
+
+Note that separating $z$ and $c^{(q)}$ may be used for other tasks such as cross-view translation (Huang et al., 2018; Lee et al., 2018) and content/style disentanglement.
+
+The above theorems are based on the so-called population case (with $N = \infty$ and the $\mathcal{X}_q$ observed). This is similar to the vast majority of provable nonlinear ICA/factor disentanglement literature; see (Hyvarinen & Morioka, 2016; Hyvarinen et al., 2019; Locatello et al., 2020; Khemakhem et al., 2020). It is of interest to study the finite sample case. In addition, most of these works assumed that the learning function $\pmb{f}^{(q)}$ is a universal function approximator. In practice, considering $\pmb{f}^{(q)} \in \mathcal{F}$ , where $\mathcal{F}$ is a certain restricted function class that may have mismatches with $\pmb{g}^{(q)}$ 's function class, is meaningful. To proceed, we assume $D_{1} = D_{2}$ and $M = M_{1} = M_{2}$ for notation simplicity and:
+
+Assumption 2 Assume the following conditions hold:
+
+(a) We have $\pmb{g}^{(q)} \in \mathcal{G}$ and learn $\pmb{f}^{(q)}$ from $\mathcal{F}$ , where the function classes $\mathcal{F}$ and $\mathcal{G}$ are third-order differentiable and bounded.
+(b) The Rademacher complexity (Bartlett & Mendelson, 2002) of $\mathcal{F}' = \{\pmb{f}_d : \mathbb{R}^M \to \mathbb{R} | \pmb{f}_d(\pmb{x}) = [\pmb{f}(\pmb{x})]_d, \pmb{f} \in \mathcal{F}\}$ is bounded by $\Re_N$ given $N$ samples.
+(c) Define $\mathcal{G}^{-1} = \left\{\pmb {u}:\mathbb{R}^M\to \mathbb{R}^{D + D_1}|\pmb {u}_{\mathrm{S}}(\pmb {x}) = \pmb {\gamma}(\pmb {z}),\pmb {u}_{\mathrm{S}}(\pmb {x}) = [\pmb {u}(\pmb {x})]_{1:D}\right\} \forall \pmb {x}\in \mathcal{X}_q$ and any invertible $\pmb {\gamma}(\cdot)$ . There exists $\pmb {f}\in \mathcal{F}$ such that $\sup_{\pmb {x}\in \mathcal{X}_q}\| \pmb {f}_{\mathrm{S}}(\pmb {x}) - \pmb {u}_{\mathrm{S}}(\pmb {x})\| _2\leq \nu$
+(d) Any third-order partial derivative of $[\pmb{h}^{(q)}(\pmb{x})]_d = [\pmb{f}^{(q)} \circ \pmb{g}^{(q)}(\pmb{x})]_d$ resides in $[-C_d, C_d]$ for all $\pmb{x} \in \mathcal{X}_q$ . In addition, $[\pmb{c}^{(q)}]_j \in [-C_p, C_p]$ with $0 < C_p < \infty$ for $j \in [D_q]$ .
+
+Assumption 2 specifies some conditions of the function class $\mathcal{F}$ where the learning functions are chosen from. Specifically, (a) and (d) mean that the learning function is sufficiently smooth (i.e., with bounded third-order derivatives); (b) means that the learning function is not overly complex (i.e., with a bounded Rademacher complexity); and (c) means that the learning function should be expressive enough to approximate the inverse of the generative function.
+
+Theorem 3 (Sample Complexity) Under the generative model in (5), Assumption 1 and the suite of conditions in Assumption 2, assume that $(\pmb{x}_{\ell}^{(1)},\pmb{x}_{\ell}^{(2)})$ for $\ell = 1,\dots ,N$ are i.i.d. samples of $(\pmb{x}^{(1)},\pmb{x}^{(2)})$ . Denote $\widehat{\pmb{f}}^{(q)}$ as any solution of (7) with the invertibility constraint satisfied. Then, we have the following holds with probability of at least $1 - \delta$ :
+
+$$
+\mathbb {E} \left[ \sum_ {i = 1} ^ {D} \sum_ {j = 1} ^ {D _ {q}} \left(\partial \left[ \hat {\boldsymbol {f}} _ {\mathrm {S}} \left(\boldsymbol {x} ^ {(q)}\right) \right] _ {i} / \partial_ {c _ {j} ^ {(q)}}\right) ^ {2} \right] = O \left(\left(D \Re_ {N} + \sqrt {\log (1 / \delta) / N} + \nu^ {2}\right) ^ {2 / 3}\right) \tag {8}
+$$
+
+for any $\pmb{c}^{(q)} \in \mathcal{C}_q$ such that $-C_p + \kappa_j \leq c_j^{(q)} \leq C_p - \kappa_j$ for all $j \in [D_q]$ and all $i \in [D]$ , where $\kappa_j = \Omega((3 / C_d)^{1/3}(4C_f(2D\Re_N + C_f\sqrt{\log(1/\delta)/2N}) + 4\nu^2)^{1/6})$ .
+
+If the metric on the left hand side of (8) is zero, then $\widehat{f}_{\mathrm{S}}(\boldsymbol{x}^{(q)})$ is disentangled from $c^{(q)}$ . The theorem indicates that with $N$ samples, the metric is bounded by $O(N^{-1/3})$ . In addition, $\Re_{N}$ decreases when $N$ increases; e.g., a fully connected neural network with bounded weights satisfies $\Re_{N} = O(N^{-1/2})$ (Shalev-Shwartz & Ben-David, 2014). When $\Re_{N}$ increases (e.g., by using a more complex neural network), the function mismatch $\nu$ often decreases (since $\mathcal{F}$ can be more expressive with a higher $\Re_{N}$ ). In other words, Theorem 3 indicates a tradeoff between the expressiveness of the function class $\mathcal{F}$ and the sample complexity. If $\mathcal{F}$ comprises neural networks, the expressiveness is increased (or equivalently, the modeling error is reduced) by increasing the width or depth of networks. But this in turn increases $\Re_{N}$ and requires more samples to reduce (8). This makes sense—one hopes to use a sufficiently expressive learning function, but does not hope to use an excessively expressive one, which is similar to the case in supervised learning.
+
+# 4 IMPLEMENTATION
+
+Enforcing Group Statistical Independence. A notable challenge is the statistical independence constraint in (7d), whose enforcement is often an art. Early methods such as (Taleb & Jutten, 1999; Hyvarinen & Oja, 2000) may be costly. The HSIC method in (Gretton et al., 2007) which measures the correlation of two variables in a kernel space can be used in our framework, but kernels sometimes induce large memory overheads and are sensitive to parameter (e.g., kernel width) selection.
+
+In this work, we provide a simple alternative. Note that if two variables $X$ and $Y$ are statistically independent, then we have $p(X,Y) = p(X)p(Y)\iff \mathbb{E}[\phi (X)\tau (Y)] = \mathbb{E}[\phi (X)]\mathbb{E}[\tau (Y)]$ for all measurable functions $\phi (\cdot):\mathbb{R}\to \mathbb{R}$ and $\tau (\cdot):\mathbb{R}\rightarrow \mathbb{R}$ (Gretton et al., 2005). Hence, to enforce group independence between variables $\widehat{\pmb{z}}^{(q)}$ and $\widehat{\pmb{c}}^{(q)}$ , we propose to exhaust the space of all measurable functions $\phi^{(q)}:\mathbb{R}^D\to \mathbb{R}$ and $\pmb{\tau}^{(q)}:\mathbb{R}^{D_q}\to \mathbb{R}$ , such that
+
+$$
+\sup _ {\boldsymbol {\phi} ^ {(q)}, \boldsymbol {\tau} ^ {(q)}} \mathcal {R} ^ {(q)} = \sup _ {\boldsymbol {\phi} ^ {(q)}, \boldsymbol {\tau} ^ {(q)}} \left| \mathbb {C} _ {\mathbb {D}} \left[ \boldsymbol {\phi} ^ {(q)} \left(\widehat {\boldsymbol {z}} ^ {(q)}\right), \boldsymbol {\tau} ^ {(q)} \left(\widehat {\boldsymbol {c}} ^ {(q)}\right) \right] \right| / \left(\sqrt {\mathbb {V} \left[ \boldsymbol {\phi} ^ {(q)} \left(\widehat {\boldsymbol {z}} ^ {(q)}\right) \right]} \sqrt {\mathbb {V} \left[ \boldsymbol {\tau} ^ {(q)} \left(\widehat {\boldsymbol {c}} ^ {(q)}\right) \right]}\right) \tag {9}
+$$
+
+is minimized. It is not hard to show the following (see the proof in the supplementary material):
+
+Proposition 1 In (9), if $\sup_{\boldsymbol{\phi}^{(q)},\boldsymbol{\tau}^{(q)}}\mathcal{R}^{(q)} = 0$ over all measurable functions $\phi^{(q)}$ and $\pmb{\tau}^{(q)}$ , then, any $[\widehat{\pmb{z}}^{(q)}]_i$ and $[\widehat{\pmb{c}}^{(q)}]_j$ for $i\in [D]$ and $j\in [D_q]$ are statistically independent.
+
+In practice, we use two neural networks to represent $\phi^{(q)}$ and $\pmb{\tau}^{(q)}$ , respectively, which blends well with the neural encoders for algorithm design.
+
+Reformulation and Optimization. We use deep neural networks to serve as $\pmb{f}^{(q)}$ . We introduce a slack variable $\pmb{u}_{\ell}$ and change the objective to minimizing $\mathcal{L}_{\ell} = \sum_{q=1}^{2} \| \pmb{u}_{\ell} - \pmb{f}_{\mathrm{S}}^{(q)}(\pmb{x}_{\ell}^{(q)}) \|_2^2$ like in (3). The slack variable can also make orthogonality and zero-mean constraints easier to enforce. A reconstruction loss $\mathcal{V}_{\ell} = \sum_{q=1}^{2} \| \pmb{x}_{\ell}^{(q)} - \pmb{r}^{(q)}(\pmb{f}^{(q)}(\pmb{x}_{\ell}^{(q)})) \|_2^2$ is employed to promote invertibility of $\pmb{f}^{(q)}$ , where $\pmb{r}^{(q)}$ is a reconstruction network. Let $\pmb{\theta}$ collect the parameters of $\pmb{f}^{(q)}$ and $\pmb{r}^{(q)}$ , and $\pmb{\eta}$ the parameters of $\phi^{(q)}, \tau^{(q)}$ . The overall formulation is:
+
+$$
+\min _ {\boldsymbol {U}, \boldsymbol {\theta}} \max _ {\boldsymbol {\eta}} \mathcal {L} + \beta \mathcal {V} + \lambda \mathcal {R}, \quad \text {s . t .} \frac {1}{N} \sum_ {\ell = 1} ^ {N} \boldsymbol {u} _ {\ell} \boldsymbol {u} _ {\ell} ^ {\top} = \boldsymbol {I}, \frac {1}{N} \sum_ {\ell = 1} ^ {N} \boldsymbol {u} _ {\ell} = \boldsymbol {0}, \tag {10}
+$$
+
+where $\mathcal{L} = 1 / N\sum_{\ell = 1}^{N}\mathcal{L}_{\ell},\mathcal{V} = 1 / N\sum_{\ell = 1}^{N}\mathcal{V}_{\ell},\pmb {U} = [\pmb {u}_1,\dots ,\pmb {u}_N]\in \mathbb{R}^{D\times N},\mathcal{R} = \sum_{q = 1}^{2}\mathcal{R}^{(q)}$ and $\beta ,\lambda \geq 0$ . We design an algorithm for handling (10) with scalable updates; see the supplementary materials for detailed implementation and complexity analysis. We should mention that using reconstruction to encourage invertibility is often seen in multiview learning; see, e.g., (Wang et al., 2015). Nonetheless, this needs not to be the only invertibility-encouraging method. Other realizations such as flow-based (e.g., (Kingma & Dhariwal, 2018)) and entropy regularization-based approaches (e.g., (Von Kugelgen et al., 2021)) are also viable—see more in Appendix I.
+
+# 5 RELATED WORK - NONLINEAR ICA AND LATENT DISENTANGLEMENT
+
+Other than the DCCA and AM-SSL works, our design for private and shared information separation also draws insights from two topics in unsupervised representation learning, namely, nonlinear ICA (nICA) (Hyvarinen & Morioka, 2016; 2017; Hyvarinen et al., 2019; Khemakhem et al., 2020) and latent factor disentanglement (Higgins et al., 2017; Kim & Mnih, 2018; Chen et al., 2018; Zhao et al., 2019; Lopez et al., 2018), which are recently offered a unifying perspective in (Khemakhem et al., 2020). The nICA works aim to separate nonlinearly mixed latent components to an individual component level, which is in general impossible unless additional information associated with each sample (e.g., time frame labels (Hyvarinen & Morioka, 2016) and class labels (Hyvarinen et al., 2019; Khemakhem et al., 2020)) is used. Multiple views are less studied in the context of nICA, with the recent exception in (Locatello et al., 2020) and (Gresele et al., 2020). Nonetheless, their models are different from ours and the approaches cannot extract the private information from views with different nonlinear models. The concurrent work in (Von Kugelgen et al., 2021) worked on
+
+
+Raw data Proposed Clust. Acc $= 37.4\%$ Clust. Acc $= 97.0\%$
+
+
+DCCA Clust. Acc= 97.0%
+
+
+Figure 1: t-SNE of the results on multiview MNIST from (Wang et al., 2015). Baselines: DCCA (Wang et al., 2015), Barlow Twins (Zbontar et al., 2021) and BYOL (Grill et al., 2020).
+
+
+
+
+Barlow Twins BYOL
+ust. Acc=98.0% Clust. Acc=95.6%
+
+content-style disentanglement under data augmented SSL settings and considered a similar generative model where both shared and private components are explicitly used. A key difference is that their model uses an identical nonlinear generative function across the views (i.e., $g^{(1)} = g^{(2)}$ ), while we consider two possibly different $g^{(q)}$ 's. In addition, our learning criterion is able to extract the private information, while the work in (Von Kugelgen et al., 2021) did not consider this aspect. None of the aforementioned works offered finite sample analysis. Our independence promoter is reminiscent of (Gretton et al., 2005), with the extension to handle group variables.
+
+# 6 EXPERIMENTS
+
+Synthetic Data. We first use synthetic data for theory validation; see the supplementary materials.
+
+# 6.1 VALIDATING THEOREM 1 - SHARED COMPONENT LEARNING
+
+In this subsection, we show that latent correlation maximization (or latent component matching) leads to shared component extraction under the model in (5)—which can be used to explain the effectiveness of a number of DCCA and AM-SSL formulations. This is also the objective of our formulation (7) if the constraint in (7d) is not enforced.
+
+Multiview MNIST Data. For proof-of-concept, we adopt a multiview MNIST dataset that was used in (Wang et al., 2015). There, the "augmented" view of MNIST contains randomly rotated digits and the other with additive Gaussian white noise (Wang et al., 2015); see Fig. 1. This is similar to the data augmentation ideas in AM-SSL. Using this multiview data, we apply different multiview learning paradigms that match the latent representations (or maximize the correlations of learned representations) across views. The dataset has 70,000 samples that are $28 \times 28$ images of handwritten digits. Note that without (7d), our method can be understood as a slight variant of (3). To benchmark our method, we use a number of DCCA and AM-SSL approaches mentioned in Sec. 2, namely, DCCA (Wang et al., 2015), Barlow Twins (Zbontar et al., 2021) and BYOL (Grill et al., 2020). We set $D = 10$ , $D_{1} = 20$ and $D_{2} = 50$ through a validation set. The detailed settings of our neural networks can be found in the supplementary material.
+
+Since we do not have ground-truth to evaluate the effectiveness of shared information extraction, we follow the evaluation method in (Wang et al., 2015) and apply $k$ -means to all the embeddings $\widehat{\pmb{z}}_{\ell}^{(1)} = \pmb{f}_{\mathrm{S}}^{(1)}(\pmb{x}_{\ell}^{(1)})$ and compute the clustering accuracy on the test set (see the visualization of $\widehat{\pmb{z}}_{\ell}^{(2)}$ in the supplementary materials). In Fig. 1, we show the t-SNE (Van der Maaten & Hinton, 2008) visualizations of $\widehat{\pmb{z}}_{\ell}^{(1)}$ 's on a test set of 10,000 samples together with the clustering accuracy. All results are averaged over 5 random initializations.
+
+By Theorem 1, all the methods under test should output identity-revealing representations of the data samples. The reason is that the two views share the same identity information of a sample. Indeed, from Fig. 1, one can see that all latent correlation-maximization-based DCCA and AM-SSL methods learn informative representations that are sufficiently distinguishable. The "shape" of the clusters are different, which can be explained by the existence of the invertible function $\gamma (\cdot)$ . These results corroborate our analysis in Theorem 1.
+
+CIFAR10 Data. We also observe similar results using the CIFAR10 data (Krizhevsky et al., 2009). The results can be found in the supplementary materials, due to page limitations.
+
+
+Figure 2: Evaluation on Cars3D; rows in blue boxes are w/ $\mathcal{R}$ ; rows in green boxes are w/o $\mathcal{R}$ .
+
+# 6.2 VALIDATING THEOREM 2 - SHARED AND PRIVATE COMPONENT DISENTANGLEMENT
+
+We use data generation examples to support our claim in Theorem 2-i.e., with our designed regularizer $\mathcal{R}$ in (10), one can provably disentangle the shared and private latent components.
+
+Cars3D Data for Cross-sample Data Generation. We use the Cars3D dataset (Reed et al., 2015) that contains different car CAD models. For each car image, there are three defining aspects (namely, 'type', 'elevation' and 'azimuth').
+
+We create two views as follows. We assume that given the car type that is captured by shared variables $\mathbf{z}$ and the azimuths that are captured by $\mathbf{c}^{(q)}$ , the generation mappings $\mathbf{g}^{(1)}$ and $\mathbf{g}^{(2)}$ produce car images with low elevations and high elevations, respectively (so they must be different mappings). Under our setting, each view has $N = 8$ , 784 car images. We model $\mathbf{z}$ with $D = 10$ . For $\mathbf{c}^{(q)}$ , we set $D_{1} = D_{2} = 2$ . More details about our settings are in the supplementary material.
+
+We use the idea of cross-sample data generation to evaluate the effectiveness of our method. To be precise, we evaluate the learned $\widehat{\pmb{f}}^{(q)}$ 's by combining $\widehat{\pmb{z}}_{\ell}^{(q)} = \widehat{\pmb{f}}_{\mathrm{S}}^{(q)}(\pmb{x}_{\ell}^{(q)})$ and $\widehat{\pmb{c}}_j^{(q)} = \widehat{\pmb{f}}_{\mathrm{P}}^{(q)}(\pmb{x}_j^{(q)})$ and generating $\widehat{\pmb{x}}_{\ell ,j}^{(q)} = \widehat{\pmb{r}}^{(q)}([(\widehat{\pmb{z}}_{\ell}^{(q)})^{\top},(\pmb{c}_{j}^{(q)})^{\top}]^{\top})$ , where $\widehat{\pmb{r}}^{(q)}$ is the learned reconstruction network [cf Eq. (10)]. Under our model, if the shared components and private components are truly disentangled in the latent domain, this generated sample $\widehat{\pmb{x}}_{\ell ,j}^{(q)}$ should exhibit the same 'type' and 'elevation' as those of $\pmb{x}_{\ell}^{(q)}$ and the 'azimuth' of $\pmb{x}_j^{(q)}$ .
+
+Fig. 2 shows our experiment results. The proposed method's outputs are as expected. For example, on the left of Fig. 2, the $\boldsymbol{z}_{\ell}^{(1)}$ is extracted from the red convertible, and the $\widehat{\boldsymbol{c}}_j^{(1)},$ s are extracted from the top row. One can see that the generated $\widehat{\boldsymbol{x}}_{\ell,j}^{(1)},$ s under the proposed method with $\mathcal{R}$ are all red convertibles with the same elevation, but using the azimuths of the corresponding cars from the top row. Note that if $\mathcal{R}$ is not used, then the learned $\widehat{\boldsymbol{c}}_j^{(q)}$ may still contain the 'type' or 'elevation' information; see the example highlighted with yellow background on the right of Fig. 2. More results are in the supplementary material.
+
+dSprites Data and MNIST Data for Cross-sample/Cross-view Data Generation. We offer two extra sets of examples to validate our claim in Theorem 2. Please see the supplementary materials.
+
+# 7 CONCLUSION
+
+In this work, we provided theoretical understandings to the role of latent correlation maximization (latent component matching) that is often used in DCCA and AM-SSL methods from an unsupervised nonlinear mixture learning viewpoint. In particular, we modeled multiview data as nonlinear mixtures of shared and private components, and showed that latent correlation maximization ensures to extract the shared components—which are believed to be identity-revealing. In addition, we showed that, with a carefully designed constraint (which is approximated by a neural regularizer), one can further disentangle the shared and private information, under reasonable conditions. We also analyzed the sample complexity for extracting the shared information, which has not been addressed in nonlinear component analysis works, to our best knowledge. To realize our learning criterion, we proposed a slack variable-assisted latent correlation maximization approach, with a novel minimax neural regularizer for promoting group independence. We tested our method over synthetic and real data. The results corroborated our design goals and theoretical analyses.
+
+Acknowledgement. This work is supported in part by the National Science Foundation (NSF) under Project NSF ECCS-1808159, and in part by the Army Research Office (ARO) under Project ARO W911NF-21-1-0227.
+Ethics Statement. This paper focuses on theoretical analysis and provable guarantees of learning criteria. It does not involve human subjects or other ethics-related concerns.
+Reproducibility Statement. The authors strive to make the research in this work reproducible. The supplementary materials contain rich details of the algorithm implementation and experiment settings. The source code of our Python-implemented algorithm and two demos with real data are uploaded as supplementary materials. The details of the proofs of our theoretical claims are also included in the supplementary materials.
+
+# REFERENCES
+
+Galen Andrew, Raman Arora, Jeff Bilmes, and Karen Livescu. Deep canonical correlation analysis. In International Conference on Machine Learning, pp. 1247-1255. PMLR, 2013.
+Raman Arora and Karen Livescu. Multi-view cca-based acoustic features for phonetic recognition across speakers and domains. In 2013 IEEE International Conference on Acoustics, Speech and Signal Processing, pp. 7135-7139. IEEE, 2013.
+Francis R Bach and Michael I Jordan. A probabilistic interpretation of canonical correlation analysis. 2005.
+Peter L Bartlett and Shahar Mendelson. Rademacher and Gaussian complexities: Risk bounds and structural results. Journal of Machine Learning Research, 3(Nov):463-482, 2002.
+Mohamed Ishmael Belghazi, Aristide Baratin, Sai Rajeshwar, Sherjil Ozair, Yoshua Bengio, Aaron Courville, and Devon Hjelm. MINE: Mutual information neural estimation. In International Conference on Machine Learning, volume 80, pp. 531-540. PMLR, 10-15 Jul 2018.
+Adrian Benton, Huda Khayrallah, Biman Gujral, Drew Reisinger, Shenmin Zhang, and Raman Arora. Deep generalized canonical correlation analysis. In RepL4NLP at ACL, 2017.
+J Douglas Carroll. Generalization of canonical correlation analysis to three or more sets of variables. In Proceedings of the 76th annual convention of the American Psychological Association, volume 3, pp. 227-228, 1968.
+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, pp. 2610-2620, 2018.
+Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In International Conference on Machine Learning, pp. 1597-1607. PMLR, 2020.
+Xinlei Chen and Kaiming He. Exploring simple Siamese representation learning. In Proceedings of Conference on Computer Vision and Pattern Recognition, pp. 15750-15758, 2021.
+Thomas M Cover. Elements of information theory. John Wiley & Sons, 1999.
+G Darmois. Analyse des liaisons de probabilité. In Proc. Int. Stat. Conferences 1947, pp. 231, 1951.
+Richard A Davis, Keh-Shin Lii, and Dimitris N Politis. Remarks on some nonparametric estimates of a density function. In Selected Works of Murray Rosenblatt, pp. 95-100. Springer, 2011.
+Paramveer Dhillon, Jordan Rodu, Dean Foster, and Lyle Ungar. Two Step CCA: A new spectral method for estimating vector models of words. In Proceedings of the 29th International Conference on Machine Learning (ICML-12), pp. 1551-1558, New York, NY, USA, July 2012. Omnipress.
+Alexey Dosovitskiy, Philipp Fischer, Jost Tobias Springenberg, Martin Riedmiller, and Thomas Brox. Discriminative unsupervised feature learning with exemplar convolutional neural networks. IEEE Trans. Pattern Anal. Mach. Intell., 38(9):1734-1747, 2015.
+
+John Duchi, Elad Hazan, and Yoram Singer. Adaptive subgradient methods for online learning and stochastic optimization. Journal of Machine Learning Research, 12(Jul):2121-2159, 2011.
+Ronald A Fisher. Frequency distribution of the values of the correlation coefficient in samples from an indefinitely large population. Biometrika, 10(4):507-521, 1915.
+Spyros Gidaris, Praveer Singh, and Nikos Komodakis. Unsupervised representation learning by predicting image rotations. In International Conference on Learning Representations, 2018.
+Yunchao Gong, Qifa Ke, Michael Isard, and Svetlana Lazebnik. A multi-view embedding space for modeling internet images, tags, and their semantics. International Journal of Computer Vision, 106(2):210-233, 2014.
+Luigi Gresele, Paul K Rubenstein, Arash Mehrjou, Francesco Locatello, and Bernhard Scholkopf. The incomplete Rosetta stone problem: Identifiability results for multi-view nonlinear ICA. In Proceedings of UAI 2020, pp. 217-227, 2020.
+Arthur Gretton, Alexander J Smola, Olivier Bousquet, Ralf Herbrich, Andrei Belitski, Mark Augath, Yusuke Murayama, Jon Pauls, Bernhard Scholkopf, and Nikos K Logothetis. Kernel constrained covariance for dependence measurement. In International Conference on Artificial Intelligence and Statistics, volume 10, pp. 112-119. Citeseer, 2005.
+Arthur Gretton, Kenji Fukumizu, Choon Teo, Le Song, Bernhard Schölkopf, and Alex Smola. A kernel statistical test of independence. Advances in Neural Information Processing Systems, 20, 2007.
+Jean-Bastien Grill, Florian Strub, Florent Alché, Coretin Tallec, Pierre Richemond, Elena Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Guo, Mohammad Gheshlaghi Azar, Bilal Piot, Koray Kavukcuoglu, Remi Munos, and Michal Valko. Bootstrap your own latent - a new approach to self-supervised learning. In Advances in Neural Information Processing Systems, volume 33, pp. 21271-21284, 2020.
+Gregory Gundersen, Bianca Dumitrascu, Jordan T Ash, and Barbara E Engelhardt. End-to-end training of deep probabilistic CCA on paired biomedical observations. In Uncertainty in Artificial Intelligence, 2019.
+Michael Gutmann and Aapo Hyvarinen. Noise-contrastive estimation: A new estimation principle for unnormalized statistical models. In Proceedings of the 13th International Conference on Artificial Intelligence and Statistics, pp. 297-304. JMLR Workshop and Conference Proceedings, 2010.
+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, 2017.
+Harold Hotelling. Relations between two sets of variates. Biometrika, 28(3/4):321-377, 1936.
+Xun Huang, Ming-Yu Liu, Serge Belongie, and Jan Kautz. Multimodal unsupervised image-to-image translation. In Proceedings of the European Conference on Computer Vision, pp. 172-189, 2018.
+Aapo Hyvarinen and Hiroshi Morioka. Unsupervised feature extraction by time-contrastive learning and nonlinear ICA. In Advances in Neural Information Processing Systems, volume 29, 2016.
+Aapo Hyvarinen and Hiroshi Morioka. Nonlinear ICA of temporally dependent stationary sources. In International Conference on Artificial Intelligence and Statistics, volume 54, pp. 460-469, 20-22 Apr 2017.
+Aapo Hyvarinen and Erkki Oja. Independent component analysis: Algorithms and applications. Neural Networks, 13(4-5):411-430, 2000.
+
+Aapo Hyvarinen, Hiroaki Sasaki, and Richard Turner. Nonlinear ICA using auxiliary variables and generalized contrastive learning. In International Conference on Artificial Intelligence and Statistics, pp. 859-868, 2019.
+Mohamed Salah Ibrahim and Nicholas D Sidiropoulos. Reliable detection of unknown cell-edge users via canonical correlation analysis. IEEE Trans. Wireless Commun., 19(6):4170-4182, 2020.
+Jon R Kettenring. Canonical analysis of several sets of variables. Biometrika, 58(3):433-451, 1971.
+Ilyes Khemakhem, Diederik Kingma, Ricardo Monti, and Aapo Hyvarinen. Variational autoencoders and nonlinear ICA: A unifying framework. In International Conference on Artificial Intelligence and Statistics, pp. 2207-2217. PMLR, 2020.
+Hyunjik Kim and Andriy Mnih. Disentangling by factorising. In International Conference on Machine Learning, volume 80, pp. 2649-2658. PMLR, 10-15 Jul 2018.
+Diederick P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2015.
+Durk P Kingma and Prafulla Dhariwal. Glow: Generative flow with invertible 1x1 convolutions. Advances in Neural Information Processing Systems, 31, 2018.
+Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009.
+Pei Ling Lai and Colin Fyfe. Kernel and nonlinear canonical correlation analysis. International Journal of Neural Systems, 10(05):365-377, 2000.
+Christian Ledig, Lucas Theis, Ferenc Huszár, Jose Caballero, Andrew Cunningham, Alejandro Acosta, Andrew Aitken, Alykhan Tejani, Johannes Totz, Zehan Wang, et al. Photo-realistic single image super-resolution using a generative adversarial network. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4681-4690, 2017.
+Hsin-Ying Lee, Hung-Yu Tseng, Jia-Bin Huang, Maneesh Singh, and Ming-Hsuan Yang. Diverse image-to-image translation via disentangled representations. In Proceedings of the European Conference on Computer Vision, pp. 35-51, 2018.
+Francesco Locatello, Ben Poole, Gunnar Ratsch, Bernhard Scholkopf, Olivier Bachem, and Michael Tschannen. Weakly-supervised disentanglement without compromises. In International Conference on Machine Learning, pp. 6348-6359. PMLR, 2020.
+Romain Lopez, Jeffrey Regier, Michael I Jordan, and Nir Yosef. Information constraints on autoencoding variational Bayes. Advances in Neural Information Processing Systems, 31:6114-6125, 2018.
+Qi Lyu and Xiao Fu. Nonlinear multiview analysis: Identifiability and neural network-assisted implementation. IEEE Trans. Signal Process., 68:2697-2712, 2020.
+Mehryar Mohri, Afshin Rostamizadeh, and Ameet Talwalkar. Foundations of Machine Learning. MIT press, 2018.
+Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
+Pushpendre Rastogi, Benjamin Van Durme, and Raman Arora. Multiview LSA: Representation learning via generalized CCA. In Proceedings of the 2015 conference of the North American chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 556-566, 2015.
+Scott E Reed, Yi Zhang, Yuting Zhang, and Honglak Lee. Deep visual analogy-making. Advances in Neural Information Processing Systems, 28:1252-1260, 2015.
+
+Nikunj Saunshi, Orestis Plevrakis, Sanjeev Arora, Mikhail Khodak, and Hrishikesh Khandeparkar. A theoretical analysis of contrastive unsupervised representation learning. In Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pp. 5628-5637. PMLR, 09-15 Jun 2019.
+Shai Shalev-Shwartz and Shai Ben-David. Understanding machine learning: From theory to algorithms. Cambridge university press, 2014.
+Richard Socher and Li Fei-Fei. Connecting modalities: Semi-supervised segmentation and annotation of images using unaligned text corpora. In 2010 IEEE Computer Society Conference on Computer Vision and Pattern Recognition, pp. 966-973. IEEE, 2010.
+Anisse Taleb and Christian Jutten. Source separation in post-nonlinear mixtures. IEEE Trans. Signal Process., 47(10):2807-2820, 1999.
+Yuandong Tian, Xinlei Chen, and Surya Ganguli. Understanding self-supervised learning dynamics without contrastive pairs. In Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pp. 10268-10278. PMLR, 18-24 Jul 2021.
+Christopher Tosh, Akshay Krishnamurthy, and Daniel Hsu. Contrastive learning, multi-view redundancy, and linear models. In Algorithmic Learning Theory, pp. 1179-1206. PMLR, 2021.
+Laurens Van der Maaten and Geoffrey Hinton. Visualizing data using t-SNE. Journal of Machine Learning Research, 9(11), 2008.
+Julius Von Kugelgen, Yash Sharma, Luigi Gresele, Wieland Brendel, Bernhard Scholkopf, Michel Besserve, and Francesco Locatello. Self-supervised learning with data augmentations provably isolates content from style. Advances in Neural Information Processing Systems, 34, 2021.
+Tongzhou Wang and Phillip Isola. Understanding contrastive representation learning through alignment and uniformity on the hypersphere. In International Conference on Machine Learning, pp. 9929-9939. PMLR, 2020.
+Weiran Wang, Raman Arora, Karen Livescu, and Jeff Bilmes. On deep multi-view representation learning. In International Conference on Machine Learning, pp. 1083-1092, 2015.
+Weiran Wang, Xinchen Yan, Honglak Lee, and Karen Livescu. Deep variational canonical correlation analysis. arXiv preprint arXiv:1610.03454, 2016.
+Ka Yee Yeung and Walter L Ruzzo. Details of the Adjusted Rand Index and clustering algorithms, supplement to the paper an empirical study on Principal Component Analysis for clustering gene expression data. Bioinformatics, 17(9):763-774, 2001.
+Jure Zbontar, Li Jing, Ishan Misra, Yann Lecun, and Stephane Deny. Barlow Twins: Self-supervised learning via redundancy reduction. In Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pp. 12310-12320. PMLR, 18-24 Jul 2021.
+Shengjia Zhao, Jiaming Song, and Stefano Ermon. InfoVAE: Balancing learning and inference in variational autoencoders. Proceedings of the AAAI Conference on Artificial Intelligence, 33(01): 5885-5892, Jul. 2019.
+Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2223-2232, 2017.
+Roland S. Zimmermann, Yash Sharma, Steffen Schneider, Matthias Bethge, and Wieland Brendel. Contrastive learning inverts the data generating process. In Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pp. 12979-12990. PMLR, 18-24 Jul 2021.
+
+# Supplementary Materials
+
+# A NOTATION
+
+The notations used in this work are summarized in Table A.1.
+
+Table A.1: Definition of notations.
+
+
| Notation | Definition |
| x, x, X | scalar, vector, and matrix |
| [x]i, xi | both represent theith element of vector x |
| [X]ij | theith row, jth column of matrix X |
| p(x) | probability density function of random variable x |
| x ⊥ y | x and y are statistically independent, i.e., p(x, y) = p(x)p(y) |
| x ⊥ y | xi ⊥ yj for all i, j |
| x^1, X^1 | transpose of x, X |
| Jf | Jacobian matrix of a vector-valued function f |
| I | identity matrix with a proper size |
| f ∘ g | function composition operation |
| detX | determinant of a square matrix X |
| E[·] | expectation |
| V[·] | variance |
| Cov[·,·] | covariance |
| [N] | the integer set {1, 2, ..., N} |
+
+# B PROOF OF THEOREM 1
+
+Theorem 1. (Shared Component Extraction) Under the generative model in (5) and Assumption 1, consider the population form in (7) (i.e., $N = \infty$ ). Assume that the considered constraints hold over all $\pmb{x}^{(q)} \in \mathcal{X}_q$ for $q = 1,2$ , where $\mathcal{X}_q = \{\pmb{x}^{(q)} | \pmb{x}^{(q)} = \pmb{g}^{(q)}([z^{\top}, (\pmb{c}^{(q)})^{\top}]^{\top}), \forall \pmb{z} \in \mathcal{Z}, \forall \pmb{c}^{(q)} \in \mathcal{C}_q\}$ . Denote $\widehat{\pmb{f}}^{(q)}$ as any solution of (7). Also assume that the first-order derivative of $\widehat{\pmb{f}}^{(q)} \circ \pmb{g}^{(q)}$ exists. Then, we have $\widehat{\pmb{z}} = \widehat{\pmb{f}}_{\mathrm{S}}^{(q)}(\pmb{x}^{(q)}) = \gamma(\pmb{z})$ no matter if (7d) is enforced or not, where $\gamma(\cdot): \mathbb{R}^D \to \mathbb{R}^D$ is a certain invertible function.
+
+We consider the formulation in (7) without (7d). When $N = \infty$ and $\pmb{x}^{(q)}\sim \mathcal{X}_q$ for $q = 1,2$ are all available, the sample average version of the formulation in (7) becomes the following expected value version:
+
+$$
+\underset {\boldsymbol {f} ^ {(1)}, \boldsymbol {f} ^ {(2)}} {\text {m a x i m i z e}} \operatorname {T r} \left(\mathbb {E} \left[ \boldsymbol {f} _ {\mathrm {S}} ^ {(1)} \left(\boldsymbol {x} _ {\ell} ^ {(1)}\right) \left(\boldsymbol {f} _ {\mathrm {S}} ^ {(2)} \left(\boldsymbol {x} _ {\ell} ^ {(2)}\right) ^ {\top}\right) \right]\right) \tag {B.1a}
+$$
+
+subject to $\pmb{f}^{(q)}$ for $q = 1,2$ are invertible, (B.1b)
+
+$$
+\mathbb {E} \left[ \boldsymbol {f} _ {\mathrm {S}} ^ {(q)} \left(\boldsymbol {x} _ {\ell} ^ {(q)}\right) \boldsymbol {f} _ {\mathrm {S}} ^ {(q)} \left(\boldsymbol {x} _ {\ell} ^ {(q)}\right) ^ {\top} \right] = \boldsymbol {I}, \mathbb {E} \left[ \boldsymbol {f} _ {\mathrm {S}} \left(\boldsymbol {x} _ {\ell} ^ {(q)}\right) \right] = \boldsymbol {0}, q = 1, 2 \tag {B.1c}
+$$
+
+First, note that under the generative model in (5), the maximum of the objective function in (7) is $D$ , which is obtained when every corresponding components of the learned solutions, i.e., $\hat{\pmb{f}}_{\mathrm{S}}^{(1)}: \mathbb{R}^{M_1} \to \mathbb{R}^D$ and $\hat{\pmb{f}}_{\mathrm{S}}^{(1)}: \mathbb{R}^{M_2} \to \mathbb{R}^D$ , are perfectly correlated, i.e.,
+
+$$
+\widehat {\boldsymbol {f}} _ {\mathrm {S}} ^ {(1)} \left(\boldsymbol {x} ^ {(1)}\right) = \widehat {\boldsymbol {f}} _ {\mathrm {S}} ^ {(2)} \left(\boldsymbol {x} ^ {(2)}\right). \tag {B.2}
+$$
+
+Indeed, one may rewrite (B.1a) as
+
+$$
+\begin{array}{l} \arg \min _ {\boldsymbol {f} ^ {(1)}, \boldsymbol {f} ^ {(2)}} - 2 \operatorname {T r} \left(\mathbb {E} \left[ \boldsymbol {f} _ {\mathrm {S}} ^ {(1)} \left(\boldsymbol {x} _ {\ell} ^ {(1)}\right) \left(\boldsymbol {f} _ {\mathrm {S}} ^ {(2)} \left(\boldsymbol {x} _ {\ell} ^ {(2)}\right) ^ {\top}\right) \right]\right) \\ = \arg \min _ {\boldsymbol {f} ^ {(1)}, \boldsymbol {f} ^ {(2)}} \boldsymbol {I} - 2 \operatorname {T r} \left(\mathbb {E} \left[ \boldsymbol {f} _ {\mathrm {S}} ^ {(1)} \left(\boldsymbol {x} _ {\ell} ^ {(1)}\right) \left(\boldsymbol {f} _ {\mathrm {S}} ^ {(2)} \left(\boldsymbol {x} _ {\ell} ^ {(2)}\right) ^ {\top}\right) \right]\right) + \boldsymbol {I} \\ = \arg \min _ {\boldsymbol {f} ^ {(1)}, \boldsymbol {f} ^ {(2)}} \mathbb {E} \left[ \left\| \boldsymbol {f} _ {\mathrm {S}} ^ {(1)} \left(\boldsymbol {x} _ {\ell} ^ {(1)}\right) - \boldsymbol {f} _ {\mathrm {S}} ^ {(2)} \left(\boldsymbol {x} _ {\ell} ^ {(2)}\right) \right\| _ {2} ^ {2} \right] \tag {B.3} \\ \end{array}
+$$
+
+where the second equality holds because the constraint in (B.1c). Note that the criterion in (B.3) admits the optimal solution in (B.2) under our generative model.
+
+Note that one solution to attain zero cost of (B.3) is
+
+$$
+\widehat {\boldsymbol {f}} _ {\mathrm {S}} ^ {(q)} \left(\boldsymbol {x} ^ {(q)}\right) = \boldsymbol {z}, q = 1, 2.
+$$
+
+However, the question lies in "uniqueness", i.e., can enforcing (B.2) always yield $f_{\mathrm{S}}^{(q)}(\boldsymbol{x}^{(q)}) = \boldsymbol{z}$ (up to certain ambiguities)? This is central to learning criterion design, as the expressiveness of function approximators like neural networks may attain zero cost of (B.3) with undesired solutions.
+
+Assume that a solution that satisfies (B.2) is found. Denote $\hat{\pmb{f}}^{(q)}$ for $q = 1,2$ as the solution. Combine the solution with the generative model in (5). Then, following equality can be obtained:
+
+$$
+\boldsymbol {h} _ {\mathrm {S}} ^ {(1)} \left(\left[ \begin{array}{l} \boldsymbol {z} \\ \boldsymbol {c} ^ {(1)} \end{array} \right]\right) = \boldsymbol {h} _ {\mathrm {S}} ^ {(2)} \left(\left[ \begin{array}{l} \boldsymbol {z} \\ \boldsymbol {c} ^ {(2)} \end{array} \right]\right), \tag {B.4}
+$$
+
+where we have
+
+$$
+\pmb {h} _ {\mathrm {S}} ^ {(q)} (\pmb {\omega} ^ {(q)}) = \left[ \widehat {\pmb {f}} ^ {(q)} \circ \pmb {g} ^ {(q)} (\pmb {\omega} ^ {(q)}) \right] _ {1: D} = \widehat {\pmb {f}} _ {\mathrm {S}} ^ {(q)} \circ \pmb {g} ^ {(q)} (\pmb {\omega} ^ {(q)}),
+$$
+
+in which
+
+$$
+\boldsymbol {\omega} ^ {(q)} = [ \boldsymbol {z} ^ {\top}, (\boldsymbol {c} ^ {(q)}) ^ {\top} ] ^ {\top}.
+$$
+
+We hope to show that $\pmb{h}_{\mathrm{S}}^{(1)}$ and $\pmb{h}_{\mathrm{S}}^{(2)}$ are functions of only $z$ —i.e., the functions $\widehat{\pmb{f}}_{\mathrm{S}}^{(q)}$ for $q = 1,2$ only extract the shared information.
+
+To show that $h_{\mathrm{S}}^{(1)}$ is a function of only $z$ but not a function of $c^{(1)}$ , we consider the first-order partial derivatives of $h_{\mathrm{S}}^{(1)}$ w.r.t. $z$ and $c^{(1)}$ , respectively. Namely, we hope to show that the matrix consisting of all the partial derivatives of $h_{\mathrm{S}}^{(1)}$ w.r.t. $z$ is full rank while any partial derivatives of $h_{\mathrm{S}}^{(1)}$ w.r.t. $c^{(1)}$ is zero.
+
+Therefore, we investigate the Jacobian of $\pmb{h}^{(1)}$ which fully characterizes all the first-order partial derivatives of the function $h_{\mathrm{S}}^{(1)}$ and $h_{\mathrm{P}}^{(1)}$ w.r.t. $\pmb{z}$ and $\pmb{c}^{(1)}$ . Let us denote the outputs of $\pmb{h}^{(1)} = \widehat{\pmb{f}}^{(1)} \circ \pmb{g}^{(1)}(\pmb{\omega}^{(1)})$ as follows:
+
+$$
+\left[ \begin{array}{l} \widehat {\boldsymbol {z}} \\ \widehat {\boldsymbol {c}} ^ {(1)} \end{array} \right] = \boldsymbol {h} ^ {(1)} \left(\left[ \begin{array}{l} \boldsymbol {z} \\ \boldsymbol {c} ^ {(1)} \end{array} \right]\right). \tag {B.5}
+$$
+
+The Jacobian of $h^{(1)}$ can be expressed using the following block form
+
+$$
+\boldsymbol {J} ^ {(1)} = \left[ \begin{array}{c c} \boldsymbol {J} _ {1 1} ^ {(1)} & \boldsymbol {J} _ {1 2} ^ {(1)} \\ \boldsymbol {J} _ {2 1} ^ {(1)} & \boldsymbol {J} _ {2 2} ^ {(1)} \end{array} \right],
+$$
+
+where $\pmb{J}_{11}^{(1)}\in \mathbb{R}^{D\times D}$ , $\pmb{J}_{12}^{(1)}\in \mathbb{R}^{D\times D_1}$ , $\pmb{J}_{21}^{(1)}\in \mathbb{R}^{D_1\times D}$ and $\pmb{J}_{22}^{(1)}\in \mathbb{R}^{D_1\times D_1}$ are Jacobian matrices defined as follows
+
+$$
+\begin{array}{l} \boldsymbol {J} _ {1 1} ^ {(1)} = \left[ \begin{array}{c c c} \frac {\partial \left[ \boldsymbol {h} _ {\mathrm {S}} ^ {(1)} (\boldsymbol {\omega} ^ {(1)}) \right] _ {1}}{\partial z _ {1}} & \dots & \frac {\partial \left[ \boldsymbol {h} _ {\mathrm {S}} ^ {(1)} (\boldsymbol {\omega} ^ {(1)}) \right] _ {1}}{\partial z _ {D}} \\ \vdots & \ddots & \vdots \\ \frac {\partial \left[ \boldsymbol {h} _ {\mathrm {S}} ^ {(1)} (\boldsymbol {\omega} ^ {(1)}) \right] _ {D}}{\partial z _ {1}} & \dots & \frac {\partial \left[ \boldsymbol {h} _ {\mathrm {S}} ^ {(1)} (\boldsymbol {\omega} ^ {(1)}) \right] _ {D}}{\partial z _ {D}} \end{array} \right], \boldsymbol {J} _ {1 2} ^ {(1)} = \left[ \begin{array}{c c c} \frac {\partial \left[ \boldsymbol {h} _ {\mathrm {S}} ^ {(1)} (\boldsymbol {\omega} ^ {(1)}) \right] _ {1}}{\partial c _ {1} ^ {(1)}} & \dots & \frac {\partial \left[ \boldsymbol {h} _ {\mathrm {S}} ^ {(1)} (\boldsymbol {\omega} ^ {(1)}) \right] _ {1}}{\partial c _ {D _ {1}} ^ {(1)}} \\ \vdots & \ddots & \vdots \\ \frac {\partial \left[ \boldsymbol {h} _ {\mathrm {S}} ^ {(1)} (\boldsymbol {\omega} ^ {(1)}) \right] _ {D}}{\partial c _ {1} ^ {(1)}} & \dots & \frac {\partial \left[ \boldsymbol {h} _ {\mathrm {S}} ^ {(1)} (\boldsymbol {\omega} ^ {(1)}) \right] _ {D}}{\partial c _ {D _ {1}} ^ {(1)}} \end{array} \right], \\ \boldsymbol {J} _ {2 1} ^ {(1)} = \left[ \begin{array}{c c c} \frac {\partial [ \boldsymbol {h} _ {\mathrm {P}} ^ {(1)} (\boldsymbol {\omega} ^ {(1)}) ] _ {1}}{\partial z _ {1}} & \dots & \frac {\partial [ \boldsymbol {h} _ {\mathrm {P}} ^ {(1)} (\boldsymbol {\omega} ^ {(1)}) ] _ {1}}{\partial z _ {D}} \\ \vdots & \ddots & \vdots \\ \frac {\partial [ \boldsymbol {h} _ {\mathrm {P}} ^ {(1)} (\boldsymbol {\omega} ^ {(1)}) ] _ {D _ {1}}}{\partial z _ {1}} & \dots & \frac {\partial [ \boldsymbol {h} _ {\mathrm {P}} ^ {(1)} (\boldsymbol {\omega} ^ {(1)}) ] _ {D _ {1}}}{\partial z _ {D}} \end{array} \right], \boldsymbol {J} _ {2 2} ^ {(1)} = \left[ \begin{array}{c c c} \frac {\partial [ \boldsymbol {h} _ {\mathrm {P}} ^ {(1)} (\boldsymbol {\omega} ^ {(1)}) ] _ {1}}{\partial c _ {1} ^ {(1)}} & \dots & \frac {\partial [ \boldsymbol {h} _ {\mathrm {P}} ^ {(1)} (\boldsymbol {\omega} ^ {(1)}) ] _ {1}}{\partial c _ {D _ {1}} ^ {(1)}} \\ \vdots & \ddots & \vdots \\ \frac {\partial [ \boldsymbol {h} _ {\mathrm {P}} ^ {(1)} (\boldsymbol {\omega} ^ {(1)}) ] _ {D _ {1}}}{\partial c _ {1} ^ {(1)}} & \dots & \frac {\partial [ \boldsymbol {h} _ {\mathrm {P}} ^ {(1)} (\boldsymbol {\omega} ^ {(1)}) ] _ {D _ {1}}}{\partial c _ {D _ {1}} ^ {(1)}} \end{array} \right]. \\ \end{array}
+$$
+
+What we hope to show is that $J_{12}^{(1)}$ is an all-zero matrix while the determinant of $J_{11}^{(1)}$ is non-zero.
+
+We first show that $J_{12}^{(1)} = 0$ . Note that (B.4) holds over the entire domain. Hence, we consider any fixed $\overline{z}$ and $\overline{c}^{(2)}$ . Then for all $c^{(1)}$ , the following equation holds:
+
+$$
+\boldsymbol {h} _ {\mathrm {S}} ^ {(1)} \left(\left[ \begin{array}{l} \bar {z} \\ \boldsymbol {c} ^ {(1)} \end{array} \right]\right) = \boldsymbol {h} _ {\mathrm {S}} ^ {(2)} \left(\left[ \begin{array}{l} \bar {z} \\ \bar {\boldsymbol {c}} ^ {(2)} \end{array} \right]\right) \tag {B.6}
+$$
+
+for all $c^{(1)}\in \mathcal{C}_1$ with any fixed $\overline{z}$ and $\overline{c}^{(2)}$
+
+Let us define matrices $\mathbf{H}_{\mathrm{S}}^{(1)}$ and $\mathbf{H}_{\mathrm{S}}^{(2)}$ , where
+
+$$
+\left[ \boldsymbol {H} _ {\mathrm {S}} ^ {(q)} \right] _ {i, j} = \frac {\partial \left[ \boldsymbol {h} _ {\mathrm {S}} ^ {(q)} (\boldsymbol {\omega} ^ {(q)}) \right] _ {i}}{\partial c _ {j} ^ {(1)}}, i = 1, \dots , D, j = 1, \dots , D _ {1}.
+$$
+
+By taking partial derivatives of Eq. (B.6) w.r.t. $c_{j}^{(1)}$ for $j = 1, \ldots, D_{1}$ , we have the following Jacobian:
+
+$$
+\left. \boldsymbol {H} _ {\mathrm {S}} ^ {(1)} \right| _ {\bar {\boldsymbol {z}}, \boldsymbol {c} ^ {(1)}} = \left. \boldsymbol {H} _ {\mathrm {S}} ^ {(2)} \right| _ {\bar {\boldsymbol {z}}, \bar {\boldsymbol {c}} ^ {(2)}} \stackrel {{(a)}} {{=}} \left(\left. \boldsymbol {J} _ {\boldsymbol {h} _ {\mathrm {S}} ^ {(2)}} \right| _ {\bar {\boldsymbol {z}}, \bar {\boldsymbol {c}} ^ {(2)}}\right) \left[ \begin{array}{l l l} \frac {\partial \bar {z} _ {1}}{\partial c _ {1} ^ {(1)}} & \dots & \frac {\partial \bar {z} _ {1}}{\partial c _ {D _ {1}} ^ {(1)}} \\ \vdots & \ddots & \vdots \\ \frac {\partial \bar {z} _ {D}}{\partial c _ {1} ^ {(1)}} & \dots & \frac {\partial \bar {z} _ {D}}{\partial c _ {D _ {1}} ^ {(1)}} \\ \frac {\partial \bar {c} _ {1} ^ {(2)}}{\partial c _ {1} ^ {(1)}} & \dots & \frac {\partial \bar {c} _ {1} ^ {(2)}}{\partial c _ {D _ {1}} ^ {(1)}} \\ \vdots & \ddots & \vdots \\ \frac {\partial \bar {c} _ {D _ {2}} ^ {(2)}}{\partial c _ {1} ^ {(1)}} & \dots & \frac {\partial \bar {c} _ {D _ {2}} ^ {(2)}}{\partial c _ {D _ {1}} ^ {(1)}} \end{array} \right] \stackrel {{(b)}} {{=}} \left(\left. \boldsymbol {J} _ {\boldsymbol {h} _ {\mathrm {S}} ^ {(2)}} \right| _ {\bar {\boldsymbol {z}}, \bar {\boldsymbol {c}} ^ {(2)}}\right) \left[ \begin{array}{l} \mathbf {0} _ {D \times D _ {1}} \\ \mathbf {0} _ {D _ {2} \times D _ {1}} \end{array} \right] = \mathbf {0} _ {D \times D _ {1}},
+$$
+
+where $J_{\mathbf{h}_{\mathrm{S}}^{(2)}} \in \mathbb{R}^{D \times (D + D_2)}$ is the Jacobian of $h_{\mathrm{S}}^{(2)}$ , (a) is by the chain rules and (b) is because we take derivatives of constants. The equation above holds for any $\overline{z}$ and $\overline{c}^{(2)}$ . Hence, the same derivation holds for all $z$ and $c^{(2)}$ , which leads to the conclusion that the learned $h_{\mathrm{S}}^{(q)}(\omega^{(q)})$ is not a function of $c^{(1)}$ . Note that another possibility that could lead to (B.7) is that $h_{\mathrm{S}}^{(q)}(\omega^{(q)})$ always outputs a constant. However, this is not possible because each $h^{(q)} = \widehat{f}^{(q)} \circ g^{(q)}$ is an invertible function, which implies that any dimension of $h^{(q)}(\omega^{(q)})$ cannot be a constant if $\omega^{(q)}$ is not a constant. To be more precise, note that $x^{(q)}$ is generated from $\omega^{(q)}$ that has $D + D_q$ dimensions. If there are $D$ dimensions (i.e., $h_{\mathrm{S}}^{(q)}(\omega^{(q)}) \in \mathbb{R}^D$ ) that are constants (and thus no information) in the learned generative domain, then $x^{(q)}$ cannot be reconstructed from that domain, which contradicts invertibility.
+
+Then, the Jacobian of $\pmb{h}^{(1)}$ can be re-expressed by (B.7)
+
+$$
+\boldsymbol {J} ^ {(1)} = \left[ \begin{array}{c c} \boldsymbol {J} _ {1 1} ^ {(1)} & \boldsymbol {H} _ {S} ^ {(1)} \\ \boldsymbol {J} _ {2 1} ^ {(1)} & \boldsymbol {J} _ {2 2} ^ {(1)} \end{array} \right] = \left[ \begin{array}{c c} \boldsymbol {J} _ {1 1} ^ {(1)} & \boldsymbol {0} _ {D \times D _ {1}} \\ \boldsymbol {J} _ {2 1} ^ {(1)} & \boldsymbol {J} _ {2 2} ^ {(1)} \end{array} \right].
+$$
+
+Next, we show that the determinant of $J_{11}^{(1)}$ is non-zero. By the structure of the Jacobian $J^{(1)}$ , one can see that $\widehat{z}$ is a function of only $z$ but not determined by $c^{(1)}$ , where we denote as $\widehat{z} = \gamma(z)$ . Besides, since $h^{(1)}$ is invertible, we have
+
+$$
+\left| \det J ^ {(1)} \right| = \left| \det J _ {1 1} ^ {(1)} \right| \left| \det J _ {2 2} ^ {(1)} \right| \neq 0
+$$
+
+by the property of determinant for block matrix. It further indicates that $\left|\operatorname{det}J_{11}^{(1)}\right| \neq 0$ (so does $\left|\operatorname{det}J_{22}^{(1)}\right|$ ), which implies that $\gamma(\cdot)$ is an invertible function. This proves Theorem 1.
+
+# C PROOF OF THEOREM 2
+
+Theorem 2. (Private Component Extraction) Under the same conditions as in Theorem 1, also assume that (7d) is enforced, we further have $\widehat{\pmb{c}}^{(q)} = \widehat{\pmb{f}}_{\mathrm{P}}^{(q)}\left(\pmb{x}^{(q)}\right) = \pmb{\delta}^{(q)}\left(\pmb{c}^{(q)}\right)$ , where $\delta^{(q)}(\cdot):\mathbb{R}^{D_q}\to \mathbb{R}^{D_q}$ is a certain invertible function.
+
+Following the proof of Theorem 1, we further consider the expected value version with (7d), i.e.,
+
+$$
+\underset {\boldsymbol {f} ^ {(1)}, \boldsymbol {f} ^ {(2)}} {\text {m a x i m i z e}} \operatorname {T r} \left(\mathbb {E} \left[ \boldsymbol {f} _ {\mathrm {S}} ^ {(1)} \left(\boldsymbol {x} ^ {(1)}\right) \boldsymbol {f} _ {\mathrm {S}} ^ {(2)} \left(\boldsymbol {x} ^ {(2)}\right) ^ {\top} \right]\right) \tag {C.1a}
+$$
+
+subject to $\pmb{f}^{(q)}$ for $q = 1,2$ are invertible, (C.1b)
+
+$$
+\mathbb {E} \left[ \boldsymbol {f} _ {\mathrm {S}} ^ {(q)} \left(\boldsymbol {x} ^ {(q)}\right) \boldsymbol {f} _ {\mathrm {S}} ^ {(q)} \left(\boldsymbol {x} ^ {(q)}\right) ^ {\top} \right] = \boldsymbol {I}, \mathbb {E} \left[ \boldsymbol {f} _ {\mathrm {S}} ^ {(q)} \left(\boldsymbol {x} ^ {(q)}\right) \right] = \mathbf {0}, q = 1, 2, \tag {C.1c}
+$$
+
+$$
+\boldsymbol {f} _ {\mathrm {S}} ^ {(q)} \left(\boldsymbol {x} ^ {(q)}\right) \perp \left. \boldsymbol {f} _ {\mathrm {P}} ^ {(q)} \left(\boldsymbol {x} ^ {(q)}\right), q = 1, 2, \right. \tag {C.1d}
+$$
+
+Again, under our generative model, any optimal solution $(\hat{\pmb{f}}^{(1)},\hat{\pmb{f}}^{(2)})$ satisfies
+
+$$
+\widehat {\boldsymbol {f}} _ {\mathrm {S}} ^ {(1)} (\boldsymbol {x} ^ {(1)}) = \widehat {\boldsymbol {f}} _ {\mathrm {S}} ^ {(2)} (\boldsymbol {x} ^ {(2)}).
+$$
+
+We hope to further show that
+
+$$
+\widehat {\boldsymbol {c}} ^ {(1)} = \widehat {\boldsymbol {f}} _ {\mathrm {P}} \left(\boldsymbol {x} ^ {(1)}\right) = \boldsymbol {h} _ {\mathrm {P}} ^ {(1)} \left(\left[ \begin{array}{c} \boldsymbol {z} \\ \boldsymbol {c} ^ {(1)} \end{array} \right]\right)
+$$
+
+is an invertible function-transformed version of $c^{(1)}$ , where
+
+$$
+\boldsymbol {h} _ {\mathrm {P}} ^ {(q)} (\boldsymbol {\omega} ^ {(q)}) = \left[ \widehat {\boldsymbol {f}} ^ {(q)} \circ \boldsymbol {g} ^ {(q)} (\boldsymbol {\omega} ^ {(q)}) \right] _ {D + 1: D + D _ {q}} = \widehat {\boldsymbol {f}} _ {\mathrm {P}} ^ {(q)} \circ \boldsymbol {g} ^ {(q)} (\boldsymbol {\omega} ^ {(q)}).
+$$
+
+Recall that we have the following Jacobian matrix for function $h^{(1)}$
+
+$$
+\boldsymbol {J} ^ {(1)} = \left[ \begin{array}{c c} \boldsymbol {J} _ {1 1} ^ {(1)} & \boldsymbol {0} \\ \boldsymbol {J} _ {2 1} ^ {(1)} & \boldsymbol {J} _ {2 2} ^ {(1)} \end{array} \right],
+$$
+
+where the second row corresponding to function $h_{\mathrm{P}}^{(1)}$ .
+
+Since we have shown that both $\left|\operatorname{det}J_{11}^{(1)}\right| \neq 0$ and $\left|\operatorname{det}J_{22}^{(1)}\right| \neq 0$ in Section B, we only need to show that $J_{21}^{(1)}$ is an all-zero matrix. To show this, we will use the condition (C.1d). First, it is not hard to see that
+
+$$
+\boldsymbol {J} _ {2 1} ^ {(1)} = \left[ \begin{array}{c c c} \frac {\partial [ \boldsymbol {h} _ {\mathrm {P}} ^ {(1)} (\boldsymbol {\omega} ^ {(1)}) ] _ {1}}{\partial \widehat {z} _ {1}} & \dots & \frac {\partial [ \boldsymbol {h} _ {\mathrm {P}} ^ {(1)} (\boldsymbol {\omega} ^ {(1)}) ] _ {1}}{\partial \widehat {z} _ {D}} \\ \vdots & \ddots & \vdots \\ \frac {\partial [ \boldsymbol {h} _ {\mathrm {P}} ^ {(1)} (\boldsymbol {\omega} ^ {(1)}) ] _ {D _ {1}}}{\partial \widehat {z} _ {1}} & \dots & \frac {\partial [ \boldsymbol {h} _ {\mathrm {P}} ^ {(1)} (\boldsymbol {\omega} ^ {(1)}) ] _ {D _ {1}}}{\partial \widehat {z} _ {D}} \end{array} \right] \boldsymbol {J} _ {1 1} ^ {(1)},
+$$
+
+by chain rules where the first matrix on the right hand side is the Jacobian of $\widehat{c}^{(1)}$ w.r.t. $\widehat{\pmb{z}}$ . By (C.1d), we have $\widehat{c}^{(1)} \perp \widehat{\pmb{z}}$ , which means that we can observe fixed $\tilde{c}^{(1)} = (\widehat{c}_1^{(1)}, \dots, \widehat{c}_i, \dots, \widehat{c}_{D_1}^{(1)})$ for any fixed $\overline{c}_i$ with any possible $\widehat{\pmb{z}}$ . Therefore, at any specific point of $\tilde{c}^{(1)}$ , the following always holds
+
+$$
+\frac {\partial [ \tilde {\boldsymbol {c}} ^ {(1)} ] _ {i}}{\partial \hat {z} _ {j}} = \frac {\partial \overline {{c}} _ {i}}{\partial \hat {z} _ {j}} = 0,
+$$
+
+since the numerator is a constant. Note that the above holds for any $\tilde{c}^{(1)}$ with different $\bar{c}_i$ for $i\in [D_1]$ , which further means that we actually have
+
+$$
+\left[ \begin{array}{c c c} \frac {\partial \left[ \boldsymbol {h} _ {\mathrm {P}} ^ {(1)} (\boldsymbol {\omega} ^ {(1)}) \right] _ {1}}{\partial \widehat {z} _ {1}} & \dots & \frac {\partial \left[ \boldsymbol {h} _ {\mathrm {P}} ^ {(1)} (\boldsymbol {\omega} ^ {(1)}) \right] _ {1}}{\partial \widehat {z} _ {D}} \\ \vdots & \ddots & \vdots \\ \frac {\partial \left[ \boldsymbol {h} _ {\mathrm {P}} ^ {(1)} (\boldsymbol {\omega} ^ {(1)}) \right] _ {D _ {1}}}{\partial \widehat {z} _ {1}} & \dots & \frac {\partial \left[ \boldsymbol {h} _ {\mathrm {P}} ^ {(1)} (\boldsymbol {\omega} ^ {(1)}) \right] _ {D _ {1}}}{\partial \widehat {z} _ {D}} \end{array} \right] = \mathbf {0}
+$$
+
+for all $h_{\mathrm{P}}^{(1)}(\omega^{(1)})$ and $\widehat{z}$
+
+Therefore, $\pmb{J}_{21}^{(1)} = \pmb{0}_{D_1 \times D} \pmb{J}_{11}^{(1)} = \pmb{0}_{D_1 \times D}$ . Consequently, we have the following block diagonal form for $\pmb{J}^{(1)}$ by combing with Theorem 1, i.e.,
+
+$$
+\boldsymbol {J} ^ {(1)} = \left[ \begin{array}{c c} \boldsymbol {J} _ {1 1} ^ {(1)} & \boldsymbol {0} _ {D \times D _ {1}} \\ \boldsymbol {0} _ {D _ {1} \times D} & \boldsymbol {J} _ {2 2} ^ {(1)} \end{array} \right].
+$$
+
+By invertibility of $\widehat{\pmb{f}}^{(q)}$ and $\pmb{g}^{(q)}$ , we have
+
+$$
+\left| \det J ^ {(1)} \right| = \left| \det J _ {1 1} ^ {(1)} \right| \left| \det J _ {2 2} ^ {(1)} \right| \neq 0,
+$$
+
+which implies that $\widehat{z} = \gamma(z)$ and $\widehat{\pmb{c}}^{(1)} = \delta^{(1)}(\pmb{c}^{(1)})$ with invertible functions $\gamma(\cdot)$ and $\delta^{(1)}(\cdot)$ , respectively. The same proof technique applies to $\delta^{(2)}(\cdot)$ .
+
+# D PROOF OF THEOREM 3
+
+Theorem 3. Under the generative model in (5) and Assumptions 1 and 2, assume that $(\pmb{x}_{\ell}^{(1)},\pmb{x}_{\ell}^{(2)})$ for $\ell = 1,\dots ,N$ are i.i.d. samples of $(\pmb{x}^{(1)},\pmb{x}^{(2)})$ . Denote $\widehat{\pmb{f}}^{(q)}\in \mathcal{F}$ as any solution of (7) with the invertibility constraint satisfied. Then, we have the following holds with probability of at least $1 - \delta$ :
+
+$$
+\mathbb {E} \left[ \sum_ {i = 1} ^ {D} \sum_ {j = 1} ^ {D _ {q}} \left(\partial \left[ \widehat {\boldsymbol {f}} _ {\mathrm {S}} \left(\boldsymbol {x} ^ {(q)}\right) \right] _ {i} / \partial c _ {j} ^ {(q)}\right) ^ {2} \right] = O \left(\left(D \Re_ {N} + \sqrt {\log (1 / \delta) / N} + \nu^ {2}\right) ^ {2 / 3}\right) \tag {D.1}
+$$
+
+for any $\pmb{c}^{(q)} \in \mathcal{C}_q$ such that $-C_p + \kappa_j \leq c_j^{(q)} \leq C_p - \kappa_j$ for all $j \in [D_q]$ and all $i \in [D]$ , where $\kappa_j = \Omega((3/C_d)^{1/3}(4C_f(2D\Re_N + C_f\sqrt{\log(1/\delta)/2N}) + 4\nu^2)^{1/6})$ .
+
+# D.1 A LEMMA ON RADEMACHER COMPLEXITY
+
+To derive the Rademacher complexity of the loss function, we have the following lemma
+
+Lemma 1 Consider the following function class
+
+$$
+\mathcal {H} = \left\{l \left(\boldsymbol {x} ^ {(1)}, \boldsymbol {x} ^ {(2)}\right) \Bigg | l \left(\boldsymbol {x} ^ {(1)}, \boldsymbol {x} ^ {(2)}\right) = \sum_ {d = 1} ^ {D} \left(\boldsymbol {f} _ {d} ^ {(1)} \left(\boldsymbol {x} ^ {(1)}\right) - \boldsymbol {f} _ {d} ^ {(2)} \left(\boldsymbol {x} ^ {(2)}\right)\right) ^ {2} \right\}
+$$
+
+where $\pmb{f}_d^{(1)},\pmb{f}_d^{(2)}\in \mathcal{F}'$ are as defined in Assumption 2. Assume that $\left|\pmb{f}_d^{(q)}(\pmb{x}^{(q)})\right|\leq C_f$ for all $\pmb{f}_d^{(q)}\in \mathcal{F}'$ , where $C_f > 0$ . Then, the Rademacher complexity of class $\mathcal{H}$ is bounded by
+
+$$
+\mathfrak {R} _ {N} (\mathcal {H}) \leq 4 D C _ {f} \mathfrak {R} _ {N}.
+$$
+
+Proof: First, we have the function $\left| \pmb{f}_d^{(1)}(\pmb{x}^{(1)}) - \pmb{f}_d^{(2)}(\pmb{x}^{(2)}) \right|$ bounded within $[0, 2C_f]$ . According to the Lipschitz composition property of Rademacher complexity (Bartlett & Mendelson, 2002), we have
+
+$$
+\mathfrak {R} _ {N} (\phi \circ \mathcal {F}) \leq L _ {\phi} \mathfrak {R} _ {N} (\mathcal {F})
+$$
+
+where $L_{\phi}$ is the Lipschitz constant of $\phi$ . Here $\phi(x) = x^2$ and $L_{\phi} = 4C_f$ .
+
+Combining with the linearity property of the Rademacher complexity (Bartlett & Mendelson, 2002), we have
+
+$$
+\Re_ {N} (\mathcal {H}) \leq 4 D C _ {f} \Re_ {N} \tag {D.2}
+$$
+
+which completes the proof of the lemma. Note that (D.2) is derived by treating $\pmb{f}_d^{(q)}$ for $d \in [D]$ as individual functions. However, $\pmb{f}_d^{(q)}$ for $d \in [D]$ are the first $D$ outputs of the same function $\pmb{f}^{(q)}$ —which means that many parameters of these $D$ functions are constrained to be identical. Nonetheless, this fact does not affect the inequality in (D.2) since adding confining constraints to the function class $\mathcal{H}$ only reduces the Rademacher complexity (Bartlett & Mendelson, 2002).
+
+# D.2 PROOF OF THEOREM 3
+
+First, we bound the true risk on the view matching loss. Consider the regression problem given $\left(\boldsymbol{x}_{\ell}^{(1)},\boldsymbol{x}_{\ell}^{(2)}\right)$ as samples, we have
+
+$$
+\underset {\boldsymbol {f} ^ {(1)}, \boldsymbol {f} ^ {(2)}} {\text {m i n i m i z e}} \frac {1}{N} \sum_ {\ell = 1} ^ {N} \left\| \boldsymbol {f} _ {\mathrm {S}} ^ {(1)} \left(\boldsymbol {x} _ {\ell} ^ {(1)}\right) - \boldsymbol {f} _ {\mathrm {S}} ^ {(2)} \left(\boldsymbol {x} _ {\ell} ^ {(2)}\right) \right\| _ {2} ^ {2}.
+$$
+
+By Lemma 1 and (Mohri et al., 2018, Theorem 3.3), we have the following hold with probability at least $1 - \delta$
+
+$$
+\begin{array}{l} \mathbb {E} \left[ \left\| \boldsymbol {f} _ {\mathrm {S}} ^ {(1)} (\boldsymbol {x} _ {\ell} ^ {(1)}) - \boldsymbol {f} _ {\mathrm {S}} ^ {(2)} (\boldsymbol {x} _ {\ell} ^ {(2)}) \right\| _ {2} ^ {2} \right] \leq \frac {1}{N} \sum_ {\ell = 1} ^ {N} \left\| \boldsymbol {f} _ {\mathrm {S}} ^ {(1)} (\boldsymbol {x} _ {\ell} ^ {(1)}) - \boldsymbol {f} _ {\mathrm {S}} ^ {(2)} (\boldsymbol {x} _ {\ell} ^ {(2)}) \right\| _ {2} ^ {2} \\ + 2 \Re_ {N} (\mathcal {H}) + 4 C _ {f} ^ {2} \sqrt {\frac {\log (1 / \delta)}{2 N}}. \\ \end{array}
+$$
+
+By Assumption 2(c), the first term on the right hand side can be bounded as
+
+$$
+\begin{array}{l} \frac {1}{N} \sum_ {\ell = 1} ^ {N} \left\| \boldsymbol {f} _ {\mathrm {S}} ^ {(1)} \left(\boldsymbol {x} _ {\ell} ^ {(1)}\right) - \boldsymbol {f} _ {\mathrm {S}} ^ {(2)} \left(\boldsymbol {x} _ {\ell} ^ {(2)}\right) \right\| _ {2} ^ {2} \\ = \frac {1}{N} \sum_ {\ell = 1} ^ {N} \left\| \boldsymbol {f} _ {\mathrm {S}} ^ {(1)} (\boldsymbol {x} _ {\ell} ^ {(1)}) - \boldsymbol {u} _ {\mathrm {S}} ^ {(1)} (\boldsymbol {x} ^ {(1)}) + \boldsymbol {u} _ {\mathrm {S}} ^ {(2)} (\boldsymbol {x} ^ {(2)}) - \boldsymbol {f} _ {\mathrm {S}} ^ {(2)} (\boldsymbol {x} _ {\ell} ^ {(2)}) \right\| _ {2} ^ {2} \\ \leq \frac {1}{N} \sum_ {\ell = 1} ^ {N} (\nu + \nu) ^ {2} = 4 \nu^ {2}. \\ \end{array}
+$$
+
+where the first equality is because there exist $\pmb{u}^{(1)}\in \mathcal{G}^{-1}$ and $\pmb{u}^{(2)}\in \mathcal{G}^{-1}$ such that $\pmb{u}_{\mathrm{S}}^{(1)}\left(\pmb{x}^{(1)}\right) = \pmb{u}_{\mathrm{S}}^{(2)}\left(\pmb{x}^{(2)}\right) = \gamma (\pmb {z})$ and the second inequality is by the triangle inequality.
+
+Therefore, by plugging in $\Re_N(\mathcal{H})$ we have:
+
+$$
+\mathbb {E} \left[ \left\| \boldsymbol {f} _ {\mathrm {S}} ^ {(1)} \left(\boldsymbol {x} _ {\ell} ^ {(1)}\right) - \boldsymbol {f} _ {\mathrm {S}} ^ {(2)} \left(\boldsymbol {x} _ {\ell} ^ {(2)}\right) \right\| _ {2} ^ {2} \right] \leq \epsilon
+$$
+
+with the definition
+
+$$
+\begin{array}{l} \epsilon := 4 \nu^ {2} + 8 D C _ {f} \Re_ {N} + 4 C _ {f} ^ {2} \sqrt {\frac {\log (1 / \delta)}{2 N}} \\ = 4 C _ {f} \left(2 D \Re_ {N} + C _ {f} \sqrt {\frac {\log (1 / \delta)}{2 N}}\right) + 4 \nu^ {2}. \\ \end{array}
+$$
+
+Next, we use the bound of true risk to bound the energy of the entries of the Jacobian matrix on the left hand side of Eq. (D.1). Denote $\pmb{h}_{\mathrm{S}}^{(q)} = \pmb{f}_{\mathrm{S}}^{(q)} \circ \pmb{g}^{(q)}$ . We define the error for any individual sample pair $(\pmb{x}_{\ell}^{(1)}, \pmb{x}_{\ell}^{(2)}) \sim p(\pmb{x}^{(1)}, \pmb{x}^{(2)})$ as
+
+$$
+\left\| \boldsymbol {f} _ {\mathrm {S}} ^ {(1)} (\boldsymbol {x} _ {\ell} ^ {(1)}) - \boldsymbol {f} _ {\mathrm {S}} ^ {(2)} (\boldsymbol {x} _ {\ell} ^ {(2)}) \right\| _ {2} ^ {2} = \varepsilon_ {\ell},
+$$
+
+with $\mathbb{E}[\varepsilon_{\ell}] \leq \epsilon$
+
+Define another two pairs of samples, such that
+
+$$
+\left\| \boldsymbol {h} _ {\mathrm {S}} ^ {(1)} \left(\left[ \begin{array}{c} \boldsymbol {z} _ {\ell} \\ \boldsymbol {c} _ {\ell} ^ {(1)} + \Delta \boldsymbol {e} _ {j} \end{array} \right]\right) - \boldsymbol {h} _ {\mathrm {S}} ^ {(2)} \left(\left[ \begin{array}{c} \boldsymbol {z} _ {\ell} \\ \boldsymbol {c} _ {\ell} ^ {(2)} \end{array} \right]\right) \right\| _ {2} ^ {2} = \varepsilon_ {\widehat {\ell}},
+$$
+
+$$
+\left\| \boldsymbol {h} _ {\mathrm {S}} ^ {(1)} \left(\left[ \begin{array}{c} \boldsymbol {z} _ {\ell} \\ \boldsymbol {c} _ {\ell} ^ {(1)} - \Delta \boldsymbol {e} _ {j} \end{array} \right]\right) - \boldsymbol {h} _ {\mathrm {S}} ^ {(2)} \left(\left[ \begin{array}{c} \boldsymbol {z} _ {\ell} \\ \boldsymbol {c} _ {\ell} ^ {(2)} \end{array} \right]\right) \right\| _ {2} ^ {2} = \varepsilon_ {\tilde {\ell}},
+$$
+
+where $\Delta > 0$ and $e_j$ is the unit vector in the $c_j^{(1)}$ direction. Then by triangle inequality we have
+
+$$
+\left\| \boldsymbol {h} _ {\mathrm {S}} ^ {(1)} \left(\left[ \begin{array}{c} \boldsymbol {z} _ {\ell} \\ \boldsymbol {c} _ {\ell} ^ {(1)} + \Delta \boldsymbol {e} _ {j} \end{array} \right]\right) - \boldsymbol {h} _ {\mathrm {S}} ^ {(1)} \left(\left[ \begin{array}{c} \boldsymbol {z} _ {\ell} \\ \boldsymbol {c} _ {\ell} ^ {(1)} - \Delta \boldsymbol {e} _ {j} \end{array} \right]\right) \right\| _ {2} \leq \sqrt {\varepsilon_ {\widehat {\ell}}} + \sqrt {\varepsilon_ {\overline {{\ell}}}}.
+$$
+
+Define
+
+$$
+\psi_ {i j} \left(c _ {j} ^ {(1)}\right) := \left[ \boldsymbol {h} _ {\mathrm {S}} ^ {(1)} \left(\left[ \bar {\boldsymbol {z}} ^ {\top}, \left(\bar {c} _ {1} ^ {(1)}, \dots , c _ {j} ^ {(1)}, \dots , \bar {c} _ {D _ {1}} ^ {(1)}\right) \right] ^ {\top}\right) \right] _ {i},
+$$
+
+which is a scalar function of $c_{j}^{(1)}$ with fixed $\bar{z}$ and $\bar{c}_k^{(1)}$ for $k\neq j$
+
+Then the element $\frac{\partial[\widehat{f}_{\mathrm{S}}(\boldsymbol{x}^{(1)})]_i}{\partial c_j^{(1)}}$ can be estimated using the central difference formula as
+
+$$
+\begin{array}{l} \left| \frac {\partial \left[ \widehat {\boldsymbol {f}} _ {\mathrm {S}} \left(\boldsymbol {x} ^ {(1)}\right) \right] _ {i}}{\partial c _ {j} ^ {(1)}} \right| = \left| \frac {\left[ \boldsymbol {h} _ {\mathrm {S}} ^ {(1)} \left(\left[ \begin{array}{l} \boldsymbol {z} _ {\ell} \\ \boldsymbol {c} _ {\ell} ^ {(1)} + \Delta \boldsymbol {e} _ {j} \end{array} \right]\right) - \boldsymbol {h} _ {\mathrm {S}} ^ {(1)} \left(\left[ \begin{array}{l} \boldsymbol {z} _ {\ell} \\ \boldsymbol {c} _ {\ell} ^ {(1)} - \Delta \boldsymbol {e} _ {j} \end{array} \right]\right) \right] _ {i}}{2 \Delta} - \frac {\Delta^ {2}}{1 2} \left(\psi_ {i j} ^ {\prime \prime \prime} (\xi_ {1}) + \psi_ {i j} ^ {\prime \prime \prime} (\xi_ {2})\right) \right| \\ \leq \frac {\left| \left[ \begin{array}{c} \boldsymbol {h} _ {\mathrm {S}} ^ {(1)} \left(\left[ \begin{array}{c} \boldsymbol {z} _ {\ell} \\ \boldsymbol {c} _ {\ell} ^ {(1)} + \Delta \boldsymbol {e} _ {j} \end{array} \right]\right) - \boldsymbol {h} _ {\mathrm {S}} ^ {(1)} \left(\left[ \begin{array}{c} \boldsymbol {z} _ {\ell} \\ \boldsymbol {c} _ {\ell} ^ {(1)} - \Delta \boldsymbol {e} _ {j} \end{array} \right]\right) \right] _ {i} \right|}{2 \Delta} + \left| \frac {\Delta^ {2}}{6} \psi_ {i j} ^ {\prime \prime \prime} (\xi^ {\prime}) \right|, \\ \end{array}
+$$
+
+where $\xi_1 \in (c_{\ell,j}^{(1)}, c_{\ell,j}^{(1)} + \Delta)$ , $\xi_2 \in (c_{\ell,j}^{(1)} - \Delta, c_{\ell,j}^{(1)})$ and by intermediate value theorem $\xi' \in (c_{\ell,j}^{(1)} - \Delta, c_{\ell,j}^{(1)} + \Delta)$ .
+
+Since $|x_{i}| \leq \| x \|_{\infty} \leq \| x \|_{2}$ , we have
+
+$$
+\left| \frac {\partial \left[ \widehat {\boldsymbol {f}} _ {\mathrm {S}} \left(\boldsymbol {x} ^ {(1)}\right) \right] _ {i}}{\partial c _ {j} ^ {(1)}} \right| \leq \frac {\sqrt {\varepsilon_ {\bar {\ell}}} + \sqrt {\varepsilon_ {\bar {\ell}}}}{2 \Delta} + \left| \frac {\Delta^ {2}}{6} \psi_ {i j} ^ {\prime \prime \prime} (\xi^ {\prime}) \right|.
+$$
+
+By taking expectation, we have
+
+$$
+\begin{array}{l} \mathbb {E} \left[ \left| \frac {\partial [ \widehat {\boldsymbol {f}} _ {\mathrm {S}} (\boldsymbol {x} ^ {(1)}) ] _ {i}}{\partial c _ {j} ^ {(1)}} \right| \right] \leq \frac {\mathbb {E} [ \sqrt {\varepsilon_ {\tilde {\ell}}} ] + \mathbb {E} [ \sqrt {\varepsilon_ {\tilde {\ell}}} ]}{2 \Delta} + \left| \frac {\Delta^ {2}}{6} \psi_ {i j} ^ {\prime \prime \prime} (\xi^ {\prime}) \right| \\ \leq \frac {\sqrt {\epsilon}}{\Delta} + \frac {\Delta^ {2}}{6} | \psi_ {i j} ^ {\prime \prime \prime} (\xi^ {\prime}) |, \\ \end{array}
+$$
+
+where the second inequality is by Jensen's inequality
+
+$$
+\mathbb {E} [ \sqrt {\varepsilon_ {\ell}} ] \leq \sqrt {\mathbb {E} [ \varepsilon_ {\ell} ]} \leq \sqrt {\varepsilon},
+$$
+
+due to the concavity of $\sqrt{x}$ .
+
+We aim to find the smallest upper bound, i.e.,
+
+$$
+\inf _ {0 < \Delta < \min \left\{C _ {p} + c _ {\ell , j} ^ {(1)}, C _ {p} - c _ {\ell , j} ^ {(1)} \right\}} \frac {\sqrt {\epsilon}}{\Delta} + \frac {\Delta^ {2}}{6} \left| \psi_ {i j} ^ {\prime \prime \prime} \left(\xi^ {\prime}\right) \right|. \tag {D.3}
+$$
+
+Note that the function in (D.3) is convex and smooth. We have the minimizer
+
+$$
+\Delta^ {*} \in \left\{\left(\frac {3 \sqrt {\epsilon}}{| \psi_ {i j} ^ {\prime \prime \prime} (\xi^ {\prime}) |}\right) ^ {1 / 3}, \min \left\{C _ {p} + c _ {\ell , j} ^ {(1)}, C _ {p} - c _ {\ell , j} ^ {(1)} \right\} \right\},
+$$
+
+which gives us the minimum
+
+$$
+\inf _ {\Delta} \frac {\sqrt {\epsilon}}{\Delta} + \frac {\Delta^ {2}}{6} | \psi_ {i j} ^ {\prime \prime \prime} (\xi^ {\prime}) | \leq \min \left\{\frac {3}{2} \left(\frac {| \psi_ {i j} ^ {\prime \prime \prime} (\xi^ {\prime}) |}{3}\right) ^ {1 / 3} \epsilon^ {1 / 3}, \frac {\sqrt {\epsilon}}{\kappa_ {j}} + \frac {\kappa_ {j} ^ {2}}{6} | \psi_ {i j} ^ {\prime \prime \prime} (\xi^ {\prime}) | \right\}.
+$$
+
+where $\kappa_{j} = \min \left\{C_{p} + c_{\ell ,j}^{(1)},C_{p} - c_{\ell ,j}^{(1)}\right\}$
+
+If $\kappa_{j}\geq \left(\frac{3\sqrt{\epsilon}}{|\psi_{ij}^{\prime\prime\prime}(\xi^{\prime})|}\right)^{1 / 3}$ , then we can bound
+
+$$
+\mathbb {E} \left[ \left| \frac {\partial \left[ \widehat {\boldsymbol {f}} _ {\mathrm {S}} \left(\boldsymbol {x} ^ {(1)}\right) \right] _ {i}}{\partial c _ {j} ^ {(1)}} \right| \right] \leq \frac {3}{2} \left(\frac {| \psi_ {i j} ^ {\prime \prime \prime} (\xi^ {\prime}) |}{3}\right) ^ {1 / 3} \epsilon^ {1 / 3}.
+$$
+
+With fixed $N$ , one can choose $\epsilon = 4C_f\left(2D\Re_N + C_f\sqrt{\frac{\log(1 / \delta)}{2N}}\right) + 4\nu^2$ , which gives the following bound
+
+$$
+\mathbb {E} \left[ \left| \frac {\partial [ \widehat {\boldsymbol {f}} _ {\mathrm {S}} (\boldsymbol {x} ^ {(1)}) ] _ {i}}{\partial c _ {j} ^ {(1)}} \right| \right] \leq \frac {3}{2} \left(\frac {C _ {d}}{3}\right) ^ {1 / 3} \left(4 C _ {f} \left(2 D \Re_ {N} + C _ {f} \sqrt {\frac {\log (1 / \delta)}{2 N}}\right) + 4 \nu^ {2}\right) ^ {1 / 3},
+$$
+
+$$
+\text {i f} \kappa_ {j} \geq \left(\frac {3}{C _ {d}}\right) ^ {1 / 3} \left(4 C _ {f} \left(2 D \Re_ {N} + C _ {f} \sqrt {\frac {\log (1 / \delta)}{2 N}}\right) + 4 \nu^ {2}\right) ^ {1 / 6}.
+$$
+
+Considering all $i,j$ pairs, we have
+
+$$
+\mathbb {E} \left[ \sum_ {i = 1} ^ {D} \sum_ {j = 1} ^ {D _ {1}} \left| \frac {\partial [ \widehat {\boldsymbol {f}} _ {\mathrm {S}} (\boldsymbol {x} ^ {(1)}) ] _ {i}}{\partial c _ {j} ^ {(1)}} \right| \right] \leq \frac {3}{2} D D _ {1} \left(\frac {C _ {d}}{3}\right) ^ {1 / 3} \left(4 C _ {f} \left(2 D \Re_ {N} + C _ {f} \sqrt {\frac {\log (1 / \delta)}{2 N}}\right) + 4 \nu^ {2}\right) ^ {1 / 3}.
+$$
+
+Since $\| \cdot \|_2$ is upper bounded by $\| \cdot \|_1$ , we have
+
+$$
+\mathbb {E} \left[ \sum_ {i = 1} ^ {D} \sum_ {j = 1} ^ {D _ {1}} \left(\frac {\partial \left[ \widehat {\pmb {f}} _ {\mathrm {S}} (\pmb {x} ^ {(1)}) \right] _ {i}}{\partial c _ {j} ^ {(1)}}\right) ^ {2} \right] \leq \frac {9}{4} D ^ {2} D _ {1} ^ {2} \left(\frac {C _ {d}}{3}\right) ^ {2 / 3} \left(4 C _ {f} \left(2 D \Re_ {N} + C _ {f} \sqrt {\frac {\log (1 / \delta)}{2 N}}\right) + 4 \nu^ {2}\right) ^ {2 / 3},
+$$
+
+which completes the proof. The same holds for $q = 2$ by role symmetry.
+
+# E PROOF OF PROPOSITION 1
+
+The claim can be proved by contradiction. Take $q = 1$ for example. Suppose that there exists two elements $\widehat{z}_i^{(1)}$ and $\widehat{c}_j^{(1)}$ that are dependent but (9) is 0. Let
+
+$$
+\phi_ {1} = \pmb {e} _ {i} ^ {\top}, \quad \tau_ {1} = \pmb {e} _ {j} ^ {\top},
+$$
+
+which are valid choices. Then, we have
+
+$$
+\mathbb {C} \circ \mathrm {v} [ \phi_ {1} (\widehat {\boldsymbol {z}} ^ {(1)}), \tau_ {1} (\widehat {\boldsymbol {c}} ^ {(1)}) ] = \mathbb {E} [ \widehat {z} _ {i} ^ {(1)} \widehat {c} _ {j} ^ {(1)} ] - \mathbb {E} [ \widehat {z} _ {i} ^ {(1)} ] \mathbb {E} [ \widehat {c} _ {j} ^ {(1)} ].
+$$
+
+Note that by definition of independence, we have
+
+$$
+\mathbb {E} [ \widehat {z} _ {i} ^ {(1)} \widehat {c} _ {j} ^ {(1)} ] = \mathbb {E} [ \widehat {z} _ {i} ^ {(1)} ] \mathbb {E} [ \widehat {c} _ {j} ^ {(1)} ] \Longleftrightarrow \widehat {z} _ {i} ^ {(1)} \perp \widehat {c} _ {j} ^ {(1)}.
+$$
+
+Hence, $\widehat{z}_i^{(1)}$ and $\widehat{c}_j^{(1)}$ being dependent means that
+
+$$
+\mathbb {E} [ \widehat {z} _ {i} ^ {(1)} \widehat {c} _ {j} ^ {(1)} ] - \mathbb {E} [ \widehat {z} _ {i} ^ {(1)} ] \mathbb {E} [ \widehat {c} _ {j} ^ {(1)} ] \neq 0.
+$$
+
+Consequently, one can see that
+
+$$
+\sup _ {\phi_ {1}, \tau_ {1}} \mathbb {C} \mathbb {O} \mathbb {V} [ \phi_ {1} (\widehat {\pmb {z}} ^ {(1)}), \tau_ {1} (\widehat {\pmb {c}} ^ {(1)}) ] \geq \mathbb {C} \mathbb {O} \mathbb {V} [ \phi_ {1} (\widehat {\pmb {z}} ^ {(1)}), \tau_ {1} (\widehat {\pmb {c}} ^ {(1)}) ] | _ {\phi_ {1} = \pmb {e} _ {i} ^ {\top}, \tau_ {1} = \pmb {e} _ {j} ^ {\top}} = \mathbb {C} \mathbb {O} \mathbb {V} [ \widehat {\pmb {z}} _ {i} ^ {(1)} \widehat {\pmb {c}} _ {j} ^ {(1)} ] \neq 0.
+$$
+
+The above is a contradiction to our assumption that holds.
+
+On the other hand, if $\widehat{z}_i^{(1)}$ and $\widehat{c}_j^{(1)}$ are independent for all $i\in [D]$ and $j\in [D_1]$ , then we have
+
+$$
+\mathbb {E} [ \phi (\widehat {z} _ {i} ^ {(1)}) \tau (\widehat {c} _ {j} ^ {(1)}) ] - \mathbb {E} [ \phi (\widehat {z} _ {i}) ] \mathbb {E} [ \tau (\widehat {c} _ {j} ^ {(1)}) ] = 0,
+$$
+
+for all $i\in [D]$ and $j\in [D_1]$ , for any $\phi :\mathbb{R}\to \mathbb{R}$ and $\tau :\mathbb{R}\rightarrow \mathbb{R}$ .
+
+# F DETAILED ALGORITHM IMPLEMENTATION
+
+Recall that the proposed criterion is
+
+$$
+\underset {\boldsymbol {f} ^ {(1)}, \boldsymbol {f} ^ {(2)}} {\text {m a x i m i z e}} \operatorname {T r} \left(\frac {1}{N} \sum_ {\ell = 1} ^ {N} \boldsymbol {f} _ {\mathrm {S}} ^ {(1)} \left(\boldsymbol {x} _ {\ell} ^ {(1)}\right) \boldsymbol {f} _ {\mathrm {S}} ^ {(2)} \left(\boldsymbol {x} _ {\ell} ^ {(2)}\right) ^ {\top}\right) \tag {F.1a}
+$$
+
+subject to $\pmb{f}^{(q)}$ for $q = 1,2$ are invertible, (F.1b)
+
+$$
+\frac {1}{N} \sum_ {\ell = 1} ^ {N} \boldsymbol {f} _ {\mathrm {S}} ^ {(q)} \left(\boldsymbol {x} _ {\ell} ^ {(q)}\right) \boldsymbol {f} _ {\mathrm {S}} ^ {(q)} \left(\boldsymbol {x} _ {\ell} ^ {(q)}\right) ^ {\top} = \boldsymbol {I}, \frac {1}{N} \sum_ {\ell = 1} ^ {N} \boldsymbol {f} _ {\mathrm {S}} ^ {(q)} \left(\boldsymbol {x} _ {\ell} ^ {(q)}\right) = \mathbf {0}, q = 1, 2, \tag {F.1c}
+$$
+
+$$
+\boldsymbol {f} _ {\mathrm {S}} ^ {(q)} \left(\boldsymbol {x} _ {\ell} ^ {(q)}\right) \perp \boldsymbol {f} _ {\mathrm {P}} ^ {(q)} \left(\boldsymbol {x} _ {\ell} ^ {(q)}\right), q = 1, 2, \tag {F.1d}
+$$
+
+We will use neural networks to parameterize the functions that we aim to learn. To move forward, first, as we have shown in the proof of Theorem 1, Eq. (F.1) is equivalent to the following:
+
+$$
+\underset {\boldsymbol {f} ^ {(1)}, \boldsymbol {f} ^ {(2)}} {\text {m i n i m i z e}} \frac {1}{N} \sum_ {\ell = 1} ^ {N} \left\| \boldsymbol {f} _ {\mathrm {S}} ^ {(1)} \left(\boldsymbol {x} _ {\ell} ^ {(1)}\right) - \boldsymbol {f} _ {\mathrm {S}} ^ {(2)} \left(\boldsymbol {x} _ {\ell} ^ {(2)}\right) \right\| _ {2} ^ {2} \tag {F.2a}
+$$
+
+$$
+\text {s u b j e c t} \frac {1}{N} \sum_ {\ell = 1} ^ {N} \boldsymbol {f} _ {\mathrm {S}} ^ {(q)} \left(\boldsymbol {x} _ {\ell} ^ {(q)}\right) \boldsymbol {f} _ {\mathrm {S}} ^ {(q)} \left(\boldsymbol {x} _ {\ell} ^ {(q)}\right) ^ {\top} = \boldsymbol {I}, \frac {1}{N} \sum_ {\ell = 1} ^ {N} \boldsymbol {f} _ {\mathrm {S}} ^ {(q)} \left(\boldsymbol {x} _ {\ell} ^ {(q)}\right) = \mathbf {0}, q = 1, 2 \tag {F.2b}
+$$
+
+$\pmb{f}^{(q)}$ for $q = 1,2$ are invertible, (F.2c)
+
+$$
+\boldsymbol {f} _ {\mathrm {S}} ^ {(q)} \left(\boldsymbol {x} _ {\ell} ^ {(q)}\right) \perp \boldsymbol {f} _ {\mathrm {P}} ^ {(q)} \left(\boldsymbol {x} _ {\ell} ^ {(q)}\right), q = 1, 2, \tag {F.2d}
+$$
+
+Note that we have manifold constraints on both neural networks $\pmb{f}_{\mathrm{S}}^{(1)}$ and $\pmb{f}_{\mathrm{S}}^{(2)}$ . Directly optimizing over such manifold constraints may be costly and challenging. To reduce the difficulty of this constrained problem, we introduce a slack variable $\pmb{u}_{\ell}$ and recast the formulation in (F.2) as follows:
+
+$$
+\underset {\boldsymbol {f} ^ {(1)}, \boldsymbol {f} ^ {(2)}, \boldsymbol {u} _ {\ell}} {\text {m i n i m i z e}} \mathcal {L} = \frac {1}{N} \sum_ {\ell = 1} ^ {N} \mathcal {L} _ {\ell} = \frac {1}{N} \sum_ {\ell = 1} ^ {N} \sum_ {q = 1} ^ {2} \left\| \boldsymbol {u} _ {\ell} - \boldsymbol {f} _ {\mathrm {S}} ^ {(q)} \left(\boldsymbol {x} _ {\ell} ^ {(q)}\right) \right\| _ {2} ^ {2} \tag {F.3a}
+$$
+
+$$
+\text {s u b j e c t} \frac {1}{N} \sum_ {\ell = 1} ^ {N} \boldsymbol {u} _ {\ell} \boldsymbol {u} _ {\ell} ^ {\top} = I, \frac {1}{N} \sum_ {\ell = 1} ^ {N} \boldsymbol {u} _ {\ell} = \mathbf {0}. \tag {F.3b}
+$$
+
+$$
+\boldsymbol {f} ^ {(q)} \text {f o r} q = 1, 2 \text {a r e i n v e r t i b l e}, \tag {F.3c}
+$$
+
+$$
+\boldsymbol {f} _ {\mathrm {S}} ^ {(q)} \left(\boldsymbol {x} _ {\ell} ^ {(q)}\right) \perp \perp \boldsymbol {f} _ {\mathrm {P}} ^ {(q)} \left(\boldsymbol {x} _ {\ell} ^ {(q)}\right), q = 1, 2, \tag {F.3d}
+$$
+
+Ideally, we hope that $\boldsymbol{u}_{\ell} = \gamma(\boldsymbol{z}_{\ell})$ . Introducing $\boldsymbol{u}_{\ell}$ makes the $\boldsymbol{f}^{(1)}$ and $\boldsymbol{f}^{(2)}$ subproblems unconstrained. This is a commonly used reformulation in neural network based multiview matching (see (Benton et al., 2017; Lyu & Fu, 2020)), which is reminiscent of the MAX-VAR formulation of CCA (Kettenring, 1971; Carroll, 1968; Rastogi et al., 2015). Such reformulations oftentimes make algorithm design easier, since the constraints are simplified.
+
+The invertibility and independence constraints in (F.3c) and (F.3d) are also not straightforward to enforce. Instead of directly enforcing the invertibility constraint in (F.3c), we design a regularization term. Specifically, we use the idea of autoencoder that reconstructs the samples from their latent representations $\pmb{f}^{(q)}(\pmb{x}_{\ell}^{(q)})$ . We define a regularizer
+
+$$
+\mathcal {V} = \frac {1}{N} \sum_ {\ell = 1} ^ {N} \mathcal {V} _ {\ell} = \frac {1}{N} \sum_ {\ell = 1} ^ {N} \sum_ {q = 1} ^ {2} \left\| \boldsymbol {x} _ {\ell} ^ {(q)} - \boldsymbol {r} ^ {(q)} \left(\boldsymbol {f} ^ {(q)} \left(\boldsymbol {x} _ {\ell} ^ {(q)}\right)\right) \right\| _ {2} ^ {2}, \tag {F.4}
+$$
+
+as the reconstruction loss, where $\boldsymbol{r}^{(q)}$ 's are the reconstruction neural networks. Note that the above term being zero does not necessarily indicate that the function $\boldsymbol{f}^{(q)}$ is invertible, since this term is only imposed on limited number of samples. But in practice, this idea is effective in learning invertible transformations—also see (Wang et al., 2015; Lyu & Fu, 2020).
+
+To promote the statistical independence constraint in (F.3d), we use the designed independence regularizer, i.e.,
+
+$$
+\sup _ {\boldsymbol {\phi} ^ {(q)}, \boldsymbol {\tau} ^ {(q)}} \mathcal {R} ^ {(q)} = \sup _ {\boldsymbol {\phi} ^ {(q)}, \boldsymbol {\tau} ^ {(q)}} \frac {\left| \complement_ {\mathbb {O}} \mathbb {V} \left[ \boldsymbol {\phi} ^ {(q)} \left(\widehat {\boldsymbol {z}} ^ {(q)}\right) , \boldsymbol {\tau} ^ {(q)} \left(\widehat {\boldsymbol {c}} ^ {(q)}\right) \right] \right|}{\left(\sqrt {\mathbb {V} \left[ \boldsymbol {\phi} ^ {(q)} \left(\widehat {\boldsymbol {z}} ^ {(q)}\right) \right]} \sqrt {\mathbb {V} \left[ \boldsymbol {\tau} ^ {(q)} \left(\widehat {\boldsymbol {c}} ^ {(q)}\right) \right]}\right)}, \tag {F.5}
+$$
+
+where $\phi^{(q)}$ and $\tau^{(q)}$ are again represented by neural networks.
+
+Let $\pmb{\theta}$ collect the parameters of $\pmb{f}^{(q)}$ and $\pmb{r}^{(q)}$ , and $\pmb{\eta}$ the parameters of $\phi^{(q)}$ and $\pmb{\tau}^{(q)}$ . Putting all the terms together, our working cost function is summarized as follows:
+
+$$
+\min _ {\boldsymbol {U}, \boldsymbol {\theta}} \max _ {\boldsymbol {\eta}} \frac {1}{N} \sum_ {\ell = 1} ^ {N} \mathcal {L} _ {\ell} (\boldsymbol {\theta}, \boldsymbol {U}) + \beta \frac {1}{N} \sum_ {\ell = 1} ^ {N} \mathcal {V} _ {\ell} (\boldsymbol {\theta}) + \lambda \mathcal {R} (\boldsymbol {\theta}, \boldsymbol {\eta}), \tag {F.6a}
+$$
+
+$$
+\text {s u b j e c t} \frac {1}{N} \sum_ {\ell = 1} ^ {N} \boldsymbol {U} \boldsymbol {U} ^ {\top} = \boldsymbol {I}, \frac {1}{N} \boldsymbol {U} \mathbf {1} = \mathbf {0}, \tag {F.6b}
+$$
+
+where $\pmb{U} = [\pmb{u}_1, \dots, \pmb{u}_N] \in \mathbb{R}^{D \times N}$ , and $\beta$ and $\lambda$ are nonnegative and $\mathcal{R} = \sum_{q=1}^{2} \mathcal{R}^{(q)}$ .
+
+In terms of algorithm design, we propose to handle $U$ , $\theta$ and $\eta$ cyclically when the other two are fixed, i.e., alternating optimization (AO).
+
+First, we use stochastic gradient descent and ascent for the unconstrained $\theta$ and $\eta$ subproblems. To proceed, we sample a batch of data indexed by $\mathcal{B} \subseteq [N]$ . Then, $\theta$ and $\eta$ can be updated by any stochastic gradient based optimizers, e.g., the plain-vanilla stochastic gradient descent/ascent,
+
+$$
+\boldsymbol {\theta} \leftarrow \boldsymbol {\theta} - \gamma \left(\frac {1}{| \mathcal {B} |} \sum_ {\ell \in \mathcal {B}} (\nabla_ {\boldsymbol {\theta}} \mathcal {L} _ {\ell} (\boldsymbol {\theta}, \boldsymbol {U}) + \beta \nabla_ {\boldsymbol {\theta}} \mathcal {V} _ {\ell} (\boldsymbol {\theta})) + \lambda \widehat {\nabla} _ {\boldsymbol {\theta}} \mathcal {R} (\boldsymbol {\theta}, \boldsymbol {\eta})\right),
+$$
+
+$$
+\boldsymbol {\eta} \leftarrow \boldsymbol {\eta} + \delta \left(\lambda \widehat {\nabla} _ {\boldsymbol {\eta}} \mathcal {R} (\boldsymbol {\theta}, \boldsymbol {\eta})\right),
+$$
+
+where $\gamma$ and $\delta$ are the step sizes for the updates of $\theta$ and $\eta$ , respectively. The stochastic gradients of $\mathcal{L}$ , $\mathcal{V}$ are defined as follows:
+
+$$
+\widehat {\nabla} _ {\boldsymbol {\theta}} \mathcal {L} := \frac {1}{| \mathcal {B} |} \sum_ {\ell \in \mathcal {B}} \nabla_ {\boldsymbol {\theta}} \mathcal {L} _ {\ell} (\boldsymbol {\theta}, \boldsymbol {U}) \tag {F.7a}
+$$
+
+$$
+\widehat {\nabla} _ {\boldsymbol {\theta}} \mathcal {V} := \frac {1}{| \mathcal {B} |} \sum_ {\ell \in \mathcal {B}} \nabla_ {\boldsymbol {\theta}} \mathcal {V} _ {\ell} (\boldsymbol {\theta}). \tag {F.7b}
+$$
+
+In addition, the terms $\widehat{\nabla}_{\pmb{\theta}}\mathcal{R}$ and $\widehat{\nabla}_{\eta}\mathcal{R}$ are defined similarly. Taking the latter as an example. We have $\widehat{\nabla}_{\eta}\mathcal{R} = \sum_{q=1}^{2} \widehat{\nabla}_{\eta}\mathcal{R}^{(q)}$ , and $\widehat{\nabla}_{\eta}\mathcal{R}^{(q)}$ is estimated by taking gradient w.r.t. $\pmb{\eta}$ of the following batch-estimated $\mathcal{R}^{(q)}$ (the same holds for $\widehat{\nabla}_{\pmb{\theta}}\mathcal{R}$ ):
+
+$$
+\begin{array}{l} \mathcal {R} _ {\mathcal {B}} ^ {(q)} := \tag {F.8a} \\ \left| \frac {1}{| \mathcal {B} |} \sum_ {\ell \in \mathcal {B}} \left(\phi^ {(q)} \left(\widehat {\boldsymbol {z}} _ {\ell} ^ {(q)}\right) - \frac {1}{| \mathcal {B} |} \sum_ {\ell \in \mathcal {B}} \phi^ {(q)} \left(\widehat {\boldsymbol {z}} _ {\ell} ^ {(q)}\right)\right) \left(\boldsymbol {\tau} ^ {(q)} \left(\widehat {\boldsymbol {c}} _ {\ell} ^ {(q)}\right) - \frac {1}{| \mathcal {B} |} \sum_ {\ell \in \mathcal {B}} \boldsymbol {\tau} ^ {(q)} \left(\widehat {\boldsymbol {c}} _ {\ell} ^ {(q)}\right)\right) \right| \\ \end{array}
+$$
+
+$$
+\sqrt {\frac {1}{| \mathcal {B} |} \sum_ {\ell \in \mathcal {B}} \left(\phi^ {(q)} \left(\widehat {\boldsymbol {z}} _ {\ell} ^ {(q)}\right) - \frac {1}{| \mathcal {B} |} \sum_ {\ell \in \mathcal {B}} \phi^ {(q)} \left(\widehat {\boldsymbol {z}} _ {\ell} ^ {(q)}\right)\right) ^ {2}} \sqrt {\frac {1}{| \mathcal {B} |} \sum_ {\ell \in \mathcal {B}} \left(\boldsymbol {\tau} ^ {(q)} \left(\widehat {\boldsymbol {c}} _ {\ell} ^ {(q)}\right) - \frac {1}{| \mathcal {B} |} \sum_ {\ell \in \mathcal {B}} \boldsymbol {\tau} ^ {(q)} \left(\widehat {\boldsymbol {c}} _ {\ell} ^ {(q)}\right)\right) ^ {2}}
+$$
+
+$$
+\widehat {\nabla} _ {\eta} \mathcal {R} ^ {(q)} := \nabla_ {\eta} \mathcal {R} _ {\mathcal {B}} ^ {(q)} \tag {F.8b}
+$$
+
+$$
+\widehat {\nabla} _ {\boldsymbol {\theta}} \mathcal {R} ^ {(q)} := \nabla_ {\boldsymbol {\theta}} \mathcal {R} _ {\mathcal {B}} ^ {(q)}. \tag {F.8c}
+$$
+
+It was shown in (Fisher, 1915) that the correlation coefficient is computed using random samples of Gaussian variables, the estimator in (F.8a) for $\mathcal{R}^{(q)}$ is asymptotically unbiased. For other distributions, the estimation also works well in practice; see, e.g., DCCA based works in (Wang et al., 2015).
+
+Consider more general stochastic optimizers, e.g., Adam (Kingma & Ba, 2015) and Adagrad (Duchi et al., 2011). Then, the updates can be summarized as follows:
+
+$$
+\boldsymbol {\theta} \leftarrow \text {S G D - o p t i m i z e r} \left(\boldsymbol {\theta}, \widehat {\nabla} _ {\boldsymbol {\theta}} \mathcal {L} + \beta \widehat {\nabla} _ {\boldsymbol {\theta}} \mathcal {V} + \lambda \widehat {\nabla} _ {\boldsymbol {\theta}} \mathcal {R}\right) \tag {F.9}
+$$
+
+$$
+\boldsymbol {\eta} \leftarrow \text {S G D - o p t i m i z e r} \left(\boldsymbol {\eta}, - \widehat {\nabla} _ {\boldsymbol {\eta}} \mathcal {R}\right). \tag {F.10}
+$$
+
+where (F.10) uses the negative stochastic gradient since it is an ascending step, while stochastic optimizers are by default descending the objective function.
+
+The $U$ subproblem consists of (F.3a) and (F.3b). It can be re-expressed as follows by expanding (F.3a):
+
+$$
+\begin{array}{l} \frac {1}{N} \sum_ {\ell = 1} ^ {N} \sum_ {q = 1} ^ {2} \left\| \boldsymbol {u} _ {\ell} - \boldsymbol {f} _ {\mathrm {S}} ^ {(q)} (\boldsymbol {x} _ {\ell} ^ {(q)}) \right\| _ {2} ^ {2} \\ = \frac {1}{N} \sum_ {\ell = 1} ^ {N} \operatorname {T r} \left(2 \boldsymbol {u} _ {\ell} \boldsymbol {u} _ {\ell} ^ {\top} - 2 \boldsymbol {u} _ {\ell} \left(\boldsymbol {f} _ {\mathrm {S}} ^ {(1)} \left(\boldsymbol {x} _ {\ell} ^ {(1)}\right) + \boldsymbol {f} _ {\mathrm {S}} ^ {(2)} \left(\boldsymbol {x} _ {\ell} ^ {(2)}\right)\right) ^ {\top} + \sum_ {q = 1} ^ {2} \boldsymbol {f} _ {\mathrm {S}} ^ {(q)} \left(\boldsymbol {x} _ {\ell} ^ {(q)}\right) \boldsymbol {f} _ {\mathrm {S}} ^ {(q)} \left(\boldsymbol {x} _ {\ell} ^ {(q)}\right) ^ {\top}\right). \\ \end{array}
+$$
+
+Note that the first term is a constant by (F.3b) and the last term does not involve $\pmb{u}_{\ell}$ . Then, we rewrite the $\pmb{u}_{\ell}$ subproblem as
+
+$$
+\underset {\boldsymbol {U}} {\text {m a x i m i z e}} \operatorname {T r} \left(\boldsymbol {U} \left(\boldsymbol {F} ^ {(1)} + \boldsymbol {F} ^ {(2)}\right)\right), \tag {F.11}
+$$
+
+$$
+\text {s u b j e c t} \frac {1}{N} \boldsymbol {U} \boldsymbol {U} ^ {\top} = \boldsymbol {I}, \frac {1}{N} \boldsymbol {U} \boldsymbol {1} = \boldsymbol {0},
+$$
+
+where $\pmb{F}^{(q)} = \left[\pmb{f}_{\mathrm{S}}^{(q)}(\pmb{x}_1^{(q)}), \dots, \pmb{f}_{\mathrm{S}}^{(q)}(\pmb{x}_N^{(q)})\right]$ . This is an orthogonal projection onto the set of row zero-mean and orthogonal matrices. It is shown in (Lyu & Fu, 2020, Lemma 1) that such a projection problem, although nonconvex, can be solved to optimality via a mean-removed singular value decomposition (SVD) procedure, i.e.,
+
+$$
+\boldsymbol {U} \leftarrow \sqrt {N} \boldsymbol {S T} ^ {\top}, \text {w i t h} \boldsymbol {S D T} ^ {\top} = \operatorname {S V D} \left(\left(\boldsymbol {F} ^ {(1)} + \boldsymbol {F} ^ {(2)}\right) \boldsymbol {W}\right), \tag {F.12}
+$$
+
+where $\pmb{W} = \pmb{I}_N - \frac{1}{N}\pmb{1}\pmb{1}^\top$ removes the mean of $\pmb{F}^{(1)} + \pmb{F}^{(2)}$ , $\pmb{D} \in \mathbb{R}^{D \times D}$ holds the singular values, $\pmb{S} \in \mathbb{R}^{D \times D}$ and $\pmb{T} \in \mathbb{R}^{N \times D}$ are the left and right orthogonal matrices in the SVD, respectively.
+
+To summarize, an alternating optimization algorithm is summarized in Algorithm 1. Notice that we use two different batch sizes (denoted as $\mathcal{B}_1$ and $\mathcal{B}_2$ in line 4 of Algorithm 1) to construct the gradient estimations for $\widehat{\nabla}_{\theta}\mathcal{L}$ , $\widehat{\nabla}_{\theta}\mathcal{V}$ and $\widehat{\nabla}_{\theta}\mathcal{R}$ , $\widehat{\nabla}_{\eta}\mathcal{R}$ , respectively. The reason is that accurately
+
+Algorithm 1: Proposed Algorithm.
+Data: $\pmb{x}_{\ell}^{(q)}$ for $\ell = 1,\dots ,N$ and $q = 1,2$ Result: $\pmb{f}^{(q)},\pmb{r}^{(q)}$
+while stopping criterion is not reached do
+ $U\gets \sqrt{N} ST^{\top}$ with $SDT^{\top} = SVD((F^{(1)} + F^{(2)})W)$
+while stopping criterion is not reached do
+draw a random batch $\mathcal{B}_1$ and $\mathcal{B}_2$ // use $|\mathcal{B}_2| > |\mathcal{B}_1|$ $\widehat{\nabla}_{\theta}\mathcal{L}\leftarrow \frac{1}{|\mathcal{B}_1|}\sum_{\ell \in \mathcal{B}_1}\nabla_{\theta}\mathcal{L}_{\ell};$ $\widehat{\nabla}_{\theta}\mathcal{V}\leftarrow \frac{1}{|\mathcal{B}_1|}\sum_{\ell \in \mathcal{B}_1}\nabla_{\theta}\mathcal{V}_{\ell};$ $\widehat{\nabla}_{\eta}\mathcal{R}\leftarrow \sum_{q = 1}^{2}\nabla_{\eta}\mathcal{R}_{\mathcal{B}_2}^{(q)};$ // using $\mathcal{B}_2$ and (F.8a), (F.8b)
+ $\widehat{\nabla}_{\theta}\mathcal{R}\leftarrow \sum_{q = 1}^{2}\nabla_{\theta}\mathcal{R}_{\mathcal{B}_2}^{(q)};$ // using $\mathcal{B}_2$ and (F.8a), (F.8c)
+ $\pmb {\theta}\gets \mathrm{SGD\_opt�izer}\left(\pmb {\theta},\widehat{\nabla}_{\theta}\mathcal{L} + \beta \widehat{\nabla}_{\theta}\mathcal{V} + \lambda \widehat{\nabla}_{\theta}\mathcal{R}\right);$ // descent
+ $\pmb {\eta}\gets \mathrm{SGD\_opt�izer}\left(\pmb {\eta}, - \lambda \widehat{\nabla}_{\eta}\mathcal{R}\right);$ // ascent
+end
+
+Table F.1: Computational complexity of the proposed algorithm in each iteration, where $d_{\theta}$ and $d_{\eta}$ denote the parameter dimensions of the encoder/reconstruction and the independence-promoting networks, respectively.
+Complexity (flops)
+Line 2 $O(ND^2)$
+Line 5 $O(|\mathcal{B}_1|d_\theta)$
+Line 6 $O(|\mathcal{B}_1|d_\theta)$
+Line 7 $O(|\mathcal{B}_2|d_\eta)$
+Line 8 $O(|\mathcal{B}_2|d_\theta)$
+Line 9 $O(d_\theta)$
+Line 10 $O(d_\eta)$
+Overall $O\left(ND^2 + (|\mathcal{B}_1| + |\mathcal{B}_2|) d_\theta + |\mathcal{B}_2| d_\eta\right)$
+
+estimating of $\mathcal{R}$ using (F.8a) often requires a relatively large batch size, while small batches may suffice for the gradient estimations of $\mathcal{L}$ and $\mathcal{V}$ , according to our extensive simulations.
+
+Computational Complexity. Tab. F.1 summarizes the computational complexity of each step. Specifically, line 2 requires computing a thin SVD, which requires $O(ND^2)$ flops. Note that this is linear in the number of samples $N$ , and $D$ is the dimension of the shared component, which is often relatively small in practice.
+
+Inside the inner loop line 4-10, lines 5 and 6 construct the gradient estimations w.r.t. $\theta$ and $\eta$ . These two steps cost $O(|\mathcal{B}_1|d_\theta)$ flops. Similarly, lines 7 and 8 use $O(|\mathcal{B}_2|d_\eta)$ and $O(|\mathcal{B}_2|d_\theta)$ flops, respectively. Note that we have used $d_{\theta}$ and $d_{\eta}$ to denote the parameter dimensions of the encoder/reconstruction and the independence-promoting networks, respectively. Typically, $|\mathcal{B}_1|$ and $|\mathcal{B}_2|$ are small numbers compared to $N$ (e.g., $|\mathcal{B}_1| = 128$ , $|\mathcal{B}_2| = 512$ while $N$ could easily exceed $10^{\circ}$ ). For line 9 and 10, when a first-order stochastic optimizer (e.g., plain-vanilla SGD, ADAM, Adagrad) is used, this step has a computational complexity that is linear in terms of the network size.
+
+One can see that all the steps scale linearly with size of the neural networks or the sample size, which makes the algorithm easy to run with large-scale data sets and large-size neural feature extractors.
+
+
+Figure G.1: Left: $z$ ; middle: t-SNE of $\pmb{x}^{(1)}$ ; right: t-SNE of $\pmb{x}^{(2)}$ .
+
+
+
+
+
+# G EXPERIMENTS: MORE DETAILS AND ADDITIONAL VALIDATIONS
+
+In this section, we show all the experiment results with greater details, e.g., results under more metrics, more setting details, and more demonstrations. We also include more real data experiments using the CIFAR10 (Krizhevsky et al., 2009) and dSprites data (Higgins et al., 2017).
+
+# G.1 SYNTHETIC DATA - VALIDATING MAIN THEOREMS
+
+In this subsection, we describe the synthetic data experiments. For synthetic data, we generate the shared $z \in \mathbb{R}^2$ that is uniformly drawn from the unit circle, with noise $\mathcal{N}(0, 0.02^2)$ added to each dimension. The private components are scalars $c^{(1)} \sim \mathcal{N}(0, 2.0)$ and $c^{(2)} \sim \mathrm{Laplace}(0, 4.0)$ . The shared-to-private energy ratios for the two views are approximately -6 dB and -18 dB. The sample size is $N = 5,000$ . And we use two different one-hidden-layer neural networks with 3 neurons and softmax activation to represent the invertible $g^{(q)}$ 's. The network parameters are drawn from standard normal distribution.
+
+The shared component $z$ and the t-SNE of $x^{(1)}$ and $x^{(2)}$ are shown in Fig. G.1. One can see that by incorporating strong noise and nonlinear transformations, the shape of circle is hardly to be identified in both views.
+
+In our simulations, $f^{(q)}$ is represented by a three-hidden-layer multi-layer perceptrons (MLPs) with 256 neurons in each layer with ReLU activations. In addition, $\phi^{(q)}$ and $\pmb{\tau}^{(q)}$ are represented by two-hidden-layer MLPs with 128 neurons in each layer. We set batch size to be 1000, $\beta = 1.0$ , $\lambda = 0.1$ . We use the Adam optimizer (Kingma & Ba, 2015) with initial learning rate 0.001 for all the parameters. Besides, we also regularize the network parameters using $\| \eta \|_2^2$ with a regularization parameter 0.1. This often helps improve numerical stability when optimizing cost functions involving neural networks. We run lines 4-10 of Algorithm 1 for 10 epochs to update $\theta$ and $\eta$ .
+
+For ablation study, we test the methods with different combinations of $\mathcal{L}$ , $\mathcal{R}$ and $\mathcal{V}$ , i.e.,
+
+(i) the proposed method $(\mathcal{L} + \mathcal{V} + \mathcal{R})$
+(ii) the proposed without independence regularization $(\mathcal{L} + \mathcal{V})$
+(iii) the proposed without reconstruction $(\mathcal{L} + \mathcal{R})$
+(iv) the proposed with only latent correlation maximization $(\mathcal{L})$
+(v) we also test the performance with HSIC (Gretton et al., 2007) as the independence regularizer $(\mathcal{L} + \mathcal{V} + \mathrm{HISC})$ ;
+
+All methods stop when the average matching loss $\mathcal{L}$ reaches 0.01. The learned components by the proposed method are shown in Fig. G.2. One can see that the estimated shared components are matched, while the second view exhibits relatively large noise level as expected. For the estimated private components, one can see that both $\delta^{(1)}(\cdot)$ and $\delta^{(2)}(\cdot)$ are approximately invertible functions.
+
+To evaluate the performance of the synthetic experiment, we compute mutual information (MI) between groups of random variables of interest (measured by the mutual information neural estimation
+
+
+
+
+scatter plot of $\widehat{z}^{(2)}$
+Figure G.2: (a) Scatter plot of $\widehat{z}^{(1)}$ ; (b) $\widehat{c}^{(1)}$ as a function of $c^{(1)}$ ; (c) Scatter plot of $\widehat{z}^{(2)}$ ; (d) $\widehat{c}^{(2)}$ as a function of $c^{(2)}$ .
+
+
+$\widehat{c}^{(1)}$ as a function of $c^{(1)}$
+
+
+$\widehat{c}^{(2)}$ as a function of $c^{(2)}$
+
+(MINE) (Belghazi et al., 2018) and Gaussian kernel density estimation (KDE) (Davis et al., 2011)). The results are averaged from 10 random trials.
+
+One can see that all methods successfully extract the information about $\mathbf{z}$ in the sense that both $\widehat{\mathbf{z}}^{(q)} = \widehat{\mathbf{f}}_{\mathrm{S}}^{(q)}(\mathbf{x}^{(q)})$ for $q = 1,2$ have similarly high MIs with $\mathbf{z}$ . Besides, all methods output $\widehat{\mathbf{z}}^{(q)}$ and $\widehat{c}^{(q)}(c^{(q)})$ that have small MIs—meaning that they are not dependent.
+
+Although most loss functions using latent correlation maximization extract the shared $z$ 's information well, the difference is articulated in extracting the private information. The proposed $\mathcal{L} + \mathcal{V} + \mathcal{R}$ objective has the best performance on that regard. The method $\mathcal{L} + \mathcal{V} + \mathrm{HSIC}$ also works reasonably well since HSIC serves the same purpose as $\mathcal{R}$ does—but with a kernel-based implementation.
+
+Moreover, by looking at the last two columns, one can see that the methods with $\mathcal{R}$ and $\nu$ perform the best in removing the information of $z$ from $c^{(q)}$ . This corroborates our analysis that both (7b) (invertibility) and (7d) (independence) are vital to achieve private-shared information disentangle-ment.
+
+Tab. G.1 shows the results, with all the entries averaged over 10 random trials. One can see that the results via the Gaussian KDE are consistent with those under MINE. That is, the proposed $\mathcal{L} + \mathcal{V} + \mathcal{R}$ exhibits the best performance in terms of extracting and disentangling the shared and private information.
+
+# G.2 SYNTHETIC DATA - ROBUSTNESS TO STRONG PRIVATE INTERFERENCE
+
+In this subsection, we demonstrate the performance of the proposed method under different levels of private component energy (which are often considered interference) (Ibrahim & Sidiropoulos, 2020; Bach & Jordan, 2005; Lyu & Fu, 2020). First, we define the shared-to-private ratio (SPR) for the $q$ -th view as
+
+$$
+\mathrm {S P R} = 1 0 \log_ {1 0} \left(\frac {\frac {1}{D N} \sum_ {\ell = 1} ^ {N} \| \boldsymbol {z} _ {\ell} \| _ {2} ^ {2}}{\frac {1}{D _ {q} N} \sum_ {\ell = 1} ^ {N} \| \boldsymbol {c} _ {\ell} ^ {(q)} \| _ {2} ^ {2}}\right) \mathrm {d B}.
+$$
+
+For the experiment, we make both views have identical SPRs. We test the performance under $\mathrm{SPR} = -10$ dB, $-20$ dB and $-30$ dB, respectively.
+
+Table G.1: Mutual information (MI) between groups of variables. “↑”: high score preferred; “↓”: low score preferred; “n/a”: not applicable; $\widehat{\mathbf{z}}^{(q)} = \widehat{\mathbf{f}}_{\mathrm{S}}^{(q)}$ for $q = 1,2$ .
+
+ | z(1),z(↑) | z(2),z(↑) | z(1),c(1)(↓) | z(2),c(2)(↓) | c(1),c(1)(↑) | c(2),c(2)(↑) | c(1),z(↓) | c(2),z(↓) |
| Metric | MINE-based MI Estimation (Belghazi et al., 2018) |
| L | 2.32±0.06 | 2.36±0.10 | 0.01±0.00 | 0.00±0.00 | 0.45±0.13 | 0.33±0.07 | 0.39±0.14 | 0.43±0.04 |
| L+V | 2.37±0.05 | 2.38±0.08 | 0.01±0.00 | 0.01±0.00 | 0.55±0.09 | 0.33±0.08 | 0.31±0.06 | 0.43±0.05 |
| L+R | 2.32±0.05 | 2.33±0.07 | 0.02±0.01 | 0.00±0.00 | 0.90±0.42 | 0.22±0.12 | 0.09±0.06 | 0.22±0.12 |
| L+V+R | 2.43±0.04 | 2.39±0.09 | 0.01±0.01 | 0.01±0.00 | 1.22±0.33 | 0.85±0.23 | 0.04±0.02 | 0.11±0.03 |
| L+V+HSIC | 2.48±0.09 | 2.43±0.08 | 0.01±0.00 | 0.01±0.01 | 0.68±0.25 | 0.52±0.14 | 0.04±0.01 | 0.07±0.02 |
| Metric | Gaussian kernel density estimate (KDE)-based MI Estimation |
| L | 2.73±0.22 | 2.88±0.22 | 0.00±0.00 | 0.00 | 0.33±0.13 | 0.01±0.02 | 0.34±0.13 | 0.37±0.06 |
| L+V | 2.95±0.21 | 2.91±0.26 | 0.00±0.01 | 0.00 | 0.38±0.11 | 0.01±0.02 | 0.24±0.04 | 0.39±0.07 |
| L+R | 2.83±0.18 | 2.86±0.15 | 0.00 | 0.00 | 0.72±0.40 | 0.10±0.10 | 0.08±0.07 | 0.28±0.16 |
| L+V+R | 3.27±0.07 | 2.88±0.25 | 0.00±0.01 | 0.00 | 0.99±0.30 | 0.35±0.11 | 0.03±0.04 | 0.08±0.03 |
| L+V+HSIC | 3.35±0.16 | 2.95±0.33 | 0.00 | 0.00 | 0.78±0.22 | 0.06±0.06 | 0.05±0.02 | 0.02±0.01 |
+
+Table G.2: Mutual information (MI) between groups of variables under different SPR. “↑”: high score preferred; “↓”: low score preferred; $\hat{z}^{(q)} = \hat{f}_{\mathrm{S}}^{(q)}$ for $q = 1, 2$ .
+
+ | z(1),z(↑) | z(2),z(↑) | z(1),c(1)(↓) | z(2),c(2)(↓) | c(1),c(1)(↑) | c(2),c(2)(↑) | c(1),z(↓) | c(2),z(↓) |
| SPR | MINE-based MI Estimation (Belghazi et al., 2018) |
| -10 dB | 2.41±0.07 | 2.43±0.05 | 0.01±0.01 | 0.01±0.01 | 1.72±0.41 | 0.52±0.10 | 0.02±0.01 | 0.19±0.03 |
| -20 dB | 1.81±0.10 | 2.15±0.09 | 0.10±0.06 | 0.01±0.01 | 1.41±0.15 | 1.15±0.07 | 0.08±0.04 | 0.06±0.02 |
| -30 dB | 1.16±0.07 | 1.55±0.10 | 0.11±0.09 | 0.07±0.04 | 1.77±0.42 | 0.73±0.14 | 0.03±0.02 | 0.14±0.11 |
+
+Table G.3: Mutual information (MI) between groups of variables with different $\beta$ (i.e. reconstruction term). "↑": high score preferred; "↓": low score preferred; $\widehat{z}^{(q)} = \widehat{f}_{\mathrm{S}}^{(q)}$ for $q = 1,2$ .
+
+ | z(1),z(↑) | z(2),z(↑) | z(1),c(1)(↓) | z(2),c(2)(↓) | c(1),c(1)(↑) | c(2),c(2)(↑) | c(1),z(↓) | c(2),z(↓) |
| λ = 1e-1 | MINE-based MI Estimation (Belghazi et al., 2018) |
| β = 1e-2 | 2.13±0.26 | 2.11±0.33 | 0.01±0.01 | 0.01±0.00 | 0.77±0.03 | 0.48±0.18 | 0.13±0.02 | 0.17±0.07 |
| β = 1e-1 | 2.16±0.23 | 2.12±0.21 | 0.01±0.01 | 0.01±0.00 | 1.09±0.37 | 0.70±0.20 | 0.10±0.06 | 0.16±0.07 |
| β = 1e0 | 2.41±0.13 | 2.38±0.12 | 0.01±0.00 | 0.01±0.00 | 1.48±0.08 | 0.93±0.17 | 0.02±0.00 | 0.10±0.04 |
| β = 1e1 | 2.34±0.19 | 2.28±0.08 | 0.04±0.04 | 0.02±0.02 | 0.86±0.40 | 0.41±0.21 | 0.15±0.10 | 0.52±0.26 |
| β = 1e2 | 2.32±0.01 | 1.77±0.07 | 0.07±0.02 | 0.40±0.05 | 0.58±0.04 | 0.21±0.03 | 0.31±0.01 | 0.69±0.05 |
+
+Tab. G.2 shows the evaluation results averaged from 10 trials. One can see that as SPR decreases, the MI between the extracted $\widehat{z}$ and $z$ decreases—but only gracefully. The slight decline of performance is because the matching of two views becomes harder when the private components get stronger. However, even if SPR=-30 dB, the extraction and disentanglement of private and shared information are still clearly achieved. Such robustness to strong private interference is considered a key feature of linear CCA (Ibrahim & Sidiropoulos, 2020) and post-nonlinear CCA (Lyu & Fu, 2020). Our analysis and evaluation in this work show that such resilience is also inherited by the proposed approach.
+
+# G.3 SYNTHETIC DATA - SENSITIVITY TO HYPERPARAMETERS
+
+In this subsection, we investigate the sensitivity to the key hyperparameters $\beta$ and $\lambda$ . The results are shown in Tab. G.3 and Tab. G.4, respectively. One can see that for the reconstruction regularization parameter (i.e., $\beta$ ) does not affect the results too much unless it was set to be overly large (i.e., $\beta = 1$ or 100 in our simulation). This makes sense, since reconstruction is for preventing trivial degenerate solutions, and giving this part too much attention may not really help the learning goals (e.g., shared and private information extraction) reflected in the other parts of the loss function. From Tab. G.4, one can see that the choice of $\lambda$ affects the performance slightly more than $\beta$ . It makes sense, since $\lambda$ reflects the attention that the algorithm puts on the private component extraction part. We should mention that, for real data analysis with a downstream task (e.g., classification), one can choose these hyperparameters using a validation set.
+
+Table G.4: Mutual information (MI) between groups of variables with different $\lambda$ (i.e. independence regularizer). "↑": high score preferred; "↓": low score preferred; $\widehat{z}^{(q)} = \widehat{f}_{\mathrm{S}}^{(q)}$ for $q = 1,2$ .
+
+ | z(1),z(↑) | z(2),z(↑) | z(1),c(1)(↓) | z(2),c(2)(↓) | c(1),c(1)(↑) | c(2),c(2)(↑) | c(1),z(↓) | c(2),z(↓) |
| β = 1e0 | MINE-based MI Estimation (Belghazi et al., 2018) |
| λ = 1e-2 | 2.36±0.09 | 2.34±0.05 | 0.01±0.00 | 0.01±0.00 | 0.56±0.18 | 0.51±0.14 | 0.25±0.07 | 0.36±0.08 |
| λ = 1e-1 | 2.41±0.13 | 2.38±0.12 | 0.01±0.00 | 0.01±0.00 | 1.48±0.08 | 0.93±0.17 | 0.02±0.01 | 0.10±0.04 |
| λ = 1e0 | 2.04±0.12 | 2.00±0.11 | 0.04±0.01 | 0.02±0.00 | 0.71±0.17 | 0.37±0.10 | 0.15±0.06 | 0.22±0.03 |
| λ = 1e1 | 1.49±0.18 | 1.55±0.11 | 0.17±0.07 | 0.17±0.10 | 0.61±0.04 | 0.17±0.07 | 0.23±0.02 | 0.16±0.05 |
| λ = 1e2 | 0.80±0.23 | 0.96±0.36 | 0.46±0.13 | 0.28±0.07 | 0.18±0.08 | 0.22±0.06 | 0.75±0.37 | 0.57±0.18 |
+
+Table G.5: Network structures for the MNIST experiment.
+
+| Encoders | Decoders |
| input: x( q ) ∈ R28×28×14 × 4 Conv, 64ReLU, stride 24 × 4 Conv, 32ReLU, stride 2FC 256, ReLUFC D + Dq | input: f( q )(x( q ) ) ∈ R D+DqFC 256, ReLUFC 7 × 7 × 32, ReLU4 × 4 Conv_Trans, 64ReLU, stride 24 × 4 Conv_Trans, 1, stride 2 |
+
+# G.4 REAL DATA - MORE ON VALIDATING THEOREM 1
+
+Multiview MNIST Data. In this subsection, we provide more details and evaluation results on the MNIST experiment. The way of generating such two views (as shown in Fig. 1 of the main text) of MNIST data is similar to the data augmentation ideas used in AM-SSL, e.g., rotation, adding noise, cropping, flipping (Chen et al., 2020; Grill et al., 2020). We aim to match the two views and try to learn the shared representations, which should encode the class label information. The dataset has 70,000 samples that are $28 \times 28$ images of handwritten digits. For the latent dimension, we set $D = 10$ , $D_{1} = 20$ and $D_{2} = 50$ . In particular, since the second view consists of large random noise that are not of interest, we only add the independence regularizer $\mathcal{R}^{(1)}$ on the first view (i.e., the rotated digits) to learn the private component of $\boldsymbol{x}_{\ell}^{(1)}$ . The learned $\widehat{\boldsymbol{c}}_{\ell}^{(1)}$ was used to generate new samples; see the illustration in our main text.
+
+The network structure used for all methods is shown in Tab. G.5. The network structure for $\phi^{(q)}$ and $\tau^{(q)}$ are MLPs with three hidden layers of 64 neurons. For hyperparameters, we set batch size to be $|\mathcal{B}_1| = 100$ and $|\mathcal{B}_2| = 1000$ , $\beta = 1.0$ , $\lambda = 100.0$ . For optimizer, we also use Adam (Kingma & Ba, 2015) with initial learning rate 0.001 for $\theta$ and 1.0 for $\eta$ . And we add squared $\ell_2$ regularization for both $\theta$ and $\eta$ , with different regularization parameters that are 0.0001 and 0.1, respectively. We also run the SGD optimizer for 10 epochs to update $\theta$ and $\eta$ .
+
+In Tab. G.6, we show more evaluation results on the learned shared information across views. To be specific, we feed the learned $\widehat{z}_{\ell}^{(1)}$ 's to a classifier and the $k$ -means algorithm, to observe if the learned representations improve the performance of supervised and unsupervised learning tasks. For the classification task, we split the data as 50,000/10,000/10,000 for training/validation/test sets. We train a linear support vector machine (SVM) using the training data. The performance is measured by classification error (ERR). For the clustering task, we use the standard $k$ -means to cluster on all the data samples. After clustering, we report the performance on the test set. We use a number of metrics to measure performance, namely, clustering accuracy (ACC), normalized mutual information (NMI), and adjusted Rand index (ARI) (Yeung & Ruzzo, 2001). Among these metrics, ARI ranges from $-1$ to $+1$ , with 1 being the best and $-1$ the worst and NMI range from 0 to 1 with 1 being the best.
+
+The "Baseline" denotes the results of simply applying SVM and $k$ -means onto the raw data of the first view, i.e., $x_{\ell}^{(1)}$ for $\ell = 1, \dots, N$ . All the results of algorithms that involve stochastic methods are averaged over 5 random initializations. One can see that all methods have comparably good results in terms of learning informative representations across views. The results empirically validate our Theorem 1 that latent correlation maximization is a useful criterion to extract the shared information with guarantees. In particular, Barlow Twins performs slightly better in terms of benefiting downstream classification and clustering tasks. Nonetheless, the proposed method can
+
+
+Figure G.3: t-SNE of the results on multiview MNIST of the second view. Baselines: DCCA (Wang et al., 2015), Barlow Twins (Zbontar et al., 2021) and BYOL (Grill et al., 2020).
+
+Table G.6: The classification error (first row) and clustering results (rows 2 to 4) of the two-view MNIST dataset. “↑”: high score preferred; “↓”: low score preferred.
+
+ | Baseline | L+V+R | L+V | DCCA | DCCAE | Barlow Twins | BYOL |
| ERR (↓) | 13.40% | 2.81%±0.21% | 2.95%±0.23% | 2.87%±0.16% | 2.85%±0.05% | 2.05%±0.07% | 2.67%±0.22% |
| ACC (↑) | 37.35% | 97.03%±0.13% | 96.80%±0.40% | 97.02%±0.12% | 96.95%±0.12% | 98.06%±0.06% | 95.56%±0.41% |
| NMI (↑) | 0.337 | 0.922±0.003 | 0.923±0.007 | 0.922±0.003 | 0.920±0.003 | 0.947±0.002 | 0.895±0.023 |
| ARI (↑) | 0.216 | 0.936±0.003 | 0.931±0.009 | 0.935±0.003 | 0.934±0.002 | 0.958±0.001 | 0.904±0.047 |
+
+Table G.7: Augmentation Used for CIFAR10 to Generate Multiple Views.
+
+| Transformation | Value | Probability |
| ColorJitter | brightness=0.8, contrast=0.8, saturation=0.8, hue=0.2 | 0.8 |
| GrayScale | - | 0.2 |
| RandomResizedCrop | scale=(0.2, 1.0), ratio=(0.75, 4/3) | - |
| HorizontalFlip | - | 0.5 |
| GaussianBlur | σ ~ U[0.1, 2] | 0.5 |
| Solarization | - | 0.4 |
| Normalization | - | - |
+
+also guarantee extracting private information and facilitate cross-view image generation (see the experiments in the main text), which is out the reach of Barlow Twins and BYOL.
+
+In addition to showing the visualization of the learned embedding of the first view in Fig. 1 of the main paper, we also plot the t-SNE of the learned representation $\widehat{\boldsymbol{z}}_{\ell}^{(2)}$ of the second view (i.e., the noisy digits). The results are shown in Fig. G.3. One can see that the visualization and clustering accuracy are similar to those obtained from $\widehat{\boldsymbol{z}}_{\ell}^{(1)}$ .
+
+Augmented CIFAR10 Data for SSL. We also use the CIFAR10 dataset (Krizhevsky et al., 2009) to validate Theorem 1. The CIFAR10 dataset contains 50,000 and 10,000 images of size $32 \times 32$ for training and testing, respectively. There are 10 different classes. We use ResNet18 as the backbone network for learning the representation. Since CIFAR10 images are small, we replace the first 7x7 Conv layer of stride 2 with 3x3 Conv layer of stride 1. We also remove the max pooling layer. We follow the evaluation method in (Chen & He, 2021) to stop the algorithms after one hundred epochs. In terms of data augmentation, we use the pipeline of different transformations in Tab. G.7. Note that for the proposed method, we only impose constraint (7c) since our goal here in this task is to extract essential shared information.
+
+We evaluate the proposed method and two AM-SSL baselines as mentioned in the main text, namely, Barlow Twins (Zbontar et al., 2021) and BYOL (Grill et al., 2020) by feeding the learned representations to a linear classifier. We report both the Top-1 linear classification accuracy and the KNN (with $k = 5$ ) accuracy. The results are shown in Tab. G.8. One can see that different methods achieve comparable results. The proposed method and BYOL attain essentially the same accuracy. The t-SNE (Van der Maaten & Hinton, 2008) visualizations of the test set is plotted in Fig. G.4. One can see that all methods extract "identity-revealing" information to a certain extent, as in the MNIST case.
+
+Table G.8: Evaluation using CIFAR10.
+
+ | BYOL | Barlow Twins | Proposed |
| Classification Acc. (%) | 84.2 | 82.8 | 84.2 |
| KNN (k=5) Acc. (%) | 80.5 | 78.7 | 81.0 |
+
+
+BYOL
+
+
+Barlow Twins
+
+
+Proposed
+Figure G.4: t-SNE of learned representations for CIFAR10.
+
+samples of view1
+
+
+Figure G.5: Samples of the lower elevations (view1) and higher elevations (view2).
+
+
+
+samples of view2
+
+
+
+
+
+Remark 1 We should remark that the experiment results suggest that latent correlation maximization (or latent component matching) used in many AM-SSL and DCCA methods works towards the same ultimate goal under our generative model in (5). However, this does not suggest that different SSL and DCCA methods are essentially the same in practice—one should not expect that. In fact, there are many factors that affect DCCA and AM-SSL methods' results, e.g., model mismatches, optimization procedure, network construction, and the detailed designs in their loss functions. The difference between the methods normally are more articulated with larger data sets or more complex problems. Nonetheless, our interest lies in theoretical understanding of their common properties, other than the differences in practical implementations. From this perspective, the results in this section support our theoretical analysis in Theorem 1.
+
+# G.5 REAL DATA - MORE ON VALIDATING THEOREM 2
+
+Cars3D Data for Cross-sample Generation. In this subsection, we provide more detailed settings and results of the Cars3D experiment. To create a multiview dataset, we assume that given the car type that is captured by shared variables $z$ and the azimuths that are captured by $c^{(q)}$ , the generation mappings $g^{(1)}$ and $g^{(2)}$ produce car images with low elevations and high elevations, respectively (so they must be different mappings).
+
+We split the car images as follows. We treat the same car model (e.g., a red convertible) with lower and higher elevations as $\boldsymbol{x}_{\ell}^{(1)}$ and $\boldsymbol{x}_{\ell}^{(2)}$ , respectively. The azimuths are randomly shuffled with different pairs of $\boldsymbol{x}_{\ell}^{(1)}$ and $\boldsymbol{x}_{\ell}^{(2)}$ . This way, if our generative model holds, $z$ , $c^{(q)}$ and $g^{(q)}$ are responsible for 'type', 'azimuth' and 'elevation', respectively. Some samples are shown in Fig. G.5.
+
+Under our splitting, each view has $2 \times 183 \times 24 = 8784$ RGB images that all have a size of $64 \times 64 \times 3$ . We model the 'type' information $z$ using $D = 10$ latent dimensions since many different factors (e.g., color and shape) together give rise to a 'type'. On the other hand, we set $D_{1} = D_{2} = 2$ to model the 'azimuth' information.
+
+Tab. G.9 shows network structures for the encoders and decoders of our formulation in (F.6). In the table, FC denotes fully connected layer, Conv denotes convolutional layer and Conv_Trans denotes 2D transposed convolutional layer. As before, the structures of $\phi^{(q)}$ and $\tau^{(q)}$ are MLPs with two-
+
+Table G.9: Network structures for the Cars3D experiment.
+
+| Encoders | Decoders |
| input: x(1)q ∈ R64×64×34 × 4 Conv, 32 ReLU, stride 24 × 4 Conv, 32 ReLU, stride 24 × 4 Conv, 64 ReLU, stride 24 × 4 Conv, 64 ReLU, stride 2FC 256, ReLUFC 10+2 | input: f(q)(x(1)) ∈ R10+2FC 256, ReLUFC 4 × 4 × 64, ReLU4 × 4 Conv_Trans, 64 ReLU, stride 24 × 4 Conv_Trans, 32 ReLU, stride 24 × 4 Conv_Trans, 32 ReLU, stride 24 × 4 Conv_Trans, 3, stride 2 |
| x(1)j | c(1)j | | | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
+
+Figure G.6: Generated samples by fixing $\widehat{z}_{\ell}$ and varying $\widehat{c}_j^{(q)}$ ; rows in blue boxes are w/ $\mathcal{R}$ ; rows in green boxes are w/o $\mathcal{R}$ .
+
+hidden-layer and 256 neurons for each layer. For hyperparameters, we set batch size to be $|\mathcal{B}_1| = 100$ and $|\mathcal{B}_2| = 800$ , $\beta = 0.1$ , $\lambda = 1.0$ . For this real data experiment, we also use Adam (Kingma & Ba, 2015) as the optimizer with initial learning rate 0.001 for $\theta$ and 1.0 for $\eta$ . We add $\|\eta\|_2^2$ for regularization with parameter 0.0001. We limit the inner loops for solving the $\theta$ and $\eta$ subproblems to 10 epochs as well.
+
+Figs. G.6 and G.7 show more results under the same setting as in Fig. 2 in the main text.
+
+dSprites Data for Cross-sample data Generation. We present the results on an additional dataset, i.e., dSprites (Higgins et al., 2017). In the dSprites dataset, $64 \times 64$ images are generated based on five factors: 3 shapes (square, ellipse, heart), 6 scales, 40 orientations, and 32 different horizontal and vertical coordinates.
+
+In particular, we take a subset that contains squares and hearts as the two views of data. In this subset, all the data samples are with the same scale. We assume the generating functions $g^{(1)}$ and $g^{(2)}$ are responsible for the shape of square and heart, respectively. We treat the orientation and horizontal positions as the shared information, i.e., $z$ , and the vertical position as the private information $c^{(q)}$ . The vertical coordinates are random and not matched between different pairs of $x_{\ell}^{(1)}$ and $x_{\ell}^{(2)}$ . Overall, we have 40,960 samples for each view. We set $D = 2$ and $D_{1} = D_{2} = 1$ .
+
+We use the same neural network structure as in Tab. G.9. The only differences lie in the input and latent dimensions. The network structure for $\phi^{(q)}$ and $\pmb{\tau}^{(q)}$ are MLPs with two hidden layers of 128 neurons, and we set $|\mathcal{B}_1| = 100$ , $|\mathcal{B}_2| = 500$ , $\beta = 0.1$ , and $\lambda = 100.0$ . Similar as before, we use the Adam (Kingma & Ba, 2015) optimizer with initial learning rate 0.001 for $\theta$ . As before, we add a squared $\ell_2$ norm regularization on the network parameters $\eta$ , and set the regularization parameter to 0.1. We let the inner loop stochastic optimizers run for 10 epochs.
+
+
+Figure G.7: Generated samples by fixing $\widehat{c}_j^{(q)}$ and varying $\widehat{z}_l$ ; rows in blue boxes are w/ $\mathcal{R}$ ; rows in green boxes are w/o $\mathcal{R}$ .
+
+We conduct the same cross-sample data generation experiment as in the Cars3D case. Fig. G.8 shows the results. To be specific, we extract $\widehat{\pmb{z}}_{\ell}^{(q)} = \widehat{\pmb{f}}_{\mathrm{S}}(\pmb{x}_{\ell}^{(q)})$ that represents the rotation and horizontal coordinate information and $\widehat{\pmb{c}}_j^{(q)} = \widehat{\pmb{f}}_{\mathrm{P}}(\pmb{x}_{\ell}^{(q)})$ . And we combine this information together to generate synthetic samples $\widehat{\pmb{x}}_{\ell,j}^{(q)}$ with the learned reconstruction network $\pmb{r}^{(q)}$ , i.e., $\widehat{\pmb{x}}_{\ell,j}^{(q)} = \widehat{\pmb{r}}^{(q)}([\widehat{\pmb{z}}_{\ell}^{(q)})^{\top}, (\pmb{c}_j^{(q)})^{\top}]^{\top}$ .
+
+The observations are similar to that in the Cars3D experiments. Ideally, the generated samples should have the rotation and horizontal position of $\pmb{x}_{\ell}^{(q)}$ (contained in $\widehat{\pmb{z}}_{\ell}^{(q)}$ ) while the vertical position of $\pmb{x}_{j}^{(q)}$ (contained in $\widehat{\pmb{c}}_{j}^{(q)}$ ). One can see that without using the independence regularizer $\mathcal{R}$ , the generated samples may have rotation change, shape deformation compared to $\pmb{x}_{\ell}^{(q)}$ or simply the vertical position is not exactly replicated from the sample $\pmb{x}_{j}^{(q)}$ . However, with the $\mathcal{R}$ regularization, the results are exactly what one expects to see. This again verifies our claim in Theorem 2.
+
+Multiview MNIST Data for Cross-view Generation. Using the multiview MNIST data, we also show the cross-view generation results in Fig. G.9. Here, we extract $\widehat{\pmb{z}}_{\ell}^{(2)} = \widehat{\pmb{f}}_{\mathrm{S}}^{(2)}(\pmb{x}_{\ell}^{(2)})$ from the second view and $\widehat{\pmb{c}}_j^{(1)} = \widehat{\pmb{f}}_{\mathrm{P}}^{(1)}(\pmb{x}_j^{(1)})$ from the first. Then, we generate $\widehat{\pmb{x}}_{\ell ,j}^{(1)} = \widehat{\pmb{r}}^{(1)}([(\widehat{\pmb{z}}_{\ell}^{(2)})^{\top},(\pmb{c}_{j}^{(1)})^{\top}]^{\top})$ shown in the blue and green boxes. Ideally, the generated samples should have the digit information of $\pmb{x}_{\ell}^{(2)}$ (contained in $\widehat{\pmb{z}}_{\ell}^{(2)}$ ) while the style information of $\pmb{x}_j^{(1)}$ (contained in $\widehat{\pmb{c}}_j^{(1)}$ ). Clearly, using $\mathcal{R}$ attains the desired results. Note that this dataset is challenging as the noise in view 2 is very high, making it hard to achieve perfect matching and reconstruction—but our result is still plausible.
+
+Remark 2 We would like to mention that multiview data and pertinent learning tasks are pervasive in the real world. For example, acoustic features and articulatory recordings are two views of speech signals, and multiview based representation learning can be used to enhance speech recognition (Arora & Livescu, 2013; Wang et al., 2015). Another example is cross-media information retrieval (Gong et al., 2014). There, a data entity has a text view and an image view, and the task is to retrieve one view from another. This task can be efficiently done in the learned shared domain. In natural language processing, multilingual word embedding can also be formulated as a CCA-type shared information learning problem; see (Socher & Fei-Fei, 2010; Dhillon et al., 2012). In computer vision, there are a number of important tasks such as image style translation (e.g., sketch to picture and picture to cartoon) (Zhu et al., 2017; Huang et al., 2018; Lee et al., 2018) and super-resolution (Ledig et al., 2017) can be considered as multiview learning problems. In particular, image style translation will benefit from our method's guaranteed shared (content) and private (style) disentanglement.
+
+
+Figure G.8: Generated samples by fixing $\widehat{\mathcal{Z}}_{\ell}$ (rotation and horizontal position) and varying $\widehat{c}_{j}^{(q)}$ (vertical position). Top: the square view; bottom: the heart view; rows in blue boxes are w/ $\mathcal{R}$ ; rows in green boxes are w/o $\mathcal{R}$ .
+
+
+Figure G.9: Cross-view generation from $\boldsymbol{x}_{\ell}^{(2)}$ to $\boldsymbol{x}_{\ell}^{(1)}$ .
+
+# H ADDITIONAL NOTES ON SHARED-PRIVATE MODELING
+
+Regarding the generative model in (5), some remarks are as follows. The intuition that multiview data consists of shared and private components are widely used; see, e.g., (Huang et al., 2018; Lee et al., 2018; Wang et al., 2016; Gundersen et al., 2019). However, explicit generative models were only considered in limited theory-oriented works.
+
+The model in (5) can be understood as a nonlinear generalization of the linear CCA model in (Ibrahim & Sidiropoulos, 2020), where the views are modeled as
+
+$$
+\boldsymbol {x} _ {\ell} ^ {(q)} = \boldsymbol {A} ^ {(q)} [ \boldsymbol {z} _ {\ell} ^ {\top}, (\boldsymbol {c} _ {\ell} ^ {(q)}) ^ {\top} ] ^ {\top}
+$$
+
+for $q = 1,2$ . In (Lyu & Fu, 2020), a special type of nonlinear model, namely, the post-nonlinear mixture model, was analyzed. There, the model is
+
+$$
+\boldsymbol {x} _ {\ell} ^ {(q)} = \boldsymbol {g} ^ {(q)} (\boldsymbol {A} ^ {(q)} [ \boldsymbol {z} _ {\ell} ^ {\top}, (\boldsymbol {c} _ {\ell} ^ {(q)}) ^ {\top} ] ^ {\top}),
+$$
+
+where $g^{(q)}(\pmb{y})$ applies a nonlinear distortion to each element of $\pmb{y}$ individually. However, post-nonlinear models are much less general compared to our model in (5)—where $g^{(q)}(\pmb{y})$ nonlinearly distorts all elements of $\pmb{y}$ jointly in an unknown way. More recently, under the context of AM-SSL, the work in (Von Kugelgen et al., 2021) considered a multiview generative model that is similar to our model, but the views share the same generative nonlinear function, i.e.,
+
+$$
+\boldsymbol {x} _ {\ell} ^ {(q)} = \boldsymbol {g} ([ \boldsymbol {z} _ {\ell} ^ {\top}, (\boldsymbol {c} _ {\ell} ^ {(q)}) ^ {\top} ] ^ {\top}).
+$$
+
+This assumption restricts the applicability of the model to scenarios where the two views are generated using exactly the same nonlinear distortions, which may be less flexible. Our model in (5) subsumes the models in (Ibrahim & Sidiropoulos, 2020; Lyu & Fu, 2020; Von Kugelgen et al., 2021) as its special cases.
+
+# I AVOIDING RECONSTRUCTION USING ENTROPY REGULARIZATION
+
+# I.1 ENTROPY REGULARIZATION AND SHARED COMPONENT IDENTIFIABILITY
+
+If we ignore private information extraction, our formulation for shared information extraction is as follows:
+
+$$
+\underset {\boldsymbol {f} ^ {(1)}, \boldsymbol {f} ^ {(2)}} {\text {m i n i m i z e}} \mathbb {E} \left[ \left\| \boldsymbol {f} _ {\mathrm {S}} ^ {(1)} \left(\boldsymbol {x} ^ {(1)}\right) - \boldsymbol {f} _ {\mathrm {S}} ^ {(2)} \left(\boldsymbol {x} ^ {(2)}\right) \right\| ^ {2} \right] \tag {I.1a}
+$$
+
+subject to $\pmb{f}^{(q)}$ for $q = 1,2$ are invertible, (I.1b)
+
+$$
+\mathbb {E} \left[ \boldsymbol {f} _ {\mathrm {S}} ^ {(q)} \left(\boldsymbol {x} ^ {(q)}\right) \boldsymbol {f} _ {\mathrm {S}} ^ {(q)} \left(\boldsymbol {x} ^ {(q)}\right) ^ {\top} \right] = \boldsymbol {I}, \mathbb {E} \left[ \boldsymbol {f} _ {\mathrm {S}} \left(\boldsymbol {x} ^ {(q)}\right) \right] = \boldsymbol {0}, q = 1, 2, \tag {I.1c}
+$$
+
+with the latent variables satisfying:
+
+$$
+p (\boldsymbol {z}, \boldsymbol {c} ^ {(1)}, \boldsymbol {c} ^ {(2)}) = p (\boldsymbol {z}) p (\boldsymbol {c} ^ {(1)}) p (\boldsymbol {c} ^ {(2)}).
+$$
+
+We hope to encourage invertibility of $f^{(q)}$ without using a decoder reconstruction network. To this end, we generalize the idea in Theorem 4.4 in (Von Kügelgen et al., 2021). Note that (Von Kügelgen et al., 2021) deals with the case where only one $f$ is learned (i.e., $f^{(1)} = f^{(2)}$ ). Here, we show that this idea can be used under our case as well. To see this, let us consider the following formulation:
+
+$$
+\underset {\boldsymbol {f} _ {\mathrm {S}} ^ {(1)}, \boldsymbol {f} _ {\mathrm {S}} ^ {(2)}} {\text {m i n i m i z e}} \mathbb {E} \left[ \left\| \boldsymbol {f} _ {\mathrm {S}} ^ {(1)} \left(\boldsymbol {x} ^ {(1)}\right) - \boldsymbol {f} _ {\mathrm {S}} ^ {(2)} \left(\boldsymbol {x} ^ {(2)}\right) \right\| ^ {2} \right] - H \left(\boldsymbol {f} _ {\mathrm {S}} ^ {(1)} \left(\boldsymbol {x} ^ {(1)}\right)\right) \tag {I.2a}
+$$
+
+subject to $\pmb{f}_{\mathrm{S}}^{(q)}:\mathbb{R}^{M_q}\to (0,1)^D$ (I.2b)
+
+where $H(\cdot)$ computes the differential entropy of its argument. The formulation still aims to match the latent representations of the two views, but at the same time maximizes the entropy of the learned features of a the first view. The proof of this case consists of three major steps.
+
+Step 1. It is straightforward to see that the optimal solution of (I.2) is
+
+$$
+\widehat {\boldsymbol {z}} = \boldsymbol {f} _ {\mathrm {S}} ^ {(1)} (\boldsymbol {x} ^ {(1)}) = \boldsymbol {f} _ {\mathrm {S}} ^ {(2)} (\boldsymbol {x} ^ {(2)}), \widehat {\boldsymbol {z}} \sim \operatorname {U n i f o r m} (0, 1) ^ {D}
+$$
+
+since the first term has optimal value 0 when two view are perfectly matched, and the differential entropy of a random variable is maximized when the distribution on $(0,1)^{D}$ is uniform (Cover, 1999). Next, following the idea in (Von Kugelgen et al., 2021), by the Darmois construction (Darmois,
+
+1951), there exists $\pmb{d}(\cdot): \mathcal{Z} \rightarrow (0,1)^D$ which maps the ground-truth $z$ to a uniform random variable on $(0,1)^D$ . Thus, one can construct an optimal solution of (I.2) as:
+
+$$
+\boldsymbol {f} _ {\mathrm {S}} ^ {(q)} = \boldsymbol {d} \circ \left[ \left(\boldsymbol {g} ^ {(q)}\right) ^ {- 1} \right] _ {1: D}
+$$
+
+where the first $D$ dimensions of the output of $\left(\pmb{g}^{(q)}\right)^{-1}$ are fed to $\pmb{d}(\cdot)$ .
+
+Step 2. By using our proof technique in Theorem 1, employing the equation $\widehat{z} = f_{\mathrm{S}}^{(1)}(\pmb{x}^{(1)}) = f_{\mathrm{S}}^{(2)}(\pmb{x}^{(2)})$ , it can be shown that $\widehat{z}$ only depends on the shared component $z$ but does not depend on either $c^{(1)}$ or $c^{(2)}$ , which we denote as $\widehat{z} = \gamma(z)$ . Note that the proof of this part holds since it only uses the latent correlation maximization (or $f_{\mathrm{S}}^{(q)}$ matching). Using the same derivation as in Theorem 1, we have the Jacobian of $h^{(1)}$ as follows:
+
+$$
+\boldsymbol {J} ^ {(1)} = \left[ \begin{array}{c c} \boldsymbol {J} _ {1 1} ^ {(1)} & \boldsymbol {H} _ {\mathrm {S}} ^ {(1)} \\ \boldsymbol {J} _ {2 1} ^ {(1)} & \boldsymbol {J} _ {2 2} ^ {(1)} \end{array} \right] = \left[ \begin{array}{c c} \boldsymbol {J} _ {1 1} ^ {(1)} & \boldsymbol {0} _ {D \times D _ {1}} \\ \boldsymbol {J} _ {2 1} ^ {(1)} & \boldsymbol {J} _ {2 2} ^ {(1)} \end{array} \right],
+$$
+
+which indicates that $\widehat{\pmb{z}}$ only depends on $\pmb{z}$ but not $c^{(1)}$ . The above also holds for the second view. Note that the possibility of $\pmb{f}_{\mathrm{S}}^{(q)}$ being a trivial constant solution (and thus making $\pmb{H}_{\mathrm{S}}^{(1)} = \mathbf{0}$ ) is ruled out since $\pmb{f}_{\mathrm{S}}^{(q)}$ 's entropy is maximized.
+
+Step 3. The last step in Theorem 1 is to use $\mathrm{rank}(\pmb{J}^{(1)}) = D + D_1$ to show that $\pmb{J}_{11}^{(1)} \in \mathbb{R}^{D \times D}$ has full rank. There, $\mathrm{rank}(\pmb{J}^{(1)}) = D + D_1$ is natural since $\pmb{f}^{(1)}$ is constructed to be invertible using an autoencoder (and thus $\pmb{f}^{(1)} \circ \pmb{g}^{(1)}$ is also invertible). Here, we could not use this argument. However, similar to Theorem 4.4 in (Von Kugelgen et al., 2021), by applying Proposition 5 of (Zimmermann et al., 2021), one can show that $\widehat{\pmb{z}} = \pmb{\gamma}(\pmb{z})$ where $\pmb{\gamma}(\cdot)$ is an invertible function, if $p(\pmb{z})$ is a regular density, i.e., $0 < p(z) < \infty$ everywhere. Note that under our generative model, $\pmb{f}^{(1)}(\pmb{x}^{(1)}) = \pmb{f}^{(2)}(\pmb{x}^{(2)})$ for all $\pmb{x}^{(q)}$ . Hence, the above derivations can be repeated for $\pmb{f}^{(2)}$ . This concludes the proof.
+
+# I.2 REALIZATION AND CONNECTION TO CONTRASTIVE SSL
+
+To implement the formulation (I.2), following the idea in (Von Kugelgen et al., 2021), one can use the idea of InfoNCE (Gutmann & Hyvarinen, 2010; Oord et al., 2018), which it has interesting connections to contrastive SSL (Wang & Isola, 2020). In particular, the formulation of InfoNCE is as follows:
+
+$$
+\mathbb {E} _ {\left\{\boldsymbol {x} _ {\ell} ^ {(1)}, \boldsymbol {x} _ {\ell} ^ {(2)} \right\} _ {\ell = 1} ^ {K} \sim p \left(\boldsymbol {x} ^ {(1)}, \boldsymbol {x} ^ {(2)}\right)} \left[ - \sum_ {i = 1} ^ {K} \log \frac {\exp \left\{\sin \left(\widehat {\boldsymbol {z}} _ {i} , \widehat {\boldsymbol {z}} _ {i} ^ {\prime}\right) / \tau \right\}}{\sum_ {j = 1} ^ {K} \exp \left\{\sin \left(\widehat {\boldsymbol {z}} _ {i} , \widehat {\boldsymbol {z}} _ {j} ^ {\prime}\right) / \tau \right\}} \right] \tag {I.3}
+$$
+
+where $\widehat{\pmb{z}}_{\ell}$ and $\widehat{\pmb{z}}_{\ell}^{\prime}$ are the learned representations of the two corresponding samples $\pmb{x}_{\ell}^{(1)}$ and $\pmb{x}_{\ell}^{(2)}$ , respectively, $\sin (a,b)$ computes the similarity of its arguments, $\tau$ is a temperature hyperparameter and there are $K$ samples of each batch where $K - 1$ of them are negative.
+
+Note that in (Von Kugelgen et al., 2021), only one generative function $g(\cdot)$ is considered. In their implementation, given sample pairs $\{\pmb{x}_{\ell}^{(1)}, \pmb{x}_{\ell}^{(2)}\}_{\ell=1}^{K}$ , the above InfoNCE objective can be rewritten with $\tau = 1$ and $\mathrm{sim}(\pmb{a}, \pmb{b}) = -\|\pmb{a} - \pmb{b}\|_2^2$ as
+
+$$
+\mathbb {E} _ {\left\{\boldsymbol {x} _ {\ell} ^ {(1)}, \boldsymbol {x} _ {\ell} ^ {(2)} \right\} _ {\ell = 1} ^ {K} \sim p (\boldsymbol {x} ^ {(1)}, \boldsymbol {x} ^ {(2)})} \left[ \sum_ {i = 1} ^ {K} \left\{\left\| \boldsymbol {f} \left(\boldsymbol {x} _ {i} ^ {(1)}\right) - \boldsymbol {f} \left(\boldsymbol {x} _ {i} ^ {(2)}\right) \right\| _ {2} ^ {2} + \log \sum_ {j = 1} ^ {K} \exp \left\{- \left\| \boldsymbol {f} \left(\boldsymbol {x} _ {i} ^ {(1)}\right) - \boldsymbol {f} \left(\boldsymbol {x} _ {j} ^ {(2)}\right) \right\| _ {2} ^ {2} \right\} \right\} \right].
+$$
+
+The second term is a non-parametric entropy estimator of the representation as $K \to \infty$ (Wang & Isola, 2020). The above nicely connects AM-SSL with contrastive learning when $g^{(1)} = g^{(2)}$ and only one encoder is used, i.e., $f^{(1)} = f^{(2)}$ .
+
+However, in our problem the generative functions are different in each view. Hence, the formulation above is not directly applicable. Nonetheless, one can use the slack variable based design as in (10). Then, the problem can be reformulated as
+
+$$
+\mathbb {E} _ {\left\{\boldsymbol {x} _ {\ell} ^ {(1)}, \boldsymbol {x} _ {\ell} ^ {(2)} \right\} _ {\ell = 1} ^ {K} \sim p \left(\boldsymbol {x} ^ {(1)}, \boldsymbol {x} ^ {(2)}\right)} \left[ \sum_ {i = 1} ^ {K} \left\{\sum_ {q = 1} ^ {2} \left\| \boldsymbol {u} _ {i} - \boldsymbol {f} ^ {(q)} \left(\boldsymbol {x} _ {i} ^ {(q)}\right) \right\| ^ {2} + \log \sum_ {j = 1} ^ {K} \exp \left\{- \| \boldsymbol {u} _ {i} - \boldsymbol {u} _ {j} \| _ {2} ^ {2} \right\} \right\} \right]. \tag {I.5}
+$$
+
+Note that the entropy regularization is imposed on the slack variable $\mathbf{u}$ — which indirectly promotes high entropy of $\mathbf{f}^{(q)}$ 's. This way, one can handle $Q$ views with different generative functions $\mathbf{g}^{(q)}$ 's.
\ No newline at end of file
diff --git a/understandinglatentcorrelationbasedmultiviewlearningandselfsupervisionanidentifiabilityperspective/images.zip b/understandinglatentcorrelationbasedmultiviewlearningandselfsupervisionanidentifiabilityperspective/images.zip
new file mode 100644
index 0000000000000000000000000000000000000000..f3fa5ac647c21ccfdbc4839ada885dce261a2806
--- /dev/null
+++ b/understandinglatentcorrelationbasedmultiviewlearningandselfsupervisionanidentifiabilityperspective/images.zip
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e1ebb5a4646ff2816b9cd006d5bb2811d42e7bbcea97120889b985fbfc3926f1
+size 2069524
diff --git a/understandinglatentcorrelationbasedmultiviewlearningandselfsupervisionanidentifiabilityperspective/layout.json b/understandinglatentcorrelationbasedmultiviewlearningandselfsupervisionanidentifiabilityperspective/layout.json
new file mode 100644
index 0000000000000000000000000000000000000000..a80120d06d59ad882f988ef29ae649fa771029b7
--- /dev/null
+++ b/understandinglatentcorrelationbasedmultiviewlearningandselfsupervisionanidentifiabilityperspective/layout.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:52745b60c01688ef22ea11d6fd6c0c0fb4e6fb6e523b13575e4d7d79fda10b07
+size 1627538
diff --git a/understandingtheroleofselfattentionforefficientspeechrecognition/6eab39ff-801f-4244-a054-726b9b2eab01_content_list.json b/understandingtheroleofselfattentionforefficientspeechrecognition/6eab39ff-801f-4244-a054-726b9b2eab01_content_list.json
new file mode 100644
index 0000000000000000000000000000000000000000..38bebd3b471261c8641c514dd8537f28368a2aa4
--- /dev/null
+++ b/understandingtheroleofselfattentionforefficientspeechrecognition/6eab39ff-801f-4244-a054-726b9b2eab01_content_list.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:67b3774dc711ea574e1496e2005bbde3caec7273c03ce4cd7e78e5aa12bd291d
+size 110833
diff --git a/understandingtheroleofselfattentionforefficientspeechrecognition/6eab39ff-801f-4244-a054-726b9b2eab01_model.json b/understandingtheroleofselfattentionforefficientspeechrecognition/6eab39ff-801f-4244-a054-726b9b2eab01_model.json
new file mode 100644
index 0000000000000000000000000000000000000000..2f2d789319407aa00e591f3cbdadb1441199e6ed
--- /dev/null
+++ b/understandingtheroleofselfattentionforefficientspeechrecognition/6eab39ff-801f-4244-a054-726b9b2eab01_model.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4f58dfc0a9e823c8fb7992a790566f99c1f0ec7198e592ca8e9ab2a00ef8347d
+size 136051
diff --git a/understandingtheroleofselfattentionforefficientspeechrecognition/6eab39ff-801f-4244-a054-726b9b2eab01_origin.pdf b/understandingtheroleofselfattentionforefficientspeechrecognition/6eab39ff-801f-4244-a054-726b9b2eab01_origin.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..febd867f01fe0bdc2a847c13be7d58463ca21027
--- /dev/null
+++ b/understandingtheroleofselfattentionforefficientspeechrecognition/6eab39ff-801f-4244-a054-726b9b2eab01_origin.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d35e5177585ee2a6ad6d21e66fb8b56758ad999268ec44da7baeed21631a20a0
+size 9575143
diff --git a/understandingtheroleofselfattentionforefficientspeechrecognition/full.md b/understandingtheroleofselfattentionforefficientspeechrecognition/full.md
new file mode 100644
index 0000000000000000000000000000000000000000..a0fe3c829bc054292d6f717f71906f9cbe2da5f2
--- /dev/null
+++ b/understandingtheroleofselfattentionforefficientspeechrecognition/full.md
@@ -0,0 +1,430 @@
+# UNDERSTANDING THE ROLE OF SELF ATTENTION FOR EFFICIENT SPEECH RECOGNITION
+
+Kyuhong Shim1, Jungwook Choi2, Wonyong Sung1
+
+Department of Electrical and Computer Engineering, Seoul National University1
+Department of Electrical Engineering, Hanyang University2
+
+skhu20@snu.ac.kr, choij@hanyang.ac.kr, wysung@snu.ac.kr
+
+# ABSTRACT
+
+Self-attention (SA) is a critical component of Transformer neural networks that have succeeded in automatic speech recognition (ASR). In this paper, we analyze the role of SA in Transformer-based ASR models for not only understanding the mechanism of improved recognition accuracy but also lowering the computational complexity. We reveal that SA performs two distinct roles: phonetic and linguistic localization. Especially, we show by experiments that phonetic localization in the lower layers extracts phonologically meaningful features from speech and reduces the phonetic variance in the utterance for proper linguistic localization in the upper layers. From this understanding, we discover that attention maps can be reused as long as their localization capability is preserved. To evaluate this idea, we implement the layer-wise attention map reuse on real GPU platforms and achieve up to 1.96 times speedup in inference and $33\%$ savings in training time with noticeably improved ASR performance for the challenging benchmark on LibriSpeech dev/test-other dataset.
+
+# 1 INTRODUCTION
+
+Recent advances in end-to-end automatic speech recognition (ASR) have been driven by Transformer models (Vaswani et al., 2017). Transformer was first introduced for natural language processing (NLP) tasks such as neural machine translation (Vaswani et al., 2017; Ott et al., 2018), language modeling (Dai et al., 2019; Rae et al., 2019), and text generation (Raffel et al., 2020). Thanks to its superior performance in processing sequence input, Transformer has been widely adopted in various state-of-art ASR models (Zhang et al., 2020b; Ng et al., 2021; Guo et al., 2021). Self-attention (SA) is a core component of Transformer-based ASR, which dynamically collects information from multiple frames of an audio sequence. However, the computation and memory costs of SA increase quadratically with the length of a sequence, which is particularly problematic for ASR. For example, just a 30-second utterance corresponds to about 750 frames with a widely used window stride of 40ms.
+
+Understanding the role of SA may provide essential insights for the efficient design of Transformer-based ASR models. Extensive studies have examined the behavior of SA in the field of NLP (Kovaleva et al., 2019; Park et al., 2019; Gong et al., 2019; Rogers et al., 2020). Recently, several studies further attempted to discover the characteristics of SA in the speech domain. Yang et al. (2020) revealed that self-attention features in the self-supervised audio Transformer are categorized into global, vertical, and diagonal patterns. Zhang et al. (2021b) focused on the diagonality of upper SA layers in ASR models for improving efficiency. However, these prior works revealed limited insights on the patterns discovered in SA, constraining its use for improving model efficiency. Thus, providing a holistic view of the role of SA is desirable for efficient ASR model design.
+
+In this work, we reveal that SA plays two distinct roles in the success of Transformer-based ASR models: phonetic and linguistic localization, as illustrated in Figure 1. First, phonetic localization of lower SA layers attends to the phonologically meaningful global context. Second, linguistic localization of upper SA layers mainly attends to the local context of a near-diagonal attention map. We hypothesize that the phonetic variance in utterances such as variations in pronunciation is standardized in the lower SA layers so that the upper SA layers can identify local linguistic features
+
+
+Figure 1: Illustration of the role of SA layers in Transformer-based ASR models and the proposed layer-wise attention map reuse. We discover that lower layers and upper layers show different behavior.
+
+for accurate transcription. To investigate the behavior of SA layers, we propose phoneme attention relationship (PAR) to explain how phoneme localization works quantitatively. Interestingly, we discover that the phonetic localization represents the traditional knowledge on phonetics; for example, labial, velar, or nasal phonemes tend to attend to each other.
+
+Based on this understanding, we propose a practical method for efficient ASR model design. We reuse the attention maps of SA layers while preserving the phonetic localization capability of the lower SA layers, resulting in up to 1.96x speedup in inference and $33\%$ savings of training time with considerably improved performance in challenging ASR tasks (LibriSpeech dev/test-other dataset).
+
+Our contributions can be summarized as follows:
+
+- We reveal that SA layers contribute to ASR with two distinct roles: phonetic localization in the lower layers and linguistic localization in the upper layers. This unique distinction leads to an in-depth analysis of phonetic SA for the first time. We further propose phoneme attention relationship (PAR) to quantitatively identify the role of phonetic localization.
+- We propose layer-wise attention map reuse for efficient Transformer-based ASR models. In particular, we discover that attention map reuse is possible in lower SA layers as long as the phonetic localization property quantified by PAR is preserved. We demonstrate with the popular ASR model and dataset that ASR performance can be maintained or slightly improved even if the attention map is reused.
+- We implement the attention map reuse on real GPU platforms and achieve up to 1.96x inference speedup and $33\%$ savings in training time, demonstrating that the proposed method is practical.
+
+# 2 BACKGROUND
+
+# 2.1 ASR ENCODER AND SELF-ATTENTION
+
+SA is usually utilized as a module inside the ASR model consisting of stacked Transformer encoder layers. ASR encoder takes a sequence of short-time Fourier-transformed (STFT) audio features, known as a 'frame', as input and extracts a high-level feature of each frame through multiple layers. As illustrated in Figure 1, the extracted high-level feature changes for each layer; stacked SA layers
+
+first extract phonetic features from audio features and utilize these features to build linguistic features for the output transcription.
+
+We briefly review the $\mathrm{SA}^1$ computation procedure. Consider a sequence of $d$ -dimensional column vectors $X = \{x_{1}, x_{2}, \ldots, x_{T}\}$ as input. Each vector corresponds to each frame of speech where the total number of $T$ frames are included. The input feature vector $X$ is projected to query $(Q)$ , key $(K)$ , and value $(V)$ of $h$ -th attention head as follows:
+
+$$
+q _ {h, i} = W _ {h} ^ {Q} x _ {i}, \quad k _ {h, i} = W _ {h} ^ {K} x _ {i}, \quad v _ {h, i} = W _ {h} ^ {V} x _ {i} \quad \left(W _ {h} ^ {Q}, W _ {h} ^ {K}, W _ {h} ^ {V} \in \mathbb {R} ^ {d _ {h} \times d}\right) \tag {1}
+$$
+
+$W^{Q,K,V}$ indicates projection matrices for $Q, K, V$ , respectively. $d_h = d / H$ is the dimension of each attention head where $H$ is the number of attention heads. The attention map $(A_h)$ , which represents how much frames attend to each other, is computed by scaled dot-product operation followed by softmax. The resulting attention map takes a form of a 2D matrix where each row is a probability vector. A single element of the attention map $(A_h[i,j])$ represents how much $i$ -th frame attends to $j$ -th frame. The attention head $(d_h)$ is a weighted sum of $V$ using the attention map as weight. Note that each attention head corresponds to a different attention map $A_h$ ; this multi-head design enables focusing on various perspectives within a single SA layer. The output $O = \{o_1,o_2,\dots o_T\}$ is computed by the projection $(W^O \in \mathbb{R}^{d\times d})$ on the concatenated attention heads2.
+
+$$
+A _ {h} [ i,: ] = \operatorname {S o f t m a x} _ {j} \left(\frac {q _ {h , i} k _ {h , j} ^ {T}}{\sqrt {d _ {h}}}\right), \quad d _ {h, i} = \sum_ {j = 1} ^ {T} A _ {h} [ i, j ] v _ {h, j}, \quad o _ {i} = W ^ {O} \underset {h} {\operatorname {C o n c a t}} \left(d _ {h, i}\right) \tag {2}
+$$
+
+SA layer contains $O(d^{2})$ parameters. As shown in equations, SA requires quadratic computation and memory complexity $O(T^{2})$ , in exchange for the ability to access any location in the sequence. When $N$ layers of SA are stacked, the burden proportionally increases.
+
+# 2.2 PREVIOUS WORK ON SELF-ATTENTION ANALYSIS
+
+ASR considers both phonetic and linguistic aspects to transform audio input to text output. However, the studies on NLP mostly analyze the linguistic characteristics of SA, and the studies on self-supervised audio representation learning (SSAL) mainly focus on the phonetic behaviors of SA. The valuable findings from both domains cannot be directly applied to ASR.
+
+NLP The behavior of SA has been widely studied in the NLP domain (Rogers et al., 2020), mostly focused on BERT (Devlin et al., 2019), a self-supervised language representation learning model. Kovaleva et al. (2019) and Guan et al. (2020) suggested that attention patterns can be clustered into several groups and the pattern may change depending on the fine-tuning task. Clark et al. (2019) and Tenney et al. (2019) observed attention maps that correspond to linguistic concepts of the language. Voita et al. (2019) also characterized linguistic attention heads and connected the knowledge to efficient model structure. However, studies on NLP only provide analysis on linguistic attention.
+
+SSAL Recently, several studies have been introduced to understand how the audio information is encoded in SSAL models, such as CPC (Oord et al., 2018), Wav2Vec 2.0 (Baevski et al., 2020), Mockingjay (Liu et al., 2020), HuBERT (Hsu et al., 2021), and Audio ALBERT (Chi et al., 2021). Ma et al. (2021) and Shah et al. (2021) demonstrated that a wide spectrum of phonetic information is included in these models. Especially, Yang et al. (2020) categorized attention maps into three categories: global, vertical, and diagonal, where diagonal heads attend to local frames and vertical heads either focus or neglect specific phonemes. However, Yang et al. (2020) only discovered attention patterns without an explanation on how phonetic feature extraction is achieved with these patterns.
+
+ASR Previous works have investigated the redundancy of attention maps mainly based on diagonality. From the observation that attention maps in upper layers show highly diagonal patterns, Zhang et al. (2021b) proposed replacing upper SA layers to feed-forward layers without performance loss. Zhang et al. (2021a) removed SA heads of high diagonality during training as a regularization
+
+
+Figure 2: Cumulative attention diagonality (CAD) of each attention head. Four points for each layer correspond to the CAD of four attention heads. The black line connects the median across the layers.
+
+but keep every head for the test time. Similarly, Chang et al. (2020) introduced adaptive attention span where each attention head equips a different attention span width to reduce the sequence length for the computation, starting from the intuition that some heads only attend to neighboring frames. These approaches mainly focus on reducing the burden of diagonal and concentrated attention, however, diagonality-based analysis has limitations in optimizing phonetic attention. We distinguish SA into two groups and provide proper analysis for each.
+
+# 3 UNDERSTANDING THE ROLE OF SELF-ATTENTION IN ASR
+
+# 3.1 ANALYSIS SETUP
+
+We train and evaluate the model on the LibriSpeech-960 (Panayotov et al., 2015) dataset. The dataset include two types of data, clean and other, where other contains more challenging utterances. We extract the 80-dimensional log-Mel filterbank feature from a 25ms window with a stride of 10ms. We use 128 sub-word tokens as vocabulary, built on SentencePiece (Kudo & Richardson, 2018) library using the byte-pair encoding (Sennrich et al., 2016). The analyses are performed on LibriSpeech test-clean dataset unless specified.
+
+We use Conformer-M(medium) (Gulati et al., 2020) as the baseline ASR encoder, trained with CTC (Graves et al., 2006) loss. Conformer is a variant of Transformer, which combines an additional convolution module to enhance the ability to collect local neighboring features. We follow recently introduced state-of-the-art ASR studies (Zhang et al., 2020b; Ng et al., 2021; Guo et al., 2021) that have adopted Conformer as their ASR encoder. We train the model with AdamW (Loshchilov & Hutter, 2018) optimizer for 200K iterations. Please see Appendix A.1 and A.2 for the model configuration and training details.
+
+# 3.2 Distinguishing BETWEEN PHONETIC AND LINGUISTIC SELF ATTENTIONS
+
+To understand the role of SA, we start by examining the attention map $A_{h}$ , which characterizes the functionality of SA. The attention map indicates how a frame attends the other frames in terms of probabilistic distribution for each attention head. Thus, analysis on attention maps across the heads of a SA layer would discover important characteristics of SA. To measure the diagonality of the attention map, we introduce cumulative attention diagonality (CAD) defined as the integral of the sum of attention probabilities constrained by distance as below:
+
+$$
+\mathrm {C A D} _ {h} = \int_ {r = 0} ^ {1} \frac {1}{T} \sum_ {i = 1} ^ {T} \sum_ {j = 1} ^ {T} A _ {h} [ i, j ] \cdot \mathbb {I} [ | i - j | \leq r (T - 1) ] \mathrm {d} r \tag {3}
+$$
+
+where $T$ is the number of frames in a sequence, $r$ determines the range of distribution in the attention map under test, and $h$ is an index of the attention head. Appendix B.1.1 provides detailed explanations of above equation and visualizes some CAD examples.
+
+Figure 2 shows the attention diagonality analysis for the SA layers. There is a clear transition of CAD from lower layers (layer 1-8) to upper layers (layer 9-16). We emphasize this is a unique trend observed in ASR models compared to other domains: Kovaleva et al. (2019) classified attention maps in BERT but did not report the grouping of the same types. Yang et al. (2020) also categorized attention maps in SSAL but those categories broadly appear through layers. In ASR, Zhang et al. (2021b) observed a similar diagonality pattern for SA layers, but they considered it as an increase of diagonality over layers and did not separate the distinct patterns.
+
+
+Figure 3: Visualization of the phonetic localization. Each element corresponds to $A[i,j]$ where $i,j$ indicates the frame index. Several rows that correspond to a certain phoneme, give higher attention to similar phonemes across the columns. For better visualization, we selectively draw boxes on three representative patterns (S, ER, and IY).
+
+From the diagonality analysis, we categorize the role of SA layers into two parts: phonetic and linguistic localization. In ASR, linguistic localization refers to the behavior of the attention map that focuses on local (near in distance) frames and aggregates the information for text transcription. Since these local frames are particularly important in audio to text transcription in ASR, the attention map is characterized with a diagonal pattern. As shown in Figure 2, the upper layers tend to exhibit diagonally dominant patterns, implying their role as a linguistic localizer. We visualize two cases of diagonal attention patterns in Figure 1, extracted from layers 12 and 15 of the baseline model. Our observation is consistent with the prior work such as Zhang et al. (2021b). On the other hand, there has been little discussion about the role of lower layers in ASR in the context of phoneme localization. We discuss this in detail in the next section.
+
+# 3.3 CHARACTERISTIC OF PHONETIC LOCALIZATION
+
+Phonetic localization denotes the role of the attention map that focuses on similar (near in content) frames and extracts the phonologically meaningful features. We observe two characteristics of phonetic localization. First, phonetic localization is realized as attention to similar phonemes across the sequence. Second, the localization transforms each corresponding frame more likely to others.
+
+To analyze phonetic attention, we exploit the phoneme information to find out the relationship between attention and phonemes. For the LibriSpeech dataset, we use the frame-level phoneme alignments obtained from Montreal Forced Aligner (McAuliffe et al., 2017). Table 1 lists all phoneme classes. Please visit Appendix A.3 for details on phoneme pre-processing.
+
+| Idx. | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| Phn. | AA | AE | AW | AY | AH | EH | ER | EY | IY | IH | O | UH | UW | L | R | M | N | NG |
| Idx. | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |
| Phn. | B | D | DH | G | K | P | T | F | CH | SH | TH | S | Z | V | JH | W | Y | HH |
+
+Table 1: Phoneme index for the analysis. Phonemes are extracted from the LibriSpeech lexicon and collapsed into 36 classes. Phonemes are reordered according to their phonological properties.
+
+Figure 3 demonstrates the first characteristic of phoneme localization. The attention map presents that the same or similar phonemes tend to assign high attention weight to each other, for example, ('S' to 'Z'), ('ER' to 'R'), and ('IY' to 'IH').
+
+We evaluate our second statement by phoneme classification on hidden layer representations (output of layers, also known as a hidden activation or hidden vector), similar to previous approaches (Baevski et al., 2021; Liu et al., 2021). We extract hidden layer representations and train a softmax classifier for each layer. Input is 256-dimensional vector and output contains total 37 output classes (36 phonemes + "silence"). See Appendix A.5 for the details on training the classifier and visualization of the confusion matrix.
+
+
+Figure 4: Phoneme classification accuracy on LibriSpeech test datasets. The zeroth entry implies the classifier is trained from hidden representations obtained before the first SA layer.
+Figure 4 shows the phoneme classification accuracy for different layers. The accuracy increases for the lower layers (layer 1-8) where phonetic localization dominates. Specifically, the accuracy of layer 0 (before SA) is only $53.8\%$ , but it consistently increases to $81.7\%$ at layer 8. The phoneme classification accuracy indicates how well hidden vectors can be distinguished according to their phoneme classes. Therefore, the accuracy increase on lower layers implies that hidden layer representations are more standardized by phonetic localization. We assume that the accuracy decreases for the upper layers because they perform the linguistic localization and convert phoneme-level information to output text.
+
+# 3.4 LAYER-WISE ANALYSIS OF PHONETIC ATTENTIONS
+
+In phonetic attention, we observed that similar phonemes attend to each other and the phonetic features are clustered through layers. For the next step, we investigate the layer-wise behavior of phonetic attention to understand the contribution of each phonetic attention layer. We introduce phoneme attention relationship (PAR) to understand how SA processes phonological information by exposing how much each phoneme class attends to the other phonemes on average. Specifically, we directly map an attention probability $A_{h}[i,j]$ to $P_{h}[p,q]$ where $i$ -th frame and $j$ -th frame correspond to phoneme $p$ and $q$ , respectively. If two phoneme classes $p$ and $q$ are different, we simply transport the probability from $A_{h}[i,j]$ to $P_{h}[p,q]$ . On the other hand, if two frames are within the same phoneme class $p$ , we exclude consecutive frames of the same class to avoid unnecessarily emphasize the effect of diagonal attention maps. PAR is computed as below3:
+
+$$
+P _ {h} [ p, q ] = \frac {T}{\left| C _ {p} \right| \cdot \left| C _ {q} \right|} \sum_ {i \in C _ {p}} \sum_ {j \in C _ {q}} A _ {h} [ i, j ] \quad (p \neq q) \tag {4}
+$$
+
+$$
+P _ {h} [ p, p ] = \frac {T}{\left| C _ {p} \right|} \sum_ {i \in C _ {p}} \frac {1}{\left| C _ {p} \right| - \left| E _ {p} (i) \right|} \sum_ {j \in C _ {p} - E _ {p} (i)} A _ {h} [ i, j ] \quad (p = q) \tag {5}
+$$
+
+$C_p, C_q$ indicates the set of frame indices that correspond to phoneme class $p$ and $q$ . $E_p(i)$ indicates the number of frames that satisfies two conditions: belong to the same class $p$ as $i$ -th frame and all frames between itself and $i$ -th frame also belong to the same class. In other words, $C_p - E_p(i)$ indicates the subset of $C_p$ that are not connected to $i$ -th frame by consecutive class $p$ frames. For the $P_h[p,p]$ calculation, we do not include consecutive frames of the same class. We discuss the purpose of this exclusion in Appendix B.2.1.
+
+We visualize the average PAR of the lower half and upper half of layers in Figure 5. A prominent diagonal component appears, representing that phonemes put high attention to themselves. Interestingly, we also discover well-known phonological characteristics in the lower half of layers. For example, labial (B, P), velar (G, K), and alveolar (S, Z) consonants highly attend to each other. Nasal phonemes (M, N, NG) also show a high correlation. From the empirical observations, we denote that phonetic attention map creates heterogeneous patterns. Thanks to the multi-head structure, a single SA layer can capture multiple phonetic relationships. Please see Figure 12 in Appendix B.2.2 for various PAR examples for each head.
+
+If each phonetic attention map corresponds to different relationships, can we reuse phonetic attention maps across multiple layers? We answer this question by introducing the PAR coverage, which
+
+
+(a) Lower half of layers
+
+
+(b) Upper half of layers
+Figure 5: Averaged phoneme attention relationship of the lower half (1st, ... 8th) and upper half (9th, ... 16th) layers. The result is averaged through layers and heads on test-clean dataset. Each row and column corresponds to the phoneme index. Brighter (yellow) values indicate stronger attention between phonemes. Elements that stand out are highlighted, where phonemes with similar properties tend to attend to each other.
+
+
+Figure 6: Accumulated PAR coverage of lower layers (1st, ... 8th). Averaged PAR of the baseline (Figure 5(a)) is set to 1.0, which is considered to be a desirable reference. The left plot on the accumulated coverage shows how each layer participates in covering the strength of the relationship. The right table summarizes the coverage of different reuse configurations. A higher average per-layer coverage ratio implies that each layer performs more similarly to the baseline.
+
+| Reusing Config. | Avg. Per-layer Coverage (%) | Accumulated Coverage (%) |
| 1x16 | 0.915 ± 0.041 | 1.0 |
| 2x8 | 0.960 ± 0.021 | 0.996 |
| 4x4 | 0.968 ± 0.016 | 0.992 |
| 8x2 | 0.973 ± 0.000 | 0.974 |
+
+indicates how much each layer covers the phonetic relationship represented in the averaged PAR from the baseline (Figure 5(a)). The averaged PAR of the baseline is considered to represent all the essential phoneme relationships. Please refer to Appendix A.4 for details.
+
+To investigate the effect of reuse, we plot the accumulated PAR coverage for different reuse configurations in Figure 6. In calculating the accumulated coverage ratio, we take the average on every PAR under a certain layer and compare it with the reference PAR. The accumulated coverage consistently increases to 1, which means that the missing relationships are fulfilled through layers. We test four configurations (will be introduced in detail in the next Section) $X \times Y$ , where $X$ layers share the same attention map. As the number of reuse increases $(2 \times 8 \rightarrow 4 \times 4 \rightarrow 8 \times 2)$ , the average per-layer coverage also grows, which implies that each SA layer tries to capture more phonetic relationships to recover the performance. However, for $8 \times 2$ , the model fails to fully cover the reference, represented as a low accumulated coverage ratio of 0.974. In Appendix B.3, we visualize the effect of the reuse on PAR coverage where phonetic features captured in $2 \times 8$ and $4 \times 4$ are missed in $8 \times 2$ .
+
+Table 2: Word error rate $(\%)$ for different attention map reuse configurations. "HX" indicates that the number of attention heads in the self-attention layer is set to X. All configurations carry almost the same number of parameters. No external language model is used.
+
+| Configuration | #Heads | Head dim. | dev-clean | dev-other | test-clean | test-other |
| 1(H4) × 16 (baseline) | 64 | 64 | 3.1 | 8.3 | 3.2 | 8.4 |
| 2(H4) × 8 | 32 | 64 | 3.0 | 8.2 | 3.3 | 8.2 |
| 4(H8) + 4(H8) + 4(H8) + 4(H8) | 32 | 32 | 3.1 | 8.1 | 3.2 | 8.1 |
| 4(H2) + 4(H2) + 4(H4) + 4(H4) | 12 | 128/64 | 3.1 | 8.2 | 3.4 | 8.3 |
| 4(H4) + 4(H4) + 4(H4) + 4(H4) | 16 | 64 | 3.0 | 8.2 | 3.3 | 8.2 |
| 4(H8) + 4(H8) + 4(H4) + 4(H4) | 24 | 32/64 | 3.1 | 8.3 | 3.2 | 8.4 |
| 4(H4) + 4(H4) + 4(H2) + 4(H2) | 12 | 64/128 | 3.1 | 8.5 | 3.4 | 8.5 |
| 4(H4) + 4(H4) + 4(H4) + 4(H4) | 16 | 64 | 3.0 | 8.2 | 3.3 | 8.2 |
| 4(H4) + 4(H4) + 4(H8) + 4(H8) | 24 | 64/32 | 3.1 | 8.2 | 3.3 | 8.1 |
| 4(H4) + 4(H4) + 8(H4) | 12 | 64 | 3.1 | 8.3 | 3.3 | 8.2 |
| 8(H4) + 4(H4) + 4(H4) | 12 | 64 | 3.1 | 8.5 | 3.3 | 8.6 |
| 8(H4) + 8(H4) | 8 | 64 | 3.3 | 8.8 | 3.6 | 8.7 |
| 8(H8) + 8(H8) | 16 | 32 | 3.2 | 8.5 | 3.4 | 8.5 |
+
+# 4 LAYER-WISE ATTENTION MAP REUSE
+
+We propose layer-wise attention map reuse, a method to design an efficient Transformer-based ASR encoder by reducing the heavy SA computation. The core idea is to reuse the computed attention map from the previous layer. More specifically, we reuse attention map of $l$ -th SA layer to $(l + 1)$ , $(l + 2)$ , ... $(l + M - 1)$ -th consecutive SA layers. If a single attention map is shared through $M$ layers, the computation burden of SA can be reduced by $M$ times. During training, the reused attention map receives gradients from $M$ layers. This layer-wise reuse is easy to implement and fully supported by modern accelerator hardware. The idea of reuse attention map through layers have been proposed for NLP (Xiao et al., 2019; Ying et al., 2021) but not tested for ASR. We discuss the difference in Section 5. For SA layers that receive the pre-computed attention map, query and key are not used and can be removed. To compensate the parameter size for those layers, we simply double the output dimension of $V$ ( $W_h^V \in \mathbb{R}^{2d_h \times d}$ , $W^O \in \mathbb{R}^{d \times 2d}$ ).
+
+Table 2 shows the word error rate (WER) on LibriSpeech dev and test dataset. Configuration “ $X \times Y$ ” indicates that $X$ successive layers are grouped to share the same attention map and total $Y$ groups are built. Therefore, there exist HXY unique attention heads for each model. We also use the notation ‘+’, for example, $4 \times 4$ is identical to $4 + 4 + 4 + 4$ . For each configuration, we train the model from scratch with the same training setup as the baseline. Note that the increased number of heads comes with the decreased per-head dimension to keep the parameter size comparable.
+
+Best and Worst We first compare the best $(4(\mathsf{H8})\times 4)$ and the worst configuration $(8(\mathsf{H4})\times 2)$ . The worst is the most naive setting that just applies very aggressive attention map reuse. Although the speed is about the same, performance can be improved by increasing the number of heads $(8(\mathsf{H8})\times 2)$ . In contrast, the best working setting is carefully designed to maximize performance. For example, equipping the same number of heads $(2(\mathsf{H4})\times 8)$ does not show similar performance compared to the best configuration.
+
+Sensitivity to Reuse We examine which of the phonetic or linguistic localization is more sensitive to attention map reuse. Comparing two configurations with the identical number of heads and head dimensions $(4 + 4 + 8$ vs. $8 + 4 + 4)$ in the 5th block of Table 2, we conclude the phonetic localization suffers more from increasing the reuse of layers. In other words, the linguistic localization seems to be more robust to the reuse. We conjecture that too few phonetic localization heads fail to capture every essential relationship.
+
+Number of Heads in Phonetic Localization To better understand the trade-off between the number of heads and head dimension, we conduct three experiments that only differ on the number of heads in lower layers. As shown in the 3rd block of Table 2, among the three configurations,
+
+Table 3: Effect of different configurations on speed. The numbers inside of the parentheses indicate the speed-up ratio. The front convolutional sub-sampling is not included. Changing the number of heads does not make much difference to the speed.
+
+| Config. | #Param (M) | Latency(ms) by sequence length (approx. sec) | Training cost(h) |
| 128 (5.1s) | 256 (10.2s) | 512 (20.5s) | 768 (30.7s) |
| 1 × 16 | 25.45 | 1.43 (x1.00) | 3.74 (x1.00) | 11.11 (x1.00) | 22.32 (x1.00) | 430.0 |
| 2 × 8 | 24.92 | 1.25 (x1.15) | 2.98 (x1.26) | 7.92 (x1.40) | 15.05 (x1.48) | 337.5 |
| 4 × 4 | 24.66 | 1.14 (x1.25) | 2.56 (x1.46) | 6.29 (x1.77) | 11.38 (x1.96) | 288.4 |
| 8 × 2 | 24.52 | 1.08 (x1.32) | 2.35 (x1.59) | 5.47 (x2.03) | 9.55 (x2.34) | 268.8 |
+
+$(4(\mathsf{H}4)\times 4)$ surpasses the other two in 3 over 4 benchmarks. We expect a trade-off between the number of phonetic localization heads and per-head dimension; the former enables more various aspects to be covered while the latter helps richer representation for each head.
+
+Number of Heads in Linguistic Localization We perform the same experiment as above for the upper layers, shown in the 4th block of Table 2. Interestingly, we found that increasing the number of heads for linguistic localization tends to improve the overall performance. In addition, a considerable performance loss is detected when the number of heads is decreased to $2(\mathrm{H}2)$ . This observation implies that the previous studies that only reduce linguistic attention may face limitations when the remaining linguistic heads are too few.
+
+Inference and Training Speed Table 3 compares different reuse configurations. Both training and inference speed can be greatly improved by reducing the number of attention computation. The impact becomes more significant for longer sequences as $T$ increases. Our best configuration $(4(\mathrm{H}8) \times 4)$ accelerates the inference by 1.96x times (for 30-second utterance) and reduces training cost by $33\%$ . Note that the number of parameters is almost equivalent for all configurations because of the expansion of $V$ dimension. Inference speed is evaluated on a single RTX-Titan(24GB) GPU and training cost is measured in GPU-hours on A100(40GB) GPU.
+
+# 5 RELATED WORK
+
+Attention Map Reuse in NLP Xiao et al. (2019) proposed sharing of attention map through consecutive layers for neural machine translation. They determine the reuse policy by Jensen-Shannon divergence (JSD) values between two attention maps. Ying et al. (2021) propose a similar approach for BERT but with manual reuse configurations. In addition to the critical difference in the domain (NLP vs. ASR), both works depend on the similarities of the attention map, however, do not investigate why the similarity is developed.
+
+Efficient Attention Map Computation for ASR Several studies have been proposed to reduce the cost of attention computation for ASR. Wang et al. (2021) proposed a prob-sparse SA that only computes the top-k queries that are less uniform. For the streaming purpose, block processing of input sequence has been widely adopted (Yeh et al., 2021; Shi et al., 2021). Masked attention, which restricts the attention range to local neighbors, have also been used (Zhang et al., 2020a; Tripathi et al., 2020; Audhkhasi et al., 2021). While these approaches focus on reducing the effective sequence length, our method directly reduces SA computation.
+
+# 6 CONCLUSION
+
+In this paper, we analyze the role of self-attention in Transformer-based ASR and show that the role can be distinguished into two types: phonetic and linguistic localization. Especially, we showed that the phonetic localization captures various phonetic relationships and contributes to the performance by standardizing the features over similar phonemes, verified by the increasing phoneme classification accuracy over lower layers. The distinguished roles of SA in lower and upper layers also lead to an efficient ASR model that reuses the attention map for multiple SA layers. The proposed method has achieved a significant 1.96 times of speedup in inference and $33\%$ reduced training time, with the reduction of word error rate from $8.40\%$ to $8.05\%$ on the LibriSpeech test-other dataset.
+
+# REPRODUCIBILITY STATEMENT
+
+We explain extra details for the model architecture, training procedure, pre-processing steps, and experiments for analyses in Appendix A. We also provide the source code for the experiments in supplemental materials.
+
+# ACKNOWLEDGMENTS
+
+This work was supported by the National Research Foundation of Korea (NRF) grant funded by Korea government (MSIT) (No. 2021R1A2C1013513). This work was also partly supported by Institute of Information & communications Technology Planning & Evaluation (IITP) grant funded by MSIT (No. 2020-0-01373, No. 2021-0-00020-001). This work was also supported in part by Samsung Advanced Institute of Technology, Samsung Electronics Co., Ltd. This work was also partly supported by the Google AI Focused Research Awards Program awarded to Wonyong Sung. We gratefully acknowledge the GCP credit support from Google AI and the GPU server support from the Artificial Intelligence Cluster Agency (AICA, Korea).
+
+# REFERENCES
+
+Kartik Audhkhasi, Tongzhou Chen, Bhuvana Ramabhadran, and Pedro J Moreno. Mixture model attention: Flexible streaming and non-streaming automatic speech recognition. Proc. Interspeech 2021, pp. 1812-1816, 2021.
+Alexei Baevski, Yuhao Zhou, Abdelrahman Mohamed, and Michael Auli. wav2vec 2.0: A framework for self-supervised learning of speech representations. Advances in Neural Information Processing Systems, 33, 2020.
+Alexei Baevski, Wei-Ning Hsu, Alexis Conneau, and Michael Auli. Unsupervised speech recognition. arXiv preprint arXiv:2105.11084, 2021.
+Xuankai Chang, Aswin Shanmugam Subramanian, Pengcheng Guo, Shinji Watanabe, Yuya Fujita, and Motoi Omachi. End-to-end asr with adaptive span self-attention. In INTERSPEECH, pp. 3595–3599, 2020.
+Po-Han Chi, Pei-Hung Chung, Tsung-Han Wu, Chun-Cheng Hsieh, Yen-Hao Chen, Shang-Wen Li, and Hung-yi Lee. Audio albert: A lite bert for self-supervised learning of audio representation. In 2021 IEEE Spoken Language Technology Workshop (SLT), pp. 344-350. IEEE, 2021.
+Kevin Clark, Urvashi Khandelwal, Omer Levy, and Christopher D Manning. What does bert look at? an analysis of bert's attention. In Proceedings of the 2019 ACL Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pp. 276-286, 2019.
+Zihang Dai, Zhilin Yang, Yiming Yang, Jaime G Carbonell, Quoc Viet Le, and Ruslan Salakhutdinov. Transformer-xl: Attentive language models beyond a fixed-length context. In ACL (1), 2019.
+Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In *NAACL-HLT* (1), 2019.
+Linyuan Gong, Di He, Zhuohan Li, Tao Qin, Liwei Wang, and Tieyan Liu. Efficient training of bert by progressively stacking. In International Conference on Machine Learning, pp. 2337-2346. PMLR, 2019.
+Alex Graves, Santiago Fernández, Faustino Gomez, and Jürgen Schmidhuber. Connectionist temporal classification: labelling unsegmented sequence data with recurrent neural networks. In Proceedings of the 23rd international conference on Machine learning, pp. 369-376, 2006.
+Yue Guan, Jingwen Leng, Chao Li, Quan Chen, and Minyi Guo. How far does bert look at: Distance-based clustering and analysis of bert's attention. arXiv preprint arXiv:2011.00943, 2020.
+Anmol Gulati, James Qin, Chung-Cheng Chiu, Niki Parmar, Yu Zhang, Jiahui Yu, Wei Han, Shibo Wang, Zhengdong Zhang, Yonghui Wu, and Ruoming Pang. Conformer: Convolution-augmented transformer for speech recognition. In Proc. Interspeech 2020, pp. 5036-5040, 2020.
+
+Pengcheng Guo, Florian Boyer, Xuankai Chang, Tomoki Hayashi, Yosuke Higuchi, Hirofumi Inaguma, Naoyuki Kamo, Chenda Li, Daniel Garcia-Romero, Jiatong Shi, et al. Recent developments on espnet toolkit boosted by conformer. In ICASSP 2021-2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 5874-5878. IEEE, 2021.
+Wei-Ning Hsu, Benjamin Bolte, Yao-Hung Hubert Tsai, Kushal Lakhotia, Ruslan Salakhutdinov, and Abdelrahman Mohamed. Hubert: Self-supervised speech representation learning by masked prediction of hidden units. arXiv preprint arXiv:2106.07447, 2021.
+Mingkun Huang, Jun Zhang, Meng Cai, Yang Zhang, Jiali Yao, Yongbin You, Yi He, and Zejun Ma. Improving rn transducer with normalized jointer network. arXiv preprint arXiv:2011.01576, 2020.
+P Izmailov, AG Wilson, D Podoprikhin, D Vetrov, and T Garipov. Averaging weights leads to wider optima and better generalization. In 34th Conference on Uncertainty in Artificial Intelligence 2018, UAI 2018, pp. 876-885, 2018.
+Goro Kobayashi, Tatsuki Kuribayashi, Sho Yokoi, and Kentaro Inui. Attention is not only a weight: Analyzing transformers with vector norms. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 7057-7075, 2020.
+Olga Kovaleva, Alexey Romanov, Anna Rogers, and Anna Rumshisky. Revealing the dark secrets of bert. 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), pp. 4365-4374, 2019.
+Taku Kudo and John Richardson. Sentencepiece: A simple and language independent subword tokenizer and detokenizer for neural text processing. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pp. 66-71, 2018.
+Andy T Liu, Shu-wen Yang, Po-Han Chi, Po-chun Hsu, and Hung-yi Lee. Mockingjay: Unsupervised speech representation learning with deep bidirectional transformer encoders. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 6419-6423. IEEE, 2020.
+Andy T Liu, Shang-Wen Li, and Hung-yi Lee. Tera: Self-supervised learning of transformer encoder representation for speech. IEEE/ACM Transactions on Audio, Speech, and Language Processing, 29:2351-2366, 2021.
+Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In International Conference on Learning Representations, 2018.
+Danni Ma, Neville Ryan, and Mark Liberman. Probing acoustic representations for phonetic properties. In ICASSP 2021-2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 311-315. IEEE, 2021.
+Michael McAuliffe, Michaela Socolof, Sarah Mihuc, Michael Wagner, and Morgan Sonderegger. Montreal forced aligner: Trainable text-speech alignment using kaldi. In Interspeech, volume 2017, pp. 498-502, 2017.
+Edwin G Ng, Chung-Cheng Chiu, Yu Zhang, and William Chan. Pushing the limits of non-autoregressive speech recognition. arXiv preprint arXiv:2104.03416, 2021.
+Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
+Myle Ott, Sergey Edunov, David Grangier, and Michael Auli. Scaling neural machine translation. In Proceedings of the Third Conference on Machine Translation: Research Papers, pp. 1-9, 2018.
+Vassil Panayotov, Guoguo Chen, Daniel Povey, and Sanjeev Khudanpur. Librispeech: an asr corpus based on public domain audio books. In 2015 IEEE international conference on acoustics, speech and signal processing (ICASSP), pp. 5206-5210. IEEE, 2015.
+
+Cheonbok Park, Inyoup Na, Yongjang Jo, Sungbok Shin, Jaehyo Yoo, Bum Chul Kwon, Jian Zhao, Hyungjong Noh, Yeonsoo Lee, and Jaegul Choo. Sanvis: Visual analytics for understanding self-attention networks. In 2019 IEEE Visualization Conference (VIS), pp. 146–150. IEEE, 2019.
+Daniel S Park, Yu Zhang, Chung-Cheng Chiu, Youzheng Chen, Bo Li, William Chan, Quoc V Le, and Yonghui Wu. Specaugment on large scale datasets. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 6879-6883. IEEE, 2020.
+Chao Peng, Tete Xiao, Zeming Li, Yuning Jiang, Xiangyu Zhang, Kai Jia, Gang Yu, and Jian Sun. Megdet: A large mini-batch object detector. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 6181-6189, 2018.
+Jiezhong Qiu, Hao Ma, Omer Levy, Wen-tau Yih, Sinong Wang, and Jie Tang. Blockwise self-attention for long document understanding. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: Findings, pp. 2555–2565, 2020.
+Jack W Rae, Anna Potapenko, Siddhant M Jayakumar, Chloe Hillier, and Timothy P Lillicrap. Compressive transformers for long-range sequence modelling. In International Conference on Learning Representations, 2019.
+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:1-67, 2020.
+Anna Rogers, Olga Kovaleva, and Anna Rumshisky. A primer in bertology: What we know about how bert works. Transactions of the Association for Computational Linguistics, 8:842-866, 2020.
+Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1715-1725, 2016.
+Jui Shah, Yaman Kumar Singla, Changyou Chen, and Rajiv Ratn Shah. What all do audio transformer models hear? probing acoustic representations for language delivery and its structure. arXiv preprint arXiv:2101.00387, 2021.
+Tao Shen, Tianyi Zhou, Guodong Long, Jing Jiang, and Chengqi Zhang. Bi-directional block selfattention for fast and memory-efficient sequence modeling. In International Conference on Learning Representations, 2018.
+Yangyang Shi, Yongqiang Wang, Chunyang Wu, Christian Fuegen, Frank Zhang, Duc Le, Ching-Feng Yeh, and Michael L Seltzer. Weak-attention suppression for transformer based speech recognition. In Interspeech, 2020.
+Yangyang Shi, Yongqiang Wang, Chunyang Wu, Ching-Feng Yeh, Julian Chan, Frank Zhang, Duc Le, and Mike Seltzer. Emformer: Efficient memory transformer based acoustic model for low latency streaming speech recognition. In ICASSP 2021-2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 6783-6787. IEEE, 2021.
+Kaiser Sun and Ana Marasovic. Effective attention sheds light on interpretability. arXiv preprint arXiv:2105.08855, 2021.
+Ian Tenney, Dipanjan Das, and Ellie Pavlick. Bert rediscovers the classical nlp pipeline. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 4593-4601, 2019.
+Anshuman Tripathi, Jaeyoung Kim, Qian Zhang, Han Lu, and Hasim Sak. Transformer transducer: One model unifying streaming and non-streaming speech recognition. arXiv preprint arXiv:2010.03192, 2020.
+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, pp. 5998-6008, 2017.
+
+Elena Voita, David Talbot, Fedor Moiseev, Rico Sennrich, and Ivan Titov. Analyzing multi-head self-attention: Specialized heads do the heavy lifting, the rest can be pruned. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 5797–5808, 2019.
+Xiong Wang, Sining Sun, Lei Xie, and Long Ma. Efficient conformer with prob-sparse attention mechanism for end-to-endspeech recognition. In *INTERSPEECH*, 2021.
+Tong Xiao, Yinqiao Li, Jingbo Zhu, Zhengtao Yu, and Tongran Liu. Sharing attention weights for fast transformer. In Proceedings of the Twenty-Eighth International Joint Conference on Artificial Intelligence (IJCAI-19), 2019.
+Shuwen Yang, Andy T. Liu, and Hung yi Lee. Understanding self-attention of self-supervised audio transformers. In Proc. Interspeech 2020, pp. 3785-3789, 2020. doi: 10.21437/Interspeech.2020-2231.
+Ching-Feng Yeh, Yongqiang Wang, Yangyang Shi, Chunyang Wu, Frank Zhang, Julian Chan, and Michael L Seltzer. Streaming attention-based models with augmented memory for end-to-end speech recognition. In 2021 IEEE Spoken Language Technology Workshop (SLT), pp. 8-14. IEEE, 2021.
+Chengxuan Ying, Guolin Ke, Di He, and Tie-Yan Liu. Lazyformer: Self attention with lazy update. arXiv preprint arXiv:2102.12702, 2021.
+Qian Zhang, Han Lu, Hasim Sak, Anshuman Tripathi, Erik McDermott, Stephen Koo, and Shankar Kumar. Transformer transducer: A streamable speech recognition model with transformer encoders and rn-t loss. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 7829-7833. IEEE, 2020a.
+Shuong Zhang, Erfan Loweimi, Peter Bell, and Steve Renals. Stochastic attention head removal: A simple and effective method for improving transformer based asr models. In Proc. Interspeech 2021, 2021a.
+Shucong Zhang, Erfan Loweimi, Peter Bell, and Steve Renals. On the usefulness of self-attention for automatic speech recognition with transformers. In 2021 IEEE Spoken Language Technology Workshop (SLT), pp. 89-96. IEEE, 2021b.
+Yu Zhang, James Qin, Daniel S Park, Wei Han, Chung-Cheng Chiu, Ruoming Pang, Quoc V Le, and Yonghui Wu. Pushing the limits of semi-supervised learning for automatic speech recognition. arXiv preprint arXiv:2010.10504, 2020b.
+
+# A DETAILS
+
+# A.1 MODEL
+
+Our baseline model is Conformer-M(medium) (Gulati et al., 2020) trained with CTC (Graves et al., 2006) loss. Table 4 shows the configuration of the model. Unspecified details follow the original Conformer paper. We observed that SyncBN (Peng et al., 2018) is critical for the overall performance. We employ weak attention suppression (WAS) (Shi et al., 2020) of $\gamma = 0.5$ for faster convergence and improved performance.
+
+| Encoder |
| #Layers | 16 | Hidden dim. | 256 |
| #Heads | 4 | Feed-forward dim. | 1024 |
| Conv. kernel size | 31 | Conv. normalization | SyncBN |
| BN momentum | 0.005 | BN epsilon | 1e-5 |
| Hidden drop prob. | 0.1 | Attention drop prob. | 0.1 |
| Conv. Subsampling |
| #Layers | 2 | #Channels | 256 |
| Conv. kernel size | 3 | Conv. normalization | SyncBN |
| Conv. stride | 2 | Activation func. | ReLU |
+
+We decide to use Conformer as our baseline, following recent state-of-the-art ASR models, because these models can benefit the most from the proposed efficient model design. However, there may be several concerns on the clarity of our analysis on SA because the convolution module is jointly used with SA inside Conformer. Because the ability to gather information from the entire sequence is only equipped in SA, the analysis results on the role of phonetic heads could not be presented without SA. The convolution kernel size of 31, which covers about 1.2 seconds, is too short to gather long-range information. We believe that the convolution module may guide the model to focus on local information first at the early stage of the training, however, the role of SA is not much affected by the difference between Conformer and Transformer.
+
+# A.2 TRAINING
+
+Table 4: Conformer-M implementation details.
+
+| Optimizer & Scheduler |
| Maximum LR | 1.5e-3 | Weight decay | 1e-5 |
| Adam epsilon | 1e-8 | Adam betas | (0.9, 0.99) |
| LR warm-up iters | 5K | LR keep iters | 95K |
| Total iters | 200K | Batch size | 480 |
| Additional Details |
| #Frequency masking | 2 | Frequency mask width | 27 |
| #Time masking | 10 | Time mask width | 0.05 (5%) |
| #Models for SWA | 45 | Variational noise | 0.02 |
| CTC beam size | 32 | Gradient norm clip | 20 |
+
+Table 5: Training details including optimizer, scheduler, augmentation and other hyper-parameters.
+
+We use AdamW (Loshchilov & Hutter, 2018) optimizer with the inverse square-root learning rate schedule (Vaswani et al., 2017). Table 4 shows the training configuration. We linearly increase the learning rate (LR) to the maximum value for 5K iterations and keep LR at maximum for 95K iterations, followed by 100K iterations of LR decrease. We use 4x A100(40GB) GPUs for the experiments. To fit the batch size of 480 in these GPUs, we assign 40 samples per GPU and accumulate the gradient of 3 batches. We don't use bucketing for generating the mini-batch during training. We also employ adaptive SpecAugment (Park et al., 2020), stochastic weight averaging (SWA) (Izmailov et al., 2018), and variational noise.
+
+# A.3 PHONEMPRE-PROCESSING
+
+For phonetic analyses, We employ the collapsed list of phonemes that are included in the LibriSpeech lexicon. We collapse ('AA, AO' to 'AA'), ('OW, OY' to 'O'), and ('SH, ZH' to 'SH'), which leads to the phoneme classes in Table 1, for better understanding the characteristics. Because the LibriSpeech dataset does not provide frame-wise phoneme alignments, we extract the phoneme alignment from MFA (McAuliffe et al., 2017) and map these alignments to each frame. Especially, we exploit the fact that each frame corresponds to a 40ms interval after passing through two convolutional layers (convolutional sub-sampling) of stride 2 in front of the model. We assign the phoneme class to each frame if the center of the frame is within the phoneme duration, including the 'silence' phoneme.
+
+Except for the phoneme classification, our analysis excludes 'silence' frames by exploiting frame-level phoneme alignments. Then, we re-normalize the remaining attention probability to preserve the probability sum to 1. We observe that these silence frames sometimes consume too much probability mass for both linguistic and phonetic heads, which makes our analysis difficult. Note that this phenomenon of assigning strong attention to ambiguous tokens, such as [CLS] or [SEP], has been also reported in NLP (Kobayashi et al., 2020; Sun & Marasović, 2021). Recently, Kobayashi et al. (2020) introduced the concept of norm-based analysis and reported that those [CLS] and [SEP] does not contribute much to the output even though their attention weight is large. We leave analysis using effective attention as a future work.
+
+# A.4 PHONEME ATTENTION RELATIONSHIP COVERAGE
+
+
+Figure 7: Top-10 phoneme classes (column) for each phoneme (row) in the reference phoneme attention relationship of Figure 5(a).
+
+The coverage ratio $R$ of the target PAR compared to the reference PAR is calculated as below:
+
+$$
+R _ {h} [ p, q ] = \operatorname {M i n i m u m} \left(\frac {\operatorname {P A R} _ {h} [ p , q ]}{\operatorname {P A R} _ {h} ^ {\text {r e f}} [ p , q ]}, 1\right), \quad R _ {h} = \frac {1}{| P |} \sum_ {p \in P} \frac {1}{| Q _ {p} |} \sum_ {q \in Q _ {p}} R _ {h} [ p, q ] \tag {6}
+$$
+
+$P$ indicates every phoneme class and $Q_{p}$ indicates top-10 phoneme classes in the order of the largest PAR elements for the phoneme $p$ $(R_{h}[p,:])$ . Top-10 classes are visualized in Figure 7. We exploit topmost phoneme classes because our interest is at the important relationships.
+
+# A.5 PHONEME CLASSIFICATION
+
+For the phoneme classification, we train a single fully-connected layer as a classifier. We choose the simplest architecture as a classifier to more directly correlate the phoneme accuracy and hidden layer representations. These representations are extracted from dev-clean and dev-other dataset and evaluated on test-clean and test-other dataset. We use SGD with a learning rate of 0.1, momentum of 0.9, and weight decay of 1e-3. The training takes 15 epochs, where the learning rate is multiplied by 0.1 for every 3 epochs. We visualize confusion matrices of the phoneme classification in Figure 8. As layer proceeds, wrongly classified phonemes (non-diagonal) disappear and leave a clear diagonal line on the confusion matrix.
+
+
+(a) Layer 0 $(48.4\%)$
+
+
+(b) Layer 4 $(68.0\%)$
+
+
+Accuracy $(\%)$
+(c) Layer 8 $(75.5\%)$
+
+
+Figure 8: Confusion matrix and phoneme accuracy for selected layers. Visualized the result from the LibriSpeech test-other dataset. Each row and column corresponds to the 37 phoneme classes, including 'silence' as zeroth class.
+
+
+Figure 9: Examples of typical cumulative attention diagonality (CAD). (a) and (b) visualizes curves (before the integral) of four attention heads in each layer. $x$ -axis and $y$ -axis depict the relative distance $r$ and accumulated attention probability, respectively. CAD is represented as the area under curve. CAD values of each head are also listed.
+
+# B ADDITIONAL RESULTS AND DISCUSSIONS
+
+# B.1 DIAGONALITY
+
+# B.1.1 CAD RESULTS
+
+The CAD is a good indicator of how fast the accumulated attention increases over the distance, directly represents the diagonality of the attention weight. The CAD is interpreted as the area under the function $D(r)$ , where $D(r)$ calculates the amount of total attention weight within the restricted range $j \in [i - r(T - 1), i + r(T - 1)]$ . ( $T - 1$ ) is the maximum possible distance between two frames where $T$ is the number of frames.
+
+$$
+\mathrm {C A D} _ {h} = \int_ {r = 0} ^ {1} \frac {1}{T} \sum_ {i = 1} ^ {T} \left(\sum_ {\substack {j = \max (1, \\ i - r (T - 1))}} ^ {\min (T,)} A _ {h} [ i, j ]\right) \mathrm {d} r = \int_ {r = 0} ^ {1} D (r) \mathrm {d} r \tag{7}
+$$
+
+If the $r$ is same, a larger $D(r)$ means that the attention is more concentrated near the diagonal. Please note that $D(r)$ is a monotonically increasing function whose output is always in the range [0, 1].
+
+To help understand the concept of CAD, we visualize two typical examples of the cumulative attention diagonality in Figure 9. For layer 2, where attention heads perform the phonetic localization, CAD values are low. In contrast, for layer 14 that concentrates on linguistic localization, CAD values are much higher.
+
+Figure 10 plots the sorted CAD values. We determined the threshold (0.75) where the curve of sorted CAD values changes from convex to concave. The higher CAD value represents that more probability mass is concentrated near the diagonal in the attention map, while the lower CAD value
+
+
+Figure 10: Sorted CAD over attention heads in the baseline model. Over 64 heads, 42 heads belong to the CAD value under 0.75. The table on the right side indicates the number of linguistic attention heads that are of CAD value under 0.75.
+
+| #Layer | 0 | 1 | 2 | 3 |
| < 0.75 | 4 | 4 | 4 | 4 |
| #Layer | 4 | 5 | 6 | 7 |
| < 0.75 | 4 | 4 | 4 | 4 |
| #Layer | 8 | 9 | 10 | 11 |
| < 0.75 | 4 | 2 | 2 | 0 |
| #Layer | 12 | 13 | 14 | 15 |
| < 0.75 | 1 | 0 | 0 | 1 |
+
+implies that the distribution is more uniformly distributed. We observe that diagonally concentrated heads take a large portion in upper layers.
+
+# B.1.2 PREVIOUS DIAGONALITY ANALYSIS
+
+Previous studies utilized a different metric to calculate the diagonality of an attention map (Zhang et al., 2021b; Yang et al., 2020). In this version of diagonality, the metric is interpreted as the negative normalized average attention distance (span-length). In Yang et al. (2020), the diagonality is calculated as below:
+
+$$
+D _ {h} = 1 - \frac {1}{T ^ {2}} \sum_ {i = 1} ^ {T} \sum_ {j = 1} ^ {T} A _ {h} [ i, j ] \cdot | i - j | \tag {8}
+$$
+
+We introduced the cumulative attention diagonality (CAD) because the previous diagonality metric lacks information about how attention is distributed by distance. In other words, CAD is more comprehensive because it provides the overall diagonality value as well as the tendency of the attention according to the distance. Our CAD metric dearly captures the flat region in lower layers (Figure 2). In contrast, in Zhang et al. (2021b), the diagonality increases from the lower layers to the upper layers, which may not be sufficient observation in ASR.
+
+# B.2 PHONEME ATTENTION RELATIONSHIP
+
+# B.2.1 EXCLUDING CONSECUTIVE FRAMES
+
+We treat $P_{h}[p,q](p \neq q)$ and $P_{h}[p,p]$ differently because we want to separate the effect of the diagonal (position-based) attention map. An attention map that highly focuses on the surroundings (diagonal-like) can unintentionally disturb the purpose of PAR in measuring $P_{h}[p,p]$ , because it will give a high value to $p-p$ relationship not because the contents are similar, but because the location is close. Our purpose on PAR is to examine the phonetic (content-based) behavior, so excluding consecutive frames of the same phoneme class better represents SA in lower layers that correspond to the phonetic localization.
+
+# B.2.2 PAR RESULTS
+
+Figure 11 visualizes how averaged PAR changes through layers. Lower layers (first row in Figure) show noticeable regions that represent the important phoneme relationships, including the diagonal. Note that the diagonal stands out even though we excluded the consecutive same phoneme classes. Each lower layer focuses on different aspects, supporting our analysis on the PAR coverage (Figure 6) that the accumulated coverage ratio continuously increases through layers. In other words, each layer covers a certain part of the reference PAR with less overlap between layers. On the other hand, the upper layers (second row in Figure) do not show the emphasized pattern. This is expected for linguistic localization heads that generate highly diagonal attention maps because their attention is mainly assigned to near frames regardless of their phoneme classes.
+
+For the finer understanding, we also visualize how attention heads compose the averaged PAR. Figure 12 shows that each head corresponds to different phonological properties but their averaged
+
+
+(a) Layer 2
+
+
+
+
+
+
+
+
+(e) Layer 10
+
+
+(b) Layer 4
+(f) Layer 12
+
+
+(c) Layer 6
+(g) Layer 14
+
+
+(d) Layer 8
+(h) Layer 16
+
+
+(Layer 7)
+
+
+Figure 11: Phoneme attention relationships (PAR) in SA layers. Averaged PAR of even-numbered layers (2nd, 4th, ... 16th) are visualized. Lower layers show high correlations between similar phonetic features, but these relationships are weakened in upper layers.
+Head 1
+
+
+Head 2
+
+
+Head 3
+Figure 12: Phoneme attention relationships of self-attention heads. Each head see different aspects, enriching the overall information the layer captures.
+
+
+Head 4
+
+interests mimic the reference PAR. This emphasizes the importance of multiple attention heads in phonetic localization; each head specializes in capturing the specific phoneme relationship and contributes differently.
+
+# B.2.3 PREVIOUS PHONEMERELATIONSHIPANALYSIS
+
+The idea of phoneme relationship analysis is first introduced in Yang et al. (2020) as phoneme relation map (PRM), but our PAR is different from PRM in two ways. First and the most difference is that PRM do not distinguish consecutive frames and discontinuous frames that corresponds to the same phoneme class. Therefore, attention heads that only focus on neighbors would also present heavy self-to-self phoneme relationship in PRM, which hinders the clarity of the analysis. Second, PRM do not apply correction according to the sequence length. We multiply $T$ to reduce the effect of sequence length, inspired by the fact that the expectation of (averaged) probability is potentially smaller for longer sequences.
+
+
+(a) $2 \times 8$
+
+
+(b) $4 \times 4$
+Figure 13: Phoneme attention relationship (PAR) for three attention map reuse configurations $(2 \times 8, 4 \times 4, 8 \times 2)$ . PAR(a)(b)(c) are obtained by averaging PAR of lower layers. Key missing relationship is highlighted in white circles, such as (B, P), (G, K), and (DH, TH) in Figure 5(a).
+
+
+(c) $8 \times 2$
+
+# B.3 ATTENTION MAP REUSE AND PAR
+
+For the understanding of the performance loss for extreme reuse cases, we visualize the PAR of different configurations in Figure 13. We observe that most of the patterns resemble the baseline model, which implies that heads learn similar roles during training. However, for $8 \times 2$ , several information is lost; diagonal became unclear and highlighted correlations disappeared.
+
+# B.4 COMPARISON TO MASKED ATTENTION
+
+We compare the masked attention (Zhang et al., 2020a; Tripathi et al., 2020; Audhkhasi et al., 2021; Huang et al., 2020) with the proposed attention map reuse. Masked attention, similar to block-based attention (Shen et al., 2018; Qiu et al., 2020), is a method to reduce the computational burden of self-attention by restricting the length of the accessible context. If masked attention is adopted for ASR, each frame only attends to local neighbors; $L$ frames to the left and $R$ frames to the right, denoted as $[-L,R]$ .
+
+Table 6: Comparison of the word error rate between the proposed attention reuse and the masked attention. “-” indicates that the attention range is not restricted (unlimited).
+
+| Model | Lower layers | Upper layers | dev-clean | dev-other | test-clean | test-other |
| Baseline | - | - | 3.1 | 8.3 | 3.2 | 8.4 |
| Low64 | [-64, 64] | - | 3.1 | 8.4 | 3.4 | 8.5 |
| Up64 | - | [-64, 64] | 3.1 | 8.2 | 3.3 | 8.2 |
| 4(H8) × 4 | - | - | 3.1 | 8.1 | 3.2 | 8.1 |
+
+We train the models with the same setting as the Conformer-M baseline (as in Table 2) but with a limited attention range for either lower or upper layers. Among the 16 layers in the baseline, lower and upper layers consist of 8 layers each and correspond to phonetic localization and linguistic localization, respectively. For selected layers, we restrict each frame to only attend to near neighbors within the distance of 64 frames. Table 6 shows the performance on the LibriSpeech dataset.
+
+For lower layers, attention range restriction causes a clear degradation of the recognition accuracy. We consider that phonetic localization in lower layers demands a wide range of attention. On the other hand, for upper layers, attention range restriction shows almost comparable performance to the baseline, and even better in some subsets. We hypothesize that the upper layers for CTC-based ASR may not require a very wide context, because their attention pattern is highly diagonal. In addition, the restriction-based computational savings seems to be no larger than the proposed attention reuse. A context range of 128 (64+64) frames corresponds to about 5.1 seconds, where the average utterance length of the corpora is about 7.4 seconds. Therefore, we expect approximately $30\%$ reduction in attention calculation when masked attention is applied to every layer. Our attention reuse $(4 \times 4)$ reduces about $75\%$ of the attention computation without any degradation in the performance.
\ No newline at end of file
diff --git a/understandingtheroleofselfattentionforefficientspeechrecognition/images.zip b/understandingtheroleofselfattentionforefficientspeechrecognition/images.zip
new file mode 100644
index 0000000000000000000000000000000000000000..4d9c73db20b97348b354edb5c3a52cc800eb9cb5
--- /dev/null
+++ b/understandingtheroleofselfattentionforefficientspeechrecognition/images.zip
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4811423ee8c20c7932c446a79ffa5efd6ceb9485a4139363c2540e49db0a278f
+size 885128
diff --git a/understandingtheroleofselfattentionforefficientspeechrecognition/layout.json b/understandingtheroleofselfattentionforefficientspeechrecognition/layout.json
new file mode 100644
index 0000000000000000000000000000000000000000..2802cd2988cc377dd7cd9e0b964bbc9c710737f9
--- /dev/null
+++ b/understandingtheroleofselfattentionforefficientspeechrecognition/layout.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d1af7190219c1e39b581cbae76761047b9b01e570976bf92be3698a41673f350
+size 571100
diff --git a/unifyinglikelihoodfreeinferencewithblackboxoptimizationandbeyond/233cc708-146f-4dc3-9d0a-3b19ec3ef5ab_content_list.json b/unifyinglikelihoodfreeinferencewithblackboxoptimizationandbeyond/233cc708-146f-4dc3-9d0a-3b19ec3ef5ab_content_list.json
new file mode 100644
index 0000000000000000000000000000000000000000..8feb20c9ad148528975d969a7e0aecfa6c4f5083
--- /dev/null
+++ b/unifyinglikelihoodfreeinferencewithblackboxoptimizationandbeyond/233cc708-146f-4dc3-9d0a-3b19ec3ef5ab_content_list.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e957a5dbccd8e0b563c165fad528ae36d43312b722e3bd9e209f199b4e68e5cf
+size 127732
diff --git a/unifyinglikelihoodfreeinferencewithblackboxoptimizationandbeyond/233cc708-146f-4dc3-9d0a-3b19ec3ef5ab_model.json b/unifyinglikelihoodfreeinferencewithblackboxoptimizationandbeyond/233cc708-146f-4dc3-9d0a-3b19ec3ef5ab_model.json
new file mode 100644
index 0000000000000000000000000000000000000000..54aef81ca3f33d62deb221b82881fad1344680dd
--- /dev/null
+++ b/unifyinglikelihoodfreeinferencewithblackboxoptimizationandbeyond/233cc708-146f-4dc3-9d0a-3b19ec3ef5ab_model.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:1654f0441debfe953740e5a36230ab5799b1f73a68bc0bac77fea5ace552e64d
+size 153675
diff --git a/unifyinglikelihoodfreeinferencewithblackboxoptimizationandbeyond/233cc708-146f-4dc3-9d0a-3b19ec3ef5ab_origin.pdf b/unifyinglikelihoodfreeinferencewithblackboxoptimizationandbeyond/233cc708-146f-4dc3-9d0a-3b19ec3ef5ab_origin.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..ecd8218ac1a032f3f053353c5ab5d05e1d03cb84
--- /dev/null
+++ b/unifyinglikelihoodfreeinferencewithblackboxoptimizationandbeyond/233cc708-146f-4dc3-9d0a-3b19ec3ef5ab_origin.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:42091c03a64758daa4ac4381290d4c94e668452f1fdb4216154cdfe1b8874787
+size 504899
diff --git a/unifyinglikelihoodfreeinferencewithblackboxoptimizationandbeyond/full.md b/unifyinglikelihoodfreeinferencewithblackboxoptimizationandbeyond/full.md
new file mode 100644
index 0000000000000000000000000000000000000000..ce0f3290e60a66a887a58cafe6bb5b8c0096e350
--- /dev/null
+++ b/unifyinglikelihoodfreeinferencewithblackboxoptimizationandbeyond/full.md
@@ -0,0 +1,490 @@
+# UNIFYING LIKELIHOOD-FREE INFERENCE WITH BLACK-BOX OPTIMIZATION AND BEYOND
+
+Dinghuai Zhang $^{1,2}$ , Jie Fu $^{1,2*}$ , Yoshua Bengio $^{1,2,3}$ , Aaron Courville $^{1,2,3}$
+
+1Mila, 2University of Montreal, 3CIFAR Fellow
+
+Montreal, Canada
+
+{dinghuai.zhang, fujie}@mila.quebec
+
+# ABSTRACT
+
+Black-box optimization formulations for biological sequence design have drawn recent attention due to their promising potential impact on the pharmaceutical industry. In this work, we propose to unify two seemingly distinct worlds: likelihood-free inference and black-box optimization, under one probabilistic framework. In tandem, we provide a recipe for constructing various sequence design methods based on this framework. We show how previous optimization approaches can be "reinvented" in our framework, and further propose new probabilistic black-box optimization algorithms. Extensive experiments on sequence design application illustrate the benefits of the proposed methodology.
+
+# 1 INTRODUCTION
+
+Discovering new drugs to fulfill specific criteria, such as binding affinity towards a given molecular target, is a fundamental problem in chemistry and the pharmaceutical industry (Hughes et al., 2011). In this work, we focus on an important subdomain: de novo biological sequence design. This task is challenging for two reasons: (1) the exploration space for sequences is combinatorially large; and (2) sequence usefulness is evaluated via a complicated process which usually involves time-consuming and expensive wet-lab experiments.
+
+Despite the difficulty of this task, many approaches have been developed over the past few decades thanks to recent advances in biochemistry and machine learning. The Nobel Prize wining paradigm, directed evolution (Chen & Arnold, 1991), which conducts local evolutionary search under human guidance, is one of the popular techniques. Unfortunately, it is limited by its sample inefficiency and reliance on strong prior knowledge, e.g., about where to mutate (Ahn et al., 2020). Furthermore, to compete with other machine learning methods (Gottipati et al., 2020), guided evolution (Yoshikawa et al., 2018; Jensen, 2019; Nigam et al., 2019) heavily relies on human intuition for designing domain-specific evolutionary operators, which may not always apply to tasks at hand.
+
+In this work, we deem sequence design to be a black-box optimization problem, tasked with maximizing an unknown oracle function. We assume that oracle queries are limited due to the constraint on resources, such as the budgets for evaluating queries in a wet-lab. Thus, sample efficiency is crucial. We develop a probabilistic framework by reformulating the aforementioned black-box optimization target as a posterior modeling problem. With this framework, we draw a surprising connection between likelihood-free inference and sequence design, and thus linking two fields which are previously considered as unrelated. The key observation we leverage here for establishing this connection is that both settings share similar elements and targets which will be elaborated in Section 2.2. This connection facilitates our understanding of both fields and provides a recipe for developing sequence design algorithms. Going beyond, we also combine different probabilistic modeling insights and develop three novel composite probabilistic algorithms. We point out that our framework could actually be applied to any black-box optimization settings, but in this work we focus on its application to biological sequence design.
+
+To demonstrate the empirical effectiveness of our methods, we conduct systematical experiments to evaluate their performance on four in-silico sequence design benchmarks. Our proposed meth-
+
+ods achieve at least comparable results to existing baselines, and the proposed composite methods behave consistently better than all other ones across various sequence design tasks.
+
+We summarize our contribution as follows:
+
+- We develop a probabilistic framework that unifies likelihood-free inference and black-box optimization.
+- Based on this framework, we provide a recipe for designing algorithms for black-box problems. We apply these ideas to propose a series of composite design algorithms.
+- We perform systematical evaluation on a series of black-box sequence design benchmarks, and find that these algorithms achieve consistently comparable or better results compared to previous ones, thus illustrating the benefit of the proposed unified framework.
+
+# 2 A UNIFYING PROBABILISTIC FRAMEWORK
+
+# 2.1 BACKGROUND
+
+Likelihood-free inference (LFI). We use $\theta \in \Theta$ and $\mathbf{x} \in \mathcal{X}$ to separately denote the parameters and the data generated via the mechanism $\mathbf{x} \sim p(\mathbf{x}|\boldsymbol{\theta})$ . In this scenario, LFI refers to a special kind of Bayesian inference setting where the likelihood function is not tractable but sampling (by simulation) from the likelihood is feasible. Consider the objective of modeling the Bayesian posterior when we cannot compute the likelihood $p(\mathbf{x}_o|\boldsymbol{\theta})$ :
+
+$$
+p (\boldsymbol {\theta} | \mathbf {x} _ {o}) \propto p (\boldsymbol {\theta}) \underbrace {p (\mathbf {x} _ {o} | \boldsymbol {\theta})} _ {?}, \tag {1}
+$$
+
+where $\mathbf{x}_o$ is the observed data, $p(\boldsymbol{\theta})$ is the (given) prior over the model parameters $\boldsymbol{\theta}$ , $p(\mathbf{x}|\boldsymbol{\theta})$ is the intractable likelihood function and $p(\boldsymbol{\theta}|\mathbf{x})$ is the desired posterior over $\boldsymbol{\theta}$ . While we do not have access to the exact likelihood, we can still simulate (sample) data $\mathbf{x}$ from the model simulator: $\mathbf{x} \sim p(\mathbf{x}|\boldsymbol{\theta})$ . Instead of trying to obtain a numerical value of the generic posterior $p(\boldsymbol{\theta}|\mathbf{x})$ for arbitrary $\mathbf{x}$ , LFI only tries to obtain an approximation of $p(\boldsymbol{\theta}|\mathbf{x}_o)$ for the given $\mathbf{x}_o$ . During the inference process, we can take advantage of the sampled data: $\mathcal{D} = \{(\boldsymbol{\theta}_i, \mathbf{x}_i)\}_{i=1}^n$ where $\mathbf{x}_i \sim p(\mathbf{x}|\boldsymbol{\theta}_i)$ for selected values of $\boldsymbol{\theta}_i$ .
+
+Biological black-box sequence design. We consider biological sequence design as a black-box optimization problem:
+
+$$
+\mathbf{m}^{*} = \operatorname *{arg max}_{\mathbf{m}\in \mathcal{M}}f(\mathbf{m}),
+$$
+
+where $f(\cdot)$ is the oracle score function, and we would like to discover values of $\mathbf{m}$ for which $f(\mathbf{m})$ is large. In real-world situations, a query of this oracle $f$ could represent a series of wet-lab experiments to measure specific chemical properties or specificity for a given binding site target. In general, these experiments are time- and cost-consuming. As a result, the total number of queries is limited.
+
+In our setting, we use $\mathcal{M} = \mathcal{V}^L$ to denote the search space for sequences with fixed length $L$ , where $\mathcal{V}$ is the vocabulary for each entry of the sequence: for DNA nucleotides $|\mathcal{V}| = 4$ , and for protein amino acids $|\mathcal{V}| = 20$ . For variable length setting, we have $\mathcal{M} = \cup_{L \in [L_{\min}, L_{\max}]} \mathcal{V}^L$ , where $L_{\min}$ and $L_{\max}$ are the minimal and maximal length, respectively.
+
+# 2.2 CONNECTING LFI AND BLACK-BOX OPTIMIZATION
+
+In order to draw a connection to LFI, we require a probabilistic formulation of the black-box sequence design problem. To this end, we relax the goal of searching for a single maximum of the oracle / score function $f$ to a posterior modeling problem, i.e., finding a representative sample of the configurations of $\mathbf{m}$ sampled with probability related to some target posterior. Think of $\mathcal{C}$ is the set of sequences with these desirable configurations, $\mathcal{E}$ is a Boolean event about whether a sequence $\mathbf{m}$ belongs to $\mathcal{C}$ , and our goal is to characterize the posterior distribution $p(\mathbf{m}|\mathcal{E})$ from which we obtain the desired sequences. Below, we consider two specific ways of doing this:
+
+Example A. We explicitly define $\mathcal{C}$ (and $\mathcal{E}$ accordingly) as all the sequences whose scores are larger than a given threshold $s$ :
+
+$$
+\mathcal {C} = \left\{\mathbf {m} \mid f (\mathbf {m}) \geq s \right\}. \tag {2}
+$$
+
+Here $s$ could be any fixed value, or a certain quantile of a particular score distribution. In this way, we have $p(\mathcal{E}|\mathbf{m}) = p(\mathbf{m}\in \mathcal{C}|\mathbf{m}) = \mathbb{1}\{f(\mathbf{m})\geq s\}$ where $\mathbb{1}\{\}$ is the indicator function.
+
+Example B. In a softer version of $\mathcal{E}$ and $\mathcal{C}$ , we can define its conditional probability of being true to follow a Boltzmann distribution:
+
+$$
+p (\mathcal {E} | \mathbf {m}) = p (\mathbf {m} \in \mathcal {C} | \mathbf {m}) \propto \exp (f (\mathbf {m}) / \tau). \tag {3}
+$$
+
+where $\tau$ is a temperature parameter. We introduce the exponential because $f(\cdot)$ does not necessarily take positive values. Any monotone transformation of $f(\cdot)$ to non-negative reals could be used, so that sequences with larger oracle scores have a greater probability of making $\mathcal{E}$ true.
+
+With this posterior objective, our goal now becomes effectively modeling and sampling from the posterior $p(\mathbf{m}|\mathcal{E})$ . It is thus natural to resort to the tools of Bayesian inference for this task. In order to examine this possibility, we draw a detailed comparison between the settings of black-box sequence design problem and likelihood-free Bayesian inference in Table 1.
+
+ | Likelihood-free inference | Black-box optimization |
| Element | (θ, x) | (m, s) |
| Target | p(θ|x_o) | p(m|ε) |
| Constraint | limited simulation: x ~ p(x|θ) | limited query: s ~ f(m) |
| intractable likelihood: p(x|θ) | black-box oracle: f(m) |
+
+Table 1: Correspondence between likelihood-free inference and black-box optimization.
+
+It can be observed that both tasks share similar elements and targets. The two settings also share similar limitations on the allowed queries, which are too time-consuming and / or cost-intensive. Notice that in sequence design, the oracle could be either exact or noisy, thus we use the more general $s \sim f(\mathbf{m})$ formulation rather than $s = f(\mathbf{m})$ . We will further present several concrete examples as demonstrations of this correspondence in the following section.
+
+Another way to understand this correspondence is to consider the following mapping $T$ :
+
+$$
+\begin{array}{l} T: \Theta \times \mathcal {X} \to \mathcal {M} \times \mathbb {R} \\ (\boldsymbol {\theta}, \mathbf {x}) \mapsto (\mathbf {m}, s), \quad \text {s . t .} \quad s = - \| \mathbf {x} - \mathbf {x} _ {o} \| . \\ \end{array}
+$$
+
+Here we can see the score value $s$ as a quantitative metric for how close the generated data $\mathbf{x}$ (given $\theta$ ) is to the target observed data $\mathbf{x}_o$ . In addition, querying the oracle in the sequence design setting can also be thought of as follows: (1) sample $\mathbf{x} \sim p(\cdot | \boldsymbol{\theta})$ and then (2) calculate $s = -\| \mathbf{x} - \mathbf{x}_o \|$ under some distance $\| \cdot \|$ . In this manner, $T$ could conceptually transform any LFI problem into a black-box optimization task. In this work, we only focus on the application of sequence design.
+
+# 3 METHODOLOGY
+
+We provide a recipe for designing new sequence design algorithms based on the correspondence in Section 2.2. The recipe induces different approaches by modeling different probabilistic components of the Bayesian inference problem. We begin with common algorithm restrictions under this setting.
+
+Common constraint for algorithms. Due to the restriction of simulation / query in our setting, we constrain our algorithms to act in a sequential / iterative way, gradually achieving the desired posterior round by round. Every algorithm starts with an empty dataset $\mathcal{D} = \varnothing$ and an initial proposal $p_1(\cdot) = p(\cdot)$ , where $p(\cdot)$ is the prior given by the task. In the $r$ -th round of this multi-round setting, the algorithm would use the proposal $p_r(\cdot)$ of this round to sample a batch of data $(\theta / \mathbf{m})$ for simulation / query, and augment the current dataset $\mathcal{D}$ with the newly obtained batch of data. We use $n$ to denote the batch size for each round's simulation / query. Afterwards, the algorithm updates
+
+the proposal to $p_{r + 1}(\cdot)$ . The outcomes for the two settings we discuss may be slightly different: an algorithm for likelihood-free inference would return the posterior, while a sequence design method would return the dataset of all the sequences it has queried, which hopefully contains desired high scored sequences. On the other hand, a sequence design method could produce as an intermediate result a generative model for sampling queries, which then completely fits with the LFI framework.
+
+# 3.1 BACKWARD MODELING OF THE MECHANISM
+
+Approximate Bayesian Computation (ABC) (Beaumont et al., 2002) is a standard method for tackling LFI problems. In Algorithm 1, we display one of the most popular variants: Sequential Monte Carlo-Approximate Bayesian Computation (SMC-ABC) (Beaumont et al., 2009). In each round, parameters $\theta$ are sampled from the current proposal distribution $p_r(\theta)$ for simulation. A rejection step is then involved to remove the $\theta_i$ whose simulation outcomes $\mathbf{x}_i$ cannot reproduce the observed data $\mathbf{x}_o$ with sufficient accuracy. The remaining accepted $\{\theta_i\}_i$ are adopted to update the next round's proposal $p_{r + 1}(\cdot)$ towards the target posterior, i.e., by refitting $q_{\phi}$ with the modified data. We defer more details of this approach to Section A.1 in Appendix.
+
+Algorithm 1 SMC-ABC
+$p_1(\pmb {\theta})\gets p(\pmb {\theta})$
+for $r$ in 1 to $R$ do repeat sample $\pmb {\theta}_i\sim p_r(\pmb {\theta})$ simulate $\mathbf{x}_i\sim p(\mathbf{x}|\pmb {\theta}_i)$ until $n$ samples are obtained $\mathcal{D}\leftarrow \mathcal{D}\cup \{(\pmb {\theta}_i,\mathbf{x}_i)\}_{i = 1}^n$ sort $\mathcal{D}$ according to $-\| \mathbf{x}_i - \mathbf{x}_o\|$ fit $q_{\phi}(\pmb {\theta})$ with top $\{\pmb {\theta}_i\} _i$ in $\mathcal{D}$ $p_{r + 1}(\pmb {\theta})\gets q_{\phi}(\pmb {\theta})$
+end for
+return $\hat{p} (\pmb {\theta}|\mathbf{x}_o) = p_{R + 1}(\pmb {\theta})$
+
+Algorithm 2 FB-VAE
+$p_1(\mathbf{m})\gets p(\mathbf{m})$
+for $r$ in 1 to $R$ do repeat sample $\mathbf{m}_i\sim p_r(\mathbf{m})$ query the oracle: $s_i\gets f(\mathbf{m}_i)$ until $n$ samples are obtained $\mathcal{D}\gets \mathcal{D}\cup \{( \mathbf { m } _ { i } , s _ { i } ) \} _ { i = 1 } ^ { n }$ sort $\mathcal{D}$ according to $s_i$ fit $q_{\phi}(\mathbf{m})$ with top $\{\mathbf{m}_i\}_{i}$ in $\mathcal{D}$ $p_{r + 1}(\mathbf{m})\leftarrow q_{\phi}(\mathbf{m})$ end for return $\{\mathbf{m}:(\mathbf{m},s)\in \mathcal{D}\}$
+
+It would then be natural to construct an analogical sequence design algorithm using top scored entities $\{\mathbf{m}_i\}_i$ to guide the update of a certain sequence distribution, see Algorithm 2. Interestingly, this is the proposed sequence design algorithm in Gupta & Zou (2019), where the authors name this kind of updating "feedback" because training of the parametric generator $q_{\phi}(\mathbf{m})$ exploits feedback signals from the oracle. In this paper, we follow Brookes & Listgarten (2018) to crystallize $q_{\phi}(\mathbf{m})$ to be a variational autoencoder (Kingma & Welling, 2014), and use the term Feedback-Variational AutoEncoder (FB-VAE) to refer to Algorithm 2. We place Algorithm 1 & 2 side-by-side to highlight their correspondence. We also make the same arrangement for the following Algorithm 3 & 4, Algorithm 5 & 6 and Algorithm 7 & 8.
+
+Algorithm 3 Sequential Neural Posterior
+$p_1(\pmb {\theta})\gets p(\pmb {\theta})$
+for $r$ in 1 to $R$ do repeat sample $\pmb {\theta}_i\sim p_r(\pmb {\theta})$ simulate $\mathbf{x}_i\sim p(\mathbf{x}|\pmb {\theta}_i)$ until $n$ samples are obtained $\mathcal{D}\gets \mathcal{D}\cup \{(\pmb {\theta}_i,\mathbf{x}_i)\}_{i = 1}^n$ $q_{\phi}\gets \arg \min_{q}\mathbb{E}_{\mathbf{x}}[D_{\mathrm{KL}}(p(\pmb {\theta}|\mathbf{x})||q)];$ $p_{r + 1}(\pmb {\theta})\gets q_{\phi}(\pmb {\theta}|\mathbf{x}_o);$
+end for
+return $\hat{p} (\pmb {\theta}|\mathbf{x}_o) = p_{R + 1}(\pmb {\theta})$
+
+Algorithm 4 Design by Adaptive Sampling
+$p_1(\mathbf{m})\gets p(\mathbf{m})$
+for $r$ in 1 to $R$ do repeat sample $\mathbf{m}_i\sim p_r(\mathbf{m})$ query the oracle: $s_i\gets f(\mathbf{m}_i)$ until $n$ samples are obtained $\mathcal{D}\gets \mathcal{D}\cup \{( \mathbf { m } _ { i } , s _ { i } ) \} _ { i = 1 } ^ { n }$ $q_{\phi}\leftarrow \arg \min_{q}D_{\mathrm{KL}}(p(\mathbf{m}|\mathcal{E})||q);\right.$ $p_{r + 1}(\mathbf{m})\gets q_{\phi}(\mathbf{m});$
+end for
+return $\{\mathbf{m}:(\mathbf{m},s)\in \mathcal{D}\}$
+
+In comparison with SMC-ABC, the Sequential Neural Posterior (SNP) method (Papamakarios & Murray, 2016; Lueckmann et al., 2017; Greenberg et al., 2019) for likelihood-free inference adopts a more flexible approach, taking the power of conditional neural density estimator (e.g., Papamakarios et al. (2017)) to model the general posterior $p(\pmb{\theta}|\mathbf{x})$ , which takes arbitrary $\pmb{\theta}$ and $\mathbf{x}$ as two inputs and outputs a distribution. This neural estimator is trained via approximately minimizing the
+
+Kullback-Leibler (KL) divergence between $q_{\phi}(\pmb{\theta}|\mathbf{x})$ and the true posterior $p(\pmb{\theta}|\mathbf{x})$ . We defer more training details to Section A.1 in Appendix. Under the connection viewpoint, one similar algorithm for sequence design is the Design by Adaptive Sampling (DbAS) proposed in Brookes & Listgarten (2018) which is characterized in Algorithm 4, fitting $q_{\phi}(\mathbf{m})$ through minimizing the KL divergence with the posterior $p(\mathbf{m}|\mathcal{E})$ . Based on the difference in specific implementations, both algorithms have more than one variant, whose details are deferred to Section A.1 in Appendix.
+
+We refer to the above algorithms as "backward modeling" because the trained generative network $q_{\phi}$ (going from $\mathbf{x} / \mathcal{E}$ to $\theta / \mathbf{m}$ ) is a sort of reverse model of the simulation mechanism (which goes from $\theta / \mathbf{m}$ to $\mathbf{x} / s$ ).
+
+# 3.2 FORWARD MODELING OF THE MECHANISM
+
+Whereas the above methods focus on directly modeling the target posterior with a generative model that learns a "reverse mechanism" of the simulation process, it is also possible to model the "forward mechanism", which is consistent with the simulation process. Papamakarios et al. (2019) claim that the forward modeling approach may be an easier task than its backward counterpart, as unbiased estimation of the likelihood does not depend on the choice of proposal. Consequently, in contrast to SNP, Papamakarios et al. (2019) chooses to train a neural density estimator to model the conditional likelihood distribution $q_{\phi}(\mathbf{x}|\boldsymbol{\theta})$ sequentially in each round. The training is achieved by maximizing the total log likelihood $\max_q\sum_i\log q_\phi (\mathbf{x}_i|\boldsymbol {\theta}_i)$ with data samples from the dataset $\mathcal{D}$ at the current $(r$ -th) round. The downside of this forward approach is an additional computational Markov Chain Monte Carlo (MCMC) step is needed to sample from the $r$ -th round posterior / proposal $p_r(\boldsymbol{\theta})$ . The resulting approach, which is coined (Papamakarios et al., 2019) the Sequential Neural Likelihood (SNL), is summarized in Algorithm 5.
+
+In the spirit of directly modeling the forward mechanism of sequence design, we train a regressor $\hat{f}_{\phi}(\mathbf{m})$ in a supervised manner to fit the oracle scorer. In order to adapt this regressor into the update procedure of the proposal of the next round, we use $\tilde{q} (\mathbf{m})$ to denote the unknown posterior $p(\mathbf{m}|\mathcal{E})$ with knowledge of $\hat{f}_{\phi}(\mathbf{m})$ and prior $p(\mathbf{m})$ . The specific construction of $\tilde{q} (\mathbf{m})$ depends on the choice of $\mathcal{E}$ . For instance, if we choose Example B in Section 2.2 to be the definition of $\mathcal{E}$ , then $\tilde{q} (\mathbf{m})$ is the distribution with (unnormized) probability $p(\mathbf{m})\cdot \exp (\hat{f}_{\phi}(\mathbf{m}) / \tau)$ . See Section A.2 in Appendix for more elaboration about this point. We then choose the update procedure of the proposal $p_{r + 1}(\mathbf{m})$ to be analogical to that of SNL. We name this proposed algorithm to be Iterative Scoring (IS) to avoid confusion with likelihood-free inference algorithms. Furthermore, depending on different definition of $\mathcal{E}$ , we use the name "IS-A" and "IS-B" for them in the following sections.
+
+Algorithm 5 Sequential Neural Likelihood
+$p_1(\theta)\gets p(\theta);$
+for $r$ in 1 to $R$ do repeat sample $\pmb {\theta}_i\sim p_r(\pmb {\theta})$ simulate $\mathbf{x}_i\sim p(\mathbf{x}|\pmb {\theta}_i)$ until $n$ samples are obtained $\mathcal{D}\gets \mathcal{D}\cup \{(\pmb {\theta}_i,\mathbf{x}_i)\}_{i = 1}^n$ fit $q_{\phi}(\mathbf{x}|\pmb {\theta})$ with $\mathcal{D}$ .. $p_{r + 1}(\pmb {\theta})\propto p(\pmb {\theta})\cdot q_{\phi}(\mathbf{x}_o|\pmb {\theta})$ end for return $\hat{p} (\pmb {\theta}|\mathbf{x}_o) = p_{R + 1}(\pmb {\theta})$
+
+Algorithm 6 Iterative Scoring
+$p_1(\mathbf{m})\gets p(\mathbf{m})$
+for $r$ in 1 to $R$ do repeat sample $\mathbf{m}_i\sim p_r(\mathbf{m})$ query the oracle: $s_i\gets f(\mathbf{m}_i)$ until $n$ samples are obtained $\mathcal{D}\leftarrow \mathcal{D}\cup \{(\mathbf{m}_i,s_i)\}_{i = 1}^n$ fit $\hat{f}_{\phi}(\mathbf{m})$ with $\mathcal{D}$ construct $\tilde{q} (\mathbf{m})$ with $\hat{f}_{\phi}(\cdot)$ and $p(\mathbf{m})$ $p_{r + 1}(\mathbf{m})\gets \tilde{q} (\mathbf{m})$
+end for
+return $\{\mathbf{m}:(\mathbf{m},s)\in \mathcal{D}\}$
+
+# 3.3 MODELING A PROBABILITY RATIO
+
+In this subsection, we discuss yet another approach, through the estimation of a probability ratio. Gutmann & Hyvarinen (2010) proposes noise contrastive estimation as a statistical inference approach. This methodology turns a hard probability modeling problem into binary classification, which is considered easier to learn. In contrast to the aforementioned likelihood-free inference methods which rely on a form of density estimation to perform the task, Sequential Neural Ratio
+
+(SNR) (Hermans et al., 2019) takes a similar approach as noise contrastive estimation. SNR adopts a classification approach to estimate the likelihood-to-evidence ratio $r(\pmb{\theta}, \mathbf{x}) = p(\pmb{\theta}|\mathbf{x}) / p(\pmb{\theta})$ . SNR is summarized in Algorithm 7. Specifically, in each round, SNR fits a binary classifier $d_{\phi}(\pmb{\theta}, \mathbf{x}) \in [0,1]$ in the following manner:
+
+$$
+\arg \min _ {d} \left\{\sum_ {\left(\boldsymbol {\theta} _ {i}, \mathbf {x} _ {i}\right) \in \mathcal {D}} \left[ - \log d \left(\mathbf {x} _ {i}, \boldsymbol {\theta} _ {i}\right) \right] + \sum_ {\left(\boldsymbol {\theta} _ {i} ^ {\prime}, \mathbf {x} _ {i}\right) \in \mathcal {D} ^ {\prime}} \left[ - \log \left(1 - d \left(\mathbf {x} _ {i}, \boldsymbol {\theta} _ {i} ^ {\prime}\right)\right) \right] \right\}. \tag {4}
+$$
+
+We show that with the $\mathcal{D}$ and $\mathcal{D}'$ established in Algorithm 7, we have
+
+$$
+d ^ {*} (\pmb {\theta}, \mathbf {x}) = \frac {p (\pmb {\theta} | \mathbf {x})}{p (\pmb {\theta}) + p (\pmb {\theta} | \mathbf {x})}, r ^ {*} (\pmb {\theta}, \mathbf {x}) := \frac {d ^ {*} (\pmb {\theta} , \mathbf {x})}{1 - d ^ {*} (\pmb {\theta} , \mathbf {x})} = \frac {p (\pmb {\theta} | \mathbf {x})}{p (\pmb {\theta})}
+$$
+
+where the $*$ denotes the optimality. We have the following Proposition 1:
+
+Proposition 1. Let $p_0(\mathbf{a})$ and $p_1(\mathbf{a})$ be two distributions for $d_a$ -dimension random variable $\mathbf{a}$ which takes value in the space of $\mathcal{A} = \mathbb{R}^{d_a}$ , and $d(\mathbf{a}) : \mathcal{A} \to [0,1]$ is a real-value function mapping any $\mathbf{a}$ to a positive real value number. Then the functional optimization problem
+
+$$
+\operatorname * {a r g m a x} _ {d: \mathcal {A} \to [ 0, 1 ]} \left\{\mathbb {E} _ {\mathbf {a} \sim p _ {0} (\mathbf {a})} [ \log d (\mathbf {a}) ] + \mathbb {E} _ {\mathbf {a} \sim p _ {1} (\mathbf {a})} [ \log (1 - d (\mathbf {a})) ] \right\}.
+$$
+
+will lead to the optimal solution $d^{*}(\mathbf{a}) = \frac{p_{0}(\mathbf{a})}{p_{0}(\mathbf{a}) + p_{1}(\mathbf{a})}$ .
+
+See the proof in Section A.3 in Appendix. After training $d$ , SNR can obtain the posterior density value by $p(\boldsymbol{\theta}|\mathbf{x}) = r^{*}(\boldsymbol{\theta},\mathbf{x})p(\boldsymbol{\theta})$ . SNR mirrors SNL in that it samples the new proposal $p_{r + 1}(\boldsymbol{\theta})$ without explicitly modeling the posterior.
+
+On the other hand, we propose a sequence design algorithm analogous to SNR and named Iterative Ratio (IR), which estimates the probability ratio $r(\mathbf{m}) = p(\mathbf{m}|\mathcal{E}) / p(\mathbf{m})$ for the purpose of posterior sampling. IR first builds two datasets $\mathcal{D}$ and $\mathcal{D}'$ , corresponding to two different distributions $p(\mathbf{m}|\mathcal{E})$ and $p(\mathbf{m})$ . We take a similar binary classification approach, whose training objective is $\min_d\left\{\sum_{\mathbf{m}\in \mathcal{D}}[-\log d(\mathbf{m})] + \sum_{\mathbf{m}\in \mathcal{D}'}[-\log (1 - d(\mathbf{m}))]\right\}$ . The desired ratio is then obtained by $r(\mathbf{m}) := d(\mathbf{m}) / (1 - d(\mathbf{m}))$ . Other components of IR follow the scheme of IS, and IR is schematized in Algorithm 8. We point out that IR does not have two variants as IS does, as the definition for $\mathcal{E}$ in Example B is not usable because of the unknown normalizing constant for probability $p(\mathcal{E}|\mathbf{m})$ . See Section A.3 in Appendix for more explanation.
+
+Algorithm 7 Sequential Neural Ratio
+ $p_1(\boldsymbol{\theta}) \gets p(\boldsymbol{\theta})$ ;
+for $r$ in 1 to $R$ do
+repeat
+ sample $\boldsymbol{\theta}_i, \boldsymbol{\theta}_i' \sim p_r(\boldsymbol{\theta})$ ;
+ simulate $\mathbf{x}_i \sim p(\mathbf{x}|\boldsymbol{\theta}_i)$ ;
+until $n$ samples are obtained
+ $\mathcal{D} \gets \mathcal{D} \cup \{(\boldsymbol{\theta}_i, \mathbf{x}_i)\}_{i=1}^n$ $\mathcal{D}' \gets \mathcal{D}' \cup \{(\boldsymbol{\theta}_i', \mathbf{x}_i)\}_{i=1}^n$
+train $d_{\phi}(\boldsymbol{\theta}, \mathbf{x})$ classifying between $\mathcal{D}$ and $\mathcal{D}'$ with the loss in Eq. 4;
+ $r_{\phi}(\boldsymbol{\theta}, \mathbf{x}) \gets \frac{d_{\phi}(\boldsymbol{\theta}, \mathbf{x})}{1 - d_{\phi}(\boldsymbol{\theta}, \mathbf{x})}$ ;
+ $p_{r+1}(\boldsymbol{\theta}) \propto r_{\phi}(\boldsymbol{\theta}, \mathbf{x}) \cdot p(\boldsymbol{\theta})$ ;
+end for
+return $\hat{p}(\boldsymbol{\theta}|\mathbf{x}_o) = p_{R+1}(\boldsymbol{\theta})$
+
+Algorithm 8 Iterative Ratio
+ $p_1(\mathbf{m}) \gets p(\mathbf{m})$ ;
+for $r$ in 1 to $R$ do
+repeat
+ sample $\mathbf{m}_i \sim p_r(\mathbf{m})$ ;
+ query the oracle: $s_i \gets f(\mathbf{m}_i)$ ;
+until $n$ samples are obtained
+ $\mathcal{D} \gets \mathcal{D} \cup \{(\mathbf{m}_i, s_i)\}_{i=1}^n$ ;
+construct $\tilde{\mathcal{D}}$ with $\mathbf{m}$ in $\mathcal{D}$ satisfying $\mathcal{E}$ ;
+construct $\tilde{\mathcal{D}}'$ from $p(\mathbf{m})$ ;
+train $d_{\phi}(\mathbf{m})$ classifying between $\tilde{\mathcal{D}}$ and $\tilde{\mathcal{D}}'$ ;
+ $r_{\phi}(\mathbf{m}) \gets \frac{d_{\phi}(\mathbf{m})}{1 - d_{\phi}(\mathbf{m})}$ ;
+ $p_{r+1}(\boldsymbol{\theta}) \propto r_{\phi}(\mathbf{m}) \cdot p(\mathbf{m})$ ;
+end for
+return $\{\mathbf{m} : (\mathbf{m}, s) \in \mathcal{D}\}$
+
+Interestingly, a recent SNR-like work, EG-LF-MCMC (Begy & Schikuta, 2021), proposes to train the classifier on tuples of $(\theta ,\epsilon = \| \mathbf{x} - \mathbf{x}_o\|)$ instead of $(\theta ,\mathbf{x})$ . This algorithm can be also seen as a more precise analogy of our Iterative Ratio in the LFI context, as we have pointed out in Section 2.2 that a conceptual link could be drawn between $s$ and $-\| \mathbf{x} - \mathbf{x}_o\|$ .
+
+# 3.4 COMPOSITE PROBABILISTIC METHODS
+
+Building on the above analogies and framework, we move beyond the above algorithms in this subsection. The previous lines of approach – the direct posterior modeling methods in Section 3.1 and the indirect methods in Section 3.2 and 3.3 – both have their own advantages and disadvantages. The former methods may fail to get accurate inference result due to unmatched proposals, while the latter ones would need extra large amount of computation for the MCMC sampling process before obtaining accurate posterior samples, etc. Here we study composite algorithms that combine the aforementioned ingredients through the lens of our proposed unified framework. Our goal is to combine the strengths from both kinds of methods.
+
+We first introduce Iterative Posterior Scoring (IPS) method illustrated in Algorithm 9. IPS also uses a neural network $\hat{f}_{\phi}(\mathbf{m})$ to model the forward mechanism as IS does, and again we use $\tilde{q}$ here to denote the target posterior $p(\mathbf{m}|\mathcal{E})$ . Instead of applying computational MCMC steps here, we train a second parametrized model $q_{\psi}$ to model $\tilde{q}$ by minimizing the KL divergence between them. Notice that the optimization of $q_{\psi}$ is restricted within a neural network parameterization family. As a result, in the next round, we can directly utilize $q_{\psi}(\mathbf{m})$ to serve as a flexible generative proposal of $p_{r+1}(\mathbf{m})$ . Like IS, the IPS algorithm also has two different variants with regard to different choices of $\mathcal{E}$ , we name them to be IPS-A and IPS-B. Two choices differ in the detailed construction of distribution $\tilde{q}(\mathbf{m})$ .
+
+In a similar spirit, we propose the Iterative Posterior Ratio (IPR) algorithm (see Algorithm 10). IPR is close to the IR algorithm in many aspects, but also adopts a second neural network model $q_{\psi}(\mathbf{m})$ like IPS. IPR works similarly to IR, in that we also construct $\tilde{q} (\mathbf{m})$ , taking advantage of $r_{\phi}(\mathbf{m})$ and the prior $p(\mathbf{m})$ simply via $\tilde{q} (\mathbf{m})\gets r_{\phi}(\mathbf{m})\cdot p(\mathbf{m})$ . Note that the usage of two models in IPR is not exactly the same as in IPS: $q_{\psi}(\mathbf{m})$ is also achieved via minimizing KL divergence with $\tilde{q} (\mathbf{m})$ , but the training of model $d_{\phi}(\mathbf{m})$ is closer to that in IR rather than the $\hat{f}_{\phi}(\mathbf{m})$ in IS. Another similarity between IPR and IR is that IPR also only has one variant, since the Example B is not applicable for this ratio modeling approach (see Section A.4 in Appendix for more details).
+
+Algorithm 9 Iterative Posterior Scoring
+$p_1(\mathbf{m})\gets p(\mathbf{m})$
+for $r$ in 1 to $R$ do repeat sample $\mathbf{m}_i\sim p_r(\mathbf{m})$ query the oracle: $s_i\gets f(\mathbf{m}_i)$ until $n$ samples are obtained $\mathcal{D}\leftarrow \mathcal{D}\cup \{(\mathbf{m}_i,s_i)\}_{i = 1}^n$ fit $\hat{f}_{\phi}(\mathbf{m})$ with $\mathcal{D}$ construct $\tilde{q} (\mathbf{m})$ with $\hat{f}_{\phi}(\cdot)$ and $p(\mathbf{m})$ $q_{\psi}\gets \arg \min_qD_{\mathrm{KL}}(\tilde{q} (\mathbf{m})\| q);$ $p_{r + 1}(\mathbf{m})\gets q_{\psi}(\mathbf{m})$
+end for
+return $\{\mathbf{m}:(\mathbf{m},s)\in \mathcal{D}\}$
+
+Algorithm 10 Iterative Posterior Ratio
+$p_1(\mathbf{m})\gets p(\mathbf{m})$
+for $r$ in 1 to $R$ do repeat sample $\mathbf{m}_i\sim p_r(\mathbf{m})$ query the oracle: $s_i\gets f(\mathbf{m}_i)$ until $n$ samples are obtained $\mathcal{D}\gets \mathcal{D}\cup \{((\mathbf{m}_i,s_i)\}_{i = 1}^n$ construct $\tilde{\mathcal{D}}$ with $\mathbf{m}$ in $\mathcal{D}$ satisfying $\mathcal{E}$ construct $\tilde{\mathcal{D}}^\prime$ from $p(\mathbf{m})$ train $d_{\phi}(\mathbf{m})$ classifying between $\tilde{\mathcal{D}}$ and $\tilde{\mathcal{D}}^\prime$ $r_\phi (\mathbf{m})\leftarrow \frac{d_\phi(\mathbf{m})}{1 - d_\phi(\mathbf{m})};$ construct $\tilde{q} (\mathbf{m})$ with $r_{\phi}(\mathbf{m})$ and $p(\mathbf{m})$ $q_{\psi}\gets \arg \min_qD_{\mathrm{KL}}(\tilde{q} (\mathbf{m})\| q);$ $p_{r + 1}(\mathbf{m})\gets q_{\psi}(\mathbf{m});$
+end for
+return $\{\mathbf{m}:(\mathbf{m},s)\in \mathcal{D}\}$
+
+# 4 EXPERIMENTS
+
+# 4.1 SETUP
+
+In this section, we systematically evaluate the proposed methods and baselines on four different in-silico biological sequence design benchmarks. In every round, we allow each algorithm to query the black-box oracle for a batch of $n$ sequences $\mathbf{m}_i$ to obtain their true scores $s_i$ , with $n = 100$ for all experiments. The total number of rounds differs across different tasks.
+
+We experiment with our six proposed methods: Iterative Scoring (-A/B) from Section 3.2, Iterative Ratio from Section 3.3, Iterative Posterior Scoring (-A/B) and Iterative Posterior Ratio from Sec-
+
+
+Figure 1: Top score (y-axis) curves of different methods on 3 TfBind problems (KLF11_R402Q_R1, PBX4_REF_R2 and CRX_E80A_R1) with regard to the number of rounds.
+
+ | IS-A | IS-B | IR | IPS-A | IPS-B | IPR | RANDOM | EVOLUTION | DBAS | FB-VAE |
| TOP-10 | 8.43 | 6.93 | 4.79 | 6.21 | 8.36 | 7.00 | 1.14 | 4.36 | 5.07 | 2.71 |
| TOP-100 | 9.57 | 7.93 | 4.07 | 6.71 | 7.64 | 6.00 | 1.00 | 5.50 | 4.57 | 2.00 |
+
+Table 2: Mean rank of evaluated algorithms with regard to the area under the top score curve for TfBind problems. The rank ranges from 1 to 10. Higher rank is better.
+
+tion 3.4. Apart from these proposed methods, we consider as baselines a battery of existing methods designed for batched black-box sequence design tasks: (1) Random, a method that randomly select proposal sequences at every round; (2) FB-VAE (Gupta & Zou, 2019) depicted in Section 3.1; (3) Evolution based (Brindle, 1980; Real et al., 2019) sequence design algorithm; and (4) DbAS (Brookes & Listgarten, 2018), described in Section 3.1.
+
+We evaluate these sequence design algorithms by the average score of the top-10 and top-100 sequences in the resulting dataset $\mathcal{D}$ at each round. We plot the average score curves with regard to the number of rounds. We also use the area under the curve as a scalar metric for sample efficiency to compare the methods being evaluated. Specifically, since the area depends on the choice of x-axis, we simply cumulate the scores of all rounds to calculate the area. The result could be non-positive, since the score can take negative values.
+
+# 4.2 RESULTS
+
+Transcription factor binding sites (TfBind). Protein sequences that bind with DNA sequences to adjust their activity are called transcription factors. In Barrera et al. (2016), the authors measure the binding properties between a battery of transcription factors and all possible length-8 DNA sequences through biological experiments. Concretely, we choose 15 transcription factors to serve as 15 different tasks. For each transcription factor, the algorithm needs to search for sequences that maximize the corresponding binding activity score. The size of the search space is $|\mathcal{V}|^L = 4^8 = 65536$ . The number of total rounds is fixed to 10. For validation, we follow Angermüller et al. (2020b) and use one task (ZNF200_S265Y_R1) for hyperparameter selection. Then we test the algorithms' performance on the other 14 held-out tasks.
+
+Figure 1 displays a comparison for all ten methods on three of the chosen binding affinity tasks. We can observe that after 10 rounds, our proposed methods perform consistently better than the
+
+
+Figure 2: Top score (y-axis) curves of different methods on 3 sequence design problems (left: UTR, middle: AMP, right: Fluo) with regard to the number of rounds.
+
+ | IS-A | IS-B | IR | IPS-A | IPS-B | IPR | RANDOM | EVOLUTION | DBAS | FB-VAE |
| UTR | 8.46 | 9.61 | 9.03 | 10.04 | 10.19 | 9.52 | 8.12 | 9.23 | 9.59 | 8.20 |
| AMP | -5.67 | -5.11 | -5.37 | -4.65 | -4.39 | -5.42 | -5.96 | -5.79 | -5.39 | -5.54 |
| FLUO | 32.76 | 33.33 | 32.95 | 44.51 | 43.13 | 42.42 | 31.64 | 35.44 | 41.40 | 32.52 |
+
+Table 3: Comparison of the area under top-100 curves for UTR, AMP and Fluo benchmarks. Larger area means better sample efficiency.
+
+backward modeling methods like DbAS and FB-VAE in terms of both Top-10 and Top-100 scores. Among all baselines, the evolution method is the strongest one, and it beats IR on some of the tasks (see complete results in Table 4 and 5 in Appendix). We also find that IS-A and IS-B increase top scores slightly faster than other methods, especially on PBX4_REF_R2 and CRX_E80A_R1. This indicates that composite methods' way of using parameterized models to replace computational procedures is not the optimal solution for small-scale tasks.
+
+5' untranslated regions (UTR). The translation efficiency is mainly determined by the sequence of 5' UTR (Alipanahi et al., 2015). In Sample et al. (2019), the authors create a library of gene sequences with ribosome loading level as labels. They further train a convolutional neural network with this library to predict the relationship between a 5' UTR sequence and the corresponding gene expression level. We use this neural network as an oracle for this benchmark. The length of the gene sequences is fixed to 50, and thus the size of the search space is $4^{50}$ . For this 5' UTR benchmark, we also allow each algorithm to explore for 10 rounds. Figure 2 (left) shows that our proposed composite methods significantly outperform other methods on the UTR task. Different from the results on the TfBind task, forward modeling methods do not achieve the best performance.
+
+Antimicrobial peptides (AMP). Protein modeling has recently become a popular sub-area of machine learning research. We are tasked to generate AMP sequences, which are short protein sequences against multi-resistant pathogens. We train a binary classifier model to classify whether a short protein sequence belongs to AMP and defer the related details to Appendix. This is the only task we consider regarding sequence design with alterable lengths, where the length of sequences ranges from 12 to 60. Since each entry of protein sequence has $|\mathcal{V}| = 20$ different choices on amino acids, the size of search space is $\sum_{L=12}^{60} 20^L$ . We set the number of total rounds to be 15 for this task. Figure 2 (middle) clearly shows that the performances of IPS-A and IPS-B dominate the AMP generation task, which demonstrates the effectiveness of our composite strategy.
+
+Fluorescence proteins (Fluo). As another protein engineering task, we consider the optimization over fluorescent proteins, which is a commonly used test bed of modern molecular biology. This task is similar to the AMP task introduced above, but its ground-truth measurement relies on a regressor. We use a pretrained model taken from Rao et al. (2019) to act as our task oracle, which is a regressor trained to predict log-fluorescence intensity value over approximately 52,000 protein sequences of length 238 (Sarkisyan et al., 2016). More concretely, the regressor is fit on a small neighborhood of parent green fluorescent protein, and is then evaluated on a more distant protein. The training data is derived from the naturally occurring GFP in Aequorea victoria. The task Fluo's search space is $20^{238}$ and we set the number of rounds to 20. We demonstrate the Fluo results in Figure 2 (right), where we can see both composite methods and DbAS achieve much better results than other approaches. This might signify that for long sequence design tasks, backward modeling is superior to other modeling methods, which is not consistent with LFI (Papamakarios et al., 2019). We also summarize the sample efficiency results for the latter 3 benchmarks in Table 3 and 6, from which we can see that our proposed three composite methods perform remarkably promising results.
+
+# 5 CONCLUSION
+
+We propose a probabilistic framework that unifies likelihood-free inference and black-box optimization for designing biological sequences. This unified perspective enables us to design a variety of novel composite probabilistic sequence design methods combining the best of both worlds. Extensive experiments have demonstrated the benefits of the unified perspective. While the composite probabilistic methods usually outperform other baseline methods in most sequence design tasks we consider in this work, the key contribution of our paper is not just about the superiority of those composite methods, as different specific tasks might prefer different algorithmic configurations due to no free lunch theorem (Wolpert & Macready, 1997). Actually, we would like to attribute the strong performance to the unified probabilistic framework, which enables us to develop a richer algorithm pool, based on which we can design performant algorithms for particular sequence design tasks.
+
+# ACKNOWLEDGEMENT
+
+The authors would like to thank Christof Angermueller, Yanzhi Chen, Michael Gutmann, and anonymous reviewers for helpful feedbacks. Jie Fu thanks Microsoft Research Montreal for funding his postdoctoral position at University of Montreal and Mila. Yoshua Bengio acknowledges the funding from CIFAR, Samsung, IBM and Microsoft. Aaron Courville thanks the support of Samsung, Hitachi and CIFAR.
+
+# REFERENCES
+
+Sungsoo Ahn, Junsu Kim, Hankook Lee, and Jinwoo Shin. Guiding deep molecular optimization with genetic exploration. *ArXiv*, abs/2007.04897, 2020.
+Babak Alipanahi, Andrew Delong, Matthew T Weirauch, and Brendan J Frey. Predicting the sequence specificities of dna-and rna-binding proteins by deep learning. Nature biotechnology, 33 (8):831-838, 2015.
+Christof Angermüller, David Belanger, Andreea Gane, Zelda E. Mariet, David Dohan, Kevin Murphy, Lucy J. Colwell, and D. Sculley. Population-based black-box optimization for biological sequence design. In ICML, 2020a.
+Christof Angermüller, David Dohan, David Belanger, Ramya Deshpande, Kevin Murphy, and Lucy J. Colwell. Model-based reinforcement learning for biological sequence design. In *ICLR*, 2020b.
+Luis A. Barrera, Anastasia Vedenko, Jesse V. Kurland, Julia M Rogers, Stephen S. Gisselbrecht, Elizabeth J Rossin, Jaie C. Woodard, Luca Mariani, Kian Hong Kock, Sachi Inukai, Trevor Siggers, Leila Shokri, Raluca Gordan, Nidhi Sahni, Chris Cotsapas, Tong Hao, S. Stephen Yi, Manolis Kellis, Mark J. Daly, Marc Vidal, David E. Hill, and Martha L. Bulyk. Survey of variation in human transcription factors reveals prevalent dna binding changes. Science, 351:1450 - 1454, 2016.
+
+M. Beaumont, Wenyang Zhang, and D. Balding. Approximate bayesian computation in population genetics. Genetics, 162 4:2025-35, 2002.
+M. Beaumont, J. Cornuet, J. Marin, and C. Robert. Adaptive approximate bayesian computation. Biometrika, 96:983-990, 2009.
+Volodimir Begy and Erich Schikuta. Error-guided likelihood-free mcmc. 2021 International Joint Conference on Neural Networks (IJCNN), pp. 1-7, 2021.
+Michael G. B. Blum. Approximate bayesian computation: A nonparametric perspective. Journal of the American Statistical Association, 105:1178 - 1187, 2009.
+Johann Brehmer, Gilles Louppe, Juan Pavez, and Kyle Cranmer. Mining gold from implicit models to improve likelihood-free inference. Proceedings of the National Academy of Sciences, 117:5242 - 5249, 2020.
+A. Brindle. Genetic algorithms for function optimization. 1980.
+David H. Brookes and J. Listgarten. Design by adaptive sampling. ArXiv, abs/1810.03714, 2018.
+David H. Brookes, Hahnbeom Park, and Jennifer Listgarten. Conditioning by adaptive sampling for robust design. In ICML, 2019.
+Jeffrey Chan, Valerio Perrone, Jeffrey P. Spence, Paul A. Jenkins, Sara Mathieson, and Yun S. Song. A likelihood-free inference framework for population genetic data using exchangeable neural networks. bioRxiv, 2018.
+K. Chen and F. Arnold. Enzyme engineering for nonaqueous solvents: Random mutagenesis to enhance activity of subtilisin e in polar organic media. Bio/Technology, 9:1073-1077, 1991.
+Yanzhi Chen and Michael U. Gutmann. Adaptive gaussian copula abc. ArXiv, abs/1902.10704, 2019.
+Yanzhi Chen, Dinghuai Zhang, M. Gutmann, Aaron C. Courville, and Zhanxing Zhu. Neural approximate sufficient statistics for implicit models. *ArXiv*, abs/2010.10079, 2021.
+P. T. de Boer, Dirk P. Kroese, Shie Mannor, and Reuven Y. Rubinstein. A tutorial on the cross-entropy method. Annals of Operations Research, 134:19-67, 2005.
+Christopher C. Drovandi, Clara Grazian, Kerrie L. Mengersen, and Christian P. Robert. Approximating the likelihood in approximate bayesian computation. arXiv: Computation, 2018.
+Ahmed Elnaggar, Michael Heinzinger, Christian Dallago, Ghalia Rihawi, Yu Wang, Llion Jones, Tom Gibbs, Tamas Feher, Christoph Angerer, Martin Steinegger, et al. Prottrans: towards cracking the language of life's code through self-supervised deep learning and high performance computing. arXiv preprint arXiv:2007.06225, 2020.
+Paul Fearnhead and Dennis Prangle. Constructing summary statistics for approximate bayesian computation: semi-automatic approximate bayesian computation (with discussion). 2012.
+Rafael Gómez-Bombarelli, David Kristjanson Duvenaud, José Miguel Hernández-Lobato, 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:268 - 276, 2018.
+Sai Krishna Gottipati, Boris Sattarov, Sufeng Niu, Yashaswi Pathak, Haoran Wei, Shengchao Liu, Simon Blackburn, Karam Thomas, Connor Coley, Jian Tang, et al. Learning to navigate the synthetically accessible chemical space using reinforcement learning. In International Conference on Machine Learning, pp. 3668-3679. PMLR, 2020.
+David S. Greenberg, M. Nonnenmacher, and J. Macke. Automatic posterior transformation for likelihood-free inference. ArXiv, abs/1905.07488, 2019.
+
+Gabriel Lima Guimaraes, Benjamin Sánchez-Lengeling, Pedro Luis Cunha Farias, and Alán Aspuru-Guzik. Objective-reinforced generative adversarial networks (organ) for sequence generation models. ArXiv, abs/1705.10843, 2017.
+Anvita Gupta and J. Zou. Feedback gan for dna optimizes protein functions. Nature Machine Intelligence, 1:105-111, 2019.
+Michael U. Gutmann and Aapo Hyvarinen. Noise-contrastive estimation: A new estimation principle for unnormalized statistical models. In AISTATS, 2010.
+Michael U. Gutmann, Ritabrata Dutta, Samuel Kaski, and Jukka Corander. Likelihood-free inference via classification. Statistics and Computing, 28:411 - 425, 2018.
+Tatsunori B. Hashimoto, Steve Yadlowsky, and John C. Duchi. Derivative free optimization via repeated classification. In AISTATS, 2018.
+J. Hermans, Volodimir Bemy, and Gilles Louppe. Likelihood-free mcmc with amortized approximate likelihood ratios. arXiv: Machine Learning, 2019.
+Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural Computation, 9:1735-1780, 1997.
+Jp Hughes, S. Rees, SB Kalindjian, and KL Philpott. Principles of early drug discovery. British Journal of Pharmacology, 162, 2011.
+Rafael Izbicki, Ann B. Lee, and Chad M. Schafer. High-dimensional density ratio estimation with extensions to approximate likelihood computation. In AISTATS, 2014.
+Jan H Jensen. A graph-based genetic algorithm and generative model/monte carlo tree search for the exploration of chemical space. Chemical science, 10(12):3567-3572, 2019.
+Diederik P. Kingma and M. Welling. Auto-encoding variational bayes. CoRR, abs/1312.6114, 2014.
+Jian Ping Li, David J. Nott, Y. Fan, and Scott Anthony Sisson. Extending approximate bayesian computation methods to high dimensions via a gaussian copula model. Comput. Stat. Data Anal., 106:77-89, 2017.
+Jarno Lintusaari, Michael U. Gutmann, Ritabrata Dutta, Samuel Kaski, and Jukka Corander. Fundamentals and recent developments in approximate bayesian computation. Systematic Biology, 66: e66 - e82, 2017.
+Ge Liu, Haoyang Zeng, Jonas Mueller, Brandon Carter, Ziheng Wang, Jonas Schilz, Geraldine Horny, Michael E. Birnbaum, Stefan Ewert, and David Kenneth Gifford. Antibody complementarity determining region design using high-capacity machine learning. *bioRxiv*, 2020.
+Jan-Matthis Lueckmann, Pedro J. Gonçalves, G. Bassetto, Kaan Öcal, M. Nonnenmacher, and J. Macke. Flexible statistical inference for mechanistic models of neural dynamics. In NIPS, 2017.
+Jan-Matthis Lueckmann, Giacomo Bassetto, Theofanis Karaletsos, and Jakob H. Macke. Likelihood-free inference with emulator networks. ArXiv, abs/1805.09294, 2018.
+Jean-Michel Marin, Pierre Pudlo, Christian P. Robert, and Robin J. Ryder. Approximate bayesian computational methods. Statistics and Computing, 22:1167-1180, 2012.
+Kerrie L. Mengersen, Pierre Pudlo, and Christian P. Robert. Approximate bayesian computation via empirical likelihood. 2012.
+Daniel Neil, Marwin H. S. Segler, Laura Guasch, Mohamed Ahmed, Dean Plumbley, Matthew Sellwood, and Nathan Brown. Exploring deep recurrent models with reinforcement learning for molecule design. In ICLR, 2018.
+AkshitKumar Nigam, Pascal Friederich, Mario Krenn, and Alán Aspuru-Guzik. Augmenting genetic algorithms with deep neural networks for exploring the chemical space. arXiv preprint arXiv:1909.11655, 2019.
+
+George Papamakarios and Iain Murray. Fast $\epsilon$ -free inference of simulation models with bayesian conditional density estimation. In NIPS, 2016.
+George Papamakarios, Iain Murray, and Theo Pavlakou. Masked autoregressive flow for density estimation. ArXiv, abs/1705.07057, 2017.
+George Papamakarios, D. Terratt, and Iain Murray. Sequential neural likelihood: Fast likelihood-free inference with autoregressive flows. In AISTATS, 2019.
+Roshan Rao, Nicholas Bhattacharya, Neil Thomas, Yan Duan, Xi Chen, John Canny, Pieter Abbeel, and Yun S Song. Evaluating protein transfer learning with tape. In Advances in Neural Information Processing Systems, 2019.
+Esteban Real, Alok Aggarwal, Yanping Huang, and Quoc V. Le. Regularized evolution for image classifier architecture search. In AAAI, 2019.
+Reuven Y. Rubinstein and Dirk P. Kroese. The cross-entropy method. In Information Science and Statistics, 2004.
+Tim Salimans, Jonathan Ho, Xi Chen, and Ilya Sutskever. Evolution strategies as a scalable alternative to reinforcement learning. *ArXiv*, abs/1703.03864, 2017.
+Paul Sample, Ban Wang, David W. Reid, Vladimir Presnyak, Iain J Mcfadyen, David R. Morris, and Georg Seelig. Human 5utr design and variant effect prediction from a massively parallel translation assay. Nature Biotechnology, 37:803-809, 2019.
+Karen S Sarkisyan, Dmitry A Bolotin, Margarita V Meer, Dinara R Usmanova, Alexander S Mishin, George V Sharonov, Dmitry N Ivankov, Nina G Bozhanova, Mikhail S Baranov, Onuralp Soylemez, et al. Local fitness landscape of the green fluorescent protein. Nature, 533(7603):397-401, 2016.
+Bobak Shahriari, Kevin Swersky, Ziyun 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.
+Chence Shi, Minkai Xu, Zhaocheng Zhu, Weinan Zhang, Ming Zhang, and Jian Tang. Graphaf: a flow-based autoregressive model for molecular graph generation. ArXiv, abs/2001.09382, 2020.
+Nitish Srivastava, Geoffrey E. Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. J. Mach. Learn. Res., 15: 1929-1958, 2014.
+Owen Thomas, Ritabrata Dutta, Jukka Corander, Samuel Kaski, and Michael U. Gutmann. Likelihood-free inference by ratio estimation. arXiv: Machine Learning, 2016.
+Minh-Ngoc Tran, David J. Nott, and Robert Kohn. Variational bayes with intractable likelihood. Journal of Computational and Graphical Statistics, 26:873 - 882, 2015.
+Laurens van der Maaten and Geoffrey E. Hinton. Visualizing data using t-sne. Journal of Machine Learning Research, 9:2579-2605, 2008.
+Daan Wierstra, Tom Schaul, Jan Peters, and Juergen Schmidhuber. Natural evolution strategies. 2008 IEEE Congress on Evolutionary Computation (IEEE World Congress on Computational Intelligence), pp. 3381-3387, 2008.
+Jacob Witten and Zack Witten. Deep learning regression model for antimicrobial peptide design. BioRxiv, pp. 692681, 2019.
+David H. Wolpert and William G. Macready. No free lunch theorems for optimization. IEEE Trans. Evol. Comput., 1:67-82, 1997.
+Simon N. Wood. Statistical inference for noisy nonlinear ecological dynamic systems. Nature, 466: 1102-1104, 2010.
+
+Zachary Wu, S B Jennifer Kan, Russell D Lewis, Bruce J. Wittmann, and Frances H. Arnold. Machine learning-assisted directed protein evolution with combinatorial libraries. Proceedings of the National Academy of Sciences, 116:8852 - 8858, 2019.
+Kevin K. Yang, Zachary Wu, and Frances H. Arnold. Machine-learning-guided directed evolution for protein engineering. Nature Methods, pp. 1-8, 2019.
+Naruki Yoshikawa, Kei Terayama, Masato Sumita, Teruki Homma, Kenta Oono, and Koji Tsuda. Population-based de novo molecule generation, using grammatical evolution. Chemistry Letters, 47(11):1431-1434, 2018.
+Zhenpeng Zhou, Steven M. Kearnes, Li Li, Richard N. Zare, and Patrick F. Riley. Optimization of molecules via deep reinforcement learning. *Scientific Reports*, 9, 2019.
+
+# A MORE ABOUT METHODOLOGY
+
+# A.1 BACKWARD MODELING OF THE MECHANISM
+
+About SMC-ABC. In Algorithm 1, when we pick the top- $m$ $\theta$ at the $r$ -th round, the picked parameters actually follow such a distribution
+
+$$
+p (\boldsymbol {\theta} \mid \boldsymbol {x} _ {o}) \propto \sum_ {l = 1} ^ {r} p _ {l} (\boldsymbol {\theta}) \cdot p (\| \boldsymbol {x} - \boldsymbol {x} _ {o} \| < \epsilon \mid \boldsymbol {\theta}) = \left(\sum_ {l = 1} ^ {r} p _ {l} (\boldsymbol {\theta})\right) \cdot p (\| \boldsymbol {x} - \boldsymbol {x} _ {o} \| < \epsilon \mid \boldsymbol {\theta}) \tag {5}
+$$
+
+where the $\epsilon$ here is implicitly defined by how "top" the selection process is, namely the ratio $\frac{m}{nr}$ . As a result, we point out that in Algorithm 1, another more complicated form of the last step $p_{r+1}(\pmb{\theta}) \gets q_{\phi}(\pmb{\theta})$ is $p_{r+1}(\pmb{\theta}) \propto q_{\phi}(\pmb{\theta}) p(\pmb{\theta}) / \sum_{l}^{r} p_{l}(\pmb{\theta})$ , where an additional renormalizing term is involved. We ignore this term and used the simpler alternative in order to keep our main text clean. We refer interested readers to Beaumont et al. (2009) for more details.
+
+About Sequential Neural Posterior. Define $p(\mathbf{x}) = \int p(\mathbf{x}|\pmb{\theta})p(\pmb{\theta})d\pmb{\theta}$ and $\tilde{p} (\mathbf{x}) = \int p(\mathbf{x}|\pmb {\theta})\tilde{p} (\pmb {\theta})d\pmb{\theta}$ for any arbitrary proposal distribution $\tilde{p} (\pmb {\theta})$ which is not necessary to be the prior $p(\pmb {\theta})$ . What's more, we define $p(\pmb {\theta}|\mathbf{x}) = p(\mathbf{x}|\pmb {\theta})p(\pmb {\theta}) / p(\mathbf{x})$ and $\tilde{p} (\pmb {\theta}|\mathbf{x}) = p(\mathbf{x}|\pmb {\theta})\tilde{p} (\pmb {\theta}) / \tilde{p} (\mathbf{x})$ to be the true posterior and the proposal posterior.
+
+Starting from the goal of approximating the true posterior,
+
+$$
+\begin{array}{l} \underset {q} {\arg \min } \mathbb {E} _ {p (\mathbf {x})} [ D _ {\mathrm {K L}} (p (\boldsymbol {\theta} | \mathbf {x}) \| q (\boldsymbol {\theta} | \mathbf {x})) ] = \underset {q} {\arg \max } \int p (\mathbf {x}) d \mathbf {x} \int p (\boldsymbol {\theta} | \mathbf {x}) \log q (\boldsymbol {\theta} | \mathbf {x}) d \boldsymbol {\theta} \\ = \arg \max _ {q} \int p (\boldsymbol {\theta}, \mathbf {x}) \log q (\boldsymbol {\theta} | \mathbf {x}) d \boldsymbol {\theta} \mathbf {x} \\ = \underset {q} {\arg \max} \mathbb {E} _ {p (\boldsymbol {\theta}, \mathbf {x})} [ \log q (\boldsymbol {\theta} | \mathbf {x}) ]. \\ \end{array}
+$$
+
+It seems that we can directly train the parameterized neural density estimator $q_{\phi}$ in a data driven manner via $\max_{\phi}\sum_{i}\log q_{\phi}(\pmb{\theta}_{i}|\mathbf{x}_{i})$ where $i$ is the index for data sample. When the number of training samples as well as the parameterization family of $\phi$ are large enough, the obtained $q_{\phi}$ would be close enough to the true posterior. This would require the data samples to follow $(\pmb{\theta}_i,\mathbf{x}_i)\sim p(\pmb {\theta},\mathbf{x}) = p(\pmb {\theta})p(\mathbf{x}|\pmb {\theta})$ . However, practically one uses a proposal $\tilde{p} (\pmb {\theta})$ to first generate some $\{\pmb {\theta}_i\}_i$ and then generate $\{\mathbf{x}_i\}_i$ by simulation. When the proposal distribution $\tilde{p} (\pmb {\theta})$ is not exactly the prior distribution $p(\pmb {\theta})$ , the resulting $q_{\phi}(\cdot |\cdot)$ would be:
+
+$$
+\tilde {p} (\boldsymbol {\theta} | \mathbf {x}) = p (\boldsymbol {\theta} | \mathbf {x}) \frac {\tilde {p} (\boldsymbol {\theta}) p (\mathbf {x})}{p (\boldsymbol {\theta}) \tilde {p} (\mathbf {x})} \propto p (\boldsymbol {\theta} | \mathbf {x}) \frac {\tilde {p} (\boldsymbol {\theta})}{p (\boldsymbol {\theta})}, \tag {6}
+$$
+
+which is a biased estimation and is not what we want.
+
+Three variants of SNP take different approaches to try to fix this bias. SNP-A (Papamakarios & Murray, 2016) first fits the biased proposal posterior $\tilde{p}(\boldsymbol{\theta}|\mathbf{x})$ in the aforementioned way and utilize the relation in Eq. 6 to solve for an unbiased estimation. This approach is restricted to a mixture of Gaussian distribution family and thus has limited expressiveness. SNP-B (Lueckmann et al., 2017) uses importance sampling to address this issue via $\max_{\boldsymbol{\phi}} \mathbb{E}_{(\mathbf{x},\boldsymbol{\theta}) \sim p(\mathbf{x}|\boldsymbol{\theta})\tilde{p}(\boldsymbol{\theta})}\left[\frac{p(\boldsymbol{\theta})}{\tilde{p}(\boldsymbol{\theta})}\log q_{\boldsymbol{\phi}}(\boldsymbol{\theta}|\mathbf{x})\right]$ . One downside of this approach is the high variance involved by the importance weights $p(\boldsymbol{\theta}) / \tilde{p}(\boldsymbol{\theta})$ . SNP-C (Greenberg et al., 2019) proposes to use reparameterize the proposal posterior by setting $\tilde{q}_{\boldsymbol{\phi}}(\boldsymbol{\theta}|\mathbf{x}) = q_{\boldsymbol{\phi}}(\boldsymbol{\theta}|\mathbf{x})\frac{\tilde{p}(\boldsymbol{\theta})}{p(\boldsymbol{\theta})}\frac{1}{Z_{\boldsymbol{\phi}}(\mathbf{x})}$ where $Z_{\boldsymbol{\phi}}(\mathbf{x}) = \int q_{\boldsymbol{\phi}}(\boldsymbol{\theta}|\mathbf{x})\frac{\tilde{p}(\boldsymbol{\theta})}{p(\boldsymbol{\theta})}d\boldsymbol{\theta}$ is the corresponding normalizing factor for $\mathbf{x}$ . SNP-C then maximizes $\mathbb{E}_{(\mathbf{x},\boldsymbol{\theta}) \sim p(\mathbf{x}|\boldsymbol{\theta})\tilde{p}(\boldsymbol{\theta})}\left[\log \tilde{q}_{\boldsymbol{\phi}}(\boldsymbol{\theta}|\mathbf{x})\right]$ .
+
+About Design by Adaptive Sampling. We aim to approximate the posterior via minimizing the KL divergence:
+
+$$
+\begin{array}{l} \arg \min _ {q} D _ {\mathrm {K L}} (p (\mathbf {m} | \mathcal {E}) \| q (\mathbf {m})) = \arg \max _ {q} \int p (\mathbf {m} | \mathcal {E}) \log q (\mathbf {m}) d \mathbf {m} \\ = \arg \max _ {q} \int p (\mathcal {E} | \mathbf {m}) p (\mathbf {m}) \log q (\mathbf {m}) d \mathbf {m} \\ = \arg \max _ {q} \mathbb {E} _ {\tilde {q} (\mathbf {m})} \left[ \frac {p (\mathbf {m})}{\tilde {q} (\mathbf {m})} p (\mathcal {E} | \mathbf {m}) \log q (\mathbf {m}) \right], \\ \end{array}
+$$
+
+where $\tilde{q} (\mathbf{m})$ could be any distribution of $\mathbf{m}$ . Brookes et al. (2019) takes this formulation. Brookes & Listgarten (2018) only differs in the place that it ignores the denominator term. According to Angermuller et al. (2020b), we choose the latter variant as one of our baselines because it is more stable in practice. We refer interested readers to Brookes & Listgarten (2018) for more details.
+
+Notice that we are not doing exactly the same things for LFI and black-box sequence design. Since LFI models flexible posterior $p(\theta | \mathbf{x})$ which is a distribution for arbitrary $\mathbf{x}$ , we can also choose to model $p(\mathbf{m}|s)$ for arbitrary $s$ . Nevertheless, in the neural network modeling, conditioning by a scalar value is not an effective approach as the effect of low dimensional scalar value conditioning may be covered by other high dimensional input. Therefore, we choose to directly model the target posterior $p(\mathbf{m}|\mathcal{E})$ with a single neural network.
+
+# A.2 FORWARD MODELING OF THE MECHANISM
+
+We still use $\tilde{p}(\boldsymbol{\theta})$ to denote an arbitrary proposal distribution and $\tilde{p}(\boldsymbol{\theta}, \mathbf{x}) := p(\mathbf{x} | \boldsymbol{\theta}) \tilde{p}(\boldsymbol{\theta})$ . Then we have
+
+$$
+\begin{array}{l} \arg \min _ {q} \mathbb {E} _ {\tilde {p} (\boldsymbol {\theta})} \left[ D _ {\mathrm {K L}} \left(p (\mathbf {x} | \boldsymbol {\theta}) \| q (\mathbf {x} | \boldsymbol {\theta})\right) \right] = \arg \max _ {q} \int \tilde {p} (\boldsymbol {\theta}) d \boldsymbol {\theta} \int p (\mathbf {x} | \boldsymbol {\theta}) \log q (\mathbf {x} | \boldsymbol {\theta}) d \mathbf {x} \\ = \operatorname * {a r g m a x} _ {q} \mathbb {E} _ {\tilde {p} (\boldsymbol {\theta}, \mathbf {x})} \left[ \log q (\mathbf {x} | \boldsymbol {\theta}) \right]. \\ \end{array}
+$$
+
+We point out that with much enough data and large enough expressiveness of the neural density estimator parameterization family, no matter what proposal $\tilde{p}(\boldsymbol{\theta})$ is used to provide training samples $\{(\boldsymbol{\theta}_i, \mathbf{x}_i)\}_{i} \sim \tilde{p}(\boldsymbol{\theta}, \mathbf{x})$ , we have the resulting $q_{\hat{\phi}}(\boldsymbol{\theta}|\mathbf{x})$ equals true likelihood $p(\mathbf{x}|\boldsymbol{\theta})$ in the support of the proposal. What SNL gives is an unbiased estimation and thus does not have the same problem as SNP.
+
+Now we elaborate the construction of $\tilde{q}(\mathbf{m})$ in Iterative Scoring algorithm. Here we use the notation $\tilde{q}(\mathbf{m})$ to denote our approximation of the posterior $p(\mathbf{m}|\mathcal{E})$ . Notice that we want $\tilde{q}(\mathbf{m}) \propto p(\mathbf{m}) \cdot p(\mathcal{E}|\mathbf{m})$ . If we choose Example A to serve as the definition of event $\mathcal{E}$ , then the samples of $\tilde{q}(\mathbf{m})$ can be obtained in this way: (1) sample $\mathbf{m}$ from prior $p(\mathbf{m})$ and (2) accept this sample if $\hat{f}_{\phi}(\mathbf{m})$ is larger than threshold $s$ , or otherwise reject it. Alternatively, if we choose Example B, we have $\tilde{q}(\mathbf{m}) \propto p(\mathbf{m}) \cdot \exp(\hat{f}_{\phi}(\mathbf{m}) / \tau)$ . Similar to SNL, we do MCMC sampling from this unnormalized probability function.
+
+# A.3 MODELING A PROBABILITY RATIO
+
+About Sequential Neural Ratio. Dataset $\mathcal{D}$ is generated in the way that (1) first sample $\pmb{\theta} \sim p(\pmb{\theta})$ and (2) simulate $\mathbf{x} \sim p(\mathbf{x}|\pmb{\theta})$ . Consequently, $\mathcal{D}$ follows the distribution $p(\pmb{\theta})p(\mathbf{x}|\pmb{\theta}) = p(\pmb{\theta},\mathbf{x})$ . On the other hand, the other dataset $\mathcal{D}'$ generates $\pmb{\theta}$ and $\mathbf{x}$ in parallel and independent manner. Notice here $\pmb{\theta} \sim p(\pmb{\theta})$ and $\mathbf{x}$ follows the marginal distribution: $\mathbf{x} \sim p(\mathbf{x}) = \int p(\pmb{\theta})p(\mathbf{x}|\pmb{\theta})d\pmb{\theta}$ .
+
+# Proof of Proposition 1.
+
+Proof. We define a functional $\mathcal{F}$ to be the optimization objective:
+
+$$
+\mathcal {F} [ d ] = \mathbb {E} _ {\mathbf {a} \sim p _ {0} (\mathbf {a})} [ \log d (\mathbf {a}) ] + \mathbb {E} _ {\mathbf {a} \sim p _ {1} (\mathbf {a})} [ \log (1 - d (\mathbf {a})) ]
+$$
+
+We calculate its functional derivative. For arbitrary function $u$ and infinite small $\epsilon$
+
+$$
+\begin{array}{l} \mathcal {F} [ d + \epsilon u ] - \mathcal {F} [ d ] = \mathbb {E} _ {p _ {0}} \left[ \log \left(1 + \epsilon \frac {u}{d}\right) \right] + \mathbb {E} _ {p _ {1}} \left[ \log \left(1 + \epsilon \frac {- u}{1 - d}\right) \right] \\ = \epsilon \int u \cdot \left(\frac {p _ {0}}{d} + \frac {- p _ {1}}{1 - d}\right) + \mathcal {O} (\epsilon) \\ \Rightarrow \lim _ {\epsilon \rightarrow 0} \frac {\mathcal {F} [ d + \epsilon u ] - \mathcal {F} [ d ]}{\epsilon} = \int u \cdot \left(\frac {p _ {0}}{d} + \frac {- p _ {1}}{1 - d}\right) = \int u \cdot \delta \mathcal {F}. \\ \end{array}
+$$
+
+We set the functional derivative to zero:
+
+$$
+\begin{array}{l} \delta \mathcal {F} = 0 \Rightarrow \frac {p _ {0}}{p _ {1}} = \frac {d}{1 - d} \\ \Rightarrow d (\mathbf {a}) = \frac {p _ {0} (\mathbf {a})}{p _ {0} (\mathbf {a}) + p _ {1} (\mathbf {a})}. \\ \end{array}
+$$
+
+This optimal function $d^{*}$ apparently takes value in $[0,1]$ .
+
+
+
+About Iterative Ratio. Notice that in Algorithm 8 we construct two datasets: $\tilde{\mathcal{D}}$ and $\tilde{\mathcal{D}}'$ . To generate $\tilde{\mathcal{D}}$ , we need to be able to pick some sequence samples $\mathbf{m}$ from $\mathcal{D}$ and make the selected ones follow the posterior $p(\mathbf{m}|\mathcal{E})$ . This procedure will depend on our choice of event $\mathcal{E}$ . For Example A this is easy, since we just need to filter out the sequences whose oracle value is smaller than the threshold. However, for Example B, it is hard to do similar things, since given score value from $\mathcal{D}$ we only know the unnormalized value of posterior probability, and cannot determine which sequence should be filtered out. The construction of $\tilde{\mathcal{D}}'$ which follows prior distribution $p(\mathbf{m})$ is trivial.
+
+# A.4 COMPOSITE PROBABILISTIC METHODS
+
+For IPS, the optimization with regard to the second parameterized model $q_{\psi}(\mathbf{m})$ is
+
+$$
+\begin{array}{l} q _ {\psi} = \underset {q} {\arg \min } D _ {\mathrm {K L}} (\tilde {q} (\mathbf {m}) \| q) = \underset {q} {\arg \max } \int \tilde {q} (\mathbf {m}) \log q (\mathbf {m}) d \mathbf {m} \\ = \arg \max _ {q} \int p (\mathbf {m} | \mathcal {E}) \log q (\mathbf {m}) d \mathbf {m} = \arg \max _ {q} \int p (\mathcal {E} | \mathbf {m}) p (\mathbf {m}) \log q (\mathbf {m}) d \mathbf {m}. \\ \end{array}
+$$
+
+The exact value of $p(\mathcal{E}|\mathbf{m})$ depends on different choices of configuration feature $\mathcal{E}$ in Section 2.2. On the other hand, IPR, like IR, also only has one variant, which is with Example A:
+
+$$
+q _ {\psi} = \underset {q} {\arg \min} D _ {\mathrm {K L}} (\tilde {q} ({\bf m}) \| q) = \underset {q} {\arg \max} \int r _ {\phi} ({\bf m}) p ({\bf m}) \log q ({\bf m}) d {\bf m},
+$$
+
+which is a tractable optimization problem. Both IPR and IR are not fit for Example B since it cannot provide an exact probability value and thus cannot be adopted to construct $\tilde{\mathcal{D}}$ .
+
+# B MORE ABOUT EXPERIMENTS
+
+Random method uses no neural network model. FB-VAE uses a VAE model. The encoder of the VAE first linearly transform one-hot input into a hidden feature which is 64 dimension, and then separately linearly transform to a 64-dimension mean output and 64-dimension variance output. The decoder contains a $64 \times 64$ linear layer and a linear layer that maps the hidden feature to categorical output. All other methods utilize bi-directional long short-term memory model (BiLSTM) (Hochreiter & Schmidhuber, 1997) with a linear embedding layer. Both the embedding dimension and the hidden size of LSTM is set to 32. For composite methods that use two models, we use one-layer LSTM for each of them. For the other algorithms that only use one LSTM, we set its number of
+
+
+Figure 3: Diversity visualization results for two TfBind tasks.
+
+ | IS-A | IS-B | IR | IPS-A | IPS-B | IPR | RANDOM | EVO. | DBAS | FB-VAE |
| POU6F2_REF_R1 | 9 | 7 | 3 | 5 | 10 | 8 | 1 | 4 | 6 | 2 |
| KLF11_R402Q_R1 | 8 | 6 | 5 | 7 | 9 | 10 | 1 | 4 | 2 | 3 |
| EGR2_R359W_R1 | 4 | 5 | 8 | 9 | 7 | 6 | 1 | 2 | 10 | 3 |
| HOXD13_S316C_R1 | 8 | 10 | 3 | 4 | 7 | 9 | 1 | 5 | 6 | 2 |
| HOXB7_K191R_R1 | 10 | 8 | 6 | 4 | 9 | 3 | 1 | 5 | 7 | 2 |
| PBX4_REF_R2 | 10 | 9 | 8 | 7 | 5 | 4 | 1 | 6 | 2 | 3 |
| GFI1B_A204T_R1 | 8 | 7 | 3 | 4 | 9 | 10 | 1 | 6 | 5 | 2 |
| FOXC1_REF_R1 | 10 | 8 | 3 | 5 | 7 | 9 | 1 | 4 | 6 | 2 |
| KLF1_REF_R1 | 6 | 4 | 7 | 9 | 8 | 10 | 3 | 1 | 2 | 5 |
| SIX6_REF_R1 | 8 | 7 | 3 | 10 | 9 | 6 | 1 | 5 | 2 | 4 |
| ARX_L343Q_R2 | 10 | 3 | 4 | 7 | 9 | 5 | 1 | 6 | 8 | 2 |
| CRX_E80A_R1 | 9 | 10 | 7 | 5 | 8 | 2 | 1 | 6 | 3 | 4 |
| ESX1_K193R_R1 | 9 | 6 | 3 | 5 | 10 | 8 | 1 | 4 | 7 | 2 |
| VSX1_G160D_R1 | 9 | 7 | 4 | 6 | 10 | 8 | 1 | 3 | 5 | 2 |
| AVERAGE | 8.43 | 6.93 | 4.79 | 6.21 | 8.36 | 7.00 | 1.14 | 4.36 | 5.07 | 2.71 |
+
+Table 4: Top-10 score ranking for the TfBind instances that we adopt. "Evo." stands for the evolution algorithm.
+
+layers to be two. No Dropout (Srivastava et al., 2014) is used in LSTM models. In this way, the number of parameters of the VAE is slightly larger than that of the two layer BiLSTM, and all methods (except Random) share similar model parameter size.
+
+All the experiments are repeated with fifty random seeds and report the mean value (and also standard deviation in the figure plots). We set $p(\mathbf{m})$ to be uniform prior for all tasks for simplicity, which uniformly samples from the dictionary $\mathcal{V}$ for each entry of the sequence. For length alterable task, we first uniformly sample the length between minimum length and maximum length and then sample each entry.
+
+We explain details about evolution based method mentioned in the main text, which can be seen as a substantial example of directed evolution (Chen & Arnold, 1991). Like other model based methods, Evolution also trains an LSTM regressor to predict the score of a sequence, which is further used to assist in the reproduce procedure. The Evolution algorithm maintains a generation list through the whole exploration process. In each round, the method mutates and reproduces the sequences to enlarge the generation list, and then utilizes the learned regressor to select top sequences for the next generation.
+
+For validation, we follow (Angermüller et al., 2020b) and sweep each algorithm for fifty trials and pick the best configuration. We tune learning rate and whether to re-initialize the optimizer for each new round for all methods. We tune threshold for DbAS, FB-VAE and the methods that is with Example A. For the other choice of $\mathcal{E}$ , we tune the temperature. For evolution, we tune the number of offsprings for each sequence in generation list, the probability of substitution, insertion and deletion. For TfBind we use ZNF200_S265Y_R1 for validation. For UTR, AMP and Fluo, since we only have one oracle instance for each benchmark, we do not use a hold-out validation method.
+
+ | IS-A | IS-B | IR | IPS-A | IPS-B | IPR | RANDOM | EVO. | DBAS | FB-VAE |
| POU6F2_REF_R1 | 10 | 8 | 3 | 5 | 9 | 6 | 1 | 7 | 4 | 2 |
| KLF11_R402Q_R1 | 10 | 7 | 4 | 8 | 9 | 6 | 1 | 5 | 3 | 2 |
| EGR2_R359W_R1 | 7 | 8 | 4 | 10 | 5 | 9 | 1 | 3 | 6 | 2 |
| HOXD13_S316C_R1 | 10 | 9 | 3 | 4 | 7 | 6 | 1 | 5 | 8 | 2 |
| HOXB7_K191R_R1 | 10 | 9 | 3 | 6 | 8 | 4 | 1 | 5 | 7 | 2 |
| PBX4_REF_R2 | 10 | 9 | 7 | 5 | 6 | 4 | 1 | 8 | 3 | 2 |
| GFI1B_A204T_R1 | 10 | 7 | 4 | 5 | 9 | 6 | 1 | 8 | 3 | 2 |
| FOXC1_REF_R1 | 10 | 7 | 4 | 8 | 6 | 9 | 1 | 5 | 3 | 2 |
| KLF1_REF_R1 | 8 | 6 | 5 | 9 | 7 | 10 | 1 | 4 | 3 | 2 |
| SIX6_REF_R1 | 9 | 7 | 5 | 10 | 8 | 4 | 1 | 6 | 3 | 2 |
| ARX_L343Q_R2 | 10 | 7 | 4 | 8 | 9 | 3 | 1 | 6 | 5 | 2 |
| CRX_E80A_R1 | 10 | 9 | 5 | 7 | 8 | 4 | 1 | 6 | 3 | 2 |
| ESX1_K193R_R1 | 10 | 9 | 3 | 4 | 8 | 6 | 1 | 5 | 7 | 2 |
| VSX1_G160D_R1 | 10 | 9 | 3 | 5 | 8 | 7 | 1 | 4 | 6 | 2 |
| AVERAGE | 9.57 | 7.93 | 4.07 | 6.71 | 7.64 | 6.00 | 1.00 | 5.50 | 4.57 | 2.00 |
+
+Table 5: Top-100 score ranking for the TfBind instances that we adopt. "Evo." stands for the evolution algorithm.
+
+ | IS-A | IS-B | IR | IPS-A | IPS-B | IPR | RANDOM | EVOLUTION | DBAS | FB-VAE |
| UTR | 10.87 | 11.71 | 11.43 | 12.06 | 12.15 | 11.94 | 10.60 | 11.20 | 11.89 | 10.65 |
| AMP | -2.98 | -2.67 | -2.84 | -2.54 | -2.16 | -2.74 | -3.36 | -3.09 | -2.73 | -2.80 |
| FLUO | 35.31 | 35.82 | 35.59 | 46.19 | 44.28 | 43.88 | 34.33 | 37.40 | 43.45 | 34.78 |
+
+Table 6: Comparison of the area under top-10 curves for UTR, AMP and Fluo benchmarks. Larger area means better sample efficiency.
+
+For TfBind benchmark, we use the following transcription factor instances and treat them as different black-box optimization tasks: ZNF200_S265Y_R1, POU6F2_REF_R1_8, KLF11_R402Q_R1, EGR2_R359W_R1, HOXD13_S316C_R1, HOXB7_K191R_R1, PBX4_REF_R2, GFI1B_A204T_R1, FOXC1_REF_R1, KLF1_REF_R1, SIX6_REF_R1, ARX_L343Q_R2, CRX_E80A_R1, ESX1_K193R_R1 and VSX1_G160D_R1. We do not do post-processing such as score normalization whitening for the data for simplicity. We first calculate the area under curve to summarize the performance in a scalar output, and put the ranking result for each algorithm in Table 4 and Table 5, which provide more details for Table 2. To further investigate the diversity of different algorithms, we choose two TfBind instances (POU6F2_REF_R1 and KLF11_R402Q_R1) and visualize the resulting sequences with T-SNE (van der Maaten & Hinton, 2008) in Figure 3. We provide two visualization views for both task instances: (1) we uniformly sample 20 sequences from the whole $n \cdot R$ sequences for each algorithm and visualize them; (2) for each algorithm, we visualize 20 sequences uniformly sampled from the last batch (i.e., at the last round). This is notated with "final sequences" in the figure. We do not visualize all the sequences for simplicity. We use Hamming distance in the computation of T-SNE. From Figure 3, we can see that there is no obvious difference for the evaluated methods. This indicates that our proposed methods can achieve better performance while maintaining on-par diversity level with the baselines. This is not exactly consistent to the findings of Angermüller et al. (2020a), which claims some algorithms such as DbAS achieve very limited diversity. We do not use the "optima fraction" metric in Angermüller et al. (2020a;b), since this metric may not deal with multimode oracle landscape well and needs extra unstable computation such as clustering. Besides, this metric cannot generalize to other benchmarks.
+
+We elaborate the construction of our AMP oracle. We use the AMP dataset from (Witten & Witten, 2019) which contains 6,760 AMP sequences. A multilayer perceptron classifier is trained to predict if a protein sequence can prohibit the growth of a particular pathogen in that AMP dataset. This classifier operates on the features extracted by ProtAlbert (Elnaggar et al., 2020) model. Following the setup in (Angermüller et al., 2020b), we treat the predicted logits as the ground-truth measurement. Moreover, we demonstrate the area under Top-10 curves for UTR, AMP and Fluo benchmarks in Table 6, which is a good complement for Table 3 but is missing due to limited space in the main text.
+
+# C RELATED WORKS AND DISCUSSION
+
+Likelihood-free inference. We have already introduced the main classes of likelihood-free inference algorithms in the main text: (1) Approximate Bayesian Computation (ABC) method (Beaumont et al., 2009; Blum, 2009; Marin et al., 2012; Lintusaari et al., 2017) in Section 3.1; (2) Posterior modeling method that is also stated in Section 3.1, including classical ones (Tran et al., 2015; Li et al., 2017; Chen & Gutmann, 2019) and modern SNP methods (Papamakarios & Murray, 2016; Lueckmann et al., 2017; Greenberg et al., 2019); (3) Likelihood modeling method described in Section 3.2, also containing various classical algorithms (Wood, 2010; Mengersen et al., 2012; Drovandi et al., 2018) and modern SNL variants (Lueckmann et al., 2018; Papamakarios et al., 2019); and (4) Probability ratio modeling methods mentioned in Section 3.3 diverge in estimating likelihood ratio (Gutmann & Hyvarinen, 2010; Gutmann et al., 2018; Brehmer et al., 2020) or likelihood-to-evidence ratio (Thomas et al., 2016; Izbicki et al., 2014), where the latter paradigm is a good fit for LFI problem (Hermans et al., 2019). Besides, there are also works about how to construct low-dimensional summary statistics for LFI (Fearnhead & Prangle, 2012; Chan et al., 2018; Chen et al., 2021).
+
+Machine learning based drug design. Generative modeling and discriminative modeling are two basic ways of thinking in machine learning. In literature for sequence design, generative modeling is also known as cross entropy method. This is a famous kind of design method that is close to our "backward modeling of the mechanism" approach. Cross entropy methods seek to solve an expectation maximization problem (i.e., $\max_p\mathbb{E}_{p(\mathbf{m})}[f(\mathbf{m})]$ ) where the sequences follow a distribution $p$ . This can also be related to simulated annealing, a large family of black-box optimization algorithms - the sequential neural posterior could be thought to maintain a distribution which is gradually becoming sharper to a delta distribution at the optimal value. On the other hand, we think of this as a way for modeling the posterior $p(\mathbf{m}|\mathcal{E})$ and develop corresponding analysis under the probabilistic framework, which is like a more accurate version of cross entropy method. Many related methods (including the ones stated in Section 3.1) train the distribution by likelihood maximization for sequences with large scores, or use some sort of reweighting to achieve similar effects (Rubinstein & Kroese, 2004; de Boer et al., 2005; Neil et al., 2018; Gupta & Zou, 2019; Brookes et al., 2019).
+
+Discriminative modeling usually goes in a "model-based optimization" way (terminology from Angermüller et al. (2020a)), i.e., use a discriminative model $\hat{f}(\mathbf{m})$ to fit the real oracle $f(\mathbf{m})$ and act as a surrogate for it. The surrogate model can replace the true oracle $f(\mathbf{m})$ which involves costly biological experiments. This corresponds to our "forward modeling of the mechanism" in Section 3.2. Bayesian optimization (Shahriari et al., 2016) is a classical example, which utilizes $\hat{f}$ (typically a Gaussian process model) to define an acquisition function to guide the exploration and exploitation. Many modern biochemical methods also belong to this category (Gómez-Bombarelli et al., 2018; Hashimoto et al., 2018; Yang et al., 2019; Wu et al., 2019; Sample et al., 2019; Liu et al., 2020).
+
+There seems not much related literature about probability ratio estimation based method in this topic. On the other hand, Hashimoto et al. (2018) shares a classification based approach with IR but they differ on how to use the classifier. This algorithm utilizes the learned classifier to update the proposal with multiplicative weights algorithm, making the proposal to have large probability where the classifier logit is small. Other categories of drug design methods include evolution algorithms (Brindle, 1980; Wierstra et al., 2008; Salimans et al., 2017; Yoshikawa et al., 2018; Jensen, 2019; Real et al., 2019; Ahn et al., 2020) that search over the target space with genetic operators like insert, mutation, and crossover, and reinforcement learning (Guimaraes et al., 2017; Neil et al., 2018; Zhou et al., 2019; Shi et al., 2020; Angermüller et al., 2020b) which see the formation of a drug as a Markov decision process and train the policy to learn highly-rewarding drugs. We do not find other work that is similar to our probability ratio modeling approach (Section 3.3) from the literature, which we take as a novel contribution.
\ No newline at end of file
diff --git a/unifyinglikelihoodfreeinferencewithblackboxoptimizationandbeyond/images.zip b/unifyinglikelihoodfreeinferencewithblackboxoptimizationandbeyond/images.zip
new file mode 100644
index 0000000000000000000000000000000000000000..870ab149055c776f674a76687c3177608a760256
--- /dev/null
+++ b/unifyinglikelihoodfreeinferencewithblackboxoptimizationandbeyond/images.zip
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:9ebfdacb7e493ec8f9bfdbce47ebd6faa4ed3dd1e0fe444c7af25535179822ef
+size 620664
diff --git a/unifyinglikelihoodfreeinferencewithblackboxoptimizationandbeyond/layout.json b/unifyinglikelihoodfreeinferencewithblackboxoptimizationandbeyond/layout.json
new file mode 100644
index 0000000000000000000000000000000000000000..21b20b4b57273eaaecc4e080fa9f4cdc2dd8bc08
--- /dev/null
+++ b/unifyinglikelihoodfreeinferencewithblackboxoptimizationandbeyond/layout.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:c58fb1e863fcd3b7006fa4e94c4bb27c5f1909b4aa26bb54f375e84b4bb712ca
+size 822225
diff --git a/universalapproximationunderconstraintsispossiblewithtransformers/73cdadad-7133-44f3-93c2-e97d9e3a6b1e_content_list.json b/universalapproximationunderconstraintsispossiblewithtransformers/73cdadad-7133-44f3-93c2-e97d9e3a6b1e_content_list.json
new file mode 100644
index 0000000000000000000000000000000000000000..29d0135ac0ef8975313b095a654051ad9b18fb50
--- /dev/null
+++ b/universalapproximationunderconstraintsispossiblewithtransformers/73cdadad-7133-44f3-93c2-e97d9e3a6b1e_content_list.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:910a89422db6dd7e50dfa18e3326e2248299ead9078b96b5adf5f754c85b6483
+size 100166
diff --git a/universalapproximationunderconstraintsispossiblewithtransformers/73cdadad-7133-44f3-93c2-e97d9e3a6b1e_model.json b/universalapproximationunderconstraintsispossiblewithtransformers/73cdadad-7133-44f3-93c2-e97d9e3a6b1e_model.json
new file mode 100644
index 0000000000000000000000000000000000000000..94caa6d182092512822e39e92fd66630ba6d0104
--- /dev/null
+++ b/universalapproximationunderconstraintsispossiblewithtransformers/73cdadad-7133-44f3-93c2-e97d9e3a6b1e_model.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b552d4041ed1817a01b4724a05fbc07297be6fb569dc3242d5c262a3b3efae8a
+size 134695
diff --git a/universalapproximationunderconstraintsispossiblewithtransformers/73cdadad-7133-44f3-93c2-e97d9e3a6b1e_origin.pdf b/universalapproximationunderconstraintsispossiblewithtransformers/73cdadad-7133-44f3-93c2-e97d9e3a6b1e_origin.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..22381e63053b5984496f77b97a3e62837c8a30b4
--- /dev/null
+++ b/universalapproximationunderconstraintsispossiblewithtransformers/73cdadad-7133-44f3-93c2-e97d9e3a6b1e_origin.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a6a3c4e5a844c528761b0a280f533fda25cd32156368401bbda504c87b52575a
+size 1018253
diff --git a/universalapproximationunderconstraintsispossiblewithtransformers/full.md b/universalapproximationunderconstraintsispossiblewithtransformers/full.md
new file mode 100644
index 0000000000000000000000000000000000000000..f19cefe94b76145358cedff218daef432731a5bc
--- /dev/null
+++ b/universalapproximationunderconstraintsispossiblewithtransformers/full.md
@@ -0,0 +1,435 @@
+# UNIVERSAL APPROXIMATION UNDER CONSTRAINTS IS POSSIBLE WITH TRANSFORMERS
+
+Anastasis Kratsios\*Tianlin Liu & Ivan Dokmanic
+Universitat Basel,
+Departement Mathematik und Informatik
+{firstname.lastname}@unibas.ch
+
+Behnoosh Zamanlooy*
+Universität Zürich,
+Department of Informatics
+bzamanlooy@ifi.uzh.ch
+
+# ABSTRACT
+
+Many practical problems need the output of a machine learning model to satisfy a set of constraints, $K$ . There are, however, no known guarantees that classical neural networks can exactly encode constraints while simultaneously achieving universality. We provide a quantitative constrained universal approximation theorem which guarantees that for any convex or non-convex compact set $K$ and any continuous function $f: \mathbb{R}^n \to K$ , there is a probabilistic transformer $\hat{F}$ whose randomized outputs all lie in $K$ and whose expected output uniformly approximates $f$ . Our second main result is a "deep neural version" of Berge (1963)'s Maximum Theorem. The result guarantees that given an objective function $L$ , a constraint set $K$ , and a family of soft constraint sets, there is a probabilistic transformer $\hat{F}$ that approximately minimizes $L$ and whose outputs belong to $K$ ; moreover, $\hat{F}$ approximately satisfies the soft constraints. Our results imply the first universal approximation theorem for classical transformers with exact convex constraint satisfaction, and a chart-free universal approximation theorem for Riemannian manifold-valued functions subject to geodesically-convex constraints.
+
+Keywords: Constrained Universal Approximation, Probabilistic Attention, Transformer Networks, Geometric Deep Learning, Measurable Maximum Theorem, Non-Affine Random Projections.
+
+# 1 INTRODUCTION
+
+In supervised learning, we select a parameterized model $\hat{f}:\mathbb{R}^n\to \mathbb{R}^m$ by optimizing a real-valued loss function $L$ over training data from an input-output domain $\mathcal{X}\times \mathcal{Y}\subseteq \mathbb{R}^n\times \mathbb{R}^m$ . A necessary property for a model class to produce asymptotically optimal results, for any continuous loss $L$ , is the universal approximation property. However, often more structure (beyond vectorial $\mathbb{R}^m$ ) is present in a learning problem and this structure must be encoded into the trained model $\hat{f}$ to obtain meaningful or feasible predictions. This additional structure is typically described by a constraint set $K\subseteq \mathbb{R}^{m}$ and the condition $\hat{f} (\mathcal{X})\subseteq K$ . For example, in classification $K = \{y\in [0,1]^m:\sum_{i = 1}^m y_i = 1\}$ (Shalev-Shwartz & Ben-David, 2014), in Stackelberg games (Holters et al., 2018; Jin et al., 2020; Li et al., 2021) $K$ is the set of utility-maximizing actions of an opponent, in integer programming $K$ is the integer lattice $\mathbb{Z}^m$ (Conforti et al., 2014), in financial risk-management $K$ is a set of positions meeting the minimum solvency requirements imposed by international regularity bodies (Basel Committee on Banking Supervision, 2015; 2019; McNeil et al., 2015), in covariance matrix prediction $K\subseteq \mathbb{R}^{m\times m}$ is the set of $m\times m$ matrices which are symmetric and positive semidefinite (Bonnabel et al., 2013; Bonnabel & Sepulchre, 2009; Baes et al., 2021), in geometric deep learning $K$ is typically a manifold (e.g. a pose manifold in computer vision and robotics (Ding & Fan, 2014) or a manifold of distance matrices (Dokmanic et al., 2015)), a graph, or an orbit of a group action (Bronstein et al., 2017; 2021; Kratsios & Bilokopytov, 2020). Therefore, we ask:
+
+Is exact constraint satisfaction possible with universal deep learning models?
+
+The answer to this question begins by examining the classical universal approximation theorems for deep feedforward networks. If $L$ and $K$ are mildly regular, the universal approximation theorems of Hornik et al. (1989); Cybenko (1989); Pinkus (1999); Guhring et al. (2020); Kidger & Lyons (2020); Park et al. (2021) guarantee that for any "good activation function $\sigma$ " and for every tolerance level $\epsilon > 0$ , there is a deep feedforward network with activation function $\sigma$ , such that $\inf_{y \in K} L(x, y)$ and $L(x, \hat{f}(x))$ are uniformly at most $\epsilon$ apart. Written in terms of the optimality set,
+
+$$
+\sup _ {x \in \mathcal {X}} \| \hat {f} (x) - \underset {y \in K} {\operatorname {a r g m i n}} L (x, y) \| \leq \epsilon , \tag {1}
+$$
+
+where the distance of a point $y \in \mathbb{R}^m$ to a set $A \subseteq \mathbb{R}^m$ is defined by $\| y - A\| \triangleq \inf_{a \in A} \| y - a\|$ . Since $\operatorname{argmin}_{y \in K} L(x, y) \subseteq K$ , then (1) only implies that $\| \hat{f}(x) - K\| \leq \epsilon$ and there is no reason to believe that the constraint $\hat{f}(x) \in K$ is exactly satisfied, for every $x \in \mathcal{X}$ .
+
+This kind of approximate constraint satisfaction is not always appropriate. In the following examples constraint violation causes either practical or theoretical concerns:
+
+(i) In post-financial crisis risk management, international regulatory bodies mandate that any financial actor should maintain solubility proportional to the risk of their investments (Basel Committee on Banking Supervision, 2015; 2019). To prevent future financial crises, any violation of these risk constraints, no matter the size, incurs large and immediate fines.
+(ii) In geometric deep learning, we often need to encode complicated non-vectorial structure present in a dataset, by viewing it as a $K$ valued function (Fletcher, 2013; Bonnabel & Sepulchre, 2009; Baes et al., 2021). However, if $K$ is non-convex then Motzkin (1935) confirms that there is no unique way to map predictions $\hat{f}(x) \notin K$ to a closest point in $K$ . Thus, we are faced with the dilemma: either make an ad-hoc choice of a $k$ in $K$ with $k \approx \hat{f}(x)$ (ex.: an arbitrary choice scheme when $K = \mathbb{Z}^m$ ) or have meaningless predictions (ex: non-integer values to integer programs, or symmetry breaking (Weinberg, 1976)2).
+
+Constrained learning was recognized as an effective framework for fairness and robustness by Chamon & Ribeiro (2020) who study empirical risk minimization under constraints. Many emerging topics in machine learning lead to constrained learning formulations. A case in point is model-based domain generalization (Robey et al., 2021). Despite the importance of (deep) learning with constraints, there are no related approximation-theoretic results to the best of our knowledge.
+
+In this paper, we bridge this theoretical gap by showing that universal approximation with exact constraint satisfaction is always possible for deep (probabilistic) transformer networks with a single attention mechanism as output layer. Our contribution is three-fold:
+
+1. We derive the first universal approximation theorem with exact constraint satisfaction;
+2. Our transformer network's encoder and decoder adapt to the dimension of the constraint set and thus beat the curse of dimensionality for low-dimensional constraints;
+3. Our models leverage a probabilistic attention mechanism that can encode non-convex constraints. This probabilistic approach is key to bypass the topological obstructions to non-Euclidean universal approximation (Kratsios & Papon, 2021).
+
+Our analysis provides perspective on the empirical success of attention and adds to the recent line of work on approximation theory for transformer networks, (Yun et al., 2020a;b), which roughly considers the unconstrained case (with $K$ in (1) replaced by $\mathbb{R}^m$ ) in the special case of $L(x,y) = \| f(x) - y\|$ for a suitable target function $f:\mathbb{R}^n\to \mathbb{R}^m$ . Our probabilistic perspective on transformer networks fits with the representations of Vuckovic et al. (2021) and of Kratsios (2021).
+
+Our results can be regarded as an approximation-theoretic counterpart to the constrained statistical learning theory of Chamon & Ribeiro (2020). Further, they put forward a perspective on randomness in neural networks that is complementary to the work of Louart et al. (2018); Gonon et al. (2020a;b). We look at the same problem focusing on constraint satisfaction instead of training efficiency. Finally, our proof methods are novel, and build on contemporary tools from metric geometry (Ambrosio & Puglisi, 2020; Brue et al., 2021).
+
+# 1.1 THE PROBABILISTIC ATTENTION MECHANISM
+
+We now give a high-level explanation of our results; the detailed formulations are in Section 2.
+
+Introduced in (Bahdanau et al., 2015) and later used to define the transformer architecture (Vaswani et al., 2017), in the NLP context, attention maps a matrix of queries $Q$ , a matrix of keys $K$ , and a matrix of values $V$ to the quantity $\mathrm{Softmax}(QK^{\top})V$ , where the softmax function (defined below) is applied row-wise to $QK^{\top}$ . Just as the authors of (Petersen & Voigtlaender, 2020; Zhou, 2020) focus on the simplified versions of practically implementable ConvNets in the study of approximation theory of deep ConvNets (e.g. omitting pooling layers), we find it sufficient to study the following simplified attention mechanism to obtain universal approximation results:
+
+$$
+\operatorname {A t t e n t i o n} (w, Y) \triangleq \operatorname {S o f t m a x} _ {N} (w) ^ {\top} Y = \sum_ {n = 1} ^ {N} [ \operatorname {S o f t m a x} _ {N} (w) _ {n} ] Y _ {n}, \tag {2}
+$$
+
+where $w \in \mathbb{R}^N$ , $\operatorname{Softmax}_N: \mathbb{R}^N \ni w \mapsto \left( \frac{e^{w_k}}{\sum_{j=1}^N e^{w_j}} \right)_{k=1}^N$ , and $Y$ is an $N \times m$ matrix. The attention mechanism (2) can be interpreted as "paying attention" to a set of particles $Y_1, \ldots, Y_N \in \mathbb{R}^m$ defined by $Y$ 's rows. This simplified form of attention is sufficient to demonstrate that transformer networks can approximate a function while respecting a constraint set, $K$ , whether convex or non-convex.
+
+Informal Theorem 1.1 (Deep Maximum Theorem for Transformers). If $K$ is convex and the quantities defining (1) are regular then, for any $\epsilon \in (0,1]$ , there is a feedforward network $\hat{f}$ , an $\mathcal{X}_{\epsilon} \subset \mathbb{R}^{n}$ of probability 1- $\epsilon$ , and a matrix $Y$ such that the transformer Attention $(\hat{f}(x),Y)$ satisfies:
+
+(i) Exact Constraint Satisfaction: For each $x\in \mathbb{R}^n$ , Attention $(\hat{f} (x),Y)\in K$
+(ii) Universal Approximation: $\sup_{x\in \mathcal{X}_{\epsilon}}\| \mathrm{Attention}(\hat{f} (x),Y) - \underset {y^{\star}\in K}{\mathrm{argmin}}L(x,y^{\star})\| \leq \epsilon$
+
+Informal Theorem 1.1 guarantees that simple transformer networks can minimize any loss function while exactly satisfying the set of convex constraints. As illustrated by Figure 1 and Figure 2, $K$ 's convexity is critical here, since without it the transformer's prediction may fail to lie in $K$ . This is because any transformer network's output is a convex combinations of the particles $Y_{1}, Y_{2}, Y_{3}$ ; thus, any transformer network's predictions must belong to these particles' convex hull.
+
+
+Figure 1: Convex Constraints
+
+
+Figure 2: Non-Convex Constraints
+
+In Figures 1 and 2, $Y$ 's columns, i.e. the particles $Y_{1}, Y_{2}$ , and $Y_{3}$ , are each illustrated by a $\bullet$ at the constraint set $(K)$ vertices. The bubble around each each $Y_{i}$ illustrates the predicted probability, for a given input, that $f(x)$ is nearest to that $Y_{i}$ . The $\times$ is the transformer's prediction which is, by construction, a convex combination of the $Y_{i}$ weighted by the aforementioned probabilities and therefore they lie in the $K$ if it is convex (Figure 1) but not if $K$ is non-convex (Figure 2).
+
+Naturally, we arrive at the question: How can (i) and (ii) simultaneously hold when $K$ is non-convex?
+
+Returning to Vaswani et al. (2017) and using the introduced terminology, we note that the role of the $\mathrm{Softmax}_N$ layer is to rank the importance of the particles $\{Y_n\}_{n=1}^N$ when optimizing $L$ , at any given input: the weights $[\mathrm{Softmax}_N(w)]_n$ in (2) can be interpreted as charging their respective point masses $\{\delta_{Y_n}\}_{n=1}^N$ with probabilities of being optimal for $L$ (relative to the other particles)3. This suggests the following probabilistic reinterpretation of attention (which we denote by p-attention):
+
+$$
+\operatorname {P} \text {- a t t e n t i o n} (w, Y) \triangleq \sum_ {n = 1} ^ {N} \left[ \operatorname {S o f t m a x} _ {N} (w) \right] _ {n} \delta_ {Y _ {n}}. \tag {3}
+$$
+
+Crudely put, P-attention $(\cdot ,Y)$ "pays relative attention to the particles" $Y_{1},\ldots ,Y_{n}\in \mathbb{R}^{m}$
+
+A simple computation shows that the mean prediction of our probabilistic attention mechanism, exactly implements "classical" Attention of Vaswani et al. (2017), as defined in (2),
+
+$$
+\operatorname {A t t e n t i o n} (w, Y) = \mathbb {E} _ {X \sim \mathrm {P - a t t e n t i o n} (w, Y)} [ X ], \tag {4}
+$$
+
+where $\mathbb{E}_{X\sim \mathrm{P - attention}(w,Y)}[X]$ denotes the (vector-valued) expectation of a random-vector $X$ distributed according to $\mathrm{P - attention}(w,Y)$ . Hence, (3) is no less general than (2). The advantage of (3) is that, if each particle $Y_{n}$ belongs to $K$ (even if $K$ is non-convex) then, any sample drawn from the probability measure $\mathrm{P - attention}(w,Y)$ necessarily belongs to $K$ .
+
+# 1.2 QUALITATIVE RESULTS: DEEP MAXIMUM THEOREM
+
+Probabilistic attention (3) yields the following non-convex generalization of Informal Theorem 1.1. The result is a qualitative universal approximation theorem as well as a deep neural version of the Maximum Theorem4 (Berge, 1963), which states that under mild regularity conditions, given any well-behaved family of input dependent "soft constraint sets" $\{C_x\}_{x \in \mathbb{R}^n}$ compatible with $K$ , there is a measurable function mapping each $x \in \mathbb{R}^n$ to a minimizer of $L(x, y)$ on $K \cap C_x$ .
+
+We use $\mathcal{W}_1$ to denote the Wasserstein-1 distance between probability measures on $K$ . The results also give the flexibility to the user to enforce an input-dependent family of "soft constraints" $\{C_x\}_{x\in \mathbb{R}^n}$ which only need to hold approximately; definitions are provided in Section 1.4.
+
+Informal Theorem 1.2 (Deep Maximum Theorem: Non-Convex Case). If the quantities defining $\mathcal{I}$ are regular, $K$ is a compact set of "exact constraints", and $\{C_x\}_{x \in \mathbb{R}^n}$ a set of "soft constraints", then, for any approximation quality $0 < \epsilon \leq 1$ , there is a deep feedforward network $\hat{f}$ and a matrix $Y$ satisfying:
+
+(i) Exact Constraint Satisfaction: For each $x \in \mathbb{R}^n$ , P-attention $(\hat{f}(x), Y)$ is supported in $K$ ; (ii) Universal Approximation: $\mathbb{P}(\mathcal{W}_1(\mathrm{P - attention}(\hat{f}(x), Y), \operatorname*{argmin}_{y^\star \in C_x \cap K} L(x, y^\star)) \leq \epsilon) \geq 1 - \epsilon$ ; where for a probability measure $\mathbb{P}$ on $\mathbb{R}^m$ and a $B \subseteq \mathbb{R}^m$ we define $\mathcal{W}_1(\mathbb{P}, B) \triangleq \inf_{b \in B} \mathcal{W}_1(\mathbb{P}, \delta_b)$ .
+
+Example 1.3 (Reduction to Classical Point-to-Set Distance). In particular, when $\mathbb{P}$ is a point-mass $\mathbb{P} = \delta_y$ for some $y\in \mathbb{R}^m$ , then one recovers the familiar Euclidean distance to the set $B$ via:
+
+$$
+\mathcal {W} _ {1} (\delta_ {y}, B) \stackrel {\mathrm {(d e f)}} {=} \inf _ {b \in B} \mathcal {W} _ {1} (\delta_ {y}, \delta_ {b}) = \inf _ {b \in B} \| y - b \| \stackrel {\mathrm {(d e f)}} {=} \| y - B \|;
+$$
+
+where the first and second equality follows from (Villani, 2009, (5) - page 99), and the last equality is the definition of $\| y - B \|$ (as in (Aubin & Frankowska, 2009, Definition 1.1.1)).
+
+Another important class of non-convex constraints arising from geometric deep learning where $K$ is a non-Euclidean ball in a Riemannian submanifold of $\mathbb{R}^m$ . In this broad case, we may extract mean predictions from P-attention $(\hat{f}, Y)$ , by applying the Fréchet mean introduced in Fréchet (1948). Such "geometric means" are well-understood theoretically (Bhattacharya & Patrangenaru, 2003) and easily handled numerically Miolane et al. (2020); Lou et al. (2020).
+
+# 1.3 QUANTITATIVE RESULTS: CONSTRAINED UNIVERSAL APPROXIMATION THEOREM
+
+In its current form, the objective function $L$ is too general to derive quantitative approximation rates. Nevertheless, as with most universal approximation theorems (Hornik et al., 1989; Pinkus, 1999; Kidger & Lyons, 2020), if each soft constraint $C_x$ is set to $\mathbb{R}^m$ and $L$ quantifies the uniform distance to an unknown continuous function $f: \mathbb{R}^n \to K$ in the Euclidean sense,
+
+$$
+L (x, y) \triangleq \| f (x) - y \|,
+$$
+
+then, Informal Theorem 1.2 reduces to a (qualitative) universal approximation for transformer networks with exact constraint satisfaction. In fact, this additional structure is enough for us to derive quantitative versions of the aforementioned results. We permit ourselves the general situation, where
+
+$K$ is contained in an unknown $d$ -dimensional submanifold (where $d \in \Theta(m^{\frac{1}{s}})$ for some $s > 0$ ). Our approximation rates scale favourably in the ratio $s \approx \frac{\log(m)}{\log(d)}$ ; i.e., we avoid the curse of dimensionality for low-dimensional constraint sets. This additional structure translates into the familiar encoder-decoder structure deployed in most transformer network implementations.
+
+
+Figure 3: Encoder : $\approx f$
+
+
+Figure 4: Decoder : ≈ Random Projection to $K$
+
+Figure 3 illustrates the encoder network $\hat{\mathcal{E}}: \mathbb{R}^n \to \mathbb{R}^m$ , whose role is to perform a (classical) unconstrained approximation of the target function, $f$ . Since $\hat{\mathcal{E}}$ is a classical feedforward network then its approximation of the target function can be arbitrarily close to the constraint set $K$ but it need not lie in it. The next step is to "map the encoder network's output onto $K$ with low distortion." The role of the decoder network $\hat{\mathcal{D}}$ is to correct any constraint violation made by encoder network by "projecting them back on to $K$ ". However, such a projection does not exist if $K$ is not convex since there must be more than one closest point in $K$ to some $y \in \mathbb{R}^m$ (Motzkin, 1935). Nevertheless, if the "projection" were capable of mapping any $y \in \mathbb{R}^m$ to multiple points on $K$ , ranked by their proximity to $y$ , then there would be no trouble. The decoder network accomplishes precisely this, as illustrated in Figure 4, where the bubbles illustrate the probability of any particle in $K$ being closest to $y$ , illustrated by the size of the bubbles in Figure 4. Mathematically, ${}^6\hat{\mathcal{D}}: \mathbb{R}^m \to \mathcal{P}_1(K)$ approximates a (non-affine) random projection, in the sense of Ohta (2009); Ambrosio & Puglisi (2020); Bruè et al. (2021); i.e.: a 1-Lipschitz map $\Pi: \mathbb{R}^m \to \mathcal{P}_1(K)$ satisfying the random projection property: for all $y \in K$
+
+$$
+\Pi_ {y} = \delta_ {y}.
+$$
+
+Thus, $\Pi$ 's random projection property means that it fixes any output already satisfying the constraint $K$ , and its Lipschitz regularity implies that it is stable. Thus, sampling from $\Pi(y_1)$ is similar to sampling from $\Pi(y_2)$ whenever the points $y_1, y_2 \in \mathbb{R}^m$ are near to one another.
+
+Remark 1.4. Random projections are closely tied to the (random) partitions of unity of Lee & Naor (2005) (see (Ambrosio & Puglisi, 2020, Theorem 2.8)). These random projections generalize the random projections of Johnson & Lindenstrauss (1984), beyond the case where $K$ is affine.
+
+Remark 1.5. The special case of random projections onto affine spaces has recently been used when constructing universal neural models (Cuchiero et al., 2021; Puthawala et al., 2020).
+
+We record the complexity of both the decoder and encoder networks constructed in our quantitative results in Table 1. Here $A, B, C, D \geq 0$ are constants independent of $\epsilon$ and $k$ , where $k \in \mathbb{N}_{+}$ is the number of continuous derivatives which $f$ admits (when viewed as a function into $\mathbb{R}^m$ ). From
+
+| Network | ˆ | ˆ |
| Depth | O(m1/s(1+ε23(kn+1)-2n/kn+1)) | O((N3/2(A+2ε)(4-ε-1)2)/s) |
| Width | m1/s(4n+10) | m1/s+N+2 |
| N | - | O((ε-1A+B)m/2) |
| Q | - | O(ε-m/s) |
+
+Table 1: Complexity of simple transformer network $\widehat{f} = \widehat{\mathcal{D}} \circ \widehat{\mathcal{E}}$ approximating $f$ .
+
+Table 1, we see that if $m^{\frac{1}{s}} \ll m$ then, $s > 0$ is large; hence, $\epsilon^{\frac{m}{s}}, (1 - 4\epsilon^{-1})^{\frac{2m}{s}}$ , and $N^{\frac{m}{s}}$ are small.
+
+# 1.4 NOTATION AND BACKGROUND
+
+Optimal Transportd Given any non-empty subset $K \subseteq \mathbb{R}^m$ , the set of all Borel probability measures $\mathbb{P}$ on $K$ with a finite mean; i.e.: $\mathbb{E}_{X \sim \mathbb{P}}[||X||] < \infty$ , is denoted by $\mathcal{P}_1(K)$ . Wasserstein
+
+distance $\mathcal{W}_1$ is defined for any $\mathbb{P},\mathbb{Q}\in \mathcal{P}_1(K)$ by the minimal energy needed to transport all mass from $\mathbb{P}$ to $\mathbb{Q}$ . Following Villani (2009), $\mathcal{W}_1(\mathbb{P},\mathbb{Q})$ is defined by:
+
+$$
+\mathcal {W} _ {1} (\mathbb {P}, \mathbb {Q}) \triangleq \inf _ {\pi} \mathbb {E} _ {(X _ {1}, X _ {2}) \sim \pi} [ \| X _ {1} - X _ {2} \| ],
+$$
+
+where the infimum is taken over all Borel probability measures $\pi$ on $K^2$ with marginals $\mathbb{P}$ and $\mathbb{Q}$ . The metric space $(\mathcal{P}_1(K),\mathcal{W}_1)$ is named the Wasserstein space over $K$ ; we abbreviate it by $\mathcal{P}_1(K)$ .
+
+Smooth Function Spaces The set of real-valued continuous functions on $\mathbb{R}^n$ is denoted by $C(\mathbb{R}^n)$ . Let $k\in \mathbb{N}_{+}$ and $\mathcal{X}\subseteq [0,1]^n$ be non-empty. The set of functions $f:\mathcal{X}\to K$ for which there is a $k$ -times continuously differentiable $\pmb {f}:\mathbb{R}^n\rightarrow \mathbb{R}^m$ extending $f$ ; i.e.: $\pmb {f}|_{\mathcal{X}} = f$ , is denoted by $C_{tr}^{k}(\mathcal{X},K)$ . Our interest in $C_{tr}^{k}(\mathcal{X},K)$ does not stem from the fact that it contains all smooth functions mapping $[0,1]^n$ to $K$ , but rather that it allows us to speak about the uniform approximation of discontinuous $K$ -valued functions on regions in $[0,1]^n$ where they are "regular". This is noteworthy for pathological constraint sets, such as integer constraints7. For details on $C_{tr}^{k}(\mathcal{X},K)$ , see (Brudnyi & Brudnyi, 2012a;b) and the extension theorems of Whitney (1934); Fefferman (2005).
+
+Neural Networks It has recently been observed that deep feedforward networks with multiple activation functions, or more generally parametric families of activation functions, achieved significantly more efficient approximation rates than classical feedforward networks with a single activation function (Yarotsky & Zhevnerchuk, 2020; Yarotsky, 2021; Shen et al., 2021a,b). Practically deployed examples of parametric activation functions are the PReLU activation function of He et al. (2015), the Sigmoid-weighted Linear Unit (SiLU) of Elfwing et al. (2018), and the Swish activation function of Ramachandran et al. (2018). We also observe a similar phenomenon, and therefore our quantitative results consider deep feedforward networks whose activation functions belong to a 1-parameter family $\sigma_{\star} \triangleq \{\sigma_t\}_{t \in [0,1]} \subseteq C(\mathbb{R})$ . The set of all such networks is denoted by $\mathcal{N}\mathcal{N}_{n,N}^{\sigma_{\star}}$ and it includes all $\hat{f}: \mathbb{R}^n \to \mathbb{R}^N$ with iterative representation:
+
+$$
+\hat {f} (x) \triangleq A ^ {(J)} x ^ {(J)}, \quad x _ {i _ {j}} ^ {(j + 1)} \triangleq \sigma_ {t _ {i _ {j}}} \left(\left(A ^ {(j)} x\right) _ {i _ {j}} + b _ {i _ {j}} ^ {(j)}\right), \quad x ^ {(0)} \triangleq x, \tag {5}
+$$
+
+where $x \in \mathbb{R}^n$ , $j = 1, \ldots, J - 1$ , each $A^{(j)}$ is a $d_j \times d_{j + 1}$ -matrix, each $b^{(j)} \in \mathbb{R}^{d_{j + 1}}$ , $d_{J + 1} = N$ , $d_1 = 0, t_{1,1}, \ldots, t_{J,N_J} \in [0,1]$ , for each $j$ . The integer $J$ is $\hat{f}$ 's depth and $\max_{j = 1,\dots,J + 1} d_j$ is $\hat{f}$ 's width.
+
+Example 1.6 (Networks with Untrainable Nonlinearity). Denote $\sigma \triangleq \sigma_0$ . The subset of classical feedforward networks consisting of all $\hat{f} \in \mathcal{N}\mathcal{N}_{n,N}^{\sigma_\star}$ with each $\sigma_{t_{i_j}} = \sigma$ in (5) is denoted $\mathcal{N}\mathcal{N}_{n,N}^{\sigma}$ .
+
+It is approximation theoretically advantageous to generalize the proposed definition of probabilistic attention in the introduction (3) by replacing $Y$ with a 3-dimensional array (elementary 3-tensor).
+
+Definition 1.7 (Probabilistic Attention). Let $N, Q, m \in \mathbb{N}_{+}$ , and $Y$ be an $N \times Q \times m$ -array with $Y_{n,q} \in K$ for $n = 1, \ldots, N$ , $q = 1, \ldots, Q$ . Probabilistic attention is the function:
+
+$$
+\mathbb {R} ^ {n} \ni w \mapsto \operatorname {P - a t t e n t i o n} (w, Y) \triangleq \frac {1}{Q} \sum_ {n = 1} ^ {N} \sum_ {q = 1} ^ {Q} \operatorname {S o f t m a x} _ {N} (w) _ {n} \delta_ {Y _ {n, q}} \in \mathcal {P} _ {1} (K).
+$$
+
+If $Y$ is an $N \times m$ -matrix, as in (3), then we identify $Y$ as the $N \times m \times 1$ -array in the obvious manner.
+
+Set-Valued Analysis: A family of non-empty subsets $\{C_x\}_{x \in \mathbb{R}^n}$ of $K$ is said to be a weakly measurable correspondence, denoted $C: \mathbb{R}^n \Rightarrow \mathbb{R}^m$ , if for every open subset $U \subseteq K$ , $\{x \in \mathbb{R}^n: C_x \cap U \neq \emptyset\}$ is a non-empty Borel subset of $\mathbb{R}^n$ (Aliprantis & Border, 2006, pages 557, 592).
+
+# 2 MAIN RESULTS
+
+We now present our main results in detail. All proofs are relegated to the paper's appendix.
+
+# 2.1 QUALITATIVE APPROXIMATION: DEEP MAXIMUM THEOREM
+
+Our main qualitative result is the following deep neural version of Berge (1963)'s Maximum Theorem where, the measurable selector is approximately implemented by a probabilistic transformer
+
+network. We first present the general qualitative result which gives a concrete description of a measurable selector of (1), with high-probability, which has the key property that all its predictions satisfy the required constraints defined by $K$ .
+
+Assumption 2.1 (Kidger & Lyons (2020)). $\sigma : \mathbb{R} \to \mathbb{R}$ is continuous, $\sigma$ is differentiable at some $x_0 \in \mathbb{R}$ , and its derivative satisfies $\sigma'(x_0) \neq 0$ .
+
+Theorem 2.2 (Deep Maximum Theorem). Let $\sigma$ satisfy Assumption 2.1. Let $K\subseteq \mathbb{R}^n$ be a nonempty compact set, $C:\mathbb{R}^n\Rightarrow \mathbb{R}^m$ be a weakly-measurable correspondence with closed values such that $C_x\cap K\neq \emptyset$ for each $x\in \mathbb{R}^n$ , $L\in C(\mathbb{R}^m)$ , and $\mathbb{P}$ be a Borel probability measure on $\mathbb{R}^n$ .
+
+For each $0 < \epsilon \leq 1$ , there is an $N \in \mathbb{N}_+$ , an $\hat{f} \in \mathcal{NN}_{n,N}^{\sigma}$ of width at most $2 + n + N$ , and an $N \times m$ -matrix $Y$ such that:
+
+$$
+\hat {F}: \mathbb {R} ^ {n} \ni x \mapsto \operatorname {P - a t t e n t i o n} (\hat {f} (x), Y) \in \mathcal {P} _ {1} (\mathbb {R} ^ {m}), \tag {6}
+$$
+
+satisfies the following:
+
+(i) Exact Constrain Satisfaction: $\cup_{x\in \mathbb{R}^n}\operatorname {supp}(\hat{F} (x))\subseteq K,$
+
+(ii) Probably Approximately Optimality: There is a compact $\mathcal{X}_{\epsilon} \subseteq \mathbb{R}^{n}$ satisfying:
+
+(a) $\max_{x\in \mathcal{X}_{\epsilon}}\mathcal{W}_1(\hat{F} (x),\underset {y\in C_x\cap K}{\arg \min}L(x,y))\leq \epsilon ,$
+(b) $1 - \mathbb{P}(\mathcal{X}_{\epsilon})\leq \epsilon$
+
+Theorem 2.2 implies that for any random field $(Y^{x})_{x\in \mathbb{R}^{n}}$ on $\mathbb{R}^m$ (i.e. a family of $\mathbb{R}^m$ -valued random vectors indexed by $\mathbb{R}^n$ ) with $Y^{x}\sim \hat{F} (x)$ : 1. samples drawn from $Y^{x}$ are in $K$ (by (i)) and 2. samples drawn from each $Y^{x}$ are near to the optimality set $\mathrm{argmin}_{y\in C_x\cap K}L(x,y)$ (by (ii)).
+
+Corollary 2.3 ( $\hat{F}$ 's Mean Prediction). Assume the setting of Theorem 2.2. Let $\{Y^x\}_{x \in \mathbb{R}^n}$ be a $K$ -valued random field with $Y^x \sim \hat{F}(x)$ for each $x \in \mathbb{R}^n$ then, $1 - \mathbb{P}(\mathcal{X}_\epsilon) \leq \epsilon$ and
+
+$$
+\max _ {x \in \mathcal {X} _ {\epsilon}} \mathbb {E} \big [ \| Y ^ {x} - \operatorname * {a r g m i n} _ {y ^ {\star} \in C _ {x} \cap K} L (x, y ^ {\star}) \| \big ] \leq \epsilon .
+$$
+
+Appendix 8 contains additional consequences of the Deep Maximum Theorem, such as the special case of classical transformers when $K$ is convex. Next, we complement our qualitative results by their quantitative analogues, within the context of universal approximation under constraints.
+
+# 2.2 QUANTITATIVE APPROXIMATION: CONSTRAINED UNIVERSAL APPROXIMATION
+
+In order to derive a quantitative constrained universal approximation theorem, we require the loss function to be tied to the Euclidean norm in the following manner.
+
+Assumption 2.4 (Norm-Controllable Loss). There is a continuous $f: \mathbb{R}^n \to \mathbb{R}^m$ with $f(\mathbb{R}^n) \subseteq K$ and a continuous $l: [0, \infty) \to [0, \infty)$ with $l(0) = 0$ , satisfying: $L(x, y) \leq l(\|f(x) - y\|)$ .
+
+Just as with transformer networks, our "constrained universal approximation theorem" approximates a suitably regular function $f: \mathbb{R}^n \to K \subseteq \mathbb{R}^m$ while exactly respecting the constraints $K$ by implementing an encoder-decoder network architecture. Thus, our model is a composition of an encoder network $\hat{\mathcal{E}}: \mathbb{R}^n \to \mathbb{R}^d$ whose role is to approximate $f$ in a classical "unconstrained fashion" and a decoder network (with probabilistic attention layers at its output) $\hat{\mathcal{D}}: \mathbb{R}^d \to \mathcal{P}_1(K)$ whose role is to enforce the constraints $K$ while preserving the approximation performed by $\hat{\mathcal{E}}$ , where $d \ll m$ .
+
+To take advantage of the encoder-decoder framework present in most transformer networks, we formalize what is often called a "latent low-dimensional manifold" hypothesis. Briefly, this means that, the hard constraints in set $K$ are contained in a "low dimensional" subspace.
+
+Assumption 2.5 (Low-Dimensional Manifold). There is an $0 < s$ and a smooth bijection $\Phi$ from $\mathbb{R}^n$ to itself with smooth inverse, such that $\Phi(K) \subseteq \mathbb{R}^d$ ; where $2 \leq d$ and $d \in \Theta(m^{\frac{1}{s}})$ .
+
+Assumption 2.5 does not postulate that $K$ is itself a single-chart low-dimensional manifold, or even a manifold. Rather, $K$ need only be contained in a low-dimensional manifold. For the fast rates we use activation functions generalizing the swish function (Ramachandran et al., 2018) as follows.
+
+Assumption 2.6 (Swish-Like Activation Function). The map $\sigma : [0,1] \times \mathbb{R} \ni (\alpha, t) \mapsto \sigma_{\alpha}(t) \in \mathbb{R}$ is continuous; $\sigma_0$ is non-affine and piecewise-linear; and $\sigma_1$ is smooth10 and non-polynomial.
+
+Theorem 2.7 (Constrained Universal Approximation). Let $k \in \mathbb{N}_{+}$ and $\mathcal{X} \subseteq [0,1]^n$ be non-empty. Suppose that $\sigma$ satisfies 2.6, $L$ satisfies Assumption 2.4, $K \subseteq \mathbb{R}^n$ is non-empty, compact and satisfies Assumption 2.5. For any $f \in C_{tr}^{k}(\mathcal{X},K)$ , every constraining quality $\epsilon_K > 0$ , and every approximation error $\epsilon_f > 0$ , there exist $N, Q \in \mathbb{N}_{+}$ , an encoder $\hat{\mathcal{E}} \in \mathcal{NN}_{n,d}^{\sigma}$ , and a decoder:
+
+$$
+\hat {\mathcal {D}}: \mathbb {R} ^ {d} \ni x \mapsto \sum_ {k = 1} ^ {N} \text {P - a t t e n t i o n} (\hat {D} (x), Y) \in \mathcal {P} _ {1} (K) \tag {7}
+$$
+
+where $\hat{D} \in \mathcal{N}\mathcal{N}_{d,N}^{\sigma}$ and $Y$ is an $N \times Q \times m$ -array with $Y_{1,1}, \ldots, Y_{N,Q} \in K$ such that:
+
+(i) Exact Constrain Satisfaction: For each $x \in \mathbb{R}^n$ : $\operatorname{supp}(\hat{\mathcal{D}} \circ \hat{\mathcal{E}}(x)) \subseteq K$
+(ii) Universal Approximation: The estimate holds $^{11}$ :
+
+$$
+\sup_{x\in [0,1]^{n}}\mathcal{W}_{1}(\hat{\mathcal{D}}\circ \hat{\mathcal{E}} (x),\operatorname *{argmin}_{y\in K}L(x,y))\leq \epsilon_{K} + k \mathrm{Lip}(\Phi^{-1})d\epsilon_{f};
+$$
+
+where, $0 < k$ is an absolute constant independent of $n$ , $m$ , $d$ , $f$ , and of $\epsilon$ and $\mathrm{Lip}(\Phi^{-1})$ denotes the Lipschitz constant of $\Phi^{-1}$ on the compact set $\{z \in \mathbb{R}^d : \| z - \Phi(K) \| \leq \epsilon_f\}$ .
+
+Furthermore, the "complexities" of $\hat{\mathcal{D}}$ and $\hat{\mathcal{E}}$ are recorded in Table12 1 for $\frac{\epsilon}{2} = \epsilon_{k} = \epsilon_{f}$
+
+In practice, we can only sample from each measure $\hat{\mathcal{D}}\circ \hat{\mathcal{E}} (x)$ . In this case, we may ask how the typical sample drawn from a random-vector $Y^{x}$ distributed according to our learned measure $\hat{\mathcal{D}}\circ \hat{\mathcal{E}} (x)$ performs when minimizing $L(x,y)$ . The next result relates the estimates in Theorem 2.7 (ii) to the typical (in $Y^{x}$ ) worst-case (in $x$ ) gap between a sample from $Y^{x}$ and $f(x)$ , as quantified by $L(x,\cdot)$ .
+
+Corollary 2.8 (Average Worst-Case Loss). Assume the setting of Theorem 2.7 and suppose that the "modulus" $l$ in Assumption 2.4 is strictly increasing and concave. Let $\hat{\mathcal{D}}$ and $\hat{\mathcal{E}}$ be as in Theorem 2.7 and let $\{Y^x\}_{x \in \mathcal{X}}$ be an $\mathbb{R}^m$ -valued random field with $Y^x \sim \hat{\mathcal{D}} \circ \hat{\mathcal{E}}(x)$ , for each $x \in \mathbb{R}^n$ . Then:
+
+$$
+\max _ {x \in \mathcal {X}} \mathbb {E} _ {Y ^ {x} \sim \hat {\mathcal {D}} \circ \hat {\mathcal {E}} (x)} [ L (x, Y ^ {x}) ] \leq l \left(\epsilon_ {K} + k \operatorname {L i p} \left(\Phi^ {- 1}\right) d \epsilon_ {f}\right).
+$$
+
+Corollary 2.8 quantifies the expected performance of a sample from our probabilistic transformer model, as expressed by $L$ , whereas Theorem 2.7 (ii) quantifies the difference from the transformer's prediction to the optimal prediction value. Next, we consider implications of our main results.
+
+# 2.3 APPLICATIONS
+
+We apply our theory to obtain a universal approximation theorem for classical transformer networks with exact convex constraint satisfaction and to derive a version of the non-Euclidean universal approximation theorems of Kratsios & Bilokopytov (2020); Kratsios & Papon (2021) for Riemannian-manifold valued functions which does not need explicit charts. As with most quantitative (uniform) universal approximation theorems (Guhring et al., 2020; Kidger & Lyons, 2020; Shen et al., 2021a), we henceforth consider $L(x,y) = \| f(x) - y\|$ . We also fix $f\in C_{tr}^{k}([0,1]^{n},K)$ .
+
+# 2.3.1 TRANSFORMERS ARE CONVEX-CONSTRAINED UNIVERSAL APPROXIMATORS
+
+We return to the familiar transformer networks of Vaswani et al. (2017). The next result shows that transformer networks can balance universal approximation and exact convex constraint satisfaction. This is because when $K$ is convex, then the mean of the random field $\{Y^x\}_{x \in \mathbb{R}^n}$ of Corollary 2.3 must belong to $K$ . Consequently, the identity (4) implies that $\text{Attention}(\hat{\mathcal{D}} \circ \hat{\mathcal{E}}(\cdot), Y) \approx f$ .
+
+Corollary 2.9 (Constrained Universal Approximation: Convex Constraints). Consider the setting and notation of Corollary 2.8. Suppose that $K$ is convex and let $L(x,y) = \| f(x) - y\|$ . Then:
+
+$$
+\mathbb {R} ^ {n} \ni x \mapsto \mathbb {E} \left[ Y ^ {x} \right] = \operatorname {A t t e n t i o n} \left(\hat {\mathcal {D}} \circ \hat {\mathcal {E}} (x), Y\right) \in K; \tag {8}
+$$
+
+(i) Exact Constraint Satisfaction: $\mathbb{E}_{Y^x\sim \hat{\mathcal{D}}_0\hat{\mathcal{E}} (x)}[Y^x ]\in K,$ for each $x\in \mathbb{R}^n$
+(ii) Universal Approximation: $\sup_{[0,1]^n}\| f(x) - \mathbb{E}_{Y^x\sim \hat{\mathcal{D}}\circ \hat{\mathcal{E}} (x)}[Y^x ]\| < \epsilon_K + kd\epsilon_f.$
+
+The "complexities" of the networks $\hat{\mathcal{D}}$ and $\hat{\mathcal{E}}$ are recorded in Table 13 $I$ for $\frac{\epsilon}{2} = \epsilon_{k} = \epsilon_{f}$
+
+11In fact, we actually prove that the slightly stronger statement: $\sup_{x\in [0,1]^n}\mathcal{W}_1\left(\hat{\mathcal{D}}\circ \hat{\mathcal{E}} (x),\delta_{f(x)}\right)\leq \epsilon_K + k\operatorname {Lip}(\Phi^{-1})d\epsilon_f$ . Both formulations align when $l$ has a unique minimum at 0, as is the case when $L(x,y) = \| f(x) - y\|_{\star}$ and $\| \cdot \|_{\star}$ is any norm on $\mathbb{R}^m$ .
+12 Explicit constants are recorded in Table 2 within the paper's appendix; there, $\epsilon_{K}$ and $\epsilon_{f}$ may differ.
+13 Explicit constants are recorded in Table 2 within the paper's appendix; there, $\epsilon_{K}$ and $\epsilon_{f}$ may differ.
+
+# 2.3.2 CHART-FREE RIEMANNIAN MANIFOLD-VALUED UNIVERSAL APPROXIMATION
+
+We explore how additional non-convex structure of the constraint set $K$ can be encoded by the probabilistic transformer networks of Theorems 2.2 and 2.7 and be used to build new types of (deterministic) transformer networks. These results highlight that the standard transformer networks of (8) are specialized for convex constraints and that by instead using an intrinsic variant of expectation, we build can new types of "geometric transformer networks" customized to $K$ 's geometry. This section makes use of Riemannian geometry; for an overview see Jost (2017).
+
+Let $(M,g)$ be a connected $d$ -dimensional Riemannian submanifold of $\mathbb{R}^m$ with distance function by $d_g$ . We only require the following mild assumption introduced in Afsari (2011). We recall that the injectivity radius at $y_0$ , denoted by $\inf_g(y_0)$ , (see (Jost, 2017, Definition 1.4.6)) is the minimum length of a geodesic (or minimal length curve) in $M$ with starting point $y_0$ . We also recall that the sectional curvature (see (Jost, 2017, Definition 4.3.2) for a formal statement) quantifies the curvature of $(M,g)$ as compared the geometry of its flat counterpart $\mathbb{R}^d$ . We focus on a broad class of nonconvex constraints, namely geodesically convex constraints, which generalize convex constraint and have received recent attention in the optimization literature (Zhang & Sra, 2016; Liu et al., 2017).
+
+Assumption 2.10 (Geodesically Convex Constraints). The Riemannian manifold $(M,g)$ is connected, it is complete as a metric space, and all its sectional curvatures of $(M,g)$ are all bounded above by a constant $C\geq 0$ . The non-empty constrain set $K$ satisfies:
+
+1. $K$ is contained in the geodesic ball $B(y_0, \rho) \triangleq \{y \in M : d_g(y_0, y) < \rho\}$ for some point $y_0 \in M$ and some radius $\rho$ satisfying14: $0 < \rho < 2^{-1} \min \{\mathrm{inj}_g(y_0), \frac{\pi}{\sqrt{C}}\}$ ,
+2. For each $y_0, y_1 \in K$ there exists a unique geodesic $\gamma : [0,1] \to K$ joining $y_0$ to $y_1$ .
+
+Our latent probabilistic representation grants us the flexibility of replacing the usual "extrinsic mean" used in (8) to extract deterministic predictions from our probabilistic transformer networks via an additional Fréchet mean layer at their readout. This intrinsic notion of a mean, was introduced independently in Fréchet (1948) and in Karcher (1977), and is defined on any $\mathbb{P} \in \mathcal{P}_1(K)$ by:
+
+$$
+\bar {\mathbb {P}} \triangleq \underset {k \in K} {\operatorname {a r g m i n}} \int d _ {g} ^ {2} (k, u) \mathbb {P} (d u). \tag {9}
+$$
+
+With this "geometric readout layer" added to our model, we obtain the following variants of our main results in this non-convex, but geometrically regular, setting.
+
+Corollary 2.11 (Constrained Universal Approximation: Riemannian Case). Consider the setting and notation of Corollary 2.8. Let $L(x,y) = \| f(x) - y\|$ . If Assumption 2.10 holds then:
+
+$$
+\mathbb {R} ^ {n} \ni x \mapsto \widehat {\mathcal {D}} \circ \widehat {\mathcal {E}} (x) \in K, \tag {10}
+$$
+
+is a well-defined Lipschitz-continuous function, and the following hold:
+
+(i) Exact Constraint Satisfaction: $\overline{\hat{D} \circ \hat{\mathcal{E}}(x)} \in K$ , for each $x \in \mathcal{X}$ ,
+(ii) Universal Approximation: $\sup_{\mathcal{X}}d_g(f(x),\hat{\mathcal{D}}\circ \hat{\mathcal{E}} (x)) < \epsilon_K + kd\epsilon_f$
+
+The "complexities" of $\hat{\mathcal{D}}$ and $\hat{\mathcal{E}}$ are recorded in Table15 1 for $\frac{\epsilon}{2} = \epsilon_{k} = \epsilon_{f}$ .
+
+# 3 DISCUSSION
+
+In this paper, we derived the first constrained universal approximation theorems using probabilistic reformation of Vaswani et al. (2017)'s transformer networks. The results assumed both a quantitative form (Theorem 2.7) and a qualitative form in the more general case of an arbitrary loss functions $L$ and additional compatible soft constraints in (Theorem 2.2). Our results provide (generic) direction to end-users designing deep learning models processing non-vectorial structures and constraints.
+
+As this is the first approximation theoretic result in this direction, there are naturally as many questions raised as have been answered. In particular, it is natural to ask: "Are the probabilistic transformer networks trainable in practice; especially when $K$ is non-convex?" In Appendix 5, we show that the answer is indeed: "Yes!", by proposing a training algorithm in that direction and showing that we outperform an MLP model and a classical transformer network in terms of a joint MSE and distance to the constraint set. The evaluation is performed on a large number of randomly generated experiments, whose objective is to reduce the MSE to a randomly generated function mapping a high-dimensional Euclidean space to there sphere $\mathbb{R}^3$ with outputs constrained to the sphere.
+
+# ACKNOWLEDGMENTS
+
+Anastasis Kratsios and Ivan Dokmanić were supported by the European Research Council (ERC) Starting Grant 852821—SWING. The authors thank Wahid Khosrawi-Sardroudi, Phillip Casgrain, and Hanna Sophia Wutte from ETH Zürich, Valentin Debarnot from the University of Basel for their helpful feedback, and Sven Seuken from the University of Zürich for his helpful feedback in the rebuttal phase.
+
+# REFERENCES
+
+Bijan Afsari. Riemannian $L^p$ center of mass: existence, uniqueness, and convexity. Proceedings of the American Mathematical Society, 139(2):655-673, 2011.
+Charalambos D. Aliprantis and Kim C. Border. Infinite dimensional analysis: A hitchhiker's guide. Springer, Berlin, third edition, 2006.
+Luigi Ambrosio and Daniele Puglisi. Linear extension operators between spaces of Lipschitz maps and optimal transport. Journal für die Reine und Angewandte Mathematik, 764:1-21, 2020.
+Anonymized. Pytorch implementation of attend-to-constraints, 2021. URL https://drive.google.com/file/d/1vryYsUmHt0fok3Mrje6oN9Tjs2UmpgkA/view.
+Jean-Pierre Aubin and Hélène Frankowska. Set-valued analysis. Modern Birkhäuser Classics. Birkhäuser Boston, Inc., Boston, MA, 2009.
+Michel Baes, Calypso Herrera, Ariel Neufeld, and Pierre Ruyssen. Low-rank plus sparse decomposition of covariance matrices using neural network parametrization. IEEE Transaction on Neural Networks and Learning Systems, 2021.
+Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In Proceedings of the International Conference on Learning Representations (ICLR), 2015.
+Yair Bartal. On approximating arbitrary metrics by tree metrics. In Proceedings of the Thirtieth Annual ACM Symposium on the Theory of Computing, pp. 161-168. ACM, New York, 1999.
+Basel Committee on Banking Supervision. Fundamental review of the trading book: outstanding issues, February 2015. https://www.bis.org/bcbs/publ/d305.pdf.
+Basel Committee on Banking Supervision. Minimum capital requirements for market risk, February 2019. https://www.bis.org/bcbs/publ/d457.pdf.
+Heinz H. Bauschke and Patrick L. Combettes. Convex analysis and monotone operator theory in Hilbert spaces. CMS Books in Mathematics/Ouvrages de Mathématiques de la SMC. Springer, New York, 2011. ISBN 978-1-4419-9466-0. doi: 10.1007/978-1-4419-9467-7. URL https://doi.org/10.1007/978-1-4419-9467-7. With a foreword by Hédy Attouch.
+Claude Berge. Espaces Topologiques (Topological Spaces). Dunod, 1963.
+Rabi Bhattacharya and Vic Patrangenaru. Large sample theory of intrinsic and extrinsic sample means on manifolds. The Annals of Statistics, 31(1):1-29, 2003.
+Silvère Bonnabel and Rodolphe Sepulchre. Riemannian metric and geometric mean for positive semidefinite matrices of fixed rank. SIAM Journal on Matrix Analysis and Applications, 31(3): 1055-1070, 2009.
+Silvère Bonnabel, Anne Collard, and Rodolphe Sepulchre. Rank-preserving geometric means of positive semi-definite matrices. Linear Algebra and its Applications, 438(8):3202-3216, 2013.
+Michael M Bronstein, Joan Bruna, Yann LeCun, Arthur Szlam, and Pierre Vandergheynst. Geometric deep learning: going beyond Euclidean data. IEEE Signal Processing Magazine, 34(4):18-42, 2017.
+
+Michael M Bronstein, Joan Bruna, Taco Cohen, and Petar Velicković. Geometric deep learning: Grids, Groups, Graphs, Geodesics, and Gauges. arXiv:2104.08708, 2021. URL http://arxiv.org/abs/2104.13478.
+Bernard Bru, Henri Heinich, and Jean-Claude Lootgieter. Distances de Lévy et extensions des théorèmes de la limite centrale et de Glivenko-Cantelli. Publ. Inst. Statist. Univ. Paris, 37(3-4): 29-42, 1993.
+Alexander Brudnyi and Yuri Brudnyi. Methods of geometric analysis in extension and trace problems. Volume 1, volume 102 of Monographs in Mathematics. Birkhäuser/Springer Basel AG, Basel, 2012a.
+Alexander Brudnyi and Yuri Brudnyi. Methods of geometric analysis in extension and trace problems. Volume 2, volume 103 of Monographs in Mathematics. Birkhäuser/Springer Basel AG, Basel, 2012b.
+Elia Brue, Simone Di Marino, and Federico Stra. Linear Lipschitz and $C^1$ extension operators through random projection. Journal of Functional Analysis, 280(4):108868, 2021.
+Luiz Chamon and Alejandro Ribeiro. Probably approximately correct constrained learning. In Proceedings of Advances in Neural Information Processing Systems (NeurIPS), 2020.
+Michele Conforti, Gérard Cornuéjols, and Giacomo Zambelli. *Integer Programming*, volume 271 of Graduate Texts in Mathematics. Springer, Cham, 2014.
+Christa Cuchiero, Lukas Gonon, Lyudmila Grigoryeva, Juan-Pablo Ortega, and Josef Teichmann. Discrete-time signatures and randomness in reservoir computing. IEEE Transactions on Neural Networks and Learning Systems, pp. 1-10, 2021.
+Marco Cuturi. Sinkhorn distances: Lightspeed computation of optimal transport. In Proceedings of Advances in Neural Information Processing Systems (NeurIPS), pp. 2292-2300, 2013.
+George Cybenko. Approximation by superpositions of a sigmoidal function. Mathematics of Control, Signals, and Systems, 2(4):303-314, 1989.
+Meng Ding and Guoliang Fan. Multilayer joint gait-posed manifolds for human gait motion modeling. IEEE Transactions on Cybernetics, 45(11):2413-2424, 2014.
+Ivan Dokmanic, Reza Parhizkar, Juri Ranieri, and Martin Vetterli. Euclidean distance matrices: Essential theory, algorithms, and applications. IEEE Signal Processing Magazine, 32(6):12-30, 2015. doi: 10.1109/MSP.2015.2398954.
+Richard M. Dudley. Real analysis and probability, volume 74 of Cambridge Studies in Advanced Mathematics. Cambridge University Press, Cambridge, 2002.
+Stefan Elfwing, Eiji Uchibe, and Kenji Doya. Sigmoid-weighted linear units for neural network function approximation in reinforcement learning. *Neural Networks*, 107:3-11, 2018.
+Charles L. Fefferman. A sharp form of Whitney's extension theorem. Annals of Mathematics, 161 (1):509-577, 2005.
+Thomas Fletcher. Geodesic regression and the theory of least squares on Riemannian manifolds. International Journal of Computer Vision, 105(2):171-185, 2013.
+Maurice Fréchet. Les éléments aléatoires de nature quelconque dans un espace distancié. Annales de l'Institut Henri Poincaré, 10:215-310, 1948.
+Lukas Gonon, Lyudmila Grigoryeva, and Juan-Pablo Ortega. Risk bounds for reservoir computing. Journal of Machine Learning Research, 21(240):1-61, 2020a. URL http://jmlr.org/papers/v21/19-902.html.
+Lukas Gonon, Lyudmila Grigoryeva, and Juan-Pablo Ortega. Approximation bounds for random neural networks and reservoir systems. arXiv preprint arXiv:2002.05933, 2020b.
+
+Lyudmila Grigoryeva and Juan-Pablo Ortega. Universal discrete-time reservoir computers with stochastic inputs and linear readouts using non-homogeneous state-affine systems. J. Mach. Learn. Res., 19:Paper No. 24, 40, 2018.
+Lyudmila Grigoryeva and Juan-Pablo Ortega. Differentiable reservoir computing. J. Mach. Learn. Res., 20:Paper No. 179, 62, 2019.
+Ingo Guhring, Gitta Kutyniok, and Philipp Petersen. Error bounds for approximations with deep ReLU neural networks in $W^{s,p}$ norms. Analysis and Applications, 18(5):803-859, 2020.
+Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on ImageNet classification. In Proceedings of the IEEE international conference on computer vision, pp. 1026-1034, 2015.
+Juha Heinonen. Lectures on analysis on metric spaces. Universitext. Springer-Verlag, New York, 2001.
+Ludger Holters, Björn Bahl, Maike Hennen, and André Bardow. Playing Stackelberg games for minimal cost for production and utilities. In ECOS 2018-Proceedings of the 31st International Conference on Efficiency, Cost, Optimisation, Simulation and Environmental Impact of Energy Systems, pp. 36-36. University of Minho, 2018.
+Kurt Hornik, Maxwell Stinchcombe, and Halbert White. Multilayer feedforward networks are universal approximators. Neural Network, 2(5):359-366, July 1989.
+Chi Jin, Praneeth Netrapalli, and Michael Jordan. What is local optimality in nonconvex-nonconcave minimax optimization? In Proceedings of the International Conference on Machine Learning (ICML), 2020.
+William B. Johnson and Joram Lindenstrauss. Extensions of Lipschitz mappings into a Hilbert space. In Conference in modern analysis and probability, volume 26 of Contemp. Math., pp. 189-206. American Mathematical Society, RI, 1984.
+Jürgen Jost. Riemannian geometry and geometric analysis. Universitext. Springer, Heidelberg, seventh edition, 2017.
+Heinrich W. E. Jung. Über die Cremonasche Transformation der Ebene. J. Reine Angew. Math., 138:255-318, 1910. ISSN 0075-4102. doi: 10.1515/crll.1910.138.255.
+Olav Kallenberg. Foundations of modern probability, volume 99 of Probability Theory and Stochastic Modelling. Springer, Cham, third edition, 2021.
+Hermann Karcher. Riemannian center of mass and mollifier smoothing. Communications on Pure and Applied Mathematics, 30(5):509-541, 1977.
+Patrick Kidger and Terry Lyons. Universal approximation with deep narrow networks. In Jacob Abernethy and Shivani Agarwal (eds.), Proceedings of Machine Learning Research, volume 125, pp. 2306-2327. PMLR, 09-12 Jul 2020.
+Achim Klenke. Probability theory: A comprehensive course. Universitext. Springer, London, second edition, 2014.
+Soheil Kolouri, Kimia Nadjahi, Umut Simsekli, Roland Badeau, and Gustavo Rohde. Generalized sliced Wasserstein distances. In Proceedings of Advances in Neural Information Processing Systems (NeurIPS), 2019.
+Anastasis Kratsios. Universal regular conditional distributions. arXiv preprint:2105.07743, 2021. URL https://arxiv.org/abs/2105.07743.
+Anastasis Kratsios and Eugene Bilokopytov. Non-Euclidean universal approximation. In Proceedings of Advances in Neural Information Processing Systems (NeurIPS), 2020.
+Anastasis Kratsios and Leonie Papon. Universal approximation theorems for differentiable geometric deep learning, 2021. URL https://arxiv.org/abs/2101.05390.
+
+James R. Lee and Assaf Naor. Extending Lipschitz functions via random metric partitions. Inventiones Mathematicae, 160(1):59-95, 2005.
+Haochuan Li, Yi Tian, Jingzhao Zhang, and Ali Jabbabaie. Complexity lower bounds for nonconvex-strongly-concave min-max optimization. arXiv:2104.08708, 2021. URL https://arxiv.org/abs/2104.08708.
+Yuanyuan Liu, Fanhua Shang, James Cheng, Hong Cheng, and Licheng Jiao. Accelerated first-order methods for geodesically convex optimization on riemannian manifolds. In Proceedings of Advances in Neural Information Processing Systems (NeurIPS), 2017.
+Aaron Lou, Isay Katsman, Qingxuan Jiang, Serge Belongie, Ser-Nam Lim, and Christopher De Sa. Differentiating through the Fréchet mean. In Proceedings of the International Conference on Machine Learning (ICML), 2020.
+Cosme Louart, Zhenyu Liao, and Romain Couillet. A random matrix approach to neural networks. Ann. Appl. Probab., 28(2):1190-1248, 2018. ISSN 1050-5164. doi: 10.1214/17-AAP1328. URL https://doi.org/10.1214/17-AAP1328.
+Mantas Lukosovicius and Herbert Jaeger. Reservoir computing approaches to recurrent neural network training. Computer Science Review, 3(3):127-149, 2009. ISSN 1574-0137.
+Alexander J. McNeil, Rüdiger Frey, and Paul Embrechts. Quantitative Risk Management: Concepts, Techniques and Tools. Princeton Series in Finance. Princeton University Press, Princeton, NJ, 2015.
+Nina Miolane, Nicolas Guigui, Alice Le Brigant, Johan Mathe, Benjamin Hou, Yann Thanwerdas, Stefan Heyder, Olivier Peltre, Niklas Koep, Hadi Zaatiti, Hatem Hajri, Yann Cabanes, Thomas Gerald, Paul Chauchat, Christian Shewmake, Daniel Brooks, Bernhard Kainz, Claire Donnat, Susan Holmes, and Xavier Pennec. Geomstats: A python package for riemannian geometry in machine learning. Journal of Machine Learning Research, 21(223):1-9, 2020.
+Theodore Samuel Motzkin. Sur quelques propriétés caractéristiques des ensembles bornés non convexes. Bardi, 1935.
+James R. Munkres. Topology. Prentice Hall, Inc., Upper Saddle River, NJ, 2000. Second edition.
+Shin-ichi Ohta. Extending Lipschitz and Hölder maps between metric spaces. Positivity, 13(2): 407-425, 2009.
+Sejun Park, Chulhee Yun, Jaeho Lee, and Jinwoo Shin. Minimum width for universal approximation. International Conference on Learning Representations (ICLR), 2021.
+Ofir Pele and Michael Werman. Fast and robust Earth Mover's distances. In Proceedings of the 12th IEEE International Conference on Computer Vision (ICCV), pp. 460-467, 2009.
+Philipp Petersen and Felix Voigtlaender. Equivalence of approximation by convolutional neural networks and fully-connected networks. Proceedings of the American Mathematical Society, 148 (4):1567-1581, 2020.
+Allan Pinkus. Approximation theory of the MLP model in neural networks. Acta Numerica, 1999, 8:143-195, 1999.
+Chayne Planiden and Xianfu Wang. Most convex functions have unique minimizers. Journal of Convex Analysis, 23(3):877-892, 2016.
+Pakize Simin Pulat. On the relation of max-flow to min-cut for generalized networks. European Journal of Operational Research, 39(1):103-107, 1989.
+Michael Puthawala, Konik Kothari, Matti Lassas, Ivan Dokmanić, and Maarten de Hoop. Globally injective ReLU networks. arXiv:2006.08464, 2020. URL https://arxiv.org/abs/2105.07743.
+Prajit Ramachandran, Barret Zoph, and Quoc Le. Searching for activation functions. In Proceedings of the International Conference of Learning Representations (ICLR), 2018.
+
+Alexander Robey, George J Pappas, and Hamed Hassani. Model-based domain generalization. arXiv:2102.11436, 2021. URL https://arxiv.org/abs/2102.11436.
+James C. Robinson. *Dimensions, embeddings, and attractors*, volume 186 of Cambridge Tracts in Mathematics. Cambridge University Press, Cambridge, 2011.
+Denis Rosset, Felipe Montealegre-Mora, and Jean-Daniel Bancal. RepLAB: A computational/numerical approach to representation theory. In Quantum Theory and Symmetries, pp. 643-653. Springer, 2021.
+Shai Shalev-Shwartz and Shai Ben-David. Understanding Machine Learning: From Theory to Algorithms. Cambridge University Press, USA, 2014.
+Zuowei Shen, Haizhao Yang, and Shijun Zhang. Neural network approximation: Three hidden layers are enough. Neural Networks, 141:160-173, 2021a.
+Zuowei Shen, Haizhao Yang, and Shijun Zhang. Deep network with approximation error being reciprocal of width to power of square root of depth. Neural Computation, 33(4):1005-1036, 03 2021b.
+Max Sommerfeld, Jörn Schrieber, Yoav Zemel, and Axel Munk. Optimal transport: Fast probabilistic approximation with exact solvers. Journal of Machine Learning Research, 20(105):1-23, 2019.
+Karl-Theodor Sturm. Probability measures on metric spaces of nonpositive curvature. In Heat kernels and analysis on manifolds, graphs, and metric spaces, volume 338 of Contemp. Math., pp. 357-390. Amer. Math. Soc., Providence, RI, 2003.
+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 Advances in Neural Information Processing Systems, pp. 5998-6008, 2017.
+Cédric Villani. Optimal Transport: Old and New, volume 338. Springer, 2009.
+James Vuckovic, Aristide Baratin, and Remi Tachet des Combes. On the regularity of attention. arXiv:2102.05628, 2021. URL https://arxiv.org/abs/2102.05628.
+Steven Weinberg. Implications of dynamical symmetry breaking. Physical Review D, 13(4):974, 1976.
+Hassler Whitney. Analytic extensions of differentiable functions defined in closed sets. Transactions of the American Mathematical Society, 36(1):63-89, 1934.
+Dmitry Yarotsky. Elementary superexpressive activations. In Proceedings of the 38th International Conference on Machine Learning (ICML), 2021.
+Dmitry Yarotsky and Anton Zhevnerchuk. The phase diagram of approximation rates for deep neural networks. In Proceedings of Advances in Neural Information Processing Systems (NeurIPS), volume 33, 2020.
+Chulhee Yun, Srinadh Bhojanapalli, Ankit Singh Rawat, Sashank Reddi, and Sanjiv Kumar. Are transformers universal approximators of sequence-to-sequence functions? In Proceedings of the International Conference on Learning Representations (ICLR), 2020a.
+Chulhee Yun, Yin-Wen Chang, Srinadh Bhojanapalli, Ankit Singh Rawat, Sashank Reddi, and Sanjiv Kumar. $O(n)$ connections are expressive enough: Universal approximability of sparse transformers. In Proceedings of Advances in Neural Information Processing Systems (NeurIPS), 2020b.
+Hongyi Zhang and Suvrit Sra. First-order methods for geodesically convex optimization. In Proceedings of the 29th Conference on Learning Theory (COLT), 2016.
+Ding-Xuan Zhou. Universality of deep convolutional neural networks. Applied and Computational Harmonic Analysis, 48(2):787-794, 2020.
\ No newline at end of file
diff --git a/universalapproximationunderconstraintsispossiblewithtransformers/images.zip b/universalapproximationunderconstraintsispossiblewithtransformers/images.zip
new file mode 100644
index 0000000000000000000000000000000000000000..5c0ececbda7e2b2ba114434c956f5754be1dae58
--- /dev/null
+++ b/universalapproximationunderconstraintsispossiblewithtransformers/images.zip
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:bec3c58fa42fe1641ac717fa016d16b611ff9faeeda7ea664f09396e47891a8c
+size 147539
diff --git a/universalapproximationunderconstraintsispossiblewithtransformers/layout.json b/universalapproximationunderconstraintsispossiblewithtransformers/layout.json
new file mode 100644
index 0000000000000000000000000000000000000000..7b9f96de0e2301c6bbd9680a88179d54e57a9682
--- /dev/null
+++ b/universalapproximationunderconstraintsispossiblewithtransformers/layout.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5367bd6a111df5489e11dda79f8725f3211f6b6061dd02dacd06a03233bf67e4
+size 841605
diff --git a/vaeapproximationerrorelboandexponentialfamilies/59188a09-537b-42ec-af57-2e24f01fd95a_content_list.json b/vaeapproximationerrorelboandexponentialfamilies/59188a09-537b-42ec-af57-2e24f01fd95a_content_list.json
new file mode 100644
index 0000000000000000000000000000000000000000..7be29d1735793dd5730acdb0c8c9086c8638437a
--- /dev/null
+++ b/vaeapproximationerrorelboandexponentialfamilies/59188a09-537b-42ec-af57-2e24f01fd95a_content_list.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f5445622c58b181a5eb246d53ca88bf33a8ac48f4180fcd646cf168844112061
+size 126081
diff --git a/vaeapproximationerrorelboandexponentialfamilies/59188a09-537b-42ec-af57-2e24f01fd95a_model.json b/vaeapproximationerrorelboandexponentialfamilies/59188a09-537b-42ec-af57-2e24f01fd95a_model.json
new file mode 100644
index 0000000000000000000000000000000000000000..59706c8226db9ff3f3fa9fee692f1a9bc783df25
--- /dev/null
+++ b/vaeapproximationerrorelboandexponentialfamilies/59188a09-537b-42ec-af57-2e24f01fd95a_model.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e203610836ab5a891008ca5cc1ffa67b15cc3f726457bbf925c47b6fbcd11279
+size 148105
diff --git a/vaeapproximationerrorelboandexponentialfamilies/59188a09-537b-42ec-af57-2e24f01fd95a_origin.pdf b/vaeapproximationerrorelboandexponentialfamilies/59188a09-537b-42ec-af57-2e24f01fd95a_origin.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..76c650a52be5a9287765a8c8b3aaab96e9cb98cb
--- /dev/null
+++ b/vaeapproximationerrorelboandexponentialfamilies/59188a09-537b-42ec-af57-2e24f01fd95a_origin.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:8e2e48d1e5c73c75e5b5414907ffd114b3bbf37301abc4151e516ca9c16e46b0
+size 1669589
diff --git a/vaeapproximationerrorelboandexponentialfamilies/full.md b/vaeapproximationerrorelboandexponentialfamilies/full.md
new file mode 100644
index 0000000000000000000000000000000000000000..f7cabe1e64d3d74c7a5611e4d1a2c746bc37b976
--- /dev/null
+++ b/vaeapproximationerrorelboandexponentialfamilies/full.md
@@ -0,0 +1,657 @@
+# VAE APPROXIMATION ERROR: ELBO AND EXPONENTIAL FAMILIES
+
+# Alexander Shekhovtsov
+
+Czech Technical University in Prague
+shekhole@fel(cvut.cz
+
+# Dmitrij Schlesinger
+
+Dresden University of Technology Dmytro.Shlezinger@tu-dresden.de
+
+# Boris Flach
+
+Czech Technical University in Prague flachbor@fel.cyut.cz
+
+# ABSTRACT
+
+The importance of Variational Autoencoders reaches far beyond standalone generative models — the approach is also used for learning latent representations and can be generalized to semi-supervised learning. This requires a thorough analysis of their commonly known shortcomings: posterior collapse and approximation errors. This paper analyzes VAE approximation errors caused by the combination of the ELBO objective and encoder models from conditional exponential families, including, but not limited to, commonly used conditionally independent discrete and continuous models. We characterize subclasses of generative models consistent with these encoder families. We show that the ELBO optimizer is pulled away from the likelihood optimizer towards the consistent subset and study this effect experimentally. Importantly, this subset can not be enlarged, and the respective error cannot be decreased, by considering deeper encoder/decoder networks.
+
+# 1 INTRODUCTION
+
+Variational autoencoders (VAE, Kingma & Welling, 2014; Rezende et al., 2014) strive at learning complex data distributions $p_d(x)$ , $x \in \mathcal{X}$ in a generative way. They introduce latent variables $z \in \mathcal{Z}$ and model the joint distribution as $p_{\theta}(x|z)p(z)$ , where $p(z)$ is a simple distribution which is usually assumed to be known. The conditional distribution $p_{\theta}(x|z)$ , called decoder, is modeled in terms of a deep network parametrized by $\theta \in \Theta$ . Models defined in this way allow to sample from $p_{\theta}(x) = \mathbb{E}_{p(z)}p_{\theta}(x|z)$ easily, however at the price that computing the posterior $p_{\theta}(z|x) = p_{\theta}(x|z)p(z) / p_{\theta}(x)$ is usually intractable. To handle this problem, VAE approximates the posterior $p_{\theta}(z|x)$ by an amortized inference encoder $q_{\phi}(z|x)$ parametrized by $\phi \in \Phi$ . Given the empirical data distribution $p_d(x)$ , the model is learned by maximizing the evidence lower bound (ELBO) of the data log-likelihood $L(\theta) = \mathbb{E}_{p_d}\log p_\theta (x)$ . It can be expressed in the following two equivalent forms:
+
+$$
+\begin{array}{l} L _ {B} (\theta , \phi) = \mathbb {E} _ {p _ {d}} \left[ \mathbb {E} _ {q _ {\phi}} \log p _ {\theta} (x | z) - D _ {\mathrm {K L}} \left(q _ {\phi} (z | x) \| p (z)\right) \right] (1a) \\ = L (\theta) - \mathbb {E} _ {p _ {d}} \left[ D _ {\mathrm {K L}} \left(q _ {\phi} (z | x) \| p _ {\theta} (z | x)\right) \right]. (1b) \\ \end{array}
+$$
+
+The first form allows for stochastic optimization of ELBO while the second form shows that the gap between log-likelihood and ELBO is exactly the mismatch between the encoder and the posterior.
+
+VAEs constitute a powerful deep learning extension of the expectation-maximization (EM) approach to handle latent variables. They are useful not only as generative models but also, e.g., in semi-supervised learning (Kingma et al., 2014; Mattei & Frellsen, 2019). Furthermore the encoder part constructs an efficient embedding of the data in the latent space, useful in many applications. The outreach of the VAE approach requires therefore a careful empirical and theoretical analysis of the problems and trade offs involved. The most important ones are (i) posterior collapse (He et al., 2019; Lucas et al., 2019; Dai et al., 2018; Dai & Wipf, 2019; Dai et al., 2020) and (ii) approximation errors caused by an inappropriate choice of the encoder family.
+
+
+Figure 1: Diagram of the VAE trade-off. The optimal solution $\theta_{\mathrm{VAE}}$ is "in between" the maximum likelihood solution $\theta_{\mathrm{ML}}$ and the best solution in the class $\Theta_{\Phi}$ of consistent VAEs, where the posterior approximation error function $F(\theta)$ vanishes. We give an explicit characterization of this consistent set. At $\theta_{\mathrm{VAE}}$ there is a balance between the gradient of $-F$ (blue arrow) and the gradient of the data log-likelihood (black arrow).
+
+The VAE approximation error has been studied (e.g., Cremer et al. 2018; Hjelm et al. 2016; Kim et al. 2018) so far mainly empirically. The problem also occurs and is well-recognized in the context of variational inference and variational Bayesian inference, where the target posterior distribution is expected to be complex. It is commonly understood, that the mean field approximation of $p_{\theta}(z|x)$ by $q_{\phi}(z|x)$ in (1b) significantly limits variational Bayesian inference. In contrast, in VAEs, the decoder may adopt to compensate for the chosen encoder family. The effect of this coupling, we believe, is not fully understood. The phenomenon of decoder adopting to the posterior was experimentally observed, e.g., by Cremer et al. (2018, Section 5.4), noting that the approximation error is often dominated by the amortization error. Turner & Sahani (2011, Sec. 1.4) analytically show for linear state space models that simpler variational approximations (such a mean-field) can lead to less bias in parameter estimation than more complicated structured approximations. Similarly, Shu et al. (2018) view the VAE objective as providing a regularization and show that making the amortized inference model smoother, while increasing the amortization gap, leads to a better generalization.
+
+The common (empirical) understanding of the importance of the gap between the approximate and the true posterior has led to many generalizations of standard VAEs, which achieve impressive practical results, notably, tighter bounds using importance weighting (Burda et al., 2016; Nowozin, 2018), encoders employing normalizing flows (Rezende & Mohamed, 2015; Kingma et al., 2016), hierarchical and autoregressive encoders (Vahdat & Kautz, 2020; Sønderby et al., 2016; Ranganath et al., 2016), MRF encoders (Vahdat et al., 2020) and more. While these extensions mitigate the posterior mismatch problem, they often come at a price of a more difficult training and more expensive inference. Furthermore, simpler encoders may be of practical interest. Burda et al. (2016, Appendix C) illustrates that IWAE approximate posteriors are less regular and more spread out. In contrast, factorized encoders provide simple embeddings useful for downstream tasks such as semantic hashing (Chaidaroon & Fang, 2017).
+
+The aim of this paper is to study the approximation error of VAEs and its impact on the learned decoder. We consider a setting that generalizes many common VAEs, in particular popular models where encoder and decoder are conditionally independent Bernoulli or Gaussian distributions: we assume that both decoder and encoder are conditional exponential families. We identify the subclass of generative models where the encoder can model the posterior exactly, referred to as consistent VAEs. We give a characterization of consistent VAEs revealing that this set in fact does not depend on the complexity of the involved neural networks. We further show that the ELBO optimizer is pulled towards this set away from the likelihood optimizer. Specializing the characterization to several common VAE models, we show that the respective consistent models turn out to be RBM-like in many cases. We experimentally investigate the detrimental effect in one case and show that a simpler but more consistent VAE can perform better in the other.
+
+# 2 PROBLEM STATEMENT
+
+We adopt the following notion of approximation error. Consider a generative model class $\mathcal{P}_{\Theta} = \{p_{\theta}(x,z) \mid \theta \in \Theta\}$ , the encoder class $\mathcal{Q}_{\Phi} = \{q_{\phi}(z|x) \mid \phi \in \Phi\}$ and the data distribution $p_d(x)$ . The maximum likelihood generative model is given by $\theta_{\mathrm{ML}} \in \operatorname{argmax}_{\theta \in \Theta} \mathbb{E}_{p_d(x)} \log p_{\theta}(x)$ . For a decoder with parameters $\theta$ we define its approximation error as the likelihood difference $L(\theta_{\mathrm{ML}}) -$
+
+$L(\theta)$ . Respectively, the VAE approximation error is defined for a given $\theta$ as:
+
+$$
+L \left(\theta_ {\mathrm {M L}}\right) - \max _ {\phi} L _ {B} (\theta , \phi) \geq L \left(\theta_ {\mathrm {M L}}\right) - L (\theta). \tag {2}
+$$
+
+In order for this error to become zero, two conditions are necessary and sufficient:
+
+- Parameters $(\theta, \phi)$ must be optimal for the ELBO objective.
+- ELBO must be tight at $(\theta, \phi)$ , i.e., $L_B(\theta, \phi) = L(\theta)$ .
+
+Assuming that the optimality can be achieved, we study the non-tightness gap $L(\theta) - L_B(\theta, \phi)$ . From (1b) it expresses as $\mathbb{E}_{p_d}\left[D_{\mathrm{KL}}(q_\phi(z|x) \| p_\theta(z|x))\right]$ . It follows that ELBO is tight at $(\theta, \phi)$ iff $q_\phi(z|x) \equiv p_\theta(z|x)$ . Hence, we define the consistent set $\Theta_\Phi \subseteq \Theta$ as the subset of distributions $p_\theta(x,z)$ whose posteriors are in $\mathcal{Q}_\Phi$ , i.e.,
+
+$$
+\Theta_ {\Phi} = \left\{\theta \in \Theta \mid \exists \phi \in \Phi : q _ {\phi} (z | x) \equiv p _ {\theta} (z | x) \right\}. \tag {3}
+$$
+
+The KL-divergence in the ELBO objective (1b) can vanish only if $\theta \in \Theta_{\Phi}$ . If the likelihood maximizer $\theta_{\mathrm{ML}}$ is not contained in $\Theta_{\Phi}$ , then this KL-divergence pulls the optimizer towards $\Theta_{\Phi}$ and away from $\theta_{\mathrm{ML}}$ as illustrated in Fig. 1.
+
+We characterize the consistent set $\Theta_{\Phi}$ , on which the bound is tight, and show that this set is quite narrow and does not depend on the complexity of the encoder and decoder networks beyond simple 1-layer linear mappings of sufficient statistics.
+
+# 3 THEORETICAL ANALYSIS
+
+We consider a general class of VAEs, where both encoder and decoder are defined as exponential families. This class includes many common models, in particular Gaussian VAEs and Bernoulli VAEs with conditional independence assumptions, but also more complex ones, e.g., where the encoder is a conditional random field (Vahdat et al., 2020) $^1$ .
+
+Assumption 1 (Exponential family VAE). Let $\mathcal{X}$ and $\mathcal{Z}$ be sets of observations and latent variables, respectively. We consider VAE models defined by
+
+$$
+p _ {\theta} (x \mid z) = h (x) \exp \left[ \langle \nu (x), f _ {\theta} (z) \rangle - A \left(f _ {\theta} (z)\right) \right] \tag {4a}
+$$
+
+$$
+q _ {\phi} (z \mid x) = h ^ {\prime} (z) \exp \left[ \langle \psi (z), g _ {\phi} (x) \rangle - B \left(g _ {\phi} (x)\right) \right], \tag {4b}
+$$
+
+where $\nu \colon \mathcal{X} \to \mathbb{R}^n$ and $\psi \colon \mathcal{Z} \to \mathbb{R}^m$ are fixed sufficient statistics of dimensionality $n$ and $m$ ; $f_{\theta} \colon \mathcal{Z} \to \mathbb{R}^n$ and $g_{\phi} \colon \mathcal{X} \to \mathbb{R}^m$ are the decoder, resp., encoder, networks with learnable parameters $\theta$ , resp. $\phi$ ; $h \colon \mathcal{X} \to \mathbb{R}_+$ , $h' \colon \mathcal{Z} \to \mathbb{R}_+$ are strictly positive base measures and $A$ , $B$ denote the respective log-partition functions.
+
+Notice that this assumption imposes no restrictions on the nature of random variables $x$ and $z$ . They can be discrete or continuous, univariate or multivariate. Similarly, it imposes no restrictions on the complexity of the decoder and encoder networks $f_{\theta}(z)$ and $g_{\phi}(x)$ .
+
+Characterization of the consistent set. In the first step of our analysis, we investigate the conditions under which the approximation error of an exponential family VAE can be made exactly zero. As discussed above, a tight VAE $(\theta ,\phi)$ must satisfy $\forall (x,z)q_{\phi}(z|x) = p_{\theta}(z|x)$ , which leads to the following theorem.
+
+Theorem 1. The consistent set $\Theta_{\Phi}$ of an exponential family VAE is given by decoders of the form
+
+$$
+p (x \mid z) = h (x) \exp \left[ \langle \nu (x), W \psi (z) \rangle + \langle \nu (x), u \rangle - A (z) \right], \tag {5}
+$$
+
+where $W$ is a $n \times m$ matrix and $u \in \mathbb{R}^n$ . Moreover, the corresponding encoders have the form
+
+$$
+q (z | x) = h ^ {\prime} (z) \exp \left[ \left\langle \psi (z), W ^ {T} \nu (x) \right\rangle + \left\langle \psi (z), v \right\rangle - B (x) \right], \tag {6}
+$$
+
+where $v\in \mathbb{R}^m$
+
+This is a direct consequence of a theorem by Arnold & Strauss (1991) (see Appendix A.1 for more details). For a tight VAE, Theorem 1 states that the decoder and encoder are generalized linear models (GLMs) (5) and (6) with the interaction between $x$ and $z$ parametrized by a matrix $W$ and two vectors $u, v$ instead of the (complex) neural networks with parameters $\theta, \phi$ . The corresponding joint probability distribution takes the form of an EF Harmonium (Welling et al., 2005):
+
+$$
+p (x, z) = h (x) h ^ {\prime} (z) \exp \big (\langle \nu (x), W \psi (z) \rangle + \langle \nu (x), u \rangle + \langle \psi (z), v \rangle - A \big). \tag {7}
+$$
+
+Corollary 1. The subset $\Theta_{\Phi}$ of consistent models can not be enlarged by considering more complex encoder networks $g(x)$ , provided that the affine family $W^{\top} \nu(x)$ can already be represented.
+
+Corollary 2. Let the decoder network family be affine in $\psi (z)$ , i.e., $f(z) = W\psi (z) + a$ and let the encoder network family $g(x)$ include at least all affine maps $V\nu (x) + b$ . Then any global optimum of ELBO attains a zero approximation error.
+
+VAE can escape consistency when it degenerates to a flow. In practice, VAE models with rich decoders are almost never tight. It is therefore natural to ask, whether a small VAE posterior mismatch error implies closeness of the optimal decoder to some decoder in the consistent set.
+
+Definition 1. A VAE $(p_{\theta},q_{\phi})$ is $\varepsilon$ -tight for some $\varepsilon >0$ if $\mathbb{E}_{p_d(x)}[D_{\mathrm{KL}}(q_\phi (z|x)\| p_\theta (z|x))]\leq \varepsilon$ .
+
+It turns out that this definition allows a VAE to approach tightness while not approaching consistency. In the continuous case an example satisfying $\varepsilon$ -tightness with non-linear decoder follows from Dai & Wipf (2019, Theorem 2). They show, for a class of Gaussian VAEs with general neural networks $f_{\theta}$ , $g_{\phi}$ , that it is possible to build a sequence of network parameters $\theta_t$ , $\phi_t$ with the following properties: i) the target distribution is approximated arbitrary well, ii) the posterior mismatch $D_{\mathrm{KL}}(q_{\phi_t}(z|x)\| p_{\theta_t}(z|x))$ approaches zero and iii) both the encoder and decoder approach deterministic mappings. The VAE thus approaches a flow model (or invertible neural network) between the data manifold and a subspace of the latent space (Dai & Wipf, 2019). Clearly, in a general case the flow must be non-linear. A similar case can be made for discrete variables, see Example A.1.
+
+Non-deterministic nearly-tight VAEs approach consistency. We would however argue that the mode where the decoder and encoder are nearly-deterministic is not a natural VAE solution. By making additional assumptions, excluding such deterministic solutions, and restricting ourselves to the finite space in order to simplify the analysis, we can show that an $\varepsilon$ -tight VAE does indeed approach an EF-Harmonium.
+
+Theorem 2. Let $(p_{\theta}, q_{\phi})$ be an exponential family VAE (Assumption 1) on a discrete space $\mathcal{X} \times \mathcal{Z}$ with encoder $q_{\phi}(z|x)$ and decoder posterior $p_{\theta}(z|x)$ both bounded from below by $\alpha > 0$ . If the VAE is $\varepsilon$ -tight, then there exists a matrix $W \in \mathbb{R}^{n,m}$ and vectors $u \in \mathbb{R}^n$ , $v \in \mathbb{R}^m$ such that the joint model implied by the decoder $p_{\theta}(x,z) = p_{\theta}(x|z)p(z)$ can be approximated by an unnormalized EF Harmonium
+
+$$
+\tilde {p} (x, z) = h (x) h ^ {\prime} (z) \exp (\langle \nu (x), W \psi (z) \rangle + \langle \nu (x), u \rangle + \langle v, \psi (z) \rangle + c) \tag {8}
+$$
+
+with the error bound
+
+$$
+\mathbb {E} _ {p _ {d} (x)} \left[ \left(\log p _ {\theta} (x, z) - \log \tilde {p} (x, z)\right) ^ {2} \right] \leq \frac {\varepsilon}{2 \alpha^ {2}} + o (\varepsilon) \quad \forall z \in \mathcal {Z}. \tag {9}
+$$
+
+The proof is given in Appendix A.3. In this theorem the function $\tilde{p}(x, z)$ is non-negative but does not necessarily satisfy the normalization constraint of a density. Re-normalizing it by adjusting $c$ in (8) may break the approximation guarantee. Nevertheless, if $\varepsilon$ is small enough and, e.g., the data distribution is non-negative on the whole $\mathcal{X}$ , we expect it to approach a density, in particular to recover the result in Theorem 1 in the limit. Note that the theorem does not make any assumptions about optimality of $(\theta, \phi)$ , i.e., it describes all models in the vicinity of the consistent set in Fig. 1.
+
+# 3.1 CASES ANALYSIS
+
+This subsection gives a detailed analysis of consistent VAE models in several concrete cases of practical interest.
+
+Diagonal Gaussian VAE Let us consider a Gaussian VAE, as commonly applied to image generation (e.g., Dai & Wipf (2019)). Let $\mathcal{X} = \mathbb{R}^n$ , $\mathcal{Z} = \mathbb{R}^m$ , $p(x|z) = \mathcal{N}(x|\mu_d(z), \sigma_d^2 I)$ ,
+
+$q(z|x) = \mathcal{N}(z|\mu_e(x),\mathrm{diag}(\sigma_e^2 (x)))$ , where $\mu_{d},\mu_{e}$ and $\sigma_{e}$ are neural networks and $\sigma_{d}$ is a common pixel observation noise parameter. The decoder has minimal sufficient statistics $\nu (x) = x$ and base measure $h(x) = \mathcal{N}(x|0,\sigma_d^2 I)$ . The encoder has minimal sufficient statistics $\psi (z) = (z,z^2)$ , where the square is coordinate-wise. Theorem 1 implies that a tight optimal VAE has the joint model
+
+$$
+p (x, z) \propto h (x) \exp \left[ \left\langle x, W z + V z ^ {2} + a \right\rangle + \left\langle b, z \right\rangle + \left\langle c, z ^ {2} \right\rangle \right] \tag {10}
+$$
+
+for some matrices $W$ , $V$ and vectors $a, b, c$ . Furthermore, the integral over $z$ must be finite for all $x$ and therefore $x^{\mathsf{T}}V + c < 0$ must hold for all $x \in \mathbb{R}^n$ . This is possible only if $V = 0$ and $c < 0$ . The joint distribution is therefore a multivariate Gaussian and the same holds for its marginal $p(x)$ . The neural network $\mu_d(z)$ must degenerate to $\mu_d(z) = \sigma_d^2 \cdot (Wz + a)$ and the two neural networks for the encoder to $\sigma_e^2(x) = -1/2c$ and $\mu_e(x) = -(W^{\mathsf{T}}x + b)/2c$ , where divisions are coordinate-wise. VAEs with such simplified, linear Gaussian encoder-decoder pairs, called "linear VAEs" (Lucas et al., 2019) are known to be consistent and to match the probabilistic PCA model (Dai et al., 2018; Lucas et al., 2019). In this context, our Corollary 2 is a generalization of (Lucas et al., 2019, Lemma 1) showing consistency of linear VAEs, to decoders in any exponential family with natural parameters being a linear mapping of any fixed lifted latent representation $\psi(z)$ .
+
+We argue that a joint Gaussian model is too simplistic to generate complex data such as realistic images and that in this case the VAE error is detrimental. In Section 4.2 we experimentally confirm that optimizing ELBO for a general decoder network $\mu_{d}$ causes qualitative and quantitative degradation relative to the ML decoder. Note that if we allowed $\sigma_{d}$ to be dependent on $z$ , the resulting joint statistics in $\nu \otimes \psi$ would include terms $x^{2}z$ , $x^{2}z^{2}$ . The joint distribution would not be Gaussian and may be in fact multi-modal (see Anil Bhattacharayya's distribution in Arnold et al. 2001).
+
+Bernoulli-MRF VAE Vahdat et al. (2020) proposed to consider encoders in the Markov Random Field (MRF) family, in particular encoders of the form $q(z|x) \propto \exp(\langle z^1, V(x)z^2 \rangle + \langle b^1(x), z^1 \rangle + \langle b^2(x), z_2 \rangle)$ , where $z^1, z^2$ are two groups of latent variables and interaction weights $V, b^1, b^2$ are computed by the encoder network. In this case $q(z|x)$ is itself a (conditional) RBM. While evaluating $q(z|x)$ is difficult, MCMC sampling is efficient. We assume binary observations $x$ and a conditionally independent Bernoulli decoder family as above. The decoder thus has sufficient statistics $\nu = x$ and the encoder has $\psi = (z^1, z^2, z^1 \otimes z^2)$ . Introducing homogeneous constant components $x_0 = z_0^1 = z_0^2 = 1$ , the family of consistent joint distributions can be compactly described as
+
+$$
+p (x, z) = \exp \left[ \sum_ {i, j, k} W _ {i, j, k} x _ {i} z _ {j} ^ {1} z _ {k} ^ {2} \right], \tag {11}
+$$
+
+where the summation in all indices starts from 0 and $-W_{0,0,0}$ is the log-partition function. This joint model is a higher order MRF with the highest order potentials given by cubic monomials.
+
+Standard Bernoulli VAEs are a special case of the Bernoulli-MRF model, obtained when the interaction weights $V$ are zero. The joint distribution of such tight optimal VAEs takes the form
+
+$$
+p (x, z) = \frac {1}{c} \exp \left(x ^ {\mathsf {T}} W z + u ^ {\mathsf {T}} x + v ^ {\mathsf {T}} z\right), \tag {12}
+$$
+
+which is a restricted Boltzmann machine (RBM). Since RBMs are well known for being useful in many applications (dimensionality reduction, collaborative filtering, feature learning, topic modeling), we hypothesize that they can make a good baseline for Bernoulli VAEs and furthermore that the effect of pulling the VAE solution towards an RBM may be benign in case of insufficient data. For example IwAE test likelihood in (Burda et al., 2016) is worse than that of an RBM (Burda et al., 2015) on the Omniglot dataset. Furthermore, debiasing of IwAE (Nowozin, 2018) does not improve test likelihood in many cases.
+
+Bernoulli VAE for Semantic Hashing One important application of Bernoulli VAEs is the semantic hashing problem, initially proposed and modeled with RBMs (Salakhutdinov & Hinton, 2009). The problem is to assign to each document / image a compact binary latent code that can be used for quick retrieval by the nearest neighbor search. We will detail now a more recent VAE model for text documents (Chaidaroon & Fang, 2017; Shen et al., 2018) and show that it can be tight only in a full posterior collapse. We correct the encoder so as to allow a larger consistent set and observe that the resulting consistent joint distribution forms a multinomial-Bernoulli RBM.
+
+Let $x \in \mathbb{N}^K$ be word counts in a document with words from a dictionary of size $K$ . Let $z \in \{0,1\}^m$ be a binary latent code. Let $l = \sum_{k} x_k$ denote the document's length. We assume that the document
+
+length is independent of the latent topic and its distribution $p(l)$ can be learned separately (e.g., a log-normal distribution is a good fit). The decoder is defined using the multinomial distribution model (words in the document are drawn from the same categorical distribution corresponding to its topic):
+
+$$
+p (x, l \mid z) = p (l) h (x \mid l) \exp (f (z) ^ {\top} x - l A (f (z))), \tag {13}
+$$
+
+where $f(z)$ is a neural network mapping the latent code to the logits of word occurrence probabilities, $A(\eta) = \log \sum_{k} \exp(\eta_{k})$ and $h(x|l) = \mathbb{I}\left[\sum_{k} x_{k} = l\right] \left( \frac{l!}{\prod_{k} x_{k}} \right)$ is the base measure2. The sufficient statistics are the word counts $x$ . The prior $p(z)$ is assumed uniform Bernoulli.
+
+The encoder is the conditionally independent Bernoulli model, expressed as
+
+$$
+q (z | x, l) \propto \exp (g (x) ^ {\mathsf {T}} z), \tag {14}
+$$
+
+where $g(x)$ is the encoder network. Chaidaroon & Fang (2017) experimented with the encoder and decoder design and recommended using TFIDF features instead of raw counts. First, we note that the inverse document frequency (IDF) is not relevant, since it can be learned by the first linear transform in the encoder. Effectively, the term frequency (TF), given by $x / l$ , is used. This choice is adopted in later works (Shen et al., 2018; Zamani Dadaneh et al., 2020; Nanculef et al., 2020). It might seem reasonable that the latent code modeling the document topic should not depend on the document length, only on the distribution of words in the document. However, we will argue that this rationale is misleading for stochastic encoders.
+
+We apply Theorem 1 to two groups of variables: observed $(x, l)$ and latent $z$ with $h(x, l) = h(x|l)p(l), \nu(x, l) = x$ and $\psi(z) = z$ . It follows that the consistent joint family is
+
+$$
+p (x, l, z) = h (x, l) \exp \left(x ^ {\mathsf {T}} W z + a ^ {\mathsf {T}} x + b ^ {\mathsf {T}} z + c\right). \tag {15}
+$$
+
+This however implies that $g(x) = Wx + b$ , i.e. the encoder network must be linear in $x$ . Consequently, it cannot match a function of word frequencies $x / l$ (as chosen by design) unless $W = 0$ , i.e. a completely trivial model with an encoder not depending on $x$ . Such an encoder would imply full posterior collapse. The corresponding consistent set $\Theta_{\Phi}$ coincides with the set of collapsed VAEs where the decoder does not depend on the latent variable $z$ in Fig. 1. We conjecture that the inherent inconsistency of this VAE has a detrimental effect on learning.
+
+If instead, we let the encoder network to access word counts $x$ directly, we obtain that $g(x) = Wx + b$ can form a consistent VAE. Inspecting this encoder model in more detail, we see that it builds up topic confidence in proportion to the evidence (total word counts), as the true posterior would. Indeed, the true posterior $p(z|x,l)$ satisfies the factorization by Bayes's theorem: $p(z|x,l) = p(x|z,l)p(z) / p(x|l)$ . The prior $p(z)$ is constant by design, $p(x|l)$ does not vary with $z$ and $p(x|z,l)$ factors over all word instances according to (13). In other words, the coupling between $x$ and $z$ in $\log p(z|x,l)$ is linear in $x$ .
+
+In Section 4 we study the proposed correction experimentally and show that it enables learning better models under a variety of settings.
+
+# 4 EXPERIMENTS
+
+# 4.1 ARTIFICIAL EXAMPLE
+
+To start with, we illustrate our findings on a toy example. We consider a simple Gaussian mixture model for which we can easily generate samples and compute all necessary quantities including the ELBO objective. We define the ground truth model to be $p^*(x,z) = p^*(z)p^*(x|z)$ , with $z \in \{1\ldots 4\}$ , $p^*(z) \equiv 0.25$ , $x \in \mathbb{R}^2$ , $p^*(x|z) = \mathcal{N}(x|\mu(z), \sigma^2I)$ , i.e., a mixture of four 2D Gaussians. Fig. 2(a) shows the color-coded posterior distribution $p^*(z|x)$ . We assign a color to each component and represent $p^*(z|x)$ for each pixel $x \in \mathbb{R}^2$ by the corresponding mixture of the component colors. For better interpretability, we illustrate further results by decision maps $\arg \max_z p(z|x)$ . Fig. 2(b) shows the decision map for $p^*(z|x)$ .
+
+
+(a)
+
+
+(b)
+
+
+(c)
+Figure 2: Artificial example. (a) Color-coded posterior distribution $p^{*}(z|x)$ . (b-e): Decision maps (arg max $_z$ ) of: (b) true posterior $p^{*}(z|x)$ , (c) factorized encoder $q_{\phi}(z|x)$ after joint learning, (d) model posterior $p_{\theta}(z|x)$ after joint learning, (e) RBM trained on the same data. Gaussian centers $\mu(z)$ are shown as black dots. (f) Probability simplex of distributions over the four binary configurations. The vertices correspond to pure (deterministic) binary states represented by the code and its respective color. The surface shows the manifold of factorized distributions realizable by $q(z|x)$ . Notice that the two edges (00, 11) and (01, 10) are not in the manifold because they correspond to switching of two bits simultaneously in a correlated way. The factorized approximation cannot model transitions between these states. Hence, when learning VAE, these pairs of states are repulsed in the decision maps (c), (d).
+
+
+(d)
+
+
+(e)
+
+
+(f)
+
+The aim of the experiment is to learn a VAE and to study the influence of the factorization assumption on the results. We use the decoder architecture as in the ground truth model — a Gaussian distribution $p_{\theta}(x|z) = \mathcal{N}(x|\theta z_{oh},\sigma^2 I)$ , where $z_{oh}$ is the one-hot (categorical) representation of $z$ , and $\theta$ is a $2\times 4$ matrix that maps the four latent codes to 2D centers at general locations. Note that the ground truth model is contained in the chosen decoder family. Hence, the ML solution is the ground truth decoder $p^{*}(x|z)$ . We restrict the encoder to factor over the binary representation of the code $z_{b}\in \{0,1\}^{2}$ and define it as $q_{\phi}(z_b|x)\propto \exp \langle g_{\phi}(x),z_b\rangle$ , where $g_{\phi}(x)$ is implemented as a feed-forward network with two hidden layers, each with 64 units and ReLU activations.
+
+First, we pre-train our factorized encoder by optimizing ELBO and keeping the ground truth decoder fixed. The next step is to jointly train the encoder and decoder by maximizing ELBO. Since we are interested in how the ELBO objective distorts the likelihood solution, we start with the ground truth decoder and the pre-trained encoder from the previous step. The ELBO-optimal decoder has to match not only the training data, but also the inexact, factorizing encoder. The resulting $q_{\phi}(z|x)$ is shown in Fig. 2(c) and the learned model posterior $p_{\theta}(z|x) \propto p(z)p_{\theta}(x|z)$ in Fig. 2(d). Note that they match each other pretty well, but differ substantially from the ground truth posterior shown in Fig. 2(b). The impact of the factorization is clearly visible – one can see two decision boundaries (one for each bit of $z_b$ ), which together partition the $x$ -space into four regions, approximating the true posterior. For comparison, Fig. 2(e) shows the posterior of an RBM trained on the same data. It is clearly seen that the ELBO optimizer is pulled away from the likelihood optimizer towards an RBM solution. Notice also the explanation given in Fig. 2(f). Summarizing, this simple toy example clearly shows the VAE approximation error caused by the combination of ELBO objective and the factorization assumption for the encoder. While the numerical difference between ELBO and log-likelihood is small (see details in Appendix C.1), the qualitative difference in Fig. 2 appears substantial.
+
+# 4.2 GAUSSIAN VAES FOR CELEBA IMAGES
+
+The goal and design of this experiment is similar to the previous one. We first define a ground truth decoder which is used to generate training images. Then we pre-train an encoder by ELBO keeping the ground truth decoder fixed. Finally, we train both model parts starting from the ground truth decoder and the pre-trained encoder.
+
+The ground truth generative model is obtained by training a convolutional Generative Adversarial network (GAN) using code of Inkawich (2017) on the CelebA dataset Liu et al. (2015). We scale and crop all images to $64 \times 64$ pixels. In order to get a stochastic decoder, we equip the GAN generator $x = d(z)$ , $z \in \mathbb{R}^{100}$ , $x \in \mathbb{R}^{64 \times 64 \times 3}$ with image noise $\sigma_d$ . The ground truth generative model is thus defined as $p^*(x, z) = p^*(z)p^*(x|z)$ , where $p^*(z) = \mathcal{N}(z|0, I)$ , $p^*(x|z) = \mathcal{N}(x|\mu_d(z), \sigma_d^2 I)$ , and $\sigma_d^2$ is a common noise variance for all pixels and color channels. We chose $\sigma_d = 0.05$ (the color values are normalized to $[-1, 1]$ ). This corresponds to an image noise level, which is just visible, but does not disturb visual perception essentially.
+
+
+Figure 3: Results for the encoder learned by supervised conditional likelihood. Top row: training samples $\hat{x} \sim p^{*}(x)$ . Second row: the corresponding reconstructions from mean values of $z$ , i.e. $x \sim p^{*}(x|\mu_{e}(\hat{x}))$ . Third row: reconstructions from sampled $z$ , i.e. $\hat{z} \sim \mathcal{N}(\mu_{e}(\hat{x}), \sigma_{e}^{2}(\hat{x}))$ followed by $x \sim p^{*}(x|\hat{z})$ .
+
+
+Figure 4: Visual comparison - images drawn from the original/learned models. Each column corresponds to a particular value of $z \sim \mathcal{N}(0, I)$ . Top row: the ground truth model, middle row: learned decoder with fixed $\sigma_d$ , bottom row: decoder with learned $\sigma_d$ .
+
+The decoder family of the considered VAE consists of networks with the same architecture as $d(z)$ . This ensures that the ground truth decoder is a likelihood maximizer of the VAE model. The encoder is defined as $q_{\phi}(z|x) = \mathcal{N}(x|\mu_e(x),\mathrm{diag}(\sigma_e^2 (x)))$ , where $\mu_{e},\sigma_{e}\in \mathbb{R}^{100}$ are two outputs of a convolutional neural network with an architecture similar to the architecture of the discriminator used for training the GAN (except the output layer), i.e., $q_{\phi}(z|x)$ is a multivariate Gaussian with diagonal covariance matrix whose parameters depend on $x$ .
+
+We pre-train the encoder fully supervised by maximizing its conditional log-likelihood $\mathbb{E}_{p^{*}(x,z)}\log q_{\phi}(z|x)$ on examples drawn from the ground truth generating model $p^* (x,z)$ . The results of pre-training are shown in Fig. 3. Then we jointly learn the encoder and decoder by maximizing ELBO on $x$ -samples drawn from the ground truth model. We start the learning with the ground truth decoder $p^* (x|z)$ and the encoder obtained in the previous step. Two variants are considered for this training: (i) keeping the image noise $\sigma_{d}$ fixed and (ii) learning it along with other model parameters. We evaluate the results quantitatively by computing the Frechet Inception Distances (FID) between the ground truth model $p^* (x|z)$ and the obtained decoders $p_{\theta}(x|z)$ using the code of Seitzer (2020). For this we generate 200k images from each model. The obtained values are given in Tab. 1. Fig. 4 shows images generated by the ground truth model and the two learned models.
+
+To conclude, ELBO optimization harms the decoder considerably as clearly seen both from FID-scores and the generated images. Models with higher ELBO values have worse FID-scores and produce less realistic images.
+
+Table 1: Optimizing the ELBO starting from the ML solution degrades the FID-score. The first row corresponds to the pre-trained encoder for the ground truth decoder, its FID-score therefore compares two image sets, both generated by the ground truth model.
+
+| Experiment | ELBO | FID |
| optimize encoder (conditional likelihood) | -364513.78 | 0.13 |
| optimize encoder and decoder (ELBO, fixed σd) | -5898.94 | 77.10 |
| optimize encoder and decoder (ELBO, learned σd) | 9035.69 | 117.87 |
+
+# 4.3 BERNOULLI VAE FOR TEXT DOCUMENTS
+
+This experiment compares training of the VAE model for semantic hashing discussed in Section 3.1 with and without our proposed correction on the 20Newsgroups dataset (Lang & Rennie, 2008). We describe the dataset, preprocessing and optimization details in Appendix C.2.
+
+We compare three encoders: e1: linear encoder on word counts (the proposed correction), e2: deep (2 hidden layers) encoder using word frequencies and e3: a linear encoder on frequencies. The
+
+encoders are compared across different numbers of latent Bernoulli variables (bits) and different decoder depths. The decoder depth denotes the number of fully connected hidden ReLU layers (0-2). In both the encoder and decoder we use 512 units in hidden layers. The prior work mainly used linear decoders following the ablation study of Shen et al. (2018). Our experiments also suggest that using deep decoders in combination with longer bit-length leads to a significant overfitting. When the decoder is linear, the posterior distribution is tractable and is linear as well, i.e., the VAE model is equivalent to a Multinomial-Bernoulli RBM. We experimentally verify that a linear encoder on word counts e1 indeed works better in this case. However, perhaps more surprisingly, we also find out that it works better even for non-linear decoders.
+
+Table 2 show the achieved training and test Negative ELBO (NELBO) values. We observe across all settings that the simple encoder e1 is consistently better than the more complex encoder e2 which in turn is significantly better than the linear encoder on frequencies e3. We conclude that the use of VAEs with deep encoders based on word frequencies (Chaidaroon & Fang, 2017; Shen et al., 2018; Zamani Dadaneh et al., 2020; Nanculef et al., 2020) is sub-optimal for this dataset. We also observe that linear decoders generalize better under 32 and 64 bits compared to more complex decoders, which suffer from overfitting. This implies that in these cases the best encoder-decoder combination is linear, i.e. the basic RBM model. This evidence agrees with previously observed worse reconstruction error with deep architecture (Dai et al., 2020), however we did not observe (a more severe) posterior collapse with deeper models amongst the depths we report.
+
+Table 2: Training and test NELBO values for Text-VAE with different configurations of bits, decoder and encoder. Bold highlights the best encoder choice and underlined bold values are the best decoder-encoder combinations for each bit-length.
+
+| TRAINING | TEST | |
| Bits | dhidden=0 | dhidden=1 | dhidden=2 | Bits | dhidden=0 | dhidden=1 | dhidden=2 |
| e1 | e2 | e3 | e1 | e2 | e3 | e1 | e2 | e3 | e1 | e2 | e3 | e1 | e2 | e3 | e1 | e2 | e3 |
| 8 | 419 | 429 | 439 | 321 | 390 | 415 | 325 | 370 | 421 | 8 | 423 | 429 | 435 | 413 | 421 | 424 | 418 | 423 | 427 |
| 16 | 382 | 398 | 419 | 201 | 329 | 407 | 164 | 269 | 413 | 16 | 409 | 417 | 421 | 404 | 422 | 420 | 410 | 416 | 422 |
| 32 | 337 | 358 | 412 | 165 | 189 | 403 | 132 | 159 | 411 | 32 | 396 | 413 | 416 | 399 | 413 | 418 | 406 | 416 | 421 |
| 64 | 296 | 324 | 407 | 171 | 189 | 398 | 134 | 149 | 409 | 64 | 392 | 411 | 414 | 398 | 413 | 417 | 406 | 417 | 422 |
+
+# 5 CONCLUSIONS
+
+We have analyzed the approximation error of VAEs in a general setting, when both the decoder and encoder are exponential families. This includes commonly used VAE variants as, e.g., Gaussian VAEs and Bernoulli VAEs. We have shown that the subset of generative models consistent with the encoder class is quite restricted: it coincides with the set of log-bilinear models on the sufficient statistics of both decoder and encoder, i.e., RBM-like models. This consistent subset can not be enlarged by using more complex encoder networks as long as encoder's sufficient statistics remain unchanged. In combination with the ELBO objective, this causes an approximation error — the ELBO optimizer is pulled away from the data likelihood optimizer towards this subset. Moreover, we proved theoretically that close-to-tight EF VAEs must be close to RBMs in a certain sense.
+
+We have shown that the error is detrimental when the consistent subset is too restrictive. In the cases where a lot of data is available and a high quality generative model is of the primary interest, such as in the CelebA experiment, more expressive encoder families are required in addition to large networks. On the other hand the VAE approximation error may result in a useful regularization when the respective RBM is a good baseline model. In this case we can speak of a binning inductive bias towards RBM, such as in our text-VAE experiment. Furthermore, simple encoders can be desired when the learned representations are of interest, in particular they appear to facilitate similarity in Hamming distance, useful in the semantic hashing problem.
+
+Further connections to related work and discussion can be found in Appendix B.
+
+# ACKNOWLEDGMENT
+
+D.S. was supported by the German Federal Ministry of Education and Research (BMBF, 01/S18026A-F) by funding the competence center for Big Data and AI "ScaDS.AI Dresden/Leipzig". A.S and B.F gratefully acknowledge support by the Czech OP VVV project "Research Center for Informatics" (CZ.02.1.01/0.0/0.0/16019/0000765)". B.F. was also supported by the Czech Science Foundation, grant 19-09967S. The authors gratefully acknowledge the Center for Information Services and HPC (ZIH) at TU Dresden for providing computing time. We thank the anonymous reviewers for many helpful links and suggestions.
+
+# REFERENCES
+
+B. C. Arnold and D. J. Strauss. Bivariate distributions with conditionals in prescribed exponential families. Journal of the Royal Statistical Society Series B (Methodological), 53(2):365-375, 1991.
+Barry C. Arnold, Enrique Castillo, and Jose Maria Sarabia. Conditionally specified distributions: An introduction. Statistical Science, 16(3):249 - 274, 2001.
+Yuri Burda, Roger Grosse, and Ruslan Salakhutdinov. Accurate and conservative estimates of MRF log-likelihood using reverse annealing. In AISTATS, volume 38, pp. 102-110, 09-12 May 2015.
+Yuri Burda, Roger B. Grosse, and Ruslan Salakhutdinov. Importance weighted autoencoders. In ICLR, 2016.
+Suthee Chaidaroon and Yi Fang. Variational deep semantic hashing for text documents. In SIGIR Conference on Research and Development in Information Retrieval, pp. 75-84, 2017.
+Chris Cremer, Xuechen Li, and David Duvenaud. Inference suboptimality in variational autoencoders. In ICML, volume 80, pp. 1078-1086, 2018.
+Bin Dai and David Wipf. Diagnosing and enhancing VAE models. In ICLR, 2019.
+Bin Dai, Yu Wang, John Aston, Gang Hua, and David Wipf. Connections with robust PCA and the role of emergent sparsity in variational autoencoder models. Journal of Machine Learning Research, 19(41):1-42, 2018.
+Bin Dai, Ziyu Wang, and David Wipf. The usual suspects? Reassessing blame for VAE posterior collapse. In ICML, 2020.
+Junxian He, Daniel Spokoyny, Graham Neubig, and Taylor Berg-Kirkpatrick. Lagging inference networks and posterior collapse in variational autoencoders. In *ICLR*, 2019.
+Devon Hjelm, Russ R Salakhutdinov, Kyunghyun Cho, Nebojsa Jojic, Vince Calhoun, and Junyoung Chung. Iterative refinement of the approximate posterior for directed belief networks. In Advances in Neural Information Processing Systems, volume 29, pp. 4691-4699, 2016.
+Nathan Inkawich. DCGAN tutorial, 2017. URL https://pytorch.org/tutorials/beginner/dcgan_faces_tutorial.html.
+Yoon Kim, Sam Wiseman, Andrew Miller, David Sontag, and Alexander Rush. Semi-amortized variational autoencoders. In ICML, volume 80, pp. 2678-2687, 2018.
+Diederik P Kingma and Max Welling. Auto-encoding variational bayes. In ICLR, 2014.
+Diederik P. Kingma, Danilo J. Rezende, Shakir Mohamed, and Max Welling. Semi-supervised learning with deep generative models. In Proceedings of the 27th International Conference on Neural Information Processing Systems - Volume 2, NIPS'14, pp. 3581-3589, Cambridge, MA, USA, 2014. MIT Press.
+Diederik P Kingma, Tim Salimans, Rafal Jozefowicz, Xi Chen, Ilya Sutskever, and Max Welling. Improved variational inference with inverse autoregressive flow. In NeurIPS, volume 29, pp. 4743-4751, 2016.
+
+Ken Lang and Jason Rennie. The 20 newsgroups dataset, 2008. http://qwone.com/~jason/20Newsgroups/.
+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.
+James Lucas, George Tucker, Roger B Grosse, and Mohammad Norouzi. Don't blame the ELBO! a linear VAE perspective on posterior collapse. In NeurIPS, volume 32, pp. 9408-9418, 2019.
+Lars Maalø e, Marco Fraccaro, Valentin Lievin, and Ole Winther. BIVA: A very deep hierarchy of latent variables for generative modeling. In NeurIPS, volume 32, 2019.
+Pierre-Alexandre Mattei and Jes Frellsen. MIWAE: Deep generative modelling and imputation of incomplete data sets. In ICML, volume 97, pp. 4413-4423, 09-15 Jun 2019.
+Ricardo Nanculef, Francisco Alejandro Mena, Antonio Macaluso, Stefano Lodi, and Claudio Sartori. Self-supervised Bernoulli autoencoders for semi-supervised hashing. CoRR, abs/2007.08799, 2020.
+Sebastian Nowozin. Debiasing evidence approximations: On importance-weighted autoencoders and jackknife variational inference. In International Conference on Learning Representations, 2018.
+Rajesh Ranganath, Dustin Tran, and David Blei. Hierarchical variational models. In ICML, volume 48, pp. 324-333, 20-22 Jun 2016.
+Danilo Rezende and Shakir Mohamed. Variational inference with normalizing flows. In ICML, volume 37, pp. 1530-1538, 2015.
+Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In ICML, 2014.
+Ruslan Salakhutdinov and Geoffrey Hinton. Semantic hashing. Int. J. Approx. Reasoning, 50(7): 969-978, July 2009.
+Maximilian Seitzer. pytorch-fid: FID Score for PyTorch. https://github.com/mseitzer/pytorch-fid, August 2020. Version 0.1.1.
+Dinghan Shen, Qinliang Su, Paidamoyo Chapfuwa, Wenlin Wang, Guoyin Wang, Ricardo Henao, and Lawrence Carin. NASH: Toward end-to-end neural architecture for generative semantic hashing. In Annual Meeting of the Association for Computational Linguistics, pp. 2041-2050, jul 2018.
+Rui Shu, Hung H Bui, Shengjia Zhao, Mykel J Kochenderfer, and Stefano Ermon. Amortized inference regularization. In NeurIPS, volume 31, 2018.
+Robert Sicks, Ralf Korn, and Stefanie Schwaar. A generalised linear model framework for $\beta$ -variational autoencoders based on exponential dispersion families. CoRR, 2021.
+Casper Kaae Sønderby, Tapani Raiko, Lars Maaløe, Søren Kaae Sønderby, and Ole Winther. Ladder variational autoencoders. In Advances in Neural Information Processing Systems, volume 29, pp. 3738-3746, 2016.
+Hiroshi Takahashi, Tomoharu Iwata, Yuki Yamanaka, Masanori Yamada, and Satoshi Yagi. Student-t variational autoencoder for robust density estimation. In *IJCAI*, pp. 2696-2702, 7 2018.
+R. E. Turner and M. Sahani. Two problems with variational expectation maximisation for time-series models. In Bayesian Time series models, chapter 5, pp. 109-130. 2011.
+Arash Vahdat and Jan Kautz. Nvae: A deep hierarchical variational autoencoder. In NeurIPS, volume 33, pp. 19667-19679, 2020.
+Arash Vahdat, Evgeny Andriyash, and William Macready. Undirected graphical models as approximate posteriors. In ICML, volume 119, pp. 9680-9689, 13-18 Jul 2020.
+
+Max Welling, Michal Rosen-Zvi, and Geoffrey E Hinton. Exponential family harmoniums with an application to information retrieval. In NeurIPS, volume 17, 2005.
+Mingzhang Yin and Mingyuan Zhou. ARM: Augment-REINFORCE-merge gradient for stochastic binary networks. In ICLR, 2019.
+Siamak Zamani Dadaneh, Shahin Boluki, Mingzhang Yin, Mingyuan Zhou, and Xiaoning Qian. Pairwise supervised hashing with Bernoulli variational auto-encoder and self-control gradient estimator. In UAI, volume 124, pp. 540-549, 2020.
+
+# Appendix
+
+# A PROOFS
+
+# A.1 PROOF OF THEOREM 1
+
+The proof directly follows from the characterization of conditionally specified joint distributions in the exponential family given by Arnold & Strauss (1991), see (Arnold et al., 2001, Theorem 3):
+
+Theorem A.1 (Arnold & Strauss 1991). Let $x \in \mathcal{X}$ and $z \in \mathcal{Z}$ be random variables with a strictly positive joint distribution such that both conditional distributions are exponential families with densities
+
+$$
+p (x \mid z) = h (x) \exp [ \langle \nu (x), f (z) \rangle - A (z) ] \tag {16a}
+$$
+
+$$
+p (z \mid x) = h ^ {\prime} (z) \exp [ \langle \psi (z), g (x) \rangle - B (x) ], \tag {16b}
+$$
+
+where $\nu : \mathcal{X} \to \mathbb{R}^n$ and $\psi : \mathcal{Z} \to \mathbb{R}^m$ are minimal sufficient statistics, $f : \mathcal{Z} \to \mathbb{R}^n$ and $g : \mathcal{X} \to \mathbb{R}^m$ are any mappings, $h(x)$ and $h'(z)$ are base measures, and $A$ and $B$ denote the respective log-partition functions4.
+
+Then there exists a matrix $W \in \mathbb{M}(n + 1, m + 1)$ , such that the density of the joint distribution can be represented as
+
+$$
+p (x, z) = h (x) h ^ {\prime} (z) \exp \left\langle \nu_ {e} (x), W \psi_ {e} (z) \right\rangle , \tag {17}
+$$
+
+where $\nu_{e},\psi_{e}$ denote the statistics vectors extended with an additional component 1.
+
+# A.2 EXAMPLE OF A DISCRETE VAE APPROACHING A FLOW
+
+Example A.1. In this example we construct a VAE that can be arbitrary close to tight one, but where the decoder network does not approach a linear map. Let $\mathcal{X} = \{-1,1\}^2$ , $\mathcal{Z} = \{-1,1\}^2$ and let $p(z)$ be uniform. Let the decoder be conditionally independent
+
+$$
+p (x \mid z) = \exp \left[ \beta \langle x, \pi (z) \rangle - A (z) \right] \tag {18}
+$$
+
+where $\pi (z)$ denotes the invertible mapping of $\mathcal{Z}$ to $\mathcal{X}$ given by
+
+$$
+x _ {1} = z _ {1} \tag {19}
+$$
+
+$$
+x _ {2} = z _ {1} z _ {2}. \tag {20}
+$$
+
+If the parameter $\beta$ is sufficiently large, the distribution $p(x|z)$ approaches the deterministic distribution $\delta_{x = \pi (z)}$ . Its posterior therefore also approaches the deterministic distribution $\delta_{z = \pi^{-1}(x)}$ (notice that $\pi^{-1} = \pi$ ). Let the encoder be the conditionally independent model $q(z|x) = \exp \bigl [\beta \langle z,\pi^{-1}(x)\rangle -A(x)\bigr ]$ . This decoder by design approaches $\delta_{x = \pi (z)}$ as well and thus the VAE $(p,q)$ achieves $\varepsilon$ -tightness for sufficiently large $\beta$ . At the same time the deviation between logarithms of probabilities $\log q(z|x)$ and $\log p(z|x)$ grows with $\beta$ .
+
+# A.3 PROOF OF THEOREM 2
+
+The idea of the proof is to bound the difference between $\log p(z|x)$ and $\log q(z|x)$ , which is done by Proposition A.2 and then in the space of log-probabilities to approximate the non-linear mapping $f_{e}(z)$ by a linear one as detailed in Proposition A.1. By carefully choosing the norms and the approximation we obtain a bound on the error for the joint model, which despite the discreteness assumption of the observation space $\mathcal{X}$ in Theorem 2 does not depend on its cardinality.
+
+For a finite set $X \subset \mathcal{X}$ let $\mathcal{H}$ be the $|X|$ -dimensional vector space with the inner product $\langle u, v \rangle_{p_d} = \sum_{x \in X} p_d(x) u(x) v(x)$ , assuming that $p_d(x) > 0$ for all $x \in \mathcal{X}$ . The respective norm will be denoted as $\| \cdot \|_{p_d}$ .
+
+Proposition A.1. Under model Assumption 1, for any finite $X \subseteq \mathcal{X}$ there exists a matrix $W \in \mathbb{M}(n + 1, m + 1)$ such that joint distribution implied by the decoder $p(x,z) = p(x|z)p(z)$ can be approximated by an unnormalized EF Harmonium
+
+$$
+\tilde {p} (x, z) = h (x) h ^ {\prime} (z) \exp \left(\left\langle \nu_ {e} (x), W \psi_ {e} (z) \right\rangle\right) \tag {21}
+$$
+
+with the error bound
+
+$$
+\left(\forall z\right) \sum_ {x \in X} p _ {d} (x) \left| \log p (x, z) - \log \tilde {p} (x, z) \right| ^ {2} \leq \sum_ {x \in X} p _ {d} (x) \left| \log q (z | x) - \log p (z | x) \right| ^ {2}. \tag {22}
+$$
+
+The function $\tilde{p}(x,z)$ is non-negative but does not necessarily satisfy the normalization constraint of a density.
+
+Proof. For clarity, we will omit the dependence of the decoder and encoder on their parameters $\theta$ , resp. $\phi$ . Throughout the proof we will also assume that a single $z \in \mathcal{Z}$ is fixed.
+
+First, we expand
+
+$$
+\log q (z \mid x) = \langle \psi (z), g (x) \rangle - B (x) + \log h ^ {\prime} (z); \tag {23a}
+$$
+
+$$
+\begin{array}{l} \log p (z \mid x) = \log p (x \mid z) + \log p (z) - \log p (x) \\ = \left\langle \nu (x), f (z) \right\rangle - A (z) + \log h (x) + \log p (z) - \log p (x), \tag {23b} \\ \end{array}
+$$
+
+where $A(z) = A(f(z))$ and $B(x) = B(g(x))$ . We can therefore represent
+
+$$
+\begin{array}{l} \log q (z \mid x) - \log p (z \mid x) = \left\langle \psi (z), g (x) \right\rangle - B (x) + \log p (x) - \log h (x) (24) \\ - \left(\langle \nu (x), f (z) \rangle + \log p (z) - \log h ^ {\prime} (z) - A (z)\right) (25) \\ = \left\langle \psi_ {e} (z), g _ {e} (x) \right\rangle - \left\langle \nu_ {e} (x), f _ {e} (z) \right\rangle , (26) \\ \end{array}
+$$
+
+where
+
+$$
+\psi_ {e} (z) = (\psi (z), 1); \tag {27}
+$$
+
+$$
+\nu_ {e} (x) = (\nu (x), 1); \tag {28}
+$$
+
+$$
+g _ {e} (x) = (g (x), \log p (x) - B (x) - \log h (x)); \tag {29}
+$$
+
+$$
+f _ {e} (z) = (f (z), \log p (z) - A (z) - \log h ^ {\prime} (z)). \tag {30}
+$$
+
+With this representation we have:
+
+$$
+\begin{array}{l} \left. \sum_ {x \in X} p _ {d} (x) \mid \langle \nu_ {e} (x), f _ {e} (z) \rangle - \langle \psi_ {e} (z), g _ {e} (x) \rangle \right| ^ {2} (31) \\ = \sum_ {x \in X} p _ {d} (x) | \log q (z | x) - \log p (z | x) | ^ {2} =: \Delta^ {2}. (32) \\ \end{array}
+$$
+
+Let $V$ be the matrix with rows $\nu_{e}(x)$ for all $x \in X$ . Let $G$ be the matrix with rows $g_{e}(x)$ for all $x \in X$ . We can rewrite the condition (31) in the form
+
+$$
+\xi = V f _ {e} (z) - G \psi_ {e} (z), \tag {33a}
+$$
+
+$$
+\left\| \xi \right\| _ {p _ {d}} ^ {2} = \Delta^ {2}, \tag {33b}
+$$
+
+where $\xi \in \mathbb{R}^{|X|}$ is the vector of residuals. Let $P$ be the orthogonal projection onto the range of $V$ in the space $\mathcal{H}$ . Multiplying (33a) by $P$ on the left, we obtain
+
+$$
+P V f _ {e} (z) - P G \psi_ {e} (z) = P \xi . \tag {34}
+$$
+
+Because $PV = V$ we obtain
+
+$$
+V f _ {e} (z) - P G \psi_ {e} (z) = P \xi . \tag {35}
+$$
+
+We therefore can consider the decoder network approximation $\tilde{f}_e(z) = \tilde{W}\psi_e(z)$ , where $\tilde{W}$ is the solution to the consistent system of linear equations $V\tilde{W} = PG$ and is independent of $z$ . We can therefore express
+
+$$
+\left\| V f _ {e} (z) - V \bar {f} _ {e} (z) \right\| _ {p _ {d}} = \| P \xi \| _ {p _ {d}} \leq \| \xi \| _ {p _ {d}} = \Delta , \tag {36}
+$$
+
+where the inequality holds because $P$ is an orthogonal projection in $\mathcal{H}$ .
+
+We obtained that the decoder network $f_{e}(z)$ can be approximated by a linear mapping $\tilde{W}\psi_{e}(z)$ such that
+
+$$
+\left. \sum_ {x \in X} p _ {d} (x) \mid \langle \nu_ {e} (x), f _ {e} (z) \rangle - \langle \nu_ {e} (x), \tilde {W} \psi_ {e} (z) \rangle \right| ^ {2} \leq \Delta^ {2}. \tag {37}
+$$
+
+Expressing back
+
+$$
+\begin{array}{l} \left\langle \nu_ {e} (x), f _ {e} (z) \right\rangle = \left\langle \nu (x), f (z) \right\rangle + \log p (z) - A (z) - \log h ^ {\prime} (z) (38a) \\ = \log p (x \mid z) + \log p (z) - \log h (x) - \log h ^ {\prime} (z) (38b) \\ = \log p (x, z) - \log h (x) - \log h ^ {\prime} (z) (38c) \\ \end{array}
+$$
+
+we obtain that
+
+$$
+\left. \sum_ {x \in X} p _ {d} (x) \right| \log p (x, z) - \left. \log \tilde {p} (x, z) \right| ^ {2} \leq \Delta^ {2}, \tag {39}
+$$
+
+where
+
+$$
+\log \tilde {p} (x, z) = \log h (x) + \log h ^ {\prime} (z) + \left\langle \nu_ {e} (x), W \psi_ {e} (z) \right\rangle . \tag {40}
+$$
+
+
+
+Proposition A.2. Under model Assumption 1, let $\mathcal{X}$ and $\mathcal{Z}$ be discrete (finite) sets and let $z\in \mathcal{Z}$ be chosen. If $q(z|x)\geq \alpha$ and $p(z|x)\geq \alpha$ for all $x\in X$ , where $X\subseteq \mathcal{X}$ and
+
+$$
+\mathbb {E} _ {p _ {d} (x)} \left[ D _ {\mathrm {K L}} \left(q (z \mid x) \| p (z \mid x)\right) \right] \leq \varepsilon , \tag {41}
+$$
+
+then
+
+$$
+\sum_ {x \in X} p _ {d} (x) (\log p (z | x) - \log q (z | x)) ^ {2} \leq \frac {\varepsilon}{\alpha^ {2}} + o (\varepsilon). \tag {42}
+$$
+
+Proof. Let us denote $\varepsilon(x) = D_{\mathrm{KL}}(q(z|x) \| p(z|x))$ . Pinsker's inequality assures for each $x$
+
+$$
+\sup _ {S \subset \mathcal {Z}} | \mathbb {P} _ {q (z \mid x)} (S) - \mathbb {P} _ {p (z \mid x)} (S) | ^ {2} \leq \varepsilon (x) / 2. \tag {43}
+$$
+
+Substituting $S = \{z\}$ we obtain
+
+$$
+\left| p (z \mid x) - q (z \mid x) \right| ^ {2} \leq \varepsilon (x) / 2. \tag {44}
+$$
+
+By taking expectation in $p_d(x)$ on both sides we obtain a variant of Pinsker's inequality:
+
+$$
+\mathbb {E} _ {p _ {d} (x)} | p (z | x) - q (z | x) | ^ {2} \leq \mathbb {E} _ {p _ {d} (x)} \varepsilon (x) / 2 = \frac {1}{2} \mathbb {E} _ {p _ {d} (x)} \left[ D _ {\mathrm {K L}} \left(q (z | x) \| p (z | x)\right) \right] \leq \varepsilon / 2. \tag {45}
+$$
+
+Notice that the LHS depends on the given $z$ . Because all summands are non-negative it follows that
+
+$$
+\forall X ^ {\prime} \subseteq \mathcal {X} \quad \sum_ {x \in X ^ {\prime}} p _ {d} (x) | p (z | x) - q (z | x) | ^ {2} \leq \varepsilon / 2. \tag {46}
+$$
+
+This inequality will be used in several places below.
+
+Consider $x \in X$ such that $p(z|x) > q(z|x)$ . Then
+
+$$
+\begin{array}{l} \left| \log p (z | x) - \log q (z | x) \right| ^ {2} = \log^ {2} \frac {p (z | x)}{q (z | x)} (47a) \\ = \log^ {2} (1 + \frac {p (z | x) - q (z | x)}{q (z | x)}) (47b) \\ \leq \log^ {2} (1 + \frac {p (z \mid x) - q (z \mid x)}{\alpha}), (47c) \\ \end{array}
+$$
+
+where the inequality holds because $\log^2$ is monotonously increasing for arguments greater equal than 1, which is ensured. Let us now consider $x\in X$ such that $p(z|x) < q(z|x)$ . Then
+
+$$
+\begin{array}{l} \left| \log p (z | x) - \log q (z | x) \right| ^ {2} = \log^ {2} \frac {q (z | x)}{p (z | x)} (48a) \\ = \log^ {2} (1 + \frac {q (z | x) - p (z | x)}{p (z | x)}) (48b) \\ \leq \log^ {2} (1 + \frac {q (z | x) - p (z | x)}{\alpha}). (48c) \\ \end{array}
+$$
+
+In total, we obtain
+
+$$
+\left| \log p (z | x) - \log q (z | x) \right| ^ {2} \leq \log^ {2} \left(1 + \frac {\left| p (z | x) - q (z | x) \right|}{\alpha}\right). \tag {49}
+$$
+
+Let us denote $u(x) = \frac{|p(z|x) - q(z|x)|}{\alpha}$ and partition the set $X$ into two parts:
+
+$$
+X _ {1} = \{x \in X \mid u (x) < u _ {0} \} \tag {50a}
+$$
+
+$$
+X _ {2} = \{x \in X \mid u (x) \geq u _ {0} \}, \tag {50b}
+$$
+
+where we chose $u_0 \in [\sqrt{e - 1}, 5]$ for reasons to be clarified below. For both parts, i.e. $k = 1, 2$ , we have
+
+$$
+\sum_ {x \in X _ {k}} p _ {d} (x) | \log q (z | x) - \log p (z | x) | ^ {2} \leq \sum_ {x \in X _ {k}} p _ {d} (x) \log^ {2} \left(1 + \frac {| p (z | x) - q (z | x) |}{\alpha}\right). \tag {51}
+$$
+
+For $X_{1}$ (51) can be further bounded as
+
+$$
+\leq \sum_ {x \in X _ {1}} p _ {d} (x) \log \left(1 + \frac {\left| p (z | x) - q (z | x) \right| ^ {2}}{\alpha^ {2}}\right) \tag {52a}
+$$
+
+$$
+\leq \log \sum_ {x \in X _ {1}} p _ {d} (x) \left(1 + \frac {\left| p (z | x) - q (z | x) \right| ^ {2}}{\alpha^ {2}}\right) \tag {52b}
+$$
+
+$$
+= \log \left(p _ {d} \left(X _ {1}\right) + \frac {1}{\alpha^ {2}} \sum_ {x \in X _ {1}} p _ {d} (x) | p (z | x) - q (z | x) | ^ {2}\right) \tag {52c}
+$$
+
+$$
+\leq \log \left(1 + \frac {\varepsilon}{2 \alpha^ {2}}\right) = \frac {\varepsilon}{2 \alpha^ {2}} + o (\varepsilon), \tag {52d}
+$$
+
+where the first inequality holds for $u_0 \leq 5$ , because in this case $\log^2 (1 + u) \leq \log (1 + u^2)$ holds, the second inequality is the Jensen's inequality for $\log$ and the last inequality uses (46) under monotone log.
+
+For $X_{2}$ we have the following. Let $V = p_{d}(X_{2}) = \sum_{x\in X_{2}}p_{d}(x)$ . We can express
+
+$$
+\sum_ {x \in X _ {2}} p _ {d} (x) \log^ {2} \left(1 + \frac {\left| p (z | x) - q (z | x) \right|}{\alpha}\right) \tag {53a}
+$$
+
+$$
+= V \left(\sum_ {x \in X _ {2}} p _ {d} (x \mid X _ {2}) \log^ {2} \left(1 + \frac {\left| p (z \mid x) - q (z \mid x) \right|}{\alpha}\right)\right) \tag {53b}
+$$
+
+Using that $u < u^2$ on $X_2$ and that $\log^2(1 + u)$ is monotone for a positive argument, we can bound (53b) as
+
+$$
+\leq V \left(\sum_ {x \in X _ {2}} p _ {d} (x \mid X _ {2}) \log^ {2} \left(1 + \frac {\left| p (z \mid x) - q (z \mid x) \right| ^ {2}}{\alpha^ {2}}\right)\right). \tag {54}
+$$
+
+Further, using that $\log^2 (1 + v)$ is concave on $X_{2}$ for $v\geq e - 1$ , we have
+
+$$
+\leq V \log^ {2} \left(\sum_ {x \in X _ {2}} p _ {d} (x \mid X _ {2}) \left(1 + \frac {\left| p (z \mid x) - q (z \mid x) \right| ^ {2}}{\alpha^ {2}}\right)\right) \tag {55a}
+$$
+
+$$
+= V \log^ {2} \left(1 + \sum_ {x \in X _ {2}} p _ {d} (x \mid X _ {2}) \frac {\left| p (z \mid x) - q (z \mid x) \right| ^ {2}}{\alpha^ {2}}\right) \tag {55b}
+$$
+
+$$
+\leq V \log^ {2} \left(1 + \frac {\varepsilon}{2 \alpha^ {2} V}\right), \tag {55c}
+$$
+
+where in the last step we used (46).
+
+Next we show that $V$ itself is bounded above by $\frac{\varepsilon}{2u_0^2\alpha^2}$ . It follows from
+
+$$
+u _ {0} ^ {2} V = \sum_ {x \in X _ {2}} p _ {d} (x) u _ {0} ^ {2} \leq \sum_ {x \in X _ {2}} p _ {d} (x) \frac {\left| p (z | x) - q (z | x) \right| ^ {2}}{\alpha^ {2}} \leq \sum_ {x \in X} p _ {d} (x) \frac {\left| p (z | x) - q (z | x) \right| ^ {2}}{\alpha^ {2}} \leq \frac {\varepsilon}{2 \alpha^ {2}}, \tag {56}
+$$
+
+where the last inequality is again (46).
+
+Now, letting $r = \frac{\varepsilon}{2\alpha^2V} \geq u_0^2 \geq 1$ we can bound (55c) as follows
+
+$$
+\begin{array}{l} V \log^ {2} \left(1 + \frac {\varepsilon}{2 \alpha^ {2} V}\right) = \frac {\varepsilon}{2 \alpha^ {2}} \frac {1}{r} \log^ {2} (1 + r) (57a) \\ \leq \frac {\varepsilon}{2 \alpha^ {2}} \sup _ {r \geq 1} \frac {1}{r} \log^ {2} (1 + r) \leq \frac {\varepsilon}{2 \alpha^ {2}} 0. 6 4. (57b) \\ \end{array}
+$$
+
+
+
+Theorem 2 follows by Proposition A.2 and Proposition A.1 with the choice $X = \mathcal{X}$
+
+# B DISCUSSION
+
+In this section we discuss further connections to related work and some open questions.
+
+Cremer et al. (2018) showed experimentally that using a more expressive class of models for the encoder reduces not only the posterior family mismatch but also the amortization error. This observation is compatible with our results: increasing the expressive power of the encoder admits tight VAEs with more complex dependence of $z$ on $x$ . Indeed, increasing the expressive power of the encoder in our setting means extending its sufficient statistics $\psi(z)$ by new components. While it keeps the simple linear dependence $g(x) = W^{\mathsf{T}}\nu(x)$ characterizing tight VAEs, it does lead to a more expressive GLM $p(z|x)$ . Conversely, our results suggest that increasing the complexity of the encoder network in order to reduce the amortization gap is only useful for models that are far from the consistent set. Furthermore, there could be negative impact from increasing the model depth in practice: (Dai et al., 2020) demonstrated that the risk of the learning converging to a suboptimal solution (in particular leading to more collapsed latent dimensions) increases with decoder depth.
+
+Lucas et al. (2019) showed that any spurious local minima in linear Gaussian VAEs are entirely due to the marginal log likelihood and that the ELBO does not introduce any new local minima. It is a good question5 whether something similar can be said about the EF VAE generalization. To our best knowledge this is not straightforward in such a general setting. The result of Lucas et al. (2019) is possible thanks to the fact that for linear Gaussian models ELBO is analytically tractable and its stationary point conditions can be written down and analyzed. In the general EF setup, which includes, e.g., MRF VAEs, this does not appear possible. On the other hand, for any consistent EF VAE, the decoder posterior must be in the EF of the encoder. Therefore the optimal encoder could be easier to find analytically or numerically using forward KL divergence and not the reverse KL divergence used in ELBO, thus circumventing the question about local optima of ELBO. Since ELBO at the optimal encoder is tight for a consistent VAE, this could be an alternative way to find the global maximum.
+
+A recent work by Sicks et al. (2021) extends the result of Lucas Lucas et al. (2019) in that they develop an analytical local approximation to ELBO, which is exact in the Gaussian linear model case and is a lower bound on ELBO for Binomial observation model. These results allow to analyze ELBO (and in particular the posterior collapse problem) locally under the assumption that the decoder's mapping $f(z)$ is (locally) an affine mapping of $z$ . Our Theorem 1 implies it must be so globally for tight VAEs in several special cases (e.g., Bernoulli model), while in general it is an affine mapping of $\psi(z)$ . These connections indicate that a better understanding of VAEs can be reached in the setting where either decoder or encoder or both are consistent with the joint model (7).
+
+We restricted this study to exponential families. While in richer models discussed in the introduction, the approximation error still exists, it is made small by design, and it is less relevant and harder to analyze it theoretically. One possible open direction where such analysis would make sense is to consider fully factorized non-exponential cases, e.g., Student-t VAEs (Takahashi et al., 2018) or models satisfying hierarchical or partial factorization (Maaløe et al., 2019).
+
+# C DETAILS OF EXPERIMENTAL SETUP
+
+# C.1 ARTIFICIAL EXAMPLE
+
+We give here the achieved likelihood and ELBO values for this experiment. The negative entropy $\sum_{x}p^{*}(x)\log p^{*}(x)$ of the ground truth model, i.e., the best reachable data log-likelihood, is $-3.65$ . The ELBO of the pre-trained VAE is $-3.74$ . During the second step of training, i.e., the joint learning of the encoder and decoder by ELBO maximization, the ELBO value increases from $-3.74$ to $-3.70$ . The data log-likelihood $\sum_{x}p^{*}(x)\log p_{\theta}(x)$ drops at the same time from $-3.65$ to $-3.68$ . The approximation error (2) in the decoder caused by using the factorized encoder is only 0.03 nats, but the qualitative difference between the ground truth model and the ELBO optimizer model shown in Fig. 2 appears detrimental.
+
+# C.2 BERNOULLI VAE FOR TEXT DOCUMENTS
+
+Dataset In this experiment we used the version of the 20Newsgroups data set (Lang & Rennie, 2008) denoted as "processed" by the authors. The dataset contains bag-of-words representations of documents and is split into a training set with 11269 documents and a test set with 7505 documents. We keep only the 10000 most frequent words in the training set, which is a common pre-processing (each of the omitted words occurs not more than in 10 documents).
+
+Optimization To train VAE we used the state-of-the-art unbiased gradient estimator ARM (Yin & Zhou, 2019) and Adam optimizer with learning rate 0.001. We did not use the test set for parameter selection. We train for 1000 epochs using 1-sample ARM and then for 500 more epochs using 10 samples for computing each gradient estimate with ARM. We report the lowest negative ELBO (NELBO) values for the training set and test set during all epochs.
+
+Models The decoder model (13) describes words as independent draws from a categorical distribution specified by the neural network $f(z)$ . This network respectively has a structure
+
+$$
+\operatorname {L i n e a r} \to \underbrace {\left(\operatorname {R e L U} \to \operatorname {L i n e a r}\right)} _ {\times \text {d h i d d e n}} \to \operatorname {L o g s o f t m a x}.
+$$
+
+The input dimension equals to the number of latent bits, the output dimension equals the number of words in the dictionary, 10000. For decoders with dhidden $= 1,2$ the hidden layers contained 512 units.
+
+The encoder networks e2, e3 take on the input word frequencies $x / \sum_{k}x_{k}$ , the encoder network e1 takes on input word counts $x$ . For the deep encoder e2 we used 2 hidden ReLU layers with 512 units each.
\ No newline at end of file
diff --git a/vaeapproximationerrorelboandexponentialfamilies/images.zip b/vaeapproximationerrorelboandexponentialfamilies/images.zip
new file mode 100644
index 0000000000000000000000000000000000000000..5c37d2077f81f3e2cbc546fc5962a154df2fc7d2
--- /dev/null
+++ b/vaeapproximationerrorelboandexponentialfamilies/images.zip
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:92cbad5b87c2f4167d06d47f815c73932a49eef783f370892cd0897a4453a9df
+size 675355
diff --git a/vaeapproximationerrorelboandexponentialfamilies/layout.json b/vaeapproximationerrorelboandexponentialfamilies/layout.json
new file mode 100644
index 0000000000000000000000000000000000000000..30ae59d2ebb513b5bd13d204823ad726b3638b04
--- /dev/null
+++ b/vaeapproximationerrorelboandexponentialfamilies/layout.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:c4a0474bb059c2a40b8844b839af6066f8869a154a3340a9d4f5b593ff646843
+size 813121
diff --git a/valuegradientweightedmodelbasedreinforcementlearning/9c4cdf72-62f3-4a8d-9611-3d82d5c1330d_content_list.json b/valuegradientweightedmodelbasedreinforcementlearning/9c4cdf72-62f3-4a8d-9611-3d82d5c1330d_content_list.json
new file mode 100644
index 0000000000000000000000000000000000000000..a4f2d661ce1497c338462234e84de02860cbd35b
--- /dev/null
+++ b/valuegradientweightedmodelbasedreinforcementlearning/9c4cdf72-62f3-4a8d-9611-3d82d5c1330d_content_list.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:abac2f814d269170aa776f02fd3bf14089b29a4b4b46d7f986cce5a053c946c5
+size 109153
diff --git a/valuegradientweightedmodelbasedreinforcementlearning/9c4cdf72-62f3-4a8d-9611-3d82d5c1330d_model.json b/valuegradientweightedmodelbasedreinforcementlearning/9c4cdf72-62f3-4a8d-9611-3d82d5c1330d_model.json
new file mode 100644
index 0000000000000000000000000000000000000000..ec4ceaf93bc36141748dbfd40d2c05cd2c8baf7f
--- /dev/null
+++ b/valuegradientweightedmodelbasedreinforcementlearning/9c4cdf72-62f3-4a8d-9611-3d82d5c1330d_model.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:2df9fdad5af98e7f174f908d43fbebe46458108bff975b276d212ebd4b1bb424
+size 127890
diff --git a/valuegradientweightedmodelbasedreinforcementlearning/9c4cdf72-62f3-4a8d-9611-3d82d5c1330d_origin.pdf b/valuegradientweightedmodelbasedreinforcementlearning/9c4cdf72-62f3-4a8d-9611-3d82d5c1330d_origin.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..4ca7bf56b24ad83111ad7b6da5da32b37211af4b
--- /dev/null
+++ b/valuegradientweightedmodelbasedreinforcementlearning/9c4cdf72-62f3-4a8d-9611-3d82d5c1330d_origin.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:087e6bda2b837a71d14169f6559fab4260c7e31d807b1f789a803ab7ea4999b2
+size 648390
diff --git a/valuegradientweightedmodelbasedreinforcementlearning/full.md b/valuegradientweightedmodelbasedreinforcementlearning/full.md
new file mode 100644
index 0000000000000000000000000000000000000000..11fbf04b0d4a15ab1568e770fc82986988b9afc9
--- /dev/null
+++ b/valuegradientweightedmodelbasedreinforcementlearning/full.md
@@ -0,0 +1,393 @@
+# VALUE GRADIENT WEIGHTED MODEL-BASED REINFORCEMENT LEARNING
+
+Claas A. Voelcker $^{1,2}$ , Victor Liao $^{1,3}$ , Animesh Garg $^{1,2,4}$ , Amir-massoud Farahmand $^{1,2}$
+
+$^{1}$ Vector Institute, $^{2}$ University of Toronto, $^{3}$ University of Waterloo, $^{4}$ Nvidia Correspondence to c.voelcker@cs.toronto.edu
+
+# ABSTRACT
+
+Model-based reinforcement learning (MBRL) is a sample efficient technique to obtain control policies, yet unavoidable modeling errors often lead to performance deterioration. The model in MBRL is often solely fitted to reconstruct dynamics, state observations in particular, while the impact of model error on the policy is not captured by the training objective. This leads to a mismatch between the intended goal of MBRL, enabling good policy and value learning, and the target of the loss function employed in practice, future state prediction. Naive intuition suggests that value-aware model learning would fix this problem and, indeed, several solutions to this objective mismatch problem have been proposed based on theoretical analysis. However, they tend to be inferior in practice to commonly used maximum likelihood (MLE) based approaches. In this paper we propose the Value-Gradient weighted Model loss (VaGram), a novel method for value-aware model learning which improves the performance of MBRL in challenging settings, such as small model capacity and the presence of distracting state dimensions. We analyze both MLE and value-aware approaches and demonstrate how they fail to account for sample coverage and the behavior of function approximation when learning value-aware models. From this, we highlight the additional goals that must be met to stabilize optimization in the deep learning setting. To achieve this, we leverage the gradient of the empirical value function as a measure of the sensitivity of the RL algorithm to model errors. We verify our analysis by showing that our loss function is able to achieve high returns on the Mujoco benchmark suite while being more robust than maximum likelihood based approaches.
+
+# 1 INTRODUCTION
+
+Model-based Reinforcement Learning (MBRL) is a sample-efficient approach to obtain a policy for a given control problem. It solves the control optimization into two interleaved stages: model learning and planning. In the model learning stage, an approximate model of the environment is learned which is then utilized in the planning stage to generate new experience without having to query the original environment. Often this process is repeated by continuously updating the model with new experience and replanning based on the updated model. MBRL is an enticing paradigm for scenarios in which samples of the true environment are difficult or expensive to obtain, such as computationally intensive simulators, real-world robots, or environments involving humans, since the model can be used to generalize the policy to unseen regions of the state space. The approach has received a lot of attention and significant progress has been made in the field (Sutton, 1990; Deisenroth & Rasmussen, 2011; Levine & Koltun, 2013; Hafner et al., 2020; Moerland et al., 2020; Schrittwieser et al., 2020).
+
+One of the core problems of model-based policy learning methods, however, is that the accuracy of the model directly influences the quality of the learned policy or plan (Schneider, 1997; Kearns & Singh, 2002; Ross & Bagnell, 2012; Talvitie, 2017; Luo et al., 2019; Janner et al., 2019). Model errors tend to accumulate over time, and therefore long-term planning under approximate models can lead to suboptimal policies compared to the performance achievable with model-free approaches. This is especially prevalent in settings with complex dynamics, such as robotic environments with discontinuities, which can be hard to model with common function approximation methods. These model approximation errors are nearly impossible to avoid with current methods due to limits of
+
+function approximation in model and value learning algorithms, which cannot fully capture the full distribution over dynamics functions perfectly, and the use of finite datasets.
+
+Hence, it is important that a model is accurate where it counts for the planning procedure, by modelling dimensions and data points that have a higher impact on the planning. But this objective is not captured in most current MBRL methods, which generally use maximum likelihood estimation (MLE) to learn a parametric model of the environment without involving information from the planning process. The misalignment between the model learning and planning stages of MBRL has recently received renewed interest and is now commonly termed the objective mismatch of reinforcement learning (Lambert et al., 2020), but the problems has been investigated in earlier works (Joseph et al., 2013). Several recent papers have investigated the objective mismatch (Abachi et al., 2020; Zhang et al., 2021; Ayoub et al., 2020; Grimm et al., 2020; 2021; Nikishin et al., 2022), but currently theoretical investigation and understanding of possible approaches do not perform well when applied to complex deep learning based approaches (Lovatto et al., 2020) or the proposed approaches rely on heuristics which might not be applicable generally (Nair et al., 2020).
+
+Summary of Contributions. We present the Value-Gradient weighted Model loss (VaGraM) which rescales the mean squared error loss function with gradient information from the current value function estimate. We demonstrate the advantage of the VaGraM loss over previous approaches via the analysis of the optimization behavior of the Value-Aware Model Learning framework (Farahmand et al., 2017; Farahmand, 2018) and form two hypotheses for the lack of empirical performance gain despite theoretical intuition: (a) the theory does not account for the optimization trajectory induced by the loss function and (b) it also does not address how to counter problems that arise when the state-space is yet insufficiently explored in early stages of the model training. Our experiments show, qualitatively and quantitatively, that the VaGraM loss impacts the resulting state and value prediction accuracy, and that it solves the optimization problems of previously published approaches. Beyond pedagogical domains, we show that VaGraM performs on par with a current state-of-the-art MBRL algorithms in more complex continuous control domains, while improving robustness to irrelevant dimensions in the state-space and smaller model sizes.
+
+# 2 BACKGROUND
+
+We consider the discounted MDP setting $(\mathcal{S},\mathcal{A},p,r,\gamma)$ (Puterman, 1994), where $\mathcal{S}$ denotes the state space, $\mathcal{A}$ the action space of an agent, $p$ is a transition probability kernel, $r:\mathcal{S}\times \mathcal{A}\to \mathbb{R}$ is a scalar reward function, and $\gamma$ denotes the reward discount factor. Following the standard setting of reinforcement learning, the goal is to obtain an agent which maximizes the reward function while interacting with the environment by taking actions after an optimal (potentially stochastic) policy $\pi^{*}$ without knowledge of the true transition kernel.
+
+We will concentrate on value function-based methods to solve the reinforcement learning problem. With these, the aim is to learn a function $V_{\pi}:S\to \mathbb{R}$ which represent the (discounted) reward obtained in state $s$ by following policy $\pi$ from there: $V_{\pi}(s) = \mathbb{E}_{(s_0,a_0,\dots)}[\sum_{t = 0}^{\infty}\gamma^t r(s_t,a_t)|s_0 = s]$ . It is also helpful to define an action-value function $Q(s,a) = r(s,a) + \gamma \int p(s'|s,a)V(s')ds'$ . Many approaches (Watkins & Dayan, 1992; Mnih et al., 2013; Wang et al., 2016; Haarnoja et al., 2018) try to learn this function by minimizing the deviations of the value function approximation to a bootstrap target: $\min_{\phi}\mathbb{E}\left[(Q_{\phi}(s,a) - (r(s,a) + \gamma \int p(s'|s,a)V(s')\mathrm{d}s'))^{2}\right]$ . This equation forms the core motivation for our investigation of MBRL.
+
+# 2.1 MODEL-BASED REINFORCEMENT LEARNING
+
+In the MBRL framework, an approximate model $\hat{p}$ is trained from data to represent the unknown transition function $p$ . We will use the word 'model' to refer to the learned approximation and 'environment' to refer to the unknown MDP transition function.
+
+We concentrate on the Dyna algorithm (Sutton, 1990) and specifically investigate the impact of model errors on the planning procedure. Dyna uses a dataset $\mathcal{D}$ of past experiences from the envi
+
+ronment $\mathcal{D} = (s_i,a_i,r_i,s_i')_{i = 1}^N$ . A parametric model $\hat{p}_{\theta}$ of the environment is learned by a maximum likelihood estimate using $\mathcal{D}$ : $\theta^{*} = \arg \max_{\theta}\sum_{i = 1}^{N}\log \hat{p}_{\theta}(s_i',r_i|s_i,a_i)$ . This model $\hat{p}_{\theta}$ is then used to sample new next states $s_{\mathrm{model}}'\sim \hat{p}_{\theta}(\cdot |s,a)$ to obtain better coverage of the state-action space. The samples are used to train the value function and policy as if they were samples from the environment. It is also possible to learn deterministic models, which we will denote as $f_{\theta}$ for clarity.
+
+# 2.2 KEY INSIGHT: MODEL MISMATCH PROBLEM
+
+One of the main drawbacks of model-based reinforcement learning is the fact that model errors propagate and compound when the model is used for planning (Schneider, 1997; Kearns & Singh, 2002; Talvitie, 2017). As a simple example, assume that a sample is collected from a deterministic model and has an error $\epsilon$ . A value function based method will use the model sample to compute a biased bootstrap target $r(s, a) + \gamma V(s' + \epsilon)$ .
+
+The impact of the modelling error on the value function therefore depends on the size of the error and the local behavior of the value function. As an extreme example take a value function that only depends on a subset of all state observation dimensions. In this case, a large error in an irrelevant dimension has no consequence on the obtained policy, yet a maximum likelihood loss for the model cannot properly capture this behavior without prior handcrafted features.
+
+We can motivate the use of MLE (such as the mean squared error for a Gaussian model with fixed variance) as a loss function by an upper bound: $\sup_{V\in \mathcal{F}}|\langle p - \hat{p},V\rangle |\leq ||p - \hat{p} ||_1\sup_{V\in \mathcal{F}}||V||_\infty \leq$ $\sqrt{\mathrm{KL}(p||\hat{p})}\sup_{V\in \mathcal{F}}||V||_{\infty}$ (Farahmand et al., 2017), but this bound is loose and does not account for the geometry of the problem's value function. In our example above a mean squared error would penalize deviations equally by their $L_{2}$ norm without accounting for the relevance of the dimensions.
+
+# 2.3 VALUE-AWARE MODEL LEARNING
+
+To address the model mismatch, Farahmand et al. (2017) proposed Value-aware Model Learning (VAML), a loss function that captures the impact the model errors have on the one-step value estimation accuracy. The core idea behind VAML is to penalize a model prediction by the resulting difference in a value function. Given a distribution over the state-action space $\mu$ and a value function $V$ , it is possible to define a value-aware loss function $\mathcal{L}_V(\hat{p}, p, \mu)$ :
+
+$$
+\mathcal {L} _ {V} (\hat {p}, p, \mu) = \int \mu (s, a) \left| \overbrace {\int p \left(s ^ {\prime} \mid s , a\right) V \left(s ^ {\prime}\right) \mathrm {d} s ^ {\prime}} ^ {\text {e n v i r o n m e n t v a l u e e s t i m a t e}} - \overbrace {\int \hat {p} \left(s ^ {\prime} \mid s , a\right) V \left(s ^ {\prime}\right) \mathrm {d} s ^ {\prime}} ^ {\text {m o d e l v a l u e e s t i m a t e}} \right| ^ {2} \mathrm {d} (s, a) \tag {1}
+$$
+
+and its empirical approximation $\hat{\mathcal{L}}_V$ based on a dataset $D = (s, a, s')_{i=1}^{N}$ of samples from $\mu$ and $p$ :
+
+$$
+\hat {\mathcal {L}} _ {V} (\hat {p}, \mathcal {D}) = \sum_ {(s _ {i}, a _ {i}, s _ {i} ^ {\prime}) \in \mathcal {D}} \left| V \left(s _ {i} ^ {\prime}\right) - \int (\hat {p} \left(s ^ {\prime} \mid s _ {i}, a _ {i}\right)) V \left(s ^ {\prime}\right) d s ^ {\prime} \right| ^ {2}. \tag {2}
+$$
+
+It is worth noting that if the loss $\mathcal{L}_V$ is zero for a given model, environment and corresponding value function, then estimating the bootstrap target based on the model will result in the exact same update as if the environment were used. However, this is rarely the case in practice!
+
+The main problem of this approach is that it relies on the value function, which is not known a priori while learning the model. In the original formulation by Farahmand et al. (2017), the value function is replaced with the supremum over a function space. While this works well in the case of linear value function spaces, finding a supremum for a function space parameterized by complex function approximators like neural networks is difficult. Furthermore, the supremum formulation is conservative and does not account for the fact that knowledge about the value function is gained over the course of exploration and optimization in a MBRL approach.
+
+Instead of the supremum over a value function class, Farahmand (2018) introduced a modification of VAML called Iterative Value-Aware Model Learning (IterVAML), where the supremum is replaced with the current estimate of the value function, . In each iteration, the value function is updated based on the model, and the model is trained using the loss function based on the last iteration's value function. The author presents error bounds for both steps of the iteration, but did not test
+
+the algorithm to ascertain whether the presented error bounds are sufficient to guarantee a strong algorithm in practice. Notably IterVAML provides an intuitive fix to the model-mismatch problem, yet overlooks two key optimization issues which lead to empirical ineffectiveness.
+
+# 3 VALUE-GRADIENT WEIGHTED MODEL LOSS (VAGRAM)
+
+We present Value-Gradient weighted Model loss (VaGraM), a loss which is value-aware and has stable optimization behavior even in challenging domains with function approximation. To motivate the loss function, we highlight two causes for the lack of empirical improvements of IterVAML over MLE based approaches. These phenomena are investigated and verified in detail in section 4.
+
+Value function evaluation outside of the empirical state-action distribution IterVAML suffers when randomly initialized models predict next states that are far away from the current data distribution or if the optimization procedure leads the model's prediction outside of the covered state space. Since the value function has only been trained on the current data distribution, it will not have meaningful values at points outside of its training set. Nonetheless, these points can still achieve small value prediction errors if, due to the optimization process, the value function outside the training distribution happens to have the same value at the model prediction as at the environment sample. We therefore require that our value-aware loss function should not directly depend on the value function at the model prediction, since these might be potentially meaningless.
+
+Suboptimal local minima Since the model can converge to a solution that is far away from the environment sample if the values are equal, we find that the model-based value prediction often performs poorly after updating the value function. We expect that the updated model loss forces the model prediction to a new solution, but due to the non-convex nature of the VAML loss, the model can get stuck or even diverge. This is especially prevalent when the previous minimum is situated outside of the empirically covered state space. A stable value-aware loss function should therefore have only one minimum in the state space $^2$ that lies within the empirical state distribution.
+
+# 3.1 APPROXIMATING A VALUE-AWARE LOSS WITH THE VALUE FUNCTION GRADIENT
+
+To derive a loss function that fulfils these requirements, we start from the assumption that the difference between the model prediction and the environment next states $s'$ are small. This is implicitly required by many MBRL approaches, since an MLE model cannot be used to estimate the next state's value otherwise. We also assume that the model has small transition noise, akin to the model assumptions underlying MSE regression, otherwise the difference between a model sample and the next state sample might be large. Under this assumption, the IterVAML loss can be approximated by a Taylor expansion of the value function, where we denote the expansion of $V$ around a reference point $s'$ as $\hat{V}_{s'}$ and obtain $\hat{V}_{s'}(s) \approx V(s') + (\nabla_s V(s)|_{s'})^\top (s - s')$ . Using this expansion at the next state sample $s_i' \in \mathcal{D}$ collected from the environment for each tuple independently instead of the original value function, the VAML error can be stated as:
+
+$$
+\begin{array}{l} \hat {\mathcal {L}} _ {\hat {V}} = \sum_ {\left\{s _ {i}, a _ {i}, s _ {i} ^ {\prime} \right\} \in \mathcal {D}} \left(V \left(s _ {i} ^ {\prime}\right) - \int \hat {p} _ {\theta} \left(s ^ {\prime} \mid s _ {i}, a _ {i}\right) \left(V \left(s _ {i} ^ {\prime}\right) + \left(\nabla_ {s} V (s) \mid_ {s _ {i} ^ {\prime}}\right) ^ {\intercal} \left(s ^ {\prime} - s _ {i} ^ {\prime}\right)\right) \mathrm {d} s ^ {\prime}\right) ^ {2} (3) \\ = \sum_ {\left\{s _ {i}, a _ {i}, s _ {i} ^ {\prime} \right\} \in \mathcal {D}} \left(\int \hat {p} _ {\theta} \left(s ^ {\prime} \mid s _ {i}, a _ {i}\right) \left(\left(\nabla_ {s} V (s) \mid_ {s _ {i} ^ {\prime}}\right) ^ {\intercal} \left(s ^ {\prime} - s _ {i} ^ {\prime}\right)\right) d s ^ {\prime}\right) ^ {2} (4) \\ \end{array}
+$$
+
+This objective function crucially does not depend on the value function at unknown state samples, all $s_i'$ are in the dataset the value function is trained on, which solves the first of our major problems with the VAML paradigm.
+
+We can simplify the objective above even further if we restrict ourselves to deterministic models of the form $\hat{s}_i' = f_\theta(s, a)$ . Since VAML requires the expectation of the value function under the model
+
+
+Figure 1: Visualization of discussed loss function with regards to a reference point marked with the white cross and the corresponding value function on the Pendulum environment. For the value function, darker color indicates a lower value. In the loss figures, darker color indicates how large the loss is if the model predicts $(\theta ,\dot{\theta})$ instead of the reference sample marked in white. The VAML loss has a complex non-linear shape in the state space that follows isolines of the value function, while MSE and VaGraM are centered around the sample. For VaGraM, the rescaling of the MSE in the direction of high gradient along the $\theta$ axis is visible. Due to Equation 7, the scaling is aligned with the axis of the coordinate system and not rotated to fit the value function closer.
+
+and the environment to be equal, we can exchange the probabilistic model with a deterministic one as long as we assume that the mean value function under the true environment is close to the empirical estimate of the value function from a single sample. We explore the prerequisites and consequences of this assumption further in Appendix F. The model loss can then be expressed as:
+
+$$
+\sum_ {i} \left(\left(\nabla_ {s} V (s) \mid_ {s _ {i} ^ {\prime}}\right) ^ {\intercal} \left(f _ {\theta} \left(s _ {i}, a _ {i}\right) - s _ {i} ^ {\prime}\right)\right) ^ {2} \tag {5}
+$$
+
+We can see that the objective is similar to a mean squared error regression with a vector that defines the local geometry of the objective function. This vector can be interpreted as a measure of sensitivity of the value function at each data point and dimension. In regions where the value function changes significantly, the regression incentivizes the model to be very accurate.
+
+# 3.2 PREVENTING SPURIOUS LOCAL MINIMA
+
+The formulation above retains one problem, Equation 5 does not constrain the solution for each $(s,a,s')$ tuple sufficiently. For each $(s,a,s')$ tuple, the loss function only requires that the difference between the model and environment sample be orthogonal to the gradient of the value function, which describes a hyperplane of solutions. These predictions can lie arbitrarily far away from the environment sample, which breaks the assumption underlying the Taylor approximation that the model prediction is within a small region of the expanded state point. For more details see Appendix A.
+
+To prevent these suboptimal solutions and achieve our second design goal, we consider an upper bound on the value-gradient loss by applying the Cauchy Schwartz inequality $\left(\sum_{i=1}^{n} x_i\right)^2 \leq n \sum x_i^2$ to change the square of the sum with a sum of squares. We denote the diagonal matrix with vector $a$ on the diagonal as $\operatorname{diag}(a)$ and refer to the dimensionality of the state space as $\dim(S)$ and rephrase the sum as a vector-matrix multiplication:
+
+$$
+\begin{array}{l} \sum_ {\left\{s _ {i}, a _ {i}, s _ {i} ^ {\prime} \right\} \in \mathcal {D}} \left(\left(\nabla_ {s} V (s) \mid_ {s _ {i} ^ {\prime}}\right) ^ {\top} \left(f _ {\theta} \left(s _ {i}, a _ {i}\right) - s _ {i} ^ {\prime}\right)\right) ^ {2} (6) \\ \leq \dim (\mathcal {S}) \sum_ {\left\{s _ {i}, a _ {i}, s _ {i} ^ {\prime} \right\} \in \mathcal {D}} \left(\left(f _ {\theta} \left(s _ {i}, a _ {i}\right) - s _ {i} ^ {\prime}\right) ^ {\mathsf {T}} \operatorname {d i a g} \left(\nabla_ {s} V (s) \mid_ {s _ {i} ^ {\prime}}\right) ^ {2} \left(f _ {\theta} \left(s _ {i}, a _ {i}\right) - s _ {i} ^ {\prime}\right)\right). (7) \\ \end{array}
+$$
+
+This reformulation is equivalent to a mean squared error loss function with a per-sample diagonal scaling matrix. Because the scaling matrix is positive semi-definite by design, each summand in the loss is a quadratic function with a single solution as long as the derivative of the value function does not become zero in any component. Therefore this upper bound assures our second requirement: the loss function does not admit spurious local minima.3
+
+
+Figure 2: Evolution of the VAML loss over changing value functions on the Pendulum domain. Lines denote the mean and shaded areas show standard error over 8 model initialization and data set samples per model. In the linear setting, VAML achieves the lowest VAML error, while VaGraM is able to significantly outperform MSE. In the NN setting, VAML diverges rapidly, while VaGraM and MSE converge to approximately the same solution.
+
+
+
+To give an intuitive insight into all the discussed loss functions, we visualized each one for a pedagogical environment, the Pendulum stabilization task. The resulting loss curves can be seen in Figure 1. The VAML loss has a complicated shape that depends on the exact values of the value function while both MSE and our proposal have a paraboloid shape. Compared to MSE, our proposed loss function is rescaled to account for the larger gradient of the value function in the $\theta$ axis.
+
+# 4 EXPERIMENT: MODEL LEARNING IN LOW-DIMENSIONAL PROBLEM
+
+We compare the performance of VaGraM, with both MSE and VAML on a pedagogical environment with a small state space and smooth dynamics to gain qualitative insight into the loss surfaces. We use the Pendulum environment, a canonical control problem in which an under-actuated pendulum must be swung and stabilized to an upright position. We use the implementation provided by Brockman et al. (2016). To learn the policy and its value function, we use the SAC algorithm (Haarnoja et al., 2018). The original IterVAML paper assumed that the value function was obtained using approximate value iteration (AVI) (Gordon, 1995; Ernst et al., 2005; Farahmand et al., 2010). We use SAC instead of a full AVI for stability in large scale experiments and discuss a proper extension of the VAML loss to SAC in Appendix C. We find that the difference in loss is negligible and therefore use SAC together with VAML throughout our experiments. More information on the implementation and hyperparameters of all of our experiments can be found in Appendix E.
+
+To simplify the setup of the evaluation, we decided to investigate the model losses without model-based value function learning. This allows us to focus solely on the loss functions, without taking into account the inter-dependency between model and value function updates. Instead of the model-based loop, we used the SAC algorithm in a model-free setup to estimate the value function. We saved the intermediate value functions after each epoch of training, corresponding to 200 environment steps, and optimized the models using stochastic gradient descent on the respective loss function, updating the value function used for the loss every 1000 model training steps. As the MLE loss, we used the mean squared error which assumes a Gaussian model with fixed variance.
+
+To compare the optimization, we used two architectures, a linear regression without feature transformations and a neural network with a single hidden layer and 16 neurons. We sampled a dataset uniformly over the whole state space and used the environment transition function to compute ground truth next state samples. Finally, we evaluated each models VAML error with regards to the current value function on a held out dataset and plotted the results in Figure 2.
+
+Dependency on untrained value function estimates. The first cause for lacking empirical performance with VAML that we discussed in section 3 was that the algorithm can move outside of the covered state space region where the value function prediction is often meaningless.
+
+
+Figure 3: Performance of VaGraM and MLE models with reduced model size. The dotted lines correspond to the final performance reported for model-free SAC (grey, approx. 3200). Shaded area represents standard error over 16 repeated runs. VaGraM continues to solve the task almost unimpeded, while MLE is unable to even stabilize the Hopper when using a two layer neural network.
+
+In our experiment we find that a linear regression model remains stable under all three loss functions, VaGraM, MSE and VAML. But when using a flexible function approximation, the VAML loss converges in the first iteration with the given value function, but then rapidly diverges once the value function is updated. When investigating the mean squared error of the VAML solution, we find that the model finds a stable minimum of the VAML loss outside of the reachable state space of the pendulum. This confirms our hypothesis that flexible VAML models can find solutions outside of the empirical state space distribution, which are unstable once we update the value function. VaGraM remains stable even with flexible function approximation and achieves a lower VAML error than the MSE baseline when using a model with insufficient capacity to represent the dynamics.
+
+Single solution convergence. In the experiment, we see that the MSE and VaGraM models converge to a similar solution when using a neural network. This leads us to the conclusion that our loss function really only admits a single solution and that this solution coincides with the mean square error prediction when the function approximation has sufficient capacity to model the dynamics function with high precision. On the other hand, the VAML network converges to solutions that are far away from the environment sample measured in the $L_{2}$ norm and it cannot recover from these spurious minima due to the complex optimization landscape.
+
+# 5 EXPERIMENT: MODEL-BASED CONTINUOUS CONTROL
+
+Due to the limited complexity of the pendulum environment, the quantitative differences between the mean squared error and VaGraM are at times insignificant in this setting. The dynamics function of the environment can be approximated sufficiently well with a simple neural network and one hidden layer.
+
+The underlying theory supporting VAML states that a value-aware loss is preferable to a mean squared error loss in a setting where the capacity of the model is too small to fully approximate the problem or the state space contains dimensions that are irrelevant for the control problem. To test whether our loss function is superior to a maximum likelihood approach in these cases, we used the Hopper environment from the OpenAI gym benchmark (Brockman et al., 2016). As a deep learning based Dyna algorithm, we chose Model-based Policy Optimization (MBPO) (Janner et al., 2019) and ran all of our experiments using the implementation provided by Pineda et al. (2021). We kept the structure of the MBPO algorithm and models and replaced the model loss function with VaGram.
+
+# 5.1 HOPPER WITH REDUCED MODEL CAPACITY
+
+In the first experiment, we decreased the network size of the used neural network ensemble. Janner et al. (2019) use fully connected neural networks with four hidden layers and 200 neurons per layer.
+
+
+Figure 4: Performance of VaGram and MLE models with distracting state dimensions. The dotted lines correspond to the final performance achieved by both algorithms on the Hopper task without distraction (grey, approx. 3200). Shaded area represents standard error over 16 repeated runs. VaGram achieves significantly higher returns than the MLE baseline, especially in the most challenging setting with 15 distracting dimensions.
+
+To test the performance of the algorithm under smaller models, we ran tests with two and three layer networks and 64 neurons per hidden layer. The results are shown in Figure 3. As before, when using a sufficiently powerful function approximation, we see no difference between the maximum likelihood approach and VaGram, suggesting that the networks are flexible enough to capture the true environment's dynamics sufficiently close for planning. But when reducing the model size, the maximum likelihood models quickly lose performance, completely failing to even stabilize the Hopper for a short period in the smallest setting, while VaGram retains almost its original performance.
+
+# 5.2 HOPPER WITH DISTRACTING DIMENSIONS
+
+To show that VaGraM is able to achieve good performance in a setting where there are additional dynamics in the environment that do not contribute to the control problem, we appended distractor dimensions to the Hopper observations. These are independent of the original environment state space and reward function, and evolve under non-linear and discontinuous dynamics (details in Appendix E). A setting with distracting dimensions is known to pose difficulty for model-based control algorithms (Stone et al., 2021) and neural networks struggle to model non-linear, discontinuous dynamics, so with an increasing number of dimensions the task becomes harder.
+
+The results of this experiment are shown in Figure 4. When using five distractor dimensions, both models are able to capture the dynamics sufficiently well to achieve comparable reward to the original environment. When increasing the number of dimensions, the performance of the MLE model deteriorates, as more and more of its capacity is used to model the added dynamics. VaGram continues to be able to achieve reward even under the presence of distracting dimensions, since the gradient of the value function with regards to the state dimensions which are irrelevant to the control problem becomes small over training. Still, the performance of VaGram also suffers with increasing dimensions: when adding 20 distracting dimensions, neither algorithm is able to stabilize the Hopper consistently. In this case, the value function approximation cannot differentiate sufficiently between the relevant and irrelevant dimensions with the amount of environment samples provided.
+
+In summary, we find that VaGram is able to deal with challenging distractions and reduced model capacity significantly better than a MLE baseline. This validates that our algorithm is really value-aware and can use the value function information to improve the performance of a model-based controller in settings where the model is unable to fully represent the environment.
+
+# 6 RELATED WORK
+
+Several authors have noted on the problem of learning models that align with the goal of obtaining a good policy. The proposed approaches fall into three broad categories: value-function or policy dependency, representation learning, and data resampling.
+
+Inspired by VAML, Abachi et al. (2020) present a method that seeks to align the policy gradients under a learned model with the gradients under the true environment. Similar to our proposal, D'Oro et al. (2020) also proposed to reweigh samples in a log likelihood loss, but used policy search as the reinforcement learning approach and did not account for individual state dimensions. Nikishin et al. (2022) show an approach to directly optimizing the policy performance on the real environment by learning a model with implicit differentiation. Asadi et al. (2018) show that the original VAML loss coincides with a Wasserstein distance in the model space under the assumption that the value function is Lipschitz smooth. We find that all of these approaches suffer from similar scaling issues as VAML and have not been shown to lead to strong empirical performance outside of toy settings.
+
+Grimm et al. (2020) characterize the space of possible solutions to the model learning problem under different restrictions given by value functions and policies, and propose to learn models that are value-equivalent, similar to Farahmand et al. (2017). In a follow-up work Grimm et al. (2021) expand on this idea and show that their principle can be used to improve the MuZero algorithm (Schrittwieser et al., 2020). However, these works do not discuss the optimization challenges in actually finding such value-equivalent models, they mostly characterize the space under different value functions and policies, and present an orthogonal research direction to this paper.
+
+An alternative to characterizing the problem in the state space of the MDP are representation learning approaches, which seek to map the original states to a latent representation that is more amenable to control. Such approaches include Value Prediction Networks (Oh et al., 2017), Embed-to-Control (Watter et al., 2015) and related proposals (Levine et al., 2020; Cui et al., 2021). Zhang et al. (2021) build on the idea of bisimulation metrics (Ferns et al., 2004; 2011) which seeks to characterize the difference between MDPs by finding a state mapping that is reward-invariant under policy and value function. In this work, we did not investigate learning state embeddings, but combining our work with representation learning approaches is an exciting direction for future research.
+
+Lambert et al. (2020) hypothesize that the objective mismatch could be solved by reweighing the training buffer for model learning to prioritize datapoints with high value. These are more likely to matter for obtaining an optimal policy. A similar proposal was evaluated empirically by Nair et al. (2020). Contrary to our work however, this technique cannot account for the differing impact of the state space dimensions and scaling, since the data points are weighted as a whole.
+
+# 7 CONCLUSION
+
+We presented the Value-Gradient weighted Model loss (VaGraM), a novel loss function to train models that model a dynamics function where it matters for the control problem. We derived our loss function from the value-aware model learning framework, showing that previous work does not account for two important optimization phenomena that appear when learning models with empirical value function approximations. We highlighted how VaGraM counters these issues and showed the increased stability of the training procedure when using our loss in a pedagogical environment.
+
+On the Mujoco benchmark, VaGraM performs on par with maximum likelihood estimation when using large neural network models. However, introducing additional complications to the problem results in drastic performance impacts for MLE based models, which highlights the necessity for value function aware losses in challenging environments and settings in which sufficient model capacity cannot be guaranteed. In these cases, value-awareness can greatly increase the performance of Dyna algorithms by focusing the model learning procedure on relevant aspects of the state space. In future work we seek to scale our loss function to image-based RL, where relevant state space dimensions can vary over a task due to shifting camera angles. Furthermore, we seek to derive a related value-aware approach for partially observable domains that can take the state inference problem into account.
+
+# ETHICAL CONCERNS AND LIMITATIONS
+
+The proposed value-aware model learning approach is designed as a general purpose solution to the model mismatch problem in MBRL. While the reinforcement learning paradigm as a whole has important ethical ramifications, especially in settings where automated decision making affects humans directly, we do not address these concerns specifically in our paper as our method focuses on algorithmic problems that are orthogonal to the question of proper reward design. We restrict our proposal to cases in which the reward design actually captures the intended task, which is a common, yet rarely addressed, assumption in the RL literature.
+
+# REPRODUCIBILITY
+
+We provide an open-source version of our code at https://github.com/pairlab/vagram. Furthermore we document all details on the implementation and evaluation setting in Appendix E and describe all necessary components of our loss in the main text. We also used the open source MBRL-Lib implementation for MBPO (Pineda et al., 2021) as the basis for our code and for the evaluation of baselines and provide our model loss as an additional module in the framework for easy replication.
+
+# ACKNOWLEDGMENTS
+
+AG and AMF acknowledge the funding from the Canada CIFAR AI Chairs program, as well as the support of the Natural Sciences and Engineering Research Council of Canada (NSERC) through the Discovery Grant program. AG is also supported by the University of Toronto XSeed, LG and Huawei. We thank the members of the PAIR lab and AMF group for feedback on the paper and help with running the experiments. We are grateful to the anonymous reviewers for their constructive feedback and the valuable rebuttal discussion. 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 Institute.
+
+# REFERENCES
+
+Romina Abachi, Mohammad Ghavamzadeh, and Amir-massoud Farahmand. Policy-aware model learning for policy gradient methods. ArXiv, abs/2003.00030, 2020.
+Kavosh Asadi, Evan Cater, Dipendra Misra, and Michael L Littman. Equivalence between wasserstein and value-aware loss for model-based reinforcement learning. *ArXiv*, abs/1806.01265, 2018.
+Alex Ayoub, Zeyu Jia, Csaba Szepesvari, Mengdi Wang, and Lin F. Yang. Model-based reinforcement learning with value-targeted regression. In International Conference on Machine Learning, 2020.
+Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym. ArXiv, abs/1606.01540, 2016.
+Brandon Cui, Yinlam Chow, and Mohammad Ghavamzadeh. Control-aware representations for model-based reinforcement learning. In International Conference on Learning Representations, 2021.
+Marc Deisenroth and Carl E Rasmussen. Pilco: A model-based and data-efficient approach to policy search. In International Conference on Machine Learning, 2011.
+Pierluca D'Oro, Alberto Maria Metelli, Andrea Tirinzoni, Matteo Papini, and Marcello Restelli. Gradient-aware model-based policy search. In AAAI Conference on Artificial Intelligence, 2020.
+Damien Ernst, Pierre Geurts, and Louis Wehenkel. Tree-based batch mode reinforcement learning. Journal of Machine Learning Research, 6:503-556, 2005.
+Amir-massoud Farahmand. Iterative value-aware model learning. In Advances in Neural Information Processing Systems, volume 31, 2018.
+Amir-massoud Farahmand, Csaba Szepesvári, and Rémi Munos. Error propagation for approximate policy and value iteration. Advances in Neural Information Processing Systems, 2010.
+Amir-massoud Farahmand, André Barreto, and Daniel Nikovski. Value-Aware Loss Function for Model-based Reinforcement Learning. In International Conference on Artificial Intelligence and Statistics, 2017.
+Norm Ferns, Prakash Panangaden, and Doina Precup. Metrics for finite markov decision processes. In Uncertainty in AI, 2004.
+Norm Ferns, Prakash Panangaden, and Doina Precup. Bisimulation metrics for continuous markov decision processes. SIAM Journal on Computing, 40(6), 2011.
+Geoffrey J Gordon. Stable function approximation in dynamic programming. In International Conference on Machine Learning, 1995.
+Christopher Grimm, André Barreto, Satinder Singh, and David Silver. The value equivalence principle for model-based reinforcement learning. In Advances in Neural Information Processing Systems, 2020.
+Christopher Grimm, André Barreto, Gregory Farquhar, David Silver, and Satinder Singh. Proper value equivalence. In Advances in Neural Information Processing Systems, 2021.
+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, 2018.
+Danijar Hafner, Timothy Lillicrap, Jimmy Ba, and Mohammad Norouzi. Dream to control: Learning behaviors by latent imagination. In International Conference on Learning Representations, 2020.
+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.
+
+Joshua Joseph, Alborz Geramifard, John W Roberts, Jonathan P How, and Nicholas Roy. Reinforcement learning with misspecified model classes. In IEEE International Conference on Robotics and Automation, 2013.
+Michael Kearns and Satinder Singh. Near-optimal reinforcement learning in polynomial time. Machine learning, 49(2):209-232, 2002.
+Nathan Lambert, Brandon Amos, Omry Yadan, and Roberto Calandra. Objective mismatch in model-based reinforcement learning. In Conference on Learning for Dynamics and Control, 2020.
+Nir Levine, Yinlam Chow, Rui Shu, Ang Li, Mohammad Ghavamzadeh, and Hung Bui. Prediction, consistency, curvature: Representation learning for locally-linear control. In International Conference on Learning Representations, 2020.
+Sergey Levine and Vladlen Koltun. Guided policy search. In International Conference on Machine Learning, 2013.
+Angelo G. Lovatto, Thiago P. Bueno, Denis D. Mauá, and Leliane N. de Barros. Decision-aware model learning for actor-critic methods: When theory does not meet practice. In "I Can't Believe It's Not Better!" at NeurIPS Workshops, 2020.
+Yuping Luo, Huazhe Xu, Yuanzhi Li, Yuandong Tian, Trevor Darrell, and Tengyu Ma. Algorithmic framework for model-based deep reinforcement learning with theoretical guarantees. In International Conference on Learning Representations, 2019.
+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*, abs/2109.14311, 2021.
+Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, and Martin Riedmiller. Playing atari with deep reinforcement learning. In NeurIPS Deep Learning Workshop. 2013.
+Thomas M. Moerland, Joost Broekens, and Catholijn M. Jonker. Model-based reinforcement learning: A survey. ArXiv, abs/2006.16712, 2020.
+Suraj Nair, Silvio Savarese, and Chelsea Finn. Goal-aware prediction: Learning to model what matters. In International Conference on Machine Learning, 2020.
+Evgenii Nikishin, Romina Abachi, Rishabh Agarwal, and Pierre-Luc Bacon. Control-oriented model-based reinforcement learning with implicit differentiation. In AAAI Conference on Artificial Intelligence, 2022.
+Junhyuk Oh, Satinder Singh, and Honglak Lee. Value prediction network. In Advances in Neural Information Processing Systems, 2017.
+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. 2019.
+Jan Peters and Stefan Schaal. Natural actor-critic. Neurocomputing, 71(7-9):1180-1190, 2008.
+Luis Pineda, Brandon Amos, Amy Zhang, Nathan O. Lambert, and Roberto Calandra. Mbrl-lib: A modular library for model-based reinforcement learning. ArXiv, abs/2104.10159, 2021.
+Martin L. Puterman. Markov decision processes: Discrete stochastic dynamic programming. In Wiley Series in Probability and Statistics, 1994.
+Stéphane Ross and Drew Bagnell. Agnostic system identification for model-based reinforcement learning. In International Conference on Machine Learning, 2012.
+Jeff G Schneider. Exploiting model uncertainty estimates for safe dynamic control learning. In Advances in Neural Information Processing Systems, 1997.
+
+Julian Schrittwieser, Ioannis Antonoglou, Thomas Hubert, Karen Simonyan, Laurent Sifre, Simon Schmitt, Arthur Guez, Edward Lockhart, Demis Hassabis, Thore Graepel, et al. Mastering atari, go, chess and shogi by planning with a learned model. Nature, 588(7839):604-609, 2020.
+Austin Stone, Oscar Ramirez, Kurt Konolige, and Rico Jonschkowski. The distracting control suite - a challenging benchmark for reinforcement learning from pixels. ArXiv, abs/2101.02722, 2021.
+Richard S Sutton. Integrated architectures for learning, planning, and reacting based on approximating dynamic programming. In Machine learning Proceedings, pp. 216-224. 1990.
+Erin Talvitie. Self-correcting models for model-based reinforcement learning. In AAAI Conference on Artificial Intelligence, 2017.
+Ziyu Wang, Tom Schaul, Matteo Hessel, Hado Hasselt, Marc Lanctot, and Nando Freitas. *Dueling network architectures for deep reinforcement learning*. In *International Conference on Machine Learning*, 2016.
+Christopher JCH Watkins and Peter Dayan. Q-learning. Machine learning, 8(3-4), 1992.
+Manuel Watter, Jost Tobias Springenberg, Joschka Boedecker, and Martin Riedmiller. Embed to control: A locally linear latent dynamics model for control from raw images. In Advances in Neural Information Processing Systems, 2015.
+Amy Zhang, Rowan Thomas McAllister, Roberto Calandra, Yarin Gal, and Sergey Levine. Learning invariant representations for reinforcement learning without reconstruction. In International Conference on Learning Representations, 2021.
+
+# A BOUND BETWEEN VALUE-AWARE MODEL LEARNING AND VALUE-GRADIENT WEIGHTED MODEL LOSS
+
+The error in Taylor approximation $\mathcal{R}(V,s',f_{\theta}(s,a))$ is bounded by $\frac{M}{2} ||s' - f_{\theta}(s,a)||^2$ with M dependent on the Hessian of the value function. Plugging this into the VAML loss and assuming worst case approximation errors, we obtain an upper bound on the VAML error:
+
+$$
+\mathbb {E} _ {s ^ {\prime}, s, a \sim D} \left[ \left(V \left(f _ {\theta} (s, a)\right) - V \left(s _ {0} ^ {\prime}\right)\right) ^ {2} \right] \tag {8}
+$$
+
+$$
+= \mathbb {E} _ {s ^ {\prime}, s, a \sim D} \left[ \left(\left(\nabla_ {s} V (s) \mid_ {s ^ {\prime}}\right) ^ {\intercal} \left(f _ {\theta} (s, a) - s ^ {\prime}\right) + \mathcal {R} \left(V, s ^ {\prime}, f _ {\theta} (s, a)\right)\right) ^ {2} \right] \tag {9}
+$$
+
+$$
+\leq \mathbb {E} _ {s ^ {\prime}, s, a \sim D} \left[ \left(\left| \left(\nabla_ {s} V (s) \mid_ {s ^ {\prime}}\right) ^ {\top} \left(f _ {\theta} (s, a) - s ^ {\prime}\right) \right| + \left| \mathcal {R} \left(V, s _ {0} ^ {\prime}, f _ {\theta} (s, a)\right) \right|\right) ^ {2} \right] \tag {10}
+$$
+
+$$
+\leq \mathbb {E} _ {s ^ {\prime}, s, a \sim D} \left[ \left(\left| \left(\nabla_ {s} V (s) \mid_ {s ^ {\prime}}\right) ^ {\top} \left(f _ {\theta} (s, a) - s ^ {\prime}\right) \right| + \frac {M}{2} \left\| s ^ {\prime} - f _ {\theta} (s, a) \right\| ^ {2}\right) ^ {2} \right] \tag {11}
+$$
+
+$$
+\leq 2 \cdot \mathbb {E} _ {s ^ {\prime}, s, a \sim D} \left[ \left(\left(\nabla_ {s} V (s) | _ {s ^ {\prime}}\right) ^ {\top} \left(f _ {\theta} (s, a) - s ^ {\prime}\right)\right) ^ {2} \right] + 2 \cdot \mathbb {E} _ {s ^ {\prime}, s, a \sim D} \left[ \frac {M ^ {2}}{4} | | s ^ {\prime} - f _ {\theta} (s, a) | | ^ {4} \right] \tag {12}
+$$
+
+Our experiments show that if we treat $M$ like a tuneable hyperparameter, we obtain worse performance when optimizing this upper bound compared to VaGraM. The Hessian parameter is difficult to compute or estimate in practice and we find that most often, either the first or the second loss component will dominate when choosing heuristic values.
+
+# B ANALYZING THE ADDITIONAL LOCAL MINIMA OF THE TAYLOR APPROXIMATION LOSS
+
+We noted in the main paper that the direct Taylor approximation of the value function leads to a spurious local minimum. This is clear when looking at the loss for a single datapoint:
+
+$$
+\min _ {\theta} \left(\left(\nabla_ {s} V (s) \mid_ {s ^ {\prime}}\right) ^ {\intercal} f _ {\theta} (s, a)\right) ^ {2} \tag {13}
+$$
+
+$$
+= \min _ {\theta} \left(\sum_ {n = 0} ^ {\dim (\mathcal {S})} \left(\nabla_ {s} V (s) | _ {s ^ {\prime}}\right) _ {n} \cdot f _ {\theta} (s, a) _ {n}\right) ^ {2} \tag {14}
+$$
+
+Assuming that $f$ is flexible and can predict any next state $s'$ (i.e. by choosing $f = \theta$ ), the optimal solution is obtained from an undetermined linear system of equations. This system admits far more solutions than either the corresponding IterVAML loss or a mean squared error, and many of them will achieve arbitrary large value prediction errors. In fact, the equation describes a hyperplane of minimal solutions consisting of every weight vector that is orthogonal to the gradient of the value function at the reference sample, with $\dim(S) - 1$ free variables. Therefore we need to enforce the closeness of the model prediction and the environment sample, since the Taylor approximation is only approximately valid in a close ball around the reference sample.
+
+One way to achieve this closeness is by adding the second order Taylor term, which results in an additional MSE loss term. As pointed out in Appendix A, we did not achieve good performance when testing out this version, since it is difficult to compute the Hessian in higher state spaces and heuristically choosing a value as a hyperparameter proved to be difficult to tune in practice. Therefore, we approached the solution to this problem as outlined in the paper.
+
+# C FULL VAML FOR SAC
+
+The formulation of VAML which we derive for SAC is a direct extension of the VAML loss to the SAC soft bellman backup. Specifically, given some distribution over the state-action space $\mathcal{D}$ , state-action value function $Q$ and policy $\pi$ , we can define a SAC-aware loss.
+
+
+Figure 5: Comparison of VaGraM, MLE (MBPO baseline), IterVAML Farahmand (2018) and a value-weighing ablation on two simple continuous control tasks. The shaded area represents standard error estimated over 8 runs. While VaGraM, IterVAML and MBPO are able to achieve satisfactory performance on the Pendulum Swingup task, IterVAML fails to stabilize the more difficult Cartpole balancing task.
+
+
+
+$$
+\begin{array}{l} \mathcal {L} _ {Q, \pi} (\hat {p}, p, \mathcal {D}) = \\ \int \left| \int (\hat {p} \left(s ^ {\prime} \mid s, a\right) - p \left(s ^ {\prime} \mid s, a\right)) \mathbb {E} _ {a ^ {\prime} \sim \pi \left(\cdot \mid s ^ {\prime}\right)} \left(Q \left(s ^ {\prime}, a ^ {\prime}\right) - \log \pi \left(a ^ {\prime} \mid s ^ {\prime}\right)\right) d s ^ {\prime} \right| ^ {2} d \mathcal {D} (s, a) (15) \\ = \int \left| \int \left(\hat {p} \left(s ^ {\prime} \mid s, a\right) - p \left(s ^ {\prime} \mid s, a\right)\right) V ^ {\pi} \left(s ^ {\prime}, a ^ {\prime}\right) d s ^ {\prime} \right. \\ - \int \left(\hat {p} \left(s ^ {\prime} \mid s, a\right) - p \left(s ^ {\prime} \mid s, a\right)\right) \mathbb {E} _ {a ^ {\prime} \sim \pi (\cdot | s ^ {\prime})} \left[ \log \pi \left(a ^ {\prime} \mid s ^ {\prime}\right) \right] d s ^ {\prime} \Bigg | ^ {2} d \mathcal {D} (s, a) (16) \\ \end{array}
+$$
+
+as well as its sample-based version:
+
+$$
+\begin{array}{l} \hat {\mathcal {L}} _ {Q, \pi} (\hat {p}, p, \mathcal {D}) = \sum_ {i} \left| V ^ {\pi} (s _ {i} ^ {\prime}) - \int \hat {p} (s ^ {\prime} | s _ {i}, a _ {i}) V ^ {\pi} (s ^ {\prime}) \mathrm {d} s ^ {\prime} - \right. \\ \left. \left(\int \pi \left(a ^ {\prime} \mid s _ {i} ^ {\prime}\right) \log \pi \left(a ^ {\prime} \mid s _ {i} ^ {\prime}\right) \mathrm {d} a ^ {\prime} - \int \int \hat {p} \left(s ^ {\prime} \mid s _ {i}, a _ {i}\right) \pi \left(a ^ {\prime} \mid s ^ {\prime}\right) \log \pi \left(a ^ {\prime} \mid s ^ {\prime}\right) \mathrm {d} a ^ {\prime} \mathrm {d} s ^ {\prime}\right) \right| ^ {2} \tag {17} \\ \end{array}
+$$
+
+We find that in most of our experiments, the entropy terms did not significantly contribute to the loss. Therefore we dropped it in our experiments and directly derived VaGraM for the value function prediction error only. This makes our loss applicable in all situations where the model is used to estimate the value function of a policy.
+
+Finally, we do not account for the dependency of the policy function update on the model. Since SAC aims to minimize the KL divergence between the action distribution and the Gibbs distribution defined by the value function directly, the only way the model influences this update is via the induced state space distribution. We do not address this matching explicitly in this work, but a hybrid policy-aware and value-aware model is an enticing direction for future research.
+
+# D ADDITIONAL EXPERIMENTS
+
+# D.1 ABLATIONS
+
+To test the performance of VaGraM and MBPO against alternative models, we used the classic Pendulum swingup and Cartpole benchmarks. As points of comparison, we used IterVAML (Farahmand, 2018) and a simple value-weighted regression similar to Nair et al. (2020), where the MSE error is multiplied by the inverse of the value function of the sample. The results are visualized in Figure 5. Hyperparameters follow the Cartpole task baseline in Pineda et al. (2021).
+
+Since IterVAML suffers from strong destabilization on the Pendulum model learning problem, as discussed in section 4, we added an MSE loss to the original formulation $\mathcal{L}_{\mathrm{joint}} = \mathcal{L}_{\mathrm{IterVAML}} + \lambda \mathcal{L}_{\mathrm{MSE}}$
+
+
+
+
+
+
+Figure 6: Comparison of VaGraM and MBPO on the Mujoco tasks presented in Janner et al. (2019). We see that VaGraM is able to perform on par with the MBPO implementation on all tasks, while outperforming both the model-based and model-free baseline on the Ant environment. For the HalfCHEetah-v2 task, different performances emerge when using different rollout lengths. While the MLE baseline is not able to benefit from longer rollouts, VaGraM increases in performance, although the statistical significance of this increase is low due to the strong bimodality of solutions on the HalfCHEetah task.
+
+
+
+with a tradeoff factor of $\lambda = 0.01$ . We see that this is sufficient to stabilize the performance in the Pendulum swingup task and prevent catastrophic divergence, but the model still performs significantly below the MBPO and VaGraM results in the Cartpole stabilization task. This is evidence that even with additional stabilization mechanisms, the issues presented in section 3 prevents the easy adoption of IterVAML to complex domains.
+
+The value-weighing baseline is unable to achieve satisfactory performance even on the simple pendulum task, leading us to conclude that more complex reweighing schemes such as VaGraM are indeed necessary.
+
+# D.2 PERFORMANCE IN MUJOCO BENCHMARK SUITE
+
+The comparison runs on the Mujoco benchmark environments presented in Figure 6 are faulty due to a bug that was pointed out to us at the poster session. The bug only harms the performance of VaGraM, so we do not see it as a reason to withdraw the paper, but due to limited time and computational resources, we were unable to repeat the full comparison presented here. All other experiments are corrected and to the best of our knowledge reflect the performance of VaGraM. We will update the paper with updated comparisons once they are finished.
+
+The results of VaGraM and MBPO are presented in Figure 6. We find that VaGraM is able to perform on par with the MBPO baseline on all the tasks. Due to stability issues, the Humanoid-v2 task is excluded, no algorithm achieved satisfactory performance (compare Pineda et al. (2021) for a discussion).
+
+On the Ant-v2, we see small performance improvements above the results reported by Janner et al. (2019) and Pineda et al. (2021). We hypothesise that for this task, the canonical state space representation could be misaligned with the control problem in the sense that not all dimensions are informative for control. A further investigation of the phenomenon would be an interesting direction
+
+for future research. All comparisons were done on the hyperparameter settings provided by Pineda et al. (2021).
+
+Investigating the performance differences further, we find that on the HalfCheetah-v2 domain, VaGraM is able to profit from longer rollouts, while MBPO does not increase in performance when rolling out the model for more than 1 step. The comparison is presented in Figure 6. The MLE based model completely destabilizes if trained beyond 180 - 200 epochs on longer rollouts, which is why we truncated the training length before convergence. The performance of VaGraM with longer rollouts is already beyond the final performance of the fully trained MBPO baseline after 180 steps.
+
+The destabilization leads to a complete collapse of the policy performance, probably due to increasing uncertainty of the model and in some cases to a gradient explosion that produces NaN values in the policy. We find that VaGraM does not suffer from this pattern and is able to slightly outperform both MBPO and VaGraM trained on a single step rollout. Similar patterns do not emerge in the Walker-v2 domain, here training on longer rollouts destabilizes all algorithms. We leave a more in-depth discussion of the impact of rollout length on policy performance under different models and losses for future work but highlight that significant performance might be gained by finding better tradeoffs than those discussed in Janner et al. (2019), especially when comparing deterministic and probabilistic models (compare Appendix F) as well as value-aware and value-agnostic models.
+
+# EXPERIMENT DETAILS
+
+As described in the main paper, we conducted our experiment in two domains from the OpenAI benchmark OpenAI Gym (Brockman et al., 2016), Pendulum-v2 and Hopper-v0. We used both environments as provided by the framework without further modification in our capacity tests. Our algorithm is shown in pseudocode in algorithm 1.
+
+Expanded Hopper environment To test the performance of VaGraM in a setting with additional unnecessary state observations, we created a random dynamical system that evolves according to randomly initialized dynamics function, where $A$ is a fixed matrix with entries randomly drawn from $\mathcal{N}(0.,10.)$ , and a fixed initial state $s_0$ with components randomly drawn from $\mathcal{N}(0.,0.1)$ . We do not resample the fixed components at reset.
+
+The transitions are then described by the following deterministic function:
+
+$$
+f \left(s _ {t}, a _ {t}\right) = \left\{ \begin{array}{l l} s _ {t} + \sin (A s) & \text {i f} | f \left(s _ {t}, a _ {t}\right) | < 2 0 \\ s _ {0} & \text {e l s e} \end{array} \right. \tag {18}
+$$
+
+This dynamics function contains two attributes which are hard for neural networks to model: discontinuity and non-linear dynamics. We find that this is sufficient to provide a very challenging environment for the MLE trained neural network models. To account for varying difficulty over different random initialization of the environments, we made sure to test the comparison runs with the same seeds over the different loss functions, but we did not find that the inter-seed variance was larger than the observed difference between the different loss functions.
+
+# E.1 ARCHITECTURE AND HYPERPARAMETERS
+
+For the Pendulum experiments, we use a simple fully connected neural network with a single layer, and a linear regression without feature transformations as architectures. The used non-linearity is ReLU. All experiments were implemented in PyTorch (Paszke et al., 2019) and were not specified, the standard initialization of the library were kept. The exact versions of all used libraries are documented in the provided source code.
+
+To assure a fair comparison we used the hyperparameters provided by Janner et al. (2019) for all experiments with our approach and the NLL loss function used for the baseline. All models used were fully connected neural networks with SiLU non-linearities and standard initialization. For all experiments with full model size we followed MBPO and used seven ensemble members with four layers and 200 neurons per layer.
+
+Algorithm 1: Value-Gradient weighted Model learning (VaGraM)
+Initialize policy $\pi_{\phi}$ ,value function $v_{\psi}$ ,model $\hat{f}_{\theta}$ ,environment dataset $\mathcal{D}_{\mathrm{env}}$ , model dataset
+ $\mathcal{D}_{\mathrm{model}}$ .
+for N epochs do
+while $\hat{p}_{\theta}$ not converged do Sample batch $(s,a,r,s^{\prime})$ from $\mathcal{D}_{\mathrm{env}}$ .. $\mathcal{L}_{v_{\psi}} = \left((s' - \hat{f}_{\theta}(s,a))^{\intercal}\mathrm{diag}\left(\frac{d}{ds} v_{\psi}(s)|_{s'}\right)^{2}(s' - \hat{f}_{\theta}(s,a))\right);$ $\theta \gets \theta -\alpha \frac{d}{d\theta}\mathcal{L}_{v_{\psi}}$ Train reward model
+end
+for E steps do Take action in env according to $\pi_{\phi}$ ;add to $\mathcal{D}_{\mathrm{env}}$ . for M model rollouts do Sample s from $\mathcal{D}_{\mathrm{env}}$ ; sample $a\sim \pi_{\phi}(s)$ $s^{\prime},r = \hat{f}_{\theta}(s,a)$ Add $(s,a,r,s^{\prime})$ to $\mathcal{D}_{\mathrm{model}}$
+end
+for G policy gradient updates do Sample batch $(s,a,r,s^{\prime})$ from $\mathcal{D}_{\mathrm{env}}\cup \mathcal{D}_{\mathrm{model}}$ . $\psi \gets \psi -\beta \frac{d}{d\psi} (v_{\psi}(s) - (r + \gamma v'(s'))^{2};$ $\phi \gets \phi -\lambda \hat{\nabla}_{\phi}J(\pi_{\phi},v_{\psi},(s,a,r,s'))$
+end
+end
+
+Even though our loss derivation does not support rolling out the model for more than a single step without accounting for this in the training setup, we find that VaGraM is still stable over the short rollout horizons used by MBPO. Therefore we used the rollout scheme from MBPO.
+
+However, it was necessary to make a small alteration to the training setup: in the provided implementation, the value function is solely trained on model samples. Since our model is directly dependent on the value function, we need to break the inter-dependency between model and value function in the early training iterations. Hence, we used both real environment data and model data to train the value function, linearly increasing the amount of model samples from 0 to $95\%$ of the SAC replay buffer over the first 40 epochs of training (corresponding to 40.000 real environment steps). We did not transition to fully using model data to assure that the real environment samples are still able to inform the value function learning. We found that this did not diminish the training returns of MBPO compared to solely using model samples and so used this approach for both VaGraM and MLE.
+
+To estimate the gradient of the value function, we used the four empirical value functions, two direct estimates and two target value functions used in the SAC algorithm and summed the losses using each data tuple and value function gradient independently. Furthermore we calculated the $L_{2}$ norm of all value function gradients and clipped these at the 95-th percentile. We found that this was necessary since the empirical value function gradients can get very sharp, which in rare cases leads to a destabilization of the gradient descent algorithm used to update the model.
+
+# F DETERMINISTIC VS PROBABILISTIC MODELS
+
+Our derivation of VaGram lead us to the conclusion that a deterministic model was sufficient to achieve the goal of value-aware model learning in environments with small transition noise. This insight stands in contrast to the current literature, which often claims that probabilistic models are needed to achieve optimal performance in model-based reinforcement learning. However, there is no clear consensus among different authors whether probabilistic models are needed or if a deterministic model can be sufficient for MBRL (compare Lutter et al. (2021)).
+
+
+Figure 7: Comparison of the empirical performance of deterministic and probabilistic MLE models vs VaGraM. Thick lines denote the mean and shaded area the standard error over 8 runs. In the limited capacity setting, the deterministic model is able to achieve significantly higher returns than the probabilistic baseline, however with stability issues during longer training. On the distracting benchmark, the deterministic model is not able to achieve any significant returns.
+
+
+
+Our assumption that the model can be replaced with a deterministic one relies on the assumption that the underlying model is not dominated by stochastic transitions, but is deterministic or near deterministic and unimodal. This follows from the requirement that the model prediction admits a small error in the mean squared error sense, otherwise the Taylor approximation does not properly capture the behavior of the value function, as a model prediction might have high likelihood under the environment and still be far away from the environment sample in a mean squared sense otherwise. In domains where capturing the stochasticity is crucial, we have to revisit this requirement in follow up work.
+
+Furthermore, we are operating under the assumption that the mean value function of each distribution over states can be represented as the value function of a single state prediction. Since value function approximations represented by neural networks are continuous, this is true in our setting due to the mean value theorem for integrals. Implicitly due to the Taylor approximation, we also assume that this mean value lies close to or on the environment sample we obtained. If other approximation schemes are used, this property needs to be checked and potentially probabilistic models are needed to represent the expectation over all possible value functions and transition dynamics.
+
+# F.1 ABLATION EXPERIMENT WITH DETERMINISTIC MODELS
+
+In our experiments in the Hopper domain, we used probabilistic models following Janner et al. (2019). To verify that the improvement in performance did not result from using a deterministic model instead of a probabilistic model, we repeated the experiment showing the impact of smaller model sizes, and replaced the probabilistic Gaussian ensemble with an ensemble of deterministic functions trained with the mean squared error loss between sample and state prediction. All other implementation details, architecture and hyperparameters were kept fixed. The results are shown in Figure 7. In this ablation, we do indeed see that a mean squared trained model captures the dynamics information better than a model that is trained using negative log likelihood. To the best of our knowledge, this phenomenon has not received attention in the literature, but we hypothesize that it is an artifact of training a probabilistic model with gradient descent instead of natural gradient descent (compare Figure 1 in Peters & Schaal (2008) for a visual intuition).
+
+Nonetheless, VaGraM is still able to achieve higher cumulative reward consistently than the MSE model. Especially on the distraction task we find that a deterministic MSE model performs on par with the probabilistic model and fails to achieve any reward when faced with a challenging number of distractions. This validates our hypothesis that value awareness is important in settings with insufficient model capacity, but crucial in cases where the environment observations are not aligned with the control problem.
\ No newline at end of file
diff --git a/valuegradientweightedmodelbasedreinforcementlearning/images.zip b/valuegradientweightedmodelbasedreinforcementlearning/images.zip
new file mode 100644
index 0000000000000000000000000000000000000000..0846b4a5a09617bfa32e9f20a7747ef23466cac5
--- /dev/null
+++ b/valuegradientweightedmodelbasedreinforcementlearning/images.zip
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:197aabbdb764e66791be1361d0f335d500a11fcd0831c0e7fb816d8c866af8a2
+size 424776
diff --git a/valuegradientweightedmodelbasedreinforcementlearning/layout.json b/valuegradientweightedmodelbasedreinforcementlearning/layout.json
new file mode 100644
index 0000000000000000000000000000000000000000..ba55fe3f1a6d0a015e7e8f28567126f545f53788
--- /dev/null
+++ b/valuegradientweightedmodelbasedreinforcementlearning/layout.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:6d7ac36ea2cfe795b0d0b8883eba07adcd5f37a9e341ef28377ef29c55cd2c69
+size 467718
diff --git a/variationalmethodsforsimulationbasedinference/b631abec-cbcf-48ed-8993-df86144885bb_content_list.json b/variationalmethodsforsimulationbasedinference/b631abec-cbcf-48ed-8993-df86144885bb_content_list.json
new file mode 100644
index 0000000000000000000000000000000000000000..f8a56b23c6e1f37867e82b6d4e733fc35a39fcea
--- /dev/null
+++ b/variationalmethodsforsimulationbasedinference/b631abec-cbcf-48ed-8993-df86144885bb_content_list.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b276a395b38e63a66406de42e58fbd6b56c597e38bc7f4b33658525f6289dd8d
+size 154174
diff --git a/variationalmethodsforsimulationbasedinference/b631abec-cbcf-48ed-8993-df86144885bb_model.json b/variationalmethodsforsimulationbasedinference/b631abec-cbcf-48ed-8993-df86144885bb_model.json
new file mode 100644
index 0000000000000000000000000000000000000000..b4c366267e5dea45e169a95a164953f175f32e03
--- /dev/null
+++ b/variationalmethodsforsimulationbasedinference/b631abec-cbcf-48ed-8993-df86144885bb_model.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:013296fe1ff0de189c548d51808865782c845af6412ed0bfa9981fcb6bcbebee
+size 179909
diff --git a/variationalmethodsforsimulationbasedinference/b631abec-cbcf-48ed-8993-df86144885bb_origin.pdf b/variationalmethodsforsimulationbasedinference/b631abec-cbcf-48ed-8993-df86144885bb_origin.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..fb30a8620d2e44b1ff094d0cde89f1a81c9d610b
--- /dev/null
+++ b/variationalmethodsforsimulationbasedinference/b631abec-cbcf-48ed-8993-df86144885bb_origin.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:08079d1bfe5044d1ecb8d24cb8e95585046bb07f05ae70b831d178bbf3341604
+size 7135318
diff --git a/variationalmethodsforsimulationbasedinference/full.md b/variationalmethodsforsimulationbasedinference/full.md
new file mode 100644
index 0000000000000000000000000000000000000000..dedc25739bd80c647d2c15b8786ad3ffb9fe97ae
--- /dev/null
+++ b/variationalmethodsforsimulationbasedinference/full.md
@@ -0,0 +1,624 @@
+# VARIATIONAL METHODS FOR SIMULATION-BASED INFERENCE
+
+Manuel Glickler
+
+University of Tübingen
+
+Michael Deistler
+
+University of Tübingen
+
+Jakob H. Macke
+
+University of Tübingen
+
+# ABSTRACT
+
+We present Sequential Neural Variational Inference (SNVI), an approach to perform Bayesian inference in models with intractable likelihoods. SNVI combines likelihood-estimation (or likelihood-ratio-estimation) with variational inference to achieve a scalable simulation-based inference approach. SNVI maintains the flexibility of likelihood(-ratio) estimation to allow arbitrary proposals for simulations, while simultaneously providing a functional estimate of the posterior distribution without requiring MCMC sampling. We present several variants of SNVI and demonstrate that they are substantially more computationally efficient than previous algorithms, without loss of accuracy on benchmark tasks. We apply SNVI to a neuroscience model of the pyloric network in the crab and demonstrate that it can infer the posterior distribution with one order of magnitude fewer simulations than previously reported. SNVI vastly reduces the computational cost of simulation-based inference while maintaining accuracy and flexibility, making it possible to tackle problems that were previously inaccessible.
+
+# 1 INTRODUCTION
+
+Many domains in science and engineering use numerical simulations to model empirically observed phenomena. These models are designed by domain experts and are built to produce mechanistic insights. However, in many cases, some parameters of the simulator cannot be experimentally measured and need to be inferred from data. A principled way to identify parameters that match empirical observations is Bayesian inference. However, for many models of interest, one can only sample from the model by simulating a (stochastic) computer program, but explicitly evaluating the likelihood $p(\pmb{x}|\pmb{\theta})$ is intractable. Traditional methods to perform Bayesian inference in such simulation-based inference (SBI), also known as likelihood-free inference scenarios, include Approximate Bayesian computation (ABC) (Beaumont et al., 2002) and synthetic likelihood (SL) (Wood, 2010) methods. However, these methods generally struggle with high-dimensional data and typically require one to design or learn (Chen et al., 2021) summary statistics and distance functions.
+
+Recently, several methods using neural density(-ratio) estimation have emerged. These methods train neural networks to learn the posterior (SNPE, Papamakarios & Murray, 2016; Lueckmann et al., 2017; Greenberg et al., 2019), the likelihood (SNLE, Papamakarios et al., 2019; Lueckmann et al., 2019a), or the likelihood-to-evidence ratio (SNRE, Thomas et al., 2021; Hermans et al., 2020; Durkan et al., 2020; Miller et al., 2022).
+
+To improve the simulation efficiency of these methods, sequential training schemes have been proposed: Initially, parameters are sampled from the prior distribution to train an estimation-network. Subsequently, new samples are drawn adaptively to focus training on specific regions in parameter space, thus allowing the methods to scale to larger models with more parameters.
+
+In practice, however, it has remained a challenge to realize the full potential of these sequential schemes: For sequential neural posterior estimation (SNPE) techniques, the loss function needs to be adjusted across rounds (Greenberg et al., 2019), and it has been reported that this can be problematic if the proposal distribution is very different from prior, and lead to 'leakage' of probability mass into regions without prior support (Durkan et al., 2020). Both sequential neural likelihood (SNLE) and likelihood-ratio (SNRE) methods require MCMC sampling, which can become prohibitively slow-- MCMC sampling is required for each round of simulations, which, for high-dimensional models, can take more time than running the simulations and training the neural density estimator.
+
+
+Figure 1: Illustration of SNVI. We first learn the likelihood $p(\pmb{x}|\pmb{\theta})$ for any $\pmb{\theta}$ . We then use variational inference to learn the posterior distribution by minimizing a general divergence measure $D$ . The obtained posterior distribution is sampled with sampling importance resampling (SIR) to run new simulations and refine the likelihood estimator.
+
+Our goal is to provide a method which combines the advantages of posterior-targeting methods and those targeting likelihood(-ratios): Posterior targeting methods allow rapid inference by providing a functional approximation to the posterior which can be evaluated without the need to use MCMC sampling. Conversely, a key advantage of likelihood(-ratio) targeting methods is their flexibility-learned likelihoods can e.g. be used to integrate information from multiple observations, or can be used without retraining if the prior is changed. In addition, they can be applied with any active-learning scheme without requiring modifications of the loss-function.
+
+We achieve this method by combining likelihood(-ratio) estimation with variationally learned inference networks using normalizing flows (Rezende & Mohamed, 2015; Papamakarios et al., 2017; Durkan et al., 2019a) and sampling importance resampling (SIR) (Rubin, 1988). We name our approach Sequential Neural Variational Inference (SNVI). We will show that our simulation-based inference methods are as accurate as SNLE and SNRE, while being substantially faster at inference as they do not require MCMC sampling. In addition, real-world simulators sometimes produce invalid outputs, e.g. when a simulation fails. We introduce a strategy that allows likelihood(-ratio) targeting methods (such as SNVI) to deal with such invalid simulation outputs.
+
+A recent method termed "Sequential Neural Posterior and Likelihood Approximation" (SNPLA) also proposed to use variational inference (VI) instead of MCMC to speed up inference in likelihood-targeting methods (Wiqvist et al., 2021). While this proposal is related to our approach, their VI objective is based on the reverse Kullback Leibler (rKL) divergence for learning the posterior. As we also show on benchmark tasks, this leads to mode-seeking behaviour which can limit its performance. In contrast, we show how this limitation can be overcome through modifying the variational objective in combination with using SIR for adjusting posteriors.
+
+After an introduction on neural network-based simulation-based inference (SBI) and variational inference (Sec. 2), we present our method, Sequential Neural Variational Inference (SNVI) (Sec. 3). In Sec. 4.2, we empirically show that SNVI is significantly faster than state-of-the-art SBI methods while achieving similar accuracy on benchmark tasks. In Sec. 4.3, we demonstrate that SNVI is scalable, and that it is robust to invalid simulation outputs: We obtain the posterior distribution of a complex neuroscience model with one order of magnitude fewer simulations than previous methods.
+
+# 2 BACKGROUND
+
+# 2.1 SIMULATION-BASED INFERENCE
+
+Simulation-based inference (SBI) aims to perform Bayesian inference on statistical models for which the likelihood function is only implicitly defined through a stochastic simulator. Given a prior $p(\pmb{\theta})$ and a simulator which implicitly defines the likelihood $p(\pmb{x}|\pmb{\theta})$ , the goal is to identify the posterior distribution $p(\pmb{\theta}|\pmb{x}_o)$ for an observation $\pmb{x}_o$ . The simulator is considered to be 'black-box', i.e. one cannot evaluate $p(\pmb{x}|\pmb{\theta})$ and does not have access to the internal states of the simulator, but only to its inputs $\pmb{\theta}$ and its outputs $\pmb{x}$ .
+
+We focus on improving likelihood-estimation (SNLE) and likelihood-ratio-estimation (SNRE) methods. SNLE trains a deep neural density estimator $\ell_{\psi}(\pmb{x}|\pmb{\theta})$ by minimizing the forward Kullback-Leibler divergence (fKL) between $\ell_{\psi}(\pmb{x}|\pmb{\theta})$ and $p(\pmb{x}|\pmb{\theta})$ using samples $(\pmb{x},\pmb{\theta}) \sim \tilde{p}(\pmb{x},\pmb{\theta}) = p(\pmb{x}|\pmb{\theta})\tilde{p}(\pmb{\theta})$ from the simulator with $\mathcal{L}(\psi) = -\frac{1}{N}\sum_{i=1}^{N}\log \ell_{\psi}(\pmb{x}_i|\pmb{\theta}_i)$ . Here, $\ell_{\psi}(\pmb{x}|\pmb{\theta})$ is a conditional density estimator learning the conditional density $p(\pmb{x}|\pmb{\theta})$ from $(\pmb{\theta},\pmb{x})$ pairs, $\psi$ are its learnable parameters, and $\tilde{p}(\pmb{\theta})$ is the proposal distribution from which the parameters $\pmb{\theta}$ are drawn (given by e.g. a previous estimate of the posterior or by an active learning scheme, Papamakarios et al., 2019; Lueckmann et al., 2019a).
+
+Analogously, SNRE uses a discriminator, e.g. a deep logistic regression network, to estimate the density ratio $r(\pmb{x}, \pmb{\theta}) = \frac{\tilde{p}(\pmb{x}, \pmb{\theta})}{\tilde{p}(\pmb{x}) \tilde{p}(\pmb{\theta})} = \frac{p(\pmb{x}|\pmb{\theta})}{\tilde{p}(\pmb{x})}$ . (Hermans et al., 2020; Durkan et al., 2020). If the proposal is given by the prior, then one can recover the exact posterior density, otherwise the posterior can be recovered up to a normalizing constant (Durkan et al., 2020). Once the likelihood (or likelihood-ratio) has been learned, the posterior can be sampled with MCMC. In sequential schemes, the proposal $\tilde{p}$ is updated each round using the current estimate of the posterior – thus, computationally expensive MCMC sampling needs to be run in each round.
+
+# 2.2 VARIATIONAL INFERENCE
+
+We use variational inference (VI) to estimate the posterior distribution. VI formulates an optimization problem over a class of tractable distributions $\mathcal{Q}$ to find parameters $\phi^{*}$ such that $q_{\phi^{*}} \in \mathcal{Q}$ is closest to the true posterior $p(\boldsymbol{\theta} | \boldsymbol{x}_o)$ according to some divergence $D$ (Blei et al., 2017). Formally,
+
+$$
+\phi^ {*} = \underset {\phi} {\arg \min } D (q _ {\phi} (\boldsymbol {\theta}) | | p (\boldsymbol {\theta} | \boldsymbol {x} _ {o}))
+$$
+
+with $q_{\phi^*}(\pmb{\theta}) = p(\pmb{\theta}|\pmb{x}_o) \iff D(q_{\phi^*}(\pmb{\theta})||p(\pmb{\theta}|\pmb{x}_o)) = 0$ . Recent work has introduced normalizing flows as a variational family for VI (Ranganath et al., 2014; Agrawal et al., 2020; Rezende & Mohamed, 2015). Normalizing flows define a distribution $q_{\phi}(\pmb{\theta})$ by learning a bijection $T_{\phi}$ which transforms a simpler distribution into a complex distribution $p(\pmb{\theta}|\pmb{x}_o)$ . Normalizing flows provide a highly flexible variational family, while at the same time allowing low variance gradient estimation of an expectation by the reparameterization trick, i.e. $\nabla_{\phi}\mathbb{E}_{\pmb{\theta}\sim q_{\phi}}[f(\pmb{\theta})] = \mathbb{E}_{\pmb{\theta}_0\sim q_0}[\nabla_{\phi}f(T_{\phi}(\pmb{\theta}_0))]$ with $\pmb{\theta} = T_{\phi}(\pmb{\theta}_0)$ (Kingma & Welling, 2014; Rezende et al., 2014; Rezende & Mohamed, 2015).
+
+# 3 SEQUENTIAL NEURAL VARIATIONAL INFERENCE (SNVI)
+
+# 3.1 KEYINGREDIENTS
+
+We propose a framework to use variational inference (VI) for simulation-based inference. Our method consists of three parts: A learnable likelihood (or likelihood-ratio) model, a posterior model (typically parameterized as a normalizing flow) to be learned with VI, and sampling importance resampling (SIR) (Rubin, 1988) to refine the accuracy of the posterior (Fig. 1). The likelihood(-ratio) model $\ell_{\psi}(\pmb{x}|\pmb{\theta})$ learns to approximate the likelihood $p(\pmb{x}|\pmb{\theta})$ or the likelihood-ratio $\frac{p(\pmb{x}|\pmb{\theta})}{p(\pmb{x})}$ from pairs of parameters and simulation outputs $(\pmb{\theta},\pmb{x})$ . We use the term SNLVI to refer to SNVI with likelihoods, and SNRVI with likelihood-ratios. After a likelihood(-ratio) model has been trained, the posterior model $q_{\phi}(\pmb{\theta})$ is trained with variational inference using normalizing flows. Finally, SIR is used to correct potential inaccuracies in the posterior $q_{\phi}(\pmb{\theta})$ - as we will show below, the SIR step leads to empirical improvements at modest computational overhead. To refine the likelihood(-ratio) model and the posterior, the procedure can be repeated across several 'rounds'. We opt to sample the parameters $\pmb{\theta}$ from the previous posterior estimate $q_{\phi}(\pmb{\theta})$ , but other strategies for active learning (e.g. Lueckmann et al., 2019b) could be plugged into SNVI. The algorithm is summarized in Alg. 1. We will now describe three variational objectives that can be used with SNVI, the SIR procedure to refine the posterior, and a strategy for dealing with invalid simulation outputs.
+
+# 3.2 VARIATIONAL OBJECTIVES FOR SBI
+
+Because of the expressiveness of normalizing flows, the true posterior can likely be approximated well by a member of the variational family (Papamakarios et al., 2021). Thus, the quality of the
+
+Algorithm 1: SNVI
+1 Inputs: prior $p(\theta)$ , observation $\pmb{x}_o$ , divergence $D$ , simulations per round $N$ , number of
+rounds $R$ , selection strategy $\mathcal{S}$
+2 Outputs: Approximate likelihood $\ell_{\psi}$ and variational posterior $q_{\phi}$
+3 Initialize: Proposal $\tilde{p} (\pmb {\theta}) = p(\pmb {\theta})$ , simulation dataset $\mathcal{X} = \{\}$
+4 for $r\in [1,\dots,R]$ do
+5 for $i\in [1,\dots,N]$ do
+6 $\pmb {\theta}_i = \mathcal{S}(\tilde{p},\ell_\phi ,p)$ // sample $\pmb {\theta}_i\sim \tilde{p} (\pmb {\theta})$
+7 simulate $\pmb {x}_i\sim p(\pmb {x}|\pmb {\theta}_i)$ // run the simulator on $\pmb{\theta}_{i}$
+8 add $(\pmb {\theta}_i,\pmb {x}_i)$ to $\mathcal{X}$
+9 end
+10 (re-)train $\ell_{\psi}$ .. $\psi^{*} = \arg \min_{\psi} - \frac{1}{N}\sum_{(\pmb {x}_i,\pmb {\theta}_i)\in \mathcal{X}}\log \ell_{\psi}(\pmb {x}_i|\pmb {\theta}_i);$ / or SNRE loss
+11 (re-)train $q_{\phi}$ .. $\phi^{*} = \arg \min_{\phi}D(q_{\phi}(\pmb {\theta})||p(\pmb {\theta}|\pmb {x}_o))$ with
+12 $p(\pmb {\theta}|\pmb {x}_o)\propto p(\pmb {x}_o|\pmb {\theta})p(\pmb {\theta})\approx \ell_{\psi^*}(\pmb {x}_o|\pmb {\theta})p(\pmb {\theta})$
+13 end
+
+variational approximation is strongly linked to the ability to achieve the best possible approximation through optimization, which in turn depends on the choice of variational objective $D$ . Using the reverse Kullback-Leibler Divergence (rKL) as proposed by Wiqvist et al. (2021) can give rise to mode-seeking behaviour and $q_{\phi}$ might not cover all regions of the posterior (Bishop, 2006; Blei et al., 2017). As a complementary approach, we suggest and evaluate three alternative variational objectives that induce a mass-covering behaviour and posit that this strategy will be particularly important in sequential schemes.
+
+1. Forward KL divergence (fKL) In contrast to the reverse KL (rKL), the forward Kullback-Leibler divergence (fKL) is mass-covering (Bishop, 2006). Wan et al. (2020) minimize the following upper bound to the evidence, which implicitly minimizes the fKL: $\mathcal{L}(\phi) = \mathbb{E}_{\pmb{\theta}\sim q_{\phi}}[w(\pmb{\theta})\log(w(\pmb{\theta}))]$ with $w(\pmb{\theta}) = p(\pmb{x}_o,\pmb{\theta}) / q_{\phi}(\pmb{\theta})$ . This expression is hard to estimate with samples: If $q_{\phi}(\pmb{\theta})$ is different from $p(\pmb{x}_o,\pmb{\theta})$ then $w(\pmb{\theta}) \approx 0$ for most $\pmb{\theta} \sim q_{\phi}(\pmb{\theta})$ , thus $\nabla_{\phi}\mathcal{L}(\phi) \approx 0$ , which would prevent learning (see Appendix Sec. A.3).
+
+To overcome this problem, we rewrite the fKL using self-normalized importance sampling (Jerfel et al., 2021). Let $\theta_{1},\ldots ,\theta_{N}\sim \pi$ be samples from an arbitrary proposal distribution $\pi$ . We then minimize the loss:
+
+$$
+\mathcal {L} _ {\mathrm {f K L}} (\phi) = D _ {K L} (p | | q _ {\phi}) \approx \sum_ {i = 1} ^ {N} \frac {w (\boldsymbol {\theta} _ {i})}{\sum_ {j = 1} ^ {N} w (\boldsymbol {\theta} _ {j})} \log \left(\frac {p (\boldsymbol {x} _ {o} , \boldsymbol {\theta} _ {i})}{q _ {\phi} (\boldsymbol {\theta} _ {i})}\right)
+$$
+
+where $w(\pmb{\theta}) = p(\pmb{x}_o, \pmb{\theta}) / \pi(\pmb{\theta})$ . As a self-normalized importance sampling scheme, this estimate is biased, but the bias vanishes at rate $\mathcal{O}(1/N)$ (Hesterberg, 2003). In our experiments, we use $\pi = q_{\phi}$ , which provides a good proposal when $q_{\phi}$ is close to $p$ (Chatterjee & Diaconis, 2018). Even though $q_{\phi}$ will differ from $p$ initially, sufficient gradient information is available to drive $q_{\phi}$ towards $p$ , as we demonstrate in Appendix Sec. A.3.
+
+2. Importance weighted ELBO The importance weighted ELBO (IW-ELBO) introduced by Burda et al. (2016) uses the importance-weighted gradient of the evidence lower bound (ELBO). It minimizes the KL divergence between the self-normalized importance sampling distribution of $q_{\phi}$ and the posterior and thus provides a good proposal for sampling importance resampling (Cremer et al., 2017; Domke & Sheldon, 2018; Ranganath et al., 2014). It can be formulated as
+
+$$
+\mathcal {L} _ {I W} ^ {(K)} (\phi) = \mathbb {E} _ {\boldsymbol {\theta} _ {1}, \dots , \boldsymbol {\theta} _ {k} \sim q _ {\phi}} \left[ \log \frac {1}{K} \sum_ {k = 1} ^ {K} \frac {p (\boldsymbol {x} _ {o} , \boldsymbol {\theta} _ {k})}{q _ {\phi} (\boldsymbol {\theta} _ {k})} \right].
+$$
+
+To avoid a low SNR of the gradient estimator (Rainforth et al., 2018), we use the 'Sticking the Landing' (STL) estimator introduced by Roeder et al. (2017).
+
+3. Rényi $\alpha$ -divergences Rényi $\alpha$ -divergences are a divergence family with a hyperparameter $\alpha$ which allows to tune the mass-covering (or mode-seeking) behaviour of the algorithm. For $\alpha \to 1$ , the divergence approaches the rKL. For $\alpha < 1$ , the divergence becomes more mass-covering, for $\alpha > 1$ more mode-seeking. We use $\alpha = 0.1$ in our experiments. A Rényi variational bound was established by Li & Turner (2016) and is given by
+
+$$
+\mathcal {L} _ {\alpha} (\phi) = \frac {1}{1 - \alpha} \log \left(\mathbb {E} _ {\pmb {\theta} \sim q _ {\phi}} \left[ \left(\frac {p (\pmb {x} _ {o} , \pmb {\theta})}{q _ {\phi} (\pmb {\theta})}\right) ^ {1 - \alpha} \right]\right)
+$$
+
+For $\alpha = 0$ , $\mathcal{L}_{\alpha}$ is a single sample Monte Carlo estimate of the IW-ELBO (when using $K$ samples to estimate the expectation in $\mathcal{L}_{\alpha}(\phi)$ ) and thus also suffers from a low SNR as $\alpha \rightarrow 0$ (Rainforth et al., 2018; Li & Turner, 2016). Just as for the IW-ELBO, we alleviate this issue by combining the $\alpha$ -divergences with the STL estimator.
+
+# 3.3 SAMPLING IMPORTANCE RESAMPLING
+
+After the variational posterior has been trained, $q_{\phi}$ approximates $\ell_{\psi}(\pmb{x}_o|\pmb{\theta})p(\pmb{\theta}) / Z$ with normalization constant $Z$ . We propose to improve the quality of posterior samples by applying Sampling Importance Resampling (SIR) (Rubin, 1988). We sample $K = 32$ samples from $\pmb{\theta} \sim q_{\phi}(\pmb{\theta})$ , compute the corresponding importance weights $w_i = \ell_{\psi}(\pmb{x}_o|\pmb{\theta}_i)p(\pmb{\theta}_i) / q_{\phi}(\pmb{\theta}_i)$ and resample a single sample from a categorical distribution whose probabilities equal the normalized importance weights (details in Appendix Sec. A.4). This strategy enriches the variational family with minimal computational cost (Agrawal et al., 2020). SIR is particularly useful when $q_{\phi}(\pmb{\theta})$ covers the true posterior and is thus well-suited for the objectives described above (see Appendix Fig. 6).
+
+# 3.4 EXCLUDING INVALID DATA
+
+Simulators may produce unreasonable or undefined values (e.g. NaN), as we will also see in the pyloric network model described later. In posterior estimation methods (SNPE), one can simply remove these 'invalid' simulations from the training dataset, and the trained neural density estimator will still approximate the true posterior (Lueckmann et al., 2017). However, as we show in Appendix Sec. A.6, this is not the case for likelihood(-ratio)-methods- when 'invalid' simulations are removed, the network will converge to $\ell_{\psi}(\pmb{x}_o|\pmb{\theta})\approx \frac{1}{Z} p(\pmb{x}_o|\pmb{\theta}) / p(\mathrm{valid}|\pmb {\theta})$ , i.e. the learned likelihood-function will be biased towards parameter regions which often produce 'invalid' simulations. This prohibits any method that estimates the likelihood(-ratio) (i.e. SNVI, SNLE, SNRE) from excluding 'invalid' simulations, and would therefore prohibit their use on models that produce such data.
+
+To overcome this limitation of likelihood-targeting techniques, we propose to estimate the bias-term $p(\mathrm{valid}|\pmb{\theta})$ with an additional feedforward neural network $c_{\zeta}(\pmb{\theta}) \approx p(\mathrm{valid}|\pmb{\theta})$ (details in Appendix Sec. A.6). Once trained, $c_{\zeta}(\pmb{\theta})$ can be used to correct for the bias in the likelihood network. Given the (biased) likelihood network $\ell_{\psi}(\pmb{x}_o|\pmb{\theta})$ and the correction factor $c_{\zeta}(\pmb{\theta})$ , the posterior distribution is proportional to
+
+$$
+\mathcal {P} (\boldsymbol {\theta}) = \ell_ {\psi} (\boldsymbol {x} _ {o} | \boldsymbol {\theta}) p (\boldsymbol {\theta}) c _ {\zeta} (\boldsymbol {\theta}) \propto p (\boldsymbol {x} _ {o} | \boldsymbol {\theta}) p (\boldsymbol {\theta}) \propto p (\boldsymbol {\theta} | \boldsymbol {x} _ {o}).
+$$
+
+We sample from this distribution with VI in combination with SIR. Details, proof and extension to SNRVI in Appendix Sec. A.6. The additional network $c_{\zeta}(\theta)$ is only required in models which can produce invalid simulations. This is not the case for the toy models in Sec. 4.2, but it is required in the model in Sec. 4.3. Alg. 1 shows SNVI without the additional bias-correction step, Appendix Alg. 3 shows the method with correction.
+
+# 4 EXPERIMENTS
+
+We demonstrate the accuracy and the computational efficiency of SNVI on several examples. First, we apply SNVI to an illustrative example to demonstrate its ability to capture complex posteriors without mode-collapse. Second, we compare SNVI to alternative methods on several benchmark tasks. Third, we demonstrate that SNVI can obtain the posterior distribution in models with many parameters by applying it to a neuroscience model of the pyloric network in the crab Cancer borealis.
+
+
+Figure 2: A Posterior approximations of SNLE, SNPLA, and SNVI+fKL for the two moons benchmark example. B Runtime of all algorithms.
+
+
+
+# 4.1 ILLUSTRATIVE EXAMPLE: TWO MOONS
+
+We use the 'two moons' simulator (Greenberg et al., 2019) to illustrate the ability of SNVI to capture complex posterior distributions. The two moons simulator has two parameters with a uniform prior and generates a posterior that has both local and global structure. Fig. 2A shows the ground truth posterior distribution as well as approximations learned by several methods using $10^{5}$ simulations.
+
+SNLE with MCMC (in the form of Slice Sampling with axis-aligned updates (Neal, 2003)) can recover the bimodality when running 100 chains in parallel (Lueckmann et al., 2021) (not shown: individual chains typically only explore a single mode). SNPLA, which is based on the mode-seeking rKL (and could thus also be considered as $\mathrm{SNVI + rKL}$ , see Appendix Sec. A.7) captures only a single mode. In contrast, SNLVI (using the fKL and SIR, denoted as $\mathrm{SNVI + fKL}$ ) recovers both the local and the global structure of the posterior accurately. In terms of runtime, SNPLA and $\mathrm{SNVI + fKL}$ are up to twenty times faster than 100 chain MCMC in our implementation (Fig. 2B), and two to four orders of magnitude faster than single chain MCMC (single chain not shown, the relative speed-up for multi-chain MCMC is due to vectorization).
+
+# 4.2 RESULTS ON BENCHMARK PROBLEMS
+
+We compare the accuracy and computational cost of SNVI to that of previous methods, using SBI benchmark tasks (Lueckmann et al., 2021):
+
+Bernoulli GLM: Generalized linear model with Bernoulli observations. Inference is performed on 10-dimensional sufficient summary statistics of the originally 100 dimensional raw data. The resulting posterior is 10-dimensional, unimodal, and concave.
+
+Lotka Volterra: A traditional model in ecology (Wangersky, 1978), which describes a predator-prey interaction between species, illustrating a task with complex likelihood and unimodal posterior.
+
+Two moons: Same as described in the previous section.
+
+SLCP: A task introduced by Papamakarios et al. (2019) with a simple likelihood and complex posterior. The prior is uniform, the likelihood has Gaussian noise but is nonlinearly related to the parameters, resulting in a posterior with four symmetrical modes.
+
+For each task, we perform inference for ten different runs, each with a different observation. As performance metric, we used classifier 2-sample tests (C2ST) (best is 0.5, worst is 1.0) (Friedman, 2004; Lopez-Paz & Oquab, 2017). For each method, we perform inference given a total of $10^{3}$ , $10^{4}$ and $10^{5}$ simulations, evenly distributed across ten rounds of simulation and training. Details on the hyperparameters are provided in Appendix Sec. A.8, details on results in Appendix Fig. 9, comparisons to the forward KL without self-normalized weights as well as to the IW-ELBO and the $\alpha$ -divergences without STL in Appendix Fig. 11.
+
+We show results for two reference methods, SNLE with MCMC sampling, and SNPLA, and compare them to three variants of SNLVI using the forward KL (SNVI+fKL), the importance-weighted ELBO (SNVI+IW) as well as an alpha-divergence (SNVI+α). We find that all three SNVI-variants achieve performance comparable to MCMC across all four tasks (Fig. 3 A-D, left), and outperform SNPLA on the two tasks with multi-modal posteriors (Two moons and SLCP). We find that omitting the SIR-adjustment (dotted lines) leads to a small but consistent degradation in inference
+
+
+Figure 3: C2ST benchmark results for SNVI with likelihood-estimation (SNLVI) for four models, Bernoulli GLM (A), Lotka volterra (B), Two moons (C) and SLCP (D). Each point represents the average metric value for ten different observations, as well as the confidence intervals. Bars on the right indicate the average runtime. Two reference methods: SNLE with MCMC sampling, and SNPLA (which uses rKL), as well as three variants of SNVI, with forward KL (SNVI+fKL), importance-weighted ELBO (SNVI+IW) and $\alpha$ -divergence (SNVI+ $\alpha$ ). Dotted lines: Performance when not using SIR.
+
+performance for all SNVI-variants, but not for SNPLA with the rKL: When using the rKL, the approximate posterior $q_{\phi}$ is generally narrower than the posterior and thus ill-suited for SIR (Appendix Fig. 6). Qualitatively similar results were found when using likelihood-ratio approaches with the same hyperparameters, see Appendix Fig. 10.
+
+In terms of runtime, all three variants of SNLVI are substantially faster than SNLE on every task (bars in Fig. 3 on the right), in some cases by more than an order of magnitude. When using likelihood-ratio estimation, MCMC with 100 chains can be as fast as SNRVI on tasks with few parameters (Appendix Fig. 10). On tasks with many parameters, however, SNRVI is significantly faster than SNRE (see e.g. Bernoulli GLM with 10 parameters).
+
+# 4.3 INFERENCE IN A NEUROSCIENCE MODEL OF THE PYLORIC NETWORK
+
+Finally, we applied SNVI to a simulator of the pyloric network in the stomatogastric ganglion (STG) of the crab Cancer Borealis, a well-characterized circuit producing rhythmic activity. The model consists of three model neurons (each with eight membrane conductances) with seven synapses (31 parameters in total) and produces voltage traces that can be characterized with 15 established summary statistics (Prinz et al., 2003; 2004). In this model, disparate parameter sets can produce similar activity, leading to a posterior distribution with broad margins but narrow conditionals (Prinz et al., 2004; Gonçalves et al., 2020). Previous work has used millions of simulations from prior samples and performed amortized inference with NPE (18 million simulations in Gonçalves et al. (2020), 9 million in Deistler et al. (2021)). Sequential neural posterior estimation (SNPE) struggles on this problem due to leakage, whereas SNLE and SNRE with MCMC are inefficient (Durkan et al., 2020). Here, we apply SNVI to identify the posterior distribution given an extracellular recording of the stomatogastric motor neuron (Fig. 4A) (Haddad & Marder, 2021; 2018). We demonstrate that SNVI can perform multi-round inference and obtains the posterior distribution with only 350,000 simulations – 25 times fewer than previous methods!
+
+
+
+
+
+
+
+
+Figure 4: (A) Empirical observation, arrows indicate some of the summary statistics. Scale bar is one second. (B) Cornerplot showing a subset of the marginal and pairwise marginal distributions of the 31-dimensional posterior (full posterior in Appendix Fig. 12). Red dot: MAP. Black dot: Posterior mean. (C) Conditional distributions $p(\theta_{i,j} | \boldsymbol{x}, \theta_{\neq i,j})$ . Green dot shows the sample on which we condition. (D) Simulated traces from the posterior mean and MAP. Scale bar is one second. (E) Simulated traces of three posterior samples. (F) Posterior predictive and prior predictive median (z-scored) distances from the observation. (G) Time required to obtain 10k samples: SNVI takes 11 minutes and SNLE with 100-chain MCMC 808 minutes, i.e. over 13 hours.
+
+
+
+
+
+We ran SNVI with a likelihood-estimator with the fKL divergence (SNVI+fKL) and SIR. Since the simulator produces many invalid summary statistics (e.g. gaps between bursts cannot be defined if there are no bursts) we employed the strategy described in Sec. 3.4. Because only $1\%$ of the simulations from prior samples are valid (Fig. 4F), we used 50,000 simulations in the first round and continued for 30 rounds with 10,000 simulations each.
+
+The posterior is complex and reveals strong correlations and nonlinear relationships between parameters (Fig. 4B showing 4 out of 31 dimensions, full posterior in Appendix Fig. 12). The conditional distributions $p(\theta_{i,j} | \boldsymbol{x}, \theta_{\neq i,j})$ given a posterior sample (Fig. 4C) are narrow, demonstrating that parameters have to be finely tuned to generate the summary statistics of the experimentally measured activity. We used posterior predictive checks to inspect the quality of the posterior. When simulating data from the posterior mean and posterior mode (MAP), we find that both of them match the statistics of the experimental activity (Fig. 4D). Similarly, samples from the posterior distribution closely match statistics of the experimental activity (Fig. 4E). Out of 10,000 posterior samples, 9366 ( $\approx 94\%$ ) generated activity with well-defined summary statistics (compared to $1\%$ of prior samples). For the samples which generate well-defined summary statistics, the (z-scored) median distance between the observed data $x_o$ and generated activity is smaller for posterior samples than for prior samples (Fig. 4F). We emphasize that an application of SNLE with MCMC would be estimated to take an additional 400 hours, due to 30 rounds of slow MCMC sampling (Fig. 4G) that would be required- instead of 27 hours for SNVI. Likewise, when running SNPE-C on this example, only one out of 2 million samples was within the prior bounds after the second round, requiring computationally expensive rejection sampling (Greenberg et al., 2019; Durkan et al., 2020). Finally, we note that the additional neural network $c_\zeta(\theta)$ (required to correct for the effect of invalid simulations) can be learned robustly and with low computational cost (see Appendix Fig. 13 for runtime).
+
+These results show that SNVI makes it possible to overcome the limitations of previous methods and allows sequential neural simulation-based inference methods to effectively and robustly scale to challenging inference problems of scientific interest. While it is difficult to rigorously evaluate the accuracy of the obtained posterior distribution due to a lack of ground truth, we observed that almost all posterior predictions have well-defined summary statistics (94% vs 80% in Gonçalves et al. (2020)) and that the posterior predictions closely match $\pmb{x}_o$ .
+
+# 5 DISCUSSION
+
+We introduced Sequential Neural Variational Inference (SNVI), an efficient, flexible, and robust approach to perform Bayesian inference in models with an intractable likelihood. We achieve this by combining likelihood-estimation (or likelihood-ratio estimation) with variational inference, further improved by using SIR for refining posteriors. We demonstrate that SNVI reduces the computational cost of inference while maintaining accuracy. We applied our approach to a neuroscience model of the pyloric network with 31 parameters and showed that it is 25 times more efficient than previous methods. Our results demonstrate that SNVI is a scalable and robust method for simulation-based inference, opening up new possibilities for Bayesian inference in models with intractable likelihoods.
+
+We selected three variational objectives for SNVI which induce mass-covering behaviour and are, therefore, well suited as a proposal for sampling from complex posterior distributions. We empirically evaluated all of these methods in terms of runtime and accuracy on four benchmark tasks. We found that, while their performance differed when using the raw VI output, they all showed similar performance after an additional, computationally cheap, sampling importance resampling (SIR) step. After the SIR step, all methods had similar accuracy as MCMC, and all methods outperformed a mode-seeking variational objective (reverse KL) which was used in a previously proposed method Wiqvist et al. (2021). Our results suggest that mass-covering VI objectives (regardless of their exact implementation) provide a means to perform fast and accurate inference in models with intractable likelihood, without loss of accuracy compared to MCMC. In Appendix Sec. A.2, we provide technical recommendations for choosing a variational objective for specific problems.
+
+A common approach in sequential methods is to use the current posterior estimate as the proposal distribution for the next round, but more elaborate active-learning strategies for choosing new simulations are possible (Papamakarios & Murray, 2016; Papamakarios et al., 2019; Lueckmann et al., 2019a). SNVI can flexibly be combined with any active learning scheme, and unlike neural likelihood(-ratio) methods, does not require expensive MCMC sampling for updating posterior estimates. While this comes at the cost of having to train two neural networks (a likelihood-model and a posterior-model), the cost of training these neural networks is often negligible compared to the cost of simulations. Another method that trains both a likelihood- and a posterior network is Posterior-Aided Regularization (Kim et al., 2021), which regularizes the likelihood-estimate with a simultaneously trained posterior-estimate. This improves the modelling of multimodal posteriors, but the method still requires MCMC and thus scales poorly with the number of samples and dimensions. Likelihood-free variational inference (Tran et al., 2017) avoids learning a likelihood model by learning an implicit posterior distribution, but it requires an adversarial training objective which can be difficult to optimize and requires extensive hyperparameter tuning (Huszár, 2017). Ong et al. (2018) is another method that performs variational inference with a synthetic likelihood, but their approach requires that the summary statistics are approximately Gaussian in order to obtain unbiased estimates of the log-likelihood.
+
+Overall, SNVI combines the desirable properties of current methods: It can be combined with any active learning scheme, it can flexibly combine information from multiple datapoints, it returns a posterior distribution that can be sampled quickly, and it can robustly deal with missing data. SNVI speeds up inference relative to MCMC-based methods, sometimes by orders of magnitude, and can perform inference in large models with many parameters. SNVI therefore has potential to provide a new 'go-to' approach for simulation-based inference, and to open up new application domains for simulation-based Bayesian inference.
+
+# 6 REPRODUCIBILITY STATEMENT
+
+We used the configuration manager hydra to track the configuration and seeds of each run (Yadan, 2019). The results shown in this paper can be reproduced with the git repository https://github.com/mackelab/snvi Repo. The algorithms developed in this work are also available in the sbi toolbox (Tejero-Cantero et al., 2020). All simulations and runs were performed on a high-performance computer. For each run, we used 16 CPU cores (Intel family 6, model 61) and 8GB RAM.
+
+# 7 ACKNOWLEDGEMENTS
+
+We thank Jan-Matthis Lueckmann for insightful comments on the manuscript. This work was funded by the German Research Foundation (DFG; Germany's Excellence Strategy MLCoE - EXC number 2064/1 PN 390727645) and the German Federal Ministry of Education and Research (BMBF; Tübingen AI Center, FKZ: 01IS18039A).
+
+# 8 ETHICS STATEMENT
+
+We used data recorded from animal experiments in the crab Cancer borealis. The data we used were recorded for a different, independent study and have recently been made publicly available (Haddad & Marder, 2018; 2021). While simulation-based inference has the potential to greatly accelerate scientific discovery across a broad range of disciplines, one could also imagine undesired use-cases of SBI.
+
+# REFERENCES
+
+LF Abbott and Eve Marder. Modeling small networks. Methods in Neuronal Modeling, pp. 361-410, 1998.
+Abhinav Agrawal, Daniel Sheldon, and Justin Domke. Advances in black-box vi: Normalizing flows, importance weighting, and optimization. arXiv preprint arXiv:2006.10343, 2020.
+Mark A Beaumont, Wenyang Zhang, and David J Balding. Approximate bayesian computation in population genetics. Genetics, 162(4):2025-2035, 2002.
+Eli Bingham, Jonathan P. Chen, Martin Jankowiak, Fritz Obermeyer, Neeraj Pradhan, Theofanis Karaletsos, Rohit Singh, Paul A. Szerlip, Paul Horsfall, and Noah D. Goodman. Pyro: Deep universal probabilistic programming. J. Mach. Learn. Res., 20:28:1-28:6, 2019.
+Christopher M Bishop. Pattern recognition. Machine learning, 128(9), 2006.
+David M. Blei, Alp Kucukelbir, and Jon D. McAuliffe. Variational inference: A review for statisticians. Journal of the American Statistical Association, 112(518):859-877, Apr 2017.
+Yuri Burda, Roger Grosse, and Ruslan Salakhutdinov. Importance weighted autoencoders. International Conference on Learning Representations, 2016.
+Sourav Chatterjee and Persi Diaconis. The sample size required in importance sampling. The Annals of Applied Probability, 28(2):1099-1135, 2018.
+Yanzhi Chen, Dinghuai Zhang, Michael Gutmann, Aaron Courville, and Zhanxing Zhu. Neural approximate sufficient statistics for implicit models. International Conference on Learning Representations, 2021.
+Kyle Cranmer, Juan Pavez, and Gilles Louppe. Approximating likelihood ratios with calibrated discriminative classifiers. arXiv preprint arXiv:1506.02169, 2015.
+Chris Cremer, Quaid Morris, and David Duvenaud. Reinterpreting importance-weighted autoencoders, 2017.
+
+Michael Deistler, Jakob H. Macke, and Pedro J. Gonçalves. Disparate energy consumption despite similar network activity. bioRxiv, 2021.
+Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. Density estimation using real nvp. International Conference in Learning Representations 2017, 2017.
+Justin Domke and Daniel Sheldon. Importance weighting and variational inference. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, pp. 4475-4484, 2018.
+Conor Durkan, Artur Bekasov, Iain Murray, and George Papamakarios. Neural spline flows. Advances in Neural Information Processing Systems, 32:7511-7522, 2019a.
+Conor Durkan, Artur Bekasov, Iain Murray, and George Papamakarios. Neural spline flows. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019b.
+Conor Durkan, Iain Murray, and George Papamakarios. On contrastive learning for likelihood-free inference. In International Conference on Machine Learning, pp. 2771-2781. PMLR, 2020.
+Jerome Friedman. On multivariate goodness-of-fit and two-sample testing. Technical report, Cite-seer, 2004.
+Pedro J Gonçalves, Jan-Matthis Lueckmann, Michael Deistler, Marcel Nonnenmacher, Kaan Öcal, Giacomo Bassetto, Chaitanya Chintaluri, William F Podlaski, Sara A Haddad, Tim P Vogels, et al. Training deep neural density estimators to identify mechanistic models of neural dynamics. *Elife*, 9:e56261, 2020.
+David Greenberg, Marcel Nonnenmacher, and Jakob Macke. Automatic posterior transformation for likelihood-free inference. In International Conference on Machine Learning, pp. 2404-2414, 2019.
+Michael U Gutmann, Ritabrata Dutta, Samuel Kaski, and Jukka Corander. Likelihood-free inference via classification. Statistics and Computing, 28(2):411-425, 2018.
+Sara A. Haddad and Eve Marder. Circuit robustness to temperature perturbation is altered by neuromodulators. Neuron, 100(3):609-623.e3, 2018.
+Sara Ann Haddad and Eve Marder. Recordings from the C. borealis Stomatogastric Nervous System at different temperatures in the decentralized condition, July 2021. URL https://doi.org/10.5281/zenodo.5139650.
+Joeri Hermans, Volodimir Begy, and Gilles Louppe. Likelihood-free mcmc with amortized approximate ratio estimators. In International Conference on Machine Learning, pp. 4239-4248. PMLR, 2020.
+Timothy Classen Hesterberg. Advances in importance sampling. PhD thesis, CiteSeer, 2003.
+Ferenc Huszár. Variational inference using implicit distributions, 2017.
+Ghassen Jerfel, Serena Wang, Clara Fannjiang, Katherine A. Heller, Yian Ma, and Michael I. Jordan. Variational refinement for importance sampling using the forward kullback-leibler divergence, 2021.
+Dongjun Kim, Kyungwoo Song, Seungjae Shin, Wanmo Kang, and Il-Chul Moon. Posterior-aided regularization for likelihood-free inference. arXiv preprint arXiv:2102.07770, 2021.
+Diederik P Kingma and Max Welling. Auto-encoding variational bayes, 2014.
+Durk P Kingma, Tim Salimans, Rafal Jozefowicz, Xi Chen, Ilya Sutskever, and Max Welling. Improved variational inference with inverse autoregressive flow. Advances in neural information processing systems, 29:4743-4751, 2016.
+Y Li and RE Turner. Rényi divergence variational inference. Advances in Neural Information Processing Systems 29 (NIPS 2016), pp. 1073-1081, 2016.
+
+David Lopez-Paz and Maxime Oquab. Revisiting classifier two-sample tests. In International Conference on Learning Representations, 2017.
+Jan-Matthis Lueckmann, Pedro J Goncalves, Giacomo Bassetto, Kaan Öcal, Marcel Nonnenmacher, and Jakob H Macke. Flexible statistical inference for mechanistic models of neural dynamics. In Advances in Neural Information Processing Systems, pp. 1289-1299, 2017.
+Jan-Matthis Lueckmann, Giacomo Bassetto, Theofanis Karaletsos, and Jakob H. Macke. Likelihood-free inference with emulator networks. In Francisco Ruiz, Cheng Zhang, Dawen Liang, and Thang Bui (eds.), Proceedings of The 1st Symposium on Advances in Approximate Bayesian Inference, volume 96 of Proceedings of Machine Learning Research, pp. 32-53, 2019a.
+Jan-Matthis Lueckmann, Giacomo Bassetto, Theofanis Karaletsos, and Jakob H Macke. Likelihood-free inference with emulator networks. In Symposium on Advances in Approximate Bayesian Inference, pp. 32-53. PMLR, 2019b.
+Jan-Matthis Lueckmann, Jan Boelts, David Greenberg, Pedro Goncalves, and Jakob Macke. Benchmarking simulation-based inference. In Arindam Banerjee and Kenji Fukumizu (eds.), Proceedings of The 24th International Conference on Artificial Intelligence and Statistics, volume 130 of Proceedings of Machine Learning Research, pp. 343-351. PMLR, 13-15 Apr 2021.
+Benjamin Kurt Miller, Alex Cole, Patrick Forre, Gilles Louppe, and Christoph Weniger. Truncated marginal neural ratio estimation. Advances in Neural Information Processing Systems, 2022.
+Shakir Mohamed and Balaji Lakshminarayanan. Learning in implicit generative models. arXiv preprint arXiv:1610.03483, 2016.
+Radford M Neal. Slice sampling. The annals of statistics, 31(3):705-767, 2003.
+Victor MH Ong, David J Nott, Minh-Ngoc Tran, Scott A Sisson, and Christopher C Drovandi. Variational bayes with synthetic likelihood. Statistics and Computing, 28(4):971-988, 2018.
+George Papamakarios and Iain Murray. Fast $\varepsilon$ -free inference of simulation models with bayesian conditional density estimation. In Advances in Neural Information Processing Systems, pp. 1028-1036, 2016.
+George Papamakarios, Theo Pavlakou, and Iain Murray. Masked autoregressive flow for density estimation. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pp. 2335-2344, 2017.
+George Papamakarios, David Sterratt, and Iain Murray. Sequential neural likelihood: Fast likelihood-free inference with autoregressive flows. In The 22nd International Conference on Artificial Intelligence and Statistics, pp. 837-848, 2019.
+George Papamakarios, Eric Nalisnick, Danilo Jimenez Rezende, Shakir Mohamed, and Balaji Lakshminarayanan. Normalizing flows for probabilistic modeling and inference. Journal of Machine Learning Research, 22(57):1-64, 2021.
+Astrid A Prinz, Cyrus P Billimoria, and Eve Marder. Alternative to hand-tuning conductance-based models: construction and analysis of databases of model neurons. Journal of neurophysiology, 2003.
+Astrid A Prinz, Dirk Bucher, and Eve Marder. Similar network activity from disparate circuit parameters. Nature neuroscience, 7(12):1345-1352, 2004.
+Tom Rainforth, Adam Kosiorek, Tuan Anh Le, Chris Maddison, Maximilian Igl, Frank Wood, and Yee Whye Teh. Tighter variational bounds are not necessarily better. In International Conference on Machine Learning, pp. 4277-4285. PMLR, 2018.
+Rajesh Ranganath, Sean Gerrish, and David Blei. Black box variational inference. In Artificial Intelligence and Statistics, pp. 814-822. PMLR, 2014.
+Danilo Rezende and Shakir Mohamed. Variational inference with normalizing flows. In International conference on machine learning, pp. 1530-1538. PMLR, 2015.
+
+Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In International conference on machine learning, pp. 1278-1286. PMLR, 2014.
+Geoffrey Roeder, Yuhuai Wu, and David K Duvenaud. Sticking the landing: Simple, lower-variance gradient estimators for variational inference. Advances in Neural Information Processing Systems, 30:6925-6934, 2017.
+Donald B Rubin. Using the sir algorithm to simulate posterior distributions. Bayesian statistics, 3: 395-402, 1988.
+Alvaro Tejero-Cantero, Jan Boelts, Michael Deistler, Jan-Matthis Lueckmann, Conor Durkan, Pedro J. Gonçalves, David S. Greenberg, and Jakob H. Macke. sbi: A toolkit for simulation-based inference. Journal of Open Source Software, 5(52):2505, 2020. doi: 10.21105/joss.02505.
+Owen Thomas, Ritabrata Dutta, Jukka Corander, Samuel Kaski, Michael U Gutmann, et al. Likelihood-free inference by ratio estimation. Bayesian Analysis, 2021.
+Dustin Tran, Rajesh Ranganath, and David M Blei. Hierarchical implicit models and likelihood-free variational inference. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pp. 5529-5539, 2017.
+George Tucker, Dieterich Lawson, Shixiang Gu, and Chris J Maddison. Doubly reparameterized gradient estimators for monte carlo objectives. In International Conference on Learning Representations, 2018.
+Neng Wan, Dapeng Li, and Naira Hovakimyan. f-divergence variational inference. Advances in Neural Information Processing Systems, 33, 2020.
+Peter J Wangersky. Lotka-volterra population models. Annual Review of Ecology and Systematics, 9(1):189-218, 1978.
+Samuel Wiqvist, Jes Frellsen, and Umberto Picchini. Sequential neural posterior and likelihood approximation, 2021.
+Simon N. Wood. Statistical inference for noisy nonlinear ecological dynamic systems. Nature, 466 (7310):1102-1104, Aug 2010.
+Omry Yadan. Hydra - a framework for elegantly configuring complex applications. Github, 2019. URL https://github.com/facebookresearch/hydra.
+
+# A APPENDIX
+
+# A.1 GRADIENTS OF THE DIVERGENCES
+
+For completeness, we provide the gradients of the divergences introduced in Sec. 3.2.
+
+Forward Kullback-Leibler divergence The gradient estimate is given by
+
+$$
+\nabla_ {\phi} \mathcal {L} _ {\mathrm {f K L}} (\phi) = - \mathbb {E} _ {\pmb {\theta} \sim p} \left[ \nabla_ {\phi} \log (q _ {\phi} (\pmb {\theta})) \right] \approx - \sum_ {i = 1} ^ {N} \frac {w (\pmb {\theta} _ {i})}{\sum_ {j = 1} ^ {N} w (\pmb {\theta} _ {j})} \nabla_ {\phi} \log q _ {\phi} (\pmb {\theta} _ {i})
+$$
+
+Importance-weighted ELBO A gradient estimator is given by
+
+$$
+\nabla_ {\phi} \mathcal {L} _ {I W} ^ {(K)} (\boldsymbol {\phi}) = \mathbb {E} _ {\boldsymbol {\theta} _ {1}, \dots , \boldsymbol {\theta} _ {K} \sim q _ {\phi}} \left[ \sum_ {i = 1} ^ {K} \tilde {w} (\boldsymbol {\theta} _ {i}) \nabla_ {\phi} \log \left(\frac {p (\boldsymbol {x} _ {o} , \boldsymbol {\theta} _ {i})}{q _ {\phi} (\boldsymbol {\theta} _ {i})}\right) \right] \quad \tilde {w} (\boldsymbol {\theta} _ {i}) = \frac {w (\boldsymbol {\theta} _ {i})}{\sum_ {i = 1} ^ {K} w (\boldsymbol {\theta} _ {i})}
+$$
+
+where $w(\pmb {\theta}) = p(\pmb{x}_o,\pmb {\theta}) / q_\phi (\pmb {\theta})$
+
+Renyi $\alpha$ -divergence A biased gradient estimator using the reparameterization trick can be written as:
+
+$$
+\nabla_ {\phi} \mathcal {L} _ {\alpha} (\phi) = \mathbb {E} _ {\pmb {\theta} \sim q _ {\phi}} \left[ \tilde {w} _ {\alpha} (\pmb {\theta}) \nabla_ {\phi} \log \left(\frac {p (\pmb {x} _ {o} , \pmb {\theta})}{q _ {\phi} (\pmb {\theta})}\right) \right] \quad \tilde {w} _ {\alpha} = \frac {w (\pmb {\theta}) ^ {1 - \alpha}}{\mathbb {E} _ {\pmb {\theta} \sim q _ {\phi}} [ w (\pmb {\theta}) ^ {1 - \alpha} ]},
+$$
+
+where $w(\pmb{\theta}) = p(\pmb{x}_o, \pmb{\theta}) / q_{\phi}(\pmb{\theta})$ . This gradient estimator is biased towards the rKL but the bias vanishes as more samples are used for the Monte Carlo approximation (Li & Turner, 2016).
+
+# A.2 CHOICE OF DIVERGENCE
+
+In Fig. 4.2, we demonstrated that all mass-covering objectives perform similarly in terms of accuracy and runtime on the problems we considered. We here give technical recommendations for choosing a variational objective:
+
+(i) Closed-form posterior: The variational posterior provides a closed-form approximation to the posterior, but this is no longer the case when SIR is used. While, in our results, all three approaches performed similarly with SIR, they can differ in their performance without it, and the forward KL and the $\alpha$ -divergence provided better approximations than the IW-ELBO. Thus, if one seeks a posterior density that can be evaluated in closed-form, our results suggest to use the forward KL or the $\alpha$ -divergence.
+(ii) Dimensionality of the parameter space: We use an autoregressive normalizing flow as variational family. These flows are very expressive, yet the computation time of their forward or backward passes scale with the dimensionality of $\theta$ (Papamakarios et al., 2017; Kingma et al., 2016; Durkan et al., 2019a). The IW-ELBO and the $\alpha$ -divergences only require forward passes, whereas the forward KL requires forward and backward passes, thus making the forward KL expensive for high-dimensional parameter spaces. The STL estimator used in the IW-ELBO and the $\alpha$ -divergences also requires forward and backward passes. We found that the STL estimator improves performance of the IW-ELBO only weakly (Fig. 11). Thus, in cases where computational cost is critical, our results suggest that using the IW-ELBO without the STL can give high accuracy at low computational cost. Another way to reduce computational cost is to use alternative architectures for the normalizing flow, e.g. coupling layers (Durkan et al., 2019a; Papamakarios et al., 2021).
+(iii) Trading-off the mass-covering property with computational cost: For $\alpha$ -divergences, one can trade-off the extent to which the divergence is mass-covering by choosing the value of $\alpha$ (low $\alpha$ is more mass-covering). As shown in Fig. 11, high values of $\alpha$ benefit less from using the STL estimator. Thus, in cases where mass-covering behavior of the algorithm is less crucial, the STL estimator can be waived, leading to lower computational cost because the normalizing flow requires only forward passes (see point (ii)).
+
+
+Figure 5: A Left: Gradient estimation on the Gaussian example. For values of $\mu$ around $\mu^{*} = 4 / 5$ , all estimators provide good gradients. As $\mu$ is farther from $\mu^{*}$ , the forward variational bound (fVB) (grey) vanishes, whereas the self-normalized fVB approaches a constant. Right: SNR for the fVB and the self-normalized fVB. B Theoretical and empirical densities $p_{R}(r)$ for $\mu = 6$ and $\mu = 12$ .
+
+
+
+# A.3 OVERCOMING VANISHING GRADIENTS IN THE FORWARD KL ESTIMATOR
+
+We use an estimator of the forward Kullback-Leibler divergence (fKL) that is based on self-normalized importance sampling. In this section, we demonstrate that this estimator moves the variational distribution $q_{\phi}(\pmb{\theta})$ towards the target density $p(\pmb{x}_o, \pmb{\theta})$ even if $q_{\phi}(\pmb{\theta})$ and $p(\pmb{x}_o, \pmb{\theta})$ differ strongly.
+
+For this analysis, we consider a Gaussian toy example with prior $p(\pmb{\theta}) = \mathcal{N}(\pmb{\theta}; 0, 4)$ , likelihood $p(\pmb{x}|\pmb{\theta}) = \mathcal{N}(\pmb{x}; \pmb{\theta}, 1)$ , and observation $\pmb{x}_o = 1$ . The posterior distribution can be computed in closed-form as $p(\pmb{\theta}|\pmb{x}_o) = \mathcal{N}(\pmb{\theta}; 4/5, 4/5)$ . We aim to learn the posterior distribution using variational inference with the variational family $q_{\mu}(\pmb{\theta}) = \mathcal{N}(\mu, 4/5)$ (note that $\mu$ is the only parameter). The best approximation within this family is $\mu^* = 4/5$ .
+
+We use this toy example to compare the gradient and the signal-to-noise ratio (SNR) of the self-normalized fKL estimator to the fKL estimator introduced by Wan et al. (2020). Fig. 5A (left) shows the gradient of the loss for different values of $\mu$ . When $\mu \approx \mu^{*} = 4/5$ , the fKL (gray) without self-normalization closely matches the true gradient (red). However, as $\mu$ is further from $\mu^{*}$ , the fKL first points in the wrong direction and then vanishes, which prevents learning. The self-normalized fKL (blue, orange, green) closely matches the gradient around $\mu \approx \mu^{*} = 4/5$ and does not vanish for $\mu$ that are far from $\mu^{*}$ . The gradient is stronger if more samples $N$ are used to approximate the fKL. Similarly, the $\mathrm{SNR}(\nabla_{\phi}\mathcal{L}(\phi)) = |\mathbb{E}[\nabla_{\phi}\mathcal{L}(\phi)] / \sqrt{\mathrm{Var}(\nabla_{\phi}\mathcal{L}(\phi))}|$ does not vanish for $\mu$ that are far from $\mu^{*}$ for the self-normalized fKL.
+
+To understand this behaviour of the self-normalized fKL, we computed an approximation to the gradient $\nabla_{\mu}\mathcal{L}_{\mathrm{fKL}}(\mu)$ in this toy example. The fKL loss is given as:
+
+$$
+\nabla_ {\mu} \mathcal {L} _ {\mathrm {f K L}} (\mu) = - \mathbb {E} _ {\pmb {\theta} \sim q _ {\phi}} \left[ \frac {w (\pmb {\theta})}{\sum_ {i = 1} ^ {N} w (\pmb {\theta})} \nabla_ {\mu} \log q _ {\mu} (\pmb {\theta}) \right] \approx - \sum_ {i = 1} ^ {N} \frac {w (\pmb {\theta} _ {i})}{\sum_ {i = 1} ^ {N} w (\pmb {\theta} _ {i})} \nabla_ {\mu} \log q _ {\mu} (\pmb {\theta} _ {i})
+$$
+
+with weights $w(\pmb{\theta}_i) = \frac{p(\pmb{x}_o, \pmb{\theta})}{q_\phi(\pmb{\theta})}$ . In the case where $q_{\phi}(\pmb{\theta})$ differs strongly from $p(\pmb{x}_o, \pmb{\theta})$ , the weights are often degenerate, i.e. the strongest weight is much larger than all others. In the worst case, $\tilde{w}(\pmb{\theta}_i) = \frac{w(\pmb{\theta}_i)}{\sum_{i=1}^N w(\pmb{\theta}_i)} = 1$ for some $i$ and the gradient estimator reduces to
+
+$$
+\nabla_ {\mu} \mathcal {L} _ {\mathrm {f K L}} (\mu) = - \nabla_ {\mu} \log q _ {\mu} (\underset {\boldsymbol {\theta} _ {1}, \ldots , \boldsymbol {\theta} _ {N}} {\arg \max } w (\boldsymbol {\theta})) = - \nabla_ {\mu} \log q _ {\mu} (r)
+$$
+
+The gradient of $\mu$ is thus determined by $r = \arg \max_{\theta_1,\dots,\theta_N}w(\pmb {\theta})$ , which itself can be considered a draw from a random variable $R$ . We will now derive the probability density $p_R(r)$ of $R$ .
+
+Algorithm 2: SIR
+1 Input: $K$ the number of importance samples, proposal $q_{\phi}$ , joint density $p(\boldsymbol{x}_o,\boldsymbol{\theta}) = \ell_\psi (\boldsymbol{x}_o|\boldsymbol {\theta})p(\boldsymbol {\theta})$
+2 for $i\in [1,\dots ,K]$ do
+3 $\begin{array}{l}\pmb {\theta}_i\sim q_\phi (\pmb {\theta})\\ w_i = \frac{p(\pmb{x}_o,\pmb{\theta}_i)}{q_\phi(\pmb{\theta}_i)} \end{array}$
+4 end
+6 Each $\tilde{w}_i = w_i / \sum_{k = 1}^K w_k$
+7 $j\sim$ Categorical $(\tilde{w})$
+8 return $\pmb{\theta}_{j}$
+
+If $\mu >\mu^{*}$ , then $w(\pmb {\theta})$ is monotonically decreasing in $\pmb{\theta}$ because $w(\pmb {\theta})\propto \frac{\mathcal{N}(\pmb{\theta};\mu^{*},4 / 5)}{\mathcal{N}(\pmb{\theta};\mu,4 / 5)}\propto \exp (5 / 4\cdot \pmb {\theta}(\mu^{*} - \mu))$ . The cumulative distribution function $F_{R}(R\leq r)$ can then be written as
+
+$$
+\begin{array}{l} F_{R}(R\leq r) = P(\underset {\boldsymbol{\theta}_{1},\ldots ,\boldsymbol{\theta}_{n}}{\arg \max}w(\boldsymbol {\theta})\leq r) = P(\min (\boldsymbol{\theta}_{1},\ldots ,\boldsymbol{\theta}_{n})\leq r) \\ = 1 - P \left(\min \left(\boldsymbol {\theta} _ {1}, \dots , \boldsymbol {\theta} _ {n}\right) > r\right) = 1 - \prod_ {i = 1} ^ {N} P \left(\boldsymbol {\theta} _ {i} > r\right) \\ = 1 - \left(1 - F _ {q _ {\phi}} (r)\right) ^ {N} \\ \end{array}
+$$
+
+Thus, $R$ has the density $p_{R}(r) = \frac{d}{dr} F(R\leq r) = N(1 - F_{q_{\phi}}(r))^{N - 1}q_{\mu}(r)$ . The derivation is analogous for the case $\mu < \mu^{*}$ . Because $\nabla_{\mu}\mathcal{L}_{\mathrm{fKL}}(\mu) = \nabla_{\mu}\log q_{\mu}(r)$ for $r\sim p_R$ , this allows us to compute the distribution of the gradient of $\mu$ (under the assumption that weights are degenerate).
+
+We empirically validate this result on the Gaussian toy example. Fig. 5B (left) shows the true posterior distribution (black), the variational density $q_{\mu}(\pmb{\theta})$ for $\mu = 6$ and $\mu = 10$ and the corresponding $p_R(r)$ for $N = 1000$ . The theoretically computed density $p_R(r)$ (dashed lines) matches the empirically observed distribution of $\arg \max_{\pmb{\theta}_{i} = 1\dots N} w(\pmb{\theta}_{i})$ . For almost every value of $r \sim p_R(r)$ , the gradient $\nabla_{\mu} \log q_{\mu}(r)$ is negative, thus driving $\nabla_{\mu} \mathcal{L}_{\mathrm{fKL}}(\mu)$ into the correct direction. For larger $N$ , the distribution $p_R(r)$ shifts towards the true posterior distribution and thus also the gradient signal increases.
+
+Notably, for $\mu$ that are even further from $\mu^{*}$ , $\nabla_{\mu} \log q_{\mu}(r)$ remains relatively constant (Fig. 5B, right). This explains why the gradient $\nabla_{\mu} \mathcal{L}_{\mathrm{fKL}}(\mu)$ becomes constant in Fig. 5A (left).
+
+# A.4 IMPROVEMENT THROUGH SIR
+
+We use Sampling Importance Resampling (SIR) to refine samples obtained from the variational posterior. The SIR procedure is detailed in Alg. 2 for drawing a single sample from the posterior. Consistent with Agrawal et al. (2020), we found that using SIR always helps to improve the approximation quality even when using complex variational families such as normalizing flows (compare dotted and solid lines in Fig. 3).
+
+We visualize the benefits of SIR in Fig. 6 on an example which uses a Gaussian proposal distribution (i.e. variational family). SIR enhances the variational family and allows to approximate the bimodal target distribution. SIR particularly improves the posterior estimate when the proposal (i.e. the variational posterior) is overdispersed. This provides an explanation for why SIR is particularly useful for the mass-covering divergences used in SNVI, and less so for mode-covering divergences (as used in SNPLA).
+
+# A.5 QUALITY OF THE LIKELIHOOD ESTIMATOR
+
+The estimated variational posterior is based on the estimated likelihood $\ell(\pmb{x}_o|\pmb{\theta})$ . It is thus important to accurately learn the likelihood from simulations. To be able to learn skewed or bimodal likelihoods, we use a conditional autoregressive normalizing flow for $\ell(\pmb{x}|\pmb{\theta})$ (Papamakarios et al., 2017; Kingma et al., 2016; Durkan et al., 2019a). Fig. 7 demonstrates that these flows can learn complex likelihoods (Papamakarios et al., 2019).
+
+
+Figure 6: Visualization of SIR. A Toy example with a Gaussian proposal density. Left: Two toy examples with a Gaussian (top) or bimodal (bottom) target density. SIR (with $K = 32$ ) can extend the Gaussian density and refine the approximation if the proposal is overdispersed (middle), but helps less when it is too narrow (right). B SIR improvements on two moons example. We plot the joint density as learned by the likelihood-model $p(\pmb{x}_o, \pmb{\theta}) = \ell_{\psi}(\pmb{x}_o | \pmb{\theta}) p(\pmb{\theta})$ against the variational posterior $q_{\phi}$ (blue, obtained with the fKL), as well as the SIR-corrected density with $K = 2$ (orange) and $K = 32$ (green). Despite using an expressive normalizing flow as $q_{\phi}$ , SIR improves the accuracy.
+
+
+
+
+
+
+
+
+
+
+
+
+Figure 7: A neural spline flow (NSF) estimating a bimodal likelihood with $10^{4}$ simulations with prior $\mathcal{N}(0,2)$ . Top: Ground truth. Bottom: Likelihood-approximation with NSF. The learned likelihood closely matches the true likelihood.
+
+
+
+# A.6 PROOFS FOR EXCLUDING INVALID DATA
+
+Many simulators can produce unreasonable or undefined values when fed with parameters sampled from the prior (Lueckmann et al., 2017). These invalid simulations are not useful for accurately learning the likelihood, and we would like to ignore them. To do so, we developed a loss-reweighing strategy.
+
+Algorithm 3: SNVI with calibration kernel
+1 Inputs: prior $p(\theta)$ , observation $x_o$ , divergence $D$ , simulations per round $N$ , number of rounds $R$ , selection strategy $S$ and calibration kernel $K$ .
+2 Outputs: Approximate likelihood $\ell_{\psi}$ , variational posterior $q_{\phi}$ and calibration network $c_{\zeta}$ .
+3 Initialize: Proposal $\tilde{p}(\theta) = p(\theta)$ , simulation dataset $\mathcal{X} = \{\}$ , calibration dataset $C = \{\}$
+4 for $r \in [1, \dots, R]$ do
+5 for $i \in [1, \dots, N]$ do
+6 $\theta_i = S(\tilde{p}, \ell_{\phi}, p)$ ; // sample $\theta_i \sim \tilde{p}(\theta)$
+7 simulate $x_i \sim p(x|\theta_i)$ ; // run the simulator on $\theta_i$
+8 add $(\theta_i, K(x_i, x_o))$ to $C$
+9 if $K(x, x_o) > 0$ then
+10 | add $(\theta_i, x_i)$ to $X$
+11 end
+12 end
+13 (re-)train $\ell_{\psi}$ ; $\psi^* = \arg \min_{\psi} -\frac{1}{N}\sum_{(x_i,\theta_i)\in X}K(x_i,x_o)\log\ell_{\psi}(x_i|\theta_i)$ ; // or SNRE
+14 (re-)train $c_{\zeta}$ ; $\xi^* = \arg \min_{\xi}\frac{1}{N}\sum_{(\theta_i,K(x_i,x_o))\in\mathcal{C}}\mathcal{L}(c_{\zeta}(\theta_i),K(x_i,x_o))$ ; // MSE or cross-entropy for binary calibration kernel
+15 (re-)train $q_{\phi}$ ; $\phi^* = \arg \min_{\phi}D(q_{\phi}(\theta)||p(\theta|x_o))$ with
+16 $p(\theta|x_o) \propto p(x_o|\theta)p(\theta) \approx \ell_{\psi^*}(x_o|\theta)c_{\xi^*}(\theta)p(\theta)$
+17 end
+
+We formulate the exclusion of invalid simulations by the means of a calibration kernel $K(\pmb{x}, \pmb{x}_o)$ (originally introduced for neural posterior estimation in Lueckmann et al. (2017)). This calibration kernel can be any function, and can thus be used beyond excluding invalid data. The case of excluding invalid simulations can be recovered by using a binary calibration kernel:
+
+$$
+K \left(\boldsymbol {x}, \boldsymbol {x} _ {o}\right) = \left\{ \begin{array}{l l} 0 & \text {i f} \boldsymbol {x} \text {i n v a l i d} \\ 1 & \text {i f} \boldsymbol {x} \text {v a l i d} \end{array} \right. \tag {1}
+$$
+
+Alg. 3 shows SNVI with calibration kernel. Notice that, in the case of a binary calibration kernel, the loss for the likelihood $\ell_{\psi}$ ; $\psi^{*} = \arg \min_{\psi} - \frac{1}{N}\sum_{(\boldsymbol{x}_{i},\boldsymbol{\theta}_{i})\in \mathcal{X}}K(\boldsymbol{x}_{i},\boldsymbol{x}_{o})\log \ell_{\psi}(\boldsymbol{x}_{i}|\boldsymbol{\theta}_{i})$ is zero for all invalid simulations (because $K(\boldsymbol{x},\boldsymbol{x}_o) = 0$ ). Thus, since these simulations do not contribute to the loss, we exclude these simulations from the dataset that is used to train the likelihood(-ratio) model.
+
+Below, we provide proofs of convergence for Alg. 3. Theorem 1 and Lemma 1 are relevant to SNLVI, Theorem 2 and Lemma 2 are relevant to SNRVI, and Lemma 3 is relevant to both methods. Theorem 1 and Theorem 2 provide a means to use a calibration kernel in the training of the likelihood(ratio)-model such that one can still recover the posterior density. In SNVI, we sample from the (unnormized) potential function with variational inference. However, one can also use Theorem 1 and Theorem 2 in combination with SNLE and SNRE and draw samples from the potential function with MCMC.
+
+Both SNLVI and SNRVI with calibration kernels rely on the estimation of $\mathbb{E}_{\boldsymbol{x} \sim p(\boldsymbol{x}|\boldsymbol{\theta})}[K(\boldsymbol{x}, \boldsymbol{x}_o)]$ (note that this turns into $p(\mathrm{valid}|\boldsymbol{\theta})$ for the binary calibration kernel). We estimate this term with a feed-forward regression neural network $c_{\zeta}(\boldsymbol{\theta})$ (see Lemma 3). The network is trained on pairs $(\boldsymbol{\theta}, K(\boldsymbol{x}, \boldsymbol{x}_o))$ , where $\boldsymbol{\theta}$ and $\boldsymbol{x}$ are the same pairs as used for training the likelihood(-ratio)-model. For general calibration kernels $K(\boldsymbol{x}, \boldsymbol{x}_o)$ , we use a mean-squared error loss, whereas in the case of invalid data, we parameterize $c_{\zeta}(\boldsymbol{\theta})$ as a logistic regression network and train it with a cross-entropy loss (since the calibration kernel $K(\boldsymbol{x}, \boldsymbol{x}_o)$ is a binary function: 0 for invalid data, 1 for valid data).
+
+Theorem 1. Let $K: \mathcal{X} \times \mathcal{X} \to \mathbb{R}^+$ be a kernel. Let $\ell_{\psi^*}(\pmb{x}|\pmb{\theta})$ be the maximizer of the objective
+
+$$
+\mathcal {L} = \mathbb {E} _ {\boldsymbol {\theta}, \boldsymbol {x} \sim \tilde {p} (\boldsymbol {\theta}, \boldsymbol {x})} [ K (\boldsymbol {x}, \boldsymbol {x} _ {o}) \log (\ell_ {\psi} (\boldsymbol {x} | \boldsymbol {\theta})) ]
+$$
+
+and let $c_{\zeta^{*}}(\pmb {\theta})$ be the minimizer of
+
+$$
+\mathcal {L} = \mathbb {E} _ {\boldsymbol {\theta}, \boldsymbol {x} \sim \tilde {p} (\boldsymbol {\theta}, \boldsymbol {x})} \left[ \left(c _ {\zeta} (\boldsymbol {\theta}) - K \left(\boldsymbol {x}, \boldsymbol {x} _ {o}\right)\right) ^ {2} \right]
+$$
+
+Then the potential function
+
+$$
+\mathcal {P} (\boldsymbol {\theta}) = \ell_ {\psi^ {*}} \left(\boldsymbol {x} _ {o} | \boldsymbol {\theta}\right) p (\boldsymbol {\theta}) c _ {\zeta^ {*}} (\boldsymbol {\theta})
+$$
+
+is proportional to the posterior density $p(\pmb{\theta}|\pmb{x}_o)$ .
+
+Proof. Using Lemma 1 and Lemma 3, we get
+
+$$
+\begin{array}{l} \mathcal {P} (\boldsymbol {\theta}) = \ell_ {\psi^ {*}} \left(\boldsymbol {x} _ {o} | \boldsymbol {\theta}\right) p (\boldsymbol {\theta}) c _ {\zeta^ {*}} (\boldsymbol {\theta}) \\ = \frac {K (\boldsymbol {x} , \boldsymbol {x} _ {o}) p (\boldsymbol {x} _ {o} | \boldsymbol {\theta})}{\mathbb {E} _ {\boldsymbol {x} \sim p (\boldsymbol {x} | \boldsymbol {\theta})} [ K (\boldsymbol {x} , \boldsymbol {x} _ {o}) ]} p (\boldsymbol {\theta}) \mathbb {E} _ {\boldsymbol {x} \sim p (\boldsymbol {x} | \boldsymbol {\theta})} [ K (\boldsymbol {x}, \boldsymbol {x} _ {o}) ] \\ = K (\boldsymbol {x}, \boldsymbol {x} _ {o}) p (\boldsymbol {x} _ {o} | \boldsymbol {\theta}) p (\boldsymbol {\theta}) \\ \propto p (\boldsymbol {\theta} \mid \boldsymbol {x} _ {o}) \\ \end{array}
+$$
+
+
+
+Theorem 2. Let $K:\mathcal{X}\times \mathcal{X}\to \mathbb{R}^{+}$ be a kernel. Let $\ell_{\psi^*}(\pmb {x},\pmb {\theta})$ be the minimizer of the objective
+
+$$
+\mathcal {L} = \mathbb {E} _ {\boldsymbol {\theta}, \boldsymbol {x} \sim \tilde {p} (\boldsymbol {\theta}, \boldsymbol {x})} [ K (\boldsymbol {x}, \boldsymbol {x} _ {o}) \log (\ell_ {\psi^ {*}} (\boldsymbol {x}, \boldsymbol {\theta})) ] + \mathbb {E} _ {\boldsymbol {\theta}, \boldsymbol {x} \sim p (\boldsymbol {\theta}) p (\boldsymbol {x})} [ K (\boldsymbol {x}, \boldsymbol {x} _ {o}) \log (1 - \ell_ {\psi^ {*}} (\boldsymbol {x}, \boldsymbol {\theta})) ]
+$$
+
+and let $c_{\zeta^{*}}(\pmb {\theta})$ be the minimizer of
+
+$$
+\mathcal {L} = \mathbb {E} _ {\boldsymbol {\theta}, \boldsymbol {x} \sim \tilde {p} (\boldsymbol {\theta}, \boldsymbol {x})} \left[ \left(c _ {\zeta} (\boldsymbol {\theta}) - K \left(\boldsymbol {x}, \boldsymbol {x} _ {o}\right)\right) ^ {2} \right]
+$$
+
+Then the potential function
+
+$$
+\mathcal {P} (\boldsymbol {\theta}) = \ell_ {\psi^ {*}} (\boldsymbol {x} _ {o}, \boldsymbol {\theta}) p (\boldsymbol {\theta}) c _ {\zeta^ {*}} (\boldsymbol {\theta})
+$$
+
+is proportional to the posterior density $p(\boldsymbol{\theta}|\boldsymbol{x}_o)$ .
+
+Proof. Using Lemma 2 and Lemma 3, we get
+
+$$
+\begin{array}{l} \mathcal {P} (\boldsymbol {\theta}) = \ell_ {\psi^ {*}} \left(\boldsymbol {x} _ {o}, \boldsymbol {\theta}\right) p (\boldsymbol {\theta}) c _ {\zeta^ {*}} (\boldsymbol {\theta}) \\ = \frac {\mathbb {E} _ {\boldsymbol {x} \sim p (\boldsymbol {x})} [ K (\boldsymbol {x} , \boldsymbol {x} _ {o}) ]}{\mathbb {E} _ {\boldsymbol {x} \sim p (\boldsymbol {x} | \boldsymbol {\theta})} [ K (\boldsymbol {x} , \boldsymbol {x} _ {o}) ]} \frac {p (\boldsymbol {x} _ {o} | \boldsymbol {\theta})}{p (\boldsymbol {x} _ {o})} p (\boldsymbol {\theta}) \mathbb {E} _ {\boldsymbol {x} \sim p (\boldsymbol {x} | \boldsymbol {\theta})} [ K (\boldsymbol {x}, \boldsymbol {x} _ {o}) ] \\ = \mathbb {E} _ {\boldsymbol {x} \sim p (\boldsymbol {x})} [ K (\boldsymbol {x}, \boldsymbol {x} _ {o}) ] \frac {p (\boldsymbol {x} _ {o} | \boldsymbol {\theta})}{p (\boldsymbol {x} _ {o})} p (\boldsymbol {\theta}) \\ \propto p (\boldsymbol {\theta} | \boldsymbol {x} _ {o}) \\ \end{array}
+$$
+
+
+
+Lemma 1. Let $K: \mathcal{X} \times \mathcal{X} \to \mathbb{R}^+$ be an arbitrary kernel. Then, the objective
+
+$$
+\mathcal {L} = \mathbb {E} _ {\boldsymbol {\theta}, \boldsymbol {x} \sim \tilde {p} (\boldsymbol {\theta}, \boldsymbol {x})} [ K (\boldsymbol {x}, \boldsymbol {x} _ {o}) \log (\ell_ {\psi} (\boldsymbol {x} | \boldsymbol {\theta})) ]
+$$
+
+is maximized if and only if $\ell_{\psi}(\pmb{x}|\pmb{\theta}) = \frac{1}{Z(\pmb{\theta})} K(\pmb{x},\pmb{x}_o)p(\pmb{x}|\pmb{\theta})$ for all $\pmb{\theta} \in \text{support}(\tilde{p}(\pmb{\theta}))$ , with normalizing constant $Z(\pmb{\theta}) = \int K(\pmb{x},\pmb{x}_o)p(\pmb{x}|\pmb{\theta})d\pmb{x} = \mathbb{E}_{\pmb{x} \sim p(\pmb{x}|\pmb{\theta})}[K(\pmb{x},\pmb{x}_o)]$ .
+
+Proof.
+
+$$
+\begin{array}{l} \mathcal {L} = \mathbb {E} _ {\boldsymbol {\theta}, \boldsymbol {x} \sim \tilde {p} (\boldsymbol {\theta}, \boldsymbol {x})} [ K (\boldsymbol {x}, \boldsymbol {x} _ {o}) \log (\ell_ {\psi} (\boldsymbol {x} | \boldsymbol {\theta})) ] \\ = \iint K (\boldsymbol {x}, \boldsymbol {x} _ {o}) \tilde {p} (\boldsymbol {\theta}, \boldsymbol {x}) \log \left(\ell_ {\psi} (\boldsymbol {x} | \boldsymbol {\theta})\right) d \boldsymbol {x} d \boldsymbol {\theta} \\ = \iint K (\boldsymbol {x}, \boldsymbol {x} _ {o}) \tilde {p} (\boldsymbol {\theta}) p (\boldsymbol {x} | \boldsymbol {\theta}) \log \left(\ell_ {\psi} (\boldsymbol {x} | \boldsymbol {\theta})\right) d \boldsymbol {x} d \boldsymbol {\theta} \\ = \int \tilde {p} (\boldsymbol {\theta}) \int K (\boldsymbol {x}, \boldsymbol {x} _ {o}) p (\boldsymbol {x} | \boldsymbol {\theta}) \log \left(\ell_ {\psi} (\boldsymbol {x} | \boldsymbol {\theta})\right) d \boldsymbol {x} d \boldsymbol {\theta} \\ \end{array}
+$$
+
+Since $\int K(\pmb{x},\pmb{x}_o)p(\pmb{x}|\pmb{\theta})\log (\ell_{\psi}(\pmb{x}|\pmb{\theta}))d\pmb{x}\propto -D_{\mathrm{KL}}(\frac{1}{Z(\pmb{\theta})} K(\pmb{x},\pmb{x}_o)p(\pmb{x}|\pmb{\theta}),\ell_{\psi}(\pmb{x}|\pmb{\theta}))$ , this term is maximized if and only if $\ell_{\psi}(\pmb {x}|\pmb {\theta}) = \frac{1}{Z(\pmb{\theta})} K(\pmb {x},\pmb{x}_o)p(\pmb {x}|\pmb {\theta})$ for all $\pmb {\theta}\in \operatorname {supp}(p(\pmb {\theta}))$ with $Z(\pmb {\theta}) =$ $\int K(\pmb {x},\pmb {x}_o)p(\pmb {x}|\pmb {\theta})d\pmb {x} = \mathbb{E}_{\pmb{x}\sim p(\pmb {x}|\pmb {\theta})}[K(\pmb {x},\pmb {x}_o)]$
+
+Lemma 2. Let $K: \mathcal{X} \times \mathcal{X} \to \mathbb{R}^+$ be an arbitrary kernel. Then, the objective
+
+$$
+\mathcal {L} = \mathbb {E} _ {\boldsymbol {\theta}, \boldsymbol {x} \sim \tilde {p} (\boldsymbol {\theta}, \boldsymbol {x})} \left[ K (\boldsymbol {x}, \boldsymbol {x} _ {o}) \log (\ell_ {\psi^ {*}} (\boldsymbol {x}, \boldsymbol {\theta})) \right] + \mathbb {E} _ {\boldsymbol {\theta}, \boldsymbol {x} \sim \tilde {p} (\boldsymbol {\theta}) p (\boldsymbol {x})} \left[ K (\boldsymbol {x}, \boldsymbol {x} _ {o}) \log (1 - \ell_ {\psi^ {*}} (\boldsymbol {x}, \boldsymbol {\theta})) \right]
+$$
+
+is minimized if and only if $\ell_{\psi}(\pmb{x},\pmb{\theta}) = \frac{\mathbb{E}_{\pmb{x}\sim p(\pmb{x})}[K(\pmb{x},\pmb{x}_o)]}{\mathbb{E}_{\pmb{x}\sim p(\pmb{x}|\pmb{\theta})}[K(\pmb{x},\pmb{x}_o)]}\frac{p(\pmb{x}|\pmb{\theta})}{p(\pmb{x})}$ for all $\pmb{\theta} \in \text{support}(\tilde{p}(\pmb{\theta}))$ .
+
+Proof. We begin by rearranging the expectations:
+
+$$
+\begin{array}{l} \mathcal {L} = \mathbb {E} _ {\boldsymbol {\theta}, \boldsymbol {x} \sim \tilde {p} (\boldsymbol {\theta}, \boldsymbol {x})} [ K (\boldsymbol {x}, \boldsymbol {x} _ {o}) \log (\ell_ {\psi^ {*}} (\boldsymbol {x}, \boldsymbol {\theta})) ] + \mathbb {E} _ {\boldsymbol {\theta}, \boldsymbol {x} \sim \tilde {p} (\boldsymbol {\theta}) \tilde {p} (\boldsymbol {x})} [ K (\boldsymbol {x}, \boldsymbol {x} _ {o}) \log (1 - \ell_ {\psi^ {*}} (\boldsymbol {x}, \boldsymbol {\theta})) ] \\ = \iint \tilde {p} (\boldsymbol {\theta}, \boldsymbol {x}) K (\boldsymbol {x}, \boldsymbol {x} _ {o}) \log \left(\ell_ {\psi^ {*}} (\boldsymbol {x}, \boldsymbol {\theta})\right) d \boldsymbol {\theta} d \boldsymbol {x} + \\ \iint \tilde {p} (\boldsymbol {\theta}) \tilde {p} (\boldsymbol {x}) K (\boldsymbol {x}, \boldsymbol {x} _ {o}) \log (1 - \ell_ {\psi^ {*}} (\boldsymbol {x}, \boldsymbol {\theta})) d \boldsymbol {\theta} d \boldsymbol {x} \\ = \iint \frac {\tilde {p} (\boldsymbol {\theta} , \boldsymbol {x}) K (\boldsymbol {x} , \boldsymbol {x} _ {o})}{\iint \tilde {p} (\boldsymbol {\theta} , \boldsymbol {x}) K (\boldsymbol {x} , \boldsymbol {x} _ {o}) d \boldsymbol {\theta} d \boldsymbol {x}} \log \left(\ell_ {\psi^ {*}} (\boldsymbol {x}, \boldsymbol {\theta})\right) d \boldsymbol {\theta} d \boldsymbol {x} + \\ \iint \frac {\tilde {p} (\boldsymbol {\theta}) \tilde {p} (\boldsymbol {x}) K (\boldsymbol {x} , \boldsymbol {x} _ {o})}{\iint \tilde {p} (\boldsymbol {\theta}) \tilde {p} (\boldsymbol {x}) K (\boldsymbol {x} , \boldsymbol {x} _ {o}) d \boldsymbol {\theta} d \boldsymbol {x}} \log (1 - \ell_ {\psi^ {*}} (\boldsymbol {x}, \boldsymbol {\theta})) d \boldsymbol {\theta} d \boldsymbol {x} \\ = \mathbb {E} _ {\boldsymbol {\theta}, \boldsymbol {x} \sim \pi_ {\text {j o i n t}} (\boldsymbol {\theta}, \boldsymbol {x})} \left[ \log \left(\ell_ {\psi^ {*}} (\boldsymbol {x}, \boldsymbol {\theta})\right) \right] + \mathbb {E} _ {\boldsymbol {\theta}, \boldsymbol {x} \sim \pi_ {\text {m a r g i n a l}} (\boldsymbol {\theta}, \boldsymbol {x})} \left[ \log \left(1 - \ell_ {\psi^ {*}} (\boldsymbol {x}, \boldsymbol {\theta})\right) \right] \\ \end{array}
+$$
+
+where we introduced
+
+$$
+\pi_ {\text {j o i n t}} (\boldsymbol {\theta}, \boldsymbol {x}) = \frac {\tilde {p} (\boldsymbol {\theta} , \boldsymbol {x}) K (\boldsymbol {x} , \boldsymbol {x} _ {o})}{\iint \tilde {p} (\boldsymbol {\theta} , \boldsymbol {x}) K (\boldsymbol {x} , \boldsymbol {x} _ {o}) d \boldsymbol {\theta} d \boldsymbol {x}} \quad \pi_ {\text {m a r g i n a l}} (\boldsymbol {\theta}, \boldsymbol {x}) = \frac {\tilde {p} (\boldsymbol {\theta}) \tilde {p} (\boldsymbol {x}) K (\boldsymbol {x} , \boldsymbol {x} _ {o})}{\iint \tilde {p} (\boldsymbol {\theta}) \tilde {p} (\boldsymbol {x}) K (\boldsymbol {x} , \boldsymbol {x} _ {o})}
+$$
+
+Since binary classification recovers density ratios (Cranmer et al., 2015; Mohamed & Lakshminarayanan, 2016; Gutmann et al., 2018), we get
+
+$$
+\begin{array}{l} \ell_ {\psi *} (\boldsymbol {x}, \boldsymbol {\theta}) = \frac {\pi_ {\text {j o i n t}} (\boldsymbol {\theta} , \boldsymbol {x})}{\pi_ {\text {m a r g i n a l}} (\boldsymbol {\theta} , \boldsymbol {x})} \\ = \frac {\frac {1}{\iint \tilde {p} (\boldsymbol {\theta} , \boldsymbol {x}) K (\boldsymbol {x} , \boldsymbol {x} _ {o}) d \boldsymbol {\theta} d \boldsymbol {x}} \tilde {p} (\boldsymbol {\theta} , \boldsymbol {x}) K (\boldsymbol {x} , \boldsymbol {x} _ {o})}{\frac {1}{\iint \tilde {p} (\boldsymbol {\theta}) p (\boldsymbol {x}) K (\boldsymbol {x} , \boldsymbol {x} _ {o}) d \boldsymbol {\theta} d \boldsymbol {x}} \tilde {p} (\boldsymbol {\theta}) \tilde {p} (\boldsymbol {x}) K (\boldsymbol {x} , \boldsymbol {x} _ {o})} \\ = \frac {\iint \tilde {p} (\boldsymbol {\theta}) \tilde {p} (\boldsymbol {x}) K (\boldsymbol {x} , \boldsymbol {x} _ {o}) d \boldsymbol {\theta} d \boldsymbol {x}}{\iint \tilde {p} (\boldsymbol {\theta}) p (\boldsymbol {x} | \boldsymbol {\theta}) K (\boldsymbol {x} , \boldsymbol {x} _ {o}) d \boldsymbol {\theta} d \boldsymbol {x}} \frac {p (\boldsymbol {x} | \boldsymbol {\theta})}{\tilde {p} (\boldsymbol {x})} \\ = \frac {\int \tilde {p} (\boldsymbol {x}) K (\boldsymbol {x} , \boldsymbol {x} _ {o}) \int \tilde {p} (\boldsymbol {\theta}) d \boldsymbol {\theta} d \boldsymbol {x}}{\int p (\boldsymbol {x} | \boldsymbol {\theta}) K (\boldsymbol {x} , \boldsymbol {x} _ {o}) \int \tilde {p} (\boldsymbol {\theta}) d \boldsymbol {\theta} d \boldsymbol {x}} \frac {p (\boldsymbol {x} | \boldsymbol {\theta})}{\tilde {p} (\boldsymbol {x})} \\ = \frac {\mathbb {E} _ {\boldsymbol {x} \sim \tilde {p} (\boldsymbol {x})} [ K (\boldsymbol {x} , \boldsymbol {x} _ {o}) ]}{\mathbb {E} _ {\boldsymbol {x} \sim p (\boldsymbol {x} | \boldsymbol {\theta})} [ K (\boldsymbol {x} , \boldsymbol {x} _ {o}) ]} \frac {p (\boldsymbol {x} | \boldsymbol {\theta})}{\tilde {p} (\boldsymbol {x})} \\ \end{array}
+$$
+
+Lemma 3. The objective
+
+$$
+\mathcal {L} = \mathbb {E} _ {\boldsymbol {\theta}, \boldsymbol {x} \sim \tilde {p} (\boldsymbol {\theta}, \boldsymbol {x})} [ (c _ {\zeta} (\boldsymbol {\theta}) - K (\boldsymbol {x}, \boldsymbol {x} _ {o})) ^ {2} ]
+$$
+
+is minimized if and only if $c_{\zeta}(\pmb {\theta}) = \mathbb{E}_{\pmb {x}\sim p(\pmb {x}|\pmb {\theta})}[K(\pmb {x},\pmb {x}_o))]$ for all $\pmb {\theta}\in$ support $(\tilde{p} (\pmb {\theta}))$
+
+Proof.
+
+$$
+\begin{array}{l} \mathcal {L} = \mathbb {E} _ {\boldsymbol {\theta}, \boldsymbol {x} \sim \tilde {p} (\boldsymbol {\theta}, \boldsymbol {x})} \left[ \left(c _ {\zeta} (\boldsymbol {\theta}) - K (\boldsymbol {x}, \boldsymbol {x} _ {o})\right) ^ {2} \right] \\ = \iint \tilde {p} (\boldsymbol {\theta}, \boldsymbol {x}) \left(c _ {\zeta} (\boldsymbol {\theta}) - K (\boldsymbol {x}, \boldsymbol {x} _ {o})\right) ^ {2} d \boldsymbol {x} d \boldsymbol {\theta} \\ = \int \tilde {p} (\boldsymbol {\theta}) \int p (\boldsymbol {x} | \boldsymbol {\theta}) \left(c _ {\zeta} (\boldsymbol {\theta}) - K \left(\boldsymbol {x}, \boldsymbol {x} _ {o}\right)\right) ^ {2} d \boldsymbol {x} d \boldsymbol {\theta} \\ = \int \tilde {p} (\boldsymbol {\theta}) \mathbb {E} _ {\boldsymbol {x} \sim p (\boldsymbol {x} | \boldsymbol {\theta})} [ (c _ {\zeta} (\boldsymbol {\theta}) - K (\boldsymbol {x}, \boldsymbol {x} _ {o})) ^ {2} ] d \boldsymbol {\theta} \\ \end{array}
+$$
+
+which is minimized if and only if $c_{\zeta}(\pmb {\theta}) = \mathbb{E}_{\pmb {x}\sim p(\pmb {x}|\pmb {\theta})}[K(\pmb {x},\pmb{x}_o)])$ for all $\pmb {\theta}\in \mathrm{support}(\tilde{p} (\pmb {\theta}))$
+
+
+
+
+Figure 8: Comparison between SNPLA implementation of (Wiqvist et al., 2021) and SNVI with rKL.
+
+# A.7 SNPLA
+
+In Fig. 2 and Fig. 3, we compared SNVI to SNPLA (Wiqvist et al., 2021). To ensure comparability between SNPLA and SNVI, we implemented SNPLA ourselves and used the same likelihood- and posterior-model for both methods. The main difference between our implementation and the original implementation of SNPLA are:
+
+1. We do not use the proposal $\hat{p}_r(\pmb {\theta}) = \alpha p(\pmb {\theta}) + (1 - \alpha)q_\phi (\pmb {\theta})$ for $\alpha \in [0,1]$ , instead we use $\alpha = 0$ , i.e. we use the current posterior estimate as proposal.
+2. Secondly, we use a Rational Linear Spline Flow (RSF) based on pyro (Bingham et al., 2019), whereas Wiqvist et al. (2021) uses a Masked Autoregressive Flow based on nflows (Durkan et al., 2019b).
+
+Fig. 8 compares the performance of our SNPLA implementation to the original implementation. Our implementation performs slightly better, likely due to the use of more expressive normalizing flows. We used our implementation for all experiments and nonetheless refer to the method with the name 'SNPLA'.
+
+# A.8 EXPERIMENTS: BENCHMARK
+
+All tasks were taken from an sbi benchmark (Lueckmann et al., 2021). For a description of the simulators, summary statistics, and prior distributions, we refer the reader to that paper.
+
+We use the SNLE and SNRE as implemented in the sbi package (Tejero-Cantero et al., 2020). In all experiments, we learn the likelihood with a Masked Autoregressive Flow (MAF) with five autoregressive layers each with two hidden layers and 50 hidden units (Tejero-Cantero et al., 2020; Durkan et al., 2019b). For SNRE we use a two block residual network with 50 hidden units. Just as in Lueckmann et al. (2021), we implement SNRE with the loss described in Durkan et al. (2020).
+
+The implementation of the posterior normalizing flows is based on pyro (Bingham et al., 2019), as pyro caches intermediate values during sampling and thus allow cheap density evaluation on obtained samples. We use MAFs for higher dimensional problems and Rational Linear Spline Flows (RSF) for low dimensional but complex problems (SLCP, Two moons). We always use a standard Gaussian base distribution and five autoregressive layers with a hidden size depending on input dimension ([dim·10, dim·10] for spline autoregressive nets and [dim·5+5] for affine autoregressive nets, each with ReLU activations). As the posterior support must match that of the prior, we add a bijective mapping that maps the support to that of the prior. This allows to train the normalizing flows directly on the constrained domain.
+
+We used a total sampling budget of $N = 256$ for any VI loss. To estimate the IW-ELBO we use $N = 32$ to estimate $\mathcal{L}_{IW}^{(K = 8)}(\phi)$ (Rainforth et al., 2018). Additionally, we use the STL estimator (Roeder et al., 2017). An alternatively would be the doubly reparameterized gradient estimator, which is unbiased. We choose the STL estimator as it admits larger SNRs at the cost of introducing some bias (Tucker et al., 2018). Because for $\alpha \rightarrow 0$ we have that $\mathcal{L}_{\alpha}\to \mathcal{L}_{IW}^{(K = 1)}$ we use this
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Figure 9: Samples from the posterior distributions for SNLE with MCMC, SNVI + fKL, SNVI + rKL. First row: results for SLCP. Second row: Lotka-Volterra. Third row: Bernoulli GLM.
+
+
+
+
+
+estimator also to estimate $\mathcal{L}_{\alpha = 0.1}(\phi)$ . While the estimator can also be used for the ELBO, it requires additional computational cost i.e. we additionally need to calculate the inverse transformation, which is costly for autoregressive flows. Note that the fKL estimator also requires the inverse transform, thus we recommend to use a normalizing flow with fast forward and inverse passes in problems with many parameters, e.g. normalizing flows based on coupling layers (Dinh et al., 2017; Durkan et al., 2019a).
+
+We trained for 10 rounds of simulations. In each round, we initialize the likelihood- and the posterior-model as their respective last estimates from the previous round. We train the posterior model for each round for at least 100 iterations and at most 1000 iterations. We evaluate convergence by tracking the decrease within the loss. For this automated benchmark, the convergence criteria are chosen conservative too avoid early stopping. More elaborate convergence criteria may improve runtime.
+
+As metrics, we used classifier 2-sample tests (C2ST). C2ST trains a classifier to distinguish posterior samples produced by a specific method to ground truth posterior samples. Thus, a value of 0.5 means that the distributions are identical, whereas higher values indicate a mismatch between the distributions. As in Lueckmann et al. (2021), we computed the C2ST using 10,000 samples. Each figure shows the average metric value over 10 different observations, as well as the corresponding $95\%$ confidence interval.
+
+
+Figure 10: C2ST benchmark results for SNVI with ratio estimation (SNRVI) for four models, Bernoulli GLM (A), Lotka Volterra (B), Two moons (C) and SLCP (D). Each point represents the average metric value for ten different observations, as well as the confidence intervals. Bars on the right indicate the average runtime. Two reference methods: SNRE with MCMC sampling and the rKL, as well as three variants of SNVI, with forward KL (SNVI+fKL), importance-weighted ELBO (SNVI+IW) and $\alpha$ -divergence (SNVI+ $\alpha$ ). Dotted lines: performance when not using SIR.
+
+Fig. 11 shows results for further variational objectives on the two moons (top) and on the SLCP task (bottom). The self-normalization used for the forward KL estimator improves the approximation quality (11, left, dark vs light purple). For the IW-ELBO (middle) as well as for the $\alpha$ -divergences (right), the STL estimator improves performance (Rainforth et al., 2018). The gains from the STL are stronger for $\alpha$ -divergences as for the IW-ELBO (especially when using SIR). The STL particularly improves the estimate for low values of alpha (which are more support-covering).
+
+# A.9 EXPERIMENTS: INFERENCE IN A NEUROSCIENCE MODEL OF THE PYLORIC NETWORK
+
+We used the same simulator as in Gonçalves et al. (2020); Deistler et al. (2021) and the 15 summary statistics originally described in Prinz et al. (2004) and also used in Gonçalves et al. (2020); Deistler et al. (2021) (notably, Gonçalves et al. (2020); Deistler et al. (2021) used 3 additional features). Below, we describe the simulator briefly, for a full description we refer the reader to Prinz et al. (2004); Gonçalves et al. (2020); Deistler et al. (2021).
+
+The model is composed of three single-compartment neurons, AB/PD, LP, and PY, where the electrically coupled AB and PD neurons are modeled as a single neuron. Each of the model neurons contains 8 currents. In addition, the model contains 7 synapses. As in Prinz et al. (2004), these synapses are simulated using a standard model of synaptic dynamics (Abbott & Marder, 1998).
+
+For each set of membrane and synaptic conductances, we numerically simulate the circuit for 10 seconds with a step size of $0.025\mathrm{ms}$ . At each time step, each neuron receives Gaussian noise with mean zero and standard deviation $0.001\mathrm{mV}\cdot \mathrm{ms}^{-0.5}$ .
+
+We applied SNVI to infer the posterior over 24 membrane parameters and 7 synaptic parameters, i.e. 31 parameters in total. The 7 synaptic parameters are the maximal conductances of all synapses in the circuit, each of which is varied uniformly in logarithmic domain and the membrane parameters
+
+
+Figure 11: Evaluation of further variational objectives for the two moons (top) and the SLCP (bottom) task. Left: Variations of the forward KL (with and without self-normalized weights). Middle: Variations of the IW-ELBO (with and without STL). Right: Variations of the $\alpha$ -divergence (with and without STL as well as for different values of $\alpha$ .
+
+are the maximal membrane conductances for each neuron. All membrane and synaptic conductances are varied over the same range as in Gonçalves et al. (2020); Deistler et al. (2021).
+
+The 15 summary features proposed by Prinz et al. (2004) are salient features of the pyloric rhythm: Cycle period (s), three burst durations (s), two gap durations between bursts, two phase delays, three duty cycles, two phase gaps, and two phases of burst onsets. Note that several of these values are only defined if each neuron produces rhythmic bursting behavior. In particular we call any simulations invalid if at least one of the summary features is undefined.
+
+The experimental data is taken from file 845_082_0044 in a publicly available dataset (Haddad & Marder, 2021).
+
+For the likelihood-model, we use a Neural Spline Flow (NSF) with five autoregressive layers. Each layer has two hidden layers and 50 hidden neurons, as implemented in the sbi package (Tejero-Cantero et al., 2020; Durkan et al., 2019b). The posterior-model is a Masked autoregressive flow (MAF) with five autoregressive layers each with one hidden layer and 160 hidden units.
+
+We train a total of 31 rounds. In the first round we use 50000 simulations from which only 492 are valid, and thus used to estimate the likelihood. For all other rounds we each simulated 10000 samples. To account for invalid summary features, we use the calibration kernel $K(\pmb{x},\pmb{x}_o) = I(\pmb{x}$ is valid), hence can simply exclude any invalid simulations from training the likelihood-model. By Theorem 1 we have to correct the likelihood by multiplication of $\mathbb{E}_{\pmb{x}\sim p(\pmb{x}|\pmb{\theta})}[I(\pmb{x}$ is valid)] $= P(\pmb{x}$ is valid| $\pmb{\theta}$ ). To estimate this probability we use a deep logistic regression net with 3 hidden layers each with 50 neurons and ReLU activations. We train this classifier simultaneously with the likelihood-model, that is in each round we add new data $\left\{\left(\pmb{\theta}_i,I(\pmb{\theta}_i\text{is valid})\right)\right\}_{i = 1}^N$ and retrain the classifier using the weighted binary-cross-entropy loss. We weight the loss by the estimated class probabilities to account for class imbalance especially in early rounds. We fix the number of epochs to 200 per round. We use the fKL loss with $N = 1024$ samples, as well as SIR.
+
+
+Figure 12: Posterior distribution for the neuroscience model of the pyloric network. In Fig. 4B we show a subset. The black point is a mean estimate using $10^{7}$ samples. The red point is a maximum a-posteriori estimate, obtained by gradient ascent.
+
+In total, the procedure took 27 hours, with the runs of the simulator being parallelized across several nodes. Because of this, the runtime also depends greatly on availability of computing resources on the cluster.
+
+
+Figure 13: Runtime of the classifier $c_{\zeta}(\theta)$ in the model of the pyloric network (90% of simulations are invalid). Training the classifier is approximately three times cheaper than training the likelihood-model (compare left bar to second left) and thus increases the computational cost only modestly. The likelihood-model is trained only on valid simulations. The combined runtime of classifier and likelihood-model (third bar) is still far less than the time it would take to train the likelihood-model on all simulations (right bar. To estimate the runtime of the likelihood-model on all simulations, we substituted invalid simulation outputs (i.e. NaN) with an unreasonably low value and trained on all simulations).
\ No newline at end of file
diff --git a/variationalmethodsforsimulationbasedinference/images.zip b/variationalmethodsforsimulationbasedinference/images.zip
new file mode 100644
index 0000000000000000000000000000000000000000..380cc4ae7145835a9fd58fd51731494dd7252163
--- /dev/null
+++ b/variationalmethodsforsimulationbasedinference/images.zip
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:bd2e32d57d4c0b60e5043040371ddb498b55d045f5bf818250be399b5f1faf4b
+size 1144636
diff --git a/variationalmethodsforsimulationbasedinference/layout.json b/variationalmethodsforsimulationbasedinference/layout.json
new file mode 100644
index 0000000000000000000000000000000000000000..04a85ffd1e2f949fb8124f5ef8baef26e21d524f
--- /dev/null
+++ b/variationalmethodsforsimulationbasedinference/layout.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5238587f04a2c205cfa3a5df1e13f4232b86d6fc91892511c722cbdb2deebbaa
+size 858809
diff --git a/vitgantrainingganswithvisiontransformers/f2dbc46a-fc3b-4c65-bcb7-5c78ee2242d4_content_list.json b/vitgantrainingganswithvisiontransformers/f2dbc46a-fc3b-4c65-bcb7-5c78ee2242d4_content_list.json
new file mode 100644
index 0000000000000000000000000000000000000000..d9609413b93d5d85b3dd82e91ab918182bf57575
--- /dev/null
+++ b/vitgantrainingganswithvisiontransformers/f2dbc46a-fc3b-4c65-bcb7-5c78ee2242d4_content_list.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:3018d7341a7a5864887621a1617f2d1721fd09a689c940ff5a18e3e25f741180
+size 98494
diff --git a/vitgantrainingganswithvisiontransformers/f2dbc46a-fc3b-4c65-bcb7-5c78ee2242d4_model.json b/vitgantrainingganswithvisiontransformers/f2dbc46a-fc3b-4c65-bcb7-5c78ee2242d4_model.json
new file mode 100644
index 0000000000000000000000000000000000000000..e9b6f4b176c5f7d302f8a006c8db3ba3e7ffb1db
--- /dev/null
+++ b/vitgantrainingganswithvisiontransformers/f2dbc46a-fc3b-4c65-bcb7-5c78ee2242d4_model.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e171053c3b2b769b6b83c6e7ad7e49bf03e011767eb98872158ff90ee9141e6d
+size 123509
diff --git a/vitgantrainingganswithvisiontransformers/f2dbc46a-fc3b-4c65-bcb7-5c78ee2242d4_origin.pdf b/vitgantrainingganswithvisiontransformers/f2dbc46a-fc3b-4c65-bcb7-5c78ee2242d4_origin.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..520233423b1bb6d89be12ca1d983bd514ddca7bf
--- /dev/null
+++ b/vitgantrainingganswithvisiontransformers/f2dbc46a-fc3b-4c65-bcb7-5c78ee2242d4_origin.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:8cd6c9ef9f4aead669a0c05c1f9764225f8d556288dafad7d5998968c3c0ba44
+size 8176354
diff --git a/vitgantrainingganswithvisiontransformers/full.md b/vitgantrainingganswithvisiontransformers/full.md
new file mode 100644
index 0000000000000000000000000000000000000000..2028aeb66404cca3b2227743dea03a375ed9ddfc
--- /dev/null
+++ b/vitgantrainingganswithvisiontransformers/full.md
@@ -0,0 +1,407 @@
+# VITGAN: TRAINING GANS WITH VISION TRANSFORMERS
+
+Kwonjoon Lee $^{1,3}$ Huiwen Chang $^{2}$ Lu Jiang $^{2}$ Han Zhang $^{2}$ Zhuowen Tu $^{1}$ Ce Liu $^{4}$
+
+$^{1}$ UC San Diego $^{2}$ Google Research $^{3}$ Honda Research Institute $^{4}$ Microsoft Azure AI
+
+kwl042@eng.ucsd.edu {huiwenchang,lujiang,zhanghan}@google.com
+
+ztu@ucsd.edu ce.liu@microsoft.com
+
+# ABSTRACT
+
+Recently, Vision Transformers (ViTs) have shown competitive performance on image recognition while requiring less vision-specific inductive biases. In this paper, we investigate if such performance can be extended to image generation. To this end, we integrate the ViT architecture into generative adversarial networks (GANs). For ViT discriminators, we observe that existing regularization methods for GANs interact poorly with self-attention, causing serious instability during training. To resolve this issue, we introduce several novel regularization techniques for training GANs with ViTs. For ViT generators, we examine architectural choices for latent and pixel mapping layers to facilitate convergence. Empirically, our approach, named ViTGAN, achieves comparable performance to the leading CNN-based GAN models on three datasets: CIFAR-10, CelebA, and LSUN bedroom. Our code is available online1.
+
+# 1 INTRODUCTION
+
+Convolutional neural networks (CNNs) (LeCun et al., 1989) are dominating computer vision today, thanks to their powerful capability of convolution (weight-sharing and local-connectivity) and pooling (translation equivariance). Recently, however, Transformer architectures (Vaswani et al., 2017) have started to rival CNNs in many vision tasks.
+
+In particular, Vision Transformers (ViTs) (Dosovitskiy et al., 2021), which interpret an image as a sequence of tokens (analogous to words in natural language), have been shown to achieve comparable classification accuracy with smaller computational budgets (i.e., fewer FLOPs) on the ImageNet benchmark. Unlike CNNs, ViTs capture a different inductive bias through self-attention where each patch is attended to all patches of the same image. ViTs, along with their variants (Touvron et al., 2020; Tolstikhin et al., 2021), though still in their infancy, have demonstrated advantages in modeling non-local contextual dependencies (Ranftl et al., 2021; Strudel et al., 2021) as well as promising efficiency and scalability. Since their recent inception, ViTs have been used in various tasks such as object detection (Beal et al., 2020), video recognition (Bertasius et al., 2021; Arnab et al., 2021), multitask pre-training (Chen et al., 2020a), etc.
+
+In this paper, we examine whether Vision Transformers can perform the task of image generation without using convolution or pooling, and more specifically, whether ViTs can be used to train generative adversarial networks (GANs) with comparable quality to CNN-based GANs. While we can naively train GANs following the design of the standard ViT (Dosovitskiy et al., 2021), we find that GAN training becomes highly unstable when coupled with ViTs, and that adversarial training is frequently hindered by high-variance gradients in the later stage of discriminator training. Furthermore, conventional regularization methods such as gradient penalty (Gulrajani et al., 2017; Mescheder et al., 2018), spectral normalization (Miyato et al., 2018) cannot resolve the instability issue, even though they are proved to be effective for CNN-based GAN models (shown in Fig. 4). As unstable training is uncommon in the CNN-based GANs training with appropriate regularization, this presents a unique challenge to the design of ViT-based GANs.
+
+We propose several necessary modifications to stabilize the training dynamics and facilitate the convergence of ViT-based GANs. In the discriminator, we design an improved spectral normalization that enforces Lipschitz continuity for stabilizing the training dynamics. In the generator, we propose two key modifications to the layer normalization and output mapping layers after studying several architecture designs. Our ablation experiments validate the necessity of the proposed techniques and their central role in achieving stable and superior image generation.
+
+The experiments are conducted on three public image synthesis benchmarks: CIFAR-10, CelebA, and LSUN bedroom. The results show that our model, named ViTGAN, yields comparable performance to the leading CNN-based StyleGAN2 (Karras et al., 2020b; Zhao et al., 2020a) when trained under the same setting. Moreover, we are able to outperform StyleGAN2 by combining the StyleGAN2 discriminator with our ViTGAN generator.
+
+Note that it is not our intention to claim ViTGAN is superior to the best-performing GAN models such as StyleGAN2 + ADA (Karras et al., 2020a) which are equipped with highly-optimized hyperparameters, architecture configurations, and sophisticated data augmentation methods. Instead, our work aims to close the performance gap between the conventional CNN-based GAN architectures and the novel GAN architecture composed of vanilla ViT layers. Furthermore, the ablation in Table 4 shows the advantages of ViT's intrinsic capability (i.e., adaptive connection weight and global context) for image generation.
+
+# 2 RELATED WORK
+
+Generative Adversarial Networks Generative adversarial networks (GANs) (Goodfellow et al., 2014) model the target distribution using adversarial learning. It is typically formulated as a min-max optimization problem minimizing some distance between the real and generated data distributions, e.g., through various $f$ -divergences (Nowozin et al., 2016) or integral probability metrics (IPMs) (Müller, 1997; Song & Ermon, 2020) such as the Wasserstein distance (Arjovsky et al., 2017).
+
+GAN models are notorious for unstable training dynamics. As a result, numerous efforts have been proposed to stabilize training, thereby ensuring convergence. Common approaches include spectral normalization (Miyato et al., 2018), gradient penalty (Gulrajani et al., 2017; Mescheder et al., 2018; Kodali et al., 2017), consistency regularization (Zhang et al., 2020; Zhao et al., 2021), and data augmentation (Zhao et al., 2020a; Karras et al., 2020a; Zhao et al., 2020b; Tran et al., 2021). These techniques are all designed inside convolutional neural networks (CNN) and have been only verified in convolutional GAN models. However, we find that these methods are insufficient for stabilizing the training of Transformer-based GANs. A similar finding was reported in (Chen et al., 2021) on a different task of pretraining. This paper introduces several novel techniques to overcome the unstable adversarial training of Vision Transformers.
+
+Vision Transformers Vision Transformer (ViT) (Dosovitskiy et al., 2021) is a convolution-free Transformer that performs image classification over a sequence of image patches. ViT demonstrates the superiority of the Transformer architecture over the classical CNNs by taking advantage of pretraining on large-scale datasets. Afterward, DeiT (Touvron et al., 2020) improves ViTs' sample efficiency using knowledge distillation as well as regularization tricks. MLP-Mixer (Tolstikhin et al., 2021) further drops self-attention and replaces it with an MLP to mix the per-location feature. In parallel, ViT has been extended to various computer vision tasks such as object detection (Beal et al., 2020), action recognition in video (Bertasius et al., 2021; Arnab et al., 2021), and multitask pretraining (Chen et al., 2020a). Our work is among the first to exploit Vision Transformers in the GAN model for image generation.
+
+Generative Transformers in Vision Motivated by the success of GPT-3 (Brown et al., 2020), a few pilot works study image generation using Transformer by autoregressive learning (Chen et al., 2020b; Esser et al., 2021) or cross-modal learning between image and text (Ramesh et al., 2021). These methods are different from ours as they model image generation as a autoregressive sequence learning problem. On the contrary, our work trains Vision Transformers in the generative adversarial training paradigm. Recent work of (Hudson & Zitnick, 2021), embeds (cross-)attention module within the CNN backbone (Karras et al., 2020b) in a similar spirit to (Zhang et al., 2019). The closest work to ours is TransGAN (Jiang et al., 2021), presenting a GAN model based on Swin Transformer
+
+
+Figure 1: Overview of the proposed ViTGAN framework. Both the generator and the discriminator are designed based on the Vision Transformer (ViT). Discriminator score is derived from the classification embedding (denoted as $[^{*}]$ in the Figure). The generator generates pixels patch-by-patch based on patch embeddings.
+
+backbone (Liu et al., 2021b). Our approach is complementary to theirs as we propose key techniques for training stability within the original ViT backbone (Dosovitskiy et al., 2021).
+
+# 3 PRELIMINARIES: VISION TRANSFORMERS (VITs)
+
+Vision Transformer (Dosovitskiy et al., 2021) is a pure transformer architecture for image classification that operates upon a sequence of image patches. The 2D image $\mathbf{x} \in \mathbb{R}^{H \times W \times C}$ is flattened into a sequence of image patches, following the raster scan, denoted by $\mathbf{x}_p \in \mathbb{R}^{N \times (P^2 \cdot C)}$ , where $N = \frac{H \times W}{P^2}$ is the effective sequence length and $P \times P \times C$ is the dimension of each image patch.
+
+Following BERT (Devlin et al., 2019), a learnable classification embedding $\mathbf{x}_{\mathrm{class}}$ is pretended to the image sequence along with the added 1D positional embeddings $\mathbf{E}_{pos}$ to formulate the patch embedding $\mathbf{h}_0$ . The architecture of ViT follows the Transformer architecture (Vaswani et al., 2017).
+
+$$
+\mathbf {h} _ {0} = \left[ \mathbf {x} _ {\text {c l a s s}}; \mathbf {x} _ {p} ^ {1} \mathbf {E}; \mathbf {x} _ {p} ^ {2} \mathbf {E}; \dots ; \mathbf {x} _ {p} ^ {N} \mathbf {E} \right] + \mathbf {E} _ {p o s}, \quad \mathbf {E} \in \mathbb {R} ^ {(P ^ {2} \cdot C) \times D}, \mathbf {E} _ {p o s} \in \mathbb {R} ^ {(N + 1) \times D} \tag {1}
+$$
+
+$$
+\mathbf {h} _ {\ell} ^ {\prime} = \operatorname {M S A} \left(\operatorname {L N} \left(\mathbf {h} _ {\ell - 1}\right)\right) + \mathbf {h} _ {\ell - 1}, \quad \ell = 1, \dots , L \tag {2}
+$$
+
+$$
+\mathbf {h} _ {\ell} = \operatorname {M L P} \left(\operatorname {L N} \left(\mathbf {h} _ {\ell} ^ {\prime}\right)\right) + \mathbf {h} _ {\ell} ^ {\prime}, \quad \ell = 1, \dots , L \tag {3}
+$$
+
+$$
+\mathbf {y} = \operatorname {L N} \left(\mathbf {h} _ {L} ^ {0}\right) \tag {4}
+$$
+
+Equation 2 applies multi-headed self-attention (MSA). Given learnable matrices $\mathbf{W}_q, \mathbf{W}_k, \mathbf{W}_v$ corresponding to query, key, and value representations, a single self-attention head is computed by:
+
+$$
+\operatorname {A t t e n t i o n} _ {h} (\mathbf {X}) = \operatorname {s o f t m a x} \left(\frac {\mathbf {Q K} ^ {\top}}{\sqrt {d _ {h}}}\right) \mathbf {V}, \tag {5}
+$$
+
+where $\mathbf{Q} = \mathbf{X}\mathbf{W}_q$ , $\mathbf{K} = \mathbf{X}\mathbf{W}_k$ , and $\mathbf{V} = \mathbf{X}\mathbf{W}_v$ . Multi-headed self-attention aggregates information from $H$ self-attention heads by means of concatenation and linear projection: $\mathrm{MSA}(\mathbf{X}) = \mathrm{concat}_{h=1}^{H}[\mathrm{Attention}_h(\mathbf{X})]\mathbf{W} + \mathbf{b}$ .
+
+# 4 METHOD
+
+Fig. 1 illustrates the architecture of the proposed ViTGAN with a ViT discriminator and a ViT-based generator. We find that directly using ViT as the discriminator makes the training volatile. We introduce techniques to both generator and discriminator to stabilize the training dynamics and facilitate the convergence: (1) regularization on ViT discriminator and (2) new architecture for generator.
+
+# 4.1 REGULARIZING VIT-BASED DISCRIMINATOR
+
+Enforcing Lipschitzness of Transformer Discriminator Lipschitz continuity plays a critical role in GAN discriminators. It was first brought to attention as a condition to approximate the Wasserstein distance in WGAN (Arjovsky et al., 2017), and later was confirmed in other GAN settings (Fedus et al., 2018; Miyato et al., 2018; Zhang et al., 2019) beyond the Wasserstein loss. In particular, (Zhou et al., 2019) proves that Lipschitz discriminator guarantees the existence of the optimal discriminative function as well as the existence of a unique Nash equilibrium. A very recent work (Kim et al., 2021), however, shows that Lipschitz constant of standard dot product self-attention (i.e., Equation 5) layer can be unbounded, rendering Lipschitz continuity violated in ViTs. To enforce Lipschitzness of our ViT discriminator, we adopt $L2$ attention proposed in (Kim et al., 2021). As shown in Equation 6, we replace the dot product similarity with Euclidean distance and also tie the weights for the projection matrices for query and key in self-attention:
+
+$$
+\operatorname {A t t e n t i o n} _ {h} (\mathbf {X}) = \operatorname {s o f t m a x} \left(- \frac {d \left(\mathbf {X W} _ {q} , \mathbf {X W} _ {k}\right)}{\sqrt {d _ {h}}}\right) \mathbf {X W} _ {v}, \quad \text {w h e r e} \quad \mathbf {W} _ {q} = \mathbf {W} _ {k}, \tag {6}
+$$
+
+$\mathbf{W}_q, \mathbf{W}_k,$ and $\mathbf{W}_v$ are the projection matrices for query, key, and value, respectively. $d(\cdot, \cdot)$ computes vectorized L2 distances between two sets of points. $\sqrt{d_h}$ is the feature dimension for each head. This modification improves the stability of Transformers when used for GAN discriminators.
+
+Improved Spectral Normalization. To further strengthen the Lipschitz continuity, we also apply spectral normalization (SN) (Miyato et al., 2018) in the discriminator training. The standard SN uses power iterations to estimate spectral norm of the projection matrix for each layer in the neural network. Then it divides the weight matrix with the estimated spectral norm, so Lipschitz constant of the resulting projection matrix equals 1. We observe that making the spectral norm equal to 1 stabilized the training but GANs seemed to be underfitting in such settings (c.f.Table 3b). Similarly, we find R1 gradient penalty cripples GAN training when ViT-based discriminators are used (c.f.Figure 4). (Dong et al., 2021) suggests that the small Lipschitz constant of MLP block may cause the output of Transformer collapse to a rank-1 matrix. Without the spectral normalization, our GAN model initially learns in a healthy manner but the training becomes unstable (later on) since we cannot guarantee Lipschitzness of Transformer discriminator.
+
+We find that multiplying the normalized weight matrix of each layer with the spectral norm at initialization is sufficient to solve this problem. Concretely, we use the following update rule for our spectral normalization, where $\sigma$ computes the standard spectral norm of weight matrices:
+
+$$
+\bar {W} _ {\mathrm {I S N}} (\mathbf {W}) := \sigma \left(\mathbf {W} _ {\text {i n i t}}\right) \cdot \mathbf {W} / \sigma (\mathbf {W}). \tag {7}
+$$
+
+Overlapping Image Patches. ViT discriminators are prone to overfitting due to their exceeding learning capacity. Our discriminator and generator use the same image representation that partitions an image as a sequence of non-overlapping patches according to a predefined grid $P \times P$ . These arbitrary grid partitions, if not carefully tuned, may encourage the discriminator to memorize local cues and stop providing meaningful loss for the generator. We use a simple trick to mitigate this issue by allowing some overlap between image patches (Liu et al., 2021b;a). For each border edge of the patch, we extend it by $o$ pixels, making the effective patch size $(P + 2o) \times (P + 2o)$ .
+
+This results in a sequence with the same length but less sensitivity to the predefined grids. It may also give the Transformer a better sense of which ones are neighboring patches to the current patch, hence giving a better sense of locality.
+
+Convolutional Projection. To allow Transformers to leverage local context as well as global context, we apply convolutions when computing $\mathbf{Q},\mathbf{K},\mathbf{V}$ in Equation 5. While variants of this idea were proposed in (Wu et al., 2021; Guo et al., 2021), we find the following simple option works well: we apply $3\times 3$ convolution after reshaping image token embeddings into a feature map of size $\frac{H}{P}\times \frac{W}{P}\times D$ . We note that this formulation does not harm the expressiveness of the original Transformer, as the original $\mathbf{Q},\mathbf{K},\mathbf{V}$ projection can be recovered by using the identity convolution kernel.
+
+
+Figure 2: Generator Architecture Variants. The diagram on the left shows three generator architectures we consider: (A) adding intermediate latent embedding $\mathbf{w}$ to every positional embedding, (B) prepending $\mathbf{w}$ to the sequence, and (C) replacing normalization with self-modulated layernorm (SLN) computed by learned affine transform (denoted as $\mathbf{A}$ in the figure) from $\mathbf{w}$ . On the right, we show the details of the self-modulation operation applied in the Transformer block.
+
+# 4.2 GENERATOR DESIGN
+
+Designing a generator based on the ViT architecture is a nontrivial task. A challenge is converting ViT from predicting a set of class labels to generating pixels over a spatial region. Before introducing our model, we discuss two plausible baseline models, as shown in Fig. 2 (A) and 2 (B). Both models swap ViT's input and output to generate pixels from embeddings, specifically from the latent vector $\mathbf{w}$ derived from a Gaussian noise vector $\mathbf{z}$ by an MLP, i.e., $\mathbf{w} = \mathrm{MLP}(\mathbf{z})$ (called mapping network (Karras et al., 2019) in Fig. 2). The two baseline generators differ in their input sequences. Fig. 2 (A) takes as input a sequence of positional embeddings and adds the intermediate latent vector $\mathbf{w}$ to every positional embedding. Alternatively, Fig. 2 (B) prepends the sequence with the latent vector. This design is inspired by inverting ViT where $\mathbf{w}$ is used to replace the classification embedding $\mathbf{h}_L^0$ in Equation 4.
+
+To generate pixel values, a linear projection $\mathbf{E} \in \mathbb{R}^{D \times (P^2 \cdot C)}$ is learned in both models to map a $D$ -dimensional output embedding to an image patch of shape $P \times P \times C$ . The sequence of $N = \frac{H \times W}{P^2}$ image patches $[\mathbf{x}_p^i]_{i=1}^N$ are finally reshaped to form an whole image $\mathbf{x}$ .
+
+These baseline transformers perform poorly compared to the CNN-based generator. We propose a novel generator following the design principle of ViT. Our ViTGAN Generator, shown in Fig. 2 (c), consists of two components (1) a Transformer block and (2) an output mapping layer.
+
+$$
+\mathbf {h} _ {0} = \mathbf {E} _ {\text {p o s}}, \quad \mathbf {E} _ {\text {p o s}} \in \mathbb {R} ^ {N \times D}, \tag {8}
+$$
+
+$$
+\mathbf {h} _ {\ell} ^ {\prime} = \operatorname {M S A} \left(\operatorname {S L N} \left(\mathbf {h} _ {\ell - 1}, \mathbf {w}\right)\right) + \mathbf {h} _ {\ell - 1}, \quad \ell = 1, \dots , L, \mathbf {w} \in \mathbb {R} ^ {D} \tag {9}
+$$
+
+$$
+\mathbf {h} _ {\ell} = \operatorname {M L P} \left(\operatorname {S L N} \left(\mathbf {h} _ {\ell} ^ {\prime}, \mathbf {w}\right)\right) + \mathbf {h} _ {\ell} ^ {\prime}, \quad \ell = 1, \dots , L \tag {10}
+$$
+
+$$
+\mathbf {y} = \operatorname {S L N} \left(\mathbf {h} _ {L}, \mathbf {w}\right) = \left[ \mathbf {y} ^ {1}, \dots , \mathbf {y} ^ {N} \right] \quad \mathbf {y} ^ {1}, \dots , \mathbf {y} ^ {N} \in \mathbb {R} ^ {D} \tag {11}
+$$
+
+$$
+\mathbf {x} = \left[ \mathbf {x} _ {p} ^ {1}, \dots , \mathbf {x} _ {p} ^ {N} \right] = \left[ f _ {\theta} \left(\mathbf {E} _ {f o u}, \mathbf {y} ^ {1}\right), \dots , f _ {\theta} \left(\mathbf {E} _ {f o u}, \mathbf {y} ^ {N}\right) \right] \quad \mathbf {x} _ {p} ^ {i} \in \mathbb {R} ^ {P ^ {2} \times C}, \mathbf {x} \in \mathbb {R} ^ {H \times W \times C} \tag {12}
+$$
+
+The proposed generator incorporates two modifications to facilitate the training.
+
+Self-Modulated LayerNorm. Instead of sending the noise vector $\mathbf{z}$ as the input to ViT, we use $\mathbf{z}$ to modulate the layernorm operation in Equation 9. This is known as self-modulation (Chen et al., 2019) since the modulation depends on no external information. The self-modulated layernorm (SLN) in Equation 9 is computed by:
+
+$$
+\operatorname {S L N} \left(\mathbf {h} _ {\ell}, \mathbf {w}\right) = \operatorname {S L N} \left(\mathbf {h} _ {\ell}, \operatorname {M L P} (\mathbf {z})\right) = \gamma_ {\ell} (\mathbf {w}) \odot \frac {\mathbf {h} _ {\ell} - \boldsymbol {\mu}}{\sigma} + \beta_ {\ell} (\mathbf {w}), \tag {13}
+$$
+
+where $\mu$ and $\sigma$ track the mean and the variance of the summed inputs within the layer, and $\gamma_l$ and $\beta_l$ compute adaptive normalization parameters controlled by the latent vector derived from $\mathbf{z}$ . $\odot$ is the element-wise dot product.
+
+Table 1: Comparison to representative GAN architectures on unconditional image generation benchmarks. *Results from the original papers. All other results are our replications and trained with DiffAug (Zhao et al., 2020a) + bCR for fair comparison. ↓ means lower is better.
+
+| Architecture | CIFAR 10 | CelebA 64x64 | LSUN 64x64 | LSUN 128x128 |
| FID ↓ | IS ↑ | FID ↓ | IS ↑ | FID ↓ | IS ↑ | FID ↓ | IS ↑ |
| BigGAN+ DiffAug (Zhao et al., 2020a) | 8.59* | 9.25* | - | - | - | - | - | - |
| StyleGAN2 (Karras et al., 2020b) | 5.60 | 9.41 | 3.39 | 3.43 | 2.33 | 2.44 | 3.26 | 2.26 |
| TransGAN (Jiang et al., 2021) | 9.02* | 9.26* | - | - | - | - | - | - |
| Vanilla-ViT | 12.7 | 8.40 | 20.2 | 2.57 | 218.1 | 2.20 | - | - |
| ViTGAN (Ours) | 4.92 | 9.69 | 3.74 | 3.21 | 2.40 | 2.28 | 2.48 | 2.26 |
| StyleGAN2-D+ViTGAN-G (Ours) | 4.57 | 9.89 | - | - | 1.49 | 2.46 | 1.87 | 2.32 |
+
+Implicit Neural Representation for Patch Generation. We use an implicit neural representation (Park et al., 2019; Mescheder et al., 2019; Tancik et al., 2020; Sitzmann et al., 2020) to learn a continuous mapping from a patch embedding $\mathbf{y}^i \in \mathbb{R}^D$ to patch pixel values $\mathbf{x}_p^i \in \mathbb{R}^{P^2 \times C}$ . When coupled with Fourier features (Tancik et al., 2020) or sinusoidal activation functions (Sitzmann et al., 2020), implicit representations can constrain the space of generated samples to the space of smooth-varying natural signals. Concretely, similarly to (Anokhin et al., 2021), $\mathbf{x}_p^i = f_\theta(\mathbf{E}_{fou}, \mathbf{y}^i)$ where $\mathbf{E}_{fou} \in \mathbb{R}^{P^2 \cdot D}$ is a Fourier encoding of $P \times P$ spatial locations and $f_\theta(\cdot, \cdot)$ is a 2-layer MLP. For details, please refer to Appendix D. We find implicit representation to be particularly helpful for training GANs with ViT-based generators, c.f. Table 3a.
+
+# 5 EXPERIMENTS
+
+We train and evaluate our model on various standard benchmarks for image generation, including CIFAR-10 (Krizhevsky et al., 2009), LSUN bedroom (Yu et al., 2015) and CelebA (Liu et al., 2015). We consider three resolution settings: $32 \times 32$ , $64 \times 64$ , $128 \times 128$ , and $256 \times 256$ . We strive to use a consistent setup across different resolutions and datasets, and as such, keep all key hyper-parameters, except for the number of Transformer blocks and patch sizes, the same. For more details about the datasets and implementation, please refer to Appendix C and D.
+
+# 5.1 MAIN RESULTS
+
+Table 1 shows the main results on three standard benchmarks for image synthesis. Our method is compared with the following baseline architectures. TransGAN (Jiang et al., 2021) is the only existing convolution-free GAN that is entirely built on the Transformer architecture. Vanilla-ViT is a ViT-based GAN that employs the generator illustrated in Fig. 2 (A) and a vanilla ViT discriminator without any techniques discussed in Section 4.1. For a fair comparison, R1 penalty and bCR (Zhao et al., 2021) + DiffAug (Zhao et al., 2020a) were used for this baseline. The architecture with the generator illustrated in Fig. 2 (B) is separately compared in Table 3a. In addition, BigGAN (Brock et al., 2019) and StyleGAN2 (Karras et al., 2020b) are also included as state-of-the-art CNN-based GAN models.
+
+Our ViTGAN model outperforms other Transformer-based GAN models by a large margin. This stems from the improved stable GAN training on the Transformer architecture. As shown in Fig. 4, our method overcomes the spikes in gradient magnitude and stabilizes the training dynamics. This enables ViTGAN to converge to either a lower or a comparable FID on different datasets.
+
+ViTGAN achieves comparable performance to the leading CNN-based models, i.e. BigGAN and StyleGAN2. Note that in Table 1, to focus on comparing the architectures, we use a generic version of StyleGAN2. More comprehensive comparisons with StyleGAN2 are included in Appendix A.1. As shown in Fig. 3, the image fidelity of the best Transformer baseline (Middle Row) has been notably improved by the proposed ViTGAN model (Last Row). Even compared with StyleGAN2, ViTGAN generates images with comparable quality and diversity. Notice there appears to be a perceivable difference between the images generated by Transformers and CNNs, e.g.in the background of the CelebA images. Both the quantitative results and qualitative comparison substantiate the efficacy of the proposed ViTGAN as a competitive Transformer-based GAN model.
+
+
+CIFAR-10 $32 \times 32$
+
+
+
+
+
+
+(a) StyleGAN2 (FID = 5.60)
+CelebA $64 \times 64$
+
+
+(b) Vanilla-ViT (FID = 12.7)
+
+
+(c) ViTGAN (FID = 4.92)
+
+
+(d) StyleGAN2 (FID = 3.39)
+LSUN bedroom $64 \times 64$
+(g) StyleGAN2 (FID = 2.33)
+Figure 3: Qualitative Comparison. We compare our ViTGAN with StyleGAN2, and our best Transformer baseline, i.e., a vanilla pair of ViT generator and discriminator described in Section 5.1, on the CIFAR-10 $32 \times 32$ , CelebA $64 \times 64$ and LSUN Bedroom $64 \times 64$ datasets. Results on LSUN Bedroom $128 \times 128$ and $256 \times 256$ can be found in the Appendix.
+
+
+(e) Vanilla-ViT (FID = 23.61)
+(h) Vanilla-ViT (FID = 218.1)
+
+
+(f) ViTGAN (FID = 3.74)
+(i) ViTGAN (FID = 2.40)
+
+
+(a) Gradient $L_{2}$ Norm (CIFAR)
+
+
+(b) Gradient $L_{2}$ Norm (CelebA)
+
+
+(c) Gradient $L_{2}$ Norm (LSUN)
+
+
+(d) FID (CIFAR)
+
+
+(e) FID (CelebA)
+
+
+(f) FID (LSUN)
+Figure 4: (a-c) Gradient magnitude ( $L_{2}$ norm over all parameters) of ViT discriminator and (d-f) FID score (lower the better) as a function of training iteration. Our ViTGAN are compared with two baselines of Vanilla ViT discriminators with R1 penalty and spectral norm (SN). The remaining architectures are the same for all methods. Our method overcomes the spikes of gradient magnitude, and achieve lower FIDs (on CIFAR and CelebA) or a comparable FID (on LSUN).
+
+# 5.2 ABLATION STUDIES
+
+We conduct ablation experiments on the CIFAR dataset to study the contributions of the key techniques and verify the design choices in our model.
+
+Compatibility with CNN-based GANs In Table 2, we mix and match the generator and discriminator of our ViTGAN and the leading CNN-based GAN: StyleGAN2. With the StyleGAN2 generator, our ViTGAN discriminator outperforms the vanilla ViT discriminator. Besides, our ViTGAN generator still works together with the StyleGAN2 discriminator. The results show the proposed techniques are compatible with both Transformer-based and CNN-based generators and discriminators.
+
+Table 2: ViTGAN on CIFAR-10 when paired with CNN-based generators or discriminators.
+
+| Generator | Discriminator | FID ↓ | IS ↑ |
| ViTGAN | ViTGAN | 4.92 | 9.69 |
| StyleGAN2 | StyleGAN2 | 5.60 | 9.41 |
| StyleGAN2 | Vanilla-ViT | 17.3 | 8.57 |
| StyleGAN2 | ViTGAN | 8.02 | 9.15 |
| ViTGAN | StyleGAN2 | 4.57 | 9.89 |
+
+# Generator architecture Table 3a shows GAN
+
+performances under three generator architectures, as shown in Fig. 2. Fig. 2 (B) underperforms other architectures. We find that Fig. 2 (A) works well but lags behind Fig. 2 (C) due to its instability. Regarding the mapping between patch embedding and pixels, implicit neural representation (denoted as NeurRep in Table 3a) offers consistently better performance than linear mapping, suggesting the importance of implicit neural representation in the ViTGAN generators.
+
+Discriminator regularization Table 3b validates the necessity of the techniques discussed in Section 4.1. First, we compare GAN performances under different regularization methods. Training GANs with ViT discriminator under R1 penalty (Mescheder et al., 2018) is highly unstable, as shown in Fig. 4, sometimes resulting in complete training failure (indicated as IS=NaN in Row 1 of Table 3b). Spectral normalization (SN) is better than R1 penalty. But SN still exhibits high-variance gradients and therefore suffers from low quality scores. Our $L_{2}+$ ISN regularization improves the stability significantly (c.f.Fig. 4) and achieves the best IS and FID scores as a consequence. On the other hand, the overlapping patch is a simple trick that yields further improvement over the $L_{2}+$ ISN method. However, the overlapping patch by itself does not work well (see a comparison between
+
+Row 3 and 9). The above results validate the essential role of these techniques in achieving the final performance of the ViTGAN model.
+
+| Embedding | Output Mapping | FID ↓ | IS ↑ |
| Fig 2 (A) | Linear | 14.3 | 8.60 |
| Fig 2 (A) | NeurRep | 11.3 | 9.05 |
| Fig 2 (B) | Linear | 328 | 1.01 |
| Fig 2 (B) | NeurRep | 285 | 2.46 |
| Fig 2 (C) | Linear | 15.1 | 8.58 |
| Fig 2 (C) | NeurRep | 6.66 | 9.30 |
+
+(a) Ablation studies of generator architectures. NeurRep denotes implicit neural representation. ViT discriminator without convolutional projection is used for this ablation.
+
+Table 3: Ablation studies of ViTGAN on CIFAR-10.
+
+| Aug. | Reg. | Overlap | Proj. | FID ↓ | IS ↑ |
| X | R1 | X | X | 2e4 | NaN |
| X | R1 | ✓ | X | 129 | 4.99 |
| ✓ | R1 | ✓ | X | 13.1 | 8.71 |
| X | SN | X | X | 121 | 4.28 |
| ✓ | SN | X | X | 10.2 | 8.78 |
| ✓ | L2+SN | X | X | 168 | 2.36 |
| ✓ | ISN | X | X | 8.51 | 9.12 |
| ✓ | L2+ISN | X | X | 8.36 | 9.02 |
| ✓ | L2+ISN | ✓ | X | 6.66 | 9.30 |
| ✓ | L2+ISN | ✓ | ✓ | 4.92 | 9.69 |
+
+(b) Ablation studies of discriminator regularization. 'Aug., Reg., Overlap' and 'Proj.' stand for DiffAug Zhao et al. (2020a) + bCR Zhao et al. (2021), and regularization method, overlapping image patches, and convolutional projection, respectively.
+
+Necessity of self-attention Two intrinsic advantages of ViTs over CNNs are (a) adaptive connection weights based on both content and position, and (b) globally contextualized representation. We show the importance of each of them by ablation analysis in Table 4. We conduct this ablation study on the LSUN Bedroom dataset considering that its large-scale ( $\sim 3$ million images) helps compare sufficiently trained vision transformers.
+
+First, to see the importance of adapting connection weights, we maintain the network topology (i.e., each
+
+token is connected to all other tokens) and use fixed weights between tokens as in CNNs. We adopt the recently proposed MLP-Mixer (Tolstikhin et al., 2021) as an instantiation of this idea. By comparing the 2nd and 3rd rows of the table, we see that it is beneficial to adapt connection weight between tokens. The result of MLP-Mixer on the LSUN Bedroom dataset suggests that the deficiency of weight adaptation cannot be overcome by merely training on a large-scale dataset.
+
+Second, to see the effect of self-attention scope (global v.s. local), we adopt a local self-attention of window size $= 3 \times 3$ (Ramachandran et al., 2019). The ViT based on local attention (4th row in Table 4) outperforms the ones with global attention. This shows the importance of considering local context (2nd row in Table 4). The ViT with convolutional projection (last row in Table 4) — which considers both local and global contexts — outperforms other methods.
+
+For results on applying these techniques into either one of discriminator or generator, please refer to Table 6 in the Appendix.
+
+# 6 CONCLUSION AND LIMITATIONS
+
+We have introduced ViTGAN, leveraging Vision Transformers (ViTs) in GANs, and proposed essential techniques to ensuring its training stability and improving its convergence. Our experiments on standard benchmarks demonstrate that the presented model achieves comparable performance to leading CNN-based GANs. Regarding the limitations, ViTGAN is a novel GAN architecture consisting solely of Transformer layers. This could be improved by incorporating advanced training (e.g., (Jeong & Shin, 2021; Schonfeld et al., 2020)) or coarse-to-fine architectures (e.g., (Liu et al., 2021b)) into the ViTGAN framework. Besides, we have not verified ViTGAN on high-resolution images. Our paper establishes a concrete baseline of ViT on resolutions up to $256 \times 256$ and we hope that it can facilitate future research to use vision transformers for high-resolution image synthesis.
+
+# ETHICS STATEMENT
+
+We acknowledge that the image generation techniques have the risks to be misused to produce misleading information. Researchers should explore the techniques responsibly. Future research may have ethical and fairness implication especially when generating images of identifiable faces. It is unclear whether the proposed new architecture would differentially impact groups of people of certain appearance (e.g., skin color), age (young or aged), or with a physical disability. These concerns ought to be considered carefully. We did not undertake any subject studies or conduct any data-collection for this project. We are committed in our work to abide by the eight General Ethical Principles listed at ICLR Code of Ethics (https://iclr.cc/public/CodeOfEthics)
+
+# REPRODUCIBILITY STATEMENT
+
+All of our experiments are conducted on public benchmarks. We describe the implementation details in the experiment section and in the Appendix C and Appendix D. We will release our code and models to ensure reproducibility.
+
+# ACKNOWLEDGMENTS
+
+This work was supported in part by Google Cloud Platform (GCP) Credit Award. We would also like to acknowledge Cloud TPU support from Google's TensorFlow Research Cloud (TRC) program. Also, we thank the anonymous reviewers for their helpful and constructive comments and suggestions.
+
+# REFERENCES
+
+Ivan Anokhin, Kirill Demochkin, Taras Khakhulin, Gleb Sterkin, Victor Lempitsky, and Denis Korzhenkov. Image generators with conditionally-independent pixel synthesis. In CVPR, 2021.
+Martin Arjovsky, Soumith Chintala, and Léon Bottou. Wasserstein generative adversarial networks. In ICML, 2017.
+Anurag Arnab, Mostafa Dehghani, Georg Heigold, Chen Sun, Mario Lučić, and Cordelia Schmid. Vivit: A video vision transformer. arXiv preprint arXiv:2103.15691, 2021.
+Josh Beal, Eric Kim, Eric Tzeng, Dong Huk Park, Andrew Zhai, and Dmitry Kislyuk. Toward transformer-based object detection. arXiv preprint arXiv:2012.09958, 2020.
+Gedas Bertasius, Heng Wang, and Lorenzo Torresani. Is space-time attention all you need for video understanding? In ICML, 2021.
+Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale gan training for high fidelity natural image synthesis. In ICLR, 2019.
+Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D 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 Ziegler, Jeffrey Wu, Clemens Winter, Chris 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.
+Hanting Chen, Yunhe Wang, Tianyu Guo, Chang Xu, Yiping Deng, Zhenhua Liu, Siwei Ma, Chunjing Xu, Chao Xu, and Wen Gao. Pre-trained image processing transformer. In ICML, 2020a.
+Mark Chen, Alec Radford, Rewon Child, Jeff Wu, Heewoo Jun, Prafulla Dhariwal, David Luan, and Ilya Sutskever. Generative pretraining from pixels. In ICML, 2020b.
+Ting Chen, Mario Lucic, Neil Houlsby, and Sylvain Gelly. On self modulation for generative adversarial networks. In ICLR, 2019.
+
+Xinlei Chen, Saining Xie, and Kaiming He. An empirical study of training self-supervised vision transformers. CoRR, abs/2104.02057, 2021.
+Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In ACL, 2019.
+Yihe Dong, Jean-Baptiste Cordonnier, and Andreas Loukas. Attention is not all you need: Pure attention loses rank doubly exponentially with depth. arXiv preprint arXiv:2103.03404, 2021.
+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.
+Patrick Esser, Robin Rombach, and Björn Ommer. Taming transformers for high-resolution image synthesis. In CVPR, 2021.
+William Fedus, Mihaela Rosca, Balaji Lakshminarayanan, Andrew M. Dai, Shakir Mohamed, and Ian J. Goodfellow. Many paths to equilibrium: Gans do not need to decrease a divergence at every step. In *ICLR*, 2018.
+Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In NeurIPS, 2014.
+Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron Courville. Improved training of wasserstein gans. In NeurIPS, 2017.
+Jianyuan Guo, Kai Han, Han Wu, Chang Xu, Yehui Tang, Chunjing Xu, and Yunhe Wang. Cmt: Convolutional neural networks meet vision transformers, 2021.
+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 NeurIPS, 2017.
+Drew A Hudson and C. Lawrence Zitnick. Generative adversarial transformers. arXiv preprint:2103.01209, 2021.
+Jongheon Jeong and Jinwoo Shin. Training {gan}s with stronger augmentations via contrastive discriminator. In ICLR, 2021. URL https://openreview.net/forum?id=eo6U4CAwVmg.
+Yifan Jiang, Shiyu Chang, and Zhangyang Wang. Transgan: Two transformers can make one strong gan. arXiv preprint arXiv:2102.07074, 2021.
+Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of gans for improved quality, stability, and variation. In ICLR, 2018.
+Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In CVPR, 2019.
+Tero Karras, Miika Aittala, Janne Hellsten, Samuli Laine, Jaakko Lehtinen, and Timo Aila. Training generative adversarial networks with limited data. In NeurIPS, 2020a.
+Tero Karras, Samuli Laine, Miika Aittala, Janne Hellsten, Jaakko Lehtinen, and Timo Aila. Analyzing and improving the image quality of StyleGAN. In CVPR, 2020b.
+Hyunjik Kim, George Papamakarios, and Andriy Mnih. The lipschitz constant of self-attention. In ICML, 2021.
+Naveen Kodali, Jacob Abernethy, James Hays, and Zsolt Kira. On convergence and stability of gans. arXiv preprint arXiv:1705.07215, 2017.
+Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009.
+
+Y. LeCun, B. Boser, J. S. Denker, D. Henderson, R. E. Howard, W. Hubbard, and L. D. Jackel. Backpropagation applied to handwritten zip code recognition. Neural Computation, 1(4):541-551, 1989. doi: 10.1162/neco.1989.1.4.541.
+Rui Liu, Hanming Deng, Yangyi Huang, Xiaoyu Shi, Lewei Lu, Wenxiu Sun, Xiaogang Wang, Jifeng Dai, and Hongsheng Li. Fuseformer: Fusing fine-grained information in transformers for video inpainting. In ICCV, 2021a.
+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, 2021b.
+Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaou Tang. Deep learning face attributes in the wild. In ICCV, 2015.
+Lars Mescheder, Sebastian Nowozin, and Andreas Geiger. Which training methods for gans do actually converge? In ICML, 2018.
+Lars Mescheder, Michael Oechsle, Michael Niemeyer, Sebastian Nowozin, and Andreas Geiger. Occupancy networks: Learning 3d reconstruction in function space. In CVPR, 2019.
+Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. In ICLR, 2018.
+Alfred Müller. Integral probability metrics and their generating classes of functions. Advances in Applied Probability, pp. 429-443, 1997.
+Sebastian Nowozin, Botond Cseke, and Ryota Tomioka. f-gan: Training generative neural samplers using variational divergence minimization. In NeurIPS, 2016.
+Jeong Joon Park, Peter Florence, Julian Straub, Richard Newcombe, and Steven Lovegrove. Deepsdf: Learning continuous signed distance functions for shape representation. In $CVPR$ , 2019.
+Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. In ICLR, 2016.
+Prajit Ramachandran, Niki Parmar, Ashish Vaswani, Irwan Bello, Anselm Levskaya, and Jon Shlens. Stand-alone self-attention in vision models. In NeurIPS, 2019.
+Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. arXiv preprint arXiv:2102.12092, 2021.
+René Ranftl, Alexey Bochkovskiy, and Vladlen Koltun. Vision transformers for dense prediction. ArXiv preprint, 2021.
+Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. In NeurIPS, 2016.
+Edgar Schonfeld, Bernt Schiele, and Anna Khoreva. A u-net based discriminator for generative adversarial networks. In CVPR, 2020.
+Vincent Sitzmann, Julien N.P. Martel, Alexander W. Bergman, David B. Lindell, and Gordon Wetzstein. Implicit neural representations with periodic activation functions. In NeurIPS, 2020.
+Jiaming Song and Stefano Ermon. Bridging the gap between $f$ -gans and wasserstein gans. In ICML, 2020.
+Robin Strudel, Ricardo Garcia, Ivan Laptev, and Cordelia Schmid. Segmenter: Transformer for semantic segmentation. arXiv preprint arXiv:2105.05633, 2021.
+Matthew Tancik, Pratul P. Srinivasan, Ben Mildenhall, Sara Fridovich-Keil, Nithin Raghavan, Utkarsh Singhal, Ravi Ramamoorthi, Jonathan T. Barron, and Ren Ng. Fourier features let networks learn high frequency functions in low dimensional domains. In NeurIPS, 2020.
+
+Ilya Tolstikhin, Neil Houlsby, Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Thomas Unterthiner, Jessica Yung, Andreas Steiner, Daniel Keysers, Jakob Uszkoreit, Mario Lucic, and Alexey Dosovitskiy. Mlp-mixer: An all-mlx architecture for vision. arXiv preprint arXiv:2105.01601, 2021.
+Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention. arXiv preprint arXiv:2012.12877, 2020.
+Ngoc-Trung Tran, Viet-Hung Tran, Ngoc-Bao Nguyen, Trung-Kien Nguyen, and Ngai-Man Cheung. On data augmentation for gan training. IEEE Transactions on Image Processing, 30:1882-1897, 2021.
+Hung-Yu Tseng, Lu Jiang, Ce Liu, Ming-Hsuan Yang, and Weilong Yang. Regularizing generative adversarial networks under limited data. In CVPR, 2021.
+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.
+Haiping Wu, Bin Xiao, Noel Codella, Mengchen Liu, Xiyang Dai, Lu Yuan, and Lei Zhang. Cvt: Introducing convolutions to vision transformers. arXiv preprint arXiv:2103.15808, 2021.
+Tete Xiao, Mannat Singh, Eric Mintun, Trevor Darrell, Piotr Dólár, and Ross Girshick. Early convolutions help transformers see better, 2021.
+Fisher Yu, Yinda Zhang, Shuran Song, Ari Seff, 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.
+Han Zhang, Ian J. Goodfellow, Dimitris N. Metaxas, and Augustus Odena. Self-attention generative adversarial networks. In ICML, 2019.
+Han Zhang, Zizhao Zhang, Augustus Odena, and Honglak Lee. Consistency regularization for generative adversarial networks. In ICLR, 2020.
+Shengyu Zhao, Zhijian Liu, Ji Lin, Jun-Yan Zhu, and Song Han. Differentiable augmentation for data-efficient gan training. In NeurIPS, 2020a.
+Zhengli Zhao, Zizhao Zhang, Ting Chen, Sameer Singh, and Han Zhang. Image augmentations for GAN training. arXiv preprint:2006.02595, 2020b.
+Zhengli Zhao, Sameer Singh, Honglak Lee, Zizhao Zhang, Augustus Odena, and Han Zhang. Improved consistency regularization for gans. In AAAI, 2021.
+Zhiming Zhou, Jiadong Liang, Yuxuan Song, Lantao Yu, Hongwei Wang, Weinan Zhang, Yong Yu, and Zhihua Zhang. Lipschitz generative adversarial nets. In ICML, 2019.
+
+# A MORE RESULTS
+
+# A.1 EFFECTS OF DATA AUGMENTATION
+
+Table 5 presents the comparison of the Convolution-based GAN architectures (BigGAN and StyleGAN2) and our Transformer-based architecture (ViTGAN). This table complements the results in Table 1 of the main paper by a closer examination of the network architecture performance with and without using data augmentation. The differentiable data augmentation (DiffAug) (Zhao et al., 2020a) is used in this study.
+
+As shown, data augmentation plays more critical role in ViTGAN. This is not unexpected because discriminators built on Transformer architectures are more capable of over-fitting or memorizing the data. DiffAug increases the diversity of the training data, thereby mitigating the overfitting issue in adversarial training. Nevertheless, with DiffAug, ViTGAN performs comparably to the leading-performing CNN-based GAN models: BigGAN and StyleGAN2.
+
+In addition, Table 5 includes the model performance without using the balanced consistency regularization (bCR) (Zhao et al., 2021).
+
+Table 5: Effectiveness of data augmentation and regularization on the CIFAR-10 dataset. ViTGAN results here are based on the ViT backbone without convolutional projection.
+
+| Method | Data Augmentation | Conv | FID ↓ | IS ↑ |
| StyleGAN2 | None | Y | 8.32 | 9.21 |
| StyleGAN2 | DiffAug | Y | 5.60 | 9.41 |
| ViTGAN | None | N | 30.72 | 7.75 |
| ViTGAN | DiffAug | N | 6.66 | 9.30 |
| ViTGAN w/o. bCR | DiffAug | N | 8.84 | 9.02 |
+
+# A.2 FID OF STYLEGAN2
+
+We implemented StyleGAN2, Vanilla-ViT, and ViTGAN on the same codebase to allow for a fair comparison between the methods. Our implementation follows StyleGAN2 + DiffAug (Zhao et al., 2020a) and reproduces the StyleGAN2 FID reported in (Zhao et al., 2020a) which was published in NeurIPS 2020: the FID of our StyleGAN2 (+ DiffAug) re-implementation is 5.60 versus the 5.79 FID reported in Zhao et al. (2020a).
+
+There is another contemporary work called StyleGAN2 (+ ADA) (Karras et al., 2020a). Both StyleGAN2 (+ DiffAug) (Zhao et al., 2020a) and StyleGAN2 (+ ADA) (Karras et al., 2020a) use the same StyleGAN2 architecture which is considered as the state-of-the-art CNN-based GAN. Due to their differences in data augmentation methods and hyperparameter settings, they report different FIDs on the CIFAR-10 dataset.
+
+Note our goal is to compare the architecture difference under the same training setting, we only compare StyleGAN2 (+ DiffAug) (Zhao et al., 2020a) and use the same data augmentation method DiffAug in both StyleGAN2 and ViTGAN.
+
+# A.3 NECCESSITY OF SELF-ATTENTION
+
+In Table 6, we extend the result from Table 4 by applying self-attention or local attention to either one of discriminator (D) or generator (G). The comparison between ViT vs. MLP shows that it is more important to use adaptive weights on the generator than the discriminator. The comparison between ViT and ViT-local shows that it is beneficial to have locality on both generator and discriminator.
+
+# A.4 HIGH-RESOLUTION SAMPLES
+
+Figure 5 and Figure 6 show uncurated samples from our ViTGAN model trained on LSUN Bedroom $128 \times 128$ and LSUN Bedroom $256 \times 256$ , respectively. For $256 \times 256$ resolution, we use the
+
+Table 6: Detailed ablations studies of self-attention on LSUN Bedroom 32x32.
+
+| Method | FID ↓ |
| ViT-D + ViT-G | 1.94 |
| MLP-D + ViT-G | 2.33 |
| ViT-D + MLP-G | 2.86 |
| MLP-D + MLP-G | 3.23 |
| ViT-local-D + ViT-local-G | 1.79 |
| ViT-local-D + ViT-G | 2.03 |
| ViT-D + ViT-local-G | 2.04 |
+
+same architecture as $128 \times 128$ resolution except for increasing the sequence length to 1024 for the generator. The FID of ViTGAN on LSUN Bedroom $256 \times 256$ is 4.67. Our method outperforms GANformer (Hudson & Zitnick, 2021), which achieved an FID of 6.51 on LSUN Bedroom $256 \times 256$ .
+
+
+Figure 5: Samples from ViTGAN on $128 \times 128$ resolution. Our ViTGAN was trained on LSUN Bedroom $128 \times 128$ dataset. We achieved the FID of 2.48.
+
+
+Figure 6: Samples from ViTGAN on $256 \times 256$ resolution. Our ViTGAN was trained on LSUN Bedroom $256 \times 256$ dataset. We achieved the FID of 4.67.
+
+# B COMPUTATION COST ANALYSIS
+
+We would like to note that computational complexity is not the main challenge of using Transformers for high-resolution datasets. Due to various smart tokenization strategies such as non-overlapping patches (Dosovitskiy et al., 2021), stack of strided convolutions (Xiao et al., 2021), etc, we are able to suppress the explosion of effective sequence length — it is typically just a few hundred for standard image resolutions. As a result, the sequence length stays within a region where a quadratic time complexity is not a big issue. Actually, as shown in Table 7, ViTs are much more compute efficient than CNN (StyleGAN2). For our ViT-based discriminator, owing to the approach from (Xiao et al., 2021), we were able to scale up from $32 \times 32$ to $128 \times 128$ without the increase in sequence length (=64). For our ViT-based generator, since we did not employ any convolution stack, we had to increase the sequence length as we increased the resolution. This issue, in principle, can be addressed by adding up-convolutional (deconvolutional) blocks or Swin Transformer (Liu et al., 2021b) blocks after the initial low-resolution Transformer stage. Table 7 reveals that we are able to suppress the increase in computation cost at higher-resolutions by using Swin Transformer blocks. For this hypothetical ViTGAN-Swin variant, we use Swin Transformer blocks starting from $128^{2}$ resolution stage, and the number of channels is halved for every upsampling stage as done in Swin Transformer.
+
+Please note that the main goal of this paper is not to design a new Transformer block for general computer vision applications; we instead focus on addressing challenges unique to the combination of Transformers and GANs. Techniques presented in this paper are still valid for numerous variants of ViTs such as Swin (Liu et al., 2021b), CvT (Wu et al., 2021), CMT (Guo et al., 2021), etc.
+
+The experiments in the current paper is not based on Swin Transformers since using Swin Transformers resulted in inferior FID according to our experiments. However, we believe that with careful tuning of architectural configurations such as numbers of heads, channels, layers, etc., ViTGAN-Swin may be able to achieve a better FID score. We were unable to perform this due to our limited computational resources. We leave leave it to future work.
+
+Table 7: Generator computation cost comparison among methods.
+
+| Method | #Params@642 | FLOPs@642 | FLOPs@1282 | FLOPs@2562 |
| StyleGAN2 (Karras et al., 2020b) | 24M | 7.8B | 11.5B | 15.2B |
| ViTGAN | 38M | 2.6B | 11.8B | 52.1B |
| ViTGAN-Swin | N/A | N/A | 3.1B | 3.5B |
+
+# C EXPERIMENT DETAILS
+
+Datasets The CIFAR-10 dataset (Krizhevsky et al., 2009) is a standard benchmark for image generation, containing 50K training images and 10K test images. Inception score (IS) (Salimans et al., 2016) and Fréchet Inception Distance (FID) (Heusel et al., 2017) are computed over the 50K images. The LSUN bedroom dataset (Yu et al., 2015) is a large-scale image generation benchmark, consisting of $\sim 3$ million training images and 300 images for validation. On this dataset, FID is computed against the training set due to the small validation set. The CelebA dataset (Liu et al., 2015) comprises 162,770 unlabeled face images and 19,962 test images. We use the aligned version of CelebA, which is different from cropped version used in prior literature (Radford et al., 2016; Jiang et al., 2021).
+
+Implementation Details. We consider three resolution settings: $32 \times 32$ on the CIFAR dataset, $64 \times 64$ on CelebA and LSUN bedroom, and $128 \times 128$ on LSUN bedroom. For $32 \times 32$ resolution, we use a 4-block ViT-based discriminator and a 4-block ViT-based generator. For $64 \times 64$ resolution, we increase the number of blocks to 6. Following ViT-Small (Dosovitskiy et al., 2021), the input/output feature dimension is 384 for all Transformer blocks, and the MLP hidden dimension is 1,536. Unlike (Dosovitskiy et al., 2021), we choose the number of attention heads to be 6. We find increasing the number of heads does not improve GAN training. For $32 \times 32$ resolution, we use patch size $4 \times 4$ , yielding a sequence length of 64 patches. For $64 \times 64$ resolution, we simply increase the patch size to $8 \times 8$ , keeping the same sequence length as in $32 \times 32$ resolution. For $128 \times 128$ resolution
+
+generator, we use patch size $8 \times 8$ and 8 Transformer blocks. For $128 \times 128$ resolution discriminator, we maintain the sequence length of 64 and 4 Transformer blocks. Similarly to (Xiao et al., 2021), $3 \times 3$ convolutions with stride 2 were used until desired sequence length is reached.
+
+Translation, Color, Cutout, and Scaling data augmentations (Zhao et al., 2020a; Karras et al., 2020a) are applied with probability 0.8. All baseline transformer-based GAN models, including ours, use balanced consistency regularization (bCR) with $\lambda_{real} = \lambda_{fake} = 10.0$ . Other than bCR, we do not employ regularization methods typically used for training ViTs (Touvron et al., 2020) such as Dropout, weight decay, or Stochastic Depth. We found that LeCam regularization (Tseng et al., 2021), similar to bCR, improves the performance. But for clearer ablation, we do not include the LeCam regularization. We train our models with Adam with $\beta_{1} = 0.0$ , $\beta_{2} = 0.99$ , and a learning rate of 0.002 following the practice of (Karras et al., 2020b). In addition, we employ non-saturating logistic loss (Goodfellow et al., 2014), exponential moving average of generator weights (Karras et al., 2018), and equalized learning rate (Karras et al., 2018). We use a mini-batch size of 128.
+
+Both ViTGAN and StyleGAN2 are based on Tensorflow 2 implementation $^2$ and trained on Google Cloud TPU v2-32 and v3-8.
+
+# D IMPLEMENTATION NOTES
+
+Patch Extraction We use a simple trick to mitigate the over-fitting of the ViT-based discriminator by allowing some overlap between image patches. For each border edge of the patch, we extend it by $o$ pixels, making the effective patch size $(P + 2o) \times (P + 2o)$ , where $o = \frac{P}{2}$ . Although this operation has a connection to a convolution operation with kernel $(P + 2o) \times (P + 2o)$ and stride $P \times P$ , we do not regard it as a convolution operator in our model because we do not use convolution in our implementation. Note that the extraction of (non-overlapping) patches in the Vanilla ViT (Dosovitskiy et al., 2021) also has a connection to a convolution operation with kernel $P \times P$ and stride $P \times P$ .
+
+Positional Embedding Each positional embedding of ViT networks is a linear projection of patch position followed by a sine activation function. The patch positions are normalized to lie between -1.0 and 1.0.
+
+Implicit Neural Representation for Patch Generation Each positional embedding is a linear projection of pixel coordinate followed by a sine activation function (hence the name Fourier encoding). The pixel coordinates for $P^2$ pixels are normalized to lie between -1.0 and 1.0. The 2-layer MLP takes positional embedding $\mathbf{E}_{fou}$ as its input, and it is conditioned on patch embedding $\mathbf{y}^i$ via weight modulation as in (Karras et al., 2020b; Anokhin et al., 2021).
\ No newline at end of file
diff --git a/vitgantrainingganswithvisiontransformers/images.zip b/vitgantrainingganswithvisiontransformers/images.zip
new file mode 100644
index 0000000000000000000000000000000000000000..e4ae9dcc6d9ce9450c0d8abc5f611ccf162019d5
--- /dev/null
+++ b/vitgantrainingganswithvisiontransformers/images.zip
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4547728301104ba2da4135278cf7b124e71b42a2f022e9632aed888dec0863ad
+size 1189054
diff --git a/vitgantrainingganswithvisiontransformers/layout.json b/vitgantrainingganswithvisiontransformers/layout.json
new file mode 100644
index 0000000000000000000000000000000000000000..fc91e9ccc8ad4b944f93f7443704f2a93d3a9820
--- /dev/null
+++ b/vitgantrainingganswithvisiontransformers/layout.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:01180ee4af977c086f02c309296cbae9c40813b0868f716e3640e87c4edba5ad
+size 534466
diff --git a/whathappensaftersgdreacheszerolossamathematicalframework/f60a662a-43e3-4464-81ce-db44d98124a1_content_list.json b/whathappensaftersgdreacheszerolossamathematicalframework/f60a662a-43e3-4464-81ce-db44d98124a1_content_list.json
new file mode 100644
index 0000000000000000000000000000000000000000..593c256fbc921ff5534956f62c049cc617ab9e6b
--- /dev/null
+++ b/whathappensaftersgdreacheszerolossamathematicalframework/f60a662a-43e3-4464-81ce-db44d98124a1_content_list.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:c2271b09cf30449f56aa61d5b014975b16c183cc9ba06d7b85c33455bcfa4cdc
+size 370936
diff --git a/whathappensaftersgdreacheszerolossamathematicalframework/f60a662a-43e3-4464-81ce-db44d98124a1_model.json b/whathappensaftersgdreacheszerolossamathematicalframework/f60a662a-43e3-4464-81ce-db44d98124a1_model.json
new file mode 100644
index 0000000000000000000000000000000000000000..2f7eeabad3943f126756e8cc31139b75713ce134
--- /dev/null
+++ b/whathappensaftersgdreacheszerolossamathematicalframework/f60a662a-43e3-4464-81ce-db44d98124a1_model.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:8671970e7707d4e5b36f0545b8dedc3c432b7cf0c5c312fc3943c5c130d57c85
+size 428508
diff --git a/whathappensaftersgdreacheszerolossamathematicalframework/f60a662a-43e3-4464-81ce-db44d98124a1_origin.pdf b/whathappensaftersgdreacheszerolossamathematicalframework/f60a662a-43e3-4464-81ce-db44d98124a1_origin.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..c5cc59d6f26ff527e41b98e3226402d200b39e01
--- /dev/null
+++ b/whathappensaftersgdreacheszerolossamathematicalframework/f60a662a-43e3-4464-81ce-db44d98124a1_origin.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a5f5702a86faa26a217de62cfc6b931cd83f9c755ae61d2ced8e6203ecf3ff69
+size 1318730
diff --git a/whathappensaftersgdreacheszerolossamathematicalframework/full.md b/whathappensaftersgdreacheszerolossamathematicalframework/full.md
new file mode 100644
index 0000000000000000000000000000000000000000..371f1b61eb7cf7b09a88515ac01efcf87a59c8e8
--- /dev/null
+++ b/whathappensaftersgdreacheszerolossamathematicalframework/full.md
@@ -0,0 +1,1918 @@
+# WHAT HAPPENS AFTER SGD REACHES ZERO LOSS? -A MATHEMATICAL FRAMEWORK
+
+# Zhiyuan Li
+
+Department of Computer Science
+
+Princeton University
+
+zhiyuanli@cs.princeton.edu
+
+# Tianhao Wang
+
+Department of Statistics and Data Science Yale University
+
+tianhao.wang@yale.edu
+
+# Sanjeev Arora
+
+Department of Computer Science
+
+Princeton University
+
+arora@cs.princeton.edu
+
+# ABSTRACT
+
+Understanding the implicit bias of Stochastic Gradient Descent (SGD) is one of the key challenges in deep learning, especially for overparametrized models, where the local minimizers of the loss function $L$ can form a manifold. Intuitively, with a sufficiently small learning rate $\eta$ , SGD tracks Gradient Descent (GD) until it gets close to such manifold, where the gradient noise prevents further convergence. In such regime, Blanc et al. (2020) proved that SGD with label noise locally decreases a regularizer-like term, the sharpness of loss, $\mathrm{tr}[\nabla^2 L]$ . The current paper gives a general framework for such analysis by adapting ideas from Katzenberger (1991). It allows in principle a complete characterization for the regularization effect of SGD around such manifold—i.e., the "implicit bias"—using a stochastic differential equation (SDE) describing the limiting dynamics of the parameters, which is determined jointly by the loss function and the noise covariance. This yields some new results: (1) a global analysis of the implicit bias valid for $\eta^{-2}$ steps, in contrast to the local analysis of Blanc et al. (2020) that is only valid for $\eta^{-1.6}$ steps and (2) allowing arbitrary noise covariance. As an application, we show with arbitrary large initialization, label noise SGD can always escape the kernel regime and only requires $O(\kappa \ln d)$ samples for learning an $\kappa$ -sparse overparametrized linear model in $\mathbb{R}^d$ (Woodworth et al., 2020), while GD initialized in the kernel regime requires $\Omega(d)$ samples. This upper bound is minimax optimal and improves the previous $\widetilde{O}(\kappa^2)$ upper bound (HaoChen et al., 2020).
+
+# 1 INTRODUCTION
+
+The implicit bias underlies the generalization ability of machine learning models trained by stochastic gradient descent (SGD). But it still remains a mystery to mathematically characterize such bias. We study SGD in the following formulation
+
+$$
+x _ {\eta} (k + 1) = x _ {\eta} (k) - \eta (\nabla L (x _ {\eta} (k)) + \sqrt {\Xi} \cdot \sigma_ {\xi_ {k}} (x _ {\eta} (k))) \tag {1}
+$$
+
+where $\eta$ is the learning rate (LR), $L: \mathbb{R}^D \to \mathbb{R}$ is the training loss and $\sigma(x) = [\sigma_1(x), \sigma_2(x), \ldots, \sigma_\Xi(x)] \in \mathbb{R}^{D \times \Xi}$ is a deterministic noise function. Here $\xi_k$ is sampled uniformly from $\{1, 2, \ldots, \Xi\}$ and it satisfies $\mathbb{E}_{\xi_k}[\sigma_{\xi_k}(x)] = 0, \forall x \in \mathbb{R}^d$ and $k$ .
+
+It is widely believed that large LR (or equivalently, small batch size) helps SGD find better minima. For instance, some previous works argued that large noise enables SGD to select a flatter attraction basin of the loss landscape which potentially benefits generalization (Li et al., 2019c; Jastrzebski et al., 2017). However, there is also experimental evidence (Li et al., 2020b) that small LR also has equally good implicit bias (albeit with higher training time), and that is the case studied here. Presumably low LR precludes SGD jumping between different basins since under general conditions this should require $\Omega (\exp (1 / \eta))$ steps (Shi et al., 2020). In other words, there should be a mechanism to reach better generalization while staying within a single basin. For deterministic GD similar mechanisms
+
+$$
+\begin{array}{l} - \nabla L (X _ {*} + \Delta) \\ \approx - \nabla L ^ {2} (X _ {*}) \Delta - 0. 5 \partial^ {2} (\nabla L) (X _ {*}) [ \Delta , \Delta ] \end{array}
+$$
+
+
+(a) Taylor Expansion of $\nabla L$
+
+
+(b) Normal Space Dynamics
+
+
+(c) Tangent Space Dynamics
+Figure 1: Illustration for limiting flow in $\mathbb{R}^2$ . $\Gamma$ is an 1D manifold of minimizers of loss $L$ .
+
+have been demonstrated in simple cases (Soudry et al., 2018; Lyu & Li, 2019) and referred to as implicit bias of gradient descent. The current paper can be seen as a study of implicit bias of Stochastic GD, which turns out to be quite different, mathematically.
+
+Recent work (Blanc et al., 2020) shed light on this direction by analyzing effects of stochasticity in the gradient. For sufficiently small LR, SGD will reach and be trapped around some manifold of local minimizers, denoted by $\Gamma$ (see Figure 2). The effect is shown to be an implicit deterministic drift in a direction corresponding to lowering a regularizer-like term along the manifold. They showed SGD with label noise locally decreases the sharpness of loss, $\mathrm{tr}[\nabla^2 L]$ , by $\Theta (\eta^{0.4})$ in $\eta^{-1.6}$ steps. However, such an analysis is actually local, since the natural time scale of analysis should be $\eta^{-2}$ , not $\eta^{-1.6}$ .
+
+The contribution of the current paper is a more general and global analysis of this type. We introduce a more powerful framework inspired by the classic paper (Katzenberger, 1991).
+
+# 1.1 INTUITIVE EXPLANATION OF REGULARIZATION EFFECT DUE TO SGD
+
+We start with an intuitive description of the implicit regularization effect described in Blanc et al. (2020). For simplification, we show it for the canonical SDE approximation (See Section B.1 for more details) of SGD (1) (Li et al., 2017; Cheng et al., 2020). Here $W(t)$ is the standard $\Xi$ -dimensional Brownian motion. The only property about label noise SGD we will use is that the noise covariance $\sigma \sigma^{\top}(x) = \nabla^{2}L(x)$ for every $x$ in the manifold $\Gamma$ (See derivation in Section 5).
+
+$$
+\mathrm {d} \tilde {X} _ {\eta} (t) = - \eta \nabla L (\tilde {X} _ {\eta} (t)) \mathrm {d} t + \eta \cdot \sigma (\tilde {X} _ {\eta} (t)) \mathrm {d} W (t). \tag {2}
+$$
+
+Suppose $\tilde{X}_{\eta}(0)$ is already close to some local minimizer point $X_{*} \in \Gamma$ . The goal is to show $\tilde{X}_{\eta}(t)$ will move in the tangent space and steadily decrease $\mathrm{tr}[\nabla^2 L]$ . At first glance, this seems impossible as the gradient $\nabla L$ vanishes around $\Gamma$ , and the noise has zero mean, implying SGD should be like random walk instead of a deterministic drift. The key observation of Blanc et al. (2020) is that the local dynamics of $\tilde{X}_{\eta}(t)$ is completely different in tangent space and normal space — the fast random walk in normal space causes $\tilde{X}_{\eta}(t)$ to move slowly (with velocity $\Theta(\eta^2)$ ) but deterministically in certain direction. To explain this, letting $\Delta(t) = \tilde{X}_{\eta}(t) - X_*$ , Taylor expansion of (2) gives $\mathrm{d}\Delta(t) \approx -\eta\nabla^2L(X_*)\Delta\mathrm{d}t + \eta\sigma(X_*)\mathrm{d}W(t)$ , meaning $\Delta$ is behaving like an Ornstein-Uhlenbeck (OU) process locally in the normal space. Its mixing time is $\Theta(\eta^{-1})$ and the stationary distribution is the standard multivariate gaussian in the normal space scaled by $\sqrt{\eta}$ (see Figure 1b), because noise covariance $\sigma\sigma^{\top} = \nabla^{2}L$ . Though this OU process itself doesn't form any regularization, it activates the second order Taylor expansion of $\nabla L(X_* + \Delta(t))$ , i.e., $-\frac{1}{2}\partial^2(\nabla L)(X_*)[\Delta(t), \Delta(t)]$ , creating a $\Theta(\eta^2)$ velocity in the tangent space. Since there is no push back force in the tangent space, the small velocity accumulates over time, and in a longer time scale of $\Omega(\eta^{-1})$ , the time average of the stochastic velocity is roughly the same as the expected velocity when $\Delta$ is sampled from its stationary distribution. This simplifies the expression of the velocity in tangent space to $\frac{\eta^2}{2}\nabla_T\mathrm{tr}[\nabla^2L]$ (see Figure 1c), where $\nabla_T$ means the gradient is only taken in the tangent space.
+
+However, the above approach only gives a local analysis for $O(\eta^{-1.6})$ time, where the total movement due to implicit regularization is $O(\eta^{2 - 1.6}) = O(\eta^{0.4})$ and thus is negligible when $\eta \rightarrow 0$ . In order to get a non-trivial limiting dynamics when $\eta \rightarrow 0$ , a global analysis for $\Omega (\eta^{-2})$ steps is necessary and it cannot be done by Taylor expansion with a single reference point. Recent work by Damian et al. (2021) glues analyses of multiple local phases into a global guarantee that SGD finds a $(\epsilon ,\gamma)$ -stationary point for the regularized loss, but still doesn't show convergence for trajectory when $\eta \rightarrow 0$ and cannot deal with general noise types, e.g., noise lying in the tangent space of the manifold. The
+
+main technical difficulty here is that it's not clear how to separate the slow and fast dynamics in different spaces and how to only take limit for the slow dynamics, especially when shifting to a new reference point in the Taylor series calculation.
+
+# 1.2 OUR APPROACH: SEPARATING THE SLOW FROM THE FAST
+
+In this work, we tackle this problem via a different angle. First, since the anticipated limiting dynamics is of speed $\Theta (\eta^2)$ , we change the time scaling to accelerate (2) by $\eta^{-2}$ times, which yields
+
+$$
+\mathrm {d} X _ {\eta} (t) = - \eta^ {- 1} \nabla L (X _ {\eta} (t)) \mathrm {d} t + \sigma (X _ {\eta} (t)) \mathrm {d} W (t). \tag {3}
+$$
+
+The key idea here is that we only need to track the slow dynamic, or equivalently, some projection of $X$ onto the manifold $\Gamma$ , $\Phi(X)$ . Here $\Phi: \mathbb{R}^D \to \Gamma$ is some function to be specified and hopefully we can simplify the dynamics (3) via choosing suitable $\Phi$ . To track the dynamics of $\Phi(X_\eta)$ , we apply Ito's lemma (a.k.a. stochastic chain rule, see Lemma A.9) to Equation (3), which yields
+
+$$
+\begin{array}{l} \mathrm {d} \Phi (X _ {\eta} (t)) = - \eta^ {- 1} \partial \Phi (X _ {\eta} (t)) \nabla L (X _ {\eta} (t)) \mathrm {d} t + \partial \Phi (X _ {\eta} (t)) \sigma (X _ {\eta} (t)) \mathrm {d} W (t) \\ + \frac {1}{2} \sum_ {i, j = 1} ^ {D} \partial_ {i j} \Phi (X _ {\eta} (t)) (\sigma (X _ {\eta} (t)) \sigma (X _ {\eta} (t)) ^ {\top}) _ {i j} \mathrm {d} t. \\ \end{array}
+$$
+
+Note the first term $-\eta^{-1}\partial \Phi (X_{\eta})\nabla L(X_{\eta})$ is going to diverge to $\infty$ when $\eta \to 0$ , so a natural choice for $\Phi$ is to kill the first term. Further note $-\partial \Phi (X)\nabla L(X)$ is indeed the directional derivative of $\Phi$ at $X$ towards $-\nabla L$ , killing the first term becomes equivalent to making $\Phi$ invariant under Gradient Flow (GF) of $-\nabla L(X)$ ! Thus it suffices to take $\Phi (X)$ to be the limit of GF starting at $X$ . (Formally defined in Section 3; see Lemma C.2 for a proof of $\partial \Phi (X)\nabla L(X)\equiv 0$ .)
+
+Also intuitively $X_{\eta}$ will be infinitely close to $\Gamma$ , i.e., $d(X_{\eta}(t),\Gamma)\to 0$ for any $t > 0$ as $\eta \rightarrow 0$ , so we have $\Phi (X_{\eta})\approx X_{\eta}$ . Thus we can rewrite the above equation as
+
+$$
+\mathrm {d} X _ {\eta} (t) \approx \partial \Phi \left(X _ {\eta} (t)\right) \sigma \left(X _ {\eta} (t)\right) \mathrm {d} W (t) + \frac {1}{2} \sum_ {i, j = 1} ^ {D} \partial_ {i j} \Phi \left(X _ {\eta} (t)\right) \left(\sigma \left(X _ {\eta} (t)\right) \sigma \left(X _ {\eta} (t)\right) ^ {\top}\right) _ {i j} \mathrm {d} t, \tag {4}
+$$
+
+and the solution of (4) shall converge to that of the following (in an intuitive sense):
+
+$$
+\mathrm {d} X (t) = \partial \Phi (X (t)) \sigma (X (t)) \mathrm {d} W (t) + \frac {1}{2} \sum_ {i, j = 1} ^ {D} \partial_ {i j} \Phi (X (t)) (\sigma (X (t)) \sigma (X (t)) ^ {\top}) _ {i j} \mathrm {d} t, \tag {5}
+$$
+
+The above argument for SDE was first formalized and rigorously proved by Katzenberger (1991). It included an extension of the analysis to the case of asymptotic continuous dynamics (Theorem 4.1) including SGD with infinitesimal LR, but the result is weaker in this case and no convergence is shown. Another obstacle for applying this analysis is that 2nd order partial derivatives of $\Phi$ are unknown. We solve these issues in Section 4 and our main result Theorem 4.6 gives a clean and complete characterization for the implicit bias of SGD with infinitesimal LR in $\Theta (\eta^{-2})$ steps. Finally, our Corollary 5.2 shows (5) gives exactly the same regularization as $\mathrm{tr}[\nabla^2 L]$ for label noise SGD.
+
+The main contributions of this paper are summarized as follows.
+
+1. In Section 4, we propose a mathematical framework to study the implicit bias of SGD with infinitesimal LR. Our main theorem (Theorem 4.6) gives the limiting diffusion of SGD with LR $\eta$ for $\Theta (\eta^{-2})$ steps as $\eta \rightarrow 0$ and allows any covariance structure.
+2. In Section 5, we give limiting dynamics of SGD with isotropic noise and label noise.
+3. In Section 6, we show for any initialization, SGD with label noise achieves $O(\kappa \ln d)$ sample complexity for learning a $\kappa$ -sparse overparametrized linear model (Woodworth et al., 2020). In this case, the implicit regularizer is a data-dependent weighted $\ell_1$ regularizer, meaning noise can help reduce the norm and even escape the kernel regime. The $O(\kappa \ln d)$ rate is minimax optimal (Raskutti et al., 2012) and improves over $\tilde{O} (\kappa^2)$ upper bound by HaoChen et al. (2020). In contrast, vanilla GD requires $\Omega(d)$ samples to generalize in the kernel regime.
+
+For technical contributions, we rigorously prove the convergence of GF for OLM (Lemma 6.3), unlike many existing implicit bias analyses which have to assume the convergence. We also prove the convergence of limiting flow to the global minimizer of the regularizer (Lemma 6.5) by a trajectory analysis via our framework. It cannot be proved by previous results (Blanc et al., 2020; Damian et al., 2021), as they only assert convergence to stationary point in the best case.
+
+# 2 RELATED WORKS
+
+Loss Landscape of Overparametrized Models A phenomenon known as mode connectivity has been observed that local minimizers of the loss function of a neural network are connected by simple paths (Freeman & Bruna, 2016; Garipov et al., 2018; Draxler et al., 2018), especially for overparametrized models (Venturi et al., 2018; Liang et al., 2018; Nguyen et al., 2018; Nguyen, 2019). Later this phenomenon is explained under generic assumptions by Kuditipudi et al. (2019). Moreover, it has been proved that the local minimizers of an overparametrized network form a low-dimensional manifold (Cooper, 2018; 2020) which possibly has many components. Fehrman et al. (2020) proved the convergence rate of SGD to the manifold of local minimizers starting in a small neighborhood.
+
+Implicit Bias in Overparametrized Models Algorithmic regularization has received great attention in the community (Arora et al., 2018; 2019a; Gunasekar et al., 2018b;a;b; Soudry et al., 2018; Li et al., 2018; 2020a). In particular, the SGD noise is widely believed to be a promising candidate for explaining the generalization ability of modern neural networks (LeCun et al., 2012; Keskar et al., 2016; Hoffer et al., 2017; Zhu et al., 2018; Li et al., 2019a). Beyond the size of noise (Li et al., 2019c; Jastrzebski et al., 2017), the shape and class of the noise also play an important role (Wen et al., 2019; Wu et al., 2020). It is shown by HaoChen et al. (2020) that parameter-dependent noise will bias SGD towards a low-complexity local minimizer. Similar implicit bias has also been studied for overparametrized nonlinear statistical models by Fan et al. (2020). Several existing works (Vaskevicius et al., 2019; Woodworth et al., 2020; Zhao et al., 2019) have shown that for the quadratically overparametrized linear model, i.e., $w = u^{\odot 2} - v^{\odot 2}$ or $w = u\odot v$ , gradient descent/flow from small initialization implicitly regularizes $\ell_1$ norm and provides better generalization when the groundtruth is sparse. This is in sharp contrast to the kernel regime, where neural networks trained by gradient descent behaves like kernel methods (Daniely, 2017; Jacot et al., 2018; Yang, 2019). This allows one to prove convergence to zero loss solutions in overparametrized settings (Li & Liang, 2018; Du et al., 2018; Allen-Zhu et al., 2019b;a; Du et al., 2019; Zou et al., 2020), where the learnt function minimizes the corresponding RKHS norm (Arora et al., 2019b; Chizat et al., 2018).
+
+Modelling Stochastic First-Order Methods with Itô SDE Apart from the discrete-time analysis, another popular approach to study SGD is through the continuous-time lens using SDE (Li et al., 2017; 2019b; Cheng et al., 2020). Such an approach is often more elegant and can provide fruitful insights like the linear scaling rule (Krizhevsky, 2014; Goyal et al., 2017) and the intrinsic learning rate (Li et al., 2020b). A recent work by Li et al. (2021) justifies such SDE approximation. Xie et al. (2020) gave a heuristic derivation explaining why SGD favors flat minima with SDE approximation. Wojtowitsch (2021) showed that the invariant distribution of the canonical SDE approximation of SGD will collapse to some manifold of minimizers and in particular, favors flat minima. By approximating SGD using a SDE with slightly modified covariance for the overparametrized linear model, Pesme et al. (2021) relates the strength of implicit regularization to training speed.
+
+# 3 NOTATION AND PRELIMINARIES
+
+Given loss $L$ , the GF governed by $L$ can be described through a mapping $\phi : \mathbb{R}^D \times [0, \infty) \to \mathbb{R}^D$ satisfying $\phi(x,t) = x - \int_0^t \nabla L(\phi(x,s)) \, \mathrm{d}s$ . We further denote the limiting mapping $\Phi(x) = \lim_{t \to \infty} \phi(x,t)$ whenever the limit exists. We denote $\mathbb{1}_{\xi} \in \mathbb{R}^{\Xi}$ as the one-hot vector where $\xi$ -th coordinate is 1, and $\mathbb{1}$ the all 1 vector. See Appendix A for a complete clarification of notations.
+
+# 3.1 MANIFOLD OF LOCAL MINIMIZERS
+
+Assumption 3.1. Assume that the loss $L: \mathbb{R}^D \to \mathbb{R}$ is a $\mathcal{C}^3$ function, and that $\Gamma$ is a $(D - M)$ -dimensional $\mathcal{C}^2$ -submanifold of $\mathbb{R}^D$ for some integer $0 \leq M \leq D$ , where for all $x \in \Gamma$ , $x$ is a local minimizer of $L$ and $\mathrm{rank}(\nabla^2 L(x)) = M$ .
+
+Assumption 3.2. Assume that $U$ is an open neighborhood of $\Gamma$ satisfying that gradient flow starting in $U$ converges to some point in $\Gamma$ , i.e., $\forall x \in U, \Phi(x) \in \Gamma$ . (Then $\Phi$ is $\mathcal{C}^2$ on $U$ by Falconer (1983).)
+
+When does such a manifold exist? The vast overparametrization in modern deep learning is a major reason for the set of global minimizers to appear as a Riemannian manifold (possibly with multiple connected components), instead of isolated ones. Suppose all global minimizers interpolate the
+
+training dataset, i.e., $\forall x\in \mathbb{R}^D$ $L(x) = \min_{x^{\prime}\in \mathbb{R}^{D}}L(x^{\prime})$ implies $f_{i}(x) = y_{i}$ for all $i\in [n]$ , then by preimage theorem (Banyaga & Hurtubise, 2013), the manifold $\Gamma \coloneqq \{x\in \mathbb{R}^D\mid f_i(x) = y_i,\forall i\in [n]\}$ is of dimension $D - n$ if the Jacobian matrix $[\nabla f_1(x),\dots ,\nabla f_n(x)]$ has rank $n$ for all $x\in \Gamma$ . Note this condition is equivalent to that NTK at $x$ has full rank, which is very common in literature.
+
+# 4 LIMITING DIFFUSION OF SGD
+
+In Section 4.1 we first recap the main result of Katzenberger (1991). In Section 4.2 we derive the closed-form expressions of $\partial \Phi$ and $\partial^2\Phi$ . We present our main result in Section 4.3. We remark that sometimes we omit the dependency on $t$ to make things clearer.
+
+# 4.1 RECAP OF KATZENBERGER'S THEOREM
+
+Let $\{A_n\}_{n \geq 1}$ be a sequence of integrators, where each $A_n: \mathbb{R} \to \mathbb{R}$ is a non-decreasing function with $A_n(0) = 0$ . Let $\{Z_n\}_{n \geq 1}$ be a sequence of $\mathbb{R}^{\lvert \Xi \rvert}$ -valued stochastic processes defined on $\mathbb{R}$ . Given loss function $L$ and noise covariance function $\sigma$ , we consider the following stochastic process:
+
+$$
+X _ {n} (t) = X (0) + \int_ {0} ^ {t} \sigma \left(X _ {n} (s) \mathrm {d} Z _ {n} (s) + \int_ {0} ^ {t} - \nabla L \left(X _ {n} (s)\right) \mathrm {d} A _ {n} (s) \right. \tag {6}
+$$
+
+In particular, when the integrator sequence $\{A_n\}_{n \geq 1}$ increases infinitely fast, meaning that $\forall \epsilon > 0$ , $\inf_{t \geq 0} (A_n(t + \epsilon) - A_n(t)) \to \infty$ as $n \to \infty$ , we call (6) a Katzenberger process.
+
+One difficulty for directly studying the limiting dynamics of $X_{n}(t)$ is that the point-wise limit as $n\to \infty$ become discontinuous at $t = 0$ if $X(0)\notin \Gamma$ . The reason is that clearly $\lim_{n\to \infty}X_n(0) = X(0)$ , but for any $t > 0$ , since $\{A_{n}\}_{n\geq 1}$ increases infinitely fast, one can prove $\lim_{n\to \infty}X_n(t)\in \Gamma!$ . To circumvent this issue, we consider $Y_{n}(t) = X_{n}(t) - \phi (X(0),A_{n}(t)) + \Phi (X(0))$ . Then for each $n\geq 1$ , we have $Y_{n}(0) = \Phi (X(0))$ and $\lim_{n\to \infty}Y_{n}(t) = \lim_{n\to \infty}X_{n}(t)$ . Thus $Y_{n}(t)$ has the same limit on $(0,\infty)$ as $X_{n}(t)$ , but the limit of the former is further continuous at $t = 0$ .
+
+Theorem 4.1 (Informal version of Theorem B.7, Katzenberger 1991). Suppose the loss $L$ , manifold $\Gamma$ and neighborhood $U$ satisfies Assumptions 3.1 and 3.2. Let $\{X_{n}\}_{n\geq 1}$ be a sequence of Katzenberger process with $\{A_n\}_{n\geq 1}, \{Z_n\}_{n\geq 1}$ . Let $Y_{n}(t) = X_{n}(t) - \phi (X(0),\bar{A}_{n}(t)) + \Phi (X_{0})$ . Under technical assumptions, it holds that if $(Y_{n},Z_{n})$ converges to some $(Y,W)$ in distribution, where $\{W(t)\}_{t\geq 0}$ is the standard Brownian motion, then $Y$ stays on $\Gamma$ and admits
+
+$$
+Y (t) = Y (0) + \int_ {0} ^ {t} \partial \Phi (Y) \sigma (Y) d W (s) + \frac {1}{2} \sum_ {i, j = 1} ^ {D} \int_ {0} ^ {t} \partial_ {i j} \Phi (Y) (\sigma (Y) \sigma (Y) ^ {\top}) _ {i j} d s. \tag {7}
+$$
+
+Indeed, SGD (1) can be rewritten into a Katzenberger process as in the following lemma.
+
+Lemma 4.2. Let $\{\eta_n\}_{n=1}^{\infty}$ be any positive sequence with $\lim_{n\to \infty}\eta_n = 0$ , $A_n(t) = \eta_n\lfloor t / \eta_n^2\rfloor$ and $Z_n(t) = \eta_n\sum_{k=1}^{\lfloor t / \eta_n^2\rfloor}\sqrt{\Xi}(\mathbb{1}_{\xi_k} - \frac{1}{\Xi}\mathbb{1})$ , where $\xi_1, \xi_2, \ldots \stackrel{i.i.d.}{\sim}\text{Unif}([\Xi])$ . Then with the same initialization $X_n(0) = x_{\eta_n}(0) \equiv X(0)$ , $X_n(k\eta_n^2)$ defined by (6) is a Katzenberger process and is equal to $x_{\eta_n}(k)$ defined in (1) with LR equal to $\eta_n$ for all $k \geq 1$ . Moreover, the counterpart of (7) is
+
+$$
+Y (t) = \Phi (X (0)) + \int_ {0} ^ {t} \partial \Phi (Y) \sigma (Y) d W (s) + \frac {1}{2} \int_ {0} ^ {t} \partial^ {2} \Phi (Y) [ \Sigma (Y) ] d s, \tag {8}
+$$
+
+where $\Sigma \equiv \sigma \sigma^{\top}$ and $\{W(t)\}_{t\geq 0}$ is a $\Xi$ -dimensional standard Brownian motion.
+
+However, there are two obstacles preventing us from directly applying Theorem 4.1 to SGD. First, the stochastic integral in (8) depends on the derivatives of $\Phi$ , $\partial \Phi$ and $\partial_{ij} \Phi$ , but Katzenberger (1991) did not give their dependency on loss $L$ . To resolve this, we explicitly calculate the derivatives of $\Phi$ on $\Gamma$ in terms of the derivatives of $L$ in Section 4.2.
+
+The second difficulty comes from the convergence of $(Y_{n},Z_{n})$ which we assume as granted for brevity in Theorem 4.1. In fact, the full version of Theorem 4.1 (see Theorem B.7) concerns the stopped version of $Y_{n}$ with respect to some compact $K\subset U$ , i.e., $Y_{n}^{\mu_{n}(K)}(t) = Y_{n}(t\wedge \mu_{n}(K))$ where $\mu_n(K)$ is the stopping time of $Y_{n}$ leaving $K$ . As noted in Katzenberger (1991), we need the
+
+convergence of $\mu_{n}(K)$ for $Y_{n}^{\mu_{n}(K)}$ to converge, which is a strong condition and difficult to prove in our cases. We circumvent this issue by proving Theorem B.9, a user-friendly interface for the original theorem in Katzenberger (1991), and it only requires the information about the limiting diffusion. Building upon these, we present our final result as Theorem 4.6.
+
+# 4.2 CLOSED-FORM EXPRESSION OF THE LIMITING DIFFUSION
+
+We can calculate the derivatives of $\Phi$ by relating to those of $L$ . Here the key observation is the invariance of $\Phi$ along the trajectory of GF.
+
+Lemma 4.3. For any $x \in \Gamma$ , $\partial \Phi(x) \in \mathbb{R}^{D \times D}$ is the projection matrix onto tangent space $T_x(\Gamma)$ .
+
+To express the second-order derivatives compactly, we introduce the notion of Lyapunov operator.
+
+Definition 4.4 (Lyapunov Operator). For a symmetric matrix $H$ , we define $W_{H} = \{\Sigma \in \mathbb{R}^{D\times D}\mid$ $\Sigma = \Sigma^{\top},HH^{\dagger}\Sigma = \Sigma = \Sigma HH^{\dagger}\}$ and Lyapunov Operator $\mathcal{L}_H:W_H\to W_H$ as $\mathcal{L}_H(\Sigma) = H^\top \Sigma +\Sigma H$ . It's easy to verify $\mathcal{L}_H^{-1}$ is well-defined on $W_{H}$ .
+
+Lemma 4.5. Let $x$ be any point in $\Gamma$ and $\Sigma = \Sigma(x) = \sigma \sigma^{\top}(x) \in \mathbb{R}^{D \times D}$ be the noise covariance at $x^1$ . Then $\Sigma$ can be decomposed as $\Sigma = \Sigma_{\parallel} + \Sigma_{\perp} + \Sigma_{\parallel, \perp} + \Sigma_{\perp, \parallel}$ , where $\Sigma_{\parallel} := \partial \Phi \Sigma \partial \Phi$ , $\Sigma_{\perp} := (I_D - \partial \Phi)\Sigma(I_D - \partial \Phi)$ and $\Sigma_{\parallel, \perp} = \Sigma_{\perp, \parallel}^{\top} = \partial \Phi \Sigma(I_D - \partial \Phi)$ are the noise covariance in tangent space, normal space and across both spaces, respectively. Then it holds that
+
+$$
+\partial^ {2} \Phi [ \Sigma ] = (\nabla^ {2} L) ^ {\dagger} \partial^ {2} (\nabla L) [ \Sigma_ {\|} ] - \partial \Phi \partial^ {2} (\nabla L) [ \mathcal {L} _ {\nabla^ {2} L} ^ {- 1} (\Sigma_ {\perp}) ] + 2 \partial \Phi \partial^ {2} (\nabla L) [ (\nabla^ {2} L) ^ {\dagger} \Sigma_ {\perp , \|} ]. \tag {9}
+$$
+
+# 4.3 MAIN RESULT
+
+Now we are ready to present our main result. It's a direct combination of Theorem B.9 and Lemma 4.5. Theorem 4.6. Suppose the loss function $L$ , the manifold of local minimizer $\Gamma$ and the open neighborhood $U$ satisfy Assumptions 3.1 and 3.2, and $x_{\eta}(0) = x(0) \in U$ for all $\eta > 0$ . If SDE (10) has a global solution $Y$ with $Y(0) = x(0)$ and $Y$ never leaves $U$ , i.e., $\mathbb{P}[Y(t) \in U, \forall t \geq 0] = 1$ , then for any $T > 0$ , $x_{\eta}(\lfloor T / \eta^2 \rfloor)$ converges in distribution to $Y(T)$ as $\eta \to 0$ .
+
+$$
+\begin{array}{l} \mathrm {d} Y (t) = \underbrace {\Sigma_ {\parallel} ^ {\frac {1}{2}} (Y) \mathrm {d} W (t)} _ {\text {T a n g e n t N o i s e}} + \underbrace {\frac {1}{2} \nabla^ {2} L (Y) ^ {\dagger} \partial^ {2} (\nabla L) (Y) [ \Sigma_ {\parallel} (Y) ] \mathrm {d} t} _ {\text {T a n g e n t N o i s e C o m p e n s a t i o n}} \tag {10} \\ + \frac {1}{2} \partial \Phi (Y) \left(\underbrace {\partial^ {2} (\nabla L) (Y) \left[ \nabla^ {2} L (Y) ^ {\dagger} \Sigma_ {\perp , \parallel} (Y) \right]} _ {\text {M i x e d R e g u l a r i z a t i o n}} - \underbrace {\partial^ {2} (\nabla L) (Y) \left[ \mathcal {L} _ {\nabla^ {2} L} ^ {- 1} (\Sigma_ {\perp} (Y)) \right]} _ {\text {N o r m a l R e g u l a r i z a t i o n}}\right) \mathrm {d} t, \\ \end{array}
+$$
+
+where $\Sigma \equiv \sigma \sigma^{\top}$ and $\Sigma_{\parallel},\Sigma_{\perp},\Sigma_{\perp ,\parallel}$ are defined in Lemma 4.5.
+
+Based on the above theorem, the limiting dynamics of SGD can be understood as follows: (a) the tangent noise, $\Sigma_{\parallel}^{1 / 2}(Y)\mathrm{d}W(t)$ , is preserved, and the second term of (10) can be viewed as the necessary tangent noise compensation for the limiting dynamics to stay on $\Gamma$ . Indeed, Lemma C.7 shows that the value of the second term only depends on $\Gamma$ itself, i.e., it's same for all loss $L$ which locally defines the same $\Gamma$ . (b) The noise in the normal space is killed since the limiting dynamics always stay on $\Gamma$ . However, its second order effect (Ito correction term) takes place as a vector field on $\Gamma$ , which induces the Noise Regularization and Mixed Regularization term, corresponding to the mixed and normal noise covariance respectively.
+
+Remark 4.7. In Appendix B.4 we indeed prove a stronger version of Theorem 4.6 that the sample paths of SGD converge in distribution, i.e., let $\tilde{x}_{\eta}(t) = x_{\eta}(\lfloor t / \eta^2 \rfloor)$ , then $\tilde{x}_{\eta}$ weakly converges to $Y$ on $[0, T]$ . Moreover, we only assume the existence of a global solution for ease of presentation. As long as there exists a compact $K \subseteq \Gamma$ such that $Y$ stays in $K$ on $[0, T]$ with high probability, Theorem B.9 still provides the convergence of SGD iterates (stopped at the boundary of $K$ ) before time $T$ with high probability.
+
+# 5 IMPLICATIONS AND EXAMPLES
+
+In this section, we derive the limiting dynamics for two notable noise types, where we fix the expected loss $L$ and the noise distribution, and only drive $\eta$ to 0. The proofs are deferred into Appendix C.3.
+
+Type I: Isotropic Noise. Isotropic noise means $\Sigma(x) \equiv I_D$ for any $x \in \Gamma$ (Shi et al., 2020). The following theorem shows that the limiting diffusion with isotropic noise can be viewed as a Brownian Motion plus Riemannian Gradient Flow with respect to the pseudo-determinant of $\nabla^2 L$ .
+
+Corollary 5.1 (Limiting Diffusion for Isotropic Noise). If $\Sigma \equiv I_D$ on $\Gamma$ , SDE (10) is then
+
+$$
+\mathrm {d} Y (t) = \underbrace {\partial \Phi (Y) \mathrm {d} W + \frac {1}{2} \nabla^ {2} L (Y) ^ {\dagger} \partial^ {2} (\nabla L) (Y) [ \partial \Phi (Y) ] \mathrm {d} t} _ {\text {B r o w n i a n M o t i o n o n M a n i f o l d}} - \underbrace {\frac {1}{2} \partial \Phi (Y) \nabla (\ln | \nabla^ {2} L (Y) | _ {+}) \mathrm {d} t} _ {\text {N o r m a l R e g u l a r i z a t i o n}} \tag {11}
+$$
+
+where $|\nabla^2 L(Y)|_+ = \lim_{\alpha \to 0} \frac{|\nabla^2 L(Y) + \alpha I_D|}{\alpha D - \operatorname{rank}(\nabla^2 L(Y))}$ is the pseudo-determinant of $\nabla^2 L(Y)$ . $|\nabla^2 L(Y)|_+$ is also equal to the sum of log of non-zero eigenvalue values of $\nabla^2 L(Y)$ .
+
+Type II: Label Noise. When doing SGD for $\ell_2$ -regression on dataset $\{(z_i, y_i)\}_{i=1}^n$ , adding label noise (Blanc et al., 2020; Damian et al., 2021) means replacing the true label at iteration $k$ , $y_{i_k}$ , by a fresh noisy label $\tilde{y}_{i_k} := y_{i_k} + \delta_k$ , where $\delta_k \stackrel{\text{i.i.d.}}{\sim} \text{Unif}\{-\delta, \delta\}$ for some constant $\delta > 0$ . Then the corresponding loss becomes $\frac{1}{2}(f_{i_k}(x) - \tilde{y}_{i_k})^2$ , where $f_{i_k}(x)$ is the output of the model with parameter $x$ on data $z_{i_k}$ . So the label noise SGD update is
+
+$$
+x _ {k + 1} = x _ {k} - \eta / 2 \cdot \nabla_ {x} \left(f _ {i _ {k}} (x _ {k}) - y _ {i _ {k}} + \delta_ {i _ {k}}\right) ^ {2} = x _ {k} - \eta \left(f _ {i _ {k}} (x _ {k}) - y _ {i _ {k}} + \delta_ {k}\right) \nabla_ {x} f _ {i _ {k}} (x _ {k}). \tag {12}
+$$
+
+Suppose the model can achieve the global minimum of the loss $L(x) \coloneqq \frac{1}{2}\mathbb{E}[(f_i(x) - \tilde{y}_i)^2]$ at $x_*$ , then the model must interpolate the whole dataset, i.e., $f_{i}(x_{*}) = y_{i}$ for all $i\in [n]$ , and thus here the manifold $\Gamma$ is a subset of $\{x\in \mathbb{R}^D\mid f_i(x) = y_i,\forall i\in [n]\}$ . Here the key property of the label noise used in previous works is $\Sigma (x) = \frac{\delta^2}{n}\sum_{i = 1}^{n}\nabla_xf_i(x)\nabla_xf_i(x)^\top = \delta^2\nabla^2 L(x)$ . Lately, Damian et al. (2021) further generalizes the analysis to other losses, e.g., logistic loss and exponential loss, as long as they satisfy $\Sigma (x) = c\nabla^{2}L(x)$ for some constant $c > 0$ .
+
+In sharp contrast to the delicate discrete-time analysis in Blanc et al. (2020) and Damian et al. (2021), the following corollary recovers the same result but with much simpler analysis – taking derivatives is all you need. Under our framework, we no longer need to do Taylor expansion manually nor carefully control the infinitesimal variables of different orders together. It is also worth mentioning that our framework immediately gives a global analysis of $\Theta (\eta^{-2})$ steps for SGD, far beyond the local coupling analysis in previous works. In Section 6, we will see how such global analysis allows us to prove a concrete generalization upper bound in a non-convex problem, the overparametrized linear model (Woodworth et al., 2020; HaoChen et al., 2020).
+
+Corollary 5.2 (Limiting Flow for Label Noise). If $\Sigma \equiv c\nabla^2 L$ on $\Gamma$ for some constant $c > 0$ , SDE (10) can be simplified into (13) where the regularization is from the noise in the normal space.
+
+$$
+\mathrm {d} Y (t) = - 1 / 4 \cdot \partial \Phi (Y (t)) \nabla \operatorname {t r} [ c \nabla^ {2} L (Y (t)) ] \mathrm {d} t. \tag {13}
+$$
+
+# 6 PROVABLE GENERALIZATION BENEFIT WITH LABEL NOISE
+
+In this section, we show provable benefit of label noise in generalization using our framework (Theorem B.7) in a concrete setting, the overparametrized linear models (OLM) (Woodworth et al., 2020). While the existing implicit regularization results for Gradient Flow often relates the generalization quality to initialization, e.g., Woodworth et al. (2020) shows that for OLM, small initialization corresponds to the rich regime and prefers solutions with small $\ell_1$ norm while large initialization corresponds to the kernel regime and prefers solutions with small $\ell_2$ norm, our result Theorem 6.1 surprisingly proves that even if an OLM is initialized in the kernel regime, label noise SGD can still help it escape and then enter the rich regime by minimizing its weighted $\ell_1$ norm. When the groundtruth is $\kappa$ -sparse, this provides a $\widetilde{O}(\kappa \ln d)$ vs $\Omega(d)$ sample complexity separation between SGD with label noise and GD when both initialized in the kernel regime. Here $d$ is the dimension of the groundtruth. The lower bound for GD in the kernel regime is folklore, but for completeness, we state the result as Theorem 6.7 in Section 6.3 and append its proof in Appendix D.6.
+
+Theorem 6.1. In the setting of OLM, suppose the groundtruth is $\kappa$ -sparse and $n \geq \Omega(\kappa \ln d)$ training data are sampled from either i.i.d. Gaussian or Boolean distribution. Then for any initialization $x_{init}$ (except a zero-measure set) and any $\epsilon > 0$ , there exist $\eta_0, T > 0$ such that for any $\eta < \eta_0$ , OLM trained with label noise SGD (12) with LR equal to $\eta$ for $\lfloor T / \eta^2 \rfloor$ steps returns an $\epsilon$ -optimal solution, with probability of $1 - e^{-\Omega(n)}$ over the randomness of the training dataset.
+
+The proof roadmap of Theorem 6.1 is the following:
+
+1. Show Assumption 3.1 is satisfied, i.e., the set of local minimizers, $\Gamma$ , is indeed a manifold and the hessian $\nabla^2 L(x)$ is non-degenerate on $\Gamma$ (by Lemma 6.2);
+2. Show Assumption 3.2 is satisfied, i.e., $\Phi (U)\subset \Gamma$ (by Lemma 6.3);
+3. Show the limiting flow (13) converges to the minimizer of the regularizer (by Lemma 6.5);
+4. Show the minimizer of the regularizer recovers the groundtruth (by Lemma 6.6).
+
+Our setting is more general than HaoChen et al. (2020), which assumes $w^{*} \in \{0,1\}^{d}$ and their reparametrization can only express positive linear functions, i.e., $w = u^{\odot 2}$ . Their $\widetilde{O}(\kappa^2)$ rate is achieved with a delicate three phase LR schedule, while our $O(\kappa \ln d)$ rate only uses a constant LR.
+
+Setting: Let $\{(z_i, y_i)\}_{i \in [n]}$ be the training dataset where $z_1, \ldots, z_n \stackrel{\text{i.i.d.}}{\sim} \operatorname{Unif}(\{\pm 1\}^d)$ or $\mathcal{N}(0, I_d)$ and each $y_i = \langle z_i, w^* \rangle$ for some unknown $w^* \in \mathbb{R}^d$ . We assume that $w^*$ is $\kappa$ -sparse for some $\kappa < d$ . Denote $x = \binom{u}{v} \in \mathbb{R}^D = \mathbb{R}^{2d}$ , and we will use $x$ and $(u, v)$ exchangeably as the parameter of functions defined on $\mathbb{R}^D$ in the sequel. For each $i \in [n]$ , define $f_i(x) = f_i(u, v) = z_i^\top (u^{\odot 2} - v^{\odot 2})$ . Then we fit $\{(z_i, y_i)\}_{i \in [n]}$ with an overparametrized model through the following loss function:
+
+$$
+L (x) = L (u, v) = \frac {1}{n} \sum_ {i = 1} ^ {n} \ell_ {i} (u, v), \quad \text {w h e r e} \ell_ {i} (u, v) = \frac {1}{2} \left(f _ {i} (u, v) - y _ {i}\right) ^ {2}. \tag {14}
+$$
+
+It is straightforward to verify that $\nabla^2 L(x) = \frac{4}{n}\sum_{i=1}^{n}\binom{z_i\odot u}{-z_i\odot v}\binom{z_i\odot u}{-z_i\odot v}^\top$ , $\forall x \in \Gamma$ . For simplicity, we define $Z = (z_1,\ldots,z_n)^\top \in \mathbb{R}^{n\times d}$ and $Y = (y_1,\ldots,y_n)^\top \in \mathbb{R}^n$ . Consider the following manifold:
+
+$$
+\Gamma = \left\{x = \left(u ^ {\top}, v ^ {\top}\right) ^ {\top} \in U: Z \left(u ^ {\odot 2} - v ^ {\odot 2}\right) = Y \right\}, \quad \text {w h e r e} U = \left(\mathbb {R} \backslash \{0 \}\right) ^ {D}. \tag {15}
+$$
+
+We verify that the above loss function $L$ and manifold $\Gamma$ satisfy Assumption 3.1 by Lemma 6.2, and that the neighborhood $U$ and $\Gamma$ satisfy Assumption 3.2 by Lemma 6.3.
+
+Lemma 6.2. Consider the loss $L$ defined in (14) and manifold $\Gamma$ defined in (15). If data is full rank, i.e., $\operatorname{rank}(Z) = n$ , then it holds that (a). $\Gamma$ is a smooth manifold of dimension $D - n$ ; (b). $\operatorname{rank}(\nabla^2 L(x)) = n$ for all $x \in \Gamma$ . In particular, $\operatorname{rank}(Z) = n$ holds with probability 1 for Gaussian distribution and with probability $1 - c^d$ for Boolean distribution for some constant $c \in (0,1)$ .
+
+Lemma 6.3. Consider the loss function $L$ defined in (14), manifold $\Gamma$ and its open neighborhood defined in (15). For gradient flow $\frac{\mathrm{d}x_t}{\mathrm{d}t} = -\nabla L(x_t)$ starting at any $x_0 \in U$ , it holds that $\Phi(x_0) \in \Gamma$ .
+
+Remark 6.4. In previous works (Woodworth et al., 2020; Azulay et al., 2021), the convergence of gradient flow is only assumed. Recently Pesme et al. (2021) proved it for a specific initialization, i.e., $u_{j} = v_{j} = \alpha, \forall j \in [n]$ for some $\alpha > 0$ . Lemma 6.3 completely removes the technical assumption.
+
+Therefore, by the result in the previous section, the implicit regularizer on the manifold is $R(x) = \operatorname{tr}(\Sigma(x)) = \operatorname{tr}(\delta^2\nabla^2 L(x))$ . Without loss of generality, we take $\delta = 1$ . Hence, it follows that
+
+$$
+R (x) = \frac {4}{n} \sum_ {j = 1} ^ {D} \left(\sum_ {i = 1} ^ {n} z _ {i, j} ^ {2}\right) \left(u _ {j} ^ {2} + v _ {j} ^ {2}\right). \tag {16}
+$$
+
+The limiting behavior of label noise SGD is described by a Riemannian gradient flow on $\Gamma$ as follows:
+
+$$
+\mathrm {d} x _ {t} = - 1 / 4 \cdot \partial \Phi (x _ {t}) \nabla R (x _ {t}) \mathrm {d} t, \text {w i t h} x _ {0} = \Phi (x _ {\text {i n i t}}) \in \Gamma . \tag {17}
+$$
+
+The goal is to show that the above limiting flow will converge to the underlying groundtruth $x^{*} = \binom{u^{*}}{v^{*}}$ where $(u^{*}, v^{*}) = ([w^{*}]_{+}^{\odot 1/2}, [-w^{*}]_{+}^{\odot 1/2})$ .
+
+# 6.1 LIMITING FLOW CONVERGES TO MINIMIZERS OF REGULARIZER
+
+In this subsection we show limiting flow (13) starting from anywhere on $\Gamma$ converges to the minimizer of regularizer $R$ (by Lemma 6.5). The proof contains two parts: (a) the limiting flow converges; (b) the limit point of the flow cannot be sub-optimal stationary points. These are indeed the most technical and difficult parts of proving the $O(\kappa \ln d)$ upper bound, where the difficulty comes from the fact that the manifold $\Gamma$ is not compact, and the stationary points of the limiting flow are in fact all located on the boundary of $\Gamma$ . However, the limiting flow itself is not even defined on the boundary of the manifold $\Gamma$ . Even if we can extend $\partial \Phi(\cdot) \nabla R(\cdot)$ continuously to entire $\mathbb{R}^D$ , the continuous extension is not everywhere differentiable.
+
+Thus the non-compactness of $\Gamma$ brings challenges for both (a) and (b). For (a), the convergence for standard gradient flow is often for free, as long as the trajectory is bounded and the objective is
+
+analytic or smooth and semialgebraic. The latter ensures the so-called Kurdyka-Łojasiewicz (KL) inequality (Lojasiewicz, 1963), which implies finite trajectory length and thus the convergence. However, since our flow does not satisfy those nice properties, we have to show that the limiting flow satisfies Polyak-Łojasiewicz condition (a special case of KL condition) (Polyak, 1964) via careful calculation (by Lemma D.16).
+
+For (b), the standard analysis based on center stable manifold theorem shows that gradient descent/flow converges to strict saddle (stationary point with at least one negative eigenvalue in hessian) only for a zero-measure set of initialization (Lee et al., 2016; 2017). However, such analyses cannot deal with the case where the flow is not differentiable at the sub-optimal stationary point. To circumvent this issue, we prove the non-convergence to sub-optimal stationary points with a novel approach: we show that for any stationary point $x$ , whenever there exists a descent direction of the regularizer $R$ at $x$ , we can construct a potential function which increases monotonically along the flow around $x$ , while the potential function is equal to $-\infty$ at $x$ , leading to a contradiction. (See proof of Lemma 6.5.)
+
+Lemma 6.5. Let $\{x_{t}\}_{t\geq 0} \subseteq \mathbb{R}^{D}$ be generated by the flow defined in (17) with any initialization $x_0 \in \Gamma$ . Then $x_{\infty} = \lim_{t\to \infty}x_{t}$ exists. Moreover, $x_{\infty} = x^{*}$ is the optimal solution of (18).
+
+# 6.2 MINIMIZER OF THE REGULARIZER RECOVERS THE SPARSE GROUNDTRUTH
+
+Note $\frac{1}{n}\sum_{i = 1}^{n}z_{i,j}^2 = 1$ when $z_{i,j}\stackrel {iid}{\sim}\mathrm{Unif}\{-1,1\}$ , and we can show minimizing $R(x)$ on $\Gamma$ , (18), is equivalent to finding the minimum $\ell_1$ norm solution of Equation (14). Standard results in sparse recovery imply that minimum $\ell_1$ norm solution recovers with the sparse groundtruth. The gaussian case is more complicated but still can be proved with techniques from Tropp (2015).
+
+$$
+\text {m i n i m i z e} R (x) = \frac {4}{n} \sum_ {j = 1} ^ {d} \left(\sum_ {i = 1} ^ {n} z _ {i, j} ^ {2}\right) \left(u _ {j} ^ {2} + v _ {j} ^ {2}\right), \tag {18}
+$$
+
+$$
+\text {s u b j e c t} Z \left(u ^ {\odot 2} - v ^ {\odot 2}\right) = Z w ^ {*}.
+$$
+
+Lemma 6.6. Let $z_1, \ldots, z_n \stackrel{i.i.d.}{\sim} \mathrm{Unif}(\{\pm 1\}^d)$ or $\mathcal{N}(0, I_d)$ . Then there exist some constants $C, c > 0$ such that if $n \geq C\kappa \ln d$ , then with probability at least $1 - e^{-cn}$ , the optimal solution of (18), $(\hat{u}, \hat{v})$ , is unique up to sign flips of each coordinate and recovers the groundtruth, i.e., $\hat{u}^{\odot 2} - \hat{v}^{\odot 2} = w^{*}$ .
+
+# 6.3 LOWER BOUND FOR GRADIENT DESCENT IN THE KERNEL REGIME
+
+In this subsection we show GD needs at least $\Omega(d)$ samples to learn OLM, when initialized in the kernel regime. This lower bound holds for all learning rate schedules and numbers of steps. This is in sharp contrast to the $\widetilde{O}(\kappa \ln d)$ sample complexity upper bound of SGD with label noise. Following the setting of kernel regime in (Woodworth et al., 2020), we consider the limit of $u_0 = v_0 = \alpha \mathbb{1}$ , with $\alpha \to \infty$ . It holds that $f_i(u_0, v_0) = 0$ and $\nabla f_i(u_0, v_0) = [\alpha z_i, -\alpha z_i]$ for each $i \in [n]$ . Standard convergence analysis for NTK (Neural Tangent Kernel, Jacot et al. (2018)) shows that upon convergence, the distance traveled by parameter converges to 0, and thus the learned model shall converge in function space, so is the generalization performance. For ease of illustration, we directly consider the lower bound for test loss when the NTK is fixed throughout the training.
+
+Theorem 6.7. Assume $z_{1},\ldots ,z_{n}\stackrel {i.i.d.}{\sim}\mathcal{N}(0,I_{d})$ and $y_{i} = z_{i}^{\top}w^{*}$ , for all $i\in [n]$ . Define the loss with linearized model as $L(x) = \sum_{i = 1}^{n}(f_{i}(x_{0}) + \langle \nabla f_{i}(x_{0}),x - x_{0}\rangle -y_{i})^{2}$ , where $x = \binom{u}{v}$ and $x_0 = \binom{u_0}{v_0} = \alpha \binom{\mathbb{1}}{\mathbb{1}}$ . Then for any groundtruth $w^{*}$ , any learning rate schedule $\{\eta_t\}_{t\geq 1}$ , and any fixed number of steps $T$ , the expected $\ell_2$ loss of $x(T)$ is at least $(1 - \frac{n}{d})\| w^{*}\|_{2}^{2}$ , where $x(T)$ is the $T$ -th iterate of $GD$ on $L$ , i.e., $x(t + 1) = x(t) - \eta_t\nabla L(x(t))$ , for all $t\geq 0$ .
+
+# 7 CONCLUSION AND FUTURE WORK
+
+We propose a mathematical framework to study the implicit bias of SGD with infinitesimal LR. We show that with arbitrary noise covariance, $\Theta (\eta^{-2})$ steps of SGD converge to a limiting diffusion on certain manifold of local minimizer, as the LR $\eta \rightarrow 0$ . For specific noise types, this allows us to recover and strengthen results regarding implicit bias in previous works with much simpler analysis. In particular, we show a sample complexity gap between label noise SGD and GD in the kernel regime for a overparametrized linear model, justifying the generalization benefit of SGD. For the future work, we believe our framework can be applied to analyze the implicit bias of SGD in more complex models towards better understanding of the algorithmic regularization induced by stochasticity. It will be valuable to extend our method to other stochastic optimization algorithms, e.g., ADAM, SGD with momentum.
+
+# ACKNOWLEDGEMENT
+
+We thank Yangyang Li for pointing us to Katzenberger (1991). We also thank Wei Zhan and Jason Lee for helpful discussions.
+
+The authors acknowledge support from NSF, ONR, Simons Foundation, Schmidt Foundation, Mozilla Research, Amazon Research, DARPA and SRC. ZL is also supported by Microsoft Research PhD Fellowship.
+
+# REFERENCES
+
+Zeyuan Allen-Zhu, Yuzhhi Li, and Yingyu Liang. Learning and generalization in overparameterized neural networks, going beyond two layers. Advances in neural information processing systems, 2019a.
+Zeyuan Allen-Zhu, Yanzhi Li, and Zhao Song. A convergence theory for deep learning via overparameterization. In International Conference on Machine Learning, pp. 242-252. PMLR, 2019b.
+Sanjeev Arora, Nadav Cohen, and Elad Hazan. On the optimization of deep networks: Implicit acceleration by overparameterization. In International Conference on Machine Learning, pp. 244-253. PMLR, 2018.
+Sanjeev Arora, Nadav Cohen, Wei Hu, and Yuping Luo. Implicit regularization in deep matrix factorization. arXiv preprint arXiv:1905.13655, 2019a.
+Sanjeev Arora, Simon Du, Wei Hu, Zhiyuan Li, and Ruosong Wang. Fine-grained analysis of optimization and generalization for overparameterized two-layer neural networks. In International Conference on Machine Learning, pp. 322-332. PMLR, 2019b.
+Shahar Azulay, Edward Moroshko, Mor Shpigel Nacson, Blake Woodworth, Nathan Srebro, Amir Globerson, and Daniel Soudry. On the implicit bias of initialization shape: Beyond infinitesimal mirror descent. arXiv preprint arXiv:2102.09769, 2021.
+Augustin Banyaga and David Hurtubise. *Lectures on Morse homology*, volume 29. Springer Science & Business Media, 2013.
+Patrick Billingsley. Convergence of probability measures. John Wiley & Sons, 2013.
+Guy Blanc, Neha Gupta, Gregory Valiant, and Paul Valiant. Implicit regularization for deep neural networks driven by an Ornstein-uhlenbeck like process. In Conference on learning theory, pp. 483-513. PMLR, 2020.
+Xiang Cheng, Dong Yin, Peter Bartlett, and Michael Jordan. Stochastic gradient and Langevin processes. In International Conference on Machine Learning, pp. 1810-1819. PMLR, 2020.
+Lenaic Chizat, Edouard Oyallon, and Francis Bach. On lazy training in differentiable programming. arXiv preprint arXiv:1812.07956, 2018.
+Y Cooper. The critical locus of overparameterized neural networks. arXiv preprint arXiv:2005.04210, 2020.
+Yaim Cooper. The loss landscape of overparameterized neural networks. arXiv preprint arXiv:1804.10200, 2018.
+Alex Damian, Tengyu Ma, and Jason Lee. Label noise sgd provably prefers flat global minimizers. arXiv preprint arXiv:2106.06530, 2021.
+Amit Daniely. Sgd learns the conjugate kernel class of the network. arXiv preprint arXiv:1702.08503, 2017.
+Manfredo P Do Carmo. Riemannian geometry. Springer Science & Business Media, 2013.
+
+Felix Draxler, Kambis Veschgini, Manfred Salmhofer, and Fred Hamprecht. Essentially no barriers in neural network energy landscape. In International conference on machine learning, pp. 1309-1318. PMLR, 2018.
+Simon Du, Jason Lee, Haochuan Li, Liwei Wang, and Xiyu Zhai. Gradient descent finds global minima of deep neural networks. In International Conference on Machine Learning, pp. 1675-1685. PMLR, 2019.
+Simon S Du, Xiyu Zhai, Barnabas Poczos, and Aarti Singh. Gradient descent provably optimizes over-parameterized neural networks. arXiv preprint arXiv:1810.02054, 2018.
+K. J. Falconer. Differentiation of the limit mapping in a dynamical system. Journal of the London Mathematical Society, s2-27(2):356-372, 1983. ISSN 0024-6107. doi: 10.1112/jlms/s2-27.2.356.
+Jianqing Fan, Zhuoran Yang, and Mengxin Yu. Understanding implicit regularization in overparameterized nonlinear statistical model. arXiv preprint arXiv:2007.08322, 2020.
+Benjamin Fehrman, Benjamin Gess, and Arnulf Jentzen. Convergence rates for the stochastic gradient descent method for non-convex objective functions. Journal of Machine Learning Research, 21, 2020.
+C Daniel Freeman and Joan Bruna. Topology and geometry of half-rectified network optimization. arXiv preprint arXiv:1611.01540, 2016.
+Timur Garipov, Pavel Izmailov, Dmitrii Podoprikhin, Dmitry Vetrov, and Andrew Gordon Wilson. Loss surfaces, mode connectivity, and fast ensembling of dnns. arXiv preprint arXiv:1802.10026, 2018.
+Priya Goyal, Piotr Dálár, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, Andrew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch sgd: Training imagenet in 1 hour. arXiv preprint arXiv:1706.02677, 2017.
+Suriya Gunasekar, Jason Lee, Daniel Soudry, and Nathan Srebro. Characterizing implicit bias in terms of optimization geometry. In International Conference on Machine Learning, pp. 1832-1841. PMLR, 2018a.
+Suriya Gunasekar, Blake Woodworth, Srinadh Bhojanapalli, Behnam Neyshabur, and Nathan Srebro. Implicit regularization in matrix factorization. In 2018 Information Theory and Applications Workshop (ITA), pp. 1-10. IEEE, 2018b.
+Jeff Z HaoChen, Colin Wei, Jason D Lee, and Tengyu Ma. Shape matters: Understanding the implicit bias of the noise covariance. arXiv preprint arXiv:2006.08680, 2020.
+Elad Hoffer, Itay Hubara, and Daniel Soudry. Train longer, generalize better: closing the generalization gap in large batch training of neural networks. arXiv preprint arXiv:1705.08741, 2017.
+Andrew Holbrook. Differentiating the pseudo determinant. Linear Algebra and its Applications, 548: 293-304, 2018.
+Elton P Hsu. Stochastic analysis on manifolds. Number 38. American Mathematical Soc., 2002.
+Arthur Jacot, Franck Gabriel, and Clément Hongler. Neural tangent kernel: Convergence and generalization in neural networks. arXiv preprint arXiv:1806.07572, 2018.
+Stanislaw Jastrzebski, Zachary Kenton, Devansh Arpit, Nicolas Ballas, Asja Fischer, Yoshua Bengio, and Amos Storkey. Three factors influencing minima in sgd. arXiv preprint arXiv:1711.04623, 2017.
+Jeff Kahn, János Komlós, and Endre Szemerédi. On the probability that a random $\pm 1$ -matrix is singular. Journal of the American Mathematical Society, 8(1):223-240, 1995.
+Ioannis Karatzas and Steven Shreve. Brownian motion and stochastic calculus, volume 113. springer, 2014.
+
+Gary Shon Katzenberger. Solutions of a stochastic differential equation forced onto a manifold by a large drift. The Annals of Probability, pp. 1587-1628, 1991.
+Nitish Shirish Keskar, Dheevatsa Mudigere, Jorge Nocedal, Mikhail Smelyanskiy, and Ping Tak Peter Tang. On large-batch training for deep learning: Generalization gap and sharp minima. arXiv preprint arXiv:1609.04836, 2016.
+Alex Krizhevsky. One weird trick for parallelizing convolutional neural networks. arXiv preprint arXiv:1404.5997, 2014.
+Rohith Kuditipudi, Xiang Wang, Holden Lee, Yi Zhang, Zhiyuan Li, Wei Hu, Sanjeev Arora, and Rong Ge. Explaining landscape connectivity of low-cost solutions for multilayer nets. arXiv preprint arXiv:1906.06247, 2019.
+Yann A LeCun, Léon Bottou, Genevieve B Orr, and Klaus-Robert Müller. Efficient backprop. In Neural networks: Tricks of the trade, pp. 9-48. Springer, 2012.
+Jason D Lee, Max Simchowitz, Michael I Jordan, and Benjamin Recht. Gradient descent only converges to minimizers. In Conference on learning theory, pp. 1246-1257. PMLR, 2016.
+Jason D Lee, Ioannis Panageas, Georgios Piliouras, Max Simchowitz, Michael I Jordan, and Benjamin Recht. First-order methods almost always avoid saddle points. arXiv preprint arXiv:1710.07406, 2017.
+Jian Li, Xuanyuan Luo, and Mingda Qiao. On generalization error bounds of noisy gradient methods for non-convex learning. arXiv preprint arXiv:1902.00621, 2019a.
+Qianxiao Li, Cheng Tai, and E Weinan. Stochastic modified equations and adaptive stochastic gradient algorithms. In International Conference on Machine Learning, pp. 2101-2110. PMLR, 2017.
+Qianxiao Li, Cheng Tai, and E Weinan. Stochastic modified equations and dynamics of stochastic gradient algorithms i: Mathematical foundations. The Journal of Machine Learning Research, 20 (1):1474-1520, 2019b.
+Yuanzhi Li and Yingyu Liang. Learning overparameterized neural networks via stochastic gradient descent on structured data. arXiv preprint arXiv:1808.01204, 2018.
+Yuanzhi Li, Tengyu Ma, and Hongyang Zhang. Algorithmic regularization in over-parameterized matrix sensing and neural networks with quadratic activations. In Conference On Learning Theory, pp. 2-47. PMLR, 2018.
+Yuanzhi Li, Colin Wei, and Tengyu Ma. Towards explaining the regularization effect of initial large learning rate in training neural networks. arXiv preprint arXiv:1907.04595, 2019c.
+Zhiyuan Li, Yuping Luo, and Kaifeng Lyu. Towards resolving the implicit bias of gradient descent for matrix factorization: Greedy low-rank learning. In International Conference on Learning Representations, 2020a.
+Zhiyuan Li, Kaifeng Lyu, and Sanjeev Arora. Reconciling modern deep learning with traditional optimization analyses: The intrinsic learning rate. Advances in Neural Information Processing Systems, 33, 2020b.
+Zhiyuan Li, Yi Zhang, and Sanjeev Arora. Why are convolutional nets more sample-efficient than fully-connected nets? arXiv preprint arXiv:2010.08515, 2020c.
+Zhiyuan Li, Sadhika Malladi, and Sanjeev Arora. On the validity of modeling sgd with stochastic differential equations (sdes). arXiv preprint arXiv:2102.12470, 2021.
+Shiyu Liang, Ruoyu Sun, Yixuan Li, and Rayadurgam Srikant. Understanding the loss surface of neural networks for binary classification. In International Conference on Machine Learning, pp. 2835-2843. PMLR, 2018.
+Stanislaw Lojasiewicz. A topological property of real analytic subsets. Coll. du CNRS, Les équations aux dérivées partielles, 117(87-89):2, 1963.
+
+Kaifeng Lyu and Jian Li. Gradient descent maximizes the margin of homogeneous neural networks. arXiv preprint arXiv:1906.05890, 2019.
+Andrew Y Ng. Feature selection, 11 vs. 12 regularization, and rotational invariance. In Proceedings of the twenty-first international conference on Machine learning, pp. 78, 2004.
+Quynh Nguyen. On connected sublevel sets in deep learning. In International Conference on Machine Learning, pp. 4790-4799. PMLR, 2019.
+Quynh Nguyen, Mahesh Chandra Mukkamala, and Matthias Hein. On the loss landscape of a class of deep neural networks with no bad local valleys. arXiv preprint arXiv:1809.10749, 2018.
+Lawrence M. Perko. Differential equations and dynamical systems. 2001.
+Scott Pesme, Loucas Pillaud-Vivien, and Nicolas Flammarion. Implicit bias of sgd for diagonal linear networks: a provable benefit of stochasticity. arXiv preprint arXiv:2106.09524, 2021.
+David Pollard. Convergence of stochastic processes. Springer Science & Business Media, 2012.
+Boris T Polyak. Gradient methods for solving equations and inequalities. USSR Computational Mathematics and Mathematical Physics, 4(6):17-32, 1964.
+Garvesh Raskutti, Martin J Wainwright, and Bin Yu. Minimax-optimal rates for sparse additive models over kernel classes via convex programming. Journal of machine learning research, 13(2), 2012.
+Bin Shi, Weijie J Su, and Michael I Jordan. On learning rates and schr\” odinger operators. arXiv preprint arXiv:2004.06977, 2020.
+Daniel Soudry, Elad Hoffer, Mor Shpigel Nacson, Suriya Gunasekar, and Nathan Srebro. The implicit bias of gradient descent on separable data. *The Journal of Machine Learning Research*, 19(1): 2822-2878, 2018.
+Joel A Tropp. Convex recovery of a structured signal from independent random linear measurements. In Sampling Theory, a Renaissance, pp. 67-101. Springer, 2015.
+Tomas Vaskevicius, Varun Kanade, and Patrick Rebeschini. Implicit regularization for optimal sparse recovery. Advances in Neural Information Processing Systems, 32:2972-2983, 2019.
+Luca Venturi, Afonso S Bandeira, and Joan Bruna. Spurious valleys in two-layer neural network optimization landscapes. arXiv preprint arXiv:1802.06384, 2018.
+Yeming Wen, Kevin Luk, Maxime Gazeau, Guodong Zhang, Harris Chan, and Jimmy Ba. Interplay between optimization and generalization of stochastic gradient descent with covariance noise. arXiv preprint arXiv:1902.08234, 2019.
+Ward Whitt. Stochastic-process limits: an introduction to stochastic-process limits and their application to queues. Springer Science & Business Media, 2002.
+Stephan Wojtowytsch. Stochastic gradient descent with noise of machine learning type. part ii: Continuous time analysis. arXiv preprint arXiv:2106.02588, 2021.
+Blake Woodworth, Suriya Gunasekar, Jason D Lee, Edward Moroshko, Pedro Savarese, Itay Golan, Daniel Soudry, and Nathan Srebro. Kernel and rich regimes in overparametrized models. In Conference on Learning Theory, pp. 3635-3673. PMLR, 2020.
+Jingfeng Wu, Wenqing Hu, Haoyi Xiong, Jun Huan, Vladimir Braverman, and Zhanxing Zhu. On the noisy gradient descent that generalizes as sgd. In International Conference on Machine Learning, pp. 10367-10376. PMLR, 2020.
+Zeke Xie, Issei Sato, and Masashi Sugiyama. A diffusion theory for deep learning dynamics: Stochastic gradient descent escapes from sharp minima exponentially fast. arXiv preprint arXiv:2002.03495, 2020.
+
+Greg Yang. Scaling limits of wide neural networks with weight sharing: Gaussian process behavior, gradient independence, and neural tangent kernel derivation. arXiv preprint arXiv:1902.04760, 2019.
+Peng Zhao, Yun Yang, and Qiao-Chu He. Implicit regularization via hadamard product overparametrization in high-dimensional linear regression. arXiv preprint arXiv:1903.09367, 2019.
+Zhanxing Zhu, Jingfeng Wu, Bing Yu, Lei Wu, and Jinwen Ma. The anisotropic noise in stochastic gradient descent: Its behavior of escaping from sharp minima and regularization effects. arXiv preprint arXiv:1803.00195, 2018.
+Difan Zou, Yuan Cao, Dongruo Zhou, and Quanquan Gu. Gradient descent optimizes overparameterized deep relu networks. Machine Learning, 109(3):467-492, 2020.
+
+# A PRELIMINARIES ON STOCHASTIC PROCESSES
+
+We first clarify the notations in this paper. For any integer $k$ , we denote $\mathcal{C}^k$ as the set of the $k$ times continuously differentiable functions. We denote $a \wedge b = \min \{a, b\}$ . For any vector $u, v$ and $\alpha \in \mathbb{R}$ , we define $[u \odot v]_i = u_i v_i$ and $[v^{\odot \alpha}]_i = v_i^\alpha$ . For any matrix $A$ , we denote its pseudo inverse by $A^\dagger$ . For mapping $F: \mathbb{R}^D \to \mathbb{R}^D$ , we denote the Jacobian of $F$ at $x$ by $\partial F(x) \in \mathbb{R}^{D \times D}$ where the $(i,j)$ -th entry is $\partial_j F_i(x)$ . We also use $\partial F(x)[u]$ and $\partial^2 F(x)[u,v]$ to denote the first and second order directional derivative of $F$ at $x$ along the derivation of $u$ (and $v$ ). We abuse the notation of $\partial^2 F$ by viewing it a linear mapping defined on $\mathbb{R}^D \otimes \mathbb{R}^D \cong \mathbb{R}^{D^2}$ , in the sense that $\partial^2 F(x)[\Sigma] = \sum_{i,j=1}^{D} \partial^2 F(x)[e_i,e_j]\Sigma_{ij}$ , for any $\Sigma \in \mathbb{R}^{D \times D}$ . For any submanifold $\Gamma \subset \mathbb{R}^D$ and $x \in \Gamma$ , we denote by $T_x(\Gamma)$ the tangent space of $\Gamma$ at $x$ and $T_x^\perp(\Gamma)$ the normal space of $\Gamma$ at $x$ .
+
+Next, we review a few basics of stochastic processes that will be useful for proving our results, so that our paper will be self-contained. We refer the reader to classics like Karatzas & Shreve (2014); Billingsley (2013); Pollard (2012) for more systematic derivations.
+
+Throughout the rest of this section, let $\mathcal{E}$ be a Banach space equipped with norm $\| \cdot \|$ , e.g., $(\mathbb{R},|\cdot |)$ and $(\mathbb{R}^D,\| \cdot \| _2)$ .
+
+# A.1 CADLAGFUNCTION AND METRIC
+
+Definition A.1 (Càdlàgfunction). Let $T \in [0, \infty]$ . A function $g: [0, T) \to E$ is càdlàg if for all $t \in [0, T)$ it is right-continuous at $t$ and its left limit $g(t-)$ exists. Let $\mathcal{D}_{\mathcal{E}}[0, T)$ be the set of all càdlàg function mapping $[0, T)$ into $\mathcal{E}$ . We also use $\mathcal{D}_{\mathcal{E}}[0, T)$ to denote the set of all continuous function mapping $[0, T)$ into $\mathcal{E}$ . By definition, $\mathcal{C}_{\mathcal{E}}[0, T) \subset \mathcal{D}_{\mathcal{E}}[0, T)$ .
+
+Definition A.2 (Continuity modulus). For any function $f:[0,\infty) \to \mathcal{E}$ and any interval $I \subseteq [0,\infty)$ , we define
+
+$$
+\omega (f; I) = \sup _ {s, t \in I} \| f (s) - f (t) \|.
+$$
+
+For any $N \in \mathbb{N}$ and $\theta > 0$ , we further define the continuity modulus of continuous $f$ as
+
+$$
+\omega_ {N} (f, \theta) = \sup _ {0 \leq t \leq t + \theta \leq N} \{\omega (f; [ t, t + \theta ]) \}.
+$$
+
+Moreover, the continuity modulus of $\operatorname{càdlàg} f \in \mathcal{D}_{\mathcal{E}}[0, \infty)$ is defined as
+
+$$
+\omega_ {N} ^ {\prime} (f, \theta) = \inf \left\{\max _ {i \leq r} \omega (f; [ t _ {i - 1}, t _ {i}): 0 \leq t _ {0} < \dots < t _ {r} = N, \inf _ {i < r} (t _ {i} - t _ {i - 1}) \geq \theta \right\}.
+$$
+
+Definition A.3 (Jump). For any $g \in \mathcal{D}_{\mathcal{E}}[0, T)$ , we define the jump of $g$ at $t$ to be
+
+$$
+\Delta g (t) = g (t) - g (t -).
+$$
+
+For any $\delta > 0$ , we define $h_{\delta}:[0,\infty) \to [0,\infty)$ by
+
+$$
+h _ {\delta} (r) = \left\{ \begin{array}{l l} 0 & \text {i f} r \leq \delta \\ 1 - \delta / r & \text {i f} r \geq \delta \end{array} \right..
+$$
+
+We then further define $J_{\delta}:\mathcal{D}_{\mathbb{R}^D}[0,\infty)\to \mathcal{D}_{\mathbb{R}^D}[0,\infty)$ (Katzenberger, 1991) as
+
+$$
+J _ {\delta} (g) (t) = \sum_ {0 < s \leq t} h _ {\delta} (\| \Delta g (s) \|) \Delta g (s). \tag {19}
+$$
+
+Definition A.4 (Skorohod metric on $\mathcal{D}_{\mathcal{E}}[0,\infty)$ ). For each finite $T > 0$ and each pair of functions $f,g\in \mathcal{D}_{\mathcal{E}}[0,\infty)$ , define $d_{T}(f,g)$ as the infimum of all those values of $\delta$ for which there exist grids $0\leq t_0 < t_1 < \dots < t_m$ and $0 < s_0 < s_1 < \dots < s_m$ , with $t_k,s_k\geq T$ , such that $|t_i - s_i|\leq \delta$ for $i = 0,\ldots ,k$ , and
+
+$$
+\left\| f (t) - g (s) \right\| \leq \delta \quad \text {i f} (t, s) \in \left[ t _ {i}, t _ {i + 1}\right) \times \left[ s _ {i}, s _ {i + 1}\right)
+$$
+
+for $i = 0,\dots ,k - 1$ . The Skorohod metric on $\mathcal{D}_{\mathcal{E}}[0,\infty)$ is defined to be
+
+$$
+d (f, g) = \sum_ {T = 1} ^ {\infty} 2 ^ {- T} \min \{1, d _ {T} (f, g) \}.
+$$
+
+# A.2 STOCHASTIC PROCESSES AND STOCHASTIC INTEGRAL
+
+Let $(\Omega, \mathcal{F}, \{\mathcal{F}_t\}_{t \geq 0}, \mathbb{P})$ be a filtered probability space.
+
+Definition A.5 (Cross variation). Let $X$ and $Y$ be two $\{\mathcal{F}_t\}_{t \geq 0}$ -adapted stochastic processes such that $X$ has sample paths in $\mathcal{D}_{\mathbb{R}^{D \times e}}[0, \infty)$ and $Y$ has samples paths in $\mathcal{D}_{\mathbb{R}^e}[0, \infty)$ , then the cross variation of $X$ and $Y$ on $(0, t]$ , denoted by $[X, Y](t)$ , is defined to be the limit of
+
+$$
+\sum_ {i = 0} ^ {m - 1} \left(X \left(t _ {i + 1}\right) - X \left(t _ {i}\right)\right) \left(Y \left(t _ {i + 1}\right) - Y \left(t _ {i}\right)\right)
+$$
+
+in probability as the mesh size of $0 = t_0 < t_1 < \dots < t_m = t$ goes to 0, if it exists. Moreover, for $Y$ itself, we write
+
+$$
+[ Y ] = \sum_ {i = 1} ^ {e} [ Y _ {i}, Y _ {i} ]
+$$
+
+Definition A.6 (Martingale). Let $\{X(t)\}_{t\geq 0}$ be a $\{\mathcal{F}_t\}_{t\geq 0}$ -adapted stochastic process. If for all $0\leq s\leq t$ , it holds that
+
+$$
+\mathbb {E} [ X (t) \mid \mathcal {F} _ {s} ] = X (s),
+$$
+
+then $X$ is called a martingale.
+
+Definition A.7 (Local martingale). Let $\{X(t)\}_{t\geq 0}$ be a $\{\mathcal{F}_t\}_{t\geq 0}$ -adapted stochastic process. If there exists a sequence of $\{\mathcal{F}_t\}_{t\geq 0}$ -stopping time, $\{\tau_k\}_{k\geq 0}$ , such that
+
+- $\mathbb{P}[\tau_k < \tau_{k + 1}] = 1, \mathbb{P}[\lim_{k\to \infty}\tau_k = \infty] = 1,$
+and $\{X^{\tau_k}(t)\}_{t\geq 0}$ is a $\{\mathcal{F}_t\}_{t\geq 0}$ -adapted martingale,
+
+then $X$ is called a local martingale.
+
+Definition A.8 (Semimartingale). Let $\{X(t)\}_{t\geq 0}$ be a $\{\mathcal{F}_t\}_{t\geq 0}$ -adapted stochastic process. If there exists a local martingale $\{M(t)\}_{t\geq 0}$ and a càdlàg $\{\mathcal{F}_t\}_{t\geq 0}$ -adapted process $\{A(t)\}_{t\geq 0}$ with bounded total variation that $X(t) = M(t) + A(t)$ , then $X$ is called a semimartingale.
+
+Lemma A.9 (Itô's Lemma). Let $\{X(t)\}_{t\geq 0}$ be defined through the following Itô drift-diffusion process:
+
+$$
+\mathrm {d} X (t) = \mu (t) \mathrm {d} t + \sigma (t) \mathrm {d} W (t).
+$$
+
+where $\{W(t)\}_{t\geq 0}$ is the standard Brownian motion. Then for any twice differentiable function $f$ , it holds that
+
+$$
+\mathrm {d} f (t, X (t)) = \left(\frac {\partial f}{\partial t} + (\nabla_ {x} f) ^ {\top} \mu_ {t} + \frac {1}{2} \operatorname {t r} [ \sigma^ {\top} \nabla_ {x} ^ {2} f \sigma ]\right) \mathrm {d} t + (\nabla_ {x} f) ^ {\top} \sigma (t) \mathrm {d} W (t).
+$$
+
+# A.3 WEAK CONVERGENCE FOR STOCHASTIC PROCESSES
+
+Let $(\mathcal{D}_{\mathcal{E}}[0,\infty),\mathcal{A},d)$ be a metric space equipped with a $\sigma$ -algebra $\mathcal{A}$ and the Skorohod metric defined in the previous subsection.
+
+Let $\{X_{n}\}_{n\geq 0}$ be a sequence of stochastic processes on a sequence of probability spaces $\{(\Omega_n,\mathcal{F}_n,\mathbb{P}_n)\}_{n\geq 0}$ such that each $X_{n}$ has sample paths in $\mathcal{D}_{\mathcal{E}}[0,\infty)$ . Also, let $X$ be a stochastic process on $(\Omega ,\mathcal{F},\mathbb{P})$ with sample paths on $\mathcal{D}_{\mathcal{E}}[0,\infty)$ .
+
+Definition A.10 (Weak convergence). A sequence of stochastic process $\{X_{n}\}_{n\geq 0}$ is said to converge in distribution or weakly converge to $X$ (written as $X_{n}\Rightarrow X$ ) if and only if for all $\mathcal{A}$ -measurable, bounded, and continuous function $f:\mathcal{D}_{\mathcal{E}}[0,\infty)\to \mathbb{R}$ , it holds that
+
+$$
+\lim _ {n \rightarrow \infty} \mathbb {E} [ f (X _ {n}) ] = \mathbb {E} [ f (X) ]. \tag {20}
+$$
+
+Though we define weak convergence for a countable sequence of stochastic processes, but it is still valid if we index the stochastic processes by real numbers, e.g., $\{X_{\eta}\}_{\eta \geq 0}$ , and consider the weak convergence of $X_{\eta}$ as $\eta \to 0$ . This is because the convergence in (20) is for a sequence of real numbers, which is also well-defined if we replace $\lim_{n\to \infty}$ by $\lim_{\eta \to 0}$ .
+
+Definition A.11 ( $\delta$ -Prohorov distance). Let $\delta > 0$ . For any two probability measures $P$ and $Q$ on a metric space with metric $d$ , let $(X, Y)$ be a coupling such that $P$ is the marginalized law of $X$ and $Q$ that of $Y$ . We define
+
+$$
+\rho^ {\delta} (P, Q) = \inf \{\epsilon > 0: \exists (X, Y), \mathbb {P} [ d (X, Y) \geq \epsilon ] \leq \delta \}.
+$$
+
+Note this distance is not a metric because it does not satisfy triangle inequality.
+
+Definition A.12 (Prohorov metric). For any two probability measures $P$ and $Q$ on a metric space with metric $d$ , let $(X, Y)$ be a coupling such that $P$ is the marginalized law of $X$ and $Q$ that of $Y$ . Denote the marginal laws of $X$ and $Y$ by $\mathcal{L}(X)$ and $\mathcal{L}(Y)$ respectively. We define the Prohorov metric as
+
+$$
+\rho (P, Q) = \inf \{\epsilon > 0: \exists (X, Y), \mathcal {L} (X) = P, \mathcal {L} (Y) = Q, \mathbb {P} [ d (X, Y) \geq \epsilon ] \leq \epsilon \}.
+$$
+
+It can be shown that $X_{n}\Rightarrow X$ is equivalent to $\lim_{n\to \infty}\rho (X_n,X) = 0$
+
+Theorem A.13 (Skorohod Representation Theorem). Suppose $P_{n}, n = 1,2,\ldots$ and $P$ are probability measures on $\mathcal{E}$ such that $P_{n} \Rightarrow P$ . Then there is a probability space $(\Omega, \mathcal{F}, \mathbb{P})$ on which are defined $\mathcal{E}$ -valued random variables $X_{n}, n = 1,2,\ldots$ and $X$ with distributions $P_{n}$ and $P$ respectively, such that $\lim_{n\to \infty}X_n = X$ a.s.
+
+The main convergence result in Katzenberger (1991) (Theorem B.7) are in the sense of Skorohod metric in Definition A.4, which is harder to understand and use compared to the more common uniform metric (Definition A.14). However, convergence in Skorohod metric and uniform metric indeed coincide with each other when the limit is in $\mathcal{C}_{\mathbb{R}^p}[0,\infty)$ , i.e., the continuous functions.
+
+Definition A.14 (Uniform metric on $\mathcal{D}_{\mathcal{E}}[0,\infty)$ ). For each finite $T > 0$ and each pair of functions $f,g\in \mathcal{D}_{\mathcal{E}}[0,T)$ , the uniform metric is defined to be
+
+$$
+d_{U}(f,g;T) = \sup_{t\in [0,T)}\| f(t) - g(t)\| .
+$$
+
+The uniform metric on $\mathcal{D}_{\mathcal{E}}[0,\infty)$ is defined to be
+
+$$
+d _ {U} (f, g) = \sum_ {T = 1} ^ {\infty} 2 ^ {- T} \min \{1, d _ {U} (f, g; T) \}.
+$$
+
+Lemma A.15 (Problem 7, Section 5, Pollard (2012)). If $X_{n} \Rightarrow X$ in the Skorohod sense, and $X$ has sample paths in $\mathcal{C}_{\mathbb{R}^D}[0,\infty)$ , then $X_{n} \Rightarrow X$ in the uniform metric.
+
+Remark A.16. We shall note the uniform metric defined above is weaker than $\sup_{t\in [0,\infty)}\| f(t) - g(t)\|$ . Convergence in the uniform metric on $[0,\infty]$ defined in Definition A.14 is equivalent to convergence in the uniform metric on each compact set $[0,T]$ for $T\in \mathbb{N}^{+}$ . The same holds for the Skorohod topology.
+
+# B LIMITING DIFFUSION OF SGD
+
+In this section, we give a complete derivation of the limiting diffusion of SGD. Here we use $\Rightarrow$ to denote the convergence in distribution. For any $U \subseteq \mathbb{R}^D$ , we denote by $\hat{U}$ its interior. For linear space $S$ , we use $S^\perp$ to denote its orthogonal complement.
+
+First, as mentioned in Assumption 3.2, we verify that the mapping $\Phi$ is $\mathcal{C}^2$ in Lemma B.1. In Appendix B.1 we discuss how different time scalings could affect the coefficients in SDE (2) and (3). Then we check the necessary conditions for applying the results in Katzenberger (1991) in Appendix B.2 and recap the corresponding theorem for the asymptotically continuous case in Appendix B.3. Finally, we provide a user-friendly interface for Katzenberger's theorem in Appendix B.4.
+
+Lemma B.1 (Implication of Falconer (1983)). Under Assumption 3.2, $\Phi$ is $\mathcal{C}^2$ on $U$ .
+
+Proof of Lemma B.1. Applying Theorem 5.1 of Falconer (1983) with $f(\cdot) = \phi(\cdot, 1)$ suffices.
+
+
+
+# B.1 APPROXIMATING SGD BY SDE
+
+Let's first clarify how we derive the SDEs, (2) and (3), that approximate SGD (1) under different time scalings. Recall $W(t)$ is $\Xi$ -dimensional Brownian motion and that $\sigma(X): \mathbb{R}^D \to \mathbb{R}^{D \times \Xi}$ is a deterministic noise function. As proposed by Li et al. (2017), one approach to approximate SGD (1) by SDE is to consider the following SDE:
+
+$$
+\mathrm {d} X (t) = - \nabla L (X (t)) \mathrm {d} t + \sqrt {\eta} \sigma (X (t)) \mathrm {d} W (t),
+$$
+
+where the time correspondence is $t = k\eta$ , i.e., $X(k\eta) \approx x_{\eta}(k)$ .
+
+Now rescale the above SDE by considering $\tilde{X}(t) = X(t\eta)$ , which then yields
+
+$$
+\begin{array}{l} \mathrm {d} \tilde {X} (t) = \mathrm {d} X (t \eta) = - \nabla L (X (t \eta)) \mathrm {d} (t \eta) + \sqrt {\eta} \sigma (X (t \eta)) \mathrm {d} W (t \eta) \\ = - \eta \nabla L (X (t \eta)) \mathrm {d} t + \sqrt {\eta} \sigma (X (t \eta)) \mathrm {d} W (t \eta). \\ \end{array}
+$$
+
+Now we define $W'(t) = \frac{1}{\sqrt{\eta}} W(t\eta)$ , and it's easy to verify that $W'(t)$ is also a $\Xi$ -dimensional brownian motion, which means $W' \stackrel{d}{=} W$ , i.e., $W$ and $W'$ have the same sample paths in $\mathcal{C}_{\mathbb{R}^d}[0,\infty)$ . Thus
+
+$$
+\begin{array}{l} \mathrm {d} \tilde {X} (t) = - \eta \nabla L (X (t \eta)) \mathrm {d} t + \eta \sigma (X (t \eta)) \mathrm {d} W ^ {\prime} (t) \\ = - \eta \nabla L (\tilde {X} (t)) \mathrm {d} t + \eta \sigma (\tilde {X} (t)) \mathrm {d} W ^ {\prime} (t), \\ \end{array}
+$$
+
+where the time correspondence is $t = k$ , i.e., $\tilde{X}(k) \approx x_{\eta}(k)$ . The above SDE is exactly the same as (2).
+
+Then, to accelerate the above SDE by $\eta^{-2}$ times, let's define $\bar{X}(t) = \tilde{X}(t / \eta^2)$ . Then it follows that
+
+$$
+\begin{array}{l} \mathrm {d} \bar {X} (t) = \mathrm {d} \tilde {X} (t / \eta^ {2}) = - \eta \nabla L (\tilde {X} (t / \eta^ {2})) \mathrm {d} t / \eta^ {2} + \eta \sigma (\tilde {X} (t / \eta^ {2})) \mathrm {d} W (t / \eta^ {2}) \\ = - \frac {1}{\eta} \nabla L (\bar {X} (t)) \mathrm {d} t + \sigma (\bar {X} (t)) \mathrm {d} \left(\eta W (t / \eta^ {2})\right) \\ \end{array}
+$$
+
+Again note that $\eta W(t / \eta^2) \stackrel{d}{=} W(t)$ in sample paths and thus is also a $\Xi$ -Brownian motion. Here the time correspondence is $t = k\eta^2$ , i.e., evolving for constant time with the above SDE approximates $\Omega(1 / \eta^2)$ steps of SGD. In this way, we derive SDE (3) in the main context.
+
+# B.2 NECESSARY CONDITIONS
+
+Below we collect the necessary conditions imposed on $\{Z_{n}\}_{n\geq 1}$ and $\{A_n\}_{n\geq 1}$ in Katzenberger (1991). Recall that we consider the following stochastic process
+
+$$
+X _ {n} (t) = X (0) + \int_ {0} ^ {t} \sigma (X _ {n} (s)) \mathrm {d} Z _ {n} (s) - \int_ {0} ^ {t} \nabla L (X _ {n} (s)) \mathrm {d} A _ {n} (s).
+$$
+
+For any stopping time $\tau$ , the stopped process is defined as $X_{n}^{\tau}(t) = X_{n}(t \wedge \tau)$ . For any compact $K \subset U$ , we define the stopping time of $X_{n}$ leaving $K$ as $\lambda_{n}(K) = \inf \{t \geq 0 \mid X_{n}(t-) \notin \mathring{K} \text{ or } X_{n}(t) \notin \mathring{K}\}$ .
+
+Condition B.2. The integrator sequence $\{A_n\}_{n \geq 1}$ is asymptotically continuous: $\sup_{t > 0} |A_n(t) - A_n(t-)| \Rightarrow 0$ where $A_n(t-) = \lim_{s \to t-} A_n(s)$ is the left limit of $A_n$ at $t$ .
+
+Condition B.3. The integrator sequence $\{A_n\}_{n \geq 1}$ increases infinitely fast: $\forall \epsilon > 0, \inf_{t \geq 0} (A_n(t + \epsilon) - A_n(t)) \Rightarrow \infty$ .
+
+Condition B.4 (Eq.(5.1), Katzenberger 1991). For every $T > 0$ , as $n \to \infty$ , it holds that
+
+$$
+\sup _ {0 < t \leq T \wedge \lambda_ {n} (K)} \| \Delta Z _ {n} (t) \| _ {2} \Rightarrow 0.
+$$
+
+Condition B.5 (Condition 4.2, Katzenberger 1991). For each $n \geq 1$ , let $Y_{n}$ be a $\{\mathcal{F}_t^n\}$ -semimartingale with sample paths in $\mathcal{D}_{\mathbb{R}^D}[0,\infty)$ . Assume that for some $\delta > 0$ (allowing $\delta = \infty$ ) and every $n \geq 1$ there exist stopping times $\{\tau_n^m \mid m \geq 1\}$ and a decomposition of $Y_{n} - J_{\delta}(Y_{n})$
+
+into a local martingale $M_{n}$ plus a finite variation process $F_{n}$ such that $\mathbb{P}[\tau_n^m\leq m]\leq 1 / m$ $\{[M_n](t\wedge \tau_n^m) + T_{t\wedge \tau_n^m}(F_n)\}_{n\geq 1}$ is uniformly integrable for every $t\geq 0$ and $m\geq 1$ , and
+
+$$
+\lim_{\gamma \to 0}\limsup_{n\to \infty}\mathbb{P}\left[\sup_{0\leq t\leq T}\left(T_{t + \gamma}(F_{n}) - T_{t}(F_{n})\right) > \epsilon \right] = 0,
+$$
+
+for every $\epsilon > 0$ and $T > 0$ , where $T_{t}(\cdot)$ denotes total variation on the interval $[0, t]$ .
+
+Lemma B.6. For SGD iterates defined using the notation in Lemma 4.2, the sequences $\{A_n\}_{n \geq 1}$ and $\{Z_n\}_{n \geq 1}$ satisfy Condition B.2, B.3, B.4 and B.5.
+
+Proof of Lemma B.6. Condition B.2 is obvious from the definition of $\{A_n\}_{n\geq 1}$ .
+
+Next, for any $\epsilon > 0$ and $t \in [0, T]$ , we have
+
+$$
+A _ {n} (t + \epsilon) - A _ {n} (t) = \eta_ {n} \cdot \left\lfloor \frac {t + \epsilon}{\eta_ {n} ^ {2}} \right\rfloor - \eta_ {n} \cdot \left\lfloor \frac {t}{\eta_ {n} ^ {2}} \right\rfloor \geq \frac {t + \epsilon - \eta_ {n} ^ {2}}{\eta_ {n}} - \frac {t}{\eta_ {n}} = \frac {\epsilon - \eta_ {n} ^ {2}}{\eta_ {n}},
+$$
+
+which implies that $\inf_{0\leq t\leq T}(A_n(t + \epsilon) - A_n(t)) > \epsilon /(2\eta_n)$ for small enough $\eta_{n}$ . Then taking $n\to \infty$ yields the Condition B.3.
+
+For Condition B.4, note that
+
+$$
+\Delta Z _ {n} (t) = \left\{ \begin{array}{l l} \eta_ {n} \sqrt {\Xi} (\mathbb {1} _ {\xi_ {k}} - \frac {1}{\Xi} \mathbb {1}) & \text {i f} t = k \cdot \eta_ {n} ^ {2}, \\ 0 & \text {o t h e r w i s e}. \end{array} \right.
+$$
+
+Therefore, we have $\| \Delta Z_{n}(t)\|_{2}\leq 2\eta_{n}\sqrt{\Xi}$ for all $t > 0$ . This implies that $\| \Delta Z_n(t)\| _2\to 0$ uniformly over $t > 0$ as $n\to \infty$ , which verifies Condition B.4.
+
+We proceed to verify Condition B.5. By the definition of $Z_{n}$ , we know that $\{Z_{n}(t)\}_{t\geq 0}$ is a jump process with independent increments and thus is a martingale. Therefore, by decomposing $Z_{n} = M_{n} + F_{n}$ with $M_{n}$ being a local martingale and $F_{n}$ a finite variation process, we must have $F_{n} = 0$ and $M_{n}$ is $Z_{n}$ itself. It then suffices to show that $[M_n](t\wedge \tau_n^m)$ is uniformly integrable for every $t\geq 0$ and $m\geq 1$ . Since $M_{n}$ is a pure jump process, we have
+
+$$
+\begin{array}{l} [ M _ {n} ] (t \wedge \tau_ {n} ^ {m}) = \sum_ {0 < s \leq t \wedge \tau_ {n} ^ {m}} \| \Delta M _ {n} (s) \| _ {2} ^ {2} \leq \sum_ {0 < s \leq t} \| \Delta M _ {n} (s) \| _ {2} ^ {2} \\ = \sum_ {k = 1} ^ {\lfloor t / \eta_ {n} ^ {2} \rfloor} \left\| \eta_ {n} \sqrt {\Xi} \left(\mathbb {1} _ {\xi_ {k}} - \frac {1}{\Xi} \mathbb {1}\right) \right\| _ {2} ^ {2} \leq 4 \Xi \sum_ {k = 1} ^ {\lfloor t / \eta_ {n} ^ {2} \rfloor} \eta_ {n} ^ {2} \leq 4 \Xi t. \\ \end{array}
+$$
+
+This implies that $[M_{\eta}](t \wedge \tau_{\eta}^{m})$ is universally bounded by $4t$ , and thus $[M_{\eta}](t \wedge \tau_{\eta}^{m})$ is uniformly integrable. This completes the proof.
+
+Lemma 4.2. Let $\{\eta_n\}_{n=1}^{\infty}$ be any positive sequence with $\lim_{n\to \infty}\eta_n = 0$ , $A_n(t) = \eta_n\lfloor t / \eta_n^2\rfloor$ and $Z_n(t) = \eta_n\sum_{k=1}^{\lfloor t / \eta_n^2\rfloor}\sqrt{\Xi}(\mathbb{1}_{\xi_k} - \frac{1}{\Xi}\mathbb{1})$ , where $\xi_1, \xi_2, \ldots \stackrel{i.i.d.}{\sim}\text{Unif}([\Xi])$ . Then with the same initialization $X_n(0) = x_{\eta_n}(0) \equiv X(0)$ , $X_n(k\eta_n^2)$ defined by (6) is a Katzenberger process and is equal to $x_{\eta_n}(k)$ defined in (1) with LR equal to $\eta_n$ for all $k \geq 1$ . Moreover, the counterpart of (7) is
+
+$$
+Y (t) = \Phi (X (0)) + \int_ {0} ^ {t} \partial \Phi (Y) \sigma (Y) d W (s) + \frac {1}{2} \int_ {0} ^ {t} \partial^ {2} \Phi (Y) [ \Sigma (Y) ] d s, \tag {8}
+$$
+
+where $\Sigma \equiv \sigma \sigma^{\top}$ and $\{W(t)\}_{t\geq 0}$ is a $\Xi$ -dimensional standard Brownian motion.
+
+Proof of Lemma 4.2. For any $n \geq 1$ , it suffices to show that given $X_{n}(k\eta_{n}^{2}) = x_{\eta_{n}}(k)$ , we further have $X_{n}((k + 1)\eta_{n}^{2}) = x_{\eta_{n}}(k + 1)$ . By the definition of $X_{n}(t)$ , we have
+
+$$
+\begin{array}{l} X _ {n} ((k + 1) \eta_ {n} ^ {2}) - X _ {n} (k \eta_ {n} ^ {2}) \\ = - \int_ {k \eta_ {n} ^ {2}} ^ {(k + 1) \eta_ {n} ^ {2}} \nabla L (X _ {n} (t)) \mathrm {d} A _ {n} (t) + \int_ {k \eta_ {n} ^ {2}} ^ {(k + 1) \eta_ {n} ^ {2}} \sigma (X _ {n} (t)) \mathrm {d} Z _ {n} (t) \\ = - \nabla L (X _ {n} (k \eta_ {n} ^ {2})) (A _ {n} ((k + 1) \eta_ {n} ^ {2}) - A _ {n} (k \eta_ {n} ^ {2})) + \sigma (X _ {n} (k \eta_ {n} ^ {2})) (Z _ {n} ((k + 1) \eta_ {n} ^ {2}) - Z _ {n} (k \eta_ {n} ^ {2})) \\ = - \eta_ {n} \nabla L (X _ {n} (k \eta_ {n} ^ {2})) + \eta_ {n} \sqrt {\Xi} \sigma_ {\xi_ {k}} (X _ {n} (k \eta_ {n} ^ {2})) \\ = - \eta_ {n} \nabla L \left(x _ {\eta_ {n}} (k)\right) + \eta_ {n} \sqrt {\Xi} \sigma_ {\xi_ {k}} \left(x _ {\eta_ {n}} (k)\right) = x _ {\eta_ {n}} (k + 1) - x _ {\eta_ {n}} (k) \\ \end{array}
+$$
+
+where the second equality is because $A_{n}(t)$ and $Z_{n}(t)$ are constant on interval $[k\eta_n^2, (k + 1)\eta_n^2)$ . This confirms the alignment between $\{X_{n}(k\eta_{n}^{2})\}_{k\geq 1}$ and $\{x_{\eta_n}(k)\}_{k\geq 1}$ .
+
+For the second claim, note that $\sigma(x)\mathbb{E}Z_n(t) \equiv 0$ for all $x \in \mathbb{R}^D$ , $t \geq 0$ (since the noise has zero expectation) and that $\{Z_n(t) - \mathbb{E}Z_n(t)\}_{t \geq 0}$ will converge in distribution to a Brownian motion by the classic functional central limit theorem (see, for example, Theorem 4.3.5 in Whitt (2002)). Thus, the limiting diffusion of $X_n$ as $n \to \infty$ can be obtained by substituting $Z$ with the standard Brownian motion $W$ in (22). This completes the proof.
+
+# B.3 KATZENBERGER'S THEOREM FOR ASYMPTOTICALLY CONTINUOUS CASE
+
+The full Katzenberger's theorem deals with a more general case, which only requires the sequence of integrators to be asymptotically continuous, thus including SDE (3) and SGD (1) with $\eta$ goes to 0.
+
+To describe the results in Katzenberger (1991), we first introduce some definitions. For each $n \geq 1$ , let $(\Omega^n, \mathcal{F}^n, \{\mathcal{F}_t^n\}_{t \geq 0}, \mathbb{P})$ be a filtered probability space, $Z_n$ an $\mathbb{R}^e$ -valued cadlag $\{\mathcal{F}_t^n\}$ -semimartingale with $Z_n(0) = 0$ and $A_n$ a real-valued cadlag $\{\mathcal{F}_t^n\}$ -adapted nondecreasing process with $A_n(0) = 0$ . Let $\sigma_n: U \to \mathbb{M}(D, e)$ be continuous with $\sigma_n \to \sigma$ uniformly on compact subsets of $U$ . Let $X_n$ be an $\mathbb{R}^D$ -valued cadlag $\{\mathcal{F}_t^n\}$ -semimartingale satisfying, for all compact $K \subset U$ ,
+
+$$
+X _ {n} (t) = X (0) + \int_ {0} ^ {t} \sigma \left(X _ {n}\right) \mathrm {d} Z _ {n} + \int_ {0} ^ {t} - \nabla L \left(X _ {n}\right) \mathrm {d} A _ {n} \tag {21}
+$$
+
+for all $t \leq \lambda_n(K)$ where $\lambda_n(K) = \inf \{t \geq 0 \mid X_n(t-) \notin \mathring{K} \text{ or } X_n(t) \notin \mathring{K}\}$ is the stopping time of $X_n$ leaving $K$ .
+
+Theorem B.7 (Theorem 6.3, Katzenberger 1991). Suppose $X(0) \in U$ , Assumptions 3.1 and 3.2, Condition B.2, B.3, B.4 and B.5 hold. For any compact $K \subset U$ , define $\mu_n(K) = \inf \{t \geq 0 \mid Y_n(t-) \notin \mathring{K} \text{ or } Y_n(t) \notin \mathring{K}\}$ , then the sequence $\{(Y_n^{\mu_n(K)}, Z_n^{\mu_n(K)}, \mu_n(K))\}$ is relatively compact in $\mathcal{D}_{\mathbb{R}^{D \times e}}[0, \infty) \times [0, \infty)$ . If $(Y, Z, \mu)$ is a limit point of this sequence under the skorohod metric (Definition A.4), then $(Y, Z)$ is a continuous semimartingale, $Y(t) \in \Gamma$ for every $t \geq 0$ a.s., $\mu \geq \inf \{t \geq 0 \mid Y(t) \notin \mathring{K}\}$ a.s. and $Y(t)$ admits
+
+$$
+\begin{array}{l} Y (t) = Y (0) + \int_ {0} ^ {t \wedge \mu} \partial \Phi (Y (s)) \sigma (Y (s)) \mathrm {d} Z (s) \\ + \frac {1}{2} \sum_ {i, j = 1} ^ {D} \sum_ {k, l = 1} ^ {e} \int_ {0} ^ {t \wedge \mu} \partial_ {i j} \Phi (Y (s)) \sigma (Y (s)) _ {i k} \sigma (Y (s)) _ {j l} d [ Z _ {k}, Z _ {l} ] (s). \tag {22} \\ \end{array}
+$$
+
+We note that by Lemma A.15, convergence in distribution under skorohod metric is equivalent to convergence in distribution under uniform metric Definition A.14, therefore in the rest of the paper we will only use the uniform metric in the rest of the paper, e.g., whenever we mention Prohorov metric and $\delta$ -Prohorov distance, the underlying metric is the uniform metric.
+
+# B.4 A USER-FRIENDLY INTERFACE FOR KATZENBERGER'S THEOREM
+
+Based on the Lemma B.6, we can immediately apply Theorem B.7 to obtain the following limiting diffusion of SGD.
+
+Theorem B.8. Let the manifold $\Gamma$ and its open neighborhood $U$ satisfy Assumptions 3.1 and 3.2. Let $K\subset U$ be any compact set and fix some $x_0\in K$ . Consider the SGD formulated in Lemma 4.2 where $X_{\eta_n}(0)\equiv x_0$ . Define
+
+$$
+Y _ {\eta_ {n}} (t) = X _ {\eta_ {n}} (t) - \phi \left(X _ {\eta_ {n}} (0), A _ {\eta_ {n}} (t)\right) + \Phi \left(X _ {\eta_ {n}} (0)\right)
+$$
+
+and $\mu_{\eta_n}(K) = \min \{t\in \mathbb{N}\mid Y_{\eta_n}(t)\notin \mathring{K}\}$ . Then the sequence $\{(Y_{\eta_n}^{\mu_{\eta_n}(K)},Z_{\eta_n},\mu_{\eta_n}(K))\}_{n\geq 1}$ is relatively compact in $\mathcal{D}_{\mathbb{R}^D\times \mathbb{R}^n}[0,\infty)\times [0,\infty ]$ . Moreover, if $(Y,Z,\mu)$ is a limit point of this sequence, it holds that $Y(t)\in \Gamma$ a.s for all $t\geq 0$ , $\mu \geq \inf \{t\geq 0\mid Y(t)\notin \mathring{K}\}$ and $Y(t)$ admits
+
+$$
+Y (t) = \int_ {s = 0} ^ {t \wedge \mu} \partial \Phi (Y (s)) \sigma (Y (s)) d W (s) + \int_ {s = 0} ^ {t \wedge \mu} \frac {1}{2} \sum_ {i, j = 1} ^ {D} \partial_ {i j} \Phi (Y (s)) (\sigma (Y (s)) \sigma (Y (s)) ^ {\top}) _ {i j} d s \tag {23}
+$$
+
+where $\{W(s)\}_{s\geq 0}$ is the standard Brownian motion and $\sigma (\cdot)$ is as defined in Lemma 4.2.
+
+However, the above theorem is hard to parse and cannot be directly applied if we want to further study the implicit bias of SGD through this limiting diffusion. Therefore, we develop a user-friendly interface to it in below. In particular, Theorem 4.6 is the a special case of Theorem B.9. In Theorem 4.6, we replace $\partial \Phi (Y(t))\sigma (Y(t))$ with $\Sigma_{\parallel}^{\frac{1}{2}}(Y(t))$ to simplify the equation, since $\partial \Phi (Y(t))\sigma (Y(t))\left(\partial \Phi (Y(t))\sigma (Y(t))\right)^{\top} = \Sigma_{\parallel}(Y(t))$ and thus this change doesn't affect the distribution of the sample paths of the solution.
+
+Theorem B.9. Under the same setting as Theorem B.8, we change the integer index back to $\eta > 0$ with a slight abuse of notation. For any stopping time $\mu$ and stochastic process $\{Y(t)\}_{t\geq 0}$ such that $\mu \geq \inf \{t\geq 0\mid Y(t)\notin \mathring{K}\}$ , $Y(0) = \Phi (x_0)$ and that $(Y,\mu)$ satisfy Equation (23) for some standard Brownian motion $W$ . For any compact set $K\subseteq U$ and $T > 0$ , define $\mu (K) = \inf \{t\geq 0\mid Y(t)\notin \mathring{K}\}$ and $\delta = \mathbb{P}(\mu (K)\leq T)$ . Then for any $\epsilon > 0$ , it holds for all sufficiently small $LR$ $\eta$ that:
+
+$$
+\rho^ {2 \delta} \left(Y _ {\eta} ^ {\mu_ {\eta} (K) \wedge T}, Y ^ {\mu (K) \wedge T}\right) \leq \epsilon , \tag {24}
+$$
+
+which means there is a coupling between the distribution of the stopped processes $Y_{\eta}^{\mu_{\eta}(K)\wedge T}$ and $Y^{\mu (K)\wedge T}$ , such that the uniform metric between them is smaller than $\epsilon$ with probability at least $1 - 2\delta$ . In other words, $\lim_{\eta \to 0}\rho^{2\delta}(Y_{\eta}^{\mu_{\eta}(K)\wedge T},Y^{\mu (K)\wedge T}) = 0$ .
+
+Moreover, when $\{Y(t)\}_{t\geq 0}$ is a global solution to the following limiting diffusion
+
+$$
+Y (t) = \int_ {s = 0} ^ {t} \partial \Phi (Y (s)) \sigma (Y (s)) \mathrm {d} W (s) + \int_ {s = 0} ^ {t} \frac {1}{2} \sum_ {i, j = 1} ^ {D} \partial_ {i j} \Phi (Y (s)) (\sigma (Y (s)) \sigma (Y (s)) ^ {\top}) _ {i j} \mathrm {d} s
+$$
+
+and $Y$ never leaves $U$ , i.e. $\mathbb{P}[\forall t \geq 0, Y(t) \in U] = 1$ , it holds that $Y_{\eta}^{T}$ converges in distribution to $Y^{T}$ as $\eta \to 0$ for any fixed $T > 0$ .
+
+For clarity, we break the proof of Theorem B.9 into two parts, devoted to the two claims respectively.
+
+Proof of the first claim of Theorem B.9. First, Theorem B.8 guarantees there exists a stopping time $\tilde{\mu}$ and a stochastic process $\{\widetilde{Y}(t)\}_{t\geq 0}$ such that
+
+1. $(\widetilde{Y},\tilde{\mu})$ satisfies Equation (23);
+2. $\widetilde{Y}\in \Gamma a.s.$
+3. $\tilde{\mu}\geq \tilde{\mu} (K)\coloneqq \inf \{t\geq 0\mid \tilde{Y} (t)\notin \mathring{K}\}$
+
+The above conditions imply that $\widetilde{Y}^{\tilde{\mu}(K)} \in \Gamma$ a.s.. Since the coefficients in Equation (23) are locally Lipschitz, we claim that $(\widetilde{Y}^{\tilde{\mu}(K)}, \tilde{\mu}(K)) \stackrel{d}{=} (Y^{\mu(K)}, \mu(K))$ . To see this, note that for any compact $K \subseteq U$ , the noise function $\sigma, \partial \Phi$ and $\partial^{2}\Phi$ are all Lipschitz on $K$ , thus we can extend their definitions to $\mathbb{R}^{D}$ such that the resulting functions are still locally Lipschitz. Based on this extension, applying classic theorem on weak uniqueness (e.g., Theorem 1.1.10, Hsu 2002) to the extended version of Equation (23) yields the equivalence in law. Thus we only need to prove the first claim for $\widetilde{Y}$ .
+
+Let $\mathcal{E}_T$ be the event such that $\tilde{\mu}(K) > T$ on $\mathcal{E}_T$ . Then restricted on $\mathcal{E}_T$ , we have $\widetilde{Y}(T \wedge \tilde{\mu}) = \widetilde{Y}(T \wedge \tilde{\mu}(K))$ as $\tilde{\mu} \geq \tilde{\mu}(K)$ holds a.s. We first prove the claim for any convergent subsequence of $\{Y_\eta\}_{\eta > 0}$ .
+
+Now, let $\{\eta_m\}_{m\geq 1}$ be a sequence of LRs such that $\eta_{m}\to 0$ and $Y_{\eta_m}^{\mu_{\eta_m}(K)}\Rightarrow \widetilde{Y}^{\tilde{\mu}}$ as $m\rightarrow \infty$ . By applying the Skorohod representation theorem, we can put $\{Y_{\eta_m}\}_{m\geq 1}$ and $\widetilde{Y}$ under the same probability space such that $Y_{\eta_m}^{\mu_{\eta_m}(K)}\to \widetilde{Y}^{\tilde{\mu}}$ a.s. in the Skorohod metric, or equivalently the uniform metric (since $\widetilde{Y}^{\tilde{\mu}}$ is continuous) i.e.,
+
+$$
+d _ {U} \left(Y _ {\eta_ {m}} ^ {\mu_ {\eta_ {m}} (K)}, \widetilde {Y} ^ {\tilde {\mu}}\right)\rightarrow 0, a. s.,
+$$
+
+which further implies that for any $\epsilon > 0$ , there exists some $N > 0$ such that for all $m > N$ ,
+
+$$
+\mathbb {P} \left[ d _ {U} (Y _ {\eta_ {m}} ^ {\mu_ {\eta_ {m}} (K) \wedge T}, \widetilde {Y} ^ {\tilde {\mu} \wedge T}) \geq \epsilon \right] \leq \delta .
+$$
+
+Restricted on $\mathcal{E}_T$ , we have $d_U(Y_{\eta_m}^{\mu_{\eta_m}(K)\wedge T},\widetilde{Y}^{\tilde{\mu}\wedge T}) = d_U(Y_{\eta_m}^{\mu_{\eta_m}(K)\wedge T},\widetilde{Y}^{\tilde{\mu}(K)\wedge T})$ , and it follows that for all $m > N$
+
+$$
+\begin{array}{l} \mathbb {P} \left[ d _ {U} \left(Y _ {\eta_ {m}} ^ {\mu_ {\eta_ {m}} (K) \wedge T}, \widetilde {Y} ^ {\tilde {\mu} (K) \wedge T}\right) \geq \epsilon \right] \leq \mathbb {P} \left[ \left\{d _ {U} \left(Y _ {\eta_ {m}} ^ {\mu_ {\eta_ {m}} (K) \wedge T}, \widetilde {Y} ^ {\tilde {\mu} (K) \wedge T}\right) \geq \epsilon \right\} \cap \mathcal {E} _ {T} \right] + \mathbb {P} \left[ \mathcal {E} _ {T} ^ {c} \right] \\ = \mathbb {P} \left[ \left\{d _ {U} \left(Y _ {\eta_ {m}} ^ {\mu_ {\eta_ {m}} (K) \wedge T}, \widetilde {Y} ^ {\tilde {\mu} \wedge T}\right) \geq \epsilon \right\} \cap \mathcal {E} _ {T} \right] + \mathbb {P} [ \mathcal {E} _ {T} ^ {c} ] \\ \leq \mathbb {P} \left[ d _ {U} \left(Y _ {\eta_ {m}} ^ {\mu_ {\eta_ {m}} (K) \wedge T}, \widetilde {Y} ^ {\tilde {\mu} \wedge T}\right) \geq \epsilon \right] + \mathbb {P} \left[ \mathcal {E} _ {T} ^ {c} \right] \\ \leq 2 \delta . \\ \end{array}
+$$
+
+By the definition of the Prohorov metric in Definition A.12, we then get $\rho^{2\delta}\big(Y_{\eta_m}^{\mu_{\eta_m}(K)\wedge T},\widetilde{Y}^{\tilde{\mu}(K)\wedge T}\big)\leq \epsilon$ for all $m > N$ . Therefore, we have
+
+$$
+\lim _ {m \to \infty} \rho^ {2 \delta} (Y _ {\eta_ {m}} ^ {\mu_ {\eta_ {m}} (K) \wedge T}, \widetilde {Y} ^ {\tilde {\mu} (K) \wedge T}) = 0.
+$$
+
+Now we claim that it indeed holds that $\lim_{\eta \to 0} \rho^{2\delta}(Y_{\eta}^{\mu_{\eta}(K) \wedge T}, \widetilde{Y}^{\tilde{\mu}(K) \wedge T}) = 0$ . We prove this by contradiction. Suppose otherwise, then there exists some $\epsilon > 0$ such that for all $\eta_0 > 0$ , there exists some $\eta < \eta_0$ with $\rho^{2\delta}(Y_{\eta}^{\mu_{\eta}(K) \wedge T}, \widetilde{Y}^{\tilde{\mu}(K) \wedge T}) > \epsilon$ . Consequently, there is a sequence $\{\eta_m\}_{m \geq 1}$ satisfying $\lim_{m \to \infty} \eta_m = 0$ and $\rho^{2\delta}(Y_{\eta_m}^{\mu_{\eta_m}(K)}, \widetilde{Y}^{\tilde{\mu}(K) \wedge T}) > \epsilon$ for all $m$ . Since $\{(Y_{\eta_m}^{\mu_{\eta_m}(K) \wedge T}, Z_{\eta_m}, \mu_{\eta_m}(K))\}_{m \geq 1}$ is relatively compact, there exists a subsequence (WLOG, assume it is the original sequence itself) converging to $(\widetilde{Y}^{\tilde{\mu} \wedge T}, W, \tilde{\mu})$ in distribution. However, repeating the exactly same argument as above, we would have $\rho^{2\delta}(Y_{\eta_m}^{\mu_{\eta_m}(K) \wedge T}, \widetilde{Y}^{\tilde{\mu}(K) \wedge T}) \leq \epsilon$ for all sufficiently large $m$ , which is a contradiction. This completes the proof.
+
+Proof of the second claim of Theorem B.9. We will first show there exists a sequence of compact set $\{K_m\}_{m\geq 1}$ such that $\cup_{m = 1}^{\infty}K_{m} = U$ and $K_{m}\subseteq K_{m + 1}$ . For $m\in \mathbb{N}^{+}$ , we define $H_{m} = U\backslash (B_{1 / m}(0) + \mathbb{R}^{D}\setminus U)$ and $K_{m} = \overline{H_{m}}\cap B_{m}(0)$ . By definition it holds that $\forall m < m^{\prime}, H_{m}\subseteq H_{m^{\prime}}$ and $K_{m}\subseteq K_{m^{\prime}}$ . Moreover, since $K_{m}$ is bounded and closed, $K_{m}$ is compact for every $m$ . Now we claim $\cup_{m = 1}^{\infty}K_{m} = U$ . Note that $\cup_{m = 1}^{\infty}K_{m} = \cup_{m = 1}^{\infty}\overline{H_{m}}\cap B_{m}(0) = \cup_{m = 1}^{\infty}\overline{H_{m}}$ . $\forall x\in U$ , since $U$ is open, we know $d_U(x,\mathbb{R}^D\setminus U) > 0$ , thus there exists $m_0\in \mathbb{N}^+$ , such that $\forall m\geq m_0$ , $x\notin (B_{1 / m}(0) + \mathbb{R}^{D}\setminus U)$ and thus $x\in H_{m}$ , which implies $x\in \cup_{m = 1}^{\infty}\overline{H_m}$ . On the other hand, $\forall x\in \mathbb{R}^{D}\setminus U$ , it holds that $x\in (B_{1 / m}(0) + \mathbb{R}^{D}\setminus U)$ for all $m\in \mathbb{N}^{+}$ , thus $x\notin H_m\subset K_m$ .
+
+Therefore, since $Y \in U$ and is continuous almost surely, random variables $\lim_{m \to \infty} \mu(K_m) = \infty$ a.s., which implies $\mu(K_m)$ converges to $\infty$ in distribution, i.e., $\forall \delta > 0, T > 0$ , $\exists m \in \mathbb{N}^+$ , such that $\forall K \supseteq K_m$ , it holds $\mathbb{P}[\mu(K) \leq T] \leq \delta$ .
+
+Now we will show for any $T > 0$ and $\epsilon > 0$ , there exists $\eta_0$ such that $\rho^{\epsilon}(Y^{T}, Y_{\eta}^{T}) \leq \epsilon$ for all $\eta \leq \eta_0$ . Fixing any $T > 0$ , for any $\epsilon > 0$ , let $\delta = \frac{\epsilon}{4}$ , then from above we know exists compact set $K$ , such that $\mathbb{P}(\mu(K) \leq T) \leq \delta$ . We further pick $K' = K + B_{2\epsilon'}(0)$ , where $\epsilon'$ can be any real number satisfying $0 < \epsilon' < \epsilon$ and $K' \subseteq U$ . Such $\epsilon'$ exists since $U$ is open. Note $K \subseteq K'$ , we have $\mathbb{P}(\mu(K') \leq T) \leq \mathbb{P}(\mu(K) \leq T) \leq \delta$ . Thus by the first claim of Theorem B.9, there exists $\eta_0 > 0$ , such that for all $\eta \leq \eta_0$ , we have $\rho^{2\delta}(Y_{\eta}^{\mu_{\eta}(K')} \wedge T, Y^{\mu(K') \wedge T}) \leq 2^{-[T]} \epsilon'$ .
+
+Note that $\rho^{\delta}(Y^{\mu (K)\wedge T},Y^{\mu (K')\wedge T}) = 0$ , so we have for all $\eta \leq \eta_0$
+
+$$
+\rho^ {3 \delta} (Y ^ {\mu (K) \wedge T}, Y _ {\eta} ^ {\mu_ {\eta} (K ^ {\prime}) \wedge T}) \leq 2 ^ {- \lceil T \rceil} \epsilon^ {\prime}.
+$$
+
+By the definition of $\delta$ -Prohorov distance in Definition A.11, we can assume $(Y^{\mu(K) \wedge T}, Y_{\eta}^{\mu_{\eta}(K') \wedge T})$ is already the coupling such that $\mathbb{P}\left[d_U(Y^{\mu(K) \wedge T}, Y_{\eta}^{\mu_{\eta}(K') \wedge T}) \geq 2^{-[T]} \epsilon'\right] \leq 3\delta$ . Below we want to show $\rho^{3\delta}(Y^{\mu(K) \wedge T}, Y_{\eta}^{T}) \leq 2^{-[T]} \epsilon'$ . Note that for all $t \geq 0$ , $Y^{\mu(K) \wedge T}(t) \in K$ , thus we know if
+
+$\mu_{\eta}(K^{\prime})\leq T$ , then
+
+$$
+\begin{array}{l} d _ {U} (Y ^ {\mu (K) \wedge T}, Y _ {\eta} ^ {\mu_ {\eta} (K ^ {\prime}) \wedge T}) \geq 2 ^ {- \lceil T \rceil} \left\| Y ^ {\mu (K) \wedge T} (\mu_ {\eta} (K ^ {\prime})) - Y _ {\eta} ^ {\mu_ {\eta} (K ^ {\prime}) \wedge T} (\mu_ {\eta} (K ^ {\prime}) \right\| _ {2} \\ \geq 2 ^ {- \lceil T \rceil} d _ {U} (K, \mathbb {R} ^ {d} / K ^ {\prime}) \\ \geq 2 ^ {- \lceil T \rceil} \epsilon^ {\prime}. \\ \end{array}
+$$
+
+On the other hand, if $\mu_{\eta}(K') > T$ , then $Y_{\eta}^{T} = Y_{\eta}^{\mu_{\eta}(K') \wedge T}$ . Thus we can conclude that $d_{U}(Y^{\mu(K) \wedge T}, Y_{\eta}^{T}) \geq 2^{-[T]} \epsilon'$ implies $d_{U}(Y^{\mu(K) \wedge T}, Y_{\eta}^{\mu_{\eta}(K') \wedge T}) \geq 2^{-[T]} \epsilon'$ . Therefore, we further have
+
+$$
+\mathbb {P} \left[ d _ {U} (Y ^ {\mu (K) \wedge T}, Y _ {\eta} ^ {T}) \geq 2 ^ {- \lceil T \rceil} \epsilon^ {\prime} \right] \leq \mathbb {P} \left[ d _ {U} (Y ^ {\mu (K) \wedge T}, Y _ {\eta} ^ {\mu_ {\eta} (K ^ {\prime}) \wedge T}) \geq 2 ^ {- \lceil T \rceil} \epsilon^ {\prime} \right] \leq 3 \delta ,
+$$
+
+that is,
+
+$$
+\rho^ {3 \delta} (Y ^ {\mu (K) \wedge T}, Y _ {\eta} ^ {T}) \leq 2 ^ {- \lceil T \rceil} \epsilon^ {\prime}.
+$$
+
+Finally, since $\rho^{\delta}(Y^{T},Y^{\mu (K)\wedge T}) = 0$ we have for all $\eta \leq \eta_0$
+
+$$
+\rho^ {\epsilon} (Y ^ {T}, Y _ {\eta} ^ {T}) = \rho^ {4 \delta} (Y ^ {T}, Y _ {\eta} ^ {T}) \leq \rho^ {3 \delta} (Y ^ {\mu (K) \wedge T}, Y _ {\eta} ^ {T}) + \rho^ {\delta} (Y ^ {T}, Y ^ {\mu (K) \wedge T}) \leq 2 ^ {- \lceil T \rceil} \epsilon^ {\prime} + 0 \leq \epsilon ,
+$$
+
+which completes the proof.
+
+
+
+Now, we provide the proof of Theorem 4.6 as a direct application of Theorem B.9.
+
+Proof of Theorem 4.6. We first prove that $Y$ never leaves $\Gamma$ , i.e., $\mathbb{P}[Y(t) \in \Gamma, \forall t \geq 0] = 1$ . By the result of Theorem B.8, we know that for each compact set $K \subset \Gamma$ , $Y^{\mu(K)}$ stays on $\Gamma$ almost surely, where $\mu(K) := \inf \{t \geq 0 \mid \widetilde{Y}(t) \notin \check{K}\}$ is the earliest time that $Y$ leaves $K$ . In other words, for all compact sets $K \subset \Gamma$ , $\mathbb{P}[\exists t \geq 0, Y(t) \notin \Gamma, Y(t) \in K] = 0$ . Let $\{K_m\}_{m \geq 1}$ be any sequence of compact sets such that $\cup_{m \geq 1} K_m = U$ and $K_m \subset U$ , e.g., the ones constructed in the proof of the second claim of Theorem B.9. Therefore, we have
+
+$$
+\mathbb {P} [ \exists t \geq 0, Y (t) \notin \Gamma ] = \mathbb {P} [ \exists t \geq 0, Y (t) \notin \Gamma , Y (t) \in U ] \leq \sum_ {m = 1} ^ {\infty} \mathbb {P} [ \exists t \geq 0, Y (t) \notin \Gamma , Y (t) \in K _ {m} ] = 0,
+$$
+
+which means $Y$ always stays on $\Gamma$ .
+
+Then recall the decomposition of $\Sigma = \Sigma_{\parallel} + \Sigma_{\perp} + \Sigma_{\parallel ,\perp} + \Sigma_{\perp ,\parallel}$ as defined in Lemma 4.5. Since $Y$ never leaves $\Gamma$ , by Lemma 4.5, we can rewrite Equation (10) as
+
+$$
+\begin{array}{l} \mathrm {d} Y (t) = \Sigma_ {\parallel} ^ {1 / 2} \mathrm {d} W (t) + \partial^ {2} \Phi (Y (t)) [ \Sigma (Y (t)) ] \mathrm {d} t \\ = \partial \Phi (Y (t)) \sigma (Y (t)) d W (t) + \frac {1}{2} \sum_ {i, j = 1} ^ {D} \partial_ {i j} \Phi (Y (t)) (\sigma (Y (t)) \sigma (Y (t)) ^ {\top}) _ {i j} d t \\ \end{array}
+$$
+
+where the second equality follows from the definition that $\Sigma_{\parallel} = \partial \Phi \Sigma \partial \Phi = \partial \Phi \sigma \sigma^{\top} \partial \Phi$ . This coincides with the formulation of the limiting diffusion in Theorem B.9. Therefore, further combining Lemma 4.2 and the second part of Theorem B.9, we obtain the desired result.
+
+Remark B.10. Our result suggests that for tiny $LR \eta$ , $SGD$ dynamics have two phases. In Phase I of $\Theta(1/\eta)$ steps, the $SGD$ iterates move towards the manifold $\Gamma$ of local minimizers along $GF$ . Then in Phase II which is of $\Theta(1/\eta^2)$ steps, the $SGD$ iterates stay close to $\Gamma$ and diffuse approximately according to (10). See Figure 2 for an illustration of this two-phase dynamics. However, since the length of Phase I gets negligible compared to that of Phase II when $\eta \to 0$ , Theorem 4.6 only reflects the time scaling of Phase II.
+
+# C EXPLICIT FORMULA OF THE LIMITING DIFFUSION
+
+In this section, we demonstrate how to compute the derivatives of $\Phi$ by relating to those of the loss function $L$ , and then present the explicit formula of the limiting diffusion.
+
+
+Figure 2: Illustration for two-phase dynamics of SGD with the same example as in Figure 1. $\Gamma$ is an 1D manifold of minimizers of loss $L$ .
+
+# C.1 EXPLICIT EXPRESSION OF THE DERIVATIVES
+
+For any $x \in \Gamma$ , we choose an orthonormal basis of $T_x(\Gamma)$ as $\{v_1, \ldots, v_{D - M}\}$ . Let $\{v_{D - M + 1}, \ldots, v_D\}$ be an orthonormal basis of $T_x^\perp(\Gamma)$ so that $\{v_i\}_{i \in [D]}$ is an orthonormal basis of $\mathbb{R}^D$ .
+
+Lemma C.1. For any $x \in \Gamma$ and any $v \in T_x(\Gamma)$ , it holds that $\nabla^2 L(x)v = 0$ .
+
+Proof. For any $x \in T_x(\Gamma)$ , let $\{x(t)\}_{t \geq 0}$ be a parametrized smooth curve on $\Gamma$ such that $x(0) = x$ and $\left.\frac{\mathrm{d}x(t)}{\mathrm{d}t}\right|_{t=0} = v$ . Then $\nabla L(x_t) = 0$ for all $t$ . Thus $0 = \left.\frac{\mathrm{d}\nabla L(x_t)}{\mathrm{d}t}\right|_{t=0} = \nabla^2 L(x)v$ .
+
+Lemma C.2. For any $x\in \mathbb{R}^D$ , it holds that $\partial \Phi (x)\nabla L(x) = 0$ and
+
+$$
+\partial^ {2} \Phi (x) [ \nabla L (x), \nabla L (x) ] = - \partial \Phi (x) \nabla^ {2} L (x) \nabla L (x).
+$$
+
+Proof. Fixing any $x \in \mathbb{R}^D$ , let $\frac{\mathrm{d}x(t)}{\mathrm{d}t} = -\nabla L(x(t))$ be initialized at $x(0) = x$ . Since $\Phi(x(t)) = \Phi(x)$ for all $t \geq 0$ , we have
+
+$$
+\frac {\mathrm {d}}{\mathrm {d} t} \Phi (x (t)) = - \partial \Phi (x (t)) \nabla L (x (t)) = 0.
+$$
+
+Evaluating the above equation at $t = 0$ yields $\partial \Phi (x)\nabla L(x) = 0$ . Moreover, take the second order derivative and we have
+
+$$
+\frac {\mathrm {d} ^ {2}}{\mathrm {d} t ^ {2}} \Phi (x _ {t}) = - \partial^ {2} \Phi (x (t)) \left[ \frac {\mathrm {d} x (t)}{\mathrm {d} t}, \nabla L (x (t)) \right] - \partial \Phi (x (t)) \nabla^ {2} L (x (t)) \frac {\mathrm {d} x (t)}{\mathrm {d} t} = 0.
+$$
+
+Evaluating at $t = 0$ completes the proof.
+
+
+
+Now we can prove Lemma 4.3, restated in below.
+
+Lemma 4.3. For any $x \in \Gamma$ , $\partial \Phi(x) \in \mathbb{R}^{D \times D}$ is the projection matrix onto tangent space $T_x(\Gamma)$ .
+
+Proof of Lemma 4.3. For any $v \in T_x(\Gamma)$ , let $\{v(t), t \geq 0\}$ be a parametrized smooth curve on $\Gamma$ such that $v(0) = x$ and $\left.\frac{\mathrm{d}v(t)}{\mathrm{d}t}\right|_{t=0} = v$ . Since $v(t) \in \Gamma$ for all $t \geq 0$ , we have $\Phi(v(t)) = v(t)$ , and thus
+
+$$
+\left. \frac {\mathrm {d} v (t)}{\mathrm {d} t} \right| _ {t = 0} = \left. \frac {\mathrm {d}}{\mathrm {d} t} \Phi (v (t)) \right| _ {t = 0} = \partial \Phi (x) \frac {\mathrm {d} v (t)}{\mathrm {d} t} \Bigg | _ {t = 0}.
+$$
+
+This implies that $\partial \Phi (x)v = v$ for all $v\in T_x(\Gamma)$
+
+Next, for any $u \in T_x^\perp(\Gamma)$ and $t \geq 0$ , consider expanding $\nabla L(x + t\nabla^2 L(x)^\dagger u)$ at $t = 0$ :
+
+$$
+\begin{array}{l} \nabla L \left(x + t \nabla^ {2} L (x) ^ {\dagger} u\right) = \nabla^ {2} L (x) \cdot t \nabla^ {2} L (x) ^ {\dagger} u + o (t) \\ = t u + o (t) \\ \end{array}
+$$
+
+where the second equality follows from the assumption that $\nabla^2 L(x)$ is full-rank when restricted on $T_x^\perp (\Gamma)$ . Then since $\partial \Phi$ is continuous, it follows that
+
+$$
+\begin{array}{l} \lim _ {t \to 0} \frac {\partial \Phi (x + t \nabla^ {2} L (x) ^ {\dagger} u) \nabla L (x + t \nabla^ {2} L (x) ^ {\dagger} u)}{t} = \lim _ {t \to 0} \partial \Phi (x + t \nabla^ {2} L (x) ^ {\dagger}) (u + o (1)) \\ = \partial \Phi (x) u. \\ \end{array}
+$$
+
+By Lemma C.2, we have $\partial \Phi (x + t(\nabla^{2}L(x))^{\dagger}u))\nabla L(x + t(\nabla^{2}L(x))^{\dagger}u) = 0$ for all $t > 0$ , which then implies that $\partial \Phi (x)u = 0$ for all $u\in T_x^\perp (\Gamma)$ .
+
+Therefore, under the basis $\{v_{i},\dots ,v_{N}\}$ $\partial \Phi (x)$ is given by
+
+$$
+\partial \Phi (x) = \left( \begin{array}{c c} I _ {D - M} & 0 \\ 0 & 0 \end{array} \right) \in \mathbb {R} ^ {D \times D},
+$$
+
+that is, the projection matrix onto $T_{x}(\Gamma)$
+
+
+
+Lemma C.3. For any $x\in \Gamma$ , it holds that $\partial \Phi (x)\nabla^2 L(x) = 0$
+
+
+
+Proof. It directly follows from Lemma C.1 and Lemma 4.3. $\square$
+
+
+
+Next, we proceed to compute the second-order derivatives.
+
+Lemma C.4. For any $x\in \Gamma$ $u\in \mathbb{R}^D$ and $v\in T_x(\Gamma)$ , it holds that
+
+$$
+\partial^ {2} \Phi (x) [ v, u ] = - \partial \Phi (x) \partial^ {2} (\nabla L) (x) [ v, \nabla^ {2} L (x) ^ {\dagger} u ] - \nabla^ {2} L (x) ^ {\dagger} \partial^ {2} (\nabla L) (x) [ v, \partial \Phi (x) u ].
+$$
+
+Proof of Lemma C.4. Consider a parametrized smooth curve $\{v(t)\}_{t\geq 0}$ on $\Gamma$ such that $v(0) = x$ and $\left.\frac{\mathrm{d}v(t)}{\mathrm{d}t}\right|_{t = 0} = v$ . We define $P(t) = \partial \Phi (v(t))$ , $P^{\perp}(t) = I_D - P(t)$ and $H(t) = \nabla^{2}L(v(t))$ for all $t\geq 0$ . By Lemma C.1 and 4.3, we have
+
+$$
+P ^ {\perp} (t) H (t) = H (t) P ^ {\perp} (t) = H (t), \tag {25}
+$$
+
+Denote the derivative of $P(t), P^{\perp}(t)$ and $H(t)$ with respect to $t$ as $P'(t), (P^{\perp})'(t)$ and $H'(t)$ . Then differentiating with respect to $t$ , we have
+
+$$
+\left(P ^ {\perp}\right) ^ {\prime} (t) H (t) = H ^ {\prime} (t) - P ^ {\perp} (t) H ^ {\prime} (t) = P (t) H ^ {\prime} (t). \tag {26}
+$$
+
+Then combining (25) and (26) and evaluating at $t = 0$ , we have
+
+$$
+P ^ {\prime} (0) H (0) = - \left(P ^ {\perp}\right) ^ {\prime} (0) H (0) = - P (0) H ^ {\prime} (0) \tag {27}
+$$
+
+We can decompose $P^{\prime}(0)$ and $H(0)$ as follows
+
+$$
+P ^ {\prime} (0) = \left( \begin{array}{c c} P _ {1 1} ^ {\prime} (0) & P _ {1 2} ^ {\prime} (0) \\ P _ {2 1} ^ {\prime} (0) & P _ {2 2} ^ {\prime} (0) \end{array} \right), \quad H (0) = \left( \begin{array}{c c} 0 & 0 \\ 0 & H _ {2 2} (0) \end{array} \right), \tag {28}
+$$
+
+where $P_{11}^{\prime}(0)\in \mathbb{R}^{(D - M)\times (D - M)}$ and $H_{22}$ is the hessian of $L$ restricted on $T_x^\perp (\Gamma)$ . Also note that
+
+$$
+\begin{array}{l} P (0) H ^ {\prime} (0) P ^ {\perp} (0) = \left( \begin{array}{c c} I _ {D - M} & 0 \\ 0 & 0 \end{array} \right) \left( \begin{array}{c c} H _ {1 1} ^ {\prime} (0) & H _ {1 2} ^ {\prime} (0) \\ H _ {2 1} ^ {\prime} (0) & H _ {2 2} ^ {\prime} (0) \end{array} \right) \left( \begin{array}{c c} 0 & 0 \\ 0 & I _ {M} \end{array} \right) \\ = \left( \begin{array}{c c} 0 & H _ {1 2} ^ {\prime} (0) \\ 0 & 0 \end{array} \right), \\ \end{array}
+$$
+
+and thus by (28) we have
+
+$$
+P ^ {\prime} (0) H (0) = \left( \begin{array}{c c} 0 & P _ {1 2} ^ {\prime} (0) H _ {2 2} (0) \\ 0 & P _ {2 2} ^ {\prime} (0) H _ {2 2} (0) \end{array} \right) = \left( \begin{array}{c c} 0 & - H _ {1 2} ^ {\prime} (0) \\ 0 & 0 \end{array} \right).
+$$
+
+This implies that we must have $P_{22}^{\prime}(0) = 0$ and $P_{12}^{\prime}(0)H_{22}(0) = H_{12}^{\prime}(0)$ . Similarly, by taking transpose in (28), we also have $H_{22}(0)P_{21}^{\prime}(0) = -H_{21}^{\prime}(0)$ .
+
+It then remains to determine the value of $P_{11}'(0)$ . Note that since $P(t)P(t) = P(t)$ , we have $P'(t)P(t) + P(t)P'(t) = P'(t)$ , evaluating at $t = 0$ yields
+
+$$
+2 P _ {1 1} ^ {\prime} (0) = P _ {1 1} ^ {\prime} (0).
+$$
+
+Therefore, we must have $P_{11}^{\prime}(0) = 0$ . Combining the above results, we obtain
+
+$$
+P ^ {\prime} (0) = - P (0) H ^ {\prime} (0) H (0) ^ {\dagger} - H (0) ^ {\dagger} H ^ {\prime} (0) P (0).
+$$
+
+Finally, recall that $P(t) = \partial \Phi(v(t))$ , and thus
+
+$$
+P ^ {\prime} (0) = \frac {\mathrm {d}}{\mathrm {d} t} \partial \Phi (v (t)) \bigg | _ {t = 0} = \partial^ {2} \Phi (x) [ v ].
+$$
+
+Similarly, we have $H^{\prime}(0) = \partial^{2}(\nabla L)(x)[v]$ , and it follows that
+
+$$
+\partial^ {2} \Phi (x) [ v ] = - \partial \Phi (x) \partial^ {2} (\nabla L) (x) [ v ] \nabla^ {2} L (x) ^ {\dagger} - \nabla^ {2} L (x) ^ {\dagger} \partial^ {2} (\nabla L) (x) [ v ] \partial \Phi (x).
+$$
+
+
+
+Lemma C.5. For any $x\in \Gamma$ and $u\in T_x^\perp (\Gamma)$ , it holds that
+
+$$
+\partial^ {2} \Phi (x) [ u u ^ {\top} + \nabla^ {2} L (x) ^ {\dagger} u u ^ {\top} \nabla^ {2} L (x) ] = - \partial \Phi (x) \partial^ {2} (\nabla L) (x) [ \nabla^ {2} L (x) ^ {\dagger} u u ^ {\top} ].
+$$
+
+Proof of Lemma C.5. For any $u \in T_x^\perp(\Gamma)$ , we define $u(t) = x + t\nabla^2 L(x)^\dagger u$ for $t \geq 0$ . By Taylor approximation, we have
+
+$$
+\nabla L (u (t)) = t \nabla^ {2} L (x) \nabla^ {2} L (x) ^ {\dagger} u + o (t) = t u + o (t) \tag {29}
+$$
+
+and
+
+$$
+\nabla^ {2} L (u (t)) = \nabla^ {2} L (x) + t \partial^ {2} (\nabla L) (x) [ \nabla^ {2} L (x) ^ {\dagger} u ] + o (t). \tag {30}
+$$
+
+Combine (29) and (30) and apply Lemma C.2, and it follows that
+
+$$
+\begin{array}{l} 0 = \partial^ {2} \Phi (u (t)) [ \nabla L (u (t)), \nabla L (u (t)) ] + \partial \Phi (u (t)) \nabla^ {2} L (u (t)) \nabla L (u (t)) \\ = t ^ {2} \partial^ {2} \Phi (u (t)) [ u + o (1) ] (u + o (1)) + t ^ {2} \partial \Phi (u (t)) \partial^ {2} (\nabla L) (x) [ \nabla^ {2} L (x) ^ {\dagger} u ] (u + o (1)) \\ + t ^ {2} \frac {\partial \Phi (u (t))}{t} \nabla^ {2} L (x) (u + o (1)) \\ = t ^ {2} \partial^ {2} \Phi (u (t)) [ u + o (1) ] (u + o (1)) + t ^ {2} \partial \Phi (u (t)) \partial^ {2} (\nabla L) (x) [ \nabla^ {2} L (x) ^ {\dagger} u ] (u + o (1)) \\ + t ^ {2} \frac {\partial \Phi (u (t)) - \partial \Phi (x)}{t} \nabla^ {2} L (x) (u + o (1)) \\ \end{array}
+$$
+
+where the last equality follows from Lemma C.3. Dividing both sides by $t^2$ and letting $t\to 0$ , we get
+
+$$
+\partial^ {2} \Phi (x) [ u ] u + \partial \Phi (x) \partial^ {2} (\nabla L) (x) [ \nabla^ {2} L (x) ^ {\dagger} u ] u + \partial^ {2} \Phi (x) [ \nabla^ {2} L (x) ^ {\dagger} u ] \nabla^ {2} L (x) u = 0.
+$$
+
+Rearranging the above equation completes the proof.
+
+With the notion of Lyapunov Operator in Definition 4.4, Lemma C.5 can be further simplified into Lemma C.6.
+
+Lemma C.6. For any $x \in \Gamma$ and $\Sigma \in \operatorname{span}\{uu^\top \mid u \in T_x^\perp(\Gamma)\}$ ,
+
+$$
+\langle \partial^ {2} \Phi (x), \Sigma \rangle = - \partial \Phi (x) \partial^ {2} (\nabla L) (x) \left[ \mathcal {L} _ {\nabla^ {2} L (x)} ^ {- 1} (\Sigma) \right]. \tag {31}
+$$
+
+Proof of Lemma C.6. Let $A = uu^{\top} + \nabla^{2}L(x)^{\dagger}uu^{\top}\nabla^{2}L(x)$ and $B = \nabla^{2}L(x)^{\dagger}uu^{\top}$ . The key observation is that $A + A^{\top} = \mathcal{L}_{\nabla^{2}L(x)}(B + B^{\top})$ . Therefore, by Lemma C.5, it holds that
+
+$$
+\partial^ {2} \Phi (x) \left[ \mathcal {L} _ {\nabla^ {2} L (x)} \left(B + B ^ {\top}\right) \right] = \partial^ {2} \Phi (x) \left[ A + A ^ {\top} \right] = 2 \partial \Phi (x) \partial^ {2} (\nabla L) (x) [ B ] = \partial \Phi (x) \partial^ {2} (\nabla L) (x) [ B + B ^ {\top} ].
+$$
+
+Since $\nabla^2 L(x)^\dagger$ is full-rank when restricted to $T_x^\perp (\Gamma)$ , we have $\operatorname{span}\{\nabla^2 L(x)^\dagger uu^\top +uu^\top \nabla^2 L(x)^\dagger | u\in T_x^\perp (\Gamma)\} = \operatorname {span}\{uu^\top |u\in T_x^\perp (\Gamma)\}$ . Thus by the linearity of above equation, we can replace $B + B^{\top}$ by any $\Sigma \in \operatorname {span}\{uu^{\top}|u\in T_{x}^{\perp}(\Gamma)\}$ , resulting in the desired equation.
+
+Then Lemma 4.5 directly follows from Lemma C.4 and C.5.
+
+# C.2 TANGENT NOISE COMPENSATION ONLY DEPENDENDS ON THE MANIFOLD ITSELF
+
+Here we show that the second term of (10), i.e., the tangent noise compensation for the limiting dynamics to stay on $\Gamma$ , only depends on $\Gamma$ itself.
+
+Lemma C.7. For any $x \in \Gamma$ , suppose there exist a neighborhood $U_x$ of $x$ and two loss functions $L$ and $L'$ that define the same manifold $\Gamma$ locally in $U_x$ , i.e., $\Gamma \cap U_x = \{x \mid \nabla L(x) = 0\} = \{x \mid \nabla L'(x) = 0\}$ . Then for any $v \in T_x(\Gamma)$ , it holds that $(\nabla^2 L(x))^{\dagger} \partial^2 (\nabla L)(x)[v,v] = (\nabla^2 L'(x))^{\dagger} \partial^2 (\nabla L')(x)[v,v]$ .
+
+Proof of Lemma C.7. Let $\{v(t)\}_{t\geq 0}$ be a smooth curve on $\Gamma$ with $v(0) = x$ and $\left.\frac{\mathrm{d}v(t)}{\mathrm{d}t}\right|_{t = 0} = v$ . Since $v(t)$ stays on $\Gamma$ , we have $\nabla L(v(t)) = 0$ for all $t\geq 0$ . Taking derivative for two times yields $\partial^2 (\nabla L)(v(t))[\frac{\mathrm{d}v(t)}{\mathrm{d}t},\frac{\mathrm{d}v(t)}{\mathrm{d}t}] + \nabla^2 L(v(t))\frac{\mathrm{d}^2v(t)}{\mathrm{d}t^2} = 0$ . Evaluating it at $t = 0$ and multiplying both sides by $\nabla^2 L(x)^\dagger$ , we get
+
+$$
+\nabla^ {2} L (x) ^ {\dagger} \partial^ {2} (\nabla L) (x) [ v, v ] = - \nabla^ {2} L (x) ^ {\dagger} \nabla^ {2} L (x) \frac {\mathrm {d} ^ {2} v (t)}{\mathrm {d} t ^ {2}} \bigg | _ {t = 0} = - \partial \Phi (x) \frac {\mathrm {d} ^ {2} v (t)}{\mathrm {d} t ^ {2}} \bigg | _ {t = 0}.
+$$
+
+Since $\partial \Phi (x)$ is the projection matrix onto $T_{x}(\Gamma)$ by Lemma 4.3, it does not depend on $L$ , so analogously we also have $\nabla^2 L'(x)^\dagger \partial^2 (\nabla L')(x)[v,v] = -\partial \Phi (x)\frac{\mathrm{d}^2v(t)}{\mathrm{d}t^2}\big|_{t = 0}$ as well. The proof is thus completed. Note that $\partial \Phi (x)\frac{\mathrm{d}^2v(t)}{\mathrm{d}t^2}\big|_{t = 0}$ is indeed the second fundamental form for $v$ at $x$ , and the value won't change if we choose another parametric smooth curve with a different second-order time derivative. (See Chapter 6 in Do Carmo (2013) for a reference.)
+
+# C.3 PROOF OF RESULTS IN SECTION 5
+
+Now we are ready to give the missing proofs in Section 5 which yield explicit formula of the limiting diffusion for label noise and isotropic noise.
+
+Corollary 5.1 (Limiting Diffusion for Isotropic Noise). If $\Sigma \equiv I_D$ on $\Gamma$ , SDE (10) is then
+
+$$
+\mathrm {d} Y (t) = \underbrace {\partial \Phi (Y) \mathrm {d} W + \frac {1}{2} \nabla^ {2} L (Y) ^ {\dagger} \partial^ {2} (\nabla L) (Y) [ \partial \Phi (Y) ] \mathrm {d} t} _ {\text {B r o w n i a n M o t i o n o n M a n i f o l d}} - \underbrace {\frac {1}{2} \partial \Phi (Y) \nabla (\ln | \nabla^ {2} L (Y) | _ {+}) \mathrm {d} t} _ {\text {N o r m a l R e g u l a r i z a t i o n}} \tag {11}
+$$
+
+where $|\nabla^2 L(Y)|_+ = \lim_{\alpha \to 0} \frac{|\nabla^2 L(Y) + \alpha I_D|}{\alpha^D - \mathrm{rank}(\nabla^2 L(Y))}$ is the pseudo-determinant of $\nabla^2 L(Y)$ . $|\nabla^2 L(Y)|_+$ is also equal to the sum of log of non-zero eigenvalue values of $\nabla^2 L(Y)$ .
+
+Proof of Corollary 5.1. Set $\Sigma_{\parallel} = \partial \Phi, \Sigma_{\perp} = I_D - \partial \Phi$ and $\Sigma_{\perp, \parallel} = \Sigma_{\parallel, \perp} = 0$ in the decomposition of $\Sigma$ by Lemma 4.5, and we need to show $\partial \Phi \nabla (\ln |\Sigma|_+) = \partial^2 (\nabla L)[(\nabla^2 L)^\dagger]$ .
+
+Holbrook (2018) shows that the gradient of pseudo-inverse determinant satisfies $\nabla |A|_{+} = |A|_{+}A^{\dagger}$ . Thus we have for any vector $v\in \mathbb{R}^{D}$ , $\left\langle v,\nabla \ln |\nabla^{2}L|_{+}\right\rangle = \left\langle \frac{|\nabla^{2}L|_{+}\nabla^{2}L}{|\nabla^{2}L|_{+}},\partial^{2}(\nabla L)[v]\right\rangle = \left\langle \nabla^{2}L,\partial^{2}(\nabla L)[v]\right\rangle = \partial^{2}(\nabla L)[v,\nabla^{2}L] = \left\langle v,\partial^{2}(\nabla L)[(\nabla^{2}L)^{\dagger}]\right\rangle$ , which completes the proof.
+
+Corollary 5.2 (Limiting Flow for Label Noise). If $\Sigma \equiv c\nabla^2 L$ on $\Gamma$ for some constant $c > 0$ , SDE (10) can be simplified into (13) where the regularization is from the noise in the normal space.
+
+$$
+\mathrm {d} Y (t) = - 1 / 4 \cdot \partial \Phi (Y (t)) \nabla \operatorname {t r} [ c \nabla^ {2} L (Y (t)) ] \mathrm {d} t. \tag {13}
+$$
+
+Proof of Corollary 5.2. Since $\Sigma = c\nabla^2 L$ , here we have $\Sigma_{\perp} = \Sigma$ and $\Sigma_{\parallel}, \Sigma_{\perp, \parallel}, \Sigma_{\parallel, \perp} = 0$ . Thus it suffices to show that $2\partial^{2}(\nabla L)\left[\mathcal{L}_{\nabla^{2}L}^{-1}(\Sigma_{\perp})\right] = \nabla \operatorname{tr}[\nabla^{2}L]$ . Note that for any $v \in \mathbb{R}^{D}$
+
+$$
+v ^ {\top} \nabla \operatorname {t r} [ \nabla^ {2} L ] = \left\langle I _ {D}, \partial^ {2} (\nabla L) [ v ] \right\rangle = \left\langle I _ {D} - \partial \Phi , \partial^ {2} (\nabla L) [ v ] \right\rangle , \tag {32}
+$$
+
+where the second equality is because the tangent space of symmetric rank- $n$ matrices at $\nabla^2 L$ is $\{A\nabla^{2}L + \nabla^{2}LA^{\top}\mid A\in \mathbb{R}^{D\times D}\}$ , and every element in this tangent space has zero inner-product with $\partial \Phi$ by Lemma 4.3. Also note that $\mathcal{L}_{\nabla^2 L}^{-1}(\nabla^2 L) = \frac{1}{2} (I_D - \partial \Phi)$ , thus $\langle I_D - \partial \Phi ,\partial^2 (\nabla L)[v]\rangle = 2\langle \mathcal{L}_{\nabla^2 L}^{-1}(\nabla^2 L),\partial^2 (\nabla L)[v]\rangle = 2v^\top \partial^2 (\nabla L)[\mathcal{L}_{\nabla^2 L}^{-1}(\nabla^2 L)]$ .
+
+# C.4 EXAMPLE: $k$ -PHASE MOTOR
+
+We also give an example with rigorous proof where the implicit bias induced by noise in the normal space cannot be characterized by a fixed regularizer, which was first discovered by Damian et al. (2021) but was only verified via experiments.
+
+Note the normal regularization in both cases of label noise and isotropic noise induces Riemannian gradient flow against some regularizer, it's natural to wonder if the limiting flow induced by the normal noise can always be characterized by certain regularizer. Interestingly, Damian et al. (2021) answers this question negatively via experiments in their Section E.2. We adapt their example into the following one, and rigorously prove the limiting flow moves around a cycle at a constant speed and never stops using our framework.
+
+Suppose dimension $D = k + 2 \geq 5$ . For each $x \in \mathbb{R}^D$ , we decompose $x = \binom{x_{1:2}}{x_{3:D}}$ where $x_{1:2} \in \mathbb{R}^2$ and $x_{3:D} \in \mathbb{R}^{D-2}$ . Let $Q_\theta \in \mathbb{R}^{2 \times 2}$ be the rotation matrix of angle $\theta$ , i.e., $Q_\theta = \left( \begin{array}{cc}\cos \theta & -\sin \theta \\ \sin \theta & \cos \theta \end{array} \right)$ and the loss $L(x) := \frac{1}{8} (\| x_{1:2}\|_2^2 -1)^2 +\frac{1}{2}\sum_{j = 3}^{D}(2 + \bigl < Q_\alpha^{j - 3}v,x_{1:2}\bigr > x_j^2$ , where $\alpha = \frac{2\pi}{D - 2}$ and $v$ is any vector in $\mathbb{R}^2$ with unit norm. Here the manifold is given by $\Gamma := \{x\mid L(x) = 0\} = \{x\in \mathbb{R}^D\mid x_1^2 +x_2^2 = 1,x_j = 0,\forall j = 3,\ldots ,D\}$ .
+
+The basic idea is that we can add noise in the 'auxiliary dimensions' for $j = 3, \ldots, D$ to get the regularization force on the circle $\{x_1^2 + x_2^2 = 1\}$ , and the goal is to make the vector field induced by the normal regularization always point to the same direction, say anti-clockwise. However, this cannot be done with a single auxiliary dimension because from the analysis for label noise, we know when $\mathcal{L}_{\nabla^2 L}^{-1}(\Sigma_\perp)$ is identity, the normal regularization term in Equation (10) has 0 path integral along the unit circle and thus it must have both directions. The key observation here is that we can align the magnitude of noise with the strength of the regularization to make the path integral positive. By using $k \geq 3$ auxiliary dimensions, we can further ensure the normal regularization force is anti-clockwise and of constant magnitude, which is reminiscent of how a three-phase induction motor works.
+
+Lemma C.8. Let $\Sigma \in \mathbb{R}^{D\times D}$ be given by $\Sigma_{ij}(x) = (1 + \langle Q_\alpha^{j - 3}v,Q_{-\pi /2}x_{1:2}\rangle)(2 + \langle Q_\alpha^{j - 3}v,x_{1:2}\rangle)$ , if $i = j\geq 3$ or 0 otherwise, then the solution of SDE (10) is the following (33), which implies that $Y(t)$ moves anti-clockwise with a constant angular speed of $(D - 2) / 2$ .
+
+$$
+Y _ {1: 2} (t) = Q _ {t (D - 2) / 2} Y _ {1: 2} (0) \quad a n d \quad Y _ {3: D} (t) \equiv 0. \tag {33}
+$$
+
+Proof of Lemma C.8. Note that for any $x \in \Gamma$ , it holds that
+
+$$
+\left(\nabla^ {2} L (x)\right) _ {i j} = \left\{ \begin{array}{l l} 2 + \left\langle Q _ {\alpha} ^ {j - 3} v, x _ {1: 2} \right\rangle & \text {i f} i = j \geq 3, \\ x _ {i} x _ {j} & \text {i f} i, j \in \{1, 2 \}, \\ 0 & \text {o t h e r w i s e .} \end{array} \right. \tag {34}
+$$
+
+Then clearly $\Sigma$ only brings about noise in the normal space, and specifically, it holds that $\mathcal{L}_{\nabla^2 L(x)}^{-1}(\Sigma (x)) = \mathrm{diag}(0,0,1 + \langle Q_\alpha^0 v,Q_{-\pi /2}x_{1:2}\rangle ,\ldots ,1 + \langle Q_\alpha^{D - 3}v,Q_{-\pi /2}x_{1:2}\rangle)$ . Further note that, by the special structure of the hessian in (34) and Lemma C.3, for any $x\in \Gamma$ , we have $\partial \Phi (x) = (x_2, - x_1,0,\dots ,0)^\top (x_2, - x_1,0,\dots ,0) = \binom {Q_{-\pi /2}x_{1:2}}{0}\binom {Q_{-\pi /2}x_{1:2}}{0}^\top$ . Combining these
+
+facts, the dynamics of the first two coordinates in SDE (10) can be simplified into
+
+$$
+\begin{array}{l} \frac {\mathrm {d} x _ {1 : 2} (t)}{\mathrm {d} t} = - \left(\frac {1}{2} \partial \Phi (x (t)) \partial^ {2} (\nabla L) (x (t)) [ \mathcal {L} _ {\nabla^ {2} L} ^ {- 1} (\Sigma (x (t))) ]\right) _ {1: 2} \\ = - \frac {1}{2} Q _ {- \pi / 2} x _ {1: 2} x _ {1: 2} ^ {\top} Q _ {- \pi / 2} ^ {\top} \sum_ {j = 3} ^ {D} \left(1 + \left\langle Q _ {\alpha} ^ {j - 3} v, Q _ {- \pi / 2} x _ {1: 2} \right\rangle\right) \nabla_ {1: 2} \left(\partial_ {j j} L\right) (x) \\ = - \frac {1}{2} Q _ {- \pi / 2} x _ {1: 2} \left\langle Q _ {- \pi / 2} x _ {1: 2}, \sum_ {j = 3} ^ {D} \left(1 + \left\langle Q _ {\alpha} ^ {j - 3} v, Q _ {- \pi / 2} x _ {1: 2} \right\rangle\right) Q _ {\alpha} ^ {j - 3} v \right\rangle \\ = - \frac {1}{2} Q _ {- \pi / 2} x _ {1: 2} \left(\left\langle Q _ {- \pi / 2} x _ {1: 2}, \sum_ {j = 3} ^ {D} Q _ {\alpha} ^ {j - 3} v \right\rangle + \sum_ {j = 3} ^ {D} \left\langle Q _ {\alpha} ^ {j - 3} v, Q _ {- \pi / 2} x _ {1: 2} \right\rangle^ {2}\right) \\ = - \frac {1}{2} Q _ {- \pi / 2} x _ {1: 2} \left(0 + \frac {D - 2}{2} \left\| Q _ {- \pi / 2} x _ {1: 2} \right\| _ {2} ^ {2}\right) = \frac {D - 2}{2} Q _ {\pi / 2} x _ {1: 2}, \\ \end{array}
+$$
+
+where the second to the last equality follows from the property of $Q_{\alpha}$ and the last equality follows from the fact that $\| x_{1:2}\| _2^2 = 1$ for all $x\in \Gamma$ . Note we require $k\geq 3$ (or $D\geq 5$ ) to allow $\sum_{j = 3}^{D}\left\langle Q_{\alpha}^{j - 3}v,Q_{-\pi /2}x_{1:2}\right\rangle^{2} = \frac{D - 2}{2}\left\| Q_{-\pi /2}x_{1:2}\right\| _2^2$ . On the other hand, we have $\frac{\mathrm{d}x_{3:D}(t)}{\mathrm{d}t} = 0$ as $\partial \Phi$ kills the movement on that component.
+
+The proof is completed by noting that the solution of $x_{1:2}$ is
+
+$$
+x _ {1: 2} (t) = \exp \left(t \cdot \frac {D - 2}{2} Q _ {\pi / 2}\right) x _ {1: 2} (0),
+$$
+
+and by Lemma C.9,
+
+$$
+\exp \left(t \cdot \frac {D - 2}{2} Q _ {\pi / 2}\right) = \left(\exp \left(Q _ {\pi / 2}\right)\right) ^ {\frac {t (D - 2)}{2}} = Q _ {1} ^ {\frac {t (D - 2)}{2}} = Q _ {\frac {t (D - 2)}{2}}.
+$$
+
+
+
+Lemma C.9. $\exp \left(\binom{0-1}{10}\right) = \binom{\cos 1 - \sin 1}{\sin 1\cos 1}.$
+
+Proof. By definition, for matrix $A = \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}$ , $\exp(A) = \sum_{t=0}^{\infty} \frac{A^t}{t!}$ . Note $A_2 = -I$ , $A^3 = -A$ and $A^4 = I$ , and by using this pattern, we can easily check that
+
+$$
+\sum_ {t = 0} ^ {\infty} \frac {A ^ {t}}{t !} = \left( \begin{array}{c c} \sum_ {i = 0} ^ {\infty} (- 1) ^ {i} \frac {1}{(2 i) !} & - \sum_ {i = 0} ^ {\infty} (- 1) ^ {i} \frac {1}{(2 i + 1) !} \\ \sum_ {i = 0} ^ {\infty} (- 1) ^ {i} \frac {1}{(2 i + 1) !} & \sum_ {i = 0} ^ {\infty} (- 1) ^ {i} \frac {1}{(2 i) !} \end{array} \right) = \left( \begin{array}{c c} \cos 1 & - \sin 1 \\ \sin 1 & \cos 1 \end{array} \right).
+$$
+
+
+
+# D PROOF OF RESULTS IN SECTION 6
+
+In this section, we present the missing proofs in Section 6 regarding the overparametrized linear model.
+
+For convenience, for any $p,r\geq 0$ and $u\in \mathbb{R}^D$ , we denote by $B_r^p (u)$ the $\ell_p$ norm ball of radius $r$ centered at $u$ . We also denote $v_{i:j} = (v_i,v_{i + 1},\ldots ,v_j)^\top$ for $i,j\in [D]$ .
+
+# D.1 PROOF OF THEOREM 6.1
+
+In this subsection, we provide the proof of Theorem 6.1.
+
+Theorem 6.1. In the setting of OLM, suppose the groundtruth is $\kappa$ -sparse and $n \geq \Omega(\kappa \ln d)$ training data are sampled from either i.i.d. Gaussian or Boolean distribution. Then for any initialization $x_{init}$ (except a zero-measure set) and any $\epsilon > 0$ , there exist $\eta_0, T > 0$ such that for any $\eta < \eta_0$ , OLM trained with label noise SGD (12) with LR equal to $\eta$ for $\lfloor T / \eta^2 \rfloor$ steps returns an $\epsilon$ -optimal solution, with probability of $1 - e^{-\Omega(n)}$ over the randomness of the training dataset.
+
+Proof of Theorem 6.1. First, by Lemma 6.6, it holds with probability at least $1 - e^{-\Omega (n)}$ that the solution to (18), $x_{*}$ , is unique up to and satisfies $|x_{*}| = \psi (w_{*})$ . Then on this event, for any $\epsilon >0$ by Lemma 6.5, there exists some $T > 0$ such that $x_{T}$ given by the Riemannian gradient flow (17) satisfies that $x_{T}$ is an $\epsilon /2$ -optimal solution of the OLM. For this $T$ , by Theorem 4.6, we know that the $\lfloor T / \eta^2\rfloor$ -th SGD iterate, $x_{\eta}(\lfloor T / \eta^{2}\rfloor)$ , satisfies $\| x_{\eta}(\lfloor T / \eta^{2}\rfloor) - x_{T}\|_{2}\leq \epsilon /2$ with probability at least $1 - e^{-\Omega (n)}$ for all sufficiently small $\eta >0$ , and thus $x_{\eta}(\lfloor T / \eta^{2}\rfloor)$ is an $\epsilon$ -optimal solution of the OLM. Finally, the validity of applying Theorem 4.6 is guaranteed by Lemma 6.2 and 6.3. This completes the proof.
+
+In the following subsections, we provide the proofs of all the components used in the above proof.
+
+# D.2 PROOF OF LEMMA 6.2
+
+Recall that for each $i \in [n]$ $f_i(x) = f(u, v) = z_i^\top (u^{\odot 2} - v^{\odot 2})$ , $\nabla f_i(x) = 2\binom{z_i \odot u}{z_i \odot v}$ , and $K(x) = (K_{ij}(x))_{i,j \in [n]}$ where each $K_{ij}(x) = \langle \nabla f_i(x), \nabla f_j(x) \rangle$ . Then
+
+$$
+\nabla^ {2} \ell_ {i} (x) = 2 \left( \begin{array}{c} z _ {i} \odot u \\ - z _ {i} \odot v \end{array} \right) \left((z _ {i} \odot u) ^ {\top} \quad - (z _ {i} \odot v) ^ {\top}\right) + (f _ {i} (u, v) - y _ {i}) \cdot \mathrm {d i a g} (z _ {i}, z _ {i}).
+$$
+
+So for any $x\in \Gamma$ , it holds that
+
+$$
+\nabla^ {2} L (x) = \frac {2}{n} \sum_ {i = 1} ^ {n} \binom {z _ {i} \odot u} {- z _ {i} \odot v} \left(\left(z _ {i} \odot u\right) ^ {\top} - \left(z _ {i} \odot v\right) ^ {\top}\right). \tag {35}
+$$
+
+Lemma D.1. For any fixed $x \in \mathbb{R}^D$ , suppose $\{\nabla f_i(x)\}_{i \in [n]}$ is linearly independent, then $K(x)$ is full-rank.
+
+Proof of Lemma D.1. Suppose otherwise, then there exists some $\lambda \in \mathbb{R}^n$ such that $\lambda \neq 0$ and $\lambda^\top K(x)\lambda = 0$ . However, note that
+
+$$
+\begin{array}{l} \lambda^ {\top} K (x) \lambda = \sum_ {i, j = 1} ^ {n} \lambda_ {i} \lambda_ {j} K _ {i j} (x) \\ = \sum_ {i, j = 1} ^ {n} \lambda_ {i} \lambda_ {j} \langle \nabla f _ {i} (x), \nabla f _ {j} (x) \rangle \\ = \left\| \sum_ {i = 1} ^ {n} \lambda_ {i} \nabla f _ {i} (x) \right\| _ {2} ^ {2}, \\ \end{array}
+$$
+
+which implies that $\sum_{i=1}^{n} \lambda_i \nabla f_i(x) = 0$ . This is a contradiction since by assumption $\{\nabla f_i(x)\}_{i \in [n]}$ is linearly independent.
+
+Lemma 6.2. Consider the loss $L$ defined in (14) and manifold $\Gamma$ defined in (15). If data is full rank, i.e., $\operatorname{rank}(Z) = n$ , then it holds that (a). $\Gamma$ is a smooth manifold of dimension $D - n$ ; (b). $\operatorname{rank}(\nabla^2 L(x)) = n$ for all $x \in \Gamma$ . In particular, $\operatorname{rank}(Z) = n$ holds with probability 1 for Gaussian distribution and with probability $1 - c^d$ for Boolean distribution for some constant $c \in (0,1)$ .
+
+Proof of Lemma 6.2. (1) By preimage theorem (Banyaga & Hurtubise, 2013), it suffices to check the jacobian $\left[\nabla f_1(x),\ldots ,\nabla f_n(x)\right] = 2\left[\binom{z_1\odot u}{-z_1\odot v}\right],\ldots ,\binom{z_n\odot u}{-z_n\odot v}]$ is full rank. Similarly, for the second claim, due to (35). it is also equivalent to show that $\{\binom{z_i\odot u}{-z_i\odot v}\}_{i\in [n]}$ is of rank $n$
+
+Since $\binom{u}{v} \in \Gamma \subset U$ , each coordinate is non-zero, thus we only need to show that $\{z_i\}_{i \in [n]}$ is of rank $n$ . This happens with probability 1 in the Gaussian case, and probability at least $1 - c^d$ for some constant $c \in (0,1)$ by Kahn et al. (1995). This completes the proof.
+
+# D.3 PROOF OF LEMMA 6.3
+
+We first establish some auxiliary results. The following lemma shows the PL condition along the trajectory of gradient flow.
+
+Lemma D.2. Along the gradient flow generated by $-\nabla L$ , it holds that $\| \nabla L(x(t))\|^2 \geq \frac{16}{n}\lambda_{\min}(ZZ^\top) \cdot \min_{i \in [d]} |u_i(0)v_i(0)|L(x(t)), \forall t \geq 0$ .
+
+To prove Lemma D.2, we need the following invariance along the gradient flow.
+
+Lemma D.3. Along the gradient flow generated by $-\nabla L$ , $u_{j}(t)v_{j}(t)$ stays constant for all $j\in [d]$ . Thus, $\mathrm{sign}(u_j(t)) = \mathrm{sign}(u_j(0))$ and $\mathrm{sign}(v_j(t)) = \mathrm{sign}(v_j(0))$ for any $j\in [d]$ .
+
+Proof of Lemma D.3.
+
+$$
+\begin{array}{l} \frac {\partial}{\partial t} \left(u _ {j} (t) v _ {j} (t)\right) = \frac {\partial u _ {j} (t)}{\partial t} \cdot v _ {j} (t) + u _ {j} (t) \cdot \frac {\partial v _ {j} (t)}{\partial t} \\ = \nabla_ {u} L (u (t), v (t)) _ {j} \cdot v _ {j} (t) + u _ {j} (t) \cdot \nabla_ {v} L (u (t), v (t)) _ {j} \\ = \frac {2}{n} \sum_ {i = 1} ^ {n} \left(f _ {i} (u (t), v (t)) - y _ {i}\right) z _ {i, j} u _ {j} (t) v _ {j} (t) - \frac {2 u _ {j} (t)}{n} \sum_ {i = 1} ^ {n} \left(f _ {i} (u (t), v (t)) - y _ {i}\right) z _ {i, j} v _ {j} (t) \\ = 0. \\ \end{array}
+$$
+
+Therefore, any sign change of $u_{j}(t), v_{j}(t)$ would enforce $u_{j}(t) = 0$ or $v_{j}(t) = 0$ for some $t > 0$ since $u_{j}(t), v_{j}(t)$ are continuous in time $t$ . This immediately leads to a contradiction to the invariance of $u_{j}(t)v_{j}(t)$ .
+
+We then can prove Lemma D.2.
+
+Proof of Lemma D.2. Note that
+
+$$
+\begin{array}{l} \| \nabla L (x) \| _ {2} ^ {2} = \frac {1}{n ^ {2}} \sum_ {i, j = 1} ^ {n} (f _ {i} (x) - y _ {i}) (f _ {j} (x) - y _ {j}) \langle \nabla f _ {i} (x), \nabla f _ {j} (x) \rangle \\ \geq \frac {1}{n ^ {2}} \sum_ {i = 1} ^ {n} (f _ {i} (x) - y _ {i}) ^ {2} \lambda_ {\min } (K (x)) \\ = \frac {2}{n} L (x) \lambda_ {\mathrm {m i n}} (K (x)), \\ \end{array}
+$$
+
+where $K(x)$ is a $n \times n$ p.s.d. matrix with $K_{ij}(x) = \langle \nabla f_i(x), \nabla f_j(x) \rangle$ . Below we lower bound $\lambda_{\min}(K(x))$ , the smallest eigenvalue of $K(x)$ . Note that $K_{ij}(x(t)) = 4 \sum_{h=1}^{d} z_{i,h} z_{j,h} ((u_h(t))^2 + (v_h(t))^2)$ , and we have
+
+$$
+\begin{array}{l} K (x (t)) = 4 Z \mathrm {d i a g} ((u (t)) ^ {\odot 2} + (v (t)) ^ {\odot 2}) Z ^ {\top} \succeq 8 Z \mathrm {d i a g} (| u (t) \odot v (t) |) Z ^ {\top} \\ \stackrel {* \ast} {=} 8 Z \operatorname {d i a g} (| u (0) \odot v (0) |) Z ^ {\top} \succeq 8 \min _ {i \in [ d ]} | u _ {i} (0) v _ {i} (0) | Z Z ^ {T} \\ \end{array}
+$$
+
+where $(\ast)$ is by Lemma D.3. Thus $\lambda_{\min}(K(x(t)) \geq 8 \min_{i \in [d]} |u_i(0)v_i(0)|\lambda_{\min}(ZZ^T)$ for all $t \geq 0$ which completes the proof.
+
+We also need the following characterization of the manifold $\Gamma$ .
+
+Lemma D.4. All the stationary points in $U$ are global minimizers, i.e., $\Gamma = \{x\in U\mid \nabla L(x) = 0\}$ .
+
+Proof of Lemma D.4. Since $\Gamma$ is the set of local minimizers, each $x$ in $\Gamma$ must satisfy $\nabla L(x) = 0$ . The other direction is proved by noting that $\mathrm{rank}(\{z_i\}_{i\in [n]}) = n$ , which implies $\mathrm{rank}(\{\nabla f_i(x)\}_{i\in [n]}) = n$ .
+
+Now, we are ready to prove Lemma 6.3 which is restated below.
+
+Lemma 6.3. Consider the loss function $L$ defined in (14), manifold $\Gamma$ and its open neighborhood defined in (15). For gradient flow $\frac{\mathrm{d}x_t}{\mathrm{d}t} = -\nabla L(x_t)$ starting at any $x_0 \in U$ , it holds that $\Phi(x_0) \in \Gamma$ .
+
+Proof of Lemma 6.3. It suffices to prove gradient flow $\frac{\mathrm{d}x(t)}{\mathrm{d}t} = -\nabla L(x(t))$ converges when $t \to \infty$ , as long as $x(0) \in U$ . Whenever it converges, it must converge to a stationary point in $U$ . The proof will be completed by noting that all stationary points of $L$ in $U$ belong to $\Gamma$ (Lemma D.4).
+
+Below we prove $\lim_{t\to \infty}x(t)$ exists. Denote $C = \frac{16}{n}\min_{i\in [d]}|u_i(0)v_i(0)|\lambda_{\mathrm{min}}(ZZ^\top)$ , then it follows from Lemma D.2 that
+
+$$
+\left\| \frac {\mathrm {d} x (t)}{\mathrm {d} t} \right\| = \| \nabla L (x (t)) \| \leq \frac {\| \nabla L (x (t)) \| _ {2} ^ {2}}{\sqrt {C L (x (t))}} = \frac {- \frac {\mathrm {d} L (x (t))}{\mathrm {d} t}}{\sqrt {L (x (t))}} = - \frac {1}{2 \sqrt {C}} \frac {\mathrm {d} \sqrt {L (x (t))}}{\mathrm {d} t}.
+$$
+
+Thus the total GF trajectory length is bounded by $\int_{t=0}^{\infty}\left\|\frac{\mathrm{d}x(t)}{\mathrm{d}t}\right\| \mathrm{d}t \leq \int_{t=0}^{\infty}-\frac{1}{2\sqrt{C}}\frac{\mathrm{d}\sqrt{L}(x(t))}{\mathrm{d}dt} \mathrm{d}t \leq \frac{L(x(0))}{2\sqrt{C}}$ , where the last inequality uses that $L$ is non-negative over $\mathbb{R}^{D}$ . Therefore, the GF must converge.
+
+# D.4 PROOF OF RESULTS IN SECTION 6.2
+
+Without loss of generality, we will assume $\sum_{i=1} z_{i,j}^2 > 0$ for all $j \in [d]$ , because otherwise we can just delete the unused coordinate, since there won't be any update in the parameter corresponding to that coordinate. Moreover, in both gaussian and boolean setting, it can be shown that with probability $1$ , $\sum_{i=1} z_{i,j}^2 > 0$ for all $j \in [d]$ .
+
+To study the optimal solution to (18), we consider the corresponding $d$ -dimensional convex program in terms of $w \in \mathbb{R}^d$ , which has been studied in Tropp (2015):
+
+$$
+\text {m i n i m i z e} R (w) = \frac {4}{n} \sum_ {j = 1} ^ {d} \left(\sum_ {i = 1} ^ {n} z _ {i, j} ^ {2}\right) | w _ {j} |, \tag {36}
+$$
+
+$$
+\text {s u b j e c t} \quad Z w = Z w ^ {*}.
+$$
+
+Here we slightly abuse the notation of $R$ and the parameter dimension will be clear from the context. We can relate the optimal solution to (18) to that of (36) via a canonical parametrization defined as follows.
+
+Definition D.5 (Canonical Parametrization). For any $w \in \mathbb{R}^d$ , we define $\binom{u}{v} = \psi(w) = ([w^\top]_+^{\odot 1/2}, [-w^\top]_+^{\odot 1/2})^\top$ as the canonical parametrization of $w$ . Clearly, it holds that $u^{\odot 2} - v^{\odot 2} = w$ .
+
+Indeed, we can show that if (36) has a unique optimal solution, it immediately follows that the optimal solution to (18) is also unique up to sign flips of each coordinate, as summarized in the lemma below.
+
+Lemma D.6. Suppose the optimal solution to (36) is unique and equal to $w^{*}$ . Then the optimal solution to (18) is also unique up to sign flips of each coordinate. In particular, one of them is given by $(\tilde{u}^{*},\tilde{v}^{*}) = \psi (w^{*})$ , that is, the canonical parametrization of $w^{*}$ .
+
+Proof of Lemma D.6. Let $(\hat{u},\hat{v})$ be any optimal solution of (18) and we define $\hat{w} = \hat{u}^{\odot 2} - \hat{v}^{\odot 2}$ , which is also feasible to (36). By the optimality of $w^{*}$ , we have
+
+$$
+\sum_ {j = 1} ^ {d} \left(\sum_ {i = 1} ^ {n} z _ {i, j} ^ {2}\right) | w _ {j} ^ {*} | \leq \sum_ {j = 1} ^ {d} \left(\sum_ {i = 1} ^ {n} z _ {i, j} ^ {2}\right) | \hat {w} _ {j} | \leq \sum_ {j = 1} ^ {d} \left(\sum_ {i = 1} ^ {n} z _ {i, j} ^ {2}\right) (\hat {u} _ {j} ^ {2} + \hat {v} _ {j} ^ {2}). \tag {37}
+$$
+
+On the other hand, $(\tilde{u}^{*},\tilde{v}^{*}) = \psi (w^{*})$ is feasible to (18). Thus, it follows from the optimality of $(\hat{u},\hat{v})$ that
+
+$$
+\sum_ {j = 1} ^ {d} \left(\sum_ {i = 1} ^ {n} z _ {i, j} ^ {2}\right) \left(\hat {u} _ {j} ^ {2} + \hat {v} _ {j} ^ {2}\right) \leq \sum_ {j = 1} ^ {d} \left(\sum_ {i = 1} ^ {n} z _ {i, j} ^ {2}\right) \left(\left(\tilde {u} _ {j} ^ {*}\right) ^ {2} + \left(\tilde {v} _ {j} ^ {*}\right) ^ {2}\right) = \sum_ {j = 1} ^ {d} \left(\sum_ {i = 1} ^ {n} z _ {i, j} ^ {2}\right) | w _ {j} ^ {*} |. \tag {38}
+$$
+
+Combining (37) and (38) yields
+
+$$
+\sum_ {j = 1} ^ {d} \left(\sum_ {i = 1} ^ {n} z _ {i, j} ^ {2}\right) \left(\hat {u} _ {j} ^ {2} + \hat {v} _ {j} ^ {2}\right) = \sum_ {j = 1} ^ {d} \left(\sum_ {i = 1} ^ {n} z _ {i, j} ^ {2}\right) \left| w _ {j} ^ {*} \right| = \sum_ {j = 1} ^ {d} \left(\sum_ {i = 1} ^ {n} z _ {i, j} ^ {2}\right) \left| \hat {u} _ {j} ^ {2} - \hat {v} _ {j} ^ {2} \right| \tag {39}
+$$
+
+which implies that $\hat{u}^{\odot 2} - \hat{v}^{\odot 2}$ is also an optimal solution of (36). Since $w^{*}$ is the unique optimal solution to (36), we have $\hat{u}^{\odot 2} - \hat{v}^{\odot 2} = w^{*}$ . Moreover, by (39), we must have $\hat{u}^{\odot 2} = [w^{*}]_{+}$ and $\hat{u}^{\odot 2} = [w^{*}]_{+}$ , otherwise the equality would not hold. This completes the proof.
+
+Therefore, the unique optimality of (18) can be reduced to that of (36). In the sequel, we show that the latter holds for both Boolean and Gaussian random vectors. We divide Lemma 6.6 into to Lemma D.8 and D.7 for clarity.
+
+Lemma D.7 (Boolean Case). Let $z_1, \ldots, z_n \stackrel{i.i.d.}{\sim} \mathrm{Unif}(\{\pm 1\}^d)$ . There exist some constants $C, c > 0$ such that if the sample size $n$ satisfies
+
+$$
+n \geq C [ \kappa \ln (d / \kappa) + \kappa ]
+$$
+
+then with probability at least $1 - e^{-cn^2}$ , the optimal solution of (18), $(\hat{u},\hat{v})$ , is unique up to sign flips of each coordinate and recovers the groundtruth, i.e., $\hat{u}^{\odot 2} - \hat{v}^{\odot 2} = w^{*}$ .
+
+Proof of Lemma D.7. By the assumption that $z_{1},\ldots ,z_{n}\stackrel {\mathrm{i.i.d.}}{\sim}\mathrm{Unif}(\{\pm 1\}^{d})$ , we have $\sum_{i = 1}^{n}z_{i,j}^{2} = n$ for all $j\in [d]$ . Then (36) is equivalent to the following optimization problem:
+
+minimize $g(w) = \| w\| _1$
+
+subject to $Zw = Z((u^{*})^{\odot 2} - (v^{*})^{\odot 2})$ (40)
+
+This model exactly fits the Example 6.2 in Tropp (2015) with $\sigma = 1$ and $\alpha = 1 / \sqrt{2}$ . Then applying Equation (4.2) and Theorem 6.3 in Tropp (2015), (40) has a unique optimal solution equal to $(u^{*})^{\odot 2} - (v^{*})^{\odot 2}$ with probability at least $1 - e^{-ch^2}$ for some constant $c > 0$ , given that the sample size satisfies
+
+$$
+n \geq C (\kappa \ln (d / \kappa) + \kappa + h)
+$$
+
+for some absolute constant $C > 0$ . Choosing $h = \frac{n}{2C}$ and then adjusting the choices of $C, c$ appropriately yield the desired result. Finally, applying Lemma D.6 finishes the proof.
+
+The Gaussian case requires more careful treatment.
+
+Lemma D.8 (Gaussian Case). Let $z_{1},\ldots ,z_{n} \stackrel{i.i.d.}{\sim}\mathcal{N}(0,I_{d})$ . There exist some constants $C,c > 0$ such that if the sample size satisfies
+
+$$
+n \geq C \kappa \ln d,
+$$
+
+then with probability at least $1 - (2d + 1)e^{-cn}$ , the optimal solution of (18), $(\hat{u},\hat{v})$ , is unique up to sign flips of each coordinate of $\hat{u}$ and $\hat{v}$ and recovers the groundtruth, i.e., $\hat{u}^{\odot 2} - \hat{v}^{\odot 2} = w^{*}$ .
+
+Proof of Lemma D.8. Since $z_{1},\ldots ,z_{n}\stackrel {\mathrm{i.i.d.}}{\sim}\mathcal{N}(0,I_{d})$ , we have
+
+$$
+\mathbb {P} \left[ \sum_ {i = 1} ^ {n} z _ {i, j} ^ {2} \in [ n / 2, 3 n / 2 ], \forall j \in [ d ] \right] \geq 1 - 2 d e ^ {- c n}
+$$
+
+for some constant $c > 0$ , and we denote this event by $\mathcal{E}_n$ . Therefore, on $\mathcal{E}_n$ , we have
+
+$$
+2 \sum_ {j = 1} ^ {D} \left(u _ {j} ^ {2} + v _ {j} ^ {2}\right) \leq R (x) \leq 6 \sum_ {j = 1} ^ {D} \left(u _ {j} ^ {2} + v _ {j} ^ {2}\right)
+$$
+
+or equivalently,
+
+$$
+2 (\| u ^ {\odot 2} \| _ {1} + \| v ^ {\odot 2} \| _ {1}) \leq R (x) \leq 6 (\| u ^ {\odot 2} \| _ {1} + v ^ {\odot 2} \| _ {1}).
+$$
+
+Define $w^{*} = (u^{*})^{\odot 2} - (v^{*})^{\odot 2}$ , and (36) is equivalent to the following convex optimization problem
+
+$$
+\text {m i n i m i z e} \quad g (w) = \frac {4}{n} \sum_ {j = 1} ^ {d} \left(\sum_ {i = 1} ^ {n} z _ {i, j} ^ {2}\right) | w _ {j} + w _ {j} ^ {*} |, \tag {41}
+$$
+
+subject to $Zw = 0$
+
+The point $w = 0$ is feasible for (41), and we claim that this is the unique optimal solution when $n$ is large enough. In detail, assume that there exists a non-zero feasible point $w$ for (41) in the descent cone (Tropp, 2015) $\mathcal{D}(g, w^*)$ of $g$ , then
+
+$$
+\lambda_ {\min } (Z; \mathcal {D} (g, w ^ {*})) \leq \frac {\| Z w \| _ {2}}{\| w \| _ {2}} = 0
+$$
+
+where the equality follows from that $w$ is feasible. Therefore, we only need to show that $\lambda_{\min}(Z; \mathcal{D}(g, x^{*}))$ is bounded from below for sufficiently large $n$ .
+
+On $\mathcal{E}_n$ , it holds that $g$ belongs to the following function class
+
+$$
+\mathcal {G} = \left\{h: \mathbb {R} ^ {d} \rightarrow \mathbb {R} \mid h (w) = \sum_ {j = 1} ^ {d} v _ {j} | w _ {j} |, v \in \Upsilon \right\} \text {w i t h} \Upsilon = \left\{v \in \mathbb {R} ^ {d}: v _ {j} \in [ 2, 6 ], \forall j \in [ d ] \right\}.
+$$
+
+We identify $g_v \in \mathcal{G}$ with $v \in \Upsilon$ , then $\mathcal{D}(g, w^*) \subseteq \cup_{v \in \Upsilon} \mathcal{D}(g_v, w^*) \coloneqq \mathcal{D}_{\Upsilon}$ , which further implies that
+
+$$
+\lambda_ {\min } (Z; \mathcal {D} (g, w ^ {*})) \geq \lambda_ {\min } (Z; \mathcal {D} _ {\Upsilon}).
+$$
+
+Recall the definition of minimum conic singular value (Tropp, 2015):
+
+$$
+\lambda_{\min}(Z;\mathcal{D}_{\Upsilon}) = \inf_{p\in \mathcal{D}_{\Upsilon}\cap \mathcal{S}^{d - 1}}\sup_{q\in \mathcal{S}^{n - 1}}\langle q,Zp\rangle .
+$$
+
+where $S^{n - 1}$ denotes the unit sphere in $\mathbb{R}^n$ . Applying the same argument as in Tropp (2015) yields
+
+$$
+\mathbb {P} \left[ \lambda_ {\min} (Z; \mathcal {D} _ {\Upsilon}) \geq \sqrt {n - 1} - w (\mathcal {D} _ {\Upsilon}) - h \right] \geq 1 - e ^ {- h ^ {2} / 2}.
+$$
+
+Take the intersection of this event with $\mathcal{E}_n$ , and we obtain from a union bound that
+
+$$
+\lambda_ {\min } \left(Z; \mathcal {D} \left(g, w ^ {*}\right)\right) \geq \sqrt {n - 1} - w \left(\mathcal {D} _ {\Upsilon}\right) - h \tag {42}
+$$
+
+with probability at least $1 - e^{-h^2 /2} - 2de^{-cn}$ . It remains to determine $w(\mathcal{D}_{\Upsilon})$ , which is defined as
+
+$$
+w \left(\mathcal {D} _ {\Upsilon}\right) = \mathbb {E} _ {z \sim \mathcal {N} \left(0, I _ {d}\right)} \left[ \sup _ {p \in \mathcal {D} _ {\Upsilon} \cap \mathcal {S} ^ {d - 1}} \langle z, p \rangle \right] = \mathbb {E} _ {z \sim \mathcal {N} \left(0, I _ {d}\right)} \left[ \sup _ {v \in \Upsilon} \sup _ {p \in \mathcal {D} \left(g _ {v}, x ^ {*}\right) \cap \mathcal {S} ^ {d - 1}} \langle z, p \rangle \right]. \tag {43}
+$$
+
+Without loss of generality, we assume that $w^{*} = (w_{1}^{*},\dots ,w_{\kappa}^{*},0,\dots ,0)^{\top}$ with $w_{1}^{*},\ldots ,w_{\kappa}^{*} > 0$ , otherwise one only needs to specify the signs and the nonzero set of $w^{*}$ in the sequel. For any $v\in \Upsilon$ and any $p\in \mathcal{D}(g_v,w^*)\cap \mathcal{S}^{d - 1}$ , there exists some $\tau >0$ such that $g_{v}(w^{*} + \tau \cdot p)\leq g_{v}(w^{*})$ , i.e.,
+
+$$
+\sum_ {j = 1} ^ {d} v _ {j} \left| w _ {j} ^ {*} + \tau p _ {j} \right| \leq \sum_ {j = 1} ^ {d} v _ {j} \left| w _ {j} ^ {*} \right|
+$$
+
+which further implies that
+
+$$
+\tau \sum_ {j = \kappa + 1} ^ {d} v _ {j} | p _ {j} | \leq \sum_ {j = 1} ^ {\kappa} v _ {j} \left(\left| w _ {j} ^ {*} \right| - \left| w _ {j} ^ {*} - \tau p _ {j} \right|\right) \leq \tau \sum_ {j = 1} ^ {\kappa} v _ {j} | p _ {j} |
+$$
+
+where the second inequality follows from the triangle inequality. Then since each $v_{j} \in [2,6]$ , it follows that
+
+$$
+\sum_ {j = \kappa + 1} ^ {d} | p _ {j} | \leq 3 \sum_ {j = 1} ^ {\kappa} | p _ {j} |.
+$$
+
+Note that this holds for all $\xi \in \Xi$ simultaneously. Now let us denote $p_{1:\kappa} = (p_1,\dots ,p_\kappa)\in \mathbb{R}^\kappa$ and $p_{(\kappa +1):d} = (p_{\kappa +1},\ldots ,p_d)\in \mathbb{R}^{d - \kappa}$ , and similarly for other $d$ -dimensional vectors. Then for all $p\in \mathcal{D}_{\Upsilon}\cap \mathcal{S}^{d - 1}$ , by Cauchy-Schwartz inequality, we have
+
+$$
+\left\| p _ {(\kappa + 1); d} \right\| _ {1} \leq 3 \left\| p _ {1: \kappa} \right\| _ {1} \leq 3 \sqrt {\kappa} \left\| p _ {1: \kappa} \right\| _ {2}.
+$$
+
+Thus, for any $z\in \mathbb{R}^d$ and any $p\in \mathcal{D}_{\Upsilon}\cap S^{d - 1}$ , it follows that
+
+$$
+\begin{array}{l} \langle z, p \rangle = \langle z _ {1: \kappa}, p _ {1: \kappa} \rangle + \langle z _ {(\kappa + 1): d}, p _ {(\kappa + 1): d} \rangle \\ \leq \| z _ {1: \kappa} \| _ {2} \| p _ {1: \kappa} \| _ {2} + \| p _ {(\kappa + 1): d} \| _ {1} \cdot \max _ {j \in \{\kappa + 1, \dots , d \}} | z _ {j} | \\ \leq \| z _ {1: \kappa} \| _ {2} \| p _ {1: \kappa} \| _ {2} + 3 \sqrt {\kappa} \| p _ {1: \kappa} \| _ {2} \cdot \max _ {j \in \{\kappa + 1,.., d \}} | z _ {j} | \\ \leq \left\| z _ {1: \kappa} \right\| _ {2} + 3 \sqrt {\kappa} \cdot \max _ {j \in \{\kappa + 1, \dots , d \}} | z _ {j} | \\ \end{array}
+$$
+
+where the last inequality follows from the fact that $p \in S^{d-1}$ . Therefore, combine the above inequality with (43), and we obtain that
+
+$$
+\begin{array}{l} w \left(\mathcal {D} _ {\Upsilon}\right) \leq \mathbb {E} \left[ \| z _ {1: \kappa} \| _ {2} + 3 \sqrt {\kappa} \cdot \max _ {j \in \{\kappa + 1, \dots , d \}} | z _ {j} | \right] \\ \leq \sqrt {\kappa} + 3 \sqrt {\kappa} \cdot \mathbb {E} \left[ \max _ {j \in \{\kappa + 1, \dots , d \}} | z _ {j} | \right]. \tag {44} \\ \end{array}
+$$
+
+where the second inequality follows from the fact that $\mathbb{E}[\| z_{1:\kappa}\|_2] \leq \sqrt{\mathbb{E}[\|z_{1:\kappa}\|_2^2]} = \sqrt{\kappa}$ . To bound the second term in (44), applying Lemma D.9, it follows from (44) that
+
+$$
+w \left(\mathcal {D} _ {\Upsilon}\right) \leq \sqrt {\kappa} + 3 \sqrt {2 \kappa \ln (2 (d - \kappa))}. \tag {45}
+$$
+
+Therefore, combining (45) and (42), we obtain
+
+$$
+\lambda_ {\min } (Z; \mathcal {D} (g, w ^ {*})) \geq \sqrt {n - 1} - \sqrt {\kappa} - 3 \sqrt {2 \kappa \ln (2 (d - \kappa))} - h.
+$$
+
+Therefore, choosing $h = \sqrt{n - 1} /2$ , as long as $n$ satisfies that $n\geq C(\kappa \ln d)$ for some constant $C > 0$ , we have $\lambda_{\min}(Z;\mathcal{D}(g,w^{*})) > 0$ with probability at least $1 - (2d + 1)e^{-cn}$ . Finally, the uniqueness of the optimal solution to (18) in this case follows from Lemma D.6.
+
+Lemma D.9. Let $z\sim \mathcal{N}(0,I_d)$ , then it holds that $\mathbb{E}\left[\max_{i\in [d]}|z_i|\right]\leq \sqrt{2\ln(2d)}$
+
+Proof of Lemma D.9. Denote $M = \max_{i\in [d]}|z_i|$ . For any $\lambda >0$ , by Jensen's inequality, we have
+
+$$
+e ^ {\lambda \cdot \mathbb {E} [ M ]} \leq \mathbb {E} \left[ e ^ {\lambda M} \right] = \mathbb {E} \left[ \max _ {i \in [ d ]} e ^ {\lambda | z _ {i} |} \right] \leq \sum_ {i = 1} ^ {d} \mathbb {E} \left[ e ^ {\lambda | z _ {i} |} \right].
+$$
+
+Note that $\mathbb{E}[e^{\lambda |z_i|}] \leq 2 \cdot \mathbb{E}[e^{\lambda z_i}]$ . Thus, by the expression of the Gaussian moment generating function, we further have
+
+$$
+e ^ {\lambda \cdot \mathbb {E} [ M ]} \leq 2 \sum_ {i = 1} ^ {d} \mathbb {E} \left[ e ^ {\lambda z _ {i}} \right] = 2 d e ^ {\lambda^ {2} / 2},
+$$
+
+from which it follows that
+
+$$
+\mathbb {E} [ M ] \leq \frac {\ln (2 d)}{\lambda} + \frac {\lambda}{2}.
+$$
+
+Choosing $\lambda = \sqrt{2\ln(2d)}$ yields the desired result.
+
+
+
+# D.5 PROOF OF LEMMA 6.5
+
+Instead of studying the convergence of the Riemannian gradient flow directly, it is more convenient to consider it in the ambient space $\mathbb{R}^D$ . To do so, we define a Lagrange function $\mathcal{L}(x;\lambda) = R(x) + \sum_{i=1}^{n}\lambda_i(f_i(x) - y_i)$ for $\lambda \in \mathbb{R}^n$ . Based on this Lagrangian, we can continuously extend $\partial \Phi(x)\nabla R(x)$ to the whole space $\mathbb{R}^D$ . In specific, we can find a continuous function $F:\mathbb{R}^D\to \mathbb{R}^D$ such that $F(\cdot)|_{\Gamma} = \partial \Phi(\cdot)\nabla R(\cdot)$ . Such an $F$ can be implicitly constructed via the following lemma.
+
+Lemma D.10. The $\ell_2$ norm has a unique minimizer among $\{\nabla_x\mathcal{L}(x;\lambda)\mid \lambda \in \mathbb{R}^n\}$ for any fixed $x\in \mathbb{R}^{D}$ . Thus we can define $F:\mathbb{R}^{D}\to \mathbb{R}^{D}$ by $F(x) = \mathrm{argmin}_{g\in \{\nabla_{x}\mathcal{L}(x;\lambda)|\lambda \in \mathbb{R}^{n}\}}\| g\|_{2}$ . Moreover, it holds that $\langle F(x),\nabla f_i(x)\rangle = 0$ for all $i\in [n]$ .
+
+Proof of Lemma D.10. Fix any $x \in \mathbb{R}^D$ . Note that $\{\nabla_x \mathcal{L}(x; \lambda) \mid \lambda \in \mathbb{R}^n\}$ is the subspace spanned by $\{\nabla f_i(x)\}_{i \in [n]}$ shifted by $\nabla R(x)$ , thus there is a unique minimizer of the $\ell_2$ norm in this set. This implies that $F(x) = \operatorname*{argmin}_{g \in \{\nabla_x \mathcal{L}(x; \lambda) \mid \lambda \in \mathbb{R}^n\}} \| g \|_2$ is well-defined.
+
+To show the second claim, denote $h(\lambda) = \|\nabla_x\mathcal{L}(x;\lambda)\|_2^2 / 2$ , which is a quadratic function of $\lambda \in \mathbb{R}^n$ . Then we have
+
+$$
+\nabla h (\lambda) = \left( \begin{array}{c} \langle \nabla R (x), \nabla f _ {1} (x) \rangle \\ \vdots \\ \langle \nabla R (x), \nabla f _ {n} (x) \rangle \end{array} \right) + \left( \begin{array}{c} \sum_ {i = 1} ^ {n} \lambda_ {i} \langle \nabla f _ {1} (x), \nabla f _ {i} (x) \rangle \\ \vdots \\ \sum_ {i = 1} ^ {n} \lambda_ {i} \langle \nabla f _ {n} (x), \nabla f _ {i} (x) \rangle \end{array} \right) = \left( \begin{array}{c} \langle \nabla R (x), \nabla f _ {1} (x) \rangle \\ \vdots \\ \langle \nabla R (x), \nabla f _ {n} (x) \rangle \end{array} \right) + K (x) \lambda .
+$$
+
+For any $\lambda$ such that $\nabla_x\mathcal{L}(x;\lambda) = F(x)$ , we must have $\nabla h(\lambda) = 0$ by the definition of $F(x)$ , which by the above implies
+
+$$
+\left. (K (x) \lambda) _ {i} = - \langle \nabla R (x), \nabla f _ {i} (x) \rangle \quad \text {f o r a l l} i \in [ n ]. \right.
+$$
+
+Therefore, we further have
+
+$$
+\langle F (x), \nabla f _ {i} (x) \rangle = \langle \nabla R (x), \nabla f _ {i} (x) \rangle + \sum_ {j = 1} ^ {n} \lambda_ {j} \langle \nabla f _ {i} (x), \nabla f _ {j} (x) \rangle = \langle \nabla R (x), \nabla f _ {i} (x) \rangle + (K (x) \lambda) _ {i} = 0
+$$
+
+for all $i \in [n]$ . This finishes the proof.
+
+
+
+Hence, with any initialization $x(0) \in \Gamma$ , the limiting flow (17) is equivalent to the following dynamics
+
+$$
+\frac {\mathrm {d} x (t)}{\mathrm {d} t} = - \frac {1}{4} F (x (t)). \tag {46}
+$$
+
+Thus Lemma 6.5 can be proved by showing that the above $x(t)$ converges to $x^{*}$ as $t \to \infty$ . We first present a series of auxiliary results in below.
+
+Lemma D.11 (Implications for $F(x) = 0$ ). Let $F: \mathbb{R}^D \to \mathbb{R}^D$ be as defined in Lemma D.10. For any $x = \binom{u}{v} \in \mathbb{R}^D$ such that $F(x) = 0$ , it holds that for each $j \in [d]$ , either $u_j = 0$ or $v_j = 0$ .
+
+Proof. Since $F(x) = 0$ , it holds for all $j \in [d]$ that,
+
+$$
+0 = \frac {\partial R}{\partial u _ {j}} (x) + \sum_ {i = 1} ^ {n} \lambda_ {i} (x) \frac {\partial f _ {i}}{\partial u _ {j}} (x) = 2 u _ {j} \left[ \frac {4}{n} \sum_ {i = 1} ^ {n} z _ {i, j} ^ {2} + \sum_ {i = 1} ^ {n} \lambda_ {i} (x) z _ {i, j} \right],
+$$
+
+$$
+0 = \frac {\partial R}{\partial v _ {j}} (x) + \sum_ {i = 1} ^ {n} \lambda_ {i} (x) \frac {\partial f _ {i}}{\partial v _ {j}} (x) = 2 v _ {j} \left[ \frac {4}{n} \sum_ {i = 1} ^ {n} z _ {i, j} ^ {2} - \sum_ {i = 1} ^ {n} \lambda_ {i} (x) z _ {i, j} \right].
+$$
+
+If there exists some $j \in [d]$ such that $u_{j} \neq 0$ and $v_{j} \neq 0$ , then it follows from the above two identities that
+
+$$
+\sum_ {i = 1} ^ {n} z _ {i, j} ^ {2} = 0
+$$
+
+which happens with probability 0 in both the Boolean and Gaussian case. Therefore, we must have $u_{j} = 0$ or $v_{j} = 0$ for all $j \in [d]$ .
+
+Lemma D.12. Let $F:\mathbb{R}^D\to \mathbb{R}^D$ be as defined in Lemma D.10. Then $F$ is continuous on $\mathbb{R}^D$
+
+Proof. Case I. We first consider the simpler case of any fixed $x^{*} \in U = (\mathbb{R} \setminus \{0\})^{D}$ , assuming that $K(x^{*})$ is full-rank. Lemma D.10 implies that for any $\lambda \in \mathbb{R}^n$ such that $\nabla_{x}\mathcal{L}(x^{*};\lambda) = F(x^{*})$ , we have
+
+$$
+K (x ^ {*}) \lambda = - [ \nabla f _ {1} (x) \dots \nabla f _ {n} (x) ] ^ {\top} \nabla R (x).
+$$
+
+Thus such $\lambda$ is unique and given by
+
+$$
+\lambda \left(x ^ {*}\right) = - K \left(x ^ {*}\right) ^ {- 1} \left[ \nabla f _ {1} (x) \dots \nabla f _ {n} (x) \right] ^ {\top} \nabla R (x).
+$$
+
+Since $K(x)$ is continuous around $x^*$ , there exists a sufficiently small $\delta > 0$ such that for any $x \in B_{\delta}(x^*)$ , $K(x)$ is full-rank, which further implies that $K(x)^{-1}$ is also continuous in $B_{\delta}(x)$ . Therefore, by the above characterization of $\lambda$ , we see that $\lambda(x)$ is continuous for $x \in B_{\delta}(x^*)$ , and so is $F(x) = \nabla R(x) + \sum_{i=1}^{n} \lambda_i(x) \nabla f_i(x)$ .
+
+Case II. Next, we consider all general $x^{*} \in \mathbb{R}^{D}$ . Here for simplicity, we reorder the coordinates as $x = (u_{1}, v_{1}, u_{2}, v_{2}, \ldots, u_{d}, v_{d})$ with a slight abuse of notation. Without loss of generality, fix any $x^{*}$ such that for some $q \in [d]$ , $(u_{i}(0))^{2} + (v_{i}(0))^{2} > 0$ for all $i = 1, \ldots, q$ and $u_{i}^{*} = v_{i}^{*} = 0$ for all $i = q + 1, \ldots, d$ . Then $\nabla R(x^{*})$ and $\{\nabla f_{i}(x^{*})\}_{i \in [n]}$ only depend on $\{z_{i,j}\}_{i \in [n], j \in [q]}$ , and for all $i \in [n]$ , it holds that
+
+$$
+\left(\nabla R \left(x ^ {*}\right)\right) _ {(2 q + 1): D} = \left(\nabla f _ {i} \left(x ^ {*}\right)\right) _ {(2 q + 1): D} = 0.
+$$
+
+Note that if we replace $\{\nabla f_i(x)\}_{i\in [n]}$ by any fixed and invertible linear transform of itself, it would not affect the definition of $F(x)$ . In specific, we can choose an invertible matrix $Q\in \mathbb{R}^{n\times n}$ such that, for some $q^{\prime}\in [q]$ , $(\tilde{z}_1,\ldots ,\tilde{z}_n) = (z_1,\ldots ,z_n)Q$ satisfies that $\{\tilde{z}_{i,1:q}\}_{i\in [q']}$ is linearly independent and $\tilde{z}_{i,1:q} = 0$ for all $i = q' + 1,\dots ,n$ . We then consider $\left[\nabla \tilde{f}_1(x),\dots ,\nabla \tilde{f}_n(x)\right] = [\nabla f_1(x),\dots ,\nabla f_n(x)]Q$ and the corresponding $F(x)$ . For notational simplicity, we assume that $Q$ can be chosen as the identity matrix, so that $(z_{1},\ldots ,z_{n})$ itself satisfies the above property, and we repeat it here for clarity
+
+$$
+\left\{z _ {i, 1: q} \right\} _ {i \in [ q ^ {\prime} ]} \text {i s l i n e a r l y i n d e p e n d e n t a n d} \tilde {z} _ {i, 1: q} = 0 \text {f o r a l l} i = q ^ {\prime} + 1, \dots , n. \tag {47}
+$$
+
+This further implies that
+
+$$
+\left(\nabla f _ {i} (x)\right) _ {1: (2 q)} = 0, \quad \text {f o r a l l} i \in \left\{q ^ {\prime} + 1, \dots , n \right\} \text {a n d} x \in \mathbb {R} ^ {D}. \tag {48}
+$$
+
+In the sequel, we use $\lambda$ for $n$ -dimensional vectors and $\bar{\lambda}$ for $q'$ -dimensional vectors. Denote
+
+$$
+\lambda (x) \in \operatorname * {a r g m i n} _ {\lambda \in \mathbb {R} ^ {n}} \left\| \nabla R (x) + \sum_ {i = 1} ^ {n} \lambda_ {i} \nabla f _ {i} (x) \right\| _ {2},
+$$
+
+$$
+\bar {\lambda} (x) \in \operatorname * {a r g m i n} _ {\bar {\lambda} \in \mathbb {R} ^ {q ^ {\prime}}} \left\| \left(\nabla R (x) + \sum_ {i = 1} ^ {q ^ {\prime}} \bar {\lambda} _ {i} \nabla (f _ {i} (x)\right) _ {1: (2 q)} \right\| _ {2}.
+$$
+
+Then due to (47) and (48), we have
+
+$$
+\left\| \left(\nabla R \left(x ^ {*}\right) + \sum_ {i = 1} ^ {q ^ {\prime}} \bar {\lambda} _ {i} \left(x ^ {*}\right) \nabla f _ {i} \left(x ^ {*}\right)\right) _ {1: (2 q)} \right\| _ {2} = \left\| \nabla R \left(x ^ {*}\right) + \sum_ {i = 1} ^ {n} \lambda_ {i} (x) \nabla f _ {i} \left(x ^ {*}\right) \right\| _ {2} = \| F \left(x ^ {*}\right) \| _ {2}. \tag {49}
+$$
+
+On the other hand, for any $x\in \mathbb{R}^D$ , by (48), we have
+
+$$
+\begin{array}{l} \left\| \left(\nabla R (x) + \sum_ {i = 1} ^ {q ^ {\prime}} \bar {\lambda} _ {i} (x) \nabla f _ {i} (x)\right) _ {1: (2 q)} \right\| _ {2} = \min _ {\lambda \in \mathbb {R} ^ {n}} \left\| \left(\nabla R (x) + \sum_ {i = 1} ^ {n} \lambda_ {i} (x) \nabla f _ {i} (x)\right) _ {1: (2 q)} \right\| _ {2} \\ \leq \left\| \left(\nabla R (x) + \sum_ {i = 1} ^ {n} \lambda_ {i} (x) \nabla f _ {i} (x)\right) _ {1: (2 q)} \right\| _ {2} = \| F _ {1: (2 q)} (x) \| _ {2} \\ \leq \| F (x) \| _ {2} \leq \left\| \nabla R (x) + \sum_ {i = 1} ^ {n} \lambda_ {i} \left(x ^ {*}\right) \nabla f _ {i} (x) \right\| _ {2} \tag {50} \\ \end{array}
+$$
+
+where the first and third inequalities follow from the definition of $F(x)$ . Let $x \to x^*$ , by the continuity of $\nabla R(x)$ and $\{\nabla f_i(x)\}_{i \in [n]}$ , we have
+
+$$
+\left. \lim _ {x \rightarrow x ^ {*}} \left\| \nabla R (x) + \sum_ {i = 1} ^ {n} \lambda_ {i} \left(x ^ {*}\right) \nabla f _ {i} (x) \right\| _ {2} = \left\| \nabla R \left(x ^ {*}\right) + \sum_ {i = 1} ^ {n} \lambda_ {i} \left(x ^ {*}\right) \nabla f _ {i} \left(x ^ {*}\right)\right\| _ {2} \right. \tag {51}
+$$
+
+Denote $\tilde{K} (x) = (\tilde{K}_{ij}(x))_{(i,j)\in [q']^2} = (\langle \nabla f_i(x)_{1:(2q)},\nabla f_i(x)_{1:(2q)}\rangle)_{(i,j)\in [q']^2}$ . By applying the same argument as in Case I, since $\tilde{K} (x^{*})$ is full-rank, it also holds that $\lim_{x\to x^{*}}\bar{\lambda} (x) = \bar{\lambda} (x^{*})$ , and thus
+
+$$
+\left. \right. \lim _ {x \rightarrow x ^ {*}} \left\|\left(\nabla R (x) + \sum_ {i = 1} ^ {q ^ {\prime}} \bar {\lambda} _ {i} (x) \nabla f _ {i} (x) _ {1: (2 q)} \right.\right.\left. \right\rVert_ {2} = \left\|\left(\nabla R (x) + \sum_ {i = 1} ^ {q ^ {\prime}} \bar {\lambda} _ {i} \left(x ^ {*}\right) \nabla f _ {i} \left(x ^ {*}\right)\right) _ {1: (2 q)} \right\| _ {2}. \tag {52}
+$$
+
+Combing (49), (50), (51) and (52) yields
+
+$$
+\lim _ {x \rightarrow x ^ {*}} \| F _ {1: (2 q)} (x) \| _ {2} = \lim _ {x \rightarrow x ^ {*}} \min _ {\lambda \in \mathbb {R} ^ {n}} \left\|\left(\nabla R (x) + \sum_ {i = 1} ^ {n} \lambda_ {i} \nabla f _ {i} (x)\right) _ {1: (2 q)} \right\| _ {2} = \| F (x ^ {*}) \| _ {2}. \tag {53}
+$$
+
+Moreover, since $\| F_{(2q + 1):D}(x)\| _2 = \sqrt{\|F(x)\|_2^2 - \|F_{1:(2q)}(x)\|_2^2}$ , we also have
+
+$$
+\lim _ {x \rightarrow x ^ {*}} \| F _ {(2 q + 1): D} (x) \| _ {2} = 0. \tag {54}
+$$
+
+It then remains to show that $\lim_{x\to x^*}F_{1:(2q)}(x) = F_{1:(2q)}(x^*)$ , which directly follows from $\lim_{x\to x^*}\lambda_{1:q'}(x) = \lambda_{1:q'}(x^*) = \bar{\lambda}(x^*)$ .
+
+Now, for any $\epsilon > 0$ , due to the convergence of $\bar{\lambda}(x)$ and that $\tilde{K}(x^{*}) \succ 0$ , we can pick a sufficiently small $\delta_{1}$ such that for some constant $\alpha > 0$ and all $x \in B_{\delta_1}(x^*)$ , it holds that $\| \bar{\lambda}(x) - \bar{\lambda}(x^{*}) \|_2 \leq \epsilon / 2$ and
+
+$$
+\left\| \left(\nabla R (x) + \sum_ {i = 1} ^ {q ^ {\prime}} \bar {\lambda} _ {i} \nabla f _ {i} (x)\right) _ {1: (2 q)} \right\| _ {2} ^ {2} \geq \left\| \left(\nabla R (x) + \sum_ {i = 1} ^ {q ^ {\prime}} \bar {\lambda} _ {i} (x) \nabla f _ {i} (x)\right) _ {1: (2 q)} \right\| _ {2} ^ {2} + \alpha \| \bar {\lambda} - \bar {\lambda} (x) \| _ {2} ^ {2}. \tag {55}
+$$
+
+for all $\bar{\lambda} \in \mathbb{R}^p$ , where the inequality follows from the strong convexity. Meanwhile, due to (48), we have
+
+$$
+\begin{array}{l} \lim _ {x \to x ^ {*}} \left\| \left(\nabla R (x) + \sum_ {i = 1} ^ {q ^ {\prime}} \lambda_ {i} (x) \nabla f _ {i} (x)\right) _ {1: (2 q)} \right\| _ {2} = \lim _ {x \to x ^ {*}} \left\| \left(\nabla R (x) + \sum_ {i = 1} ^ {n} \lambda_ {i} (x) \nabla f _ {i} (x)\right) _ {1: (2 q)} \right\| _ {2} \\ = \left\| \left(\nabla R (x) + \sum_ {i = 1} ^ {q ^ {\prime}} \bar {\lambda} _ {i} \left(x ^ {*}\right) \nabla f _ {i} \left(x ^ {*}\right)\right) _ {1: (2 q)} \right\| _ {2} \\ = \lim _ {x \rightarrow x ^ {*}} \left\|\left(\nabla R (x) + \sum_ {i = 1} ^ {q ^ {\prime}} \bar {\lambda} _ {i} (x) \nabla f _ {i} (x)\right) _ {1: (2 q)} \right\| _ {2}. \\ \end{array}
+$$
+
+where the second equality follows from (53) and the second equality is due to (52). Therefore, we can pick a sufficiently small $\delta_{2}$ such that
+
+$$
+\left\| \left(\nabla R (x) + \sum_ {i = 1} ^ {q ^ {\prime}} \lambda_ {i} (x) \nabla f _ {i} (x)\right) _ {1: (2 q)} \right\| _ {2} \leq \left\| \left(\nabla R (x) + \sum_ {i = 1} ^ {q ^ {\prime}} \bar {\lambda} _ {i} (x) \nabla f _ {i} (x)\right) _ {1: (2 q)} \right\| _ {2} + \frac {\alpha \epsilon^ {2}}{4} \tag {56}
+$$
+
+for all $x \in B_{\delta_2}(x^*)$ . Setting $\delta = \min(\delta_1, \delta_2)$ , it follows from (55) and (56) that
+
+$$
+\| \lambda_ {1: q ^ {\prime}} (x) - \bar {\lambda} (x) \| _ {2} \leq \frac {\epsilon}{2}, \quad \text {f o r a l l} x \in B _ {\delta} \left(x ^ {*}\right).
+$$
+
+Recall that we already have $\| \bar{\lambda}(x) - \bar{\lambda}(x^*) \| \leq \epsilon / 2$ , and thus
+
+$$
+\| \lambda_ {1: q ^ {\prime}} (x) - \lambda \left(x ^ {*}\right) _ {1: q ^ {\prime}} \| _ {2} = \| \lambda_ {1: q ^ {\prime}} (x) - \bar {\lambda} \left(x ^ {*}\right) \| _ {2} \leq \| \lambda_ {1: q ^ {\prime}} (x) - \bar {\lambda} (x) \| _ {2} + \| \bar {\lambda} (x) - \bar {\lambda} \left(x ^ {*}\right) \| _ {2} \leq \epsilon
+$$
+
+for all $x \in B_{\delta}(x^{*})$ . Therefore, we see that $\lim_{x \to x^{*}} \lambda_{1:q'}(x) = \lambda(x^{*})_{1:q'}$ .
+
+Finally, it follows from the triangle inequality that
+
+$$
+\begin{array}{l} \| F (x) - F \left(x ^ {*}\right) \| _ {2} \leq \left\| \left(F (x) - F \left(x ^ {*}\right)\right) _ {1: (2 q)} \right\| _ {2} + \| F _ {(2 q + 1): D} (x) \| _ {2} + \underbrace {\| F _ {(2 q + 1) : D} \left(x ^ {*}\right) \| _ {2}} _ {0} \\ = \left\| \left(\nabla R (x) + \sum_ {i = 1} ^ {q ^ {\prime}} \lambda_ {i} (x) \nabla f _ {i} (x) - \nabla R (x ^ {*}) - \sum_ {i = 1} ^ {q ^ {\prime}} \lambda_ {i} (x ^ {*}) \nabla f _ {i} (x ^ {*})\right) _ {1: (2 q)} \right\| _ {2} + \| F _ {(2 q + 1): D} (x) \| _ {2} \\ \leq \left\| \sum_ {i = 1} ^ {q ^ {\prime}} \lambda_ {i} (x) \nabla f _ {i} (x) - \lambda_ {i} \left(x ^ {*}\right) \nabla f _ {i} \left(x ^ {*}\right) \right\| _ {2} + \| \nabla R (x) - \nabla R \left(x ^ {*}\right) \| _ {2} + \| F _ {(2 q + 1): D} (x) \| _ {2} \\ \end{array}
+$$
+
+where, as $x \to x^*$ , the first term vanishes by the convergence of $\lambda_{1;q'}(x)$ and the continuity of each $\nabla f_i(x)$ , the second term converges to 0 by the continuity of $\nabla R(x)$ and the third term vanishes by (54). Therefore, we conclude that
+
+$$
+\lim _ {x \to x ^ {*}} F (x) = F (x ^ {*}),
+$$
+
+that is, $F$ is continuous.
+
+
+
+Lemma D.13. For any initialization $x^{*} \in \Gamma$ , the Riemannian Gradient Flow (17) (or equivalently, (46)) is defined on $[0,\infty)$ .
+
+Proof of Lemma D.13. Let $[0, T)$ be the right maximal interval of existence of the solution of Riemannian gradient glow and suppose $T \neq \infty$ . Since $R(x(t))$ is monotone decreasing, thus $R(x(t))$ is upper bounded by $R(x(0))$ and therefore $\| \nabla R(x(t))\|$ is also upper bounded. Since $\left\| \frac{dx(t)}{dt} \right\|_2 \leq \| \nabla R(x(t))\|_2$ for any $t < T$ , the left limit $x(T-) := \lim_{\tau \to T^-} x(\tau)$ must exist. By Corollary 1, Perko (2001), $x(T-)$ belongs to boundary of $U$ , i.e., $u_j(T-) = 0$ or $v_j(T-) = 0$ for some $j \in [d]$ by Lemma D.11. By the definition of the Riemannian gradient flow in (17), we have
+
+$$
+\begin{array}{l} \frac {\mathrm {d}}{\mathrm {d} t} (u _ {j} (t) v _ {j} (t)) = \left( \begin{array}{c c} v _ {j} (t) e _ {j} ^ {\top} & u _ {j} (t) e _ {j} ^ {\top} \end{array} \right) \frac {\mathrm {d} x (t)}{\mathrm {d} t} \\ = - \frac {1}{4} \left( \begin{array}{c c} v _ {j} (t) e _ {j} ^ {\top} & u _ {j} (t) e _ {j} ^ {\top} \end{array} \right) F (x (t)). \\ \end{array}
+$$
+
+By the expression of $F(x(t)) = \nabla R(x(t)) + \sum_{i=1}^{n} \lambda_i(x(t)) \nabla f_i(x(t))$ , we then have
+
+$$
+\begin{array}{l} \frac {\mathrm {d}}{\mathrm {d} t} (u _ {j} (t) v _ {j} (t)) = - \left[ \frac {2}{n} \sum_ {i = 1} ^ {n} z _ {i, j} ^ {2} + \frac {1}{2} \sum_ {i = 1} ^ {n} \lambda_ {i} (x (t)) z _ {i, j} \right] u _ {j} (t) v _ {j} (t) - \left[ \frac {2}{n} \sum_ {i = 1} ^ {n} z _ {i, j} ^ {2} - \frac {1}{2} \sum_ {i = 1} ^ {n} \lambda_ {i} (x (t)) z _ {i, j} \right] u _ {j} (t) v _ {j} (t) \\ = - \left(\frac {4}{n} \sum_ {i = 1} ^ {n} z _ {i, j} ^ {2}\right) u _ {j} (t) v _ {j} (t). \\ \end{array}
+$$
+
+Denote $s_j = \frac{4}{n} \sum_{i=1}^{n} z_{i,j}^2$ . It follows that $|u_j(t)v_j(t)| = |u_j(0)v_j(0)|e^{-s_jt}$ for all $t \in [0,T)$ . Taking the limit we have $|u_j(T-)v_j(T-)| \geq |u_j(0)v_j(0)|e^{-s_jT} > 0$ . Contradiction with $T \neq \infty!$
+
+Before showing that $F$ satisfies the PL condition, we need the following two intermediate results. Given two points $u$ and $v$ in $\mathbb{R}^d$ , we say $u$ weakly dominate $v$ (written as $u \leq v$ ) if and only if $u_i \leq v_i$ , for all $i \in [d]$ . Given two subsets $A$ and $B$ of $\mathbb{R}^D$ , we say $A$ weakly dominates $B$ if and only if for any point $v$ in $B$ , there exists a point $u \in A$ such that $u \leq v$ .
+
+Lemma D.14. For some $q \in [D]$ , let $S$ be any $q$ -dimensional subspace of $\mathbb{R}^D$ and $P = \{u \in \mathbb{R}^D \mid u_i \geq 0, \forall i \in [D]\}$ . Let $u_\star$ be an arbitrary point in $P$ and $Q = P \cap (u_\star + S)$ . Then there exists a radius $r > 0$ , such that $B_r^1(0) \cap Q$ weakly dominates $Q$ , where $B_r^1(0)$ is the $\ell_1$ -norm ball of radius $r$ centered at 0.
+
+As a direct implication, for any continuous function $f: P \to \mathbb{R}$ , which is coordinate-wise nondecreasing, $\min_{x \in U} f(x)$ can always be achieved.
+
+Proof of Lemma D.14. We will prove by induction on the environment dimension $D$ . For the base case of $D = 1$ , either $S = \{0\}$ or $S = \mathbb{R}$ , and it is straightforward to verify the desired for both scenarios.
+
+Suppose the proposition holds for $D - 1$ , below we show it holds for $D$ . For each $i \in [D]$ , we apply the proposition with $D - 1$ to $Q \cap \{u \in P \mid u_i = 0\}$ (which can be seen as a subset of $\mathbb{R}^{D - 1}$ ), and let $r_i$ be the corresponding $\ell_1$ radius. Set $r = \max_{i \in [D]} r_i$ , and we show that choosing the radius to be $r$ suffices.
+
+For any $v \in Q$ , we take a random direction in $S$ , denoted by $\omega$ . If $\omega \geq 0$ or $\omega \leq 0$ , we denote by $y$ the first intersection (i.e., choosing the smallest $\lambda$ ) between the line $\{v - \lambda |\omega|\}_{\lambda \geq 0}$ and the boundary of $U$ , i.e., $\cup_{i=1}^{D} \{z \in \mathbb{R}^D \mid z_i = 0\}$ . Clearly $y \leq v$ . By the induction hypothesis, there exists a $u \in B_r^1(0) \cap Q$ such that $u \leq y$ . Thus $u \leq v$ and meets our requirement.
+
+If $\omega$ has different signs across its coordinates, we take $y_{1}, y_{2}$ to be the first intersections of the line $\{v - \lambda |\omega|\}_{\lambda \in \mathbb{R}}$ and the boundary of $U$ in directions of $\lambda > 0$ and $\lambda < 0$ , respectively. Again by the induction hypothesis, there exist $u_{1}, u_{2} \in B_{r}^{1}(0) \cap Q$ such that $u_{1} \leq y_{1}$ and $u_{2} \leq y_{2}$ . Since $v$ lies in the line connecting $u_{1}$ and $u_{2}$ , there exists some $h \in [0,1]$ such that $v = (1 - h)u_{1} + hu_{2}$ . It then follows that $(1 - h)u_{1} + hu_{2} \leq (1 - h)y_{1} + hy_{2} = v$ . Now since $Q$ is convex, we have $(1 - h)u_{1} + hu_{2} \in Q$ , and by the triangle inequality it also holds that $\|(1 - h)u_{1} + hu_{2}\|_{1} \leq r$ , so $(1 - h)u_{1} + hu_{2} \in B_{r}^{1}(0) \cap Q$ . Therefore, we conclude that $B_{r}^{1}(0) \cap Q$ weakly dominates $Q$ , and thus the proposition holds for $D$ . This completes the proof by induction.
+
+Lemma D.15. For some $q \in [D]$ , let $S$ be any $q$ -dimensional subspace of $\mathbb{R}^D$ and $P = \{u \in \mathbb{R}^D \mid u_i \geq 0, \forall i \in [D]\}$ . Let $u_\star$ be an arbitrary point in $P$ and $Q = P \cap (u_\star + S)$ . Then there exists a constant $c \in (0,1]$ such that for any sufficiently small radius $r > 0$ , $c \cdot Q$ weakly dominates $P \cap (u_\star + S + B_r^2(0))$ , where $B_r^2(0)$ is the $\ell_2$ -norm ball of radius $r$ centered at 0.
+
+Proof of Lemma D.15. We will prove by induction on the environment dimension $D$ . For the base case of $D = 1$ , either $S = \{0\}$ or $S = \mathbb{R}$ . $S = \mathbb{R}$ is straight-forward; for the case $S = \{0\}$ , we just need to ensure $c|u_{\star}| \leq |u_{\star}| - r$ , and it suffices to pick $r = |u_{\star}|$ and $c = 0.5$ .
+
+Suppose the proposition holds for $D - 1$ , below we show it holds for $D$ . For each $i \in [D]$ , we first consider the intersection between $P \cap (u_{\star} + S + B_r^2(0))$ and $H_i := \{u \in \mathbb{R}^D \mid u_i = 0\}$ . Let $u_i$ be an arbitrary point in $P \cap (u_{\star} + S) \cap H_i$ , then $P \cap (u_{\star} + S) \cap H_i = P \cap (u_i + S) \cap H_i = P \cap (u_i + S \cap H_i)$ . Furthermore, there exists $\{\alpha_i\}_{i \in [D]}$ which only depends on $S$ and satisfies $P \cap (u^* + S + B_r^2(0)) \cap H_i \subset P \cap (u_i + S \cap H_i + B_{\alpha_ir}^2(0) \cap H_i)$ . Applying the induction hypothesis to $P \cap (u_i + S \cap H_i + B_{\alpha_ir}^2(0) \cap H_i)$ , we know there exists a $c > 0$ such that for sufficiently small $r$ , $c(P \cap (u_{\star} + S) \cap H_i) = c(P \cap (u_i + S \cap H_i) \cup H_i)$ weakly dominates $P \cap (u_i + S \cap H_i + B_{\alpha_ir}^2(0) \cap H_i)$ .
+
+For any point $v$ in $Q$ and any $z \in B_r^2(0)$ , we take a random direction in $S$ , denoted by $\omega$ . If $\omega \geq 0$ or $\omega \leq 0$ , we denote by $y$ the first intersection between $\{v + z - \lambda |\omega|\}_{\lambda \geq 0}$ and the boundary of $U$ . Clearly $y \leq v$ . Since $y \in P \cap (u_\star + S + B_r^2(0)) \cap H_i \subset P \cap (u_i + S \cap H_i + B_{\alpha_i r}^2(0) \cap H_i)$ , by the induction hypothesis, there exists a $u \in c(P \cap (u_\star + S) \cap H_i)$ such that $u \leq y$ . Thus $z \leq v + z$ and $z \in c(P \cap (u_\star + S)) = c \cdot Q$ .
+
+If $\omega$ has different signs across its coordinates, we take $y_{1}, y_{2}$ to be the first intersections of the line $\{v + z - \lambda |\omega|\}_{\lambda \in \mathbb{R}}$ and the boundary of $U$ in directions of $\lambda > 0$ and $\lambda < 0$ , respectively. By the induction hypothesis, there exist $u_{1}, u_{2} \in c \cdot Q$ such that $u_{1} \leq y_{1}$ and $u_{2} \leq y_{2}$ . Since $v + z$ lies
+
+in the line connecting $u_{1}$ and $u_{2}$ , there exists some $h \in [0,1]$ such that $v + z = (1 - h)y_{1} + hy_{2}$ . It then follows that $(1 - h)u_{1} + hu_{2} \leq (1 - h)y_{1} + hy_{2} = v + z$ . Since $Q$ is convex, we have $(1 - h)u_{1} + hu_{2} \in cQ$ . Therefore, we conclude that $cQ \cap Q$ weakly dominates $P \cap (u_{\star} + S + B_r^2(0))$ for all sufficiently small $r$ , and thus the proposition holds for $D$ . This completes the proof by induction.
+
+Lemma D.16. (Polyak-Lojasiewicz condition for $F$ .) For any $x^{*}$ such that $L(x^{*}) = 0$ , i.e., $x^{*} \in \overline{\Gamma}$ , there exist a neighbourhood $U'$ of $x^{*}$ and a constant $c > 0$ , such that $\| F(x)\|_2^2 \geq c \cdot \max(R(x) - R(x^{*}), 0)$ for all $x \in U' \cap \overline{\Gamma}$ . Note this requirement is only non-trivial when $\| F(x^{*})\|_2 = 0$ since $F$ is continuous.
+
+Proof of Lemma D.16. It suffices to show the PL condition for $\{x\mid F(x) = 0\}$ . We need to show for any $x^{*}$ satisfying $F(x^{*}) = 0$ , there exist some $\epsilon >0$ and $C > 0$ , such that for all $x\in \overline{\Gamma}\cap B_{\epsilon}^{2}(x^{*})$ with $R(x) > R(x^{*})$ , it holds that $\| F(x)\| _2^2\geq C(R(x) - R(x^*))$ .
+
+Case I. We first prove the case where $x = \binom{u}{v}$ itself is a canonical parametrization of $w = u^{\odot 2} - v^{\odot 2}$ , i.e., $u_{j}v_{j} = 0$ for all $j \in [d]$ . Since $x^{*}$ satisfies $\nabla F(x^{*}) = 0$ , by Lemma D.11, we have $x^{*} = \psi(w^{*})$ where $w^{*} = (u^{*})^{\odot 2} - (v^{*})^{\odot 2}$ . In this case, we can rewrite both $R$ and $F$ as functions of $w \in \mathbb{R}^d$ . In detail, we define $R'(w) = R(\psi(w))$ and $F'(w) = F(\psi(w))$ for all $w \in \mathbb{R}^d$ . For any $w$ in a sufficiently small neighbourhood of $w^{*}$ , it holds that $\mathrm{sign}(w_j) = \mathrm{sign}(w_j^*)$ for all $j \in [q]$ . Below we show that for each possible sign pattern of $w_{(q+1):d}$ , there exists some constant $C$ which admits the PL condition in the corresponding orthant. Then we take the minimum of all $C$ from different orthant and the proof is completed. W.L.O.G., we assume that $w_j \geq 0$ , for all $j = q + 1, \ldots, d$ .
+
+We temporarily reorder the coordinates as $x = (u_{1}, v_{1}, u_{2}, v_{2}, \ldots, u_{d}, v_{d})^{\top}$ . Recall that $Z = [z_{1}, \ldots, z_{n}]^{\top}$ is a $n$ -by- $d$ matrix, and we have
+
+$$
+\| F ^ {\prime} (w) \| _ {2} ^ {2} = \min _ {\lambda \in \mathbb {R} ^ {n}} \left\langle (a - \operatorname {s i g n} (w) \odot Z ^ {\top} \lambda) ^ {\odot 2}, | w | \right\rangle ,
+$$
+
+where $a = \frac{8}{n}\sum_{i=1}^{n}z_i^{\odot 2} \in \mathbb{R}^d$ . Since $F(x^*) = 0$ , there must exist $\lambda^* \in \mathbb{R}^n$ , such that the first $2q$ coordinates of $\nabla R(x^*) + \sum_{i=1}^{n}\lambda_i^*\nabla f_i(x^*)$ are equal to 0. As argued in the proof of Lemma D.12, we can assume the first $q'$ rows of $Z$ are linear independent on the first $q$ coordinates for some $q' \in [q]$ .
+
+In other words, $Z$ can be written as $\begin{bmatrix} Z_A & Z_B \\ 0 & Z_D \end{bmatrix}$ where $Z_A \in \mathbb{R}^{q' \times q}$ . We further denote $\lambda_a := \lambda_{1:q'}$ , $\lambda_b := \lambda_{(q' + 1):n}$ , $w_a := w_{1:q}$ and $w_b := w_{(q + 1):d}$ for convenience, then we have
+
+$$
+\left\| F ^ {\prime} (w) \right\| _ {2} ^ {2} = \min _ {\lambda \in \mathbb {R} ^ {n}} \left\langle \left(a _ {1} + \operatorname {s i g n} \left(w _ {a}\right) \odot Z _ {A} ^ {\top} \lambda_ {a}\right) ^ {\odot 2}, \left| w _ {a} \right| \right\rangle + \left\langle \left(a _ {2} + Z _ {B} ^ {\top} \lambda_ {a} + Z _ {D} ^ {\top} \lambda_ {b}\right) ^ {\odot 2}, w _ {b} \right\rangle . \tag {57}
+$$
+
+Since every $w$ in $\overline{\Gamma}$ is a global minimizer, $R'(w) = R'(w) + \sum_{i=1}^{n} \lambda_i^*(z_i^\top w - y_i) \coloneqq g^\top w + R'(w_*)$ , where $g = \mathrm{sign}(w) \odot a + Z^\top \lambda^*$ . Similarly we define $g_a \coloneqq g_{1:q}$ and $g_b \coloneqq g_{(q+1):d}$ . It holds that $g_a = 0$ and we assume $Z_Dg_b = 0$ without loss of generality, because this can always be done by picking suitable $\lambda_i^*$ for $i = q' + 1, \ldots, n$ . (We have such freedom on $\lambda_{q' + 1:n}^*$ because they doesn't affect the first $2q$ coordinates.)
+
+We denote $\lambda_{a} - \lambda_{a}^{*}$ by $\Delta \lambda_{a}$ , then since $0 = g_{a} = \mathrm{sign}(w_{a})\odot a_{1} + Z_{A}^{\top}\lambda_{a}^{*}$ , we further have
+
+$$
+\begin{array}{l} \left\langle \left(a _ {1} + \operatorname {s i g n} \left(w _ {a}\right) \odot Z _ {A} ^ {\top} \lambda_ {a}\right) ^ {\odot 2}, | w _ {a} | \right\rangle = \left\langle \left(a _ {1} + \operatorname {s i g n} \left(w _ {a}\right) \odot Z _ {A} ^ {\top} \lambda_ {a} ^ {*} + \operatorname {s i g n} \left(w _ {a}\right) \odot Z _ {A} ^ {\top} \Delta \lambda_ {a}\right) ^ {\odot 2}, | w _ {a} | \right\rangle \\ = \left\langle \left(\operatorname {s i g n} \left(w _ {a}\right) \odot Z _ {A} ^ {\top} \Delta \lambda_ {a}\right) ^ {\odot 2}, \left| w _ {a} \right| \right\rangle . \\ \end{array}
+$$
+
+On the other hand, we have $g_{b} = \mathrm{sign}(w_{b})\odot a_{2} + Z_{B}^{\top}\lambda_{a}^{*} + Z_{D}^{\top}\lambda_{b}^{*} = a_{2} + Z_{B}^{\top}\lambda_{a}^{*} + Z_{D}^{\top}\lambda_{b}^{*}$ by the assumption that each coordinate of $w_{b}$ is non-negative. Combining this with the above identity, we can rewrite Equation (57) as:
+
+$$
+\left\| F ^ {\prime} (w) \right\| _ {2} ^ {2} = \min _ {\lambda \in \mathbb {R} ^ {D}} \left\langle \left(Z _ {A} ^ {\top} \Delta \lambda_ {a}\right) ^ {\odot 2}, \left| w _ {a} \right| \right\rangle + \left\langle \left(g _ {b} + Z _ {B} ^ {\top} \Delta \lambda_ {a} + Z _ {D} ^ {\top} \lambda_ {b}\right) ^ {\odot 2}, w _ {b} \right\rangle . \tag {58}
+$$
+
+Now suppose $R'(w) - R'(w^*) = g_b^\top w_b = \delta$ for some sufficiently small $\delta$ (which can be controlled by $\epsilon$ ). We will proceed in the following two cases separately.
+
+- Case I.1: $\| \Delta \lambda_{a}\|_{2} = \Omega (\sqrt{\delta})$ . Since $Z_{A}$ has full row rank, $\left\| (Z_A^\top \Delta \lambda_a)^{\odot 2}\right\| _1 = \left\| (Z_A^\top \Delta \lambda_a)\right\| _2^2\geq \left\| \Delta \lambda_a\right\| _2^2\lambda_{\min}^2 (Z_A)$ is lower-bounded. On the other hand, we can choose $\epsilon$ small enough such that $\forall i\in [q]|(w_a)_i^2 |\geq \frac{1}{2} (w_a^*)_i^2$ . Thus the first term of Equation (58) is lower bounded by $\| \Delta \lambda_{a}\|_{2}^{2}\lambda_{\min}^{2}(Z_{A})\cdot \min_{i\in [q]}\frac{1}{2} (w_{a}^{*})_{i}^{2} = \Omega (\delta) = \Omega (R^{\prime}(w) - R^{\prime}(w^{*}))$
+- Case I.2: $\| \Delta \lambda_{a}\|_{2} = O(\sqrt{\delta})$ . Let $u = g_{b} + Z_{B}^{\top}\Delta \lambda_{a} + Z_{D}^{\top}\lambda_{b}$ , then we have $u\in S + B_{c\sqrt{\delta}}^{2}(0)$ for some constant $c > 0$ , where $S = \{g_b + Z_D^\top \lambda_b\mid \lambda_b\in \mathbb{R}^{n - q'}\}$ . By Lemma D.14, there exists some constant $c_0\geq 1$ , such that $\frac{1}{c_0}\cdot S$ weakly dominates $S + B_{c\sqrt{\delta}}^{2}(0)$ . Thus we have $\| F'(w)\| _2^2\geq \inf_{u\in S + B_{c\sqrt{\delta}}(0)}\left\langle u^{\odot 2},w_b\right\rangle \geq \inf_{u\in \frac{1}{c_0}\cdot S}\left\langle s^{\odot 2},w_b\right\rangle$ , where the last step is because each coordinate of $w_{b}$ is non-negative.
+
+Let $A$ be the orthogonal complement of $\operatorname{span}(Z_D, g_b)$ , i.e., the spanned space of columns of $Z_D$ and $g_b$ , we know $w_b \in \frac{\delta}{\|g_b\|_2^2} g_b + A$ , since $Z_D w_b = Z_D w_*^2 = 0$ and $g_b^\top w_b = \delta$ . Therefore,
+
+$$
+\begin{array}{l} \inf _ {w: R ^ {\prime} (w) - R ^ {\prime} (w ^ {*}) = \delta > 0} \frac {\| F ^ {\prime} (w) \| _ {2} ^ {2}}{R ^ {\prime} (w) - R ^ {\prime} (w ^ {*})} \geq \inf _ {w _ {b}: R ^ {\prime} (w) - R ^ {\prime} (w ^ {*}) = \delta > 0} \inf _ {u \in \frac {1}{c _ {0}} \cdot S} \left\langle u ^ {\odot 2}, \frac {w _ {b}}{\delta} \right\rangle \\ \geq \frac {1}{c _ {0} ^ {2}} \inf _ {w _ {b} \in \frac {\delta}{\| g _ {b} \| _ {2} ^ {2}} g _ {b} + A, w _ {b} \geq 0, u \in S} \left\langle u ^ {\odot 2}, w _ {b} \right\rangle . \tag {59} \\ \end{array}
+$$
+
+Note $\langle u^{\odot 2},w_b\rangle$ is a monotone non-decreasing function in the first joint orthant, i.e., $\{(u,w_b)\in \mathbb{R}^d\times \mathbb{R}^{d - q'}\mid u\geq 0,w_b\geq 0\}$ , thus by Lemma D.15 the infimum can be achieved by some finite $(u,w_{b})$ in the joint first orthant. Applying the same argument to each other orthant of $u\in \mathbb{R}^d$ , we conclude that the right-hand-side of (59) can be achieved.
+
+On the other hand, we have $u^{\top}w_{b} = \delta > 0$ for all $w_{b} \in \frac{\delta}{\|g_{b}\|_{2}^{2}} g_{b} + A$ and $u \in S$ , by $Z_{D}g_{b} = 0$ and the definition of $A$ . This implies there exists at least one $i \in [d - q']$ such that $w_{2,i}u_{i} > 0$ , which further implies $\langle u^{\odot 2}, w_{b} \rangle > 0$ . Therefore, we conclude that $\| F'(w)\|_{2}^{2} = \Omega(R'(w) - R'(w_{0}))$ .
+
+Case II. Next, for any general $x = \binom{u}{v}$ , we define $w = u^{\odot 2} - v^{\odot 2}$ and $m = \min \{u^{\odot 2}, v^{\odot 2}\}$ , where $\min$ is taken coordinate-wise. Then we can rewrite $\| F(x)\|_2^2$ as
+
+$$
+\begin{array}{l} \| F (x) \| _ {2} ^ {2} = \min _ {\lambda \in \mathbb {R} ^ {n}} \left\| \left(\left[ \begin{array}{c} a \\ a \end{array} \right] + \left[ \begin{array}{c} Z \\ - Z \end{array} \right] \lambda\right) \odot \left[ \begin{array}{c} u \\ v \end{array} \right] \right\| _ {2} ^ {2} \\ = \min _ {\lambda \in \mathbb {R} ^ {n}} \left\| \left(\left[ \begin{array}{c} a \\ a \end{array} \right] + \left[ \begin{array}{c} Z \\ - Z \end{array} \right] \lambda\right) ^ {\odot 2} \odot \left[ \begin{array}{c} u ^ {\odot 2} \\ v ^ {\odot 2} \end{array} \right] \right\| _ {1} \\ = \min _ {\lambda \in \mathbb {R} ^ {n}} \left\| \left(\left[ \begin{array}{c} a \\ a \end{array} \right] + \left[ \begin{array}{c} Z \\ - Z \end{array} \right] \lambda\right) ^ {\odot 2} \odot \left(\psi (w) ^ {\odot 2} + \left[ \begin{array}{c} m \\ m \end{array} \right]\right) \right\| _ {1} \\ \geq \min _ {\lambda \in \mathbb {R} ^ {n}} \left\| \left(\left[ \begin{array}{c} a \\ a \end{array} \right] + \left[ \begin{array}{c} Z \\ - Z \end{array} \right] \lambda\right) ^ {\odot 2} \odot \psi (w) ^ {\odot 2} \right\| _ {1} + \min _ {\lambda \in \mathbb {R} ^ {n}} \left\| \left(\left[ \begin{array}{c} a \\ a \end{array} \right] + \left[ \begin{array}{c} Z \\ - Z \end{array} \right] \lambda\right) ^ {\odot 2} \odot \left[ \begin{array}{c} m \\ m \end{array} \right] \right\| _ {1} \\ = \min _ {\lambda \in \mathbb {R} ^ {n}} \left\| \left(\left[ \begin{array}{c} a \\ a \end{array} \right] + \left[ \begin{array}{c} Z \\ - Z \end{array} \right] \lambda\right) \odot \psi (w) \right\| _ {2} ^ {2} + \min _ {\lambda \in \mathbb {R} ^ {n}} \left\| \left(\left[ \begin{array}{c} a \\ a \end{array} \right] + \left[ \begin{array}{c} Z \\ - Z \end{array} \right] \lambda\right) \odot \left[ \begin{array}{c} \sqrt {m} \\ \sqrt {m} \end{array} \right] \right\| _ {2} ^ {2}. \\ \end{array}
+$$
+
+Then applying the result for the previous case yields the following for some constant $C \in (0,1)$ :
+
+$$
+\begin{array}{l} \| F (x) \| _ {2} ^ {2} \geq C (R (\psi (w)) - R (\psi (w ^ {*})) + \min _ {\lambda \in \mathbb {R} ^ {n}} \left\| \left(\left[ \begin{array}{c} a \\ a \end{array} \right] + \left[ \begin{array}{c} Z \\ - Z \end{array} \right] \lambda\right) \odot \left[ \begin{array}{c} \sqrt {m} \\ \sqrt {m} \end{array} \right] \right\| _ {2} ^ {2} \\ = C (R (\psi (w)) - R (x ^ {*}) + 2 \left\langle a ^ {\odot 2}, m \right\rangle \\ \geq C (R (\psi (w)) - R (x ^ {*}) + 2 \min _ {i \in [ d ]} a _ {i} \langle a, m \rangle \\ = C (R (\psi (w)) - R (x ^ {*}) + \min _ {i \in [ d ]} a _ {i} (R (x) - R (\psi (w))) \\ \geq \min \left\{C, \min _ {i \in [ d ]} a _ {i} \right\} (R (x) - R (x ^ {*})), \\ \end{array}
+$$
+
+where the first equality follows from the fact that $x^{*} = \psi (w^{*})$ and the last inequality is due to the fact that both $R(\psi (w) - R(\psi (w^{*}))$ and $R(x) - R(\psi (w))$ are non-negative. This completes the proof.
+
+Now, based on the PL condition, we can show that (17) indeed converges.
+
+Lemma D.17. The trajectory of the flow defined in (17) has finite length, i.e., $\int_{t=0}^{\infty}\|\frac{\mathrm{d}x}{\mathrm{d}t}\|_2\mathrm{d}t < \infty$ for any $x^* \in \Gamma$ . Moreover, $x(t)$ converges to some $x(\infty)$ when $t \to \infty$ with $F(x(\infty)) = 0$ .
+
+Proof of Lemma D.17. Note that along the Riemannian gradient flow, $R(x(t))$ is non-increasing, thus $\| x(t)\| _2$ is bounded over time and $\{x(t)\}_{t\geq 0}$ has at least one limit point, which we will call $x^{*}$ . Therefore, $R(x^{*})$ is a limit point of $R(x(t))$ , and again since $R(x(t))$ is non-increasing, it follows that $R(x(t))\geq R(x^{*})$ and $\lim_{t\to \infty}R(x(t)) = R(x^{*})$ . Below we will show $\lim_{t\to \infty}x(t) = x^{*}$ .
+
+Note that $\frac{\mathrm{d}R(x(t))}{\mathrm{d}t} = \left\langle \nabla R(x(t)),\frac{\mathrm{d}x(t)}{\mathrm{d}t}\right\rangle = -\left\langle \nabla R(x(t)),\frac{1}{4} F(x(t))\right\rangle = -\frac{1}{4}\| F(x(t))\| _2^2$ where the last equality applies Lemma D.10. By Lemma D.16, there exists a neighbourhood of $x^{*},U^{\prime}$ in which PL condition holds of $F$ . Since $x^{*}$ is a limit point, there exists a time $T_{0}$ , such that $x_{T_0}\in U$ . Let $T_{1} = \inf_{t\geq T_{0}}\{x(t)\notin U^{\prime}\}$ (which is equal to $\infty$ if $x(t)\in U^{\prime}$ for all $t\geq T_0$ Since $x(t)$ is continuous in $t$ and $U$ is open, we know $T_{1} > T_{0}$ and for all $t\in [T_0,T_1)$ , we have $\| F(x(t))\| _2\geq \sqrt{c} (R(x(t)) - R(x^*))^{1 / 2}$
+
+Thus it holds that for $t \in [T_0, T_1)$ ,
+
+$$
+\frac {\mathrm {d} (R (x (t)) - R (x ^ {*}))}{\mathrm {d} t} \leq - \frac {\sqrt {c}}{4} (R (x (t)) - R (x ^ {*})) ^ {1 / 2} \| F (x (t)) \| _ {2},
+$$
+
+that is,
+
+$$
+\frac {\mathrm {d} (R (x (t)) - R (x ^ {*})) ^ {1 / 2}}{\mathrm {d} t} \leq - \frac {\sqrt {c}}{8} \| F (x (t)) \| _ {2}.
+$$
+
+Therefore, we have
+
+$$
+\int_ {t = T _ {0}} ^ {T _ {1}} \| F (x (t)) \| _ {2} \mathrm {d} t \leq \frac {8}{\sqrt {c}} \left(R \left(x \left(T _ {0}\right)\right) - R \left(x ^ {*}\right)\right) ^ {1 / 2}. \tag {60}
+$$
+
+Thus if we pick $T_0$ such that $R(x(T_0)) - R(x^*)$ is sufficiently small, $R(T_1)$ will remain in $U$ , which implies that $T_1$ cannot be finite and has to be $\infty$ . Therefore, Equation (60) shows that the trajectory of $x(t)$ is of finite length, so $x(\infty) := \lim_{t \to \infty} x(t)$ exists and is equal to $x^*$ . As a by-product, $F(x^*)$ must be 0.
+
+Finally, collecting all the above lemmas, we are able to prove Lemma 6.5. In Lemma D.17 we already show the convergence of $x(t)$ as $t \to \infty$ , the main part of the proof of Lemma 6.5 is to show the $x(\infty)$ cannot be sub-optimal stationary points of $R$ on $\overline{\Gamma}$ , the closure of $\Gamma$ . The key idea here is that we can construct a different potential $\phi$ for each such sub-optimal stationary point $x^{*}$ , such that (1) $\phi(x_{t})$ is locally increasing in a sufficiently neighborhood of $x^{*}$ and (2) $\lim_{x \to x^{*}} \phi(x) = -\infty$ .
+
+Lemma 6.5. Let $\{x_{t}\}_{t\geq 0} \subseteq \mathbb{R}^{D}$ be generated by the flow defined in (17) with any initialization $x_0 \in \Gamma$ . Then $x_{\infty} = \lim_{t\to \infty}x_{t}$ exists. Moreover, $x_{\infty} = x^{*}$ is the optimal solution of (18).
+
+Proof of Lemma 6.5. We will prove by contradiction. Suppose $x(\infty) = \binom{u(\infty)}{v(\infty)} = \lim_{t\to \infty}x(t)$ is not the optimal solution to (18). Denote $w(t) = (u(t))^{\odot 2} - (v(t))^{\odot 2}$ , then $w(\infty) = \lim_{t\to \infty}w(t)$ is not the optimal solution to (36). Thus we have $R(w(t)) > R(w^{*})$ . Without loss of generality, suppose there is some $q\in [d]$ such that $(u_i(\infty))^2 +(v_i(\infty))^2 >0$ for all $i = 1,\dots ,q$ and $u_{i}(\infty) = v_{i}(\infty) = 0$ for all $i = q + 1,\ldots ,d$ . Again, as argued in the proof of Lemma D.12, we can assume that, for some $q^{\prime}\in [q]$ ,
+
+$$
+\left\{z _ {i, 1: q} \right\} _ {i \in [ q ^ {\prime} ]} \text {i s l i n e a r l y i n d e p e n d e n t a n d} z _ {i, 1: q} = 0 \text {f o r a l l} i = q ^ {\prime} + 1, \dots , n. \tag {61}
+$$
+
+Since both $w(\infty)$ and $w^{*}$ satisfy the constraint that $Zw(\infty) = Zw^{*} = Y$ , we further have
+
+$$
+0 = \left\langle z _ {i}, w (\infty) \right\rangle = \left\langle z _ {i}, w ^ {*} \right\rangle = \left\langle z _ {i, (q + 1): d}, w _ {(q + 1): d} ^ {*} \right\rangle , \quad \text {f o r a l l} i = q ^ {\prime} + 1, \dots , n. \tag {62}
+$$
+
+Consider a potential function $\varphi : U \to \mathbb{R}$ defined as
+
+$$
+\varphi (x) = \varphi (u, v) = \sum_ {j = q + 1} ^ {d} w _ {j} ^ {*} \left[ \ln (u _ {j}) ^ {2} \mathbb {1} \{w _ {j} ^ {*} > 0 \} - \ln (v _ {j}) ^ {2} \mathbb {1} \{w _ {j} ^ {*} < 0 \} \right].
+$$
+
+Clearly $\lim_{t\to \infty}\varphi (x(t)) = -\infty$ if $\lim_{t\to \infty}x(t) = x(\infty)$ . Below we will show contradiction if $x(\infty)$ is suboptimal. Consider the dynamics of $\varphi (x)$ along the Riemannian gradient flow:
+
+$$
+\frac {\mathrm {d} \varphi}{\mathrm {d} t} (x (t)) = \left\langle \nabla \varphi (x (t)), \frac {\mathrm {d} x (t)}{\mathrm {d} t} \right\rangle = - \left\langle \nabla \varphi (x (t)), \frac {1}{4} F (x (t)) \right\rangle \tag {63}
+$$
+
+where $F$ is defined previously in Lemma D.10. Recall the definition of $F$ , and we have
+
+$$
+\begin{array}{l} \langle \nabla \varphi (x (t)), F (x (t)) \rangle = \underbrace {\left\langle \nabla \varphi (x (t)) , \frac {1}{4} \nabla R (x (t)) + \frac {1}{4} \sum_ {i = 1} ^ {q ^ {\prime}} \lambda_ {i} (x (t)) \nabla f _ {i} (x (t)) \right\rangle} _ {\mathcal {I} _ {1}} \\ + \underbrace {\left\langle \nabla \varphi (x (t)) , \frac {1}{4} \sum_ {i = q ^ {\prime} + 1} ^ {n} \lambda_ {i} (x (t)) \nabla f _ {i} (x (t)) \right\rangle} _ {\mathcal {I} _ {2}}. \tag {64} \\ \end{array}
+$$
+
+To show $\langle \nabla \varphi (x(t)),F(x(t))\rangle < 0$ , we analyze $\mathcal{I}_1$ and $\mathcal{I}_2$ separately. By the definition of $\varphi (x)$ , we have
+
+$$
+\nabla \varphi (x) = \sum_ {j = q + 1} ^ {d} 2 w _ {j} ^ {*} \left[ \frac {\mathbb {1} \{w _ {j} ^ {*} > 0 \}}{u _ {j}} \cdot e _ {j} - \frac {\mathbb {1} \{w _ {j} ^ {*} < 0 \}}{v _ {j}} \cdot e _ {D + j} \right]
+$$
+
+where $e_j$ is the $j$ -th canonical base of $\mathbb{R}^d$ . Recall that $\nabla f_i(x) = 2\binom{z_i\odot u}{-z_i\odot v}$ , and we further have
+
+$$
+\begin{array}{l} \mathcal {I} _ {2} = \sum_ {i = q ^ {\prime} + 1} ^ {n} \lambda_ {i} (x (t)) \sum_ {j = q + 1} ^ {d} w _ {j} ^ {*} \left[ \frac {\mathbb {1} \{w _ {j} ^ {*} > 0 \}}{u _ {j}} \langle e _ {j}, z _ {i} \odot u \rangle + \frac {\mathbb {1} \{w _ {j} ^ {*} < 0 \}}{v _ {j}} \langle e _ {j}, z _ {i} \odot v \rangle \right] \\ = \sum_ {i = q ^ {\prime} + 1} ^ {n} \lambda_ {i} (x (t)) \sum_ {j = q + 1} ^ {d} w _ {j} ^ {*} \left[ \frac {\mathbb {1} \{w _ {j} ^ {*} > 0 \}}{u _ {j}} z _ {i, j} u _ {j} + \frac {\mathbb {1} \{w _ {j} ^ {*} < 0 \}}{v _ {j}} z _ {i, j} v _ {j} \right] \\ = \sum_ {i = q ^ {\prime} + 1} ^ {n} \lambda_ {i} (x (t)) \sum_ {j = q + 1} ^ {d} w _ {j} ^ {*} z _ {i, j} = \sum_ {i = q ^ {\prime} + 1} ^ {n} \lambda_ {i} (x (t)) \left\langle z _ {i, (q + 1): d}, w _ {(q + 1): d} ^ {*} \right\rangle = 0 \tag {65} \\ \end{array}
+$$
+
+where the last equality follows from (62).
+
+Next, we show that $\mathcal{I}_1 < 0$ by utilizing the fact that $w^{*} - w(\infty)$ is a descent direction of $R^{\prime}(w)$ . For $w\in \mathbb{R}^d$ , define $\tilde{f}_i(w) = z_i^\top w$ and
+
+$$
+\tilde {R} (w) = R (w) + \sum_ {i = 1} ^ {q ^ {\prime}} \lambda_ {i} (x (\infty)) (\tilde {f} _ {i} (w) - y _ {i}).
+$$
+
+Clearly, for any $w \in \mathbb{R}^D$ satisfying $Zw = Y$ , it holds that $\tilde{f}_i(w) - y_i = 0$ for each $i \in [n]$ , and thus $R(w) = \tilde{R}(w)$ . In particular, we have $\tilde{R}(w(\infty)) = R(w(\infty)) > R(w^*) = \tilde{R}(w^*)$ . Since $\tilde{R}(w)$ is a convex function, it follows that $\tilde{R}(w(\infty) + s(w^* - w(\infty))) \leq s\tilde{R}(w^*) + (1 - s)\tilde{R}(\infty) < \tilde{R}(w(\infty))$ for all $0 < s \leq 1$ , which implies $\frac{\mathrm{d}\tilde{R}}{\mathrm{d}t}(w(\infty) + s(w^* - w(\infty)))|_{s=0} < -2c < 0^+$ for some constant $c > 0$ . Note that, for small enough $s > 0$ , we have
+
+$$
+\begin{array}{l} R (w (\infty) + s (w ^ {*} - w (\infty))) = \frac {4}{n} \sum_ {j = 1} ^ {d} \left(\sum_ {i = 1} ^ {n} z _ {i, j} ^ {2}\right) | w _ {j} (\infty) + s (w _ {j} ^ {*} - w _ {j} (\infty)) | \\ = \frac {4}{n} \sum_ {j = 1} ^ {q} \left(\sum_ {i = 1} ^ {n} z _ {i, j} ^ {2}\right) \operatorname {s i g n} \left(w _ {j} (\infty)\right) \left(w _ {j} (\infty) + s \left(w _ {j} ^ {*} - w _ {j} (\infty)\right)\right) \\ + \frac {4}{n} \sum_ {j = q + 1} ^ {d} \left(\sum_ {i = 1} ^ {n} z _ {i, j} ^ {2}\right) s | w _ {j} ^ {*} |. \\ \end{array}
+$$
+
+Therefore, we can compute the derivative with respect to $s$ at $s = 0$ as
+
+$$
+\begin{array}{l} - 2 c > \frac {\mathrm {d} \tilde {R}}{\mathrm {d} t} (w (\infty) + s (w ^ {*} - w (\infty))) \Bigg | _ {s = 0} \\ = \frac {4}{n} \sum_ {j = 1} ^ {q} \left(\sum_ {i = 1} ^ {n} z _ {i, j} ^ {2}\right) \mathrm {s i g n} (w _ {j} (\infty)) (w _ {j} ^ {*} - w _ {j} (\infty)) + \frac {4}{n} \sum_ {j = q + 1} ^ {d} \left(\sum_ {i = 1} ^ {n} z _ {i, j} ^ {2}\right) | w _ {j} ^ {*} | \\ + \sum_ {i = 1} ^ {q ^ {\prime}} \lambda_ {i} (x (\infty)) z _ {i} ^ {\top} (w ^ {*} - w _ {j} (\infty)) \\ = \frac {4}{n} \sum_ {j = 1} ^ {q} \left(\sum_ {i = 1} ^ {n} z _ {i, j} ^ {2}\right) \mathrm {s i g n} (w _ {j} (\infty)) (w _ {j} ^ {*} - w (\infty)) + \frac {4}{n} \sum_ {j = q + 1} ^ {d} \left(\sum_ {i = 1} ^ {n} z _ {i, j} ^ {2}\right) | w _ {j} ^ {*} | \\ + \sum_ {j = 1} ^ {q} \left(w _ {j} ^ {*} - w _ {j} (\infty)\right) \sum_ {i = 1} ^ {q ^ {\prime}} \lambda_ {i} (x (\infty)) z _ {i, j} + \sum_ {j = q + 1} ^ {d} w _ {j} ^ {*} \sum_ {i = 1} ^ {q ^ {\prime}} \lambda_ {i} (x (\infty)) z _ {i, j} \tag {66} \\ \end{array}
+$$
+
+where the second equality follows from the fact that $w_{(q + 1):d}(\infty) = 0$ . Since $x(t)$ converges to $x(\infty)$ , we must have $F(x(\infty)) = 0$ , which implies that for each $j \in \{1, \dots, q\}$ ,
+
+$$
+0 = \frac {\partial R}{\partial u _ {j}} (x (\infty)) + \sum_ {i = 1} ^ {q ^ {\prime}} \lambda_ {i} (x (\infty)) \frac {\partial f _ {i}}{\partial u _ {j}} (x (\infty)) = 2 u _ {j} (\infty) \left[ \frac {4}{n} \sum_ {i = 1} ^ {n} z _ {i, j} ^ {2} + \sum_ {i = 1} ^ {q ^ {\prime}} \lambda_ {i} (x (\infty)) z _ {i, j} \right],
+$$
+
+$$
+0 = \frac {\partial R}{\partial v _ {j}} (x (\infty)) + \sum_ {i = 1} ^ {q ^ {\prime}} \lambda_ {i} (x (\infty)) \frac {\partial f _ {i}}{\partial v _ {j}} (x (\infty)) = 2 v _ {j} (\infty) \left[ \frac {4}{n} \sum_ {i = 1} ^ {n} z _ {i, j} ^ {2} - \sum_ {i = 1} ^ {q ^ {\prime}} \lambda_ {i} (x (\infty)) z _ {i, j} \right].
+$$
+
+Combining the above two equalities yields
+
+$$
+\frac {4}{n} \sum_ {i = 1} ^ {n} z _ {i, j} ^ {2} = - \operatorname {s i g n} (w _ {j} (\infty)) \sum_ {i = 1} ^ {q ^ {\prime}} \lambda_ {i} (x (\infty)) z _ {i, j}, \quad \text {f o r a l l} j \in [ q ].
+$$
+
+Apply the above identity together with (66), and we obtain
+
+$$
+\begin{array}{l} - 2 c > \sum_ {j = 1} ^ {q} - \operatorname {s i g n} (w _ {j} (\infty)) ^ {2} (w _ {j} ^ {*} - w (\infty)) \sum_ {i = 1} ^ {q ^ {\prime}} \lambda_ {i} (x (\infty)) z _ {i, j} + \frac {4}{n} \sum_ {j = q + 1} ^ {d} \left(\sum_ {i = 1} ^ {n} z _ {i, j} ^ {2}\right) | w _ {j} ^ {*} | \\ + \sum_ {j = 1} ^ {q} \left(w _ {j} ^ {*} - w _ {j} (\infty)\right) \sum_ {i = 1} ^ {q ^ {\prime}} \lambda_ {i} (x (\infty)) z _ {i, j} + \sum_ {j = q + 1} ^ {d} w _ {j} ^ {*} \sum_ {i = 1} ^ {q ^ {\prime}} \lambda_ {i} (x (\infty)) z _ {i, j} \\ = \frac {4}{n} \sum_ {j = q + 1} ^ {d} \left(\sum_ {i = 1} ^ {n} z _ {i, j} ^ {2}\right) \left| w _ {j} ^ {*} \right| + \sum_ {j = q + 1} ^ {d} w _ {j} ^ {*} \sum_ {i = 1} ^ {q ^ {\prime}} \lambda_ {i} (x (\infty)) z _ {i, j} \tag {67} \\ \end{array}
+$$
+
+On the other hand, by directly evaluating $\nabla R(x(t))$ and each $\nabla f_{i}(x(t))$ , we can compute $\mathcal{I}_1$ as
+
+$$
+\begin{array}{l} \mathcal {I} _ {1} = \sum_ {j = q + 1} ^ {d} \frac {w _ {j} ^ {*} \mathbb {1} \{w _ {j} ^ {*} > 0 \}}{u _ {j} (t)} \left[ \frac {2}{n} \sum_ {i = 1} ^ {n} z _ {i, j} ^ {2} u _ {j} (t) + \frac {1}{2} \sum_ {i = 1} ^ {q ^ {\prime}} \lambda_ {i} (x (t)) z _ {i, j} u _ {j} (t) \right] \\ - \sum_ {j = q + 1} ^ {d} \frac {w _ {j} ^ {*} \mathbb {1} \{w _ {j} ^ {*} < 0 \}}{v _ {j} (t)} \left[ \frac {2}{n} \sum_ {i = 1} ^ {n} z _ {i, j} ^ {2} v _ {j} (t) - \frac {1}{2} \sum_ {i = 1} ^ {q ^ {\prime}} \lambda_ {i} (x (t)) z _ {i, j} v _ {j} (t) \right] \\ = \frac {2}{n} \sum_ {j = q + 1} ^ {d} \left(\sum_ {i = 1} ^ {n} z _ {i, j} ^ {2}\right) | w _ {j} ^ {*} | + \frac {1}{2} \sum_ {j = q + 1} ^ {d} w _ {j} ^ {*} \sum_ {i = 1} ^ {q ^ {\prime}} \lambda_ {i} (x (t)) z _ {i, j} \\ = \frac {2}{n} \sum_ {j = q + 1} ^ {d} \left(\sum_ {i = 1} ^ {n} z _ {i, j} ^ {2}\right) \left| w _ {j} ^ {*} \right| + \frac {1}{2} \sum_ {j = q + 1} ^ {d} w _ {j} ^ {*} \sum_ {i = 1} ^ {q ^ {\prime}} \lambda_ {i} (x (\infty)) z _ {i, j} \\ + \frac {1}{2} \sum_ {j = q + 1} ^ {d} w _ {j} ^ {*} \sum_ {i = 1} ^ {q ^ {\prime}} \left(\lambda_ {i} (x (t)) - \lambda_ {i} (x (\infty))\right) z _ {i, j}. \\ \end{array}
+$$
+
+We already know that $\lambda_{1:q'}(x)$ is continuous at $x(\infty)$ by the proof of Lemma D.12, so the third term converges to 0 as $x(t)$ tends to $x(\infty)$ . Now, applying (67), we immediately see that there exists some $\delta > 0$ such that $\mathcal{I}_1 < -c$ for $x(t) \in B_\delta(x(\infty))$ . As we have shown in the above that $\mathcal{I}_2 = 0$ , it then follows from (63) and (64) that
+
+$$
+\frac {\mathrm {d} \varphi}{\mathrm {d} t} (x (t)) > c, \quad \text {f o r a l l} x (t) \in B _ {\delta} (x (\infty)). \tag {68}
+$$
+
+Since $\lim_{t\to \infty}x(t) = x(\infty)$ , there exists some $T > 0$ such that $x(t)\in B_{\delta}(x(\infty))$ for all $t > T$ . By the proof of Lemma D.13, we know that $\varphi (x(T)) > - \infty$ , then it follows from (68) that
+
+$$
+\lim _ {t \to \infty} \varphi (x (t)) = \varphi (x (T)) + \int_ {T} ^ {\infty} \frac {\mathrm {d} \varphi (x (t))}{\mathrm {d} t} \mathrm {d} t > \varphi (x (T)) + \int_ {T} ^ {\infty} c \mathrm {d} t = \infty
+$$
+
+which is a contradiction. This finishes the proof.
+
+
+
+# D.6 PROOF OF THEOREM 6.7
+
+Here we present the lower bound on the sample complexity of GD in the kernel regime.
+
+Theorem 6.7. Assume $z_{1},\ldots ,z_{n}\stackrel {i.i.d}{\sim}\mathcal{N}(0,I_{d})$ and $y_{i} = z_{i}^{\top}w^{*}$ , for all $i\in [n]$ . Define the loss with linearized model as $L(x) = \sum_{i = 1}^{n}(f_{i}(x_{0}) + \langle \nabla f_{i}(x_{0}),x - x_{0}\rangle -y_{i})^{2}$ , where $x = \binom{u}{v}$ and $x_0 = \binom{u_0}{v_0} = \alpha \binom{\mathbb{1}}{\mathbb{1}}$ . Then for any groundtruth $w^{*}$ , any learning rate schedule $\{\eta_t\}_{t\geq 1}$ , and any fixed number of steps $T$ , the expected $\ell_2$ loss of $x(T)$ is at least $(1 - \frac{n}{d})\| w^{*}\|_{2}^{2}$ , where $x(T)$ is the $T$ -th iterate of $GD$ on $L$ , i.e., $x(t + 1) = x(t) - \eta_t\nabla L(x(t))$ , for all $t\geq 0$ .
+
+Proof of Theorem 6.7. We first simplify the loss function by substituting $x' = x - x(0)$ , so correspondingly $x_0' = 0$ and we consider $L'(x') \coloneqq L(x) = (\langle \nabla f_i(x(0)), x' \rangle - y_i)^2$ . We can think as if GD is performed on $L'(x')$ . For simplicity, we still use the $x$ and $L(x)$ notation in below.
+
+In order to show test loss lower bound against a single fixed target function, we must take the properties of the algorithm into account. The proof is based on the observation that GD is rotationally equivariant (Ng, 2004; Li et al., 2020c) as an iterative algorithm, i.e., if one rotates the entire data distribution (including both the training and test data), the expected loss of the learned function remains the same. Since the data distribution and initialization are invariant under any rotation, it means the expected loss of $x(T)$ with ground truth being $w^{*}$ is the same as the case where the ground truth is uniformly randomly sampled from all vectors of $\ell_{2}$ -norm $\| w^{*}\|_{2}$ .
+
+Thus the test loss of $x(T)$ is
+
+$$
+\mathbb {E} _ {z} \left[ \left(\langle \nabla f _ {z} (x (0)), x (T) \rangle - \langle z, w ^ {*} \rangle\right) ^ {2} \right] = \mathbb {E} _ {z} \left[ \left(\langle z, w ^ {*} - (u (T) - v (T)) \rangle\right) ^ {2} \right] = \| w ^ {*} - (u (T) - v (T)) \| _ {2} ^ {2}. \tag {69}
+$$
+
+Note $x(T) \in \operatorname{span}\{\nabla f_x(x(0))\}$ , which is at most an $n$ -dimensional space spanned by the gradients of model output at $x(0)$ , so is $u(T) - v(T)$ . We denote the corresponding space for $u(T) - v(T)$ by $S$ , so $\dim(S) \leq n$ and it holds that $\|w^* - (u(T) - v(T))\|_2^2 \geq \|(I_D - P_S)w^*\|_2^2$ , where $P_S$ is projection matrix onto space $S$ .
+
+The expected test loss is lower bounded by
+
+$$
+\begin{array}{l} \mathbb {E} _ {w ^ {*}} \left[ \mathbb {E} _ {z _ {i}} \left[ \| w ^ {*} - (u (T) - v (T)) \| _ {2} ^ {2} \right] \right] = \mathbb {E} _ {z _ {i}} \left[ \mathbb {E} _ {w ^ {*}} \left[ \| w ^ {*} - (u (T) - v (T)) \| _ {2} ^ {2} \right] \right] \\ \geq \min _ {\left\{z _ {i} \right\} _ {i \in [ n ]}} \mathbb {E} _ {w ^ {*}} \left[ \left\| \left(I _ {D} - P _ {S}\right) w ^ {*} \right\| _ {2} ^ {2} \right] \\ \geq \left(1 - \frac {n}{d}\right) \| w ^ {*} \| _ {2} ^ {2}. \\ \end{array}
+$$
+
+
\ No newline at end of file
diff --git a/whathappensaftersgdreacheszerolossamathematicalframework/images.zip b/whathappensaftersgdreacheszerolossamathematicalframework/images.zip
new file mode 100644
index 0000000000000000000000000000000000000000..fdd585e998bc90b2de4979673221a02f3792a218
--- /dev/null
+++ b/whathappensaftersgdreacheszerolossamathematicalframework/images.zip
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:3b22caaf4ae019c9a559d967ec04f58d2bfe7e0287f14a40080df2be12eedd54
+size 2236341
diff --git a/whathappensaftersgdreacheszerolossamathematicalframework/layout.json b/whathappensaftersgdreacheszerolossamathematicalframework/layout.json
new file mode 100644
index 0000000000000000000000000000000000000000..4ff39042a7505dec16dec2555b310f2fedae988d
--- /dev/null
+++ b/whathappensaftersgdreacheszerolossamathematicalframework/layout.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:9ce608423c44bcb9abdf4ba2eff6d821b594cceb04c637ff816a6fdb942a7590
+size 3056991
diff --git a/whenshouldagentsexplore/bf6759cb-74d0-4eaa-9042-9541b473fe81_content_list.json b/whenshouldagentsexplore/bf6759cb-74d0-4eaa-9042-9541b473fe81_content_list.json
new file mode 100644
index 0000000000000000000000000000000000000000..3b0cdfab48db42142e625d288ff7347dea8c3d54
--- /dev/null
+++ b/whenshouldagentsexplore/bf6759cb-74d0-4eaa-9042-9541b473fe81_content_list.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ad0ef11694e7bae33a4ed57aea5c4565b80794a8baa534d0d9d0254789c5a28f
+size 133169
diff --git a/whenshouldagentsexplore/bf6759cb-74d0-4eaa-9042-9541b473fe81_model.json b/whenshouldagentsexplore/bf6759cb-74d0-4eaa-9042-9541b473fe81_model.json
new file mode 100644
index 0000000000000000000000000000000000000000..262fc3c9b5f0df451d5d5ed6adc12ca145bc3c85
--- /dev/null
+++ b/whenshouldagentsexplore/bf6759cb-74d0-4eaa-9042-9541b473fe81_model.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:048f727083bef3c987ef88ed2f01eedcafa31a05f64c3341c86ae33246e629f6
+size 156004
diff --git a/whenshouldagentsexplore/bf6759cb-74d0-4eaa-9042-9541b473fe81_origin.pdf b/whenshouldagentsexplore/bf6759cb-74d0-4eaa-9042-9541b473fe81_origin.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..9e7b135bdee7312514375ed41cbc6177541a12ba
--- /dev/null
+++ b/whenshouldagentsexplore/bf6759cb-74d0-4eaa-9042-9541b473fe81_origin.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:698575d5a47580dcb7c5faab36a193530e0412c95c619aff02649e533a1e2e05
+size 3702400
diff --git a/whenshouldagentsexplore/full.md b/whenshouldagentsexplore/full.md
new file mode 100644
index 0000000000000000000000000000000000000000..26f63f80e623a4e6f861b35140d25bde04fdb954
--- /dev/null
+++ b/whenshouldagentsexplore/full.md
@@ -0,0 +1,554 @@
+# WHEN SHOULD AGENTS EXPLORE?
+
+Miruna Píslar David Szepesvari Georg Ostrovski Diana Borsa Tom Schaul
+
+DeepMind London, UK
+
+{mirunapislar,dsz,ostrovski,borsa,tom}@deepmind.com
+
+# ABSTRACT
+
+Exploration remains a central challenge for reinforcement learning (RL). Virtually all existing methods share the feature of a monolithic behaviour policy that changes only gradually (at best). In contrast, the exploratory behaviours of animals and humans exhibit a rich diversity, namely including forms of switching between modes. This paper presents an initial study of mode-switching, nonmonolithic exploration for RL. We investigate different modes to switch between, at what timescales it makes sense to switch, and what signals make for good switching triggers. We also propose practical algorithmic components that make the switching mechanism adaptive and robust, which enables flexibility without an accompanying hyper-parameter-tuning burden. Finally, we report a promising and detailed analysis on Atari, using two-mode exploration and switching at sub-episodic time-scales.
+
+# 1 INTRODUCTION
+
+The trade-off between exploration and exploitation is described as the crux of learning and behaviour across many domains, not just reinforcement learning (Sutton & Barto, 2018), but also in decision making (Cohen et al., 2007), evolutionary biology (Cremer et al., 2019), ecology (Kembro et al., 2019), neuroscience (e.g., focused versus diffuse search in visual attention (Wolfe et al., 1989), dopamine regulations (Chakroun et al., 2020)), cognitive sciences (Hills et al., 2015), as well as psychology and psychiatry (Addicott et al., 2017). In a nutshell, exploration is about the balance between taking the familiar choice that is known to be rewarding and learning about unfamiliar options of uncertain reward, but which could ultimately be more valuable than the familiar options.
+
+Ample literature has studied the question of how much to explore, that is how to set the overall trade-off (and how to adjust it over the course of learning) (Jaksch et al., 2010; Cappé et al., 2013; Lattimore & Szepesvári, 2020; Thrun, 1992), and the question of how to explore, namely how to choose exploratory actions (e.g., randomly, optimistically, intrinsically motivated, or otherwise) (Schmidhuber, 1991; Oudeyer & Kaplan, 2009; Linke et al., 2019). In contrast, the question of when to explore has been studied very little, possibly because it does not arise in bandit problems, where a lot of exploration methods are rooted. The 'when' question and its multiple facets are the subjects of this paper. We believe that addressing it could lead to more intentional forms of exploration.
+
+Consider an agent that has access to two modes of behaviour, an 'explore' mode and an 'exploit' mode (e.g., a random policy and a greedy policy, as in $\varepsilon$ -greedy). Even when assuming that the overall proportion of exploratory steps is fixed, the agent still has multiple degrees of freedom: it can explore more at the beginning of training and less in later phases; it may take single exploratory steps or execute prolonged periods of exploration; it may prefer exploratory steps early or late within an episode; and it could trigger the onset (or end) of an exploratory period based on various criteria. Animals and humans exhibit non-trivial behaviour in all of these dimensions, presumably encoding useful inductive biases that way (Power, 1999). Humans make use of multiple effective strategies, such as selectively exploring options with high uncertainty (a form of directed, or information-seeking exploration), and increasing the randomness of their choices when they are more uncertain (Gershman, 2018; Gershman & Tzovaras, 2018; Ebitz et al., 2019). Monkeys use directed exploration to manage explore-exploit trade-offs, and these signals are coded in motivational brain regions (Costa et al., 2019). Patients with schizophrenia register changes in directed exploration and expe
+
+rience low-grade inflammation when shifting from exploitation to random exploration (Waltz et al., 2020; Cathomas et al., 2021). This diversity is what motivates us to study which of these can benefit RL agents in turn, by expanding the class of exploratory behaviours beyond the commonly used monolithic ones (where modes are merged homogeneously in time).
+
+# 2 METHODS
+
+The objective of an RL agent is to learn a policy that maximises external reward. At the high level, it achieves this by interleaving two processes: generating new experience by interacting with the environment using a behaviour policy (exploration) and updating its policy using this experience (learning). As RL is applied to increasingly ambitious tasks, the challenge for exploration becomes to keep producing diverse experience, because if something has not been encountered, it cannot be learned. Our central argument is therefore simple: a monolithic, time-homogeneous behaviour policy is strictly less diverse than a heterogeneous mode-switching one, and the former may hamstring the agent's performance. As an illustrative example, consider a human learning how to ride a bike (explore), while maintaining their usual happiness through food, sleep, work (exploit): there is a stark contrast between a monolithic, time-homogeneous behaviour that interleaves a twist of the handlebar or a turn of a pedal once every few minutes or so, and the mode-switching behaviour that dedicates prolonged periods of time exclusively to acquiring the new skill of cycling.
+
+While the choice of behaviour in pure exploit mode is straightforward, namely the greedy pursuit of external reward (or best guess thereof), denoted by $\mathcal{G}$ , there are numerous viable choices for behaviour in a pure explore mode (denoted by $\mathcal{X}$ ). In this paper we consider two standard ones: $\mathcal{X}_U$ , the naive uniform random policy, and $\mathcal{X}_I$ , an intrinsically motivated behaviour that exclusively pursues a novelty measure based on random network distillation (RND, (Burda et al., 2018)). See Section 4 and Appendix B for additional possibilities of $\mathcal{X}$ . In this paper we choose fixed behaviours for these modes, and focus solely on the question of when to switch between them. In our setting, overall proportion of exploratory steps (the how much), denoted by $p_{\mathcal{X}}$ , is not directly controlled but derives from the when.
+
+# 2.1 GRANULARITY
+
+An exploration period is an uninterrupted sequence of steps in explore mode. We consider four choices of temporal granularity for exploratory periods, also illustrated in Figure 1.
+
+Step-level exploration is the most common scenario, where the decision to explore is taken independently at each step, affecting one action. The canonical example is $\varepsilon$ -greedy (Fig.1:C).
+
+Experiment-level exploration is the other extreme, where all behaviour during training is produced in explore mode, and learning is off-policy (the greedy policy is only used for evaluation). This scenario is also very common, with most forms of intrinsic motivation falling into this category, namely pursuing reward with an intrinsic bonus throughout training (Fig.1:A).2
+
+Episode-level exploration is the case where the mode is fixed for an entire episode at a time (e.g., training games versus tournament matches in a sport), see Fig.1:B. This has been investigated for simple cases, where the policy's level of stochasticity is sampled at the beginning of each episode (Horgan et al., 2018; Kaptuowski et al., 2019; Zha et al., 2021).
+
+Intra-episodic exploration is what falls in-between step- and episode-level exploration, where exploration periods last for multiple steps, but less than a full episode. This is the least commonly studied scenario, and will form the bulk of our investigations (Fig.1:D,E,F,G).
+
+We denote the length of an exploratory period by $n_{\mathcal{X}}$ (and similarly $n_{\mathcal{G}}$ for exploit mode). To characterise granularity, our summary statistic of choice is $\mathrm{med}_{\mathcal{X}} \coloneqq \mathrm{median}(n_{\mathcal{X}})$ . Note that there are two possible units for these statistics: the raw steps or the proportion of the episode length $L$ .
+
+
+Figure 1: Illustration of different types of temporal structure for two-mode exploration. Left: Each line A-G depicts an excerpt of an experiment (black lines show episode boundaries, experiment continues on the right), with colour denoting the active mode (blue is exploit, magenta is explore). A is of experiment-level granularity, B episode-level, C step-level, and D-G are of intra-episodic exploration granularity. Right: The same examples, mapped onto a characteristic plot of summary statistics: overall exploratory proportion $p_{\mathcal{X}}$ versus typical length of an exploratory period $\mathrm{med}_{\mathcal{X}}$ . The yellow-shaded area highlights the intra-episodic part of space studied in this paper (some points are not realisable, e.g., when $p_{\mathcal{X}} \approx 1$ then $\mathrm{med}_{\mathcal{X}}$ must be large). C, D, E, F share the same $p_{\mathcal{X}} \approx 0.2$ , while interleaving exploration modes in different ways. D and E share the same $\mathrm{med}_{\mathcal{X}}$ value, and differ only on whether exploration periods are spread out, or happen toward the end.
+
+
+
+The latter has different (relative) semantics, but may be more appropriate when episode lengths vary widely across training. We denote it as $\operatorname{rmed}_{\mathcal{X}} \coloneqq \operatorname{median}(n_{\mathcal{X}} / L)$ .
+
+# 2.2 SWITCHING MECHANISMS
+
+Granularity is but the coarsest facet of the 'when' question, but the more precise intra-episode timings matter too, namely when exactly to start and when to stop an exploratory period. This section introduces two mechanisms, blind and informed switching. It is worth highlighting that, in general, the mechanism (or its time resolution) for entering explore mode differs from the one for exiting it (to enter exploit mode) – this asymmetry is crucial to obtain flexible overall amounts of exploration. If switching were symmetric, the proportion would be $p_{\chi} \approx 0.5$ .
+
+Blind switching The simplest switching mechanism does not take any state into account (thus, we call it blind) and is only concerned with producing switches at some desired time resolution. It can be implemented deterministically through a counter (e.g., enter explore mode after 100 exploit mode steps), or probabilistically (e.g., at each step, enter explore mode with probability 0.01). Its expected duration can be parameterised in terms of raw steps, or in terms of fractional episode length. The opposite of blind switching is informed switching, as discussed below.
+
+Informed switching Going beyond blind switching opens up another rich set of design choices, with switching informed by the agent's internal state. There are two parts: first, a scalar trigger signal is produced by the agent at each step, using its current information - drawing inspiration from human behaviour, we view the triggering signal as a proxy for uncertainty (Schulz et al., 2019): when uncertainty is high, the agent will switch to explore. Second, a binary switching decision is taken based on the trigger signal (for example, by comparing it to a threshold). Again, triggering will generally not be symmetric between entering and exiting an exploratory period.
+
+To keep this paper focused, we will look at one such informed trigger, dubbed 'value promise discrepancy' (see Appendix B for additional competitive variants). This is an online proxy of how much of the reward that the agent's past value estimate promised ( $k$ steps ago) have actually come about. The intuition is that in uncertain parts of state space, this discrepancy will generally be larger than when everything goes as expected. Formally,
+
+$$
+D _ {\mathrm {p r o m i s e}} (t - k, t) := \left| V (s _ {t - k}) - \sum_ {i = 0} ^ {k - 1} \gamma^ {i} R _ {t - i} - \gamma^ {k} V (s _ {t}) \right|
+$$
+
+where $V(s)$ is the agent's value estimate at state $s$ , $R$ is the reward, and $\gamma$ is a discount factor.
+
+Starting mode When periods last for a significant fraction of episode length, it also matters how the sequence is initialised, i.e., whether an episode starts in explore or in exploit mode, or more generally, whether the agent explores more early in an episode or more later on. It is conceivable that the best choice among these is domain dependent (see Figure 6): in most scenarios, the states at the beginning of an episode have been visited many times, thus starting with exploit mode can be beneficial; in other domains however, early actions may disproportionately determine the available future paths (e.g., build orders in StarCraft (Churchill & Buro, 2011)).
+
+# 2.3 FLEXIBILITY WITHOUT ADDED BURDEN
+
+Our approach introduces additional flexibility to the exploration process, even when holding the specifics of the learning algorithm and the exploration mode fixed. To prevent this from turning into an undue hyper-parameter tuning burden, we recommend adding two additional mechanisms.
+
+Bandit adaptation The two main added degrees of freedom in our intra-episodic switching set-up are when (or how often) to enter explore mode, and when (or how quickly) to exit it. These can be parameterised by a duration, termination probability or target rate (see Section 3.1). In either case, we propose to follow Schaul et al. (2019) and Badia et al. (2020a), and delegate the adaptation of these settings to a meta-controller, which is implemented as a non-stationary multi-armed bandit that maximises episodic return. As an added benefit, the 'when' of exploration can now become adaptive to both the task, and the stage of learning.
+
+Homeostasis In practice, the scales of the informed trigger signals may vary substantially across domains and across training time. For example, the magnitude of $D_{\mathrm{promise}}$ will depend on reward scales and density and can decrease over time as accuracy improves (the signals could also be noisy). This means that naively setting a threshold hyper-parameter is impractical. For a simple remedy, we have taken inspiration from neuroscience (Turrigiano & Nelson, 2004) to add homeostasis to the binary switching mechanism, which tracks recent values of the signal and adapts the threshold for switching so that a specific average target rate is obtained. This functions as an adaptive threshold, making tuning straightforward because the target rate of switching is configured independently of the scales of the trigger signal. See Appendix A for the details of the implementation.
+
+# 3 RESULTS
+
+The design space we propose contains a number of atypical ideas for how to structure exploration. For this reason, we opted to keep the rest of our experimental setup very conventional, and include multiple comparable baselines, ablations and variations.
+
+Setup: R2D2 on Atari We conduct our investigations on a subset of games of the Atari Learning Environment (Bellemare et al., 2013), a common benchmark for the study of exploration. All experiments are conducted across 7 games (FROSTBITE, GRAVITAR, H.E.R.O., MONTEZUMA'S REVENGE, MS. PAC-MAN, PHOENIX, STAR GUNNER), the first 5 of which are classified as hard exploration games (Bellemare et al., 2016), using 3 seeds per game. For our agent, we use the R2D2 architecture (Kapturowski et al., 2019), which is a modern, distributed version of DQN (Mnih et al., 2015) that employs a recurrent network to approximate its Q-value function. This is a common basis used in exploration studies (Dabney et al., 2020; Badia et al., 2020b;a). The only major modification to conventional R2D2 is its exploration mechanism, where instead we implement all the variants of mode-switching introduced in Section 2. Separately from the experience collected for learning, we run an evaluator process that assesses the performance of the current greedy policy. This is what we report in all our performance curves (see Appendix A for more details).
+
+Baselines There are a few simple baselines worth comparing to, namely the pure explore mode $(p_{\mathcal{X}} = 1$ , Fig.1:A) and the pure exploit mode $(p_{\mathcal{X}} = 0)$ , as well as the step-wise interleaved $\varepsilon$ -greedy execution (Fig.1:C), where $p_{\mathcal{X}} = 0.01 = \varepsilon$ (without additional episodic or intra-episodic structure). Given its wide adoption in well-tuned prior work, we expect the latter to perform well overall. The fourth baseline picks a mode for an entire episode at a time (Fig.1:B), with the probability of picking $\mathcal{X}$ being adapted by a bandit meta-controller. We denote these as experiment-level-X, experiment-level-G, step-level-0.01 and episode-level- $\star$ respectively. For each of these, we have a version with uniform $(\mathcal{X}_U)$ and intrinsic $(\mathcal{X}_I)$ explore mode.
+
+
+Figure 2: Illustrating the space of design decisions for intra-episodic exploration (see also Figure 9).
+
+# 3.1 VARIANTS OF INTRA-EPISODIC EXPLORATION
+
+As discussed in Section 2, there are multiple dimensions along which two-mode intra-episodic exploration can vary. The concrete ones for our experiments are:
+
+- Explore mode: uniform random $\mathcal{X}_U$ , or RND intrinsic reward $\mathcal{X}_I$ (denoted XU and XI).
+- Explore duration $(n_{\mathcal{X}})$ : this can be a fixed number of steps (1, 10, 100), or one of these is adaptively picked by a bandit (denoted by $\star$ ), or the switching is symmetric between entering and exiting explore mode (denoted by $=$ ).
+- Trigger type: either blind or informed (based on value promise, see Section 2.2).
+- Exploit duration $(n_{\mathcal{G}})$ : for blind triggers, the exploit duration can be parameterised by fixed number of steps (10, 100, 1000, 10000), indirectly defined by a probability of terminating (0.1, 0.01, 0.001, 0.0001), or adaptively picked by a bandit over these choices (denoted by n* or p*, respectively). For informed triggers, the exploit duration is indirectly parameterised by a target rate in (0.1, 0.01, 0.001, 0.0001), or a bandit over them (p*), which is in turn transformed into an adaptive switching threshold by homeostasis (Section 2.2).
+- Starting mode: $\mathcal{G}$ greedy (default) or $\mathcal{X}$ explore (denoted by $\mathsf{G}$ or $\mathsf{X}$ ).
+
+We can concisely refer to a particular instance by a tuple that lists these choices. For example, XU-intra(100, informed, p*, X) denotes uniform random exploration $\mathcal{X}_U$ , with fixed 100-step explore periods, triggered by the value-promise signal at a bandit-determined rate, and starting in explore mode. See Figure 2 for an illustration.
+
+# 3.2 PERFORMANCE RESULTS
+
+We start by reporting overall performance results, to reassure the reader that our method is viable (and convince them to keep reading the more detailed and qualitative results in the following sections). Figure 3 shows performance across 7 Atari games according to two human-normalised aggregation metrics (mean and median), comparing one form of intra-episodic exploration to all the baselines, separately for each explore mode $(\mathcal{X}_U$ and $\mathcal{X}_I)$ . The headline result is that intra-episodic exploration improves over both step-level and episode-level baselines (as well as the pure experiment-level modes that we would not expect to be very competitive). The full learning curves per game are found in the appendix, and show scores on hard exploration games like MONTEZUMA'S REVENGE or PHOENIX that are also competitive in absolute terms (at our compute budget of 2B frames).
+
+Note that there is a subtle difference to the learning setups between $\mathcal{X}_U$ and $\mathcal{X}_I$ , as the latter requires training a separate head to estimate intrinsic reward values. This is present even in pure exploit mode, where it acts as an auxiliary task only (Jaderberg et al., 2016), hence the differences in pure greedy curves in Figure 3. For details, see Appendix A.
+
+# 3.3 DIVERSITY RESULTS
+
+In a study like ours, the emphasis is not on measuring raw performance, but rather on characterising the diversity of behaviours arising from the spectrum of proposed variants. A starting point is to return to Figure 1 (right), and assess how much of the previously untouched space is now filled
+
+
+Figure 3: Human-normalized performance results aggregated over 7 Atari games and 3 seeds, comparing the four levels of exploration granularity. Left two: uniform explore mode $\mathcal{X}_U$ . Right two: RND intrinsic reward explore mode $\mathcal{X}_I$ . In each case, the baselines are pure modes $\mathcal{X}$ and $\mathcal{G}$ , step-level switching with $\varepsilon$ -greedy, and episodic switching (with a bandit-adapted proportion). Note that the $\mathcal{X}_I$ -step-level experiment uses both an intrinsic and an extrinsic reward, as in Burda et al. (2018).
+
+
+
+
+
+
+
+
+
+
+Figure 4: Rows 1 and 3: Summary characteristics $p_{\mathcal{X}}$ and $\mathrm{rmed}_{\mathcal{X}}$ of induced exploration behaviour, for different variants of intra-episodic exploration (and an episodic baseline for comparison), on a subset of 4 Atari games. Bandit adaptation can change these statistics over time, hence square and cross markers show averages over first and last $10\%$ of training, respectively. Rows 2 and 4: Corresponding final scores (averaged over final $10\%$ of training). Error bars show the span between min and max performance across 3 seeds. Note how different variants cover different parts of characteristic space, and how the bandit adaptation shifts the statistics into different directions for different games. See main text for further discussion and Appendix C for other games and variants.
+
+by intra-episodic variants, and how the 'when' characteristics translate into performance. Figure 4 answers these questions, and raises some new ones. First off, the raw amount of exploration $p_{\mathcal{X}}$ is not a sufficient predictor of performance, implying that the temporal structure matters. It also shows substantial bandit adaptation at work: compare the exploration statistics at the start (squares) and end-points of training (crosses), and how these trajectories differ per game; a common pattern is that reducing $p_{\mathcal{X}}$ far below 0.5 is needed for high performance. Interestingly, these adaptations are similar between $\mathcal{X}_U$ and $\mathcal{X}_I$ , despite very different explore modes (and differing performance
+
+
+
+
+
+
+
+
+Figure 5: Left and center: Illustration of detailed temporal structure within individual episodes, on FROSTBITE (top) and GRAVITAR (bottom), contrasting two trigger mechanisms. Each subplot shows 15 randomly selected episodes (one per row) that share the same overall exploration amount $p_{\mathcal{X}} = 0.1$ . Each vertical bar (magenta) represents an exploration period of fixed length $n_{\mathcal{X}} = 10$ ; each blue chunk represents an exploitation period. Left: blind, step-based trigger leads to equally spaced exploration periods. Center: a trigger signal informed by value promise leads to very different within-episode patterns, with some parts being densely explored, and others remaining in exploit mode for very long. Right: the corresponding learning curves show a clear performance benefit for the informed trigger variant (orange) in this particular setting. Appendix C has similar plots for many more variants and games.
+
+
+
+
+
+
+Figure 6: Starting mode effect. Final mean episode return for two blind intra-episode experiments that differ only in start mode, greedy (blue) or explore (orange). Scores are normalised so that 1 is the maximum result across the two start modes. Either choice can reliably boost or harm performance, depending on the game. Left: uniform explore mode $\mathcal{X}_U$ . Right: intrinsic reward explore mode $\mathcal{X}_I$ .
+
+
+
+
+Figure 7: Left and center: Contrasting the behavioural characteristics between two forms of blind switching, step-based (left) and probabilistic (center), on the example of FROSTBITE. Each point is an actor episode, with colour indicating time in training (blue for early, red for late). Note the higher diversity of $p_{\mathcal{X}}$ when switching probabilistically. Right: Corresponding performance curves indicate that the probabilistic switching (red) has a performance benefit, possibly because it creates the opportunity for 'lucky' episodes with much less randomness in a game where random actions can easily kill the agent. For more games, please see the Appendix C.
+
+
+
+
+
+results). We would expect prolonged intrinsic exploration periods to be more useful than prolonged random ones, and indeed, comparing the high-rmed $\mathcal{X}$ variant (purple) across $\mathcal{X}_U$ and $\mathcal{X}_I$ , it appears more beneficial for the latter. Zooming in on specific games, a few results stand out: in $\mathcal{X}_U$ mode, the only variant that escapes the inherent local optimum of PHOENIX is the blind, doubly adaptive one (purple), with the bandits radically shifting the exploration statistics over the course of training. In contrast, the best results on MONTEZUMA'S REVENGE are produced by the symmetric, informed trigger variant (light green), which is forced to retain a high $p_{\mathcal{X}}$ . Finally, FROSTBITE is the one game where an informed trigger (red) clearly outperforms its blind equivalent (purple).
+
+These insights are still limited to summary statistics, so Figure 5 looks in more depth at the detailed temporal structure within episodes (as in Figure 1, left). Here the main comparison is between blind and informed triggers, illustrating that the characteristics of the fine-grained within-episode structure can differ massively, despite attaining the same high-level statistics $p_{\mathcal{X}}$ and $\mathrm{med}_{\mathcal{X}}$ . We can see quite a lot of variation in the trigger structure – the moments we enter exploration are not evenly spaced anymore. As a bonus, the less rigid structure of the informed trigger (and possibly the more carefully chosen switch points) end up producing better performance too.
+
+Figure 6 sheds light on a complementary dimension, differentiating the effects of starting in explore or exploit mode. In brief, each of these can be consistently beneficial in some games, and consistently harmful in others. Another observation here is the dynamics of the bandit adaptation: when starting in exploit mode, it exhibits a preference for long initial exploit periods in many games (up to 10000 steps), but that effect vanishes when starting in explore mode (see also Appendix C). More subtle effects arise from the choice of parameterisation of switching rates. Figure 7 shows a stark qualitative difference on how probabilistic switching differs from step-count based switching, with the former spanning a much wider diversity of outcomes, which improves performance.
+
+# 3.4 TAKE-AWAYS
+
+Summarising the empirical results in this section, two messages stand out. First, there seems to be a sweet spot in terms of temporal granularity, and intra-episodic exploration is the right step towards finding it. Second, the vastly increased design space of our proposed family of methods gives rise to a large diversity of behavioural characteristics; and this diversity is not superficial, it also translates to meaningful performance differences, with different effects in different games, which cannot be reduced to simplistic metrics, such as $p_{\mathcal{X}}$ . In addition, we provide some sensible rules-of-thumb for practitioners willing to join us on the journey of intra-episodic exploration. In general, it is useful to let a bandit figure out the precise settings, but it is worth curating its choices to at most a handful. Jointly using two bandits across factored dimensions is very adaptive, but can sometimes be harmful when they decrease the signal-to-noise ratio in each other's learning signal. Finally, the choice of the uncertainty-based trigger should be informed by the switching modes (see Appendix B for details).
+
+# 4 DISCUSSION
+
+Time-based exploration control The emphasis of our paper was on the benefits of heterogeneous temporal structure in mode-switching exploration. Another potential advantage over monolithic approaches is that it may be easier to tune hyper-parameters related to an explicit exploration budget (e.g., via $p_{\mathcal{X}}$ ) than to tune an intrinsic reward coefficient, especially if extrinsic reward scales change across tasks or time, and if the non-stationarity of the intrinsic reward affects its overall scale.
+
+Diversity for diversity's sake One role of a general-purpose exploration method is to allow an agent to get off the ground in a wide variety of domains. While this may clash with sample-efficient learning on specific domains, we believe that the former objective will come to dominate in the long run. In this light, methods that exhibit more diverse behaviour are preferable for that reason alone because they are more likely to escape local optima or misaligned priors.
+
+Related work While not the most common approach to exploration in RL, we are aware of some notable work investigating non-trivial temporal structure. The $\epsilon z$ -greedy algorithm (Dabney et al., 2020) initiates contiguous chunks of directed behaviour ('flights') with the length sampled from a heavy-tailed distribution. In contrast to our proposal, these flights act with a single constant action instead of invoking an explore mode. Campos et al. (2021) pursue a similar idea, but with flights along pre-trained coverage policies, while Ecoffet et al. (2021) chain a 'return-to-state' policy to an explore mode. Maybe closest to our $\mathcal{X}_I$ setting is the work of Bagot et al. (2020), where periods of intrinsic reward pursuit are explicitly invoked by the agent. Exploration with gradual change instead of abrupt mode switches generally appears at long time-scales, such as when pursuing intrinsic rewards (Schmidhuber, 2010; Oudeyer & Kaplan, 2009) but can also be effective at shorter timescales, e.g., Never-Give-Up (Badia et al., 2020b). Related work on the question of which states to prefer for exploration decisions (Tokic, 2010) tends not to consider prolonged exploratory periods.
+
+Relation to options Ideas related to switching behaviours at intra-episodic time scales are well-known outside of the context of exploration. In the options framework in hierarchical RL, the goal is to chain together a sequence of sub-behaviours into a reward-maximising policy (Sutton et al., 1999; Mankowitz et al., 2016). Some work has looked at using options for exploration too (Jinnai et al., 2019a; Bougie & Ichise, 2021). In its full generality, the options framework is a substantially more ambitious endeavour than our proposal, as it requires learning a full state-dependent hierarchical policy that picks which option to start (and when), as well as jointly learning the options themselves.
+
+**Limitations** Our proposed approach inherits many typical challenges for exploration methods, such as sample efficiency or trading off risk. An aspect that is particular to the intra-episode switching case is the different nature of the off-policy-ness. The resulting effective policy can produce state distributions that differ substantially from those of either of the two base mode behaviours that are being interleaved. It can potentially visit parts of the state space that neither base policy would reach if followed from the beginning of the episode. While a boon for exploration, this might pose a challenge to learning, as it could require off-policy corrections that treat those states differently and do not only correct for differences in action space. Our paper does not use (non-trivial) off-policy correction (see Appendix A) as our initial experimentation showed it is not an essential component in the current setting (see Figure 15). We leave this intriguing finding for future investigation.
+
+Future work With the dimensions laid out in Section 2, it should be clear that this paper can but scratch the surface. We see numerous opportunities for future work, some of which we already carried out initial investigations (see Appendix B). For starters, the mechanism could go beyond two-mode and switch between exploit, explore, novelty and mastery (Thomaz & Breazeal, 2008), or between many diverse forms of exploration, such as levels of optimism (Derman et al., 2020; Moskovitz et al., 2021). Triggers could be expanded or refined by using different estimations of uncertainty, such as ensemble discrepancy (Wiering & Van Hasselt, 2008; Buckman et al., 2018), amortised value errors (Flennerhag et al., 2020), or density models (Bellemare et al., 2016; Ostrovski et al., 2017); or other signals, such as salience (Downar et al., 2002), minimal coverage (Jinnai et al., 2019a;b), or empowerment (Klyubin et al., 2005; Gregor et al., 2016; Houthooft et al., 2016).
+
+Conclusion We have presented an initial study of intra-episodic exploration, centred on the scenario of switching between an explore and an exploit mode. We hope this has broadened the available forms of temporal structure in behaviour, leading to more diverse, adaptive and intentional forms of exploration, in turn enabling RL to scale to ever more complex domains.
+
+# ACKNOWLEDGMENTS
+
+We would like to thank Audrunas Gruslys, Simon Osindero, Eszter Vértes, David Silver, Dan Horgan, Zita Marinho, Katrina McKinney, Claudia Clopath, David Amos, Víctor Campos, Remi Munos, and the entire DeepMind team for discussions and support, and especially Pablo Sprechmann and Luisa Zintgraf for detailed feedback on an earlier version.
+
+# REFERENCES
+
+M. A. Addicott, J. M. Pearson, M. M. Sweitzer, D. L. Barack, and M. L. Platt. A Primer on Foraging and the Explore/Exploit Trade-Off for Psychiatry Research. Neuropsychopharmacology, 42(10): 1931–1939, Sep 2017.
+Adrià Puigdomènech Badia, Bilal Piot, Steven Kapturowski, Pablo Sprechmann, Alex Vitvitskyi, Daniel Guo, and Charles Blundell. Agent57: Outperforming the Atari human benchmark, 2020a.
+Adrià Puigdomènech Badia, Pablo Sprechmann, Alex Vitvitskyi, Daniel Guo, Bilal Piot, Steven Kapturowski, Olivier Tieleman, Martin Arjovsky, Alexander Pritzel, Andrew Bolt, and Charles Blundell. Never give up: Learning directed exploration strategies, 2020b.
+Louis Bagot, Kevin Mets, and Steven Latré. Learning intrinsically motivated options to stimulate policy exploration, 2020.
+Marc G Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 47: 253-279, 2013.
+Marc G Bellemare, Sriram Srinivasan, Georg Ostrovski, Tom Schaul, David Saxton, and Rémi Munos. Unifying count-based exploration and intrinsic motivation. In Neural Information Processing Systems, 2016.
+Nicolas Bougie and Ryutaro Ichise. Fast and slow curiosity for high-level exploration in reinforcement learning. Applied Intelligence, 51(2):1086-1107, 2021.
+James Bradbury, Roy Frostig, Peter Hawkins, Matthew James Johnson, Chris Leary, Dougal Maclaurin, George Necula, Adam Paszke, Jake VanderPlas, Skye Wanderman-Milne, and Qiao Zhang. JAX: composable transformations of Python+NumPy programs, 2018. URL http://github.com/google/jax.
+Jacob Buckman, Danijar Hafner, George Tucker, Eugene Brevdo, and Honglak Lee. Sample-efficient reinforcement learning with stochastic ensemble value expansion. arXiv preprint arXiv:1807.01675, 2018.
+David Budden, Matteo Hessel, Iurii Kemaev, Stephen Spencer, and Fabio Viola. Chex: Testing made fun, in jax!, 2020a. URL http://github.com/deepmind/chex.
+David Budden, Matteo Hessel, John Quan, Steven Kapturowski, Kate Baumli, Surya Bhupatiraju, Aurelia Guy, and Michael King. RLax: Reinforcement Learning in JAX, 2020b. URL http://github.com/deepmind/rlax.
+Yuri Burda, Harrison Edwards, Amos J. Storkey, and Oleg Klimov. Exploration by random network distillation. CoRR, abs/1810.12894, 2018.
+Víctor Campos, Pablo Sprechmann, Steven Hansen, Andre Barreto, Steven Kapturowski, Alex Vitvitskyi, Adrià Puigdomènech Badia, and Charles Blundell. Coverage as a principle for discovering transferable behavior in reinforcement learning. arXiv preprint arXiv:2102.13515, 2021.
+Olivier Cappé, Aurélien Garivier, Odalric-Ambrym Maillard, Rémi Munos, Gilles Stoltz, et al. Kullback-Leibler upper confidence bounds for optimal sequential allocation. Annals of Statistics, 41(3):1516-1541, 2013.
+
+Albin Cassirer, Gabriel Barth-Maron, Thibault Sottiaux, Manuel Kroiss, and Eugene Brevdo. Reverb: An efficient data storage and transport system for ml research, 2020. URL https://github.com/deepmind/reverb.
+Flurin Cathomas, Federica Klaus, Karoline Guetter, Hui-Kuan Chung, Anjali Raja Beharelle, Tobias R. Spiller, Rebecca Schlegel, Erich Seifritz, Matthias N. Hartmann-Riemer, Philippe N. Tobler, and Stefan Kaiser. Increased random exploration in schizophrenia is associated with inflammation. npj Schizophrenia, 7(1):6, Feb 2021.
+K. Chakroun, D. Mathar, A. Wiehler, F. Ganzer, and J. Peters. Dopaminergic modulation of the exploration/exploitation trade-off in human decision-making. *Elife*, 9, 06 2020.
+David Churchill and Michael Buro. Build order optimization in starcraft. In Proceedings of the AAAI Conference on Artificial Intelligence and Interactive Digital Entertainment, volume 6(1), 2011.
+Jonathan D Cohen, Samuel M McClure, and Angela J Yu. Should I stay or should I go? How the human brain manages the trade-off between exploitation and exploration. Philosophical Transactions of the Royal Society B: Biological Sciences, 362(1481):933-942, 2007.
+Vincent D. Costa, Andrew R. Mitz, and Bruno B. Averbeck. Subcortical substrates of explore-exploit decisions in primates. Neuron, 103(3):533-545.e5, August 2019.
+Jonas Cremer, Tomoya Honda, Ying Tang, Jerome Wong-Ng, Massimo Vergassola, and Terence Hwa. Chemotaxis as a navigation strategy to boost range expansion. Nature, 575(7784):658-663, 11 2019.
+Will Dabney, Georg Ostrovski, and André Barreto. Temporally-extended $\epsilon$ -greedy exploration, 2020.
+Esther Derman, Daniel Mankowitz, Timothy Mann, and Shie Mannor. A bayesian approach to robust reinforcement learning. In Uncertainty in Artificial Intelligence, pp. 648-658. PMLR, 2020.
+Jonathan Downar, Adrian P Crawley, David J Mikulis, and Karen D Davis. A cortical network sensitive to stimulus salience in a neutral behavioral context across multiple sensory modalities. Journal of neurophysiology, 87(1):615-620, 2002.
+R. Becket Ebitz, Brianna J. Sleezer, Hank P. Jedema, Charles W. Bradberry, and Benjamin Y. Hayden. Tonic exploration governs both flexibility and lapses. PLOS Computational Biology, 15(11): e1007475, November 2019.
+Adrien Ecoffet, Joost Huizinga, Joel Lehman, Kenneth O. Stanley, and Jeff Clune. Go-exlore: a new approach for hard-exploration problems, 2021.
+Sebastian Flennerhag, Jane X Wang, Pablo Sprechmann, Francesco Visin, Alexandre Galashov, Steven Kapturowski, Diana L Borsa, Nicolas Heess, Andre Barreto, and Razvan Pascanu. Temporal difference uncertainties as a signal for exploration. arXiv preprint arXiv:2010.02255, 2020.
+Samuel J. Gershman. Deconstructing the human algorithms for exploration. Cognition, 173:34-42, 2018. ISSN 0010-0277.
+Samuel J. Gershman and Bastian Greshake Tzovaras. Dopaminergic genes are associated with both directed and random exploration. bioRxiv, 2018.
+Karol Gregor, Danilo Jimenez Rezende, and Daan Wierstra. Variational intrinsic control. arXiv preprint arXiv:1611.07507, 2016.
+Tom Hennigan, Trevor Cai, Tamara Norman, and Igor Babuschkin. Haiku: Sonnet for JAX, 2020. URL http://github.com/deepmind/dm-haiku.
+Matteo Hessel, David Budden, Fabio Viola, Mihaela Rosca, Eren Sezener, and Tom Hennigan. Optax: Composable gradient transformation and optimisation, in JAX!, 2020. URL http://github.com/deepmind/optax.
+
+T. T. Hills, P. M. Todd, D. Lazer, A. D. Redish, and I. D. Couzin. Exploration versus exploitation in space, mind, and society. Trends Cogn Sci, 19(1):46-54, Jan 2015.
+Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8): 1735-1780, 1997.
+Dan Horgan, John Quan, David Budden, Gabriel Barth-Maron, Matteo Hessel, Hado Van Hasselt, and David Silver. Distributed prioritized experience replay. arXiv preprint arXiv:1803.00933, 2018.
+Rein Houthooft, Xi Chen, Yan Duan, John Schulman, Filip De Turck, and Pieter Abbeel. Vime: Variational information maximizing exploration. arXiv preprint arXiv:1605.09674, 2016.
+Max Jaderberg, Volodymyr Mnih, Wojciech Marian Czarnecki, Tom Schaul, Joel Z Leibo, David Silver, and Koray Kavukcuoglu. Reinforcement learning with unsupervised auxiliary tasks. arXiv preprint arXiv:1611.05397, 2016.
+Thomas Jaksch, Ronald Ortner, and Peter Auer. Near-optimal regret bounds for reinforcement learning. Journal of Machine Learning Research, 11(4), 2010.
+Yuu Jinnai, Jee Won Park, David Abel, and George Konidaris. Discovering options for exploration by minimizing cover time. In International Conference on Machine Learning, pp. 3130-3139. PMLR, 2019a.
+Yuu Jinnai, Jee Won Park, Marlos C Machado, and George Konidaris. Exploration in reinforcement learning with deep covering options. In International Conference on Learning Representations, 2019b.
+Steven Kaptuowski, Georg Ostrovski, Will Dabney, John Quan, and Remi Munos. Recurrent experience replay in distributed reinforcement learning. In International Conference on Learning Representations, 2019.
+J. M. Kembro, M. Lihoreau, J. Garriga, E. P. Raposo, and F. Bartumeus. Bumblebees learn foraging routes through exploitation-exploration cycles. *JR Soc Interface*, 16(156):20190103, 07 2019.
+Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
+Alexander S Klyubin, Daniel Polani, and Chrystopher L Nehaniv. Empowerment: A universal agent-centric measure of control. In 2005 IEEE Congress on Evolutionary Computation, volume 1, pp. 128-135. IEEE, 2005.
+Tor Lattimore and Csaba Szepesvári. Bandit algorithms. Cambridge University Press, 2020.
+Cam Linke, Nadia M. Ady, Martha White, Thomas Degris, and Adam White. Adapting behaviour via intrinsic reward: A survey and empirical study, 2019.
+Marlos C Machado, Marc G Bellemare, Erik Talvitie, Joel Veness, Matthew Hausknecht, and Michael Bowling. Revisiting the arcade learning environment: Evaluation protocols and open problems for general agents. Journal of Artificial Intelligence Research, 61:523-562, 2018.
+Daniel J Mankowitz, Timothy Arthur Mann, and Shie Mannor. Adaptive skills adaptive partitions (ASAP). In Neural Information Processing Systems, 2016.
+Volodymyr Mniih, Koray Kavukcuoglu, David Silver, Andrei A. Rusu, Joel Veness, Marc G. Bellemare, Alex Graves, Martin Riedmiller, Andreas K. Fidjeland, Georg Ostrovski, Stig Petersen, Charles Beattie, Amir Sadik, Ioannis Antonoglou, Helen King, Dharshan Kumaran, Daan Wierstra, Shane Legg, and Demis Hassabis. Human-level control through deep reinforcement learning. Nature, 518(7540):529-533, 2015.
+Ted Moskovitz, Jack Parker-Holder, Aldo Pacchiano, and Michael Arbel. Deep reinforcement learning with dynamic optimism. arXiv preprint arXiv:2102.03765, 2021.
+Georg Ostrovski, Marc G. Bellemare, Aïron van den Oord, and Rémi Munos. Count-based exploration with neural density models. CoRR, abs/1703.01310, 2017.
+
+Pierre-Yves Oudeyer and Frederic Kaplan. What is intrinsic motivation? a typology of computational approaches. Frontiers in neurorobotics, 1:6, 2009.
+Thomas G Power. Play and exploration in children and animals. Psychology Press, 1999.
+Tom Schaul, John Quan, Ioannis Antonoglou, and David Silver. Prioritized experience replay. In International Conference on Learning Representations, Puerto Rico, 2016.
+Tom Schaul, Diana Borsa, David Ding, David Szepesvari, Georg Ostrovski, Will Dabney, and Simon Osindero. Adapting behaviour for learning progress, 2019.
+Tom Schaul, Georg Ostrovski, Iurii Kemaev, and Diana Borsa. Return-based scaling: Yet another normalisation trick for deep RL. arXiv preprint arXiv:2105.05347, 2021.
+Jürgen Schmidhuber. Curious model-building control systems. In Proc. international joint conference on neural networks, pp. 1458-1463, 1991.
+Jürgen Schmidhuber. Formal theory of creativity, fun, and intrinsic motivation (1990-2010). IEEE Transactions on Autonomous Mental Development, 2(3):230-247, 2010.
+Eric Schulz, Rahul Bhui, Bradley C. Love, Bastien Brier, Michael T. Todd, and Samuel J. Gershman. Structured, uncertainty-driven exploration in real-world consumer choice. Proceedings of the National Academy of Sciences, 116(28):13903-13908, June 2019.
+Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT press, 2018.
+Richard S Sutton, Doina Precup, and Satinder Singh. Between MDPs and semi-MDPs: A framework for temporal abstraction in reinforcement learning. Artificial intelligence, 112(1-2):181-211, 1999.
+Andrea L Thomaz and Cynthia Breazeal. Experiments in socially guided exploration: Lessons learned in building robots that learn with and without human teachers. *Connection Science*, 20 (2-3):91-110, 2008.
+Sebastian B Thrun. Efficient exploration in reinforcement learning, 1992.
+Michel Tokic. Adaptive $\varepsilon$ -greedy exploration in reinforcement learning based on value differences. In Annual Conference on Artificial Intelligence, pp. 203-210. Springer, 2010.
+Gina G Turrigiano and Sacha B Nelson. Homeostatic plasticity in the developing nervous system. Nature reviews neuroscience, 5(2):97-107, 2004.
+James A. Waltz, Robert C. Wilson, Matthew A. Albrecht, Michael J. Frank, and James M. Gold. Differential effects of psychotic illness on directed and random exploration. Computational Psychiatry, 4(0):18, August 2020.
+Ziyu Wang, Tom Schaul, Matteo Hessel, Hado Hasselt, Marc Lanctot, and Nando Freitas. Dueling network architectures for deep reinforcement learning. In Maria Florina Balcan and Kilian Q. Weinberger (eds.), Proceedings of The 33rd International Conference on Machine Learning, volume 48 of Proceedings of Machine Learning Research, pp. 1995-2003, New York, New York, USA, 20-22 Jun 2016. PMLR.
+Marco A Wiering and Hado Van Hasselt. Ensemble algorithms in reinforcement learning. IEEE Transactions on Systems, Man, and Cybernetics, Part B (Cybernetics), 38(4):930-936, 2008.
+J. M. Wolfe, K. R. Cave, and S. L. Franzel. Guided search: an alternative to the feature integration model for visual search. J Exp Psychol Hum Percept Perform, 15(3):419-433, 1989.
+Daochen Zha, Wenye Ma, Lei Yuan, Xia Hu, and Ji Liu. Rank the episodes: A simple approach for exploration in procedurally-generated environments. In International Conference on Learning Representations, 2021.
+
+# A DETAILED EXPERIMENTAL SETUP
+
+# A.1 ATARI ENVIRONMENT
+
+We use a selection of games from the widely used Atari Learning Environment (ALE, Bellemare et al. (2013)). It is configured to not expose the 'life-loss' signal, and use the full action set (18 discrete actions) for all games (not the per-game reduced effective action spaces). We also use the sticky-action randomisation as in (Machado et al., 2018). Episodes time-out after 108k frames (i.e. 30 minutes of real-time game play).
+
+Differently from most past Atari RL agents following DQN (Mnih et al., 2015), our agent uses the raw $210 \times 160$ RGB frames as input to its value function (one at a time, without frame stacking), though it still applies a max-pool operation over the most recent 2 frames to mitigate flickering inherent to the Atari simulator. As in most past work, an action-repeat of 4 is applied, over which rewards are summed.
+
+# A.2 AGENT
+
+The agent used in our Atari experiments is a distributed implementation of a value- and replay-based RL algorithm derived from the Recurrent Replay Distributed DQN (R2D2) architecture (Kapturowski et al., 2019). This system comprises of a fleet of 120 CPU-based actors (combined with a single TPU for batch inference) concurrently generating experience and feeding it to a distributed experience replay buffer, and a single TPU-based learner randomly sampling batches of experience sequences from replay and performing updates of the recurrent value function by gradient descent on a suitable RL loss.
+
+The value function is represented by a convolutional torso feeding into a linear layer, followed by a recurrent LSTM (Hochreiter & Schmidhuber, 1997) core, whose output is processed by a further linear layer before finally being output via a Dueling value head (Wang et al., 2016). The exact parameterisation follows the slightly modified R2D2 presented by Dabney et al. (2020) and Schaul et al. (2021). Refer to Table 1 for a full list of hyper-parameters. It is trained via stochastic gradient descent on a multi-step TD loss (more precisely, a 5-step Q-learning loss) with the use of a periodically updated target network (Mnih et al., 2015) for bootstrap target computation, using mini-batches of sampled replay sequences. Replay sampling is performed using prioritized experience replay (Schaul et al., 2016) with priorities computed from sequences' TD errors following the scheme introduced by Kapturowski et al. (2019). As in R2D2, sequences of 80 observations are used for replay, with a prefix of 20 observations used for burn-in. In a slight deviation from the original, our agent uses a fixed replay ratio of 1, i.e. the learner or actors get throttled dynamically if the average number of times a sample gets replayed exceeds or falls below this value; this makes experiments more reproducible and stable.
+
+Actors periodically pull the most recent network parameters from the learner to be used in their exploratory policy. In addition to feeding the replay buffer, all actors periodically report their reward, discount and return histories to the learner, which then calculates running estimates of reward, discount and return statistics to perform return-based scaling (Schaul et al., 2021). If applicable, the episodic returns from the actors are also sent to the non-stationary bandit(s) that adapt the distribution over exploration parameters (e.g., target ratios $\rho$ or period lengths $n_{\mathcal{X}}$ ). In return, the bandit(s) provide samples from that distribution to each actor at the start of a new episode, just like Schaul et al. (2019).
+
+Our agent is implemented with JAX (Bradbury et al., 2018), uses the Haiku (Hennigan et al., 2020), Optax (Budden et al., 2020b), Chex (Budden et al., 2020a), and RLax (Hessel et al., 2020) libraries for neural networks, optimisation, testing, and RL losses, respectively, and Reverb (Cassirer et al., 2020) for distributed experience replay.
+
+# A.3 TRAINING AND EVALUATION PROTOCOLS
+
+All our experiments ran for 200k learner updates. With a replay ratio of 1, sequence length of 80 (adjacent sequences overlapping by 40 observations), a batch size of 64, and an action-repeat of 4 this corresponds to a training budget of $200000 \times 64 \times 40 \times 1 \times 4 \approx 2\mathrm{B}$ environment frames (which
+
+| Neural Network | |
| Convolutional torso channels | 32,64,128,128 |
| Convolutional torso kernel sizes | 7,5,5,3 |
| Convolutional torso strides | 4,2,2,1 |
| Pre-LSTM linear layer units | 512 |
| LSTM hidden units | 512 |
| Post-LSTM linear layer units | 256 |
| Dueling value head units | 2 × 256 (separate linear layer for each of value and advantage) |
| Acting | |
| Initial random No-Ops | None |
| Sticky actions | Yes (prob 0.25) |
| Action repeats | 4 |
| Number of actors | 120 |
| Actor parameter update interval | 400 environment steps |
| Replay | |
| Replay sequence length | 80 (+ prefix of 20 of burn-in) |
| Replay buffer size | 4 × 10^6 observations (10^5 part-overlapping sequences) |
| Priority exponent | 0.9 |
| Importance sampling exponent | 0.6 |
| Fixed replay ratio | 1 update per sample (on average) |
| Learning | |
| Multi-step Q-learning | k=5 |
| Off-policy corrections | None |
| Discount γ | 0.997 |
| Reward clipping | None |
| Return-based scaling | as in (Schaul et al., 2021) |
| Mini-batch size | 64 |
| Optimizer & settings | Adam (Kingma & Ba, 2014), learning rate η = 2 × 10^-4, ε = 10^-8, momentum β1 = 0.9, second moment β2 = 0.999 |
| Gradient norm clipping | 40 |
| Target network update interval | 400 updates |
| RND settings | |
| Convolutional torso channels | 32,64,64 |
| Convolutional torso kernel sizes | 8,4,3 |
| Convolutional torso strides | 4,2,1 |
| MLP hidden units | 128 |
| Image downsampling stride | 2 × 2 |
+
+Table 1: Hyper-parameters and settings.
+
+is less than $10\%$ of the original R2D2 budget). In wall-clock-time, one such experiment takes about 12 hours using 2 TPUs (one for the batch inference, the other for the learner) and 120 CPUs.
+
+For evaluation, a separate actor (not feeding the replay buffer) is running alongside the agent using a greedy policy $(\varepsilon = 0)$ , and pulling the most recent parameters at the beginning of each episode. We follow standard evaluation methodology for Atari, reporting mean and median 'human-normalised' scores as introduced in (Mnih et al., 2015) (i.e. the episode returns are normalised so that 0 corresponds to the score of a uniformly random policy while 1 corresponds to human performance), as well as the mean 'human-capped' score which caps the per-game performance at human level. Error bars or shaded curves correspond to the minimum and maximum values across these seeds.
+
+# A.4 RANDOM NETWORK DISTILLATION
+
+The agent setup for the $\mathcal{X}_I$ experiments differs in a few ways from the default described above. First, a separate network is trained via Random Network Distillation (RND, (Burda et al., 2018)), which consists of a simple convnet with an MLP (no recurrence); for detailed settings, see RND section in Table 1. The RND prediction network is updated jointly with the Q-value network, on the same
+
+data. The intrinsic reward derived from the RND loss is pursued at the same discount $\gamma = 0.997$ as the external reward in $\mathcal{G}$ . The Q-value network is augmented with a second head that predicts the Q-values for the intrinsic reward; this branches off after the 'Post-LSTM linear layer' (with 256), and is the same type ofueling head, using the same scale normalisation method (Schaul et al., 2021). In addition, the 5-step Q-learning is adapted to use a simple off-policy correction, namely trace-cutting on non-greedy actions (akin to Watkins $Q(\lambda)$ with $\lambda = 1$ ), separately for each learning head. The $\mathcal{X}_I$ policy is the greedy policy according to the Q-values of the second head. Note that because of these differences in set-up, and especially because the second head can function as an auxiliary learning target, it may be misleading to compare $\mathcal{X}_I$ and $\mathcal{X}_U$ results head-to-head: we recommend looking at how things change within one of these settings (across variants of intra-episodic exploration or the baselines), rather than between them.
+
+# A.5 HOMEOSTASIS
+
+The role of the homeostasis mechanism is to transform a sequence of scalar signals $x_{t} \in \mathbb{R}$ (for $1 \leq t \leq T$ ) into a sequence of binary switching decisions $y_{t} \in \{0,1\}$ so that the average number of switches approximates a desired target rate $\rho$ , that is, $\frac{1}{T} \sum_{t} y_{t} \approx \rho$ , and high values of $x_{t}$ correspond to a higher probability of $y_{t} = 1$ . Furthermore, the decision at any point $y_{t}$ can only be based on the past signals $x_{1:t}$ . One way to achieve this is to exponentiate $x$ (to turn it into a positive number $x^{+}$ ) and then set an adaptive threshold to determine when to switch. Algorithm 1 describes how this is done in pseudo-code. The implementation defines a time-scale of interest $\tau := \min(t, 100 / \rho)$ , and uses it to track moving averages of three quantities, namely the mean and variance of $x$ , as well as the mean of $x^{+}$ .
+
+Algorithm 1 Homeostasis
+Require: target rate $\rho$
+1: initialize $\overline{x} \gets 0, \overline{x^2} \gets 1, \overline{x^+} \gets 1$
+2: for $t \in \{1, \dots, T\}$ do
+3: obtain next scalar signal return $x_t$
+4: set time-scale $\tau \gets \min(t, \frac{100}{\rho})$
+5: update moving average $\overline{x} \gets (1 - \frac{1}{\tau})\overline{x} + \frac{1}{\tau} x_t$
+6: update moving variance $\overline{x^2} \gets (1 - \frac{1}{\tau})\overline{x^2} + \frac{1}{\tau} (x_t - \overline{x})^2$
+7: standardise and exponentiate $x^+ \gets \exp\left(\frac{x_t - \overline{x}}{\sqrt{\overline{x^2}}}\right)$
+8: update transformed moving average $\overline{x^+} \gets (1 - \frac{1}{\tau})\overline{x^+} + \frac{1}{\tau} x^+$
+9: sample $y_t \sim \text{Bernoulli}\left(\min\left(1, \rho \frac{x^+}{x^+}\right)\right)$
+10: end for
+
+In our informed trigger experiments we use value promise as the particular choice of trigger signal $x_{t} = D_{\mathrm{promise}}(t - k,t)$ . As discussed in Section3.1, when using a bandit, its choices for target rates are $\rho \in \{0.1, 0.01, 0.001, 0.0001\}$ .
+
+# B OTHER VARIANTS
+
+The results we report in the main paper are but a subset of the possible variants that could be tried in this rather large design space. In fact, we have done initial investigations on a few of these, which we report below.
+
+# B.1 ADDITIONAL EXPLORE MODES
+
+Softer explore-exploit modes The all-or-nothing setting with a greedy exploit mode and a uniform random explore mode is clear and simple, but it is plausible that less extreme choices could work well too, such as an $\varepsilon$ -greedy exploit mode with $\varepsilon = 0.4$ and an $\varepsilon$ -greedy exploit mode with
+
+
+Figure 8: Preliminary results comparing different informed triggers: value-discrepancy, action-mismatch, and variance-based, when using $\mathcal{X}_I$ exploration mode.
+
+$\varepsilon = 0.1$ . We denote this pairing as $\mathcal{X}_S$ . Preliminary results (see Figure 16) indicate that overall performance is mostly similar to $\mathcal{X}_U$ , possibly less affected by the choice of granularity and triggers.
+
+Different discounts Another category of explore mode $(\mathcal{X}_{\gamma})$ is to pursue external reward but at a different time-scale (e.g., a much shorter discount like $\gamma = 0.97$ ). This results in less of a switch between explore and exploit modes, but rather in an alternation of long-term and short-term reward pursuits, producing a different kind of behavioural diversity. So far, we do not have conclusive results to report with this mode.
+
+# B.2 ADDITIONAL INFORMED TRIGGERS
+
+Action-mismatch-based triggers Another type of informed trigger is to derive an uncertainty estimate from the discrepancies across an ensemble. For example, we can train two heads that use an identical Q-learning update but are initialised differently. From that, we can measure multiple forms of discrepancy, a nice and robust one is to rank the actions according to each head and compute how large the overlap among the top- $k$ actions is.
+
+Variance-based triggers Another type of informed trigger is to measure the variance of the Q-values themselves, taken across such an ensemble (of two heads) and use that as an alternative uncertainty-based trigger.
+
+Figure 8 shows preliminary results on how performance compares across these two new informed triggers, in relation to the value-promise one from Section 2.2. Overall, the action-mismatch trigger seems to have an edge, at least in this setting, and we plan to investigate this further in the future. From other probing experiments, it appears that for other explore modes, different trigger signals are more suitable.
+
+# C ADDITIONAL RESULTS
+
+This section includes additional results. Wherever the main figures included a subset of games or variants (Figures 4, 5, 7) we show full results here (Figures 11, 12, 13, respectively), and the aggregated performances of Figure 3 are split out into individual games in Figure 10. Also, some of the learning curves from Figures 4 and 11 are shown in Figure 16. In addition, Figure 14 illustrates how the internal bandit probabilities evolve over time based on starting mode for the experiments shown in Figure 6. Lastly, we provide some bonus illustrations for the intra-episodic design decisions included in the namings of our variants in Figure 9 with the hope of facilitating the interpretation and intuition for intra-episodic variants and their resulting behaviours.
+
+
+Figure 9: Extra example illustrating the space of design decisions for intra-episodic exploration.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Figure 10: Extension of Figure 3, showing performance results as the mean episode return (with error bars spanning the min and max performance across 3 seeds) for the 7 Atari games tried. We compare the four levels of exploration granularity as described in section 2.1 for $\mathcal{X}_U$ mode (top two rows) and $\mathcal{X}_I$ mode (bottom two rows). Intra-episodic switching (red curve) is superior or comparable to existing, monolithic or well-established approaches. Note that here we compare with the same intra-episodic switching mechanism (i.e., with XU- or XI-intra(10, informed, p*, X)), but there is at least one intra-episodic variant for each game which results in clear performance gains (just that it is not the same intra-episodic variant across games or as the one shown here).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+XU-episode-level*
+XU-intra(10,infoxed,0.001,G)
+
+
+XU-intra(p*,informed,p*,G)
+
+
+
+
+
+
+XU-intra(10, informed,p*,G)
+XU-intra(=,informed,p*,G)
+XU-intra(=,blind,n*,G)
+XU-intra(n*,blind,n*,G)
+XU-intra(10,blind,n*,G)
+XU-intra(n\*,blind,100,G)
+XU-intra(=,blind,n*,X)
+
+
+
+
+
+
+XU-intra(10,blind,90,X)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+XI-episode-level\*
+XI-intra(10 informed 0.001 G)
+
+
+Figure 11: Extension of figure 4 to all Atari games and intra-episodic switching variants tried. We show the characteristic space of exploration (summarized by $\mathrm{rmed}_{\mathcal{X}}$ and $p_{\mathcal{X}}$ on the X and Y axis, respectively) on rows 1, 2, 5, and 6, and how different explore-exploit proportions translate to performance (error bars spanning the min and max performance across 3 seeds) on rows 3, 4, 7, and 8, for $\mathcal{X}_U$ mode (top) and $\mathcal{X}_I$ mode (bottom). Note how different intra-episodic switching variants cover different parts of characteristic space and how the meta-controller adapts and changes the exploration statistics over time. This figure shows how fine-grained and varied intra-episodic switching can be, and how it translates to rich, diverse, and beneficial behaviours.
+
+
+
+
+XI-intra(10, informed p*G)
+XI-intra(n\*informed n\*G)
+XI intra(β, informed, β, G)
+XI intra(-informed, -G)
+Xtra(-,informed,p) Xtra(-,blind p*G)
+Xintra(2,5Hind,N-3)
+Xl-Intra(n²,blind,n²,G)XlIntra(10,bind,nG)
+XI intra(-blind, p*G)
+Xl intra(=,blind,p-G) Xl intra(-,blind p-X)
+X1-Intra(=,bIntra,n-,x)
+XI-intra(10,blind,90,X)
+
+
+Figure 12: Extension of Figure 5 to the 7 Atari games we experimented with. First two columns: temporal structures for a blind, step-based trigger; the 15 episodes we randomly selected correspond to 100 and 1000 fixed switching steps; the exploration period was fixed to 10 steps. Last two columns: temporal structures obtained with an equivalent informed trigger and corresponding to target rates of 0.01 and 0.001, respectively.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Figure 13: Extension of Figure 7, showing behavioural characteristics (exploration proportion $p_{\mathcal{X}}$ ) between two forms of blind switching, step-based (left) and probabilistic (center), with their corresponding performances (right).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Figure 14: Extension of Figure 6, showing the performance differences between two blind intra-episode experiments, starting either in explore $(\mathcal{X},$ rows 2 and 4) or in exploit mode $(\mathcal{G},$ rows 1 and 3). We show the bandit arm probabilities for each of the step sizes $n_{\mathcal{X}}$ and how they change over the course of learning for $\mathcal{X}_U$ (top two rows) and for $\mathcal{X}_I$ modes (bottom two rows). Findings: for symmetric blind triggers, starting with exploitation results in slower rates of switching (high $n_{\mathcal{X}} = n_{\mathcal{G}}$ like red and green); in contrast, starting with exploration results in behaviours promoting higher switching rates (small $n_{\mathcal{X}} = n_{\mathcal{G}}$ like blue and orange). Note that these preferences are not matching perfectly across all games, and thus results are domain-dependent.
+
+
+Figure 15: Results of a probe experiment around off-policy correction in $\mathcal{X}_I$ mode. Red is Watkins Q(λ) with $\lambda = 1$ while blue is uncorrected $k$ -step Q-learning, in each case with returns of length at most $k = 5$ . The performance is the same (or even slightly better) without off-policy correction, showing that it is not critical in our current setting.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Figure 16: Comparing 3 different $\mathcal{X}$ modes on the same 4 experimental settings and across 7 Atari games: uniform exploration $(\mathcal{X}_U, \text{left})$ , soft-epsilon-based exploration $(\mathcal{X}_S, \text{center})$ , and intrinsic exploration $(\mathcal{X}_I, \text{right})$ .
+
+
+
+
\ No newline at end of file
diff --git a/whenshouldagentsexplore/images.zip b/whenshouldagentsexplore/images.zip
new file mode 100644
index 0000000000000000000000000000000000000000..5a02bf827933f14abce31f7d37dff5ce45179304
--- /dev/null
+++ b/whenshouldagentsexplore/images.zip
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:87ba27ea602a601dab7b56f86dda16664d2a38c3e8359d8847d29f2cd72a93c7
+size 1687444
diff --git a/whenshouldagentsexplore/layout.json b/whenshouldagentsexplore/layout.json
new file mode 100644
index 0000000000000000000000000000000000000000..fd1c378204674cc213f83af8b843262de34dbd3d
--- /dev/null
+++ b/whenshouldagentsexplore/layout.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4b61e3600b1f61b42574e0b5bc487e86253416f83dea9efbffd9daa4138cea5e
+size 752554
diff --git a/whenvisiontransformersoutperformresnetswithoutpretrainingorstrongdataaugmentations/30202633-e06f-4c99-bc55-71857f4d2056_content_list.json b/whenvisiontransformersoutperformresnetswithoutpretrainingorstrongdataaugmentations/30202633-e06f-4c99-bc55-71857f4d2056_content_list.json
new file mode 100644
index 0000000000000000000000000000000000000000..7febf6357732770532f06e67741d8a2444543e99
--- /dev/null
+++ b/whenvisiontransformersoutperformresnetswithoutpretrainingorstrongdataaugmentations/30202633-e06f-4c99-bc55-71857f4d2056_content_list.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a7503ca68a7c48f7102c86293cd4bfd99d1a295b69d84644187c88d54a65b580
+size 130580
diff --git a/whenvisiontransformersoutperformresnetswithoutpretrainingorstrongdataaugmentations/30202633-e06f-4c99-bc55-71857f4d2056_model.json b/whenvisiontransformersoutperformresnetswithoutpretrainingorstrongdataaugmentations/30202633-e06f-4c99-bc55-71857f4d2056_model.json
new file mode 100644
index 0000000000000000000000000000000000000000..12ebb55640385bc8cd5a3061be4a6fc1b1139d2d
--- /dev/null
+++ b/whenvisiontransformersoutperformresnetswithoutpretrainingorstrongdataaugmentations/30202633-e06f-4c99-bc55-71857f4d2056_model.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b68de63dc33b36e5358f718dc2d0528419f4c66a6c8941a486f21a7632db9895
+size 155144
diff --git a/whenvisiontransformersoutperformresnetswithoutpretrainingorstrongdataaugmentations/30202633-e06f-4c99-bc55-71857f4d2056_origin.pdf b/whenvisiontransformersoutperformresnetswithoutpretrainingorstrongdataaugmentations/30202633-e06f-4c99-bc55-71857f4d2056_origin.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..1a33eb7dad3beca8827cec5c236274edcb2a1c97
--- /dev/null
+++ b/whenvisiontransformersoutperformresnetswithoutpretrainingorstrongdataaugmentations/30202633-e06f-4c99-bc55-71857f4d2056_origin.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:af9f4aab6a081a4108c49b389699f87f20a4906ac0cbfbbf706968f007804407
+size 2550550
diff --git a/whenvisiontransformersoutperformresnetswithoutpretrainingorstrongdataaugmentations/full.md b/whenvisiontransformersoutperformresnetswithoutpretrainingorstrongdataaugmentations/full.md
new file mode 100644
index 0000000000000000000000000000000000000000..70b25fa1a2d13fcead6dae657df8924c12dbd561
--- /dev/null
+++ b/whenvisiontransformersoutperformresnetswithoutpretrainingorstrongdataaugmentations/full.md
@@ -0,0 +1,437 @@
+# WHEN VISION TRANSFORMERS OUTPERFORM RESNETS WITHOUT PRE-TRAINING OR STRONG DATA AUGMENTATIONS
+
+Xiangning Chen $^{1,2,*}$ , Cho-Jui Hsieh $^{2}$ , Boqing Gong $^{1}$
+
+$^{1}$ Google Research, $^{2}$ Department of Computer Science, UCLA
+
+{xiangningc, bgong}@google.com, chohsieh@cs.ucla.edu
+
+# ABSTRACT
+
+Vision Transformers (ViTs) and MLPs signal further efforts on replacing hand-wired features or inductive biases with general-purpose neural architectures. Existing works empower the models by massive data, such as large-scale pre-training and/or repeated strong data augmentations, and still report optimization-related problems (e.g., sensitivity to initialization and learning rates). Hence, this paper investigates ViTs and MLP-Mixers from the lens of loss geometry, intending to improve the models' data efficiency at training and generalization at inference. Visualization and Hessian reveal extremely sharp local minima of converged models. By promoting smoothness with a recently proposed sharpness-aware optimizer, we substantially improve the accuracy and robustness of ViTs and MLP-Mixers on various tasks spanning supervised, adversarial, contrastive, and transfer learning (e.g., $+5.3\%$ and $+11.0\%$ top-1 accuracy on ImageNet for ViT-B/16 and Mixer-B/16, respectively, with the simple Inception-style preprocessing). We show that the improved smoothness attributes to sparser active neurons in the first few layers. The resultant ViTs outperform ResNets of similar size and throughput when trained from scratch on ImageNet without large-scale pre-training or strong data augmentations. Model checkpoints are available at https://github.com/google-research/vision_transformer.
+
+# 1 INTRODUCTION
+
+Transformers (Vaswani et al., 2017) have become the de-facto model of choice in natural language processing (NLP) (Devlin et al., 2018; Radford et al., 2018). In computer vision, there has recently been a surge of interest in end-to-end Transformers (Dosovitskiy et al., 2021; Touvron et al., 2021b; Liu et al., 2021b; Fan et al., 2021; Arnab et al., 2021; Bertasius et al., 2021; Akbari et al., 2021) and MLPs (Tolstikhin et al., 2021; Touvron et al., 2021a; Liu et al., 2021a; Melas-Kyriazi, 2021), prompting the efforts to replace hand-wired features or inductive biases with general-purpose neural architectures powered by data-driven training. We envision these efforts may lead to a unified knowledge base that produces versatile representations for different data modalities, simplifying the inference and deployment of deep learning models in various application scenarios.
+
+Despite the appealing potential of moving toward general-purpose neural architectures, the lack of convolution-like inductive biases also challenges the training of vision Transformers (ViTs) and MLPs. When trained on ImageNet (Deng et al., 2009) with the conventional Inception-style data preprocessing (Szegedy et al., 2016), Transformers "yield modest accuracies of a few percentage points below ResNets of comparable size" (Dosovitskiy et al., 2021). To boost the performance, existing works resort to large-scale pre-training (Dosovitskiy et al., 2021; Arnab et al., 2021; Akbari et al., 2021) and repeated strong data augmentations (Touvron et al., 2021b), resulting in excessive demands of data, computing, and sophisticated tuning of many hyperparameters. For instance, Dosovitskiy et al. (Dosovitskiy et al., 2021) pre-train ViTs using 304M labeled images, and Touvron et al. (2021b) repeatedly stack four strong image augmentations.
+
+In this paper, we show ViTs can outperform ResNets (He et al., 2016) of even bigger sizes in both accuracy and various forms of robustness by using a principled optimizer, without the need for large-scale pre-training or strong data augmentations. MLP-Mixers (Tolstikhin et al., 2021) also become on par with ResNets.
+
+We first study the architectures fully trained on ImageNet from the lens of loss landscapes and draw the following findings. First, visualization and Hessian matrices of the loss landscapes reveal that Transformers and MLP-Mixers converge at extremely sharp local minima, whose largest principal curvatures are almost an order of magnitude bigger than ResNets'. Such effect accumulates when the gradients backpropagate from the last layer to the first, and the initial embedding layer suffers the largest eigenvalue of the corresponding sub-diagonal Hessian. Second, the networks all have very small training errors, and MLP-Mixers are more prone to overfitting than ViTs of more parameters (because of the difference in self-attention). Third, ViTs and MLP-Mixers have worse "trainabilities" than ResNets following the neural tangent kernel analyses (Xiao et al., 2020).
+
+Therefore, we need improved learning algorithms to prevent the convergence to a sharp local minimum when it comes to the convolution-free ViTs and MLP-Mixers. The first-order optimizers (e.g., SGD and Adam (Kingma & Ba, 2015)) only seek the model parameters that minimize the training error. They dismiss the higher-order information such as flatness that correlates with generalization (Keskar et al., 2017; Kleinberg et al., 2018; Jastrzebski et al., 2019; Smith & Le, 2018; Chaudhari et al., 2017).
+
+The above study and reasoning lead us to the recently proposed sharpness-aware minimizer (SAM) (Foret et al., 2021) that explicitly smooths the loss geometry during model training. SAM strives to find a solution whose entire neighborhood has low losses rather than focus on any singleton point. We show that the resultant models exhibit smoother loss landscapes, and their generalization capabilities improve tremendously across different tasks including supervised, adversarial, contrastive, and transfer learning (e.g., $+5.3\%$ and $+11.0\%$ top-1 accuracy on ImageNet for ViT-B/16 and Mixer-B/16, respectively, with the simple Inception-style preprocessing). The enhanced ViTs achieve better accuracy and robustness than ResNets of similar and bigger sizes when trained from scratch on ImageNet, without large-scale pre-training or strong data augmentations. Moreover, we demonstrate that SAM can even enable ViT to be effectively trained with (momentum) SGD, which usually lies far behind Adam when training Transformers (Zhang et al., 2020).
+
+By analyzing some intrinsic model properties, we observe that SAM increases the sparsity of active neurons (especially for the first few layers), which contribute to the reduced Hessian eigenvalues. The weight norms increase, implying the commonly used weight decay may not be an effective regularization alone. A side observation is that, unlike ResNets and MLP-Mixers, ViTs have extremely sparse active neurons (see Figure 2 (right)), revealing the potential for network pruning (Akbari et al., 2021). Another interesting finding is that the improved ViTs appear to have visually more interpretable attention maps. Finally, we draw similarities between SAM and strong augmentations (e.g., mixup) in that they both smooth the average loss geometry and encourage the models to behave linearly between training images.
+
+# 2 BACKGROUND AND RELATED WORK
+
+We briefly review ViTs, MLP-Mixers, and some related works in this section.
+
+Dosovitskiy et al. (2021) show that a pure Transformer architecture (Vaswani et al., 2017) can achieve state-of-the-art accuracy on image classification by pre-training it on large datasets such as ImageNet-21k (Deng et al., 2009) and JFT-300M (Sun et al., 2017). Their vision Transformer (ViT) is a stack of residual blocks, each containing a multi-head self-attention, layer normalization (Ba et al., 2016), and a MLP layer. ViT first embeds an input image $x \in \mathbb{R}^{H \times W \times C}$ into a sequence of features $z \in \mathbb{R}^{N \times D}$ by applying a linear projection over $N$ nonoverlapping image patches $x_{p} \in \mathbb{R}^{N \times (P^{2} \cdot C)}$ , where $D$ is the feature dimension, $P$ is the patch resolution, and $N = HW / P^{2}$ is the sequence length. The self-attention layers in ViT are global and do not possess the locality and translation equivariance of convolutions. ViT is compatible with the popular architectures in NLP (Devlin et al., 2018; Radford et al., 2018) and, similar to its NLP counterparts, requires pretraining over massive datasets (Dosovitskiy et al., 2021; Akbari et al., 2021; Arnab et al., 2021) or
+
+Table 1: Number of parameters, NTK condition number $\kappa$ ,Hessian dominate eigenvalue ${\lambda }_{max}$ , training error at convergence ${L}_{train}$ ,average flatness ${L}_{train}^{\mathcal{N}}$ ,accuracy on ImageNet,and accuracy/robustness on ImageNet-C. ViT and MLP-Mixer suffer divergent $\kappa$ and converge at sharp regions; SAM rescues that and leads to better generalization.
+
+ | ResNet-152 | ResNet-152-SAM | ViT-B/16 | ViT-B/16-SAM | Mixer-B/16 | Mixer-B/16-SAM |
| #Params | 60M | 87M | 59M |
| NTK κ† | 2801.6 | 4205.3 | 14468.0 |
| Hessian λmax | 179.8 | 42.0 | 738.8 | 20.9 | 1644.4 | 22.5 |
| Ltrain | 0.86 | 0.90 | 0.65 | 0.82 | 0.45 | 0.97 |
| LNtrain* | 2.39 | 2.16 | 6.66 | 0.96 | 7.78 | 1.01 |
| ImageNet (%) | 78.5 | 79.3 | 74.6 | 79.9 | 66.4 | 77.4 |
| ImageNet-C (%) | 50.0 | 52.2 | 46.6 | 56.5 | 33.8 | 48.8 |
+
+† As it is prohibitive to compute the exact NTK, we approximate the value by averaging over its subdiagonal blocks (see Appendix G for details). We average the results for 1,000 random noises when calculating $L_{train}^{\mathcal{N}}$ .
+
+
+(a) ResNet
+
+
+(b) ViT
+Figure 1: Cross-entropy loss landscapes of ResNet-152, ViT-B/16, and Mixer-B/16. ViT and MLP-Mixer converge to sharper regions than ResNet when trained on ImageNet with the basic Inception-style preprocessing. SAM, a sharpness-aware optimizer, significantly smooths the landscapes.
+
+
+(c) Mixer
+
+
+(d) ViT-SAM
+
+
+(e) Mixer-SAM
+
+strong data augmentations (Touvron et al., 2021b). Some works specialize the ViT architectures for visual data (Liu et al., 2021b; Yuan et al., 2021; Fan et al., 2021; Bertasius et al., 2021).
+
+More recent works find that the self-attention in ViT is not vital for performance, resulting in several architectures exclusively based on MLPs (Tolstikhin et al., 2021; Touvron et al., 2021a; Liu et al., 2021a; Melas-Kyriazi, 2021). Here we take MLP-Mixer (Tolstikhin et al., 2021) as an example. MLP-Mixer shares the same input layer as ViT; namely, it partitions an image into a sequence of nonoverlapping patches/tokens. It then alternates between token and channel MLPs, where the former allows feature fusion from different spatial locations.
+
+We focus on ViTs and MLP-Mixers in this paper. We denote by "S" and "B" the small and base model sizes, respectively, and by an integer the image patch resolution. For instance, ViT-B/16 is the base ViT model taking as input a sequence of $16 \times 16$ patches. Appendices contain more details.
+
+# 3 VITS AND MLP-MIXERS CONVERGE AT SHARP LOCAL MINIMA
+
+The current training recipe of ViTs, MLP-Mixers, and related convolution-free architectures relies heavily on massive pre-training (Dosovitskiy et al., 2021; Arnab et al., 2021; Akbari et al., 2021) or a bag of strong data augmentations (Touvron et al., 2021b; Toltstikhin et al., 2021; Cubuk et al., 2019; Zhang et al., 2018; Yun et al., 2019). It highly demands data and computing, and leads to many hyperparameters to tune. Existing works report that ViTs yield inferior accuracy to the ConvNets of similar size and throughput when trained from scratch on ImageNet without the combination of those advanced data augmentations, despite using various regularization techniques (e.g., large weight decay, Dropout (Srivastava et al., 2014), etc.). For instance, ViT-B/16 (Dosovitskiy et al., 2021) gives rise to $74.6\%$ top-1 accuracy on the ImageNet validation set (224 image resolution), compared with $78.5\%$ of ResNet-152 (He et al., 2016). Mixer-B/16 (Tolstikhin et al., 2021) performs even worse $(66.4\%)$ . There also exists a large gap between ViTs and ResNets in robustness tests (see Table 2 for details).
+
+Moreover, Chen et al. (2021c) find that the gradients can spike and cause a sudden accuracy dip when training ViTs, and Touvron et al. (2021b) report the training is sensitive to initialization and hyperparameters. These all point to optimization problems. In this paper, we investigate the loss
+
+
+Figure 2: Left and Middle: ImageNet training error and validation accuracy vs. iteration for ViTs and MLP-Mixers. Right: Percentage of active neurons for ResNet-152, ViT-B/16, and Mixer-B/16.
+
+
+
+
+
+landscapes of ViTs and MLP-Mixers to understand them from the optimization perspective, intending to reduce their dependency on the large-scale pre-training or strong data augmentations.
+
+ViTs and MLP-Mixers converge at extremely sharp local minima. It has been extensively studied that the convergence to a flat region whose curvature is small benefits the generalization of neural networks (Keskar et al., 2017; Kleinberg et al., 2018; Jastrzejbski et al., 2019; Chen & Hsieh, 2020; Smith & Le, 2018; Zela et al., 2020; Chaudhari et al., 2017). Following Li et al. (2018), we plot the loss landscapes at convergence when ResNets, ViTs, and MLP-Mixers are trained from scratch on ImageNet with the basic Inception-style preprocessing (Szegedy et al., 2016) (see Appendices for details). As shown in Figures 1(a) to 1(c), ViTs and MLP-Mixers converge at much sharper regions than ResNets. Besides, we calculate the training error under Gaussian perturbations on the model parameters $L_{train}^{\mathcal{N}} = \mathbb{E}_{\epsilon \sim \mathcal{N}}[L_{train}(w + \epsilon)]$ in Table 1, which reveals the average flatness. Although ViT-B/16 and Mixer-B/16 achieve lower training error $L_{train}$ than that of ResNet-152, their loss values after random weight perturbation become much higher. We further validate the results by computing the dominate Hessian eigenvalue $\lambda_{max}$ , which is a mathematical evaluation of the worst-case landscape curvature. The $\lambda_{max}$ values of ViT and MLP-Mixer are orders of magnitude larger than that of ResNet, and MLP-Mixer suffers the largest curvature among the three species (see Section 4.4 for a detailed analysis).
+
+Small training errors. This convergence at sharp regions coincides with the training dynamics shown in Figure 2 (left). Although Mixer-B/16 has fewer parameters than ViT-B/16 (59M vs. 87M), it has a smaller training error (also see $L_{train}$ in Table 1) but much worse test accuracy, implying that using the cross-token MLP to learn the interplay across image patches is more prone to overfitting than ViTs' self-attention mechanism whose behavior is restricted by a softmax. To validate this statement, we simply remove the softmax in ViT-B/16, such that the query and key matrices can freely interact with each other. Although having lower $L_{train}$ (0.56 vs. 0.65), the obtained ViT-B/16-Free performs much worse than the original ViT-B/16 (70.5% vs. 74.6%). Its $L_{train}^{\mathcal{N}}$ and $\lambda_{max}$ are 7.01 and 1236.2, revealing that ViT-B/16-Free converges to a sharper region than ViT-B/16 ( $L_{train}^{\mathcal{N}}$ is 6.66 and $\lambda_{max}$ is 738.8) both on average and in the worst-case direction. Such a difference probably explains why it is easier for MLP-Mixers to get stuck in sharp local minima.
+
+ViTs and MLP-Mixers have worse trainability. Furthermore, we discover that ViTs and MLP-Mixers suffer poor trainabilities, defined as the effectiveness of a network to be optimized by gradient descent (Xiao et al., 2020; Burkholz & Dubatovka, 2019; Shin & Karniadakis, 2020). Xiao et al. (2020) show that the trainability of a neural network can be characterized by the condition number of the associated neural tangent kernel (NTK), $\Theta(x,x') = J(x)J(x')^T$ , where $J$ is the Jacobian matrix. Denoting by $\lambda_1 \geq \dots \geq \lambda_m$ the eigenvalues of NTK $\Theta_{train}$ , the smallest eigenvalue $\lambda_m$ converges exponentially at a rate given by the condition number $\kappa = \lambda_1 / \lambda_m$ . If $\kappa$ diverges then the network will become untrainable (Xiao et al., 2020; Chen et al., 2021a). As shown in Table 1, $\kappa$ is pretty stable for ResNets, echoing previous results that ResNets enjoy superior trainability regardless of the depth (Yang & Schoenholz, 2017; Li et al., 2018). However, we observe that the condition number diverges when it comes to ViT and MLP-Mixer, confirming that the training of ViTs desires extra care (Chen et al., 2021c; Touvron et al., 2021b).
+
+# 4 A PRINCIPLED OPTIMIZER FOR CONVOLUTION-FREE ARCHITECTURES
+
+The commonly used first-order optimizers (e.g., SGD (Nesterov, 1983), Adam (Kingma & Ba, 2015)) only seek to minimize the training loss $L_{train}(w)$ . They usually dismiss the higher-order
+
+information such as curvature that correlates with the generalization (Keskar et al., 2017; Chaudhari et al., 2017; Dziugaite & Roy, 2017). However, the objective $L_{train}$ for deep neural networks are highly non-convex, making it easy to reach near-zero training error but high generalization error $L_{test}$ during evaluation, let alone their robustness when the test sets have different distributions (Hendrycks & Dietterich, 2019; Hendrycks et al., 2020). ViTs and MLPs amplify such drawbacks of first-order optimizers due to the lack of inductive bias for visual data, resulting in excessively sharp loss landscapes and poor generalization, as shown in the previous section. We hypothesize that smoothing the loss landscapes at convergence can significantly improve the generalization ability of those convolution-free architectures, leading us to the recently proposed sharpness-aware minimizer (SAM) (Foret et al., 2021) that explicitly avoids sharp minima.
+
+# 4.1 SAM: OVERVIEW
+
+Intuitively, SAM (Foret et al., 2021) seeks to find the parameter $w$ whose entire neighbours have low training loss $L_{train}$ by formulating a minimax objective:
+
+$$
+\min _ {w} \max _ {\| \epsilon \| _ {2} \leq \rho} L _ {\text {t r a i n}} (w + \epsilon), \tag {1}
+$$
+
+where $\rho$ is the size of the neighbourhood ball. Without loss of generality, here we use $l_{2}$ norm for its strong empirical results (Foret et al., 2021) and omit the regularization term for simplicity. Since the exact solution of the inner maximization $\epsilon^{\star} = \arg \max_{\| \epsilon \| _2\leq \rho}L_{train}(w + \epsilon)$ is hard to obtain, they employ an efficient first-order approximation:
+
+$$
+\hat {\epsilon} (w) = \underset {\| \epsilon \| _ {2} \leq \rho} {\arg \max } L _ {t r a i n} (w) + \epsilon^ {T} \nabla_ {w} L _ {t r a i n} (w) = \rho \nabla_ {w} L _ {t r a i n} (w) / \| \nabla_ {w} L _ {t r a i n} (w) \| _ {2}. \tag {2}
+$$
+
+Under the $l_{2}$ norm, $\hat{\epsilon} (w)$ is simply a scaled gradient of the current weight $w$ . After computing $\hat{\epsilon}$ , SAM updates $w$ based on the sharpness-aware gradient $\nabla_wL_{train}(w)|_{w + \hat{\epsilon} (w)}$ .
+
+# 4.2 SHARPNESS-AWARE OPTIMIZATION IMPROVES VITs AND MLP-MIXERS
+
+We train ViTs and MLP-Mixers with no large-scale pre-training or strong data augmentations. We directly apply SAM to the original ImageNet training pipeline of ViTs (Dosovitskiy et al., 2021) without changing any hyperparameters. The pipeline employs the basic Inception-style preprocessing (Szegedy et al., 2016). The original training setup of MLP-Mixers (Tolstikhin et al., 2021) includes a combination of strong data augmentations, and we replace it with the same Inception-style preprocessing for a fair comparison. Note that we perform grid search for the learning rate, weight decay, Dropout before applying SAM. Please see Appendices for training details.
+
+Smother regions around the local minima. Thanks to SAM, both ViTs and MLP-Mixers converge at much smoother regions, as shown in Figures 1(d) and 1(e). Moreover, both the average and the worst-case curvature, i.e., $L_{train}^{\mathcal{N}}$ and $\lambda_{max}$ , decrease dramatically (see Table 1).
+
+Higher accuracy. What comes along is tremendously improved generalization performance. On ImageNet, SAM boosts the top-1 accuracy of ViT-B/16 from $74.6\%$ to $79.9\%$ , and Mixer-B/16 from $66.4\%$ to $77.4\%$ . For comparison, the improvement on a similarly sized ResNet-152 is $0.8\%$ . Empirically, the degree of improvement negatively correlates with the constraints of inductive biases built into the architecture. ResNets with inherent translation equivalence and locality benefit less from landscape smoothing than the attention-based ViTs. MLP-Mixers gain the most from the smoothed loss geometry. In Table 3, we further train two hybrid models (Dosovitskiy et al., 2021) to validate this observation, where the Transformer takes the feature map extracted from a ResNet-50 as the input sequence. The improvement brought by SAM decreases after we introduce the convolution to ViT, for instance, $+2.7\%$ for R50-B/16 compared to $+5.3\%$ for ViT-B/16. Moreover, SAM brings larger improvements to the models of larger capacity (e.g., $+4.1\%$ for Mixer-S/16 vs. $+11.0\%$ for Mixer-B/16) and longer patch sequence (e.g., $+2.1\%$ for ViT-S/32 vs. $+5.3\%$ for ViT-S/8). Please see Table 2 for more results.
+
+SAM can be easily applied to common base optimizers. Besides Adam, we also apply SAM on top of the (momentum) SGD that usually performs much worse than Adam when training Transformers (Zhang et al., 2020). As expected, we find that under the same training budget (300 epochs), the ViT-B/16 trained with SGD only achieves $71.5\%$ accuracy on ImageNet, whereas Adam achieves
+
+Table 2: Performance of ResNets, ViTs, and MLP-Mixers trained from scratch on ImageNet with SAM (improvement over the vanilla model is shown in the parentheses). We use the Inception-style preprocessing (with resolution 224) rather than a combination of strong data augmentations.
+
+| Model | #params | Throughput (img/sec/core) | ImageNet | ReaL | V2 | ImageNet-R | ImageNet-C |
| ResNet |
| ResNet-50-SAM | 25M | 2161 | 76.7 (+0.7) | 83.1 (+0.7) | 64.6 (+1.0) | 23.3 (+1.1) | 46.5 (+1.9) |
| ResNet-101-SAM | 44M | 1334 | 78.6 (+0.8) | 84.8 (+0.9) | 66.7 (+1.4) | 25.9 (+1.5) | 51.3 (+2.8) |
| ResNet-152-SAM | 60M | 935 | 79.3 (+0.8) | 84.9 (+0.7) | 67.3 (+1.0) | 25.7 (+0.4) | 52.2 (+2.2) |
| ResNet-50x2-SAM | 98M | 891 | 79.6 (+1.5) | 85.3 (+1.6) | 67.5 (+1.7) | 26.0 (+2.9) | 50.7 (+3.9) |
| ResNet-101x2-SAM | 173M | 519 | 80.9 (+2.4) | 86.4 (+2.4) | 69.1 (+2.8) | 27.8 (+3.2) | 54.0 (+4.7) |
| ResNet-152x2-SAM | 236M | 356 | 81.1 (+1.8) | 86.4 (+1.9) | 69.6 (+2.3) | 28.1 (+2.8) | 55.0 (+4.2) |
| Vision Transformer |
| ViT-S/32-SAM | 23M | 6888 | 70.5 (+2.1) | 77.5 (+2.3) | 56.9 (+2.6) | 21.4 (+2.4) | 46.2 (+2.9) |
| ViT-S/16-SAM | 22M | 2043 | 78.1 (+3.7) | 84.1 (+3.7) | 65.6 (+3.9) | 24.7 (+4.7) | 53.0 (+6.5) |
| ViT-S/14-SAM | 22M | 1234 | 78.8 (+4.0) | 84.8 (+4.5) | 67.2 (+5.2) | 24.4 (+4.7) | 54.2 (+7.0) |
| ViT-S/8-SAM | 22M | 333 | 81.3 (+5.3) | 86.7 (+5.5) | 70.4 (+6.2) | 25.3 (+6.1) | 55.6 (+8.5) |
| ViT-B/32-SAM | 88M | 2805 | 73.6 (+4.1) | 80.3 (+5.1) | 60.0 (+4.7) | 24.0 (+4.1) | 50.7 (+6.7) |
| ViT-B/16-SAM | 87M | 863 | 79.9 (+5.3) | 85.2 (+5.4) | 67.5 (+6.2) | 26.4 (+6.3) | 56.5 (+9.9) |
| MLP-Mixer |
| Mixer-S/32-SAM | 19M | 11401 | 66.7 (+2.8) | 73.8 (+3.5) | 52.4 (+2.9) | 18.6 (+2.7) | 39.3 (+4.1) |
| Mixer-S/16-SAM | 18M | 4005 | 72.9 (+4.1) | 79.8 (+4.7) | 58.9 (+4.1) | 20.1 (+4.2) | 42.0 (+6.4) |
| Mixer-S/8-SAM | 20M | 1498 | 75.9 (+5.7) | 82.5 (+6.3) | 62.3 (+6.2) | 20.5 (+5.1) | 42.4 (+7.8) |
| Mixer-B/32-SAM | 60M | 4209 | 72.4 (+9.9) | 79.0 (+10.9) | 58.0 (+10.4) | 22.8 (+8.2) | 46.2 (12.4) |
| Mixer-B/16-SAM | 59M | 1390 | 77.4 (+11.0) | 83.5 (+11.4) | 63.9 (+13.1) | 24.7 (+10.2) | 48.8 (+15.0) |
| Mixer-B/8-SAM | 64M | 466 | 79.0 (+10.4) | 84.4 (+10.1) | 65.5 (+11.6) | 23.5 (+9.2) | 48.9 (+16.9) |
+
+$74.6\%$ . Surprisingly, $\mathrm{SGD} + \mathrm{SAM}$ can push the result to $79.1\%$ , which is a huge $+7.6\%$ absolute improvement. Although Adam + SAM is still higher $(79.9\%)$ , their gap largely shrinks.
+
+Better robustness. We also evaluate the models' robustness using ImageNet-R (Hendrycks et al., 2020) and ImageNet-C (Hendrycks & Dietterich, 2019) and find even bigger impacts of the smoothed loss landscapes. On ImageNet-C, which corrupts images by noise, bad weather, blur, etc., we report the average accuracy against 19 corruptions across five levels. As shown in Tables 1 and 2, the accuracies of ViT-B/16 and Mixer-B/16 increase by $9.9\%$ and $15.0\%$ (which are $21.2\%$ and $44.4\%$ relative improvements), after SAM smoothes their converged local regions. In comparison, SAM improves the accuracy of ResNet-152 by $2.2\%$ ( $4.4\%$ relative improvement). We can see that SAM enhances the robustness even more than the relative clean accuracy improvements ( $7.1\%$ , $16.6\%$ , and $1.0\%$ for ViT-B/16, Mixer-B/16, and ResNet-152, respectively).
+
+# 4.3 VITs OUTPERFORM RESNETS WITHOUT PRE-TRAINING OR STRONG AUGMENTATIONS
+
+The performance of an architecture is often conflated with the training strategies (Bello et al., 2021), where data augmentations play a key role (Cubuk et al., 2019; 2020; Zhang et al., 2018; Xie et al., 2020; Chen et al., 2021b). However, the design of augmentations requires substantial domain expertise and may not translate between images and videos, for instance. Thanks to the principled sharpness-aware opti
+
+Table 3: Accuracy and robustness of two hybrid architectures.
+
+| Model | #params | ImageNet (%) | ImageNet-C (%) |
| R50-S/16 | 34M | 79.8 | 53.4 |
| R50-S/16-SAM | 81.0 (+1.2) | 57.2 (+3.8) |
| R50-B/16 | 99M | 79.7 | 54.4 |
| R50-B/16-SAM | 82.4 (+2.7) | 61.0 (+6.6) |
+
+mizer, we can remove the advanced augmentations and focus on the architectures themselves.
+
+When trained from scratch on ImageNet with SAM, ViTs outperform ResNets of similar and greater sizes (also comparable throughput at inference) regarding both clean accuracy (on ImageNet (Deng et al., 2009), ImageNet-ReaL (Beyer et al., 2020), and ImageNet V2 (Recht et al., 2019)) and robustness (on ImageNet-R (Hendrycks et al., 2020) and ImageNet-C (Hendrycks & Dietterich, 2019)). ViT-B/16 achieves $79.9\%$ , $26.4\%$ , and $56.6\%$ top-1 accuracy on ImageNet, ImageNet-R, and ImageNet-C, while the counterpart numbers for ResNet-152 are $79.3\%$ , $25.7\%$ , and $52.2\%$ , respectively (see Table 2). The gaps between ViTs and ResNets are even wider for small architectures. ViT-S/16 outperforms a similarly sized ResNet-50 by $1.4\%$ on ImageNet, and $6.5\%$ on ImageNet-C. SAM also significantly improves MLP-Mixers' results.
+
+Table 4: Dominant eigenvalue $\lambda_{max}$ of the sub-diagonal Hessians for different network components, and norm of the model parameter $w$ and the post-activation $a_k$ of block $k$ . Each ViT block consists of a MSA and a MLP, and MLP-Mixer alternates between a token MLP and a channel MLP. Shallower layers have larger $\lambda_{max}$ . SAM smoothes every component.
+
+| Model | λmax of diagonal blocks of Hessian | ||w||2 | ||a1||2 | ||a6||2 | ||a12||2 |
| Embedding | MSA/Token MLP | MLP/Channel MLP | Block1 | Block6 | Block12 | Whole |
| ViT-B/16 | 300.4 | 179.8 | 281.4 | 44.4 | 32.4 | 26.9 | 738.8 | 269.3 | 104.9 | 104.3 | 138.1 |
| ViT-B/16-SAM | 3.8 | 8.5 | 9.6 | 1.7 | 1.7 | 1.5 | 20.9 | 353.8 | 117.0 | 120.3 | 97.2 |
| Mixer-B/16 | 1042.3 | 95.8 | 417.9 | 239.3 | 41.2 | 5.1 | 1644.4 | 197.6 | 96.7 | 135.1 | 74.9 |
| Mixer-B/16-SAM | 18.2 | 1.4 | 9.5 | 4.0 | 1.1 | 0.3 | 22.5 | 389.9 | 110.9 | 176.0 | 216.1 |
+
+# 4.4 INTRINSIC CHANGES AFTER SAM
+
+We take a deeper look into the models to understand how they intrinsically change to reduce the Hessian' eigenvalue $\lambda_{max}$ and what the changes imply in addition to the enhanced generalization.
+
+Smother loss landscapes for every network component. In Table 4, we break down the Hessian of the whole architecture into small diagonal blocks of Hessians concerning each set of parameters, attempting to analyze what specific components cause the blowing up of $\lambda_{max}$ in the models trained without SAM. We observe that shallower layers have larger Hessian eigenvalues $\lambda_{max}$ , and the first linear embedding layer incurs the sharpest geometry. This agrees with the finding in (Chen et al., 2021c) that spiking gradients happen early in the embedding layer. Additionally, the multi-head self-attention (MSA) in ViTs and the Token MLPs in MLP-Mixers, both of which mix information across spatial locations, have comparably lower $\lambda_{max}$ than the other network components. SAM consistently reduces the $\lambda_{max}$ of all network blocks.
+
+We can gain insights into the above findings by the recursive formulation of Hessian matrices for MLPs (Botev et al., 2017). Let $h_k$ and $a_k$ be the pre-activation and post-activation values for layer $k$ , respectively. They satisfy $h_k = W_k a_{k-1}$ and $a_k = f_k(h_k)$ , where $W_k$ is the weight matrix and $f_k$ is the activation function (GELU (Hendrycks & Gimpel, 2020) in MLP-Mixers). Here we omit the bias term for simplicity. The diagonal block of Hessian matrix $H_k$ with respect to $W_k$ can be recursively calculated as:
+
+$$
+H _ {k} = \left(a _ {k - 1} a _ {k - 1} ^ {T}\right) \otimes \mathcal {H} _ {k}, \quad \mathcal {H} _ {k} = B _ {k} W _ {k + 1} ^ {T} \mathcal {H} _ {k + 1} W _ {k + 1} B _ {k} + D _ {k}, \tag {3}
+$$
+
+$$
+B _ {k} = \operatorname {d i a g} \left(f _ {k} ^ {\prime} \left(h _ {k}\right)\right), \quad D _ {k} = \operatorname {d i a g} \left(f _ {k} ^ {\prime \prime} \left(h _ {k}\right) \frac {\partial L}{\partial a _ {k}}\right), \tag {4}
+$$
+
+where $\otimes$ is the Kronecker product, $\mathcal{H}_k$ is the pre-activation Hessian for layer $k$ , and $L$ is the objective function. Therefore, the Hessian norm accumulates as the recursive formulation backpropagates to shallow layers, explaining why the first block has much larger $\lambda_{max}$ than the last block in Table 4.
+
+Greater weight norms. After applying SAM, we find that in most cases, the norm of the post-activation value $a_{k - 1}$ and the weight $W_{k + 1}$ become even bigger (see Table 4), indicating that the commonly used weight decay may not effectively regularize ViTs and MLP-Mixers (see Appendix J for further verification when we vary the weight decay strength).
+
+Sparcer active neurons in MLP-Mixers. Given the recursive formulation Equation (3), we identify another intrinsic measure of MLP-Mixers that contribute to the Hessian: the number of activated neurons. Indeed, $B_{k}$ is determined by the activated neurons whose values are greater than zero, since the first-order derivative of GELU becomes much smaller when the input is negative. As a result, the number of active GELU neurons is directly connected to the Hessian norm. Figure 2 (right) shows the proportion of activated neurons for each block, counted using $10\%$ of the ImageNet training set. We can see that SAM greatly reduces the proportion of activated neurons for the first few layers of the Mixer-B/16, pushing them to much sparser states. This result also suggests the potential redundancy of image patches.
+
+ViTs' active neurons are highly sparse. Although Equations (3) and (4) only involve MLPs, we still observe a decrease of activated neurons in the first layer of ViTs (but not as significant as in MLP-Mixers). More interestingly, we find that the proportion of active neurons in ViT is much smaller than another two architectures — given an input image, less than $10\%$ neurons have values greater than zero for most layers (see Figure 2 (right)). In other words, ViTs offer a huge potential for
+
+Table 5: Data augmentations, SAM, and their combination applied to different model architectures trained on ImageNet and its subsets from scratch.
+
+| Dataset | ResNet-152 | ViT-B/16 | Mixer-B/16 |
| Vanilla | SAM | AUG | SAM + AUG | Vanilla | SAM | AUG | SAM + AUG | Vanilla | SAM | AUG | SAM + AUG |
| ImageNet | 78.5 | 79.3 | 78.8 | 78.9 | 74.6 | 79.9 | 79.6 | 81.5 | 66.4 | 77.4 | 76.5 | 78.1 |
| ilk (1/2) | 74.2 | 75.6 | 75.1 | 75.5 | 64.9 | 75.4 | 73.1 | 75.8 | 53.9 | 71.0 | 70.4 | 73.1 |
| ilk (1/4) | 68.0 | 70.3 | 70.2 | 70.6 | 52.4 | 66.8 | 63.2 | 65.6 | 37.2 | 62.8 | 61.0 | 65.8 |
| ilk (1/10) | 54.6 | 57.1 | 59.2 | 59.5 | 32.8 | 46.1 | 38.5 | 45.7 | 21.0 | 43.5 | 43.0 | 51.0 |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Figure 3: Raw images (Left) and attention maps of ViT-S/16 with (Right) and without (Middle) sharpness-aware optimization.
+
+
+
+
+
+network pruning. This sparsity may also explain why one Transformer can handle multi-modality signals (vision, text, and audio) (Akbari et al., 2021).
+
+Visually improved attention maps in ViTs. We visualize ViT-S/16's attention map of the classification token averaged over the last multi-head attentions in Figure 3 following Caron et al. (2021). Interestingly, the ViT model optimized with SAM appears to possess visually improved attention map compared with the one trained via the vanilla AdamW optimizer.
+
+# 4.5 SAM VS. STRONG AUGMENTATIONS
+
+Previous sections show that SAM can improve the generalization (and robustness) of ViTs and MLP-Mixers. Meanwhile, another paradigm to train these models on ImageNet from scratch is to stack multiple strong augmentations (Touvron et al., 2021b;a; Tolstikhin et al., 2021). Hence, it is interesting to study the differences and similarities between the models trained by SAM and by using strong data augmentations. For the augmentation experiments, we follow Tolstikhin et al. (2021)'s pipeline that includes mixup (Zhang et al., 2018) and RandAugment (Cubuk et al., 2020).
+
+Generalization. Table 5 shows the results of strong data augmentation, SAM, and their combination on ImageNet. Each row corresponds to a training set of a different fraction of ImageNet-1k. SAM benefits ViT-B/16 and Mixer-B/16 more than the strong data augmentations, especially when the training set is small. For instance, when the training set contains only 1/10 of ImageNet training images, ViT-B/16-SAM outperforms ViT-B/16-AUG by $7.6\%$ . Apart from the improved validation accuracy, we also observe that both SAM and strong augmentations increase the training error (see Figure 2 (Middle) and Table 6), indicating their regularization effects. However, they have distinct training dynamics as the loss curve for ViT-B/16-AUG is much nosier than ViT-B/16-SAM.
+
+Sharpness at convergence. Another intriguing question is as follows. Can augmentations also smooth the loss geometry similarly to SAM? To answer it, we also plot the landscape of ViT-B/16-AUG (see Figure 5 in the Appendix) and compute its Hessian $\lambda_{max}$ together with the average flatness $L_{train}^{\mathcal{N}}$ in Table 6. Surprisingly, strong augmentations even enlarge the $\lambda_{max}$ .
+
+Table 6: Comparison between ViT-B/16-SAM and ViT-B/16-AUG. $R$ denotes the missing rate under linear interpolation.
+
+| Model | λmax | Ltrain | LNtrain | R(↓) |
| ViT-B/16 | 738.8 | 0.65 | 6.66 | 57.9% |
| ViT-B/16-SAM | 20.9 | 0.82 | 0.96 | 39.6% |
| ViT-B/16-AUG | 1659.3 | 0.85 | 1.23 | 21.4% |
+
+However, like SAM, augmentations make ViT-B/16-AUG smoother and achieve a significantly smaller training error under random Gaussian perturbations than ViT-B/16. These results show that both SAM and augmentations make the loss landscape flat on average. The difference is that SAM enforces the smoothness by reducing the largest curvature via a minimax formulation to optimize the worst-case scenario, while augmentations ignore the worse-case curvature and instead smooth the landscape over the directions induced by the augmentations.
+
+Interestingly, besides the similarity in smoothing the loss curvature on average, we also discover that SAM-trained models possess "linearity" resembling the property manually injected by the mixup augmentation. Following Zhang et al. (2018), we compute the prediction error in-between training data in Table 6, where a prediction $y$ is counted as a miss if it does not belong to $\{y_i, y_j\}$ evaluated at $x = 0.5x_i + 0.5x_j$ . We observe that SAM greatly reduces the missing rate $(R)$ compared with the vanilla baseline, showing a similar effect to mixup that explicitly encourages such linearity.
+
+# 5 ABLATION STUDIES
+
+In this section, we provide a more comprehensive study about SAM's effect on various vision models and under different training setups. We refer to Appendices B to D for the adversarial, contrastive and transfer learning results.
+
+# 5.1 WHEN SCALING THE TRAINING SET SIZE
+
+Previous studies scale up training data to show massive pre-training trumps inductive biases (Dosovitskiy et al., 2021; Tolstikhin et al., 2021). Here we show SAM further enables ViTs and MLP-Mixers to handle small-scale training data well. We randomly sample 1/4 and 1/2 images from each ImageNet class to compose two smaller-scale training sets, i.e., i1k (1/4) and i1k (1/2) with 320,291 and 640,583 images, respectively. We also use ImageNet-21k to pre-train the models with SAM, followed by fine-tuning on ImageNet-1k without SAM. The ImageNet validation set remains intact. SAM can still bring improvement when pre-trained on ImageNet-21k (+0.3%, +1.4%, and 2.3% for ResNet-152, ViT-B/16, and Mixer-B/16, respectively).
+
+As expected, fewer training examples amplify the drawback of ViTs and MLP-Mixers' lack of the convolutional inductive bias — their accuracies decline much faster than ResNets' (see Figure 4 in the Appendix and the corresponding numbers in Table 5). However, SAM can drastically rescue ViTs and MLP-Mixers' performance decrease on smaller training sets. Figure 4 (right) shows that the improvement brought by SAM over vanilla SGD training is proportional to the number of training images. When trained on 1k (1/4), it boosts ViT-B/16 and Mixer-B/16 by $14.4\%$ and $25.6\%$ , escalating their results to $66.8\%$ and $62.8\%$ , respectively. It also tells that ViT-B/16-SAM matches the performance of ResNet-152-SAM even with only 1/2 ImageNet training data.
+
+# 6 CONCLUSIONS AND LIMITATIONS
+
+This paper presents a detailed analysis of the convolution-free ViTs and MLP-Mixers from the lens of the loss landscape geometry, intending to reduce the models' dependency on massive pre-training and/or strong data augmentations. We arrive at the sharpness-aware minimizer (SAM) after observing sharp local minima of the converged models. By explicitly regularizing the loss geometry through SAM, the models enjoy much flatter loss landscapes and improved generalization regarding accuracy and robustness. The resultant ViT models outperform ResNets of comparable size and throughput when learned with no pre-training or strong augmentations. Further investigation reveals that the smoothed loss landscapes attribute to much sparser activated neurons in the first few layers. Last but not least, we discover that SAM and strong augmentations share certain similarities to enhance the generalization. They both smooth the average loss curvature and encourage linearity.
+
+Despite achieving better generalization, training ViTs with SAM has the following limitations which could lead to potential future work. First, SAM incurs another round of forward and backward propagations to update $\epsilon$ , which will lead to around $2x$ computational cost per update. Second, we notice that the effect of SAM diminishes as the training dataset becomes larger, so it is vital to develop learning algorithms that can improve/accelerate the large-scale pre-training process.
+
+# ETHICS STATEMENT
+
+We are not aware of any immediate ethical issues in our work. We hope this paper can provide new insights into the convolution-free neural architectures and their interplay with optimizers, hence benefiting future developments of advanced neural architectures that are efficient in data and computation. Possible negative societal impacts mainly hinge on the applications of convolution-free architectures, whose societal effects may translate to this work.
+
+# ACKNOWLEDGEMENT
+
+This work is partially supported by NSF under IIS-1901527, IIS-2008173, IIS-2048280 and by Army Research Laboratory under agreement number W911NF-20-2-0158.
+
+# REPRODUCIBILITY STATEMENT
+
+We provide comprehensive experimental details and references to existing works and codebases to ensure reproducibility. The specification of all the architectures used in this paper is available in Appendix A. The instructions for plotting the landscape and the attention map are detailed in Appendix E. We also present our approach to approximating Hessian's dominant eigenvalue $\lambda_{max}$ and the NTK condition number in Appendices F and G, respectively. Finally, Appendix H describes all the necessary training configurations, data augmentations, and SAM hyperparameters to ensure the reproducibility of our results.
+
+# REFERENCES
+
+Hassan Akbari, Liangzhe Yuan, Rui Qian, Wei-Hong Chuang, Shih-Fu Chang, Yin Cui, and Boqing Gong. Vatt: Transformers for multimodal self-supervised learning from raw video, audio and text. arXiv preprint arXiv:2104.11178, 2021.
+Anurag Arnab, Mostafa Dehghani, Georg Heigold, Chen Sun, Mario Lucic, and Cordelia Schmid. Vivit: A video vision transformer. arXiv preprint arXiv:2103.15691, 2021.
+Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
+Irwan Bello, William Fedus, Xianzhi Du, Ekin D. Cubuk, Aravind Srinivas, Tsung-Yi Lin, Jonathon Shlens, and Barret Zoph. Revisiting resnets: Improved training and scaling strategies, 2021.
+Gedas Bertasius, Heng Wang, and Lorenzo Torresani. Is space-time attention all you need for video understanding? arXiv preprint arXiv:2102.05095, 2021.
+Lucas Beyer, Olivier J Hénaff, Alexander Kolesnikov, Xiaohua Zhai, and Aïron van den Oord. Are we done with imagenet? arXiv preprint arXiv:2006.07159, 2020.
+Aleksandar Botev, Hippolyt Ritter, and David Barber. Practical Gauss-Newton optimisation for deep learning. In Doina Precup and Yee Whye Teh (eds.), Proceedings of the 34th International Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pp. 557-565. PMLR, 06-11 Aug 2017. URL http://proceedings.mlr.press/v70/botev17a.html.
+Rebekka Burkholz and Alina Dubatovka. Initialization of relus for dynamical isometry. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. URL https://proceedings.neurips.cc/paper/2019/file/d9731321ef4e063ebbee79298fa36f56-Paper.pdf.
+Mathilde Caron, Hugo Touvron, Ishan Misra, Herve Jégou, Julien Mairal, Piotr Bojanowski, and Armand Joulin. Emerging properties in self-supervised vision transformers, 2021.
+
+Pratik Chaudhari, Anna Choromanska, Stefano Soatto, Yann LeCun, Carlo Baldassi, Christian Borgs, Jennifer Chayes, Levent Sagun, and Riccardo Zecchina. Entropy-sgd: Biasing gradient descent into wide valleys. In International Conference on Learning Representations, 2017.
+Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In Hal Daumé III and Aarti Singh (eds.), Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pp. 1597-1607. PMLR, 13-18 Jul 2020. URL http://proceedings.mlr.press/v119/chen20j.html.
+Wuyang Chen, Xinyu Gong, and Zhangyang Wang. Neural architecture search onImagenet in four GPU hours: A theoretically inspired perspective. In International Conference on Learning Representations, 2021a. URL https://openreview.net/forum?id=Cnon5ezMHTu.
+Xiangning Chen and Cho-Jui Hsieh. Stabilizing differentiable architecture search via perturbation-based regularization. In Hal Daumé III and Aarti Singh (eds.), Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pp. 1554-1565. PMLR, 13-18 Jul 2020. URL http://proceedings.mlr.press/v119/chen20f.html.
+Xiangning Chen, Cihang Xie, Mingxing Tan, Li Zhang, Cho-Jui Hsieh, and Boqing Gong. Robust and accurate object detection via adversarial learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 16622-16631, June 2021b.
+Xinlei Chen, Saining Xie, and Kaiming He. An empirical study of training self-supervised vision transformers, 2021c.
+Ekin D. Cubuk, Barret Zoph, Dandelion Mane, Vijay Vasudevan, and Quoc V. Le. Autoaugment: Learning augmentation strategies from data. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2019.
+Ekin D. Cubuk, Barret Zoph, Jonathon Shlens, and Quoc V. Le. Randaugment: Practical automated data augmentation with a reduced search space. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), pp. 3008-3017, 2020. doi: 10.1109/CVPRW50498.2020.00359.
+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, pp. 248-255, 2009. doi: 10.1109/CVPR.2009.5206848.
+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.
+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 International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=YicbFdNTTy.
+Gintare Karolina Dziugaite and Daniel M. Roy. Computing nonvacuous generalization bounds for deep (stochastic) neural networks with many more parameters than training data. In Gal Elidan, Kristian Kersting, and Alexander T. Ihler (eds.), Proceedings of the Thirty-Third Conference on Uncertainty in Artificial Intelligence, UAI 2017, Sydney, Australia, August 11-15, 2017. AUAI Press, 2017. URL http://auai.org/uai2017/proceedings/papers/173.pdf.
+Haoqi Fan, Bo Xiong, Karttikeya Mangalam, Yanghao Li, Zhicheng Yan, Jitendra Malik, and Christoph Feichtenhofer. Multiscale vision transformers. arXiv preprint arXiv:2104.11227, 2021.
+Pierre Foret, Ariel Kleiner, Hossein Mobahi, and Behnam Neyshabur. Sharpness-aware minimization for efficiently improving generalization. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=6Tm1mposlrM.
+
+Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 770-778, 2016. doi: 10.1109/CVPR.2016.90.
+Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020.
+Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id=HJz6tiCqYm.
+Dan Hendrycks and Kevin Gimpel. Gaussian error linear units (gelus), 2020.
+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, 2020.
+Stanisław Jastrzebski, Zachary Kenton, Nicolas Ballas, Asja Fischer, Yoshua Bengio, and Amost Storkey. On the relation between the sharpest directions of DNN loss and the SGD step length. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id=SkgEaj05t7.
+Nitish Shirish Keskar, Dheevatsa Mudigere, Jorge Nocedal, Mikhail Smelyanskiy, and Ping Tak Peter Tang. On large-batch training for deep learning: Generalization gap and sharp minima. In International Conference on Learning Representations, 2017. URL https://openreview.net/forum?id=H1oyRlYgg.
+Prannay Khosla, Piotr Teterwak, Chen Wang, Aaron Sarna, Yonglong Tian, Phillip Isola, Aaron Maschinot, Ce Liu, and Dilip Krishnan. Supervised contrastive learning. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 18661-18673. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper/2020/file/d89a66c7c80a29b1bdbcab0f2a1a94af8-Paper.pdf.
+Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2015.
+Bobby Kleinberg, Yanzhi Li, and Yang Yuan. An alternative view: When does SGD escape local minima? In Jennifer Dy and Andreas Krause (eds.), Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 2698-2707. PMLR, 10-15 Jul 2018. URL http://proceedings.mlr.press/v80/kleinberg18a.html.
+Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, and Neil Houlsby. Big transfer (bit): General visual representation learning. In Andrea Vedaldi, Horst Bischof, Thomas Brox, and Jan-Michael Frahm (eds.), Computer Vision - ECCV 2020, pp. 491-507, Cham, 2020. Springer International Publishing. ISBN 978-3-030-58558-7.
+Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, 2009.
+Hao Li, Zheng Xu, Gavin Taylor, Christoph Studer, and Tom Goldstein. Visualizing the loss landscape of neural nets. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 31. Curran Associates, Inc., 2018. URL https://proceedings.neurips.cc/paper/2018/file/a41b3bb3e6b050b6c9067c67f663b915-Paper.pdf.
+Hanxiao Liu, Zihang Dai, David R So, and Quoc V Le. Pay attention to mlps. arXiv preprint arXiv:2105.08050, 2021a.
+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, 2021b.
+
+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, 2018. URL https://openreview.net/forum?id=rJzIBfZAb.
+Luke Melas-Kyriazi. Do you even need attention? a stack of feed-forward layers does surprisingly well on imagenet. arXiv preprint arXiv:2105.02723, 2021.
+Y. Nesterov. A method for solving the convex programming problem with convergence rate $o(1 / k^2)$ . Proceedings of the USSR Academy of Sciences, 269:543-547, 1983.
+Maria-Elena Nilsback and Andrew Zisserman. Automated flower classification over a large number of classes. In 2008 Sixth Indian Conference on Computer Vision, Graphics Image Processing, pp. 722-729, 2008. doi: 10.1109/ICVGIP.2008.47.
+Omkar M Parkhi, Andrea Vedaldi, Andrew Zisserman, and C. V. Jawahar. Cats and dogs. In 2012 IEEE Conference on Computer Vision and Pattern Recognition, pp. 3498-3505, 2012. doi: 10.1109/CVPR.2012.6248092.
+Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. 2018.
+Benjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. DoImagenet classifiers generalize toImagenet? In International Conference on Machine Learning, pp. 5389-5400. PMLR, 2019.
+Ali Shafahi, Mahyar Najibi, Mohammad Amin Ghiasi, Zheng Xu, John Dickerson, Christoph Studer, Larry S Davis, Gavin Taylor, and Tom Goldstein. Adversarial training for free! In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. URL https://proceedings.neurips.cc/paper/2019/file/7503cfacd12053d309b6bed5c89de212-Paper.pdf.
+Yeonjong Shin and George Em Karniadakis. Trainability of relu networks and data-dependent initialization. Journal of Machine Learning for Modeling and Computing, 1(1):39-74, 2020. ISSN 2689-3967.
+Samuel L. Smith and Quoc V. Le. A bayesian perspective on generalization and stochastic gradient descent. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id=BBij4yg0Z.
+Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15(56):1929-1958, 2014. URL http://jmlr.org/papers/v15/srivastava14a.html.
+Chen Sun, Abhinav Shrivastava, Saurabh Singh, and Abhinav Gupta. Revisiting unreasonable effectiveness of data in deep learning era. In 2017 IEEE International Conference on Computer Vision (ICCV), pp. 843-852, 2017. doi: 10.1109/ICCV.2017.97.
+Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2818-2826, 2016. doi: 10.1109/CVPR.2016.308.
+T. Tieleman and G. Hinton. Lecture 6.5—RmsProp: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural Networks for Machine Learning, 2012.
+Ilya Tolstikhin, Neil Houlsby, Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Thomas Unterthiner, Jessica Yung, Daniel Keysers, Jakob Uszkoreit, Mario Lucic, and Alexey Dosovitskiy. Mlp-mixer: An all-mlp architecture for vision, 2021.
+Hugo Touvron, Piotr Bojanowski, Mathilde Caron, Matthieu Cord, Alaaeldin El-Nouby, Edouard Grave, Armand Joulin, Gabriel Synnaeve, Jakob Verbeek, and Hervé Jégou. Resmlp: Feedforward networks for image classification with data-efficient training, 2021a.
+
+Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention, 2021b.
+Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. arXiv preprint arXiv:1706.03762, 2017.
+Eric Wong, Leslie Rice, and J. Zico Kolter. Fast is better than free: Revisiting adversarial training. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id=BJx040EFvH.
+Dongxian Wu, Shu-Tao Xia, and Yisen Wang. Adversarial weight perturbation helps robust generalization. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 2958-2969. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper/2020/file/1ef91c212e30e14bf125e9374262401f-Paper.pdf.
+Lechao Xiao, Jeffrey Pennington, and Samuel Schoenholz. Disentangling trainability and generalization in deep neural networks. In Hal Daume III and Aarti Singh (eds.), Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pp. 10462-10472. PMLR, 13-18 Jul 2020. URL http://proceedings.mlr.org/press/v119/xiao20b.html.
+Cihang Xie, Mingxing Tan, Boqing Gong, Jiang Wang, Alan L. Yuille, and Quoc V. Le. Adversarial examples improve image recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020.
+Ge Yang and Samuel Schoenholz. Mean field residual networks: On the edge of chaos. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017. URL https://proceedings.neurips.cc/paper/2017/file/81c650caac28cdefce4de5ddc18befa0-Paper.pdf.
+Yang You, Jing Li, Sashank Reddi, Jonathan Hseu, Sanjiv Kumar, Srinadh Bhojanapalli, Xiaodan Song, James Demmel, Kurt Keutzer, and Cho-Jui Hsieh. Large batch optimization for deep learning: Training bert in 76 minutes. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id=Syx4wnEtvH.
+Li Yuan, Yunpeng Chen, Tao Wang, Weihao Yu, Yujun Shi, Zihang Jiang, Francis EH Tay, Jiashi Feng, and Shuicheng Yan. Tokens-to-token vit: Training vision transformers from scratch onImagenet, 2021.
+Sangwoo Yun, Dongyoon Han, Sanghyuk Chun, Seong Joon Oh, Youngjoon Yoo, and Junsuk Choe. Cutmix: Regularization strategy to train strong classifiers with localizable features. In 2019 IEEE/CVF International Conference on Computer Vision (ICCV), pp. 6022-6031, 2019. doi: 10.1109/ICCV.2019.00612.
+Arber Zela, Thomas Elsken, Tonmoy Saikia, Yassine Marrakchi, Thomas Brox, and Frank Hutter. Understanding and robustifying differentiable architecture search. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id=HlgDNyrKDS.
+Hongyi Zhang, Moustapha Cisse, Yann N. Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id=r1Ddp1-Rb.
+Jingzhao Zhang, Sai Praneeth Karimireddy, Andreas Veit, Seungyeon Kim, Sashank J. Reddi, Sanjiv Kumar, and Suvrit Sra. Why are adaptive methods good for attention models? In NeurIPS, 2020. URL https://proceedings.neurips.cc/paper/2020/bit/ b05b57f6add810d3b7490866d74c0053-Abstract.html.
+
+# APPENDICES
+
+# A ARCHITECTURES
+
+Table 8 specifies the ViT (Dosovitskiy et al., 2021; Vaswani et al., 2017) and MLP-Mixer (Tolstikhin et al., 2021) architectures used in this paper. "S" and "B" denote the small and base model scales following (Dosovitskiy et al., 2021; Touvron et al., 2021b; Tolstikhin et al., 2021), followed by the size of each image patch. For instance, "B/16" means the model of base scale with non-overlapping image patches of resolution $16 \times 16$ . We use the input resolution $224 \times 224$ throughout the paper. Following Tolstikhin et al. (2021), we sweep the batch sizes in $\{32, 64, \ldots, 8192\}$ on TPU-v3 and report the highest throughput for each model.
+
+Table 7: Comparison under the adversarial training framework on ImageNet (numbers in the parentheses denote the improvement over the standard adversarial training without SAM). With similar model size and throughput, ViTs-SAM can still outperform ResNets-SAM for clean accuracy and adversarial robustness.
+
+| Model | #params | Throughput (img/sec/core) | ImageNet | Real | V2 | PGD-10 | ImageNet-R | ImageNet-C |
| ResNet |
| ResNet-50-SAM | 25M | 2161 | 70.1 (-0.7) | 77.9 (-0.3) | 56.6 (-0.8) | 54.1 (+0.9) | 27.0 (+0.9) | 42.7 (-0.1) |
| ResNet-101-SAM | 44M | 1334 | 73.6 (-0.4) | 81.0 (+0.1) | 60.4 (-0.6) | 58.8 (+1.4) | 29.5 (+0.6) | 46.9 (+0.3) |
| ResNet-152-SAM | 60M | 935 | 75.1 (-0.4) | 82.3 (+0.2) | 62.2 (-0.4) | 61.0 (+1.8) | 30.8 (+1.4) | 49.1 (+0.6) |
| Vision Transformer |
| ViT-S/16-SAM | 22M | 2043 | 73.2 (+1.2) | 80.7 (+1.7) | 60.2 (+1.4) | 58.0 (+5.2) | 28.4 (+2.4) | 47.5 (+1.6) |
| ViT-B/32-SAM | 88M | 2805 | 69.9 (+3.0) | 76.9 (+3.4) | 55.7 (+2.5) | 54.0 (+6.4) | 26.0 (+3.0) | 46.4 (+3.0) |
| ViT-B/16-SAM | 87M | 863 | 76.7 (+3.9) | 82.9 (+4.1) | 63.6 (+4.3) | 62.0 (+7.7) | 30.0 (+4.9) | 51.4 (+5.0) |
| MLP-Mixer |
| Mixer-S/16-SAM | 18M | 4005 | 67.1 (+2.2) | 74.5 (+2.3) | 52.8 (+2.5) | 50.1 (+4.1) | 22.9 (+2.6) | 37.9 (+2.5) |
| Mixer-B/32-SAM | 60M | 4209 | 69.3 (+9.1) | 76.4 (+10.2) | 54.7 (+9.4) | 54.5 (+13.9) | 26.3 (+8.0) | 43.7 (+8.8) |
| Mixer-B/16-SAM | 59M | 1390 | 73.9 (+11.1) | 80.8 (+11.8) | 60.2 (+11.9) | 59.8 (+17.3) | 29.0 (+10.5) | 45.9 (+12.5) |
+
+Table 8: Specifications of the ViT and MLP-Mixer architectures used in this paper. We train all the architectures with image resolution $224 \times 224$ .
+
+| Model | #params | Throughput (img/sec/core) | Patch Resolution | Sequence Length | Hidden Size | #heads | #layers | Token MLP Dimension | Channel MLP Dimension |
| ViT-S/32 | 23M | 6888 | 32 × 32 | 49 | 384 | 6 | 12 | - | - |
| ViT-S/16 | 22M | 2043 | 16 × 16 | 196 | 384 | 6 | 12 | - | - |
| ViT-S/14 | 22M | 1234 | 14 × 14 | 256 | 384 | 6 | 12 | - | - |
| ViT-S/8 | 22M | 333 | 8 × 8 | 784 | 384 | 6 | 12 | - | - |
| ViT-B/32 | 88M | 2805 | 32 × 32 | 49 | 768 | 12 | 12 | - | - |
| ViT-B/16 | 87M | 863 | 16 × 16 | 196 | 768 | 12 | 12 | - | - |
| Mixer-S/32 | 19M | 11401 | 32 × 32 | 49 | 512 | - | 8 | 256 | 2048 |
| Mixer-S/16 | 18M | 4005 | 16 × 16 | 196 | 512 | - | 8 | 256 | 2048 |
| Mixer-S/8 | 20M | 1498 | 8 × 8 | 784 | 512 | - | 8 | 256 | 2048 |
| Mixer-B/32 | 60M | 4209 | 32 × 32 | 49 | 768 | - | 12 | 384 | 3072 |
| Mixer-B/16 | 59M | 1390 | 16 × 16 | 196 | 768 | - | 12 | 384 | 3072 |
| Mixer-B/8 | 64M | 466 | 8 × 8 | 784 | 768 | - | 12 | 384 | 3072 |
+
+# B WHEN SAM MEETS ADVERSARIAL TRAINING
+
+Interestingly, SAM and adversarial training are both minimax problems except that SAM's inner maximization is with respect to the network weights, while the latter concerns about the input for
+
+Table 9: Hyperparameters for downstream tasks. All models are fine-tuned with $224 \times 224$ resolution, a batch size of 512, cosine learning rate decay, no weight decay, and grad clipping at global norm 1.
+
+| Dataset | Total steps | Warmup steps | Base LR |
| CIFAR-10 | 10K | 500 | |
| CIFAR-100 | 10K | 500 | |
| Flowers | 500 | 100 | {0.001, 0.003, 0.01, 0.03} |
| Pets | 500 | 100 | |
+
+
+Figure 4: ImageNet accuracy (Left) and improvement (Right) brought by SAM.
+
+
+
+defending contrived attack (Madry et al., 2018; Wong et al., 2020). Moreover, similar to SAM, Shafahi et al. (2019) suggest that adversarial training can flatten and smooth the loss landscape. In light of these connections, we study ViTs and MLP-Mixers under the adversarial training framework (Wu et al., 2020; Madry et al., 2018). We use the fast adversarial training (Wong et al., 2020) (FGSM with random start) with the $l_{\infty}$ norm and maximum per-pixel change 2/255 during training. All the hyperparameters remain the same as the vanilla supervised training. When evaluating the adversarial robustness, we use the PGD attack (Madry et al., 2018) with the same maximum per-pixel change 2/255. The total number of attack steps is 10, and the step size is 0.25/255. To incorporate SAM, we formulate a three-level objective:
+
+$$
+\min _ {w} \max _ {\epsilon \in \mathbb {S} _ {s a m}} \max _ {\delta \in \mathbb {S} _ {a d v}} L _ {t r a i n} (w + \epsilon , x + \delta , y), \tag {5}
+$$
+
+where $\mathbb{S}_{sam}$ and $\mathbb{S}_{adv}$ denote the allowed perturbation norm balls for the model parameter $w$ and input image $x$ , respectively. Note that we can simultaneously obtain the gradients for computing $\epsilon$ and $\delta$ by backpropagation only once. To lower the training cost, we use fast adversarial training (Wong et al., 2020) with the $l_{\infty}$ norm for $\delta$ , and the maximum per-pixel change is set as 2/255.
+
+Table 7 (see Appendices) evaluates the models' clean accuracy, real-world robustness, and adversarial robustness (under 10-step PGD attack (Madry et al., 2018)). It is clear that the landscape smoothing significantly improves the convolution-free architectures for both clean and adversarial accuracy. However, we observe a slight accuracy decrease on clean images for ResNets despite gain for robustness. Similar to our previous observations, ViTs surpass similar-size ResNets when adversarially trained on ImageNet with Inception-style preprocessing for both clean accuracy and adversarial robustness.
+
+# C WHEN SAM MEETS CONTRASTIVE LEARNING
+
+In addition to data augmentations and large-scale pre-training, another notable way of improving a neural model's generalization is (supervised) contrastive learning (Chen et al., 2020; He et al., 2020; Caron et al., 2021; Khosla et al., 2020). We couple SAM with the supervised contrastive learning (Khosla et al., 2020) for 350 epochs, followed by fine-tuning the classification head by 90 epochs for both ViT-S/16 and ViT-B/16. We train ViTs under the supervised contrastive learning framework (Khosla et al., 2020). We take the classification token output from the last layer as the encoded representation and retain the structures of the projection and classification heads (Khosla et al., 2020). We employ a batch size 2048 without memory bank (He et al., 2020) and use AutoAugment (Cubuk et al., 2019) with strength 1.0 following Khosla et al. (2020). For the 350-epoch pretraining stage, the contrastive loss temperature is set as 0.1, and we use the LAMB optimizer (You et al., 2020) with learning rate $0.001 \times \frac{\text{batch size}}{256}$ along with a cosine decay schedule. For the second stage, we train the classification head for 90 epochs via a RMSProp optimizer (Tieleman & Hinton, 2012) with base learning rate 0.05 and exponential decay. The weight decays are set as 0.3 and 1e-6 for the first and second stages, respectively. We use a small SAM perturbation strength $\rho = 0.02$ .
+
+Compared to the training procedure without SAM, we find considerable performance gain thanks to SAM's smoothing of the contrastive loss geometry, improving the ImageNet top-1 accuracy of ViTs/16 from $77.0\%$ to $78.1\%$ , and ViT-B/16 from $77.4\%$ to $80.0\%$ . In comparison, the improvement on ResNet-152 is less significant (from $79.7\%$ to $80.0\%$ after using SAM).
+
+Table 10: Accuracy on downstream tasks of the models pre-trained on ImageNet. SAM improves ViTs and MLP-Mixers' transferabilities. ViTs transfer better than ResNets of similar sizes.
+
+| % | ResNet-50-SAM | ResNet-152-SAM | ViT-S/16 | ViT-S/16-SAM | ViT-B/16 | ViT-B/16-SAM | Mixer-S/16 | Mixer-S/16-SAM | Mixer-B/16 | Mixer-B/16-SAM |
| CIFAR-10 | 97.4 | 98.2 | 97.6 | 98.2 | 98.1 | 98.6 | 94.1 | 96.1 | 95.4 | 97.8 |
| CIFAR-100 | 85.2 | 87.8 | 85.7 | 87.6 | 87.6 | 89.1 | 77.9 | 82.4 | 80.0 | 86.4 |
| Flowers | 90.0 | 91.1 | 86.4 | 91.5 | 88.5 | 91.8 | 83.3 | 87.9 | 82.8 | 90.0 |
| Pets | 91.6 | 93.3 | 90.4 | 92.9 | 91.9 | 93.1 | 86.1 | 88.7 | 86.1 | 92.5 |
| Average | 91.1 | 92.6 | 90.0 | 92.6 | 91.5 | 93.2 | 85.4 | 88.8 | 86.1 | 91.7 |
+
+
+(a) ViT
+
+
+(b) ViT-SAM
+Figure 5: Cross-entropy loss landscapes of ViT-B/16, ViT-B/16-SAM, ViT-B/16-AUG, and ViT-B/16-21k. Strong augmentations and large-scale pre-training can also smooth the curvature.
+
+
+(c) ViT-AUG
+
+
+(d) ViT-21k
+
+# D WHEN SAM MEETS TRANSFER LEARNING
+
+We also study the role of smoothed loss geometry in transfer learning. We select four datasets to test ViTs and MLP-Mixers' transferabilities: CIFAR-10/100 (Krizhevsky, 2009), Oxford-IIIT Pets (Parkhi et al., 2012), and Oxford Flowers-102 (Nilsback & Zisserman, 2008). We use image resolution $224 \times 224$ during fine-tuning on downstream tasks, other settings exactly follow Dosovitskiy et al. (2021); Tolstikhin et al. (2021) (see Table 9). Note that we do not employ SAM during fine-tuning. We perform a grid search over the base learning rates on small sub-splits of the training sets ( $10\%$ for Flowers and Pets, $2\%$ for CIFAR-10/100). After that, we fine-tune on the entire training sets and report the results on the respective test sets. For comparison, we also include ResNet-50-SAM and ResNet-152-SAM in the experiments. Table 10 summarizes the results, which confirm that the enhanced models also perform better after fine-tuning and that MLP-Mixers gain the most from the sharpness-aware optimization.
+
+# E VISUALIZATION
+
+# E.1 LOSS LANDSCAPE
+
+We use the "filter normalization" method (Li et al., 2018) to visualize the loss function curvature in Figure 1 and 5. For a fair comparison, we use the cross-entropy loss when plotting the landscapes for all architectures, although the original training objective is the sigmoid loss for ViTs and MLP-Mixers. Note that their sigmoid loss geometry is even sharper. We equally sample 2,500 points on the 2D projection space and compute the losses using $10\%$ of the ImageNet training images (Chen et al., 2020), i.e., the i1k (1/10) subset in the main text to save computation.
+
+# E.2 ATTENTION MAP
+
+The visualization of the ViT's attention maps (Figure 3 in the main text) follows (Caron et al., 2021). We average the self-attention scores of the "classification token" from the last MSA layer to obtain a matrix $A \in \mathbb{R}^{H / P \times W / P}$ , where $H, W, P$ are the image height, width, and the patch resolution, respectively. Then we upsample $A$ to the image shape $H \times W$ before generating the figure.
+
+Table 11: The SAM perturbation strength $\rho$ for training on ImageNet. ViTs and MLP-Mixers favor larger $\rho$ than ResNets does. Larger models with longer patch sequences need stronger strengths.
+
+| Model | Task | SAM ρ |
| ResNet |
| ResNet-50-SAM | supervised | 0.02 |
| ResNet-101-SAM | supervised | 0.05 |
| ResNet-152-SAM | supervised | 0.02 |
| ResNet-50x2-SAM | supervised | 0.05 |
| ResNet-101x2-SAM | supervised | 0.05 |
| ResNet-152x2-SAM | supervised | 0.05 |
| ResNet-50-SAM | adversarial | 0.05 |
| ResNet-101-SAM | adversarial | 0.05 |
| ResNet-152-SAM | adversarial | 0.05 |
| ViT |
| ViT-S/32-SAM | supervised | 0.05 |
| ViT-S/16-SAM | supervised | 0.1 |
| ViT-S/14-SAM | supervised | 0.1 |
| ViT-S/8-SAM | supervised | 0.15 |
| ViT-B/32-SAM | supervised | 0.15 |
| ViT-B/16-SAM | supervised | 0.2 |
| ViT-B/16-AUG-SAM | supervised | 0.05 |
| ViT-S/16-SAM | adversarial | 0.1 |
| ViT-B/32-SAM | adversarial | 0.1 |
| ViT-B/16-SAM | adversarial | 0.1 |
| ViT-S/16-SAM | supervised contrastive | 0.02 |
| ViT-B/16-SAM | supervised contrastive | 0.02 |
| MLP-Mixer |
| Mixer-S/32-SAM | supervised | 0.1 |
| Mixer-S/16-SAM | supervised | 0.15 |
| Mixer-S/8-SAM | supervised | 0.2 |
| Mixer-B/32-SAM | supervised | 0.35 |
| Mixer-B/16-SAM | supervised | 0.6 |
| Mixer-B/8-SAM | supervised | 0.6 |
| Mixer-B/16-AUG-SAM | supervised | 0.2 |
| Mixer-S/16-SAM | adversarial | 0.05 |
| Mixer-B/32-SAM | adversarial | 0.25 |
| Mixer-B/16-SAM | adversarial | 0.25 |
+
+# F HESSIAN EIGENVALUE
+
+The Hessian matrix requires second-order derivative, so we compute the Hessian (and all the subdiagonal Hessian) $\lambda_{max}$ using $10\%$ of the ImageNet training images (i.e., 1k (1/10)) via power iteration $^1$ , where we use 100 iterations to ensure its convergence.
+
+# G NTK CONDITION NUMBER
+
+We approximate the neural tangent kernel on the i1k (1/10) subset by averaging over block diagonal entries (with block size $48 \times 48$ ) in the full NTK. Notice that the computation is based on the architecture at initialization without training. As the activation plays an important role when computing NTK — we find that smoother activation functions enjoy smaller condition numbers, we replace the GELU in ViT and MLP-Mixer with ReLU for a fair comparison with ResNet.
+
+# H TRAINING DETAILS
+
+We use image resolution $224 \times 224$ during fine-tuning on downstream tasks, other settings exactly follow (Dosovitskiy et al., 2021; Tolstikhin et al., 2021) (see Table 9). Note that we do not employ SAM during fine-tuning. We perform a grid search over the base learning rates on small sub-splits of the training sets (10% for Flowers and Pets, 2% for CIFAR-10/100). After that, we fine-tune on the entire training sets and report the results on the respective test sets.
+
+Table 12: Hyperparameters for training from scratch on ImageNet with basic Inception-style preprocessing and ${224} \times {224}$ image resolution.
+
+ | ResNet | ViT | MLP-Mixer |
| Data augmentation | | Inception-style | |
| Input resolution | | 224 × 224 | |
| Batch size | | 4,096 | |
| Epoch | 90 | 300 | 300 |
| Warmup steps | 5K | 10K | 10K |
| Peak learning rate | 0.1 × batch size/256 | 3e-3 | 3e-3 |
| Learning rate decay | cosine | cosine | linear |
| Optimizer | SGD | AdamW | AdamW |
| SGD Momentum | 0.9 | - | - |
| Adam (β1,β2) | - | (0.9,0.999) | (0.9,0.999) |
| Weight decay | 1e-3 | 0.3 | 0.3 |
| Dropout rate | 0.0 | 0.1 | 0.0 |
| Stochastic depth | - | - | 0.1 |
| Gradient clipping | - | 1.0 | 1.0 |
+
+Table 13: ImageNet top-1 accuracy (%) of ViT-B/16 and Mixer-B/16 when trained from scratch with different perturbation strength $\rho$ in SAM.
+
+| SAM ρ | 0.0 | 0.05 | 0.1 | 0.2 | 0.25 | 0.35 | 0.4 | 0.5 | 0.6 | 0.65 |
| ViT-B/16 | 74.6 | 77.5 | 78.8 | 79.9 | 79.3 | - | - | - | - | - |
| Mixer-B/16 | 66.4 | 69.5 | - | - | 74.1 | 74.7 | 75.6 | 76.9 | 77.4 | 77.1 |
+
+Except for the experiments in Section 4.5 (SAM with strong data augmentations) and Appendix C (contrastive learning), we train all the models from scratch on ImageNet with the basic Inception-style preprocessing (Szegedy et al., 2016), i.e., a random image crop and a horizontal flip with probability $50\%$ . Please see Table 12 for the detailed training settings. We simply follow the original training settings of ResNet and ViT (Kolesnikov et al., 2020; Dosovitskiy et al., 2021). For MLP-Mixer, we remove the strong augmentations in its original training pipeline and perform a grid search over the learning rate in $\{0.003, 0.001\}$ , weight decay in $\{0.3, 0.1, 0.03\}$ , Dropout rate in $\{0.1, 0.0\}$ , and stochastic depth in $\{0.1, 0.0\}$ . Note that training for 90 epochs is enough for ResNets to converge, and longer schedule brings almost no effect. For all the experiments, we use 128 TPUv3 cores (2 per chip), resulting in 32 images per core. The SAM computation for $\hat{\epsilon}$ is conducted on each core independently.
+
+# H.1 PERTURBATION STRENGTH IN SAM
+
+Different architecture species favor different strengths of perturbation $\rho$ . We perform a grid search over $\rho$ and report the best results — Table 11 reports the corresponding strengths used in our ImageNet experiments. Besides, we show the results when varying $\rho$ in Table 13. Similar to (Foret et al., 2021), we also find that a relative small $\rho \in [0.02, 0.05]$ works the best for ResNets. However, larger $\rho$ gives rise to the best results for ViTs and MLP-Mixers. We also observe that architectures with larger capacities and longer input sequences prefer stronger perturbation strengths. Interestingly, the choice of $\rho$ coincides with our previous observations. Since MLP-Mixers suffer the sharpest landscapes, they need the largest perturbation strength. As strong augmentations and contrastive learning already improve generalization, the suitable $\rho$ becomes significantly smaller. Note that we do not re-tune any other hyperparameters when using SAM.
+
+# H.2 TRAINING ON IMAGENET SUBSETS
+
+In Section 5.1, we train the models on ImageNet subsets, and the hyperparameters have to be adjusted accordingly. We simply change the batch size to maintain similar total iterations and keep all other settings the same, i.e., 2048 for i1k (1/2), 1024 for i1k (1/4), and 512 for i1k (1/10). We do not scale the learning rate as we find the scaling harms the performance.
+
+# H.3 TRAINING WITH STRONG AUGMENTATIONS
+
+We tune the learning rate and regularization when using strong augmentations (mixup with probability 0.5, RandAugment with two layers and magnitude 15) in Section 4.5 following (Tolstikhin et al., 2021). For ViT, we use 1e-3 peak learning rate, 0.1 weight decay, 0.1 Dropout, and 0.1 stochastic depth; For MLP-Mixer, those hyperparameters are exactly the same as (Tolstikhin et al., 2021), peak learning rate as 1e-3, weight decay as 0.1, Dropout as 0.0, and stochastic depth as 0.1. Other settings are unchanged (Table 12).
+
+# I LONGER SCHEDULE OF VANILLA SGD
+
+Since SAM needs another forward and backward propagation to compute $\hat{\epsilon}$ , its training overhead is $\sim 2\times$ of the vanilla baseline. We also experiment with $2\times$ schedule vanilla training (600 epochs). We observe that training longer brings no effect on both clean accuracy and robustness, indicating that the current 300 training epochs for ViTs and MLP-Mixers are enough for them to converge.
+
+# J VARYING WEIGHT DECAY STRNGTH
+
+Table 14: ImageNet accuracy and curvature analysis for ViT-B/16 when we vary the weight decay strength in Adam (AdamW).
+
+| Model | Weight decay | ImageNet (%) | ||w||2 | Ltrain | LNtrain | λmax |
| ViT-B/16 | 0.2 | 74.2 | 339.8 | 0.51 | 4.22 | 507.4 |
| 0.3 | 74.6 | 269.3 | 0.65 | 6.66 | 738.8 |
| 0.4 | 74.7 | 236.7 | 0.77 | 7.08 | 1548.9 |
| 0.5 | 74.4 | 211.8 | 0.98 | 7.21 | 2251.7 |
| ViT-B/16-SAM | 0.2 | 79.9 | 461.4 | 0.69 | 0.72 | 13.1 |
| 0.3 | 79.9 | 353.8 | 0.82 | 0.96 | 20.9 |
| 0.4 | 79.4 | 301.1 | 0.85 | 0.98 | 26.1 |
| 0.5 | 78.7 | 259.6 | 0.95 | 1.33 | 45.5 |
+
+In this section, we vary the strength of weight decay and see the effects of this commonly used regularization approach. As shown in Table 14, weight decay helps improve the accuracy on ImageNet when training without SAM, the weight norm also decreases when we enlarge the decay strength as expected. However, enlarging the weight decay aggravates the problem of converging to a sharper region measured by both $L_{train}^N$ and $\lambda_{max}$ . Another observation is that $\| w\|_2$ consistently increases after applying SAM for every weight decay strength in Table 14, together with the improved ImageNet accuracy and smoother landscape curvature.
\ No newline at end of file
diff --git a/whenvisiontransformersoutperformresnetswithoutpretrainingorstrongdataaugmentations/images.zip b/whenvisiontransformersoutperformresnetswithoutpretrainingorstrongdataaugmentations/images.zip
new file mode 100644
index 0000000000000000000000000000000000000000..3c9e7f9c88c70615b86501ede478c67862ab2faf
--- /dev/null
+++ b/whenvisiontransformersoutperformresnetswithoutpretrainingorstrongdataaugmentations/images.zip
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:34aa5b6b0661440143e6af4aee4ee61356ffab7670c5bdbf0b72ee89b35c03c2
+size 870515
diff --git a/whenvisiontransformersoutperformresnetswithoutpretrainingorstrongdataaugmentations/layout.json b/whenvisiontransformersoutperformresnetswithoutpretrainingorstrongdataaugmentations/layout.json
new file mode 100644
index 0000000000000000000000000000000000000000..ab59c3e079f3a7bd017b4af7b3ea925a82436828
--- /dev/null
+++ b/whenvisiontransformersoutperformresnetswithoutpretrainingorstrongdataaugmentations/layout.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:7d890b2e4e1649225c3bd710c0b15e4a08fa5d879a3bdb8e581384f5d745e838
+size 653341
diff --git a/wiringupvisionminimizingsupervisedsynapticupdatesneededtoproduceaprimateventralstream/cec7f9a7-fa3a-4d96-8cd9-19f63138672c_content_list.json b/wiringupvisionminimizingsupervisedsynapticupdatesneededtoproduceaprimateventralstream/cec7f9a7-fa3a-4d96-8cd9-19f63138672c_content_list.json
new file mode 100644
index 0000000000000000000000000000000000000000..d4e3c188b3c0c9a6b3d44cedc080dc1933e365d1
--- /dev/null
+++ b/wiringupvisionminimizingsupervisedsynapticupdatesneededtoproduceaprimateventralstream/cec7f9a7-fa3a-4d96-8cd9-19f63138672c_content_list.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d94462b59b6d95b6ef3915369cdf9bca3460c695e1e7bfd16982316aeb885308
+size 97579
diff --git a/wiringupvisionminimizingsupervisedsynapticupdatesneededtoproduceaprimateventralstream/cec7f9a7-fa3a-4d96-8cd9-19f63138672c_model.json b/wiringupvisionminimizingsupervisedsynapticupdatesneededtoproduceaprimateventralstream/cec7f9a7-fa3a-4d96-8cd9-19f63138672c_model.json
new file mode 100644
index 0000000000000000000000000000000000000000..36f9e1b79dce883000c410b4e962d542865f3011
--- /dev/null
+++ b/wiringupvisionminimizingsupervisedsynapticupdatesneededtoproduceaprimateventralstream/cec7f9a7-fa3a-4d96-8cd9-19f63138672c_model.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0ba2213963891d11c11ff29e5c126995a0b8dea34f8237c8ae5881699c917ce8
+size 120274
diff --git a/wiringupvisionminimizingsupervisedsynapticupdatesneededtoproduceaprimateventralstream/cec7f9a7-fa3a-4d96-8cd9-19f63138672c_origin.pdf b/wiringupvisionminimizingsupervisedsynapticupdatesneededtoproduceaprimateventralstream/cec7f9a7-fa3a-4d96-8cd9-19f63138672c_origin.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..499d2043080206c8cbe605c57bfeca9a448fd9b5
--- /dev/null
+++ b/wiringupvisionminimizingsupervisedsynapticupdatesneededtoproduceaprimateventralstream/cec7f9a7-fa3a-4d96-8cd9-19f63138672c_origin.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:9431a62eede07b359bef934707f5c4e7711d16513a0cafd01fad1d73b494f338
+size 1668214
diff --git a/wiringupvisionminimizingsupervisedsynapticupdatesneededtoproduceaprimateventralstream/full.md b/wiringupvisionminimizingsupervisedsynapticupdatesneededtoproduceaprimateventralstream/full.md
new file mode 100644
index 0000000000000000000000000000000000000000..43709192c69fa56bdc6f327af535a3ab9d4123b1
--- /dev/null
+++ b/wiringupvisionminimizingsupervisedsynapticupdatesneededtoproduceaprimateventralstream/full.md
@@ -0,0 +1,331 @@
+# WIRING UP VISION:
+
+# MINIMIZING SUPERVISED SYNAPTIC UPDATES
+
+# NEEDED TO PRODUCE A PRIMATE VENTRAL STREAM
+
+Franziska Geiger*,1,2,3,4, Martin Schrimpf*,1,5,6, Tiago Marques1,5,6, and James J. DiCarlo1,5,6
+
+1McGovern Institute for Brain Research, MIT
+
+$^{2}$ University of Augsburg ${ }^{3}$ Ludwig Maximilian University ${ }^{4}$ Technical University of Munich
+
+$^{5}$ Department of Brain and Cognitive Sciences, MIT
+
+$^{6}$ Center for Brains, Minds and Machines, MIT
+
+* joint first authors
+
+# ABSTRACT
+
+After training on large datasets, certain deep neural networks are surprisingly good models of the neural mechanisms of adult primate visual object recognition. Nevertheless, these models are considered poor models of the development of the visual system because they posit millions of sequential, precisely coordinated synaptic updates, each based on a labeled image. While ongoing research is pursuing the use of unsupervised proxies for labels, we here explore a complementary strategy of reducing the required number of supervised synaptic updates to produce an adult-like ventral visual stream (as judged by the match to V1, V2, V4, IT, and behavior). Such models might require less precise machinery and energy expenditure to coordinate these updates and would thus move us closer to viable neuroscientific hypotheses about how the visual system wires itself up. Relative to standard model training on labeled images in ImageNet, we here demonstrate that the total number of supervised weight updates can be substantially reduced using three complementary strategies: First, we find that only $2\%$ of supervised updates (epochs and images) are needed to achieve $\sim 80\%$ of a fully trained model's match to adult ventral stream. Specifically, training benefits predictions of higher visual cortex the most whereas predictions of earlier areas improve only marginally over the course of training. Second, by improving the random distribution of synaptic connectivity, we find that $54\%$ of the brain match can already be achieved "at birth" (i.e. no training at all). Third, we find that, by training only $\sim 5\%$ of model synapses, we can still achieve nearly $80\%$ of the match to the ventral stream. This approach further improves on ImageNet performance over previous attempts in computer vision of minimizing trained components without substantially increasing the number of trained parameters. These results reflect first steps in modeling not just primate adult visual processing during inference, but also how the ventral visual stream might be "wired up" by evolution (a model's "birth" state) and by developmental learning (a model's updates based on visual experience).
+
+# 1 INTRODUCTION
+
+Particular artificial neural networks (ANNs) are the leading mechanistic models of visual processing in the primate visual ventral stream (Schrimpf et al., 2020; Kubilius et al., 2019; Dapello et al., 2020). After training on large-scale datasets such as ImageNet (Deng et al., 2009) by updating weights based on labeled images, internal representations of these ANNs partly match neural representations in the primate visual system from early visual cortex V1 through V2 and V4 to high-level IT (Yamins et al., 2014; Khaligh-Razavi & Kriegeskorte, 2014; Cadena et al., 2017; Tang et al., 2018; Schrimpf et al., 2018; Kubilius et al., 2019), and model object recognition behavior can partly account for primate object recognition behavior (Rajalingham et al., 2018; Schrimpf et al., 2018).
+
+Recently, such models have been criticized due to how their learning departs from brain development because they require many more labeled examples than is reasonable for biological systems' limited waking (visual) experience (Seibert, 2018; Zador, 2019). For example, all the current top models of the primate ventral stream rely on trillions of supervised synaptic updates, i.e. the training of millions of parameters with millions of labeled examples over dozens of epochs. In biological systems, on the other hand, the at-birth synaptic wiring as encoded by the genome already provides structure that is sufficient for macaques to exhibit adult-like visual representations after a few months (Movshon & Kiorpes, 1988; Kiorpes & Movshon, 2004; Seibert, 2018), which restricts the amount of experience dependent learning. Furthermore, different neuronal populations in cortical circuits undergo different plasticity mechanisms: neurons in supragranular and infragranular layers adapt more rapidly than those in layer 4 which receives inputs from lower areas (Diamond et al., 1994; Schoups et al., 2001), while current artificial synapses, on the other hand, all change under the same plasticity mechanism. While current models provide a basic understanding of the neural mechanisms of adult ventral stream inference, can we start to build models that provide an understanding of how the ventral stream "wires itself up" – models of the initial state at birth and how it develops during postnatal life?
+
+Related Work. Several papers have addressed related questions in machine learning: Distilled student networks can be trained on the outputs of a teacher network (Hinton et al., 2015; Cho & Hariharan, 2019; Tian et al., 2019), and, in pruning studies, networks with knocked out synapses perform reasonably well (Cheney et al., 2017; Marcos et al., 2018), demonstrating that models with many trained parameters can be compressed (Wu et al., 2018) which is further supported by the convergence of training gradients onto a small subspace (Gur-Ari et al., 2018). Tian et al. (2020) show that a pre-trained encoder's fixed features can be used to train a thin decoder with performance close to full fine-tuning and recent theoretically-driven work has found that training only BatchNorm layers (Frankle et al., 2021) or determining the right parameters from a large pool of weights (Frankle et al., 2019; Ramanujan et al., 2019) can already achieve high classification accuracy. Unsupervised approaches are also starting to develop useful representations without requiring many labels by inferring internal labels such as clusters or representational similarity (Caron et al., 2018; Wu et al., 2018; Zhuang et al., 2019; Henaff et al., 2019; Konkle & Alvarez, 2020; Zhuang et al., 2020). Many attempts are also being made to make the learning algorithms themselves more biologically plausible (e.g. Lillicrap et al., 2016; Scellier & Bengio, 2017; Pozzi et al., 2020). Nevertheless, all of these approaches require many synaptic updates in the form of labeled samples or precise machinery to determine the right set of weights. In this work, we take first steps of relating findings in machine learning to neuroscience and using such models to explore hypotheses about the product of evolution (a model's "birth state") while simultaneously reducing the number of supervised synaptic updates (a model's visual experience dependent development) without sacrificing high brain predictivity.
+
+Our contributions follow from a framework in which evolution endows the visual system with a well-chosen, yet still largely random "birth" pattern of synaptic connectivity (architecture + initialization), and developmental learning corresponds to training a fraction of the synaptic weights using very few supervised labels. We do not view the proposed changes as fully biological models of post-natal development, only that they more concretely correspond to biology than current models. Solving the entire problem of development all at once is too much for one study, but even partial improvements in this direction will likely be informative to further work. Specifically,
+
+1. we build models with a fraction of supervised updates (training epochs and labeled images) that retain high similarity to the primate ventral visual stream (quantified by a brain predictivity score from benchmarks on Brain-Score (Schrimpf et al., 2018; 2020)) and find that layers corresponding to higher visual regions such as IT are most dependent on training,
+2. we improve the "at-birth" synaptic connectivity to show that even low-capacity evolutionarily encoded information might lead to reasonable initial representations with no training at all,
+3. we propose a thin, "critical training" technique which reduces the number of trained synapses while maintaining high brain predictivity and improves over previous computer vision attempts to minimize trained components,
+4. we combine these three techniques to build models with two orders of magnitude fewer supervised synaptic updates but high brain predictivity relative to a fully trained model
+
+Code and pre-trained models are available via GitHub:
+
+https://github.com/franzigeiger/training_reductions.
+
+# 2 MODELING PRIMATE VISION
+
+We evaluate all models on a suite of ventral stream benchmarks in Brain-Score (Schrimpf et al., 2018; 2020), and we base the new models presented here on the CORnet-S architecture, one of the most accurate models of adult primate visual processing (Kubilius et al., 2019).
+
+Brain-Score benchmarks. To obtain quantified scores for brain-likeness, we use a thorough set of benchmarks from Brain-Score (Schrimpf et al., 2018). To keep scores comparable, we only included those neural benchmarks from Brain-Score with the same predictivity metric. All benchmarks feed the same images to a candidate model that were used for primate experiments while "recording" activations or measuring behavioral outputs. Specifically, the V1 and V2 benchmarks present 315 images of naturalistic textures and compare model representations to primate single-unit recordings from Freeman et al. (2013) (102 V1 and 103 V2 neurons); the V4 and IT benchmarks present 2,560 naturalistic images and compare models to primate Utah array recordings from Majaj et al. (2015) (88 V4 and 168 IT electrodes). A linear regression is fit from model to primate representations in response to $90\%$ of the images and its prediction score on the held-out $10\%$ of images is evaluated with Pearson correlation, cross-validated 10 times. The behavioral benchmark presents 240 images and compares model to primate behavioral responses from Rajalingham et al. (2018). A logistic classifier is fit on models' penultimate representations on 2,160 separate labeled images. The classifier is then used to estimate probabilities for 240 held-out images. Per-image confusion patterns between model and primate are compared with a Pearson correlation. All benchmark scores are normalized by the respective ceiling. We primarily report the average brain predictivity score as the mean of V1, V2, V4, IT, and behavioral scores.
+
+We note that the Brain-Score benchmarks in this study are based on limited data and thus present a possible limitation. Nonetheless, they are the most extensive set of primate ventral stream neuronal and behavioral benchmarks that is currently available and the scores generalize to new experiments (Kubilius et al., 2019).
+
+Brain-Score provides separate sets of data as public benchmarks which we use to determine the type of distribution in Section 4, and the layer-to-region commitments of reference models.
+
+CORnet-S. One of the current best model architectures on the Brain-Score benchmarks is CORnet-S (Kubilius et al., 2019), a shallow recurrent model which anatomically commits to ventral stream regions. CORnet-S has four computational areas, analogous to the ventral visual areas V1, V2, V4, and IT, and a linear decoder that maps from neurons in the model's last visual area to its behavioral choices. The recurrent circuitry (Figure 3B) uses up- and down-sampling convolutions to process features and is identical in each of the models visual areas (except for $\mathrm{V1}_{\text{COR}}$ ), but varies by the total number of neurons in each area. We base all models developed here on the CORnet-S architecture and use the same hyper-parameters as proposed in (Kubilius et al., 2019). Representations are read out at the end of anatomically corresponding areas.
+
+# 3 HIGH SCORES IN BRAIN PREDICTIVITY CAN BE ACHIEVED WITH FEW SUPERVISED UPDATES
+
+We evaluated the brain predictivity scores of CORnet-S variants that were trained with a combination of fewer epochs and images. Models were trained with an initial learning rate of 0.1, divided by 10 when loss did not improve over 3 epochs, and stopping after three decrements.
+
+Figure 1 shows model scores on neural and behavioral Brain-Score measures, relative to a model trained for 43 epochs on all 1.28M labeled ImageNet images. In Panel A, we compare the average score over the five brain measures of various models to the number of supervised updates that each model was trained with, defined as the number of labeled images times the number of epochs. While a fully trained model reaches an average score of .42 after 55,040,000 supervised updates (43 epochs $\times$ 1.28M images), a model with only 100,000 updates already achieves $50\%$ of that score, and 1,000,000 updates increase brain predictivity scores to $76\%$ . Models are close to convergence score after 10,000,000 supervised updates with performance nearly equal to full training $(97\%)$ . Scores grow logarithmically with an approximate $5\%$ score increase for every order of magnitude more supervised updates.
+
+
+Figure 1: High scores in brain predictivity can be achieved with few supervised updates (log x-axes). A Average brain predictivity of models trained with a range of supervised updates (different combinations of epochs $\times$ images). Each dot is a different hypothesis of how the ventral visual stream might have developed and shows the adult brain-likeness score that is achieved by that model. Fairly brain-like representations are already realized with few supervised updates, relative to a fully trained model (black dot; see also Figure 6). Standardly trained CORnet-S is set to be $100\%$ score in brain predictivity on the benchmarks. A “pixels” baseline achieves $7\%$ of this brain predictivity score. B Individual brain predictivity scores over epochs. Models start to approximate the primate ventral stream with few training epochs. Lower visual areas (V1, V2) are approximated earlier in training. C Like B, but number of training images instead of epochs. Few images are sufficient to approximate especially early visual areas.
+
+Figures 1B and C show individual neural and behavioral scores of models trained with fewer training epochs or labeled images independently. Early to mid visual representations (V1, V2, and V4 scores) are especially closely met with only few supervised updates, reaching $50\%$ of the final trained model in fractions of the first epoch (Figure 1B). After only one full iteration over the training set, V1, V2, and V4 scores are close to their final score (all $>80\%$ ) while IT requires two epochs to reach a comparable level. Behavioral scores take slightly longer to converge ( $>80\%$ after 7 epochs).
+
+Similarly, when training until convergence with fractions of the 1.28M total images, 50,000 images are sufficient to obtain high neural scores (80% of full training in V1, V2, V4, IT). Behavioral scores again require more training: half the standard number of labeled images is needed to surpass 80%.
+
+Concretely relating supervised updates to primate ventral stream development, Seibert (2018) establishes that no more than $\sim 4$ months – or 10 million seconds – of waking visual experience is needed to reach adult-level primate IT cortex (as assessed by its capability to support adult level object recognition). From this estimate, we can compute how many supervised updates per second different models in Figure 1A would require (assuming those updates are evenly distributed over the 10 million seconds). For instance, the fully trained model's 55 million supervised updates translate to 5.5 updates every second, whereas the model with 1 million updates and $76\%$ relative brain predictivity translates to one labeled image update every 10 seconds which appears more plausible given the upper limit of 2-3 saccades per second in humans (Yarbus, 1967; Gibaldi & Sabatini, 2020).
+
+# 4 “AT-BIRTH” SYNAPTIC CONNECTIVITY YIELDS REASONABLE BRAIN PREDICTIVITY WITH NO TRAINING AT ALL
+
+If few supervised updates can get model representations fairly close to a fully trained model (Figure 1), how close are the initial representations without any training? In relation to biology and following the introduced framework of treating all consecutive training as developmental learning, these "at-birth" synaptic connections would result from information encoded in the genome as a product of evolution.
+
+Due to the genome's capacity bottleneck, it is infeasible to precisely encode every synapse. Primary visual cortex alone contains $\sim 1.4\mathrm{E8}$ neurons per hemisphere (Leuba & Kraftsik, 1994), $\sim 1\mathrm{E3}$ synapses per neuron, each requiring $\sim 37$ bits per synapse (Zador, 2019). Thus, without any clever rules, specifying the connections in only one hemisphere of V1 could require up to $\sim 5.2\mathrm{E12}$ bits
+
+
+Figure 2: "At-birth" synaptic connectivity yields reasonable scores in brain predictivity. A Specifying the initial weight distribution: Kaiming Normal (KN, He et al., 2015) samples from a generic Gaussian. Weight Compression (WC) compresses trained weights into low-parameter clustered distributions that weights can be initialized from. B Visualization of WC compressed parameters: Gabor filters for first layer and cluster centers for following layers with kernel size $>3$ . The cluster centers capture an intuitive variety of kernel types. C "At-birth" representations with WC achieve $54\%$ score in brain predictivity of a fully trained model, with no training at all. Scores after training remain virtually unchanged (shaded bars).
+
+- orders of magnitude more than the entire genome's $1\mathrm{GB} = 8\mathrm{E}9$ bits (Zador, 2019). Sampling synaptic weights from reasonably compressed distributions on the other hand places little memory requirements on genetic encoding while potentially yielding useful initial weights. Current machine learning techniques for initializing weights, such as Kaiming Normal (He et al., 2015), sample from a Gaussian distribution centered around zero.
+
+To test the hypothesis that the genome might already encode more powerful initial representations with synaptic wiring sampled from distributions specified by only few bits, we explored multidimensional distributions as a more expressive alternative. These distributions only require a small number of parameters, but unlike current generic initializers, we explicitly specify them for each layer. To determine the right parameterization, we compress a trained model's weights into clusters which we then sample from ("Weight Compression, WC").
+
+More specifically, for all convolutional layers except the first, we cluster the kernel weights and later sample from the clusters. We determine the number of clusters with the elbow method (Thorndike, 1953): 11 for V1, 13 for V2, 16 for V4, and 15 for IT. To capture the relative importance of clusters we fit a normal distribution to the cluster frequency over kernels. In batch normalization layers, we fit one normal distribution each to the weights and biases. For the first convolutional layer only, we employ a Gabor prior on the weights following studies in V1 (Hubel & Wiesel, 1962; Jones & Palmer, 1987) (Appendix B). This results in 33 KB (4,166 parameters) to specify network initialization, compared to 423 MB for a trained model's weights (assuming 8 byte per parameter).
+
+Model interpretability studies (Zeiler & Fergus, 2013; Olah et al., 2020; Cammarata et al., 2020) classify model weights, comparable to WC's representation. Visualizing the weight compressions from trained CORnet-S weights (Figure 2B), we find that the first layer's Gabor filters qualitatively align with an analysis by Cammarata et al. (2020). Cluster centers seem to represent an intuitive division of channel types with opposite types in every layer.
+
+Applying WC to CORnet-S, we first obtain a compressed and clustered set of parameters, from which we sample entirely new weights to yield a new model CORnet- $S_{WC}$ . This model is not trained at all and we only evaluate the goodness of its initial wiring on the suite of Brain-Score benchmarks. Strikingly, we find that even without any training, CORnet- $S_{WC}$ achieves $54 \pm 1.5\%$ of the brain predictivity score relative to a fully-trained model (Figure 2), representing a 12 percent point improvement ( $n = 10$ seeds; permutation test $p < 1E - 5$ ) over the Kaiming Normal initialized model with a score of $43 \pm 1.7\%$ . Early ventral stream regions V1 and V2 are predicted especially well with no loss in score but we note that these two benchmarks are less well predicted by the trained model to begin with. V4 scores also approximate those of a trained model relatively well
+
+
+B
+
+
+
+
+Figure 3: Training only critical layers reduces the number of updated synapses while maintaining high brain predictivity. A We could naively reduce the parameters of a fully-trained model by freezing layers from the bottom up, training only the top layers ("Downstream Training $DT$ ; gray box). We instead propose Critical Training ( $CT$ ) which only trains thin "critical" layers (e.g. down-sampling layers, blue box). B CORnet-S circuitry. $CT$ only trains critical layers, leaving the rest frozen. C Naively reducing parameters from standard training (black dot, top right) quickly deteriorates brain predictivity scores ( $DT$ , gray line) whereas Critical Training reduces parameters while retaining high scores (blue line, $CT$ ). D Like C, but measuring ImageNet score. $CT$ retains nearly half the score with a fraction of parameters.
+
+
+
+(75%). The major drop occurs in the IT and especially behavioral scores where CORnet-SwC only reaches 39% and 6% of the trained model's score respectively. Similarly, a trained linear decoder on CORnet-SwC's IT representations only reaches 5% of a trained model's ImageNet top-1 accuracy. While intuitively sampling weights from a compression of trained weights should somewhat recover reasonable brain predictivity scores, we note that not every implementation satisfies both high brain predictivity and sufficient compression for the genome bottleneck (Appendix B.3).
+
+Weight Compression explores the hypothesis that evolution may have discovered an initialization strategy with improved at-birth representations (relative to current initializations). WC is most likely not how evolution found the at-birth synaptic connections, but shows that with nearly identical capacity, an alternative initialization distribution leads to networks that are more brain-like in their adult state – revealing a new space of possibilities (hypotheses) that should be considered (see Appendix B.4 for more details on biological plausibility). These findings further suggests that matching representations in higher visual regions might be especially dependent on visual experience whereas early visual regions might already be reasonably well specified without experience.
+
+# 5 TRAINING THIN DOWN-SAMPLING LAYERS REDUCES THE NUMBER OF UPDATED SYNAPSES WHILE MAINTAINING HIGH BRAIN PREDICTIVITY
+
+While improved "at-birth" connectivity can reach $54\%$ of a fully-trained model's score, additional experience dependent updates appear necessary to reach higher predictivities. With standard train-
+
+ing, each iteration simultaneously updates all of the millions of synaptic weights in the neural network, which may be difficult to implement biologically. Alternatively, learning could take place preferentially in specific components. Cortical circuits are heterogeneous and different neuronal populations undergo distinct plasticity mechanisms. For example, neurons in supra- and infragranular layers adapt more rapidly than those in layer 4, where inputs from lower areas arrive, as observed in rat somatosensory cortex (Diamond et al., 1994) and primate V1 (Schoups et al., 2001).
+
+As a proof-of-principle that training a reduced set of layers can retain high performance, we propose a novel thin training technique, which we term Critical Training (CT; Figure 3A). CT updates only the weights in critical layers, instead of updating every single model synapse. In CORnet-S, each of the blocks has one down-sampling layer to produce an area's final representation (Figure 3B). We explore successive variants of applying $CT$ up to a block in the architecture and then training the following blocks, e.g. freezing V1, V2, V4 with critical training of the respective down-sampling layers and additional IT training. The final $CT$ ventral stream model is almost completely frozen and only the synapses generating each cortical area's output are trained.
+
+We compared Critical Training against two alternative approaches: 1) reducing the trained parameters by freezing entire model blocks, for instance keeping V1 and V2 blocks fixed while training V4 and IT blocks. We term this block-wise freezing and training approach Downstream Training (DT). And 2) an approach proposed by Frankle et al. (2021) where only the BatchNorm parameters in a network are trained while all other parameters are kept at their initial values ("BatchNorm, BN").
+
+Compared to standard back-propagation training all the weights, all three approaches (CT, DT, BN) reduce the number of trained parameters (Figure 3C). However, while the average score with $DT$ (gray) already drops below $65\%$ with over a quarter of trained parameters remaining and $BN$ drops to $62\%$ with very few parameters, $CT$ (blue) maintains over $75\%$ with only 1.4 out of 52.8 million parameters trained. The choice of which critical layers to train also matters: training the connecting layers between regions – i.e. the last (down-sampling, default) or first (up-sampling) layer – retains most of the performance whereas training layers such as BatchNorm performs worse.
+
+By reducing the number of trained parameters, Critical Training also yields engineering benefits with more than $40\%$ of the ImageNet score maintained at $< 3\%$ of parameters trained - a significant improvement over $22\%$ accuracy with BatchNorm (Frankle et al., 2021) while adding only a small number of additional weights. $CT$ further reduces training time by $30\%$ per epoch.
+
+# 6 HIGH BRAIN PREDICTIVITY CAN BE ACHIEVED WITH A RELATIVELY SMALL NUMBER OF SUPERVISED SYNAPTIC UPDATES
+
+All three training reduction methods independently minimize the number of supervised synaptic updates required to reach a reasonably high brain predictivity score. Reducing the number of supervised updates minimizes the number of epochs and images (Section 3); Weight Compression (WC) improves the at-birth synaptic connectivity for high initial scores with no training at all (Section 4); and Critical Training (CT) reduces the number of synapses that are updated during training (Section 5). Testing synergies between these strategies, we combined all three methods to build novel models that only require a small number of supervised synaptic updates to reasonably capture the mechanisms of adult ventral visual stream processing and object recognition behavior.
+
+Figure 4A shows the average brain predictivity of a range of models with varying numbers of supervised synaptic updates relative to a standard trained CORnet-S (black dot, 3,000 trillion supervised synaptic updates). With a reduced number of supervised updates (training epochs and labeled images) but standard initialization and training all weights (light blue dots), models require 5.2 trillion updates to achieve $>50\%$ of the score of a fully trained model and about 100 trillion updates to reach $80\%$ brain score. Adding $WC + CT$ (dark blue dots), the corresponding model already reaches $53\%$ at birth with 0 supervised synaptic updates. At $0.5\%$ the updates of a fully trained model (14 trillion vs. 3,000 trillion), models then reach $79\%$ of the score ( $\diamond$ model with modeling choices marked in Figures 1 to 3). Continuing standard training from this $79\%$ model, we can achieve $100\%$ of the score with 15 additional epochs of 1,028 trillion supervised synaptic updates (one third of the fully trained model's 3,000 trillion updates). Reference models (gray dots) MobileNet (Howard et al., 2017) and ResNet (He et al., 2016) obtain high scores, but also require many supervised synaptic updates. HMAX (Riesenhuber & Poggio, 1999) is fully specified with no updates but lacks in score.
+
+
+Figure 4: Benefits of combining training reductions for high brain predictivity with few supervised synaptic updates and limitations of techniques in high-update regimes. A (log x-axis) By reducing updates with a combination of fewer supervised updates (Figure 1), improved initialization WC (Figure 2), and training only down-sampling layers $CT$ (Figure 3), the resulting models (dark blue dots; fewer supervised updates alone in light blue) maintain high brain predictivity scores while requiring only a fraction of supervised synaptic updates compared to standard CORnet-S (black dot, top right). B Comparison between WC-initialized models trained with $CT$ versus standardly initialized models training all weights, when varying training epochs and labeled images. Colors represent their percent point difference in brain predictivity scores. $WC + CT$ improve performance in regimes with few epochs and images, but fall behind in regimes with many labeled images and epochs.
+
+
+
+We next examined interactions between methods by comparing models initialized with $WC$ and trained with $CT$ to models with standard initialization and training all weights, when both are trained with fewer epochs and images. Figure 4B shows the percent point difference between the two model families. $WC + CT$ yield strong benefits (green numbers) in a regime with few supervised updates, improving by up to 27 percent points when training for only 1 epoch on 1,000 images. With many updates on the other hand, $WC + CT$ is less advantageous than standard training (red numbers): with all 43 epochs and 1.28M images, the score reduces by 17 percent points. $WC + CT$ therefore most positively interact with a small budget of supervised updates (which is the focus of this work).
+
+# 7 DISSECTING TRAINING REDUCTIONS
+
+We asked whether the developed techniques would generalize to architectures other than the CORnet-S architecture they were based on. Beyond establishing the methods as more general, this can be seen as a novel way to construct model taxonomies. We therefore applied Weight Compression (WC) and Critical Training (CT) to ResNet-50 (He et al., 2016) and MobileNet-V1 (Howard et al., 2017) architectures, both high-performing models on Brain-Score. We used WC distributions determined on CORnet-S, i.e. we tested transfer without re-fitting. $WC + CT$ maintain $91\%$ of the score in ResNet despite an almost $80\%$ reduction in parameters. When applied to MobileNet, the average score drops by $22\%$ and parameters are reduced less strongly $(43\%)$ . This difference in performance could be due to MobileNet already being very compressed, or having a less similar architecture.
+
+With most analyses so far comparing an average score, we dissected the relative contributions of $WC$ and $CT$ to individual benchmarks (Figure 5B). We compared $KN$ to $WC$ initialization, as well as resulting models after critical training ( $KN + CT$ and $WC + CT$ ). $WC$ initialization improves most over $KN$ in early visual regions V1 and V2, while additional training with $CT$ is most beneficial in mid- to high-level visual cortex V4 and IT, as well as the behavioral benchmark.
+
+
+
+
+Figure 5: Transfer to other networks and individual scores comparison. A Transfer to other networks. We sample from WC initializations determined on CORnet-S, followed by Critical Training of only down-sampling layers. B Absolute scores on individual benchmarks of combinations of initialization (KN/WC, Figure 2), and with critical training (CT, Figure 3) techniques.
+
+# 8 DISCUSSION
+
+We developed a range of models with neural and behavioral scores approaching those of the current leading model of the adult ventral visual stream as quantified in Brain-Score, while requiring only a fraction of supervised synaptic updates. These models were built by complementarily 1) reducing the number of supervised updates, i.e. training epochs and labeled images; 2) improving the "at birth" distribution of synaptic connectivity; and 3) training only critical synapses at the end of each model area. The techniques and resulting models proposed here are first steps to more closely modeling not just adult primate visual processing, but also exploring the underlying mechanisms of evolution and developmental learning.
+
+These proof-of-principle demonstrations are far from accounting for the rich information encoded in the genome or the developmental learning that together result in adult mechanisms of visual processing, and require further experimental validation. We here started from CORnet-S, one of the leading models on Brain-Score, but does not fully predict all brain measurements (0.42 absolute score). We verified favorable transfer to models with similar architectures such as ResNet, but generalization to an already compressed MobileNet was limited (Figure 5A).
+
+Relating to genomic mechanisms, the proposed techniques should generalize to other domains such as auditory processing. With the capacity bottleneck in the genome, mechanisms for wiring up would likely be shared between similar systems. The fact that early visual areas converge earlier during training (Figure 1) and are better predicted than higher areas by WC initialization is consistent with developmental studies of the primate ventral stream. In humans, behaviors that rely on low-level spatial and temporal processing of visual inputs reach adult-like performance considerably earlier than complex visual behaviors that rely on higher cortical regions, such as face perception (Ellemberg et al., 1999; Grill-Spector et al., 2008).
+
+A critical component in more closely modeling primate development is to reduce the dependence on labels altogether. Recent unsupervised approaches are starting to rival the classification performance of supervised models (Caron et al., 2018; Henaff et al., 2019; Zhuang et al., 2020) and combining them with the advances presented here could further reduce the number of synaptic updates. More precise biological measurements are required to quantify the number of (parallel) experience-dependent updates. Current unsupervised techniques however still require back-propagation which is routinely criticized as non-biological, among others due to the propagation of gradients (Grossberg, 1987; Whittington & Bogacz, 2019; Hunsberger, 2017). Local learning rules (Lowe et al., 2019; Xiong et al., 2020) might alleviate these concerns and with critical training (Figure 3), it could be sufficient to learn in only a subset of layers.
+
+The changes to model initialization and training presented here serve as a proof-of-principle that models can be changed to more closely align with primate development by reducing training steps with labeled images and improving initialization. It is also possible to achieve high brain predictivity when training only a fraction of weights, but all these models are still far from the actual biological mechanisms. We expect future work in this direction to further close the gap with improved evolutionarily encoded wiring mechanisms and developmental learning rules.
+
+# REFERENCES
+
+Martin Schrimpf, Idan A Blank, Greta Tuckute, Carina Kauf, Eghbal A Hosseini, NANCY G KANWISHER, Joshua B. Tenenbaum, and Evelina Fedorenko. Artificial Neural Networks Accurately Predict Language Processing in the Brain. bioRxiv preprint, 2020.
+Jonas Kubilius, Martin Schrimpf, Ha Hong, Najib J. Majaj, Rishi Rajalingham, Elias B. Issa, Kohitij Kar, Pouya Bashivan, Jonathan Prescott-Roy, Kailyn Schmidt, Aran Nayebi, Daniel Bear, Daniel L. K. Yamins, and James J. DiCarlo. Brain-Like Object Recognition with High-Performing Shallow Recurrent ANNs. In Neural Information Processing Systems (NeurIPS), pp. 12785--12796. 2019.
+Joel Dapello, Tiago Marques, Martin Schrimpf, Franziska Geiger, David D. Cox, and James J. DiCarlo. Simulating a Primary Visual Cortex at the Front of CNNs Improves Robustness to Image Perturbations. In Neural Information Processing Systems (NeurIPS). 2020.
+Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. ImageNet: A large-scale hierarchical image database. In IEEE Conference on Computer Vision and Pattern Recognition, pp. 248-255. 2009.
+Daniel LK Yamins, Ha Hong, Charles F Cadieu, Ethan A Solomon, Darren Seibert, and James J DiCarlo. Performance-optimized hierarchical models predict neural responses in higher visual cortex. Proceedings of the National Academy of Sciences, 111(23):8619-8624, 2014.
+Seyed-Mahdi Khaligh-Razavi and Nikolaus Kriegeskorte. Deep supervised, but not unsupervised, models may explain it cortical representation. PLoS computational biology, 10(11):e1003915, 2014.
+Santiago A Cadena, George H Denfield, Edgar Y Walker, Leon A Gatys, Andreas S Tolias, Matthias Bethge, and Alexander S Ecker. Deep convolutional models improve predictions of macaque v1 responses to natural images. bioRxiv, pp. 201764, 2017.
+Hanlin Tang, Martin Schrimpf, William Lotter, Charlotte Moerman, Ana Paredes, J.O. Josue Ortega Caro, Walter Hardesty, David Cox, and Gabriel Kreiman. Recurrent computations for visual pattern completion. Proceedings of the National Academy of Sciences (PNAS), 115(35):8835-8840, 2018.
+Martin Schrimpf, Jonas Kubilius, Ha Hong, Najib J. Majaj, Rishi Rajalingham, Elias B. Issa, Kohitij Kar, Pouya Bashivan, Jonathan Prescott-Roy, Kailyn Schmidt, Daniel L. K. Yamins, and James J. DiCarlo. Brain-Score: Which artificial neural network for object recognition is most brain-like? bioRxiv, 2018.
+Rishi Rajalingham, Elias B Issa, Pouya Bashivan, Kohitij Kar, Kailyn Schmidt, and James J DiCarlo. Large-scale, high-resolution comparison of the core visual object recognition behavior of humans, monkeys, and state-of-the-art deep artificial neural networks. Journal of Neuroscience, pp. 7255-7269, 2018.
+Darren Seibert. High-level visual object representation in juvenile and adult primates. PhD thesis, Massachusetts Institute of Technology, 2018.
+Anthony Zador. A Critique of Pure Learning: What Artificial Neural Networks can Learn from Animal Brains. bioRxiv preprint, 2019.
+J. Anthony Movshon and Lynne Kiorpes. Analysis of the development of spatial contrast sensitivity in monkey and human infants. Journal of the Optical Society of America A (JOSA A), 5(12):2166, 1988.
+Lynne Kiorpes and J. Anthony Movshon. Development of sensitivity to visual motion in macaque monkeys. Visual Neuroscience, 21(6):851-859, 2004.
+Mathew E. Diamond, Wei Huang, and Ford F. Ebner. Laminar comparison of somatosensory cortical plasticity. Science, 265(5180):1885-1888, 1994.
+Aniek Schoups, Rufin Vogels, Ning Qian, and Guy Orban. Practising orientation identification improves orientation coding in V1 neurons. Nature, 412(6846):549-553, 2001.
+Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the Knowledge in a Neural Network. arXiv preprint, 2015.
+Jang Hyun Cho and Bharath Hariharan. On the efficacy of knowledge distillation. In International Conference on Computer Vision (ICCV), volume 2019-Octob, pp. 4793-4801. 2019.
+Yonglong Tian, Dilip Krishnan, and Phillip Isola. Contrastive Representation Distillation. arXiv preprint, 2019.
+Nicholas Cheney, Martin Schrimpf, and Gabriel Kreiman. On the Robustness of Convolutional Neural Networks to Internal Architecture and Weight Perturbations. arXiv preprint, 2017.
+Ari S. Morcos, David G. T. Barrett, Neil C. Rabinowitz, and Matthew Botvinick. On the importance of single directions for generalization. In International Conference on Learning Representations (ICLR), 2018.
+Junru Wu, Yue Wang, Zhenyu Wu, Zhangyang Wang, Ashok Veeraraghavan, and Yingyan Lin. Deep k-Means: Re-Training and Parameter Sharing with Harder Cluster Assignments for Compressing Deep Convolutions. In International Conference on Machine Learning (ICML), 2018.
+Guy Gur-Ari, Daniel A. Roberts, and Ethan Dyer. Gradient Descent Happens in a Tiny Subspace. arXiv preprint, 2018.
+Yonglong Tian, Yue Wang, Dilip Krishnan, Joshua B. Tenenbaum, and Phillip Isola. Rethinking Few-Shot Image Classification: a Good Embedding Is All You Need? arXiv preprint, 2020.
+
+Jonathan Frankle, David J Schwab, and Ari S Morcos. Training BatchNorm and Only BatchNorm: On the Expressive Power of Random Features in CNNs. In International Conference on Learning Representations (ICLR), 2021.
+Jonathan Frankle, Gintare Karolina Dziugaite, Daniel M. Roy, and Michael Carbin. The Lottery Ticket Hypothesis at Scale. arXiv preprint, 2019.
+Vivek Ramanujan, Mitchell Wortsman, Aniruddha Kembhavi, Ali Farhadi, and Mohammad Rastegari. What's Hidden in a Randomly Weighted Neural Network? arXiv preprint, 2019.
+Mathilde Caron, Piotr Bojanowski, Armand Joulin, and Matthijs Douze. Deep Clustering for Unsupervised Learning of Visual Features. In European Conference on Computer Vision (ECCV), pp. 132-149, 2018.
+Zhirong Wu, Yuanjun Xiong, Stella X Yu, and Dahua Lin. Unsupervised Feature Learning via Non-parametric Instance Discrimination. In Computer Vision and Pattern Recognition (CVPR), pp. 3733-3742, 2018.
+Chengxu Zhuang, Alex Zhai, and Daniel Yamins. Local aggregation for unsupervised learning of visual embeddings. In International Conference on Computer Vision (ICCV), pp. 6001-6011. 2019.
+Olivier J. Henaff, Aravind Srinivas, Jeffrey De Fauw, Ali Razavi, Carl Doersch, S. M. Ali Eslami, and Aaron van den Oord. Data-Efficient Image Recognition with Contrastive Predictive Coding. In Computer Vision and Pattern Recognition (CVPR), 2019.
+Talia Konkle and George A. Alvarez. Instance-level contrastive learning yields human brain-like representation without category-supervision. bioRxiv preprint, 2020.
+Chengxu Zhuang, Siming Yan, Aran Nayebi, Martin Schrimpf, Michael C. Frank, James J. DiCarlo, and Daniel L. K. Yamins. Unsupervised Neural Network Models of the Ventral Visual Stream. bioRxiv preprint, 2020.
+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):13276, 2016.
+Benjamin Scellier and Yoshua Bengio. Equilibrium Propagation: Bridging the Gap between Energy-Based Models and Backpropagation. Frontiers in Computational Neuroscience, 11:24, 2017.
+Isabella Pozzi, Sander M Bohté, and Pieter R Roelfsema. Attention-Gated Brain Propagation: How the brain can implement reward-based error backpropagation. In Neural Information Processing Systems (NeurIPS), volume 33, 2020.
+Jeremy Freeman, Corey M Ziemba, David J Heeger, Eero P Simoncelli, and J Anthony Movshon. A functional and perceptual signature of the second visual area in primates. Nature Neuroscience, 16(7):974-981, 2013.
+Najib J Majaj, Ha Hong, Ethan A Solomon, and James J DiCarlo. Simple learned weighted sums of inferior temporal neuronal firing rates accurately predict human core object recognition performance. Journal of Neuroscience, 35(39):13402-13418, 2015.
+A. L. Yarbus. Eye movements and vision. Plenum Press, 1967.
+Agostino Gibaldi and Silvio P. Sabatini. The saccade main sequence revised: A fast and repeatable tool for oculomotor analysis. Behavior Research Methods, pp. 1-21, 2020.
+Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification. In Proceedings of the IEEE international conference on computer vision, pp. 1026-1034, 2015.
+G Leuba and R Kraftsik. Changes in volume, surface estimate, three-dimensional shape and total number of neurons of the human primary visual cortex from midgestation until old age. *Anatomy and Embryology*, 190 (4):351-366, 1994.
+Robert L. Thorndike. Who belongs in the family? Psychometrika, 18(4):267-276, 1953.
+David H Hubel and Torsten N Wiesel. Receptive fields, binocular interaction and functional architecture in the cat's visual cortex. The Journal of physiology, 160(1):106-154, 1962.
+J. P. Jones and L. A. Palmer. The two-dimensional spatial structure of simple receptive fields in cat striate cortex. Journal of Neurophysiology, 58(6):1187-1211, 1987.
+Matthew D Zeiler and Rob Fergus. Visualizing and Understanding Convolutional Networks. arXiv preprint, 2013.
+Chris Olah, Nick Cammarata, Ludwig Schubert, Gabriel Goh, Michael Petrov, and Shan Carter. Zoom In: An Introduction to Circuits. Distill, 5(3), 2020.
+Nick Cammarata, Shan Carter, Gabriel Goh, Chris Olah, Michael Petrov, and Ludwig Schubert. Thread: Circuits. Distill, 2020. https://distill.pub/2020/circuits.
+Andrew G. Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, and Hartwig Adam. MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications. arXiv preprint, 2017.
+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, pp. 770-778, 2016.
+Maximilian Riesenhuber and Tomaso Poggio. Hierarchical models of object recognition in cortex. Nature neuroscience, 2(11):1019, 1999.
+
+Dave Ellemberg, Terri L. Lewis, Chang Hong Liu, and Daphne Maurer. Development of spatial and temporal vision during childhood. Vision Research, 39(14):2325-2333, 1999.
+Kalanit Grill-Spector, Golijeh Golarai, and John Gabrieli. Developmental neuroimaging of the human ventral visual cortex. Trends in Cognitive Sciences, 12(4):152-162, 2008.
+Stephen Grossberg. Competitive learning: From interactive activation to adaptive resonance. Cognitive Science, 11(1):23-63, 1987.
+James C.R. Whittington and Rafal Bogacz. Theories of Error Back-Propagation in the Brain. Trends in Cognitive Sciences, 23(3):235-250, 2019.
+Eric Hunsberger. Spiking Deep Neural Networks: Engineered and Biological Approaches to Object Recognition. PhD thesis, University of Waterloo, 2017.
+Sindy Löwe, Peter O'Connor, and Bastiaan S. Veeling. Putting An End to End-to-End: Gradient-Isolated Learning of Representations. In Neural Information Processing Systems (NeurIPS), volume 32. 2019.
+Yuwen Xiong, Mengye Ren, and Raquel Urtasun. LoCo: Local Contrastive Representation Learning. arXiv, 2020.
+Evelyn Fix and J. L. Hodges. Discriminatory analysis, nonparametric discrimination. Technical report, United States Air Force, 1951.
+Gideon Schwarz. Estimating the Dimension of a Model. Annals of Statistics, 6(2):461-464, 1978.
+Andrew D. Huberman, Marla B. Feller, and Barbara Chapman. Mechanisms Underlying Development of Visual Maps and Receptive Fields. Annual Review of Neuroscience, 31(1):479-509, 2008.
+
+
+Figure 6: Findings generalize across hyperparameters. Notations like in Figure 1. To test whether fast learning could be achieved by purely changing hyperparameters, we evaluated different regularizations (weight decay 0.001 and 0.00001 vs. 0.0001), learning rates (initial 1.0 and 0.01 vs. 0.1 in the main manuscript) and learning rate schedules ("Scheduler alternative" decreases learning rate more agressively). Trends are qualitatively similar across all choices, and quantitatively nearly optimal with respect to fast convergence to high brain predictivity for the hyperparameters used in the manuscript. We suspect that more careful tuning of e.g. the learning rate could lead to an improved trade-off between supervised updates and brain predictivity.
+
+# A BENCHMARK DETAILS
+
+We use the benchmarks as implemented in www.github.com/brain-score/ brain-score at commit 96b0711, and convert base models to brain models with www.github.com/brain-score/model-tools at commit 2f778c6. Images were presented at 4 degrees without aperture for the V1 and V2 benchmarks and at 8 degrees for the V4, IT, and behavior benchmarks. Models committed to an input size of 8 degrees visual angle.
+
+# B WEIGHT COMPRESSION DETAILS
+
+For all convolutional layers except the first, we cluster kernel weights in a layer using the k-means algorithm (Fix & Hodges, 1951). The number of clusters is determined using elbow (Thorndike, 1953) (see Table 1). To capture the relative importance of clusters we fit a normal distribution $\mathcal{N}_f$ for each cluster with $\mu_f$ as the cluster frequency over kernels and $\sigma_f$ as the frequency standard deviation. To sample weights for a kernel, we first sample a cluster distribution $i \sim \mathcal{N}_f$ per kernel and then obtain channel weights by sampling from a Gaussian with $\vec{\mu}_i$ as the cluster center and the standard deviation $\vec{\sigma}_i$ of clustered weights. In batch normalization layers, we fit one normal distribution each to the weights and biases.
+
+# B.1 COMPRESSING THE FIRST LAYER WITH A GABOR PRIOR
+
+The weight compression approach we use in Section 4 is based on different initialization techniques, applied to different layers. For the very first layer of size $7 \times 7$ we found a Gabor filter most effective following studies in V1 (Hubel & Wiesel, 1962; Jones & Palmer, 1987). To generate the Gabor kernels we fit trained channel weights to a Gabor function
+
+$$
+G _ {\theta , f, \phi , n _ {x}, n _ {y}, C} (x, y) = \frac {1}{2 \pi \sigma_ {x} \sigma_ {y}} \exp \left[ - 0. 5 \left(x _ {\text {r o t}} ^ {2} / \sigma_ {x} ^ {2} + y _ {\text {r o t}} ^ {2} / \sigma_ {y} ^ {2}\right) \right] \cos (2 \pi f + \phi) C \tag {1}
+$$
+
+where
+
+$$
+x _ {r o t} = x \cos (\theta) + y \sin (\theta) \quad (2) \quad \sigma_ {x} = \frac {n _ {x}}{f} \tag {3}
+$$
+
+$$
+y _ {r o t} = - x \sin (\theta) + y \cos (\theta)
+$$
+
+$$
+\sigma_ {x} = \frac {n _ {x}}{f} \tag {3}
+$$
+
+$$
+\sigma_ {y} = \frac {n _ {y}}{f}
+$$
+
+| LAYER | NUM CLUSTERS |
| V1.conv1 | 4 |
| V1.conv2 | 7 |
| V2.conv_input | 2 |
| V2.conv1 | 2 |
| V2.conv2 | 5 |
| V2.conv3 | 2 |
| V2.skip | 2 |
| V4.conv_input | 2 |
| V4.conv1 | 2 |
| V4.conv2 | 8 |
| V4.conv3 | 2 |
| V2.skip | 2 |
| IT.conv1 | 2 |
| IT.conv2 | 9 |
| IT.conv3 | 2 |
| IT.skip | 2 |
+
+Table 1: Number of clusters used for each layer by Weight Compression, determined by the elbow method. Note that for V1.conv1, there are four components of a multivariate Gaussian as described in Appendix B.1
+
+$x_{rot}$ and $y_{rot}$ are the orthogonal and parallel orientations relative to the grating, $\theta$ is the angle of the grating orientation, $f$ is the spatial frequency of the grating, $\phi$ is the phase of the grating relative to the Gaussian envelope, $\sigma_x$ and $\sigma_y$ are the standard deviations of the Gaussian envelope orthogonal and parallel to the grating, which can be defined as multiples ( $n_x$ and $n_y$ ) of the inverse of the grating frequency and $C$ is a scaling factor.
+
+The function is fit per channel, which leads to a set of Gabor parameter for each of the 3 RGB channels. We then fit a multidimensional mixture of Gaussians to the combination of all filter parameter per kernel, resulting in a kernel parameter set. For the three RGB input channels in the first layer and the 8 Gabor parameters we therefore fit to $3 \times 8 = 27$ parameters. We evaluate the best number of components (number of distinct Gaussian distributions) based on the Bayesian Information Criterion (Schwarz, 1978) and use 4 components for the first layer of CORnet-S. To generate new kernels we sample a kernel parameter set from this mixture distribution and apply them to the described Gabor function that spans the weight values.
+
+# B.2 COMPRESSING BATCHNORM LAYERS
+
+In addition to convolutional layers, models consist of several Batchnorm layers, which contain a learnable bias and weight term. To initialize these terms, we fit a normal distribution per weight and bias vector of the trained values and sample from this distribution. Note that BatchNorm layers contain running average means and standard deviations for normalization purposes, which are applied at validation time. Those terms are set to zero when no training has happened, but cause score changes once the model has processed the dataset. During training the mean and standard deviation of the current batch are used instead.
+
+# B.3 ALTERNATIVE APPROACHES
+
+We have explored a variety of weight compression methods applied to different layers and evaluate their performance "at birth" without training and when trained with critical training.
+
+Figure 7 shows brain predictivities of several alternative compression methods implemented as follows:
+
+- WC Weight compression approach with clustering as described in Section 4, using a Gabor prior approach for the first layer, noisy cluster sampling for convolutional layers and fitted normal distributions for Batchnorm layers (4,166 parameters for CORnet-S).
+
+
+Figure 7: Alternative weight compression methods Comparison of different initializations that compress weights, "at birth" i.e. without any training (gray) and after training critical layers (shades of blue) for 6 epochs. Our best clustering-based approach WC achieved similar results as the Mixture Gaussian approach $(\sim 3$ percent points mean difference) but leads to more diverse clusters. Performance drops when solely sampling weights from kernel based normal distributions (Kernel normal) and additionally disabling the Gabor prior (No Gabor prior)
+
+- Mixture Gaussian Instead of sampling weights from cluster centers, this approach uses multidimensional distributions for convolutional layers with kernel size $>1$ . We fit a mixture Gaussian distribution per layer to the weights of a channel over all kernels. To sample a new kernel, we sample individual channels from this distribution. For convolutional layers with a kernel size of 1 we draw weights from a normal distribution adjusted per kernel as described in the next item (428,114 parameters for CORnet-S).
+- Kernel normal All weights are sampled based on normal distributions. We fit mean and standard deviation to the weights of one trained kernel and resample a new kernel from this distribution. We do this separately for every kernel to generate a whole layer. This approach is similar to the BatchNorm sampling method where we compress BatchNorm weight and bias terms instead of kernels (433,735 parameters for CORnet-S).
+- No Gabor prior To evaluate the importance of the Gabor prior we use the Kernel normal model and apply the same normal distribution approach to layer one instead of Gabor sampling. Performance drops by 13 percent points without training, and by 9 percent points after critical training. (20,026 parameters for CORnet-S)
+
+We speculate that increasing the number of clusters would follow logarithmic growth with respect to the performance of the model: i.e. a small number of clusters can already yield useful wiring (as explored here), while adding more clusters will have a positive effect but with decreasing effect size.
+
+# B.4 BIOLOGICAL PLAUSIBILITY
+
+Weight Compression (WC)'s cluster-based initialization generates an "at-birth" network that already captures some useful aspects of the visual inputs in a compressed manner and allows the system to learn faster. The way that these clusters are determined (from a previously trained network) is not biologically plausible and does not correspond to any evolutionary mechanism we are aware of. However, independent of how these clusters are determined, WC shows that it is possible to encode certain priors about a system's wiring diagram in a very compressed manner. Evolution also acquired aspects of the visual inputs (with a different strategy) and encoded them in the genome in a lower information regime.
+
+For example, we know that there are multiple neuro-developmental mechanisms, such as spontaneous retinal waves and axon guidance cues, that significantly shape the architecture and function of the visual system requiring no (or very little) visual experience ((Huberman et al., 2008)). These mechanisms depend on a relatively small number of proteins encoded in a genome and give rise to a highly complex pattern of at-birth synaptic connectivity representing a very large compression of information.
+
+
+Figure 8: Detailed analysis of $WC + CT$ . A When reducing the number of supervised synaptic updates, adding critical training (dark grey) and adding weight compression initialization (dark blue) both improve scores in brain predictivity at the same number of supervised synaptic updates, in comparison to a model with standard initialization and training all weights (bright blue). B Brain predictivities for the $WC + CT$ model when trained with a range of epochs and labeled images. C Same as B, but for a standardly initialized $(KN)$ model training all weights.
+
+
+
+
+
+# C WC INITIALIZED AND CT TRAINED MODEL ANALYSIS
+
+Our best model $WC + CT$ benefits from a combination of improved initialization through weight compression, and critical training. Figure 8A shows models with standard initialization and training all weights, but with fewer supervised updates (cf. Figure 1), models that only train down-sampling layers $(CT)$ , and models that combine critical training with weight compression $(WC + CT)$ . A model initialized with weight compression achieves (only $WC$ ) $54\%$ brain predictivity score with 0 supervised synaptic updates. Figure 8B and C show detailed brain predictivity scores, relative to a fully trained model, for models initialized and trained with $WC + CT$ (B) and models initialized with standard Kaiming Normal and training all weights (C) when trained with a range of epochs and labeled images. The specific benchmark scores when either training with all labeled images for a varying number of epochs (Figure 9A) or when training with fewer labeled images until convergence (Figure 9B) show the benchmarks of early visual achieve the best results, relative to a fully trained model. The V1 score is identical over all training states, since we do not train the V1 area.
+
+Notably, ImageNet performance of these networks seems to not be predictive of their brain predictivity, since even untrained networks with at-chance ImageNet performance correspond reasonably well to e.g. V1 (Figures 1 and 2). New normative tasks might be required to explain these results, such as model robustness to image corruptions (Dapello et al., 2020).
+
+# D DISSECTING TRAINING REDUCTIONS - DETAILS
+
+# D.1 TRANSFER TO RESNET AND MOBILENET
+
+To show the generalization of our approach we applied the weight compression methods to a ResNet-50 (He et al., 2016) and a MobileNet (Howard et al., 2017) (version 1, multiplier 1.0, image size 224) architecture. We do not regenerate sampling distributions or clusters based on the new architectures trained weights, but used the CORnet-S based distributions to sample new weights for the different architectures. Since CORnet-S is inspired by ResNet modules, we applied our critical training approach by training all conv3 layers (equivalent down sampling layers) of ResNet50. For MobileNet we explored various layer mappings. When training only the very few layers that result in reduced feature size, which are implemented as depthwise separable convolutional layers and appear three times overall, performance performance dropped close to random. Those layers however are mapped to CORnet-S' conv2 layers due to their $3 \times 3$ kernels whereas critical training in CORnet-S trains conv3 down-sampling layers with a kernel size of $1 \times 1$ . To transfer our critical training approach, we therefore additionally train the $1 \times 1$ MobileNet layers corresponding to conv3. This training version allows for more training but still reduces the amount of trained parameters by $43\%$ while maintaining $78\%$ of the original score. For both transfer methods we initialize the
+
+
+Figure 9: Individual brain benchmark scores for $WC + CT$ model A Individual brain predictivity scores of $WC + CT$ models trained with a range of epochs on all images. These models score especially high on V1, V2 and V4 already after one epoch in comparison to a model with standard initialization training all weights. IT and Behavior benchmarks continuously improve over later epochs as well but fall short of a fully trained model. B Like A, but with models trained until convergence on different numbers of labeled images, up to the full dataset of 1.28M images (rightmost points). As in A we see $>80\%$ V1, V2 and V4 scores with only 100,000 images. For comparable IT and behavioral scores, more images are required.
+
+
+
+first layer using the Gabor method based on CORnet-S's mixture-of-Gaussian distribution. Since the Gabor function is scalable we can produce Gabor kernels of varying size. Furthermore we disable BatchNorm biases and weights in all transfer models by freezing them to default values. We found that transferring those distributions on new architectures harms brain predictivity scores. Nevertheless, the BatchNorm layers still normalize activations by applying the running average and standard deviation.
+
+# D.2 COMPARISON OF TECHNIQUES TO REDUCE SUPERVISED SYNAPTIC UPDATES (FIG. 5B)
+
+To analyse the relative contributions of Weight Compression and Critical Training we compare brain predictivity scores of different models in Figure 5B:
+
+- KN A model initialized by standard Kaiming Normal initialization without training.
+- WC A model initialized by our Weight Compression initialization, described in Section 4, without training.
+- KN+CT The $KN$ -initialized model trained with Critical Training until convergence, i.e. three downstream layers and the decoder are trained and all other layers remain unchanged.
+- WC+CT The WC-initialized model with Critical Training. V1 scores do not change because weights in the V1 model area are all frozen.
+
+# E TRAINING DETAILS
+
+We used PyTorch 0.4.1 and trained the model using the ImageNet 2012 training set Deng et al. (2009). We used a batch size of 256 images and trained on a QuadroRTX6000 GPU until convergence. We start with a learning rate of 0.1 and decrease it four times by a factor of ten when training loss does not decrease over a period of three epochs. For optimization, we use Stochastic Gradient Descent with a weight decay 0.0001, momentum 0.9, and a cross-entropy loss between image labels and model logits. We trained all models with these settings except the standard Mobilenet, where we used the pretrained tensorflow model. Since the number of epochs for this model are not clearly stated, we use the published value of 100 training epochs Howard et al. (2017). The training time of a full CORnet-S with standard Imagenet dataset for 43 epochs is $\sim 2.5$ days. All variations with less weights/images/epochs trained in shorter time. Reference models trained for 4 days at most under
+
+the described settings. If not further specified, we show results of one training run. When showing error bars we used seeds 0, 42 and 94.
+
+Code to reproduce our analyses from scratch, including the framework for weight compression and critical training, as well as pre-trained models, will be made available through GitHub.
\ No newline at end of file
diff --git a/wiringupvisionminimizingsupervisedsynapticupdatesneededtoproduceaprimateventralstream/images.zip b/wiringupvisionminimizingsupervisedsynapticupdatesneededtoproduceaprimateventralstream/images.zip
new file mode 100644
index 0000000000000000000000000000000000000000..bd67346dfaa7a90caf6c79b6046b9207f966e533
--- /dev/null
+++ b/wiringupvisionminimizingsupervisedsynapticupdatesneededtoproduceaprimateventralstream/images.zip
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:267aafdd76bf50be92244c02598cac8a57577c2a46935726fc5b5eb0da1f4e32
+size 480128
diff --git a/wiringupvisionminimizingsupervisedsynapticupdatesneededtoproduceaprimateventralstream/layout.json b/wiringupvisionminimizingsupervisedsynapticupdatesneededtoproduceaprimateventralstream/layout.json
new file mode 100644
index 0000000000000000000000000000000000000000..7cc246260c23d7eebd48435139f3833a534ef06b
--- /dev/null
+++ b/wiringupvisionminimizingsupervisedsynapticupdatesneededtoproduceaprimateventralstream/layout.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:37429cf4512a51e48bf037f29e9c6be67fd56ec93886a26d6261b2d91052c6e9
+size 486270